From f2aeecf0a02b97418b762bd6ee518c33d3ae2685 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 12 九月 2025 10:22:35 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(新增演武场;支持机器人;支持PVP战斗;每场战斗结束后支持查看战斗回放;榜单优化存储玩家形象Value5;主线关卡榜支持;支持查看玩家;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py |   82 ++++++++++++++++++++++++++++++----------
 1 files changed, 61 insertions(+), 21 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py
index bb56211..bde256f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py
@@ -61,10 +61,6 @@
         # 跨服服务器不用更新本服榜
         return
     
-    UpdatePlayerFPTotalBillboard(curPlayer, True) # 战斗力榜
-    UpdateHorseBillboard(curPlayer, True, False) # 坐骑榜
-    UpdatePyPetBillboard(curPlayer, True, False) # 灵宠榜
-    UpdateRealmBillboard(curPlayer) # 境界榜
     return
 
 def UpdatePlayerFPTotalBillboard(curPlayer, isForceUpdate=False, isCheckRule=True):
@@ -149,39 +145,83 @@
     ##境界榜
     return
 
-def __CanPlayerBillboardComm(curPlayer):
-    ## 玩家可否上榜通用检查
-    if not GameWorld.IsNormalPlayer(curPlayer):
-        return False
-    #if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Billboard):
-    #    GameWorld.DebugLog("排行榜未开启,无法上榜!curLV=%s" % (curPlayer.GetLV()), curPlayer.GetPlayerID())
-    #    return False
-    
-    return True
+#def __CanPlayerBillboardComm(curPlayer):
+#    ## 玩家可否上榜通用检查
+#    if not GameWorld.IsNormalPlayer(curPlayer):
+#        return False
+#    #if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Billboard):
+#    #    GameWorld.DebugLog("排行榜未开启,无法上榜!curLV=%s" % (curPlayer.GetLV()), curPlayer.GetPlayerID())
+#    #    return False
+#    
+#    return True
 
-def UpdatePlayerBillboard(curPlayer, bType, cmpValue, cmpValue2=0, cmpValue3=0, value1=0, value2=0, autoSort=False, **kwargs):
+def UpdatePlayerBillboard(curPlayer, bType, cmpValue, cmpValue2=0, cmpValue3=0, value1=None, value2=0, autoSort=False, **kwargs):
     ## 更新玩家排行榜
     
     #if not cmpValue and not cmpValue2 and not cmpValue3:
     #    return
     
-    if not __CanPlayerBillboardComm(curPlayer):
-        return
-    
     playerJob = GetBillboardJob(curPlayer)
     playerID = curPlayer.GetID()
-    playerName = curPlayer.GetName()
+    playerName = curPlayer.GetPlayerName()
     playerOpInfo = GetBillboardOperateInfo(curPlayer)
+    if value1 == None:
+        value1 = curPlayer.GetOfficialRank()
     kwargs["value3"] = curPlayer.GetFace()
     kwargs["value4"] = curPlayer.GetFacePic()
-    if bType in ShareDefine.BTValue1_OfficialRankList:
-        value1 = curPlayer.GetOfficialRank()
-        
+    kwargs["value5"] = curPlayer.GetModelMark()
+    
     groupValue1 = 0
     UpdateBillboard(bType, groupValue1, playerID, playerName, playerOpInfo, playerJob, value1, value2, 
                     cmpValue, cmpValue2, cmpValue3, autoSort=autoSort, **kwargs)
     return
 
+def UpdateBillboardByID(dataID, billboardType, cmpValue, cmpValue2=0, cmpValue3=0, autoSort=False):
+    ## 直接根据榜单ID修改榜单排行相关值,其他值不修改
+    if GameWorld.IsCrossServer():
+        if billboardType not in ShareDefine.CrossBillboardTypeList:
+            return
+    else:
+        if billboardType not in ShareDefine.BillboardTypeList:
+            return
+        
+    if not dataID:
+        return
+    
+    groupValue1, groupValue2 = 0, 0
+    billboardMgr = DBDataMgr.GetBillboardMgr()
+    billboardObj = billboardMgr.GetBillboard(billboardType, groupValue1, groupValue2)
+    billboardData = billboardObj.FindByID(dataID)
+    if not billboardData:
+        return
+    
+    isNewData = False
+    cmpValueChange = isNewData or billboardData.GetCmpValue() != cmpValue or billboardData.GetCmpValue2() != cmpValue2 \
+        or (cmpValue3 and billboardData.GetCmpValue3() != cmpValue3)
+        
+    # 没设置值默认为时间time,先上榜的排前面
+    if cmpValue3 == 0:
+        # 时间权值仅在比较值变更的情况下才更新, 防止其他附属值更新时导致比较值相同的玩家名次间会变动的问题
+        if cmpValueChange:
+            calcTime = GameWorld.ChangeTimeStrToNum("2090-01-01 00:00:00")
+            cmpValue3 = max(0, calcTime - int(time.time())) # 比较值3如果没指定值则默认存当前更新的time
+        else:
+            cmpValue3 = billboardData.GetCmpValue3()
+            
+    billboardData.SetCmpValue(cmpValue)
+    billboardData.SetCmpValue2(cmpValue2)
+    billboardData.SetCmpValue3(cmpValue3)
+    
+    GameWorld.DebugLog("更新排行榜值: billboardType=%s,groupValue1=%s,groupValue2=%s,dataID=%s,cmpValueChange=%s,cmpValue=%s,cmpValue2=%s,cmpValue3=%s" 
+                       % (billboardType, groupValue1, groupValue2, dataID, cmpValueChange,
+                          cmpValue, cmpValue2, cmpValue3), dataID)
+    if not autoSort:
+        if isNewData or cmpValueChange:
+            billboardObj.SetSortDelay()
+    else:
+        billboardObj.SortData()
+    return True
+
 def UpdateBillboard(billboardType, groupValue1, dataID, name1, name2, type2, value1, value2, cmpValue,
                     cmpValue2=0, cmpValue3=0, groupValue2=0, id2=0, autoSort=True, **kwargs):
     ''' 更新排行榜

--
Gitblit v1.8.0