| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package GM.Commands.PrintNPCInfo  | 
| #  | 
| # @todo:ÏÔʾNPCÊôÐÔÐÅÏ¢  | 
| # @author hxp  | 
| # @date 2017-03-25  | 
| # @version 1.0  | 
| #  | 
| # ÏêϸÃèÊö: ÏÔʾNPCÊôÐÔÐÅÏ¢  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #"""Version = 2017-03-25 11:00"""  | 
| #-------------------------------------------------------------------------------  | 
|   | 
| import IPY_GameWorld  | 
| import GameWorld  | 
| import GameObj  | 
| import NPCCommon  | 
| import SkillCommon  | 
| import PrintBuff  | 
| import GMCommon  | 
| import FamilyRobBoss  | 
| import ShareDefine  | 
|   | 
| import random  | 
| #---------------------------------------------------------------------  | 
| ##²é¿´µãÑ¡µÄNPC³ðºÞÁÐ±í  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param cmdList GMÃüÁî²ÎÊýÁÐ±í  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks GMÃüÁî  | 
| def OnExec(curPlayer, cmdList):  | 
|     #---»ñµÃµãÑ¡µÄNPC---  | 
|       | 
|     if not cmdList:  | 
|         GameWorld.DebugAnswer(curPlayer, "¸ñʽPrintNPCInfo objID")  | 
|         return  | 
|       | 
|     objID = cmdList[0]  | 
|     isRefresh = cmdList[1] if len(cmdList) > 1 else 0  | 
|     curNPC = GameWorld.GetObj(objID, IPY_GameWorld.gotNPC)  | 
|     if not curNPC:  | 
|         GameWorld.DebugAnswer(curPlayer, "objID(%s) ´íÎó ÕÒ²»µ½¶ÔÓ¦NPC" % objID)  | 
|         return  | 
|     if isRefresh:  | 
|         NPCCommon.NPCControl(curNPC).RefreshNPCAttrState()  | 
|       | 
|     npcID = curNPC.GetNPCID()  | 
|     GameWorld.DebugAnswer(curPlayer, "-----------------------%s" % random.randint(0, 100))  | 
|     GameWorld.DebugAnswer(curPlayer, "ObjID: %s, NPCID: %s, %s" % (curNPC.GetID(), npcID, curNPC.GetName()))  | 
|     if FamilyRobBoss.IsHorsePetRobBoss(npcID):  | 
|         strengthenPlayerCnt = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_HorsePetRobBossPlayerCount)  | 
|         GameWorld.DebugAnswer(curPlayer, "±íµÈ¼¶: %s, ³É³¤µÈ¼¶: %s, ²ÎÓëÈËÊý: %s" % (curNPC.GetLV(), curNPC.GetCurLV(), strengthenPlayerCnt))  | 
|     else:   | 
|         GameWorld.DebugAnswer(curPlayer, "±íµÈ¼¶: %s, ³É³¤µÈ¼¶: %s" % (curNPC.GetLV(), curNPC.GetCurLV()))  | 
|     GameWorld.DebugAnswer(curPlayer, "ÉúÃü: %s / %s" % (GameObj.GetHP(curNPC), GameObj.GetMaxHP(curNPC)))  | 
|     GameWorld.DebugAnswer(curPlayer, "¹¥»÷: %s ~ %s" % (curNPC.GetMinAtk(), curNPC.GetMaxAtk()))  | 
|     GameWorld.DebugAnswer(curPlayer, "·ÀÓù: %s" % (curNPC.GetDef()))  | 
|     GameWorld.DebugAnswer(curPlayer, "ÃüÖÐ: %s,  ÉÁ±Ü: %s" % (curNPC.GetHit(), curNPC.GetMiss()))  | 
|     GameWorld.DebugAnswer(curPlayer, "ÕæÊµÉ˺¦: %s,  ÕæÊµµÖÓù: %s" % (curNPC.GetIceAtk(), curNPC.GetIceDef()))  | 
|     GameWorld.DebugAnswer(curPlayer, "¹Ì¶¨É˺¦: %s" % (NPCCommon.GetFinalHurt(curNPC)))  | 
|     GameWorld.DebugAnswer(curPlayer, "ËÙ¶È: %s" % (curNPC.GetSpeed()))  | 
|     GameWorld.DebugAnswer(curPlayer, "Õ½Á¦: %s" % (NPCCommon.GetSuppressFightPower(curNPC)))  | 
|     PrintNPCBuff(curPlayer, curNPC)  | 
|     return  | 
|   | 
| def PrintNPCBuff(curPlayer, curNPC):  | 
|     for buffType in range(IPY_GameWorld.bfBuff, IPY_GameWorld.btBufMax):  | 
|         if buffType in [IPY_GameWorld.bfIncBuff, IPY_GameWorld.btPassiveBuf, IPY_GameWorld.bfEquipBuff, IPY_GameWorld.bfMapBuff]:  | 
|             continue  | 
|         PrintBuffState(curPlayer, curNPC, buffType)  | 
|     return  | 
|   | 
| def PrintBuffState(curPlayer, tagObj, buffType):  | 
|     buffTuple = SkillCommon.GetBuffManagerByBuffType(tagObj, buffType)  | 
|       | 
|     if buffTuple == ():  | 
|         return  | 
|       | 
|     buffState = buffTuple[0]  | 
|     if not buffState.GetBuffCount():  | 
|         return  | 
|       | 
|     GameWorld.DebugAnswer(curPlayer, "---------" + GMCommon.BuffNameList[buffType])  | 
|     for i in range(0, buffState.GetBuffCount()):  | 
|         curBuff = buffState.GetBuff(i)  | 
|         curSkill = curBuff.GetSkill()  | 
|         if curSkill.GetSkillID() == 0:  | 
|             continue  | 
|           | 
|         name = curSkill.GetSkillName()  | 
|         remainTime = curBuff.GetRemainTime() / 1000  | 
|         remainTimeStr = PrintBuff.__GetRemainTimeStr(remainTime)  | 
|         GameWorld.DebugAnswer(curPlayer, "%s,ID=%s,TypeID=%s,%s"   | 
|                               % (name, curSkill.GetSkillID(), curSkill.GetSkillTypeID(), remainTimeStr))  | 
|         effectStr = ""  | 
|         for j in range(0, curSkill.GetEffectCount()):  | 
|             curEffect = curSkill.GetEffect(j)  | 
|             effectID = curEffect.GetEffectID()  | 
|             if effectID == 0:  | 
|                 continue  | 
|               | 
|             effectStr += "¼¼ÄÜЧ¹û%s ID = %s" % (j, effectID)  | 
|               | 
|         GameWorld.DebugAnswer(curPlayer, effectStr)  | 
|           | 
|     return  |