Core/Battlefields: Refactor Battlefield creation to be linked to host map creation instead of having globally accessible objects
Port From (https://github.com/TrinityCore/TrinityCore/commit/073a036d84365dae60a70064eb67e68f0447bd72)
This commit is contained in:
@@ -4275,7 +4275,7 @@ namespace Game.Spells
|
||||
Battleground bg = target.ToPlayer().GetBattleground();
|
||||
if (bg)
|
||||
bg.RemovePlayerFromResurrectQueue(target.GetGUID());
|
||||
BattleField bf = Global.BattleFieldMgr.GetBattlefieldToZoneId(target.GetZoneId());
|
||||
BattleField bf = Global.BattleFieldMgr.GetBattlefieldToZoneId(target.GetMap(), target.GetZoneId());
|
||||
if (bf != null)
|
||||
bf.RemovePlayerFromResurrectQueue(target.GetGUID());
|
||||
}
|
||||
|
||||
@@ -5731,7 +5731,7 @@ namespace Game.Spells
|
||||
// allow always ghost flight spells
|
||||
if (m_originalCaster != null && m_originalCaster.IsTypeId(TypeId.Player) && m_originalCaster.IsAlive())
|
||||
{
|
||||
BattleField Bf = Global.BattleFieldMgr.GetBattlefieldToZoneId(m_originalCaster.GetZoneId());
|
||||
BattleField Bf = Global.BattleFieldMgr.GetBattlefieldToZoneId(m_originalCaster.GetMap(), m_originalCaster.GetZoneId());
|
||||
var area = CliDB.AreaTableStorage.LookupByKey(m_originalCaster.GetAreaId());
|
||||
if (area != null)
|
||||
if (area.HasFlag(AreaFlags.NoFlyZone) || (Bf != null && !Bf.CanFlyIn()))
|
||||
|
||||
@@ -4922,7 +4922,7 @@ namespace Game.Entities
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
BattleField Bf = Global.BattleFieldMgr.GetBattlefieldToZoneId(player.GetZoneId());
|
||||
BattleField Bf = Global.BattleFieldMgr.GetBattlefieldToZoneId(player.GetMap(), player.GetZoneId());
|
||||
if (Bf == null || Bf.CanFlyIn() || (!player.HasAuraType(AuraType.ModIncreaseMountedFlightSpeed) && !player.HasAuraType(AuraType.Fly)))
|
||||
return false;
|
||||
break;
|
||||
@@ -4933,7 +4933,7 @@ namespace Game.Entities
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
BattleField bf = Global.BattleFieldMgr.GetBattlefieldToZoneId(player.GetZoneId());
|
||||
BattleField bf = Global.BattleFieldMgr.GetBattlefieldToZoneId(player.GetMap(), player.GetZoneId());
|
||||
|
||||
if (bf == null || bf.GetTypeId() != (int)BattleFieldTypes.WinterGrasp)
|
||||
return false;
|
||||
@@ -4953,7 +4953,7 @@ namespace Game.Entities
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
BattleField battlefieldWG = Global.BattleFieldMgr.GetBattlefieldByBattleId(1);
|
||||
BattleField battlefieldWG = Global.BattleFieldMgr.GetBattlefieldByBattleId(player.GetMap(), 1);
|
||||
if (battlefieldWG != null)
|
||||
return battlefieldWG.IsEnabled() && (player.GetTeamId() == battlefieldWG.GetDefenderTeam()) && !battlefieldWG.IsWarTime();
|
||||
break;
|
||||
@@ -4963,7 +4963,7 @@ namespace Game.Entities
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
BattleField bf = Global.BattleFieldMgr.GetBattlefieldToZoneId(player.GetZoneId());
|
||||
BattleField bf = Global.BattleFieldMgr.GetBattlefieldToZoneId(player.GetMap(), player.GetZoneId());
|
||||
if (bf != null)
|
||||
return bf.IsWarTime();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user