From 9e000bf066a1fa6d47d823c143be17ff05334736 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期二, 23 四月 2019 11:32:09 +0800 Subject: [PATCH] 6459 【后端】【2.0】缥缈仙域开发单(同步副本NPC个数优化,变更时主动同步) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 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,,,,,] -- Gitblit v1.8.0