AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
player_settings_commandscript Class Reference
Inheritance diagram for player_settings_commandscript:
CommandScript ScriptObject

Public Member Functions

 player_settings_commandscript ()
 
ChatCommandTable GetCommands () const override
 
virtual std::vector< Acore::ChatCommands::ChatCommandBuilderGetCommands () const =0
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Static Public Member Functions

static bool HandleSettingsAnnouncerFlags (ChatHandler *handler, std::string type, bool on)
 

Additional Inherited Members

- Protected Member Functions inherited from CommandScript
 CommandScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ player_settings_commandscript()

player_settings_commandscript::player_settings_commandscript ( )
inline
28: CommandScript("player_settings_commandscript") {}
Definition: CommandScript.h:25

Member Function Documentation

◆ GetCommands()

ChatCommandTable player_settings_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

31 {
32 static ChatCommandTable playerSettingsCommandTable =
33 {
34 { "announcer", HandleSettingsAnnouncerFlags, SEC_MODERATOR, Console::No },
35 };
36 static ChatCommandTable commandTable =
37 {
38 { "settings", playerSettingsCommandTable },
39 };
40 return commandTable;
41 }
@ SEC_MODERATOR
Definition: Common.h:58
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:46
static bool HandleSettingsAnnouncerFlags(ChatHandler *handler, std::string type, bool on)
Definition: cs_player_settings.cpp:43

References HandleSettingsAnnouncerFlags(), and SEC_MODERATOR.

◆ HandleSettingsAnnouncerFlags()

static bool player_settings_commandscript::HandleSettingsAnnouncerFlags ( ChatHandler handler,
std::string  type,
bool  on 
)
inlinestatic
44 {
45 Player* player = handler->GetPlayer();
46
47 PlayerSetting setting;
49
50 if (type == "bg")
51 {
54 }
55 else if (type == "arena")
56 {
59 }
60 else if (type == "autobroadcast")
61 {
62 if (player->GetLevel() < sWorld->getIntConfig(CONFIG_AUTOBROADCAST_MIN_LEVEL_DISABLE))
63 {
64 handler->SetSentErrorMessage(true);
66 }
67
70 }
71
72 handler->SetSentErrorMessage(false);
74 return true;
75 }
@ LANG_CMD_SETTINGS_ANNOUNCER_OFF
Definition: Language.h:1138
@ LANG_CMD_AUTOBROADCAST_LVL_ERROR
Definition: Language.h:1136
@ LANG_CMD_SETTINGS_ANNOUNCER_ON
Definition: Language.h:1137
@ CONFIG_AUTOBROADCAST_MIN_LEVEL_DISABLE
Definition: IWorld.h:358
@ ANNOUNCER_FLAG_DISABLE_AUTOBROADCAST
Definition: PlayerSettings.h:35
@ ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE
Definition: PlayerSettings.h:34
@ ANNOUNCER_FLAG_DISABLE_BG_QUEUE
Definition: PlayerSettings.h:33
const std::string AzerothcorePSSource
Definition: PlayerSettings.h:23
@ SETTING_ANNOUNCER_FLAGS
Definition: PlayerSettings.h:27
#define sWorld
Definition: World.h:443
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:210
void SetSentErrorMessage(bool val)
Definition: Chat.h:238
Player * GetPlayer() const
Definition: Chat.cpp:35
Definition: Player.h:1081
void UpdatePlayerSetting(std::string source, uint8 index, uint32 value)
Definition: PlayerSettings.cpp:115
PlayerSetting GetPlayerSetting(std::string source, uint8 index)
Definition: PlayerSettings.cpp:70
Definition: PlayerSettings.h:39
void AddFlag(uint32 flag)
Definition: PlayerSettings.h:44
void RemoveFlag(uint32 flag)
Definition: PlayerSettings.h:45
uint32 value
Definition: PlayerSettings.h:40
uint8 GetLevel() const
Definition: Unit.h:1024

References PlayerSetting::AddFlag(), ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE, ANNOUNCER_FLAG_DISABLE_AUTOBROADCAST, ANNOUNCER_FLAG_DISABLE_BG_QUEUE, AzerothcorePSSource, CONFIG_AUTOBROADCAST_MIN_LEVEL_DISABLE, Unit::GetLevel(), ChatHandler::GetPlayer(), Player::GetPlayerSetting(), LANG_CMD_AUTOBROADCAST_LVL_ERROR, LANG_CMD_SETTINGS_ANNOUNCER_OFF, LANG_CMD_SETTINGS_ANNOUNCER_ON, ChatHandler::PSendSysMessage(), PlayerSetting::RemoveFlag(), ChatHandler::SetSentErrorMessage(), SETTING_ANNOUNCER_FLAGS, sWorld, Player::UpdatePlayerSetting(), and PlayerSetting::value.

Referenced by GetCommands().