From 03fdb924f00ceb435105d23f1ef4be488cc03b0a Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 11 六月 2024 19:35:49 +0800
Subject: [PATCH] 8605 【主干】【港台】【越南】【砍树】【后端】集字活动boss掉字优化,支持单次掉落多种字;

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
index ce05c72..cc413cf 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
@@ -118,6 +118,14 @@
     except ValueError:
         return defValue
     
+def ToFloat(input, defValue = 0):
+    try:
+        result = float(input)
+        return result
+    
+    except ValueError:
+        return defValue
+    
 ## 判断2个对象是否同国籍 
 #  @param srcObj 起点对象 
 #  @param desObj 目标对象 
@@ -537,6 +545,13 @@
     return tagPlayer.GetRealMapID()
 
 #---------------------------------------------------------------------
+
+def GetTemplateID(ipyData, cfgID, dayIndex):
+    if cfgID == None or dayIndex == None or not ipyData:
+        return 0
+    templateIDList = ipyData.GetTemplateIDList()
+    templateID = templateIDList[-1] if dayIndex >= len(templateIDList) else templateIDList[dayIndex]
+    return templateID
 
 def GetOperationActionDateStr(ipyData):
     ## 获取运营活动对应日期,存数字代表开服天配置,需要转化为对应的日期
@@ -1091,7 +1106,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 +1117,7 @@
                 return orderDict[dOrder]
         
     # 找不到的默认取最后一名
-    return orderDict[orderList[-1]] if isDefaultLast else None
+    return orderDict[orderList[-1]] if isDefaultLast else defaultValue
 
 ##概率相关, 这个事件是否能够出现
 # @param rate 基础几率
@@ -1115,13 +1130,14 @@
     
     return 0
 
-def DebugAnswer(curPlayer, text):
+def DebugAnswer(curPlayer, text, isLog=True):
     '''转码后再发DebugAnswer'''
     #===========================================================================
     # if not GetGameWorld().GetDebugLevel():
     #    return
     #===========================================================================
-    DebugLog(text)
+    if isLog:
+        DebugLog(text)
     text = text.decode(ShareDefine.Def_Game_Character_Encoding).encode(GetCharacterEncoding())
     curPlayer.DebugAnswer(text)
     return

--
Gitblit v1.8.0