From 82bfb22d95a07da2efdd06c18ea4af390759777d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 23 五月 2022 17:00:30 +0800
Subject: [PATCH] 9415 【BT】【后端】古神战场(修复周榜结算、战场结算时,存在无奖励名次会报错bug)
---
ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py | 4 ++--
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py | 10 ++++++----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
index ce05c72..721975c 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
@@ -1091,7 +1091,7 @@
# @param order 名次,从1开始
# @param isDefaultLast 找不到的名次是否默认取最后一名的
# @return obj or None
-def GetOrderValueByDict(orderDict, order, isDefaultLast=True):
+def GetOrderValueByDict(orderDict, order, isDefaultLast=True, defaultValue=None):
if order in orderDict:
return orderDict[order]
@@ -1102,7 +1102,7 @@
return orderDict[dOrder]
# 找不到的默认取最后一名
- return orderDict[orderList[-1]] if isDefaultLast else None
+ return orderDict[orderList[-1]] if isDefaultLast else defaultValue
##概率相关, 这个事件是否能够出现
# @param rate 基础几率
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py
index e4ca6f2..62e253c 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py
@@ -214,14 +214,15 @@
playerID = billboardData.ID
cmpValue = billboardData.CmpValue
rank = i + 1
- awardItemList = GameWorld.GetOrderValueByDict(awardDict, rank, False)
+ awardItemList = GameWorld.GetOrderValueByDict(awardDict, rank, False, [])
paramList = [rank]
if billboardType == ShareDefine.Def_CBT_BattlefieldWJoin and enterWeekMoneyItemID:
- moneyBaseCount, multiValue = GameWorld.GetOrderValueByDict(enterWeekMoneyMultiIntDict, rank, False) # 奖励货币倍值
+ moneyBaseCount, multiValue = GameWorld.GetOrderValueByDict(enterWeekMoneyMultiIntDict, rank, False, [0, 0]) # 奖励货币倍值
#基础保底值(不同名次可能不一样) + 名次倍率*次数
awardMoneyCount = int(moneyBaseCount + multiValue * cmpValue)
awardItemList.append([enterWeekMoneyItemID, awardMoneyCount, 0])
- PlayerCompensation.SendMailByKey(mailKey, [playerID], awardItemList, paramList, crossMail=True)
+ if awardItemList:
+ PlayerCompensation.SendMailByKey(mailKey, [playerID], awardItemList, paramList, crossMail=True)
billboardObj.ClearData()
@@ -867,7 +868,8 @@
GameWorld.Log(" 失败阵营玩家: faction=%s,rank=%s,playerID=%s" % (faction, rank, playerID), fbPropertyID)
# 排名奖励邮件
- PlayerCompensation.SendMailByKey(orderAwardMailKey, [playerID], orderAwardItemList, paramList, crossMail=True)
+ if orderAwardItemList:
+ PlayerCompensation.SendMailByKey(orderAwardMailKey, [playerID], orderAwardItemList, paramList, crossMail=True)
# 更新周参与榜单
groupValue1, dataID, name1, name2 = zoneID, playerID, name, ""
--
Gitblit v1.8.0