8585 【BT3】【主干】竞技场(优化竞技场命令; 新增调整获得获得物品可配置广播)
2个文件已修改
1个文件已添加
113 ■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/Arena.py 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Arena.py 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/Arena.py
New file
@@ -0,0 +1,73 @@
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package GM.Commands.Arena
#
# @todo:竞技场
# @author hxp
# @date 2021-08-20
# @version 1.0
#
# 详细描述: 竞技场
#
#-------------------------------------------------------------------------------
#"""Version = 2021-08-20 17:00"""
#-------------------------------------------------------------------------------
import GameWorld
import GameWorldArena
import ShareDefine
#---------------------------------------------------------------------
#全局变量
#---------------------------------------------------------------------
#---------------------------------------------------------------------
#逻辑实现
## 执行逻辑
#  @param curPlayer 当前玩家
#  @param gmList [cmdIndex gmAccID msg]
#  @return None
#  @remarks 函数详细说明.
def OnExec(curPlayer, msgList):
    playerID = curPlayer.GetPlayerID()
    value1 = msgList[0]
    if len(msgList) == 1 and value1 > 0:
        updScore = value1
        __UpdArenaScore(curPlayer, playerID, updScore)
    elif len(msgList) >= 3 and value1 == 2:
        tagPlayerID, updScore = msgList[1], msgList[2]
        __UpdArenaScore(curPlayer, tagPlayerID, updScore)
    return
def __UpdArenaScore(curPlayer, playerID, updScore):
    # 更新榜单
    billBoard = GameWorld.GetBillboard().FindBillboard(ShareDefine.Def_BT_Arena)
    if billBoard:
        billBoardData = billBoard.FindByID(playerID)
        if billBoardData:
            billBoardData.SetCmpValue(updScore)
            billBoard.Sort()
            GameWorld.DebugAnswer(curPlayer, "更新榜单积分playerID=%s,积分=%s" % (playerID, updScore))
        else:
            GameWorld.DebugAnswer(curPlayer, "未上榜不需要更新积分!")
    # 更新对战记录
    battleRecList = GameWorldArena.GetPlayerArenaBattleRecList(playerID)
    if len(battleRecList) > 0:
        tagBattleRec = battleRecList[-1]
        tagBattleRec.updScore = updScore
        GameWorld.DebugAnswer(curPlayer, "对战记录积分更新playerID=%s,积分=%s" % (playerID, updScore))
    else:
        GameWorld.DebugAnswer(curPlayer, "无对战记录不需要更新积分!")
    return
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py
@@ -847,7 +847,7 @@
    
    opInfo = ""
    # 结算自己
    addScore = __CalcBattleAddScore(curScore, tagScore, isWin)
    addScore = __CalcBattleAddScore(playerID, curScore, tagScore, isWin)
    updScore = max(0, playerScore + addScore)
    GameWorld.DebugLog("    更新自身积分: addScore=%s,updScore=%s" % (addScore, updScore), playerID)
    
@@ -860,11 +860,14 @@
        randItemList = IpyGameDataPY.GetFuncEvalCfg("ArenaBattleAward", 3)
        awardItemInfo = GameWorld.GetResultByRandomList(randItemList)
        if awardItemInfo:
            awardItemList.append(awardItemInfo)
            awardItemList.append(awardItemInfo[:3])
            isWorldNotify = awardItemInfo[3] if len(awardItemInfo) > 3 else 0
            if isWorldNotify:
                PlayerControl.WorldNotify(0, "ArenaWinerItem", [curPlayer.GetName(), awardItemInfo[0], "", awardItemInfo[1]])
    # 结算对手,仅玩家时结算,机器人不处理
    if tagPlayerID > MaxRobotID:
        tagAddScore = __CalcBattleAddScore(tagScore, curScore, not isWin)
        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)
@@ -943,26 +946,28 @@
                                                       cmdStr, len(cmdStr), curPlayer.GetRouteServerIndex())
    return
def __CalcBattleAddScore(curScore, tagScore, isWin):
def __CalcBattleAddScore(playerID, curScore, tagScore, isWin):
    ## 计算对战增加积分
    diffScore = curScore - tagScore # 积分差,有正负
    calcScoreFormatDict = IpyGameDataPY.GetFuncEvalCfg("ArenaBattleAward", 1) if isWin else IpyGameDataPY.GetFuncEvalCfg("ArenaBattleAward", 2)
    scoreKeyList = calcScoreFormatDict.keys()
    scoreKeyList.sort()
    calcKey = ""
    calcKey = None
    for scoreKey in scoreKeyList:
        if diffScore <= scoreKey:
            calcKey = scoreKey
            break
        
    if not calcKey:
    if calcKey == None:
        GameWorld.ErrLog("    计算得分公式: playerID=%s,diffScore=%s,scoreKeyList=%s,isWin=%s 找不到对应key公式"
                           % (playerID, diffScore, scoreKeyList, isWin))
        return 0
    
    compileKey = "ArenaBattleScore_%s_%s" % (int(isWin), str(calcKey))
    formatStr = calcScoreFormatDict[calcKey]
    addScore = eval(FormulaControl.GetCompileFormula(compileKey, formatStr))
    GameWorld.DebugLog("    计算得分公式: diffScore=%s,isWin=%s,compileKey=%s,formatStr=%s,addScore=%s"
                       % (diffScore, isWin, compileKey, formatStr, addScore))
    GameWorld.DebugLog("    计算得分公式: playerID=%s,diffScore=%s,scoreKeyList=%s,isWin=%s,compileKey=%s,formatStr=%s,addScore=%s"
                       % (playerID, diffScore, scoreKeyList, isWin, compileKey, formatStr, addScore))
    return addScore
#// A9 A8 查看竞技场对战记录 #tagCGQueryArenaBattleRecord
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Arena.py
@@ -18,7 +18,6 @@
import GameWorld
import ShareDefine
import PlayerControl
import PlayerBillboard
import GameFuncComm
import PlayerArena
import ChConfig
@@ -33,6 +32,7 @@
    if not msgList:
        GameWorld.DebugAnswer(curPlayer, "重置玩家竞技场: Arena 0")
        GameWorld.DebugAnswer(curPlayer, "设置玩家榜积分: Arena 积分")
        GameWorld.DebugAnswer(curPlayer, "设置玩家榜积分: Arena 2 对手ID 积分")
        GameWorld.DebugAnswer(curPlayer, "直接匹配到目标: Arena 1 对手ID 对手ID ...")
        GameWorld.DebugAnswer(curPlayer, "重置赛季直接用 test_OnWeek (需开服7天后)")
        return
@@ -41,6 +41,7 @@
        GameWorld.DebugAnswer(curPlayer, "竞技场功能未开启!")
        return
    
    isSendGameServer = False
    value1 = msgList[0]
    if value1 <= 0:
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaOSSeasonState, 0)
@@ -54,20 +55,18 @@
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaScore, value1)
        PlayerArena.Sync_ArenaInfo(curPlayer)
        
        # 同步排行榜
        cmpValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaScore)
        cmpValue2 = curPlayer.GetFightPower()
        cmpValue3 = 0
        value1 = curPlayer.GetOfficialRank()
        value2 = curPlayer.GetLV()
        PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_Arena, cmpValue, cmpValue2, cmpValue3, value1, value2, autoSort=True)
        isSendGameServer = True
        
    elif len(msgList) >= 2 and value1 == 1:
        gmMatchIDList = msgList[1:]
        PlayerArena.GMArenaMatch(curPlayer, gmMatchIDList)
        
    elif len(msgList) >= 3 and value1 == 2:
        isSendGameServer = True
    else:
        pass
    
    return
    return isSendGameServer