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
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"
34 #include "AccountMgr.h"
36 // Supported shift-links (client generated and server side)
37 // |color|Harea:area_id|h[name]|h|r
38 // |color|Hcreature:creature_guid|h[name]|h|r
39 // |color|Hcreature_entry:creature_id|h[name]|h|r
40 // |color|Hgameevent:id|h[name]|h|r
41 // |color|Hgameobject:go_guid|h[name]|h|r
42 // |color|Hgameobject_entry:go_id|h[name]|h|r
43 // |color|Hitem:item_id:perm_ench_id:0:0|h[name]|h|r
44 // |color|Hitemset:itemset_id|h[name]|h|r
45 // |color|Hplayer:name|h[name]|h|r - client, in some messages, at click copy only name instead link
46 // |color|Hquest:quest_id|h[name]|h|r
47 // |color|Hskill:skill_id|h[name]|h|r
48 // |color|Hspell:spell_id|h[name]|h|r - client, spellbook spell icon shift-click
49 // |color|Htalent:talent_id,rank|h[name]|h|r - client, talent icon shift-click
50 // |color|Htele:id|h[name]|h|r
51 // |color|Htrade:spell_id,cur_value,max_value,unk3int,unk3str|h[name]|h|r - client, spellbook profession icon shift-click
53 bool ChatHandler::load_command_table
= true;
55 ChatCommand
* ChatHandler::getCommandTable()
57 static ChatCommand accountSetCommandTable
[] =
59 { "addon", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleAccountSetAddonCommand
, "", NULL
},
60 { "gmlevel", SEC_CONSOLE
, true, &ChatHandler::HandleAccountSetGmLevelCommand
, "", NULL
},
61 { "password", SEC_CONSOLE
, true, &ChatHandler::HandleAccountSetPasswordCommand
, "", NULL
},
62 { NULL
, 0, false, NULL
, "", NULL
}
65 static ChatCommand accountCommandTable
[] =
67 { "create", SEC_CONSOLE
, true, &ChatHandler::HandleAccountCreateCommand
, "", NULL
},
68 { "delete", SEC_CONSOLE
, true, &ChatHandler::HandleAccountDeleteCommand
, "", NULL
},
69 { "onlinelist", SEC_CONSOLE
, true, &ChatHandler::HandleAccountOnlineListCommand
, "", NULL
},
70 { "set", SEC_ADMINISTRATOR
, true, NULL
, "", accountSetCommandTable
},
71 { "", SEC_PLAYER
, false, &ChatHandler::HandleAccountCommand
, "", NULL
},
72 { NULL
, 0, false, NULL
, "", NULL
}
75 static ChatCommand serverSetCommandTable
[] =
77 { "loglevel", SEC_CONSOLE
, true, &ChatHandler::HandleServerSetLogLevelCommand
, "", NULL
},
78 { "motd", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleServerSetMotdCommand
, "", NULL
},
79 { NULL
, 0, false, NULL
, "", NULL
}
82 static ChatCommand serverIdleRestartCommandTable
[] =
84 { "cancel", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleServerShutDownCancelCommand
,"", NULL
},
85 { "" , SEC_ADMINISTRATOR
, true, &ChatHandler::HandleServerIdleRestartCommand
, "", NULL
},
86 { NULL
, 0, false, NULL
, "", NULL
}
89 static ChatCommand serverIdleShutdownCommandTable
[] =
91 { "cancel", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleServerShutDownCancelCommand
,"", NULL
},
92 { "" , SEC_ADMINISTRATOR
, true, &ChatHandler::HandleServerIdleShutDownCommand
, "", NULL
},
93 { NULL
, 0, false, NULL
, "", NULL
}
96 static ChatCommand serverRestartCommandTable
[] =
98 { "cancel", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleServerShutDownCancelCommand
,"", NULL
},
99 { "" , SEC_ADMINISTRATOR
, true, &ChatHandler::HandleServerRestartCommand
, "", NULL
},
100 { NULL
, 0, false, NULL
, "", NULL
}
103 static ChatCommand serverShutdownCommandTable
[] =
105 { "cancel", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleServerShutDownCancelCommand
,"", NULL
},
106 { "" , SEC_ADMINISTRATOR
, true, &ChatHandler::HandleServerShutDownCommand
, "", NULL
},
107 { NULL
, 0, false, NULL
, "", NULL
}
110 static ChatCommand serverCommandTable
[] =
112 { "corpses", SEC_GAMEMASTER
, true, &ChatHandler::HandleServerCorpsesCommand
, "", NULL
},
113 { "exit", SEC_CONSOLE
, true, &ChatHandler::HandleServerExitCommand
, "", NULL
},
114 { "idlerestart", SEC_ADMINISTRATOR
, true, NULL
, "", serverIdleRestartCommandTable
},
115 { "idleshutdown", SEC_ADMINISTRATOR
, true, NULL
, "", serverShutdownCommandTable
},
116 { "info", SEC_PLAYER
, true, &ChatHandler::HandleServerInfoCommand
, "", NULL
},
117 { "motd", SEC_PLAYER
, true, &ChatHandler::HandleServerMotdCommand
, "", NULL
},
118 { "restart", SEC_ADMINISTRATOR
, true, NULL
, "", serverRestartCommandTable
},
119 { "shutdown", SEC_ADMINISTRATOR
, true, NULL
, "", serverShutdownCommandTable
},
120 { "set", SEC_ADMINISTRATOR
, true, NULL
, "", serverSetCommandTable
},
121 { NULL
, 0, false, NULL
, "", NULL
}
124 static ChatCommand modifyCommandTable
[] =
126 { "hp", SEC_MODERATOR
, false, &ChatHandler::HandleModifyHPCommand
, "", NULL
},
127 { "mana", SEC_MODERATOR
, false, &ChatHandler::HandleModifyManaCommand
, "", NULL
},
128 { "rage", SEC_MODERATOR
, false, &ChatHandler::HandleModifyRageCommand
, "", NULL
},
129 { "runicpower", SEC_MODERATOR
, false, &ChatHandler::HandleModifyRunicPowerCommand
, "", NULL
},
130 { "energy", SEC_MODERATOR
, false, &ChatHandler::HandleModifyEnergyCommand
, "", NULL
},
131 { "money", SEC_MODERATOR
, false, &ChatHandler::HandleModifyMoneyCommand
, "", NULL
},
132 { "speed", SEC_MODERATOR
, false, &ChatHandler::HandleModifySpeedCommand
, "", NULL
},
133 { "swim", SEC_MODERATOR
, false, &ChatHandler::HandleModifySwimCommand
, "", NULL
},
134 { "scale", SEC_MODERATOR
, false, &ChatHandler::HandleModifyScaleCommand
, "", NULL
},
135 { "bit", SEC_MODERATOR
, false, &ChatHandler::HandleModifyBitCommand
, "", NULL
},
136 { "bwalk", SEC_MODERATOR
, false, &ChatHandler::HandleModifyBWalkCommand
, "", NULL
},
137 { "fly", SEC_MODERATOR
, false, &ChatHandler::HandleModifyFlyCommand
, "", NULL
},
138 { "aspeed", SEC_MODERATOR
, false, &ChatHandler::HandleModifyASpeedCommand
, "", NULL
},
139 { "faction", SEC_MODERATOR
, false, &ChatHandler::HandleModifyFactionCommand
, "", NULL
},
140 { "spell", SEC_MODERATOR
, false, &ChatHandler::HandleModifySpellCommand
, "", NULL
},
141 { "tp", SEC_MODERATOR
, false, &ChatHandler::HandleModifyTalentCommand
, "", NULL
},
142 { "titles", SEC_MODERATOR
, false, &ChatHandler::HandleModifyKnownTitlesCommand
, "", NULL
},
143 { "mount", SEC_MODERATOR
, false, &ChatHandler::HandleModifyMountCommand
, "", NULL
},
144 { "honor", SEC_MODERATOR
, false, &ChatHandler::HandleModifyHonorCommand
, "", NULL
},
145 { "rep", SEC_MODERATOR
, false, &ChatHandler::HandleModifyRepCommand
, "", NULL
},
146 { "arena", SEC_MODERATOR
, false, &ChatHandler::HandleModifyArenaCommand
, "", NULL
},
147 { "drunk", SEC_MODERATOR
, false, &ChatHandler::HandleDrunkCommand
, "", NULL
},
148 { "standstate", SEC_GAMEMASTER
, false, &ChatHandler::HandleStandStateCommand
, "", NULL
},
149 { "morph", SEC_GAMEMASTER
, false, &ChatHandler::HandleMorphCommand
, "", NULL
},
150 { "phase", SEC_GAMEMASTER
, false, &ChatHandler::HandleModifyPhaseCommand
, "", NULL
},
151 { "gender", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleModifyGenderCommand
, "", NULL
},
152 { NULL
, 0, false, NULL
, "", NULL
}
155 static ChatCommand wpCommandTable
[] =
157 { "show", SEC_GAMEMASTER
, false, &ChatHandler::HandleWpShowCommand
, "", NULL
},
158 { "add", SEC_GAMEMASTER
, false, &ChatHandler::HandleWpAddCommand
, "", NULL
},
159 { "modify", SEC_GAMEMASTER
, false, &ChatHandler::HandleWpModifyCommand
, "", NULL
},
160 { "export", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleWpExportCommand
, "", NULL
},
161 { "import", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleWpImportCommand
, "", NULL
},
162 { NULL
, 0, false, NULL
, "", NULL
}
165 static ChatCommand banCommandTable
[] =
167 { "account", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanAccountCommand
, "", NULL
},
168 { "character", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanCharacterCommand
, "", NULL
},
169 { "ip", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanIPCommand
, "", NULL
},
170 { NULL
, 0, false, NULL
, "", NULL
}
173 static ChatCommand baninfoCommandTable
[] =
175 { "account", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanInfoAccountCommand
, "", NULL
},
176 { "character", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanInfoCharacterCommand
, "", NULL
},
177 { "ip", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanInfoIPCommand
, "", NULL
},
178 { NULL
, 0, false, NULL
, "", NULL
}
181 static ChatCommand banlistCommandTable
[] =
183 { "account", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanListAccountCommand
, "", NULL
},
184 { "character", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanListCharacterCommand
, "", NULL
},
185 { "ip", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleBanListIPCommand
, "", NULL
},
186 { NULL
, 0, false, NULL
, "", NULL
}
189 static ChatCommand unbanCommandTable
[] =
191 { "account", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleUnBanAccountCommand
, "", NULL
},
192 { "character", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleUnBanCharacterCommand
, "", NULL
},
193 { "ip", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleUnBanIPCommand
, "", NULL
},
194 { NULL
, 0, false, NULL
, "", NULL
}
197 static ChatCommand debugCommandTable
[] =
199 { "inarc", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleDebugInArcCommand
, "", NULL
},
200 { "spellfail", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleDebugSpellFailCommand
, "", NULL
},
201 { "setpoi", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSetPoiCommand
, "", NULL
},
202 { "qpartymsg", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSendQuestPartyMsgCommand
, "", NULL
},
203 { "qinvalidmsg", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSendQuestInvalidMsgCommand
, "", NULL
},
204 { "equiperr", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleEquipErrorCommand
, "", NULL
},
205 { "sellerr", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSellErrorCommand
, "", NULL
},
206 { "buyerr", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleBuyErrorCommand
, "", NULL
},
207 { "sendopcode", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSendOpcodeCommand
, "", NULL
},
208 { "spawnvehicle", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSpawnVehicle
, "", NULL
},
209 { "uws", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleUpdateWorldStateCommand
, "", NULL
},
210 { "ps", SEC_ADMINISTRATOR
, false, &ChatHandler::HandlePlaySound2Command
, "", NULL
},
211 { "scn", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSendChannelNotifyCommand
, "", NULL
},
212 { "scm", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSendChatMsgCommand
, "", NULL
},
213 { "getitemstate", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleGetItemState
, "", NULL
},
214 { "playsound", SEC_MODERATOR
, false, &ChatHandler::HandlePlaySoundCommand
, "", NULL
},
215 { "update", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleUpdate
, "", NULL
},
216 { "setvalue", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSetValue
, "", NULL
},
217 { "getvalue", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleGetValue
, "", NULL
},
218 { "Mod32Value", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleMod32Value
, "", NULL
},
219 { "anim", SEC_GAMEMASTER
, false, &ChatHandler::HandleAnimCommand
, "", NULL
},
220 { "lootrecipient", SEC_GAMEMASTER
, false, &ChatHandler::HandleGetLootRecipient
, "", NULL
},
221 { "arena", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleDebugArenaCommand
, "", NULL
},
222 { "sendlargepacket",SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSendLargePacketCommand
, "", NULL
},
223 { NULL
, 0, false, NULL
, "", NULL
}
226 static ChatCommand eventCommandTable
[] =
228 { "activelist", SEC_GAMEMASTER
, true, &ChatHandler::HandleEventActiveListCommand
, "", NULL
},
229 { "start", SEC_GAMEMASTER
, true, &ChatHandler::HandleEventStartCommand
, "", NULL
},
230 { "stop", SEC_GAMEMASTER
, true, &ChatHandler::HandleEventStopCommand
, "", NULL
},
231 { "", SEC_GAMEMASTER
, true, &ChatHandler::HandleEventInfoCommand
, "", NULL
},
232 { NULL
, 0, false, NULL
, "", NULL
}
235 static ChatCommand learnCommandTable
[] =
237 { "all", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleLearnAllCommand
, "", NULL
},
238 { "all_gm", SEC_GAMEMASTER
, false, &ChatHandler::HandleLearnAllGMCommand
, "", NULL
},
239 { "all_crafts", SEC_GAMEMASTER
, false, &ChatHandler::HandleLearnAllCraftsCommand
, "", NULL
},
240 { "all_default", SEC_MODERATOR
, false, &ChatHandler::HandleLearnAllDefaultCommand
, "", NULL
},
241 { "all_lang", SEC_MODERATOR
, false, &ChatHandler::HandleLearnAllLangCommand
, "", NULL
},
242 { "all_myclass", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleLearnAllMyClassCommand
, "", NULL
},
243 { "all_myspells", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleLearnAllMySpellsCommand
, "", NULL
},
244 { "all_mytalents", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleLearnAllMyTalentsCommand
, "", NULL
},
245 { "all_recipes", SEC_GAMEMASTER
, false, &ChatHandler::HandleLearnAllRecipesCommand
, "", NULL
},
246 { "", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleLearnCommand
, "", NULL
},
247 { NULL
, 0, false, NULL
, "", NULL
}
250 static ChatCommand reloadCommandTable
[] =
252 { "all", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllCommand
, "", NULL
},
253 { "all_loot", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllLootCommand
, "", NULL
},
254 { "all_npc", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllNpcCommand
, "", NULL
},
255 { "all_quest", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllQuestCommand
, "", NULL
},
256 { "all_scripts", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllScriptsCommand
, "", NULL
},
257 { "all_spell", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllSpellCommand
, "", NULL
},
258 { "all_item", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllItemCommand
, "", NULL
},
259 { "all_locales", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAllLocalesCommand
, "", NULL
},
261 { "config", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadConfigCommand
, "", NULL
},
263 { "areatrigger_tavern", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAreaTriggerTavernCommand
, "", NULL
},
264 { "areatrigger_teleport", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadAreaTriggerTeleportCommand
, "", NULL
},
265 { "areatrigger_involvedrelation",SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadQuestAreaTriggersCommand
, "", NULL
},
266 { "event_scripts", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadEventScriptsCommand
, "", NULL
},
267 { "command", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadCommandCommand
, "", NULL
},
268 { "creature_involvedrelation", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadCreatureQuestInvRelationsCommand
,"",NULL
},
269 { "creature_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesCreatureCommand
, "", NULL
},
270 { "creature_questrelation", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadCreatureQuestRelationsCommand
, "", NULL
},
271 { "db_script_string", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadDbScriptStringCommand
, "", NULL
},
272 { "disenchant_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesDisenchantCommand
, "", NULL
},
273 { "fishing_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesFishingCommand
, "", NULL
},
274 { "game_graveyard_zone", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadGameGraveyardZoneCommand
, "", NULL
},
275 { "game_tele", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadGameTeleCommand
, "", NULL
},
276 { "gameobject_involvedrelation", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadGOQuestInvRelationsCommand
, "", NULL
},
277 { "gameobject_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesGameobjectCommand
, "", NULL
},
278 { "gameobject_questrelation", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadGOQuestRelationsCommand
, "", NULL
},
279 { "gameobject_scripts", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadGameObjectScriptsCommand
, "", NULL
},
280 { "item_enchantment_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadItemEnchantementsCommand
, "", NULL
},
281 { "item_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesItemCommand
, "", NULL
},
282 { "mangos_string", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadMangosStringCommand
, "", NULL
},
283 { "milling_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesMillingCommand
, "", NULL
},
284 { "npc_gossip", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadNpcGossipCommand
, "", NULL
},
285 { "npc_option", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadNpcOptionCommand
, "", NULL
},
286 { "npc_trainer", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadNpcTrainerCommand
, "", NULL
},
287 { "npc_vendor", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadNpcVendorCommand
, "", NULL
},
288 { "page_text", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadPageTextsCommand
, "", NULL
},
289 { "pickpocketing_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesPickpocketingCommand
,"",NULL
},
290 { "prospecting_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesProspectingCommand
,"", NULL
},
291 { "quest_mail_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesQuestMailCommand
, "", NULL
},
292 { "quest_end_scripts", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadQuestEndScriptsCommand
, "", NULL
},
293 { "quest_start_scripts", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadQuestStartScriptsCommand
, "", NULL
},
294 { "quest_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadQuestTemplateCommand
, "", NULL
},
295 { "reference_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesReferenceCommand
, "", NULL
},
296 { "reserved_name", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadReservedNameCommand
, "", NULL
},
297 { "skill_discovery_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSkillDiscoveryTemplateCommand
, "", NULL
},
298 { "skill_extra_item_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSkillExtraItemTemplateCommand
, "", NULL
},
299 { "skill_fishing_base_level", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSkillFishingBaseLevelCommand
, "", NULL
},
300 { "skinning_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesSkinningCommand
, "", NULL
},
301 { "spell_affect", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellAffectCommand
, "", NULL
},
302 { "spell_chain", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellChainCommand
, "", NULL
},
303 { "spell_elixir", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellElixirCommand
, "", NULL
},
304 { "spell_learn_spell", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellLearnSpellCommand
, "", NULL
},
305 { "spell_loot_template", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLootTemplatesSpellCommand
, "", NULL
},
306 { "spell_pet_auras", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellPetAurasCommand
, "", NULL
},
307 { "spell_proc_event", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellProcEventCommand
, "", NULL
},
308 { "spell_bonus_data", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellBonusesCommand
, "", NULL
},
309 { "spell_script_target", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellScriptTargetCommand
, "", NULL
},
310 { "spell_scripts", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellScriptsCommand
, "", NULL
},
311 { "spell_target_position", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellTargetPositionCommand
, "", NULL
},
312 { "spell_threats", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadSpellThreatsCommand
, "", NULL
},
313 { "locales_creature", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLocalesCreatureCommand
, "", NULL
},
314 { "locales_gameobject", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLocalesGameobjectCommand
, "", NULL
},
315 { "locales_item", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLocalesItemCommand
, "", NULL
},
316 { "locales_npc_text", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLocalesNpcTextCommand
, "", NULL
},
317 { "locales_page_text", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLocalesPageTextCommand
, "", NULL
},
318 { "locales_quest", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleReloadLocalesQuestCommand
, "", NULL
},
320 { NULL
, 0, false, NULL
, "", NULL
}
323 static ChatCommand honorCommandTable
[] =
325 { "add", SEC_GAMEMASTER
, false, &ChatHandler::HandleAddHonorCommand
, "", NULL
},
326 { "addkill", SEC_GAMEMASTER
, false, &ChatHandler::HandleHonorAddKillCommand
, "", NULL
},
327 { "update", SEC_GAMEMASTER
, false, &ChatHandler::HandleUpdateHonorFieldsCommand
, "", NULL
},
328 { NULL
, 0, false, NULL
, "", NULL
}
331 static ChatCommand guildCommandTable
[] =
333 { "create", SEC_GAMEMASTER
, true, &ChatHandler::HandleGuildCreateCommand
, "", NULL
},
334 { "delete", SEC_GAMEMASTER
, true, &ChatHandler::HandleGuildDeleteCommand
, "", NULL
},
335 { "invite", SEC_GAMEMASTER
, true, &ChatHandler::HandleGuildInviteCommand
, "", NULL
},
336 { "uninvite", SEC_GAMEMASTER
, true, &ChatHandler::HandleGuildUninviteCommand
, "", NULL
},
337 { "rank", SEC_GAMEMASTER
, true, &ChatHandler::HandleGuildRankCommand
, "", NULL
},
338 { NULL
, 0, false, NULL
, "", NULL
}
341 static ChatCommand lookupPlayerCommandTable
[] =
343 { "ip", SEC_GAMEMASTER
, true, &ChatHandler::HandleLookupPlayerIpCommand
, "", NULL
},
344 { "account", SEC_GAMEMASTER
, true, &ChatHandler::HandleLookupPlayerAccountCommand
, "", NULL
},
345 { "email", SEC_GAMEMASTER
, true, &ChatHandler::HandleLookupPlayerEmailCommand
, "", NULL
},
346 { NULL
, 0, false, NULL
, "", NULL
}
349 static ChatCommand lookupCommandTable
[] =
351 { "area", SEC_MODERATOR
, true, &ChatHandler::HandleLookupAreaCommand
, "", NULL
},
352 { "creature", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupCreatureCommand
, "", NULL
},
353 { "event", SEC_GAMEMASTER
, true, &ChatHandler::HandleLookupEventCommand
, "", NULL
},
354 { "faction", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupFactionCommand
, "", NULL
},
355 { "item", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupItemCommand
, "", NULL
},
356 { "itemset", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupItemSetCommand
, "", NULL
},
357 { "object", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupObjectCommand
, "", NULL
},
358 { "quest", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupQuestCommand
, "", NULL
},
359 { "player", SEC_GAMEMASTER
, true, NULL
, "", lookupPlayerCommandTable
},
360 { "skill", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupSkillCommand
, "", NULL
},
361 { "spell", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLookupSpellCommand
, "", NULL
},
362 { "tele", SEC_MODERATOR
, true, &ChatHandler::HandleLookupTeleCommand
, "", NULL
},
363 { NULL
, 0, false, NULL
, "", NULL
}
366 static ChatCommand resetCommandTable
[] =
368 { "achievements", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleResetAchievementsCommand
, "", NULL
},
369 { "honor", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleResetHonorCommand
, "", NULL
},
370 { "level", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleResetLevelCommand
, "", NULL
},
371 { "spells", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleResetSpellsCommand
, "", NULL
},
372 { "stats", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleResetStatsCommand
, "", NULL
},
373 { "talents", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleResetTalentsCommand
, "", NULL
},
374 { "all", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleResetAllCommand
, "", NULL
},
375 { NULL
, 0, false, NULL
, "", NULL
}
378 static ChatCommand castCommandTable
[] =
380 { "back", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleCastBackCommand
, "", NULL
},
381 { "dist", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleCastDistCommand
, "", NULL
},
382 { "self", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleCastSelfCommand
, "", NULL
},
383 { "target", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleCastTargetCommand
, "", NULL
},
384 { "", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleCastCommand
, "", NULL
},
385 { NULL
, 0, false, NULL
, "", NULL
}
388 static ChatCommand pdumpCommandTable
[] =
390 { "load", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLoadPDumpCommand
, "", NULL
},
391 { "write", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleWritePDumpCommand
, "", NULL
},
392 { NULL
, 0, false, NULL
, "", NULL
}
395 static ChatCommand listCommandTable
[] =
397 { "creature", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleListCreatureCommand
, "", NULL
},
398 { "item", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleListItemCommand
, "", NULL
},
399 { "object", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleListObjectCommand
, "", NULL
},
400 { "auras", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleListAurasCommand
, "", NULL
},
401 { NULL
, 0, false, NULL
, "", NULL
}
404 static ChatCommand teleCommandTable
[] =
406 { "add", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleAddTeleCommand
, "", NULL
},
407 { "del", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleDelTeleCommand
, "", NULL
},
408 { "name", SEC_MODERATOR
, true, &ChatHandler::HandleNameTeleCommand
, "", NULL
},
409 { "group", SEC_MODERATOR
, false, &ChatHandler::HandleGroupTeleCommand
, "", NULL
},
410 { "", SEC_MODERATOR
, false, &ChatHandler::HandleTeleCommand
, "", NULL
},
411 { NULL
, 0, false, NULL
, "", NULL
}
414 static ChatCommand npcCommandTable
[] =
416 { "say", SEC_MODERATOR
, false, &ChatHandler::HandleNpcSayCommand
, "", NULL
},
417 { "textemote", SEC_MODERATOR
, false, &ChatHandler::HandleNpcTextEmoteCommand
, "", NULL
},
418 { "add", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcAddCommand
, "", NULL
},
419 { "delete", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcDeleteCommand
, "", NULL
},
420 { "spawndist", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcSpawnDistCommand
, "", NULL
},
421 { "spawntime", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcSpawnTimeCommand
, "", NULL
},
422 { "factionid", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcFactionIdCommand
, "", NULL
},
423 { "addmove", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcAddMoveCommand
, "", NULL
},
424 { "setmovetype", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcSetMoveTypeCommand
, "", NULL
},
425 { "move", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcMoveCommand
, "", NULL
},
426 { "changelevel", SEC_GAMEMASTER
, false, &ChatHandler::HandleChangeLevelCommand
, "", NULL
},
427 { "setmodel", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcSetModelCommand
, "", NULL
},
428 { "additem", SEC_GAMEMASTER
, false, &ChatHandler::HandleAddVendorItemCommand
, "", NULL
},
429 { "delitem", SEC_GAMEMASTER
, false, &ChatHandler::HandleDelVendorItemCommand
, "", NULL
},
430 { "flag", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcFlagCommand
, "", NULL
},
431 { "changeentry", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleNpcChangeEntryCommand
, "", NULL
},
432 { "info", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleNpcInfoCommand
, "", NULL
},
433 { "playemote", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleNpcPlayEmoteCommand
, "", NULL
},
434 { "follow", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcFollowCommand
, "", NULL
},
435 { "setphase", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcSetPhaseCommand
, "", NULL
},
436 { "unfollow", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcUnFollowCommand
, "", NULL
},
437 { "whisper", SEC_MODERATOR
, false, &ChatHandler::HandleNpcWhisperCommand
, "", NULL
},
438 { "yell", SEC_MODERATOR
, false, &ChatHandler::HandleNpcYellCommand
, "", NULL
},
439 { "tame", SEC_GAMEMASTER
, false, &ChatHandler::HandleNpcTameCommand
, "", NULL
},
441 //{ TODO: fix or remove this commands
442 { "name", SEC_GAMEMASTER
, false, &ChatHandler::HandleNameCommand
, "", NULL
},
443 { "subname", SEC_GAMEMASTER
, false, &ChatHandler::HandleSubNameCommand
, "", NULL
},
444 { "addweapon", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleAddWeaponCommand
, "", NULL
},
447 { NULL
, 0, false, NULL
, "", NULL
}
450 static ChatCommand goCommandTable
[] =
452 { "grid", SEC_MODERATOR
, false, &ChatHandler::HandleGoGridCommand
, "", NULL
},
453 { "creature", SEC_GAMEMASTER
, false, &ChatHandler::HandleGoCreatureCommand
, "", NULL
},
454 { "object", SEC_GAMEMASTER
, false, &ChatHandler::HandleGoObjectCommand
, "", NULL
},
455 { "trigger", SEC_GAMEMASTER
, false, &ChatHandler::HandleGoTriggerCommand
, "", NULL
},
456 { "graveyard", SEC_GAMEMASTER
, false, &ChatHandler::HandleGoGraveyardCommand
, "", NULL
},
457 { "zonexy", SEC_MODERATOR
, false, &ChatHandler::HandleGoZoneXYCommand
, "", NULL
},
458 { "xy", SEC_MODERATOR
, false, &ChatHandler::HandleGoXYCommand
, "", NULL
},
459 { "xyz", SEC_MODERATOR
, false, &ChatHandler::HandleGoXYZCommand
, "", NULL
},
460 { "", SEC_MODERATOR
, false, &ChatHandler::HandleGoXYZCommand
, "", NULL
},
461 { NULL
, 0, false, NULL
, "", NULL
}
464 static ChatCommand gobjectCommandTable
[] =
466 { "add", SEC_GAMEMASTER
, false, &ChatHandler::HandleGameObjectCommand
, "", NULL
},
467 { "delete", SEC_GAMEMASTER
, false, &ChatHandler::HandleDelObjectCommand
, "", NULL
},
468 { "move", SEC_GAMEMASTER
, false, &ChatHandler::HandleMoveObjectCommand
, "", NULL
},
469 { "near", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleNearObjectCommand
, "", NULL
},
470 { "setphase", SEC_GAMEMASTER
, false, &ChatHandler::HandleGOPhaseCommand
, "", NULL
},
471 { "target", SEC_GAMEMASTER
, false, &ChatHandler::HandleTargetObjectCommand
, "", NULL
},
472 { "turn", SEC_GAMEMASTER
, false, &ChatHandler::HandleTurnObjectCommand
, "", NULL
},
473 { NULL
, 0, false, NULL
, "", NULL
}
476 static ChatCommand questCommandTable
[] =
478 { "add", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleAddQuest
, "", NULL
},
479 { "complete", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleCompleteQuest
, "", NULL
},
480 { "remove", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleRemoveQuest
, "", NULL
},
481 { NULL
, 0, false, NULL
, "", NULL
}
484 static ChatCommand gmCommandTable
[] =
486 { "chat", SEC_MODERATOR
, false, &ChatHandler::HandleGMChatCommand
, "", NULL
},
487 { "ingame", SEC_PLAYER
, true, &ChatHandler::HandleGMListIngameCommand
, "", NULL
},
488 { "list", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleGMListFullCommand
, "", NULL
},
489 { "visible", SEC_MODERATOR
, false, &ChatHandler::HandleVisibleCommand
, "", NULL
},
490 { "fly", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleFlyModeCommand
, "", NULL
},
491 { "", SEC_MODERATOR
, false, &ChatHandler::HandleGMmodeCommand
, "", NULL
},
492 { NULL
, 0, false, NULL
, "", NULL
}
495 static ChatCommand instanceCommandTable
[] =
497 { "listbinds", SEC_MODERATOR
, false, &ChatHandler::HandleInstanceListBindsCommand
, "", NULL
},
498 { "unbind", SEC_MODERATOR
, false, &ChatHandler::HandleInstanceUnbindCommand
, "", NULL
},
499 { "stats", SEC_MODERATOR
, true, &ChatHandler::HandleInstanceStatsCommand
, "", NULL
},
500 { "savedata", SEC_MODERATOR
, false, &ChatHandler::HandleInstanceSaveDataCommand
, "", NULL
},
501 { NULL
, 0, false, NULL
, "", NULL
}
504 static ChatCommand commandTable
[] =
506 { "account", SEC_PLAYER
, true, NULL
, "", accountCommandTable
},
507 { "gm", SEC_MODERATOR
, true, NULL
, "", gmCommandTable
},
508 { "npc", SEC_MODERATOR
, false, NULL
, "", npcCommandTable
},
509 { "go", SEC_MODERATOR
, false, NULL
, "", goCommandTable
},
510 { "learn", SEC_MODERATOR
, false, NULL
, "", learnCommandTable
},
511 { "modify", SEC_MODERATOR
, false, NULL
, "", modifyCommandTable
},
512 { "debug", SEC_MODERATOR
, false, NULL
, "", debugCommandTable
},
513 { "tele", SEC_MODERATOR
, true, NULL
, "", teleCommandTable
},
514 { "event", SEC_GAMEMASTER
, false, NULL
, "", eventCommandTable
},
515 { "gobject", SEC_GAMEMASTER
, false, NULL
, "", gobjectCommandTable
},
516 { "honor", SEC_GAMEMASTER
, false, NULL
, "", honorCommandTable
},
517 { "wp", SEC_GAMEMASTER
, false, NULL
, "", wpCommandTable
},
518 { "quest", SEC_ADMINISTRATOR
, false, NULL
, "", questCommandTable
},
519 { "reload", SEC_ADMINISTRATOR
, true, NULL
, "", reloadCommandTable
},
520 { "list", SEC_ADMINISTRATOR
, true, NULL
, "", listCommandTable
},
521 { "lookup", SEC_ADMINISTRATOR
, true, NULL
, "", lookupCommandTable
},
522 { "pdump", SEC_ADMINISTRATOR
, true, NULL
, "", pdumpCommandTable
},
523 { "guild", SEC_ADMINISTRATOR
, true, NULL
, "", guildCommandTable
},
524 { "cast", SEC_ADMINISTRATOR
, false, NULL
, "", castCommandTable
},
525 { "reset", SEC_ADMINISTRATOR
, false, NULL
, "", resetCommandTable
},
526 { "instance", SEC_ADMINISTRATOR
, true, NULL
, "", instanceCommandTable
},
527 { "server", SEC_ADMINISTRATOR
, true, NULL
, "", serverCommandTable
},
529 { "aura", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleAuraCommand
, "", NULL
},
530 { "unaura", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleUnAuraCommand
, "", NULL
},
531 { "announce", SEC_MODERATOR
, true, &ChatHandler::HandleAnnounceCommand
, "", NULL
},
532 { "notify", SEC_MODERATOR
, true, &ChatHandler::HandleNotifyCommand
, "", NULL
},
533 { "goname", SEC_MODERATOR
, false, &ChatHandler::HandleGonameCommand
, "", NULL
},
534 { "namego", SEC_MODERATOR
, false, &ChatHandler::HandleNamegoCommand
, "", NULL
},
535 { "groupgo", SEC_MODERATOR
, false, &ChatHandler::HandleGroupgoCommand
, "", NULL
},
536 { "commands", SEC_PLAYER
, true, &ChatHandler::HandleCommandsCommand
, "", NULL
},
537 { "demorph", SEC_GAMEMASTER
, false, &ChatHandler::HandleDeMorphCommand
, "", NULL
},
538 { "die", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleDieCommand
, "", NULL
},
539 { "revive", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleReviveCommand
, "", NULL
},
540 { "dismount", SEC_PLAYER
, false, &ChatHandler::HandleDismountCommand
, "", NULL
},
541 { "gps", SEC_MODERATOR
, false, &ChatHandler::HandleGPSCommand
, "", NULL
},
542 { "guid", SEC_GAMEMASTER
, false, &ChatHandler::HandleGUIDCommand
, "", NULL
},
543 { "help", SEC_PLAYER
, true, &ChatHandler::HandleHelpCommand
, "", NULL
},
544 { "itemmove", SEC_GAMEMASTER
, false, &ChatHandler::HandleItemMoveCommand
, "", NULL
},
545 { "cooldown", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleCooldownCommand
, "", NULL
},
546 { "unlearn", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleUnLearnCommand
, "", NULL
},
547 { "distance", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleGetDistanceCommand
, "", NULL
},
548 { "recall", SEC_MODERATOR
, false, &ChatHandler::HandleRecallCommand
, "", NULL
},
549 { "save", SEC_PLAYER
, false, &ChatHandler::HandleSaveCommand
, "", NULL
},
550 { "saveall", SEC_MODERATOR
, true, &ChatHandler::HandleSaveAllCommand
, "", NULL
},
551 { "kick", SEC_GAMEMASTER
, true, &ChatHandler::HandleKickPlayerCommand
, "", NULL
},
552 { "ban", SEC_ADMINISTRATOR
, true, NULL
, "", banCommandTable
},
553 { "unban", SEC_ADMINISTRATOR
, true, NULL
, "", unbanCommandTable
},
554 { "baninfo", SEC_ADMINISTRATOR
, false, NULL
, "", baninfoCommandTable
},
555 { "banlist", SEC_ADMINISTRATOR
, true, NULL
, "", banlistCommandTable
},
556 { "plimit", SEC_ADMINISTRATOR
, true, &ChatHandler::HandlePLimitCommand
, "", NULL
},
557 { "start", SEC_PLAYER
, false, &ChatHandler::HandleStartCommand
, "", NULL
},
558 { "taxicheat", SEC_MODERATOR
, false, &ChatHandler::HandleTaxiCheatCommand
, "", NULL
},
559 { "allowmove", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleAllowMovementCommand
, "", NULL
},
560 { "linkgrave", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleLinkGraveCommand
, "", NULL
},
561 { "neargrave", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleNearGraveCommand
, "", NULL
},
562 { "explorecheat", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleExploreCheatCommand
, "", NULL
},
563 { "hover", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleHoverCommand
, "", NULL
},
564 { "levelup", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleLevelUpCommand
, "", NULL
},
565 { "showarea", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleShowAreaCommand
, "", NULL
},
566 { "hidearea", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleHideAreaCommand
, "", NULL
},
567 { "additem", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleAddItemCommand
, "", NULL
},
568 { "additemset", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleAddItemSetCommand
, "", NULL
},
569 { "bank", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleBankCommand
, "", NULL
},
570 { "wchange", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleChangeWeather
, "", NULL
},
571 { "ticket", SEC_GAMEMASTER
, true, &ChatHandler::HandleTicketCommand
, "", NULL
},
572 { "delticket", SEC_GAMEMASTER
, true, &ChatHandler::HandleDelTicketCommand
, "", NULL
},
573 { "maxskill", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleMaxSkillCommand
, "", NULL
},
574 { "setskill", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleSetSkillCommand
, "", NULL
},
575 { "whispers", SEC_MODERATOR
, false, &ChatHandler::HandleWhispersCommand
, "", NULL
},
576 { "pinfo", SEC_GAMEMASTER
, true, &ChatHandler::HandlePInfoCommand
, "", NULL
},
577 { "password", SEC_PLAYER
, false, &ChatHandler::HandlePasswordCommand
, "", NULL
},
578 { "lockaccount", SEC_PLAYER
, false, &ChatHandler::HandleLockAccountCommand
, "", NULL
},
579 { "respawn", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleRespawnCommand
, "", NULL
},
580 { "senditems", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleSendItemsCommand
, "", NULL
},
581 { "sendmail", SEC_MODERATOR
, true, &ChatHandler::HandleSendMailCommand
, "", NULL
},
582 { "sendmoney", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleSendMoneyCommand
, "", NULL
},
583 { "rename", SEC_GAMEMASTER
, true, &ChatHandler::HandleRenameCommand
, "", NULL
},
584 { "customize", SEC_GAMEMASTER
, true, &ChatHandler::HandleCustomizeCommand
, "", NULL
},
585 { "loadscripts", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleLoadScriptsCommand
, "", NULL
},
586 { "mute", SEC_GAMEMASTER
, true, &ChatHandler::HandleMuteCommand
, "", NULL
},
587 { "unmute", SEC_GAMEMASTER
, true, &ChatHandler::HandleUnmuteCommand
, "", NULL
},
588 { "movegens", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleMovegensCommand
, "", NULL
},
589 { "cometome", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleComeToMeCommand
, "", NULL
},
590 { "damage", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleDamageCommand
, "", NULL
},
591 { "combatstop", SEC_GAMEMASTER
, false, &ChatHandler::HandleCombatStopCommand
, "", NULL
},
592 { "flusharenapoints", SEC_ADMINISTRATOR
, false, &ChatHandler::HandleFlushArenaPointsCommand
, "", NULL
},
593 { "chardelete", SEC_CONSOLE
, true, &ChatHandler::HandleCharacterDeleteCommand
, "", NULL
},
594 { "sendmessage", SEC_ADMINISTRATOR
, true, &ChatHandler::HandleSendMessageCommand
, "", NULL
},
595 { "repairitems", SEC_GAMEMASTER
, false, &ChatHandler::HandleRepairitemsCommand
, "", NULL
},
596 { "waterwalk", SEC_GAMEMASTER
, false, &ChatHandler::HandleWaterwalkCommand
, "", NULL
},
598 { NULL
, 0, false, NULL
, "", NULL
}
601 if(load_command_table
)
603 load_command_table
= false;
605 QueryResult
*result
= WorldDatabase
.Query("SELECT name,security,help FROM command");
610 Field
*fields
= result
->Fetch();
611 std::string name
= fields
[0].GetCppString();
612 for(uint32 i
= 0; commandTable
[i
].Name
!= NULL
; i
++)
614 if (name
== commandTable
[i
].Name
)
616 commandTable
[i
].SecurityLevel
= (uint16
)fields
[1].GetUInt16();
617 commandTable
[i
].Help
= fields
[2].GetCppString();
619 if(commandTable
[i
].ChildCommands
!= NULL
)
621 ChatCommand
*ptable
= commandTable
[i
].ChildCommands
;
622 for(uint32 j
= 0; ptable
[j
].Name
!= NULL
; j
++)
624 // first case for "" named subcommand
625 if (ptable
[j
].Name
[0]=='\0' && name
== commandTable
[i
].Name
||
626 name
== fmtstring("%s %s", commandTable
[i
].Name
, ptable
[j
].Name
) )
628 ptable
[j
].SecurityLevel
= (uint16
)fields
[1].GetUInt16();
629 ptable
[j
].Help
= fields
[2].GetCppString();
634 } while(result
->NextRow());
642 const char *ChatHandler::GetMangosString(int32 entry
) const
644 return m_session
->GetMangosString(entry
);
647 bool ChatHandler::isAvailable(ChatCommand
const& cmd
) const
649 // check security level only for simple command (without child commands)
650 return m_session
->GetSecurity() >= cmd
.SecurityLevel
;
653 bool ChatHandler::HasLowerSecurity(Player
* target
, uint64 guid
, bool strong
)
655 WorldSession
* target_session
= NULL
;
656 uint32 target_account
= 0;
659 target_session
= target
->GetSession();
661 target_account
= objmgr
.GetPlayerAccountIdByGUID(guid
);
663 if(!target_session
&& !target_account
)
665 SendSysMessage(LANG_PLAYER_NOT_FOUND
);
666 SetSentErrorMessage(true);
670 return HasLowerSecurityAccount(target_session
,target_account
,strong
);
673 bool ChatHandler::HasLowerSecurityAccount(WorldSession
* target
, uint32 target_account
, bool strong
)
677 // allow everything from console and RA console
681 // ignore only for non-players for non strong checks (when allow apply command at least to same sec level)
682 if (m_session
->GetSecurity() > SEC_PLAYER
&& !strong
&& !sWorld
.getConfig(CONFIG_GM_LOWER_SECURITY
))
686 target_sec
= target
->GetSecurity();
687 else if (target_account
)
688 target_sec
= accmgr
.GetSecurity(target_account
);
690 return true; // caller must report error for (target==NULL && target_account==0)
692 if (m_session
->GetSecurity() < target_sec
|| strong
&& m_session
->GetSecurity() <= target_sec
)
694 SendSysMessage(LANG_YOURS_SECURITY_IS_LOW
);
695 SetSentErrorMessage(true);
702 bool ChatHandler::hasStringAbbr(const char* name
, const char* part
)
707 // "" part from non-"" command
717 else if( tolower( *name
) != tolower( *part
) )
722 // allow with any for ""
727 void ChatHandler::SendSysMessage(const char *str
)
731 // need copy to prevent corruption by strtok call in LineFromMessage original string
732 char* buf
= strdup(str
);
735 while(char* line
= LineFromMessage(pos
))
737 FillSystemMessageData(&data
, line
);
738 m_session
->SendPacket(&data
);
744 void ChatHandler::SendGlobalSysMessage(const char *str
)
749 // need copy to prevent corruption by strtok call in LineFromMessage original string
750 char* buf
= strdup(str
);
753 while(char* line
= LineFromMessage(pos
))
755 FillSystemMessageData(&data
, line
);
756 sWorld
.SendGlobalMessage(&data
);
762 void ChatHandler::SendSysMessage(int32 entry
)
764 SendSysMessage(GetMangosString(entry
));
767 void ChatHandler::PSendSysMessage(int32 entry
, ...)
769 const char *format
= GetMangosString(entry
);
773 vsnprintf(str
,2048,format
, ap
);
778 void ChatHandler::PSendSysMessage(const char *format
, ...)
782 va_start(ap
, format
);
783 vsnprintf(str
,2048,format
, ap
);
788 bool ChatHandler::ExecuteCommandInTable(ChatCommand
*table
, const char* text
, const std::string
& fullcmd
)
790 char const* oldtext
= text
;
791 std::string cmd
= "";
793 while (*text
!= ' ' && *text
!= '\0')
799 while (*text
== ' ') ++text
;
801 for(uint32 i
= 0; table
[i
].Name
!= NULL
; i
++)
803 if( !hasStringAbbr(table
[i
].Name
, cmd
.c_str()) )
806 // select subcommand from child commands list
807 if(table
[i
].ChildCommands
!= NULL
)
809 if(!ExecuteCommandInTable(table
[i
].ChildCommands
, text
, fullcmd
))
811 if(text
&& text
[0] != '\0')
812 SendSysMessage(LANG_NO_SUBCMD
);
814 SendSysMessage(LANG_CMD_SYNTAX
);
816 ShowHelpForCommand(table
[i
].ChildCommands
,text
);
822 // must be available and have handler
823 if(!table
[i
].Handler
|| !isAvailable(table
[i
]))
826 SetSentErrorMessage(false);
827 // table[i].Name == "" is special case: send original command to handler
828 if((this->*(table
[i
].Handler
))(strlen(table
[i
].Name
)!=0 ? text
: oldtext
))
830 if(table
[i
].SecurityLevel
> SEC_PLAYER
)
835 Player
* p
= m_session
->GetPlayer();
836 uint64 sel_guid
= p
->GetSelection();
837 sLog
.outCommand(m_session
->GetAccountId(),"Command: %s [Player: %s (Account: %u) X: %f Y: %f Z: %f Map: %u Selected: %s (GUID: %u)]",
838 fullcmd
.c_str(),p
->GetName(),m_session
->GetAccountId(),p
->GetPositionX(),p
->GetPositionY(),p
->GetPositionZ(),p
->GetMapId(),
839 GetLogNameForGuid(sel_guid
),GUID_LOPART(sel_guid
));
843 // some commands have custom error messages. Don't send the default one in these cases.
844 else if(!sentErrorMessage
)
846 if(!table
[i
].Help
.empty())
847 SendSysMessage(table
[i
].Help
.c_str());
849 SendSysMessage(LANG_CMD_SYNTAX
);
858 int ChatHandler::ParseCommands(const char* text
)
863 //if(m_session->GetSecurity() == 0)
866 /// chat case (.command or !command format)
869 if(text
[0] != '!' && text
[0] != '.')
873 /// ignore single . and ! in line
877 /// ignore messages staring from many dots.
878 if(text
[0] == '.' && text
[1] == '.' || text
[0] == '!' && text
[1] == '!')
881 /// skip first . or ! (in console allowed use command with . and ! and without its)
882 if(text
[0] == '!' || text
[0] == '.')
885 std::string fullcmd
= text
; // original `text` can't be used. It content destroyed in command code processing.
887 if(!ExecuteCommandInTable(getCommandTable(), text
, fullcmd
))
888 SendSysMessage(LANG_NO_CMD
);
893 bool ChatHandler::ShowHelpForSubCommands(ChatCommand
*table
, char const* cmd
, char const* subcmd
)
896 for(uint32 i
= 0; table
[i
].Name
!= NULL
; ++i
)
898 // must be available (ignore handler existence for show command with possibe avalable subcomands
899 if(!isAvailable(table
[i
]))
902 /// for empty subcmd show all available
903 if( *subcmd
&& !hasStringAbbr(table
[i
].Name
, subcmd
))
911 list
+= table
[i
].Name
;
913 if(table
[i
].ChildCommands
)
920 if(table
==getCommandTable())
922 SendSysMessage(LANG_AVIABLE_CMD
);
923 PSendSysMessage("%s",list
.c_str());
926 PSendSysMessage(LANG_SUBCMDS_LIST
,cmd
,list
.c_str());
931 bool ChatHandler::ShowHelpForCommand(ChatCommand
*table
, const char* cmd
)
935 for(uint32 i
= 0; table
[i
].Name
!= NULL
; ++i
)
937 // must be available (ignore handler existence for show command with possibe avalable subcomands
938 if(!isAvailable(table
[i
]))
941 if( !hasStringAbbr(table
[i
].Name
, cmd
) )
945 char const* subcmd
= (*cmd
) ? strtok(NULL
, " ") : "";
947 if(table
[i
].ChildCommands
&& subcmd
&& *subcmd
)
949 if(ShowHelpForCommand(table
[i
].ChildCommands
, subcmd
))
953 if(!table
[i
].Help
.empty())
954 SendSysMessage(table
[i
].Help
.c_str());
956 if(table
[i
].ChildCommands
)
957 if(ShowHelpForSubCommands(table
[i
].ChildCommands
,table
[i
].Name
,subcmd
? subcmd
: ""))
960 return !table
[i
].Help
.empty();
965 for(uint32 i
= 0; table
[i
].Name
!= NULL
; ++i
)
967 // must be available (ignore handler existence for show command with possibe avalable subcomands
968 if(!isAvailable(table
[i
]))
971 if(strlen(table
[i
].Name
))
974 if(!table
[i
].Help
.empty())
975 SendSysMessage(table
[i
].Help
.c_str());
977 if(table
[i
].ChildCommands
)
978 if(ShowHelpForSubCommands(table
[i
].ChildCommands
,"",""))
981 return !table
[i
].Help
.empty();
985 return ShowHelpForSubCommands(table
,"",cmd
);
988 //Note: target_guid used only in CHAT_MSG_WHISPER_INFORM mode (in this case channelName ignored)
989 void ChatHandler::FillMessageData( WorldPacket
*data
, WorldSession
* session
, uint8 type
, uint32 language
, const char *channelName
, uint64 target_guid
, const char *message
, Unit
*speaker
)
991 uint32 messageLength
= (message
? strlen(message
) : 0) + 1;
993 data
->Initialize(SMSG_MESSAGECHAT
, 100); // guess size
994 *data
<< uint8(type
);
995 if ((type
!= CHAT_MSG_CHANNEL
&& type
!= CHAT_MSG_WHISPER
) || language
== LANG_ADDON
)
996 *data
<< uint32(language
);
998 *data
<< uint32(LANG_UNIVERSAL
);
1003 case CHAT_MSG_PARTY
:
1005 case CHAT_MSG_GUILD
:
1006 case CHAT_MSG_OFFICER
:
1008 case CHAT_MSG_WHISPER
:
1009 case CHAT_MSG_CHANNEL
:
1010 case CHAT_MSG_RAID_LEADER
:
1011 case CHAT_MSG_RAID_WARNING
:
1012 case CHAT_MSG_BG_SYSTEM_NEUTRAL
:
1013 case CHAT_MSG_BG_SYSTEM_ALLIANCE
:
1014 case CHAT_MSG_BG_SYSTEM_HORDE
:
1015 case CHAT_MSG_BATTLEGROUND
:
1016 case CHAT_MSG_BATTLEGROUND_LEADER
:
1017 target_guid
= session
? session
->GetPlayer()->GetGUID() : 0;
1019 case CHAT_MSG_MONSTER_SAY
:
1020 case CHAT_MSG_MONSTER_PARTY
:
1021 case CHAT_MSG_MONSTER_YELL
:
1022 case CHAT_MSG_MONSTER_WHISPER
:
1023 case CHAT_MSG_MONSTER_EMOTE
:
1024 case CHAT_MSG_RAID_BOSS_WHISPER
:
1025 case CHAT_MSG_RAID_BOSS_EMOTE
:
1027 *data
<< uint64(speaker
->GetGUID());
1028 *data
<< uint32(0); // 2.1.0
1029 *data
<< uint32(strlen(speaker
->GetName()) + 1);
1030 *data
<< speaker
->GetName();
1031 uint64 listener_guid
= 0;
1032 *data
<< uint64(listener_guid
);
1033 if(listener_guid
&& !IS_PLAYER_GUID(listener_guid
))
1035 *data
<< uint32(1); // string listener_name_length
1036 *data
<< uint8(0); // string listener_name
1038 *data
<< uint32(messageLength
);
1044 if (type
!= CHAT_MSG_REPLY
&& type
!= CHAT_MSG_IGNORED
&& type
!= CHAT_MSG_DND
&& type
!= CHAT_MSG_AFK
)
1045 target_guid
= 0; // only for CHAT_MSG_WHISPER_INFORM used original value target_guid
1049 *data
<< uint64(target_guid
); // there 0 for BG messages
1050 *data
<< uint32(0); // can be chat msg group or something
1052 if (type
== CHAT_MSG_CHANNEL
)
1054 ASSERT(channelName
);
1055 *data
<< channelName
;
1058 *data
<< uint64(target_guid
);
1059 *data
<< uint32(messageLength
);
1061 if(session
!= 0 && type
!= CHAT_MSG_REPLY
&& type
!= CHAT_MSG_DND
&& type
!= CHAT_MSG_AFK
)
1062 *data
<< uint8(session
->GetPlayer()->chatTag());
1067 Player
* ChatHandler::getSelectedPlayer()
1072 uint64 guid
= m_session
->GetPlayer()->GetSelection();
1075 return m_session
->GetPlayer();
1077 return objmgr
.GetPlayer(guid
);
1080 Unit
* ChatHandler::getSelectedUnit()
1085 uint64 guid
= m_session
->GetPlayer()->GetSelection();
1088 return m_session
->GetPlayer();
1090 return ObjectAccessor::GetUnit(*m_session
->GetPlayer(),guid
);
1093 Creature
* ChatHandler::getSelectedCreature()
1098 return ObjectAccessor::GetCreatureOrPetOrVehicle(*m_session
->GetPlayer(),m_session
->GetPlayer()->GetSelection());
1101 char* ChatHandler::extractKeyFromLink(char* text
, char const* linkType
, char** something1
)
1108 while(*text
==' '||*text
=='\t'||*text
=='\b')
1114 // return non link case
1116 return strtok(text
, " ");
1118 // [name] Shift-click form |color|linkType:key|h[name]|h|r
1120 // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r
1122 char* check
= strtok(text
, "|"); // skip color
1124 return NULL
; // end of data
1126 char* cLinkType
= strtok(NULL
, ":"); // linktype
1128 return NULL
; // end of data
1130 if(strcmp(cLinkType
,linkType
) != 0)
1132 strtok(NULL
, " "); // skip link tail (to allow continue strtok(NULL,s) use after retturn from function
1133 SendSysMessage(LANG_WRONG_LINK_TYPE
);
1137 char* cKeys
= strtok(NULL
, "|"); // extract keys and values
1138 char* cKeysTail
= strtok(NULL
, "");
1140 char* cKey
= strtok(cKeys
, ":|"); // extract key
1142 *something1
= strtok(NULL
, ":|"); // extract something
1144 strtok(cKeysTail
, "]"); // restart scan tail and skip name with possible spaces
1145 strtok(NULL
, " "); // skip link tail (to allow continue strtok(NULL,s) use after retturn from function
1149 char* ChatHandler::extractKeyFromLink(char* text
, char const* const* linkTypes
, int* found_idx
, char** something1
)
1156 while(*text
==' '||*text
=='\t'||*text
=='\b')
1162 // return non link case
1164 return strtok(text
, " ");
1166 // [name] Shift-click form |color|linkType:key|h[name]|h|r
1168 // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r
1170 // [name] Shift-click form |linkType:key|h[name]|h|r
1176 char* check
= strtok(text
, "|"); // skip color
1178 return NULL
; // end of data
1180 tail
= strtok(NULL
, ""); // tail
1183 tail
= text
+1; // skip first |
1185 char* cLinkType
= strtok(tail
, ":"); // linktype
1187 return NULL
; // end of data
1189 for(int i
= 0; linkTypes
[i
]; ++i
)
1191 if(strcmp(cLinkType
,linkTypes
[i
]) == 0)
1193 char* cKeys
= strtok(NULL
, "|"); // extract keys and values
1194 char* cKeysTail
= strtok(NULL
, "");
1196 char* cKey
= strtok(cKeys
, ":|"); // extract key
1198 *something1
= strtok(NULL
, ":|"); // extract something
1200 strtok(cKeysTail
, "]"); // restart scan tail and skip name with possible spaces
1201 strtok(NULL
, " "); // skip link tail (to allow continue strtok(NULL,s) use after return from function
1208 strtok(NULL
, " "); // skip link tail (to allow continue strtok(NULL,s) use after return from function
1209 SendSysMessage(LANG_WRONG_LINK_TYPE
);
1213 char const *fmtstring( char const *format
, ... )
1216 #define MAX_FMT_STRING 32000
1217 static char temp_buffer
[MAX_FMT_STRING
];
1218 static char string
[MAX_FMT_STRING
];
1219 static int index
= 0;
1223 va_start(argptr
, format
);
1224 vsnprintf(temp_buffer
,MAX_FMT_STRING
, format
, argptr
);
1227 len
= strlen(temp_buffer
);
1229 if( len
>= MAX_FMT_STRING
)
1232 if (len
+ index
>= MAX_FMT_STRING
-1)
1237 buf
= &string
[index
];
1238 memcpy( buf
, temp_buffer
, len
+1 );
1245 GameObject
* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid
,uint32 entry
)
1250 Player
* pl
= m_session
->GetPlayer();
1252 GameObject
* obj
= ObjectAccessor::GetGameObject(*pl
, MAKE_NEW_GUID(lowguid
, entry
, HIGHGUID_GAMEOBJECT
));
1254 if(!obj
&& objmgr
.GetGOData(lowguid
)) // guid is DB guid of object
1256 // search near player then
1257 CellPair
p(MaNGOS::ComputeCellPair(pl
->GetPositionX(), pl
->GetPositionY()));
1259 cell
.data
.Part
.reserved
= ALL_DISTRICT
;
1261 MaNGOS::GameObjectWithDbGUIDCheck
go_check(*pl
,lowguid
);
1262 MaNGOS::GameObjectSearcher
<MaNGOS::GameObjectWithDbGUIDCheck
> checker(pl
,obj
,go_check
);
1264 TypeContainerVisitor
<MaNGOS::GameObjectSearcher
<MaNGOS::GameObjectWithDbGUIDCheck
>, GridTypeMapContainer
> object_checker(checker
);
1265 CellLock
<GridReadGuard
> cell_lock(cell
, p
);
1266 cell_lock
->Visit(cell_lock
, object_checker
, *pl
->GetMap());
1274 SPELL_LINK_SPELL
= 0,
1275 SPELL_LINK_TALENT
= 1,
1276 SPELL_LINK_TRADE
= 2
1279 static char const* const spellKeys
[] =
1281 "Hspell", // normal spell
1282 "Htalent", // talent spell
1283 "Htrade", // profession/skill spell
1287 uint32
ChatHandler::extractSpellIdFromLink(char* text
)
1289 // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
1290 // number or [name] Shift-click form |color|Htalent:talent_id,rank|h[name]|h|r
1291 // number or [name] Shift-click form |color|Htrade:spell_id,skill_id,max_value,cur_value|h[name]|h|r
1293 char* param1_str
= NULL
;
1294 char* idS
= extractKeyFromLink(text
,spellKeys
,&type
,¶m1_str
);
1298 uint32 id
= (uint32
)atol(idS
);
1302 case SPELL_LINK_SPELL
:
1304 case SPELL_LINK_TALENT
:
1307 TalentEntry
const* talentEntry
= sTalentStore
.LookupEntry(id
);
1311 int32 rank
= param1_str
? (uint32
)atol(param1_str
) : 0;
1318 return talentEntry
->RankID
[rank
];
1320 case SPELL_LINK_TRADE
:
1328 GameTele
const* ChatHandler::extractGameTeleFromLink(char* text
)
1330 // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
1331 char* cId
= extractKeyFromLink(text
,"Htele");
1335 // id case (explicit or from shift link)
1336 if(cId
[0] >= '0' || cId
[0] >= '9')
1337 if(uint32 id
= atoi(cId
))
1338 return objmgr
.GetGameTele(id
);
1340 return objmgr
.GetGameTele(cId
);
1345 SPELL_LINK_PLAYER
= 0, // must be first for selection in not link case
1346 SPELL_LINK_CREATURE
= 1,
1347 SPELL_LINK_GAMEOBJECT
= 2
1350 static char const* const guidKeys
[] =
1358 uint64
ChatHandler::extractGuidFromLink(char* text
)
1362 // |color|Hcreature:creature_guid|h[name]|h|r
1363 // |color|Hgameobject:go_guid|h[name]|h|r
1364 // |color|Hplayer:name|h[name]|h|r
1365 char* idS
= extractKeyFromLink(text
,guidKeys
,&type
);
1371 case SPELL_LINK_PLAYER
:
1373 std::string name
= idS
;
1374 if(!normalizePlayerName(name
))
1377 if(Player
* player
= objmgr
.GetPlayer(name
.c_str()))
1378 return player
->GetGUID();
1380 if(uint64 guid
= objmgr
.GetPlayerGUIDByName(name
))
1385 case SPELL_LINK_CREATURE
:
1387 uint32 lowguid
= (uint32
)atol(idS
);
1389 if(CreatureData
const* data
= objmgr
.GetCreatureData(lowguid
) )
1390 return MAKE_NEW_GUID(lowguid
,data
->id
,HIGHGUID_UNIT
);
1394 case SPELL_LINK_GAMEOBJECT
:
1396 uint32 lowguid
= (uint32
)atol(idS
);
1398 if(GameObjectData
const* data
= objmgr
.GetGOData(lowguid
) )
1399 return MAKE_NEW_GUID(lowguid
,data
->id
,HIGHGUID_GAMEOBJECT
);
1409 std::string
ChatHandler::extractPlayerNameFromLink(char* text
)
1411 // |color|Hplayer:name|h[name]|h|r
1412 char* name_str
= extractKeyFromLink(text
,"Hplayer");
1416 std::string name
= name_str
;
1417 if(!normalizePlayerName(name
))
1423 bool ChatHandler::needReportToTarget(Player
* chr
) const
1425 Player
* pl
= m_session
->GetPlayer();
1426 return pl
!= chr
&& pl
->IsVisibleGloballyFor(chr
);
1429 const char *CliHandler::GetMangosString(int32 entry
) const
1431 return objmgr
.GetMangosStringForDBCLocale(entry
);
1434 bool CliHandler::isAvailable(ChatCommand
const& cmd
) const
1436 // skip non-console commands in console case
1437 return cmd
.AllowConsole
;
1440 void CliHandler::SendSysMessage(const char *str
)
1446 std::string
CliHandler::GetNameLink() const
1448 return GetMangosString(LANG_CONSOLE_COMMAND
);
1451 bool CliHandler::needReportToTarget(Player
* /*chr*/) const