From 8a7181b35a5f4063fb84fcb3120394faeaba2f77 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 07 十二月 2020 19:19:50 +0800
Subject: [PATCH] 8585 【港台】【BT】【长尾】【后端】竞技场(初版)

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py
index 57e9abd..f604d6c 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py
@@ -151,6 +151,33 @@
     GameWorld.Log('billboardIndex %s clear.'%billboardIndex)
     return
 
+def UpdateBillboardMaxCount(billboardIndex, updMaxCount, isDelExtra=True):
+    ''' 变更竞技场榜单最大数据数
+    @param updMaxCount: 更新的最大数据排名
+    @param isDelExtra: 是否删除原榜单排名数据超过更新后的最大排名,默认删除
+    '''
+    billBoard = GameWorld.GetBillboard().FindBillboard(billboardIndex)
+    if not billBoard:
+        return
+    curCount = billBoard.GetCount()
+    curMaxCount = billBoard.GetMaxCount()
+    # 不超过程序内置配置的最大数量
+    if billboardIndex in ChConfig.Def_BT_Cnt:
+        updMaxCount = min(updMaxCount, ChConfig.Def_BT_Cnt[billboardIndex])
+    if curMaxCount == updMaxCount:
+        return
+    billBoard.SetMaxCount(updMaxCount)
+    GameWorld.Log("    变更榜单最大数据数! billboardIndex=%s,curCount=%s,curMaxCount=%s,updMaxCount=%s" 
+                  % (billboardIndex, curCount, curMaxCount, updMaxCount))
+    
+    # 清除多余榜单数据
+    if isDelExtra and curCount > updMaxCount:
+        for delIndex in xrange(curCount - 1, updMaxCount - 1, -1):
+            if delIndex >= 0:
+                GameWorld.Log("        DeleteByIndex: %s" % delIndex)
+                billBoard.DeleteByIndex(delIndex)
+    return
+
 ####################################################################################################
 
 #class   IPY_GSetWatchBillboardState
@@ -213,6 +240,9 @@
     if packType in ChConfig.Def_InterdictLook_BT_Type:
         #不可通过此封包查看
         return
+    if ChConfig.Def_BT_Cnt.get(packType, 0) > 100:
+        GameWorld.DebugLog("该榜单最大名次较大,需使用分页查询! A9 A2 查看排行榜#tagCPYWatchBillboard")
+        return
     if not __CheckWatchCD(curPlayer, packType, tick):
         return
     

--
Gitblit v1.8.0