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

Public Member Functions

 cheat_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 HandleGodModeCheatCommand (ChatHandler *handler, Optional< bool > enableArg)
 
static bool HandleCasttimeCheatCommand (ChatHandler *handler, Optional< bool > enableArg)
 
static bool HandleCoolDownCheatCommand (ChatHandler *handler, Optional< bool > enableArg)
 
static bool HandlePowerCheatCommand (ChatHandler *handler, Optional< bool > enableArg)
 
static bool HandleCheatStatusCommand (ChatHandler *handler)
 
static bool HandleWaterWalkCheatCommand (ChatHandler *handler, Optional< bool > enableArg)
 
static bool HandleTaxiCheatCommand (ChatHandler *handler, Optional< bool > enableArg)
 
static bool HandleExploreCheatCommand (ChatHandler *handler, bool reveal)
 

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

◆ cheat_commandscript()

cheat_commandscript::cheat_commandscript ( )
inline
29: CommandScript("cheat_commandscript") { }
Definition: CommandScript.h:25

Member Function Documentation

◆ GetCommands()

ChatCommandTable cheat_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

32 {
33 static ChatCommandTable cheatCommandTable =
34 {
35 { "god", HandleGodModeCheatCommand, SEC_GAMEMASTER, Console::No },
36 { "casttime", HandleCasttimeCheatCommand, SEC_GAMEMASTER, Console::No },
37 { "cooldown", HandleCoolDownCheatCommand, SEC_GAMEMASTER, Console::No },
38 { "power", HandlePowerCheatCommand, SEC_GAMEMASTER, Console::No },
39 { "waterwalk", HandleWaterWalkCheatCommand, SEC_GAMEMASTER, Console::No },
40 { "status", HandleCheatStatusCommand, SEC_GAMEMASTER, Console::No },
41 { "taxi", HandleTaxiCheatCommand, SEC_GAMEMASTER, Console::No },
42 { "explore", HandleExploreCheatCommand, SEC_GAMEMASTER, Console::No }
43 };
44
45 static ChatCommandTable commandTable =
46 {
47 { "cheat", cheatCommandTable }
48 };
49 return commandTable;
50 }
@ SEC_GAMEMASTER
Definition: Common.h:59
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:46
static bool HandleCasttimeCheatCommand(ChatHandler *handler, Optional< bool > enableArg)
Definition: cs_cheat.cpp:72
static bool HandleExploreCheatCommand(ChatHandler *handler, bool reveal)
Definition: cs_cheat.cpp:203
static bool HandleWaterWalkCheatCommand(ChatHandler *handler, Optional< bool > enableArg)
Definition: cs_cheat.cpp:150
static bool HandleCoolDownCheatCommand(ChatHandler *handler, Optional< bool > enableArg)
Definition: cs_cheat.cpp:92
static bool HandleTaxiCheatCommand(ChatHandler *handler, Optional< bool > enableArg)
Definition: cs_cheat.cpp:172
static bool HandleGodModeCheatCommand(ChatHandler *handler, Optional< bool > enableArg)
Definition: cs_cheat.cpp:52
static bool HandleCheatStatusCommand(ChatHandler *handler)
Definition: cs_cheat.cpp:132
static bool HandlePowerCheatCommand(ChatHandler *handler, Optional< bool > enableArg)
Definition: cs_cheat.cpp:112

References HandleCasttimeCheatCommand(), HandleCheatStatusCommand(), HandleCoolDownCheatCommand(), HandleExploreCheatCommand(), HandleGodModeCheatCommand(), HandlePowerCheatCommand(), HandleTaxiCheatCommand(), HandleWaterWalkCheatCommand(), and SEC_GAMEMASTER.

◆ HandleCasttimeCheatCommand()

static bool cheat_commandscript::HandleCasttimeCheatCommand ( ChatHandler handler,
Optional< bool >  enableArg 
)
inlinestatic
73 {
74 bool enable = !handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_CASTTIME);
75 if (enableArg)
76 enable = *enableArg;
77
78 if (enable)
79 {
81 handler->SendSysMessage("CastTime Cheat is ON. Your spells won't have a casttime.");
82 }
83 else
84 {
86 handler->SendSysMessage("CastTime Cheat is OFF. Your spells will have a casttime.");
87 }
88
89 return true;
90 }
@ CHEAT_CASTTIME
Definition: Player.h:1000
WorldSession * GetSession()
Definition: Chat.h:242
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:159
bool GetCommandStatus(uint32 command) const
Definition: Player.h:1178
void SetCommandStatusOn(uint32 command)
Definition: Player.h:1179
void SetCommandStatusOff(uint32 command)
Definition: Player.h:1180
Player * GetPlayer() const
Definition: WorldSession.h:362

References CHEAT_CASTTIME, Player::GetCommandStatus(), WorldSession::GetPlayer(), ChatHandler::GetSession(), ChatHandler::SendSysMessage(), Player::SetCommandStatusOff(), and Player::SetCommandStatusOn().

Referenced by GetCommands().

◆ HandleCheatStatusCommand()

static bool cheat_commandscript::HandleCheatStatusCommand ( ChatHandler handler)
inlinestatic
133 {
134 Player* player = handler->GetSession()->GetPlayer();
135
136 char const* enabled = "ON";
137 char const* disabled = "OFF";
138
140 handler->PSendSysMessage(LANG_COMMAND_CHEAT_GOD, player->GetCommandStatus(CHEAT_GOD) ? enabled : disabled);
141 handler->PSendSysMessage(LANG_COMMAND_CHEAT_CD, player->GetCommandStatus(CHEAT_COOLDOWN) ? enabled : disabled);
142 handler->PSendSysMessage(LANG_COMMAND_CHEAT_CT, player->GetCommandStatus(CHEAT_CASTTIME) ? enabled : disabled);
143 handler->PSendSysMessage(LANG_COMMAND_CHEAT_POWER, player->GetCommandStatus(CHEAT_POWER) ? enabled : disabled);
144 handler->PSendSysMessage(LANG_COMMAND_CHEAT_WW, player->GetCommandStatus(CHEAT_WATERWALK) ? enabled : disabled);
145 handler->PSendSysMessage(LANG_COMMAND_CHEAT_TAXINODES, player->isTaxiCheater() ? enabled : disabled);
146
147 return true;
148 }
@ LANG_COMMAND_CHEAT_CT
Definition: Language.h:400
@ LANG_COMMAND_CHEAT_WW
Definition: Language.h:403
@ LANG_COMMAND_CHEAT_POWER
Definition: Language.h:402
@ LANG_COMMAND_CHEAT_GOD
Definition: Language.h:399
@ LANG_COMMAND_CHEAT_CD
Definition: Language.h:401
@ LANG_COMMAND_CHEAT_STATUS
Definition: Language.h:398
@ LANG_COMMAND_CHEAT_TAXINODES
Definition: Language.h:405
@ CHEAT_COOLDOWN
Definition: Player.h:1001
@ CHEAT_POWER
Definition: Player.h:1002
@ CHEAT_GOD
Definition: Player.h:999
@ CHEAT_WATERWALK
Definition: Player.h:1003
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:210
Definition: Player.h:1064
bool isTaxiCheater() const
Definition: Player.h:1162

References CHEAT_CASTTIME, CHEAT_COOLDOWN, CHEAT_GOD, CHEAT_POWER, CHEAT_WATERWALK, Player::GetCommandStatus(), WorldSession::GetPlayer(), ChatHandler::GetSession(), Player::isTaxiCheater(), LANG_COMMAND_CHEAT_CD, LANG_COMMAND_CHEAT_CT, LANG_COMMAND_CHEAT_GOD, LANG_COMMAND_CHEAT_POWER, LANG_COMMAND_CHEAT_STATUS, LANG_COMMAND_CHEAT_TAXINODES, LANG_COMMAND_CHEAT_WW, ChatHandler::PSendSysMessage(), and ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleCoolDownCheatCommand()

static bool cheat_commandscript::HandleCoolDownCheatCommand ( ChatHandler handler,
Optional< bool >  enableArg 
)
inlinestatic
93 {
94 bool enable = !handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_COOLDOWN);
95 if (enableArg)
96 enable = *enableArg;
97
98 if (enable)
99 {
101 handler->SendSysMessage("Cooldown Cheat is ON. You are not on the global cooldown.");
102 }
103 else
104 {
106 handler->SendSysMessage("Cooldown Cheat is OFF. You are on the global cooldown.");
107 }
108
109 return true;
110 }

References CHEAT_COOLDOWN, Player::GetCommandStatus(), WorldSession::GetPlayer(), ChatHandler::GetSession(), ChatHandler::SendSysMessage(), Player::SetCommandStatusOff(), and Player::SetCommandStatusOn().

Referenced by GetCommands().

◆ HandleExploreCheatCommand()

static bool cheat_commandscript::HandleExploreCheatCommand ( ChatHandler handler,
bool  reveal 
)
inlinestatic
204 {
205 Player* chr = handler->getSelectedPlayer();
206 if (!chr)
207 {
209 return false;
210 }
211
212 if (reveal)
213 {
215 if (handler->needReportToTarget(chr))
217 }
218 else
219 {
221 if (handler->needReportToTarget(chr))
223 }
224
225 for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
226 {
227 if (reveal)
228 handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF);
229 else
231 }
232
233 return true;
234 }
std::uint8_t uint8
Definition: Define.h:109
@ LANG_YOU_SET_EXPLORE_NOTHING
Definition: Language.h:604
@ LANG_YOURS_EXPLORE_SET_ALL
Definition: Language.h:605
@ LANG_NO_CHAR_SELECTED
Definition: Language.h:148
@ LANG_YOU_SET_EXPLORE_ALL
Definition: Language.h:603
@ LANG_YOURS_EXPLORE_SET_NOTHING
Definition: Language.h:606
#define PLAYER_EXPLORED_ZONES_SIZE
Definition: Player.h:72
@ PLAYER_EXPLORED_ZONES_1
Definition: UpdateFields.h:357
Definition: Chat.h:37
virtual std::string GetNameLink() const
Definition: Chat.h:198
void SendErrorMessage(uint32 entry)
Definition: Chat.cpp:215
virtual bool needReportToTarget(Player *chr) const
Definition: Chat.cpp:863
Player * getSelectedPlayer() const
Definition: Chat.cpp:373
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:845
WorldSession * GetSession() const
Definition: Player.h:1981

References ChatHandler::GetNameLink(), WorldSession::GetPlayer(), ChatHandler::getSelectedPlayer(), ChatHandler::GetSession(), Player::GetSession(), LANG_NO_CHAR_SELECTED, LANG_YOU_SET_EXPLORE_ALL, LANG_YOU_SET_EXPLORE_NOTHING, LANG_YOURS_EXPLORE_SET_ALL, LANG_YOURS_EXPLORE_SET_NOTHING, ChatHandler::needReportToTarget(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), and Object::SetFlag().

Referenced by GetCommands().

◆ HandleGodModeCheatCommand()

static bool cheat_commandscript::HandleGodModeCheatCommand ( ChatHandler handler,
Optional< bool >  enableArg 
)
inlinestatic
53 {
54 bool enable = !handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_GOD);
55 if (enableArg)
56 enable = *enableArg;
57
58 if (enable)
59 {
61 handler->SendSysMessage("Godmode is ON. You won't take damage.");
62 }
63 else
64 {
66 handler->SendSysMessage("Godmode is OFF. You can take damage.");
67 }
68
69 return true;
70 }

References CHEAT_GOD, Player::GetCommandStatus(), WorldSession::GetPlayer(), ChatHandler::GetSession(), ChatHandler::SendSysMessage(), Player::SetCommandStatusOff(), and Player::SetCommandStatusOn().

Referenced by GetCommands().

◆ HandlePowerCheatCommand()

static bool cheat_commandscript::HandlePowerCheatCommand ( ChatHandler handler,
Optional< bool >  enableArg 
)
inlinestatic
113 {
114 bool enable = !handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_POWER);
115 if (enableArg)
116 enable = *enableArg;
117
118 if (enable)
119 {
121 handler->SendSysMessage("Power Cheat is ON. You don't need mana/rage/energy to use spells.");
122 }
123 else
124 {
126 handler->SendSysMessage("Power Cheat is OFF. You need mana/rage/energy to use spells.");
127 }
128
129 return true;
130 }

References CHEAT_POWER, Player::GetCommandStatus(), WorldSession::GetPlayer(), ChatHandler::GetSession(), ChatHandler::SendSysMessage(), Player::SetCommandStatusOff(), and Player::SetCommandStatusOn().

Referenced by GetCommands().

◆ HandleTaxiCheatCommand()

static bool cheat_commandscript::HandleTaxiCheatCommand ( ChatHandler handler,
Optional< bool >  enableArg 
)
inlinestatic
173 {
174 Player* chr = handler->getSelectedPlayer();
175
176 if (!chr)
177 chr = handler->GetSession()->GetPlayer();
178 else if (handler->HasLowerSecurity(chr, ObjectGuid::Empty)) // check online security
179 return false;
180
181 bool enable = !chr->isTaxiCheater();
182 if (enableArg)
183 enable = *enableArg;
184
185 if (enable)
186 {
187 chr->SetTaxiCheater(true);
188 handler->PSendSysMessage(LANG_YOU_GIVE_TAXIS, handler->GetNameLink(chr));
189 if (handler->needReportToTarget(chr))
191 }
192 else
193 {
194 chr->SetTaxiCheater(false);
195 handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr));
196 if (handler->needReportToTarget(chr))
198 }
199
200 return true;
201 }
@ LANG_YOURS_TAXIS_REMOVED
Definition: Language.h:170
@ LANG_YOURS_TAXIS_ADDED
Definition: Language.h:169
@ LANG_YOU_REMOVE_TAXIS
Definition: Language.h:168
@ LANG_YOU_GIVE_TAXIS
Definition: Language.h:167
bool HasLowerSecurity(Player *target, ObjectGuid guid=ObjectGuid::Empty, bool strong=false)
Definition: Chat.cpp:56
static ObjectGuid const Empty
Definition: ObjectGuid.h:120
void SetTaxiCheater(bool on)
Definition: Player.h:1163

References ObjectGuid::Empty, ChatHandler::GetNameLink(), WorldSession::GetPlayer(), ChatHandler::getSelectedPlayer(), ChatHandler::GetSession(), Player::GetSession(), ChatHandler::HasLowerSecurity(), Player::isTaxiCheater(), LANG_YOU_GIVE_TAXIS, LANG_YOU_REMOVE_TAXIS, LANG_YOURS_TAXIS_ADDED, LANG_YOURS_TAXIS_REMOVED, ChatHandler::needReportToTarget(), ChatHandler::PSendSysMessage(), and Player::SetTaxiCheater().

Referenced by GetCommands().

◆ HandleWaterWalkCheatCommand()

static bool cheat_commandscript::HandleWaterWalkCheatCommand ( ChatHandler handler,
Optional< bool >  enableArg 
)
inlinestatic
151 {
152 bool enable = !handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_WATERWALK);
153 if (enableArg)
154 enable = *enableArg;
155
156 if (enable)
157 {
159 handler->GetSession()->GetPlayer()->SetMovement(MOVE_WATER_WALK); // ON
160 handler->SendSysMessage("Waterwalking is ON. You can walk on water.");
161 }
162 else
163 {
165 handler->GetSession()->GetPlayer()->SetMovement(MOVE_LAND_WALK); // OFF
166 handler->SendSysMessage("Waterwalking is OFF. You can't walk on water.");
167 }
168
169 return true;
170 }
@ MOVE_WATER_WALK
Definition: Player.h:458
@ MOVE_LAND_WALK
Definition: Player.h:459
void SetMovement(PlayerMovementType pType)
Definition: Player.cpp:4391

References CHEAT_WATERWALK, Player::GetCommandStatus(), WorldSession::GetPlayer(), ChatHandler::GetSession(), MOVE_LAND_WALK, MOVE_WATER_WALK, ChatHandler::SendSysMessage(), Player::SetCommandStatusOff(), Player::SetCommandStatusOn(), and Player::SetMovement().

Referenced by GetCommands().