| | |
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import ItemCommon
|
| | | import ItemControler
|
| | | import FBCommon
|
| | | import GameFuncComm
|
| | | import PlayerControl
|
| | | import ChPyNetSendPack
|
| | |
| | | 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):
|
| | | #功能开启
|
| | |
| | |
|
| | |
|
| | | def OnLogin(curPlayer):
|
| | | SyncRealmFBState(curPlayer)
|
| | | DoRealmVersionStateLogic(curPlayer)
|
| | | SyncRealmFBState(curPlayer, isAll=True)
|
| | | UpdateRealmExp(curPlayer, False)
|
| | | NotifyRealmExpInfo(curPlayer)
|
| | | 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 not realmLV:
|
| | | # 新号不处理
|
| | | return
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.Log("======================== 执行境界版本变更重置逻辑 =======================", playerID)
|
| | | |
| | | # 重置境界
|
| | | curPlayer.SetOfficialRank(0)
|
| | | |
| | | # 返还境界丹
|
| | | 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)
|
| | |
|
| | |
| | | return
|
| | |
|
| | | def GetXXZLAward(curPlayer, taskID):
|
| | | ## 领取修仙之路奖励
|
| | | awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmXXZLAward)
|
| | | if awardState&pow(2, taskID):
|
| | | GameWorld.DebugLog("已领取过境界修仙之路该奖励, taskID=%s" % taskID, curPlayer.GetPlayerID())
|
| | | return
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("RealmXXZL", taskID)
|
| | | if not ipyData:
|
| | | return
|
| | | taskType = ipyData.GetTaskType()
|
| | | needValue = ipyData.GetNeedValue()
|
| | | curValue= 0
|
| | | |
| | | #1. 得到 XXX法宝, 所需值为法宝ID
|
| | | if taskType == 1:
|
| | | magicWeaponID = needValue
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % magicWeaponID) >= 1:
|
| | | curValue = needValue
|
| | | |
| | | #2. 通关天星塔X层
|
| | | elif taskType == 2:
|
| | | curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_SkyTowerFloor)
|
| | | |
| | | #3. 击杀世界BOSSX只
|
| | | elif taskType == 3:
|
| | | curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCntTotal % ShareDefine.Def_Boss_Func_World)
|
| | | |
| | | #4. 活跃修炼X次
|
| | | elif taskType == 4:
|
| | | curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityCountTotal)
|
| | | |
| | | #5. 击杀个人BOSS:xxx,所需之为个人boss表对应线路id
|
| | | elif taskType == 5:
|
| | | mapID = ChConfig.Def_FBMapID_PersonalBoss
|
| | | lineID = needValue
|
| | | if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID]):
|
| | | curValue = needValue
|
| | | |
| | | #6. 通关宗门试炼x次
|
| | | elif taskType == 6:
|
| | | curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntTotal % ChConfig.Def_FBMapID_MunekadoTrial)
|
| | | |
| | | #7. 获得X点灵根点
|
| | | elif taskType == 7:
|
| | | curValue = PlayerControl.GetTotalLingGenPoint(curPlayer)
|
| | | |
| | | if curValue < needValue:
|
| | | GameWorld.DebugLog("境界修仙之路当前任务所需值不满足,无法领奖, taskID=%s,taskType=%s,curValue=%s < %s" |
| | | % (taskID, taskType, curValue, needValue), curPlayer.GetPlayerID())
|
| | | return
|
| | | |
| | | awardItemList = ipyData.GetAwardItemList()
|
| | | if not ItemCommon.GiveAwardItem(curPlayer, awardItemList, "RealmXXZL"):
|
| | | return
|
| | | |
| | | updAwardState = awardState|pow(2, taskID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmXXZLAward, updAwardState)
|
| | | GameWorld.DebugLog("领取境界修仙之路奖励, awardID=%s,updAwardState=%s" % (taskID, updAwardState), curPlayer.GetPlayerID())
|
| | | SyncRealmFBState(curPlayer)
|
| | | EventShell.EventRespons_RealmXXZLAward(curPlayer, taskID)
|
| | | ## 领取修仙之路奖励,废弃
|
| | | return
|
| | |
|
| | | def SyncRealmFBState(curPlayer):
|
| | | def SyncRealmFBState(curPlayer, taskIDList=None, isAll=False):
|
| | | #通知客户端渡劫副本是否开启
|
| | | #if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Official):
|
| | | # return
|
| | | sendPack = ChPyNetSendPack.tagMCSyncRealmInfo()
|
| | | sendPack.IsPass = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmFBIsOpen)
|
| | | sendPack.XXZLAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmXXZLAward)
|
| | | 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
|
| | |
|
| | |
| | | PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
|
| | | return
|
| | |
|
| | | def AddRealmTaskValue(curPlayer, taskType, addValue):
|
| | | ## 增加境界任务值
|
| | | if taskType not in NeedTaskValueTypeList:
|
| | | 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
|
| | | #
|
| | |
| | | if not realmIpyData:
|
| | | GameWorld.ErrLog("没有该境界等级数据! Lv=%s" % curRealmLV)
|
| | | return
|
| | | if realmIpyData.GetBossID():
|
| | | canLvUp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmFBIsOpen) == 1
|
| | | if not canLvUp:
|
| | | GameWorld.DebugLog(' 副本未过关,不能升级境界')
|
| | | return
|
| | | #等级判断
|
| | | if curPlayer.GetLV() < realmIpyData.GetNeedLV():
|
| | | return
|
| | | #装备判断
|
| | | needEquip = realmIpyData.GetNeedEquip()
|
| | | if needEquip and len(needEquip) == 4:
|
| | | classLV, star, isSuite, color = needEquip
|
| | | 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):
|
| | | return
|
| | | curPartStar = ChEquip.GetEquipPartStar(curPlayer, gridIndex)
|
| | | if curPartStar < star:
|
| | | return
|
| | | if isSuite and not curEquip.GetSuiteID():
|
| | | return
|
| | | if curEquip.GetItemColor() < color:
|
| | | return
|
| | |
|
| | | needItemID = realmIpyData.GetNeedItemID()
|
| | | needItemCount = realmIpyData.GetNeedItemCnt()
|
| | | # 支持不消耗物品升级
|
| | | if needItemID > 0 and needItemCount > 0:
|
| | | curPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | hasEnough, itemIndexList = ItemCommon.GetItem_FromPack_ByID(needItemID, curPack, needItemCount)
|
| | | if not hasEnough:
|
| | | GameWorld.DebugLog("渡劫开启, 材料不足! Lv=%s, needItemID=%s,needItemCount=%s" |
| | | % (curRealmLV, needItemID, needItemCount))
|
| | | return
|
| | | #扣除物品
|
| | | ItemCommon.ReduceItem(curPlayer, curPack, itemIndexList, needItemCount, True, "Realm")
|
| | | if not CheckRealmTaskFinishAll(curPlayer):
|
| | | return
|
| | |
|
| | | DoRealmLVUpLogic(curPlayer)
|
| | | return
|
| | |
|
| | | # 提升1级境界加点
|
| | | def __DoRealmLVUpAddPoint(curPlayer):
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_AddPoint):
|
| | | # 未开启前不可加点,因为DoAddPointOpen会一次性补齐,避免意外情况多加了点数
|
| | | return
|
| | |
|
| | | curFreePoint = curPlayer.GetFreePoint()
|
| | | addPoint = IpyGameDataPY.GetFuncCfg("LVUPAddPoint", 3)
|
| | | if addPoint != 0:
|
| | | setFreePoint = curFreePoint + addPoint
|
| | | DataRecordPack.DR_Freepoint(curPlayer, "RealmLVUp", addPoint)
|
| | | curPlayer.SetFreePoint(setFreePoint)
|
| | |
|
| | | return
|
| | |
|
| | |
|
| | | def DoRealmLVUpLogic(curPlayer, needSys=True):
|
| | | curRealmLV = curPlayer.GetOfficialRank()
|
| | |
| | | return
|
| | |
|
| | | curPlayer.SetOfficialRank(nextRealmLv)
|
| | | # 提升1级境界加点
|
| | | __DoRealmLVUpAddPoint(curPlayer)
|
| | | PlayerGubao.DoGubaoAddFreePoint(curPlayer)
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmFBIsOpen, 0)
|
| | | 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:
|
| | |
| | | if addFreePoint:
|
| | | updFreePoint = curPlayer.GetFreePoint() + addFreePoint
|
| | | curPlayer.SetFreePoint(updFreePoint)
|
| | | GameWorld.DebugLog(" addFreePoint=%s,updFreePoint=%s" % (addFreePoint, updFreePoint))
|
| | | GameWorld.DebugLog(" 境界阶级加灵根点: addFreePoint=%s,updFreePoint=%s" % (addFreePoint, updFreePoint))
|
| | |
|
| | | RefreshOfficialAttr(curPlayer)
|
| | | GameFuncComm.DoFuncOpenLogic(curPlayer)
|
| | | SyncRealmFBState(curPlayer)
|
| | | SyncRealmFBState(curPlayer, taskIDList=syncTaskIDList)
|
| | | #更新修为速率
|
| | | UpdateRealmExp(curPlayer, False, True)
|
| | | NotifyRealmExpInfo(curPlayer)
|
| | |
| | | #流向
|
| | | DataRecordPack.DR_RealmLVUp(curPlayer, nextRealmLv)
|
| | | return True
|
| | |
|
| | |
|
| | | def DologicDujieFBPass(curPlayer, realmLV, star):
|
| | | #渡劫通过后处理
|
| | | realmIpyData = GetRealmIpyData(realmLV)
|
| | | if not realmIpyData:
|
| | | return
|
| | | #DoRealmLVUpLogic(curPlayer)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmFBIsOpen, 1)
|
| | | SyncRealmFBState(curPlayer)
|
| | | |
| | | return
|
| | |
|
| | |
|
| | | #// A5 21 境界修为池提取 #tagCMTakeOutRealmExp
|
| | | #
|