mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +00:00
fix(Core/BG): Fix fmt issue for bg sent notifications (#19718)
* closes https://github.com/azerothcore/azerothcore-wotlk/issues/19559
This commit is contained in:
@@ -438,13 +438,19 @@ inline void Battleground::_ProcessProgress(uint32 diff)
|
||||
if (newtime > (MINUTE * IN_MILLISECONDS))
|
||||
{
|
||||
if (newtime / (MINUTE * IN_MILLISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS))
|
||||
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, CHAT_MSG_SYSTEM, nullptr, (uint32)(m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS)));
|
||||
GetBgMap()->DoForAllPlayers([&](Player* player)
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, (uint32)(m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS)));
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
//announce every 15 seconds
|
||||
if (newtime / (15 * IN_MILLISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILLISECONDS))
|
||||
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, CHAT_MSG_SYSTEM, nullptr, (uint32)(m_PrematureCountDownTimer / IN_MILLISECONDS));
|
||||
GetBgMap()->DoForAllPlayers([&](Player* player)
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, (uint32)(m_PrematureCountDownTimer / IN_MILLISECONDS));
|
||||
});
|
||||
}
|
||||
m_PrematureCountDownTimer = newtime;
|
||||
}
|
||||
@@ -1642,63 +1648,6 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float
|
||||
return false;
|
||||
}
|
||||
|
||||
void Battleground::SendMessageToAll(uint32 entry, ChatMsg type, Player const* source)
|
||||
{
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
Acore::BattlegroundChatBuilder bg_builder(type, entry, source);
|
||||
Acore::LocalizedPacketDo<Acore::BattlegroundChatBuilder> bg_do(bg_builder);
|
||||
BroadcastWorker(bg_do);
|
||||
}
|
||||
|
||||
void Battleground::PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...)
|
||||
{
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, source);
|
||||
|
||||
Acore::BattlegroundChatBuilder bg_builder(type, entry, source, &ap);
|
||||
Acore::LocalizedPacketDo<Acore::BattlegroundChatBuilder> bg_do(bg_builder);
|
||||
BroadcastWorker(bg_do);
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void Battleground::SendWarningToAll(uint32 entry, ...)
|
||||
{
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
std::map<uint32, WorldPacket> localizedPackets;
|
||||
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (localizedPackets.find(itr->second->GetSession()->GetSessionDbLocaleIndex()) == localizedPackets.end())
|
||||
{
|
||||
char const* format = sObjectMgr->GetAcoreString(entry, itr->second->GetSession()->GetSessionDbLocaleIndex());
|
||||
|
||||
char str[1024];
|
||||
va_list ap;
|
||||
va_start(ap, entry);
|
||||
vsnprintf(str, 1024, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
ChatHandler::BuildChatPacket(localizedPackets[itr->second->GetSession()->GetSessionDbLocaleIndex()], CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, nullptr, nullptr, str);
|
||||
}
|
||||
|
||||
itr->second->SendDirectMessage(&localizedPackets[itr->second->GetSession()->GetSessionDbLocaleIndex()]);
|
||||
}
|
||||
}
|
||||
|
||||
void Battleground::SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 arg1, uint32 arg2)
|
||||
{
|
||||
Acore::Battleground2ChatBuilder bg_builder(type, entry, source, arg1, arg2);
|
||||
Acore::LocalizedPacketDo<Acore::Battleground2ChatBuilder> bg_do(bg_builder);
|
||||
BroadcastWorker(bg_do);
|
||||
}
|
||||
|
||||
void Battleground::EndNow()
|
||||
{
|
||||
RemoveFromBGFreeSlotQueue();
|
||||
|
||||
@@ -470,13 +470,6 @@ public:
|
||||
|
||||
void BlockMovement(Player* player);
|
||||
|
||||
void SendWarningToAll(uint32 entry, ...);
|
||||
void SendMessageToAll(uint32 entry, ChatMsg type, Player const* source = nullptr);
|
||||
void PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...);
|
||||
|
||||
// specialized version with 2 string id args
|
||||
void SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 strId1 = 0, uint32 strId2 = 0);
|
||||
|
||||
// Raid Group
|
||||
[[nodiscard]] Group* GetBgRaid(TeamId teamId) const { return m_BgRaids[teamId]; }
|
||||
void SetBgRaid(TeamId teamId, Group* bg_raid);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "BattlegroundSA.h"
|
||||
#include "Chat.h"
|
||||
#include "GameGraveyard.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameTime.h"
|
||||
@@ -357,7 +358,11 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
|
||||
|
||||
if (TotalTime >= 1min)
|
||||
{
|
||||
SendWarningToAll(LANG_BG_SA_HAS_BEGUN);
|
||||
GetBgMap()->DoForAllPlayers([&](Player* player)
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_HAS_BEGUN);
|
||||
});
|
||||
|
||||
TotalTime = 0s;
|
||||
ToggleTimer();
|
||||
DemolisherStartState(false);
|
||||
@@ -411,7 +416,12 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
|
||||
Status = BG_SA_SECOND_WARMUP;
|
||||
TotalTime = 0s;
|
||||
ToggleTimer();
|
||||
SendWarningToAll(LANG_BG_SA_ROUND_ONE_END);
|
||||
|
||||
GetBgMap()->DoForAllPlayers([&](Player* player)
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_ROUND_ONE_END);
|
||||
});
|
||||
|
||||
UpdateWaitTimer = 5000;
|
||||
SignaledRoundTwo = false;
|
||||
SignaledRoundTwoHalfMin = false;
|
||||
@@ -617,10 +627,13 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui
|
||||
|
||||
if (eventType == go->GetGOInfo()->building.destroyedEvent)
|
||||
{
|
||||
if (go->GetGOInfo()->building.destroyedEvent == 19837)
|
||||
SendWarningToAll(LANG_BG_SA_CHAMBER_BREACHED);
|
||||
else
|
||||
SendWarningToAll(LANG_BG_SA_WAS_DESTROYED, go->GetGOInfo()->name.c_str());
|
||||
GetBgMap()->DoForAllPlayers([&](Player* player)
|
||||
{
|
||||
if (go->GetGOInfo()->building.destroyedEvent == 19837)
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_CHAMBER_BREACHED);
|
||||
else
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_WAS_DESTROYED, go->GetGOInfo()->name);
|
||||
});
|
||||
|
||||
uint32 i = GetGateIDFromEntry(go->GetEntry());
|
||||
switch (i)
|
||||
@@ -655,7 +668,10 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui
|
||||
}
|
||||
|
||||
if (eventType == go->GetGOInfo()->building.damageEvent)
|
||||
SendWarningToAll(LANG_BG_SA_IS_UNDER_ATTACK, go->GetGOInfo()->name.c_str());
|
||||
GetBgMap()->DoForAllPlayers([&](Player* player)
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_IS_UNDER_ATTACK, go->GetGOInfo()->name);
|
||||
});
|
||||
}
|
||||
|
||||
void BattlegroundSA::HandleKillUnit(Creature* creature, Player* killer)
|
||||
@@ -957,10 +973,13 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
|
||||
|
||||
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));
|
||||
UpdateWorldState(BG_SA_LEFT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1));
|
||||
if (Source->GetTeamId() == TEAM_ALLIANCE)
|
||||
SendWarningToAll(LANG_BG_SA_A_GY_WEST);
|
||||
else
|
||||
SendWarningToAll(LANG_BG_SA_H_GY_WEST);
|
||||
GetBgMap()->DoForAllPlayers([&](Player* player)
|
||||
{
|
||||
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_A_GY_WEST);
|
||||
else
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_H_GY_WEST);
|
||||
});
|
||||
break;
|
||||
case BG_SA_RIGHT_CAPTURABLE_GY:
|
||||
flag = BG_SA_RIGHT_FLAG;
|
||||
@@ -985,10 +1004,13 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
|
||||
|
||||
UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));
|
||||
UpdateWorldState(BG_SA_RIGHT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1));
|
||||
if (Source->GetTeamId() == TEAM_ALLIANCE)
|
||||
SendWarningToAll(LANG_BG_SA_A_GY_EAST);
|
||||
else
|
||||
SendWarningToAll(LANG_BG_SA_H_GY_EAST);
|
||||
GetBgMap()->DoForAllPlayers([&](Player* player)
|
||||
{
|
||||
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_A_GY_EAST);
|
||||
else
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_H_GY_EAST);
|
||||
});
|
||||
break;
|
||||
case BG_SA_CENTRAL_CAPTURABLE_GY:
|
||||
flag = BG_SA_CENTRAL_FLAG;
|
||||
@@ -999,10 +1021,13 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
|
||||
|
||||
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));
|
||||
UpdateWorldState(BG_SA_CENTER_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1));
|
||||
if (Source->GetTeamId() == TEAM_ALLIANCE)
|
||||
SendWarningToAll(LANG_BG_SA_A_GY_SOUTH);
|
||||
else
|
||||
SendWarningToAll(LANG_BG_SA_H_GY_SOUTH);
|
||||
GetBgMap()->DoForAllPlayers([&](Player* player)
|
||||
{
|
||||
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_A_GY_SOUTH);
|
||||
else
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_A_GY_SOUTH);
|
||||
});
|
||||
break;
|
||||
default:
|
||||
ABORT();
|
||||
@@ -1016,9 +1041,16 @@ void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
|
||||
{
|
||||
if (Source->GetTeamId() == Attackers)
|
||||
{
|
||||
if (Source->GetTeamId() == TEAM_ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_SA_ALLIANCE_CAPTURED_RELIC, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
else SendMessageToAll(LANG_BG_SA_HORDE_CAPTURED_RELIC, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
GetBgMap()->DoForAllPlayers([&](Player* player)
|
||||
{
|
||||
if (player->GetTeamId() == Attackers)
|
||||
{
|
||||
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_ALLIANCE_CAPTURED_RELIC);
|
||||
else
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_BG_SA_HORDE_CAPTURED_RELIC);
|
||||
}
|
||||
});
|
||||
|
||||
if (Status == BG_SA_ROUND_ONE)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user