From 59c0f7a3818d8663f5fb4f7249f586d7a7d12eb6 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 18 十月 2024 18:05:25 +0800
Subject: [PATCH] 10263 【越南】【英文】后端支持NPC仿真实玩家战斗和快速战斗

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBackup.py      |    2 +-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGuaji.py       |    2 +-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/MirrorAttack.py      |    5 ++++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/EventReport.py              |    2 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DataRecordPack.py           |    2 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py   |    2 ++
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerPackData.py                         |    8 ++++----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PlayerMirror.py |    8 +++++---
 8 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerPackData.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerPackData.py
index ce8f7c9..11fb6b1 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerPackData.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerPackData.py
@@ -318,6 +318,7 @@
         packObj = packDataMgr.GetPlayerPackObj(playerID)
         # 已经有的数据先推送回去
         if packObj:
+            GameWorld.DebugLog("跨服有缓存玩家打包数据,直接推给子服! playerID=%s" % playerID)
             packDataDict[playerID] = packObj.PackData
             dataMsg = {"playerID":playerID, "packData":packObj.PackData, "msgInfo":msgInfo}
             CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PushPlayerPackData, dataMsg, [serverGroupID])
@@ -349,18 +350,16 @@
     msgInfo = msgData["msgInfo"]
     pullPlayerIDList = msgData["pullPlayerIDList"]
     
-    needPullPlayerIDList = []
     packDataMgr = PyDataManager.GetDBPlayerPackDataManager()
     for playerID in pullPlayerIDList:
         packObj = packDataMgr.GetPlayerPackObj(playerID)
         if packObj:
-            # 本服有数据,直接推给跨服
+            GameWorld.DebugLog("本服有缓存玩家打包数据,直接推给跨服! playerID=%s" % playerID)
             dataMsg = {"playerID":playerID, "packData":packObj.PackData, "msgInfo":msgInfo}
             CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_PlayerPackData, dataMsg)
         else:
-            needPullPlayerIDList.append(playerID)
+            DoPullPlayerPackData(playerID, msgInfo)
             
-    DoPullPlayerPackData(needPullPlayerIDList, msgInfo)
     return
 
 def CrossServerMsg_PushPlayerPackData(msgData):
@@ -415,6 +414,7 @@
         CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_PlayerPackData, dataMsg)
         return
     
+    PyDataManager.GetDBPlayerPackDataManager().UpdPlayerPackData(playerID, packData)
     # 本服需要,汇总结果
     ReuestPlayerPackDataRet(msgInfo, playerID, packData)
     return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/MirrorAttack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/MirrorAttack.py
index bd53a0c..e2b4736 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/MirrorAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/MirrorAttack.py
@@ -446,6 +446,9 @@
     playerID = 0
     if curPlayer:
         playerID = curPlayer.GetPlayerID()
+        if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MirrorBattleID):
+            GameWorld.DebugLog("镜像战斗场景中,无法请求!", playerID)
+            return
         curTime = int(time.time())
         # 请求cd验证
         requestTime = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MirrorBattleTime)
@@ -476,7 +479,7 @@
                    "requestTime":requestTime, "requestID":requestID, "requestMapID":requestMapID, "playerID":playerID})
     GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "ReuestPlayerPackData", sendMsg, len(sendMsg))
     GameWorld.DebugLog("请求创建镜像战斗: %s" % sendMsg, playerID)
-    return
+    return True
 
 def OnMirrorBattleInit(msgInfo, packDataDict, curPlayer=None):
     ''' 镜像战斗初始化 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DataRecordPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DataRecordPack.py
index b828710..593dd42 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DataRecordPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DataRecordPack.py
@@ -121,6 +121,8 @@
 def SendEventPack(eventTypeStr, dataDict, curPlayer=None):
 
     if curPlayer:
+        if not GameWorld.IsNormalPlayer(curPlayer):
+            return
         pid = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PlayerFromPID)
         dataDict["pid"] = pid
         dataDict["fightPower"] = PlayerControl.GetFightPower(curPlayer)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/EventReport.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/EventReport.py
index 29008ad..6fdfaca 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/EventReport.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/EventReport.py
@@ -127,6 +127,8 @@
     
     playerInfo = ""
     if curPlayer:
+        if not GameWorld.IsNormalPlayer(curPlayer):
+            return
         #UTF8 需要转成url编码才可用
         playerInfo = urllib.urlencode({"RoleID": curPlayer.GetName(),
                           "AccountID": GameWorld.GetPlatformAccID(curPlayer.GetAccID()),
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PlayerMirror.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PlayerMirror.py
index 0e0d977..a6272b7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PlayerMirror.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PlayerMirror.py
@@ -72,10 +72,12 @@
         for i, batPlayerID in enumerate(factionIDListB):
             battlePlayerList.append({"playerID":batPlayerID, "faction":2, "posX":posX + 5, "posY":posY + i * 5})
             
-        GameWorld.DebugAnswer(curPlayer, "创建镜像: %s VS %s" % (factionIDListA, factionIDListB))
         requestID = playerID
-        MirrorAttack.OnRequestCreateMirrorBattle(mapID, lineID, requestID, battlePlayerList, isSysbg, curPlayer)
-        
+        if MirrorAttack.OnRequestCreateMirrorBattle(mapID, lineID, requestID, battlePlayerList, isSysbg, curPlayer):
+            GameWorld.DebugAnswer(curPlayer, "请求创建镜像: %s VS %s" % (factionIDListA, factionIDListB))
+        else:
+            GameWorld.DebugAnswer(curPlayer, "请求创建镜像失败: %s VS %s" % (factionIDListA, factionIDListB))
+            
     elif value1 == "s":
         battle = MirrorAttack.GetMirrorBattle(curPlayer)
         if battle:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBackup.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBackup.py
index efc2b37..24bdd9c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBackup.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBackup.py
@@ -30,7 +30,7 @@
         #GameWorld.DebugLog("未启用备档")
         return
     
-    if curPlayer.GetRealPlayerID() != 0:
+    if not GameWorld.IsNormalPlayer(curPlayer):
         return
 
     curTime = int(time.time())
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py
index 982de22..a3100ef 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py
@@ -62,6 +62,8 @@
 
 def __CanPlayerBillboardComm(curPlayer):
     ## 玩家可否上榜通用检查
+    if not GameWorld.IsNormalPlayer(curPlayer):
+        return False
     if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Billboard):
         GameWorld.DebugLog("排行榜未开启,无法上榜!curLV=%s" % (curPlayer.GetLV()), curPlayer.GetPlayerID())
         return False
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGuaji.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGuaji.py
index c0e21fd..f737e3d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGuaji.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGuaji.py
@@ -59,7 +59,7 @@
     if GameWorld.IsCrossServer():
         return
     
-    if curPlayer.GetRealPlayerID() != 0:
+    if not GameWorld.IsNormalPlayer(curPlayer):
         return
     
     if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Guaji):

--
Gitblit v1.8.0