| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #  | 
| # @todo: ÍÑ»ú¹Ò  | 
| #  | 
| # @author: Alee  | 
| # @date 2017-12-28 ÏÂÎç05:43:24  | 
| # @version 1.0  | 
| #  | 
| # @note:   | 
| #  | 
|     # 1.»ñÈ¡ÍÑ»ú¹ÒÍæ¼ÒÊý¾Ý--GameLog  | 
|         # Õý³£ºÅÏÂÏß³¬¹ý3·ÖÖÓ£¬ÓÐÍÑ»ú¹Òʱ¼ä²¢ÇÒÍÑ»ú¹Ò״̬·Ç2µÄÇé¿ö  | 
|         # 1ΪÍÑ»ú¹ÒʱÒì³£µôÏߣ¬Ó¦¿ÉÁ¢¼´ÍÑ»úÖØÁ¬£¬Ä¿Ç°¶¼°´¶ÏÏß3·ÖÖÓºóÖØÁ¬  | 
|         # 2ΪÍÑ»ú¹ÒµÄʱºò±»ÈËɱËÀ£¬µÈ´ýÍæ¼ÒÖ÷¶¯µÇ½ºóÖØÐÂÏÂÏß´¥·¢Âß¼  | 
|     # 2.³õʼ»¯ÍÑ»ú¹ÒÍæ¼ÒµÄrobot¼ÓÈëmgr  | 
|     # 3.Ä£ÄâtokenµÇ¼--InterfaceData  | 
|     # 4.µÇ¼ºóÔÚ0107loadmapok°üǰ·¢ËÍÍÑ»úµÇ¼ÏûÏ¢£¬ÓÃÓÚÇø·ÖÍæ¼ÒÕæÊµµÇ¼  | 
|     # 5.ÍÑ»ú¹ÒÍæ¼Ò·À³ÁÃÔÂß¼ÐÞÕý£¬¸ù¾Ý4Ìõ¼þ  | 
|     # 6.ÔÚÏßÈËÊýÇø·ÖÍÑ»ú¹ÒÍæ¼Ò  | 
|     # 7.03 10 Í˳ö¸±±¾#tagCExitFBµ½¶ÔÓ¦¹Ò»úµã  | 
|     # 8.ÀûÓÃCountryLastWeekHornor×ֶοØÖƱ£´æÊý¾ÝÊÇ·ñÊÇÕæÊµÏÂÏß  | 
| #---------------------------------------------------------------------  | 
|       | 
| import GameWorld  | 
| import ChConfig  | 
| import PlayerControl  | 
| import IPY_GameWorld  | 
| import FunctionNPCCommon  | 
| import NPCCommon  | 
| import ItemControler  | 
| import FBCommon  | 
| import ItemCommon  | 
| import ShareDefine  | 
| import PlayerEquipDecompose  | 
| import GameFuncComm  | 
| import time  | 
| import NetPackCommon  | 
| import ChPyNetSendPack  | 
| import ChPlayer  | 
| import SkillCommon  | 
| import PlayerBillboard  | 
| import PlayerActivity  | 
| import PlayerSuccess  | 
| import EventShell  | 
| import PlayerVip  | 
| import IpyGameDataPY  | 
| import math  | 
| import PassiveBuffEffMng  | 
| import PlayerPet  | 
| import PlayerGeTui  | 
| import ChEquip  | 
| import QuestCommon  | 
| import random  | 
| import GameObj  | 
|   | 
| Def_EatSpace = 5    # µÍÓÚX¸ñ×Ô¶¯ÍÌÊÉ  | 
|   | 
|   | 
| def DoTJGOpen(curPlayer):  | 
|     ##ÍÑ»ú¹Ò¹¦ÄÜ¿ªÆô ÔùËÍÍÑ»úʱ¼ä  | 
|     addTime = IpyGameDataPY.GetFuncCfg('TJGGiftTime')  | 
|     AddTJGTime(curPlayer, addTime)  | 
|     GameWorld.DebugLog('ÍÑ»ú¹Ò¹¦ÄÜ¿ªÆô ÔùËÍÍÑ»úʱ¼ä %s'%addTime, curPlayer.GetID())  | 
|     return  | 
|   | 
| #===============================================================================  | 
| # //B2 01 ÍÑ»ú¹Ò״̬ # tagCMLoginState  | 
| # struct    tagCMLoginState  | 
| # {  | 
| #    tagHead         Head;  | 
| #    BYTE        State;     // 0Õý³£µÇ¼£¬1ÍÑ»úµÇ¼£¬2ÍÑ»úµÇ¼ËÀÍö  | 
| # };  | 
| #===============================================================================    | 
| def OnTJGState(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     if curPlayer.GetIP() != "127.0.0.1":  | 
|         return  | 
|     curPlayer.SetState(clientData.State)  | 
|       | 
|     # ÉèÖÃÍÑ»úµÇ¼ʱµÄµÈ¼¶, ÉÏÏß֪ͨÇå¿Õ£¬ Ã»Çå¿Õ˵Ã÷¶à´ÎÍÑ»ú¹ÒµÇ¼ Ê¹Óþɵȼ¶  | 
|     notifyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_LV, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     if not notifyLV:  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGNotify_LV, curPlayer.GetLV(), ChConfig.Def_PDictType_TJGNotify)  | 
|       | 
|     # ÉÏÏßÇÐÓÅÏȼ¶¸ßµÄÊØ»¤  | 
|     ChangeGuard(curPlayer, tick)  | 
|     GameWorld.DebugLog("OnTJGState:%s"%clientData.State)  | 
|     return  | 
|   | 
|   | 
| # Çл»ÊØ»¤  | 
| def ChangeGuard(curPlayer, tick):  | 
|     return #а汾²»ÐèÒªÇл»  | 
| #    # ¼ì²é¹ý±³°üÖÐÎÞÊØ»¤Ôò²»ÔÙÖ´ÐÐ  | 
| #    if curPlayer.GetDictByKey("AutoCGuardID") == 1:  | 
| #        return  | 
| #      | 
| #    curGuardID = 0  # ×°±¸µÄÊØ»¤ID  | 
| #    itemIDList = IpyGameDataPY.GetFuncEvalCfg('AutoUseGuardian', 1)  | 
| #    guardItem = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip).GetAt(ShareDefine.retGuard1)  | 
| #    # 1¡£ ÊØ»¤´æÔÚ£¬ÅжÏÊÇ·ñ×îÓÅÏÈÊØ»¤  | 
| #    if ItemCommon.CheckItemCanUse(guardItem) and ItemCommon.CheckItemCanUseByExpireTime(guardItem):  | 
| #        curGuardID = guardItem.GetItemTypeID()  | 
| #        if curGuardID == itemIDList[0]:  | 
| #            # ×î¸ßÓÅÏȼ¶  | 
| #            return  | 
| #        if curPlayer.GetDictByKey("AutoCGuardID") == 2:  | 
| #            # µ±Ç°±³°ü×î¸ß  | 
| #            return  | 
| #          | 
| #  | 
| #    findItemList = []  | 
| #    curPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)  | 
| #      | 
| #    # ÕÒµ½±³°üÖÐÓÅÏȼ¶×î¸ßµÄÊØ»¤ÎïÆ·  | 
| #    for i in range(0, curPack.GetCount()):  | 
| #        item = curPack.GetAt(i)  | 
| #          | 
| #        if not ItemCommon.CheckItemCanUse(item):  | 
| #            continue  | 
| #          | 
| #        if item.GetItemTypeID() not in itemIDList:  | 
| #            continue  | 
| #      | 
| #        if not ItemCommon.CheckItemCanUseByExpireTime(item):  | 
| #            # ±³°üÓв»¹ýÆÚµÄÎïÆ·  | 
| #            continue  | 
| #          | 
| #        findItemList.append(item)  | 
| #      | 
| #    if not findItemList:  | 
| #        curPlayer.SetDict("AutoCGuardID", 1)    # ÉèÖÃÎÞ¿ÉÌæ»»µÄ±êÖ¾  | 
| #        return  | 
| #          | 
| #    findItemList.sort(cmp=SortGuard)  | 
| #    if curGuardID in itemIDList and itemIDList.index(curGuardID) <= itemIDList.index(findItemList[0].GetItemTypeID()):  | 
| #        # µ±Ç°×°±¸×î¸ß£¬¼õÉÙ±éÀú  | 
| #        curPlayer.SetDict("AutoCGuardID", 2)  | 
| #        return  | 
| #      | 
| #  | 
| #    #---Ö´ÐÐÍæ¼Ò»»×°Âß¼---  | 
| #    ChEquip.DoPlayerEquipItem(curPlayer, findItemList[0], ItemCommon.GetEquipPackIndex(findItemList[0]), tick)  | 
| #    curPlayer.SetDict("AutoCGuardID", 0)  | 
|     return  | 
|   | 
|   | 
| # ÓÅÏȼ¶¸ßµÄ Ê±Ð§³¤µÄÅÅÇ°Ãæ  | 
| def SortGuard(item1, item2):  | 
|     itemIDList = IpyGameDataPY.GetFuncEvalCfg('AutoUseGuardian', 1)  | 
|     itemID1 = item1.GetItemTypeID()  | 
|     itemID2 = item2.GetItemTypeID()  | 
|       | 
|     # Î´Ê¹ÓÃʱ¼äΪ0, ´´½Çʱ¼äÔ½´ó˵Ã÷ʹÓõÄʱ¼äÔ½ÉÙ  | 
|     itemTime1 = 2000000000 if not item1.GetUserAttr(ShareDefine.Def_IudetCreateTime) else item1.GetUserAttr(ShareDefine.Def_IudetCreateTime)  | 
|     itemTime2 = 2000000000 if not item2.GetUserAttr(ShareDefine.Def_IudetCreateTime) else item2.GetUserAttr(ShareDefine.Def_IudetCreateTime)  | 
|     if itemID1 == itemID2:  | 
|         return cmp(itemTime2, itemTime1)  | 
|       | 
|     return cmp(itemIDList.index(itemID1), itemIDList.index(itemID2))  | 
|   | 
| #===============================================================================  | 
| # //B2 02 ÊÓÒ°Ëõ·Å #tagCMSightZoom  | 
| # struct    tagCMSightZoom  | 
| # {  | 
| #    tagHead         Head;  | 
| #    BYTE        Sight;   // ÊÓÒ°Ëõ·Å£¬ÓÃÓÚÍÑ»ú¹Ò²»³¬¹ý×î´óÊÓÒ°£¬¿ÕÏÐ״̬Ϊ0£¬±»Íæ¼Ò¹¥»÷»Ö¸´ÊÓÒ°  | 
| # };  | 
| #===============================================================================  | 
| def OnSightZoom(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     if curPlayer.GetIP() != "127.0.0.1":  | 
|         return  | 
|     curPlayer.SetSight(min(ChConfig.Def_PlayerSight_Default, clientData.Sight))  | 
|     GameWorld.DebugLog("OnSightZoom:%s"%clientData.Sight)  | 
|       | 
|     return  | 
|   | 
| # ÐèÒª´¦ÀíµÄµã£¬·À³ÁÃÔ  | 
| def GetIsTJG(curPlayer):  | 
|     if curPlayer.GetState() > 0:  | 
|         return True  | 
|     return False  | 
|   | 
|   | 
| #===============================================================================  | 
| # //B2 03 ÉèÖÃÍÑ»ú¹ÒNPC # tagCMTJGnpc  | 
| #   | 
| # struct    tagCMTJGnpc  | 
| # {  | 
| #    tagHead         Head;  | 
| #    DWORD        NPCID;    // ÍÑ»ú¹Òµã  | 
| # };  | 
| #===============================================================================  | 
| def OnTJGNPC(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     if curPlayer.GetIP() != "127.0.0.1":  | 
|         return  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_TJGNPC, clientData.NPCID)  | 
|       | 
|     GameWorld.DebugLog("%s---OnTJGNPC:%s"%(curPlayer.GetName(),clientData.NPCID))  | 
|     return  | 
|   | 
|   | 
| #===============================================================================  | 
| # Def_PDictType_TJGNotify  | 
| # # ÍÑ»ú¹ÒÀàÐÍ֪ͨ½á¹û  | 
| # Def_PDictType_TJGNotify_Exp1 = "TJGNExp1"   #¾Ñé  | 
| # Def_PDictType_TJGNotify_Exp2 = "TJGNExp2"   #³¬¹ýE²¿·Ö  | 
| # Def_PDictType_TJGNotify_Time = "TJGNTime"   #ʹÓÃʱ¼ä  | 
| # Def_PDictType_TJGNotify_EatPurple = "TJGNEatP"   #ÍÌÊɵÄ×Ï×°ÊýÁ¿  | 
| # Def_PDictType_TJGNotify_Purple = "TJGNPurple"   #»ñµÃ×Ï×°ÊýÁ¿  | 
| # Def_PDictType_TJGNotify_Orange = "TJGNOrg"   #»ñµÃ³È×°ÊýÁ¿  | 
| #===============================================================================  | 
|   | 
| def NoteTJGExp(curPlayer, exp):  | 
|     notifyTime1 = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Exp1, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     notifyTime2 = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Exp2, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|       | 
|     totalExp = notifyTime2 * ChConfig.Def_PerPointValue + notifyTime1 + exp  | 
|       | 
|     curExp = totalExp % ChConfig.Def_PerPointValue  | 
|     expPoint = totalExp / ChConfig.Def_PerPointValue  | 
|       | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGNotify_Exp1, curExp,  | 
|                                        ChConfig.Def_PDictType_TJGNotify)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGNotify_Exp2, expPoint,  | 
|                                        ChConfig.Def_PDictType_TJGNotify)  | 
|     return  | 
|   | 
| def NoteTJGTime(curPlayer, times):  | 
|     notifyTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Time, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGNotify_Time,   | 
|                                        notifyTime+times, ChConfig.Def_PDictType_TJGNotify)  | 
|       | 
| def NoteEquip(curPlayer, itemColor):  | 
|     if itemColor == ShareDefine.Def_Item_Color_Purple:  | 
|         count = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Purple, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGNotify_Purple,   | 
|                                            count+1, ChConfig.Def_PDictType_TJGNotify)  | 
|     elif itemColor == ShareDefine.Def_Item_Color_Orange:  | 
|         count = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Orange, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGNotify_Orange,   | 
|                                            count+1, ChConfig.Def_PDictType_TJGNotify)  | 
|       | 
| def NoteItem(curPlayer, itemID, noteCount=1):  | 
|     itemIDList = IpyGameDataPY.GetFuncEvalCfg('OfflinePostItem', 1)  | 
|     if itemID not in itemIDList:  | 
|         return  | 
|     count = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_ItemID%itemID, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGNotify_ItemID%itemID,   | 
|                                        count+noteCount, ChConfig.Def_PDictType_TJGNotify)  | 
|   | 
|       | 
|       | 
| def NoteEatEquip(curPlayer, value, giveCnt):  | 
|     count = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_EatPurple, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGNotify_EatPurple,   | 
|                                        count+value, ChConfig.Def_PDictType_TJGNotify)  | 
|       | 
|     count = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_GiveCnt, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGNotify_GiveCnt,   | 
|                                        count+giveCnt, ChConfig.Def_PDictType_TJGNotify)  | 
| # ¶¨Ê±¼ÆËãÍÑ»ú¹Ò  | 
| def ProcessPlayerTJG(curPlayer, tick):  | 
|     if not GetIsTJG(curPlayer):  | 
|         return  | 
|       | 
|     if GetTJGTime(curPlayer) == 0:  | 
|         return  | 
|       | 
|     if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TJGStartTime) == 0:  | 
|         curPlayer.SetDict(ChConfig.Def_PlayerKey_TJGStartTime, tick)  | 
|         return  | 
|       | 
|       | 
|     calcTimes = IpyGameDataPY.GetFuncCfg('TJG', 2)  | 
|     passTimes = tick - curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TJGStartTime)  | 
|     if passTimes < calcTimes*1000:  | 
|         return  | 
|       | 
|     #ÓÅÏÈÖ´Ðл»ÊØ»¤  | 
|     ChangeGuard(curPlayer, tick)  | 
|     times, finalAddExp = CalcPlayerTJG(curPlayer, tick)  | 
|       | 
|     #PlayerGeTui.TJGEfficiency(curPlayer, times, finalAddExp)  | 
|     #PlayerGeTui.TJGTimeLess(curPlayer)  | 
|     return  | 
|   | 
| def GetTJGTime(curPlayer): return curPlayer.GetHappyPoint()  | 
| def SetTJGTime(curPlayer, tjgTime):  | 
|     tjgTime = max(tjgTime, 0)  | 
|     curPlayer.SetHappyPoint(tjgTime)  | 
|     PlayerControl.SendGameServerRefreshState(curPlayer, IPY_GameWorld.CDBPlayerRefresh_HappyPoint, tjgTime)  | 
|     return  | 
| def AddTJGTime(curPlayer, addTime):  | 
|     maxTime = IpyGameDataPY.GetFuncCfg('TJG', 3)  | 
|     SetTJGTime(curPlayer, min(GetTJGTime(curPlayer) + addTime, maxTime))  | 
|     return  | 
|   | 
| def CalcTJGExp(curPlayer, times, npcData, realmNPCIpyData):  | 
|     lvIpyData = PlayerControl.GetPlayerLVIpyData(curPlayer.GetLV())  | 
|     if not lvIpyData:  | 
|         return 0  | 
|     reExp = lvIpyData.GetReExp()  | 
|     attackEff = lvIpyData.GetAttackEff()  | 
|       | 
|     aMinAtk = curPlayer.GetMinAtk()        # ¹¥»÷·½×îС¹¥»÷  | 
|     aMaxAtk = curPlayer.GetMaxAtk()        # ¹¥»÷·½×î´ó¹¥»÷  | 
|     aSuperHitRate = curPlayer.GetSuperHitRate() # ±©»÷ÂÊ  | 
|     aSuperHit = curPlayer.GetSuperHit() # ±©»÷É˺¦¹Ì¶¨Öµ  | 
|     aIceAtk = curPlayer.GetIceAtk()        # ÕæÊµÉ˺¦  | 
|     aDamagePVE = PlayerControl.GetDamagePVE(curPlayer)     # PVE¹Ì¶¨É˺¦  | 
|     aSkillAtkRate = curPlayer.GetSkillAtkRate()    # ¼¼Äܹ¥»÷Á¦¼Ó³É  | 
|     petMinAtk = PlayerControl.GetPetMinAtk(curPlayer)   #Áé³è×îС¹¥»÷  | 
|     petMaxAtk = PlayerControl.GetPetMaxAtk(curPlayer)   #Áé³è×î´ó¹¥»÷  | 
|     petDamPer = GameObj.GetPetDamPer(curPlayer)   #Áé³èÔö¼ÓÉ˺¦  | 
|     atkSpeed = PlayerControl.GetAtkSpeed(curPlayer) # ¹¥»÷ËÙ¶È  | 
|     aIgnoreDefRate = curPlayer.GetIgnoreDefRate()  # ÎÞÊÓ·ÀÓù±ÈÂÊ  | 
|     aLuckyHit = curPlayer.GetLuckyHitVal()  # »áÐÄÒ»»÷¹Ì¶¨Öµ  | 
|     aLuckyHitRate = curPlayer.GetLuckyHitRate() # »áÐÄÒ»»÷¸ÅÂÊ  | 
|     aBleedDamage = PlayerControl.GetBleedDamage(curPlayer) # Á÷ѪÉ˺¦ Íò·ÖÂÊ  | 
|     aFinalHurt = PlayerControl.GetFinalHurt(curPlayer)     # ×îÖչ̶¨É˺¦  | 
|     aFinalHurtPer = PlayerControl.GetFinalHurtPer(curPlayer)     # ×îÖÕÉ˺¦¼Ó³ÉÍò·ÖÂÊ  | 
|     aFightPower = PlayerControl.GetFightPower(curPlayer) # Õ½Á¦  | 
|     aReFightPower = lvIpyData.GetReFightPower() # µÈ¼¶±í¶ÔÓ¦µÄÕ½Á¦  | 
|     aNPCHurtAddPer = PlayerControl.GetNPCHurtAddPer(curPlayer) #PVE É˺¦¼Ó³ÉÍò·ÖÂÊ  | 
|       | 
|     npcID = npcData.GetNPCID()  | 
|     if realmNPCIpyData:  | 
|         attrDict = NPCCommon.GetNPCStrengthenAttrDict(npcID, realmNPCIpyData.GetLV())  | 
|         npcExp = realmNPCIpyData.GetExp()  | 
|         npcMaxHP = attrDict.get("MaxHP", GameObj.GetHP(npcData))  | 
|         npcCommendFightPower = realmNPCIpyData.GetFireDef()  | 
|         GameWorld.DebugLog("CalcTJGExp realmNPC npcID=%s,npcExp=%s,npcMaxHP=%s,npcCommendFightPower=%s" % (npcID, npcExp, npcMaxHP, npcCommendFightPower))  | 
|     else:  | 
|         npcExp = npcData.GetExp()  | 
|         npcMaxHP = GameObj.GetHP(npcData)  | 
|         npcCommendFightPower = NPCCommon.GetCommendFightPower(npcData)  | 
|         GameWorld.DebugLog("CalcTJGExp npcID=%s,npcExp=%s,npcMaxHP=%s,npcCommendFightPower=%s" % (npcID, npcExp, npcMaxHP, npcCommendFightPower))  | 
|           | 
|     petSkillLV = 1  | 
|     petSkillPer = 10000  | 
|       | 
|     # ³õʼ»¯10¸öΪ0 Ê¹Ó㬱ÜÃâûÓÐÅä±íµ¼Ö±¨´í  | 
|     for i in range(10):  | 
|         locals()["PetSkill%s"%(i+1)] = 0  | 
|       | 
|     curPet = curPlayer.GetPetMgr().GetFightPet()  | 
|     if curPet:  | 
|         curSkill = curPet.GetSkillManager().FindSkillBySkillTypeID(48500)  # Ð´ËÀÒªÕâ¸ö¼¼Äܵĵȼ¶  | 
|         if curSkill:  | 
|             petSkillLV = curSkill.GetSkillLV()  | 
|             petSkillPer = max(curSkill.GetEffect(0).GetEffectValue(0), 10000)  | 
|       | 
|         # ³èÎï±»¶¯¼¼ÄÜ  | 
|         petSkillList = IpyGameDataPY.GetFuncEvalCfg('TJG', 5)  | 
|         petLearnSkillList, petPassiveSkillList = PlayerPet.GetPetLearnSkill(curPlayer)  | 
|         for i in range(len(petSkillList)):  | 
|             locals()["PetSkill%s"%(i+1)] = 1 if petSkillList[i] in petLearnSkillList else 0  | 
|           | 
|       | 
|     # ³õʼ»¯10¸öΪ0 Ê¹Ó㬱ÜÃâûÓÐÅä±íµ¼Ö±¨´í  | 
|     for i in range(10):  | 
|         locals()["skill%s"%(i+1)] = 0  | 
|               | 
|     skillDict = IpyGameDataPY.GetFuncEvalCfg('TJG', 4)  | 
|     skills = skillDict.get(curPlayer.GetJob(), [])  | 
|     for i in range(len(skills)):  | 
|         locals()["skill%s"%(i+1)] = 1 if skills[i] in PassiveBuffEffMng.FindUsePassiveSkills(curPlayer) else 0    | 
|                | 
|     if GameWorld.GetGameWorld().GetDebugLevel():  | 
|         GameWorld.DebugLog("""CalcTJGExp--%s-%s-%s-%s-reExp:%s, attackEff:%s, aMinAtk:%s, aMaxAtk:%s, aSuperHitRate:%s, aSuperHit:%s,  | 
|         aNPCHurtAddPer:%s, aFinalHurtPer:%s,   | 
|         aIceAtk:%s, aDamagePVE:%s, aSkillAtkRate:%s, petMinAtk:%s, petMaxAtk:%s, petDamPer:%s, atkSpeed:%s,  | 
|         aIgnoreDefRate:%s, aLuckyHit:%s, aLuckyHitRate:%s, aBleedDamage:%s, aFinalHurt:%s, npcExp:%s, npcMaxHP:%s, npcCommendFightPower:%s,  | 
|         petSkillLV:%s, petSkillPer:%s, skill:%s, petSkill:%s"""%(curPlayer.GetID(), curPlayer.GetLV(), times, npcID,  | 
|             reExp, attackEff, aMinAtk, aMaxAtk, aSuperHitRate, aSuperHit, aNPCHurtAddPer, aFinalHurtPer,  | 
|             aIceAtk, aDamagePVE, aSkillAtkRate, petMinAtk, petMaxAtk, petDamPer,  | 
|             atkSpeed, aIgnoreDefRate, aLuckyHit, aLuckyHitRate, aBleedDamage, aFinalHurt, npcExp, npcMaxHP, npcCommendFightPower, petSkillLV,  | 
|             petSkillPer, eval("[" +", ".join(["skill%s"%i for i in range(1, 11)]) + "]"),   | 
|             eval("[" +", ".join(["PetSkill%s"%i for i in range(1, 10)]) + "]")))  | 
|       | 
|     # 1. ¾Ñé   | 
|     exp = eval(IpyGameDataPY.GetFuncCompileCfg('TJG', 1))  | 
|     GameWorld.DebugLog("×îÖÕ¾Ñé:%s"%exp)  | 
|     return exp  | 
|   | 
| # ÍÑ»ú¼ÆËã ·µ»ØÕâ´Î¼ÆËãµÄʱ¼äºÍ¾Ñé  | 
| def CalcPlayerTJG(curPlayer, tick):  | 
|     if not GetIsTJG(curPlayer):  | 
|         return 0, 0  | 
|       | 
|     if GetTJGTime(curPlayer) == 0:  | 
|         return 0, 0  | 
|       | 
|     if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TJGStartTime) == 0:  | 
|         curPlayer.SetDict(ChConfig.Def_PlayerKey_TJGStartTime, tick)  | 
|         return 0, 0  | 
|       | 
|     tjgTime = GetTJGTime(curPlayer)  | 
|     passTimes = tick - curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TJGStartTime)  | 
|     curPlayer.SetDict(ChConfig.Def_PlayerKey_TJGStartTime, tick)  | 
|     times = min(passTimes/1000, tjgTime)  | 
|   | 
|     # ¼Ç¼Ã뵥λ  | 
|     NoteTJGTime(curPlayer, times)  | 
|     SetTJGTime(curPlayer, max(tjgTime - times, 0))  | 
|       | 
|     finalAddExp = OnTJGKillNPCByTimes(curPlayer, times)  | 
|       | 
| #    ¸ÄÍÑ»ú¹Ò»úÆ÷ÈËÍ˳ö¶ÓÎéÖ÷¶¯¶Ï¿ª  | 
| #    if GetTJGTime(curPlayer) == 0:  | 
| #        # ÍÑ»ú¹Òʱ¼äÓÃÍêÁË£¬Í˳ö¶ÓÎé  | 
| #        curPlayer.Kick(IPY_GameWorld.disTimeError)  | 
|     return times, finalAddExp  | 
|   | 
| def OnTJGKillNPCByTimes(curPlayer, times):  | 
|     '''¸ù¾ÝÍÑ»úʱ³¤¼ÆËã»÷ɱNPCÏà¹Ø½±ÀøÐÅÏ¢  | 
|     '''  | 
|     finalAddExp = 0  | 
|     npcID = curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_TJGNPC)  | 
|     if not npcID:  | 
|         return finalAddExp  | 
|       | 
|     npcData = GameWorld.GetGameData().FindNPCDataByID(npcID)  | 
|     if not npcData:  | 
|         return finalAddExp  | 
|       | 
|     realmLV = PlayerControl.GetDifficultyRealmLV(PlayerControl.GetRealmDifficulty(curPlayer))  | 
|     realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, realmLV)  | 
|     if realmNPCIpyData:  | 
|         mDef = realmNPCIpyData.GetMDef()  | 
|         npcLV = realmNPCIpyData.GetLV()  | 
|         sp = realmNPCIpyData.GetSP()  | 
|         GameWorld.DebugLog("OnTJGKillNPCByTimes npcID=%s,npcLV=%s,mDef=%s,sp=%s,realmLV=%s" % (npcID, npcLV, mDef, sp, realmLV))  | 
|     else:  | 
|         mDef = npcData.GetMDef()  | 
|         npcLV = npcData.GetLV()  | 
|         sp = npcData.GetSP()  | 
|         GameWorld.DebugLog("OnTJGKillNPCByTimes npcID=%s,npcLV=%s,mDef=%s,sp=%s" % (npcID, npcLV, mDef, sp))  | 
|           | 
|     # 1. ¾Ñé  | 
|     exp = CalcTJGExp(curPlayer, times, npcData, realmNPCIpyData)  | 
|     playerControl = PlayerControl.PlayerControl(curPlayer)  | 
|     if exp > 0:  | 
|         finalAddExp = playerControl.AddExp(exp, ShareDefine.Def_ViewExpType_KillNPC)  | 
|         NoteTJGExp(curPlayer, finalAddExp)  | 
|           | 
|     #GameWorld.DebugLog("PlayrTJG---%s----exp %s %s"%(curPlayer.GetID(), exp,   | 
|     #[times, reExp, attackEff, IpyGameDataPY.GetFuncCfg('TJG', 1)]))  | 
|   | 
|       | 
|     # GetMDef ÓÃÓÚ NPC±»»÷ɱʱ¼äЧÂÊ ºÁÃë  | 
|     if mDef == 0:  | 
|         return finalAddExp  | 
|       | 
|     killCnt = times*1000/mDef  | 
|     if not killCnt:  | 
|         return finalAddExp  | 
|       | 
|     #GameWorld.DebugLog("TJGKillNPC, npcID=%s,times=%s,killCnt=%s" % (npcID, times, killCnt), curPlayer.GetPlayerID())  | 
|       | 
|     # 2.ÎïÆ·  | 
|     OnTJGDropItems(curPlayer, npcID, killCnt)  | 
|     #ÈÎÎñµÀ¾ß  | 
|     OnTJGDropTaskItems(curPlayer, npcLV, killCnt)  | 
|     # VIPɱ¹Ö¼Ó¹¥  | 
|     PlayerVip.DoAddVIPKillLVExp(curPlayer, npcLV, killCnt)  | 
|       | 
|     # SPÖµ  | 
|     PlayerControl.AddZhenQiByKillNPC(curPlayer, sp, killCnt)  | 
|       | 
|     # »÷É±ÌØ¶¨NPC³É¾Í  | 
|     PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KillSpecificNPC, killCnt, [npcID])  | 
|     # ÈÕ³£»î¶¯  | 
|     if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGOnDayEx):  | 
|         if npcLV>=curPlayer.GetLV() - IpyGameDataPY.GetFuncCfg('DailyQuestKillMonster'):  | 
|             PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_KillNPC, killCnt)  | 
|     # »÷ɱÈÎÎñ¹Ö, É±¹ÖÈÕ³£ÒѾûÓÐÁË£¬ÔÝʱÆÁ±Î  | 
|     #for _ in xrange(killCnt):  | 
|     #    EventShell.Event_OnKillByID(curPlayer, npcID)  | 
|     return finalAddExp  | 
|       | 
| # ÍÑ»ú¹ÒµôÂäÎïÆ·´¦Àí  | 
| def OnTJGDropItems(curPlayer, npcID, killCnt):  | 
|     if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TJGPackFullAfterEat):  | 
|         # ÂúÁ˲»ÔÙ¸øÎïÆ·  | 
|         return  | 
|       | 
|     dropIDCountDict, auctionIDList, money = {}, [], 0  | 
|     dropRet = NPCCommon.GetNPCDropInfoTJG(curPlayer, curPlayer.GetMapID(), npcID, killCnt)  | 
|     if dropRet:  | 
|         dropIDCountDict, auctionIDList, money = dropRet  | 
|           | 
|     # 1. ×°±¸Ö»ÄÜ·Ö½â 2.·ÅÈë±³°ü 3.ÂúÔò²»¼ÌÐø¸øÎïÆ·  | 
|     for itemID, dropCount in dropIDCountDict.items():  | 
|         if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem):  | 
|             break  | 
|           | 
|         curItemData = GameWorld.GetGameData().GetItemByTypeID(itemID)  | 
|         if not curItemData:  | 
|             continue  | 
|           | 
|         isAuctionItem = itemID in auctionIDList  | 
|         itemControl = ItemControler.PlayerItemControler(curPlayer)  | 
|           | 
|         ## ×°±¸ÎïÆ· °×À¶Ö±½Ó»»ËãÍÇ®  | 
|         #=======================================================================  | 
|         # if curItemData.GetType() in ChConfig.Def_EquipItemType_TJGAutoEat:  | 
|         #    if curItemData.GetItemColor() in [ShareDefine.Def_Item_Color_White, ShareDefine.Def_Item_Color_Blue]:  | 
|         #        money += curItemData.GetSilverPrice() * dropCount  | 
|         #        continue  | 
|         #=======================================================================  | 
|               | 
|         ## ×°±¸Ò»¼þ¼þ¸ø  | 
|         if ItemCommon.GetIsEquip(curItemData):  | 
|             for _ in xrange(dropCount):  | 
|                 curItem = ItemControler.GetOutPutItemObj(itemID, 1, isAuctionItem, curPlayer=curPlayer)  | 
|                 if not curItem:  | 
|                     continue  | 
|                 if not itemControl.PutInItem(IPY_GameWorld.rptItem, curItem, event=[ChConfig.ItemGive_TJGDropItem, False, {}]):  | 
|                     curItem.Clear()  | 
|                     break  | 
|                 #¼Ç¼×ϳÈ×°ÊýÁ¿ÓÃÓÚ֪ͨ  | 
|                 NoteEquip(curPlayer, curItemData.GetItemColor())  | 
|         else:  | 
|             curItem = ItemControler.GetOutPutItemObj(itemID, dropCount, isAuctionItem, curPlayer=curPlayer)  | 
|             if not curItem:  | 
|                 continue  | 
|               | 
|             if not itemControl.PutInItem(IPY_GameWorld.rptItem, curItem, event=[ChConfig.ItemGive_TJGDropItem, False, {}]):  | 
|                 curItem.Clear()  | 
|                 break  | 
|             # ²¹³ä¼Ç¼ָ¶¨ÎïÆ·  | 
|             NoteItem(curPlayer, itemID, dropCount)  | 
|               | 
|     # 10000´Î¼ÆËãÏûºÄ½ü1Ã룬  ±³°ü¿Õ¸ñ²»×ãÍ˳öÒ಻ÏûºÄ  | 
|     # GameWorld.DebugLog("===== usetime %s-%s"%(a - time.time(), killCnt))  | 
|     PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, money, ChConfig.Def_GiveMoney_Pickup)  | 
|       | 
|     if not CanEatItemsOper(curPlayer):  | 
|         CheckPackFull(curPlayer)  | 
|         return  | 
|       | 
|     # -----СÓÚ5¸ñ×Ó£¬±éÀúÍÌÊÉ×°±¸  | 
|     packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, Def_EatSpace)  | 
|     if packSpace >= 5:  | 
|         return  | 
|       | 
|     #===========================================================================  | 
|     # equipScores = {}  | 
|     # equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)  | 
|     # for i in ChConfig.EquipPlace_Base:  | 
|     #    equipItem = equipPack.GetAt(ItemCommon.GetEquipPackIndex(i))  | 
|     #    if not equipItem or equipItem.IsEmpty():  | 
|     #        continue  | 
|     #    equipScores[equipItem.GetType()] = ItemCommon.GetEquipGearScore(equipItem)  | 
|     #===========================================================================  | 
|       | 
|     #GameWorld.DebugLog("equipScores----%s"%equipScores)  | 
|       | 
|     eatIndexList = []  | 
|     eatItemIDList = []  | 
|     itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)  | 
|     for i in range(0, itemPack.GetCount()):  | 
|         curItem = itemPack.GetAt(i)  | 
|         if not curItem or curItem.IsEmpty():  | 
|             continue  | 
|           | 
|         ## µÍÆÀ·Ö×Ï×°»ò·Ç±¾Ö°Òµ  | 
|         if curItem.GetItemColor() > ShareDefine.Def_Item_Color_Purple:  | 
|             continue  | 
|           | 
|         if curItem.GetType() not in ChConfig.Def_EquipItemType_TJGAutoEat:  | 
|             continue  | 
|           | 
|         # ±¾Ö°ÒµÐèÒªÅÐ¶ÏÆÀ·Ö¸ßµÍ  | 
|         #=======================================================================  | 
|         # if ItemCommon.CheckJob(curPlayer, curItem):  | 
|         #    if curItem.GetType() not in equipScores:  | 
|         #        # Ã»ÓÐÆÀ·Ö˵Ã÷×°±¸Î»»¹ÊǿյĠ²»ÄÜÍÌÊÉ  | 
|         #        continue  | 
|         #    if ItemCommon.GetEquipGearScore(curItem) > equipScores[curItem.GetType()]:  | 
|         #        continue  | 
|         #=======================================================================  | 
|           | 
|         eatIndexList.append(i)  | 
|         eatItemIDList.append(curItem.GetItemTypeID())  | 
|     #GameWorld.DebugLog("eatIndexList-----------%s"%len(eatIndexList))  | 
|     eatCount, giveCnt = PlayerEquipDecompose.EatItems(curPlayer, eatIndexList, eatItemIDList)  | 
|     NoteEatEquip(curPlayer, eatCount, giveCnt)  | 
|     CheckPackFull(curPlayer)  | 
|       | 
| def OnTJGDropTaskItems(curPlayer, npclv, killCnt):  | 
|     #µôÂäÈÎÎñµÀ¾ß  | 
|     if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TJGPackFullAfterEat):  | 
|         # ÂúÁ˲»ÔÙ¸øÎïÆ·  | 
|         return  | 
|     dropTaskItemDict = IpyGameDataPY.GetFuncEvalCfg('TJDropTaskItem', 1, {})  | 
|     for missionID, dropInfo in dropTaskItemDict.items():  | 
|         if not curPlayer.FindMission(missionID):  | 
|             continue  | 
|         npclvLimit, itemID, needItemCnt, itemCntFormula = dropInfo  | 
|         if npclv < npclvLimit:  | 
|             continue  | 
|         haveCnt = ItemControler.FindPlayerItemCountByItemID(curPlayer, IPY_GameWorld.rptItem, itemID)  | 
|         giveItemCnt = min(needItemCnt-haveCnt, eval(itemCntFormula))  | 
|         if giveItemCnt <= 0:  | 
|             continue  | 
|         packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, 1)  | 
|         if packSpace < 1:  | 
|             #GameWorld.Log('ÍÑ»ú¹ÒµôÂäÈÎÎñµÀ¾ß±³°ü²»×㣡 missionID=%s£¬itemID=%s,giveItemCnt=%s'%(missionID, itemID, giveItemCnt))  | 
|             continue  | 
|         ItemControler.GivePlayerItem(curPlayer, itemID, giveItemCnt, 0, [IPY_GameWorld.rptItem])  | 
|     return  | 
|       | 
| def CheckPackFull(curPlayer):  | 
|     if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem):  | 
|         curPlayer.SetDict(ChConfig.Def_PlayerKey_TJGPackFullAfterEat, 1)  | 
|         #PlayerGeTui.FullPack(curPlayer)  | 
|   | 
| # ¿ÉÖ´ÐÐÍÌÊɲÙ×÷  | 
| def CanEatItemsOper(curPlayer):  | 
|     # ±éÀúÍÌÊÉ  | 
|     if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_EquipDecompose):  | 
|         GameWorld.DebugLog(' ³èÎ﹦ÄÜ먦Æô')  | 
|         return False  | 
|       | 
|     return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TJGSet)&1  | 
|   | 
| def CanHealthReborn(curPlayer):  | 
|       | 
|     if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TJGSet)&2:  | 
|         return False  | 
|       | 
|     rebornCfg = IpyGameDataPY.GetFuncEvalCfg('RebornArguments', 1)  | 
|     moneyPrice = rebornCfg[2]  | 
|     #Òì³£  | 
|     if not moneyPrice:  | 
|         return False  | 
|     costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, moneyPrice)  | 
|     if not costMoneyList:  | 
|         return False  | 
|     return True  | 
| #===============================================================================  | 
| # //B2 04 ÏµÍ³ÉèÖà#tagCMSystem  | 
| #   | 
| # struct    tagCMSystem  | 
| # {  | 
| #    tagHead         Head;  | 
| #    BYTE        AutoEat;        // ×Ô¶¯ÍÌÊÉ  | 
| #    BYTE        AutoReborn;    //×Ô¶¯Âò»î  | 
| # };  | 
| #===============================================================================  | 
| def OnTJGSystemSet(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     # °´Î»´¦Àí  | 
|     autoEat = 1 if clientData.AutoEat else 0  | 
|     autoReborn = 2 if clientData.AutoReborn else 0  | 
|       | 
|     tjgSet = autoEat + autoReborn  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TJGSet, tjgSet)  | 
|     return  | 
|   | 
|   | 
| #===============================================================================  | 
| # //B4 09 Í¨ÖªÍÑ»ú¹Ò½á¹û #tagMCTJGInfo  | 
| #   | 
| # struct    tagMCTJGInfo  | 
| # {  | 
| #    tagHead        Head;  | 
| #    DWORD        Exp1;    // ¾Ñé  | 
| #    DWORD        Exp2;    // ³¬ÒÚ¾Ñé  | 
| #    DWORD        Times;    // Ê¹ÓÃʱ¼äÃë  | 
| #    WORD        PurpleEquip;    // ²ú³ö×Ï×°ÊýÁ¿  | 
| #    WORD        OrangeEquip;    // ²ú³ö³È×°ÊýÁ¿  | 
| #    WORD        EatPurpleEquip;    // ÍÌÊÉ×Ï×°ÊýÁ¿  | 
| #   | 
| # };  | 
| #===============================================================================  | 
|   | 
|   | 
| # Íæ¼ÒÕæÊµÉÏÏß֪ͨ  | 
| def NotifyTJGInfo(curPlayer):  | 
|       | 
|     if curPlayer.GetIP() == "127.0.0.1":  | 
|         LoginFixTJG(curPlayer, True)  | 
|         return  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGOnDayEx, 0)  | 
|                                          | 
|     # ÍÑ»ú¹ÒûÓÐÔË×÷Çé¿öÏ ÃÖ²¹ÊÕÒæ  | 
|     LoginFixTJG(curPlayer)  | 
|       | 
|     times = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Time, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     if times == 0:  | 
|         return  | 
|       | 
|     npcID = curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_TJGNPC)  | 
|     if not npcID:  | 
|         return  | 
|       | 
|     npcData = GameWorld.GetGameData().FindNPCDataByID(npcID)  | 
|     if not npcData:  | 
|         return  | 
|       | 
|     #ÍÑ»úЧÂʰñ Ò»·ÖÖÓ¾Ñé  | 
|     #minuteExp = CalcTJGExp(curPlayer, 60, npcData)  | 
|     #exp_rate = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TotalExpRate)  | 
|     #addExp = int(minuteExp * exp_rate / float(ChConfig.Def_MaxRateValue))  | 
|     #GameWorld.DebugLog('    ÍÑ»úЧÂʰñ  minuteExp=%s,exp_rate=%s,addExp=%s'%(minuteExp, exp_rate, addExp))  | 
|     #PlayerBillboard.UpdateTJGBillboard(curPlayer, addExp)  | 
|       | 
|     #ÍÑ»ú°ñ¸ÄΪƽ¾ùЧÂÊ  | 
|     exp1 = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Exp1, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     exp2 = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Exp2, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     totalExp = exp2 * ChConfig.Def_PerPointValue + exp1  | 
|     aveMinuteExp = int(totalExp * 1.0 / max(1, times / 60)) # Æ½¾ùÿ·ÖÖÓ¾Ñé  | 
|     GameWorld.DebugLog('    ÍÑ»úЧÂʰñ  aveMinuteExp=%s, totalExp=%s,times=%s' % (aveMinuteExp, totalExp, times))  | 
|     PlayerBillboard.UpdateTJGBillboard(curPlayer, aveMinuteExp)  | 
|       | 
|     sendPack = ChPyNetSendPack.tagMCTJGInfo()  | 
|     sendPack.Clear()  | 
|     sendPack.Exp1 = exp1  | 
|     sendPack.Exp2 = exp2  | 
|     sendPack.Times = times  | 
|     sendPack.PurpleEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Purple, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     sendPack.OrangeEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Orange, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     sendPack.EatPurpleEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_EatPurple, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     sendPack.GiveCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_GiveCnt, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     sendPack.BeforeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_LV, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     sendPack.Items = []  | 
|     itemIDList = IpyGameDataPY.GetFuncEvalCfg('OfflinePostItem', 1)  | 
|     for itemID in itemIDList:  | 
|         count = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_ItemID%itemID, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|         if count == 0:  | 
|             continue  | 
|         itemInfo = ChPyNetSendPack.tagMCTJGItems()  | 
|         itemInfo.ItemID = itemID  | 
|         itemInfo.Count = count  | 
|         sendPack.Items.append(itemInfo)  | 
|     sendPack.Cnt = len(sendPack.Items)  | 
|       | 
|     NetPackCommon.SendFakePack(curPlayer, sendPack)  | 
|       | 
|     curPlayer.ClearNomalDict(ChConfig.Def_PDictType_TJGNotify)  | 
|     return  | 
|   | 
|   | 
| def PlayerTJGReborn(curPlayer, tick):  | 
|     # ´Ë´¦²»ÄÜÖ±½Ó´¦ÀíËÀÍöºóÏÂÏß»òÕßÖ±½Ó¸´»îµÄÂß¼£¬  | 
|     # ²»È»»áµ¼ÖÂÍâ²ã¿ÉÄÜÔÚ´¦ÀíÑ»·Âß¼Öб¨´í£¬ÈçÔÚProcessPlayerStateÕýÔÚ´¦ÀíbuffÂ߼ʱËÀÍö  | 
|     # ¸Ä³ÉÔÚÊÕµ½·â°ü //B4 0A ÍÑ»ú¹ÒËÀÍö # tagCMTJGDead ºó´¦Àí  | 
|     if not GetIsTJG(curPlayer):  | 
|         return  | 
|           | 
|     if CanHealthReborn(curPlayer):  | 
|         pass  | 
|         #ChPlayer.PlayerRebornByType(curPlayer, ChConfig.rebornType_Health, tick)  | 
|         # ¸ø¸ö30·ÖÎÞµÐbuffÏÂÏßÏûʧ  | 
|         #SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer, ChConfig.Def_SkillID_TJGSuperBuff, tick)  | 
|     else:  | 
|         ChPlayer.PlayerRebornByType(curPlayer, ChConfig.rebornType_City, tick)  | 
|         curPlayer.SetState(2)   # ÍÑ»ú¹ÒËÀÍö  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TJGDeadTime, int(time.time()))  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TJGDeadExp, 0)  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TJGDeadExp1, 0)  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TJGDeadPayTime, 0)  | 
|         #curPlayer.Kick(IPY_GameWorld.disTimeError)  # Ëæ±ã¼Ç¼һ¸öËÀÍö  | 
|           | 
|   | 
| # ÍÑ»ú¹Ò±»É±ºóÀëÏßÕÒ»Ø  | 
| def TJGDeadOffline(curPlayer):  | 
|     if curPlayer.GetState() != 2:  | 
|         times = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TJGDeadPayTime)  | 
|         if times == 0:  | 
|             return  | 
|           | 
|         # Î´ÕÒ»ØÔÙ´Î֪ͨ  | 
|         sendPack = ChPyNetSendPack.tagMCTJGDeadPay()  | 
|         sendPack.Clear()  | 
|         sendPack.Times = times  | 
|         sendPack.Exp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TJGDeadExp)  | 
|         sendPack.Exp1 = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TJGDeadExp1)  | 
|         sendPack.DeadTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TJGDeadTime)  | 
|         NetPackCommon.SendFakePack(curPlayer, sendPack)  | 
|         return  | 
|       | 
|     # ÍÑ»ú¹ÒÆÚ¼ä±»É±£¬¿ÉÁìÈ¡ÍÑ»ú¹Òʱ¼ä·¶Î§µÄÀëÏß¾Ñé  | 
|     times = max(min(PlayerControl.GetPlayerLeaveServerSecond(curPlayer), GetTJGTime(curPlayer)), 0)  | 
|   | 
|     npcID = curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_TJGNPC)  | 
|     if not npcID:  | 
|         return  | 
|       | 
|     npcData = GameWorld.GetGameData().FindNPCDataByID(npcID)  | 
|     if not npcData:  | 
|         return  | 
|       | 
|     realmLV = PlayerControl.GetDifficultyRealmLV(PlayerControl.GetRealmDifficulty(curPlayer))  | 
|     realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, realmLV)  | 
|       | 
|     # 1. ¾Ñé   | 
|     exp = CalcTJGExp(curPlayer, times, npcData, realmNPCIpyData)  | 
|     expRate = PlayerControl.GetLimitExpRate(curPlayer, ChConfig.ExpRateLimitType_Recover)  | 
|     exp = int(exp * expRate / float(ChConfig.Def_MaxRateValue))  | 
|     # Í¨ÖªÍÑ»ú¹Ò±»É±ÊǵÄʱ¼ä ºÍ ±»É±ºóµÄÍÑ»ú¹Òʱ¼ä¿É»ñµÃµÄ¾Ñé  | 
|     curExp = exp % ChConfig.Def_PerPointValue  | 
|     expPoint = exp / ChConfig.Def_PerPointValue  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TJGDeadExp, curExp)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TJGDeadExp1, expPoint)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TJGDeadPayTime, times)  | 
|       | 
|     sendPack = ChPyNetSendPack.tagMCTJGDeadPay()  | 
|     sendPack.Clear()  | 
|     sendPack.Times = times  | 
|     sendPack.Exp = curExp  | 
|     sendPack.Exp1 = expPoint  | 
|     sendPack.DeadTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TJGDeadTime)  | 
|     NetPackCommon.SendFakePack(curPlayer, sendPack)  | 
|    | 
|   | 
| # ¹ýÌìÇåÀí  | 
| def TJGOnDay(curPlayer, onEventType):  | 
|     if onEventType == ShareDefine.Def_OnEventType:  | 
|         times = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TJGDeadPayTime)  | 
|         if times == 0:  | 
|             return  | 
|               | 
|         ResetTJGDeadInfo(curPlayer)  | 
|     elif onEventType == ShareDefine.Def_OnEventTypeEx:  | 
|         if GetIsTJG(curPlayer):  | 
|             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGOnDayEx, 1)  | 
|     return  | 
|   | 
| def ResetTJGDeadInfo(curPlayer):  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TJGDeadExp, 0)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TJGDeadExp1, 0)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TJGDeadPayTime, 0)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TJGDeadTime, 0)  | 
|       | 
|     sendPack = ChPyNetSendPack.tagMCTJGDeadPay()  | 
|     sendPack.Clear()  | 
|     sendPack.Times = 0  | 
|     sendPack.Exp = 0  | 
|     sendPack.Exp1 = 0  | 
|     sendPack.DeadTime = 0  | 
|     NetPackCommon.SendFakePack(curPlayer, sendPack)  | 
|     return  | 
|   | 
|   | 
| #===============================================================================  | 
| # //B4 0A ÍÑ»ú¹ÒËÀÍö # tagCMTJGDead  | 
| #   | 
| # struct    tagCMTJGDead  | 
| # {  | 
| #    tagHead        Head;  | 
| # };  | 
| #===============================================================================  | 
| # ÌØÊâ˵Ã÷PlayerTJGReborn ´Ë´¦²»ÄÜÖ±½Ó´¦ÀíËÀÍöºóÏÂÏß»òÕßÖ±½Ó¸´»îµÄÂß¼£¬  | 
| # ²»È»»áµ¼ÖÂÍâ²ã¿ÉÄÜÔÚ´¦ÀíÑ»·Âß¼Öб¨´í£¬ÈçÔÚProcessPlayerStateÕýÔÚ´¦ÀíbuffÂ߼ʱËÀÍö  | 
| # ¸Ä³ÉÔÚÊÕµ½·â°ü //B4 0A ÍÑ»ú¹ÒËÀÍö # tagCMTJGDead ºó´¦Àí  | 
| def TJGNotifyDead(index, clientPack, tick):  | 
|       | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     if not GetIsTJG(curPlayer):  | 
|         return  | 
|     if CanHealthReborn(curPlayer):  | 
|         ChPlayer.PlayerRebornByType(curPlayer, ChConfig.rebornType_Health, tick)  | 
|         # ¸ø¸ö30·ÖÎÞµÐbuffÏÂÏßÏûʧ  | 
|         SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer, ChConfig.Def_SkillID_TJGSuperBuff, tick)  | 
|     else:  | 
|         ChPlayer.PlayerRebornByType(curPlayer, ChConfig.rebornType_City, tick)  | 
|         curPlayer.Kick(IPY_GameWorld.disMapCopyFull)  # Ëæ±ã¼Ç¼һ¸öËÀÍö  | 
|     return  | 
|   | 
|   | 
| def TJGGM(curPlayer, times):  | 
|     # ÕæÊµÉÏÏß  | 
|     npcID = FindTJGNPC(curPlayer)  | 
|     if not npcID:  | 
|         return  | 
|       | 
|     # ´ËʱÓÉ·þÎñ¶ËÖØÐÂÕÒÒ»´Î¹Ò»úNPC  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_TJGNPC, npcID)  | 
|   | 
|     GameWorld.DebugAnswer(curPlayer, "GMÄ£ÄâÍÑ»ú²ú³ö,npcid:%s, Ê±¼äÃ룺%s£¬ ¾Ñé±¶ÂÊ£º%s"%(  | 
|                     curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_TJGNPC), times,  | 
|                     curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TotalExpRate)))  | 
|       | 
|       | 
|     # ÉèÖÃÍÑ»úµÇ¼ʱµÄµÈ¼¶, ÉÏÏß֪ͨÇå¿Õ£¬ Ã»Çå¿Õ˵Ã÷¶à´ÎÍÑ»ú¹ÒµÇ¼ Ê¹Óþɵȼ¶  | 
|     notifyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_LV, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     if not notifyLV:  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGNotify_LV, curPlayer.GetLV(), ChConfig.Def_PDictType_TJGNotify)  | 
|       | 
|       | 
|     # ¼Ç¼Ã뵥λ  | 
|     NoteTJGTime(curPlayer, times)  | 
|     OnTJGKillNPCByTimes(curPlayer, times)  | 
|   | 
|     sendPack = ChPyNetSendPack.tagMCTJGInfo()  | 
|     sendPack.Clear()  | 
|     sendPack.Exp1 = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Exp1, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     sendPack.Exp2 = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Exp2, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     sendPack.Times = times  | 
|     sendPack.PurpleEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Purple, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     sendPack.OrangeEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Orange, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     sendPack.EatPurpleEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_EatPurple, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     sendPack.GiveCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_GiveCnt, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     sendPack.BeforeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_LV, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     sendPack.Items = []  | 
|     itemIDList = IpyGameDataPY.GetFuncEvalCfg('OfflinePostItem', 1)  | 
|     for itemID in itemIDList:  | 
|         count = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_ItemID%itemID, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|         if count == 0:  | 
|             continue  | 
|         itemInfo = ChPyNetSendPack.tagMCTJGItems()  | 
|         itemInfo.ItemID = itemID  | 
|         itemInfo.Count = count  | 
|         sendPack.Items.append(itemInfo)  | 
|     sendPack.Cnt = len(sendPack.Items)  | 
|       | 
|     NetPackCommon.SendFakePack(curPlayer, sendPack)  | 
|       | 
|     curPlayer.ClearNomalDict(ChConfig.Def_PDictType_TJGNotify)  | 
|   | 
|   | 
|   | 
| # ÉÏÏß¼ì²éÍÑ»úʱ¼äÊÇ·ñÕý³£ÔËÐÐ, ÃÖ²¹¶ÔӦȱʧʱ¼ä£¬Èçά»¤2СʱȱʧµÄÍÑ»ú¹ÒÊÕÒæ  | 
| # 1. ·ÇÍÑ»úËÀÍö£¬2.´æÔÚÍÑ»úʱ¼ä£¬3.ÀëÏßʱ¼ä³¬¹ý5·ÖÖÓ£»ÔòÒ»´Î²¹Æë ÀëÏßʱ¼ä-5·ÖÖÓµÄÊÕÒæ²¢¼õÉÙÍÑ»úʱ¼ä  | 
| # °´µ±Ç°¾Ñé±¶ÂʼÆË㣬ÇÒ²»»á¼õbuffʱ¼ä  | 
| # ÕÒµ½¶ÔÓ¦µÄNPC£¬Ðè¶ÁÈ¡¶ÔÓ¦¹Ò»ú±í  | 
| def LoginFixTJG(curPlayer, isTJG=False):  | 
|     # Íâ²ãÐèÅжÏÊÇÕæÊµÍæ¼ÒµÇ¼  | 
|     tjgTime = GetTJGTime(curPlayer)     # Ãë  | 
|     if not tjgTime:  | 
|         return  | 
|       | 
|     if curPlayer.GetState() == 2:  | 
|         # Íæ¼ÒÍÑ»úËÀÍö²»´¦Àí  | 
|         GameWorld.DebugLog("ÍÑ»úËÀÍöÍæ¼Ò²»×öʱ²î²¹³¥¡£")  | 
|         return  | 
|   | 
|       | 
|     # ³¬¹ý5·ÖÖÓ²¿·Ö²¹³¥  | 
|     seconds = PlayerControl.GetPlayerLeaveServerSecond(curPlayer) - IpyGameDataPY.GetFuncCfg('AutoUseGuardian', 2)  | 
|     if seconds <= 0:  | 
|         return  | 
|     times = min(seconds, tjgTime)  | 
|   | 
|     if not isTJG:  | 
|         # ÕæÊµÉÏÏß  | 
|         npcID = FindTJGNPC(curPlayer)  | 
|         if not npcID:  | 
|             return  | 
|           | 
|         # ´ËʱÓÉ·þÎñ¶ËÖØÐÂÕÒÒ»´Î¹Ò»úNPC  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_TJGNPC, npcID)  | 
|       | 
|     GameWorld.DebugLog("ÃÖ²¹ÍÑ»ú----playerID:%s ,npcid  %s-%s-%s"%(curPlayer.GetID(),  | 
|                     curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_TJGNPC), times,  | 
|                     curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TotalExpRate)))  | 
|       | 
|       | 
|     # ÉèÖÃÍÑ»úµÇ¼ʱµÄµÈ¼¶, ÉÏÏß֪ͨÇå¿Õ£¬ Ã»Çå¿Õ˵Ã÷¶à´ÎÍÑ»ú¹ÒµÇ¼ Ê¹Óþɵȼ¶  | 
|     notifyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_LV, 0, ChConfig.Def_PDictType_TJGNotify)  | 
|     if not notifyLV:  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGNotify_LV, curPlayer.GetLV(), ChConfig.Def_PDictType_TJGNotify)  | 
|       | 
|       | 
|     # ¼Ç¼Ã뵥λ  | 
|     NoteTJGTime(curPlayer, times)  | 
|     SetTJGTime(curPlayer, max(tjgTime - times, 0))  | 
|       | 
|     OnTJGKillNPCByTimes(curPlayer, times)  | 
|       | 
|     return  | 
|   | 
|   | 
| def FindTJGNPC(curPlayer):  | 
|     # 1.ÕÒµ½¶ÔÓ¦µÈ¼¶µã£¬ÅжÏÈÎÎñÊÇ·ñÍê³É£¬Óë²ß»®Ô¼¶¨¹Ò»úµØÍ¼ID10000¿ªÍ·  | 
|     # 3.ÕÒµ½¿ÉÒÔ½øÈëµÄÒ°ÍâµØÍ¼ºó£¬¸ù¾ÝµÈ¼¶·ÀÓùÔڴ˵ØÍ¼¹Ò»ú  | 
|       | 
|     missionMapStep = GetMissionMapStep(curPlayer)  | 
|       | 
|     ipyDataMgr = IpyGameDataPY.IPY_Data()  | 
|   | 
|     maxMapID = 0    # ¸ß¼¶µØÍ¼°´±í˳ÐòÐÐÅÅ  | 
|     # ---ÕÒµ½¿ÉÒÔ¹Ò»úµÄ×î¸ß¼¶µØÍ¼---  | 
|     for i in xrange(ipyDataMgr.GetMapEventPointCount()):  | 
|         mapInfo = ipyDataMgr.GetMapEventPointByIndex(i)  | 
|         mapID = mapInfo.GetMapID()  | 
|         if mapID/10000 != 1:  | 
|             # ·ÇÒ°ÍâµØÍ¼  | 
|             continue  | 
|           | 
|         # ---ÅжϵØÍ¼±íµÄÈÎÎñºÍµÈ¼¶ÏÞÖÆ---  | 
|         mapData = GameWorld.GetGameData().GetChinMap().GetMapByID(mapID)  | 
|         if not mapData:  | 
|             continue  | 
|         enterLV = mapData.GetLV()  | 
|       | 
|         if curPlayer.GetLV() < enterLV:  | 
|             continue  | 
|         openMapStep = mapData.GetTreasureID() #ÐèÒªÍê³ÉµÄÖ÷ÏßÈÎÎñID  | 
|         if missionMapStep < openMapStep:  | 
|             continue  | 
|   | 
|         maxMapID = mapID  | 
|           | 
|     GameWorld.DebugLog("FindTJGNPC maxMapID=%s" % maxMapID)  | 
|     if not maxMapID:  | 
|         return 0  | 
|       | 
|     # ---ÕÒµ½¹Ò»úµÈ¼¶µã---  | 
|     lv = curPlayer.GetLV()  | 
|     myPoint = None  | 
|       | 
|     # ×¢£º NPCRealmStrengthen MapEventPoint ÕâÁ½ÕÅÅäÖñíÐèҪȷ±£Ïà¹Ø¹²ÓÃ×Ö¶ÎÃüÃûÒ»Ñù  | 
|     realmMapIDList = IpyGameDataPY.GetFuncEvalCfg("RealmDifficulty", 1)  | 
|     realmDifficulty = PlayerControl.GetRealmDifficulty(curPlayer)  | 
|     if maxMapID in realmMapIDList and realmDifficulty:  | 
|         realmLV = PlayerControl.GetDifficultyRealmLV(realmDifficulty)  | 
|         mapList = IpyGameDataPY.GetIpyGameDataByCondition("NPCRealmStrengthen", {"MapID":maxMapID, "RealmDifficulty":realmLV}, True)  | 
|     else:  | 
|         mapList = IpyGameDataPY.GetIpyGameDataByCondition("MapEventPoint", {"MapID":maxMapID}, True)  | 
|           | 
|     mapEffList = []  # ÓÐЧ¹Ò»úµã£¬Í¬µØÍ¼ÖдæÔÚ²»ÐèÒª¹Ò»úµÄNPCµã  | 
|     for mapInfo in mapList:  | 
|         if mapInfo.GetLowLV() == 0:  | 
|             continue  | 
|           | 
|         mapEffList.append(mapInfo)  | 
|           | 
|         if lv >= mapInfo.GetLowLV():  | 
|             if myPoint and myPoint.GetLowLV() >= mapInfo.GetLowLV():  | 
|                 continue  | 
|             myPoint = mapInfo  | 
|   | 
|     if not mapEffList:  | 
|         return 0  | 
|           | 
|     # ---¸ù¾Ý·ÀÓùÉÏϵ÷Õû  | 
|     if not myPoint:  | 
|         # Ñ°ÕÒÒ쳣ȡ×îµÍµã  | 
|         return mapEffList[0].GetNPCID()  | 
|           | 
|     pointLen = len(mapEffList)  | 
|     defense = curPlayer.GetDef()  | 
|     pIndex = mapEffList.index(myPoint)  | 
|     if defense >= mapEffList[min(pointLen-1, pIndex+1)].GetDefense():  | 
|         # ¸ßÒ»¼¶  | 
|         return mapEffList[min(pointLen-1, pIndex+1)].GetNPCID()  | 
|   | 
|     if defense < myPoint.GetDefense():  | 
|         # µÍÒ»¼¶  | 
|         return mapEffList[max(0, pIndex-1)].GetNPCID()  | 
|       | 
|     return myPoint.GetNPCID()  | 
|   | 
|   | 
|               | 
|               | 
| def GetMissionMapStep(curPlayer):  | 
|     # Ö÷ÏßÈÎÎñÍê³Éʱ»áÉèÖñêÖ¾¿É½øµØÍ¼±êÖ¾  | 
|     mission_1 = QuestCommon.GetCommonMission(curPlayer)  | 
|     if not mission_1:  | 
|         return 0  | 
|     return mission_1.GetProperty("OpenMap")  | 
|   | 
|   |