From 5e9fd1dedd0e4c99d89de3264428e8217f093c93 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 06 一月 2026 18:19:30 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(B424增加同步每个武将战力;演武场匹配列表战力优先同步演武场防守阵容战力;查看玩家增加同步红颜、坐骑信息;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py            |    3 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py        |   12 +++++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerViewCache.py |   32 ++++++++++++++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBeauty.py    |   12 ++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py      |    2 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py     |    5 +-
 6 files changed, 59 insertions(+), 7 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
index 8b292e4..264e875 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -420,6 +420,8 @@
                     else:
                         tfObj.PosNum = posNum                        
                     tfObj.AngreXP = batObj.GetXP()
+                    tfObj.FightPower = batObj.GetFightPower() % ChConfig.Def_PerPointValue
+                    tfObj.FightPowerEx = batObj.GetFightPower() / ChConfig.Def_PerPointValue
                     tfLineup.ObjList.append(tfObj)
                 tfLineup.ObjCnt = len(tfLineup.ObjList)
                 tfFaction.LineupList.append(tfLineup)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index 0b200ef..7763c91 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -37433,6 +37433,8 @@
                   ("LV", c_ushort),    # 等级,玩家的武将等级或NPC成长等级,等级显示以该值为准
                   ("PosNum", c_ubyte),    # 在本阵容中的站位,从1开始,非主战斗武将为0,如红颜
                   ("AngreXP", c_ushort),    # 当前怒气值
+                  ("FightPower", c_int),    # 战力,求余亿部分
+                  ("FightPowerEx", c_int),    # 战力,整除亿部分
                   ]
 
     def __init__(self):
@@ -37456,6 +37458,8 @@
         self.LV = 0
         self.PosNum = 0
         self.AngreXP = 0
+        self.FightPower = 0
+        self.FightPowerEx = 0
         return
 
     def GetLength(self):
@@ -37476,7 +37480,9 @@
                                 MaxHPEx:%d,
                                 LV:%d,
                                 PosNum:%d,
-                                AngreXP:%d
+                                AngreXP:%d,
+                                FightPower:%d,
+                                FightPowerEx:%d
                                 '''\
                                 %(
                                 self.ObjID,
@@ -37489,7 +37495,9 @@
                                 self.MaxHPEx,
                                 self.LV,
                                 self.PosNum,
-                                self.AngreXP
+                                self.AngreXP,
+                                self.FightPower,
+                                self.FightPowerEx
                                 )
         return DumpString
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py
index 90ef549..32ff6a7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py
@@ -414,13 +414,14 @@
         matchInfo = ChPyNetSendPack.tagSCArenaMatchInfo()
         matchInfo.PlayerID = matchID
         if viewCache:
+            fightPower = PlayerViewCache.GetLineupFightPower(viewCache, ShareDefine.Lineup_ArenaDef)
             matchInfo.PlayerName = viewCache.GetPlayerName()
             matchInfo.RealmLV = viewCache.GetRealmLV()
             matchInfo.LV = viewCache.GetLV()
             matchInfo.Face = viewCache.GetFace()
             matchInfo.FacePic = viewCache.GetFacePic()
-            matchInfo.FightPower = viewCache.GetFightPower()
-            matchInfo.FightPowerEx = viewCache.GetFightPowerEx()
+            matchInfo.FightPower = fightPower % ChConfig.Def_PerPointValue
+            matchInfo.FightPowerEx = fightPower / ChConfig.Def_PerPointValue
             matchInfo.TitleID = viewCache.GetTitleID()
         else:
             matchInfo.PlayerName = "p%s" % matchID
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBeauty.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBeauty.py
index 65ba483..03484fb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBeauty.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBeauty.py
@@ -212,6 +212,18 @@
     SyncBeautyInfo(curPlayer, [beautyID])
     return
 
+def GetBeautyActCnt(curPlayer):
+    ## 红颜已激活总数
+    actCnt = 0
+    ipyDataMgr = IpyGameDataPY.IPY_Data()
+    for index in range(ipyDataMgr.GetBeautyCount()):
+        ipyData = ipyDataMgr.GetBeautyByIndex(index)
+        beautyID = ipyData.GetBeautyID()
+        if not GetBeautyState(curPlayer, beautyID):
+            continue
+        actCnt += 1
+    return actCnt
+
 #// B2 20 红颜好感度升级 #tagCSBeautyLVUP
 #
 #struct    tagCSBeautyLVUP
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerViewCache.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerViewCache.py
index 0178843..b00727a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerViewCache.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerViewCache.py
@@ -23,6 +23,8 @@
 import ChPyNetSendPack
 import IpyGameDataPY
 import IPY_GameWorld
+import PlayerOnline
+import PlayerBeauty
 import ShareDefine
 import TurnAttack
 import DBDataMgr
@@ -109,6 +111,19 @@
             return True
         
     return False
+
+def GetLineupFightPower(curCache, lineupID):
+    ## 获取查看缓存中某个阵容对应的战力
+    if not curCache:
+        return 0
+    plusDict = curCache.GetPlusDict()
+    if "Lineup" in plusDict:
+        lineupDict = plusDict["Lineup"]
+        if str(lineupID) in lineupDict:
+            lineupInfo = lineupDict[str(lineupID)]
+            if "FightPower" in lineupInfo:
+                return lineupInfo["FightPower"]
+    return curCache.GetFightPowerTotal()
 
 def FindBattleViewCache(playerID):
     ## 获取可战斗的玩家缓存
@@ -253,15 +268,26 @@
         
     # 阵容
     lineupDict = {}
-    for lineupID in ShareDefine.LineupList:
+    for lineupID in ShareDefine.NeedViewCacheLineupIDList:
         lineupInfo = TurnAttack.GetPlayerLineupInfo(curPlayer, lineupID)
         if not lineupInfo:
             continue
         lineupDict["%s" % lineupID] = lineupInfo
+        
+    olPlayer = PlayerOnline.GetOnlinePlayer(curPlayer)
     
-    # 其他
+    # 红颜
+    attrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Beauty)
+    actCnt = PlayerBeauty.GetBeautyActCnt(curPlayer)
+    beautyDict = {"Cnt":actCnt, "Attr":{str(k):v for k, v in attrDict.items()}}
     
-    plusDict = {"Equip":equipDict, "Lineup":lineupDict}
+    # 坐骑
+    attrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Horse)
+    horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorseLV)
+    classLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorseClassLV)
+    horseDict = {"LV":horseLV, "ClassLV":classLV, "Attr":{str(k):v for k, v in attrDict.items()}}
+    
+    plusDict = {"Equip":equipDict, "Lineup":lineupDict, "Beauty":beautyDict, "Horse":horseDict}
     curCache.SetPlusDict(plusDict)
     
     return curCache
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index 082dd5b..7ed1c89 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -1271,6 +1271,9 @@
 Lineup_ArenaDef, # 竞技场防守阵容 3
 ) = range(1, 1 + 3)
 
+# 需要存储查看缓存的阵容ID列表,一般只存储主阵容及各功能所需的防守阵容
+NeedViewCacheLineupIDList = [Lineup_Main, Lineup_ArenaDef]
+
 # 宠物物品数据状态
 Def_PetStateList = (
 Def_PetState_Null, # 无

--
Gitblit v1.8.0