From 0c27822ef5e6c67782ed143a4ff03ecfbdfda1fb Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期一, 23 五月 2022 16:52:58 +0800 Subject: [PATCH] 9415 【BT】【后端】古神战场(副本内功能完整版本) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py index 4a1a011..e9c753f 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py @@ -1465,16 +1465,16 @@ ## 从列表中产生物品,[[权重, object], ....] # @param weightList 待选列表 -def GetResultByWeightList(weightList): +def GetResultByWeightList(weightList, defValue=None): randList = [] weight = 0 for info in weightList: weight += info[0] randList.append([weight, info[1] if len(info) == 2 else info[1:]]) if not randList: - return + return defValue rate = random.randint(1, randList[-1][0]) - return GetResultByRiseList(randList, rate) + return GetResultByRiseList(randList, rate, defValue) #--------------------------------------------------------------------- -- Gitblit v1.8.0