2 * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef MANGOSSERVER_CHAT_H
20 #define MANGOSSERVER_CHAT_H
22 #include "SharedDefines.h"
35 uint32 SecurityLevel
; // function pointer required correct align (use uint32)
37 bool (ChatHandler::*Handler
)(const char* args
);
39 ChatCommand
* ChildCommands
;
45 explicit ChatHandler(WorldSession
* session
) : m_session(session
) {}
46 explicit ChatHandler(Player
* player
) : m_session(player
->GetSession()) {}
49 static void FillMessageData( WorldPacket
*data
, WorldSession
* session
, uint8 type
, uint32 language
, const char *channelName
, uint64 target_guid
, const char *message
, Unit
*speaker
);
51 void FillMessageData( WorldPacket
*data
, uint8 type
, uint32 language
, uint64 target_guid
, const char* message
)
53 FillMessageData( data
, m_session
, type
, language
, NULL
, target_guid
, message
, NULL
);
56 void FillSystemMessageData( WorldPacket
*data
, const char* message
)
58 FillMessageData( data
, CHAT_MSG_SYSTEM
, LANG_UNIVERSAL
, 0, message
);
61 static char* LineFromMessage(char*& pos
) { char* start
= strtok(pos
,"\n"); pos
= NULL
; return start
; }
63 virtual const char *GetMangosString(int32 entry
) const;
65 virtual void SendSysMessage( const char *str
);
66 void SendSysMessage( int32 entry
);
67 void PSendSysMessage( const char *format
, ...) ATTR_PRINTF(2,3);
68 void PSendSysMessage( int32 entry
, ... );
70 int ParseCommands(const char* text
);
72 explicit ChatHandler() : m_session(NULL
) {} // for CLI subclass
74 bool hasStringAbbr(const char* name
, const char* part
);
76 virtual bool isAvailable(ChatCommand
const& cmd
) const;
77 virtual bool needReportToTarget(Player
* chr
) const;
78 bool HasLowerSecurity(Player
* target
, uint64 guid
, bool strong
= false);
79 bool HasLowerSecurityAccount(WorldSession
* target
, uint32 account
, bool strong
= false);
81 void SendGlobalSysMessage(const char *str
);
83 bool SetDataForCommandInTable(ChatCommand
*table
, const char* text
, uint32 security
, std::string
const& help
, std::string
const& fullcommand
);
84 bool ExecuteCommandInTable(ChatCommand
*table
, const char* text
, const std::string
& fullcommand
);
85 bool ShowHelpForCommand(ChatCommand
*table
, const char* cmd
);
86 bool ShowHelpForSubCommands(ChatCommand
*table
, char const* cmd
, char const* subcmd
);
88 ChatCommand
* getCommandTable();
90 bool HandleAccountCommand(const char* args
);
91 bool HandleAccountCreateCommand(const char* args
);
92 bool HandleAccountDeleteCommand(const char* args
);
93 bool HandleAccountLockCommand(const char* args
);
94 bool HandleAccountOnlineListCommand(const char* args
);
95 bool HandleAccountPasswordCommand(const char* args
);
96 bool HandleAccountSetAddonCommand(const char* args
);
97 bool HandleAccountSetGmLevelCommand(const char* args
);
98 bool HandleAccountSetPasswordCommand(const char* args
);
100 bool HandleBanAccountCommand(const char* args
);
101 bool HandleBanCharacterCommand(const char* args
);
102 bool HandleBanIPCommand(const char* args
);
103 bool HandleBanInfoAccountCommand(const char* args
);
104 bool HandleBanInfoCharacterCommand(const char* args
);
105 bool HandleBanInfoIPCommand(const char* args
);
106 bool HandleBanListAccountCommand(const char* args
);
107 bool HandleBanListCharacterCommand(const char* args
);
108 bool HandleBanListIPCommand(const char* args
);
110 bool HandleCastCommand(const char *args
);
111 bool HandleCastBackCommand(const char *args
);
112 bool HandleCastDistCommand(const char *args
);
113 bool HandleCastSelfCommand(const char *args
);
114 bool HandleCastTargetCommand(const char *args
);
116 bool HandleCharacterCustomizeCommand(const char * args
);
117 bool HandleCharacterDeleteCommand(const char* args
);
118 bool HandleCharacterRenameCommand(const char * args
);
119 bool HandleCharacterLevelCommand(const char* args
);
121 bool HandleDebugAnimCommand(const char* args
);
122 bool HandleDebugArenaCommand(const char * args
);
123 bool HandleDebugBattlegroundCommand(const char * args
);
124 bool HandleDebugGetItemState(const char * args
);
125 bool HandleDebugGetLootRecipient(const char * args
);
126 bool HandleDebugGetValue(const char* args
);
127 bool HandleDebugMod32Value(const char* args
);
128 bool HandleDebugSetValue(const char* args
);
129 bool HandleDebugSetItemFlagCommand(const char * args
);
130 bool HandleDebugSpawnVehicle(const char * args
);
131 bool HandleDebugUpdate(const char* args
);
132 bool HandleDebugUpdateWorldStateCommand(const char* args
);
134 bool HandleDebugPlayCinematicCommand(const char* args
);
135 bool HandleDebugPlayMovieCommand(const char* args
);
136 bool HandleDebugPlaySoundCommand(const char* args
);
138 bool HandleDebugSendBuyErrorCommand(const char* args
);
139 bool HandleDebugSendChannelNotifyCommand(const char* args
);
140 bool HandleDebugSendChatMsgCommand(const char* args
);
141 bool HandleDebugSendEquipErrorCommand(const char* args
);
142 bool HandleDebugSendLargePacketCommand(const char * args
);
143 bool HandleDebugSendOpcodeCommand(const char* args
);
144 bool HandleDebugSendPoiCommand(const char* args
);
145 bool HandleDebugSendQuestPartyMsgCommand(const char* args
);
146 bool HandleDebugSendQuestInvalidMsgCommand(const char* args
);
147 bool HandleDebugSendSellErrorCommand(const char* args
);
148 bool HandleDebugSendSetPhaseShiftCommand(const char * args
);
149 bool HandleDebugSendSpellFailCommand(const char* args
);
151 bool HandleEventActiveListCommand(const char* args
);
152 bool HandleEventStartCommand(const char* args
);
153 bool HandleEventStopCommand(const char* args
);
154 bool HandleEventInfoCommand(const char* args
);
156 bool HandleGameObjectAddCommand(const char* args
);
157 bool HandleGameObjectDeleteCommand(const char* args
);
158 bool HandleGameObjectMoveCommand(const char* args
);
159 bool HandleGameObjectNearCommand(const char* args
);
160 bool HandleGameObjectPhaseCommand(const char* args
);
161 bool HandleGameObjectTargetCommand(const char* args
);
162 bool HandleGameObjectTurnCommand(const char* args
);
164 bool HandleGMCommand(const char* args
);
165 bool HandleGMChatCommand(const char* args
);
166 bool HandleGMFlyCommand(const char* args
);
167 bool HandleGMListFullCommand(const char* args
);
168 bool HandleGMListIngameCommand(const char* args
);
169 bool HandleGMVisibleCommand(const char* args
);
171 bool HandleGoCommand(const char* args
);
172 bool HandleGoCreatureCommand(const char* args
);
173 bool HandleGoGraveyardCommand(const char* args
);
174 bool HandleGoGridCommand(const char* args
);
175 bool HandleGoObjectCommand(const char* args
);
176 bool HandleGoTaxinodeCommand(const char* args
);
177 bool HandleGoTriggerCommand(const char* args
);
178 bool HandleGoXYCommand(const char* args
);
179 bool HandleGoXYZCommand(const char* args
);
180 bool HandleGoZoneXYCommand(const char* args
);
182 bool HandleGuildCreateCommand(const char* args
);
183 bool HandleGuildInviteCommand(const char* args
);
184 bool HandleGuildUninviteCommand(const char* args
);
185 bool HandleGuildRankCommand(const char* args
);
186 bool HandleGuildDeleteCommand(const char* args
);
188 bool HandleHonorAddCommand(const char* args
);
189 bool HandleHonorAddKillCommand(const char* args
);
190 bool HandleHonorUpdateCommand(const char* args
);
192 bool HandleInstanceListBindsCommand(const char* args
);
193 bool HandleInstanceUnbindCommand(const char* args
);
194 bool HandleInstanceStatsCommand(const char* args
);
195 bool HandleInstanceSaveDataCommand(const char * args
);
197 bool HandleLearnCommand(const char* args
);
198 bool HandleLearnAllCommand(const char* args
);
199 bool HandleLearnAllGMCommand(const char* args
);
200 bool HandleLearnAllCraftsCommand(const char* args
);
201 bool HandleLearnAllRecipesCommand(const char* args
);
202 bool HandleLearnAllDefaultCommand(const char* args
);
203 bool HandleLearnAllLangCommand(const char* args
);
204 bool HandleLearnAllMyClassCommand(const char* args
);
205 bool HandleLearnAllMyPetTalentsCommand(const char* args
);
206 bool HandleLearnAllMySpellsCommand(const char* args
);
207 bool HandleLearnAllMyTalentsCommand(const char* args
);
209 bool HandleListAurasCommand(const char * args
);
210 bool HandleListCreatureCommand(const char* args
);
211 bool HandleListItemCommand(const char* args
);
212 bool HandleListObjectCommand(const char* args
);
214 bool HandleLookupAreaCommand(const char* args
);
215 bool HandleLookupCreatureCommand(const char* args
);
216 bool HandleLookupEventCommand(const char* args
);
217 bool HandleLookupFactionCommand(const char * args
);
218 bool HandleLookupItemCommand(const char * args
);
219 bool HandleLookupItemSetCommand(const char * args
);
220 bool HandleLookupObjectCommand(const char* args
);
221 bool HandleLookupPlayerIpCommand(const char* args
);
222 bool HandleLookupPlayerAccountCommand(const char* args
);
223 bool HandleLookupPlayerEmailCommand(const char* args
);
224 bool HandleLookupQuestCommand(const char* args
);
225 bool HandleLookupSkillCommand(const char* args
);
226 bool HandleLookupSpellCommand(const char* args
);
227 bool HandleLookupTaxiNodeCommand(const char * args
);
228 bool HandleLookupTeleCommand(const char * args
);
230 bool HandleModifyKnownTitlesCommand(const char* args
);
231 bool HandleModifyHPCommand(const char* args
);
232 bool HandleModifyManaCommand(const char* args
);
233 bool HandleModifyRageCommand(const char* args
);
234 bool HandleModifyRunicPowerCommand(const char* args
);
235 bool HandleModifyEnergyCommand(const char* args
);
236 bool HandleModifyMoneyCommand(const char* args
);
237 bool HandleModifyASpeedCommand(const char* args
);
238 bool HandleModifySpeedCommand(const char* args
);
239 bool HandleModifyBWalkCommand(const char* args
);
240 bool HandleModifyFlyCommand(const char* args
);
241 bool HandleModifySwimCommand(const char* args
);
242 bool HandleModifyScaleCommand(const char* args
);
243 bool HandleModifyMountCommand(const char* args
);
244 bool HandleModifyBitCommand(const char* args
);
245 bool HandleModifyFactionCommand(const char* args
);
246 bool HandleModifySpellCommand(const char* args
);
247 bool HandleModifyTalentCommand (const char* args
);
248 bool HandleModifyHonorCommand (const char* args
);
249 bool HandleModifyRepCommand(const char* args
);
250 bool HandleModifyArenaCommand(const char* args
);
251 bool HandleModifyPhaseCommand(const char* args
);
252 bool HandleModifyGenderCommand(const char* args
);
254 //-----------------------Npc Commands-----------------------
255 bool HandleNpcAddCommand(const char* args
);
256 bool HandleNpcAddMoveCommand(const char* args
);
257 bool HandleNpcAddVendorItemCommand(const char* args
);
258 bool HandleNpcAllowMovementCommand(const char* args
);
259 bool HandleNpcChangeEntryCommand(const char *args
);
260 bool HandleNpcChangeLevelCommand(const char* args
);
261 bool HandleNpcDeleteCommand(const char* args
);
262 bool HandleNpcDelVendorItemCommand(const char* args
);
263 bool HandleNpcFactionIdCommand(const char* args
);
264 bool HandleNpcFlagCommand(const char* args
);
265 bool HandleNpcFollowCommand(const char* args
);
266 bool HandleNpcInfoCommand(const char* args
);
267 bool HandleNpcMoveCommand(const char* args
);
268 bool HandleNpcPlayEmoteCommand(const char* args
);
269 bool HandleNpcSayCommand(const char* args
);
270 bool HandleNpcSetDeathStateCommand(const char* args
);
271 bool HandleNpcSetModelCommand(const char* args
);
272 bool HandleNpcSetMoveTypeCommand(const char* args
);
273 bool HandleNpcSetPhaseCommand(const char* args
);
274 bool HandleNpcSpawnDistCommand(const char* args
);
275 bool HandleNpcSpawnTimeCommand(const char* args
);
276 bool HandleNpcTameCommand(const char* args
);
277 bool HandleNpcTextEmoteCommand(const char* args
);
278 bool HandleNpcUnFollowCommand(const char* args
);
279 bool HandleNpcWhisperCommand(const char* args
);
280 bool HandleNpcYellCommand(const char* args
);
282 //TODO: NpcCommands that needs to be fixed :
283 bool HandleNpcAddWeaponCommand(const char* args
);
284 bool HandleNpcNameCommand(const char* args
);
285 bool HandleNpcSubNameCommand(const char* args
);
286 //----------------------------------------------------------
288 bool HandlePDumpLoadCommand(const char *args
);
289 bool HandlePDumpWriteCommand(const char *args
);
291 bool HandleQuestAdd(const char * args
);
292 bool HandleQuestRemove(const char * args
);
293 bool HandleQuestComplete(const char * args
);
295 bool HandleReloadAllCommand(const char* args
);
296 bool HandleReloadAllAchievementCommand(const char* args
);
297 bool HandleReloadAllAreaCommand(const char* args
);
298 bool HandleReloadAllItemCommand(const char* args
);
299 bool HandleReloadAllLootCommand(const char* args
);
300 bool HandleReloadAllNpcCommand(const char* args
);
301 bool HandleReloadAllQuestCommand(const char* args
);
302 bool HandleReloadAllScriptsCommand(const char* args
);
303 bool HandleReloadAllSpellCommand(const char* args
);
304 bool HandleReloadAllLocalesCommand(const char* args
);
306 bool HandleReloadConfigCommand(const char* args
);
308 bool HandleReloadAchievementCriteriaDataCommand(const char* args
);
309 bool HandleReloadAchievementRewardCommand(const char* args
);
310 bool HandleReloadAreaTriggerTavernCommand(const char* args
);
311 bool HandleReloadAreaTriggerTeleportCommand(const char* args
);
312 bool HandleReloadEventScriptsCommand(const char* args
);
313 bool HandleReloadCommandCommand(const char* args
);
314 bool HandleReloadCreatureQuestRelationsCommand(const char* args
);
315 bool HandleReloadCreatureQuestInvRelationsCommand(const char* args
);
316 bool HandleReloadDbScriptStringCommand(const char* args
);
317 bool HandleReloadGameGraveyardZoneCommand(const char* args
);
318 bool HandleReloadGameObjectScriptsCommand(const char* args
);
319 bool HandleReloadGameTeleCommand(const char* args
);
320 bool HandleReloadGOQuestRelationsCommand(const char* args
);
321 bool HandleReloadGOQuestInvRelationsCommand(const char* args
);
322 bool HandleReloadItemEnchantementsCommand(const char* args
);
323 bool HandleReloadLocalesAchievementRewardCommand(const char* args
);
324 bool HandleReloadLocalesCreatureCommand(const char* args
);
325 bool HandleReloadLocalesGameobjectCommand(const char* args
);
326 bool HandleReloadLocalesItemCommand(const char* args
);
327 bool HandleReloadLocalesNpcTextCommand(const char* args
);
328 bool HandleReloadLocalesPageTextCommand(const char* args
);
329 bool HandleReloadLocalesPointsOfInterestCommand(const char* args
);
330 bool HandleReloadLocalesQuestCommand(const char* args
);
331 bool HandleReloadLootTemplatesCreatureCommand(const char* args
);
332 bool HandleReloadLootTemplatesDisenchantCommand(const char* args
);
333 bool HandleReloadLootTemplatesFishingCommand(const char* args
);
334 bool HandleReloadLootTemplatesGameobjectCommand(const char* args
);
335 bool HandleReloadLootTemplatesItemCommand(const char* args
);
336 bool HandleReloadLootTemplatesMillingCommand(const char* args
);
337 bool HandleReloadLootTemplatesPickpocketingCommand(const char* args
);
338 bool HandleReloadLootTemplatesProspectingCommand(const char* args
);
339 bool HandleReloadLootTemplatesReferenceCommand(const char* args
);
340 bool HandleReloadLootTemplatesQuestMailCommand(const char* args
);
341 bool HandleReloadLootTemplatesSkinningCommand(const char* args
);
342 bool HandleReloadLootTemplatesSpellCommand(const char* args
);
343 bool HandleReloadMangosStringCommand(const char* args
);
344 bool HandleReloadNpcGossipCommand(const char* args
);
345 bool HandleReloadNpcOptionCommand(const char* args
);
346 bool HandleReloadNpcTrainerCommand(const char* args
);
347 bool HandleReloadNpcVendorCommand(const char* args
);
348 bool HandleReloadPageTextsCommand(const char* args
);
349 bool HandleReloadPointsOfInterestCommand(const char* args
);
350 bool HandleReloadSpellClickSpellsCommand(const char* args
);
351 bool HandleReloadQuestAreaTriggersCommand(const char* args
);
352 bool HandleReloadQuestEndScriptsCommand(const char* args
);
353 bool HandleReloadQuestStartScriptsCommand(const char* args
);
354 bool HandleReloadQuestTemplateCommand(const char* args
);
355 bool HandleReloadReservedNameCommand(const char*);
356 bool HandleReloadSkillDiscoveryTemplateCommand(const char* args
);
357 bool HandleReloadSkillExtraItemTemplateCommand(const char* args
);
358 bool HandleReloadSkillFishingBaseLevelCommand(const char* args
);
359 bool HandleReloadSpellAffectCommand(const char* args
);
360 bool HandleReloadSpellAreaCommand(const char* args
);
361 bool HandleReloadSpellChainCommand(const char* args
);
362 bool HandleReloadSpellElixirCommand(const char* args
);
363 bool HandleReloadSpellLearnSpellCommand(const char* args
);
364 bool HandleReloadSpellProcEventCommand(const char* args
);
365 bool HandleReloadSpellBonusesCommand(const char* args
);
366 bool HandleReloadSpellScriptTargetCommand(const char* args
);
367 bool HandleReloadSpellScriptsCommand(const char* args
);
368 bool HandleReloadSpellTargetPositionCommand(const char* args
);
369 bool HandleReloadSpellThreatsCommand(const char* args
);
370 bool HandleReloadSpellPetAurasCommand(const char* args
);
372 bool HandleResetAchievementsCommand(const char * args
);
373 bool HandleResetAllCommand(const char * args
);
374 bool HandleResetHonorCommand(const char * args
);
375 bool HandleResetLevelCommand(const char * args
);
376 bool HandleResetSpellsCommand(const char * args
);
377 bool HandleResetStatsCommand(const char * args
);
378 bool HandleResetTalentsCommand(const char * args
);
380 bool HandleSendItemsCommand(const char* args
);
381 bool HandleSendMailCommand(const char* args
);
382 bool HandleSendMessageCommand(const char * args
);
383 bool HandleSendMoneyCommand(const char* args
);
385 bool HandleServerCorpsesCommand(const char* args
);
386 bool HandleServerExitCommand(const char* args
);
387 bool HandleServerIdleRestartCommand(const char* args
);
388 bool HandleServerIdleShutDownCommand(const char* args
);
389 bool HandleServerInfoCommand(const char* args
);
390 bool HandleServerMotdCommand(const char* args
);
391 bool HandleServerPLimitCommand(const char* args
);
392 bool HandleServerRestartCommand(const char* args
);
393 bool HandleServerSetLogLevelCommand(const char* args
);
394 bool HandleServerSetMotdCommand(const char* args
);
395 bool HandleServerShutDownCommand(const char* args
);
396 bool HandleServerShutDownCancelCommand(const char* args
);
398 bool HandleTeleCommand(const char * args
);
399 bool HandleTeleAddCommand(const char * args
);
400 bool HandleTeleDelCommand(const char * args
);
401 bool HandleTeleGroupCommand(const char* args
);
402 bool HandleTeleNameCommand(const char* args
);
404 bool HandleUnBanAccountCommand(const char* args
);
405 bool HandleUnBanCharacterCommand(const char* args
);
406 bool HandleUnBanIPCommand(const char* args
);
408 bool HandleWpAddCommand(const char* args
);
409 bool HandleWpModifyCommand(const char* args
);
410 bool HandleWpShowCommand(const char* args
);
411 bool HandleWpExportCommand(const char* args
);
412 bool HandleWpImportCommand(const char* args
);
414 bool HandleHelpCommand(const char* args
);
415 bool HandleCommandsCommand(const char* args
);
416 bool HandleStartCommand(const char* args
);
417 bool HandleDismountCommand(const char* args
);
418 bool HandleSaveCommand(const char* args
);
420 bool HandleNamegoCommand(const char* args
);
421 bool HandleGonameCommand(const char* args
);
422 bool HandleGroupgoCommand(const char* args
);
423 bool HandleRecallCommand(const char* args
);
424 bool HandleAnnounceCommand(const char* args
);
425 bool HandleNotifyCommand(const char* args
);
426 bool HandleGPSCommand(const char* args
);
427 bool HandleTaxiCheatCommand(const char* args
);
428 bool HandleWhispersCommand(const char* args
);
429 bool HandleModifyDrunkCommand(const char* args
);
431 bool HandleLoadScriptsCommand(const char* args
);
433 bool HandleGUIDCommand(const char* args
);
434 bool HandleItemMoveCommand(const char* args
);
435 bool HandleDeMorphCommand(const char* args
);
436 bool HandlePInfoCommand(const char* args
);
437 bool HandleMuteCommand(const char* args
);
438 bool HandleUnmuteCommand(const char* args
);
439 bool HandleMovegensCommand(const char* args
);
441 bool HandleCooldownCommand(const char* args
);
442 bool HandleUnLearnCommand(const char* args
);
443 bool HandleGetDistanceCommand(const char* args
);
444 bool HandleModifyStandStateCommand(const char* args
);
445 bool HandleDieCommand(const char* args
);
446 bool HandleDamageCommand(const char *args
);
447 bool HandleReviveCommand(const char* args
);
448 bool HandleModifyMorphCommand(const char* args
);
449 bool HandleAuraCommand(const char* args
);
450 bool HandleUnAuraCommand(const char* args
);
451 bool HandleLinkGraveCommand(const char* args
);
452 bool HandleNearGraveCommand(const char* args
);
453 bool HandleExploreCheatCommand(const char* args
);
454 bool HandleHoverCommand(const char* args
);
455 bool HandleLevelUpCommand(const char* args
);
456 bool HandleShowAreaCommand(const char* args
);
457 bool HandleHideAreaCommand(const char* args
);
458 bool HandleAddItemCommand(const char* args
);
459 bool HandleAddItemSetCommand(const char* args
);
461 bool HandleBankCommand(const char* args
);
462 bool HandleChangeWeather(const char* args
);
463 bool HandleKickPlayerCommand(const char * args
);
465 bool HandleTicketCommand(const char* args
);
466 bool HandleDelTicketCommand(const char* args
);
467 bool HandleMaxSkillCommand(const char* args
);
468 bool HandleSetSkillCommand(const char* args
);
469 bool HandleRespawnCommand(const char* args
);
470 bool HandleComeToMeCommand(const char *args
);
471 bool HandleCombatStopCommand(const char *args
);
472 bool HandleFlushArenaPointsCommand(const char *args
);
473 bool HandleRepairitemsCommand(const char* args
);
474 bool HandleWaterwalkCommand(const char* args
);
476 //! Development Commands
477 bool HandleSet32Bit(const char* args
);
478 bool HandleSaveAllCommand(const char* args
);
480 Player
* getSelectedPlayer();
481 Creature
* getSelectedCreature();
482 Unit
* getSelectedUnit();
484 char* extractKeyFromLink(char* text
, char const* linkType
, char** something1
= NULL
);
485 char* extractKeyFromLink(char* text
, char const* const* linkTypes
, int* found_idx
, char** something1
= NULL
);
487 uint32
extractSpellIdFromLink(char* text
);
488 uint64
extractGuidFromLink(char* text
);
489 GameTele
const* extractGameTeleFromLink(char* text
);
490 std::string
extractPlayerNameFromLink(char* text
);
492 std::string
playerLink(std::string
const& name
) const { return m_session
? "|cffffffff|Hplayer:"+name
+"|h["+name
+"]|h|r" : name
; }
493 virtual std::string
GetNameLink() const { return GetNameLink(m_session
->GetPlayer()); }
494 std::string
GetNameLink(Player
* chr
) const { return playerLink(chr
->GetName()); }
496 GameObject
* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid
,uint32 entry
);
498 // Utility methods for commands
499 void ShowTicket(uint64 guid
, char const* text
, char const* time
);
500 bool LookupPlayerSearchCommand(QueryResult
* result
, int32 limit
);
501 bool HandleBanListHelper(QueryResult
* result
);
502 bool HandleBanHelper(BanMode mode
,char const* args
);
503 bool HandleBanInfoHelper(uint32 accountid
, char const* accountname
);
504 bool HandleUnBanHelper(BanMode mode
,char const* args
);
505 void HandleCharacterLevel(Player
* player
, uint64 player_guid
, uint32 oldlevel
, uint32 newlevel
);
507 void SetSentErrorMessage(bool val
){ sentErrorMessage
= val
;};
509 WorldSession
* m_session
; // != NULL for chat command call and NULL for CLI command
511 // common global flag
512 static bool load_command_table
;
513 bool sentErrorMessage
;
516 class CliHandler
: public ChatHandler
519 typedef void Print(char const*);
520 explicit CliHandler(Print
* zprint
) : m_print(zprint
) {}
522 // overwrite functions
523 const char *GetMangosString(int32 entry
) const;
524 bool isAvailable(ChatCommand
const& cmd
) const;
525 void SendSysMessage(const char *str
);
526 std::string
GetNameLink() const;
527 bool needReportToTarget(Player
* chr
) const;
533 char const *fmtstring( char const *format
, ... );