From ec68dabc97521a7706344e7d038e9f08462f4fe8 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 16 十二月 2025 10:26:34 +0800
Subject: [PATCH] 16 卡牌服务端(删除多余备档报错防范;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
index 86d570a..ea5120e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
@@ -123,6 +123,10 @@
     #重新加载已经预存的脚本
     for name, reloadPath in sys.modules.items():
         try:
+            pathStr = str(reloadPath)
+            if "\\Lib\\" in pathStr or "\\DLLs\\" in pathStr:
+                #DebugLog("Py库脚本不重读,会引起类继承出现问题导致报错! %s, %s" % (name, reloadPath))
+                continue
             if name in ["PyGameData"]:
                 DebugLog("%s 模块不重读!" % name)
                 continue
@@ -1289,6 +1293,22 @@
     LogUI.Msg('%s\t%s\tPyDebug:%s'%(par, playerID, msg))
     return
 
+def DebugLogEx(logFormat, *args):
+    ## DEBUG调试输出信息,只传入日志格式跟参数,非debug下不进行日志内容格式化
+    # @param logFormat: 日志内容格式,也可以直接传入完整的日志内容
+    # @param args: 日志参数,最后一个参数可以多传一个参数作为playerID用
+    if not __GameWorld.GetDebugLevel():
+        return
+    par = 0
+    playerID = 0
+    try:
+        msg = logFormat % args
+    except:
+        msg = logFormat % args[:-1]
+        playerID = args[-1]
+    LogUI.Msg('%s\t%s\tPyDebug:%s'%(par, playerID, msg))
+    return
+
 #---------------------------------------------------------------------
 ##获得当前服务器跨服ID
 # @param 无
@@ -1322,6 +1342,10 @@
 # @remarks 获得当前服务器的版本号
 def GetServerVersion():
     return GetGameWorld().GetServerVersion()
+
+def IsBattleServer():
+    ## 是否战斗服务器
+    return ToIntDef(ReadChConfig.GetPyMongoConfig("platform", "BattleServer"), 0) == 1
 
 def GetServerGroupID():
     ## 服务器组ID,必须唯一,代表这台物理服务器
@@ -1437,7 +1461,10 @@
 
 ##获取玩家所属平台
 def GetPlayerPlatform(curPlayer):
-    return curPlayer.GetAccountData().GetOperator()
+    appID = curPlayer.GetAccountData().GetOperator()
+    if not appID:
+        appID = GetAppIDByAccID(curPlayer.GetAccID())
+    return appID
 
 ##获取平台账号
 def GetPlatformAccID(gameAccID):

--
Gitblit v1.8.0