OregonCore  revision 71a6c59-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 HandleSummonCommand(const char* args);
125  bool HandleAppearCommand(const char* args);
126  bool HandleGroupSummonCommand(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 HandleModifyPhaseCommand(const char* args);
209  bool HandleModifyGenderCommand(const char* args);
210 
211  //-----------------------Npc Commands-----------------------
212  bool HandleNpcAddCommand(const char* args);
213  bool HandleNpcChangeEntryCommand(const char* args);
214  bool HandleNpcDeleteCommand(const char* args);
215  bool HandleNpcFactionIdCommand(const char* args);
216  bool HandleNpcFlagCommand(const char* args);
217  bool HandleNpcFollowCommand(const char* args);
218  bool HandleNpcInfoCommand(const char* args);
219  bool HandleNpcMoveCommand(const char* args);
220  bool HandleNpcPlayEmoteCommand(const char* args);
221  bool HandleNpcSayCommand(const char* args);
222  bool HandleNpcSetModelCommand(const char* args);
223  bool HandleNpcSetMoveTypeCommand(const char* args);
224  bool HandleNpcSetPhaseCommand(const char* args);
225  bool HandleNpcSpawnDistCommand(const char* args);
226  bool HandleNpcSpawnTimeCommand(const char* args);
227  bool HandleNpcTameCommand(const char* args);
228  bool HandleNpcTextEmoteCommand(const char* args);
229  bool HandleNpcUnFollowCommand(const char* args);
230  bool HandleNpcWhisperCommand(const char* args);
231  bool HandleNpcYellCommand(const char* args);
232  bool HandleNpcSetLinkCommand(const char* args);
233 
234  //----------------------------------------------------------
235 
236  bool HandleReloadCommand(const char* args);
237  bool HandleReloadAllCommand(const char* args);
238  bool HandleReloadAllAreaCommand(const char* args);
239  bool HandleReloadAllItemCommand(const char* args);
240  bool HandleReloadAllLootCommand(const char* args);
241  bool HandleReloadAllNpcCommand(const char* args);
242  bool HandleReloadAllQuestCommand(const char* args);
243  bool HandleReloadAllScriptsCommand(const char* args);
244  bool HandleReloadAllSpellCommand(const char* args);
245  bool HandleReloadAllLocalesCommand(const char* args);
246 
247  bool HandleReloadConfigCommand(const char* args);
248 
249  bool HandleReloadWpScriptsCommand(const char* args);
250  bool HandleReloadAreaTriggerTavernCommand(const char* args);
251  bool HandleReloadAutobroadcastCommand(const char* args);
252  bool HandleReloadAreaTriggerTeleportCommand(const char* args);
253  bool HandleReloadAccessRequirementCommand(const char* args);
254  bool HandleReloadEventScriptsCommand(const char* args);
255  bool HandleReloadEventAITextsCommand(const char* args);
256  bool HandleReloadEventAISummonsCommand(const char* args);
257  bool HandleReloadEventAIScriptsCommand(const char* args);
258  bool HandleReloadCommandCommand(const char* args);
259  bool HandleReloadCreatureQuestStarterCommand(const char* args);
260  bool HandleReloadCreatureQuestEnderCommand(const char* args);
261  bool HandleReloadCreatureLinkedRespawnCommand(const char* args);
262  bool HandleReloadDbScriptStringCommand(const char* args);
263  bool HandleReloadGameGraveyardZoneCommand(const char* args);
264  bool HandleReloadGameObjectScriptsCommand(const char* args);
265  bool HandleReloadGameTeleCommand(const char* args);
266  bool HandleReloadGossipMenuCommand(const char* args);
267  bool HandleReloadGossipMenuOptionCommand(const char* args);
268  bool HandleReloadGOQuestStarterCommand(const char* args);
269  bool HandleReloadGOQuestEnderCommand(const char* args);
270  bool HandleReloadLootTemplatesCreatureCommand(const char* args);
271  bool HandleReloadLootTemplatesDisenchantCommand(const char* args);
272  bool HandleReloadLootTemplatesFishingCommand(const char* args);
273  bool HandleReloadLootTemplatesGameobjectCommand(const char* args);
274  bool HandleReloadLootTemplatesItemCommand(const char* args);
275  bool HandleReloadLootTemplatesMailCommand(const char* args);
276  bool HandleReloadLootTemplatesPickpocketingCommand(const char* args);
277  bool HandleReloadLootTemplatesProspectingCommand(const char* args);
278  bool HandleReloadLootTemplatesReferenceCommand(const char* args);
279  bool HandleReloadLootTemplatesSkinningCommand(const char* args);
280  bool HandleReloadOregonStringCommand(const char* args);
281  bool HandleReloadNpcGossipCommand(const char* args);
282  bool HandleReloadNpcTrainerCommand(const char* args);
283  bool HandleReloadNpcVendorCommand(const char* args);
284  bool HandleReloadQuestAreaTriggersCommand(const char* args);
285  bool HandleReloadQuestEndScriptsCommand(const char* args);
286  bool HandleReloadQuestStartScriptsCommand(const char* args);
287  bool HandleReloadQuestTemplateCommand(const char* args);
288  bool HandleReloadReservedNameCommand(const char*);
289  bool HandleReloadReputationSpilloverTemplateCommand(const char* args);
290  bool HandleReloadSkillDiscoveryTemplateCommand(const char* args);
291  bool HandleReloadSkillExtraItemTemplateCommand(const char* args);
292  bool HandleReloadSkillFishingBaseLevelCommand(const char* args);
293  bool HandleReloadSpellAffectCommand(const char* args);
294  bool HandleReloadSpellRequiredCommand(const char* args);
295  bool HandleReloadSpellGroupsCommand(const char* args);
296  bool HandleReloadSpellGroupStackRulesCommand(const char* args);
297  bool HandleReloadSpellLearnSpellCommand(const char* args);
298  bool HandleReloadSpellLinkedSpellCommand(const char* args);
299  bool HandleReloadSpellProcEventCommand(const char* args);
300  bool HandleReloadSpellScriptsCommand(const char* args);
301  bool HandleReloadSpellTargetPositionCommand(const char* args);
302  bool HandleReloadSpellThreatsCommand(const char* args);
303  bool HandleReloadSpellPetAurasCommand(const char* args);
304  bool HandleReloadDisablesCommand(const char* args);
305  bool HandleReloadPageTextsCommand(const char* args);
306  bool HandleReloadItemEnchantementsCommand(const char* args);
307  bool HandleReloadLocalesCreatureCommand(const char* args);
308  bool HandleReloadLocalesGameobjectCommand(const char* args);
309  bool HandleReloadLocalesItemCommand(const char* args);
310  bool HandleReloadLocalesNpcTextCommand(const char* args);
311  bool HandleReloadLocalesPageTextCommand(const char* args);
312  bool HandleReloadLocalesQuestCommand(const char* args);
313  bool HandleReloadAuctionsCommand(const char* args);
314  bool HandleReloadConditions(const char* args);
315 
316  bool HandleInstanceListBindsCommand(const char* args);
317  bool HandleInstanceUnbindCommand(const char* args);
318  bool HandleInstanceStatsCommand(const char* args);
319  bool HandleInstanceSaveDataCommand(const char* args);
320 
321  bool HandleServerCorpsesCommand(const char* args);
322  bool HandleServerExitCommand(const char* args);
323  bool HandleServerIdleRestartCommand(const char* args);
324  bool HandleServerIdleShutDownCommand(const char* args);
325  bool HandleServerInfoCommand(const char* args);
326  bool HandleServerMotdCommand(const char* args);
327  bool HandleServerPLimitCommand(const char* args);
328  bool HandleServerRestartCommand(const char* args);
329  bool HandleServerSetLogMaskCommand(const char* args);
330  bool HandleServerSetMotdCommand(const char* args);
331  bool HandleServerSetDiffTimeCommand(const char* args);
332  bool HandleServerShutDownCommand(const char* args);
333  bool HandleServerShutDownCancelCommand(const char* args);
334 
335  bool HandleAddHonorCommand(const char* args);
336  bool HandleHonorAddKillCommand(const char* args);
337  bool HandleUpdateHonorFieldsCommand(const char* args);
338 
339  bool HandleSendQuestPartyMsgCommand(const char* args);
340  bool HandleSendQuestInvalidMsgCommand(const char* args);
341 
342  bool HandleDebugInArcCommand(const char* args);
343  bool HandleDebugSpellFailCommand(const char* args);
344 
345  bool HandleGUIDCommand(const char* args);
346  bool HandleNameCommand(const char* args);
347  bool HandleSubNameCommand(const char* args);
348  bool HandleItemMoveCommand(const char* args);
349  bool HandleDeMorphCommand(const char* args);
350  bool HandleAddVendorItemCommand(const char* args);
351  bool HandleDelVendorItemCommand(const char* args);
352  bool HandleChangeLevelCommand(const char* args);
353  bool HandleSetPoiCommand(const char* args);
354  bool HandleEquipErrorCommand(const char* args);
355  bool HandleGoCreatureCommand(const char* args);
356  bool HandleGoObjectCommand(const char* args);
357  bool HandleGoTicketCommand(const char* args);
358  bool HandleGoTriggerCommand(const char* args);
359  bool HandleGoGraveyardCommand(const char* args);
360  bool HandleTargetObjectCommand(const char* args);
361  bool HandleDelObjectCommand(const char* args);
362  bool HandleMoveObjectCommand(const char* args);
363  bool HandleGOPhaseCommand(const char* args);
364  bool HandleTurnObjectCommand(const char* args);
365  bool HandleObjectStateCommand(const char* args);
366  bool HandlePInfoCommand(const char* args);
367  bool HandleMuteCommand(const char* args);
368  bool HandleUnmuteCommand(const char* args);
369  bool HandleMovegensCommand(const char* args);
370  bool HandleFreezeCommand(const char* args);
371  bool HandleUnFreezeCommand(const char* args);
372  bool HandleListFreezeCommand(const char* args);
373 
374  bool HandleBanAccountCommand(const char* args);
375  bool HandleBanCharacterCommand(const char* args);
376  bool HandleBanIPCommand(const char* args);
377  bool HandleUnBanAccountCommand(const char* args);
378  bool HandleUnBanCharacterCommand(const char* args);
379  bool HandleUnBanIPCommand(const char* args);
380  bool HandleBanInfoAccountCommand(const char* args);
381  bool HandleBanInfoCharacterCommand(const char* args);
382  bool HandleBanInfoIPCommand(const char* args);
383  bool HandleBanListAccountCommand(const char* args);
384  bool HandleBanListCharacterCommand(const char* args);
385  bool HandleBanListIPCommand(const char* args);
386  bool HandleGoXYCommand(const char* args);
387  bool HandleGoXYZCommand(const char* args);
388  bool HandleGoZoneXYCommand(const char* args);
389  bool HandleGoGridCommand(const char* args);
390  bool HandleAddWeaponCommand(const char* args);
391  bool HandleAllowMovementCommand(const char* args);
392  bool HandleGoCommand(const char* args);
393 
394  bool HandleCooldownCommand(const char* args);
395  bool HandleUnLearnCommand(const char* args);
396  bool HandleGetDistanceCommand(const char* args);
397  bool HandleGameObjectCommand(const char* args);
398  bool HandleAnimCommand(const char* args);
399  bool HandleStandStateCommand(const char* args);
400  bool HandleDieCommand(const char* args);
401  bool HandleDamageCommand(const char* args);
402  bool HandleReviveCommand(const char* args);
403  bool HandleMorphCommand(const char* args);
404  bool HandleAuraCommand(const char* args);
405  bool HandleUnAuraCommand(const char* args);
406  bool HandleLinkGraveCommand(const char* args);
407  bool HandleNearGraveCommand(const char* args);
408  bool HandleActivateObjectCommand(const char* args);
409  bool HandleSpawnTransportCommand(const char* args);
410  bool HandleHoverCommand(const char* args);
411  bool HandleLevelUpCommand(const char* args);
412  bool HandleShowAreaCommand(const char* args);
413  bool HandleHideAreaCommand(const char* args);
414  bool HandleAddItemCommand(const char* args);
415  bool HandleAddItemSetCommand(const char* args);
416  bool HandlePetTpCommand(const char* args);
417  bool HandlePetUnlearnCommand(const char* args);
418  bool HandlePetLearnCommand(const char* args);
419  bool HandleCreatePetCommand(const char* args);
420 
421  // Cheat Related
422  bool HandlePowerCheatCommand(const char *args);
423  bool HandleCoolDownCheatCommand(const char *args);
424  bool HandleCasttimeCheatCommand(const char *args);
425  bool HandleGodModeCheatCommand(const char *args);
426  bool HandleExploreCheatCommand(const char* args);
427  bool HandleWaterwalkCheatCommand(const char* args);
428 
429  // Group Related
430  bool HandleGroupLeaderCommand(const char* args);
431  bool HandleGroupDisbandCommand(const char* args);
432  bool HandleGroupRemoveCommand(const char* args);
433  bool HandleGroupJoinCommand(const char* args);
434 
435  // Guild Related
436  bool HandleGuildCreateCommand(const char* args);
437  bool HandleGuildInviteCommand(const char* args);
438  bool HandleGuildUninviteCommand(const char* args);
439  bool HandleGuildRankCommand(const char* args);
440  bool HandleGuildDeleteCommand(const char* args);
441 
442  bool HandleUpdate(const char* args);
443  bool HandleBankCommand(const char* args);
444  bool HandleChangeWeather(const char* args);
445  bool HandleKickPlayerCommand(const char* args);
446  bool HandleTeleCommand(const char* args);
447  bool HandleAddTeleCommand(const char* args);
448  bool HandleDelTeleCommand(const char* args);
449  bool HandleListAurasCommand(const char* args);
450 
451  // Reset commands
452  bool HandleResetHonorCommand(const char* args);
453  bool HandleResetLevelCommand(const char* args);
454  bool HandleResetSpellsCommand(const char* args);
455  bool HandleResetStatsCommand(const char* args);
456  bool HandleResetTalentsCommand(const char* args);
457  bool HandleResetAllCommand(const char* args);
458 
459 
460  // GM ticket command handlers
461  bool HandleGMTicketListCommand(const char* args);
462  bool HandleGMTicketListOnlineCommand(const char* args);
463  bool HandleGMTicketListClosedCommand(const char* args);
464  bool HandleGMTicketGetByIdCommand(const char* args);
465  bool HandleGMTicketGetByNameCommand(const char* args);
466  bool HandleGMTicketCloseByIdCommand(const char* args);
467  bool HandleGMTicketAssignToCommand(const char* args);
468  bool HandleGMTicketUnAssignCommand(const char* args);
469  bool HandleGMTicketCommentCommand(const char* args);
470  bool HandleGMTicketDeleteByIdCommand(const char* args);
471  bool HandleGMTicketReloadCommand(const char*);
472 
473  bool HandleMaxSkillCommand(const char* args);
474  bool HandleSetSkillCommand(const char* args);
475  bool HandleListCreatureCommand(const char* args);
476  bool HandleListItemCommand(const char* args);
477  bool HandleListObjectCommand(const char* args);
478  bool HandleNearObjectCommand(const char* args);
479  bool HandleRespawnCommand(const char* args);
480 
481  //New Wp Commands
482  bool HandleWpAddCommand(const char* args);
483  bool HandleWpLoadPathCommand(const char* args);
484  bool HandleWpUnLoadPathCommand(const char* args);
485  bool HandleWpModifyCommand(const char* args);
486  bool HandleWpEventCommand(const char* args);
487  bool HandleWpShowCommand(const char* args);
488  bool HandleReloadAllPaths(const char* args);
489 
490  bool HandleFlyModeCommand(const char* args);
491  bool HandleSendOpcodeCommand(const char* args);
492  bool HandleSellErrorCommand(const char* args);
493  bool HandleBuyErrorCommand(const char* args);
494  bool HandleUpdateWorldStateCommand(const char* args);
495  bool HandleSendChannelNotifyCommand(const char* args);
496  bool HandleSendChatMsgCommand(const char* args);
497  bool HandleLoadPDumpCommand(const char* args);
498  bool HandleWritePDumpCommand(const char* args);
499  bool HandleCastCommand(const char* args);
500  bool HandleCastBackCommand(const char* args);
501  bool HandleCastDistCommand(const char* args);
502  bool HandleCastSelfCommand(const char* args);
503  bool HandleCastTargetCommand(const char* args);
504  bool HandleCharacterDeletedDeleteCommand(const char* args);
505  bool HandleCharacterDeletedListCommand(const char* args);
506  bool HandleCharacterDeletedRestoreCommand(const char* args);
507  bool HandleCharacterDeletedOldCommand(const char* args);
508  bool HandleCharacterEraseCommand(const char* args);
509  bool HandleCharacterRenameCommand(const char* args);
510  bool HandleComeToMeCommand(const char* args);
511  bool HandleCombatStopCommand(const char* args);
512  bool HandleCharDeleteCommand(const char* args);
513  bool HandleSendMessageCommand(const char* args);
514  bool HandleFlushArenaPointsCommand(const char* args);
515  bool HandlePlayAllCommand(const char* args);
516  bool HandleRepairitemsCommand(const char* args);
517 
518  bool HandleTempGameObjectCommand(const char* args);
519  bool HandleTempAddSpwCommand(const char* args);
520 
521  // Refer-A-Friend
522  bool HandleRAFInfoCommand(const char* args);
523  bool HandleRAFLinkCommand(const char* args);
524  bool HandleRAFUnlinkCommand(const char* args);
525  bool HandleRAFSummonCommand(const char* args);
526  bool HandleRAFGrantLevelCommand(const char* args);
527  bool HandleRAFReloadCommand(const char* args);
528 
530  bool HandleSetValue(const char* args);
531  bool HandleGetValue(const char* args);
532  bool HandleSet32Bit(const char* args);
533  bool HandleMod32Value(const char* args);
534  bool HandleAddQuest(const char* args);
535  bool HandleRemoveQuest(const char* args);
536  bool HandleCompleteQuest(const char* args);
537  bool HandleSaveAllCommand(const char* args);
538  bool HandleGetItemState(const char* args);
539  bool HandleGetLootRecipient(const char* args);
540  bool HandleDebugArenaCommand(const char* args);
541  bool HandleDebugBattlegroundCommand(const char* args);
542  bool HandleDebugThreatList(const char* args);
543  bool HandleDebugHostilRefList(const char* args);
544  bool HandlePossessCommand(const char* args);
545  bool HandleUnPossessCommand(const char* args);
546  bool HandleBindSightCommand(const char* args);
547  bool HandleUnbindSightCommand(const char* args);
548  bool HandleSetInstanceDataCommand(const char* args);
549  bool HandleGetInstanceDataCommand(const char* args);
550  bool HandleDebugRAFError(const char* args);
551  bool HandleSpellCrashTestCommand(const char* args);
552  bool HandlePartyResultCommand(const char* args);
553  bool HandleDebugAnimationCommand(const char* args);
554 
555  Player* getSelectedPlayer();
556  Player* getSelectedPlayerOrSelf();
557  Creature* getSelectedCreature();
558  Unit* getSelectedUnit();
559 
560  char* extractKeyFromLink(char* text, char const* linkType, char** something1 = NULL);
561  char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = NULL);
562  uint32 extractSpellIdFromLink(char* text);
563  GameTele const* extractGameTeleFromLink(char* text);
564  bool GetPlayerGroupAndGUIDByName(const char* cname, Player*& plr, Group*& group, uint64& guid, bool offline = false);
565 
566  GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry);
567 
568  // Utility methods for commands
569  bool LookupPlayerSearchCommand(QueryResult_AutoPtr result, int32 limit);
570  bool HandleBanListHelper(QueryResult_AutoPtr result);
571  bool HandleBanHelper(BanMode mode, char const* args);
572  bool HandleBanInfoHelper(uint32 accountid, char const* accountname);
573  bool HandleUnBanHelper(BanMode mode, char const* args);
574 
578  struct DeletedInfo
579  {
581  std::string name;
583  std::string accountName;
584  time_t deleteDate;
585  };
586 
587  typedef std::list<DeletedInfo> DeletedInfoList;
588  bool GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::string searchString = "");
589  std::string GenerateDeletedCharacterGUIDsWhereStr(DeletedInfoList::const_iterator& itr, DeletedInfoList::const_iterator const& itr_end);
590  void HandleCharacterDeletedListHelper(DeletedInfoList const& foundList);
591  void HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo);
592 
593  void SetSentErrorMessage(bool val)
594  {
595  sentErrorMessage = val;
596  };
597  private:
598  WorldSession* m_session; // != NULL for chat command call and NULL for CLI command
599 
600  // common global flag
601  static bool load_command_table;
603 };
604 
605 class CliHandler : public ChatHandler
606 {
607  public:
608  typedef void Print(void*, char const*);
609  explicit CliHandler(void* callbackArg, Print* zprint) : m_callbackArg(callbackArg), m_print(zprint) {}
610 
611  // overwrite functions
612  const char* GetOregonString(int32 entry) const;
613  bool isAvailable(ChatCommand const& cmd) const;
614  void SendSysMessage(const char* str);
615  char const* GetName() const;
616  bool needReportToTarget(Player* chr) const;
617 
618  private:
620  Print* m_print;
621 };
622 
623 char const* fmtstring(char const* format, ...);
624 
625 #endif
626 
void SetSentErrorMessage(bool val)
Definition: Chat.h:593
ChatHandler(WorldSession *session)
Definition: Chat.h:45
const char * Name
Definition: Chat.h:34
static bool load_command_table
Definition: Chat.h:601
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:1749
ChatCommand * ChildCommands
Definition: Chat.h:39
std::string accountName
the account name
Definition: Chat.h:583
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:608
std::string Help
Definition: Chat.h:38
WorldSession * m_session
Definition: Chat.h:596
time_t deleteDate
the date at which the character has been deleted
Definition: Chat.h:584
CliHandler(void *callbackArg, Print *zprint)
Definition: Chat.h:609
#define ATTR_PRINTF(F, V)
Definition: Define.h:60
Print * m_print
Definition: Chat.h:620
ACE_UINT8 uint8
Definition: Define.h:73
const AuthHandler table[]
Definition: AuthSocket.cpp:149
bool sentErrorMessage
Definition: Chat.h:602
void FillSystemMessageData(WorldPacket *data, const char *message)
Definition: Chat.h:56
uint32 accountId
the account id
Definition: Chat.h:582
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:587
uint32 lowguid
the low GUID from the character
Definition: Chat.h:580
std::string name
the character name
Definition: Chat.h:581
bool HasSentErrorMessage()
Definition: Chat.h:84
ChatHandler(Player *player)
Definition: Chat.h:46
ACE_UINT32 uint32
Definition: Define.h:71
Definition: Unit.h:908
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:619