8585 【主干】【gt_1.101.1】【BT3】【bt3_1.100.1】【后端】竞技场(排行榜、匹配列表,对战记录战斗力支持超20亿;对战记录挑战支持查询最新数据;守护者支持积分加减并同步名次对应等级; 增加对战流向记录)

# Conflicts:
# ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerDBGSEvent.py
8个文件已修改
567 ■■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/PyNetPack.ini 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py 192 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/PyNetPack.ini
@@ -153,12 +153,16 @@
Writer = hxp
Releaser = hxp
RegType = 0
RegisterPackCount = 1
RegisterPackCount = 2
PacketCMD_1=0xA9
PacketSubCMD_1=0xA8
PacketCallFunc_1=OnQueryArenaBattleRecord
PacketCMD_2=0xA9
PacketSubCMD_2=0xA5
PacketCallFunc_2=OnQueryArenaBattlePlayer
;镖车
[PlayerTruck.py]
ScriptName = Player\PlayerTruck.py
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -1304,6 +1304,58 @@
#------------------------------------------------------
# A9 A5 查看竞技场对战玩家最新信息 #tagCGQueryArenaBattlePlayer
class  tagCGQueryArenaBattlePlayer(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("PlayerID", c_int),    #目标玩家ID,仅支持查真实玩家
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xA9
        self.SubCmd = 0xA5
        return
    def ReadData(self, stringData, _pos=0, _len=0):
        self.Clear()
        memmove(addressof(self), stringData[_pos:], self.GetLength())
        return _pos + self.GetLength()
    def Clear(self):
        self.Cmd = 0xA9
        self.SubCmd = 0xA5
        self.PlayerID = 0
        return
    def GetLength(self):
        return sizeof(tagCGQueryArenaBattlePlayer)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// A9 A5 查看竞技场对战玩家最新信息 //tagCGQueryArenaBattlePlayer:
                                Cmd:%s,
                                SubCmd:%s,
                                PlayerID:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.PlayerID
                                )
        return DumpString
m_NAtagCGQueryArenaBattlePlayer=tagCGQueryArenaBattlePlayer()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGQueryArenaBattlePlayer.Cmd,m_NAtagCGQueryArenaBattlePlayer.SubCmd))] = m_NAtagCGQueryArenaBattlePlayer
#------------------------------------------------------
# A9 A8 查看竞技场对战记录 #tagCGQueryArenaBattleRecord
class  tagCGQueryArenaBattleRecord(Structure):
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -2368,6 +2368,112 @@
#------------------------------------------------------
# A9 26 竞技场对战玩家最新信息 #tagGCArenaBattlePlayerInfo
class  tagGCArenaBattlePlayerInfo(Structure):
    Head = tagHead()
    PlayerID = 0    #(DWORD PlayerID)//目标玩家ID
    PlayerName = ""    #(char PlayerName[33])
    Job = 0    #(BYTE Job)
    LV = 0    #(WORD LV)//等级
    RealmLV = 0    #(WORD RealmLV)//境界,机器人读境界表取等级对应境界
    FightPower = 0    #(DWORD FightPower)//战力求余亿部分,机器人读等级表取等级对应战力
    FightPowerEx = 0    #(DWORD FightPowerEx)//战力整除亿部分,机器人读等级表取等级对应战力
    Score = 0    #(DWORD Score)//积分
    data = None
    def __init__(self):
        self.Clear()
        self.Head.Cmd = 0xA9
        self.Head.SubCmd = 0x26
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.PlayerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.PlayerName,_pos = CommFunc.ReadString(_lpData, _pos,33)
        self.Job,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.LV,_pos = CommFunc.ReadWORD(_lpData, _pos)
        self.RealmLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
        self.FightPower,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.FightPowerEx,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.Score,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        return _pos
    def Clear(self):
        self.Head = tagHead()
        self.Head.Clear()
        self.Head.Cmd = 0xA9
        self.Head.SubCmd = 0x26
        self.PlayerID = 0
        self.PlayerName = ""
        self.Job = 0
        self.LV = 0
        self.RealmLV = 0
        self.FightPower = 0
        self.FightPowerEx = 0
        self.Score = 0
        return
    def GetLength(self):
        length = 0
        length += self.Head.GetLength()
        length += 4
        length += 33
        length += 1
        length += 2
        length += 2
        length += 4
        length += 4
        length += 4
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteDWORD(data, self.PlayerID)
        data = CommFunc.WriteString(data, 33, self.PlayerName)
        data = CommFunc.WriteBYTE(data, self.Job)
        data = CommFunc.WriteWORD(data, self.LV)
        data = CommFunc.WriteWORD(data, self.RealmLV)
        data = CommFunc.WriteDWORD(data, self.FightPower)
        data = CommFunc.WriteDWORD(data, self.FightPowerEx)
        data = CommFunc.WriteDWORD(data, self.Score)
        return data
    def OutputString(self):
        DumpString = '''
                                Head:%s,
                                PlayerID:%d,
                                PlayerName:%s,
                                Job:%d,
                                LV:%d,
                                RealmLV:%d,
                                FightPower:%d,
                                FightPowerEx:%d,
                                Score:%d
                                '''\
                                %(
                                self.Head.OutputString(),
                                self.PlayerID,
                                self.PlayerName,
                                self.Job,
                                self.LV,
                                self.RealmLV,
                                self.FightPower,
                                self.FightPowerEx,
                                self.Score
                                )
        return DumpString
m_NAtagGCArenaBattlePlayerInfo=tagGCArenaBattlePlayerInfo()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCArenaBattlePlayerInfo.Head.Cmd,m_NAtagGCArenaBattlePlayerInfo.Head.SubCmd))] = m_NAtagGCArenaBattlePlayerInfo
#------------------------------------------------------
# A9 23 竞技场对战记录列表 #tagGCArenaBattleRecordList
class  tagGCArenaBattleRecord(Structure):
@@ -2376,7 +2482,9 @@
    Job = 0    #(BYTE Job)
    LV = 0    #(WORD LV)//等级
    RealmLV = 0    #(WORD RealmLV)//境界,机器人读境界表取等级对应境界
    FightPower = 0    #(DWORD FightPower)//战力,机器人读等级表取等级对应战力
    FightPower = 0    #(DWORD FightPower)//战力求余亿部分,机器人读等级表取等级对应战力
    FightPowerEx = 0    #(DWORD FightPowerEx)//战力整除亿部分,机器人读等级表取等级对应战力
    Score = 0    #(DWORD Score)//积分
    AddScoreLen = 0    #(BYTE AddScoreLen)
    AddScore = ""    #(String AddScore)//本次对战增加的积分,有正负
    IsWin = 0    #(BYTE IsWin)//是否获胜
@@ -2395,6 +2503,8 @@
        self.LV,_pos = CommFunc.ReadWORD(_lpData, _pos)
        self.RealmLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
        self.FightPower,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.FightPowerEx,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.Score,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.AddScoreLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.AddScore,_pos = CommFunc.ReadString(_lpData, _pos,self.AddScoreLen)
        self.IsWin,_pos = CommFunc.ReadBYTE(_lpData, _pos)
@@ -2408,6 +2518,8 @@
        self.LV = 0
        self.RealmLV = 0
        self.FightPower = 0
        self.FightPowerEx = 0
        self.Score = 0
        self.AddScoreLen = 0
        self.AddScore = ""
        self.IsWin = 0
@@ -2421,6 +2533,8 @@
        length += 1
        length += 2
        length += 2
        length += 4
        length += 4
        length += 4
        length += 1
        length += len(self.AddScore)
@@ -2437,6 +2551,8 @@
        data = CommFunc.WriteWORD(data, self.LV)
        data = CommFunc.WriteWORD(data, self.RealmLV)
        data = CommFunc.WriteDWORD(data, self.FightPower)
        data = CommFunc.WriteDWORD(data, self.FightPowerEx)
        data = CommFunc.WriteDWORD(data, self.Score)
        data = CommFunc.WriteBYTE(data, self.AddScoreLen)
        data = CommFunc.WriteString(data, self.AddScoreLen, self.AddScore)
        data = CommFunc.WriteBYTE(data, self.IsWin)
@@ -2451,6 +2567,8 @@
                                LV:%d,
                                RealmLV:%d,
                                FightPower:%d,
                                FightPowerEx:%d,
                                Score:%d,
                                AddScoreLen:%d,
                                AddScore:%s,
                                IsWin:%d,
@@ -2463,6 +2581,8 @@
                                self.LV,
                                self.RealmLV,
                                self.FightPower,
                                self.FightPowerEx,
                                self.Score,
                                self.AddScoreLen,
                                self.AddScore,
                                self.IsWin,
@@ -2546,7 +2666,8 @@
    Job = 0    #(BYTE Job)
    LV = 0    #(WORD LV)//等级
    RealmLV = 0    #(WORD RealmLV)//境界,机器人读境界表取等级对应境界
    FightPower = 0    #(DWORD FightPower)//战力,机器人读等级表取等级对应战力
    FightPower = 0    #(DWORD FightPower)//战力求余亿部分,机器人读等级表取等级对应战力
    FightPowerEx = 0    #(DWORD FightPowerEx)//战力整除亿部分,机器人读等级表取等级对应战力
    Score = 0    #(DWORD Score)//积分
    data = None
@@ -2562,6 +2683,7 @@
        self.LV,_pos = CommFunc.ReadWORD(_lpData, _pos)
        self.RealmLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
        self.FightPower,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.FightPowerEx,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.Score,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        return _pos
@@ -2572,6 +2694,7 @@
        self.LV = 0
        self.RealmLV = 0
        self.FightPower = 0
        self.FightPowerEx = 0
        self.Score = 0
        return
@@ -2582,6 +2705,7 @@
        length += 1
        length += 2
        length += 2
        length += 4
        length += 4
        length += 4
@@ -2595,6 +2719,7 @@
        data = CommFunc.WriteWORD(data, self.LV)
        data = CommFunc.WriteWORD(data, self.RealmLV)
        data = CommFunc.WriteDWORD(data, self.FightPower)
        data = CommFunc.WriteDWORD(data, self.FightPowerEx)
        data = CommFunc.WriteDWORD(data, self.Score)
        return data
@@ -2606,6 +2731,7 @@
                                LV:%d,
                                RealmLV:%d,
                                FightPower:%d,
                                FightPowerEx:%d,
                                Score:%d
                                '''\
                                %(
@@ -2615,6 +2741,7 @@
                                self.LV,
                                self.RealmLV,
                                self.FightPower,
                                self.FightPowerEx,
                                self.Score
                                )
        return DumpString
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py
@@ -25,6 +25,7 @@
import PlayerCompensation
import PlayerDBGSEvent
import ChPyNetSendPack
import DataRecordPack
import NetPackCommon
import IpyGameDataPY
import PyGameData
@@ -102,9 +103,71 @@
def GetArenaBillLV(billData): return billData.GetValue2()
def SetArenaBillLV(billData, lv): billData.SetValue2(lv)
def GetArenaBillScore(billData): return billData.GetCmpValue()
def GetArenaBillFightPower(billData): return billData.GetCmpValue2()
def SetArenaBillFightPower(billData, fightPower): billData.SetCmpValue2(fightPower)
def SetArenaBillScore(billData, score): return billData.SetCmpValue(score)
def GetArenaBillFightPower(billData): return billData.GetCmpValue2() * ShareDefine.Def_PerPointValue + billData.GetCmpValue3()
def SetArenaBillFightPower(billData, fightPower):
    billData.SetCmpValue2(fightPower / ShareDefine.Def_PerPointValue)
    billData.SetCmpValue3(fightPower % ShareDefine.Def_PerPointValue)
    return
def RepairArenaBillboardFightPower():
    ## 修正竞技场榜单的战力数据,支持20亿,bt3_1.100.1 下次大版本更新后可删除
    repairStateKey = "RepairArenaBillboardFightPower"
    repairState = PlayerDBGSEvent.GetDBGSTrig_ByKey(repairStateKey)
    if repairState:
        GameWorld.DebugLog("=== 已经修正竞技场榜单数据  ===")
        return
    GameWorld.Log("=== 修正竞技场榜单数据 Start ===")
    worldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
    PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ArenaWorldLV, worldLV)
    GameWorld.Log("    SetDBGSTrig_ByKey %s=%s" % (PlayerDBGSEvent.Def_ArenaWorldLV, worldLV))
    robotMaxCount = IpyGameDataPY.GetFuncCfg("ArenaRobot", 1)
    __RandRobotLVList(robotMaxCount)
    GameWorld.Log("    PyGameData.g_arenaRobotLVList len=%s, %s" % (len(PyGameData.g_arenaRobotLVList), PyGameData.g_arenaRobotLVList))
    billBoard = GameWorld.GetBillboard().FindBillboard(ShareDefine.Def_BT_Arena)
    if not billBoard:
        return
    for index in xrange(billBoard.GetCount()):
        order = index + 1
        billBoardData = billBoard.At(index)
        if not billBoardData:
            continue
        playerID = billBoardData.GetID()
        fightPower = billBoardData.GetCmpValue2() # 旧战力只存在比较值2
        if playerID <= MaxRobotID:
            curLV = GetArenaBillLV(billBoardData)
            updLV = curLV
            if index < len(PyGameData.g_arenaRobotLVList):
                updLV = PyGameData.g_arenaRobotLVList[index]
            GameWorld.Log("    修正机器人等级: order=%s,playerID=%s,curLV=%s,updLV=%s"
                          % (order, playerID, curLV, updLV))
            SetArenaBillLV(billBoardData, updLV)
            SetArenaBillFightPower(billBoardData, 0)
            continue
        curCache = PlayerViewCache.FindViewCache(playerID)
        if curCache:
            cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
            fightPower = cacheDict["FightPower"]
        SetArenaBillFightPower(billBoardData, fightPower)
        GameWorld.Log("    修正真玩家战力: order=%s,playerID=%s,fightPower=%s,cmpValue2=%s,cmpValue3=%s"
                      % (order, playerID, fightPower, billBoardData.GetCmpValue2(), billBoardData.GetCmpValue3()))
    billBoard.Sort()
    PlayerDBGSEvent.SetDBGSTrig_ByKey(repairStateKey, 1)
    GameWorld.Log("=== 修正竞技场榜单的战力数据 OK ===")
    return
def OnServerStart():
    universalRecMgr = GameWorld.GetUniversalRecMgr()
    recDataList = universalRecMgr.GetTypeList(Def_RecType_ArenaBattleRecord)
@@ -148,8 +211,11 @@
            if billBoard.GetCount() > 0:
                robotMaxCount = IpyGameDataPY.GetFuncCfg("ArenaRobot", 1)
                PlayerBillboard.UpdateBillboardMaxCount(ShareDefine.Def_BT_Arena, robotMaxCount)
                __RandRobotLVList(robotMaxCount)
            else:
                __ResetArenaRobotBillboard()
    RepairArenaBillboardFightPower()
    return
def OnServerClose():
@@ -295,6 +361,11 @@
    GameWorld.Log("    重置初始化竞技场机器人榜单! robotMaxCount=%s" % robotMaxCount)
    PlayerBillboard.UpdateBillboardMaxCount(ShareDefine.Def_BT_Arena, robotMaxCount)
    
    PyGameData.g_arenaRobotLVList = []
    worldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
    PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ArenaWorldLV, worldLV)
    GameWorld.Log("    worldLV=%s" % worldLV)
    # 获取机器人随机等级、积分列表
    robotLVList = __RandRobotLVList(robotMaxCount)
    robotScoreList = __RandRobotScoreList(robotMaxCount)
@@ -319,8 +390,9 @@
        value1 = robotRealmLV
        value2 = robotLV
        cmpValue = robotScore
        cmpValue2 = robotFightPower
        PlayerBillboard.UpdatePlayerBillboard(robotID, robotName, opInfo, ShareDefine.Def_BT_Arena, type2, value1, value2, cmpValue, autoSort=False, cmpValue2=cmpValue2)
        cmpValue2 = robotFightPower / ShareDefine.Def_PerPointValue
        cmpValue3 = robotFightPower % ShareDefine.Def_PerPointValue
        PlayerBillboard.UpdatePlayerBillboard(robotID, robotName, opInfo, ShareDefine.Def_BT_Arena, type2, value1, value2, cmpValue, autoSort=False, cmpValue2=cmpValue2, cmpValue3=cmpValue3)
        
    billBoard.Sort()
    return
@@ -370,11 +442,13 @@
            
    lvList[0] = robotMinLV
    lvList[-1] = robotMaxLV
    PyGameData.g_arenaRobotLVList = sorted(lvList, reverse=True)
    return lvList
def __GetRobotLVRange():
    ## 获取赛季机器人等级范围
    worldLV = max(1, PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv))
    worldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ArenaWorldLV)
    worldLV = max(1, worldLV)
    ipyDataMgr = IpyGameDataPY.IPY_Data()
    maxCnt = ipyDataMgr.GetWorldLVCount()
    worldLVTime = 0
@@ -721,6 +795,10 @@
                        SetArenaBillRealmLV(billData, cacheDict["RealmLV"])
                        SetArenaBillLV(billData, cacheDict["LV"])
                        SetArenaBillFightPower(billData, cacheDict["FightPower"])
                else:
                    if matchIndex < len(PyGameData.g_arenaRobotLVList):
                        robotLV = PyGameData.g_arenaRobotLVList[matchIndex] # 同步更新机器人榜单变化等级
                        SetArenaBillLV(billData, robotLV)
                        
                matchPlayer.tagLV = GetArenaBillLV(billData)
                matchPlayer.tagJob = GetArenaBillJob(billData)
@@ -762,10 +840,16 @@
            curCache = PlayerViewCache.FindViewCache(matchInfo.PlayerID)
            if curCache:
                cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
                fightPower = cacheDict["FightPower"]
                matchInfo.LV = cacheDict["LV"]
                matchInfo.PlayerName = cacheDict["Name"]
                matchInfo.RealmLV = cacheDict["RealmLV"]
                matchInfo.FightPower = cacheDict["FightPower"]
                matchInfo.FightPower = fightPower % ShareDefine.Def_PerPointValue
                matchInfo.FightPowerEx = fightPower / ShareDefine.Def_PerPointValue
        else:
            # 此处机器人的暂忽略等级变化的同步,仅在刷新、更新积分时同步,此处省略查询机器人所属榜单排名
            pass
        clientPack.MatchList.append(matchInfo)
    clientPack.MatchCount = len(clientPack.MatchList)
    NetPackCommon.SendFakePack(curPlayer, clientPack)
@@ -777,6 +861,7 @@
    retDict = {}
    retDict.update(cmdDict)
    
    accID = curPlayer.GetAccID()
    playerID = curPlayer.GetPlayerID()
    GameWorld.DebugLog("竞技场玩家战斗结果: %s" % str(cmdDict), playerID)
    
@@ -801,6 +886,7 @@
    curScore = playerScore
    isFindTag = False
    tagLV, tagJob, tagScore = 0, 0, 0
    tagRealmLV, tagFightPower, tagAccID = 0, 0, "" # 机器人无值
    
    # 先找匹配列表
    matchList = PyGameData.g_arenaPlayerMatchDict.get(playerID, [])
@@ -849,11 +935,12 @@
    # 结算自己
    addScore = __CalcBattleAddScore(playerID, curScore, tagScore, isWin)
    updScore = max(0, playerScore + addScore)
    GameWorld.DebugLog("    更新自身积分: addScore=%s,updScore=%s" % (addScore, updScore), playerID)
    
    curOrder = billBoard.IndexOfByID(playerID) + 1  # 更新前获取名次
    cmpValue2 = fightPower / ShareDefine.Def_PerPointValue
    cmpValue3 = fightPower % ShareDefine.Def_PerPointValue
    PlayerBillboard.UpdatePlayerBillboard(playerID, playerName, opInfo, ShareDefine.Def_BT_Arena, playerJob,
                                          realmLV, playerLV, updScore, autoSort=False, cmpValue2=fightPower)
                                          realmLV, playerLV, updScore, autoSort=False, cmpValue2=cmpValue2, cmpValue3=cmpValue3)
    
    awardItemList = []
    if isWin:
@@ -865,30 +952,48 @@
            if isWorldNotify:
                PlayerControl.WorldNotify(0, "ArenaWinerItem", [curPlayer.GetName(), awardItemInfo[0], "", awardItemInfo[1]])
                
    tagAddScore = __CalcBattleAddScore(tagPlayerID, tagScore, curScore, not isWin)
    updTagScore = max(0, tagScore + tagAddScore)
    # 结算对手,仅玩家时结算,机器人不处理
    if tagPlayerID > MaxRobotID:
        tagAddScore = __CalcBattleAddScore(tagPlayerID, tagScore, curScore, not isWin)
        updTagScore = max(0, tagScore + tagAddScore)
        GameWorld.DebugLog("    更新对手积分: tagAddScore=%s,updTagScore=%s" % (tagAddScore, updTagScore), playerID)
        tagCache = PlayerViewCache.FindViewCache(tagPlayerID)
        if tagCache:
            cacheDict = PlayerViewCache.GetCachePropDataDict(tagCache)
            tagOpInfo = ""
            tagLV = cacheDict["LV"]
            tagPlayerName = cacheDict["Name"]
            tagRealmLV = cacheDict["RealmLV"]
            tagFightPower = cacheDict["FightPower"]
            tagAccID = cacheDict["AccID"]
            tagCmpValue2 = tagFightPower / ShareDefine.Def_PerPointValue
            tagCmpValue3 = tagFightPower % ShareDefine.Def_PerPointValue
            PlayerBillboard.UpdatePlayerBillboard(tagPlayerID, tagPlayerName, tagOpInfo, ShareDefine.Def_BT_Arena, tagJob,
                                                  tagRealmLV, tagLV, updTagScore, autoSort=False, cmpValue2=tagFightPower)
                                                  tagRealmLV, tagLV, updTagScore, autoSort=False, cmpValue2=tagCmpValue2, cmpValue3=tagCmpValue3)
    else:
        updTagScore = tagScore
        GameWorld.DebugLog("    机器人对手,积分不变!updTagScore=%s" % updTagScore, playerID)
        robotBillboardData = billBoard.FindByID(tagPlayerID)
        if robotBillboardData:
            SetArenaBillScore(robotBillboardData, updTagScore)
    # 都更新完后排序一次
    billBoard.Sort()
    updOrder = billBoard.IndexOfByID(playerID) + 1 # 取最新名次
    GameWorld.DebugLog("    更新自身积分: addScore=%s,updScore=%s,curOrder=%s,updOrder=%s" % (addScore, updScore, curOrder, updOrder), playerID)
    GameWorld.DebugLog("    更新对手积分: tagPlayerID=%s,tagAddScore=%s,updTagScore=%s" % (tagPlayerID, tagAddScore, updTagScore), playerID)
    retDict.update({"addScore":addScore, "updScore":updScore, "curOrder":curOrder, "updOrder":updOrder,
                    "awardItemList":awardItemList, "isOK":True})
    
    if tagPlayerID <= MaxRobotID:
        tagUpdOrder = billBoard.IndexOfByID(tagPlayerID) + 1 # 取最新名次
        tagOrderIndex = tagUpdOrder - 1
        if tagUpdOrder >= 1 and tagOrderIndex < len(PyGameData.g_arenaRobotLVList) and tagOrderIndex < billBoard.GetCount():
            GameWorld.DebugLog("    PyGameData.g_arenaRobotLVList=%s" % PyGameData.g_arenaRobotLVList, playerID)
            updRobotLV = PyGameData.g_arenaRobotLVList[tagOrderIndex]
            robotBillboardData = billBoard.At(tagOrderIndex)
            SetArenaBillLV(robotBillboardData, updRobotLV)
            GameWorld.DebugLog("    机器人在榜上,更新等级信息! tagPlayerID=%s,tagUpdOrder=%s,updRobotLV=%s" % (tagPlayerID, tagUpdOrder, updRobotLV), playerID)
        else:
            GameWorld.DebugLog("    机器人不在榜上,不更新等级信息! tagPlayerID=%s" % tagPlayerID, playerID)
    battleRecMaxCount = min(MaxBattleRecCount, IpyGameDataPY.GetFuncCfg("ArenaSet", 4))
    
    # 插入对战记录
@@ -934,6 +1039,11 @@
    
    # 对战结束,最后免费刷新一次匹配列表
    __DoArenaMatchRefresh(curPlayer, True, playerLV, updScore)
    drDict = {"AccID":accID, "PlayerID":playerID, "playerLV":playerLV, "realmLV":realmLV, "fightPower":fightPower, "curScore":[curScore, addScore, updScore],
              "TagAccID":tagAccID, "TagPlayerID":tagPlayerID, "tagLV":tagLV, "tagRealmLV":tagRealmLV, "tagFightPower":tagFightPower,
              "tagScore":[tagScore, tagAddScore, updTagScore], "isWin":isWin}
    DataRecordPack.SendEventPack("ArenaBattleResult", drDict)
    return retDict
def __SyncPlayerBechallengedUpdScore(curPlayer, updScore):
@@ -997,6 +1107,7 @@
        recInfo.PlayerID = battleRec.tagPlayerID
        recInfo.Job = battleRec.tagJob
        recInfo.LV = battleRec.tagLV
        recInfo.Score = battleRec.tagScore
        recInfo.AddScore = str(battleRec.addScore)
        recInfo.AddScoreLen = len(recInfo.AddScore)
        recInfo.IsWin = battleRec.isWin
@@ -1006,9 +1117,12 @@
            curCache = PlayerViewCache.FindViewCache(recInfo.PlayerID)
            if curCache:
                cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
                fightPower = cacheDict["FightPower"]
                recInfo.LV = cacheDict["LV"]
                recInfo.PlayerName = cacheDict["Name"]
                recInfo.RealmLV = cacheDict["RealmLV"]
                recInfo.FightPower = cacheDict["FightPower"]
                recInfo.FightPower = fightPower % ShareDefine.Def_PerPointValue
                recInfo.FightPowerEx = fightPower / ShareDefine.Def_PerPointValue
                
        clientPack.BattleRecordList.append(recInfo)
        
@@ -1016,7 +1130,41 @@
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return
#// A9 A5 查看竞技场对战玩家最新信息 #tagCGQueryArenaBattlePlayer
#
#struct    tagCGQueryArenaBattlePlayer
#{
#    tagHead        Head;
#    DWORD        PlayerID;        //目标玩家ID,仅支持查真实玩家
#};
def OnQueryArenaBattlePlayer(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    if not curPlayer:
        return
    tagPlayerID = clientData.PlayerID
    tagBattleRecList = GetPlayerArenaBattleRecList(tagPlayerID)
    if not tagBattleRecList:
        GameWorld.ErrLog("竞技场玩家无对战记录,无法查询最新数据! tagPlayerID=%s" % tagPlayerID, curPlayer.GetPlayerID())
        return
    tagBattleRec = tagBattleRecList[-1] # 取最后一条为最新数据
    tagScore = tagBattleRec.updScore
    clientPack = ChPyNetSendPack.tagGCArenaBattlePlayerInfo()
    clientPack.PlayerID = tagPlayerID
    clientPack.Score = tagScore
    curCache = PlayerViewCache.FindViewCache(tagPlayerID)
    if curCache:
        cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
        fightPower = cacheDict["FightPower"]
        clientPack.LV = cacheDict["LV"]
        clientPack.Job = cacheDict["Job"]
        clientPack.PlayerName = cacheDict["Name"]
        clientPack.RealmLV = cacheDict["RealmLV"]
        clientPack.FightPower = fightPower % ShareDefine.Def_PerPointValue
        clientPack.FightPowerEx = fightPower / ShareDefine.Def_PerPointValue
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return
ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
@@ -87,6 +87,7 @@
g_arenaPlayerBattleRecDict = {} # 本服竞技场玩家挑战记录缓存 {playerID:[ArenaBattleRec, ...], ...}
g_arenaPlayerMatchDict = {} # 本服竞技场玩家匹配记录缓存 {playerID:[ArenaMatchPlayer, ...], ...}
g_arenaRobotLVList = [] # 本服竞技场机器人等级列表
g_autoViceleaderDict = {}#自动安排副盟主的玩家记录{familyID:[]}
g_forbidAutoViceleaderFamily = [] #禁止自动安排副盟主的仙盟[familyID,..]
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -1304,6 +1304,58 @@
#------------------------------------------------------
# A9 A5 查看竞技场对战玩家最新信息 #tagCGQueryArenaBattlePlayer
class  tagCGQueryArenaBattlePlayer(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("PlayerID", c_int),    #目标玩家ID,仅支持查真实玩家
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xA9
        self.SubCmd = 0xA5
        return
    def ReadData(self, stringData, _pos=0, _len=0):
        self.Clear()
        memmove(addressof(self), stringData[_pos:], self.GetLength())
        return _pos + self.GetLength()
    def Clear(self):
        self.Cmd = 0xA9
        self.SubCmd = 0xA5
        self.PlayerID = 0
        return
    def GetLength(self):
        return sizeof(tagCGQueryArenaBattlePlayer)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// A9 A5 查看竞技场对战玩家最新信息 //tagCGQueryArenaBattlePlayer:
                                Cmd:%s,
                                SubCmd:%s,
                                PlayerID:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.PlayerID
                                )
        return DumpString
m_NAtagCGQueryArenaBattlePlayer=tagCGQueryArenaBattlePlayer()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGQueryArenaBattlePlayer.Cmd,m_NAtagCGQueryArenaBattlePlayer.SubCmd))] = m_NAtagCGQueryArenaBattlePlayer
#------------------------------------------------------
# A9 A8 查看竞技场对战记录 #tagCGQueryArenaBattleRecord
class  tagCGQueryArenaBattleRecord(Structure):
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -2368,6 +2368,112 @@
#------------------------------------------------------
# A9 26 竞技场对战玩家最新信息 #tagGCArenaBattlePlayerInfo
class  tagGCArenaBattlePlayerInfo(Structure):
    Head = tagHead()
    PlayerID = 0    #(DWORD PlayerID)//目标玩家ID
    PlayerName = ""    #(char PlayerName[33])
    Job = 0    #(BYTE Job)
    LV = 0    #(WORD LV)//等级
    RealmLV = 0    #(WORD RealmLV)//境界,机器人读境界表取等级对应境界
    FightPower = 0    #(DWORD FightPower)//战力求余亿部分,机器人读等级表取等级对应战力
    FightPowerEx = 0    #(DWORD FightPowerEx)//战力整除亿部分,机器人读等级表取等级对应战力
    Score = 0    #(DWORD Score)//积分
    data = None
    def __init__(self):
        self.Clear()
        self.Head.Cmd = 0xA9
        self.Head.SubCmd = 0x26
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.PlayerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.PlayerName,_pos = CommFunc.ReadString(_lpData, _pos,33)
        self.Job,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.LV,_pos = CommFunc.ReadWORD(_lpData, _pos)
        self.RealmLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
        self.FightPower,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.FightPowerEx,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.Score,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        return _pos
    def Clear(self):
        self.Head = tagHead()
        self.Head.Clear()
        self.Head.Cmd = 0xA9
        self.Head.SubCmd = 0x26
        self.PlayerID = 0
        self.PlayerName = ""
        self.Job = 0
        self.LV = 0
        self.RealmLV = 0
        self.FightPower = 0
        self.FightPowerEx = 0
        self.Score = 0
        return
    def GetLength(self):
        length = 0
        length += self.Head.GetLength()
        length += 4
        length += 33
        length += 1
        length += 2
        length += 2
        length += 4
        length += 4
        length += 4
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteDWORD(data, self.PlayerID)
        data = CommFunc.WriteString(data, 33, self.PlayerName)
        data = CommFunc.WriteBYTE(data, self.Job)
        data = CommFunc.WriteWORD(data, self.LV)
        data = CommFunc.WriteWORD(data, self.RealmLV)
        data = CommFunc.WriteDWORD(data, self.FightPower)
        data = CommFunc.WriteDWORD(data, self.FightPowerEx)
        data = CommFunc.WriteDWORD(data, self.Score)
        return data
    def OutputString(self):
        DumpString = '''
                                Head:%s,
                                PlayerID:%d,
                                PlayerName:%s,
                                Job:%d,
                                LV:%d,
                                RealmLV:%d,
                                FightPower:%d,
                                FightPowerEx:%d,
                                Score:%d
                                '''\
                                %(
                                self.Head.OutputString(),
                                self.PlayerID,
                                self.PlayerName,
                                self.Job,
                                self.LV,
                                self.RealmLV,
                                self.FightPower,
                                self.FightPowerEx,
                                self.Score
                                )
        return DumpString
m_NAtagGCArenaBattlePlayerInfo=tagGCArenaBattlePlayerInfo()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCArenaBattlePlayerInfo.Head.Cmd,m_NAtagGCArenaBattlePlayerInfo.Head.SubCmd))] = m_NAtagGCArenaBattlePlayerInfo
#------------------------------------------------------
# A9 23 竞技场对战记录列表 #tagGCArenaBattleRecordList
class  tagGCArenaBattleRecord(Structure):
@@ -2376,7 +2482,9 @@
    Job = 0    #(BYTE Job)
    LV = 0    #(WORD LV)//等级
    RealmLV = 0    #(WORD RealmLV)//境界,机器人读境界表取等级对应境界
    FightPower = 0    #(DWORD FightPower)//战力,机器人读等级表取等级对应战力
    FightPower = 0    #(DWORD FightPower)//战力求余亿部分,机器人读等级表取等级对应战力
    FightPowerEx = 0    #(DWORD FightPowerEx)//战力整除亿部分,机器人读等级表取等级对应战力
    Score = 0    #(DWORD Score)//积分
    AddScoreLen = 0    #(BYTE AddScoreLen)
    AddScore = ""    #(String AddScore)//本次对战增加的积分,有正负
    IsWin = 0    #(BYTE IsWin)//是否获胜
@@ -2395,6 +2503,8 @@
        self.LV,_pos = CommFunc.ReadWORD(_lpData, _pos)
        self.RealmLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
        self.FightPower,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.FightPowerEx,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.Score,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.AddScoreLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.AddScore,_pos = CommFunc.ReadString(_lpData, _pos,self.AddScoreLen)
        self.IsWin,_pos = CommFunc.ReadBYTE(_lpData, _pos)
@@ -2408,6 +2518,8 @@
        self.LV = 0
        self.RealmLV = 0
        self.FightPower = 0
        self.FightPowerEx = 0
        self.Score = 0
        self.AddScoreLen = 0
        self.AddScore = ""
        self.IsWin = 0
@@ -2421,6 +2533,8 @@
        length += 1
        length += 2
        length += 2
        length += 4
        length += 4
        length += 4
        length += 1
        length += len(self.AddScore)
@@ -2437,6 +2551,8 @@
        data = CommFunc.WriteWORD(data, self.LV)
        data = CommFunc.WriteWORD(data, self.RealmLV)
        data = CommFunc.WriteDWORD(data, self.FightPower)
        data = CommFunc.WriteDWORD(data, self.FightPowerEx)
        data = CommFunc.WriteDWORD(data, self.Score)
        data = CommFunc.WriteBYTE(data, self.AddScoreLen)
        data = CommFunc.WriteString(data, self.AddScoreLen, self.AddScore)
        data = CommFunc.WriteBYTE(data, self.IsWin)
@@ -2451,6 +2567,8 @@
                                LV:%d,
                                RealmLV:%d,
                                FightPower:%d,
                                FightPowerEx:%d,
                                Score:%d,
                                AddScoreLen:%d,
                                AddScore:%s,
                                IsWin:%d,
@@ -2463,6 +2581,8 @@
                                self.LV,
                                self.RealmLV,
                                self.FightPower,
                                self.FightPowerEx,
                                self.Score,
                                self.AddScoreLen,
                                self.AddScore,
                                self.IsWin,
@@ -2546,7 +2666,8 @@
    Job = 0    #(BYTE Job)
    LV = 0    #(WORD LV)//等级
    RealmLV = 0    #(WORD RealmLV)//境界,机器人读境界表取等级对应境界
    FightPower = 0    #(DWORD FightPower)//战力,机器人读等级表取等级对应战力
    FightPower = 0    #(DWORD FightPower)//战力求余亿部分,机器人读等级表取等级对应战力
    FightPowerEx = 0    #(DWORD FightPowerEx)//战力整除亿部分,机器人读等级表取等级对应战力
    Score = 0    #(DWORD Score)//积分
    data = None
@@ -2562,6 +2683,7 @@
        self.LV,_pos = CommFunc.ReadWORD(_lpData, _pos)
        self.RealmLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
        self.FightPower,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.FightPowerEx,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.Score,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        return _pos
@@ -2572,6 +2694,7 @@
        self.LV = 0
        self.RealmLV = 0
        self.FightPower = 0
        self.FightPowerEx = 0
        self.Score = 0
        return
@@ -2582,6 +2705,7 @@
        length += 1
        length += 2
        length += 2
        length += 4
        length += 4
        length += 4
@@ -2595,6 +2719,7 @@
        data = CommFunc.WriteWORD(data, self.LV)
        data = CommFunc.WriteWORD(data, self.RealmLV)
        data = CommFunc.WriteDWORD(data, self.FightPower)
        data = CommFunc.WriteDWORD(data, self.FightPowerEx)
        data = CommFunc.WriteDWORD(data, self.Score)
        return data
@@ -2606,6 +2731,7 @@
                                LV:%d,
                                RealmLV:%d,
                                FightPower:%d,
                                FightPowerEx:%d,
                                Score:%d
                                '''\
                                %(
@@ -2615,6 +2741,7 @@
                                self.LV,
                                self.RealmLV,
                                self.FightPower,
                                self.FightPowerEx,
                                self.Score
                                )
        return DumpString
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py
@@ -247,7 +247,7 @@
    playerLV = curPlayer.GetLV()
    playerScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaScore)
    msgInfo = str(["BattleResult", {"tagPlayerID":tagPlayerID, "isWin":isWin, "playerLV":playerLV, "playerScore":playerScore, 
                                    "realmLV":curPlayer.GetOfficialRank(), "fightPower":curPlayer.GetFightPower()}])
                                    "realmLV":curPlayer.GetOfficialRank(), "fightPower":PlayerControl.GetFightPower(curPlayer)}])
    GameWorld.DebugLog("竞技场发送GameServer结算: %s" % msgInfo, playerID)
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, "Arena", msgInfo, len(msgInfo))
    return