| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #  | 
| ##@package E:/GameSVN/U3DGame/ProjectSServer/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerState.py  | 
| # @todo:   | 
| #  | 
| # @author: Alee  | 
| # @date 2017-10-24 ÏÂÎç09:30:31  | 
| # @version 1.0  | 
| #  | 
| # @note:   | 
| #  | 
| #---------------------------------------------------------------------  | 
| import IPY_GameWorld  | 
| import GameWorld  | 
| import BaseAttack  | 
| import ChConfig  | 
| import SkillShell  | 
| import BuffSkill  | 
| import PlayerControl  | 
| import EventShell  | 
| import PlayerRequest  | 
| import ChEquip  | 
| import SkillCommon  | 
| import FBLogic  | 
| import AttackCommon  | 
| import ChItem  | 
| import PlayerGMOper  | 
| import GameLogInfo  | 
| import PlayerMissionCollect  | 
| import ItemCommon  | 
| import OperControlManager  | 
| import ShareDefine  | 
| import PlayerAutoCheckOnline  | 
| import PlayerGameWallow  | 
| import ReadChConfig  | 
| import PlayerViewCacheTube  | 
| import PlayerDienstgrad  | 
| import PlayerVip  | 
| import IpyGameDataPY  | 
| import PlayerFB  | 
| import GameObj  | 
| import GameMap  | 
| import math  | 
| import time  | 
| import PetControl  | 
| import ItemControler  | 
| import PlayerTJG  | 
| import AICommon  | 
| import PlayerSuccess  | 
| import CrossPlayerData  | 
| import PassiveBuffEffMng  | 
| import FunctionNPCCommon  | 
| import FormulaControl  | 
| import PlayerGoldGift  | 
| import PlayerFlashSale  | 
| import PlayerWing  | 
| import ChEquip  | 
| import PlayerYinji  | 
| import PlayerActivity  | 
| import PlayerBackup  | 
|   | 
| #---------------------------------------------------------------------  | 
| #---------------------------------------------------------------------  | 
| ##ͨÓüì²âË¢ÐÂʱ¼äÊÇ·ñµ½ÁË  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick µ±Ç°Ê±¼ä´Á  | 
| # @param tickType tickÀàÐÍ  | 
| # @return ·µ»ØÊÇ·ñµ½Ê±¼äÁË£¬¼´¿É×öºóÐø²Ù×÷  | 
| # @remarks Í¨Óüì²âË¢ÐÂʱ¼äÊÇ·ñµ½ÁË  | 
| def CommonCheckTick(curPlayer, tick, tickType):  | 
|     checkInterval = ChConfig.TYPE_Player_Tick_Time[tickType]  | 
|     lastDealTick = curPlayer.GetTickByType(tickType)  | 
|     curTimePassed = tick - lastDealTick  | 
|     #ˢмä¸ôûÓе½  | 
|     if curTimePassed < checkInterval:  | 
|         return False  | 
|       | 
|     curPlayer.SetTickByType(tickType, tick)  | 
|     #µÚÒ»´ÎµÇ½ʱlastDealTickΪ0 µ«ÊÇ´Ëʱ²»´¦Àí Ö»Êǽ«ÉÏÒ»´Î´¦ÀíTickÉèΪµ±Ç°Tick  | 
|     if lastDealTick <= 0:  | 
|         return False  | 
|       | 
|     return True  | 
| #---------------------------------------------------------------------  | 
| ##´¦ÀíÕ½¶·ºÍ¶ÔÖűê־λ, Ö´ÐÐÍæ¼Ò¿ªÊ¼Õ½¶·Âß¼  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ´¦ÀíÕ½¶·ºÍ¶ÔÖűê־λ, Ö´ÐÐÍæ¼Ò¿ªÊ¼Õ½¶·Âß¼  | 
| def ProcessFight(curPlayer, tick):  | 
|     #ÎÞ¹¥»÷±ê־λºÍ¶ÔÖűê¼Çλ²»´¦Àí¹¥»÷  | 
|     if not PlayerControl.IsPlayerInFight(curPlayer):  | 
|         return  | 
|       | 
|     __DoProcessFight(curPlayer, tick)  | 
|   | 
|     # ÎÞÂÛ¹¥»÷³É¹¦»òʧ°Ü¶¼ÖØÖù¥»÷±ê¼Ç£¬·ÀÖ¹¹¥»÷ʧ°ÜʱûÓÐÖØÖñê¼Çµ¼ÖÂÏ´ι¥»÷ÇëÇóʱ±»À¹½Ø  | 
|     __ClearPlayerAttackSign(curPlayer)  | 
|     SkillShell.ClearClientHurtDict(curPlayer)  | 
|     return  | 
|   | 
|   | 
| def __DoProcessFight(curPlayer, tick):  | 
|       | 
|     #ÊÇ·ñ±»·À³ÁÃÔ  | 
|     isWallow = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_Wallow_LV) > ChConfig.Def_GameWallow_LV_First  | 
|       | 
|     #½ûÖ¹Õ½¶··µ»Ø  | 
|     if curPlayer.GetGMForbidenFight() or isWallow:  | 
|         #Í˳ö¶ÔÖÅ  | 
|         PlayerControl.ExitPlayerConfronting(curPlayer)  | 
|           | 
|         if isWallow:  | 
|             PlayerControl.NotifyCode(curPlayer, "AvoidSink09")  | 
|   | 
|         return  | 
|       | 
|     # ¿Í»§¶Ë·¢°ü¹¥»÷  | 
|     useSkillData = GetUseSkillByAutoAtk(curPlayer)  | 
|     if not useSkillData:  | 
|         return  | 
|       | 
|     skillTypeID = useSkillData.GetSkillTypeID()  | 
|       | 
|     #===========================================================================  | 
|     # #´Ë´¦Ö»´¦Àíѹ°ü¹ý¶àµÄÇé¿ö, ¿Í»§¶ËÓÅÏȲ¥·Å¶¯×÷Ϊ±íÏÖ£¬¸Ä³ÉÊÕµ½¼¼ÄܰüµÄʱ¼äÀ´·À·¶¹¥»÷¼ä¸ôCheckClientAttackTick  | 
|     # if SkillCommon.CheckPlayerAtkInterval(curPlayer, skillTypeID, tick):  | 
|     #    #GameWorld.DebugLog("¹¥»÷¹ý¿ì")  | 
|     #    return  | 
|     #===========================================================================  | 
|       | 
|     #Ö´Ðм¼ÄÜ»òÆÕ¹¥Ç°ÇåÒ»´ÎÉËѪÁÐ±í  | 
|     BaseAttack.ClearSkillHurtList()  | 
|       | 
|     if not __DoClientUseSkillEx(curPlayer, useSkillData, tick):  | 
|         SkillShell.AttackFailNotify(curPlayer, useSkillData)  | 
|         GameWorld.DebugLog("----¹¥»÷ʧ°Ü ¿ÉÄÜÊǼ¼ÄÜCD %s"%skillTypeID)  | 
|         # ¸ù¾Ý²ß»®ÐèÇó ÒÔ¿Í»§¶Ë¶¯×÷Ϊ±ê×¼£¬²»¿É¹¥»÷״̬Ҳ½øÈëCD  | 
|         BaseAttack.Sync_AttackResult(curPlayer, useSkillData)  | 
|           | 
|     if useSkillData and useSkillData.GetSkillID() != ChConfig.Def_SkillID_Somersault:  | 
|         # ¸úËæÍæ¼ÒͬƵÂʹ¥»÷  | 
|         PetControl.PetFight(curPlayer, tick)  | 
|         SummonFollowAtk(curPlayer, tick)  | 
|     #===========================================================================  | 
|     # if not result:  | 
|     #    #GameWorld.DebugLog("¹¥»÷ʧ°ÜÇå³ý×Ô¶¯Êͷż¼ÄÜ£¡")  | 
|     #    curPlayer.ClearAutoAtk()  | 
|     #===========================================================================  | 
|       | 
|     #===========================================================================  | 
|     # #¼ì²âÏÂÒ»´Î×Ô¶¯Êͷż¼ÄܺÍÖ÷¶¯ÊͷŵÄÓÅÏÈȨ  | 
|     # tmpUseSkill = curPlayer.GetUseSkill()  | 
|     # if not tmpUseSkill:  | 
|     #    return  | 
|     #   | 
|     # #GameWorld.DebugLog("¼¼ÄÜÊÍ·ÅÓëÍæ¼Ò²Ù×÷Ò»Ö£¬%s"%([useSkillData.GetSkillTypeID(), tmpUseSkill.GetSkillTypeID()]))  | 
|     # if useSkillData.GetSkillTypeID() == tmpUseSkill.GetSkillTypeID():  | 
|     #    #Çå³ý¼¼ÄÜÊÍ·ÅÊý¾Ý, Íæ¼ÒÖ÷¶¯Êͷŵļ¼ÄܲÅÇå³ý£¬±ÜÃâ·þÎñ¶ËÊͷŵ¼ÖÂÇå³ýÍæ¼Ò²Ù×÷  | 
|     #    curPlayer.ClearUseSkillRec()  | 
|     #===========================================================================  | 
|           | 
|     return  | 
|   | 
| #---È¡Ïû·þÎñ¶Ë×Ô¶¯Êͷż¼ÄÜ---  | 
| #    else:  | 
| #        #ÆÕ¹¥Îª¼¼ÄÜ£¬¹Ê²Å¿ÉÇå³ý£¬ÊͷŲ»³É¹¦Çå³ý×Ô¶¯Õ½¶·  | 
| #        curPlayer.SetActionObj(None)  | 
| #        curPlayer.ClearAutoAtk()  | 
|           | 
|     #ÆÕ¹¥ÒѾµ±¼¼ÄÜ´¦Àí  | 
|     #===========================================================================  | 
|     # #ÊÇ·ñÖ´ÐÐClient·¢°üÊÍ·ÅÆÕ¹¥±ê־λ  | 
|     # doAttack = curPlayer.GetUseSkillTagID() and curPlayer.GetUseSkillTagType()  | 
|     #   | 
|     # #Çå¿ÕClient·¢¼¼Äܹ¥»÷°üÊý¾Ý, ÕâÀォÇå³ýGetUseSkillTagIDºÍGetUseSkillTagType  | 
|     # curPlayer.ClearUseSkillRec()  | 
|     #   | 
|     # #-----Client·¢°üÊÍ·ÅÆÕ¹¥  | 
|     # if doAttack and __DoAttack_Continue(curPlayer, tick):  | 
|     #    #ÆÕͨ¹¥»÷¹¦ÄÜ, ½øÈë¶ÔÖÅ״̬  | 
|     #    PlayerControl.AutoEnterPlayerConfronting(curPlayer)  | 
|     #    return  | 
|     #===========================================================================  | 
|       | 
|     #Çå¿ÕClient±ê¼ÇµÄÕ½¶·±êÖ¾( Client·¢ÆÕ¹¥,¼¼Äܰü»á°ÑÍæ¼Ò״̬ÉèÖÃΪ paAttack )  | 
|     return  | 
|   | 
| def SummonFollowAtk(curPlayer, tick):  | 
|     for i in range(curPlayer.GetSummonCount()):  | 
|         curSummon = curPlayer.GetSummonNPCAt(i)  | 
|         if not curSummon:  | 
|             continue  | 
|         if not curSummon.GetDictByKey(ChConfig.Def_PlayerKey_AttackFollowMaster):  | 
|             continue  | 
|   | 
|         useSkillTagID = curPlayer.GetUseSkillTagID()  | 
|         useSkillTagType = curPlayer.GetUseSkillTagType()  | 
|           | 
|         curTag = GameWorld.GetObj(useSkillTagID, useSkillTagType)  | 
|         if not curTag or GameObj.GetHP(curTag) <= 0:  | 
|             # Ã»ÓÐÖ÷Ä¿±ê¾Í´Ó³ðºÞÖÐÕÒ  | 
|             for i in range(curPlayer.GetAngryNPCCount()):  | 
|                 curTag = curPlayer.GetAngryNPCByIndex(i)  | 
|                 if not curTag or GameObj.GetHP(curTag) <= 0:  | 
|                     continue  | 
|               | 
|         if not curTag or GameObj.GetHP(curTag) <= 0:  | 
|             return  | 
|           | 
|         tagDist = 0  | 
|         #---ÓÅÏÈÊͷż¼ÄÜ---  | 
|         if AICommon.DoAutoUseSkill(curSummon, curTag, tagDist, tick):  | 
|             return  | 
|           | 
|         #ÆÕͨ¹¥»÷  | 
|         BaseAttack.Attack(curSummon, curTag, None, tick)  | 
|           | 
|           | 
| ##»ñµÃÊͷż¼ÄÜ»òÆÕ¹¥£¬Ã»ÓÐÔò´Ó×Ô¶¯ÊÍ·ÅÖлñÈ¡£©  | 
| # @param curPlyer Íæ¼ÒʵÀý  | 
| # @return ¼¼ÄÜʵÀý  | 
| def GetUseSkillByAutoAtk(curPlayer):  | 
|       | 
|     #-----Client·¢°üÊͷż¼ÄÜ  | 
|     useSkillData = curPlayer.GetUseSkill()  | 
|       | 
|     if useSkillData:  | 
|         #GameWorld.DebugLog("Ö÷¶¯Êͷż¼ÄÜ")  | 
|         return useSkillData  | 
|       | 
|     return  | 
|     #---È¡Ïû·þÎñ¶Ë×Ô¶¯ÊÍ·ÅÂß¼---  | 
|       | 
|     #»ñÈ¡»º´æµÄ×Ô¶¯Êͷż¼ÄÜÀàÐÍ  | 
| #    autoSkillType = curPlayer.GetAutoAtkType()  | 
| #    if autoSkillType != ChConfig.Def_AutoAtkSkillType_Skill:  | 
| #        #ÎÞ×Ô¶¯Êͷż¼ÄÜÍ˳ö  | 
| #        return  | 
| #      | 
| #    curObj = curPlayer.GetActionObj()  | 
| #    if curObj == None or curObj.GetID() == 0:  | 
| #        #GameWorld.DebugLog("GetUseSkillByAutoAtk ÎÞÄ¿±ê")  | 
| #        return  | 
| #      | 
| #    #ûѪ»òÕß²»¿É¼û  | 
| #    if GameObj.GetHP(curObj) <= 0 or not curObj.GetVisible():  | 
| #        return  | 
| #      | 
| #    #¸ù¾Ý¹¥ËÙÈ¡¼¼ÄÜ  | 
| #    useSkill = SkillShell.GetSkillDataBySpeed(curPlayer, curPlayer.GetAutoSkillID())  | 
| #    if not useSkill:  | 
| #        return  | 
| #      | 
| #    if not useSkill.GetContinueUse():  | 
| #        return  | 
| #      | 
| #    skillAim = SkillShell.GetSkillFireAim(useSkill)  | 
| #    if skillAim == ChConfig.Def_UseSkillAim_Obj:  | 
| #        #Ö¸ÏòÐÔ  | 
| #        curPlayer.SetUseSkillTagType(curObj.GetGameObjType())  | 
| #        curPlayer.SetUseSkillTagID(curObj.GetID())  | 
| #          | 
| #    elif skillAim == ChConfig.Def_UseSkillAim_Ground:  | 
| #        #¶ÔµØ  | 
| #        curPlayer.SetUseSkillPosX(curObj.GetPosX())  | 
| #        curPlayer.SetUseSkillPosY(curObj.GetPosY())  | 
| #          | 
| #    #ÉèÖù¥»÷ÆðµãÎªÍæ¼Ò×ÔÉí×ø±ê  | 
| #    curPlayer.SetAttackTargetPos(curPlayer.GetPosX(), curPlayer.GetPosY())  | 
| #  | 
| #    return useSkill  | 
|   | 
|   | 
| #---------------------------------------------------------------------  | 
| ##Çå³ýÕ½¶·±ê¼Ç  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks  | 
| def __ClearPlayerAttackSign(curPlayer):  | 
|     #Çå¿ÕClient±ê¼ÇµÄÕ½¶·±êÖ¾( Client·¢ÆÕ¹¥,¼¼Äܰü»á°ÑÍæ¼Ò״̬ÉèÖÃΪ paAttack )  | 
|     if curPlayer.GetPlayerAction() != IPY_GameWorld.paAttack:  | 
|         return  | 
|       | 
|     PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)  | 
|     return  | 
|   | 
|   | 
| # Õë¶Ôй¥»÷ģʽB4 05  | 
| def __DoClientUseSkillEx(curPlayer, skillData, tick):  | 
|     #ʹÓü¼Äܽá¹û  | 
|     useSkillResult = False  | 
|       | 
|     #---ÎÞÄ¿±êÀ༼ÄÜ---  | 
|     aimType = SkillShell.GetSkillFireAim(skillData)  | 
|     if aimType == ChConfig.Def_UseSkillAim_None:  | 
|         useSkillResult = SkillShell.DoPlayerUseSkill(curPlayer, skillData, tick)  | 
|   | 
|         #¶ÔµØÊÍ·ÅÀ༼ÄÜ  | 
|     elif aimType == ChConfig.Def_UseSkillAim_Ground:  | 
|         useSkillPosX = curPlayer.GetUseSkillPosX()  | 
|         useSkillPosY = curPlayer.GetUseSkillPosY()  | 
|         useSkillResult = SkillShell.DoPlayerUseSkillGround(curPlayer, skillData, useSkillPosX , useSkillPosY , tick)  | 
|     else:  | 
|         #---ÓÐÄ¿±êÀ༼ÄÜ---          | 
|         useSkillTagID = curPlayer.GetUseSkillTagID()  | 
|         useSkillTagType = curPlayer.GetUseSkillTagType()  | 
|         if useSkillTagID == 0:  | 
|             #Ö÷ÒªÊÇΪÁ˹㲥¶øÒÑ£¬´Ë´¦Ã»ËãCDǰ¶Ë×Ô¼º×ßCD  | 
|             #curPlayer.View_UseSkillAttack(skillData.GetSkillID(), 0, 0, 0, IPY_GameWorld.IPY_HurtList())  | 
|             curPlayer.View_UseSkillPos(skillData.GetSkillID(), 0, curPlayer.GetPosX(), curPlayer.GetPosY(), IPY_GameWorld.IPY_HurtList())  | 
|             return True  | 
|           | 
|         curTag = GameWorld.GetObj(useSkillTagID, useSkillTagType)  | 
|         #¹¥»÷Ä¿±êÎÞ·¨¹¥»÷  | 
|         if not curTag:  | 
|             curPlayer.SetActionObj(None)  | 
|             PlayerControl.ExitPlayerConfronting(curPlayer)  | 
|             return useSkillResult  | 
|               | 
|         #Êͷż¼ÄÜ  | 
|         useSkillResult = SkillShell.DoPlayerUseSkillTag(curPlayer, skillData, curTag, tick)  | 
|           | 
|     #===========================================================================  | 
|     #    #Ä¿±êÒѾËÀÍö  | 
|     #    if GameObj.GetHP(curTag) <= 0:  | 
|     #        #È¡ÏûÖ÷½ÇµãÑ¡  | 
|     #        curPlayer.SetActionObj(None)  | 
|     #        #Í˳öÕ½¶·¶ÔÖÅ  | 
|     #        PlayerControl.ExitPlayerConfronting(curPlayer)  | 
|     #        return useSkillResult  | 
|     #   | 
|     #    #¼õÒæBuff½øÈëÕ½¶·¶ÔÖÅ  | 
|     #    if useSkillResult and skillData.GetSkillType() in ChConfig.Def_CanAttackSkill_List:  | 
|     #        #½øÈëÕ½¶·¶ÔÖÅ  | 
|     #        curPlayer.SetActionObj(curTag)  | 
|     #        PlayerControl.AutoEnterPlayerConfronting(curPlayer)  | 
|     #===========================================================================  | 
|       | 
|     return useSkillResult  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##Ö´Ðпͻ§¶Ë·¢°üµÄÊͷż¼ÄÜ  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param skillData ¼¼ÄÜÊý¾Ý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµ, ÊÇ·ñÊͷż¼Äܳɹ¦  | 
| # @remarks ´¦ÀíÕ½¶·ºÍ¶ÔÖűê־λ, Ö´ÐгÖÐøÊ¹Óõļ¼ÄÜ  | 
| def __DoClientUseSkill(curPlayer, skillData, tick):  | 
|     #ʹÓü¼Äܽá¹û  | 
|     useSkillResult = False  | 
|       | 
|     #---ÎÞÄ¿±êÀ༼ÄÜ---  | 
|     if curPlayer.GetUseSkillTagID() == 0:  | 
|         useSkillPosX = curPlayer.GetUseSkillPosX()  | 
|         useSkillPosY = curPlayer.GetUseSkillPosY()  | 
|         #×ÔÎÒÊÍ·ÅÀ༼ÄÜ  | 
|         if useSkillPosX == 0 or useSkillPosY == 0:  | 
|             useSkillResult = SkillShell.DoPlayerUseSkill(curPlayer, skillData, tick)  | 
|   | 
|         #¶ÔµØÊÍ·ÅÀ༼ÄÜ  | 
|         else:  | 
|             useSkillResult = SkillShell.DoPlayerUseSkillGround(curPlayer, skillData, useSkillPosX , useSkillPosY , tick)  | 
|         return useSkillResult  | 
|       | 
|     #---ÓÐÄ¿±êÀ༼ÄÜ---          | 
|     useSkillTagID = curPlayer.GetUseSkillTagID()  | 
|     useSkillTagType = curPlayer.GetUseSkillTagType()  | 
|     curTag = GameWorld.GetObj(useSkillTagID, useSkillTagType)  | 
|     #¹¥»÷Ä¿±êÎÞ·¨¹¥»÷  | 
|     if not curTag:  | 
|         curPlayer.SetActionObj(None)  | 
|         PlayerControl.ExitPlayerConfronting(curPlayer)  | 
|         return useSkillResult  | 
|           | 
|     #Êͷż¼ÄÜ  | 
|     useSkillResult = SkillShell.DoPlayerUseSkillTag(curPlayer, skillData, curTag, tick)  | 
|       | 
|     #Ä¿±êÒѾËÀÍö  | 
|     if GameObj.GetHP(curTag) <= 0:  | 
|         #È¡ÏûÖ÷½ÇµãÑ¡  | 
|         curPlayer.SetActionObj(None)  | 
|         #Í˳öÕ½¶·¶ÔÖÅ  | 
|         PlayerControl.ExitPlayerConfronting(curPlayer)  | 
|         return useSkillResult  | 
|       | 
|     #¼õÒæBuff½øÈëÕ½¶·¶ÔÖÅ  | 
|     if useSkillResult and skillData.GetSkillType() in ChConfig.Def_CanAttackSkill_List:  | 
|         #½øÈëÕ½¶·¶ÔÖÅ  | 
|         curPlayer.SetActionObj(curTag)  | 
|         PlayerControl.AutoEnterPlayerConfronting(curPlayer)  | 
|       | 
|     return useSkillResult  | 
| #---------------------------------------------------------------------  | 
| ##ÊÇ·ñÇå¿Õ¼¼ÄÜʹÓüǼ  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param curSkill ¼¼ÄÜʵÀý  | 
| # @param curTag ¼¼ÄÜÊÍ·ÅÄ¿±ê  | 
| # @return ·µ»ØÖµÕæ, Çå³ýÊͷżÇ¼  | 
| # @remarks ÊÇ·ñÇå¿Õ¼¼ÄÜʹÓüǼ  | 
| def __CheckCanClearUseSkillRec(curPlayer, curSkill , curTag):  | 
|     #Ä¿±êÒѾËÀÍö  | 
|     if curTag != None and GameObj.GetHP(curTag) <= 0:  | 
|         #È¡ÏûÖ÷½ÇµãÑ¡  | 
|         curPlayer.SetActionObj(None)  | 
|         #Í˳öÕ½¶·¶ÔÖÅ  | 
|         PlayerControl.ExitPlayerConfronting(curPlayer)  | 
|         return True  | 
|       | 
| #===============================================================================  | 
| #    2010/4/27 ½£Ê¥ÏîĿȫ²¿²»¿É×Ô¶¯Êͷż¼ÄÜ, Óɿͻ§¶Ë×Ô¶¯´ò¹ÖAI¿ØÖÆ  | 
| #    #²»ÊÇÁ¬ÐøÊÍ·ÅÀ༼ÄÜ  | 
| #    if curSkill.GetContinueUse() != 1:  | 
| #        return True  | 
| #===============================================================================  | 
|     return True  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##´¦ÀíÕ½¶·ºÍ¶ÔÖűê־λ, Ö´ÐгÖÐø¹¥»÷  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµ, ÊÇ·ñÊͷż¼Äܳɹ¦  | 
| # @remarks ´¦ÀíÕ½¶·ºÍ¶ÔÖűê־λ, Ö´ÐгÖÐø¹¥»÷  | 
| def __DoAttack_Continue(curPlayer, tick):  | 
|     curTag = __GetCanAttack_ObjDetel(curPlayer, tick)  | 
|       | 
|     if not curTag:  | 
|         ##Î޿ɹ¥»÷Ä¿±ê, Í˳öÕ½¶·¶ÔÖÅ  | 
|         PlayerControl.ExitPlayerConfronting(curPlayer)  | 
|         return False  | 
|       | 
|     #µÃµ½Íæ¼ÒµÄÎäÆ÷  | 
| #    curWeapon = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip).GetAt(ShareDefine.retWeapon)  | 
| #      | 
| #    if curWeapon.IsEmpty():  | 
| #        return False  | 
|       | 
|     #ÆÕ¹¥ÐÐΪ״̬, ·þÎñ¶ËÏÞÖÆ  | 
|     if not OperControlManager.IsObjCanDoAction(curPlayer,  | 
|                                                ChConfig.Def_Obj_ActState_ServerSkill,  | 
|                                                ChConfig.Def_Action_Attack_Bit):  | 
|         return  False  | 
|   | 
|       | 
|     #ÉèÖù¥»÷±ê־λ  | 
|     PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paAttack)  | 
|   | 
|     return BaseAttack.Attack(curPlayer, curTag, None, tick)  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñÈ¡¿ÉÒÔÆÕͨ¹¥»÷µÄ¶ÔÏóʵÀý  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµ, ¹¥»÷¶ÔÏóʵÀý  | 
| # @remarks »ñÈ¡¿ÉÒÔÆÕͨ¹¥»÷µÄ¶ÔÏóʵÀý  | 
| def __GetCanAttack_ObjDetel(curPlayer, tick):  | 
|     #µ±Ç°¶ÔÏó  | 
|     curTag = __GetAttackObj(curPlayer)  | 
|       | 
|     if not curTag:  | 
|         curPlayer.SetActionObj(None)  | 
|         return  | 
|       | 
|     relation = BaseAttack.GetTagRelation(curPlayer, curTag, None, tick)  | 
|     #ÅжÏÊÇ·ñµÐ¶Ô¹ØÏµ  | 
|     if relation[0] != ChConfig.Type_Relation_Enemy :  | 
|         #AttackCommon.PlayerAttackFailSysMessanage(curPlayer, relation[1])  | 
|         return  | 
|       | 
|     return curTag  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñµÃµ±Ç°¹¥»÷µÄ¶ÔÏó  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @return ·µ»ØÖµ, µ±Ç°¹¥»÷µÄÄ¿±ê  | 
| # @remarks »ñµÃµ±Ç°¹¥»÷µÄ¶ÔÏó  | 
| def __GetAttackObj(curPlayer):  | 
|     curObj = curPlayer.GetActionObj()  | 
|       | 
|     if curObj == None or curObj.GetID() == 0:  | 
|         return  | 
|       | 
|     #µ±Ç°¶ÔÏó  | 
|     curTag = GameWorld.GetObj(curObj.GetID(), curObj.GetGameObjType())  | 
|       | 
|     #¶ÔÏó²»´æÔÚ  | 
|     if not curTag or GameObj.GetHP(curTag) <= 0:  | 
|         return  | 
|       | 
|     #¶ÔÏóÀ뿪ÆÁÄ»¹ýÔ¶  | 
|     if not curPlayer.CanSeeOther(curTag):  | 
|         return  | 
|       | 
|     return curTag  | 
| #---------------------------------------------------------------------  | 
| ##´¦ÀíÍæ¼Ò³ÖÐøÐÔBuff,°üº¬³¡¾°Buff  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ´¦ÀíÍæ¼Ò³ÖÐøÐÔBuff,°üº¬³¡¾°Buff  | 
| def ProcessPlayerBuffEffect(curPlayer, tick):  | 
|     #---´¦Àí³¡¾°Buff---  | 
|     SkillShell.ProcessMapBuff(curPlayer, tick)  | 
|       | 
|     #Ë¢ÐÂÍæ¼Ò³ÖÐøÐÔbuff  | 
|     if tick - curPlayer.GetPersistBuffTick() <= ChConfig.Def_ProcessPlayerPersistBuff:  | 
|         return  | 
|       | 
|     curPlayer.SetPersistBuffTick(tick)  | 
|   | 
|     #---´¦Àí³ÖÐøÐÔBuff---  | 
|     SkillShell.ProcessPersistBuff(curPlayer, tick)  | 
|     return  | 
| #---------------------------------------------------------------------  | 
| ##´¦ÀíÍæ¼Ò½ø¶ÈÌõʼþ  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # ÌØÊâ˵Ã÷ChangePlayerAction -> SetPlayerAction ÖРÔÚÀÌõ״̬»á֪ͨ Sync_PrepareEnd£¬Ä¬ÈϽø¶ÈÌõÀàÐÍ  | 
| # Sync_PrepareEnd Í¨Öª0²ÅËã½ø¶ÈÌõ³É¹¦£¬ÆäËûΪʧ°Ü£¬×Ôµ÷ÓÃÂ߼ʱÇë×¢Òâ  | 
| def ProcessPlayerPrepareState(curPlayer, tick):  | 
|     prepareState = curPlayer.GetPrepareState()  | 
|       | 
|     #ͨ¹ý¶¯×÷»ñµÃÏàÓ¦¶¯×÷λ  | 
|     curActBit = OperControlManager.GetActBitByAction(ChConfig.Def_ActBit_PstState, prepareState)  | 
|   | 
|     if curActBit != None:  | 
|         #À½ø¶ÈÌõÖР״̬, ·þÎñ¶ËÏÞÖÆ  | 
|         if not OperControlManager.IsObjCanDoAction(curPlayer,  | 
|                                                    ChConfig.Def_Obj_ActState_ServerAct,  | 
|                                                    curActBit):  | 
|             #ÉèÖÿÕÏÐ״̬  | 
|             PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)  | 
|             return    | 
|       | 
|     if tick - curPlayer.GetPlayerActionTick() < curPlayer.GetPrepareTime():  | 
|         #ʱ¼ä¼ä¸ôûÓе½  | 
|         if prepareState in [IPY_GameWorld.pstCollecting, IPY_GameWorld.pstMissionCollecting]:  | 
|             OnCollecting(curPlayer, tick)  | 
|           | 
|         return  | 
|       | 
|     if prepareState == IPY_GameWorld.pstDig:  | 
|         #ÍÚ±¦×´Ì¬  | 
|         EventShell.EventResponse_OnDig(curPlayer)  | 
|           | 
|     elif prepareState == IPY_GameWorld.pstSkill:  | 
|         SkillShell.SkillPrepareEnd(curPlayer, tick)  | 
|         return  | 
|   | 
|     elif prepareState == IPY_GameWorld.pstCollecting:  | 
|         #¶áÆì³É¹¦  | 
|         __DoLogic_CollectingOk(curPlayer, tick)  | 
|           | 
|     elif prepareState == IPY_GameWorld.pstCatching:  | 
|         #ÕÙ»½NPC³É¹¦  | 
|         ChItem.OnPrepareEnd(curPlayer, prepareState)  | 
|       | 
|     elif prepareState == IPY_GameWorld.pstTownPortal:  | 
|         #Õ½¶·Öлسdzɹ¦  | 
|         ChItem.UseTownPortal(curPlayer)  | 
|       | 
|     elif prepareState == IPY_GameWorld.pstMissionCollecting:  | 
|         #ÈÎÎñ²É¼¯  | 
|         PlayerMissionCollect.EndMissionCollect(curPlayer, tick)  | 
|           | 
|     elif prepareState == ShareDefine.Def_PstTrans:  | 
|           | 
|         mapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TransMapId)  | 
|         posX = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TransPosX)  | 
|         posY = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TransPosY)  | 
|           | 
|         if not TransCostAfterPrepare(curPlayer):  | 
|             return  | 
|           | 
|         PlayerControl.PlayerResetWorldPos(curPlayer, mapID, posX, posY, False)  | 
|         #PlayerControl.NotifyCode(curPlayer, "Map_Deliver_Succeed", [mapID])  | 
|           | 
|     #ÖØÖÃÍæ¼Ò״̬  | 
|     curPlayer.SetPrepareState(0)    # ³É¹¦  | 
|     PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)  | 
|     return  | 
|   | 
| def OnCollecting(curPlayer, tick):  | 
|     ## ²É¼¯ÖÐÂß¼  | 
|     tagObj = curPlayer.GetActionObj()  | 
|     if not tagObj:  | 
|         return  | 
|     if tagObj.GetGameObjType() != IPY_GameWorld.gotNPC:  | 
|         return  | 
|     curNPC = GameWorld.GetNPCManager().GetNPCByIndex(tagObj.GetIndex())  | 
|     if not curNPC:  | 
|         return  | 
|     FBLogic.OnCollecting(curPlayer, tick)  | 
|     npcID = curNPC.GetNPCID()  | 
|     collectNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("CollectNPC", npcID)  | 
|     if collectNPCIpyData:  | 
|         DoCollectingLostHP(curPlayer, collectNPCIpyData, tick, False)  | 
|     return  | 
|   | 
| def DoCollectingLostHP(curPlayer, collectNPCIpyData, tick, isEnd):  | 
|     ## Ö´Ðвɼ¯µôѪ  | 
|     if not collectNPCIpyData.GetLostHPPer():  | 
|         return  | 
|     lostSecond, lostHPPer = collectNPCIpyData.GetLostHPPer()  | 
|     lastTick = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_CollectLostHPTick)  | 
|     lostTime = (tick - lastTick) / (lostSecond * 1000.0) # µôѪ´ÎÊý  | 
|     if isEnd:  | 
|         lostTime = int(round(lostTime)) # ²É¼¯ÍêµÄʱºòËÄÉáÎåÈë  | 
|     else:  | 
|         lostTime = int(lostTime)  | 
|     if lostTime < 1:  | 
|         return  | 
|       | 
|     curPlayer.SetDict(ChConfig.Def_PlayerKey_CollectLostHPTick, tick)  | 
|     lostValue = int(GameObj.GetMaxHP(curPlayer) * lostHPPer / 100.0) * lostTime  | 
|     skillTypeID, buffOwner = 0, None  | 
|     SkillCommon.SkillLostHP(curPlayer, skillTypeID, buffOwner, lostValue, tick, skillAffect=False)  | 
|     GameWorld.DebugLog("²É¼¯µôѪ: npcID=%s,lostHPPer=%s,lostTime=%s,lostValue=%s" % (collectNPCIpyData.GetNPCID(), lostHPPer, lostTime, lostValue))  | 
|     return  | 
|   | 
|   | 
| ##´«Ëͽø¶ÈÌõÍê³Éºó¿Û³ýÏà¹ØÏûºÄ  | 
| # @param curPlayer  | 
| # @return bool  | 
| def TransCostAfterPrepare(curPlayer):  | 
|     transType = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TransType)  | 
|       | 
|     if transType == ChConfig.Def_Transport_Type_FixedPoint:  | 
|         moneyType = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TransMoneyType)  | 
|         money = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TransMoney)  | 
|         #¸¶Ç®  | 
|         infoDict = {ChConfig.Def_Cost_Reason_SonKey:transType}  | 
|         if not PlayerControl.PayMoney(curPlayer, moneyType, money, ChConfig.Def_Cost_Transport, infoDict):     | 
|             return False  | 
|       | 
|       | 
|     return True  | 
|           | 
| #---------------------------------------------------------------------  | 
| ##¶áÆì³É¹¦Âß¼  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ¶áÆì³É¹¦  | 
| def __DoLogic_CollectingOk(curPlayer, tick):  | 
|     curObj = curPlayer.GetActionObj()  | 
|       | 
|     if not curObj or not curObj.GetID():  | 
|         return  | 
|       | 
|     #Ö»´¦ÀíNPC  | 
|     if curObj.GetGameObjType() != IPY_GameWorld.gotNPC:  | 
|         return  | 
|       | 
|     curNPC = GameWorld.GetNPCByIndex(curObj.GetIndex())  | 
|       | 
|     if not curNPC:  | 
|         return  | 
|       | 
|     result = FBLogic.OnCanCollect(curPlayer, curNPC, tick)  | 
|       | 
|     if not result:  | 
|         return  | 
|       | 
|     collectNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("CollectNPC", curNPC.GetNPCID())  | 
|     if collectNPCIpyData:  | 
|         DoCollectingLostHP(curPlayer, collectNPCIpyData, tick, True)  | 
|           | 
|     FBLogic.OnCollectOK(curPlayer, curNPC.GetNPCID(), tick)  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##Ë¢ÐÂʱЧµÀ¾ß  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµ, ÊÇ·ñÖØË¢Íæ¼ÒÊôÐÔ  | 
| # @remarks Ë¢ÐÂÒÔµ¥Î»Ê±¼ä(·ÖÖÓ)ÏûºÄÄ;õÄÎïÆ·  | 
| def ProcessRefreshTimeItem(curPlayer, tick):  | 
|     reFlash = False  | 
|       | 
|     #2·ÖÖÓ±éÀúÒ»´Î£¬Ê±Ð§µÀ¾ßʱ¼äµ½²»Ïûʧ£¬  | 
|     if tick - curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_EquipTime) \  | 
|         < ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_TimeItem]:  | 
|         return reFlash  | 
|     #Ä;üõÉÙÖµ/·ÖÖÓ  | 
|     reFlash = ProcessTimeEquip(curPlayer, tick)  | 
|       | 
|     return reFlash  | 
|   | 
|   | 
| #---------------------------------------------------------------------  | 
| ##Ë¢ÐÂÍæ¼ÒBuff  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµ, ÊÇ·ñÖØË¢Íæ¼ÒÊôÐÔ  | 
| # @remarks Ë¢ÐÂÍæ¼ÒBuff  | 
| def ProcessRefreshBuffState(curPlayer, tick):  | 
|     if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_Buff) < ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_Buff]:  | 
|         #ûÓе½Ë¢Ð¼ä¸ô  | 
|         return False  | 
|       | 
|     curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_Buff, tick)  | 
|       | 
|     refresh = False  | 
|   | 
|     result = BuffSkill.RefreshBuff(curPlayer, curPlayer.GetBuffState(), tick)  | 
|     refresh = refresh or result[0]  | 
|       | 
|     result = BuffSkill.RefreshBuff(curPlayer, curPlayer.GetDeBuffState(), tick)  | 
|     refresh = refresh or result[0]  | 
|       | 
|     result = BuffSkill.RefreshBuff(curPlayer, curPlayer.GetAura(), tick)  | 
|     refresh = refresh or result[0]  | 
|       | 
|     result = BuffSkill.RefreshBuff(curPlayer, curPlayer.GetIncBuff(), tick)  | 
|     refresh = refresh or result[0]  | 
|       | 
|     result = SkillCommon.CheckAuraSkill(curPlayer, tick)  | 
|     refresh = refresh or result  | 
|       | 
|     PlayerControl.RefreshPKValueByRedBuff(curPlayer)  | 
|       | 
|     # ÊôÐÔˢР | 
|     return refresh  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##Ë¢ÐÂÍæ¼ÒBuff  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµ, ÊÇ·ñÖØË¢Íæ¼ÒÊôÐÔ  | 
| # @remarks Ë¢ÐÂÍæ¼ÒBuff  | 
| def ProcessRefreshActionBuffState(curPlayer, tick):  | 
|   | 
|     #·ÅÔÚÕâÀï¿ÉÒÔ¼°Ê±Ë¢ÐÂBUFF  | 
|     #ˢгÖÐøÐÔBUFF£¬³¡¾°BUFF¹ÜÀíÆ÷ºÍ×°±¸¹ÜÀíÆ÷¿ÉÄÜÒ²ÓгÖÐøBUFF  | 
|     BuffSkill.RefreshBuff(curPlayer, curPlayer.GetProcessBuffState(), tick)  | 
|     BuffSkill.RefreshBuff(curPlayer, curPlayer.GetProcessDeBuffState(), tick)  | 
|       | 
|     # ¿ØÖÆÀàbuffÖ§³ÖÊôÐÔÅäÖÃ  | 
|     result = BuffSkill.RefreshBuff(curPlayer, curPlayer.GetActionBuffManager(), tick)  | 
|       | 
|     # Íâ²ã¿ØÖÆË¢Ð¹æÔò  | 
|     return result  | 
|   | 
|   | 
| #---------------------------------------------------------------------  | 
|   | 
| ##Íæ¼ÒÚ¤Ïë  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return None  | 
| def ProcessMuse(curPlayer, tick):  | 
|     playerMuse_Conf = ReadChConfig.GetEvalChConfig('PlayerMuse_Conf')  | 
|       | 
|     # ²»ÔÚ¶ÔÓ¦µØÍ¼ÀÔò²»´¦Àí  | 
|     mapID = GameWorld.GetGameWorld().GetMapID()  | 
|     if mapID not in playerMuse_Conf.keys():  | 
|         return  | 
|       | 
|     curPlayerAreaType = GameMap.GetAreaTypeByMapPos(curPlayer.GetPosX(), curPlayer.GetPosY())  # µ±Ç°Íæ¼ÒËùÔÚÇøÓò  | 
|     # ²»ÔÚ°²È«Çø£¬²»´¦ÀíÚ¤Ïë  | 
|     if curPlayerAreaType != IPY_GameWorld.gatSafe:  | 
|         return  | 
|       | 
|     # Ê±¼ä¼ä¸ôºÁÃë,¾Ñ鹫ʽ  | 
|     intervalTick, expValueStr, lvLimit = playerMuse_Conf[mapID]  | 
|       | 
|     # µÈ¼¶ÏÞÖÆ²»´¦Àí  | 
|     if curPlayer.GetLV() < lvLimit:  | 
|         return  | 
|       | 
|     # Ê×´ÎtickÉèÖÃÖµ  | 
|     if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_Muse) <= 0:  | 
|         curPlayer.SetDict(ChConfig.Def_PlayerKey_Muse, tick)  | 
|         return  | 
|       | 
|     # ²»µ½É趨ʱ¼ä  | 
|     if tick - curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_Muse) < intervalTick:  | 
|         return  | 
|       | 
|     curPlayer.SetDict(ChConfig.Def_PlayerKey_Muse, tick)  | 
|       | 
|     #²Î¿¼¾Ñé  | 
|     rExp = PlayerControl.GetPlayerReExp(curPlayer)  | 
|     addExpValue = int(eval(expValueStr))  | 
|     playerControl = PlayerControl.PlayerControl(curPlayer)  | 
|     playerControl.AddExp(addExpValue, ShareDefine.Def_ViewExpType_GameEvent)  | 
|     return  | 
|   | 
| ##Íæ¼Ò×Ô¶¯ÕæÆø,»Ø¸´¾Ñé  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return None  | 
| def ProcessZhenQi(curPlayer, tick):  | 
|     #½ö´ò×ø×´Ì¬»Ø¸´  | 
|     if curPlayer.GetPlayerAction() != IPY_GameWorld.paSit:  | 
|         return  | 
|       | 
|     restoreTick, restoreValue, expValueStr = ReadChConfig.GetEvalChConfig('PlayerSit_Zhenqi')  | 
|   | 
|     if tick - curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SitForZhenQi) < restoreTick:  | 
|         return  | 
|       | 
|     curPlayer.SetDict(ChConfig.Def_PlayerKey_SitForZhenQi, tick)  | 
|       | 
|     vipLV = curPlayer.GetVIPLv()  | 
|     vipRate = ShareDefine.Def_MaxRateValue#PlayerVip.GetVIPMuseSitRate(vipLV)  | 
|       | 
|     #È¡µÃÈËÎﵱǰ¾Ñé  | 
|     curTotalExp = PlayerControl.GetPlayerTotalExp(curPlayer) # ³¬¹ý20ÒÚÖ§³Ö£¬¹¦ÄÜ´ý¶¨  | 
|       | 
|     if curTotalExp < ChConfig.Def_UpperLimit_DWord:  | 
|         #²Î¿¼¾Ñé  | 
|         rExp = PlayerControl.GetPlayerReExp(curPlayer)  | 
|         addExpValue = int(eval(expValueStr))  | 
|         vipExpValue = int(addExpValue * vipRate / float(ShareDefine.Def_MaxRateValue))  | 
|         playerControl = PlayerControl.PlayerControl(curPlayer)  | 
|         playerControl.AddExp(addExp=addExpValue + vipExpValue,  | 
|                              expViewType=ShareDefine.Def_ViewExpType_Sit,  | 
|                              isSysHint=False)  | 
|           | 
|         if vipLV == 0:  | 
|             canVipRate = ShareDefine.Def_MaxRateValue#PlayerVip.GetVIPMuseSitRate(ShareDefine.Def_VIPType_Platina)  | 
|             canVipExpValue = int(addExpValue * canVipRate / float(ShareDefine.Def_MaxRateValue))  | 
|             #GeRen_chenxin_684833£º»ñµÃ¾Ñé%sµã£¬³ÉΪVIP¾Ñé%s  | 
|             PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_684833", [addExpValue, canVipExpValue])  | 
|         else:  | 
|             #GeRen_chenxin_705350£º»ñµÃ¾Ñé%s£¨VIP+¾Ñé%s£©  | 
|             PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_705350", [addExpValue, vipExpValue])  | 
|       | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¸ßЧÁ·¹¦¼Ó¾ÑéÕæÆø  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return None  | 
| def ProcessEfficientSite(curPlayer, tick):  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##Íæ¼Ò×Ô¶¯»Ø¸´XPÖµ  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return None  | 
| # @remarks Íæ¼Ò×Ô¶¯»Ø¸´XPÖµ  | 
| def ProcessAddXP(curPlayer, tick):  | 
|     return  | 
|     #===========================================================================  | 
|     # #¿ª·ÅµÈ¼¶Ôö¼Ó¶àÉÙXPÖµ, ×î´óXPÖµ  | 
|     # openLV, addXPValue, maxXPValue = ReadChConfig.GetEvalChConfig('PlayerXP')  | 
|     # #»¹Ã»µ½¿ª·ÅµÈ¼¶  | 
|     # if openLV > curPlayer.GetLV():  | 
|     #    return  | 
|     # lastTick = curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_AddXPTick)  | 
|     # if not CommonCheckTick(curPlayer, tick, ChConfig.TYPE_Player_Tick_AddXPTick):  | 
|     #    #Ê״εǽ£¬½«µ±Ç°µÄXPÖµ¼Ç¼µ½×ÖµäÖÐ  | 
|     #    if lastTick <= 0:  | 
|     #        curPlayer.SetDict(ChConfig.Def_PlayerKey_RecordXPValue, curPlayer.GetXP())  | 
|     #    return  | 
|     #   | 
|     # #´Ó×ÖµäÖлñÈ¡µ±Ç°µÄXPÖµ  | 
|     # curXPValue = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_RecordXPValue)  | 
|     # #µ±Ç°XPÖµÒѾÊÇ×î´óÖµÁË£¬²»×ö´¦Àí  | 
|     # if curXPValue == maxXPValue:  | 
|     #    return  | 
|     # xpRestorePer = PlayerControl.GetXPRestorePer(curPlayer)  | 
|     # addXPValue = int(addXPValue * xpRestorePer/float(ChConfig.Def_MaxRateValue))  | 
|     # nextXPValue = min(curXPValue + addXPValue, maxXPValue)  | 
|     # curPlayer.SetDict(ChConfig.Def_PlayerKey_RecordXPValue, nextXPValue)  | 
|     # #ÒѾ´ïµ½×î´óµÄXPÖµÁË£¬Í¨Öª¿Í»§¶Ë  | 
|     # if nextXPValue == maxXPValue:  | 
|     #    #ÕâÀï½øÐÐÉèÖõÄʱºò£¬½«»á֪ͨ¿Í»§¶Ë  | 
|     #    curPlayer.SetXP(nextXPValue)  | 
|     #===========================================================================  | 
|   | 
|   | 
| #---------------------------------------------------------------------  | 
| ##Íæ¼Ò×Ô¶¯»Ø¸´ÉúÃüºÍħ·¨  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return None  | 
| # @remarks Íæ¼Ò×Ô¶¯»Ø¸´ÉúÃüºÍħ·¨  | 
| def ProcessHPMPState(curPlayer, tick):  | 
|       | 
| #    #½ö´ò×ø×´Ì¬»Ø¸´  | 
| #    if curPlayer.GetPlayerAction() != IPY_GameWorld.paSit:  | 
| #        return  | 
|       | 
|     if not curPlayer.IsAlive():  | 
|         #ËÀÍö״̬²»´¦Àí  | 
|         return  | 
|       | 
|     #¼ì²âÊÇ·ñµ½CDʱ¼ä, Ôݶ¨5Ãë»ØÒ»´Î  | 
|     if tick - curPlayer.GetRestoreTime() < ChConfig.Def_HPRestoreInterval:  | 
|         return  | 
|     #ÉèÖõ±Ç°»Ø¸´¿ªÊ¼Ê±¼ä  | 
|     curPlayer.SetRestoreTime(tick)  | 
|   | 
|     #ûÓлָ´ÄÜÁ¦  | 
|     if curPlayer.GetHPRestorePer() == 0:  | 
|         return  | 
|       | 
|     #ÂúѪ²»´¦Àí  | 
|     if GameObj.GetHP(curPlayer) == GameObj.GetMaxHP(curPlayer):  | 
|         return  | 
|       | 
|     #Õ½¶·Öзµ»Ø  | 
|     #if curPlayer.IsBattleState():  | 
|     #    return False  | 
|       | 
| #    #Õ½¶·¶ÔÖÅ·µ»Ø  | 
| #    if curPlayer.GetIsConfronting():  | 
| #        return False  | 
|       | 
|     #---»Ø¸´Íæ¼ÒѪÁ¿---  | 
|     playerHP = GameObj.GetHP(curPlayer)  | 
|     #playerMP = curPlayer.GetMP()  | 
|     playerMaxHP = GameObj.GetMaxHP(curPlayer)  | 
|     #playerMaxMP = curPlayer.GetMaxMP()  | 
|       | 
|     # Ä¿Ç°»Ø¸´ÆµÂÊÔݶ¨5Ãë»Ø¸´Ò»´Î£¬»Ø¸´ÊýÖµÊÇ1ÃëµÄÖµ£¬ËùÒÔ´Ë´¦³Ë5  | 
|     addHPValue = curPlayer.GetHPRestorePer() * 5  | 
|       | 
|     #addMPValue = GameWorld.GetFloatUpper(playerMaxMP * mpPer + mpValue)  | 
|      | 
|     #GameWorld.Log('addHPValue = %s, addMPValue = %s'%(addHPValue, addMPValue))  | 
|       | 
|     #µ±Ç°²»ÊÇÂúѪ, ¾Í»ØÑª  | 
|     if playerHP != playerMaxHP:  | 
|         SkillCommon.SkillAddHP(curPlayer, 0, addHPValue)  | 
|         #GameObj.SetHP(curPlayer, min(playerHP + addHPValue, playerMaxHP))  | 
|       | 
|     #µ±Ç°²»ÊÇÂúħ, ¾Í»ØÄ§  | 
|     #if playerMP != playerMaxMP:  | 
|     #    curPlayer.SetMP(min(playerMP + addMPValue, playerMaxMP))  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##Ë¢ÐÂ×é¶Ó״̬  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµ, ÊÇ·ñÖØË¢Íæ¼ÒÊôÐÔ  | 
| # @remarks Ë¢ÐÂ×é¶Ó״̬  | 
| def ProcessTeamState(curPlayer, tick):      | 
|     #===============================================================================================  | 
|     # if tick - curPlayer.GetTeamHPMPSyncTick() < ChConfig.Def_Team_GetOtherInfoInterval:  | 
|     #    return  | 
|     # team = curPlayer.GetTeam()  | 
|     # if team == None:  | 
|     #    return  | 
|     # curPlayer.SetTeamHPMPSyncTick(tick)  | 
|     # team.SyncMemberHPMP(curPlayer)  | 
|     #===============================================================================================  | 
|     return   | 
|   | 
| #---------------------------------------------------------------------  | 
| ##Ë¢ÐÂÍæ¼ÒÔÚÏßʱ¼ä  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµ, ÎÞÒâÒå  | 
| # @remarks Ë¢ÐÂÍæ¼ÒÔÚÏßʱ¼ä  | 
| def ProcessPlayer_OnlineTime(curPlayer, tick):  | 
|     if not CommonCheckTick(curPlayer, tick, ChConfig.TYPE_Player_Tick_PlayerOnlineTime):  | 
|         return  | 
|       | 
|     #´¦Àí·À³ÁÃÔÔÚÏßʱ¼ä£¬  | 
|     PlayerGameWallow.DoLogic_WallowOnlineTime(curPlayer, tick)      | 
|   | 
|     return  | 
|   | 
|       | 
| #---------------------------------------------------------------------  | 
| ##½øÈëÍ˳öÕ½¶·×´Ì¬¼ì²é  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµ, ÒâÒå  | 
| # @remarks ½øÈëÍ˳öÕ½¶·×´Ì¬¼ì²é  | 
| def CheckBattleState(curPlayer, tick):  | 
|     if (curPlayer.GetLastTimeBattleState() != 0 and  | 
|             not curPlayer.IsBattleState()):  | 
|         #Íæ¼ÒÀ뿪ս¶·×´Ì¬  | 
|         OnLeaveBattle(curPlayer, tick)  | 
|         return  | 
|       | 
|     elif (curPlayer.GetLastTimeBattleState() == 0 and  | 
|             curPlayer.IsBattleState()):  | 
|         #Íæ¼Ò½øÈëÕ½¶·×´Ì¬  | 
|         OnEnterBattle(curPlayer, tick)  | 
|         return  | 
|       | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##½øÈëÕ½¶·×´Ì¬  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµ, ÎÞÒâÒå  | 
| # @remarks ½øÈëÕ½¶·×´Ì¬  | 
| def OnEnterBattle(curPlayer, tick):  | 
|     #XW_Fight_EnterFight    <n color="255,0,0">Äú½øÈëµ½ÁËÕ½¶·×´Ì¬£¡</n>   25  -   -  | 
|     #PlayerControl.NotifyCode(curPlayer, 'XW_Fight_EnterFight')  | 
|     curPlayer.SetLastTimeBattleState(1)  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##À뿪ս¶·×´Ì¬  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµ, ÎÞÒâÒå  | 
| # @remarks À뿪ս¶·×´Ì¬  | 
| def OnLeaveBattle(curPlayer, tick):  | 
|     #tagLeaveBattle = ChPyNetSendPack.tagPlayerLeaveBattle()  | 
|     #NetPackCommon.SendFakePack(curPlayer, tagLeaveBattle)  | 
|     #Çå¿ÕÉËѪ¼Ç¼  | 
|     curPlayer.GetPlayerHurtList().Clear()  | 
|     curPlayer.SetLastTimeBattleState(0)  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##Ë¢ÐÂÍæ¼Ò±»¹¥»÷״̬  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµ, ÎÞÒâÒå  | 
| # @remarks Ë¢ÐÂÍæ¼Ò±»¹¥»÷״̬  | 
| def ProcessPlayerBattle(curPlayer, tick):  | 
|     #²»ÔÚÕ½¶·×´Ì¬²»Ë¢Ð  | 
|     if not curPlayer.IsBattleState():  | 
|         return  | 
|       | 
|     #δµ½¼ä¸ô  | 
|     if tick - curPlayer.GetLastBattleTick() < ChConfig.Def_PlayerLeaveBattleTick:  | 
|         return  | 
|      | 
|     #ÍÑÀëÕ½¶·×´Ì¬  | 
|     curPlayer.SetBattleState(False)  | 
|   | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##C++·â°ü´¥·¢, È«¾Ö¶¨Ê±Æ÷, ´¦ÀíÍæ¼Ò״̬  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµ, ÎÞÒâÒå  | 
| # @remarks C++·â°ü´¥·¢, È«¾Ö¶¨Ê±Æ÷, ´¦ÀíÍæ¼Ò״̬  | 
| def ProcessState(tick):  | 
|     GameWorld.GetPsycoFunc(__Func_ProcessState)(tick)  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##C++·â°ü´¥·¢, È«¾Ö¶¨Ê±Æ÷, ´¦ÀíÍæ¼Ò״̬  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµ, ÎÞÒâÒå  | 
| # @remarks C++·â°ü´¥·¢, È«¾Ö¶¨Ê±Æ÷, ´¦ÀíÍæ¼Ò״̬  | 
| def __Func_ProcessState(tick):  | 
|     timeClock = time.clock()  | 
|     #2009-07-01¶ÏÑÔtick >=0 ,·þÎñÆ÷tickΪDWord,³¬¹ý24ÌìÎ´ÖØÆôÓ²¼þ£¬½«µ¼ÖÂÂß¼²»¿ÉÔ¤Öª  | 
|     if tick < 0 :  | 
|         GameWorld.Log('###·þÎñÆ÷ÔËÐÐʱ¼ä³¬¹ý24Ìì tick = %s' % (tick))  | 
|         raise Exception('tick Error')  | 
|       | 
|     #Íæ¼Ò״̬´¦Àí  | 
|     playerManager = GameWorld.GetPlayerManager()  | 
|     playerCount = playerManager.GetActivePlayerCount()  | 
|     for i in range(0, playerCount):  | 
|         curPlayer = playerManager.GetActivePlayerByIndex(i)  | 
|         if curPlayer.GetID() == 0:  | 
|             continue  | 
|           | 
|         ProcessPlayerState(curPlayer, tick)   | 
|       | 
|     #¼ÇÂ¼Íæ¼ÒÂß¼´¦Àí×ܺÄʱ  | 
|     GameLogInfo.LogInfo_PlayerLogicTime(timeClock)  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##´¦ÀíÄ;üÆË㷽ʽΪ:ÏÖʵʱ¼äˢз½Ê½µÄÎïÆ·  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @return ²¼¶ûÖµ  | 
| # @remarks ´¦ÀíÄ;üÆË㷽ʽΪ:ÏÖʵʱ¼äˢз½Ê½µÄÎïÆ·  | 
| def ProcessTimeEquip(curPlayer, tick):  | 
|     itemManager = curPlayer.GetItemManager()  | 
|     hasItemClear = False  | 
|       | 
|     classLV = 0 # Ö»´¦Àí·Ç¾³½ç×°±¸µÄʱЧÎïÆ·  | 
|     curPack = itemManager.GetPack(IPY_GameWorld.rptEquip)  | 
|     for equipPlace in ChConfig.EquipPlace_LingQi:  | 
|         ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)  | 
|         if not ipyData:  | 
|             continue  | 
|         index = ipyData.GetGridIndex()  | 
|         curItem = curPack.GetAt(index)  | 
|           | 
|         #Òì³£ÎïÆ·  | 
|         if not ItemCommon.CheckItemCanUse(curItem):  | 
|             continue  | 
|           | 
|         if curItem.GetEndureReduceType() not in [ChConfig.Def_EquipReduceType_RTimeItem,  | 
|                                                  ChConfig.Def_EquipReduceType_Time]:  | 
|             continue  | 
|           | 
|         #´¦ÀíÏÖʵʱ¼äÎïÆ·Âß¼  | 
|         if __DoLogic_ProcessTimeEquip(curPlayer, curItem, index):  | 
|             hasItemClear = True  | 
|               | 
|     if hasItemClear:  | 
|         #×°±¸ÖØË¢ÊôÐÔ  | 
|         ChEquip.RefreshPlayerLingQiEquipAttr(curPlayer)  | 
|           | 
|     # ½øÐиüÐÂʱЧµÀ¾ßË¢ÐÂʱ¼ä  | 
|     curPlayer.SetDict(ChConfig.Def_PlayerKey_EquipTime, tick)  | 
|     return hasItemClear  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ×°±¸ÓÐЧʱ¼äµ½ÁËÐèÒªÍÑÏ£¬ÓÐЧʱ¼äÎïÆ·¸Ä³É²»Ïûʧ£¬µ«ÊÇÎÞʹÓÃЧ¹û ¿É³öÊÛºÍÐø·Ñ  | 
| def __DoLogic_ProcessTimeEquip(curPlayer, curItem, equipIndex):  | 
|     #ÑéÖ¤ÎïÆ·ÊÇ·ñ¹ýÆÚ  | 
|     curItemExpireTime = curItem.GetUserAttr(ShareDefine.Def_IudetExpireTime)  | 
|     if not curItemExpireTime:  | 
|         curItemExpireTime = curItem.GetExpireTime()  | 
|     curItemPastTime = time.time() - curItem.GetUserAttr(ShareDefine.Def_IudetCreateTime)  | 
|     if curItemExpireTime - curItemPastTime > 0:  | 
|         return  | 
|       | 
|     spaceIndex = ItemControler.GetItemPackSpaceIndex(curPlayer, IPY_GameWorld.rptItem)  | 
|     if spaceIndex == -1:  | 
|         # Ã»ÓпÕλ£¬Íæ¼ÒÖ÷¶¯È¡Ï£¬¼ÆËãÊôÐÔʱÎÞЧ»¯  | 
|         # ¹ýÆÚÊôÐÔʱЧÐèË¢ÊôÐÔ  | 
|         return True  | 
|       | 
|     result = ItemControler.PlayerItemControler(curPlayer).UnEquipItem(equipIndex, spaceIndex)  | 
|     if not result:  | 
|         # ¹ýÆÚÊôÐÔʱЧÐèË¢ÊôÐÔ  | 
|         return True  | 
|     equipID = result[0]  | 
|     equipPlace = result[1]  | 
|     if equipPlace in [ShareDefine.retGuard1, ShareDefine.retGuard2]:  | 
|         PlayerControl.NotifyCode(curPlayer, 'Guardian_Timeout', [equipID, spaceIndex])  | 
|     elif equipPlace == ShareDefine.retWing:  | 
|         PlayerControl.NotifyCode(curPlayer, 'WingTiyan_Timeout')  | 
|           | 
|     tryItemDict = IpyGameDataPY.GetFuncEvalCfg('FirstGoldTryItem', 1, {})  | 
|     tryItemID = tryItemDict.get(curPlayer.GetJob(), 0)  | 
|     if tryItemID and ItemControler.GetAppointItemRealID(tryItemID) == equipID:  | 
|         #Ê׳äÊÔÓÃÎäÆ÷¹ýÆÚ²¢ÇÒ»¹Ã»Ê׳äµÄÌáʾ()  | 
|         if not curPlayer.GetChangeCoinPointTotal():  | 
|             PlayerControl.NotifyCode(curPlayer, 'FirstGoldWPOver')  | 
|             PlayerGoldGift.FirstGoldTryItemOutTime(curPlayer)  | 
|               | 
|     return True  | 
| #---------------------------------------------------------------------  | 
| ##È«¾Ö¶¨Ê±Æ÷µ÷ÓÃ, Ë¢ÐÂÍæ¼Ò״̬  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ×Ô¶¨Ò庯Êý, È«¾Ö¶¨Ê±Æ÷µ÷ÓÃ, Ë¢ÐÂÍæ¼Ò״̬  | 
| def ProcessPlayerState(curPlayer, tick):  | 
|     #Ò»¸öÍæ¼ÒµÄ״̬´¦Àí  | 
|     if not curPlayer.GetInitOK():  | 
|         #Íæ¼Ò»¹Î´³õʼ»¯³É¹¦, ²»´¦Àí  | 
|         #GameWorld.Log("Íæ¼Ò»¹Î´³õʼ»¯³É¹¦, ²»´¦Àí")  | 
|         return  | 
|       | 
|     #¶¨Ê±±¸µµ  | 
|     PlayerBackup.CheckPlayerBackup(curPlayer)  | 
|       | 
|     #±»GM·â״̬ÏìÓ¦  | 
|     ProcessGMOperLogic(curPlayer, tick)  | 
|       | 
|     #Ë¢ÐÂÍæ¼ÒÕ½¶·×´Ì¬  | 
|     ProcessPlayerBattle(curPlayer, tick)  | 
|       | 
|     #Õ½¶·×´Ì¬ÅÐ¶Ï  | 
|     CheckBattleState(curPlayer, tick)  | 
|       | 
|     #Çл»Íæ¼Ò´ôÖÍ״̬  | 
|     ProcessPlayerNeedProcess(curPlayer , tick)  | 
|       | 
|     #·ÅÔÚË¢buffǰ  | 
|     ProcessPassiveSkill(curPlayer, tick)  | 
|       | 
|     #---Ó°ÏìÊôÐÔË¢ÐÂ---------------------------------------------  | 
|     #ÊÇ·ñË¢ÐÂÁÐ±í  | 
|     reFlashList = []  | 
|       | 
|     #Ë¢ÐÂÍæ¼ÒBuff  | 
|     reFlashBuff = ProcessRefreshBuffState(curPlayer, tick)  | 
|       | 
|     #Ë¢ÐÂÍæ¼Ò³¡¾°buffЧ¹û  | 
|     ProcessPlayerBuffEffect(curPlayer, tick)  | 
|       | 
|     #ʱЧµÀ¾ßˢР | 
|     reFlash = ProcessRefreshTimeItem(curPlayer, tick)  | 
|     reFlashList.append(reFlash)  | 
| #    GameWorld.Log('Ë¢ÐÂÒÔµ¥Î»Ê±¼ä(·ÖÖÓ)ÏûºÄÄ;õÄÎïÆ· %s'%(time.clock() - curTime))  | 
| #    curTime = time.clock()  | 
|   | 
|     # Ê±Ð§³ÆºÅ  | 
|     PlayerDienstgrad.CheckDienstgradTimeout(curPlayer)  | 
|       | 
|     #vipÌåÑé  | 
|     reFlash = PlayerVip.CheckVIPExperience(curPlayer, tick)  | 
|     reFlashList.append(reFlash)  | 
|       | 
|     #===Ó°ÏìÈËÎïÐÐΪˢÐÂ, Ö§³Ö¿ØÖÆÀàBUFF¿ÉË¢ÊôÐÔ======================================  | 
|     # ¿ØÖÆÀàÓÐÊôÐÔˢн»¸øÊôÐÔ´¦Àí  | 
|     attrBuffResult, actBuffResult = ProcessRefreshActionBuffState(curPlayer, tick)  | 
|       | 
|     playerControl = PlayerControl.PlayerControl(curPlayer)  | 
|     if actBuffResult:  | 
|         playerControl.RefreshPlayerActionState()  | 
|       | 
|     #===ÐÐΪˢнáÊø==============================================================      | 
|       | 
|     #ÖØË¢ÊôÐÔ  | 
|     # 1. Ñ»·ÄÚÐèҪˢÊôÐÔ  | 
|     # 2. buffÏûʧˢÊôÐÔ  | 
|     # 3. Íæ¼ÒÆäËûÐÐΪ´¥·¢»º´æË¢ÊôÐÔ  | 
|     # 4. Íæ¼ÒÒòbuff»º´æË¢ÊôÐÔ  | 
|     if True in reFlashList :  | 
|         #BuffÓ°Ïìµ½ÊôÐÔˢР | 
|         playerControl.RefreshPlayerAttrState()  | 
|       | 
|       | 
|     #´Ë´¦²ÅÊÇÕæÕýµÄË¢ÐÂÈËÎïÊôÐÔÖµ£¬ÐèË¢ÊôÐÔÂß¼Ó¦ÔÚ´ËÐÐǰµ÷Óà  | 
|     if not playerControl.RefreshPlayerAttrStateEx():  | 
|         if reFlashBuff or attrBuffResult:  | 
|             playerControl.RefreshPlayerAttrByBuff()  | 
|           | 
|         # Ö»Ë¢BUFFÇé¿ö  | 
|         playerControl.RefreshPlayerAttrByBuffEx()     | 
|           | 
|     #---µ½Õâ±ßÓ¦¸ÃÊôÐÔˢнáÊø£¬ÏÂÃæµÄÂß¼ÓеÄÐèÒªÓõ½ÊôÐÔÖµ--------------------  | 
|       | 
|       | 
|     #µ±Ç°Íæ¼ÒµÄ״̬  | 
|     curPlayerAction = curPlayer.GetPlayerAction()  | 
|       | 
| #    curTime = time.clock()  | 
|     #Ë¢ÐÂÍæ¼ÒµÄ×¼±¸½ø¶ÈÌõ  | 
|     if curPlayerAction == IPY_GameWorld.paPreparing :  | 
|         ProcessPlayerPrepareState(curPlayer, tick)  | 
|       | 
|     #Ë¢ÐÂÍæ¼ÒÇëÇó  | 
|     PlayerRequest.ProcessPlayerRequest(curPlayer, tick)  | 
|       | 
|     #»ØÑª»ØÄ§×´Ì¬´¦Àí  | 
|     ProcessHPMPState(curPlayer, tick)  | 
|       | 
|     PlayerYinji.ProcessPlayerYinji(curPlayer, tick)  | 
|       | 
|     #Ë¢ÐÂ×é¶Ó״̬  | 
|     #ProcessTeamState(curPlayer, tick)  | 
|   | 
|     #Íæ¼ÒÔÚÏßʱ¼äˢР | 
|     ProcessPlayer_OnlineTime(curPlayer, tick)  | 
|       | 
|     #·´Íâ¹ÒÑéÖ¤  | 
|     PlayerAutoCheckOnline.HackDefense(curPlayer, tick)  | 
|       | 
|     #¸±±¾Ïà¹ØÊ±¼ä´¦Àí  | 
|     PlayerFB.DoPlayerFBTimeProcess(curPlayer, tick)  | 
|       | 
|     #Íæ¼ÒÊý¾Ý»º´æ¶¨Ê±Í¬²½  | 
|     PlayerViewCacheTube.ProcessCache(curPlayer, tick)  | 
|       | 
|     #ÍÑ»ú¼ÆËã  | 
|     PlayerTJG.ProcessPlayerTJG(curPlayer, tick)  | 
|       | 
|     #PK/boss״̬  | 
|     ProcessPKBossState(curPlayer, tick)  | 
|       | 
|     #¶ñÒâ¹¥»÷ʱ¼ä´¦Àí  | 
|     AttackCommon.ProcessMaliciousAttackPlayer(curPlayer, tick)  | 
|     #³É¾Í  | 
|     PlayerSuccess.FinishDelayAddSuccessProgress(curPlayer, tick, False)  | 
|     #ÏÞʱÇÀ¹º  | 
|     PlayerFlashSale.ProcessFlashSaleMail(curPlayer, tick)  | 
|     #µØÍ¼¾Ñé  | 
|     ProcessAreaExp(curPlayer, tick)  | 
|     #ÉñÃØÉ̵êˢР | 
|     FunctionNPCCommon.CheckMysticalShopRefresh(curPlayer, tick)  | 
|     #»îÔ¾·ÅÖà  | 
|     PlayerActivity.ProcessActivityPlace(curPlayer)  | 
|     #×Ô¶¨Ò峡¾°  | 
|     FBLogic.OnCustomSceneProcess(curPlayer, tick)  | 
|     #¿ç·þÊý¾Ýͬ²½£¬·Å×îºó  | 
|     CrossPlayerData.ProcessCrossPlayer(curPlayer, tick)  | 
|     return  | 
|   | 
|   | 
| # Ò»¶¨Ê±¼ä×Ô¶¯Êͷŵı»¶¯¼¼ÄÜ  | 
| def ProcessPassiveSkill(curPlayer, tick):  | 
|     if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_ProcessPassiveSkill) < \  | 
|     ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_ProcessPassiveSkill]:  | 
|         #ûÓе½Ë¢Ð¼ä¸ô  | 
|         return  | 
|       | 
|     curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_ProcessPassiveSkill, tick)  | 
|     PassiveBuffEffMng.OnPassiveSkillTrigger(curPlayer, None, None, ChConfig.TriggerType_TimeCalc, tick)  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##Íæ¼Ò½øÈëºÍÍ˳ö´ôÖÍ״̬  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks Íæ¼Ò½øÈëºÍÍ˳ö´ôÖÍ״̬  | 
| def ProcessPlayerNeedProcess(curPlayer , tick):  | 
|     if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_NeedProcess) < ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_NeedProcess]:  | 
|         #ûÓе½Ë¢Ð¼ä¸ô  | 
|         return  | 
|       | 
|     curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_NeedProcess, tick)  | 
|       | 
|     #---½øÈë´ôÖÍ״̬---  | 
|     if curPlayer.GetIsNeedProcess():  | 
|           | 
|         curPlayerAction = curPlayer.GetPlayerAction()  | 
|           | 
|         if curPlayerAction in ChConfig.Def_Player_PrimnessState:  | 
|             PlayerControl.SetIsNeedProcess(curPlayer, False)  | 
|             return  | 
|           | 
|         return  | 
|           | 
|     #---Í˳ö´ôÖÍ״̬---  | 
|     if curPlayer.IsBattleState():  | 
|         #Õ½¶·ÖÐ  | 
|         PlayerControl.SetIsNeedProcess(curPlayer, True)  | 
|         return  | 
|       | 
| #    if curPlayer.GetIsConfronting():  | 
| #        #Õ½¶·¶ÔÖÅÖÐ  | 
| #        PlayerControl.SetIsNeedProcess(curPlayer, True)  | 
| #        return  | 
|       | 
| #===============================================================================  | 
| #    givenSkillTypeList = [ChConfig.Def_SkillType_LstPlsBuff, ChConfig.Def_SkillType_LstDepBuff]  # Ìض¨¼¼ÄÜÀàÐÍÁÐ±í  | 
| #      | 
| #    if SkillCommon.IsHasGivenBuff( curPlayer.GetBuffState(), givenSkillTypeList ) or \  | 
| #        SkillCommon.IsHasGivenBuff( curPlayer.GetDeBuffState(), givenSkillTypeList ):  | 
| #        #³ÖÐøbuffÖÐ  | 
| #        PlayerControl.SetIsNeedProcess(curPlayer, True)  | 
| #        return  | 
| #===============================================================================  | 
|     return  | 
| #---------------------------------------------------------------------  | 
| ##GM¿ª¹Ø»î¶¯, µØÍ¼·þÎñÆ÷¸ø¾Ñé  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks GM¿ª¹Ø»î¶¯, µØÍ¼·þÎñÆ÷¸ø¾Ñé  | 
| def ProcessMapGiveExp(curPlayer, tick):  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     #¾Ñé±¶ÂÊ  | 
|     exp_Multiple = 0  | 
|     if gameWorld.IsEventActive(ChConfig.Def_GY_GM_GameID_MapGiveExp_Ten):  | 
|         exp_Multiple = 10  | 
|     elif gameWorld.IsEventActive(ChConfig.Def_GY_GM_GameID_MapGiveExp_Fifty):  | 
|         exp_Multiple = 50  | 
|     else:  | 
|         #Î޻  | 
|         return  | 
|       | 
|     mapExpTick = curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_GiveMapExp)  | 
|       | 
|     if mapExpTick == 0:  | 
|         #µÚÒ»´ÎÉ趨µ±Ç°Ê±¼ä  | 
|         curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_GiveMapExp, tick)  | 
|         return  | 
|       | 
|     if tick - mapExpTick < ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_GiveMapExp]:  | 
|         #ûÓе½Ë¢Ð¼ä¸ô  | 
|         return  | 
|       | 
|     curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_GiveMapExp, tick)   | 
|       | 
|     reExp = 0  | 
|       | 
|     playerControl = PlayerControl.PlayerControl(curPlayer)  | 
|     #Íæ¼Ò¾ÑéÔö¼Ó ²Î¿¼¾Ñé * ¾Ñé±¶ÂÊ  | 
|     playerControl.AddExp(reExp * exp_Multiple)  | 
|       | 
|     return  | 
| #---------------------------------------------------------------------  | 
| ##Çå¿ÕÍæ¼ÒÁ¬Ðø»÷ɱÊýÁ¿  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks Çå¿ÕÍæ¼ÒÁ¬Ðø»÷ɱÊýÁ¿  | 
| def ReFlashPlayerAttackKill(curPlayer, tick):  | 
|     if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_ClearKill) < ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_ClearKill]:  | 
|         #ûÓе½Ë¢Ð¼ä¸ô  | 
|         return  | 
|       | 
|     curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_ClearKill, tick)  | 
|       | 
|     curPlayer.ClearPlayerKillListInTime()  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¶¯Ì¬±ä¶¯Íæ¼ÒµÄÊÓÒ°  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ¶¯Ì¬±ä¶¯Íæ¼ÒµÄÊÓÒ°  | 
| def ChangePlayerSigh(curPlayer , tick):  | 
|     if FBLogic.OnPlayerSight(curPlayer, tick):  | 
|         #¸±±¾ÖÐÈç´¦Àí¹ý£¬ÔòÌø³ö  | 
|         return  | 
|   | 
|     #09/05/06 ÊÓҰϵͳ¸ÄΪ¹Ì¶¨Öµ  | 
|     if curPlayer.GetSight() != ChConfig.Def_PlayerSight_Default:  | 
|         PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default)  | 
| #        curPlayer.SetSight(ChConfig.Def_PlayerSight_Default)  | 
|       | 
| #===============================================================================  | 
| #    #ÊÓÒ°ÄڵĶÔÏ󳬳öÊýÁ¿  | 
| #    if curPlayer.GetInSightObjCount() > ChConfig.Def_PlayerInSightObjCount_Default:  | 
| #        if curPlayer.GetSight() == ChConfig.Def_PlayerSight_Default:  | 
| #            curPlayer.SetSight(ChConfig.Def_PlayerSight_Optimize)  | 
| #    #ÊÓÒ°ÄڵĶÔÏó䳬¹ý  | 
| #    else:  | 
| #        if curPlayer.GetSight() == ChConfig.Def_PlayerSight_Optimize:   | 
| #            curPlayer.SetSight(ChConfig.Def_PlayerSight_Default)  | 
| #===============================================================================  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##´¦ÀíGMʼþ, Èç½ûÑÔ,·â´æµÈÐÅÏ¢  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ´¦ÀíGMʼþ, Èç½ûÑÔ,·â´æµÈÐÅÏ¢  | 
| def ProcessGMOperLogic(curPlayer , tick):  | 
|     if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_GMOper) < ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_GMOper]:  | 
|         #ûÓе½Ë¢Ð¼ä¸ô  | 
|         return  | 
|       | 
|     curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_GMOper, tick)  | 
|       | 
|     PlayerGMOper.DoGMOperLogic(curPlayer, tick)  | 
|     return  | 
|   | 
|   | 
| #===============================================================================  | 
| # ¾¯¸æ:1.´Ë¹¦ÄÜÓ¦¸Ã»áµ¼Ö¸ü¼ÓƵ·±´¦ÀíÕ½¶·Âß¼¸½´øµÄË¢ÐÂÊôÐÔµÈÂß¼  | 
| # ÐèÈý˼¿¼ÂÇ£¬ÔÝʱ¹Ø±Õ¡£  | 
| #   | 
| # ## ¼ÆÊ±Æ÷Èë¿Ú£¬Õ½¶·Âß¼  | 
| # # @param None  | 
| # # @return None  | 
| # def PlayerProcessFight(timerType, tick):  | 
| #    if not GameWorld.GetGameWorld().GetInitOK() :  | 
| #        return  | 
| #      | 
| #    #GameWorld.DebugLog("---!!PlayerProcessFight %s"%([timerType, tick]))  | 
| #      | 
| #    for i in xrange(GameWorld.GetGameWorld().GetGameWorldCount()):  | 
| #        #ÉèÖõ±Ç°µÄÊÀ½ç  | 
| #        GameWorld.GetGameWorld().SetCurGameWorldIndex(i)  | 
| #   | 
| #        playerManager = GameWorld.GetPlayerManager()  | 
| #        playerCount = playerManager.GetActivePlayerCount()  | 
| #        for i in range(0, playerCount):  | 
| #            curPlayer = playerManager.GetActivePlayerByIndex(i)  | 
| #            if curPlayer.IsEmpty():  | 
| #                continue  | 
| #   | 
| #            if not curPlayer.GetInitOK():  | 
| #                #GameWorld.Log("Íæ¼Ò»¹Î´³õʼ»¯³É¹¦, ²»´¦Àí")  | 
| #                continue  | 
| #              | 
| #            if curPlayer.IsMoving():  | 
| #                continue  | 
| #              | 
| #            ProcessFight(curPlayer, tick)  | 
| #   | 
| #    GameWorld.GetGameWorld().SetCurGameWorldIndex(-1)  | 
| #          | 
| #    return  | 
| #===============================================================================  | 
|   | 
| def ProcessPKBossState(curPlayer, tick):  | 
|     ## ´¦ÀíPK¼°boss״̬  | 
|     validTime = IpyGameDataPY.GetFuncCfg("PKConfig", 4) * 1000  | 
|       | 
|     pkStateTick = curPlayer.GetDictByKey(ChConfig.Def_PDict_PKStateTick)  | 
|     if pkStateTick and (tick - pkStateTick) >= validTime:  | 
|         curPlayer.SetDict(ChConfig.Def_PDict_PKStateTick, 0)  | 
|         PlayerControl.SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_PKState, 0)  | 
|         #GameWorld.DebugLog("Í˳öPK״̬!", curPlayer.GetPlayerID())  | 
|         curPlayer.SetDict("StartProDTick", tick) # ¿ªÊ¼»Ö¸´Ê±¼äµã  | 
|           | 
|     bossStateTick = curPlayer.GetDictByKey(ChConfig.Def_PDict_BossStateTick)  | 
|     if bossStateTick and (tick - bossStateTick) >= validTime:  | 
|         curPlayer.SetDict(ChConfig.Def_PDict_BossStateTick, 0)  | 
|         PlayerControl.SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_BossState, 0)  | 
|         #GameWorld.DebugLog("Í˳öBoss״̬!", curPlayer.GetPlayerID())  | 
|       | 
|     # ÍÑÀëPKÕ½¶· XÃëºó°´±ÈÀý»Ö¸´  | 
|     ProcessProDef(curPlayer, tick)  | 
|     return  | 
|   | 
| def Sync_PKBossState(curPlayer):  | 
|     psState = 1 if curPlayer.GetDictByKey(ChConfig.Def_PDict_PKStateTick) else 0  | 
|     PlayerControl.SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_PKState, psState)  | 
|       | 
|     bossState = 1 if curPlayer.GetDictByKey(ChConfig.Def_PDict_BossStateTick) else 0  | 
|     PlayerControl.SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_BossState, bossState)  | 
|     return  | 
|   | 
| # ÍÑÀëPKÕ½¶· XÃëºó°´±ÈÀý»Ö¸´  | 
| def ProcessProDef(curPlayer, tick):  | 
|     if PlayerControl.GetProDefHPPer(curPlayer) == 0:  | 
|         # Ã»×ª»¯Öµ  | 
|         return  | 
|       | 
|     # ÍÑÀëPKÕ½¶· XÃëºó°´±ÈÀý»Ö¸´  | 
|     if IsInPKState(curPlayer):  | 
|         return  | 
|       | 
|     if tick - curPlayer.GetDictByKey("StartProDTick") < IpyGameDataPY.GetFuncCfg("MagicExterior", 2) * 1000:  | 
|         return  | 
|       | 
|     if curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:  | 
|         return  | 
|       | 
|     # Ã¿Ãë»Ö¸´  | 
|     if tick - curPlayer.GetDictByKey("restoreProDTick") < 1000:  | 
|         return  | 
|       | 
|     curProDef = PlayerControl.GetProDef(curPlayer)  | 
|     maxProDef = PlayerControl.GetMaxProDef(curPlayer)  | 
|       | 
|     if curProDef == maxProDef:  | 
|         return  | 
|       | 
|     #·ÇPK״̬»Ö¸´»¤¶Ü  | 
|     PlayerControl.SetProDef(curPlayer, min(curProDef + \  | 
|                             IpyGameDataPY.GetFuncCfg("MagicExterior", 3)*maxProDef/ChConfig.Def_MaxRateValue, maxProDef))  | 
|     curPlayer.SetDict("restoreProDTick", tick)  | 
|   | 
|     return  | 
|   | 
|   | 
| def IsInPKState(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PDict_PKStateTick) > 0  | 
| def SetPKStateTick(curPlayer, tick):  | 
|     if not curPlayer.GetDictByKey(ChConfig.Def_PDict_PKStateTick):  | 
|         PlayerControl.SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_PKState, 1)  | 
|     curPlayer.SetDict(ChConfig.Def_PDict_PKStateTick, tick)  | 
|     #GameWorld.DebugLog("ÉèÖÃPK״̬tick!tick=%s" % tick, curPlayer.GetPlayerID())  | 
|     return  | 
|   | 
| def IsInBossState(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PDict_BossStateTick) > 0  | 
| def SetBossStateTick(curPlayer, tick):  | 
|     if not curPlayer.GetDictByKey(ChConfig.Def_PDict_BossStateTick):  | 
|         PlayerControl.SendPropertyRefresh(curPlayer, ShareDefine.CDBPlayerRefresh_BossState, 1)  | 
|     curPlayer.SetDict(ChConfig.Def_PDict_BossStateTick, tick)  | 
|     #GameWorld.DebugLog("ÉèÖÃBoss״̬tick!tick=%s" % tick, curPlayer.GetPlayerID())  | 
|     return  | 
|       | 
| def ProcessAreaExp(curPlayer, tick):  | 
|     ##¸ø³¡¾°¾Ñé  | 
|     if GameWorld.IsCrossServer():  | 
|         return  | 
|     if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):  | 
|         return  | 
|     crossMapID = PlayerControl.GetCrossMapID(curPlayer)  | 
|     mapID = crossMapID if crossMapID else GameWorld.GetMap().GetMapID()  | 
|     if not FBLogic.OnCanGetAreaExp(curPlayer, mapID):  | 
|         return  | 
|     neutralMapExpAwardDict = IpyGameDataPY.GetFuncEvalCfg('NeutralMapExpAward', 1, {})  | 
|     expAwardInfo = GameWorld.GetDictValueByKey(neutralMapExpAwardDict, mapID)  | 
|     if not expAwardInfo:  | 
|         return  | 
|     if len(expAwardInfo) != 2:  | 
|         return  | 
|     secondCD, expFormula = expAwardInfo  | 
|     lastTick = curPlayer.GetDictByKey(ChConfig.Def_PDict_MapAreaExpTick)  | 
|     if not lastTick:  | 
|         curPlayer.SetDict(ChConfig.Def_PDict_MapAreaExpTick, tick)  | 
|         return  | 
|     if tick - lastTick < secondCD:  | 
|         return  | 
|     curPlayer.SetDict(ChConfig.Def_PDict_MapAreaExpTick, tick)  | 
|       | 
|     reExp = PlayerControl.GetPlayerReExp(curPlayer)  | 
|     reLV = curPlayer.GetLV()  | 
|     worldLV = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)  | 
|     addExp = eval(FormulaControl.GetCompileFormula('NeutralMapExpAward%s'%mapID, expFormula))  | 
|     PlayerControl.PlayerControl(curPlayer).AddExp(addExp, ShareDefine.Def_ViewExpType_SysEx)  | 
|     return  |