mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-12 06:53:43 +00:00
Merge branch 'master' into Playerbot
This commit is contained in:
@@ -99,19 +99,41 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChatHandler::SendWorldText(std::string_view str)
|
||||
void ChatHandler::SendNotification(std::string_view str)
|
||||
{
|
||||
std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
|
||||
for (std::string_view line : lines)
|
||||
{
|
||||
WorldPacket data(SMSG_NOTIFICATION, line.size() + 1);
|
||||
data << line.data();
|
||||
m_session->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
||||
Player* player = m_session->GetPlayer();
|
||||
if (!player || !player->IsInWorld())
|
||||
void ChatHandler::SendGMText(std::string_view str)
|
||||
{
|
||||
std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
|
||||
// Session should have permissions to receive global gm messages
|
||||
if (AccountMgr::IsPlayerAccount(m_session->GetSecurity()))
|
||||
return;
|
||||
|
||||
for (std::string_view line : lines)
|
||||
{
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
|
||||
player->SendDirectMessage(&data);
|
||||
m_session->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
||||
void ChatHandler::SendWorldText(std::string_view str)
|
||||
{
|
||||
std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
|
||||
|
||||
for (std::string_view line : lines)
|
||||
{
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
|
||||
m_session->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,9 +142,6 @@ void ChatHandler::SendWorldTextOptional(std::string_view str, uint32 flag)
|
||||
std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
|
||||
|
||||
Player* player = m_session->GetPlayer();
|
||||
if (!player || !player->IsInWorld())
|
||||
return;
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_PLAYER_SETTINGS_ENABLED))
|
||||
if (player->GetPlayerSetting(AzerothcorePSSource, SETTING_ANNOUNCER_FLAGS).HasFlag(flag))
|
||||
return;
|
||||
@@ -483,6 +502,23 @@ Player* ChatHandler::getSelectedPlayerOrSelf() const
|
||||
return targetPlayer;
|
||||
}
|
||||
|
||||
bool ChatHandler::HasSession() const
|
||||
{
|
||||
if (!m_session)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChatHandler::DoForAllValidSessions(std::function<void(Player*)> exec)
|
||||
{
|
||||
SessionMap::const_iterator itr;
|
||||
for (itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
|
||||
if (Player* player = itr->second->GetPlayer())
|
||||
if (player->IsInWorld())
|
||||
exec(player);
|
||||
}
|
||||
|
||||
char* ChatHandler::extractKeyFromLink(char* text, char const* linkType, char** something1)
|
||||
{
|
||||
// skip empty
|
||||
@@ -1003,6 +1039,11 @@ int CliHandler::GetSessionDbLocaleIndex() const
|
||||
return sObjectMgr->GetDBCLocaleIndex();
|
||||
}
|
||||
|
||||
bool CliHandler::HasSession() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AddonChannelCommandHandler::ParseCommands(std::string_view str)
|
||||
{
|
||||
if (memcmp(str.data(), "AzerothCore\t", 12))
|
||||
|
||||
Reference in New Issue
Block a user