From 4e2daf438140632d5d30f14a2e19146a22aeeb31 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 11 三月 2024 11:45:44 +0800
Subject: [PATCH] 10142 【主干】【越南】【港台】【砍树】通天令激活修改

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

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
index ce05c72..237cb4a 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
@@ -538,6 +538,13 @@
 
 #---------------------------------------------------------------------
 
+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):
     ## 获取运营活动对应日期,存数字代表开服天配置,需要转化为对应的日期
     curDateTime = datetime.datetime.today()
@@ -1091,7 +1098,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 +1109,7 @@
                 return orderDict[dOrder]
         
     # 找不到的默认取最后一名
-    return orderDict[orderList[-1]] if isDefaultLast else None
+    return orderDict[orderList[-1]] if isDefaultLast else defaultValue
 
 ##概率相关, 这个事件是否能够出现
 # @param rate 基础几率
@@ -1115,13 +1122,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