From ba67d86ccc7dde96a4fe2bb2ae3abfbd0aacc561 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 03 十一月 2025 12:00:10 +0800
Subject: [PATCH] 237 【福利内容】每日任务/每周任务/章节奖励-服务端(增加每日任务类型 6 ~ 10)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py | 427 ++++-------------------------------------------------
1 files changed, 32 insertions(+), 395 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py
index da793b3..b5d3d0a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py
@@ -15,218 +15,43 @@
#"""Version = 2017-10-10 14:30"""
#-------------------------------------------------------------------------------
-import ItemCommon
import ItemControler
import FBCommon
-import QuestCommon
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 PlayerTask
+import PlayerOnline
-import time
#------------------------------------------------------------------------------
# 渡劫任务类型
RealmTaskTypeList = (
RealmTaskType_LV, # 等级 1
-RealmTaskType_PassMap, # 过关关卡 2
-RealmTaskType_KillNPC, # 击杀NPC 3
-RealmTaskType_LVUPItem, # 进阶丹 4
-RealmTaskType_Equip, # 基础装备明细 5
-RealmTaskType_Dujie, # 渡劫boss 6
-RealmTaskType_FinishMainTask, # 完成xx主线任务 7
-) = range(1, 1 + 7)
+RealmTaskType_MainLevel, # 主线关卡 2
+RealmTaskType_UseXiantao, # 消耗战锤 3
+RealmTaskType_TreeLV, # 仙树等级 4
+) = range(1, 1 + 4)
# 需要记录任务值的任务类型列表
-NeedTaskValueTypeList = [RealmTaskType_KillNPC, RealmTaskType_Dujie]
-
-def DoOfficialOpen(curPlayer):
- #功能开启
-# curRealmLV = curPlayer.GetOfficialRank()
-# if not curRealmLV:
-# DoRealmLVUpLogic(curPlayer)
- return True
-
+NeedTaskValueTypeList = [RealmTaskType_UseXiantao]
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
- lvToRealmLV = -1 # 重置后当前玩家等级对应可提升到的境界等级
- playerLV = curPlayer.GetLV()
- ipyDataMgr = IpyGameDataPY.IPY_Data()
- for index in range(ipyDataMgr.GetRealmCount()):
- realmIpyData = ipyDataMgr.GetRealmByIndex(index)
- lvToRealmLV = realmIpyData.GetLv()
- if playerLV < realmIpyData.GetLVMax():
- break
-
- # 返还到可升级到的境界等级前一级
- for index in range(ipyDataMgr.GetRealmLVUPTaskCount()):
- taskIpyData = ipyDataMgr.GetRealmLVUPTaskByIndex(index)
- if taskIpyData.GetLv() >= lvToRealmLV:
- break
- taskType = taskIpyData.GetTaskType()
- if taskType != RealmTaskType_LVUPItem:
- continue
- needValueList = taskIpyData.GetNeedValueList()
- needValueA = GetRealmTaskNeedValue(needValueList, 0)
- returnCount += needValueA
-
- GameWorld.Log("境界等级: realmLV=%s,playerLV=%s,lvToRealmLV=%s,returnItemID=%s,returnCount=%s"
- % (realmLV, playerLV, lvToRealmLV, 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)
+ SyncRealmInfo(curPlayer, isAll=True)
+ if ChConfig.Def_InitOfficialRank > 0 and not curPlayer.GetOfficialRank():
+ curPlayer.SetOfficialRank(ChConfig.Def_InitOfficialRank)
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
+def SyncRealmInfo(curPlayer, taskIDList=None, isAll=False):
sendPack = ChPyNetSendPack.tagMCSyncRealmInfo()
sendPack.TaskAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RealmTaskAwardState)
sendPack.TaskValueList = []
@@ -248,11 +73,6 @@
NetPackCommon.SendFakePack(curPlayer, sendPack)
return
-
-## 计算爵位属性
-# @param curPlayer 玩家
-# @param allAttrList 属性列表
-# @return None
def CalcOfficialRankAttr(curPlayer):
if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Official):
return
@@ -264,22 +84,18 @@
addAttrIDList, addAttrValueList = realmIpyData.GetAddAttrType(), realmIpyData.GetAddAttrNum()
- allAttrList = [{} for i in range(4)]
+ playerID = curPlayer.GetPlayerID()
+ attrDict = {}
for i, attrID in enumerate(addAttrIDList):
- PlayerControl.CalcAttrDict_Type(attrID, addAttrValueList[i], allAttrList)
+ attrDict[attrID] = attrDict.get(attrID, 0) + addAttrValueList[i]
- # 保存计算值
- PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Prestige, allAttrList)
+ GameWorld.DebugLog("官职属性: %s" % attrDict, playerID)
+ PlayerOnline.GetOnlinePlayer(curPlayer).SetCalcAttr(ChConfig.Def_CalcAttr_Realm, attrDict)
return
-
-## 重刷所有属性
-# @param curPlayer
-# @param isForceRefresh:强制刷新排行榜
-# @return 指定数据
def RefreshOfficialAttr(curPlayer):
CalcOfficialRankAttr(curPlayer)
- PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
+ PlayerOnline.GetOnlinePlayer(curPlayer).RefreshRoleAttr()
return
def AddRealmTaskValue(curPlayer, taskType, addValue):
@@ -307,7 +123,7 @@
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)
+ SyncRealmInfo(curPlayer, taskIDList=syncTaskIDList)
return
def GetRealmTaskNeedValue(needValueList, index): return needValueList[index] if len(needValueList) > index else 0
@@ -347,79 +163,21 @@
% (realmLV, taskID, taskType, playerLV, needValueA), playerID)
return
- # 过关副本
- elif taskType == RealmTaskType_PassMap:
- mapID = needValueA
- lineID = GetRealmTaskNeedValue(needValueList, 1)
+ # 主线关卡
+ elif taskType == RealmTaskType_MainLevel:
+ mapID = ChConfig.Def_FBMapID_Main
+ lineID = needValueA
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[:4]
- needCount = needValueList[4] if len(needValueList) > 4 else len(ChConfig.EquipPlace_Base)
- GameWorld.DebugLog('境界任务领奖,装备条件! realmLV=%s,taskID=%s,taskType=%s,classLV=%s,star=%s,isSuite=%s,color=%s,needCount=%s'
- % (realmLV, taskID, taskType, classLV, star, isSuite, color, needCount), playerID)
- curCount = 0
- equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
- for place in ChConfig.EquipPlace_Base:
- ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, place)
- if not ipyData:
- continue
- gridIndex = ipyData.GetGridIndex()
- curEquip = equipPack.GetAt(gridIndex)
- if not ItemCommon.CheckItemCanUse(curEquip):
- continue
- 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)
- continue
- if isSuite and not curEquip.GetSuiteID():
- GameWorld.DebugLog(' 装备位非套装! realmLV=%s,taskID=%s,taskType=%s,classLV=%s,place=%s'
- % (realmLV, taskID, taskType, classLV, place), playerID)
- continue
- 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)
- continue
- curCount += 1
-
- if curCount < needCount:
- GameWorld.DebugLog(' 境界任务所需装备数不足! realmLV=%s,taskID=%s,taskType=%s,classLV=%s,star=%s,isSuite=%s,color=%s,curCount=%s < %s'
- % (realmLV, taskID, taskType, classLV, star, isSuite, color, curCount, needCount), 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
-
- # 完成xx主线任务
- elif taskType == RealmTaskType_FinishMainTask:
- missionID = needValueA
- if not QuestCommon.GetHadFinishMainMission(curPlayer, missionID):
- GameWorld.DebugLog('境界任务领奖,主线任务未完成! realmLV=%s,taskID=%s,taskType=%s,missionID=%s' % (realmLV, taskID, taskType, missionID), playerID)
+ # 仙树等级
+ elif taskType == RealmTaskType_TreeLV:
+ treeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLV)
+ if treeLV < needValueA:
+ GameWorld.DebugLog('境界任务领奖,仙树在祝福等级不足! realmLV=%s,taskID=%s,taskType=%s,treeLV=%s < %s'
+ % (realmLV, taskID, taskType, treeLV, needValueA), playerID)
return
# 根据记录任务进度值
@@ -438,7 +196,7 @@
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)
+ SyncRealmInfo(curPlayer)
return
def CheckRealmTaskFinishAll(curPlayer):
@@ -463,7 +221,6 @@
# tagHead Head;
#};
def DoRealmLVUp(index, clientData, tick):
- #升级境界
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
curRealmLV = curPlayer.GetOfficialRank()
realmIpyData = GetRealmIpyData(curRealmLV)
@@ -486,7 +243,6 @@
return
curPlayer.SetOfficialRank(nextRealmLv)
- PlayerGubao.DoGubaoAddFreePoint(curPlayer)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmTaskAwardState, 0)
syncTaskIDList = []
@@ -501,132 +257,13 @@
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))
+ PlayerControl.WorldNotify(0, 'RealmUpSuccess', [curPlayer.GetName(), curPlayer.GetID(), nextRealmLv])
RefreshOfficialAttr(curPlayer)
GameFuncComm.DoFuncOpenLogic(curPlayer)
- SyncRealmFBState(curPlayer, taskIDList=syncTaskIDList)
- #更新修为速率
- UpdateRealmExp(curPlayer, False, True)
- NotifyRealmExpInfo(curPlayer)
- #境界提升成就
- PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_RealmlvUp, nextRealmLv)
+ SyncRealmInfo(curPlayer, taskIDList=syncTaskIDList)
PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_RealmUp, 1)
+ PlayerTask.UpdTaskValue(curPlayer, ChConfig.TaskType_RealmLV)
#更新排行榜
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
-
--
Gitblit v1.8.0