mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 23:56:25 +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:
@@ -51,6 +51,28 @@ public:
|
||||
|
||||
static char* LineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = nullptr; return start; }
|
||||
|
||||
void SendGMText(std::string_view str);
|
||||
template<typename... Args>
|
||||
void SendGMText(uint32 strId, Args&&... args)
|
||||
{
|
||||
// WorldText should be sent to all sessions
|
||||
SessionMap::const_iterator itr;
|
||||
for (itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
|
||||
{
|
||||
Player* player = itr->second->GetPlayer();
|
||||
if (player && player->IsInWorld())
|
||||
{
|
||||
m_session = player->GetSession();
|
||||
SendGMText(Acore::StringFormatFmt(GetAcoreString(strId), std::forward<Args>(args)...));
|
||||
}
|
||||
}
|
||||
}
|
||||
template<typename... Args>
|
||||
void SendGMText(char const* fmt, Args&&... args)
|
||||
{
|
||||
SendGMText(Acore::StringFormatFmt(fmt, std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
void SendWorldText(std::string_view str);
|
||||
template<typename... Args>
|
||||
void SendWorldText(uint32 strId, Args&&... args)
|
||||
|
||||
Reference in New Issue
Block a user