Core/Player: add helper methods for PLAYER_FLAGS_DEVELOPER
Port From (https://github.com/TrinityCore/TrinityCore/commit/9d38eeec7e222edfe74740efd8e7af16103b0221)
This commit is contained in:
@@ -632,29 +632,25 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[CommandNonGroup("dev", RBACPermissions.CommandDev)]
|
||||
static bool HandleDevCommand(CommandHandler handler, StringArguments args)
|
||||
static bool HandleDevCommand(CommandHandler handler, string enable)
|
||||
{
|
||||
if (args.Empty())
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
|
||||
if (enable.IsEmpty())
|
||||
{
|
||||
if (handler.GetSession().GetPlayer().HasPlayerFlag(PlayerFlags.Developer))
|
||||
handler.GetSession().SendNotification(CypherStrings.DevOn);
|
||||
else
|
||||
handler.GetSession().SendNotification(CypherStrings.DevOff);
|
||||
handler.GetSession().SendNotification(player.IsDeveloper() ? CypherStrings.DevOn : CypherStrings.DevOff);
|
||||
return true;
|
||||
}
|
||||
|
||||
string argstr = args.NextString();
|
||||
|
||||
if (argstr == "on")
|
||||
if (enable == "on")
|
||||
{
|
||||
handler.GetSession().GetPlayer().HasPlayerFlag(PlayerFlags.Developer);
|
||||
player.SetDeveloper(true);
|
||||
handler.GetSession().SendNotification(CypherStrings.DevOn);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (argstr == "off")
|
||||
else if (enable == "off")
|
||||
{
|
||||
handler.GetSession().GetPlayer().RemovePlayerFlag(PlayerFlags.Developer);
|
||||
player.SetDeveloper(false);
|
||||
handler.GetSession().SendNotification(CypherStrings.DevOff);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2137,6 +2137,14 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
//GM
|
||||
public bool IsDeveloper() { return HasPlayerFlag(PlayerFlags.Developer); }
|
||||
public void SetDeveloper(bool on)
|
||||
{
|
||||
if (on)
|
||||
AddPlayerFlag(PlayerFlags.Developer);
|
||||
else
|
||||
RemovePlayerFlag(PlayerFlags.Developer);
|
||||
}
|
||||
public bool IsAcceptWhispers() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.AcceptWhispers); }
|
||||
public void SetAcceptWhispers(bool on)
|
||||
{
|
||||
@@ -5440,7 +5448,7 @@ namespace Game.Entities
|
||||
tag |= ChatFlags.DND;
|
||||
if (IsAFK())
|
||||
tag |= ChatFlags.AFK;
|
||||
if (HasPlayerFlag(PlayerFlags.Developer))
|
||||
if (IsDeveloper())
|
||||
tag |= ChatFlags.Dev;
|
||||
|
||||
return tag;
|
||||
|
||||
Reference in New Issue
Block a user