mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 21:26:23 +00:00
refactor(Core/World): Move SendGMText to ChatHandler and allow fmt (#19490)
* refactor(Core/World): Move SendGMText to WorldSession and allow `fmt` - Move SendGMText from World to WorldSession - Make SendGMText use fmt - Make SendGMText parse acore_string entries * Update cs_message.cpp * tokenize the string only once * Move to chathandler * Update WorldSession.cpp * make sure we have a session
This commit is contained in:
@@ -566,7 +566,6 @@ public:
|
||||
[[nodiscard]] virtual uint16 GetConfigMaxSkillValue() const = 0;
|
||||
virtual void SetInitialWorldSettings() = 0;
|
||||
virtual void LoadConfigSettings(bool reload = false) = 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;
|
||||
virtual bool SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) = 0;
|
||||
|
||||
@@ -2578,32 +2578,6 @@ namespace Acore
|
||||
};
|
||||
} // namespace Acore
|
||||
|
||||
/// Send a System Message to all GMs (except self if mentioned)
|
||||
void World::SendGMText(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::iterator itr = _sessions.begin(); itr != _sessions.end(); ++itr)
|
||||
{
|
||||
// Session should have permissions to receive global gm messages
|
||||
WorldSession* session = itr->second;
|
||||
if (!session || AccountMgr::IsPlayerAccount(session->GetSecurity()))
|
||||
continue;
|
||||
|
||||
// Player should be in world
|
||||
Player* player = session->GetPlayer();
|
||||
if (!player || !player->IsInWorld())
|
||||
continue;
|
||||
|
||||
wt_do(session->GetPlayer());
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/// Send a packet to all players (or players selected team) in the zone (except self if mentioned)
|
||||
bool World::SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession* self, TeamId teamId)
|
||||
{
|
||||
|
||||
@@ -238,7 +238,6 @@ public:
|
||||
void SetInitialWorldSettings() override;
|
||||
void LoadConfigSettings(bool reload = false) 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;
|
||||
bool SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) override;
|
||||
|
||||
Reference in New Issue
Block a user