From 863a38aa50e3c28e1740f99550448be30fcc1841 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 03 十二月 2025 19:55:27 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(修改战报文件删除方式)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py          |   10 ++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py |   13 +++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
index 528f083..b1dda64 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -457,7 +457,7 @@
         if self._isNeedReport:
             packBuff = clientPack.GetBuffer()
             buffLen = len(packBuff)
-            GameWorld.DebugLog("回合战斗过程封包: %s, len:%s" % (headStr, buffLen))
+            GameWorld.DebugLog("回合战斗过程封包: %s, len:%s, %s" % (headStr, buffLen, CommFunc.B2Hex(packBuff)))
             self.batBuffer += CommFunc.WriteWORD("", buffLen)
             self.batBuffer += packBuff
             ObjPool.GetPoolMgr().release(clientPack)
@@ -2079,9 +2079,14 @@
     if not os.path.exists(ReportDir):
         os.makedirs(ReportDir)
     else:
-        shutil.rmtree(ReportDir)
-        os.makedirs(ReportDir)
-        
+        items = os.listdir(ReportDir)
+        for item in items:
+            fullPath = os.path.join(ReportDir, item)
+            try:
+                os.remove(fullPath)
+            except:
+                pass
+            
     saveFilePath = os.path.join(ReportDir, "%s.tfr" % guid)
     GameWorld.DebugLog("__saveBatBuffer=%s" % saveFilePath)
     
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
index c1db2ce..78aa02d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
@@ -60,6 +60,16 @@
         returnStr += chr(string.atoi(hexStr[i:i+2],16))
     return returnStr
 
+def B2Hex(buf, upper=True, space=True):
+    hex_str = binascii.b2a_hex(buf)
+    # 转换为大写
+    if upper:
+        hex_str = hex_str.upper()
+    # 每两个字符添加一个空格
+    if space:
+        hex_str = ' '.join(hex_str[i:i+2] for i in range(0, len(hex_str), 2))
+    return hex_str
+            
 #获取异常信息#(try:...except:..GetExceptionInfo())
 ## 
 #  @param 参数

--
Gitblit v1.8.0