diff --git a/Source/Framework/Constants/SharedConst.cs b/Source/Framework/Constants/SharedConst.cs index 76cfd2bec..5dc0cc50c 100644 --- a/Source/Framework/Constants/SharedConst.cs +++ b/Source/Framework/Constants/SharedConst.cs @@ -1517,6 +1517,7 @@ namespace Framework.Constants BasemapLoadGrids, BattlegroundCastDeserter, BattlegroundInvitationType, + BattlegroundMapLoadGrids, BattlegroundPremadeGroupWaitForMatch, BattlegroundPrematureFinishTimer, BattlegroundQueueAnnouncerEnable, diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index 827756824..6abae3a32 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -423,6 +423,9 @@ namespace Game.Maps return false; //Should delete object } + if (IsAlwaysActive()) + obj.SetActive(true); + var cell = new Cell(cellCoord); if (obj.IsActiveObject()) EnsureGridLoadedForActiveObject(cell, obj); @@ -3345,6 +3348,15 @@ namespace Game.Maps return i_mapRecord != null && i_mapRecord.IsGarrison(); } + /// + /// Currently, this means that every entity added to this map will be marked as active + /// + /// + bool IsAlwaysActive() + { + return IsBattlegroundOrArena(); + } + private bool GetEntrancePos(out uint mapid, out float x, out float y) { mapid = 0; diff --git a/Source/Game/Maps/MapManager.cs b/Source/Game/Maps/MapManager.cs index 6d6cb0749..b97912714 100644 --- a/Source/Game/Maps/MapManager.cs +++ b/Source/Game/Maps/MapManager.cs @@ -97,6 +97,10 @@ namespace Game.Entities Cypher.Assert(map.IsBattlegroundOrArena()); map.SetBG(bg); bg.SetBgMap(map); + + if (WorldConfig.GetBoolValue(WorldCfg.BattlegroundMapLoadGrids)) + map.LoadAllCells(); + return map; } diff --git a/Source/Game/Server/WorldConfig.cs b/Source/Game/Server/WorldConfig.cs index fa64982e1..3a7041fe1 100644 --- a/Source/Game/Server/WorldConfig.cs +++ b/Source/Game/Server/WorldConfig.cs @@ -227,6 +227,7 @@ namespace Game Values[WorldCfg.InstancemapLoadGrids] = false; } + Values[WorldCfg.BattlegroundMapLoadGrids] = GetDefaultValue("BattlegroundMapLoadAllGrids", true); Values[WorldCfg.IntervalSave] = GetDefaultValue("PlayerSaveInterval", 15 * Time.Minute * Time.InMilliseconds); Values[WorldCfg.IntervalDisconnectTolerance] = GetDefaultValue("DisconnectToleranceInterval", 0); Values[WorldCfg.StatsSaveOnlyOnLogout] = GetDefaultValue("PlayerSave.Stats.SaveOnlyOnLogout", true); diff --git a/Source/WorldServer/WorldServer.conf.dist b/Source/WorldServer/WorldServer.conf.dist index eceffda03..2c6cc1c97 100644 --- a/Source/WorldServer/WorldServer.conf.dist +++ b/Source/WorldServer/WorldServer.conf.dist @@ -324,6 +324,15 @@ BaseMapLoadAllGrids = 0 InstanceMapLoadAllGrids = 0 +# +# BattlegroundMapLoadAllGrids +# Description: Load all grids for battleground maps upon load. +# Upon loading an battleground map, all creatures/objects in the map will be pre-loaded +# Default: 1 - (Preload all grids in the instance upon load) +# 0 - (Don't preload all base maps, dynamically load as used) + +BattlegroundMapLoadAllGrids = 1 + # # SocketTimeOutTime # Description: Time (in milliseconds) after which a connection being idle on the character