More work on new worldstate system
Port From (https://github.com/TrinityCore/TrinityCore/commit/a161b6cd328bbcf56950664f677fba716659f0d5)
This commit is contained in:
@@ -468,31 +468,6 @@ namespace Game.BattleFields
|
||||
Global.CreatureTextMgr.SendChat(stalker, (byte)id, target);
|
||||
}
|
||||
|
||||
public void SendInitWorldStatesTo(Player player)
|
||||
{
|
||||
InitWorldStates packet = new();
|
||||
packet.MapID = m_MapId;
|
||||
packet.AreaID = m_ZoneId;
|
||||
packet.SubareaID = player.GetAreaId();
|
||||
FillInitialWorldStates(packet);
|
||||
|
||||
player.SendPacket(packet);
|
||||
}
|
||||
|
||||
public void SendUpdateWorldState(WorldStates variable, uint value, bool hidden = false)
|
||||
{
|
||||
SendUpdateWorldState((uint)variable, value, hidden);
|
||||
}
|
||||
|
||||
public void SendUpdateWorldState(uint variable, uint value, bool hidden = false)
|
||||
{
|
||||
UpdateWorldState worldstate = new();
|
||||
worldstate.VariableID = variable;
|
||||
worldstate.Value = (int)value;
|
||||
worldstate.Hidden = hidden;
|
||||
BroadcastPacketToZone(worldstate);
|
||||
}
|
||||
|
||||
public void AddCapturePoint(BfCapturePoint cp)
|
||||
{
|
||||
if (m_capturePoints.ContainsKey(cp.GetCapturePointEntry()))
|
||||
@@ -803,11 +778,6 @@ namespace Game.BattleFields
|
||||
|
||||
public virtual void DoCompleteOrIncrementAchievement(uint achievement, Player player, byte incrementNumber = 1) { }
|
||||
|
||||
// Send all worldstate data to all player in zone.
|
||||
public virtual void SendInitWorldStatesToAll() { }
|
||||
|
||||
public virtual void FillInitialWorldStates(InitWorldStates data) { }
|
||||
|
||||
// Return if we can use mount in battlefield
|
||||
public bool CanFlyIn() { return !m_isActive; }
|
||||
|
||||
|
||||
@@ -99,7 +99,6 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
bf.SetTimer(time * Time.InMilliseconds);
|
||||
bf.SendInitWorldStatesToAll();
|
||||
if (battleId == 1)
|
||||
handler.SendGlobalGMSysMessage("Wintergrasp (Command timer used)");
|
||||
|
||||
|
||||
@@ -737,23 +737,6 @@ namespace Game.Entities
|
||||
//SendPacket(packet);
|
||||
}
|
||||
|
||||
//Battlefields
|
||||
void SendBattlefieldWorldStates()
|
||||
{
|
||||
// Send misc stuff that needs to be sent on every login, like the battle timers.
|
||||
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
|
||||
public void SetArenaTeamInfoField(byte slot, ArenaTeamInfoType type, uint value)
|
||||
{
|
||||
|
||||
@@ -2906,7 +2906,6 @@ namespace Game.Entities
|
||||
uint mapid = GetMapId();
|
||||
OutdoorPvP pvp = Global.OutdoorPvPMgr.GetOutdoorPvPToZoneId(zoneId);
|
||||
InstanceScript instance = GetInstanceScript();
|
||||
BattleField battlefield = Global.BattleFieldMgr.GetBattlefieldToZoneId(zoneId);
|
||||
|
||||
InitWorldStates packet = new();
|
||||
packet.MapID = mapid;
|
||||
@@ -3497,27 +3496,12 @@ namespace Game.Entities
|
||||
if (bg && bg.GetTypeID(true) == BattlegroundTypeId.BFG)
|
||||
bg.FillInitialWorldStates(packet);
|
||||
break;
|
||||
case 5389: // Tol Barad Peninsula
|
||||
if (WorldConfig.GetBoolValue(WorldCfg.TolbaradEnable))
|
||||
{
|
||||
packet.AddState(WorldStates.BattlefieldTbAllianceControlsShow, Global.WorldMgr.GetWorldState(WorldStates.BattlefieldTbAllianceControlsShow));
|
||||
packet.AddState(WorldStates.BattlefieldTbHordeControlsShow, Global.WorldMgr.GetWorldState(WorldStates.BattlefieldTbHordeControlsShow));
|
||||
packet.AddState(WorldStates.BattlefieldTbTimeNextBattleShow, Global.WorldMgr.GetWorldState(WorldStates.BattlefieldTbTimeNextBattleShow));
|
||||
packet.AddState(WorldStates.BattlefieldTbAllianceAttackingShow, Global.WorldMgr.GetWorldState(WorldStates.BattlefieldTbAllianceAttackingShow));
|
||||
packet.AddState(WorldStates.BattlefieldTbHordeAttackingShow, Global.WorldMgr.GetWorldState(WorldStates.BattlefieldTbHordeAttackingShow));
|
||||
}
|
||||
break;
|
||||
case 5095: // Tol Barad
|
||||
if (battlefield != null && battlefield.GetTypeId() == (uint)BattleFieldTypes.TolBarad)
|
||||
battlefield.FillInitialWorldStates(packet);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SendPacket(packet);
|
||||
SendBGWeekendWorldStates();
|
||||
SendBattlefieldWorldStates();
|
||||
}
|
||||
|
||||
public long GetBarberShopCost(List<ChrCustomizationChoice> newCustomizations)
|
||||
|
||||
Reference in New Issue
Block a user