From 783f0435fafdc0ab6480ff572cf9b11aeedbc138 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 23 一月 2026 17:35:02 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(PrintFightPower命令支持刷属性指定属性明细,调整输出)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 56 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 46527c9..652b5f1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
@@ -123,13 +123,19 @@
#重新加载已经预存的脚本
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
reload(reloadPath)
except Exception:
continue
-
+
+ import DataRecordPack
+ DataRecordPack.DR_Reload("script")
Log("Reload Begin : time = %s"%GetCurrentDataTimeStr())
return
@@ -899,6 +905,22 @@
return
return
+
+## 获得指定的时间格式
+# @param timeStr 时间列表
+# @param timeFormat 指定的转换格式
+# @return 时间datetime格式
+# @remarks 获得指定的时间格式
+def GetDateTimeByFormatStr(timeStr, timeFormat):
+ timeStr = timeStr.strip().split(".")[0]
+ try:
+ return datetime.datetime.strptime(timeStr, timeFormat)
+ except BaseException , e :
+ Log("%s : %s"%(e, timeStr))
+ return
+
+ return
+
#---------------------------------------------------------------------
##获得与现实时间差距的小时数
# @param dateTimeStr 比较时间字符 如"2010-05-26 11:21:25"
@@ -1289,6 +1311,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 +1360,14 @@
# @remarks 获得当前服务器的版本号
def GetServerVersion():
return GetGameWorld().GetServerVersion()
+
+def IsBattleServer():
+ ## 是否战斗服务器
+ return ToIntDef(ReadChConfig.GetPyMongoConfig("platform", "BattleServer"), 0) == 1
+
+def GetServerGroupName():
+ ## 服务器组名,取 ServersRoute 中的配置
+ return ReadChConfig.GetServersRouteConfig("platform", "GroupName")
def GetServerGroupID():
## 服务器组ID,必须唯一,代表这台物理服务器
@@ -1437,7 +1483,10 @@
##获取玩家所属平台
def GetPlayerPlatform(curPlayer):
- return curPlayer.GetAccountData().GetOperator()
+ appID = curPlayer.GetAccountData().GetOperator()
+ if not appID:
+ appID = GetAppIDByAccID(curPlayer.GetAccID())
+ return appID
##获取平台账号
def GetPlatformAccID(gameAccID):
@@ -1445,6 +1494,10 @@
paInfoList = infoList[:-2]
platformAccID = Def_AccID_Split_Sign.join(paInfoList)
return platformAccID
+def GetAppIDByAccID(gameAccID):
+ ## 根据账号获取appID
+ infoList = gameAccID.split(Def_AccID_Split_Sign)
+ return infoList[-2]
def GetSessionID(curPlayer):
return md5.md5(curPlayer.GetAccID() + curPlayer.GetAccountData().GetLastLoginTime() +'mobile').hexdigest()
@@ -1944,7 +1997,7 @@
## 跨服服务器时间
if IsCrossServer():
return GetCurrentDataTimeStr()
- lastCrossServerTime, lastServerTime, _ = PyGameData.g_crossServerTimeInfo
+ lastCrossServerTime, lastServerTime = PyGameData.g_crossServerTimeInfo
if not lastCrossServerTime:
return GetCurrentDataTimeStr()
curTime = int(time.time())
--
Gitblit v1.8.0