OregonCore  revision 3611e8a-git
Your Favourite TBC server
Chat.h
Go to the documentation of this file.
1 /*
2  * This file is part of the OregonCore Project. See AUTHORS file for Copyright information
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef OREGONCORE_CHAT_H
19 #define OREGONCORE_CHAT_H
20 
21 #include "SharedDefines.h"
22 
23 
24 class ChatHandler;
25 class WorldSession;
26 class Creature;
27 class Player;
28 class Unit;
29 struct GameTele;
30 
32 {
33  public:
34  const char* Name;
35  uint32 SecurityLevel; // function pointer required correct align (use uint32)
37  bool (ChatHandler::*Handler)(const char* args);
38  std::string Help;
40 };
41 
43 {
44  public:
45  explicit ChatHandler(WorldSession* session) : m_session(session), sentErrorMessage(false) { }
46  explicit ChatHandler(Player* player) : m_session(player->GetSession()) { }
48 
49  static void FillMessageData(WorldPacket* data, WorldSession* session, uint8 type, uint32 language, const char* channelName, uint64 target_guid, const char* message, Unit* speaker);
50 
51  void FillMessageData(WorldPacket* data, uint8 type, uint32 language, uint64 target_guid, const char* message)
52  {
53  FillMessageData(data, m_session, type, language, NULL, target_guid, message, NULL);
54  }
55 
56  void FillSystemMessageData(WorldPacket* data, const char* message)
57  {
58  FillMessageData(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, 0, message);
59  }
60 
61  static char* LineFromMessage(char*& pos)
62  {
63  char* start = strtok(pos, "\n");
64  pos = NULL;
65  return start;
66  }
67 
68  // function with different implementation for chat/console
69  virtual const char* GetOregonString(int32 entry) const;
70  virtual void SendSysMessage(const char* str);
71 
72  char* extractQuotedArg(char* args);
73 
74  void SendSysMessage(int32 entry);
75  void PSendSysMessage(const char* format, ...) ATTR_PRINTF(2, 3);
76  void PSendSysMessage(int32 entry, ...);
77  std::string PGetParseString(int32 entry, ...);
78 
79  int ParseCommands(const char* text);
80 
81  static ChatCommand* getCommandTable();
82 
83  bool isValidChatMessage(const char* msg);
85  {
86  return sentErrorMessage;
87  }
88  virtual char const* GetName() const;
89  protected:
90  explicit ChatHandler() : m_session(NULL), sentErrorMessage(false) { } // for CLI subclass
91 
92  bool hasStringAbbr(const char* name, const char* part);
93 
94  // function with different implementation for chat/console
95  virtual bool isAvailable(ChatCommand const& cmd) const;
96  virtual bool needReportToTarget(Player* chr) const;
97 
98  void SendGlobalSysMessage(const char* str);
99  void SendGlobalGMSysMessage(const char* str);
100 
101  bool ExecuteCommandInTable(ChatCommand* table, const char* text, const std::string& fullcommand);
102  bool ShowHelpForCommand(ChatCommand* table, const char* cmd);
103  bool ShowHelpForSubCommands(ChatCommand* table, char const* cmd, char const* subcmd);
104 
105  bool HandleAccountCommand(const char* args);
106  bool HandleAccountCreateCommand(const char* args);
107  bool HandleAccountDeleteCommand(const char* args);
108  bool HandleAccountLockCommand(const char* args);
109  bool HandleAccountOnlineListCommand(const char* args);
110  bool HandleAccountPasswordCommand(const char* args);
111  bool HandleAccountSetAddonCommand(const char* args);
112  bool HandleAccountSetGmLevelCommand(const char* args);
113  bool HandleAccountSetPasswordCommand(const char* args);
114 
115  bool HandleHelpCommand(const char* args);
116  bool HandleAHBotOptionsCommand(const char* args);
117  bool HandleCommandsCommand(const char* args);
118  bool HandleStartCommand(const char* args);
119  bool HandleDismountCommand(const char* args);
120  bool HandleSaveCommand(const char* args);
121  bool HandleGMListIngameCommand(const char* args);
122  bool HandleGMListFullCommand(const char* args);
123 
124  bool HandleNamegoCommand(const char* args);
125  bool HandleGonameCommand(const char* args);
126  bool HandleGroupgoCommand(const char* args);
127  bool HandleRecallCommand(const char* args);
128  bool HandleNameAnnounceCommand(const char* args);
129  bool HandleGMNameAnnounceCommand(const char* args);
130  bool HandleAnnounceCommand(const char* args);
131  bool HandleGMAnnounceCommand(const char* args);
132  bool HandleNotifyCommand(const char* args);
133  bool HandleGMNotifyCommand(const char* args);
134  bool HandleGMmodeCommand(const char* args);
135  bool HandleGMChatCommand(const char* args);
136  bool HandleVisibleCommand(const char* args);
137  bool HandleGPSCommand(const char* args);
138  bool HandleTaxiCheatCommand(const char* args);
139  bool HandleWhispersCommand(const char* args);
140  bool HandleNameTeleCommand(const char* args);
141  bool HandleGroupTeleCommand(const char* args);
142  bool HandleDrunkCommand(const char* args);
143  bool HandleSendItemsCommand(const char* args);
144  bool HandleSendMailCommand(const char* args);
145  bool HandleSendMoneyCommand(const char* args);
146 
147  bool HandleDebugPlayCinematicCommand(const char* args);
148  bool HandleDebugPlaySoundCommand(const char* args);
149  bool HandleEventActiveListCommand(const char* args);
150  bool HandleEventStartCommand(const char* args);
151  bool HandleEventStopCommand(const char* args);
152  bool HandleEventInfoCommand(const char* args);
153 
154  bool HandleLearnCommand(const char* args);
155  bool HandleLearnAllCommand(const char* args);
156  bool HandleLearnAllGMCommand(const char* args);
157  bool HandleLearnAllCraftsCommand(const char* args);
158  bool HandleLearnAllRecipesCommand(const char* args);
159  bool HandleLearnAllDefaultCommand(const char* args);
160  bool HandleLearnAllLangCommand(const char* args);
161  bool HandleLearnAllMyClassCommand(const char* args);
162  bool HandleLearnAllMySpellsCommand(const char* args);
163  bool HandleLearnAllMyTalentsCommand(const char* args);
164 
165  bool HandleLookupAreaCommand(const char* args);
166  bool HandleLookupCreatureCommand(const char* args);
167  bool HandleLookupEventCommand(const char* args);
168  bool HandleLookupFactionCommand(const char* args);
169  bool HandleLookupItemCommand(const char* args);
170  bool HandleLookupItemSetCommand(const char* args);
171  bool HandleLookupObjectCommand(const char* args);
172  bool HandleLookupPlayerIpCommand(const char* args);
173  bool HandleLookupPlayerAccountCommand(const char* args);
174  bool HandleLookupPlayerEmailCommand(const char* args);
175  bool HandleLookupQuestCommand(const char* args);
176  bool HandleLookupSkillCommand(const char* args);
177  bool HandleLookupSpellCommand(const char* args);
178  bool HandleLookupTeleCommand(const char* args);
179 
180  bool HandleCharacterTitlesCommand(const char* args);
181  bool HandleTitleCommand(const char* args);
182  bool HandleLookupTitleCommand(const char* args);
183  bool HandleTitlesAddCommand(const char* args);
184  bool HandleTitlesCurrentCommand(const char* args);
185  bool HandleTitlesRemoveCommand(const char* args);
186  bool HandleTitlesSetMaskCommand(const char* args);
187 
188  bool HandleModifyKnownTitlesCommand(const char* args);
189  bool HandleModifyHPCommand(const char* args);
190  bool HandleModifyManaCommand(const char* args);
191  bool HandleModifyRageCommand(const char* args);
192  bool HandleModifyEnergyCommand(const char* args);
193  bool HandleModifyMoneyCommand(const char* args);
194  bool HandleModifyASpeedCommand(const char* args);
195  bool HandleModifySpeedCommand(const char* args);
196  bool HandleModifyBWalkCommand(const char* args);
197  bool HandleModifyFlyCommand(const char* args);
198  bool HandleModifySwimCommand(const char* args);
199  bool HandleModifyScaleCommand(const char* args);
200  bool HandleModifyMountCommand(const char* args);
201  bool HandleModifyBitCommand(const char* args);
202  bool HandleModifyFactionCommand(const char* args);
203  bool HandleModifySpellCommand(const char* args);
204  bool HandleModifyTalentCommand (const char* args);
205  bool HandleModifyHonorCommand (const char* args);
206  bool HandleModifyRepCommand(const char* args);
207  bool HandleModifyArenaCommand(const char* args);
208  bool HandleModifyGenderCommand(const char* args);
209 
210  //-----------------------Npc Commands-----------------------
211  bool HandleNpcAddCommand(const char* args);
212  bool HandleNpcChangeEntryCommand(const char* args);
213  bool HandleNpcDeleteCommand(const char* args);
214  bool HandleNpcFactionIdCommand(const char* args);
215  bool HandleNpcFlagCommand(const char* args);
216  bool HandleNpcFollowCommand(const char* args);
217  bool HandleNpcInfoCommand(const char* args);
218  bool HandleNpcMoveCommand(const char* args);
219  bool HandleNpcPlayEmoteCommand(const char* args);
220  bool HandleNpcSayCommand(const char* args);
221  bool HandleNpcSetModelCommand(const char* args);
222  bool HandleNpcSetMoveTypeCommand(const char* args);
223  bool HandleNpcSpawnDistCommand(const char* args);
224  bool HandleNpcSpawnTimeCommand(const char* args);
225  bool HandleNpcTameCommand(const char* args);
226  bool HandleNpcTextEmoteCommand(const char* args);
227  bool HandleNpcUnFollowCommand(const char* args);
228  bool HandleNpcWhisperCommand(const char* args);
229  bool HandleNpcYellCommand(const char* args);
230  bool HandleNpcSetLinkCommand(const char* args);
231 
232  //----------------------------------------------------------
233 
234  bool HandleReloadCommand(const char* args);
235  bool HandleReloadAllCommand(const char* args);
236  bool HandleReloadAllAreaCommand(const char* args);
237  bool HandleReloadAllItemCommand(const char* args);
238  bool HandleReloadAllLootCommand(const char* args);
239  bool HandleReloadAllNpcCommand(const char* args);
240  bool HandleReloadAllQuestCommand(const char* args);
241  bool HandleReloadAllScriptsCommand(const char* args);
242  bool HandleReloadAllSpellCommand(const char* args);
243  bool HandleReloadAllLocalesCommand(const char* args);
244 
245  bool HandleReloadConfigCommand(const char* args);
246 
247  bool HandleReloadWpScriptsCommand(const char* args);
248  bool HandleReloadAreaTriggerTavernCommand(const char* args);
249  bool HandleReloadAutobroadcastCommand(const char* args);
250  bool HandleReloadAreaTriggerTeleportCommand(const char* args);
251  bool HandleReloadAccessRequirementCommand(const char* args);
252  bool HandleReloadEventScriptsCommand(const char* args);
253  bool HandleReloadEventAITextsCommand(const char* args);
254  bool HandleReloadEventAISummonsCommand(const char* args);
255  bool HandleReloadEventAIScriptsCommand(const char* args);
256  bool HandleReloadCommandCommand(const char* args);
257  bool HandleReloadCreatureQuestRelationsCommand(const char* args);
258  bool HandleReloadCreatureQuestInvRelationsCommand(const char* args);
259  bool HandleReloadCreatureLinkedRespawnCommand(const char* args);
260  bool HandleReloadDbScriptStringCommand(const char* args);
261  bool HandleReloadGameGraveyardZoneCommand(const char* args);
262  bool HandleReloadGameObjectScriptsCommand(const char* args);
263  bool HandleReloadGameTeleCommand(const char* args);
264  bool HandleReloadGossipMenuCommand(const char* args);
265  bool HandleReloadGossipMenuOptionCommand(const char* args);
266  bool HandleReloadGOQuestRelationsCommand(const char* args);
267  bool HandleReloadGOQuestInvRelationsCommand(const char* args);
268  bool HandleReloadLootTemplatesCreatureCommand(const char* args);
269  bool HandleReloadLootTemplatesDisenchantCommand(const char* args);
270  bool HandleReloadLootTemplatesFishingCommand(const char* args);
271  bool HandleReloadLootTemplatesGameobjectCommand(const char* args);
272  bool HandleReloadLootTemplatesItemCommand(const char* args);
273  bool HandleReloadLootTemplatesMailCommand(const char* args);
274  bool HandleReloadLootTemplatesPickpocketingCommand(const char* args);
275  bool HandleReloadLootTemplatesProspectingCommand(const char* args);
276  bool HandleReloadLootTemplatesReferenceCommand(const char* args);
277  bool HandleReloadLootTemplatesSkinningCommand(const char* args);
278  bool HandleReloadOregonStringCommand(const char* args);
279  bool HandleReloadNpcGossipCommand(const char* args);
280  bool HandleReloadNpcTrainerCommand(const char* args);
281  bool HandleReloadNpcVendorCommand(const char* args);
282  bool HandleReloadQuestAreaTriggersCommand(const char* args);
283  bool HandleReloadQuestEndScriptsCommand(const char* args);
284  bool HandleReloadQuestStartScriptsCommand(const char* args);
285  bool HandleReloadQuestTemplateCommand(const char* args);
286  bool HandleReloadReservedNameCommand(const char*);
287  bool HandleReloadReputationSpilloverTemplateCommand(const char* args);
288  bool HandleReloadSkillDiscoveryTemplateCommand(const char* args);
289  bool HandleReloadSkillExtraItemTemplateCommand(const char* args);
290  bool HandleReloadSkillFishingBaseLevelCommand(const char* args);
291  bool HandleReloadSpellAffectCommand(const char* args);
292  bool HandleReloadSpellRequiredCommand(const char* args);
293  bool HandleReloadSpellGroupsCommand(const char* args);
294  bool HandleReloadSpellGroupStackRulesCommand(const char* args);
295  bool HandleReloadSpellLearnSpellCommand(const char* args);
296  bool HandleReloadSpellLinkedSpellCommand(const char* args);
297  bool HandleReloadSpellProcEventCommand(const char* args);
298  bool HandleReloadSpellScriptsCommand(const char* args);
299  bool HandleReloadSpellTargetPositionCommand(const char* args);
300  bool HandleReloadSpellThreatsCommand(const char* args);
301  bool HandleReloadSpellPetAurasCommand(const char* args);
302  bool HandleReloadDisablesCommand(const char* args);
303  bool HandleReloadPageTextsCommand(const char* args);
304  bool HandleReloadItemEnchantementsCommand(const char* args);
305  bool HandleReloadLocalesCreatureCommand(const char* args);
306  bool HandleReloadLocalesGameobjectCommand(const char* args);
307  bool HandleReloadLocalesItemCommand(const char* args);
308  bool HandleReloadLocalesNpcTextCommand(const char* args);
309  bool HandleReloadLocalesPageTextCommand(const char* args);
310  bool HandleReloadLocalesQuestCommand(const char* args);
311  bool HandleReloadAuctionsCommand(const char* args);
312  bool HandleReloadConditions(const char* args);
313 
314  bool HandleInstanceListBindsCommand(const char* args);
315  bool HandleInstanceUnbindCommand(const char* args);
316  bool HandleInstanceStatsCommand(const char* args);
317  bool HandleInstanceSaveDataCommand(const char* args);
318 
319  bool HandleServerCorpsesCommand(const char* args);
320  bool HandleServerExitCommand(const char* args);
321  bool HandleServerIdleRestartCommand(const char* args);
322  bool HandleServerIdleShutDownCommand(const char* args);
323  bool HandleServerInfoCommand(const char* args);
324  bool HandleServerMotdCommand(const char* args);
325  bool HandleServerPLimitCommand(const char* args);
326  bool HandleServerRestartCommand(const char* args);
327  bool HandleServerSetLogMaskCommand(const char* args);
328  bool HandleServerSetMotdCommand(const char* args);
329  bool HandleServerSetDiffTimeCommand(const char* args);
330  bool HandleServerShutDownCommand(const char* args);
331  bool HandleServerShutDownCancelCommand(const char* args);
332 
333  bool HandleAddHonorCommand(const char* args);
334  bool HandleHonorAddKillCommand(const char* args);
335  bool HandleUpdateHonorFieldsCommand(const char* args);
336 
337  bool HandleSendQuestPartyMsgCommand(const char* args);
338  bool HandleSendQuestInvalidMsgCommand(const char* args);
339 
340  bool HandleDebugInArcCommand(const char* args);
341  bool HandleDebugSpellFailCommand(const char* args);
342 
343  bool HandleGUIDCommand(const char* args);
344  bool HandleNameCommand(const char* args);
345  bool HandleSubNameCommand(const char* args);
346  bool HandleItemMoveCommand(const char* args);
347  bool HandleDeMorphCommand(const char* args);
348  bool HandleAddVendorItemCommand(const char* args);
349  bool HandleDelVendorItemCommand(const char* args);
350  bool HandleChangeLevelCommand(const char* args);
351  bool HandleSetPoiCommand(const char* args);
352  bool HandleEquipErrorCommand(const char* args);
353  bool HandleGoCreatureCommand(const char* args);
354  bool HandleGoObjectCommand(const char* args);
355  bool HandleGoTicketCommand(const char* args);
356  bool HandleGoTriggerCommand(const char* args);
357  bool HandleGoGraveyardCommand(const char* args);
358  bool HandleTargetObjectCommand(const char* args);
359  bool HandleDelObjectCommand(const char* args);
360  bool HandleMoveObjectCommand(const char* args);
361  bool HandleTurnObjectCommand(const char* args);
362  bool HandleObjectStateCommand(const char* args);
363  bool HandlePInfoCommand(const char* args);
364  bool HandleMuteCommand(const char* args);
365  bool HandleUnmuteCommand(const char* args);
366  bool HandleMovegensCommand(const char* args);
367  bool HandleFreezeCommand(const char* args);
368  bool HandleUnFreezeCommand(const char* args);
369  bool HandleListFreezeCommand(const char* args);
370 
371  bool HandleBanAccountCommand(const char* args);
372  bool HandleBanCharacterCommand(const char* args);
373  bool HandleBanIPCommand(const char* args);
374  bool HandleUnBanAccountCommand(const char* args);
375  bool HandleUnBanCharacterCommand(const char* args);
376  bool HandleUnBanIPCommand(const char* args);
377  bool HandleBanInfoAccountCommand(const char* args);
378  bool HandleBanInfoCharacterCommand(const char* args);
379  bool HandleBanInfoIPCommand(const char* args);
380  bool HandleBanListAccountCommand(const char* args);
381  bool HandleBanListCharacterCommand(const char* args);
382  bool HandleBanListIPCommand(const char* args);
383  bool HandleGoXYCommand(const char* args);
384  bool HandleGoXYZCommand(const char* args);
385  bool HandleGoZoneXYCommand(const char* args);
386  bool HandleGoGridCommand(const char* args);
387  bool HandleAddWeaponCommand(const char* args);
388  bool HandleAllowMovementCommand(const char* args);
389  bool HandleGoCommand(const char* args);
390 
391  bool HandleCooldownCommand(const char* args);
392  bool HandleUnLearnCommand(const char* args);
393  bool HandleGetDistanceCommand(const char* args);
394  bool HandleGameObjectCommand(const char* args);
395  bool HandleAnimCommand(const char* args);
396  bool HandleStandStateCommand(const char* args);
397  bool HandleDieCommand(const char* args);
398  bool HandleDamageCommand(const char* args);
399  bool HandleReviveCommand(const char* args);
400  bool HandleMorphCommand(const char* args);
401  bool HandleAuraCommand(const char* args);
402  bool HandleUnAuraCommand(const char* args);
403  bool HandleLinkGraveCommand(const char* args);
404  bool HandleNearGraveCommand(const char* args);
405  bool HandleActivateObjectCommand(const char* args);
406  bool HandleSpawnTransportCommand(const char* args);
407  bool HandleHoverCommand(const char* args);
408  bool HandleLevelUpCommand(const char* args);
409  bool HandleShowAreaCommand(const char* args);
410  bool HandleHideAreaCommand(const char* args);
411  bool HandleAddItemCommand(const char* args);
412  bool HandleAddItemSetCommand(const char* args);
413  bool HandlePetTpCommand(const char* args);
414  bool HandlePetUnlearnCommand(const char* args);
415  bool HandlePetLearnCommand(const char* args);
416  bool HandleCreatePetCommand(const char* args);
417 
418  // Cheat Related
419  bool HandlePowerCheatCommand(const char *args);
420  bool HandleCoolDownCheatCommand(const char *args);
421  bool HandleCasttimeCheatCommand(const char *args);
422  bool HandleGodModeCheatCommand(const char *args);
423  bool HandleExploreCheatCommand(const char* args);
424  bool HandleWaterwalkCheatCommand(const char* args);
425 
426  // Group Related
427  bool HandleGroupLeaderCommand(const char* args);
428  bool HandleGroupDisbandCommand(const char* args);
429  bool HandleGroupRemoveCommand(const char* args);
430  bool HandleGroupJoinCommand(const char* args);
431 
432  // Guild Related
433  bool HandleGuildCreateCommand(const char* args);
434  bool HandleGuildInviteCommand(const char* args);
435  bool HandleGuildUninviteCommand(const char* args);
436  bool HandleGuildRankCommand(const char* args);
437  bool HandleGuildDeleteCommand(const char* args);
438 
439  bool HandleUpdate(const char* args);
440  bool HandleBankCommand(const char* args);
441  bool HandleChangeWeather(const char* args);
442  bool HandleKickPlayerCommand(const char* args);
443  bool HandleTeleCommand(const char* args);
444  bool HandleAddTeleCommand(const char* args);
445  bool HandleDelTeleCommand(const char* args);
446  bool HandleListAurasCommand(const char* args);
447 
448  // Reset commands
449  bool HandleResetHonorCommand(const char* args);
450  bool HandleResetLevelCommand(const char* args);
451  bool HandleResetSpellsCommand(const char* args);
452  bool HandleResetStatsCommand(const char* args);
453  bool HandleResetTalentsCommand(const char* args);
454  bool HandleResetAllCommand(const char* args);
455 
456 
457  // GM ticket command handlers
458  bool HandleGMTicketListCommand(const char* args);
459  bool HandleGMTicketListOnlineCommand(const char* args);
460  bool HandleGMTicketListClosedCommand(const char* args);
461  bool HandleGMTicketGetByIdCommand(const char* args);
462  bool HandleGMTicketGetByNameCommand(const char* args);
463  bool HandleGMTicketCloseByIdCommand(const char* args);
464  bool HandleGMTicketAssignToCommand(const char* args);
465  bool HandleGMTicketUnAssignCommand(const char* args);
466  bool HandleGMTicketCommentCommand(const char* args);
467  bool HandleGMTicketDeleteByIdCommand(const char* args);
468  bool HandleGMTicketReloadCommand(const char*);
469 
470  bool HandleMaxSkillCommand(const char* args);
471  bool HandleSetSkillCommand(const char* args);
472  bool HandleListCreatureCommand(const char* args);
473  bool HandleListItemCommand(const char* args);
474  bool HandleListObjectCommand(const char* args);
475  bool HandleNearObjectCommand(const char* args);
476  bool HandleRespawnCommand(const char* args);
477 
478  //New Wp Commands
479  bool HandleWpAddCommand(const char* args);
480  bool HandleWpLoadPathCommand(const char* args);
481  bool HandleWpUnLoadPathCommand(const char* args);
482  bool HandleWpModifyCommand(const char* args);
483  bool HandleWpEventCommand(const char* args);
484  bool HandleWpShowCommand(const char* args);
485  bool HandleReloadAllPaths(const char* args);
486 
487  bool HandleFlyModeCommand(const char* args);
488  bool HandleSendOpcodeCommand(const char* args);
489  bool HandleSellErrorCommand(const char* args);
490  bool HandleBuyErrorCommand(const char* args);
491  bool HandleUpdateWorldStateCommand(const char* args);
492  bool HandleSendChannelNotifyCommand(const char* args);
493  bool HandleSendChatMsgCommand(const char* args);
494  bool HandleLoadPDumpCommand(const char* args);
495  bool HandleWritePDumpCommand(const char* args);
496  bool HandleCastCommand(const char* args);
497  bool HandleCastBackCommand(const char* args);
498  bool HandleCastDistCommand(const char* args);
499  bool HandleCastSelfCommand(const char* args);
500  bool HandleCastTargetCommand(const char* args);
501  bool HandleCharacterDeletedDeleteCommand(const char* args);
502  bool HandleCharacterDeletedListCommand(const char* args);
503  bool HandleCharacterDeletedRestoreCommand(const char* args);
504  bool HandleCharacterDeletedOldCommand(const char* args);
505  bool HandleCharacterEraseCommand(const char* args);
506  bool HandleCharacterRenameCommand(const char* args);
507  bool HandleComeToMeCommand(const char* args);
508  bool HandleCombatStopCommand(const char* args);
509  bool HandleCharDeleteCommand(const char* args);
510  bool HandleSendMessageCommand(const char* args);
511  bool HandleFlushArenaPointsCommand(const char* args);
512  bool HandlePlayAllCommand(const char* args);
513  bool HandleRepairitemsCommand(const char* args);
514 
515  bool HandleTempGameObjectCommand(const char* args);
516  bool HandleTempAddSpwCommand(const char* args);
517 
518  // Refer-A-Friend
519  bool HandleRAFInfoCommand(const char* args);
520  bool HandleRAFLinkCommand(const char* args);
521  bool HandleRAFUnlinkCommand(const char* args);
522  bool HandleRAFSummonCommand(const char* args);
523  bool HandleRAFGrantLevelCommand(const char* args);
524  bool HandleRAFReloadCommand(const char* args);
525 
527  bool HandleSetValue(const char* args);
528  bool HandleGetValue(const char* args);
529  bool HandleSet32Bit(const char* args);
530  bool HandleMod32Value(const char* args);
531  bool HandleAddQuest(const char* args);
532  bool HandleRemoveQuest(const char* args);
533  bool HandleCompleteQuest(const char* args);
534  bool HandleSaveAllCommand(const char* args);
535  bool HandleGetItemState(const char* args);
536  bool HandleGetLootRecipient(const char* args);
537  bool HandleDebugArenaCommand(const char* args);
538  bool HandleDebugBattlegroundCommand(const char* args);
539  bool HandleDebugThreatList(const char* args);
540  bool HandleDebugHostilRefList(const char* args);
541  bool HandlePossessCommand(const char* args);
542  bool HandleUnPossessCommand(const char* args);
543  bool HandleBindSightCommand(const char* args);
544  bool HandleUnbindSightCommand(const char* args);
545  bool HandleSetInstanceDataCommand(const char* args);
546  bool HandleGetInstanceDataCommand(const char* args);
547  bool HandleDebugRAFError(const char* args);
548  bool HandleSpellCrashTestCommand(const char* args);
549  bool HandlePartyResultCommand(const char* args);
550  bool HandleDebugAnimationCommand(const char* args);
551 
552  Player* getSelectedPlayer();
553  Player* getSelectedPlayerOrSelf();
554  Creature* getSelectedCreature();
555  Unit* getSelectedUnit();
556 
557  char* extractKeyFromLink(char* text, char const* linkType, char** something1 = NULL);
558  char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = NULL);
559  uint32 extractSpellIdFromLink(char* text);
560  GameTele const* extractGameTeleFromLink(char* text);
561  bool GetPlayerGroupAndGUIDByName(const char* cname, Player*& plr, Group*& group, uint64& guid, bool offline = false);
562 
563  GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry);
564 
565  // Utility methods for commands
566  bool LookupPlayerSearchCommand(QueryResult_AutoPtr result, int32 limit);
567  bool HandleBanListHelper(QueryResult_AutoPtr result);
568  bool HandleBanHelper(BanMode mode, char const* args);
569  bool HandleBanInfoHelper(uint32 accountid, char const* accountname);
570  bool HandleUnBanHelper(BanMode mode, char const* args);
571 
575  struct DeletedInfo
576  {
578  std::string name;
580  std::string accountName;
581  time_t deleteDate;
582  };
583 
584  typedef std::list<DeletedInfo> DeletedInfoList;
585  bool GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::string searchString = "");
586  std::string GenerateDeletedCharacterGUIDsWhereStr(DeletedInfoList::const_iterator& itr, DeletedInfoList::const_iterator const& itr_end);
587  void HandleCharacterDeletedListHelper(DeletedInfoList const& foundList);
588  void HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo);
589 
590  void SetSentErrorMessage(bool val)
591  {
592  sentErrorMessage = val;
593  };
594  private:
595  WorldSession* m_session; // != NULL for chat command call and NULL for CLI command
596 
597  // common global flag
598  static bool load_command_table;
600 };
601 
602 class CliHandler : public ChatHandler
603 {
604  public:
605  typedef void Print(void*, char const*);
606  explicit CliHandler(void* callbackArg, Print* zprint) : m_callbackArg(callbackArg), m_print(zprint) {}
607 
608  // overwrite functions
609  const char* GetOregonString(int32 entry) const;
610  bool isAvailable(ChatCommand const& cmd) const;
611  void SendSysMessage(const char* str);
612  char const* GetName() const;
613  bool needReportToTarget(Player* chr) const;
614 
615  private:
617  Print* m_print;
618 };
619 
620 char const* fmtstring(char const* format, ...);
621 
622 #endif
623 
void SetSentErrorMessage(bool val)
Definition: Chat.h:590
ChatHandler(WorldSession *session)
Definition: Chat.h:45
const char * Name
Definition: Chat.h:34
static bool load_command_table
Definition: Chat.h:598
static char * LineFromMessage(char *&pos)
Definition: Chat.h:61
void FillMessageData(WorldPacket *data, uint8 type, uint32 language, uint64 target_guid, const char *message)
Definition: Chat.h:51
~ChatHandler()
Definition: Chat.h:47
char const * fmtstring(char const *format,...)
Definition: Chat.cpp:1746
ChatCommand * ChildCommands
Definition: Chat.h:39
std::string accountName
the account name
Definition: Chat.h:580
ACE_INT32 int32
Definition: Define.h:67
NULL Dbg ErrDB Arena Chat Char Map MMap false
Definition: Log.cpp:556
uint32 SecurityLevel
Definition: Chat.h:35
BanMode
void Print(void *, char const *)
Definition: Chat.h:605
std::string Help
Definition: Chat.h:38
WorldSession * m_session
Definition: Chat.h:593
time_t deleteDate
the date at which the character has been deleted
Definition: Chat.h:581
CliHandler(void *callbackArg, Print *zprint)
Definition: Chat.h:606
#define ATTR_PRINTF(F, V)
Definition: Define.h:60
Print * m_print
Definition: Chat.h:617
ACE_UINT8 uint8
Definition: Define.h:73
const AuthHandler table[]
Definition: AuthSocket.cpp:149
bool sentErrorMessage
Definition: Chat.h:599
void FillSystemMessageData(WorldPacket *data, const char *message)
Definition: Chat.h:56
uint32 accountId
the account id
Definition: Chat.h:579
ChatHandler()
Definition: Chat.h:90
ACE_UINT64 uint64
Definition: Define.h:70
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
std::list< DeletedInfo > DeletedInfoList
Definition: Chat.h:584
uint32 lowguid
the low GUID from the character
Definition: Chat.h:577
std::string name
the character name
Definition: Chat.h:578
bool HasSentErrorMessage()
Definition: Chat.h:84
ChatHandler(Player *player)
Definition: Chat.h:46
ACE_UINT32 uint32
Definition: Define.h:71
Definition: Unit.h:884
Definition: Player.h:922
bool AllowConsole
Definition: Chat.h:36
Definition: Group.h:154
bool(ChatHandler::* Handler)(const char *args)
Definition: Chat.h:37
void * m_callbackArg
Definition: Chat.h:616