From e612ef874bdecbd9c946ce0f0f2ff41d13193f28 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 20 八月 2021 16:48:36 +0800 Subject: [PATCH] 8585 【BT3】【主干】竞技场(优化竞技场命令; 新增调整获得获得物品可配置广播) --- ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py | 23 ++++++++++++++--------- 1 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py index 19de738..b82040b 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py +++ b/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 -- Gitblit v1.8.0