mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 18:15:31 +01:00
Core/Player: add helper methods for PLAYER_FLAGS_DEVELOPER (#24511)
* Core/Player: add helper methods for PLAYER_FLAGS_DEVELOPER. Update .dev command to new command model
* Rename _player -> player
(cherry picked from commit 8128bb97db)
This commit is contained in:
@@ -1309,7 +1309,7 @@ uint8 Player::GetChatFlags() const
|
||||
tag |= CHAT_FLAG_DND;
|
||||
if (isAFK())
|
||||
tag |= CHAT_FLAG_AFK;
|
||||
if (HasPlayerFlag(PLAYER_FLAGS_DEVELOPER))
|
||||
if (IsDeveloper())
|
||||
tag |= CHAT_FLAG_DEV;
|
||||
|
||||
return tag;
|
||||
|
||||
@@ -1157,6 +1157,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
void CleanupAfterTaxiFlight();
|
||||
void ContinueTaxiFlight() const;
|
||||
|
||||
bool IsDeveloper() const { return HasPlayerFlag(PLAYER_FLAGS_DEVELOPER); }
|
||||
void SetDeveloper(bool on) { if (on) AddPlayerFlag(PLAYER_FLAGS_DEVELOPER); else RemovePlayerFlag(PLAYER_FLAGS_DEVELOPER); }
|
||||
bool isAcceptWhispers() const { return (m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS) != 0; }
|
||||
void SetAcceptWhispers(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; }
|
||||
bool IsGameMaster() const { return (m_ExtraFlags & PLAYER_EXTRA_GM_ON) != 0; }
|
||||
|
||||
@@ -152,29 +152,25 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDevCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleDevCommand(ChatHandler* handler, Optional<std::string> enable)
|
||||
{
|
||||
if (!*args)
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
if (!enable)
|
||||
{
|
||||
if (handler->GetSession()->GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_DEVELOPER))
|
||||
handler->GetSession()->SendNotification(LANG_DEV_ON);
|
||||
else
|
||||
handler->GetSession()->SendNotification(LANG_DEV_OFF);
|
||||
handler->GetSession()->SendNotification(player->IsDeveloper() ? LANG_DEV_ON : LANG_DEV_OFF);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string argstr = (char*)args;
|
||||
|
||||
if (argstr == "on")
|
||||
if (*enable == "on")
|
||||
{
|
||||
handler->GetSession()->GetPlayer()->AddPlayerFlag(PLAYER_FLAGS_DEVELOPER);
|
||||
player->SetDeveloper(true);
|
||||
handler->GetSession()->SendNotification(LANG_DEV_ON);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (argstr == "off")
|
||||
else if (*enable == "off")
|
||||
{
|
||||
handler->GetSession()->GetPlayer()->RemovePlayerFlag(PLAYER_FLAGS_DEVELOPER);
|
||||
player->SetDeveloper(false);
|
||||
handler->GetSession()->SendNotification(LANG_DEV_OFF);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user