From f5cd3e2c7831b5f7e8865475804580ec713702ad Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 26 十一月 2021 11:24:41 +0800
Subject: [PATCH] 9341 【BT5】【主干】【后端】情缘系统(吃喜糖改为随机获得一种物品)

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
index 40c7c07..0bcfc8e 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
@@ -985,16 +985,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)
 
 ## 获得对应数位的值
 #  @param numValue 数值

--
Gitblit v1.8.0