refactor(Core/Chat): Move SendWorldText(optional) to ChatHandler and … (#19501)

* refactor(Core/Chat): Move SendWorldText(optional) to ChatHandler and allow `fmt`

* Update src/server/game/Battlegrounds/BattlegroundQueue.cpp

* Update src/server/game/Battlegrounds/BattlegroundQueue.cpp

* Update src/server/game/Misc/BanMgr.cpp

* Update src/server/game/Misc/BanMgr.cpp

* Update src/server/game/Misc/BanMgr.cpp

* Update src/server/game/Misc/BanMgr.cpp

* Update src/server/game/Misc/BanMgr.cpp

* Update src/server/game/Misc/BanMgr.cpp

* Update src/server/game/Misc/BanMgr.cpp

* Update src/server/game/Misc/BanMgr.cpp
This commit is contained in:
Kitzunu
2024-07-29 19:44:13 +02:00
committed by GitHub
parent d5c472b25d
commit 87f4adf634
18 changed files with 119 additions and 94 deletions

View File

@@ -16,6 +16,7 @@
*/
#include "ArenaTeamMgr.h"
#include "Chat.h"
#include "DatabaseEnv.h"
#include "Define.h"
#include "Language.h"
@@ -194,9 +195,9 @@ void ArenaTeamMgr::LoadArenaTeams()
void ArenaTeamMgr::DistributeArenaPoints()
{
// Used to distribute arena points based on last week's stats
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_START);
ChatHandler(nullptr).SendWorldText(LANG_DIST_ARENA_POINTS_START);
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_START);
ChatHandler(nullptr).SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_START);
// Temporary structure for storing maximum points to add values for all players
std::map<ObjectGuid, uint32> PlayerPoints;
@@ -232,9 +233,9 @@ void ArenaTeamMgr::DistributeArenaPoints()
PlayerPoints.clear();
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_END);
ChatHandler(nullptr).SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_END);
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_START);
ChatHandler(nullptr).SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_START);
for (ArenaTeamContainer::iterator titr = GetArenaTeamMapBegin(); titr != GetArenaTeamMapEnd(); ++titr)
{
if (ArenaTeam* at = titr->second)
@@ -246,7 +247,7 @@ void ArenaTeamMgr::DistributeArenaPoints()
}
}
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_END);
ChatHandler(nullptr).SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_END);
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_END);
ChatHandler(nullptr).SendWorldText(LANG_DIST_ARENA_POINTS_END);
}

View File

@@ -618,7 +618,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
// Announce BG starting
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
sWorld->SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName().c_str(), std::min(GetMinLevel(), (uint32)80), std::min(GetMaxLevel(), (uint32)80));
ChatHandler(nullptr).SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), std::min(GetMinLevel(), (uint32)80), std::min(GetMaxLevel(), (uint32)80));
sScriptMgr->OnBattlegroundStart(this);
}

View File

@@ -722,12 +722,12 @@ void BattlegroundMgr::ToggleTesting()
if (sWorld->getBoolConfig(CONFIG_DEBUG_BATTLEGROUND))
{
m_Testing = true;
sWorld->SendWorldText(LANG_DEBUG_BG_CONF);
ChatHandler(nullptr).SendWorldText(LANG_DEBUG_BG_CONF);
}
else
{
m_Testing = !m_Testing;
sWorld->SendWorldText(m_Testing ? LANG_DEBUG_BG_ON : LANG_DEBUG_BG_OFF);
ChatHandler(nullptr).SendWorldText(m_Testing ? LANG_DEBUG_BG_ON : LANG_DEBUG_BG_OFF);
}
}
@@ -736,12 +736,12 @@ void BattlegroundMgr::ToggleArenaTesting()
if (sWorld->getBoolConfig(CONFIG_DEBUG_ARENA))
{
m_ArenaTesting = true;
sWorld->SendWorldText(LANG_DEBUG_ARENA_CONF);
ChatHandler(nullptr).SendWorldText(LANG_DEBUG_ARENA_CONF);
}
else
{
m_ArenaTesting = !m_ArenaTesting;
sWorld->SendWorldText(m_ArenaTesting ? LANG_DEBUG_ARENA_ON : LANG_DEBUG_ARENA_OFF);
ChatHandler(nullptr).SendWorldText(m_ArenaTesting ? LANG_DEBUG_ARENA_ON : LANG_DEBUG_ARENA_OFF);
}
}

View File

@@ -996,7 +996,7 @@ void BattlegroundQueue::BattlegroundQueueAnnouncerUpdate(uint32 diff, Battlegrou
uint32 q_min_level = std::min(bracketEntry->minLevel, (uint32) 80);
uint32 q_max_level = std::min(bracketEntry->maxLevel, (uint32) 80);
sWorld->SendWorldTextOptional(LANG_BG_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_BG_QUEUE, bgName.c_str(), q_min_level, q_max_level, qPlayers, MaxPlayers);
ChatHandler(nullptr).SendWorldTextOptional(LANG_BG_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_BG_QUEUE, bgName.c_str(), q_min_level, q_max_level, qPlayers, MaxPlayers);
}
else
{
@@ -1077,7 +1077,7 @@ void BattlegroundQueue::SendMessageBGQueue(Player* leader, Battleground* bg, PvP
return;
}
sWorld->SendWorldTextOptional(LANG_BG_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_BG_QUEUE, bgName.c_str(), q_min_level, q_max_level, qAlliance + qHorde, MaxPlayers);
ChatHandler(nullptr).SendWorldTextOptional(LANG_BG_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_BG_QUEUE, bgName.c_str(), q_min_level, q_max_level, qAlliance + qHorde, MaxPlayers);
}
}
}
@@ -1128,7 +1128,7 @@ void BattlegroundQueue::SendJoinMessageArenaQueue(Player* leader, GroupQueueInfo
return;
}
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, bgName.c_str(), arenatype.c_str(), q_min_level, q_max_level, qPlayers, playersNeed);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, bgName.c_str(), arenatype.c_str(), q_min_level, q_max_level, qPlayers, playersNeed);
}
}
else
@@ -1147,16 +1147,16 @@ void BattlegroundQueue::SendJoinMessageArenaQueue(Player* leader, GroupQueueInfo
switch (announcementDetail)
{
case 3:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN_NAME_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName.c_str(), ArenaType, ArenaType, ArenaTeamRating);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN_NAME_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName.c_str(), ArenaType, ArenaType, ArenaTeamRating);
break;
case 2:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN_NAME, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName.c_str(), ArenaType, ArenaType);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN_NAME, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName, ArenaType, ArenaType);
break;
case 1:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType, ArenaTeamRating);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType, ArenaTeamRating);
break;
default:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType);
break;
}
}
@@ -1187,16 +1187,16 @@ void BattlegroundQueue::SendExitMessageArenaQueue(GroupQueueInfo* ginfo)
switch (announcementDetail)
{
case 3:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT_NAME_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName.c_str(), ArenaType, ArenaType, ArenaTeamRating);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT_NAME_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName.c_str(), ArenaType, ArenaType, ArenaTeamRating);
break;
case 2:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT_NAME, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName.c_str(), ArenaType, ArenaType);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT_NAME, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, TeamName, ArenaType, ArenaType);
break;
case 1:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType, ArenaTeamRating);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT_RATING, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType, ArenaTeamRating);
break;
default:
sWorld->SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType);
ChatHandler(nullptr).SendWorldTextOptional(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ArenaType, ArenaType);
break;
}
}