AzeorthCore 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
 

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)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ player_settings_commandscript()

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

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:67
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:50
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 }
@ 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
@ LANG_CMD_SETTINGS_ANNOUNCER_OFF
Definition: Language.h:1145
@ LANG_CMD_AUTOBROADCAST_LVL_ERROR
Definition: Language.h:1143
@ LANG_CMD_SETTINGS_ANNOUNCER_ON
Definition: Language.h:1144
@ CONFIG_AUTOBROADCAST_MIN_LEVEL_DISABLE
Definition: IWorld.h:360
#define sWorld
Definition: World.h:458
void SetSentErrorMessage(bool val)
Definition: Chat.h:118
Player * GetPlayer() const
Definition: Chat.cpp:37
void PSendSysMessage(char const *fmt, Args &&... args)
Definition: Chat.h:60
Definition: Player.h:1046
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:1418

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().