From 8978dd1c93b322806bac51090d40e65cee33d90d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 09 一月 2019 15:26:09 +0800
Subject: [PATCH] 5722 【后端】【1.5】跨服BOSS开发(支持刷跨服boss)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py |   47 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index 1266f07..fe4c469 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -2068,13 +2068,7 @@
         # 通知GameServer boss状态 封魔坛在副本里单独处理
         ipyData = IpyGameDataPY.GetIpyGameDataNotLog('BOSSInfo', npcid)
         if ipyData and ipyData.GetMapID() != ChConfig.Def_FBMapID_SealDemon:
-            mapID = GameWorld.GetMap().GetMapID()
-            lineID = GameWorld.GetGameWorld().GetLineID()
-            msgList = [npcid, 0, mapID, lineID]
-            GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GameWorldBossState',
-                                                                '%s' % (msgList), len(str(msgList)))
-            bosskey = ShareDefine.Def_Notify_WorldKey_GameWorldBossReborn % npcid
-            GameWorld.GetGameWorld().SetGameWorldDict(bosskey, 0)
+            GameServe_GameWorldBossState(npcid, 0)
             #GameWorld.GetGameWorld().SetGameWorldDict(ChConfig.Map_NPC_WorldBossDeadTick % npcid, GameWorld.GetGameWorld().GetTick())
             #因为存在boss分流,所以用gameFB字典,但是存活状态还是用GameWorld字典
             GameWorld.GetGameFB().SetGameFBDict(ChConfig.Map_NPC_WorldBossDeadTick % npcid, GameWorld.GetGameWorld().GetTick())
@@ -2100,11 +2094,35 @@
                    curNPC.GetDictByKey(ChConfig.Def_NPCDead_KillerID))
     return
 
-def GameServer_KillGameWorldBoss(bossID, killerName, hurtValue, isNotify=True):
-    isAddKillCnt = 0 # 页游逻辑,手游暂写死不增
-    mapID = GameWorld.GetMap().GetMapID()
-    killMsg = str([bossID, killerName, hurtValue, isAddKillCnt, isNotify, mapID])
+def GameServer_KillGameWorldBoss(bossID, killPlayerName, hurtValue, isNotify=True):
+    dataMapID = GameWorld.GetGameWorld().GetMapID()
+    realMapID = GameWorld.GetGameWorld().GetRealMapID()
+    copyMapID = GameWorld.GetGameWorld().GetCopyMapID()
+    killMsg = str([bossID, killPlayerName, hurtValue, isNotify, realMapID, dataMapID, copyMapID])
     GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'KillGameWorldBoss', killMsg, len(killMsg))
+    GameWorld.DebugLog("Boss被击杀: bossID=%s,dataMapID=%s,realMapID=%s,copyMapID=%s" % (bossID, dataMapID, realMapID, copyMapID))
+    return
+
+def GameServe_GameWorldBossState(bossID, isAlive):
+    dataMapID = GameWorld.GetGameWorld().GetMapID()
+    realMapID = GameWorld.GetGameWorld().GetRealMapID()
+    copyMapID = GameWorld.GetGameWorld().GetCopyMapID()
+    stateMsg = str([bossID, isAlive, dataMapID, realMapID, copyMapID])
+    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GameWorldBossState', '%s' % stateMsg, len(stateMsg))
+    GameWorld.DebugLog("Boss状态变更: bossID=%s,isAlive=%s,dataMapID=%s,realMapID=%s,copyMapID=%s" 
+                       % (bossID, isAlive, dataMapID, realMapID, copyMapID))
+    if not isAlive:
+        if dataMapID in ChConfig.Def_CrossZoneTableName:
+            tableName = ChConfig.Def_CrossZoneTableName[dataMapID]
+            realMapID = GameWorld.GetGameWorld().GetRealMapID()
+            copyMapID = GameWorld.GetGameWorld().GetCopyMapID()
+            zoneIpyData = IpyGameDataPY.GetIpyGameData(tableName, realMapID, dataMapID, copyMapID)
+            if not zoneIpyData:
+                return
+            zoneID = zoneIpyData.GetZoneID()
+            GameWorld.GetGameWorld().SetGameWorldDict(ShareDefine.Def_Notify_WorldKey_GameWorldBossRebornCross % (zoneID, bossID), 0)
+        else:
+            GameWorld.GetGameWorld().SetGameWorldDict(ShareDefine.Def_Notify_WorldKey_GameWorldBossReborn % bossID, 0)
     return
 
 #################################################
@@ -3508,12 +3526,7 @@
             # 通知GameServer boss刷新成功
             ipyData = IpyGameDataPY.GetIpyGameDataNotLog('BOSSInfo', curNPCID)
             if ipyData:
-                mapID = GameWorld.GetMap().GetMapID()
-                lineID = GameWorld.GetGameWorld().GetLineID()
-                msgList = [curNPCID, 1, mapID, lineID]
-                GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GameWorldBossState',
-                                                            '%s' % (msgList), len(str(msgList)))
-                
+                GameServe_GameWorldBossState(curNPCID, 1)
                 if GetDropOwnerType(curNPC) == ChConfig.DropOwnerType_Family:
                     FamilyRobBoss.FamilyOwnerBossOnReborn(curNPC)
                     

--
Gitblit v1.8.0