Battlefields: Move BF scripts out of game

Port From (https://github.com/TrinityCore/TrinityCore/commit/49523a74a4c28e5ae17f9a8352aa8224b765b7d8)
This commit is contained in:
hondacrx
2022-02-24 10:51:24 -05:00
parent 628a24923c
commit 569232c3fe
18 changed files with 763 additions and 548 deletions
+13 -1
View File
@@ -726,7 +726,7 @@ namespace Game.Entities
// Send misc stuff that needs to be sent on every login, like the battle timers.
if (WorldConfig.GetBoolValue(WorldCfg.WintergraspEnable))
{
BattleField wg = Global.BattleFieldMgr.GetBattlefieldByBattleId(1);//Wintergrasp battle
BattleField wg = Global.BattleFieldMgr.GetBattlefieldByBattleId(BattlefieldIds.WG);
if (wg != null)
{
SendUpdateWorldState(WorldStates.BattlefieldWgActive, (uint)(wg.IsWarTime() ? 0 : 1));
@@ -734,6 +734,18 @@ namespace Game.Entities
SendUpdateWorldState(WorldStates.BattlefieldWgTimeNextBattle, (uint)(GameTime.GetGameTime() + timer));
}
}
if (WorldConfig.GetBoolValue(WorldCfg.TolbaradEnable))
{
BattleField tb = Global.BattleFieldMgr.GetBattlefieldByBattleId(BattlefieldIds.TB);
if (tb != null)
{
SendUpdateWorldState(WorldStates.BattlefieldTbFactionControlling, (uint)(tb.GetDefenderTeam() + 1));
uint timer = tb.GetTimer() / 1000;
SendUpdateWorldState(WorldStates.BattlefieldTbTimeBattleEnd, (uint)(tb.IsWarTime() ? (uint)(GameTime.GetGameTime() + timer) : 0));
SendUpdateWorldState(WorldStates.BattlefieldTbTimeNextBattle, (uint)(!tb.IsWarTime() ? (uint)(GameTime.GetGameTime() + timer) : 0));
}
}
}
//Arenas