mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
fix (Core/Wintergrasp) Fix map and battle icon (#21622)
This commit is contained in:
@@ -168,6 +168,7 @@ bool Battlefield::Update(uint32 diff)
|
||||
m_StartGrouping = true;
|
||||
InvitePlayersInZoneToQueue();
|
||||
OnStartGrouping();
|
||||
SendUpdateWorldStates();
|
||||
}
|
||||
|
||||
bool objective_changed = false;
|
||||
@@ -353,6 +354,8 @@ void Battlefield::StartBattle()
|
||||
DoPlaySoundToAll(BF_START);
|
||||
|
||||
OnBattleStart();
|
||||
|
||||
SendUpdateWorldStates();
|
||||
}
|
||||
|
||||
void Battlefield::EndBattle(bool endByTimer)
|
||||
@@ -377,6 +380,7 @@ void Battlefield::EndBattle(bool endByTimer)
|
||||
// Reset battlefield timer
|
||||
m_Timer = m_NoWarBattleTime;
|
||||
SendInitWorldStatesToAll();
|
||||
SendUpdateWorldStates();
|
||||
}
|
||||
|
||||
void Battlefield::DoPlaySoundToAll(uint32 SoundID)
|
||||
|
||||
@@ -335,6 +335,7 @@ public:
|
||||
/// Send all worldstate data to all player in zone.
|
||||
virtual void SendInitWorldStatesToAll() = 0;
|
||||
virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& /*packet*/) = 0;
|
||||
virtual void SendUpdateWorldStates(Player* player = nullptr) = 0;
|
||||
|
||||
/// Return if we can use mount in battlefield
|
||||
bool CanFlyIn() { return !m_isActive; }
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "TemporarySummon.h"
|
||||
#include "Vehicle.h"
|
||||
#include "WorldSession.h"
|
||||
#include "WorldSessionMgr.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
BattlefieldWG::~BattlefieldWG()
|
||||
@@ -936,16 +937,21 @@ uint32 BattlefieldWG::GetData(uint32 data) const
|
||||
|
||||
void BattlefieldWG::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet)
|
||||
{
|
||||
packet.Worldstates.reserve(4+2+WG_MAX_OBJ+WG_MAX_WORKSHOP);
|
||||
uint32 timer = GetTimer() / 1000;
|
||||
bool iconActive = timer < 15 * MINUTE || IsWarTime();
|
||||
|
||||
packet.Worldstates.reserve(4+4+WG_MAX_OBJ+WG_MAX_WORKSHOP);
|
||||
packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_ATTACKER, GetAttackerTeam());
|
||||
packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, GetDefenderTeam());
|
||||
|
||||
// Note: cleanup these two, their names look awkward
|
||||
packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, IsWarTime() ? 0 : 1);
|
||||
packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE, IsWarTime() ? 1 : 0);
|
||||
packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_CONTROL, m_DefenderTeam == TEAM_ALLIANCE ? 2 : 1); // Alliance 2, Hord 1
|
||||
packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_ICON_ACTIVE, iconActive ? 1 : 0);
|
||||
|
||||
for (uint32 i = 0; i < 2; ++i)
|
||||
packet.Worldstates.emplace_back(ClockWorldState[i], GameTime::GetGameTime().count() + (m_Timer / 1000));
|
||||
packet.Worldstates.emplace_back(ClockWorldState[i], GameTime::GetGameTime().count() + timer);
|
||||
|
||||
packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
|
||||
packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H));
|
||||
@@ -984,6 +990,34 @@ void BattlefieldWG::SendInitWorldStatesToAll()
|
||||
SendInitWorldStatesTo(player);
|
||||
}
|
||||
|
||||
void BattlefieldWG::SendUpdateWorldStates(Player* player)
|
||||
{
|
||||
uint32 timer = GetTimer() / 1000;
|
||||
bool iconActive = timer < 15 * MINUTE || IsWarTime();
|
||||
|
||||
SendUpdateWorldStateMessage(BATTLEFIELD_WG_WORLD_STATE_ATTACKER, GetAttackerTeam(), player);
|
||||
SendUpdateWorldStateMessage(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, GetDefenderTeam(), player);
|
||||
SendUpdateWorldStateMessage(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, IsWarTime() ? 0 : 1, player);
|
||||
SendUpdateWorldStateMessage(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE, IsWarTime() ? 1 : 0, player);
|
||||
SendUpdateWorldStateMessage(BATTLEFIELD_WG_WORLD_STATE_CONTROL, GetDefenderTeam() == TEAM_ALLIANCE ? 2 : 1, player);
|
||||
SendUpdateWorldStateMessage(BATTLEFIELD_WG_WORLD_STATE_ICON_ACTIVE, iconActive ? 1 : 0, player);
|
||||
|
||||
for (uint32 i = 0; i < 2; ++i)
|
||||
SendUpdateWorldStateMessage(ClockWorldState[i], uint32(GameTime::GetGameTime().count() + timer), player);
|
||||
}
|
||||
|
||||
void BattlefieldWG::SendUpdateWorldStateMessage(uint32 variable, uint32 value, Player* player)
|
||||
{
|
||||
WorldPackets::WorldState::UpdateWorldState worldState;
|
||||
worldState.VariableID = variable;
|
||||
worldState.Value = value;
|
||||
|
||||
if (player)
|
||||
player->SendDirectMessage(worldState.Write());
|
||||
else
|
||||
sWorldSessionMgr->SendGlobalMessage(worldState.Write());
|
||||
}
|
||||
|
||||
void BattlefieldWG::BrokenWallOrTower(TeamId /*team*/)
|
||||
{
|
||||
// might be some use for this in the future. old code commented out below. KL
|
||||
|
||||
@@ -109,6 +109,8 @@ enum WintergraspWorldStates
|
||||
BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802,
|
||||
BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803,
|
||||
BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE = 3710,
|
||||
BATTLEFIELD_WG_WORLD_STATE_CONTROL = 3804, // Shows on the map who controls WG
|
||||
BATTLEFIELD_WG_WORLD_STATE_ICON_ACTIVE = 4375, // Activates "ice" icon
|
||||
};
|
||||
|
||||
enum WintergraspAreaIds
|
||||
@@ -405,6 +407,8 @@ public:
|
||||
void SendInitWorldStatesTo(Player* player);
|
||||
void SendInitWorldStatesToAll() override;
|
||||
void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
|
||||
void SendUpdateWorldStates(Player* player = nullptr) override;
|
||||
void SendUpdateWorldStateMessage(uint32 variable, uint32 value, Player* player = nullptr);
|
||||
|
||||
void HandleKill(Player* killer, Unit* victim) override;
|
||||
void OnUnitDeath(Unit* unit) override;
|
||||
|
||||
@@ -8909,13 +8909,7 @@ void Player::SendBattlefieldWorldStates()
|
||||
{
|
||||
if (BattlefieldWG* wg = (BattlefieldWG*)sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
|
||||
{
|
||||
SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_ATTACKER, wg->GetAttackerTeam());
|
||||
SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, wg->GetDefenderTeam());
|
||||
SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, wg->IsWarTime() ? 0 : 1); // Note: cleanup these two, their names look awkward
|
||||
SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE, wg->IsWarTime() ? 1 : 0);
|
||||
|
||||
for (uint32 i = 0; i < 2; ++i)
|
||||
SendUpdateWorldState(ClockWorldState[i], uint32(GameTime::GetGameTime().count() + (wg->GetTimer() / 1000)));
|
||||
wg->SendUpdateWorldStates(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user