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

Public Member Functions

 disable_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 HandleAddDisables (ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment, uint8 disableType)
 
static bool HandleAddDisableSpellCommand (ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment)
 
static bool HandleAddDisableQuestCommand (ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment)
 
static bool HandleAddDisableMapCommand (ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment)
 
static bool HandleAddDisableBattlegroundCommand (ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment)
 
static bool HandleAddDisableAchievementCriteriaCommand (ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment)
 
static bool HandleAddDisableOutdoorPvPCommand (ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment)
 
static bool HandleAddDisableVmapCommand (ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment)
 
static bool HandleRemoveDisables (ChatHandler *handler, uint32 entry, uint8 disableType)
 
static bool HandleRemoveDisableSpellCommand (ChatHandler *handler, uint32 entry)
 
static bool HandleRemoveDisableQuestCommand (ChatHandler *handler, uint32 entry)
 
static bool HandleRemoveDisableMapCommand (ChatHandler *handler, uint32 entry)
 
static bool HandleRemoveDisableBattlegroundCommand (ChatHandler *handler, uint32 entry)
 
static bool HandleRemoveDisableAchievementCriteriaCommand (ChatHandler *handler, uint32 entry)
 
static bool HandleRemoveDisableOutdoorPvPCommand (ChatHandler *handler, uint32 entry)
 
static bool HandleRemoveDisableVmapCommand (ChatHandler *handler, uint32 entry)
 

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

◆ disable_commandscript()

disable_commandscript::disable_commandscript ( )
inline
39: CommandScript("disable_commandscript") { }
Definition: CommandScript.h:25

Member Function Documentation

◆ GetCommands()

ChatCommandTable disable_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

42 {
43 static ChatCommandTable removeDisableCommandTable =
44 {
45 { "spell", HandleRemoveDisableSpellCommand, SEC_ADMINISTRATOR, Console::Yes },
46 { "quest", HandleRemoveDisableQuestCommand, SEC_ADMINISTRATOR, Console::Yes },
47 { "map", HandleRemoveDisableMapCommand, SEC_ADMINISTRATOR, Console::Yes },
48 { "battleground", HandleRemoveDisableBattlegroundCommand, SEC_ADMINISTRATOR, Console::Yes },
49 { "outdoorpvp", HandleRemoveDisableOutdoorPvPCommand, SEC_ADMINISTRATOR, Console::Yes },
50 { "vmap", HandleRemoveDisableVmapCommand, SEC_ADMINISTRATOR, Console::Yes }
51 };
52 static ChatCommandTable addDisableCommandTable =
53 {
54 { "spell", HandleAddDisableSpellCommand, SEC_ADMINISTRATOR, Console::Yes },
55 { "quest", HandleAddDisableQuestCommand, SEC_ADMINISTRATOR, Console::Yes },
56 { "map", HandleAddDisableMapCommand, SEC_ADMINISTRATOR, Console::Yes },
57 { "battleground", HandleAddDisableBattlegroundCommand, SEC_ADMINISTRATOR, Console::Yes },
58 { "outdoorpvp", HandleAddDisableOutdoorPvPCommand, SEC_ADMINISTRATOR, Console::Yes },
59 { "vmap", HandleAddDisableVmapCommand, SEC_ADMINISTRATOR, Console::Yes }
60 };
61 static ChatCommandTable disableCommandTable =
62 {
63 { "add", addDisableCommandTable },
64 { "remove", removeDisableCommandTable }
65 };
66 static ChatCommandTable commandTable =
67 {
68 { "disable", disableCommandTable }
69 };
70 return commandTable;
71 }
@ SEC_ADMINISTRATOR
Definition: Common.h:60
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:46
static bool HandleRemoveDisableOutdoorPvPCommand(ChatHandler *handler, uint32 entry)
Definition: cs_disable.cpp:275
static bool HandleAddDisableSpellCommand(ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment)
Definition: cs_disable.cpp:165
static bool HandleAddDisableOutdoorPvPCommand(ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment)
Definition: cs_disable.cpp:190
static bool HandleRemoveDisableQuestCommand(ChatHandler *handler, uint32 entry)
Definition: cs_disable.cpp:255
static bool HandleAddDisableBattlegroundCommand(ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment)
Definition: cs_disable.cpp:180
static bool HandleAddDisableQuestCommand(ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment)
Definition: cs_disable.cpp:170
static bool HandleRemoveDisableBattlegroundCommand(ChatHandler *handler, uint32 entry)
Definition: cs_disable.cpp:265
static bool HandleAddDisableVmapCommand(ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment)
Definition: cs_disable.cpp:196
static bool HandleRemoveDisableSpellCommand(ChatHandler *handler, uint32 entry)
Definition: cs_disable.cpp:250
static bool HandleRemoveDisableVmapCommand(ChatHandler *handler, uint32 entry)
Definition: cs_disable.cpp:280
static bool HandleRemoveDisableMapCommand(ChatHandler *handler, uint32 entry)
Definition: cs_disable.cpp:260
static bool HandleAddDisableMapCommand(ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment)
Definition: cs_disable.cpp:175

References HandleAddDisableBattlegroundCommand(), HandleAddDisableMapCommand(), HandleAddDisableOutdoorPvPCommand(), HandleAddDisableQuestCommand(), HandleAddDisableSpellCommand(), HandleAddDisableVmapCommand(), HandleRemoveDisableBattlegroundCommand(), HandleRemoveDisableMapCommand(), HandleRemoveDisableOutdoorPvPCommand(), HandleRemoveDisableQuestCommand(), HandleRemoveDisableSpellCommand(), HandleRemoveDisableVmapCommand(), and SEC_ADMINISTRATOR.

◆ HandleAddDisableAchievementCriteriaCommand()

static bool disable_commandscript::HandleAddDisableAchievementCriteriaCommand ( ChatHandler handler,
uint32  entry,
uint8  flags,
std::string  disableComment 
)
inlinestatic
186 {
187 return HandleAddDisables(handler, entry, flags, disableComment, DISABLE_TYPE_ACHIEVEMENT_CRITERIA);
188 }
@ DISABLE_TYPE_ACHIEVEMENT_CRITERIA
Definition: DisableMgr.h:31
static bool HandleAddDisables(ChatHandler *handler, uint32 entry, uint8 flags, std::string disableComment, uint8 disableType)
Definition: cs_disable.cpp:73

References DISABLE_TYPE_ACHIEVEMENT_CRITERIA, and HandleAddDisables().

◆ HandleAddDisableBattlegroundCommand()

static bool disable_commandscript::HandleAddDisableBattlegroundCommand ( ChatHandler handler,
uint32  entry,
uint8  flags,
std::string  disableComment 
)
inlinestatic
181 {
182 return HandleAddDisables(handler, entry, flags, disableComment, DISABLE_TYPE_BATTLEGROUND);
183 }
@ DISABLE_TYPE_BATTLEGROUND
Definition: DisableMgr.h:30

References DISABLE_TYPE_BATTLEGROUND, and HandleAddDisables().

Referenced by GetCommands().

◆ HandleAddDisableMapCommand()

static bool disable_commandscript::HandleAddDisableMapCommand ( ChatHandler handler,
uint32  entry,
uint8  flags,
std::string  disableComment 
)
inlinestatic
176 {
177 return HandleAddDisables(handler, entry, flags, disableComment, DISABLE_TYPE_MAP);
178 }
@ DISABLE_TYPE_MAP
Definition: DisableMgr.h:29

References DISABLE_TYPE_MAP, and HandleAddDisables().

Referenced by GetCommands().

◆ HandleAddDisableOutdoorPvPCommand()

static bool disable_commandscript::HandleAddDisableOutdoorPvPCommand ( ChatHandler handler,
uint32  entry,
uint8  flags,
std::string  disableComment 
)
inlinestatic
191 {
192 HandleAddDisables(handler, entry, flags, disableComment, DISABLE_TYPE_OUTDOORPVP);
193 return true;
194 }
@ DISABLE_TYPE_OUTDOORPVP
Definition: DisableMgr.h:32

References DISABLE_TYPE_OUTDOORPVP, and HandleAddDisables().

Referenced by GetCommands().

◆ HandleAddDisableQuestCommand()

static bool disable_commandscript::HandleAddDisableQuestCommand ( ChatHandler handler,
uint32  entry,
uint8  flags,
std::string  disableComment 
)
inlinestatic
171 {
172 return HandleAddDisables(handler, entry, flags, disableComment, DISABLE_TYPE_QUEST);
173 }
@ DISABLE_TYPE_QUEST
Definition: DisableMgr.h:28

References DISABLE_TYPE_QUEST, and HandleAddDisables().

Referenced by GetCommands().

◆ HandleAddDisables()

static bool disable_commandscript::HandleAddDisables ( ChatHandler handler,
uint32  entry,
uint8  flags,
std::string  disableComment,
uint8  disableType 
)
inlinestatic
74 {
75 std::string disableTypeStr = "";
76
77 switch (disableType)
78 {
80 {
81 if (!sSpellMgr->GetSpellInfo(entry))
82 {
84 return false;
85 }
86 disableTypeStr = "spell";
87 break;
88 }
90 {
91 if (!sObjectMgr->GetQuestTemplate(entry))
92 {
94 return false;
95 }
96 disableTypeStr = "quest";
97 break;
98 }
100 {
101 if (!sMapStore.LookupEntry(entry))
102 {
104 return false;
105 }
106 disableTypeStr = "map";
107 break;
108 }
110 {
111 if (!sBattlemasterListStore.LookupEntry(entry))
112 {
114 return false;
115 }
116 disableTypeStr = "battleground";
117 break;
118 }
120 {
121 if (entry > MAX_OUTDOORPVP_TYPES)
122 {
124 return false;
125 }
126 disableTypeStr = "outdoorpvp";
127 break;
128 }
130 {
131 if (!sMapStore.LookupEntry(entry))
132 {
134 return false;
135 }
136 disableTypeStr = "vmap";
137 break;
138 }
139 default:
140 break;
141 }
142
143 WorldDatabasePreparedStatement* stmt = nullptr;
144 stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
145 stmt->SetData(0, entry);
146 stmt->SetData(1, disableType);
147 PreparedQueryResult result = WorldDatabase.Query(stmt);
148 if (result)
149 {
150 handler->SendErrorMessage("This {} (Id: {}) is already disabled.", disableTypeStr, entry);
151 return false;
152 }
153
154 stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_DISABLES);
155 stmt->SetData(0, entry);
156 stmt->SetData(1, disableType);
157 stmt->SetData(2, flags);
158 stmt->SetData(3, disableComment);
159 WorldDatabase.Execute(stmt);
160
161 handler->PSendSysMessage("Add Disabled {} (Id: {}) for reason {}", disableTypeStr, entry, disableComment);
162 return true;
163 }
#define sObjectMgr
Definition: ObjectMgr.h:1635
#define sSpellMgr
Definition: SpellMgr.h:825
@ LANG_COMMAND_NOMAPFOUND
Definition: Language.h:1059
@ LANG_COMMAND_NO_BATTLEGROUND_FOUND
Definition: Language.h:1079
@ LANG_COMMAND_NOSPELLFOUND
Definition: Language.h:477
@ LANG_COMMAND_QUEST_NOTFOUND
Definition: Language.h:504
@ LANG_COMMAND_NO_OUTDOOR_PVP_FORUND
Definition: Language.h:1081
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListEntryfmt)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
@ DISABLE_TYPE_SPELL
Definition: DisableMgr.h:27
@ DISABLE_TYPE_VMAP
Definition: DisableMgr.h:33
#define MAX_OUTDOORPVP_TYPES
Definition: OutdoorPvP.h:38
@ WORLD_INS_DISABLES
Definition: WorldDatabase.h:97
@ WORLD_SEL_DISABLES
Definition: WorldDatabase.h:96
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: DatabaseEnvFwd.h:45
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: PreparedStatement.h:157
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:77
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:210
void SendErrorMessage(uint32 entry)
Definition: Chat.cpp:215

References DISABLE_TYPE_BATTLEGROUND, DISABLE_TYPE_MAP, DISABLE_TYPE_OUTDOORPVP, DISABLE_TYPE_QUEST, DISABLE_TYPE_SPELL, DISABLE_TYPE_VMAP, LANG_COMMAND_NO_BATTLEGROUND_FOUND, LANG_COMMAND_NO_OUTDOOR_PVP_FORUND, LANG_COMMAND_NOMAPFOUND, LANG_COMMAND_NOSPELLFOUND, LANG_COMMAND_QUEST_NOTFOUND, MAX_OUTDOORPVP_TYPES, ChatHandler::PSendSysMessage(), sBattlemasterListStore, ChatHandler::SendErrorMessage(), PreparedStatementBase::SetData(), sMapStore, sObjectMgr, sSpellMgr, WORLD_INS_DISABLES, WORLD_SEL_DISABLES, and WorldDatabase.

Referenced by HandleAddDisableAchievementCriteriaCommand(), HandleAddDisableBattlegroundCommand(), HandleAddDisableMapCommand(), HandleAddDisableOutdoorPvPCommand(), HandleAddDisableQuestCommand(), HandleAddDisableSpellCommand(), and HandleAddDisableVmapCommand().

◆ HandleAddDisableSpellCommand()

static bool disable_commandscript::HandleAddDisableSpellCommand ( ChatHandler handler,
uint32  entry,
uint8  flags,
std::string  disableComment 
)
inlinestatic
166 {
167 return HandleAddDisables(handler, entry, flags, disableComment, DISABLE_TYPE_SPELL);
168 }

References DISABLE_TYPE_SPELL, and HandleAddDisables().

Referenced by GetCommands().

◆ HandleAddDisableVmapCommand()

static bool disable_commandscript::HandleAddDisableVmapCommand ( ChatHandler handler,
uint32  entry,
uint8  flags,
std::string  disableComment 
)
inlinestatic
197 {
198 return HandleAddDisables(handler, entry, flags, disableComment, DISABLE_TYPE_VMAP);
199 }

References DISABLE_TYPE_VMAP, and HandleAddDisables().

Referenced by GetCommands().

◆ HandleRemoveDisableAchievementCriteriaCommand()

static bool disable_commandscript::HandleRemoveDisableAchievementCriteriaCommand ( ChatHandler handler,
uint32  entry 
)
inlinestatic
271 {
273 }
static bool HandleRemoveDisables(ChatHandler *handler, uint32 entry, uint8 disableType)
Definition: cs_disable.cpp:201

References DISABLE_TYPE_ACHIEVEMENT_CRITERIA, and HandleRemoveDisables().

◆ HandleRemoveDisableBattlegroundCommand()

static bool disable_commandscript::HandleRemoveDisableBattlegroundCommand ( ChatHandler handler,
uint32  entry 
)
inlinestatic
266 {
267 return HandleRemoveDisables(handler, entry, DISABLE_TYPE_BATTLEGROUND);
268 }

References DISABLE_TYPE_BATTLEGROUND, and HandleRemoveDisables().

Referenced by GetCommands().

◆ HandleRemoveDisableMapCommand()

static bool disable_commandscript::HandleRemoveDisableMapCommand ( ChatHandler handler,
uint32  entry 
)
inlinestatic
261 {
262 return HandleRemoveDisables(handler, entry, DISABLE_TYPE_MAP);
263 }

References DISABLE_TYPE_MAP, and HandleRemoveDisables().

Referenced by GetCommands().

◆ HandleRemoveDisableOutdoorPvPCommand()

static bool disable_commandscript::HandleRemoveDisableOutdoorPvPCommand ( ChatHandler handler,
uint32  entry 
)
inlinestatic
276 {
277 return HandleRemoveDisables(handler, entry, DISABLE_TYPE_OUTDOORPVP);
278 }

References DISABLE_TYPE_OUTDOORPVP, and HandleRemoveDisables().

Referenced by GetCommands().

◆ HandleRemoveDisableQuestCommand()

static bool disable_commandscript::HandleRemoveDisableQuestCommand ( ChatHandler handler,
uint32  entry 
)
inlinestatic
256 {
257 return HandleRemoveDisables(handler, entry, DISABLE_TYPE_QUEST);
258 }

References DISABLE_TYPE_QUEST, and HandleRemoveDisables().

Referenced by GetCommands().

◆ HandleRemoveDisables()

static bool disable_commandscript::HandleRemoveDisables ( ChatHandler handler,
uint32  entry,
uint8  disableType 
)
inlinestatic
202 {
203 std::string disableTypeStr = "";
204
205 switch (disableType)
206 {
208 disableTypeStr = "spell";
209 break;
211 disableTypeStr = "quest";
212 break;
213 case DISABLE_TYPE_MAP:
214 disableTypeStr = "map";
215 break;
217 disableTypeStr = "battleground";
218 break;
220 disableTypeStr = "achievement criteria";
221 break;
223 disableTypeStr = "outdoorpvp";
224 break;
226 disableTypeStr = "vmap";
227 break;
228 }
229
230 WorldDatabasePreparedStatement* stmt = nullptr;
231 stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
232 stmt->SetData(0, entry);
233 stmt->SetData(1, disableType);
234 PreparedQueryResult result = WorldDatabase.Query(stmt);
235 if (!result)
236 {
237 handler->SendErrorMessage("This {} (Id: {}) is not disabled.", disableTypeStr, entry);
238 return false;
239 }
240
241 stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_DISABLES);
242 stmt->SetData(0, entry);
243 stmt->SetData(1, disableType);
244 WorldDatabase.Execute(stmt);
245
246 handler->PSendSysMessage("Remove Disabled {} (Id: {})", disableTypeStr, entry);
247 return true;
248 }
@ WORLD_DEL_DISABLES
Definition: WorldDatabase.h:98

References DISABLE_TYPE_ACHIEVEMENT_CRITERIA, DISABLE_TYPE_BATTLEGROUND, DISABLE_TYPE_MAP, DISABLE_TYPE_OUTDOORPVP, DISABLE_TYPE_QUEST, DISABLE_TYPE_SPELL, DISABLE_TYPE_VMAP, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), PreparedStatementBase::SetData(), WORLD_DEL_DISABLES, WORLD_SEL_DISABLES, and WorldDatabase.

Referenced by HandleRemoveDisableAchievementCriteriaCommand(), HandleRemoveDisableBattlegroundCommand(), HandleRemoveDisableMapCommand(), HandleRemoveDisableOutdoorPvPCommand(), HandleRemoveDisableQuestCommand(), HandleRemoveDisableSpellCommand(), and HandleRemoveDisableVmapCommand().

◆ HandleRemoveDisableSpellCommand()

static bool disable_commandscript::HandleRemoveDisableSpellCommand ( ChatHandler handler,
uint32  entry 
)
inlinestatic
251 {
252 return HandleRemoveDisables(handler, entry, DISABLE_TYPE_SPELL);
253 }

References DISABLE_TYPE_SPELL, and HandleRemoveDisables().

Referenced by GetCommands().

◆ HandleRemoveDisableVmapCommand()

static bool disable_commandscript::HandleRemoveDisableVmapCommand ( ChatHandler handler,
uint32  entry 
)
inlinestatic
281 {
282 return HandleRemoveDisables(handler, entry, DISABLE_TYPE_VMAP);
283 }

References DISABLE_TYPE_VMAP, and HandleRemoveDisables().

Referenced by GetCommands().