Core/WorldStates: Migrate Wintergrasp worldstates to new system

Port From (https://github.com/TrinityCore/TrinityCore/commit/6285033ed5ba8f67330eca40c1ae4840882a98d3)
This commit is contained in:
hondacrx
2022-06-27 16:45:31 -04:00
parent 2ea34c42fa
commit 9cece8cc8a
7 changed files with 82 additions and 97 deletions
+4 -3
View File
@@ -348,11 +348,10 @@ namespace Game.BattleFields
if (!endByTimer)
SetDefenderTeam(GetAttackerTeam());
OnBattleEnd(endByTimer);
// Reset battlefield timer
m_Timer = m_NoWarBattleTime;
SendInitWorldStatesToAll();
OnBattleEnd(endByTimer);
}
void DoPlaySoundToAll(uint soundID)
@@ -749,6 +748,8 @@ namespace Game.BattleFields
public uint GetTypeId() { return m_TypeId; }
public uint GetZoneId() { return m_ZoneId; }
public uint GetMapId() { return m_MapId; }
public Map GetMap() { return m_Map; }
public ulong GetQueueId() { return MathFunctions.MakePair64(m_BattleId | 0x20000, 0x1F100000); }
// Return true if battle is start, false if battle is not started
-11
View File
@@ -741,17 +741,6 @@ namespace Game.Entities
void SendBattlefieldWorldStates()
{
// 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(BattlefieldIds.WG);
if (wg != null)
{
SendUpdateWorldState(WorldStates.BattlefieldWgActive, (uint)(wg.IsWarTime() ? 0 : 1));
uint timer = wg.IsWarTime() ? 0 : (wg.GetTimer() / 1000); // 0 - Time to next battle
SendUpdateWorldState(WorldStates.BattlefieldWgTimeNextBattle, (uint)(GameTime.GetGameTime() + timer));
}
}
if (WorldConfig.GetBoolValue(WorldCfg.TolbaradEnable))
{
BattleField tb = Global.BattleFieldMgr.GetBattlefieldByBattleId(BattlefieldIds.TB);
-4
View File
@@ -3466,10 +3466,6 @@ namespace Game.Entities
packet.AddState(4882, 0); // WORLD_STATE_HOR_WAVE_COUNT
}
break;
case (uint)AreaId.Wintergrasp: // Wintergrasp
if (battlefield != null && battlefield.GetTypeId() == (uint)BattleFieldTypes.WinterGrasp)
battlefield.FillInitialWorldStates(packet);
break;
// Zul Aman
case 3805:
if (instance != null && mapid == 568)
+11
View File
@@ -22,6 +22,7 @@ using Game.Maps;
using Game.Networking.Packets;
using System;
using System.Collections.Generic;
using Framework.Constants;
namespace Game
{
@@ -112,6 +113,16 @@ namespace Game
return map.GetWorldStateValue(worldStateId);
}
public void SetValue(WorldStates worldStateId, int value, Map map)
{
SetValue((int)worldStateId, value, map);
}
public void SetValue(uint worldStateId, int value, Map map)
{
SetValue((int)worldStateId, value, map);
}
public void SetValue(int worldStateId, int value, Map map)
{
WorldStateTemplate worldStateTemplate = GetWorldStateTemplate(worldStateId);