hxp
2021-11-17 ffa8a645ed6a92a3c723bbf5c7f1eb4d5425c826
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py
@@ -26,8 +26,11 @@
import NetPackCommon
import DataRecordPack
import PlayerFamily
import PyDataManager
import PlayerViewCache
import time
import random
Def_Key_BillboardSortTick = "BillboardSortTick_%s" # 排行榜是否排序tick,参数(排行榜类型)
Def_Key_BillboardNeedSort = "BillboardNeedSort_%s" # 排行榜是否需要排序,参数(排行榜类型)
@@ -522,6 +525,53 @@
    #GameWorld.DebugLog("__UpdateBillboardSortState:bType=%s,autoSort=%s,isUpd=%s,needSort=%s" % (bType, autoSort, isUpd, gameWorld.GetDictByKey(key)))
    return
def GetBillboardOperateInfo(curPlayer):
    # 排行榜中所保存的运营商相关信息
    platform = curPlayer.GetAccID()
    if platform in ["tencent"]:
        return curPlayer.GetOperateInfo()
    return platform
def UpdatePlayerBillboardEx(curPlayer, playerID, bType, cmpValue, cmpValue2=0, cmpValue3=0, value1=0, value2=0, autoSort=False):
    ## 更新玩家排行榜
    # @param curPlayer: 可能为None
    playerOpInfo = ""
    playerJob = 0
    playerName = ""
    playerRealmLV = 0
    if curPlayer:
        playerID = curPlayer.GetID()
        playerJob = curPlayer.GetJob()
        playerName = curPlayer.GetName()
        playerRealmLV = curPlayer.GetOfficialRank()
        playerOpInfo = GetBillboardOperateInfo(curPlayer)
    else:
        socialPlayer = PyDataManager.GetPersonalSocialManager().GetSocialPlayer(playerID)
        if socialPlayer:
            playerJob = socialPlayer.playerInfo.Job
            playerName = socialPlayer.playerInfo.PlayerName
            playerRealmLV = socialPlayer.playerInfo.RealmLV
        else:
            curCache = PlayerViewCache.FindViewCache(playerID)
            if curCache:
                cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
                playerJob = cacheDict["Job"]
                playerName = cacheDict["Name"]
                playerRealmLV = cacheDict["RealmLV"]
    if not playerName and playerID < 10000:
        playerJob = random.choice([1, 2])
        playerName = "testName%s" % playerID
        playerRealmLV = random.randint(1, 10)
    if bType in ShareDefine.BTValue1_OfficialRankList:
        value1 = playerRealmLV
    UpdatePlayerBillboard(playerID, playerName, playerOpInfo, bType, playerJob, value1, value2, cmpValue, autoSort, cmpValue2, cmpValue3)
    return
#---------------------------------------------------------------------
#===============================================================================
#    void        SetType(int inputType);    //_I_KEY_INDEX_排行榜类型