TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cheat_commandscript Class Reference

Public Member Functions

 cheat_commandscript ()
 
std::vector< ChatCommandGetCommands () const override
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 

Static Public Member Functions

static bool HandleGodModeCheatCommand (ChatHandler *handler, const char *args)
 
static bool HandleCasttimeCheatCommand (ChatHandler *handler, const char *args)
 
static bool HandleCoolDownCheatCommand (ChatHandler *handler, const char *args)
 
static bool HandlePowerCheatCommand (ChatHandler *handler, const char *args)
 
static bool HandleCheatStatusCommand (ChatHandler *handler, const char *)
 
static bool HandleWaterWalkCheatCommand (ChatHandler *handler, const char *args)
 
static bool HandleTaxiCheatCommand (ChatHandler *handler, const char *args)
 
static bool HandleExploreCheatCommand (ChatHandler *handler, const char *args)
 

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

Constructor & Destructor Documentation

cheat_commandscript::cheat_commandscript ( )
inline
33 : CommandScript("cheat_commandscript") { }
CommandScript(const char *name)
Definition: ScriptMgr.cpp:1616

Member Function Documentation

std::vector<ChatCommand> cheat_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

36  {
37  static std::vector<ChatCommand> cheatCommandTable =
38  {
47 
48  };
49 
50  static std::vector<ChatCommand> commandTable =
51  {
52  { "cheat", rbac::RBAC_PERM_COMMAND_CHEAT, false, NULL, "", cheatCommandTable },
53  };
54  return commandTable;
55  }
static bool HandleExploreCheatCommand(ChatHandler *handler, const char *args)
Definition: cs_cheat.cpp:246
static bool HandleCasttimeCheatCommand(ChatHandler *handler, const char *args)
Definition: cs_cheat.cpp:83
arena_t NULL
Definition: jemalloc_internal.h:624
static bool HandleGodModeCheatCommand(ChatHandler *handler, const char *args)
Definition: cs_cheat.cpp:57
static bool HandleTaxiCheatCommand(ChatHandler *handler, const char *args)
Definition: cs_cheat.cpp:207
Definition: RBAC.h:198
static bool HandleCoolDownCheatCommand(ChatHandler *handler, const char *args)
Definition: cs_cheat.cpp:109
static bool HandlePowerCheatCommand(ChatHandler *handler, const char *args)
Definition: cs_cheat.cpp:135
Definition: RBAC.h:202
static bool HandleWaterWalkCheatCommand(ChatHandler *handler, const char *args)
Definition: cs_cheat.cpp:178
static bool HandleCheatStatusCommand(ChatHandler *handler, const char *)
Definition: cs_cheat.cpp:161

+ Here is the call graph for this function:

static bool cheat_commandscript::HandleCasttimeCheatCommand ( ChatHandler handler,
const char *  args 
)
inlinestatic
84  {
85  if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
86  return false;
87 
88  std::string argstr = (char*)args;
89 
90  if (!*args)
91  argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_CASTTIME)) ? "off" : "on";
92 
93  if (argstr == "off")
94  {
95  handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_CASTTIME);
96  handler->SendSysMessage("CastTime Cheat is OFF. Your spells will have a casttime.");
97  return true;
98  }
99  else if (argstr == "on")
100  {
101  handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_CASTTIME);
102  handler->SendSysMessage("CastTime Cheat is ON. Your spells won't have a casttime.");
103  return true;
104  }
105 
106  return false;
107  }
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldSession * GetSession()
Definition: Chat.h:59
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool cheat_commandscript::HandleCheatStatusCommand ( ChatHandler handler,
const char *   
)
inlinestatic
162  {
163  Player* player = handler->GetSession()->GetPlayer();
164 
165  const char* enabled = "ON";
166  const char* disabled = "OFF";
167 
169  handler->PSendSysMessage(LANG_COMMAND_CHEAT_GOD, player->GetCommandStatus(CHEAT_GOD) ? enabled : disabled);
170  handler->PSendSysMessage(LANG_COMMAND_CHEAT_CD, player->GetCommandStatus(CHEAT_COOLDOWN) ? enabled : disabled);
171  handler->PSendSysMessage(LANG_COMMAND_CHEAT_CT, player->GetCommandStatus(CHEAT_CASTTIME) ? enabled : disabled);
172  handler->PSendSysMessage(LANG_COMMAND_CHEAT_POWER, player->GetCommandStatus(CHEAT_POWER) ? enabled : disabled);
173  handler->PSendSysMessage(LANG_COMMAND_CHEAT_WW, player->GetCommandStatus(CHEAT_WATERWALK) ? enabled : disabled);
174  handler->PSendSysMessage(LANG_COMMAND_CHEAT_TAXINODES, player->isTaxiCheater() ? enabled : disabled);
175  return true;
176  }
Definition: Language.h:386
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Language.h:387
Definition: Language.h:392
Definition: Language.h:390
Definition: Language.h:388
Definition: Language.h:385
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Language.h:389

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool cheat_commandscript::HandleCoolDownCheatCommand ( ChatHandler handler,
const char *  args 
)
inlinestatic
110  {
111  if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
112  return false;
113 
114  std::string argstr = (char*)args;
115 
116  if (!*args)
117  argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_COOLDOWN)) ? "off" : "on";
118 
119  if (argstr == "off")
120  {
121  handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_COOLDOWN);
122  handler->SendSysMessage("Cooldown Cheat is OFF. You are on the global cooldown.");
123  return true;
124  }
125  else if (argstr == "on")
126  {
127  handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_COOLDOWN);
128  handler->SendSysMessage("Cooldown Cheat is ON. You are not on the global cooldown.");
129  return true;
130  }
131 
132  return false;
133  }
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldSession * GetSession()
Definition: Chat.h:59
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool cheat_commandscript::HandleExploreCheatCommand ( ChatHandler handler,
const char *  args 
)
inlinestatic
247  {
248  if (!*args)
249  return false;
250 
251  // std::int flag = (char*)args;
252  int flag = atoi((char*)args);
253 
254  Player* chr = handler->getSelectedPlayer();
255  if (!chr)
256  {
258  handler->SetSentErrorMessage(true);
259  return false;
260  }
261 
262  if (flag != 0)
263  {
264  handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, handler->GetNameLink(chr).c_str());
265  if (handler->needReportToTarget(chr))
266  ChatHandler(chr->GetSession()).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str());
267  }
268  else
269  {
270  handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, handler->GetNameLink(chr).c_str());
271  if (handler->needReportToTarget(chr))
272  ChatHandler(chr->GetSession()).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str());
273  }
274 
275  for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
276  {
277  if (flag != 0)
278  handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF);
279  else
280  handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0);
281  }
282 
283  return true;
284  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: Language.h:572
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Language.h:140
#define PLAYER_EXPLORED_ZONES_SIZE
Definition: Player.h:72
virtual std::string GetNameLink() const
Definition: Chat.h:101
Player * getSelectedPlayer()
Definition: Chat.cpp:579
Definition: Chat.h:56
WorldSession * GetSession()
Definition: Chat.h:59
uint8_t uint8
Definition: Define.h:152
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Language.h:570
Definition: Language.h:573
virtual bool needReportToTarget(Player *chr) const
Definition: Chat.cpp:1056
Definition: Language.h:571
Definition: UpdateFields.h:249

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool cheat_commandscript::HandleGodModeCheatCommand ( ChatHandler handler,
const char *  args 
)
inlinestatic
58  {
59  if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
60  return false;
61 
62  std::string argstr = (char*)args;
63 
64  if (!*args)
65  argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_GOD)) ? "off" : "on";
66 
67  if (argstr == "off")
68  {
69  handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_GOD);
70  handler->SendSysMessage("Godmode is OFF. You can take damage.");
71  return true;
72  }
73  else if (argstr == "on")
74  {
75  handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_GOD);
76  handler->SendSysMessage("Godmode is ON. You won't take damage.");
77  return true;
78  }
79 
80  return false;
81  }
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldSession * GetSession()
Definition: Chat.h:59
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool cheat_commandscript::HandlePowerCheatCommand ( ChatHandler handler,
const char *  args 
)
inlinestatic
136  {
137  if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
138  return false;
139 
140  std::string argstr = (char*)args;
141 
142  if (!*args)
143  argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_POWER)) ? "off" : "on";
144 
145  if (argstr == "off")
146  {
147  handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_POWER);
148  handler->SendSysMessage("Power Cheat is OFF. You need mana/rage/energy to use spells.");
149  return true;
150  }
151  else if (argstr == "on")
152  {
153  handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_POWER);
154  handler->SendSysMessage("Power Cheat is ON. You don't need mana/rage/energy to use spells.");
155  return true;
156  }
157 
158  return false;
159  }
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldSession * GetSession()
Definition: Chat.h:59
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool cheat_commandscript::HandleTaxiCheatCommand ( ChatHandler handler,
const char *  args 
)
inlinestatic
208  {
209 
210  std::string argstr = (char*)args;
211  Player* chr = handler->getSelectedPlayer();
212 
213  if (!chr)
214  chr = handler->GetSession()->GetPlayer();
215  else if (handler->HasLowerSecurity(chr, ObjectGuid::Empty)) // check online security
216  return false;
217 
218  if (!*args)
219  argstr = (chr->isTaxiCheater()) ? "off" : "on";
220 
221 
222  if (argstr == "off")
223 
224  {
225  chr->SetTaxiCheater(false);
226  handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr).c_str());
227  if (handler->needReportToTarget(chr))
228  ChatHandler(chr->GetSession()).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str());
229  return true;
230  }
231  else if (argstr == "on")
232  {
233  chr->SetTaxiCheater(true);
234  handler->PSendSysMessage(LANG_YOU_GIVE_TAXIS, handler->GetNameLink(chr).c_str());
235  if (handler->needReportToTarget(chr))
236  ChatHandler(chr->GetSession()).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, handler->GetNameLink().c_str());
237  return true;
238  }
239 
240 
241  handler->SendSysMessage(LANG_USE_BOL);
242  handler->SetSentErrorMessage(true);
243  return false;
244  }
Definition: Language.h:159
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Player * GetPlayer() const
Definition: WorldSession.h:927
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition: Chat.cpp:77
virtual std::string GetNameLink() const
Definition: Chat.h:101
Definition: Language.h:290
Definition: Language.h:160
Player * getSelectedPlayer()
Definition: Chat.cpp:579
Definition: Chat.h:56
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
Definition: Language.h:161
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
virtual bool needReportToTarget(Player *chr) const
Definition: Chat.cpp:1056
Definition: Language.h:162

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool cheat_commandscript::HandleWaterWalkCheatCommand ( ChatHandler handler,
const char *  args 
)
inlinestatic
179  {
180  if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
181  return false;
182 
183  std::string argstr = (char*)args;
184 
185  Player* target = handler->GetSession()->GetPlayer();
186  if (!*args)
187  argstr = (target->GetCommandStatus(CHEAT_WATERWALK)) ? "off" : "on";
188 
189  if (argstr == "off")
190  {
191  target->SetCommandStatusOff(CHEAT_WATERWALK);
192  target->SetWaterWalking(false);
193  handler->SendSysMessage("Waterwalking is OFF. You can't walk on water.");
194  return true;
195  }
196  else if (argstr == "on")
197  {
198  target->SetCommandStatusOn(CHEAT_WATERWALK);
199  target->SetWaterWalking(true);
200  handler->SendSysMessage("Waterwalking is ON. You can walk on water.");
201  return true;
202  }
203 
204  return false;
205  }
Player * GetPlayer() const
Definition: WorldSession.h:927
WorldSession * GetSession()
Definition: Chat.h:59
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: