TrinityCore
Loading...
Searching...
No Matches
cs_lookup.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/* ScriptData
19Name: lookup_commandscript
20%Complete: 100
21Comment: All lookup related commands
22Category: commandscripts
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "AccountMgr.h"
27#include "Chat.h"
28#include "DatabaseEnv.h"
29#include "DBCStores.h"
30#include "GameEventMgr.h"
31#include "ObjectAccessor.h"
32#include "ObjectMgr.h"
33#include "Player.h"
34#include "ReputationMgr.h"
35#include "SpellInfo.h"
36#include "SpellMgr.h"
37#include "World.h"
38#include "WorldSession.h"
39
40#if TRINITY_COMPILER == TRINITY_COMPILER_GNU
41#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
42#endif
43
44using namespace Trinity::ChatCommands;
45
47{
48public:
49 lookup_commandscript() : CommandScript("lookup_commandscript") { }
50
51 std::vector<ChatCommand> GetCommands() const override
52 {
53 static std::vector<ChatCommand> lookupPlayerCommandTable =
54 {
58 };
59
60 static std::vector<ChatCommand> lookupCommandTable =
61 {
72 { "player", lookupPlayerCommandTable },
81 };
82
83 static ChatCommandTable commandTable =
84 {
85 { "lookup", lookupCommandTable },
86 };
87 return commandTable;
88 }
89
90 static bool HandleLookupAreaCommand(ChatHandler* handler, char const* args)
91 {
92 if (!*args)
93 return false;
94
95 std::string namePart = args;
96 std::wstring wNamePart;
97
98 if (!Utf8toWStr(namePart, wNamePart))
99 return false;
100
101 bool found = false;
102 uint32 count = 0;
103 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
104
105 // converting string that we try to find to lower case
106 wstrToLower(wNamePart);
107
108 // Search in AreaTable.dbc
109 for (uint32 i = 0; i < sAreaTableStore.GetNumRows(); ++i)
110 {
111 AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(i);
112 if (areaEntry)
113 {
114 uint8 locale = handler->GetSessionDbcLocale();
115 std::string name = areaEntry->AreaName[locale];
116 if (name.empty())
117 continue;
118
119 if (!Utf8FitTo(name, wNamePart))
120 {
121 locale = 0;
122 for (; locale < TOTAL_LOCALES; ++locale)
123 {
124 if (locale == handler->GetSessionDbcLocale())
125 continue;
126
127 name = areaEntry->AreaName[locale];
128 if (name.empty())
129 continue;
130
131 if (Utf8FitTo(name, wNamePart))
132 break;
133 }
134 }
135
136 if (locale < TOTAL_LOCALES)
137 {
138 if (maxResults && count++ == maxResults)
139 {
141 return true;
142 }
143
144 // send area in "id - [name]" format
145 std::ostringstream ss;
146 if (handler->GetSession())
147 ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << ' ' << localeNames[locale]<< "]|h|r";
148 else
149 ss << areaEntry->ID << " - " << name << ' ' << localeNames[locale];
150
151 handler->SendSysMessage(ss.str().c_str());
152
153 if (!found)
154 found = true;
155 }
156 }
157 }
158
159 if (!found)
161
162 return true;
163 }
164
165 static bool HandleLookupCreatureCommand(ChatHandler* handler, char const* args)
166 {
167 if (!*args)
168 return false;
169
170 std::string namePart = args;
171 std::wstring wNamePart;
172
173 // converting string that we try to find to lower case
174 if (!Utf8toWStr(namePart, wNamePart))
175 return false;
176
177 wstrToLower(wNamePart);
178
179 bool found = false;
180 uint32 count = 0;
181 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
182
183 CreatureTemplateContainer const& ctc = sObjectMgr->GetCreatureTemplates();
184 for (auto const& creatureTemplatePair : ctc)
185 {
186 uint32 id = creatureTemplatePair.first;
187 uint8 localeIndex = handler->GetSessionDbLocaleIndex();
188 if (CreatureLocale const* creatureLocale = sObjectMgr->GetCreatureLocale(id))
189 {
190 if (creatureLocale->Name.size() > localeIndex && !creatureLocale->Name[localeIndex].empty())
191 {
192 std::string const& name = creatureLocale->Name[localeIndex];
193
194 if (Utf8FitTo(name, wNamePart))
195 {
196 if (maxResults && count++ == maxResults)
197 {
199 return true;
200 }
201
202 if (handler->GetSession())
203 handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str());
204 else
205 handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str());
206
207 if (!found)
208 found = true;
209
210 continue;
211 }
212 }
213 }
214
215 std::string const& name = creatureTemplatePair.second.Name;
216 if (name.empty())
217 continue;
218
219 if (Utf8FitTo(name, wNamePart))
220 {
221 if (maxResults && count++ == maxResults)
222 {
224 return true;
225 }
226
227 if (handler->GetSession())
228 handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str());
229 else
230 handler->PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str());
231
232 if (!found)
233 found = true;
234 }
235 }
236
237 if (!found)
239
240 return true;
241 }
242
243 static bool HandleLookupEventCommand(ChatHandler* handler, char const* args)
244 {
245 if (!*args)
246 return false;
247
248 std::string namePart = args;
249 std::wstring wNamePart;
250
251 // converting string that we try to find to lower case
252 if (!Utf8toWStr(namePart, wNamePart))
253 return false;
254
255 wstrToLower(wNamePart);
256
257 bool found = false;
258 uint32 count = 0;
259 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
260
261 GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
262 GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
263
264 for (uint32 id = 0; id < events.size(); ++id)
265 {
266 GameEventData const& eventData = events[id];
267
268 std::string descr = eventData.description;
269 if (descr.empty())
270 continue;
271
272 if (Utf8FitTo(descr, wNamePart))
273 {
274 if (maxResults && count++ == maxResults)
275 {
277 return true;
278 }
279
280 char const* active = activeEvents.find(id) != activeEvents.end() ? handler->GetTrinityString(LANG_ACTIVE) : "";
281
282 if (handler->GetSession())
283 handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.description.c_str(), active);
284 else
285 handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.description.c_str(), active);
286
287 if (!found)
288 found = true;
289 }
290 }
291
292 if (!found)
294
295 return true;
296 }
297
298 static bool HandleLookupFactionCommand(ChatHandler* handler, char const* args)
299 {
300 if (!*args)
301 return false;
302
303 // Can be NULL at console call
304 Player* target = handler->getSelectedPlayer();
305
306 std::string namePart = args;
307 std::wstring wNamePart;
308
309 if (!Utf8toWStr(namePart, wNamePart))
310 return false;
311
312 // converting string that we try to find to lower case
313 wstrToLower (wNamePart);
314
315 bool found = false;
316 uint32 count = 0;
317 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
318
319 for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id)
320 {
321 FactionEntry const* factionEntry = sFactionStore.LookupEntry(id);
322 if (factionEntry)
323 {
324 FactionState const* factionState = target ? target->GetReputationMgr().GetState(factionEntry) : nullptr;
325
326 uint8 locale = handler->GetSessionDbcLocale();
327 std::string name = factionEntry->Name[locale];
328 if (name.empty())
329 continue;
330
331 if (!Utf8FitTo(name, wNamePart))
332 {
333 locale = 0;
334 for (; locale < TOTAL_LOCALES; ++locale)
335 {
336 if (locale == handler->GetSessionDbcLocale())
337 continue;
338
339 name = factionEntry->Name[locale];
340 if (name.empty())
341 continue;
342
343 if (Utf8FitTo(name, wNamePart))
344 break;
345 }
346 }
347
348 if (locale < TOTAL_LOCALES)
349 {
350 if (maxResults && count++ == maxResults)
351 {
353 return true;
354 }
355
356 // send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format
357 // or "id - [faction] [no reputation]" format
358 std::ostringstream ss;
359 if (handler->GetSession())
360 ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << ' ' << localeNames[locale] << "]|h|r";
361 else
362 ss << id << " - " << name << ' ' << localeNames[locale];
363
364 if (factionState) // and then target != NULL also
365 {
366 std::string rankName = target->GetReputationMgr().GetReputationRankName(factionEntry);
367
368 ss << ' ' << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ')';
369
370 if (factionState->Flags.HasFlag(ReputationFlags::Visible))
372 if (factionState->Flags.HasFlag(ReputationFlags::AtWar))
373 ss << handler->GetTrinityString(LANG_FACTION_ATWAR);
374 if (factionState->Flags.HasFlag(ReputationFlags::Peaceful))
376 if (factionState->Flags.HasFlag(ReputationFlags::Hidden))
378 if (factionState->Flags.HasFlag(ReputationFlags::Header))
380 if (factionState->Flags.HasFlag(ReputationFlags::Inactive))
382 }
383 else
385
386 handler->SendSysMessage(ss.str().c_str());
387
388 if (!found)
389 found = true;
390 }
391 }
392 }
393
394 if (!found)
396 return true;
397 }
398
399 static bool HandleLookupItemCommand(ChatHandler* handler, char const* args)
400 {
401 if (!*args)
402 return false;
403
404 std::string namePart = args;
405 std::wstring wNamePart;
406
407 // converting string that we try to find to lower case
408 if (!Utf8toWStr(namePart, wNamePart))
409 return false;
410
411 wstrToLower(wNamePart);
412
413 bool found = false;
414 uint32 count = 0;
415 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
416
417 // Search in `item_template`
418 ItemTemplateContainer const& its = sObjectMgr->GetItemTemplateStore();
419 for (auto const& itemTemplatePair : its)
420 {
421 uint8 localeIndex = handler->GetSessionDbLocaleIndex();
422 if (ItemLocale const* il = sObjectMgr->GetItemLocale(itemTemplatePair.first))
423 {
424 if (il->Name.size() > localeIndex && !il->Name[localeIndex].empty())
425 {
426 std::string const& name = il->Name[localeIndex];
427
428 if (Utf8FitTo(name, wNamePart))
429 {
430 if (maxResults && count++ == maxResults)
431 {
433 return true;
434 }
435
436 if (handler->GetSession())
437 handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itemTemplatePair.first, itemTemplatePair.first, name.c_str());
438 else
439 handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itemTemplatePair.first, name.c_str());
440
441 if (!found)
442 found = true;
443
444 continue;
445 }
446 }
447 }
448
449 std::string const& name = itemTemplatePair.second.Name1;
450 if (name.empty())
451 continue;
452
453 if (Utf8FitTo(name, wNamePart))
454 {
455 if (maxResults && count++ == maxResults)
456 {
458 return true;
459 }
460
461 if (handler->GetSession())
462 handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itemTemplatePair.first, itemTemplatePair.first, name.c_str());
463 else
464 handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itemTemplatePair.first, name.c_str());
465
466 if (!found)
467 found = true;
468 }
469 }
470
471 if (!found)
473
474 return true;
475 }
476
477 static bool HandleLookupItemIdCommand(ChatHandler* handler, char const* args)
478 {
479 if (!*args)
480 return false;
481
482 uint32 id = atoi((char*)args);
483
484 if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(id))
485 {
486 std::string name = itemTemplate->Name1;
487
488 if (name.empty())
489 {
491 return true;
492 }
493
494 if (handler->GetSession())
495 handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str());
496 else
497 handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, id, name.c_str());
498 }
499 else
501
502 return true;
503 }
504
505 static bool HandleLookupItemSetCommand(ChatHandler* handler, char const* args)
506 {
507 if (!*args)
508 return false;
509
510 std::string namePart = args;
511 std::wstring wNamePart;
512
513 if (!Utf8toWStr(namePart, wNamePart))
514 return false;
515
516 // converting string that we try to find to lower case
517 wstrToLower(wNamePart);
518
519 bool found = false;
520 uint32 count = 0;
521 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
522
523 // Search in ItemSet.dbc
524 for (uint32 id = 0; id < sItemSetStore.GetNumRows(); id++)
525 {
526 ItemSetEntry const* set = sItemSetStore.LookupEntry(id);
527 if (set)
528 {
529 uint8 locale = handler->GetSessionDbcLocale();
530 std::string name = set->Name[locale];
531 if (name.empty())
532 continue;
533
534 if (!Utf8FitTo(name, wNamePart))
535 {
536 locale = 0;
537 for (; locale < TOTAL_LOCALES; ++locale)
538 {
539 if (locale == handler->GetSessionDbcLocale())
540 continue;
541
542 name = set->Name[locale];
543 if (name.empty())
544 continue;
545
546 if (Utf8FitTo(name, wNamePart))
547 break;
548 }
549 }
550
551 if (locale < TOTAL_LOCALES)
552 {
553 if (maxResults && count++ == maxResults)
554 {
556 return true;
557 }
558
559 // send item set in "id - [namedlink locale]" format
560 if (handler->GetSession())
561 handler->PSendSysMessage(LANG_ITEMSET_LIST_CHAT, id, id, name.c_str(), localeNames[locale]);
562 else
563 handler->PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), localeNames[locale]);
564
565 if (!found)
566 found = true;
567 }
568 }
569 }
570 if (!found)
572
573 return true;
574 }
575
576 static bool HandleLookupObjectCommand(ChatHandler* handler, char const* args)
577 {
578 if (!*args)
579 return false;
580
581 std::string namePart = args;
582 std::wstring wNamePart;
583
584 // converting string that we try to find to lower case
585 if (!Utf8toWStr(namePart, wNamePart))
586 return false;
587
588 wstrToLower(wNamePart);
589
590 bool found = false;
591 uint32 count = 0;
592 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
593
594 GameObjectTemplateContainer const& gotc = sObjectMgr->GetGameObjectTemplates();
595 for (auto const& gameObjectTemplatePair : gotc)
596 {
597 uint8 localeIndex = handler->GetSessionDbLocaleIndex();
598 if (GameObjectLocale const* objectLocalte = sObjectMgr->GetGameObjectLocale(gameObjectTemplatePair.first))
599 {
600 if (objectLocalte->Name.size() > localeIndex && !objectLocalte->Name[localeIndex].empty())
601 {
602 std::string const& name = objectLocalte->Name[localeIndex];
603 if (Utf8FitTo(name, wNamePart))
604 {
605 if (maxResults && count++ == maxResults)
606 {
608 return true;
609 }
610
611 if (handler->GetSession())
612 handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, gameObjectTemplatePair.first, gameObjectTemplatePair.first, name.c_str());
613 else
614 handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, gameObjectTemplatePair.first, name.c_str());
615
616 if (!found)
617 found = true;
618
619 continue;
620 }
621 }
622 }
623
624 std::string const& name = gameObjectTemplatePair.second.name;
625 if (name.empty())
626 continue;
627
628 if (Utf8FitTo(name, wNamePart))
629 {
630 if (maxResults && count++ == maxResults)
631 {
633 return true;
634 }
635
636 if (handler->GetSession())
637 handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, gameObjectTemplatePair.first, gameObjectTemplatePair.first, name.c_str());
638 else
639 handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, gameObjectTemplatePair.first, name.c_str());
640
641 if (!found)
642 found = true;
643 }
644 }
645
646 if (!found)
648
649 return true;
650 }
651
652 static bool HandleLookupQuestCommand(ChatHandler* handler, char const* args)
653 {
654 if (!*args)
655 return false;
656
657 // can be NULL at console call
658 Player* target = handler->getSelectedPlayerOrSelf();
659
660 std::string namePart = args;
661 std::wstring wNamePart;
662
663 // converting string that we try to find to lower case
664 if (!Utf8toWStr(namePart, wNamePart))
665 return false;
666
667 wstrToLower(wNamePart);
668
669 bool found = false;
670 uint32 count = 0;
671 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
672
673 ObjectMgr::QuestContainer const& questTemplates = sObjectMgr->GetQuestTemplates();
674 for (auto const& questTemplatePair : questTemplates)
675 {
676 uint8 localeIndex = handler->GetSessionDbLocaleIndex();
677 if (QuestLocale const* questLocale = sObjectMgr->GetQuestLocale(questTemplatePair.first))
678 {
679 if (questLocale->Title.size() > localeIndex && !questLocale->Title[localeIndex].empty())
680 {
681 std::string const& title = questLocale->Title[localeIndex];
682
683 if (Utf8FitTo(title, wNamePart))
684 {
685 if (maxResults && count++ == maxResults)
686 {
688 return true;
689 }
690
691 char const* statusStr = "";
692
693 if (target)
694 {
695 switch (target->GetQuestStatus(questTemplatePair.first))
696 {
698 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
699 break;
701 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
702 break;
704 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
705 break;
706 default:
707 break;
708 }
709 }
710
711 if (handler->GetSession())
712 handler->PSendSysMessage(LANG_QUEST_LIST_CHAT, questTemplatePair.first, questTemplatePair.first, questTemplatePair.second->GetQuestLevel(), title.c_str(), statusStr);
713 else
714 handler->PSendSysMessage(LANG_QUEST_LIST_CONSOLE, questTemplatePair.first, title.c_str(), statusStr);
715
716 if (!found)
717 found = true;
718
719 continue;
720 }
721 }
722 }
723
724 std::string const& title = questTemplatePair.second->GetTitle();
725 if (title.empty())
726 continue;
727
728 if (Utf8FitTo(title, wNamePart))
729 {
730 if (maxResults && count++ == maxResults)
731 {
733 return true;
734 }
735
736 char const* statusStr = "";
737
738 if (target)
739 {
740 switch (target->GetQuestStatus(questTemplatePair.first))
741 {
743 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
744 break;
746 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
747 break;
749 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
750 break;
751 default:
752 break;
753 }
754 }
755
756 if (handler->GetSession())
757 handler->PSendSysMessage(LANG_QUEST_LIST_CHAT, questTemplatePair.first, questTemplatePair.first, questTemplatePair.second->GetQuestLevel(), title.c_str(), statusStr);
758 else
759 handler->PSendSysMessage(LANG_QUEST_LIST_CONSOLE, questTemplatePair.first, title.c_str(), statusStr);
760
761 if (!found)
762 found = true;
763 }
764 }
765
766 if (!found)
768
769 return true;
770 }
771
772 static bool HandleLookupQuestIdCommand(ChatHandler* handler, char const* args)
773 {
774 if (!*args)
775 return false;
776
777 uint32 id = atoi((char*)args);
778
779 // can be NULL at console call
780 Player* target = handler->getSelectedPlayerOrSelf();
781
782 if (Quest const* quest = sObjectMgr->GetQuestTemplate(id))
783 {
784 std::string title = quest->GetTitle();
785 if (title.empty())
786 {
788 return true;
789 }
790
791 char const* statusStr = "";
792
793 if (target)
794 {
795 switch (target->GetQuestStatus(id))
796 {
798 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
799 break;
801 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
802 break;
804 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
805 break;
806 default:
807 break;
808 }
809 }
810
811 if (handler->GetSession())
812 handler->PSendSysMessage(LANG_QUEST_LIST_CHAT, id, id, quest->GetQuestLevel(), title.c_str(), statusStr);
813 else
814 handler->PSendSysMessage(LANG_QUEST_LIST_CONSOLE, id, title.c_str(), statusStr);
815 }
816 else
818
819 return true;
820 }
821
822 static bool HandleLookupSkillCommand(ChatHandler* handler, char const* args)
823 {
824 if (!*args)
825 return false;
826
827 // can be NULL in console call
828 Player* target = handler->getSelectedPlayer();
829
830 std::string namePart = args;
831 std::wstring wNamePart;
832
833 if (!Utf8toWStr(namePart, wNamePart))
834 return false;
835
836 // converting string that we try to find to lower case
837 wstrToLower(wNamePart);
838
839 bool found = false;
840 uint32 count = 0;
841 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
842
843 // Search in SkillLine.dbc
844 for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); id++)
845 {
846 SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(id);
847 if (skillInfo)
848 {
849 uint8 locale = handler->GetSessionDbcLocale();
850 std::string name = skillInfo->DisplayName[locale];
851 if (name.empty())
852 continue;
853
854 if (!Utf8FitTo(name, wNamePart))
855 {
856 locale = 0;
857 for (; locale < TOTAL_LOCALES; ++locale)
858 {
859 if (locale == handler->GetSessionDbcLocale())
860 continue;
861
862 name = skillInfo->DisplayName[locale];
863 if (name.empty())
864 continue;
865
866 if (Utf8FitTo(name, wNamePart))
867 break;
868 }
869 }
870
871 if (locale < TOTAL_LOCALES)
872 {
873 if (maxResults && count++ == maxResults)
874 {
876 return true;
877 }
878
879 char valStr[50] = "";
880 char const* knownStr = "";
881 if (target && target->HasSkill(id))
882 {
883 knownStr = handler->GetTrinityString(LANG_KNOWN);
884 uint32 curValue = target->GetPureSkillValue(id);
885 uint32 maxValue = target->GetPureMaxSkillValue(id);
886 uint32 permValue = target->GetSkillPermBonusValue(id);
887 uint32 tempValue = target->GetSkillTempBonusValue(id);
888
889 char const* valFormat = handler->GetTrinityString(LANG_SKILL_VALUES);
890 snprintf(valStr, 50, valFormat, curValue, maxValue, permValue, tempValue);
891 }
892
893 // send skill in "id - [namedlink locale]" format
894 if (handler->GetSession())
895 handler->PSendSysMessage(LANG_SKILL_LIST_CHAT, id, id, name.c_str(), localeNames[locale], knownStr, valStr);
896 else
897 handler->PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), localeNames[locale], knownStr, valStr);
898
899 if (!found)
900 found = true;
901 }
902 }
903 }
904 if (!found)
906
907 return true;
908 }
909
910 static bool HandleLookupSpellCommand(ChatHandler* handler, char const* args)
911 {
912 if (!*args)
913 return false;
914
915 // can be NULL at console call
916 Player* target = handler->getSelectedPlayer();
917
918 std::string namePart = args;
919 std::wstring wNamePart;
920
921 if (!Utf8toWStr(namePart, wNamePart))
922 return false;
923
924 // converting string that we try to find to lower case
925 wstrToLower(wNamePart);
926
927 bool found = false;
928 uint32 count = 0;
929 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
930
931 // Search in Spell.dbc
932 for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); ++id)
933 {
934 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id);
935 if (spellInfo)
936 {
937 uint8 locale = handler->GetSessionDbcLocale();
938 std::string name = spellInfo->SpellName[locale];
939 if (name.empty())
940 continue;
941
942 if (!Utf8FitTo(name, wNamePart))
943 {
944 locale = 0;
945 for (; locale < TOTAL_LOCALES; ++locale)
946 {
947 if (locale == handler->GetSessionDbcLocale())
948 continue;
949
950 name = spellInfo->SpellName[locale];
951 if (name.empty())
952 continue;
953
954 if (Utf8FitTo(name, wNamePart))
955 break;
956 }
957 }
958
959 if (locale < TOTAL_LOCALES)
960 {
961 if (maxResults && count++ == maxResults)
962 {
964 return true;
965 }
966
967 bool known = target && target->HasSpell(id);
968
969 SpellEffectInfo const& spellEffectInfo = spellInfo->GetEffect(EFFECT_0);
970 bool learn = spellEffectInfo.IsEffect(SPELL_EFFECT_LEARN_SPELL);
971
972 SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellEffectInfo.TriggerSpell);
973
974 uint32 talentCost = GetTalentSpellCost(id);
975
976 bool talent = (talentCost > 0);
977 bool passive = spellInfo->IsPassive();
978 bool active = target && target->HasAura(id);
979
980 // unit32 used to prevent interpreting uint8 as char at output
981 // find rank of learned spell for learning spell, or talent rank
982 uint32 rank = talentCost ? talentCost : learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank();
983
984 // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
985 std::ostringstream ss;
986 if (handler->GetSession())
987 ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name;
988 else
989 ss << id << " - " << name;
990
991 // include rank in link name
992 if (rank)
993 ss << handler->GetTrinityString(LANG_SPELL_RANK) << rank;
994
995 if (handler->GetSession())
996 ss << ' ' << localeNames[locale] << "]|h|r";
997 else
998 ss << ' ' << localeNames[locale];
999
1000 if (talent)
1001 ss << handler->GetTrinityString(LANG_TALENT);
1002 if (passive)
1003 ss << handler->GetTrinityString(LANG_PASSIVE);
1004 if (learn)
1005 ss << handler->GetTrinityString(LANG_LEARN);
1006 if (known)
1007 ss << handler->GetTrinityString(LANG_KNOWN);
1008 if (active)
1009 ss << handler->GetTrinityString(LANG_ACTIVE);
1010
1011 handler->SendSysMessage(ss.str().c_str());
1012
1013 if (!found)
1014 found = true;
1015 }
1016 }
1017 }
1018 if (!found)
1020
1021 return true;
1022 }
1023
1024 static bool HandleLookupSpellIdCommand(ChatHandler* handler, char const* args)
1025 {
1026 if (!*args)
1027 return false;
1028
1029 // can be NULL at console call
1030 Player* target = handler->getSelectedPlayer();
1031
1032 uint32 id = atoi((char*)args);
1033
1034 if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id))
1035 {
1036 uint8 locale = handler->GetSessionDbcLocale();
1037 std::string name = spellInfo->SpellName[locale];
1038 if (name.empty())
1039 {
1041 return true;
1042 }
1043
1044 bool known = target && target->HasSpell(id);
1045
1046 SpellEffectInfo const& spellEffectInfo = spellInfo->GetEffect(EFFECT_0);
1047 bool learn = spellEffectInfo.IsEffect(SPELL_EFFECT_LEARN_SPELL);
1048
1049 SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellEffectInfo.TriggerSpell);
1050
1051 uint32 talentCost = GetTalentSpellCost(id);
1052
1053 bool talent = (talentCost > 0);
1054 bool passive = spellInfo->IsPassive();
1055 bool active = target && target->HasAura(id);
1056
1057 // unit32 used to prevent interpreting uint8 as char at output
1058 // find rank of learned spell for learning spell, or talent rank
1059 uint32 rank = talentCost ? talentCost : learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank();
1060
1061 // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
1062 std::ostringstream ss;
1063 if (handler->GetSession())
1064 ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name;
1065 else
1066 ss << id << " - " << name;
1067
1068 // include rank in link name
1069 if (rank)
1070 ss << handler->GetTrinityString(LANG_SPELL_RANK) << rank;
1071
1072 if (handler->GetSession())
1073 ss << ' ' << localeNames[locale] << "]|h|r";
1074 else
1075 ss << ' ' << localeNames[locale];
1076
1077 if (talent)
1078 ss << handler->GetTrinityString(LANG_TALENT);
1079 if (passive)
1080 ss << handler->GetTrinityString(LANG_PASSIVE);
1081 if (learn)
1082 ss << handler->GetTrinityString(LANG_LEARN);
1083 if (known)
1084 ss << handler->GetTrinityString(LANG_KNOWN);
1085 if (active)
1086 ss << handler->GetTrinityString(LANG_ACTIVE);
1087
1088 handler->SendSysMessage(ss.str().c_str());
1089 }
1090 else
1092
1093 return true;
1094 }
1095
1096 static bool HandleLookupTaxiNodeCommand(ChatHandler* handler, const char * args)
1097 {
1098 if (!*args)
1099 return false;
1100
1101 std::string namePart = args;
1102 std::wstring wNamePart;
1103
1104 if (!Utf8toWStr(namePart, wNamePart))
1105 return false;
1106
1107 // converting string that we try to find to lower case
1108 wstrToLower(wNamePart);
1109
1110 bool found = false;
1111 uint32 count = 0;
1112 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
1113
1114 // Search in TaxiNodes.dbc
1115 for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++)
1116 {
1117 TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(id);
1118 if (nodeEntry)
1119 {
1120 uint8 locale = handler->GetSessionDbcLocale();
1121 std::string name = nodeEntry->Name[locale];
1122 if (name.empty())
1123 continue;
1124
1125 if (!Utf8FitTo(name, wNamePart))
1126 {
1127 locale = 0;
1128 for (; locale < TOTAL_LOCALES; ++locale)
1129 {
1130 if (locale == handler->GetSessionDbcLocale())
1131 continue;
1132
1133 name = nodeEntry->Name[locale];
1134 if (name.empty())
1135 continue;
1136
1137 if (Utf8FitTo(name, wNamePart))
1138 break;
1139 }
1140 }
1141
1142 if (locale < TOTAL_LOCALES)
1143 {
1144 if (maxResults && count++ == maxResults)
1145 {
1147 return true;
1148 }
1149
1150 // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format
1151 if (handler->GetSession())
1152 handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), localeNames[locale],
1153 nodeEntry->ContinentID, nodeEntry->Pos.X, nodeEntry->Pos.Y, nodeEntry->Pos.Z);
1154 else
1155 handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[locale],
1156 nodeEntry->ContinentID, nodeEntry->Pos.X, nodeEntry->Pos.Y, nodeEntry->Pos.Z);
1157
1158 if (!found)
1159 found = true;
1160 }
1161 }
1162 }
1163 if (!found)
1165
1166 return true;
1167 }
1168
1169 // Find tele in game_tele order by name
1170 static bool HandleLookupTeleCommand(ChatHandler* handler, char const* args)
1171 {
1172 if (!*args)
1173 {
1175 handler->SetSentErrorMessage(true);
1176 return false;
1177 }
1178
1179 char const* str = strtok((char*)args, " ");
1180 if (!str)
1181 return false;
1182
1183 std::string namePart = str;
1184 std::wstring wNamePart;
1185
1186 if (!Utf8toWStr(namePart, wNamePart))
1187 return false;
1188
1189 // converting string that we try to find to lower case
1190 wstrToLower(wNamePart);
1191
1192 std::ostringstream reply;
1193 uint32 count = 0;
1194 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
1195 bool limitReached = false;
1196
1197 GameTeleContainer const & teleMap = sObjectMgr->GetGameTeleMap();
1198 for (GameTeleContainer::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
1199 {
1200 GameTele const* tele = &itr->second;
1201
1202 if (tele->wnameLow.find(wNamePart) == std::wstring::npos)
1203 continue;
1204
1205 if (maxResults && count++ == maxResults)
1206 {
1207 limitReached = true;
1208 break;
1209 }
1210
1211 if (handler->GetSession())
1212 reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
1213 else
1214 reply << " " << itr->first << ' ' << tele->name << "\n";
1215 }
1216
1217 if (reply.str().empty())
1219 else
1220 handler->PSendSysMessage(LANG_COMMAND_TELE_LOCATION, reply.str().c_str());
1221
1222 if (limitReached)
1224
1225 return true;
1226 }
1227
1228 static bool HandleLookupTitleCommand(ChatHandler* handler, char const* args)
1229 {
1230 if (!*args)
1231 return false;
1232
1233 // can be NULL in console call
1234 Player* target = handler->getSelectedPlayer();
1235
1236 // title name have single string arg for player name
1237 char const* targetName = target ? target->GetName().c_str() : "NAME";
1238
1239 std::string namePart = args;
1240 std::wstring wNamePart;
1241
1242 if (!Utf8toWStr(namePart, wNamePart))
1243 return false;
1244
1245 // converting string that we try to find to lower case
1246 wstrToLower(wNamePart);
1247
1248 uint32 counter = 0; // Counter for figure out that we found smth.
1249 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
1250
1251 // Search in CharTitles.dbc
1252 for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
1253 {
1254 CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
1255 if (titleInfo)
1256 {
1258 uint8 locale = handler->GetSessionDbcLocale();
1259 std::string_view name = titleInfo->Name[locale];
1260 if (name.empty())
1261 continue;
1262
1263 if (!Utf8FitTo(name, wNamePart))
1264 {
1265 locale = 0;
1266 for (; locale < TOTAL_LOCALES; ++locale)
1267 {
1268 if (locale == handler->GetSessionDbcLocale())
1269 continue;
1270
1271 name = titleInfo->Name[locale];
1272 if (name.empty())
1273 continue;
1274
1275 if (Utf8FitTo(name, wNamePart))
1276 break;
1277 }
1278 }
1279
1280 if (locale < TOTAL_LOCALES)
1281 {
1282 if (maxResults && counter == maxResults)
1283 {
1285 return true;
1286 }
1287
1288 char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetTrinityString(LANG_KNOWN) : "";
1289
1290 char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->MaskID
1291 ? handler->GetTrinityString(LANG_ACTIVE)
1292 : "";
1293
1294 std::string titleNameStr = ChatHandler::PGetParseString(name, targetName);
1295
1296 // send title in "id (idx:idx) - [namedlink locale]" format
1297 if (handler->GetSession())
1298 handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->MaskID, id, titleNameStr, localeNames[locale], knownStr, activeStr);
1299 else
1300 handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->MaskID, titleNameStr, localeNames[locale], knownStr, activeStr);
1301
1302 ++counter;
1303 }
1304 }
1305 }
1306 if (counter == 0) // if counter == 0 then we found nth
1308
1309 return true;
1310 }
1311
1312 static bool HandleLookupMapCommand(ChatHandler* handler, char const* args)
1313 {
1314 if (!*args)
1315 return false;
1316
1317 std::string namePart = args;
1318 std::wstring wNamePart;
1319
1320 if (!Utf8toWStr(namePart, wNamePart))
1321 return false;
1322
1323 wstrToLower(wNamePart);
1324
1325 uint32 counter = 0;
1326 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
1327 uint8 locale = handler->GetSession() ? handler->GetSession()->GetSessionDbcLocale() : sWorld->GetDefaultDbcLocale();
1328
1329 // search in Map.dbc
1330 for (uint32 id = 0; id < sMapStore.GetNumRows(); id++)
1331 {
1332 if (MapEntry const* mapInfo = sMapStore.LookupEntry(id))
1333 {
1334 std::string name = mapInfo->MapName[locale];
1335 if (name.empty())
1336 continue;
1337
1338 if (Utf8FitTo(name, wNamePart) && locale < TOTAL_LOCALES)
1339 {
1340 if (maxResults && counter == maxResults)
1341 {
1343 return true;
1344 }
1345
1346 std::ostringstream ss;
1347 ss << id << " - [" << name << ']';
1348
1349 if (mapInfo->IsContinent())
1350 ss << handler->GetTrinityString(LANG_CONTINENT);
1351
1352 switch (mapInfo->InstanceType)
1353 {
1354 case MAP_INSTANCE:
1355 ss << handler->GetTrinityString(LANG_INSTANCE);
1356 break;
1357 case MAP_RAID:
1358 ss << handler->GetTrinityString(LANG_RAID);
1359 break;
1360 case MAP_BATTLEGROUND:
1361 ss << handler->GetTrinityString(LANG_BATTLEGROUND);
1362 break;
1363 case MAP_ARENA:
1364 ss << handler->GetTrinityString(LANG_ARENA);
1365 break;
1366 }
1367
1368 handler->SendSysMessage(ss.str().c_str());
1369
1370 ++counter;
1371 }
1372 }
1373 }
1374
1375 if (!counter)
1377
1378 return true;
1379 }
1380
1381 static bool HandleLookupMapIdCommand(ChatHandler* handler, char const* args)
1382 {
1383 if (!*args)
1384 return false;
1385
1386 uint32 id = atoi((char*)args);
1387
1388 if (MapEntry const* mapInfo = sMapStore.LookupEntry(id))
1389 {
1390 uint8 locale = handler->GetSession() ? handler->GetSession()->GetSessionDbcLocale() : sWorld->GetDefaultDbcLocale();
1391 std::string name = mapInfo->MapName[locale];
1392 if (name.empty())
1393 {
1395 return true;
1396 }
1397
1398 std::ostringstream ss;
1399 ss << id << " - [" << name << ']';
1400
1401 if (mapInfo->IsContinent())
1402 ss << handler->GetTrinityString(LANG_CONTINENT);
1403
1404 switch (mapInfo->InstanceType)
1405 {
1406 case MAP_INSTANCE:
1407 ss << handler->GetTrinityString(LANG_INSTANCE);
1408 break;
1409 case MAP_RAID:
1410 ss << handler->GetTrinityString(LANG_RAID);
1411 break;
1412 case MAP_BATTLEGROUND:
1413 ss << handler->GetTrinityString(LANG_BATTLEGROUND);
1414 break;
1415 case MAP_ARENA:
1416 ss << handler->GetTrinityString(LANG_ARENA);
1417 break;
1418 }
1419
1420 handler->SendSysMessage(ss.str().c_str());
1421 }
1422 else
1424
1425 return true;
1426 }
1427
1428 static bool HandleLookupPlayerIpCommand(ChatHandler* handler, char const* args)
1429 {
1430 std::string ip;
1431 int32 limit;
1432 char* limitStr;
1433
1434 Player* target = handler->getSelectedPlayer();
1435 if (!*args)
1436 {
1437 // NULL only if used from console
1438 if (!target || target == handler->GetSession()->GetPlayer())
1439 return false;
1440
1441 ip = target->GetSession()->GetRemoteAddress();
1442 limit = -1;
1443 }
1444 else
1445 {
1446 ip = strtok((char*)args, " ");
1447 limitStr = strtok(nullptr, " ");
1448 limit = limitStr ? atoi(limitStr) : -1;
1449 }
1450
1452 stmt->setString(0, ip);
1453 PreparedQueryResult result = LoginDatabase.Query(stmt);
1454
1455 return LookupPlayerSearchCommand(result, limit, handler);
1456 }
1457
1458 static bool HandleLookupPlayerAccountCommand(ChatHandler* handler, char const* args)
1459 {
1460 if (!*args)
1461 return false;
1462
1463 std::string account = strtok((char*)args, " ");
1464 char* limitStr = strtok(nullptr, " ");
1465 int32 limit = limitStr ? atoi(limitStr) : -1;
1466
1468 (account))
1469 return false;
1470
1472 stmt->setString(0, account);
1473 PreparedQueryResult result = LoginDatabase.Query(stmt);
1474
1475 return LookupPlayerSearchCommand(result, limit, handler);
1476 }
1477
1478 static bool HandleLookupPlayerEmailCommand(ChatHandler* handler, char const* args)
1479 {
1480 if (!*args)
1481 return false;
1482
1483 std::string email = strtok((char*)args, " ");
1484 char* limitStr = strtok(nullptr, " ");
1485 int32 limit = limitStr ? atoi(limitStr) : -1;
1486
1488 stmt->setString(0, email);
1489 PreparedQueryResult result = LoginDatabase.Query(stmt);
1490
1491 return LookupPlayerSearchCommand(result, limit, handler);
1492 }
1493
1495 {
1496 if (!result)
1497 {
1499 handler->SetSentErrorMessage(true);
1500 return false;
1501 }
1502
1503 int32 counter = 0;
1504 uint32 count = 0;
1505 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
1506
1507 do
1508 {
1509 if (maxResults && count++ == maxResults)
1510 {
1512 return true;
1513 }
1514
1515 Field* fields = result->Fetch();
1516 uint32 accountId = fields[0].GetUInt32();
1517 std::string accountName = fields[1].GetString();
1518
1520 stmt->setUInt32(0, accountId);
1521 PreparedQueryResult result2 = CharacterDatabase.Query(stmt);
1522
1523 if (result2)
1524 {
1525 handler->PSendSysMessage(LANG_LOOKUP_PLAYER_ACCOUNT, accountName.c_str(), accountId);
1526
1527 do
1528 {
1529 Field* characterFields = result2->Fetch();
1530 ObjectGuid::LowType guid = characterFields[0].GetUInt32();
1531 std::string name = characterFields[1].GetString();
1532 uint8 online = characterFields[2].GetUInt8();
1533
1534 handler->PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid, online ? handler->GetTrinityString(LANG_ONLINE) : "");
1535 ++counter;
1536 }
1537 while (result2->NextRow() && (limit == -1 || counter < limit));
1538 }
1539 }
1540 while (result->NextRow());
1541
1542 if (counter == 0) // empty accounts only
1543 {
1545 handler->SetSentErrorMessage(true);
1546 return false;
1547 }
1548
1549 return true;
1550 }
1551};
1552
@ CHAR_SEL_CHAR_GUID_NAME_BY_ACC
char const * localeNames[TOTAL_LOCALES]
Definition Common.cpp:20
@ TOTAL_LOCALES
Definition Common.h:59
@ MAP_BATTLEGROUND
Definition DBCEnums.h:338
@ MAP_ARENA
Definition DBCEnums.h:339
@ MAP_INSTANCE
Definition DBCEnums.h:336
@ MAP_RAID
Definition DBCEnums.h:337
DBCStorage< CharTitlesEntry > sCharTitlesStore(CharTitlesEntryfmt)
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
DBCStorage< ItemSetEntry > sItemSetStore(ItemSetEntryfmt)
uint32 GetTalentSpellCost(uint32 spellId)
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
DBCStorage< TaxiNodesEntry > sTaxiNodesStore(TaxiNodesEntryfmt)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
#define sGameEventMgr
@ LANG_FACTION_PEACE_FORCED
Definition Language.h:369
@ LANG_COMMAND_TELE_PARAMETER
Definition Language.h:206
@ LANG_COMMAND_NOAREAFOUND
Definition Language.h:505
@ LANG_ITEM_LIST_CHAT
Definition Language.h:586
@ LANG_COMMAND_TELE_LOCATION
Definition Language.h:209
@ LANG_FACTION_ATWAR
Definition Language.h:368
@ LANG_COMMAND_QUEST_REWARDED
Definition Language.h:538
@ LANG_EVENT_ENTRY_LIST_CONSOLE
Definition Language.h:879
@ LANG_COMMAND_NOTAXINODEFOUND
Definition Language.h:529
@ LANG_SKILL_LIST_CHAT
Definition Language.h:595
@ LANG_GO_ENTRY_LIST_CONSOLE
Definition Language.h:883
@ LANG_COMMAND_TELE_NOLOCATION
Definition Language.h:207
@ LANG_ITEMSET_LIST_CHAT
Definition Language.h:592
@ LANG_KNOWN
Definition Language.h:63
@ LANG_EVENT_ENTRY_LIST_CHAT
Definition Language.h:671
@ LANG_COMMAND_NOCREATUREFOUND
Definition Language.h:510
@ LANG_CREATURE_ENTRY_LIST_CONSOLE
Definition Language.h:880
@ LANG_FACTION_NOREPUTATION
Definition Language.h:382
@ LANG_SKILL_LIST_CONSOLE
Definition Language.h:885
@ LANG_TALENT
Definition Language.h:66
@ LANG_FACTION_INVISIBLE_FORCED
Definition Language.h:371
@ LANG_COMMAND_NOITEMFOUND
Definition Language.h:499
@ LANG_QUEST_LIST_CONSOLE
Definition Language.h:884
@ LANG_COMMAND_QUEST_ACTIVE
Definition Language.h:540
@ LANG_LOOKUP_PLAYER_CHARACTER
Definition Language.h:384
@ LANG_GO_ENTRY_LIST_CHAT
Definition Language.h:590
@ LANG_LEARN
Definition Language.h:64
@ LANG_COMMAND_NOMAPFOUND
Definition Language.h:1071
@ LANG_TITLE_LIST_CHAT
Definition Language.h:404
@ LANG_BATTLEGROUND
Definition Language.h:1074
@ LANG_COMMAND_NOSKILLFOUND
Definition Language.h:507
@ LANG_COMMAND_NOTITLEFOUND
Definition Language.h:406
@ LANG_COMMAND_NOITEMSETFOUND
Definition Language.h:506
@ LANG_TAXINODE_ENTRY_LIST_CHAT
Definition Language.h:904
@ LANG_FACTION_HIDDEN
Definition Language.h:370
@ LANG_COMMAND_NOSPELLFOUND
Definition Language.h:508
@ LANG_COMMAND_LOOKUP_MAX_RESULTS
Definition Language.h:1088
@ LANG_COMMAND_NOQUESTFOUND
Definition Language.h:509
@ LANG_ARENA
Definition Language.h:1075
@ LANG_INSTANCE
Definition Language.h:1073
@ LANG_COMMAND_FACTION_NOTFOUND
Definition Language.h:362
@ LANG_COMMAND_NOGAMEOBJECTFOUND
Definition Language.h:511
@ LANG_ACTIVE
Definition Language.h:67
@ LANG_SPELL_RANK
Definition Language.h:62
@ LANG_TAXINODE_ENTRY_LIST_CONSOLE
Definition Language.h:905
@ LANG_COMMAND_QUEST_COMPLETE
Definition Language.h:539
@ LANG_CONTINENT
Definition Language.h:1072
@ LANG_SKILL_VALUES
Definition Language.h:898
@ LANG_NOEVENTFOUND
Definition Language.h:672
@ LANG_TITLE_LIST_CONSOLE
Definition Language.h:405
@ LANG_PASSIVE
Definition Language.h:65
@ LANG_ITEMSET_LIST_CONSOLE
Definition Language.h:882
@ LANG_LOOKUP_PLAYER_ACCOUNT
Definition Language.h:383
@ LANG_NO_PLAYERS_FOUND
Definition Language.h:385
@ LANG_RAID
Definition Language.h:1076
@ LANG_CREATURE_ENTRY_LIST_CHAT
Definition Language.h:588
@ LANG_FACTION_INACTIVE
Definition Language.h:372
@ LANG_FACTION_VISIBLE
Definition Language.h:367
@ LANG_ITEM_LIST_CONSOLE
Definition Language.h:881
@ LANG_QUEST_LIST_CHAT
Definition Language.h:587
@ LANG_ONLINE
Definition Language.h:80
@ LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL
@ LOGIN_SEL_ACCOUNT_BY_IP
@ LOGIN_SEL_ACCOUNT_LIST_BY_NAME
std::unordered_map< uint32, ItemTemplate > ItemTemplateContainer
Definition ObjectMgr.h:556
std::unordered_map< uint32, GameObjectTemplate > GameObjectTemplateContainer
Definition ObjectMgr.h:544
std::unordered_map< uint32, GameTele > GameTeleContainer
Definition ObjectMgr.h:170
#define sObjectMgr
Definition ObjectMgr.h:1721
std::unordered_map< uint32, CreatureTemplate > CreatureTemplateContainer
Definition ObjectMgr.h:535
@ QUEST_STATUS_REWARDED
Definition QuestDef.h:110
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:107
@ QUEST_STATUS_COMPLETE
Definition QuestDef.h:105
@ EFFECT_0
@ SPELL_EFFECT_LEARN_SPELL
#define sSpellMgr
Definition SpellMgr.h:738
@ PLAYER_CHOSEN_TITLE
bool Utf8ToUpperOnlyLatin(std::string &utf8String)
Definition Util.cpp:610
void wstrToLower(std::wstring &str)
Definition Util.cpp:480
bool Utf8FitTo(std::string_view str, std::wstring_view search)
Definition Util.cpp:565
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition Util.cpp:383
Player * getSelectedPlayerOrSelf()
Definition Chat.cpp:346
static std::string PGetParseString(std::string_view fmt, Args &&... args)
Definition Chat.h:81
Player * getSelectedPlayer()
Definition Chat.cpp:302
WorldSession * GetSession()
Definition Chat.h:46
virtual LocaleConstant GetSessionDbcLocale() const
Definition Chat.cpp:692
virtual int GetSessionDbLocaleIndex() const
Definition Chat.cpp:697
void SetSentErrorMessage(bool val)
Definition Chat.h:134
void PSendSysMessage(char const *fmt, Args &&... args)
Definition Chat.h:69
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:101
virtual char const * GetTrinityString(uint32 entry) const
Definition Chat.cpp:36
constexpr bool HasFlag(T flag) const
Definition EnumFlag.h:106
Class used to access individual fields of database query result.
Definition Field.h:92
uint8 GetUInt8() const
Definition Field.cpp:29
std::string GetString() const
Definition Field.cpp:125
uint32 GetUInt32() const
Definition Field.cpp:61
std::vector< GameEventData > GameEventDataMap
std::set< uint16 > ActiveEvents
uint32 LowType
Definition ObjectGuid.h:142
std::unordered_map< uint32, Trinity::unique_trackable_ptr< Quest > > QuestContainer
Definition ObjectMgr.h:947
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:249
bool HasTitle(uint32 bitIndex) const
Definition Player.cpp:24301
uint16 GetPureSkillValue(uint32 skill) const
Definition Player.cpp:5948
int16 GetSkillTempBonusValue(uint32 skill) const
Definition Player.cpp:5972
int16 GetSkillPermBonusValue(uint32 skill) const
Definition Player.cpp:5960
WorldSession * GetSession() const
Definition Player.h:1719
bool HasSkill(uint32 skill) const
Definition Player.cpp:5871
uint16 GetPureMaxSkillValue(uint32 skill) const
Definition Player.cpp:5922
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition Player.cpp:15642
bool HasSpell(uint32 spell) const override
Definition Player.cpp:3853
ReputationMgr & GetReputationMgr()
Definition Player.h:1848
void setUInt32(uint8 index, uint32 value)
void setString(uint8 index, std::string const &value)
std::string GetReputationRankName(FactionEntry const *factionEntry) const
int32 GetReputation(uint32 faction_id) const
FactionState const * GetState(FactionEntry const *factionEntry) const
uint32 TriggerSpell
Definition SpellInfo.h:228
bool IsEffect() const
bool IsPassive() const
uint8 GetRank() const
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:483
std::array< char const *, 16 > SpellName
Definition SpellInfo.h:352
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
std::string const & GetName() const
Definition Object.h:382
LocaleConstant GetSessionDbcLocale() const
Player * GetPlayer() const
std::string const & GetRemoteAddress() const
std::vector< ChatCommand > GetCommands() const override
Definition cs_lookup.cpp:51
static bool HandleLookupItemIdCommand(ChatHandler *handler, char const *args)
static bool HandleLookupPlayerAccountCommand(ChatHandler *handler, char const *args)
static bool HandleLookupSkillCommand(ChatHandler *handler, char const *args)
static bool HandleLookupItemCommand(ChatHandler *handler, char const *args)
static bool HandleLookupSpellIdCommand(ChatHandler *handler, char const *args)
static bool HandleLookupPlayerEmailCommand(ChatHandler *handler, char const *args)
static bool HandleLookupFactionCommand(ChatHandler *handler, char const *args)
static bool HandleLookupPlayerIpCommand(ChatHandler *handler, char const *args)
static bool HandleLookupMapCommand(ChatHandler *handler, char const *args)
static bool HandleLookupAreaCommand(ChatHandler *handler, char const *args)
Definition cs_lookup.cpp:90
static bool HandleLookupTaxiNodeCommand(ChatHandler *handler, const char *args)
static bool LookupPlayerSearchCommand(PreparedQueryResult result, int32 limit, ChatHandler *handler)
static bool HandleLookupItemSetCommand(ChatHandler *handler, char const *args)
static bool HandleLookupQuestIdCommand(ChatHandler *handler, char const *args)
static bool HandleLookupObjectCommand(ChatHandler *handler, char const *args)
static bool HandleLookupCreatureCommand(ChatHandler *handler, char const *args)
static bool HandleLookupSpellCommand(ChatHandler *handler, char const *args)
static bool HandleLookupQuestCommand(ChatHandler *handler, char const *args)
static bool HandleLookupTitleCommand(ChatHandler *handler, char const *args)
static bool HandleLookupMapIdCommand(ChatHandler *handler, char const *args)
static bool HandleLookupEventCommand(ChatHandler *handler, char const *args)
static bool HandleLookupTeleCommand(ChatHandler *handler, char const *args)
void AddSC_lookup_commandscript()
#define sWorld
Definition World.h:900
@ CONFIG_MAX_RESULTS_LOOKUP_COMMANDS
Definition World.h:350
std::vector< ChatCommandBuilder > ChatCommandTable
Definition ChatCommand.h:50
@ RBAC_PERM_COMMAND_LOOKUP_QUEST
Definition RBAC.h:320
@ RBAC_PERM_COMMAND_LOOKUP_EVENT
Definition RBAC.h:315
@ RBAC_PERM_COMMAND_LOOKUP_SPELL
Definition RBAC.h:326
@ RBAC_PERM_COMMAND_LOOKUP_PLAYER_EMAIL
Definition RBAC.h:324
@ RBAC_PERM_COMMAND_LOOKUP_OBJECT
Definition RBAC.h:319
@ RBAC_PERM_COMMAND_LOOKUP_AREA
Definition RBAC.h:313
@ RBAC_PERM_COMMAND_LOOKUP_ITEMSET
Definition RBAC.h:318
@ RBAC_PERM_COMMAND_LOOKUP_FACTION
Definition RBAC.h:316
@ RBAC_PERM_COMMAND_LOOKUP_TELE
Definition RBAC.h:329
@ RBAC_PERM_COMMAND_LOOKUP_PLAYER_IP
Definition RBAC.h:322
@ RBAC_PERM_COMMAND_LOOKUP_QUEST_ID
Definition RBAC.h:745
@ RBAC_PERM_COMMAND_LOOKUP_ITEM_ID
Definition RBAC.h:744
@ RBAC_PERM_COMMAND_LOOKUP_SPELL_ID
Definition RBAC.h:327
@ RBAC_PERM_COMMAND_LOOKUP_SKILL
Definition RBAC.h:325
@ RBAC_PERM_COMMAND_LOOKUP_CREATURE
Definition RBAC.h:314
@ RBAC_PERM_COMMAND_LOOKUP_TITLE
Definition RBAC.h:330
@ RBAC_PERM_COMMAND_LOOKUP_MAP_ID
Definition RBAC.h:743
@ RBAC_PERM_COMMAND_LOOKUP_PLAYER_ACCOUNT
Definition RBAC.h:323
@ RBAC_PERM_COMMAND_LOOKUP_ITEM
Definition RBAC.h:317
@ RBAC_PERM_COMMAND_LOOKUP_MAP
Definition RBAC.h:331
@ RBAC_PERM_COMMAND_LOOKUP_TAXINODE
Definition RBAC.h:328
char const * AreaName[16]
char const * Name[16]
char const * Name[16]
EnumFlag< ReputationFlags > Flags
std::string description
std::string name
Definition ObjectMgr.h:166
std::wstring wnameLow
Definition ObjectMgr.h:167
char const * Name[16]
char const * DisplayName[16]
DBCPosition3D Pos
char const * Name[16]