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 std::string name = itemTemplatePair.second.GetName(handler->GetSessionDbLocaleIndex());
422 if (name.empty())
423 continue;
424
425 if (Utf8FitTo(name, wNamePart))
426 {
427 if (maxResults && count++ == maxResults)
428 {
430 return true;
431 }
432
433 if (handler->GetSession())
434 handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itemTemplatePair.first, itemTemplatePair.first, name.c_str());
435 else
436 handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itemTemplatePair.first, name.c_str());
437
438 if (!found)
439 found = true;
440 }
441 }
442
443 if (!found)
445
446 return true;
447 }
448
449 static bool HandleLookupItemIdCommand(ChatHandler* handler, char const* args)
450 {
451 if (!*args)
452 return false;
453
454 uint32 id = atoi((char*)args);
455
456 if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(id))
457 {
458 std::string name = itemTemplate->GetName(handler->GetSessionDbLocaleIndex());
459
460 if (name.empty())
461 {
463 return true;
464 }
465
466 if (handler->GetSession())
467 handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str());
468 else
469 handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, id, name.c_str());
470 }
471 else
473
474 return true;
475 }
476
477 static bool HandleLookupItemSetCommand(ChatHandler* handler, char const* args)
478 {
479 if (!*args)
480 return false;
481
482 std::string namePart = args;
483 std::wstring wNamePart;
484
485 if (!Utf8toWStr(namePart, wNamePart))
486 return false;
487
488 // converting string that we try to find to lower case
489 wstrToLower(wNamePart);
490
491 bool found = false;
492 uint32 count = 0;
493 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
494
495 // Search in ItemSet.dbc
496 for (uint32 id = 0; id < sItemSetStore.GetNumRows(); id++)
497 {
498 ItemSetEntry const* set = sItemSetStore.LookupEntry(id);
499 if (set)
500 {
501 uint8 locale = handler->GetSessionDbcLocale();
502 std::string name = set->Name[locale];
503 if (name.empty())
504 continue;
505
506 if (!Utf8FitTo(name, wNamePart))
507 {
508 locale = 0;
509 for (; locale < TOTAL_LOCALES; ++locale)
510 {
511 if (locale == handler->GetSessionDbcLocale())
512 continue;
513
514 name = set->Name[locale];
515 if (name.empty())
516 continue;
517
518 if (Utf8FitTo(name, wNamePart))
519 break;
520 }
521 }
522
523 if (locale < TOTAL_LOCALES)
524 {
525 if (maxResults && count++ == maxResults)
526 {
528 return true;
529 }
530
531 // send item set in "id - [namedlink locale]" format
532 if (handler->GetSession())
533 handler->PSendSysMessage(LANG_ITEMSET_LIST_CHAT, id, id, name.c_str(), localeNames[locale]);
534 else
535 handler->PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), localeNames[locale]);
536
537 if (!found)
538 found = true;
539 }
540 }
541 }
542 if (!found)
544
545 return true;
546 }
547
548 static bool HandleLookupObjectCommand(ChatHandler* handler, char const* args)
549 {
550 if (!*args)
551 return false;
552
553 std::string namePart = args;
554 std::wstring wNamePart;
555
556 // converting string that we try to find to lower case
557 if (!Utf8toWStr(namePart, wNamePart))
558 return false;
559
560 wstrToLower(wNamePart);
561
562 bool found = false;
563 uint32 count = 0;
564 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
565
566 GameObjectTemplateContainer const& gotc = sObjectMgr->GetGameObjectTemplates();
567 for (auto const& gameObjectTemplatePair : gotc)
568 {
569 uint8 localeIndex = handler->GetSessionDbLocaleIndex();
570 if (GameObjectLocale const* objectLocalte = sObjectMgr->GetGameObjectLocale(gameObjectTemplatePair.first))
571 {
572 if (objectLocalte->Name.size() > localeIndex && !objectLocalte->Name[localeIndex].empty())
573 {
574 std::string const& name = objectLocalte->Name[localeIndex];
575 if (Utf8FitTo(name, wNamePart))
576 {
577 if (maxResults && count++ == maxResults)
578 {
580 return true;
581 }
582
583 if (handler->GetSession())
584 handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, gameObjectTemplatePair.first, gameObjectTemplatePair.first, name.c_str());
585 else
586 handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, gameObjectTemplatePair.first, name.c_str());
587
588 if (!found)
589 found = true;
590
591 continue;
592 }
593 }
594 }
595
596 std::string const& name = gameObjectTemplatePair.second.name;
597 if (name.empty())
598 continue;
599
600 if (Utf8FitTo(name, wNamePart))
601 {
602 if (maxResults && count++ == maxResults)
603 {
605 return true;
606 }
607
608 if (handler->GetSession())
609 handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, gameObjectTemplatePair.first, gameObjectTemplatePair.first, name.c_str());
610 else
611 handler->PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, gameObjectTemplatePair.first, name.c_str());
612
613 if (!found)
614 found = true;
615 }
616 }
617
618 if (!found)
620
621 return true;
622 }
623
624 static bool HandleLookupQuestCommand(ChatHandler* handler, char const* args)
625 {
626 if (!*args)
627 return false;
628
629 // can be NULL at console call
630 Player* target = handler->getSelectedPlayerOrSelf();
631
632 std::string namePart = args;
633 std::wstring wNamePart;
634
635 // converting string that we try to find to lower case
636 if (!Utf8toWStr(namePart, wNamePart))
637 return false;
638
639 wstrToLower(wNamePart);
640
641 bool found = false;
642 uint32 count = 0;
643 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
644
645 ObjectMgr::QuestContainer const& questTemplates = sObjectMgr->GetQuestTemplates();
646 for (auto const& questTemplatePair : questTemplates)
647 {
648 uint8 localeIndex = handler->GetSessionDbLocaleIndex();
649 if (QuestLocale const* questLocale = sObjectMgr->GetQuestLocale(questTemplatePair.first))
650 {
651 if (questLocale->LogTitle.size() > localeIndex && !questLocale->LogTitle[localeIndex].empty())
652 {
653 std::string const& title = questLocale->LogTitle[localeIndex];
654
655 if (Utf8FitTo(title, wNamePart))
656 {
657 if (maxResults && count++ == maxResults)
658 {
660 return true;
661 }
662
663 char const* statusStr = "";
664
665 if (target)
666 {
667 switch (target->GetQuestStatus(questTemplatePair.first))
668 {
670 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
671 break;
673 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
674 break;
676 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
677 break;
678 default:
679 break;
680 }
681 }
682
683 if (handler->GetSession())
684 handler->PSendSysMessage(LANG_QUEST_LIST_CHAT, questTemplatePair.first, questTemplatePair.first, questTemplatePair.second->GetQuestLevel(), title.c_str(), statusStr);
685 else
686 handler->PSendSysMessage(LANG_QUEST_LIST_CONSOLE, questTemplatePair.first, title.c_str(), statusStr);
687
688 if (!found)
689 found = true;
690
691 continue;
692 }
693 }
694 }
695
696 std::string const& title = questTemplatePair.second->GetLogTitle();
697 if (title.empty())
698 continue;
699
700 if (Utf8FitTo(title, wNamePart))
701 {
702 if (maxResults && count++ == maxResults)
703 {
705 return true;
706 }
707
708 char const* statusStr = "";
709
710 if (target)
711 {
712 switch (target->GetQuestStatus(questTemplatePair.first))
713 {
715 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
716 break;
718 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
719 break;
721 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
722 break;
723 default:
724 break;
725 }
726 }
727
728 if (handler->GetSession())
729 handler->PSendSysMessage(LANG_QUEST_LIST_CHAT, questTemplatePair.first, questTemplatePair.first, questTemplatePair.second->GetQuestLevel(), title.c_str(), statusStr);
730 else
731 handler->PSendSysMessage(LANG_QUEST_LIST_CONSOLE, questTemplatePair.first, title.c_str(), statusStr);
732
733 if (!found)
734 found = true;
735 }
736 }
737
738 if (!found)
740
741 return true;
742 }
743
744 static bool HandleLookupQuestIdCommand(ChatHandler* handler, char const* args)
745 {
746 if (!*args)
747 return false;
748
749 uint32 id = atoi((char*)args);
750
751 // can be NULL at console call
752 Player* target = handler->getSelectedPlayerOrSelf();
753
754 if (Quest const* quest = sObjectMgr->GetQuestTemplate(id))
755 {
756 std::string title = quest->GetLogTitle();
757 if (title.empty())
758 {
760 return true;
761 }
762
763 char const* statusStr = "";
764
765 if (target)
766 {
767 switch (target->GetQuestStatus(id))
768 {
770 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
771 break;
773 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);
774 break;
776 statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_REWARDED);
777 break;
778 default:
779 break;
780 }
781 }
782
783 if (handler->GetSession())
784 handler->PSendSysMessage(LANG_QUEST_LIST_CHAT, id, id, quest->GetQuestLevel(), title.c_str(), statusStr);
785 else
786 handler->PSendSysMessage(LANG_QUEST_LIST_CONSOLE, id, title.c_str(), statusStr);
787 }
788 else
790
791 return true;
792 }
793
794 static bool HandleLookupSkillCommand(ChatHandler* handler, char const* args)
795 {
796 if (!*args)
797 return false;
798
799 // can be NULL in console call
800 Player* target = handler->getSelectedPlayer();
801
802 std::string namePart = args;
803 std::wstring wNamePart;
804
805 if (!Utf8toWStr(namePart, wNamePart))
806 return false;
807
808 // converting string that we try to find to lower case
809 wstrToLower(wNamePart);
810
811 bool found = false;
812 uint32 count = 0;
813 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
814
815 // Search in SkillLine.dbc
816 for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); id++)
817 {
818 SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(id);
819 if (skillInfo)
820 {
821 uint8 locale = handler->GetSessionDbcLocale();
822 std::string name = skillInfo->DisplayName[locale];
823 if (name.empty())
824 continue;
825
826 if (!Utf8FitTo(name, wNamePart))
827 {
828 locale = 0;
829 for (; locale < TOTAL_LOCALES; ++locale)
830 {
831 if (locale == handler->GetSessionDbcLocale())
832 continue;
833
834 name = skillInfo->DisplayName[locale];
835 if (name.empty())
836 continue;
837
838 if (Utf8FitTo(name, wNamePart))
839 break;
840 }
841 }
842
843 if (locale < TOTAL_LOCALES)
844 {
845 if (maxResults && count++ == maxResults)
846 {
848 return true;
849 }
850
851 char valStr[50] = "";
852 char const* knownStr = "";
853 if (target && target->HasSkill(id))
854 {
855 knownStr = handler->GetTrinityString(LANG_KNOWN);
856 uint32 curValue = target->GetPureSkillValue(id);
857 uint32 maxValue = target->GetPureMaxSkillValue(id);
858 uint32 permValue = target->GetSkillPermBonusValue(id);
859 uint32 tempValue = target->GetSkillTempBonusValue(id);
860
861 char const* valFormat = handler->GetTrinityString(LANG_SKILL_VALUES);
862 snprintf(valStr, 50, valFormat, curValue, maxValue, permValue, tempValue);
863 }
864
865 // send skill in "id - [namedlink locale]" format
866 if (handler->GetSession())
867 handler->PSendSysMessage(LANG_SKILL_LIST_CHAT, id, id, name.c_str(), localeNames[locale], knownStr, valStr);
868 else
869 handler->PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), localeNames[locale], knownStr, valStr);
870
871 if (!found)
872 found = true;
873 }
874 }
875 }
876 if (!found)
878
879 return true;
880 }
881
882 static bool HandleLookupSpellCommand(ChatHandler* handler, char const* args)
883 {
884 if (!*args)
885 return false;
886
887 // can be NULL at console call
888 Player* target = handler->getSelectedPlayer();
889
890 std::string namePart = args;
891 std::wstring wNamePart;
892
893 if (!Utf8toWStr(namePart, wNamePart))
894 return false;
895
896 // converting string that we try to find to lower case
897 wstrToLower(wNamePart);
898
899 bool found = false;
900 uint32 count = 0;
901 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
902
903 // Search in Spell.dbc
904 for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); ++id)
905 {
906 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id);
907 if (spellInfo)
908 {
909 uint8 locale = handler->GetSessionDbcLocale();
910 std::string name = spellInfo->SpellName[locale];
911 if (name.empty())
912 continue;
913
914 if (!Utf8FitTo(name, wNamePart))
915 {
916 locale = 0;
917 for (; locale < TOTAL_LOCALES; ++locale)
918 {
919 if (locale == handler->GetSessionDbcLocale())
920 continue;
921
922 name = spellInfo->SpellName[locale];
923 if (name.empty())
924 continue;
925
926 if (Utf8FitTo(name, wNamePart))
927 break;
928 }
929 }
930
931 if (locale < TOTAL_LOCALES)
932 {
933 if (maxResults && count++ == maxResults)
934 {
936 return true;
937 }
938
939 bool known = target && target->HasSpell(id);
940
941 SpellEffectInfo const& spellEffectInfo = spellInfo->GetEffect(EFFECT_0);
942 bool learn = spellEffectInfo.IsEffect(SPELL_EFFECT_LEARN_SPELL);
943
944 SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellEffectInfo.TriggerSpell);
945
946 uint32 talentCost = GetTalentSpellCost(id);
947
948 bool talent = spellInfo->HasAttribute(SPELL_ATTR0_CU_IS_TALENT);
949 bool passive = spellInfo->IsPassive();
950 bool active = target && target->HasAura(id);
951
952 // unit32 used to prevent interpreting uint8 as char at output
953 // find rank of learned spell for learning spell, or talent rank
954 uint32 rank = talentCost ? talentCost : learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank();
955
956 // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
957 std::ostringstream ss;
958 if (handler->GetSession())
959 ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name;
960 else
961 ss << id << " - " << name;
962
963 // include rank in link name
964 if (rank)
965 ss << handler->GetTrinityString(LANG_SPELL_RANK) << rank;
966
967 if (handler->GetSession())
968 ss << ' ' << localeNames[locale] << "]|h|r";
969 else
970 ss << ' ' << localeNames[locale];
971
972 if (talent)
973 ss << handler->GetTrinityString(LANG_TALENT);
974 if (passive)
975 ss << handler->GetTrinityString(LANG_PASSIVE);
976 if (learn)
977 ss << handler->GetTrinityString(LANG_LEARN);
978 if (known)
979 ss << handler->GetTrinityString(LANG_KNOWN);
980 if (active)
981 ss << handler->GetTrinityString(LANG_ACTIVE);
982
983 handler->SendSysMessage(ss.str().c_str());
984
985 if (!found)
986 found = true;
987 }
988 }
989 }
990 if (!found)
992
993 return true;
994 }
995
996 static bool HandleLookupSpellIdCommand(ChatHandler* handler, char const* args)
997 {
998 if (!*args)
999 return false;
1000
1001 // can be NULL at console call
1002 Player* target = handler->getSelectedPlayer();
1003
1004 uint32 id = atoi((char*)args);
1005
1006 if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id))
1007 {
1008 uint8 locale = handler->GetSessionDbcLocale();
1009 std::string name = spellInfo->SpellName[locale];
1010 if (name.empty())
1011 {
1013 return true;
1014 }
1015
1016 bool known = target && target->HasSpell(id);
1017
1018 SpellEffectInfo const& spellEffectInfo = spellInfo->GetEffect(EFFECT_0);
1019 bool learn = spellEffectInfo.IsEffect(SPELL_EFFECT_LEARN_SPELL);
1020
1021 SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellEffectInfo.TriggerSpell);
1022
1023 uint32 talentCost = GetTalentSpellCost(id);
1024
1025 bool talent = spellInfo->HasAttribute(SPELL_ATTR0_CU_IS_TALENT);
1026 bool passive = spellInfo->IsPassive();
1027 bool active = target && target->HasAura(id);
1028
1029 // unit32 used to prevent interpreting uint8 as char at output
1030 // find rank of learned spell for learning spell, or talent rank
1031 uint32 rank = talentCost ? talentCost : learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank();
1032
1033 // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
1034 std::ostringstream ss;
1035 if (handler->GetSession())
1036 ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name;
1037 else
1038 ss << id << " - " << name;
1039
1040 // include rank in link name
1041 if (rank)
1042 ss << handler->GetTrinityString(LANG_SPELL_RANK) << rank;
1043
1044 if (handler->GetSession())
1045 ss << ' ' << localeNames[locale] << "]|h|r";
1046 else
1047 ss << ' ' << localeNames[locale];
1048
1049 if (talent)
1050 ss << handler->GetTrinityString(LANG_TALENT);
1051 if (passive)
1052 ss << handler->GetTrinityString(LANG_PASSIVE);
1053 if (learn)
1054 ss << handler->GetTrinityString(LANG_LEARN);
1055 if (known)
1056 ss << handler->GetTrinityString(LANG_KNOWN);
1057 if (active)
1058 ss << handler->GetTrinityString(LANG_ACTIVE);
1059
1060 handler->SendSysMessage(ss.str().c_str());
1061 }
1062 else
1064
1065 return true;
1066 }
1067
1068 static bool HandleLookupTaxiNodeCommand(ChatHandler* handler, const char * args)
1069 {
1070 if (!*args)
1071 return false;
1072
1073 std::string namePart = args;
1074 std::wstring wNamePart;
1075
1076 if (!Utf8toWStr(namePart, wNamePart))
1077 return false;
1078
1079 // converting string that we try to find to lower case
1080 wstrToLower(wNamePart);
1081
1082 bool found = false;
1083 uint32 count = 0;
1084 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
1085
1086 // Search in TaxiNodes.dbc
1087 for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++)
1088 {
1089 TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(id);
1090 if (nodeEntry)
1091 {
1092 uint8 locale = handler->GetSessionDbcLocale();
1093 std::string name = nodeEntry->Name[locale];
1094 if (name.empty())
1095 continue;
1096
1097 if (!Utf8FitTo(name, wNamePart))
1098 {
1099 locale = 0;
1100 for (; locale < TOTAL_LOCALES; ++locale)
1101 {
1102 if (locale == handler->GetSessionDbcLocale())
1103 continue;
1104
1105 name = nodeEntry->Name[locale];
1106 if (name.empty())
1107 continue;
1108
1109 if (Utf8FitTo(name, wNamePart))
1110 break;
1111 }
1112 }
1113
1114 if (locale < TOTAL_LOCALES)
1115 {
1116 if (maxResults && count++ == maxResults)
1117 {
1119 return true;
1120 }
1121
1122 // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format
1123 if (handler->GetSession())
1124 handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), localeNames[locale],
1125 nodeEntry->ContinentID, nodeEntry->Pos.X, nodeEntry->Pos.Y, nodeEntry->Pos.Z);
1126 else
1127 handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[locale],
1128 nodeEntry->ContinentID, nodeEntry->Pos.X, nodeEntry->Pos.Y, nodeEntry->Pos.Z);
1129
1130 if (!found)
1131 found = true;
1132 }
1133 }
1134 }
1135 if (!found)
1137
1138 return true;
1139 }
1140
1141 // Find tele in game_tele order by name
1142 static bool HandleLookupTeleCommand(ChatHandler* handler, char const* args)
1143 {
1144 if (!*args)
1145 {
1147 handler->SetSentErrorMessage(true);
1148 return false;
1149 }
1150
1151 char const* str = strtok((char*)args, " ");
1152 if (!str)
1153 return false;
1154
1155 std::string namePart = str;
1156 std::wstring wNamePart;
1157
1158 if (!Utf8toWStr(namePart, wNamePart))
1159 return false;
1160
1161 // converting string that we try to find to lower case
1162 wstrToLower(wNamePart);
1163
1164 std::ostringstream reply;
1165 uint32 count = 0;
1166 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
1167 bool limitReached = false;
1168
1169 GameTeleContainer const & teleMap = sObjectMgr->GetGameTeleMap();
1170 for (GameTeleContainer::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
1171 {
1172 GameTele const* tele = &itr->second;
1173
1174 if (tele->wnameLow.find(wNamePart) == std::wstring::npos)
1175 continue;
1176
1177 if (maxResults && count++ == maxResults)
1178 {
1179 limitReached = true;
1180 break;
1181 }
1182
1183 if (handler->GetSession())
1184 reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
1185 else
1186 reply << " " << itr->first << ' ' << tele->name << "\n";
1187 }
1188
1189 if (reply.str().empty())
1191 else
1192 handler->PSendSysMessage(LANG_COMMAND_TELE_LOCATION, reply.str().c_str());
1193
1194 if (limitReached)
1196
1197 return true;
1198 }
1199
1200 static bool HandleLookupTitleCommand(ChatHandler* handler, char const* args)
1201 {
1202 if (!*args)
1203 return false;
1204
1205 // can be NULL in console call
1206 Player* target = handler->getSelectedPlayer();
1207
1208 // title name have single string arg for player name
1209 char const* targetName = target ? target->GetName().c_str() : "NAME";
1210
1211 std::string namePart = args;
1212 std::wstring wNamePart;
1213
1214 if (!Utf8toWStr(namePart, wNamePart))
1215 return false;
1216
1217 // converting string that we try to find to lower case
1218 wstrToLower(wNamePart);
1219
1220 uint32 counter = 0; // Counter for figure out that we found smth.
1221 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
1222
1223 // Search in CharTitles.dbc
1224 for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
1225 {
1226 if (CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id))
1227 {
1228 for (uint8 gender = GENDER_MALE; gender <= GENDER_FEMALE; ++gender)
1229 {
1230 if (target && target->GetGender() != gender)
1231 continue;
1232
1233 LocaleConstant locale = handler->GetSessionDbcLocale();
1234 std::string_view name = (gender == GENDER_MALE ? titleInfo->Name : titleInfo->Name1)[locale];
1235
1236 if (name.empty())
1237 continue;
1238
1239 if (!Utf8FitTo(name, wNamePart))
1240 {
1241 locale = LOCALE_enUS;
1242 for (; locale < TOTAL_LOCALES; locale = LocaleConstant(locale + 1))
1243 {
1244 if (locale == handler->GetSessionDbcLocale())
1245 continue;
1246
1247 name = (gender == GENDER_MALE ? titleInfo->Name : titleInfo->Name1)[locale];
1248 if (name.empty())
1249 continue;
1250
1251 if (Utf8FitTo(name, wNamePart))
1252 break;
1253 }
1254 }
1255
1256 if (locale < TOTAL_LOCALES)
1257 {
1258 if (maxResults && counter == maxResults)
1259 {
1261 return true;
1262 }
1263
1264 char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetTrinityString(LANG_KNOWN) : "";
1265
1266 char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->MaskID
1267 ? handler->GetTrinityString(LANG_ACTIVE)
1268 : "";
1269
1270 std::string titleNameStr = ChatHandler::PGetParseString(name, targetName);
1271
1272 // send title in "id (idx:idx) - [namedlink locale]" format
1273 if (handler->GetSession())
1274 handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->MaskID, id, titleNameStr, localeNames[locale], knownStr, activeStr);
1275 else
1276 handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->MaskID, titleNameStr, localeNames[locale], knownStr, activeStr);
1277
1278 ++counter;
1279 }
1280 }
1281 }
1282 }
1283 if (counter == 0) // if counter == 0 then we found nth
1285
1286 return true;
1287 }
1288
1289 static bool HandleLookupMapCommand(ChatHandler* handler, char const* args)
1290 {
1291 if (!*args)
1292 return false;
1293
1294 std::string namePart = args;
1295 std::wstring wNamePart;
1296
1297 if (!Utf8toWStr(namePart, wNamePart))
1298 return false;
1299
1300 wstrToLower(wNamePart);
1301
1302 uint32 counter = 0;
1303 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
1304 uint8 locale = handler->GetSession() ? handler->GetSession()->GetSessionDbcLocale() : sWorld->GetDefaultDbcLocale();
1305
1306 // search in Map.dbc
1307 for (uint32 id = 0; id < sMapStore.GetNumRows(); id++)
1308 {
1309 if (MapEntry const* mapInfo = sMapStore.LookupEntry(id))
1310 {
1311 std::string name = mapInfo->MapName[locale];
1312 if (name.empty())
1313 continue;
1314
1315 if (Utf8FitTo(name, wNamePart) && locale < TOTAL_LOCALES)
1316 {
1317 if (maxResults && counter == maxResults)
1318 {
1320 return true;
1321 }
1322
1323 std::ostringstream ss;
1324 ss << id << " - [" << name << ']';
1325
1326 if (mapInfo->IsContinent())
1327 ss << handler->GetTrinityString(LANG_CONTINENT);
1328
1329 switch (mapInfo->InstanceType)
1330 {
1331 case MAP_INSTANCE:
1332 ss << handler->GetTrinityString(LANG_INSTANCE);
1333 break;
1334 case MAP_RAID:
1335 ss << handler->GetTrinityString(LANG_RAID);
1336 break;
1337 case MAP_BATTLEGROUND:
1338 ss << handler->GetTrinityString(LANG_BATTLEGROUND);
1339 break;
1340 case MAP_ARENA:
1341 ss << handler->GetTrinityString(LANG_ARENA);
1342 break;
1343 }
1344
1345 handler->SendSysMessage(ss.str().c_str());
1346
1347 ++counter;
1348 }
1349 }
1350 }
1351
1352 if (!counter)
1354
1355 return true;
1356 }
1357
1358 static bool HandleLookupMapIdCommand(ChatHandler* handler, char const* args)
1359 {
1360 if (!*args)
1361 return false;
1362
1363 uint32 id = atoi((char*)args);
1364
1365 if (MapEntry const* mapInfo = sMapStore.LookupEntry(id))
1366 {
1367 uint8 locale = handler->GetSession() ? handler->GetSession()->GetSessionDbcLocale() : sWorld->GetDefaultDbcLocale();
1368 std::string name = mapInfo->MapName[locale];
1369 if (name.empty())
1370 {
1372 return true;
1373 }
1374
1375 std::ostringstream ss;
1376 ss << id << " - [" << name << ']';
1377
1378 if (mapInfo->IsContinent())
1379 ss << handler->GetTrinityString(LANG_CONTINENT);
1380
1381 switch (mapInfo->InstanceType)
1382 {
1383 case MAP_INSTANCE:
1384 ss << handler->GetTrinityString(LANG_INSTANCE);
1385 break;
1386 case MAP_RAID:
1387 ss << handler->GetTrinityString(LANG_RAID);
1388 break;
1389 case MAP_BATTLEGROUND:
1390 ss << handler->GetTrinityString(LANG_BATTLEGROUND);
1391 break;
1392 case MAP_ARENA:
1393 ss << handler->GetTrinityString(LANG_ARENA);
1394 break;
1395 }
1396
1397 handler->SendSysMessage(ss.str().c_str());
1398 }
1399 else
1401
1402 return true;
1403 }
1404
1405 static bool HandleLookupPlayerIpCommand(ChatHandler* handler, char const* args)
1406 {
1407 std::string ip;
1408 int32 limit;
1409 char* limitStr;
1410
1411 Player* target = handler->getSelectedPlayer();
1412 if (!*args)
1413 {
1414 // NULL only if used from console
1415 if (!target || target == handler->GetSession()->GetPlayer())
1416 return false;
1417
1418 ip = target->GetSession()->GetRemoteAddress();
1419 limit = -1;
1420 }
1421 else
1422 {
1423 ip = strtok((char*)args, " ");
1424 limitStr = strtok(nullptr, " ");
1425 limit = limitStr ? atoi(limitStr) : -1;
1426 }
1427
1429 stmt->setString(0, ip);
1430 PreparedQueryResult result = LoginDatabase.Query(stmt);
1431
1432 return LookupPlayerSearchCommand(result, limit, handler);
1433 }
1434
1435 static bool HandleLookupPlayerAccountCommand(ChatHandler* handler, char const* args)
1436 {
1437 if (!*args)
1438 return false;
1439
1440 std::string account = strtok((char*)args, " ");
1441 char* limitStr = strtok(nullptr, " ");
1442 int32 limit = limitStr ? atoi(limitStr) : -1;
1443
1445 (account))
1446 return false;
1447
1449 stmt->setString(0, account);
1450 PreparedQueryResult result = LoginDatabase.Query(stmt);
1451
1452 return LookupPlayerSearchCommand(result, limit, handler);
1453 }
1454
1455 static bool HandleLookupPlayerEmailCommand(ChatHandler* handler, char const* args)
1456 {
1457 if (!*args)
1458 return false;
1459
1460 std::string email = strtok((char*)args, " ");
1461 char* limitStr = strtok(nullptr, " ");
1462 int32 limit = limitStr ? atoi(limitStr) : -1;
1463
1465 stmt->setString(0, email);
1466 PreparedQueryResult result = LoginDatabase.Query(stmt);
1467
1468 return LookupPlayerSearchCommand(result, limit, handler);
1469 }
1470
1472 {
1473 if (!result)
1474 {
1476 handler->SetSentErrorMessage(true);
1477 return false;
1478 }
1479
1480 int32 counter = 0;
1481 uint32 count = 0;
1482 uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
1483
1484 do
1485 {
1486 if (maxResults && count++ == maxResults)
1487 {
1489 return true;
1490 }
1491
1492 Field* fields = result->Fetch();
1493 uint32 accountId = fields[0].GetUInt32();
1494 std::string accountName = fields[1].GetString();
1495
1497 stmt->setUInt32(0, accountId);
1498 PreparedQueryResult result2 = CharacterDatabase.Query(stmt);
1499
1500 if (result2)
1501 {
1502 handler->PSendSysMessage(LANG_LOOKUP_PLAYER_ACCOUNT, accountName.c_str(), accountId);
1503
1504 do
1505 {
1506 Field* characterFields = result2->Fetch();
1507 ObjectGuid::LowType guid = characterFields[0].GetUInt32();
1508 std::string name = characterFields[1].GetString();
1509 uint8 online = characterFields[2].GetUInt8();
1510
1511 handler->PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid, online ? handler->GetTrinityString(LANG_ONLINE) : "");
1512 ++counter;
1513 }
1514 while (result2->NextRow() && (limit == -1 || counter < limit));
1515 }
1516 }
1517 while (result->NextRow());
1518
1519 if (counter == 0) // empty accounts only
1520 {
1522 handler->SetSentErrorMessage(true);
1523 return false;
1524 }
1525
1526 return true;
1527 }
1528};
1529
@ CHAR_SEL_CHAR_GUID_NAME_BY_ACC
char const * localeNames[TOTAL_LOCALES]
Definition Common.cpp:20
LocaleConstant
Definition Common.h:48
@ TOTAL_LOCALES
Definition Common.h:59
@ LOCALE_enUS
Definition Common.h:49
@ MAP_BATTLEGROUND
Definition DBCEnums.h:336
@ MAP_ARENA
Definition DBCEnums.h:337
@ MAP_INSTANCE
Definition DBCEnums.h:334
@ MAP_RAID
Definition DBCEnums.h:335
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:550
std::unordered_map< uint32, GameObjectTemplate > GameObjectTemplateContainer
Definition ObjectMgr.h:538
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:529
@ QUEST_STATUS_REWARDED
Definition QuestDef.h:109
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:106
@ QUEST_STATUS_COMPLETE
Definition QuestDef.h:104
@ EFFECT_0
@ SPELL_EFFECT_LEARN_SPELL
@ GENDER_MALE
@ GENDER_FEMALE
@ SPELL_ATTR0_CU_IS_TALENT
Definition SpellInfo.h:164
#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:238
static std::string PGetParseString(std::string_view fmt, Args &&... args)
Definition Chat.h:73
virtual LocaleConstant GetSessionDbLocaleIndex() const
Definition Chat.cpp:589
Player * getSelectedPlayer()
Definition Chat.cpp:194
WorldSession * GetSession()
Definition Chat.h:46
virtual LocaleConstant GetSessionDbcLocale() const
Definition Chat.cpp:584
void SetSentErrorMessage(bool val)
Definition Chat.h:126
void PSendSysMessage(char const *fmt, Args &&... args)
Definition Chat.h:61
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:102
virtual char const * GetTrinityString(uint32 entry) const
Definition Chat.cpp:37
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:941
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:241
bool HasTitle(uint32 bitIndex) const
Definition Player.cpp:24276
uint16 GetPureSkillValue(uint32 skill) const
Definition Player.cpp:5962
int16 GetSkillTempBonusValue(uint32 skill) const
Definition Player.cpp:5986
int16 GetSkillPermBonusValue(uint32 skill) const
Definition Player.cpp:5974
WorldSession * GetSession() const
Definition Player.h:1705
bool HasSkill(uint32 skill) const
Definition Player.cpp:5885
uint16 GetPureMaxSkillValue(uint32 skill) const
Definition Player.cpp:5936
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition Player.cpp:15655
bool HasSpell(uint32 spell) const override
Definition Player.cpp:3881
ReputationMgr & GetReputationMgr()
Definition Player.h:1834
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
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:375
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:4558
Gender GetGender() const
Definition Unit.h:912
std::string const & GetName() const
Definition Object.h:384
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:901
@ CONFIG_MAX_RESULTS_LOOKUP_COMMANDS
Definition World.h:351
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]
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]