2 * Copyright (C) 2005-2008 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
21 #include "Database/DatabaseEnv.h"
22 #include "WorldPacket.h"
23 #include "WorldSession.h"
27 #include "ObjectMgr.h"
29 #include "UpdateMask.h"
31 #include "MapManager.h"
32 #include "GridNotifiersImpl.h"
35 bool ChatHandler::load_command_table
= true;
37 ChatCommand
* ChatHandler::getCommandTable()
39 static ChatCommand accountSetCommandTable
[] =
41 { "addon", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleAccountSetAddonCommand
, "", NULL
},
42 { "gmlevel", SEC_CONSOLE
, true, &ChatHandler::HandleAccountSetGmLevelCommand
, "", NULL
},
43 { "password", SEC_CONSOLE
, true, &ChatHandler::HandleAccountSetPasswordCommand
, "", NULL
},
44 { NULL
, 0, false, NULL
, "", NULL
}
47 static ChatCommand accountCommandTable
[] =
49 { "create", SEC_CONSOLE
, true, &ChatHandler::HandleAccountCreateCommand
, "", NULL
},
50 { "delete", SEC_CONSOLE
, true, &ChatHandler::HandleAccountDeleteCommand
, "", NULL
},
51 { "onlinelist", SEC_CONSOLE
, true, &ChatHandler::HandleAccountOnlineListCommand
, "", NULL
},
52 { "set", SEC_ADMINISTRATOR
, true, NULL
, "", accountSetCommandTable
},
53 { "", SEC_PLAYER
, false, &ChatHandler::HandleAccountCommand
, "", NULL
},
54 { NULL
, 0, false, NULL
, "", NULL
}
57 static ChatCommand serverSetCommandTable
[] =
59 { "loglevel", SEC_CONSOLE
, true, &ChatHandler::HandleServerSetLogLevelCommand
, "", NULL
},
60 { "motd", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleServerSetMotdCommand
, "", NULL
},
61 { NULL
, 0, false, NULL
, "", NULL
}
64 static ChatCommand serverCommandTable
[] =
66 { "corpses", SEC_GAMEMASTER
, true, &ChatHandler::HandleServerCorpsesCommand
, "", NULL
},
67 { "exit", SEC_CONSOLE
, true, &ChatHandler::HandleServerExitCommand
, "", NULL
},
68 { "idlerestart", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleIdleRestartCommand
, "", NULL
},
69 { "idleshutdown", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleIdleShutDownCommand
, "", NULL
},
70 { "info", SEC_PLAYER
, true, &ChatHandler::HandleServerInfoCommand
, "", NULL
},
71 { "motd", SEC_PLAYER
, true, &ChatHandler::HandleServerMotdCommand
, "", NULL
},
72 { "restart", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleRestartCommand
, "", NULL
},
73 { "shutdown", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleShutDownCommand
, "", NULL
},
74 { "set", SEC_ADMINISTRATOR
, true, NULL
, "", serverSetCommandTable
},
75 { NULL
, 0, false, NULL
, "", NULL
}
78 static ChatCommand modifyCommandTable
[] =
80 { "hp", SEC_MODERATOR
, false, &ChatHandler::HandleModifyHPCommand
, "", NULL
},
81 { "mana", SEC_MODERATOR
, false, &ChatHandler::HandleModifyManaCommand
, "", NULL
},
82 { "rage", SEC_MODERATOR
, false, &ChatHandler::HandleModifyRageCommand
, "", NULL
},
83 { "energy", SEC_MODERATOR
, false, &ChatHandler::HandleModifyEnergyCommand
, "", NULL
},
84 { "money", SEC_MODERATOR
, false, &ChatHandler::HandleModifyMoneyCommand
, "", NULL
},
85 { "speed", SEC_MODERATOR
, false, &ChatHandler::HandleModifySpeedCommand
, "", NULL
},
86 { "swim", SEC_MODERATOR
, false, &ChatHandler::HandleModifySwimCommand
, "", NULL
},
87 { "scale", SEC_MODERATOR
, false, &ChatHandler::HandleModifyScaleCommand
, "", NULL
},
88 { "bit", SEC_MODERATOR
, false, &ChatHandler::HandleModifyBitCommand
, "", NULL
},
89 { "bwalk", SEC_MODERATOR
, false, &ChatHandler::HandleModifyBWalkCommand
, "", NULL
},
90 { "fly", SEC_MODERATOR
, false, &ChatHandler::HandleModifyFlyCommand
, "", NULL
},
91 { "aspeed", SEC_MODERATOR
, false, &ChatHandler::HandleModifyASpeedCommand
, "", NULL
},
92 { "faction", SEC_MODERATOR
, false, &ChatHandler::HandleModifyFactionCommand
, "", NULL
},
93 { "spell", SEC_MODERATOR
, false, &ChatHandler::HandleModifySpellCommand
, "", NULL
},
94 { "tp", SEC_MODERATOR
, false, &ChatHandler::HandleModifyTalentCommand
, "", NULL
},
95 { "titles", SEC_MODERATOR
, false, &ChatHandler::HandleModifyKnownTitlesCommand
, "", NULL
},
96 { "mount", SEC_MODERATOR
, false, &ChatHandler::HandleModifyMountCommand
, "", NULL
},
97 { "honor", SEC_MODERATOR
, false, &ChatHandler::HandleModifyHonorCommand
, "", NULL
},
98 { "rep", SEC_MODERATOR
, false, &ChatHandler::HandleModifyRepCommand
, "", NULL
},
99 { "arena", SEC_MODERATOR
, false, &ChatHandler::HandleModifyArenaCommand
, "", NULL
},
100 { "drunk", SEC_MODERATOR
, false, &ChatHandler::HandleDrunkCommand
, "", NULL
},
101 { "standstate", SEC_GAMEMASTER
, false, &ChatHandler::HandleStandStateCommand
, "", NULL
},
102 { "morph", SEC_GAMEMASTER
, false, &ChatHandler::HandleMorphCommand
, "", NULL
},
103 { "gender", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleModifyGenderCommand
, "", NULL
},
104 { NULL
, 0, false, NULL
, "", NULL
}
107 static ChatCommand wpCommandTable
[] =
109 { "show", SEC_GAMEMASTER
, false, &ChatHandler::HandleWpShowCommand
, "", NULL
},
110 { "add", SEC_GAMEMASTER
, false, &ChatHandler::HandleWpAddCommand
, "", NULL
},
111 { "modify", SEC_GAMEMASTER
, false, &ChatHandler::HandleWpModifyCommand
, "", NULL
},
112 { "export", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleWpExportCommand
, "", NULL
},
113 { "import", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleWpImportCommand
, "", NULL
},
114 { NULL
, 0, false, NULL
, "", NULL
}
117 static ChatCommand banCommandTable
[] =
119 { "account", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanAccountCommand
, "", NULL
},
120 { "character", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanCharacterCommand
, "", NULL
},
121 { "ip", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanIPCommand
, "", NULL
},
122 { NULL
, 0, false, NULL
, "", NULL
}
125 static ChatCommand baninfoCommandTable
[] =
127 { "account", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanInfoAccountCommand
, "", NULL
},
128 { "character", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanInfoCharacterCommand
, "", NULL
},
129 { "ip", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanInfoIPCommand
, "", NULL
},
130 { NULL
, 0, false, NULL
, "", NULL
}
133 static ChatCommand banlistCommandTable
[] =
135 { "account", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanListAccountCommand
, "", NULL
},
136 { "character", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanListCharacterCommand
, "", NULL
},
137 { "ip", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanListIPCommand
, "", NULL
},
138 { NULL
, 0, false, NULL
, "", NULL
}
141 static ChatCommand unbanCommandTable
[] =
143 { "account", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleUnBanAccountCommand
, "", NULL
},
144 { "character", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleUnBanCharacterCommand
, "", NULL
},
145 { "ip", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleUnBanIPCommand
, "", NULL
},
146 { NULL
, 0, false, NULL
, "", NULL
}
149 static ChatCommand debugCommandTable
[] =
151 { "inarc", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleDebugInArcCommand
, "", NULL
},
152 { "spellfail", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleDebugSpellFailCommand
, "", NULL
},
153 { "setpoi", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSetPoiCommand
, "", NULL
},
154 { "qpartymsg", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSendQuestPartyMsgCommand
, "", NULL
},
155 { "qinvalidmsg", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSendQuestInvalidMsgCommand
, "", NULL
},
156 { "equiperr", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleEquipErrorCommand
, "", NULL
},
157 { "sellerr", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSellErrorCommand
, "", NULL
},
158 { "buyerr", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleBuyErrorCommand
, "", NULL
},
159 { "sendopcode", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSendOpcodeCommand
, "", NULL
},
160 { "uws", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleUpdateWorldStateCommand
, "", NULL
},
161 { "ps", SEC_ADMINISTRATOR
, false, &ChatHandler::HandlePlaySound2Command
, "", NULL
},
162 { "scn", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSendChannelNotifyCommand
, "", NULL
},
163 { "scm", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSendChatMsgCommand
, "", NULL
},
164 { "getitemstate", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleGetItemState
, "", NULL
},
165 { "playsound", SEC_MODERATOR
, false, &ChatHandler::HandlePlaySoundCommand
, "", NULL
},
166 { "update", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleUpdate
, "", NULL
},
167 { "setvalue", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSetValue
, "", NULL
},
168 { "getvalue", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleGetValue
, "", NULL
},
169 { "Mod32Value", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleMod32Value
, "", NULL
},
170 { "anim", SEC_GAMEMASTER
, false, &ChatHandler::HandleAnimCommand
, "", NULL
},
171 { "lootrecipient", SEC_GAMEMASTER
, false, &ChatHandler::HandleGetLootRecipient
, "", NULL
},
172 { NULL
, 0, false, NULL
, "", NULL
}
175 static ChatCommand eventCommandTable
[] =
177 { "activelist", SEC_GAMEMASTER
, true, &ChatHandler::HandleEventActiveListCommand
, "", NULL
},
178 { "start", SEC_GAMEMASTER
, true, &ChatHandler::HandleEventStartCommand
, "", NULL
},
179 { "stop", SEC_GAMEMASTER
, true, &ChatHandler::HandleEventStopCommand
, "", NULL
},
180 { "", SEC_GAMEMASTER
, true, &ChatHandler::HandleEventInfoCommand
, "", NULL
},
181 { NULL
, 0, false, NULL
, "", NULL
}
184 static ChatCommand learnCommandTable
[] =
186 { "all", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleLearnAllCommand
, "", NULL
},
187 { "all_gm", SEC_GAMEMASTER
, false, &ChatHandler::HandleLearnAllGMCommand
, "", NULL
},
188 { "all_crafts", SEC_GAMEMASTER
, false, &ChatHandler::HandleLearnAllCraftsCommand
, "", NULL
},
189 { "all_default", SEC_MODERATOR
, false, &ChatHandler::HandleLearnAllDefaultCommand
, "", NULL
},
190 { "all_lang", SEC_MODERATOR
, false, &ChatHandler::HandleLearnAllLangCommand
, "", NULL
},
191 { "all_myclass", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleLearnAllMyClassCommand
, "", NULL
},
192 { "all_myspells", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleLearnAllMySpellsCommand
, "", NULL
},
193 { "all_mytalents", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleLearnAllMyTalentsCommand
, "", NULL
},
194 { "all_recipes", SEC_GAMEMASTER
, false, &ChatHandler::HandleLearnAllRecipesCommand
, "", NULL
},
195 { "", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleLearnCommand
, "", NULL
},
196 { NULL
, 0, false, NULL
, "", NULL
}
199 static ChatCommand reloadCommandTable
[] =
201 { "all", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllCommand
, "", NULL
},
202 { "all_loot", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllLootCommand
, "", NULL
},
203 { "all_npc", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllNpcCommand
, "", NULL
},
204 { "all_quest", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllQuestCommand
, "", NULL
},
205 { "all_scripts", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllScriptsCommand
, "", NULL
},
206 { "all_spell", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllSpellCommand
, "", NULL
},
207 { "all_item", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllItemCommand
, "", NULL
},
208 { "all_locales", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllLocalesCommand
, "", NULL
},
210 { "config", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadConfigCommand
, "", NULL
},
212 { "areatrigger_tavern", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAreaTriggerTavernCommand
, "", NULL
},
213 { "areatrigger_teleport", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAreaTriggerTeleportCommand
, "", NULL
},
214 { "areatrigger_involvedrelation",SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadQuestAreaTriggersCommand
, "", NULL
},
215 { "event_scripts", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadEventScriptsCommand
, "", NULL
},
216 { "command", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadCommandCommand
, "", NULL
},
217 { "creature_involvedrelation", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadCreatureQuestInvRelationsCommand
,"",NULL
},
218 { "creature_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesCreatureCommand
, "", NULL
},
219 { "creature_questrelation", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadCreatureQuestRelationsCommand
, "", NULL
},
220 { "db_script_string", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadDbScriptStringCommand
, "", NULL
},
221 { "disenchant_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesDisenchantCommand
, "", NULL
},
222 { "fishing_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesFishingCommand
, "", NULL
},
223 { "game_graveyard_zone", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadGameGraveyardZoneCommand
, "", NULL
},
224 { "game_tele", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadGameTeleCommand
, "", NULL
},
225 { "gameobject_involvedrelation", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadGOQuestInvRelationsCommand
, "", NULL
},
226 { "gameobject_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesGameobjectCommand
, "", NULL
},
227 { "gameobject_questrelation", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadGOQuestRelationsCommand
, "", NULL
},
228 { "gameobject_scripts", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadGameObjectScriptsCommand
, "", NULL
},
229 { "item_enchantment_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadItemEnchantementsCommand
, "", NULL
},
230 { "item_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesItemCommand
, "", NULL
},
231 { "mangos_string", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadMangosStringCommand
, "", NULL
},
232 { "npc_gossip", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadNpcGossipCommand
, "", NULL
},
233 { "npc_option", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadNpcOptionCommand
, "", NULL
},
234 { "npc_trainer", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadNpcTrainerCommand
, "", NULL
},
235 { "npc_vendor", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadNpcVendorCommand
, "", NULL
},
236 { "page_text", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadPageTextsCommand
, "", NULL
},
237 { "pickpocketing_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesPickpocketingCommand
,"",NULL
},
238 { "prospecting_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesProspectingCommand
,"", NULL
},
239 { "quest_mail_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesQuestMailCommand
, "", NULL
},
240 { "quest_end_scripts", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadQuestEndScriptsCommand
, "", NULL
},
241 { "quest_start_scripts", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadQuestStartScriptsCommand
, "", NULL
},
242 { "quest_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadQuestTemplateCommand
, "", NULL
},
243 { "reference_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesReferenceCommand
, "", NULL
},
244 { "reserved_name", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadReservedNameCommand
, "", NULL
},
245 { "skill_discovery_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSkillDiscoveryTemplateCommand
, "", NULL
},
246 { "skill_extra_item_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSkillExtraItemTemplateCommand
, "", NULL
},
247 { "skill_fishing_base_level", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSkillFishingBaseLevelCommand
, "", NULL
},
248 { "skinning_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesSkinningCommand
, "", NULL
},
249 { "spell_affect", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellAffectCommand
, "", NULL
},
250 { "spell_chain", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellChainCommand
, "", NULL
},
251 { "spell_elixir", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellElixirCommand
, "", NULL
},
252 { "spell_learn_spell", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellLearnSpellCommand
, "", NULL
},
253 { "spell_pet_auras", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellPetAurasCommand
, "", NULL
},
254 { "spell_proc_event", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellProcEventCommand
, "", NULL
},
255 { "spell_script_target", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellScriptTargetCommand
, "", NULL
},
256 { "spell_scripts", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellScriptsCommand
, "", NULL
},
257 { "spell_target_position", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellTargetPositionCommand
, "", NULL
},
258 { "spell_threats", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellThreatsCommand
, "", NULL
},
259 { "locales_creature", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLocalesCreatureCommand
, "", NULL
},
260 { "locales_gameobject", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLocalesGameobjectCommand
, "", NULL
},
261 { "locales_item", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLocalesItemCommand
, "", NULL
},
262 { "locales_npc_text", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLocalesNpcTextCommand
, "", NULL
},
263 { "locales_page_text", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLocalesPageTextCommand
, "", NULL
},
264 { "locales_quest", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLocalesQuestCommand
, "", NULL
},
266 { "", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadCommand
, "", NULL
},
267 { NULL
, 0, false, NULL
, "", NULL
}
270 static ChatCommand honorCommandTable
[] =
272 { "add", SEC_GAMEMASTER
, false, &ChatHandler::HandleAddHonorCommand
, "", NULL
},
273 { "addkill", SEC_GAMEMASTER
, false, &ChatHandler::HandleHonorAddKillCommand
, "", NULL
},
274 { "update", SEC_GAMEMASTER
, false, &ChatHandler::HandleUpdateHonorFieldsCommand
, "", NULL
},
275 { NULL
, 0, false, NULL
, "", NULL
}
278 static ChatCommand guildCommandTable
[] =
280 { "create", SEC_GAMEMASTER
, true, &ChatHandler::HandleGuildCreateCommand
, "", NULL
},
281 { "delete", SEC_GAMEMASTER
, true, &ChatHandler::HandleGuildDeleteCommand
, "", NULL
},
282 { "invite", SEC_GAMEMASTER
, true, &ChatHandler::HandleGuildInviteCommand
, "", NULL
},
283 { "uninvite", SEC_GAMEMASTER
, true, &ChatHandler::HandleGuildUninviteCommand
, "", NULL
},
284 { "rank", SEC_GAMEMASTER
, true, &ChatHandler::HandleGuildRankCommand
, "", NULL
},
285 { NULL
, 0, false, NULL
, "", NULL
}
288 static ChatCommand lookupPlayerCommandTable
[] =
290 { "ip", SEC_GAMEMASTER
, true, &ChatHandler::HandleLookupPlayerIpCommand
, "", NULL
},
291 { "account", SEC_GAMEMASTER
, true, &ChatHandler::HandleLookupPlayerAccountCommand
, "", NULL
},
292 { "email", SEC_GAMEMASTER
, true, &ChatHandler::HandleLookupPlayerEmailCommand
, "", NULL
},
293 { NULL
, 0, false, NULL
, "", NULL
}
296 static ChatCommand lookupCommandTable
[] =
298 { "area", SEC_MODERATOR
, true, &ChatHandler::HandleLookupAreaCommand
, "", NULL
},
299 { "creature", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupCreatureCommand
, "", NULL
},
300 { "event", SEC_GAMEMASTER
, true, &ChatHandler::HandleLookupEventCommand
, "", NULL
},
301 { "faction", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupFactionCommand
, "", NULL
},
302 { "item", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupItemCommand
, "", NULL
},
303 { "itemset", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupItemSetCommand
, "", NULL
},
304 { "object", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupObjectCommand
, "", NULL
},
305 { "quest", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupQuestCommand
, "", NULL
},
306 { "player", SEC_GAMEMASTER
, true, NULL
, "", lookupPlayerCommandTable
},
307 { "skill", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupSkillCommand
, "", NULL
},
308 { "spell", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupSpellCommand
, "", NULL
},
309 { "tele", SEC_MODERATOR
, true, &ChatHandler::HandleLookupTeleCommand
, "", NULL
},
310 { NULL
, 0, false, NULL
, "", NULL
}
313 static ChatCommand resetCommandTable
[] =
315 { "honor", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleResetHonorCommand
, "", NULL
},
316 { "level", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleResetLevelCommand
, "", NULL
},
317 { "spells", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleResetSpellsCommand
, "", NULL
},
318 { "stats", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleResetStatsCommand
, "", NULL
},
319 { "talents", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleResetTalentsCommand
, "", NULL
},
320 { "all", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleResetAllCommand
, "", NULL
},
321 { NULL
, 0, false, NULL
, "", NULL
}
324 static ChatCommand castCommandTable
[] =
326 { "back", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleCastBackCommand
, "", NULL
},
327 { "dist", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleCastDistCommand
, "", NULL
},
328 { "self", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleCastSelfCommand
, "", NULL
},
329 { "target", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleCastTargetCommand
, "", NULL
},
330 { "", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleCastCommand
, "", NULL
},
331 { NULL
, 0, false, NULL
, "", NULL
}
334 static ChatCommand pdumpCommandTable
[] =
336 { "load", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLoadPDumpCommand
, "", NULL
},
337 { "write", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleWritePDumpCommand
, "", NULL
},
338 { NULL
, 0, false, NULL
, "", NULL
}
341 static ChatCommand listCommandTable
[] =
343 { "creature", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleListCreatureCommand
, "", NULL
},
344 { "item", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleListItemCommand
, "", NULL
},
345 { "object", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleListObjectCommand
, "", NULL
},
346 { "auras", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleListAurasCommand
, "", NULL
},
347 { NULL
, 0, false, NULL
, "", NULL
}
350 static ChatCommand teleCommandTable
[] =
352 { "add", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleAddTeleCommand
, "", NULL
},
353 { "del", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleDelTeleCommand
, "", NULL
},
354 { "name", SEC_MODERATOR
, true, &ChatHandler::HandleNameTeleCommand
, "", NULL
},
355 { "group", SEC_MODERATOR
, false, &ChatHandler::HandleGroupTeleCommand
, "", NULL
},
356 { "", SEC_MODERATOR
, false, &ChatHandler::HandleTeleCommand
, "", NULL
},
357 { NULL
, 0, false, NULL
, "", NULL
}
360 static ChatCommand npcCommandTable
[] =
362 { "say", SEC_MODERATOR
, false, &ChatHandler::HandleNpcSayCommand
, "", NULL
},
363 { "textemote", SEC_MODERATOR
, false, &ChatHandler::HandleNpcTextEmoteCommand
, "", NULL
},
364 { "add", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcAddCommand
, "", NULL
},
365 { "delete", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcDeleteCommand
, "", NULL
},
366 { "spawndist", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcSpawnDistCommand
, "", NULL
},
367 { "spawntime", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcSpawnTimeCommand
, "", NULL
},
368 { "factionid", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcFactionIdCommand
, "", NULL
},
369 { "addmove", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcAddMoveCommand
, "", NULL
},
370 { "setmovetype", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcSetMoveTypeCommand
, "", NULL
},
371 { "move", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcMoveCommand
, "", NULL
},
372 { "changelevel", SEC_GAMEMASTER
, false, &ChatHandler::HandleChangeLevelCommand
, "", NULL
},
373 { "setmodel", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcSetModelCommand
, "", NULL
},
374 { "additem", SEC_GAMEMASTER
, false, &ChatHandler::HandleAddVendorItemCommand
, "", NULL
},
375 { "delitem", SEC_GAMEMASTER
, false, &ChatHandler::HandleDelVendorItemCommand
, "", NULL
},
376 { "flag", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcFlagCommand
, "", NULL
},
377 { "changeentry", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleNpcChangeEntryCommand
, "", NULL
},
378 { "info", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleNpcInfoCommand
, "", NULL
},
379 { "playemote", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleNpcPlayEmoteCommand
, "", NULL
},
380 { "follow", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcFollowCommand
, "", NULL
},
381 { "unfollow", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcUnFollowCommand
, "", NULL
},
382 { "whisper", SEC_MODERATOR
, false, &ChatHandler::HandleNpcWhisperCommand
, "", NULL
},
383 { "yell", SEC_MODERATOR
, false, &ChatHandler::HandleNpcYellCommand
, "", NULL
},
384 { "tame", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcTameCommand
, "", NULL
},
386 //{ TODO: fix or remove this commands
387 { "name", SEC_GAMEMASTER
, false, &ChatHandler::HandleNameCommand
, "", NULL
},
388 { "subname", SEC_GAMEMASTER
, false, &ChatHandler::HandleSubNameCommand
, "", NULL
},
389 { "addweapon", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleAddWeaponCommand
, "", NULL
},
392 { NULL
, 0, false, NULL
, "", NULL
}
395 static ChatCommand goCommandTable
[] =
397 { "grid", SEC_MODERATOR
, false, &ChatHandler::HandleGoGridCommand
, "", NULL
},
398 { "creature", SEC_GAMEMASTER
, false, &ChatHandler::HandleGoCreatureCommand
, "", NULL
},
399 { "object", SEC_GAMEMASTER
, false, &ChatHandler::HandleGoObjectCommand
, "", NULL
},
400 { "trigger", SEC_GAMEMASTER
, false, &ChatHandler::HandleGoTriggerCommand
, "", NULL
},
401 { "graveyard", SEC_GAMEMASTER
, false, &ChatHandler::HandleGoGraveyardCommand
, "", NULL
},
402 { "zonexy", SEC_MODERATOR
, false, &ChatHandler::HandleGoZoneXYCommand
, "", NULL
},
403 { "xy", SEC_MODERATOR
, false, &ChatHandler::HandleGoXYCommand
, "", NULL
},
404 { "xyz", SEC_MODERATOR
, false, &ChatHandler::HandleGoXYZCommand
, "", NULL
},
405 { "", SEC_MODERATOR
, false, &ChatHandler::HandleGoXYZCommand
, "", NULL
},
406 { NULL
, 0, false, NULL
, "", NULL
}
409 static ChatCommand gobjectCommandTable
[] =
411 { "add", SEC_GAMEMASTER
, false, &ChatHandler::HandleGameObjectCommand
, "", NULL
},
412 { "delete", SEC_GAMEMASTER
, false, &ChatHandler::HandleDelObjectCommand
, "", NULL
},
413 { "target", SEC_GAMEMASTER
, false, &ChatHandler::HandleTargetObjectCommand
, "", NULL
},
414 { "turn", SEC_GAMEMASTER
, false, &ChatHandler::HandleTurnObjectCommand
, "", NULL
},
415 { "move", SEC_GAMEMASTER
, false, &ChatHandler::HandleMoveObjectCommand
, "", NULL
},
416 { "near", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleNearObjectCommand
, "", NULL
},
417 { NULL
, 0, false, NULL
, "", NULL
}
420 static ChatCommand questCommandTable
[] =
422 { "add", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleAddQuest
, "", NULL
},
423 { "complete", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleCompleteQuest
, "", NULL
},
424 { "remove", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleRemoveQuest
, "", NULL
},
425 { NULL
, 0, false, NULL
, "", NULL
}
428 static ChatCommand gmCommandTable
[] =
430 { "chat", SEC_MODERATOR
, false, &ChatHandler::HandleGMChatCommand
, "", NULL
},
431 { "ingame", SEC_PLAYER
, true, &ChatHandler::HandleGMListIngameCommand
, "", NULL
},
432 { "list", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleGMListFullCommand
, "", NULL
},
433 { "visible", SEC_MODERATOR
, false, &ChatHandler::HandleVisibleCommand
, "", NULL
},
434 { "fly", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleFlyModeCommand
, "", NULL
},
435 { "", SEC_MODERATOR
, false, &ChatHandler::HandleGMmodeCommand
, "", NULL
},
436 { NULL
, 0, false, NULL
, "", NULL
}
439 static ChatCommand instanceCommandTable
[] =
441 { "listbinds", SEC_MODERATOR
, false, &ChatHandler::HandleInstanceListBindsCommand
, "", NULL
},
442 { "unbind", SEC_MODERATOR
, false, &ChatHandler::HandleInstanceUnbindCommand
, "", NULL
},
443 { "stats", SEC_MODERATOR
, true, &ChatHandler::HandleInstanceStatsCommand
, "", NULL
},
444 { "savedata", SEC_MODERATOR
, false, &ChatHandler::HandleInstanceSaveDataCommand
, "", NULL
},
445 { NULL
, 0, false, NULL
, "", NULL
}
448 static ChatCommand commandTable
[] =
450 { "account", SEC_PLAYER
, true, NULL
, "", accountCommandTable
},
451 { "gm", SEC_MODERATOR
, true, NULL
, "", gmCommandTable
},
452 { "npc", SEC_MODERATOR
, false, NULL
, "", npcCommandTable
},
453 { "go", SEC_MODERATOR
, false, NULL
, "", goCommandTable
},
454 { "learn", SEC_MODERATOR
, false, NULL
, "", learnCommandTable
},
455 { "modify", SEC_MODERATOR
, false, NULL
, "", modifyCommandTable
},
456 { "debug", SEC_MODERATOR
, false, NULL
, "", debugCommandTable
},
457 { "tele", SEC_MODERATOR
, true, NULL
, "", teleCommandTable
},
458 { "event", SEC_GAMEMASTER
, false, NULL
, "", eventCommandTable
},
459 { "gobject", SEC_GAMEMASTER
, false, NULL
, "", gobjectCommandTable
},
460 { "honor", SEC_GAMEMASTER
, false, NULL
, "", honorCommandTable
},
461 { "wp", SEC_GAMEMASTER
, false, NULL
, "", wpCommandTable
},
462 { "quest", SEC_ADMINISTRATOR
, false, NULL
, "", questCommandTable
},
463 { "reload", SEC_ADMINISTRATOR
, true, NULL
, "", reloadCommandTable
},
464 { "list", SEC_ADMINISTRATOR
, true, NULL
, "", listCommandTable
},
465 { "lookup", SEC_ADMINISTRATOR
, true, NULL
, "", lookupCommandTable
},
466 { "pdump", SEC_ADMINISTRATOR
, true, NULL
, "", pdumpCommandTable
},
467 { "guild", SEC_ADMINISTRATOR
, true, NULL
, "", guildCommandTable
},
468 { "cast", SEC_ADMINISTRATOR
, false, NULL
, "", castCommandTable
},
469 { "reset", SEC_ADMINISTRATOR
, false, NULL
, "", resetCommandTable
},
470 { "instance", SEC_ADMINISTRATOR
, true, NULL
, "", instanceCommandTable
},
471 { "server", SEC_ADMINISTRATOR
, true, NULL
, "", serverCommandTable
},
473 { "aura", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleAuraCommand
, "", NULL
},
474 { "unaura", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleUnAuraCommand
, "", NULL
},
475 { "announce", SEC_MODERATOR
, true, &ChatHandler::HandleAnnounceCommand
, "", NULL
},
476 { "notify", SEC_MODERATOR
, true, &ChatHandler::HandleNotifyCommand
, "", NULL
},
477 { "goname", SEC_MODERATOR
, false, &ChatHandler::HandleGonameCommand
, "", NULL
},
478 { "namego", SEC_MODERATOR
, false, &ChatHandler::HandleNamegoCommand
, "", NULL
},
479 { "groupgo", SEC_MODERATOR
, false, &ChatHandler::HandleGroupgoCommand
, "", NULL
},
480 { "commands", SEC_PLAYER
, true, &ChatHandler::HandleCommandsCommand
, "", NULL
},
481 { "demorph", SEC_GAMEMASTER
, false, &ChatHandler::HandleDeMorphCommand
, "", NULL
},
482 { "die", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleDieCommand
, "", NULL
},
483 { "revive", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleReviveCommand
, "", NULL
},
484 { "dismount", SEC_PLAYER
, false, &ChatHandler::HandleDismountCommand
, "", NULL
},
485 { "gps", SEC_MODERATOR
, false, &ChatHandler::HandleGPSCommand
, "", NULL
},
486 { "guid", SEC_GAMEMASTER
, false, &ChatHandler::HandleGUIDCommand
, "", NULL
},
487 { "help", SEC_PLAYER
, true, &ChatHandler::HandleHelpCommand
, "", NULL
},
488 { "itemmove", SEC_GAMEMASTER
, false, &ChatHandler::HandleItemMoveCommand
, "", NULL
},
489 { "cooldown", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleCooldownCommand
, "", NULL
},
490 { "unlearn", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleUnLearnCommand
, "", NULL
},
491 { "distance", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleGetDistanceCommand
, "", NULL
},
492 { "recall", SEC_MODERATOR
, false, &ChatHandler::HandleRecallCommand
, "", NULL
},
493 { "save", SEC_PLAYER
, false, &ChatHandler::HandleSaveCommand
, "", NULL
},
494 { "saveall", SEC_MODERATOR
, true, &ChatHandler::HandleSaveAllCommand
, "", NULL
},
495 { "kick", SEC_GAMEMASTER
, true, &ChatHandler::HandleKickPlayerCommand
, "", NULL
},
496 { "ban", SEC_ADMINISTRATOR
, true, NULL
, "", banCommandTable
},
497 { "unban", SEC_ADMINISTRATOR
, true, NULL
, "", unbanCommandTable
},
498 { "baninfo", SEC_ADMINISTRATOR
, false, NULL
, "", baninfoCommandTable
},
499 { "banlist", SEC_ADMINISTRATOR
, true, NULL
, "", banlistCommandTable
},
500 { "plimit", SEC_ADMINISTRATOR
, true, &ChatHandler::HandlePLimitCommand
, "", NULL
},
501 { "start", SEC_PLAYER
, false, &ChatHandler::HandleStartCommand
, "", NULL
},
502 { "taxicheat", SEC_MODERATOR
, false, &ChatHandler::HandleTaxiCheatCommand
, "", NULL
},
503 { "allowmove", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleAllowMovementCommand
, "", NULL
},
504 { "linkgrave", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleLinkGraveCommand
, "", NULL
},
505 { "neargrave", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleNearGraveCommand
, "", NULL
},
506 { "explorecheat", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleExploreCheatCommand
, "", NULL
},
507 { "hover", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleHoverCommand
, "", NULL
},
508 { "levelup", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleLevelUpCommand
, "", NULL
},
509 { "showarea", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleShowAreaCommand
, "", NULL
},
510 { "hidearea", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleHideAreaCommand
, "", NULL
},
511 { "additem", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleAddItemCommand
, "", NULL
},
512 { "additemset", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleAddItemSetCommand
, "", NULL
},
513 { "bank", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleBankCommand
, "", NULL
},
514 { "wchange", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleChangeWeather
, "", NULL
},
515 { "ticket", SEC_GAMEMASTER
, true, &ChatHandler::HandleTicketCommand
, "", NULL
},
516 { "delticket", SEC_GAMEMASTER
, true, &ChatHandler::HandleDelTicketCommand
, "", NULL
},
517 { "maxskill", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleMaxSkillCommand
, "", NULL
},
518 { "setskill", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSetSkillCommand
, "", NULL
},
519 { "whispers", SEC_MODERATOR
, false, &ChatHandler::HandleWhispersCommand
, "", NULL
},
520 { "pinfo", SEC_GAMEMASTER
, true, &ChatHandler::HandlePInfoCommand
, "", NULL
},
521 { "password", SEC_PLAYER
, false, &ChatHandler::HandlePasswordCommand
, "", NULL
},
522 { "lockaccount", SEC_PLAYER
, false, &ChatHandler::HandleLockAccountCommand
, "", NULL
},
523 { "respawn", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleRespawnCommand
, "", NULL
},
524 { "senditems", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleSendItemsCommand
, "", NULL
},
525 { "sendmail", SEC_MODERATOR
, true, &ChatHandler::HandleSendMailCommand
, "", NULL
},
526 { "sendmoney", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleSendMoneyCommand
, "", NULL
},
527 { "rename", SEC_GAMEMASTER
, true, &ChatHandler::HandleRenameCommand
, "", NULL
},
528 { "loadscripts", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLoadScriptsCommand
, "", NULL
},
529 { "mute", SEC_GAMEMASTER
, true, &ChatHandler::HandleMuteCommand
, "", NULL
},
530 { "unmute", SEC_GAMEMASTER
, true, &ChatHandler::HandleUnmuteCommand
, "", NULL
},
531 { "movegens", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleMovegensCommand
, "", NULL
},
532 { "cometome", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleComeToMeCommand
, "", NULL
},
533 { "damage", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleDamageCommand
, "", NULL
},
534 { "combatstop", SEC_GAMEMASTER
, false, &ChatHandler::HandleCombatStopCommand
, "", NULL
},
535 { "chardelete", SEC_CONSOLE
, true, &ChatHandler::HandleCharacterDeleteCommand
, "", NULL
},
536 { "sendmessage", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleSendMessageCommand
, "", NULL
},
537 { "repairitems", SEC_GAMEMASTER
, false, &ChatHandler::HandleRepairitemsCommand
, "", NULL
},
538 { "waterwalk", SEC_GAMEMASTER
, false, &ChatHandler::HandleWaterwalkCommand
, "", NULL
},
540 { NULL
, 0, false, NULL
, "", NULL
}
543 if(load_command_table
)
545 load_command_table
= false;
547 QueryResult
*result
= WorldDatabase
.Query("SELECT name,security,help FROM command");
552 Field
*fields
= result
->Fetch();
553 std::string name
= fields
[0].GetCppString();
554 for(uint32 i
= 0; commandTable
[i
].Name
!= NULL
; i
++)
556 if (name
== commandTable
[i
].Name
)
558 commandTable
[i
].SecurityLevel
= (uint16
)fields
[1].GetUInt16();
559 commandTable
[i
].Help
= fields
[2].GetCppString();
561 if(commandTable
[i
].ChildCommands
!= NULL
)
563 ChatCommand
*ptable
= commandTable
[i
].ChildCommands
;
564 for(uint32 j
= 0; ptable
[j
].Name
!= NULL
; j
++)
566 // first case for "" named subcommand
567 if (ptable
[j
].Name
[0]=='\0' && name
== commandTable
[i
].Name
||
568 name
== fmtstring("%s %s", commandTable
[i
].Name
, ptable
[j
].Name
) )
570 ptable
[j
].SecurityLevel
= (uint16
)fields
[1].GetUInt16();
571 ptable
[j
].Help
= fields
[2].GetCppString();
576 } while(result
->NextRow());
584 const char *ChatHandler::GetMangosString(int32 entry
) const
586 return m_session
->GetMangosString(entry
);
589 bool ChatHandler::isAvailable(ChatCommand
const& cmd
) const
591 // check security level only for simple command (without child commands)
592 return m_session
->GetSecurity() >= cmd
.SecurityLevel
;
595 bool ChatHandler::hasStringAbbr(const char* name
, const char* part
)
600 // "" part from non-"" command
610 else if( tolower( *name
) != tolower( *part
) )
615 // allow with any for ""
620 void ChatHandler::SendSysMessage(const char *str
)
624 // need copy to prevent corruption by strtok call in LineFromMessage original string
625 char* buf
= strdup(str
);
628 while(char* line
= LineFromMessage(pos
))
630 FillSystemMessageData(&data
, line
);
631 m_session
->SendPacket(&data
);
637 void ChatHandler::SendGlobalSysMessage(const char *str
)
642 // need copy to prevent corruption by strtok call in LineFromMessage original string
643 char* buf
= strdup(str
);
646 while(char* line
= LineFromMessage(pos
))
648 FillSystemMessageData(&data
, line
);
649 sWorld
.SendGlobalMessage(&data
);
655 void ChatHandler::SendSysMessage(int32 entry
)
657 SendSysMessage(GetMangosString(entry
));
660 void ChatHandler::PSendSysMessage(int32 entry
, ...)
662 const char *format
= GetMangosString(entry
);
666 vsnprintf(str
,1024,format
, ap
);
671 void ChatHandler::PSendSysMessage(const char *format
, ...)
675 va_start(ap
, format
);
676 vsnprintf(str
,1024,format
, ap
);
681 bool ChatHandler::ExecuteCommandInTable(ChatCommand
*table
, const char* text
, std::string fullcmd
)
683 char const* oldtext
= text
;
684 std::string cmd
= "";
686 while (*text
!= ' ' && *text
!= '\0')
692 while (*text
== ' ') ++text
;
694 for(uint32 i
= 0; table
[i
].Name
!= NULL
; i
++)
696 if( !hasStringAbbr(table
[i
].Name
, cmd
.c_str()) )
699 // select subcommand from child commands list
700 if(table
[i
].ChildCommands
!= NULL
)
702 if(!ExecuteCommandInTable(table
[i
].ChildCommands
, text
, fullcmd
))
704 if(text
&& text
[0] != '\0')
705 SendSysMessage(LANG_NO_SUBCMD
);
707 SendSysMessage(LANG_CMD_SYNTAX
);
709 ShowHelpForCommand(table
[i
].ChildCommands
,text
);
715 // must be available and have handler
716 if(!table
[i
].Handler
|| !isAvailable(table
[i
]))
719 SetSentErrorMessage(false);
720 // table[i].Name == "" is special case: send original command to handler
721 if((this->*(table
[i
].Handler
))(strlen(table
[i
].Name
)!=0 ? text
: oldtext
))
723 if(table
[i
].SecurityLevel
> SEC_PLAYER
)
728 Player
* p
= m_session
->GetPlayer();
729 uint64 sel_guid
= p
->GetSelection();
730 sLog
.outCommand("Command: %s [Player: %s (Account: %u) X: %f Y: %f Z: %f Map: %u Selected: %s (GUID: %u)]",
731 fullcmd
.c_str(),p
->GetName(),m_session
->GetAccountId(),p
->GetPositionX(),p
->GetPositionY(),p
->GetPositionZ(),p
->GetMapId(),
732 GetLogNameForGuid(sel_guid
),GUID_LOPART(sel_guid
));
736 // some commands have custom error messages. Don't send the default one in these cases.
737 else if(!sentErrorMessage
)
739 if(!table
[i
].Help
.empty())
740 SendSysMessage(table
[i
].Help
.c_str());
742 SendSysMessage(LANG_CMD_SYNTAX
);
751 int ChatHandler::ParseCommands(const char* text
)
756 //if(m_session->GetSecurity() == 0)
759 /// chat case (.command or !command format)
762 if(text
[0] != '!' && text
[0] != '.')
766 /// ignore single . and ! in line
770 /// ignore messages staring from many dots.
771 if(text
[0] == '.' && text
[1] == '.' || text
[0] == '!' && text
[1] == '!')
774 /// skip first . or ! (in console allowed use command with . and ! and without its)
775 if(text
[0] == '!' || text
[0] == '.')
778 std::string fullcmd
= text
; // original `text` can't be used. It content destroyed in command code processing.
780 if(!ExecuteCommandInTable(getCommandTable(), text
, fullcmd
))
781 SendSysMessage(LANG_NO_CMD
);
786 bool ChatHandler::ShowHelpForSubCommands(ChatCommand
*table
, char const* cmd
, char const* subcmd
)
789 for(uint32 i
= 0; table
[i
].Name
!= NULL
; ++i
)
791 // must be available (ignore handler existence for show command with possibe avalable subcomands
792 if(!isAvailable(table
[i
]))
795 /// for empty subcmd show all available
796 if( *subcmd
&& !hasStringAbbr(table
[i
].Name
, subcmd
))
804 list
+= table
[i
].Name
;
806 if(table
[i
].ChildCommands
)
813 if(table
==getCommandTable())
815 SendSysMessage(LANG_AVIABLE_CMD
);
816 PSendSysMessage("%s",list
.c_str());
819 PSendSysMessage(LANG_SUBCMDS_LIST
,cmd
,list
.c_str());
824 bool ChatHandler::ShowHelpForCommand(ChatCommand
*table
, const char* cmd
)
828 for(uint32 i
= 0; table
[i
].Name
!= NULL
; ++i
)
830 // must be available (ignore handler existence for show command with possibe avalable subcomands
831 if(!isAvailable(table
[i
]))
834 if( !hasStringAbbr(table
[i
].Name
, cmd
) )
838 char const* subcmd
= (*cmd
) ? strtok(NULL
, " ") : "";
840 if(table
[i
].ChildCommands
&& subcmd
&& *subcmd
)
842 if(ShowHelpForCommand(table
[i
].ChildCommands
, subcmd
))
846 if(!table
[i
].Help
.empty())
847 SendSysMessage(table
[i
].Help
.c_str());
849 if(table
[i
].ChildCommands
)
850 if(ShowHelpForSubCommands(table
[i
].ChildCommands
,table
[i
].Name
,subcmd
? subcmd
: ""))
853 return !table
[i
].Help
.empty();
858 for(uint32 i
= 0; table
[i
].Name
!= NULL
; ++i
)
860 // must be available (ignore handler existence for show command with possibe avalable subcomands
861 if(!isAvailable(table
[i
]))
864 if(strlen(table
[i
].Name
))
867 if(!table
[i
].Help
.empty())
868 SendSysMessage(table
[i
].Help
.c_str());
870 if(table
[i
].ChildCommands
)
871 if(ShowHelpForSubCommands(table
[i
].ChildCommands
,"",""))
874 return !table
[i
].Help
.empty();
878 return ShowHelpForSubCommands(table
,"",cmd
);
881 //Note: target_guid used only in CHAT_MSG_WHISPER_INFORM mode (in this case channelName ignored)
882 void ChatHandler::FillMessageData( WorldPacket
*data
, WorldSession
* session
, uint8 type
, uint32 language
, const char *channelName
, uint64 target_guid
, const char *message
, Unit
*speaker
)
884 uint32 messageLength
= (message
? strlen(message
) : 0) + 1;
886 data
->Initialize(SMSG_MESSAGECHAT
, 100); // guess size
887 *data
<< uint8(type
);
888 if ((type
!= CHAT_MSG_CHANNEL
&& type
!= CHAT_MSG_WHISPER
) || language
== LANG_ADDON
)
889 *data
<< uint32(language
);
891 *data
<< uint32(LANG_UNIVERSAL
);
899 case CHAT_MSG_OFFICER
:
901 case CHAT_MSG_WHISPER
:
902 case CHAT_MSG_CHANNEL
:
903 case CHAT_MSG_RAID_LEADER
:
904 case CHAT_MSG_RAID_WARNING
:
905 case CHAT_MSG_BG_SYSTEM_NEUTRAL
:
906 case CHAT_MSG_BG_SYSTEM_ALLIANCE
:
907 case CHAT_MSG_BG_SYSTEM_HORDE
:
908 case CHAT_MSG_BATTLEGROUND
:
909 case CHAT_MSG_BATTLEGROUND_LEADER
:
910 target_guid
= session
? session
->GetPlayer()->GetGUID() : 0;
912 case CHAT_MSG_MONSTER_SAY
:
913 case CHAT_MSG_MONSTER_PARTY
:
914 case CHAT_MSG_MONSTER_YELL
:
915 case CHAT_MSG_MONSTER_WHISPER
:
916 case CHAT_MSG_MONSTER_EMOTE
:
917 case CHAT_MSG_RAID_BOSS_WHISPER
:
918 case CHAT_MSG_RAID_BOSS_EMOTE
:
920 *data
<< uint64(speaker
->GetGUID());
921 *data
<< uint32(0); // 2.1.0
922 *data
<< uint32(strlen(speaker
->GetName()) + 1);
923 *data
<< speaker
->GetName();
924 uint64 listener_guid
= 0;
925 *data
<< uint64(listener_guid
);
926 if(listener_guid
&& !IS_PLAYER_GUID(listener_guid
))
928 *data
<< uint32(1); // string listener_name_length
929 *data
<< uint8(0); // string listener_name
931 *data
<< uint32(messageLength
);
937 if (type
!= CHAT_MSG_REPLY
&& type
!= CHAT_MSG_IGNORED
&& type
!= CHAT_MSG_DND
&& type
!= CHAT_MSG_AFK
)
938 target_guid
= 0; // only for CHAT_MSG_WHISPER_INFORM used original value target_guid
942 *data
<< uint64(target_guid
); // there 0 for BG messages
943 *data
<< uint32(0); // can be chat msg group or something
945 if (type
== CHAT_MSG_CHANNEL
)
948 *data
<< channelName
;
951 *data
<< uint64(target_guid
);
952 *data
<< uint32(messageLength
);
954 if(session
!= 0 && type
!= CHAT_MSG_REPLY
&& type
!= CHAT_MSG_DND
&& type
!= CHAT_MSG_AFK
)
955 *data
<< uint8(session
->GetPlayer()->chatTag());
960 Player
* ChatHandler::getSelectedPlayer()
965 uint64 guid
= m_session
->GetPlayer()->GetSelection();
968 return m_session
->GetPlayer();
970 return objmgr
.GetPlayer(guid
);
973 Unit
* ChatHandler::getSelectedUnit()
978 uint64 guid
= m_session
->GetPlayer()->GetSelection();
981 return m_session
->GetPlayer();
983 return ObjectAccessor::GetUnit(*m_session
->GetPlayer(),guid
);
986 Creature
* ChatHandler::getSelectedCreature()
991 return ObjectAccessor::GetCreatureOrPet(*m_session
->GetPlayer(),m_session
->GetPlayer()->GetSelection());
994 char* ChatHandler::extractKeyFromLink(char* text
, char const* linkType
, char** something1
)
1001 while(*text
==' '||*text
=='\t'||*text
=='\b')
1007 // return non link case
1009 return strtok(text
, " ");
1011 // [name] Shift-click form |color|linkType:key|h[name]|h|r
1013 // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r
1015 char* check
= strtok(text
, "|"); // skip color
1017 return NULL
; // end of data
1019 char* cLinkType
= strtok(NULL
, ":"); // linktype
1021 return NULL
; // end of data
1023 if(strcmp(cLinkType
,linkType
) != 0)
1025 strtok(NULL
, " "); // skip link tail (to allow continue strtok(NULL,s) use after retturn from function
1026 SendSysMessage(LANG_WRONG_LINK_TYPE
);
1030 char* cKeys
= strtok(NULL
, "|"); // extract keys and values
1031 char* cKeysTail
= strtok(NULL
, "");
1033 char* cKey
= strtok(cKeys
, ":|"); // extract key
1035 *something1
= strtok(NULL
, ":|"); // extract something
1037 strtok(cKeysTail
, "]"); // restart scan tail and skip name with possible spaces
1038 strtok(NULL
, " "); // skip link tail (to allow continue strtok(NULL,s) use after retturn from function
1042 char* ChatHandler::extractKeyFromLink(char* text
, char const* const* linkTypes
, int* found_idx
, char** something1
)
1049 while(*text
==' '||*text
=='\t'||*text
=='\b')
1055 // return non link case
1057 return strtok(text
, " ");
1059 // [name] Shift-click form |color|linkType:key|h[name]|h|r
1061 // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r
1063 char* check
= strtok(text
, "|"); // skip color
1065 return NULL
; // end of data
1067 char* cLinkType
= strtok(NULL
, ":"); // linktype
1069 return NULL
; // end of data
1071 for(int i
= 0; linkTypes
[i
]; ++i
)
1073 if(strcmp(cLinkType
,linkTypes
[i
]) == 0)
1075 char* cKeys
= strtok(NULL
, "|"); // extract keys and values
1076 char* cKeysTail
= strtok(NULL
, "");
1078 char* cKey
= strtok(cKeys
, ":|"); // extract key
1080 *something1
= strtok(NULL
, ":|"); // extract something
1082 strtok(cKeysTail
, "]"); // restart scan tail and skip name with possible spaces
1083 strtok(NULL
, " "); // skip link tail (to allow continue strtok(NULL,s) use after return from function
1090 strtok(NULL
, " "); // skip link tail (to allow continue strtok(NULL,s) use after return from function
1091 SendSysMessage(LANG_WRONG_LINK_TYPE
);
1095 char const *fmtstring( char const *format
, ... )
1098 #define MAX_FMT_STRING 32000
1099 static char temp_buffer
[MAX_FMT_STRING
];
1100 static char string
[MAX_FMT_STRING
];
1101 static int index
= 0;
1105 va_start(argptr
, format
);
1106 vsnprintf(temp_buffer
,MAX_FMT_STRING
, format
, argptr
);
1109 len
= strlen(temp_buffer
);
1111 if( len
>= MAX_FMT_STRING
)
1114 if (len
+ index
>= MAX_FMT_STRING
-1)
1119 buf
= &string
[index
];
1120 memcpy( buf
, temp_buffer
, len
+1 );
1127 GameObject
* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid
,uint32 entry
)
1132 Player
* pl
= m_session
->GetPlayer();
1134 GameObject
* obj
= ObjectAccessor::GetGameObject(*pl
, MAKE_NEW_GUID(lowguid
, entry
, HIGHGUID_GAMEOBJECT
));
1136 if(!obj
&& objmgr
.GetGOData(lowguid
)) // guid is DB guid of object
1138 // search near player then
1139 CellPair
p(MaNGOS::ComputeCellPair(pl
->GetPositionX(), pl
->GetPositionY()));
1141 cell
.data
.Part
.reserved
= ALL_DISTRICT
;
1143 MaNGOS::GameObjectWithDbGUIDCheck
go_check(*pl
,lowguid
);
1144 MaNGOS::GameObjectSearcher
<MaNGOS::GameObjectWithDbGUIDCheck
> checker(obj
,go_check
);
1146 TypeContainerVisitor
<MaNGOS::GameObjectSearcher
<MaNGOS::GameObjectWithDbGUIDCheck
>, GridTypeMapContainer
> object_checker(checker
);
1147 CellLock
<GridReadGuard
> cell_lock(cell
, p
);
1148 cell_lock
->Visit(cell_lock
, object_checker
, *MapManager::Instance().GetMap(pl
->GetMapId(), pl
));
1154 static char const* const spellTalentKeys
[] = {
1160 uint32
ChatHandler::extractSpellIdFromLink(char* text
)
1162 // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
1163 // number or [name] Shift-click form |color|Htalent:talent_id,rank|h[name]|h|r
1166 char* idS
= extractKeyFromLink(text
,spellTalentKeys
,&type
,&rankS
);
1170 uint32 id
= (uint32
)atol(idS
);
1177 TalentEntry
const* talentEntry
= sTalentStore
.LookupEntry(id
);
1181 int32 rank
= rankS
? (uint32
)atol(rankS
) : 0;
1188 return talentEntry
->RankID
[rank
];
1191 GameTele
const* ChatHandler::extractGameTeleFromLink(char* text
)
1193 // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
1194 char* cId
= extractKeyFromLink(text
,"Htele");
1198 // id case (explicit or from shift link)
1199 if(cId
[0] >= '0' || cId
[0] >= '9')
1200 if(uint32 id
= atoi(cId
))
1201 return objmgr
.GetGameTele(id
);
1203 return objmgr
.GetGameTele(cId
);
1206 const char *ChatHandler::GetName() const
1208 return m_session
->GetPlayer()->GetName();
1211 bool ChatHandler::needReportToTarget(Player
* chr
) const
1213 Player
* pl
= m_session
->GetPlayer();
1214 return pl
!= chr
&& pl
->IsVisibleGloballyFor(chr
);
1217 const char *CliHandler::GetMangosString(int32 entry
) const
1219 return objmgr
.GetMangosStringForDBCLocale(entry
);
1222 bool CliHandler::isAvailable(ChatCommand
const& cmd
) const
1224 // skip non-console commands in console case
1225 return cmd
.AllowConsole
;
1228 void CliHandler::SendSysMessage(const char *str
)
1234 const char *CliHandler::GetName() const
1236 return GetMangosString(LANG_CONSOLE_COMMAND
);
1239 bool CliHandler::needReportToTarget(Player
* /*chr*/) const