From 388823edfe6308cba6f76ca6dc4f20022c5cb2be Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 30 六月 2025 19:03:50 +0800
Subject: [PATCH] 10431 【英文】看广告获得限时代金券

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py |  119 +++++++++++++++++++++++++++--------------------------------
 1 files changed, 55 insertions(+), 64 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py
index cbccd5c..5a3d184 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py
@@ -56,6 +56,8 @@
         self.tagLV = 0
         self.tagJob = 0
         self.tagScore = 0
+        self.tagFace = 0
+        self.tagFacePic = 0
         return
     
 class ArenaBattleRec():
@@ -73,6 +75,8 @@
         self.tagPlayerID = 0 # 小于10000的为机器人ID
         self.tagLV = 0
         self.tagJob = 0
+        self.tagFace = 0
+        self.tagFacePic = 0
         self.tagScore = 0
         
         self.addScore = 0
@@ -91,6 +95,7 @@
 value4        tagScore        目标积分,非实时积分,一般机器人时有用
 strValue1    resultInfo    isWin,addScore
 strValue2    updInfo    isDispose,updScore
+strValue3    faceInfo    face,facePic
 '''
 
 ''' 榜单数据 '''
@@ -102,70 +107,16 @@
 def SetArenaBillRealmLV(billData, realmLV): return billData.SetValue1(realmLV)
 def GetArenaBillLV(billData): return billData.GetValue2()
 def SetArenaBillLV(billData, lv): billData.SetValue2(lv)
+def GetArenaBillFace(billData): return billData.GetValue3()
+def SetArenaBillFace(billData, face): billData.SetValue3(face)
+def GetArenaBillFacePic(billData): return billData.GetValue4()
+def SetArenaBillFacePic(billData, facePic): billData.SetValue4(facePic)
 def GetArenaBillScore(billData): return billData.GetCmpValue()
 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():
@@ -193,6 +144,11 @@
         battleRec.isDispose = int(updInfo[0] if len(updInfo) > 0 else 0)
         battleRec.updScore = int(updInfo[1] if len(updInfo) > 1 else 0)
         
+        strValue3 = recData.GetStrValue3()
+        faceInfo = strValue3.split(",") if strValue3 else []
+        battleRec.tagFace = int(faceInfo[0] if len(faceInfo) > 0 else 0)
+        battleRec.tagFacePic = int(faceInfo[1] if len(faceInfo) > 1 else 0)
+        
         battleRecList = GetPlayerArenaBattleRecList(playerID)
         battleRecList.append(battleRec)
         
@@ -215,7 +171,6 @@
             else:
                 __ResetArenaRobotBillboard()
                 
-    RepairArenaBillboardFightPower()
     return
 
 def OnServerClose():
@@ -236,6 +191,7 @@
             
             recData.SetStrValue1("%s,%s" % (int(battleRec.isWin), battleRec.addScore))
             recData.SetStrValue2("%s,%s" % (int(battleRec.isDispose), battleRec.updScore))
+            recData.SetStrValue3("%s,%s" % (battleRec.tagFace, battleRec.tagFacePic))
             
     return
 
@@ -274,6 +230,7 @@
     if updScore != None:
         __SyncPlayerBechallengedUpdScore(curPlayer, updScore)
         
+    PlayerControl.DoOfflineUnprocessed(curPlayer, "BattleResult", __DoOfflineArenaBattleResult)
     return
 
 def OnDayEx():
@@ -337,6 +294,9 @@
     GameWorld.GetUniversalRecMgr().Delete(Def_RecType_ArenaBattleRecord)
     PyGameData.g_arenaPlayerBattleRecDict = {}
     PyGameData.g_arenaPlayerMatchDict = {}
+    
+    # 删除未处理的
+    PlayerControl.DelOfflineUnprocessed("BattleResult")
     
     # 更新新赛季信息
     if openServerDay <= customMaxServerDay and OSSeasonState == 0:
@@ -590,21 +550,27 @@
     GameWorld.Log("    奖励保底玩家信息: %s" % floorPlayerIDList)
     return
 
-def MapServer_Arena(curPlayer, msgList):
-    GameWorld.DebugLog("MapServer_Arena %s" % str(msgList), curPlayer.GetPlayerID())
+def MapServer_Arena(playerID, msgList):
+    GameWorld.DebugLog("MapServer_Arena %s" % str(msgList), playerID)
     if not msgList:
         return
     
+    curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
     cmd = msgList[0]
     cmdDict = msgList[1] if len(msgList) > 1 else {}
     retDict = {}
     
     # 匹配刷新
     if cmd == "MatchRefresh":
+        if not curPlayer:
+            return
         __DoArenaMatchRefresh(curPlayer, cmdDict["isRefresh"], cmdDict["playerLV"], cmdDict["playerScore"], cmdDict.get("gmMatchIDList"))
         
     # 对战结算
     elif cmd == "BattleResult":
+        if not curPlayer:
+            PlayerControl.AddOfflineUnprocessed(playerID, "BattleResult", cmdDict)
+            return
         retDict = __DoArenaBattleResult(curPlayer, cmdDict)
         
     return msgList + [retDict]
@@ -795,6 +761,8 @@
                         SetArenaBillRealmLV(billData, cacheDict["RealmLV"])
                         SetArenaBillLV(billData, cacheDict["LV"])
                         SetArenaBillFightPower(billData, cacheDict["FightPower"])
+                        SetArenaBillFace(billData, cacheDict.get("Face", 0))
+                        SetArenaBillFacePic(billData, cacheDict.get("FacePic", 0))
                 else:
                     if matchIndex < len(PyGameData.g_arenaRobotLVList):
                         robotLV = PyGameData.g_arenaRobotLVList[matchIndex] # 同步更新机器人榜单变化等级
@@ -803,6 +771,8 @@
                 matchPlayer.tagLV = GetArenaBillLV(billData)
                 matchPlayer.tagJob = GetArenaBillJob(billData)
                 matchPlayer.tagScore = GetArenaBillScore(billData)
+                matchPlayer.tagFace = GetArenaBillFace(billData)
+                matchPlayer.tagFacePic = GetArenaBillFacePic(billData)
                 
                 GameWorld.DebugLog("    %s 匹配在榜单上的: tagPlayerID=%s,tagLV=%s,tagScore=%s,matchOrder=%s" 
                                    % (i + 1, matchPlayer.tagPlayerID, matchPlayer.tagLV, matchPlayer.tagScore, matchOrder), playerID)
@@ -834,6 +804,8 @@
         matchInfo.Job = matchPlayer.tagJob
         matchInfo.LV = matchPlayer.tagLV
         matchInfo.Score = matchPlayer.tagScore
+        matchInfo.Face = matchPlayer.tagFace
+        matchInfo.FacePic = matchPlayer.tagFacePic
         
         # 玩家读取额外信息, 机器人其他信息不处理,这里直接读最新的查看缓存,防止刷新不及时(并不是实时数据,只是相对实时,前端可自行控制刷新频率)
         if matchInfo.PlayerID > MaxRobotID:
@@ -846,6 +818,8 @@
                 matchInfo.RealmLV = cacheDict["RealmLV"]
                 matchInfo.FightPower = fightPower % ShareDefine.Def_PerPointValue
                 matchInfo.FightPowerEx = fightPower / ShareDefine.Def_PerPointValue
+                matchInfo.Face = cacheDict.get("Face", 0)
+                matchInfo.FacePic = cacheDict.get("FacePic", 0)
         else:
             # 此处机器人的暂忽略等级变化的同步,仅在刷新、更新积分时同步,此处省略查询机器人所属榜单排名
             pass
@@ -853,6 +827,17 @@
         clientPack.MatchList.append(matchInfo)
     clientPack.MatchCount = len(clientPack.MatchList)
     NetPackCommon.SendFakePack(curPlayer, clientPack)
+    return
+
+def __DoOfflineArenaBattleResult(curPlayer, recData, cmdName, cmdDict):
+    ## 执行离线未处理的战斗结果
+    recTime = recData.GetTime()
+    msgList = [cmdName, cmdDict]
+    retDict = __DoArenaBattleResult(curPlayer, cmdDict)
+    retDict["offlineRecTime"] = recTime
+    ret = msgList + [retDict]
+    resultName = '%s' % ret 
+    curPlayer.MapServer_QueryPlayerResult(0, 0, "Arena", resultName, len(resultName))
     return
 
 def __DoArenaBattleResult(curPlayer, cmdDict):
@@ -885,7 +870,7 @@
    
     curScore = playerScore
     isFindTag = False
-    tagLV, tagJob, tagScore = 0, 0, 0
+    tagLV, tagJob, tagScore, tagFace, tagFacePic = 0, 0, 0, 0, 0
     tagRealmLV, tagFightPower, tagAccID = 0, 0, "" # 机器人无值
     
     # 先找匹配列表
@@ -893,7 +878,7 @@
     for matchPlayer in matchList:
         if matchPlayer.tagPlayerID == tagPlayerID:
             isFindTag = True
-            tagLV, tagJob, tagScore = matchPlayer.tagLV, matchPlayer.tagJob, matchPlayer.tagScore
+            tagLV, tagJob, tagScore, tagFace, tagFacePic = matchPlayer.tagLV, matchPlayer.tagJob, matchPlayer.tagScore, matchPlayer.tagFace, matchPlayer.tagFacePic
             GameWorld.DebugLog("    对手在匹配列表中! tagLV=%s, tagJob=%s, tagScore=%s" % (tagLV, tagJob, tagScore), playerID)
             break
         
@@ -903,7 +888,7 @@
         for battleRec in curBattleRecList:
             if battleRec.tagPlayerID == tagPlayerID:
                 isFindTag = True
-                tagLV, tagJob, tagScore = battleRec.tagLV, battleRec.tagJob, battleRec.tagScore
+                tagLV, tagJob, tagScore, tagFace, tagFacePic = battleRec.tagLV, battleRec.tagJob, battleRec.tagScore, battleRec.tagFace, battleRec.tagFacePic
                 GameWorld.DebugLog("    对手在对战记录中! tagLV=%s, tagJob=%s, tagScore=%s" % (tagLV, tagJob, tagScore), playerID)
                 break
             
@@ -1012,6 +997,8 @@
     battleRec.addScore = addScore
     battleRec.isDispose = 1
     battleRec.updScore = updScore
+    battleRec.tagFace = tagFace
+    battleRec.tagFacePic = tagFacePic
     curBattleRecList.append(battleRec)
     if len(curBattleRecList) > battleRecMaxCount:
         curBattleRecList = curBattleRecList[len(curBattleRecList) - battleRecMaxCount:]
@@ -1030,6 +1017,8 @@
         tagBattleRec.addScore = tagAddScore
         tagBattleRec.isDispose = 1 if tagOnline else 0
         tagBattleRec.updScore = updTagScore
+        tagBattleRec.tagFace = face
+        tagBattleRec.tagFacePic = facePic
         tagBattleRecList.append(tagBattleRec)
         if len(tagBattleRecList) > battleRecMaxCount:
             tagBattleRecList = tagBattleRecList[len(tagBattleRecList) - battleRecMaxCount:]
@@ -1116,6 +1105,8 @@
         recInfo.AddScoreLen = len(recInfo.AddScore)
         recInfo.IsWin = battleRec.isWin
         recInfo.Time = battleRec.battleTime
+        recInfo.Face = battleRec.tagFace
+        recInfo.FacePic = battleRec.tagFacePic
         
         if recInfo.PlayerID > MaxRobotID:
             curCache = PlayerViewCache.FindViewCache(recInfo.PlayerID)

--
Gitblit v1.8.0