More work on new worldstate system
Port From (https://github.com/TrinityCore/TrinityCore/commit/a161b6cd328bbcf56950664f677fba716659f0d5)
This commit is contained in:
@@ -2983,10 +2983,6 @@ namespace Framework.Constants
|
|||||||
BattlefieldTbStatePreparations = 5684,
|
BattlefieldTbStatePreparations = 5684,
|
||||||
BattlefieldTbStateBattle = 5344,
|
BattlefieldTbStateBattle = 5344,
|
||||||
|
|
||||||
BattlefieldTbProgressShow = 5376,
|
|
||||||
BattlefieldTbProgress = 5377, // 0 Horde, 100 Alliance
|
|
||||||
BattlefieldTbProgressPercentGrey = 5378,
|
|
||||||
|
|
||||||
BattlefieldTbKeepHorde = 5469,
|
BattlefieldTbKeepHorde = 5469,
|
||||||
BattlefieldTbKeepAlliance = 5470,
|
BattlefieldTbKeepAlliance = 5470,
|
||||||
|
|
||||||
|
|||||||
@@ -468,31 +468,6 @@ namespace Game.BattleFields
|
|||||||
Global.CreatureTextMgr.SendChat(stalker, (byte)id, target);
|
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)
|
public void AddCapturePoint(BfCapturePoint cp)
|
||||||
{
|
{
|
||||||
if (m_capturePoints.ContainsKey(cp.GetCapturePointEntry()))
|
if (m_capturePoints.ContainsKey(cp.GetCapturePointEntry()))
|
||||||
@@ -803,11 +778,6 @@ namespace Game.BattleFields
|
|||||||
|
|
||||||
public virtual void DoCompleteOrIncrementAchievement(uint achievement, Player player, byte incrementNumber = 1) { }
|
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
|
// Return if we can use mount in battlefield
|
||||||
public bool CanFlyIn() { return !m_isActive; }
|
public bool CanFlyIn() { return !m_isActive; }
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ namespace Game.Chat
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
bf.SetTimer(time * Time.InMilliseconds);
|
bf.SetTimer(time * Time.InMilliseconds);
|
||||||
bf.SendInitWorldStatesToAll();
|
|
||||||
if (battleId == 1)
|
if (battleId == 1)
|
||||||
handler.SendGlobalGMSysMessage("Wintergrasp (Command timer used)");
|
handler.SendGlobalGMSysMessage("Wintergrasp (Command timer used)");
|
||||||
|
|
||||||
|
|||||||
@@ -737,23 +737,6 @@ namespace Game.Entities
|
|||||||
//SendPacket(packet);
|
//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
|
//Arenas
|
||||||
public void SetArenaTeamInfoField(byte slot, ArenaTeamInfoType type, uint value)
|
public void SetArenaTeamInfoField(byte slot, ArenaTeamInfoType type, uint value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2906,7 +2906,6 @@ namespace Game.Entities
|
|||||||
uint mapid = GetMapId();
|
uint mapid = GetMapId();
|
||||||
OutdoorPvP pvp = Global.OutdoorPvPMgr.GetOutdoorPvPToZoneId(zoneId);
|
OutdoorPvP pvp = Global.OutdoorPvPMgr.GetOutdoorPvPToZoneId(zoneId);
|
||||||
InstanceScript instance = GetInstanceScript();
|
InstanceScript instance = GetInstanceScript();
|
||||||
BattleField battlefield = Global.BattleFieldMgr.GetBattlefieldToZoneId(zoneId);
|
|
||||||
|
|
||||||
InitWorldStates packet = new();
|
InitWorldStates packet = new();
|
||||||
packet.MapID = mapid;
|
packet.MapID = mapid;
|
||||||
@@ -3497,27 +3496,12 @@ namespace Game.Entities
|
|||||||
if (bg && bg.GetTypeID(true) == BattlegroundTypeId.BFG)
|
if (bg && bg.GetTypeID(true) == BattlegroundTypeId.BFG)
|
||||||
bg.FillInitialWorldStates(packet);
|
bg.FillInitialWorldStates(packet);
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendPacket(packet);
|
SendPacket(packet);
|
||||||
SendBGWeekendWorldStates();
|
SendBGWeekendWorldStates();
|
||||||
SendBattlefieldWorldStates();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public long GetBarberShopCost(List<ChrCustomizationChoice> newCustomizations)
|
public long GetBarberShopCost(List<ChrCustomizationChoice> newCustomizations)
|
||||||
|
|||||||
@@ -261,7 +261,6 @@ namespace Game.BattleFields
|
|||||||
player.GetPosition(out x, out y, out z);
|
player.GetPosition(out x, out y, out z);
|
||||||
if (5500 > x && x > 5392 && y < 2880 && y > 2800 && z < 480)
|
if (5500 > x && x > 5392 && y < 2880 && y > 2800 && z < 480)
|
||||||
player.TeleportTo(571, 5349.8686f, 2838.481f, 409.240f, 0.046328f);
|
player.TeleportTo(571, 5349.8686f, 2838.481f, 409.240f, 0.046328f);
|
||||||
SendInitWorldStatesTo(player);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -728,7 +727,6 @@ namespace Game.BattleFields
|
|||||||
if (GetData(WGData.BrokenTowerAtt) > 0)
|
if (GetData(WGData.BrokenTowerAtt) > 0)
|
||||||
player.SetAuraStack(WGSpells.TowerControl, player, GetData(WGData.BrokenTowerAtt));
|
player.SetAuraStack(WGSpells.TowerControl, player, GetData(WGData.BrokenTowerAtt));
|
||||||
}
|
}
|
||||||
SendInitWorldStatesTo(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnPlayerLeaveWar(Player player)
|
public override void OnPlayerLeaveWar(Player player)
|
||||||
@@ -767,8 +765,6 @@ namespace Game.BattleFields
|
|||||||
RemoveAurasFromPlayer(player);
|
RemoveAurasFromPlayer(player);
|
||||||
|
|
||||||
player.AddAura(m_DefenderTeam == TeamId.Horde ? WGSpells.HordeControlPhaseShift : WGSpells.AllianceControlPhaseShift, player);
|
player.AddAura(m_DefenderTeam == TeamId.Horde ? WGSpells.HordeControlPhaseShift : WGSpells.AllianceControlPhaseShift, player);
|
||||||
// Send worldstate to player
|
|
||||||
SendInitWorldStatesTo(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override uint GetData(uint data)
|
public override uint GetData(uint data)
|
||||||
@@ -793,9 +789,6 @@ namespace Game.BattleFields
|
|||||||
return base.GetData(data);
|
return base.GetData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo remove
|
|
||||||
public override void SendInitWorldStatesToAll() { }
|
|
||||||
|
|
||||||
public void BrokenWallOrTower(uint team, BfWGGameObjectBuilding building)
|
public void BrokenWallOrTower(uint team, BfWGGameObjectBuilding building)
|
||||||
{
|
{
|
||||||
if (team == GetDefenderTeam())
|
if (team == GetDefenderTeam())
|
||||||
@@ -1449,9 +1442,6 @@ namespace Game.BattleFields
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo remove
|
|
||||||
public void FillInitialWorldStates(InitWorldStates packet) { }
|
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
Global.WorldMgr.SetWorldState(_worldState, (ulong)_state);
|
Global.WorldMgr.SetWorldState(_worldState, (ulong)_state);
|
||||||
|
|||||||
Reference in New Issue
Block a user