| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
|   | 
| ##@package PrintBuff  | 
| # Êä³öÍæ¼ÒÉíÉϵÄbuff  | 
| #  | 
| # @author mark  | 
| # @date 2010-4-23  | 
| # @version 1.4  | 
| #  | 
| # ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ  | 
| # @change: "2010-05-12 18:30" zhengyang Ìí¼Ó×¢ÊÍ  | 
| # @change: "2010-06-07 17:33" adaws GMÃüÁîPrintBuffÔö¼Ó±»¶¯¼¼ÄÜbuff  | 
| # @change: "2010-12-07 12:00" Alee ´òÓ¡ÐÐΪBUFF  | 
| # @change: "2010-12-31 17:00" Alee Ìí¼Ó¹ÜÀíÆ÷¸ü¸Ä  | 
| #  | 
| # Ä£¿éÏêϸ˵Ã÷  | 
| # ½Ó¿ÚС֪ʶ£ºFindNPCByID »ñµÃ»¹ÊǸ¸ÀàµÄNPCʵÀý£¬Òª¾ßÌåת»»Îª¾ßÌåµÄNPCʵÀý£¬²Å¿ÉÒÔÓ¦ÓÃÏàÓ¦½Ó¿Ú  | 
|   | 
| """Version = 2010-12-31 17:00"""  | 
|   | 
|   | 
| import IPY_GameWorld  | 
| import GMCommon   | 
| import GameWorld  | 
| import SkillCommon  | 
|   | 
| ## ´òÓ¡buffState  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param buffState ÊÇbuffµÄ¼¯ºÏ£¬¶øÒ»¸öObjÓÖ¾ßÓÐn¸öBuffState  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def PrintBuffState(curPlayer, tagObj, buffType):  | 
|     GameWorld.DebugAnswer(curPlayer, "---------" + GMCommon.BuffNameList[buffType])  | 
|     buffTuple = SkillCommon.GetBuffManagerByBuffType(tagObj, buffType)  | 
|       | 
|     if buffTuple == ():  | 
|         return  | 
|     buffState = buffTuple[0]  | 
|       | 
|     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 = __GetRemainTimeStr(remainTime)  | 
|         GameWorld.DebugAnswer(curPlayer, "%s,ID=%s,TypeID=%s,%s,Layer=%s"   | 
|                               % (name, curSkill.GetSkillID(), curSkill.GetSkillTypeID(), remainTimeStr, curBuff.GetLayer()))  | 
|         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  | 
|       | 
| def __GetRemainTimeStr(remainTime):  | 
|     day = 3600 * 24  | 
|     days = remainTime / day  | 
|     remainTime -= (days * day)  | 
|     hours = remainTime / 3600  | 
|     remainTime -= (hours * 3600)  | 
|     minutes = remainTime / 60  | 
|     seconds = remainTime % 60  | 
|     remainTimeStr = ""  | 
|     if days:  | 
|         remainTimeStr = "%sÌì" % (days)  | 
|     if hours:  | 
|         remainTimeStr = "%s%sʱ" % (remainTimeStr, hours)  | 
|     if minutes:  | 
|         remainTimeStr = "%s%s·Ö" % (remainTimeStr, minutes)  | 
|     if seconds:  | 
|         remainTimeStr = "%s%sÃë" % (remainTimeStr, seconds)  | 
|     return remainTimeStr  | 
|   | 
| ## GMÃüÁîÖ´ÐÐÈë¿Ú  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param list ²ÎÊýÁбí [npcID]  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnExec(curPlayer, cmdList):  | 
|     GameWorld.DebugAnswer(curPlayer, "¿ªÊ¼´òÓ¡buffÁбí,ÈçÎÞ´òÓ¡,¼ÈÎÞBuff")  | 
|     curTagPlayer = None  | 
|       | 
|     if len(cmdList) == 0 or cmdList[0] == 0:  | 
|         curTagPlayer = curPlayer  | 
|     else:  | 
|         curTagPlayer = GameWorld.GetPlayerManager().FindPlayerByID(cmdList[0])  | 
|       | 
|     if curTagPlayer != None:  | 
|         GameWorld.DebugAnswer(curPlayer, "Íæ¼ÒÐÅÏ¢£º%s" % (curTagPlayer.GetID()))  | 
|         if len(cmdList) > 1:  | 
|             buffTypeStr = ""  | 
|             for i, buffName in enumerate(GMCommon.BuffNameList):  | 
|                 buffTypeStr += "%s:%s," % (i, buffName)  | 
|             GameWorld.DebugAnswer(curPlayer, "%s" % buffTypeStr)  | 
|             buffType = cmdList[1]  | 
|             PrintBuffState(curPlayer, curTagPlayer, buffType)  | 
|             return  | 
|         for buffType in range(IPY_GameWorld.bfBuff, IPY_GameWorld.btBufMax):  | 
|             PrintBuffState(curPlayer, curTagPlayer, buffType)  | 
|         return  | 
|   | 
|     #Êä³öNPCBuff  | 
|     curNPC = GameWorld.GetNPCManager().FindNPCByID(cmdList[0])  | 
|   | 
|     if curNPC == None:  | 
|         GameWorld.DebugAnswer(curPlayer, "error²ÎÊý£º²»ÊÇNPCID Ò²²»ÊÇÍæ¼ÒID")  | 
|         return  | 
|       | 
|     curNPC = GameWorld.GetObjDetail(curNPC)  | 
|     GameWorld.DebugAnswer(curPlayer, "NPCÐÅÏ¢ %s %s" % (curNPC.GetName(), curNPC.GetID()))  | 
|       | 
|     for buffType in GMCommon.GetNPCBuffTypeList(curNPC):  | 
|         PrintBuffState(curPlayer, curNPC, buffType)  |