#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # ##@package Player.PlayerPrestigeSys # # @todo:¾ôλϵͳ/ÉÙÄê¾³½ç # @author hxp # @date 2017-7-21 # @version 1.0 # # ÏêϸÃèÊö: ¾ôλϵͳ/ÉÙÄê¾³½ç # #------------------------------------------------------------------------------- #"""Version = 2017-10-10 14:30""" #------------------------------------------------------------------------------- import ItemCommon import ItemControler import FBCommon import GameFuncComm import PlayerControl import ChPyNetSendPack import NetPackCommon import IPY_GameWorld import IpyGameDataPY import ShareDefine import GameWorld import ChConfig import PlayerSuccess import ChEquip import PlayerBillboard import PlayerTongTianLing import PassiveBuffEffMng import PlayerGubao import EventShell import DataRecordPack import SkillCommon import time #------------------------------------------------------------------------------ # ¶É½ÙÈÎÎñÀàÐÍ RealmTaskTypeList = ( RealmTaskType_LV, # µÈ¼¶ 1 RealmTaskType_PassMap, # ¹ý¹Ø¹Ø¿¨ 2 RealmTaskType_KillNPC, # »÷ɱNPC 3 RealmTaskType_LVUPItem, # ½ø½×µ¤ 4 RealmTaskType_Equip, # »ù´¡×°±¸Ã÷ϸ 5 RealmTaskType_Dujie, # ¶É½Ùboss 6 ) = range(1, 1 + 6) # ÐèÒª¼Ç¼ÈÎÎñÖµµÄÈÎÎñÀàÐÍÁбí NeedTaskValueTypeList = [RealmTaskType_KillNPC, RealmTaskType_Dujie] def DoOfficialOpen(curPlayer): #¹¦ÄÜ¿ªÆô # curRealmLV = curPlayer.GetOfficialRank() # if not curRealmLV: # DoRealmLVUpLogic(curPlayer) return True def OnLogin(curPlayer): DoRealmVersionStateLogic(curPlayer) SyncRealmFBState(curPlayer, isAll=True) UpdateRealmExp(curPlayer, False) NotifyRealmExpInfo(curPlayer) if not curPlayer.GetOfficialRank(): curPlayer.SetOfficialRank(1) return def DoRealmVersionStateLogic(curPlayer): ## Ö´Ðа汾±ä¸üÂß¼­£¬½ö´¥·¢Ò»´Î£¬Ö®ºó¿Éɾ³ý state = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmVersionState) if state: GameWorld.DebugLog("¾³½ç°æ±¾±ä¸üÂß¼­ÒÑÖØÖùý!", curPlayer.GetPlayerID()) return PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmVersionState, 1) realmLV = curPlayer.GetOfficialRank() if realmLV <= 1: # ÐºŲ»´¦Àí return playerID = curPlayer.GetPlayerID() GameWorld.Log("======================== Ö´Ðо³½ç°æ±¾±ä¸üÖØÖÃÂß¼­ =======================", playerID) # ÖØÖþ³½ç curPlayer.SetOfficialRank(1) # ·µ»¹¾³½çµ¤ returnItemID = IpyGameDataPY.GetFuncCfg("RealmLvUP", 1) returnCount = 0 itemCntList = IpyGameDataPY.GetFuncEvalCfg("RealmVersion", 1) for rLV, needCnt in enumerate(itemCntList): if rLV > realmLV: break returnCount += needCnt GameWorld.Log("¾³½çµÈ¼¶: realmLV=%s,returnItemID=%s,returnCount=%s" % (realmLV, returnItemID, returnCount), playerID) # ÖØÖÃÁé¸ùµã£¬¿Û³ýÔùËÍÁé¸ùµã linggenPointDel = 0 linggenPointLVAdd = 0 linggenCntList = IpyGameDataPY.GetFuncEvalCfg("RealmVersion", 2) for rLV, lgPoint in enumerate(linggenCntList): if rLV > realmLV: break linggenPointDel += lgPoint linggenPointLVAdd += lgPoint # ¹Å±¦Ð§¹ûÔùËÍÁé¸ùµã linggenPointGubaoAdd = 0 resetGubaoEffValueKeyList = [] effType = PlayerGubao.GubaoEffType_RealmLVAddLinggen ipyDataMgr = IpyGameDataPY.IPY_Data() for index in range(ipyDataMgr.GetGubaoCount()): ipyData = ipyDataMgr.GetGubaoByIndex(index) gubaoID = ipyData.GetGubaoID() addFreePointAlready = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GubaoItemEffValue % (gubaoID, effType)) if not addFreePointAlready: continue resetGubaoEffValueKeyList.append(ChConfig.Def_PDict_GubaoItemEffValue % (gubaoID, effType)) linggenPointDel += addFreePointAlready linggenPointGubaoAdd += addFreePointAlready freePointBef = curPlayer.GetFreePoint() linggenPointTotalBef = freePointBef addPointDict = {} ipyDataMgr = IpyGameDataPY.IPY_Data() for index in range(ipyDataMgr.GetRolePointCount()): linggenID = ipyDataMgr.GetRolePointByIndex(index).GetAttrID() linggenPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % linggenID) addPointDict[linggenID] = linggenPoint linggenPointTotalBef += linggenPoint GameWorld.Log("ÖØÖÃǰÁé¸ùµã: freePointBef=%s,linggenPointTotalBef=%s,addPointDict=%s" % (freePointBef, linggenPointTotalBef, addPointDict), playerID) if linggenPointDel: import Item_ResetAttrPoint Item_ResetAttrPoint.DoResetAttrPoint(curPlayer, 0, 0) updFreePoint = max(0, curPlayer.GetFreePoint() - linggenPointDel) curPlayer.SetFreePoint(updFreePoint) for resetKey in resetGubaoEffValueKeyList: PlayerControl.NomalDictSetProperty(curPlayer, resetKey, 0) GameWorld.Log("ÖØÖþ³½çÁé¸ùµã: linggenPointDel=%s,updFreePoint=%s,linggenPointLVAdd=%s,linggenPointGubaoAdd=%s" % (linggenPointDel, updFreePoint, linggenPointLVAdd, linggenPointGubaoAdd), playerID) # ɾ³ý¾³½ç¼¼ÄÜ delSkillIDList = [] skillIDList = IpyGameDataPY.GetFuncEvalCfg("RealmVersion", 3) skillManager = curPlayer.GetSkillManager() playerControl = PlayerControl.PlayerControl(curPlayer) for skillID in skillIDList: if not skillManager.FindSkillBySkillID(skillID): continue skillManager.DeleteSkillBySkillID(skillID) delSkillIDList.append(skillID) playerControl.RefreshSkillFightPowerByDel(skillID) playerControl.RefreshPlayerAttrState() PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEffSet(curPlayer) GameWorld.Log("ÖØÖþ³½çɾ³ý¼¼ÄÜIDÁбí: %s" % delSkillIDList, playerID) # ¾³½çÄѶȵØÍ¼ÖØÖà PlayerControl.SetRealmDifficulty(curPlayer, 0) GameWorld.Log("ÖØÖþ³½çÄѶȵȼ¶Ñ¡Ôñ!", playerID) itemListEx = IpyGameDataPY.GetFuncEvalCfg("RealmVersion", 4) mailItemList = [[returnItemID, returnCount, 0]] + itemListEx paramList = [linggenPointDel, returnItemID, returnItemID, returnCount] PlayerControl.SendMailByKey("RealmVersion", [playerID], mailItemList, paramList) GameWorld.Log("ÖØÖþ³½çÓʼþ: mailItemList=%s" % mailItemList, playerID) # ¼Ç¼Á÷Ïò freePointAft = curPlayer.GetFreePoint() linggenPointTotalAft = freePointAft addPointDictAft = {} ipyDataMgr = IpyGameDataPY.IPY_Data() for index in range(ipyDataMgr.GetRolePointCount()): linggenID = ipyDataMgr.GetRolePointByIndex(index).GetAttrID() linggenPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AddPointValue % linggenID) addPointDictAft[linggenID] = linggenPoint linggenPointTotalAft += linggenPoint GameWorld.Log("ÖØÖúóÁé¸ùµã: freePointAft=%s,linggenPointTotalAft=%s,addPointDictAft=%s" % (freePointAft, linggenPointTotalAft, addPointDictAft), playerID) dataDict = {"realmLV":realmLV, "returnItemID":returnItemID, "returnCount":returnCount, "linggenPointDel":linggenPointDel, "linggenPointLVAdd":linggenPointLVAdd, "linggenPointGubaoAdd":linggenPointGubaoAdd, "linggenPointTotalBef":linggenPointTotalBef, "linggenPointTotalAft":linggenPointTotalAft, "freePointBef":freePointBef, "freePointAft":freePointAft, "addPointDict":addPointDict, "delSkillIDList":delSkillIDList, "mailItemList":mailItemList} DataRecordPack.SendEventPack("RealmVersionReset", dataDict, curPlayer) GameWorld.Log("======================= ¾³½ç°æ±¾±ä¸üÖØÖÃÍê±Ï =======================", playerID) return def GetRealmIpyData(realmLV): return IpyGameDataPY.GetIpyGameData("Realm", realmLV) #// A5 24 ¿ªÆô¶É½Ù #tagCMOpenRealmFB # #struct tagCMOpenRealmFB #{ # tagHead Head; #}; def OpenRealmFB(index, clientData, tick): return def GetXXZLAward(curPlayer, taskID): ## ÁìÈ¡ÐÞÏÉ֮·½±Àø£¬·ÏÆú return def SyncRealmFBState(curPlayer, taskIDList=None, isAll=False): #֪ͨ¿Í»§¶Ë¶É½Ù¸±±¾ÊÇ·ñ¿ªÆô #if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Official): # return sendPack = ChPyNetSendPack.tagMCSyncRealmInfo() sendPack.TaskAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmTaskAwardState) sendPack.TaskValueList = [] if isAll and taskIDList == None: taskIDList = [] curRealmLV = curPlayer.GetOfficialRank() taskIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("RealmLVUPTask", curRealmLV) if taskIpyDataList: for taskIpyData in taskIpyDataList: if taskIpyData.GetTaskType() in NeedTaskValueTypeList: taskIDList.append(taskIpyData.GetTaskID()) if taskIDList: for taskID in taskIDList: task = ChPyNetSendPack.tagMCSyncRealmTask() task.TaskID = taskID task.TaskValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmTaskValue % taskID) sendPack.TaskValueList.append(task) sendPack.TaskValueCount = len(sendPack.TaskValueList) NetPackCommon.SendFakePack(curPlayer, sendPack) return ## ¼ÆËã¾ôλÊôÐÔ # @param curPlayer Íæ¼Ò # @param allAttrList ÊôÐÔÁбí # @return None def CalcOfficialRankAttr(curPlayer): if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Official): return curRealmLV = curPlayer.GetOfficialRank() realmIpyData = GetRealmIpyData(curRealmLV) if not realmIpyData: return addAttrIDList, addAttrValueList = realmIpyData.GetAddAttrType(), realmIpyData.GetAddAttrNum() allAttrList = [{} for i in range(4)] for i, attrID in enumerate(addAttrIDList): PlayerControl.CalcAttrDict_Type(attrID, addAttrValueList[i], allAttrList) # ±£´æ¼ÆËãÖµ PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Prestige, allAttrList) return ## ÖØË¢ËùÓÐÊôÐÔ # @param curPlayer # @param isForceRefresh:Ç¿ÖÆË¢ÐÂÅÅÐаñ # @return Ö¸¶¨Êý¾Ý def RefreshOfficialAttr(curPlayer): CalcOfficialRankAttr(curPlayer) PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState() return def AddRealmTaskValue(curPlayer, taskType, addValue): ## Ôö¼Ó¾³½çÈÎÎñÖµ if taskType not in NeedTaskValueTypeList: return if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Official): return realmLV = curPlayer.GetOfficialRank() taskIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("RealmLVUPTask", realmLV) if not taskIpyDataList: return syncTaskIDList = [] for taskIpyData in taskIpyDataList: if taskType != taskIpyData.GetTaskType(): continue taskID = taskIpyData.GetTaskID() needValue = GetRealmTaskNeedValue(taskIpyData.GetNeedValueList(), 0) curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmTaskValue % taskID) if curValue >= needValue: continue syncTaskIDList.append(taskID) updValue = min(curValue + addValue, needValue) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmTaskValue % taskID, updValue) GameWorld.DebugLog("¸üо³½çÈÎÎñÖµ: realmLV=%s,taskType=%s,taskID=%s,updValue=%s,curValue=%s,addValue=%s" % (realmLV, taskType, taskID, updValue, curValue, addValue), curPlayer.GetPlayerID()) if syncTaskIDList: SyncRealmFBState(curPlayer, taskIDList=syncTaskIDList) return def GetRealmTaskNeedValue(needValueList, index): return needValueList[index] if len(needValueList) > index else 0 def GetRealmLVUpTaskAward(curPlayer, taskID): ## ÁìÈ¡¾³½ç¶É½ÙÈÎÎñÌõ¼þ½±Àø playerID = curPlayer.GetPlayerID() realmLV = curPlayer.GetOfficialRank() awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmTaskAwardState) if awardState&pow(2, taskID): GameWorld.DebugLog("¾³½çÈÎÎñÁì½±£¬ÒÑÁìÈ¡¹ý! realmLV=%s,taskID=%s" % (realmLV, taskID), playerID) return taskIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("RealmLVUPTask", realmLV) if not taskIpyDataList: return taskIpyData = None for tIpyData in taskIpyDataList: if taskID != tIpyData.GetTaskID(): continue taskIpyData = tIpyData break if not taskIpyData: GameWorld.DebugLog("ûÓиþ³½çÈÎÎñ! realmLV=%s,taskID=%s" % (realmLV, taskID), playerID) return taskType = taskIpyData.GetTaskType() needValueList = taskIpyData.GetNeedValueList() needValueA = GetRealmTaskNeedValue(needValueList, 0) awardItemList = taskIpyData.GetAwardItemList() # Íæ¼ÒµÈ¼¶ if taskType == RealmTaskType_LV: playerLV = curPlayer.GetLV() if playerLV < needValueA: GameWorld.DebugLog('¾³½çÈÎÎñÁì½±£¬µÈ¼¶²»×ã! realmLV=%s,taskID=%s,taskType=%s,playerLV=%s < %s' % (realmLV, taskID, taskType, playerLV, needValueA), playerID) return # ¹ý¹Ø¸±±¾ elif taskType == RealmTaskType_PassMap: mapID = needValueA lineID = GetRealmTaskNeedValue(needValueList, 1) if not FBCommon.IsFBPass(curPlayer, mapID, lineID): GameWorld.DebugLog('¾³½çÈÎÎñÁì½±£¬Î´¹ý¹Ø! realmLV=%s,taskID=%s,taskType=%s,mapID=%s,lineID=%s' % (realmLV, taskID, taskType, mapID, lineID), playerID) return # ½ø½×µ¤ elif taskType == RealmTaskType_LVUPItem: itemID = IpyGameDataPY.GetFuncCfg("RealmLvUP", 1) needItemCount = needValueA itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem) lackItemDict, delInfoDict = ItemCommon.GetCostItemIndexList({itemID:needItemCount}, itemPack) if lackItemDict: GameWorld.DebugLog('¾³½çÈÎÎñÁì½±£¬ÎïÆ·²»×ã! realmLV=%s,taskID=%s,taskType=%s,lackItemDict=%s' % (realmLV, taskID, taskType, lackItemDict), playerID) return ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, "Realm") # ×°±¸ elif taskType == RealmTaskType_Equip: if len(needValueList) != 4: GameWorld.DebugLog('¾³½çÈÎÎñÁì½±£¬×°±¸Ìõ¼þÅäÖôíÎ󣬳¤¶È±ØÐëΪ4! realmLV=%s,taskID=%s,taskType=%s,needValueList=%s' % (realmLV, taskID, taskType, needValueList), playerID) return classLV, star, isSuite, color = needValueList equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip) for place in ChConfig.EquipPlace_Base: ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, place) if not ipyData: return gridIndex = ipyData.GetGridIndex() curEquip = equipPack.GetAt(gridIndex) if not ItemCommon.CheckItemCanUse(curEquip): GameWorld.DebugLog('¾³½çÈÎÎñÁì½±£¬×°±¸Î»ÎÞ×°±¸! realmLV=%s,taskID=%s,taskType=%s,classLV=%s,place=%s' % (realmLV, taskID, taskType, classLV, place), playerID) return curPartStar = ChEquip.GetEquipPartStar(curPlayer, gridIndex) if curPartStar < star: GameWorld.DebugLog('¾³½çÈÎÎñÁì½±£¬×°±¸Î»ÐǼ¶²»×ã! realmLV=%s,taskID=%s,taskType=%s,classLV=%s,place=%s,curPartStar=%s < %s' % (realmLV, taskID, taskType, classLV, place, curPartStar, star), playerID) return if isSuite and not curEquip.GetSuiteID(): GameWorld.DebugLog('¾³½çÈÎÎñÁì½±£¬×°±¸Î»·ÇÌ××°! realmLV=%s,taskID=%s,taskType=%s,classLV=%s,place=%s' % (realmLV, taskID, taskType, classLV, place), playerID) return if curEquip.GetItemColor() < color: GameWorld.DebugLog('¾³½çÈÎÎñÁì½±£¬×°±¸Î»Æ·Öʲ»×ã! realmLV=%s,taskID=%s,taskType=%s,classLV=%s,place=%s,ItemColor=%s < %s' % (realmLV, taskID, taskType, classLV, place, curEquip.GetItemColor(), color), playerID) return # ¶É½Ù elif taskType == RealmTaskType_Dujie: curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmTaskValue % taskID) if not curValue: GameWorld.DebugLog('¾³½çÈÎÎñÁì½±£¬¶É½Ùδ¹ý¹Ø! realmLV=%s,taskID=%s,taskType=%s' % (realmLV, taskID, taskType), playerID) return # ¸ù¾Ý¼Ç¼ÈÎÎñ½ø¶ÈÖµ elif taskType in NeedTaskValueTypeList: curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmTaskValue % taskID) if curValue < needValueA: GameWorld.DebugLog('¾³½çÈÎÎñÁì½±£¬Ìõ¼þ²»×ã! realmLV=%s,taskID=%s,taskType=%s,curValue=%s < %s' % (realmLV, taskID, taskType, curValue, needValueA), playerID) return else: return ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, event=["RealmTask", False, {}]) updAwardState = awardState|pow(2, taskID) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmTaskAwardState, updAwardState) GameWorld.DebugLog("¾³½ç¶É½ÙÁì½±OK! realmLV=%s,taskID=%s,updAwardState=%s" % (realmLV, taskID, updAwardState), playerID) SyncRealmFBState(curPlayer) return def CheckRealmTaskFinishAll(curPlayer): ## ¼ì²é¾³½çÈÎÎñÊÇ·ñÒÑÈ«²¿Íê³É realmLV = curPlayer.GetOfficialRank() taskIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("RealmLVUPTask", realmLV) if not taskIpyDataList: GameWorld.DebugLog("ûÓо³½çÈÎÎñËãδÍê³É! realmLV=%s" % (realmLV), curPlayer.GetPlayerID()) return awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmTaskAwardState) for taskIpyData in taskIpyDataList: taskID = taskIpyData.GetTaskID() if not awardState&pow(2, taskID): GameWorld.DebugLog("¾³½çÈÎÎñδÍê³ÉÁì½±! realmLV=%s,taskID=%s" % (realmLV, taskID), curPlayer.GetPlayerID()) return return True #// A5 23 ÌáÉý¾³½çµÈ¼¶ # tagCMRealmLVUp # #struct tagCMRealmLVUp #{ # tagHead Head; #}; def DoRealmLVUp(index, clientData, tick): #Éý¼¶¾³½ç curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) curRealmLV = curPlayer.GetOfficialRank() realmIpyData = GetRealmIpyData(curRealmLV) if not realmIpyData: GameWorld.ErrLog("ûÓиþ³½çµÈ¼¶Êý¾Ý! Lv=%s" % curRealmLV) return if not CheckRealmTaskFinishAll(curPlayer): return DoRealmLVUpLogic(curPlayer) return def DoRealmLVUpLogic(curPlayer, needSys=True): curRealmLV = curPlayer.GetOfficialRank() nextRealmLv = curRealmLV + 1 GameWorld.DebugLog(' Éý¼¶¾³½çnextRealmLv=%s' % nextRealmLv) nextRealmIpyData = GetRealmIpyData(nextRealmLv) if not nextRealmIpyData: return curPlayer.SetOfficialRank(nextRealmLv) PlayerGubao.DoGubaoAddFreePoint(curPlayer) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmTaskAwardState, 0) syncTaskIDList = [] taskIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("RealmLVUPTask", nextRealmLv) if taskIpyDataList: for taskIpyData in taskIpyDataList: taskID = taskIpyData.GetTaskID() if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmTaskValue % taskID): PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmTaskValue % taskID, 0) syncTaskIDList.append(taskID) PlayerControl.PlayerControl(curPlayer).PlayerLvUp() if needSys: addBuffID = nextRealmIpyData.GetBuffID() if addBuffID: PlayerControl.WorldNotify(0, 'BigRealmUpSuccess', [curPlayer.GetName(), curPlayer.GetID(), nextRealmLv, IpyGameDataPY.GetFuncCfg('RadioExpRealm')]) msgStr = str(addBuffID) GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'RealmUpAddBuff', msgStr, len(msgStr)) else: PlayerControl.WorldNotify(0, 'RealmUpSuccess', [curPlayer.GetName(), curPlayer.GetID(), nextRealmLv]) if SkillCommon.GivePlayerSkillByJobSkill(curPlayer, nextRealmIpyData.GetLearnSkillIDInfo()): PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEffSet(curPlayer) addFreePoint = nextRealmIpyData.GetAddFreePoint() if addFreePoint: updFreePoint = curPlayer.GetFreePoint() + addFreePoint curPlayer.SetFreePoint(updFreePoint) GameWorld.DebugLog(" ¾³½ç½×¼¶¼ÓÁé¸ùµã: addFreePoint=%s,updFreePoint=%s" % (addFreePoint, updFreePoint)) RefreshOfficialAttr(curPlayer) GameFuncComm.DoFuncOpenLogic(curPlayer) SyncRealmFBState(curPlayer, taskIDList=syncTaskIDList) #¸üÐÂÐÞΪËÙÂÊ UpdateRealmExp(curPlayer, False, True) NotifyRealmExpInfo(curPlayer) #¾³½çÌáÉý³É¾Í PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_RealmlvUp, nextRealmLv) PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_RealmUp, 1) #¸üÐÂÅÅÐаñ PlayerBillboard.UpdateRealmBillboard(curPlayer) # ¼Ç¼¿ª·þ»î¶¯ #OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_RealmLV, nextRealmLv) EventShell.EventRespons_RealmUp(curPlayer, nextRealmLv) #Á÷Ïò DataRecordPack.DR_RealmLVUp(curPlayer, nextRealmLv) return True #// A5 21 ¾³½çÐÞΪ³ØÌáÈ¡ #tagCMTakeOutRealmExp # #struct tagCMTakeOutRealmExp #{ # tagHead Head; #}; def OnTakeOutRealmExp(index, clientData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) playerID = curPlayer.GetID() curTotalRealmExp = UpdateRealmExp(curPlayer, False) if curTotalRealmExp <= 0: GameWorld.DebugLog('¾³½çÐÞΪ³ØÌáÈ¡ ûÓо­Ñé¿ÉÌáÈ¡', playerID) return playerControl = PlayerControl.PlayerControl(curPlayer) playerControl.AddExp(curTotalRealmExp) PlayerControl.NotifyCode(curPlayer, 'TakeOutRealmExp', [curTotalRealmExp]) # PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpBeginTime, int(time.time())) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExp, 0) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpPoint, 0) NotifyRealmExpInfo(curPlayer) return def UpdateRealmExp(curPlayer, isNotify=True, isRealmLVUP=False): ##¸üо³½çÐÞΪ³Ø curRealmLV = curPlayer.GetOfficialRank() ipyData = GetRealmIpyData(curRealmLV) if not ipyData: return 0 if not ipyData.GetExpRate(): return 0 curTime = int(time.time()) beginTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBeginTime) if not beginTime: PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpBeginTime, curTime) return 0 if isRealmLVUP: ipyData = GetRealmIpyData(curRealmLV-1) curRealmExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExp) curRealmExpPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpPoint) curTotalExp = curRealmExpPoint * ChConfig.Def_PerPointValue + curRealmExp if curTotalExp >= ipyData.GetExpLimit(): return curTotalExp passSeconds = curTime - beginTime if passSeconds <= 0: return curTotalExp perRealmExpTime = IpyGameDataPY.GetFuncCfg('RealmExpTime') curExpRate = ipyData.GetExpRate() #buffÔö¼ÓµÄ¶îÍâ¾­Ñé buffRemainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBuffRemainTime) buffAddRate = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBuffAddRate) buffTime = min(buffRemainTime, passSeconds) addExp = buffTime /perRealmExpTime*(curExpRate*(ShareDefine.Def_MaxRateValue + buffAddRate)/ShareDefine.Def_MaxRateValue) + (passSeconds-buffTime)/perRealmExpTime*curExpRate #addExp = passSeconds / perRealmExpTime * curExpRate if addExp <= 0: return curTotalExp PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpBeginTime, curTime) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpBuffRemainTime, buffRemainTime - buffTime) updTotalExp = min(curTotalExp + addExp, ipyData.GetExpLimit()) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExp, updTotalExp % ChConfig.Def_PerPointValue) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpPoint, updTotalExp / ChConfig.Def_PerPointValue) #֪ͨ if isNotify: NotifyRealmExpInfo(curPlayer) return updTotalExp def AddRealmExpBuffTime(curPlayer, addTime, addRate): ##Ôö¼Ó»áÁ鵤BUFFʱ¼ä UpdateRealmExp(curPlayer, False) remainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBuffRemainTime) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpBuffRemainTime, remainTime + addTime) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmExpBuffAddRate, addRate) NotifyRealmExpInfo(curPlayer) return def NotifyRealmExpInfo(curPlayer): ##֪ͨÐÞΪ³ØÐÅÏ¢ sendPack = ChPyNetSendPack.tagMCRealmExpInfo() sendPack.BeginTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBeginTime) sendPack.BuffTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBuffRemainTime) sendPack.BuffAddRate = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpBuffAddRate) sendPack.CurExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExp) sendPack.CurExpPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmExpPoint) NetPackCommon.SendFakePack(curPlayer, sendPack) return