From ac98391b1102b1c07aa71dbab56f232db74273ec Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 18 九月 2025 11:51:20 +0800
Subject: [PATCH] 121 【武将】武将系统-服务端(计算主公官职属性;)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py | 9 ++++++++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py | 12 +++++++-----
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 4 +++-
3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index f775536..088c9db 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -207,12 +207,14 @@
Def_CalcAttr_LV, # 主公等级 0
Def_CalcAttr_MainEquip, # 主装备 1
Def_CalcAttr_HeroBook, # 武将图鉴 2
-) = range(3)
+Def_CalcAttr_Realm, # 官职 3
+) = range(4)
CalcAttrName = {
Def_CalcAttr_LV:"主公等级",
Def_CalcAttr_MainEquip:"主装备",
Def_CalcAttr_HeroBook:"武将图鉴",
+ Def_CalcAttr_Realm:"官职",
}
##-----------------------------------------------------------------------------------------------
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py
index 2f18a62..f639650 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py
@@ -23,6 +23,7 @@
import PlayerControl
import IpyGameDataPY
import FormulaControl
+import PlayerPrestigeSys
import PlayerHero
import GameWorld
import ChConfig
@@ -410,6 +411,7 @@
CalcRoleBase(curPlayer)
ChEquip.CalcRoleEquipAttr(curPlayer)
PlayerHero.CalcHeroAddAttr(curPlayer)
+ PlayerPrestigeSys.CalcOfficialRankAttr(curPlayer)
return
def doRefreshLineupAttr(curPlayer, olPlayer, lineup):
@@ -631,6 +633,7 @@
lvAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_LV)
equipAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_MainEquip)
bookAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_HeroBook)
+ realmAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Realm)
GameWorld.DebugLog(" 国家武将统计=%s" % countryHeroInfo, playerID)
GameWorld.DebugLog(" 羁绊武将统计=%s" % fetterHeroInfo, playerID)
@@ -645,6 +648,7 @@
GameWorld.DebugLog(" 主公等级属性=%s" % lvAttrDict, playerID)
GameWorld.DebugLog(" 主公装备属性=%s" % equipAttrDict, playerID)
GameWorld.DebugLog(" 主公图鉴属性=%s" % bookAttrDict, playerID)
+ GameWorld.DebugLog(" 主公官职属性=%s" % realmAttrDict, playerID)
PlayerLV = curPlayer.GetLV()
OfficialLV = curPlayer.GetOfficialRank()
@@ -676,6 +680,9 @@
bookValue = bookAttrDict.get(attrID, 0)
bookPer = bookAttrDict.get(attrPerID, 0) / 10000.0 if attrPerID else 0
+ realmValue = realmAttrDict.get(attrID, 0)
+ realmPer = realmAttrDict.get(attrPerID, 0) / 10000.0 if attrPerID else 0
+
lineupInitAddPer, lineupLVAddPer, lineupBreakLVAddPer, lineupStarAddPer = 0, 0, 0, 0
if attrID in ChConfig.BaseAttrIDList:
lineupInitAddPer, lineupLVAddPer, lineupBreakLVAddPer, lineupStarAddPer = InitAddPer, LVAddPer, BreakLVAddPer, StarAddPer
@@ -701,7 +708,7 @@
awakeTalentPer = awakeTalentAttrDict.get(attrPerID, 0) / 10000.0
# 计算
- attrParamDict = {"lvValue":lvValue, "equipValue":equipValue, "bookValue":bookValue, "bookPer":bookPer,
+ attrParamDict = {"lvValue":lvValue, "equipValue":equipValue, "bookValue":bookValue, "bookPer":bookPer, "realmValue":realmValue, "realmPer":realmPer,
"lineupInitAddPer":lineupInitAddPer, "lineupLVAddPer":lineupLVAddPer, "lineupBreakLVAddPer":lineupBreakLVAddPer, "lineupStarAddPer":lineupStarAddPer,
"heroSelfValue":heroSelfValue, "heroSelfPer":heroSelfPer, "inheritPer":inheritPer,
"lineupHaloValue":lineupHaloValue, "lineupHaloPer":lineupHaloPer, "fetterValue":fetterValue, "fetterPer":fetterPer,
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 136bccd..45e2df9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py
@@ -30,6 +30,7 @@
import PlayerTongTianLing
import PlayerGubao
import PlayerTask
+import PlayerOnline
#------------------------------------------------------------------------------
@@ -85,17 +86,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
def RefreshOfficialAttr(curPlayer):
CalcOfficialRankAttr(curPlayer)
- PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
+ PlayerOnline.GetOnlinePlayer(curPlayer).RefreshRoleAttr()
return
def AddRealmTaskValue(curPlayer, taskType, addValue):
--
Gitblit v1.8.0