From 5235734ece03884f84a7cd483150f84a0dd33b52 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期二, 23 四月 2019 11:53:11 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/SnxxServerCode

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossDemonKing.py |    1 -
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py |   24 ++++++++++++++++++++----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py                 |   29 +++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 5 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
index 227d2f6..d007905 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
@@ -1018,6 +1018,35 @@
     #可以进入
     return True
 #---------------------------------------------------------------------
+def Sync_FBNPC(mapID=0, npcIDList=[], curPlayer=None):
+    ## 同步当前副本NPC给副本中的所有玩家
+    if not mapID:
+        mapID = GameWorld.GetMap().GetMapID()
+        mapID = GetRecordMapID(mapID)
+    npcCntDict = {}
+    gameNPCManager = GameWorld.GetNPCManager()
+    for index in xrange(gameNPCManager.GetNPCCount()):
+        curNPC = gameNPCManager.GetNPCByIndex(index)
+        npcID = curNPC.GetNPCID()
+        if not npcID:
+            continue
+        if curNPC.GetGameNPCObjType() == IPY_GameWorld.gnotPet:
+            continue
+        if npcIDList and npcID not in npcIDList:
+            continue
+        npcCntDict[npcID] = npcCntDict.get(npcID, 0) + 1
+        
+    if curPlayer:
+        NPCCommon.SyncNPCCntInfo(curPlayer, mapID, npcCntDict)
+    else:
+        playerManager = GameWorld.GetMapCopyPlayerManager()
+        for i in xrange(playerManager.GetPlayerCount()):
+            curPlayer = playerManager.GetPlayerByIndex(i)
+            if curPlayer.GetID() == 0:
+                continue
+            NPCCommon.SyncNPCCntInfo(curPlayer, mapID, npcCntDict)
+    return npcCntDict
+
 ##获得地图上的NPC列表
 # @param 无参数
 # @return 返回值, NPC实例列表[curNPC,curNPC,,,,,]
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossDemonKing.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossDemonKing.py
index f92efaa..79c22c4 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossDemonKing.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossDemonKing.py
@@ -21,7 +21,6 @@
 import IPY_GameWorld
 import IpyGameDataPY
 import PlayerFairyDomain
-import CrossRealmPlayer
 import GameWorldProcess
 import PlayerControl
 import ShareDefine
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py
index df5f4ab..30b9f00 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py
@@ -19,13 +19,14 @@
 import GameWorldProcess
 import PlayerFairyDomain
 import NPCCustomRefresh
-import CrossRealmPlayer
 import IpyGameDataPY
 import PyGameData
 import NPCCommon
 import PlayerControl
 import ChConfig
 import FBCommon
+
+FBDict_SyncFBNPC = 'SyncFBNPC' #是否需要同步副本NPC
 
 def DoResetCrossGrassland(curPlayer, eventType, fdeventID):
     ## 草园重置
@@ -89,11 +90,17 @@
     zoneID = FBCommon.GetCrossDynamicLineMapZoneID()
     funcLineID = FBCommon.GetCrossDynamicLineMapFuncLineID()
     GameWorld.Log("DoEnterFB zoneID=%s,funcLineID=%s" % (zoneID, funcLineID), playerID)
+    FBCommon.Sync_FBNPC(curPlayer=curPlayer)
     return
 
-### 副本总逻辑计时器
-#def OnProcess(tick):
-#    return
+## 副本总逻辑计时器
+def OnProcess(tick):
+    gameFB = GameWorld.GetGameFB()
+    if gameFB.GetGameFBDictByKey(FBDict_SyncFBNPC):
+        gameFB.SetGameFBDict(FBDict_SyncFBNPC, 0)
+        FBCommon.Sync_FBNPC()
+        
+    return
 #
 ### 关闭副本
 #def OnCloseFB(tick):
@@ -169,4 +176,13 @@
     GameWorld.DebugLog("设置草园已完成!mapID=%s, lineID=%s" % (mapID, lineID))
     return
 
+def DoFB_NPCDead(curNPC):
+    #GameWorld.DebugLog("DoFB_NPCDead 设置需要同步副本NPC!")
+    GameWorld.GetGameFB().SetGameFBDict(FBDict_SyncFBNPC, 1)
+    return
+
+def OnNPCRebornInFB(curNPC):
+    #GameWorld.DebugLog("OnNPCRebornInFB 设置需要同步副本NPC!")
+    GameWorld.GetGameFB().SetGameFBDict(FBDict_SyncFBNPC, 1)
+    return
 

--
Gitblit v1.8.0