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/NPCCustomRefresh.py | 81 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 81 insertions(+), 0 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py index 6aa5ef7..5a8c626 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py @@ -17,6 +17,7 @@ import ShareDefine import ReadChConfig import GameLogic_SealDemon +import CrossRealmPlayer import PlayerControl import IPY_GameWorld import IpyGameDataPY @@ -389,6 +390,9 @@ '''非分流地图boss只在一线刷 分流地图boss每条线都刷新,其他分流线路boss在没人打的情况下同生同死 ''' + if GameWorld.IsCrossServer(): + __DoRefreshWorldBossCrossServer(npcRefresh, tick) + return mapID = GameWorld.GetMap().GetMapID() refreshMark = npcRefresh.GetRefreshMark() lineID = GameWorld.GetGameWorld().GetLineID() @@ -531,6 +535,83 @@ #=================================================================================================== +def __DoRefreshWorldBossCrossServer(npcRefresh, tick): + ## 跨服服务器刷boss + + mapID = GameWorld.GetGameWorld().GetMapID() # dataMapID + if mapID not in ChConfig.Def_CrossMapIDList: + return + + refreshMark = npcRefresh.GetRefreshMark() + lineID = GameWorld.GetGameWorld().GetLineID() + bossIpyData = IpyGameDataPY.GetIpyGameDataByCondition('BOSSInfo', {'RefreshMark':refreshMark, 'MapID':mapID}, isLogNone=False) + if not bossIpyData: + return + + stoneNPCID = bossIpyData.GetStoneNPCID() + bossID = bossIpyData.GetNPCID() + if not bossID and not stoneNPCID: + return + + if mapID not in ChConfig.Def_CrossZoneTableName: + return + tableName = ChConfig.Def_CrossZoneTableName[mapID] + realMapID = GameWorld.GetGameWorld().GetRealMapID() + copyMapID = GameWorld.GetGameWorld().GetCopyMapID() + zoneIpyData = IpyGameDataPY.GetIpyGameDataNotLog(tableName, realMapID, mapID, copyMapID) + if not zoneIpyData: + return + zoneID = zoneIpyData.GetZoneID() + + gameFB = GameWorld.GetGameFB() + bosskey = ShareDefine.Def_Notify_WorldKey_GameWorldBossRebornCross % (zoneID, bossID) + rebornBossState = GameWorld.GetGameWorld().GetGameWorldDictByKey(bosskey) + curNPC = None + if npcRefresh.GetCount() > 0: + curNPC = npcRefresh.GetAt(0) + + # 复活状态 + if rebornBossState: + if curNPC: + if curNPC.GetNPCID() == bossID: + return + #去掉非bossNPC + NPCCommon.SetDeadEx(curNPC) + + # 死亡状态 + else: + if curNPC: + if curNPC.GetNPCID() == stoneNPCID: + return + #去掉非墓碑NPC + NPCCommon.SetDeadEx(curNPC) + + # 延迟刷墓碑 + bossDeadTick = gameFB.GetGameFBDictByKey(ChConfig.Map_NPC_WorldBossDeadTick % bossID) + bossStoneDelayTime = IpyGameDataPY.GetFuncCfg('BossStoneDelayTime') + if tick - bossDeadTick <= bossStoneDelayTime: + return + gameFB.SetGameFBDict(ChConfig.Map_NPC_WorldBossDeadTick % bossID, tick) + + rebornNPCID = bossID if rebornBossState else stoneNPCID + if not rebornNPCID: + return + rebornTickKey = ChConfig.Map_NPC_WorldBossLastReBornTick % rebornNPCID + lastRebornTick = gameFB.GetGameFBDictByKey(rebornTickKey) + if tick - lastRebornTick <= 50 * 1000: + GameWorld.DebugLog("CrossBossRefresh mapID=%s,realMapID=%s,copyMapID=%s,refreshMark=%s,rebornNPCID=%s,tick=%s,lastRebornTick=%s 不重复刷新!" + % (mapID, realMapID, copyMapID, refreshMark, rebornNPCID, tick, lastRebornTick)) + return + + npcRefresh.Refresh(rebornNPCID, ChConfig.Def_SuperBossAngryCount, 1, False) + #初始化NPC + __InitNewBornNPC(npcRefresh, tick) + gameFB.SetGameFBDict(rebornTickKey, tick) + + GameWorld.DebugLog("CrossBossRefresh mapID=%s,realMapID=%s,copyMapID=%s,refreshMark=%s,rebornNPCID=%s,OK!" + % (mapID, realMapID, copyMapID, refreshMark, rebornNPCID), lineID) + return + ################################ 通用刷怪逻辑 #################################### def GetNPCRefreshCountList(refreshID): ## 获取刷怪标识点规则ID需要刷新的NPC个数信息; -- Gitblit v1.8.0