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

@@ -566,8 +566,6 @@ public:
[[nodiscard]] virtual uint16 GetConfigMaxSkillValue() const = 0;
virtual void SetInitialWorldSettings() = 0;
virtual void LoadConfigSettings(bool reload = false) = 0;
virtual void SendWorldText(uint32 string_id, ...) = 0;
virtual void SendWorldTextOptional(uint32 string_id, uint32 flag, ...) = 0;
virtual void SendGMText(uint32 string_id, ...) = 0;
virtual void SendGlobalMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) = 0;
virtual void SendGlobalGMMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) = 0;

View File

@@ -2578,53 +2578,6 @@ namespace Acore
};
} // namespace Acore
/// Send a System Message to all players (except self if mentioned)
void World::SendWorldText(uint32 string_id, ...)
{
va_list ap;
va_start(ap, string_id);
Acore::WorldWorldTextBuilder wt_builder(string_id, &ap);
Acore::LocalizedPacketListDo<Acore::WorldWorldTextBuilder> wt_do(wt_builder);
for (SessionMap::const_iterator itr = _sessions.begin(); itr != _sessions.end(); ++itr)
{
if (!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld())
continue;
wt_do(itr->second->GetPlayer());
}
va_end(ap);
}
void World::SendWorldTextOptional(uint32 string_id, uint32 flag, ...)
{
va_list ap;
va_start(ap, flag);
Acore::WorldWorldTextBuilder wt_builder(string_id, &ap);
Acore::LocalizedPacketListDo<Acore::WorldWorldTextBuilder> wt_do(wt_builder);
for (auto const& itr : _sessions)
{
if (!itr.second || !itr.second->GetPlayer() || !itr.second->GetPlayer()->IsInWorld())
{
continue;
}
if (sWorld->getBoolConfig(CONFIG_PLAYER_SETTINGS_ENABLED))
{
if (itr.second->GetPlayer()->GetPlayerSetting(AzerothcorePSSource, SETTING_ANNOUNCER_FLAGS).HasFlag(flag))
{
continue;
}
}
wt_do(itr.second->GetPlayer());
}
va_end(ap);
}
/// Send a System Message to all GMs (except self if mentioned)
void World::SendGMText(uint32 string_id, ...)
{

View File

@@ -238,7 +238,6 @@ public:
void SetInitialWorldSettings() override;
void LoadConfigSettings(bool reload = false) override;
void SendWorldText(uint32 string_id, ...) override;
void SendGMText(uint32 string_id, ...) override;
void SendGlobalMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) override;
void SendGlobalGMMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) override;
@@ -246,8 +245,6 @@ public:
void SendZoneText(uint32 zone, const char* text, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) override;
void SendServerMessage(ServerMessageType messageID, std::string stringParam = "", Player* player = nullptr) override;
void SendWorldTextOptional(uint32 string_id, uint32 flag, ...) override;
/// Are we in the middle of a shutdown?
[[nodiscard]] bool IsShuttingDown() const override { return _shutdownTimer > 0; }
[[nodiscard]] uint32 GetShutDownTimeLeft() const override { return _shutdownTimer; }