Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
Chat.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "Common.h"
7#include "DatabaseEnv.h"
8#include "ObjectMgr.h"
9#include "World.h"
10#include "WorldPacket.h"
11#include "WorldSession.h"
12
13#include "AccountMgr.h"
14#include "CellImpl.h"
15#include "Chat.h"
16#include "ChatLink.h"
17#include "GridNotifiersImpl.h"
18#include "Group.h"
19#include "Language.h"
20#include "Log.h"
21#include "Opcodes.h"
22#include "Player.h"
23#include "ScriptMgr.h"
24#include "SpellMgr.h"
25#include "UpdateMask.h"
26
28
29std::vector<ChatCommand> const& ChatHandler::getCommandTable()
30{
31 static std::vector<ChatCommand> commandTableCache;
32
33 if (LoadCommandTable())
34 {
36
37 std::vector<ChatCommand> cmds = sScriptMgr->GetChatCommands();
38 commandTableCache.swap(cmds);
39
40 PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_COMMANDS);
41 PreparedQueryResult result = WorldDatabase.Query(stmt);
42 if (result)
43 {
44 do
45 {
46 Field* fields = result->Fetch();
47 std::string name = fields[0].GetString();
48
49 SetDataForCommandInTable(commandTableCache, name.c_str(), fields[1].GetUInt16(), fields[2].GetString(), name);
50 } while (result->NextRow());
51 }
52 }
53
54 return commandTableCache;
55}
56
57std::string ChatHandler::PGetParseString(int32 entry, ...) const
58{
59 const char* format = GetSkyFireString(entry);
60 char str[1024];
61 va_list ap;
62 va_start(ap, entry);
63 vsnprintf(str, 1024, format, ap);
64 va_end(ap);
65 return std::string(str);
66}
67
68const char* ChatHandler::GetSkyFireString(int32 entry) const
69{
70 return m_session->GetSkyFireString(entry);
71}
72
74{
75 return HasPermission(cmd.Permission);
76}
77
78bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong)
79{
80 WorldSession* target_session = NULL;
81 uint32 target_account = 0;
82
83 if (target)
84 target_session = target->GetSession();
85 else if (guid)
86 target_account = sObjectMgr->GetPlayerAccountIdByGUID(guid);
87
88 if (!target_session && !target_account)
89 {
92 return true;
93 }
94
95 return HasLowerSecurityAccount(target_session, target_account, strong);
96}
97
98bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_account, bool strong)
99{
100 AccountTypes target_sec;
101
102 // allow everything from console and RA console
103 if (!m_session)
104 return false;
105
106 // ignore only for non-players for non strong checks (when allow apply command at least to same sec level)
108 return false;
109
110 if (target)
111 target_sec = target->GetSecurity();
112 else if (target_account)
113 target_sec = AccountMgr::GetSecurity(target_account, target->GetVirtualRealmID());
114 else
115 return true; // caller must report error for (target == NULL && target_account == 0)
116
117 AccountTypes target_ac_sec = target_sec;
118 if (m_session->GetSecurity() < target_ac_sec || (strong && m_session->GetSecurity() <= target_ac_sec))
119 {
122 return true;
123 }
124
125 return false;
126}
127
128bool ChatHandler::hasStringAbbr(const char* name, const char* part)
129{
130 // non "" command
131 if (*name)
132 {
133 // "" part from non-"" command
134 if (!*part)
135 return false;
136
137 while (true)
138 {
139 if (!*part)
140 return true;
141 else if (!*name)
142 return false;
143 else if (tolower(*name) != tolower(*part))
144 return false;
145 ++name; ++part;
146 }
147 }
148 // allow with any for ""
149
150 return true;
151}
152
153void ChatHandler::SendSysMessage(const char* str)
154{
155 WorldPacket data;
156
157 // need copy to prevent corruption by strtok call in LineFromMessage original string
158 char* buf = strdup(str);
159 char* pos = buf;
160
161 while (char* line = LineFromMessage(pos))
162 {
164 m_session->SendPacket(&data);
165 }
166
167 free(buf);
168}
169
171{
172 // Chat output
173 WorldPacket data;
174
175 // need copy to prevent corruption by strtok call in LineFromMessage original string
176 char* buf = strdup(str);
177 char* pos = buf;
178
179 while (char* line = LineFromMessage(pos))
180 {
182 sWorld->SendGlobalMessage(&data);
183 }
184
185 free(buf);
186}
187
189{
190 // Chat output
191 WorldPacket data;
192
193 // need copy to prevent corruption by strtok call in LineFromMessage original string
194 char* buf = strdup(str);
195 char* pos = buf;
196
197 while (char* line = LineFromMessage(pos))
198 {
200 sWorld->SendGlobalGMMessage(&data);
201 }
202 free(buf);
203}
204
209
211{
212 const char* format = GetSkyFireString(entry);
213 va_list ap;
214 char str[2048];
215 va_start(ap, entry);
216 vsnprintf(str, 2048, format, ap);
217 va_end(ap);
218 SendSysMessage(str);
219}
220
221void ChatHandler::PSendSysMessage(const char* format, ...)
222{
223 va_list ap;
224 char str[2048];
225 va_start(ap, format);
226 vsnprintf(str, 2048, format, ap);
227 va_end(ap);
228 SendSysMessage(str);
229}
230
231bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, const char* text, std::string const& fullcmd)
232{
233 char const* oldtext = text;
234 std::string cmd = "";
235
236 while (*text != ' ' && *text != '\0')
237 {
238 cmd += *text;
239 ++text;
240 }
241
242 while (*text == ' ') ++text;
243
244 for (uint32 i = 0; i < table.size(); ++i)
245 {
246 if (!hasStringAbbr(table[i].Name, cmd.c_str()))
247 continue;
248
249 bool match = false;
250 if (strlen(table[i].Name) > cmd.length())
251 {
252 for (uint32 j = 0; j < table.size(); ++j)
253 {
254 if (!hasStringAbbr(table[j].Name, cmd.c_str()))
255 continue;
256
257 if (strcmp(table[j].Name, cmd.c_str()) == 0)
258 {
259 match = true;
260 break;
261 }
262 }
263 }
264 if (match)
265 continue;
266
267 // select subcommand from child commands list
268 if (!table[i].ChildCommands.empty())
269 {
270 if (!ExecuteCommandInTable(table[i].ChildCommands, text, fullcmd))
271 {
272 if (text[0] != '\0')
274 else
276
277 ShowHelpForCommand(table[i].ChildCommands, text);
278 }
279
280 return true;
281 }
282
283 // must be available and have handler
284 if (!table[i].Handler || !isAvailable(table[i]))
285 continue;
286
287 SetSentErrorMessage(false);
288 // table[i].Name == "" is special case: send original command to handler
289 if ((table[i].Handler)(this, table[i].Name[0] != '\0' ? text : oldtext))
290 {
291 if (!m_session) // ignore console
292 return true;
293
294 Player* player = m_session->GetPlayer();
295 if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity()))
296 {
297 uint64 guid = player->GetTarget();
298 uint32 areaId = player->GetAreaId();
299 std::string areaName = "Unknown";
300 std::string zoneName = "Unknown";
301 if (AreaTableEntry const* area = GetAreaEntryByAreaID(areaId))
302 {
303 areaName = area->m_AreaName;
304 if (AreaTableEntry const* zone = GetAreaEntryByAreaID(area->m_ParentAreaID))
305 zoneName = zone->m_AreaName;
306 }
307
308 sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (Guid: %u) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected %s: %s (GUID: %u)]",
309 fullcmd.c_str(), player->GetName().c_str(), GUID_LOPART(player->GetGUID()),
310 m_session->GetAccountId(), player->GetPositionX(), player->GetPositionY(),
311 player->GetPositionZ(), player->GetMapId(),
312 player->GetMap() ? player->GetMap()->GetMapName() : "Unknown",
313 areaId, areaName.c_str(), zoneName.c_str(), GetLogNameForGuid(guid),
314 (player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "",
315 GUID_LOPART(guid));
316 }
317 }
318 // some commands have custom error messages. Don't send the default one in these cases.
319 else if (!HasSentErrorMessage())
320 {
321 if (!table[i].Help.empty())
322 SendSysMessage(table[i].Help.c_str());
323 else
325 }
326
327 return true;
328 }
329
330 return false;
331}
332
333bool ChatHandler::SetDataForCommandInTable(std::vector<ChatCommand>& table, char const* text, uint32 permission, std::string const& help, std::string const& fullcommand)
334{
335 std::string cmd = "";
336
337 while (*text != ' ' && *text != '\0')
338 {
339 cmd += *text;
340 ++text;
341 }
342
343 while (*text == ' ') ++text;
344
345 for (uint32 i = 0; i < table.size(); i++)
346 {
347 // for data fill use full explicit command names
348 if (table[i].Name != cmd)
349 continue;
350
351 // select subcommand from child commands list (including "")
352 if (!table[i].ChildCommands.empty())
353 {
354 if (SetDataForCommandInTable(table[i].ChildCommands, text, permission, help, fullcommand))
355 return true;
356 else if (*text)
357 return false;
358
359 // fail with "" subcommands, then use normal level up command instead
360 }
361 // expected subcommand by full name DB content
362 else if (*text)
363 {
364 SF_LOG_ERROR("sql.sql", "Table `command` have unexpected subcommand '%s' in command '%s', skip.", text, fullcommand.c_str());
365 return false;
366 }
367
368 if (table[i].Permission != permission)
369 SF_LOG_INFO("misc", "Table `command` overwrite for command '%s' default permission (%u) by %u", fullcommand.c_str(), table[i].Permission, permission);
370
371 table[i].Permission = permission;
372 table[i].Help = help;
373 return true;
374 }
375
376 // in case "" command let process by caller
377 if (!cmd.empty())
378 {
379 if (&table == &getCommandTable())
380 SF_LOG_ERROR("sql.sql", "Table `command` have not existed command '%s', skip.", cmd.c_str());
381 else
382 SF_LOG_ERROR("sql.sql", "Table `command` have not existed subcommand '%s' in command '%s', skip.", cmd.c_str(), fullcommand.c_str());
383 }
384
385 return false;
386}
387
388bool ChatHandler::ParseCommands(char const* text)
389{
390 ASSERT(text);
391 ASSERT(*text);
392
393 std::string fullcmd = text;
394
396 if (m_session)
397 {
398 if (text[0] != '!' && text[0] != '.')
399 return false;
400 }
401
403 if (strlen(text) < 2)
404 return false;
405 // original `text` can't be used. It content destroyed in command code processing.
406
408 if ((text[0] == '.' && text[1] == '.') || (text[0] == '!' && text[1] == '!'))
409 return false;
410
412 if (text[0] == '!' || text[0] == '.')
413 ++text;
414
415 if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd))
416 {
418 return false;
419
421 }
422 return true;
423}
424
425bool ChatHandler::isValidChatMessage(char const* message)
426{
427 /*
428 Valid examples:
429 |cffa335ee|Hitem:812:0:0:0:0:0:0:0:70|h[Glowing Brightwood Staff]|h|r
430 |cff808080|Hquest:2278:47|h[The Platinum Discs]|h|r
431 |cffffd000|Htrade:4037:1:150:1:6AAAAAAAAAAAAAAAAAAAAAAOAADAAAAAAAAAAAAAAAAIAAAAAAAAA|h[Engineering]|h|r
432 |cff4e96f7|Htalent:2232:-1|h[Taste for Blood]|h|r
433 |cff71d5ff|Hspell:21563|h[Command]|h|r
434 |cffffd000|Henchant:3919|h[Engineering: Rough Dynamite]|h|r
435 |cffffff00|Hachievement:546:0000000000000001:0:0:0:-1:0:0:0:0|h[Safe Deposit]|h|r
436 |cff66bbff|Hglyph:21:762|h[Glyph of Bladestorm]|h|r
437
438 | will be escaped to ||
439 */
440
441 if (strlen(message) > 255)
442 return false;
443
444 // more simple checks
446 {
447 const char validSequence[6] = "cHhhr";
448 const char* validSequenceIterator = validSequence;
449 const std::string validCommands = "cHhr|";
450
451 while (*message)
452 {
453 // find next pipe command
454 message = strchr(message, '|');
455
456 if (!message)
457 return true;
458
459 ++message;
460 char commandChar = *message;
461 if (validCommands.find(commandChar) == std::string::npos)
462 return false;
463
464 ++message;
465 // validate sequence
467 {
468 if (commandChar == *validSequenceIterator)
469 {
470 if (validSequenceIterator == validSequence + 4)
471 validSequenceIterator = validSequence;
472 else
473 ++validSequenceIterator;
474 }
475 else
476 return false;
477 }
478 }
479 return true;
480 }
481
482 return LinkExtractor(message).IsValidMessage();
483}
484
485bool ChatHandler::ShowHelpForSubCommands(std::vector<ChatCommand> const& table, char const* cmd, char const* subcmd)
486{
487 std::string list;
488 for (uint32 i = 0; i < table.size(); ++i)
489 {
490 // must be available (ignore handler existence for show command with possible available subcommands)
491 if (!isAvailable(table[i]))
492 continue;
493
494 // for empty subcmd show all available
495 if (*subcmd && !hasStringAbbr(table[i].Name, subcmd))
496 continue;
497
498 if (m_session)
499 list += "\n ";
500 else
501 list += "\n\r ";
502
503 list += table[i].Name;
504
505 if (!table[i].ChildCommands.empty())
506 list += " ...";
507 }
508
509 if (list.empty())
510 return false;
511
512 if (&table == &getCommandTable())
513 {
515 PSendSysMessage("%s", list.c_str());
516 }
517 else
518 PSendSysMessage(LANG_SUBCMDS_LIST, cmd, list.c_str());
519
520 return true;
521}
522
523bool ChatHandler::ShowHelpForCommand(std::vector<ChatCommand> const& table, const char* cmd)
524{
525 if (*cmd)
526 {
527 for (uint32 i = 0; i < table.size(); ++i)
528 {
529 // must be available (ignore handler existence for show command with possible available subcommands)
530 if (!isAvailable(table[i]))
531 continue;
532
533 if (!hasStringAbbr(table[i].Name, cmd))
534 continue;
535
536 // have subcommand
537 char const* subcmd = (*cmd) ? strtok(NULL, " ") : "";
538
539 if (!table[i].ChildCommands.empty() && subcmd && *subcmd)
540 {
541 if (ShowHelpForCommand(table[i].ChildCommands, subcmd))
542 return true;
543 }
544
545 if (!table[i].Help.empty())
546 SendSysMessage(table[i].Help.c_str());
547
548 if (!table[i].ChildCommands.empty())
549 if (ShowHelpForSubCommands(table[i].ChildCommands, table[i].Name, subcmd ? subcmd : ""))
550 return true;
551
552 return !table[i].Help.empty();
553 }
554 }
555 else
556 {
557 for (uint32 i = 0; i < table.size(); ++i)
558 {
559 // must be available (ignore handler existence for show command with possible available subcommands)
560 if (!isAvailable(table[i]))
561 continue;
562
563 if (strlen(table[i].Name))
564 continue;
565
566 if (!table[i].Help.empty())
567 SendSysMessage(table[i].Help.c_str());
568
569 if (!table[i].ChildCommands.empty())
570 if (ShowHelpForSubCommands(table[i].ChildCommands, "", ""))
571 return true;
572
573 return !table[i].Help.empty();
574 }
575 }
576
577 return ShowHelpForSubCommands(table, "", cmd);
578}
579
580size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string const& message, uint8 chatTag,
581 std::string const& senderName /*= ""*/, std::string const& receiverName /*= ""*/,
582 uint32 achievementId /*= 0*/, bool gmMessage /*= false*/, std::string const& channelName /*= ""*/,
583 std::string const& addonPrefix /*= ""*/)
584{
585 bool hasAchievementId = (chatType == ChatMsg::CHAT_MSG_ACHIEVEMENT || chatType == ChatMsg::CHAT_MSG_GUILD_ACHIEVEMENT) && achievementId;
586 bool hasLanguage = (language > Language::LANG_UNIVERSAL);
587 bool hasSenderName = false;
588 bool hasReceiverName = false;
589 bool hasChannelName = false;
590 bool hasGroupGUID = false;
591 bool hasGuildGUID = false;
592 bool hasPrefix = false;
593
594 switch (chatType)
595 {
603 hasGroupGUID = true;
604 break;
608 hasGuildGUID = true;
609 break;
612 if (receiverGUID && !IS_PLAYER_GUID(receiverGUID) && !IS_PET_GUID(receiverGUID))
613 hasReceiverName = receiverName.length();
614 break;
621 hasSenderName = senderName.length();
622 break;
624 hasSenderName = senderName.length();
625 break;
629 if (receiverGUID && !IS_PLAYER_GUID(receiverGUID))
630 hasReceiverName = receiverName.length();
631 break;
632
634 hasChannelName = channelName.length();
635 hasSenderName = senderName.length();
636 break;
637 default:
638 if (gmMessage)
639 hasSenderName = senderName.length();
640 break;
641 }
642
643 if (language == Language::LANG_ADDON)
644 hasPrefix = addonPrefix.length();
645
646 Player* sender = sObjectAccessor->FindPlayer(senderGUID);
647
648 ObjectGuid guildGUID = hasGuildGUID && sender && sender->GetGuildId() ? MAKE_NEW_GUID(sender->GetGuildId(), 0, HIGHGUID_GUILD) : 0;
649 ObjectGuid groupGUID = hasGroupGUID && sender && sender->GetGroup() ? sender->GetGroup()->GetGUID() : 0;
650
651
653 data.WriteBit(!hasSenderName);
654 data.WriteBit(0); // HideInChatLog - only bubble shows
655
656 if (hasSenderName)
657 data.WriteBits(senderName.length(), 11);
658
659 data.WriteBit(0); // Fake Bit
660 data.WriteBit(!hasChannelName);
661 data.WriteBit(0); // Unk
662 data.WriteBit(1); // SendFakeTime - float later
663 data.WriteBit(!chatTag); // ChatFlags
664 data.WriteBit(1); // RealmID ?
665
666 data.WriteBit(groupGUID[0]);
667 data.WriteBit(groupGUID[1]);
668 data.WriteBit(groupGUID[5]);
669 data.WriteBit(groupGUID[4]);
670 data.WriteBit(groupGUID[3]);
671 data.WriteBit(groupGUID[2]);
672 data.WriteBit(groupGUID[6]);
673 data.WriteBit(groupGUID[7]);
674
675 if (chatTag)
676 data.WriteBits(chatTag, 9);
677
678 data.WriteBit(0); // Fake Bit
679
680 data.WriteBit(receiverGUID[7]);
681 data.WriteBit(receiverGUID[6]);
682 data.WriteBit(receiverGUID[1]);
683 data.WriteBit(receiverGUID[4]);
684 data.WriteBit(receiverGUID[0]);
685 data.WriteBit(receiverGUID[2]);
686 data.WriteBit(receiverGUID[3]);
687 data.WriteBit(receiverGUID[5]);
688
689 data.WriteBit(0); // Fake Bit
690 data.WriteBit(!hasLanguage);
691 data.WriteBit(!hasPrefix);
692
693 data.WriteBit(senderGUID[0]);
694 data.WriteBit(senderGUID[3]);
695 data.WriteBit(senderGUID[7]);
696 data.WriteBit(senderGUID[2]);
697 data.WriteBit(senderGUID[1]);
698 data.WriteBit(senderGUID[5]);
699 data.WriteBit(senderGUID[4]);
700 data.WriteBit(senderGUID[6]);
701
702 data.WriteBit(!hasAchievementId);
703 data.WriteBit(!message.length());
704
705 if (hasChannelName)
706 data.WriteBits(channelName.length(), 7);
707
708 if (message.length())
709 data.WriteBits(message.length(), 12);
710
711 data.WriteBit(!hasReceiverName);
712
713 if (hasPrefix)
714 data.WriteBits(addonPrefix.length(), 5);
715
716 data.WriteBit(1); // RealmID ?
717
718 if (hasReceiverName)
719 data.WriteBits(receiverName.length(), 11);
720
721 data.WriteBit(0); // Fake Bit
722
723 data.WriteBit(guildGUID[2]);
724 data.WriteBit(guildGUID[5]);
725 data.WriteBit(guildGUID[7]);
726 data.WriteBit(guildGUID[4]);
727 data.WriteBit(guildGUID[0]);
728 data.WriteBit(guildGUID[1]);
729 data.WriteBit(guildGUID[3]);
730 data.WriteBit(guildGUID[6]);
731
732 data.FlushBits();
733
734 data.WriteByteSeq(guildGUID[4]);
735 data.WriteByteSeq(guildGUID[5]);
736 data.WriteByteSeq(guildGUID[7]);
737 data.WriteByteSeq(guildGUID[3]);
738 data.WriteByteSeq(guildGUID[2]);
739 data.WriteByteSeq(guildGUID[6]);
740 data.WriteByteSeq(guildGUID[0]);
741 data.WriteByteSeq(guildGUID[1]);
742
743 if (hasChannelName)
744 data.WriteString(channelName);
745
746 if (hasPrefix)
747 data.WriteString(addonPrefix);
748
749 // if (hasFakeTime)
750 // data << float(fakeTime);
751
752 data.WriteByteSeq(senderGUID[4]);
753 data.WriteByteSeq(senderGUID[7]);
754 data.WriteByteSeq(senderGUID[1]);
755 data.WriteByteSeq(senderGUID[5]);
756 data.WriteByteSeq(senderGUID[0]);
757 data.WriteByteSeq(senderGUID[6]);
758 data.WriteByteSeq(senderGUID[2]);
759 data.WriteByteSeq(senderGUID[3]);
760
761 data << uint8(chatType);
762
763 if (hasAchievementId)
764 data << uint32(achievementId);
765
766 data.WriteByteSeq(groupGUID[1]);
767 data.WriteByteSeq(groupGUID[3]);
768 data.WriteByteSeq(groupGUID[4]);
769 data.WriteByteSeq(groupGUID[6]);
770 data.WriteByteSeq(groupGUID[0]);
771 data.WriteByteSeq(groupGUID[2]);
772 data.WriteByteSeq(groupGUID[5]);
773 data.WriteByteSeq(groupGUID[7]);
774
775 data.WriteByteSeq(receiverGUID[2]);
776 data.WriteByteSeq(receiverGUID[5]);
777 data.WriteByteSeq(receiverGUID[3]);
778 data.WriteByteSeq(receiverGUID[6]);
779 data.WriteByteSeq(receiverGUID[7]);
780 data.WriteByteSeq(receiverGUID[4]);
781 data.WriteByteSeq(receiverGUID[1]);
782 data.WriteByteSeq(receiverGUID[0]);
783
784 if (hasLanguage)
785 data << uint8(language);
786
787 if (message.length())
788 data.WriteString(message);
789
790 if (hasReceiverName)
791 data.WriteString(receiverName);
792
793 if (hasSenderName)
794 data.WriteString(senderName);
795
796 return data.wpos();
797}
798
799size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string const& message,
800 uint32 achievementId /*= 0*/, std::string const& channelName /*= ""*/, LocaleConstant locale /*= DEFAULT_LOCALE*/, std::string const& addonPrefix /*= ""*/)
801{
802 uint64 senderGUID = 0;
803 std::string senderName = "";
804 uint8 chatTag = 0;
805 bool gmMessage = false;
806 uint64 receiverGUID = 0;
807 std::string receiverName = "";
808 if (sender)
809 {
810 senderGUID = sender->GetGUID();
811 senderName = sender->GetNameForLocaleIdx(locale);
812 if (Player const* playerSender = sender->ToPlayer())
813 {
814 chatTag = playerSender->GetChatTag();
815 gmMessage = playerSender->GetSession()->HasPermission(rbac::RBAC_PERM_COMMAND_GM_CHAT);
816 }
817 }
818
819 if (receiver)
820 {
821 receiverGUID = receiver->GetGUID();
822 receiverName = receiver->GetNameForLocaleIdx(locale);
823 }
824
825 return BuildChatPacket(data, chatType, language, senderGUID, receiverGUID, message, chatTag, senderName, receiverName, achievementId, gmMessage, channelName, addonPrefix);
826}
827
828
830{
831 if (!m_session)
832 return NULL;
833
834 uint64 selected = m_session->GetPlayer()->GetTarget();
835 if (!selected)
836 return m_session->GetPlayer();
837
838 return ObjectAccessor::FindPlayer(selected);
839}
840
842{
843 if (!m_session)
844 return NULL;
845
846 if (Unit* selected = m_session->GetPlayer()->GetSelectedUnit())
847 return selected;
848
849 return m_session->GetPlayer();
850}
851
853{
854 if (!m_session)
855 return NULL;
856
857 uint64 guid = m_session->GetPlayer()->GetTarget();
858
859 if (guid == 0)
860 return GetNearbyGameObject();
861
862 return ObjectAccessor::GetUnit(*m_session->GetPlayer(), guid);
863}
864
866{
867 if (!m_session)
868 return NULL;
869
870 return ObjectAccessor::GetCreatureOrPetOrVehicle(*m_session->GetPlayer(), m_session->GetPlayer()->GetTarget());
871}
872
873char* ChatHandler::extractKeyFromLink(char* text, char const* linkType, char** something1)
874{
875 // skip empty
876 if (!text)
877 return NULL;
878
879 // skip spaces
880 while (*text == ' ' || *text == '\t' || *text == '\b')
881 ++text;
882
883 if (!*text)
884 return NULL;
885
886 // return non link case
887 if (text[0] != '|')
888 return strtok(text, " ");
889
890 // [name] Shift-click form |color|linkType:key|h[name]|h|r
891 // or
892 // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r
893
894 char* check = strtok(text, "|"); // skip color
895 if (!check)
896 return NULL; // end of data
897
898 char* cLinkType = strtok(NULL, ":"); // linktype
899 if (!cLinkType)
900 return NULL; // end of data
901
902 if (strcmp(cLinkType, linkType) != 0)
903 {
904 strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL, s) use after retturn from function
906 return NULL;
907 }
908
909 char* cKeys = strtok(NULL, "|"); // extract keys and values
910 char* cKeysTail = strtok(NULL, "");
911
912 char* cKey = strtok(cKeys, ":|"); // extract key
913 if (something1)
914 *something1 = strtok(NULL, ":|"); // extract something
915
916 strtok(cKeysTail, "]"); // restart scan tail and skip name with possible spaces
917 strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL, s) use after return from function
918 return cKey;
919}
920
921char* ChatHandler::extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1)
922{
923 // skip empty
924 if (!text)
925 return NULL;
926
927 // skip spaces
928 while (*text == ' ' || *text == '\t' || *text == '\b')
929 ++text;
930
931 if (!*text)
932 return NULL;
933
934 // return non link case
935 if (text[0] != '|')
936 return strtok(text, " ");
937
938 // [name] Shift-click form |color|linkType:key|h[name]|h|r
939 // or
940 // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r
941 // or
942 // [name] Shift-click form |linkType:key|h[name]|h|r
943
944 char* tail;
945
946 if (text[1] == 'c')
947 {
948 char* check = strtok(text, "|"); // skip color
949 if (!check)
950 return NULL; // end of data
951
952 tail = strtok(NULL, ""); // tail
953 }
954 else
955 tail = text + 1; // skip first |
956
957 char* cLinkType = strtok(tail, ":"); // linktype
958 if (!cLinkType)
959 return NULL; // end of data
960
961 for (int i = 0; linkTypes[i]; ++i)
962 {
963 if (strcmp(cLinkType, linkTypes[i]) == 0)
964 {
965 char* cKeys = strtok(NULL, "|"); // extract keys and values
966 char* cKeysTail = strtok(NULL, "");
967
968 char* cKey = strtok(cKeys, ":|"); // extract key
969 if (something1)
970 *something1 = strtok(NULL, ":|"); // extract something
971
972 strtok(cKeysTail, "]"); // restart scan tail and skip name with possible spaces
973 strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL, s) use after return from function
974 if (found_idx)
975 *found_idx = i;
976 return cKey;
977 }
978 }
979
980 strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL, s) use after return from function
982 return NULL;
983}
984
986{
987 if (!m_session)
988 return NULL;
989
990 Player* pl = m_session->GetPlayer();
991 GameObject* obj = NULL;
995 return obj;
996}
997
999{
1000 if (!m_session)
1001 return NULL;
1002
1003 Player* pl = m_session->GetPlayer();
1004
1005 GameObject* obj = pl->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT));
1006
1007 if (!obj && sObjectMgr->GetGOData(lowguid)) // guid is DB guid of object
1008 {
1009 // search near player then
1011 Cell cell(p);
1012
1013 Skyfire::GameObjectWithDbGUIDCheck go_check(*pl, lowguid);
1015
1017 cell.Visit(p, object_checker, *pl->GetMap(), *pl, pl->GetGridActivationRange());
1018 }
1019
1020 return obj;
1021}
1022
1031
1032static char const* const spellKeys[] =
1033{
1034 "Hspell", // normal spell
1035 "Htalent", // talent spell
1036 "Henchant", // enchanting recipe spell
1037 "Htrade", // profession/skill spell
1038 "Hglyph", // glyph
1039 0
1040};
1041
1043{
1044 // number or [name] Shift-click form |color|Henchant:recipe_spell_id|h[prof_name: recipe_name]|h|r
1045 // number or [name] Shift-click form |color|Hglyph:glyph_slot_id:glyph_prop_id|h[%s]|h|r
1046 // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
1047 // number or [name] Shift-click form |color|Htalent:talent_id, rank|h[name]|h|r
1048 // number or [name] Shift-click form |color|Htrade:spell_id, skill_id, max_value, cur_value|h[name]|h|r
1049 int type = 0;
1050 char* param1_str = NULL;
1051 char* idS = extractKeyFromLink(text, spellKeys, &type, &param1_str);
1052 if (!idS)
1053 return 0;
1054
1055 uint32 id = (uint32)atol(idS);
1056
1057 switch (type)
1058 {
1059 case SPELL_LINK_SPELL:
1060 return id;
1061 case SPELL_LINK_TALENT:
1062 {
1063 // talent
1064 TalentEntry const* talentEntry = sTalentStore.LookupEntry(id);
1065 if (!talentEntry)
1066 return 0;
1067
1068 return talentEntry->SpellId;
1069 }
1070 case SPELL_LINK_ENCHANT:
1071 case SPELL_LINK_TRADE:
1072 return id;
1073 case SPELL_LINK_GLYPH:
1074 {
1075 uint32 glyph_prop_id = param1_str ? (uint32)atol(param1_str) : 0;
1076
1077 GlyphPropertiesEntry const* glyphPropEntry = sGlyphPropertiesStore.LookupEntry(glyph_prop_id);
1078 if (!glyphPropEntry)
1079 return 0;
1080
1081 return glyphPropEntry->SpellId;
1082 }
1083 }
1084
1085 // unknown type?
1086 return 0;
1087}
1088
1090{
1091 // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
1092 char* cId = extractKeyFromLink(text, "Htele");
1093 if (!cId)
1094 return NULL;
1095
1096 // id case (explicit or from shift link)
1097 if (cId[0] >= '0' || cId[0] >= '9')
1098 if (uint32 id = atoi(cId))
1099 return sObjectMgr->GetGameTele(id);
1100
1101 return sObjectMgr->GetGameTele(cId);
1102}
1103
1105{
1106 SPELL_LINK_PLAYER = 0, // must be first for selection in not link case
1109};
1110
1111static char const* const guidKeys[] =
1112{
1113 "Hplayer",
1114 "Hcreature",
1115 "Hgameobject",
1116 0
1117};
1118
1120{
1121 int type = 0;
1122
1123 // |color|Hcreature:creature_guid|h[name]|h|r
1124 // |color|Hgameobject:go_guid|h[name]|h|r
1125 // |color|Hplayer:name|h[name]|h|r
1126 char* idS = extractKeyFromLink(text, guidKeys, &type);
1127 if (!idS)
1128 return 0;
1129
1130 switch (type)
1131 {
1132 case SPELL_LINK_PLAYER:
1133 {
1134 std::string name = idS;
1135 if (!normalizePlayerName(name))
1136 return 0;
1137
1138 if (Player* player = sObjectAccessor->FindPlayerByName(name))
1139 return player->GetGUID();
1140
1141 if (uint64 guid = sObjectMgr->GetPlayerGUIDByName(name))
1142 return guid;
1143
1144 return 0;
1145 }
1147 {
1148 uint32 lowguid = (uint32)atol(idS);
1149
1150 if (CreatureData const* data = sObjectMgr->GetCreatureData(lowguid))
1151 return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT);
1152 else
1153 return 0;
1154 }
1156 {
1157 uint32 lowguid = (uint32)atol(idS);
1158
1159 if (GameObjectData const* data = sObjectMgr->GetGOData(lowguid))
1160 return MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_GAMEOBJECT);
1161 else
1162 return 0;
1163 }
1164 }
1165
1166 // unknown type?
1167 return 0;
1168}
1169
1171{
1172 // |color|Hplayer:name|h[name]|h|r
1173 char* name_str = extractKeyFromLink(text, "Hplayer");
1174 if (!name_str)
1175 return "";
1176
1177 std::string name = name_str;
1178 if (!normalizePlayerName(name))
1179 return "";
1180
1181 return name;
1182}
1183
1184bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* player_guid /*=NULL*/, std::string* player_name /*= NULL*/)
1185{
1186 if (args && *args)
1187 {
1188 std::string name = extractPlayerNameFromLink(args);
1189 if (name.empty())
1190 {
1192 SetSentErrorMessage(true);
1193 return false;
1194 }
1195
1196 Player* pl = sObjectAccessor->FindPlayerByName(name);
1197
1198 // if allowed player pointer
1199 if (player)
1200 *player = pl;
1201
1202 // if need guid value from DB (in name case for check player existence)
1203 uint64 guid = !pl && (player_guid || player_name) ? sObjectMgr->GetPlayerGUIDByName(name) : 0;
1204
1205 // if allowed player guid (if no then only online players allowed)
1206 if (player_guid)
1207 *player_guid = pl ? pl->GetGUID() : guid;
1208
1209 if (player_name)
1210 *player_name = pl || guid ? name : "";
1211 }
1212 else
1213 {
1214 Player* pl = getSelectedPlayer();
1215 // if allowed player pointer
1216 if (player)
1217 *player = pl;
1218 // if allowed player guid (if no then only online players allowed)
1219 if (player_guid)
1220 *player_guid = pl ? pl->GetGUID() : 0;
1221
1222 if (player_name)
1223 *player_name = pl ? pl->GetName() : "";
1224 }
1225
1226 // some from req. data must be provided (note: name is empty if player not exist)
1227 if ((!player || !*player) && (!player_guid || !*player_guid) && (!player_name || player_name->empty()))
1228 {
1230 SetSentErrorMessage(true);
1231 return false;
1232 }
1233
1234 return true;
1235}
1236
1237void ChatHandler::extractOptFirstArg(char* args, char** arg1, char** arg2)
1238{
1239 char* p1 = strtok(args, " ");
1240 char* p2 = strtok(NULL, " ");
1241
1242 if (!p2)
1243 {
1244 p2 = p1;
1245 p1 = NULL;
1246 }
1247
1248 if (arg1)
1249 *arg1 = p1;
1250
1251 if (arg2)
1252 *arg2 = p2;
1253}
1254
1256{
1257 if (!*args)
1258 return NULL;
1259
1260 if (*args == '"')
1261 return strtok(args + 1, "\"");
1262 else
1263 {
1264 char* space = strtok(args, "\"");
1265 if (!space)
1266 return NULL;
1267 return strtok(NULL, "\"");
1268 }
1269}
1270
1272{
1273 Player* pl = m_session->GetPlayer();
1274 return pl != chr && pl->IsVisibleGloballyFor(chr);
1275}
1276
1278{
1279 return m_session->GetSessionDbcLocale();
1280}
1281
1283{
1284 return m_session->GetSessionDbLocaleIndex();
1285}
1286
1287std::string ChatHandler::GetNameLink(Player* chr) const
1288{
1289 return playerLink(chr->GetName());
1290}
1291
1292const char* CliHandler::GetSkyFireString(int32 entry) const
1293{
1294 return sObjectMgr->GetSkyFireStringForDBCLocale(entry);
1295}
1296
1298{
1299 // skip non-console commands in console case
1300 return cmd.AllowConsole;
1301}
1302
1303void CliHandler::SendSysMessage(const char* str)
1304{
1305 m_print(m_callbackArg, str);
1306 m_print(m_callbackArg, "\r\n");
1307}
1308
1309std::string CliHandler::GetNameLink() const
1310{
1312}
1313
1315{
1316 return true;
1317}
1318
1319bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, uint64& guid, bool offline)
1320{
1321 player = NULL;
1322 guid = 0;
1323
1324 if (cname)
1325 {
1326 std::string name = cname;
1327 if (!name.empty())
1328 {
1329 if (!normalizePlayerName(name))
1330 {
1332 SetSentErrorMessage(true);
1333 return false;
1334 }
1335
1336 player = sObjectAccessor->FindPlayerByName(name);
1337 if (offline)
1338 guid = sObjectMgr->GetPlayerGUIDByName(name.c_str());
1339 }
1340 }
1341
1342 if (player)
1343 {
1344 group = player->GetGroup();
1345 if (!guid || !offline)
1346 guid = player->GetGUID();
1347 }
1348 else
1349 {
1350 if (getSelectedPlayer())
1351 player = getSelectedPlayer();
1352 else
1353 player = m_session->GetPlayer();
1354
1355 if (!guid || !offline)
1356 guid = player->GetGUID();
1357 group = player->GetGroup();
1358 }
1359
1360 return true;
1361}
1362
1364{
1365 return sWorld->GetDefaultDbcLocale();
1366}
1367
1369{
1370 return sObjectMgr->GetDBCLocaleIndex();
1371}
const AuthHandler table[]
SpellLinkType
Definition Chat.cpp:1024
@ SPELL_LINK_SPELL
Definition Chat.cpp:1025
@ SPELL_LINK_GLYPH
Definition Chat.cpp:1029
@ SPELL_LINK_TALENT
Definition Chat.cpp:1026
@ SPELL_LINK_ENCHANT
Definition Chat.cpp:1027
@ SPELL_LINK_TRADE
Definition Chat.cpp:1028
static char const *const spellKeys[]
Definition Chat.cpp:1032
GuidLinkType
Definition Chat.cpp:1105
@ SPELL_LINK_PLAYER
Definition Chat.cpp:1106
@ SPELL_LINK_CREATURE
Definition Chat.cpp:1107
@ SPELL_LINK_GAMEOBJECT
Definition Chat.cpp:1108
static char const *const guidKeys[]
Definition Chat.cpp:1111
#define vsnprintf
Definition Common.h:100
LocaleConstant
Definition Common.h:138
AccountTypes
Definition Common.h:129
DBCStorage< TalentEntry > sTalentStore(TalentEntryfmt)
DBCStorage< GlyphPropertiesEntry > sGlyphPropertiesStore(GlyphPropertiesfmt)
AreaTableEntry const * GetAreaEntryByAreaID(uint32 area_id)
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
std::uint64_t uint64
Definition Define.h:76
#define ASSERT
Definition Errors.h:29
#define SIZE_OF_GRIDS
Definition GridDefines.h:26
TypeMapContainer< AllGridObjectTypes > GridTypeMapContainer
Definition GridDefines.h:71
CoordPair< TOTAL_NUMBER_OF_CELLS_PER_MAP > CellCoord
@ LANG_CONSOLE_COMMAND
Definition Language.h:182
@ LANG_SUBCMDS_LIST
Definition Language.h:21
@ LANG_AVIABLE_CMD
Definition Language.h:22
@ LANG_CMD_SYNTAX
Definition Language.h:23
@ LANG_NO_SUBCMD
Definition Language.h:20
@ LANG_YOURS_SECURITY_IS_LOW
Definition Language.h:377
@ LANG_PLAYER_NOT_FOUND
Definition Language.h:487
@ LANG_NO_CMD
Definition Language.h:19
@ LANG_WRONG_LINK_TYPE
Definition Language.h:502
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
#define SF_LOG_INFO(filterType__,...)
Definition Log.h:137
#define sLog
Definition Log.h:106
#define sObjectAccessor
uint32 GUID_LOPART(uint64 x)
char const * GetLogNameForGuid(uint64 guid)
bool IS_PET_GUID(uint64 guid)
@ HIGHGUID_GAMEOBJECT
@ HIGHGUID_GUILD
@ HIGHGUID_UNIT
uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h)
bool IS_PLAYER_GUID(uint64 guid)
bool normalizePlayerName(std::string &name)
#define sObjectMgr
Definition ObjectMgr.h:1617
Skyfire::AutoPtr< PreparedResultSet, Skyfire::Mutex > PreparedQueryResult
Definition QueryResult.h:94
#define sScriptMgr
Definition ScriptMgr.h:764
ChatMsg
@ CHAT_MSG_BG_SYSTEM_ALLIANCE
@ CHAT_MSG_BG_SYSTEM_NEUTRAL
@ CHAT_MSG_RAID_LEADER
@ CHAT_MSG_MONSTER_SAY
@ CHAT_MSG_ACHIEVEMENT
@ CHAT_MSG_MONSTER_EMOTE
@ CHAT_MSG_INSTANCE_LEADER
@ CHAT_MSG_PARTY_LEADER
@ CHAT_MSG_RAID_BOSS_WHISPER
@ CHAT_MSG_BG_SYSTEM_HORDE
@ CHAT_MSG_TEXT_EMOTE
@ CHAT_MSG_RAID_BOSS_EMOTE
@ CHAT_MSG_GUILD_ACHIEVEMENT
@ CHAT_MSG_MONSTER_YELL
@ CHAT_MSG_MONSTER_WHISPER
@ CHAT_MSG_MONSTER_PARTY
@ CHAT_MSG_RAID_WARNING
@ CHAT_MSG_SMART_WHISPER
Language
@ WORLD_SEL_COMMANDS
static AccountTypes GetSecurity(uint32 accountId)
static bool IsPlayerAccount(AccountTypes gmlevel)
bool WriteBit(uint32 bit)
Definition ByteBuffer.h:164
void WriteString(std::string const &str)
Definition ByteBuffer.h:578
size_t wpos() const
Definition ByteBuffer.h:483
void WriteBits(T value, size_t bits)
Definition ByteBuffer.h:192
void WriteByteSeq(uint8 b)
Definition ByteBuffer.h:227
void FlushBits()
Definition ByteBuffer.h:154
uint32 Permission
Definition Chat.h:33
bool AllowConsole
Definition Chat.h:34
static bool LoadCommandTable()
Definition Chat.h:115
virtual std::string GetNameLink() const
Definition Chat.h:79
GameTele const * extractGameTeleFromLink(char *text)
Definition Chat.cpp:1089
bool HasLowerSecurity(Player *target, uint64 guid, bool strong=false)
Definition Chat.cpp:78
static void SetLoadCommandTable(bool val)
Definition Chat.h:116
bool ParseCommands(const char *text)
Definition Chat.cpp:388
virtual bool isAvailable(ChatCommand const &cmd) const
Definition Chat.cpp:73
std::string PGetParseString(int32 entry,...) const
Definition Chat.cpp:57
void extractOptFirstArg(char *args, char **arg1, char **arg2)
Definition Chat.cpp:1237
static bool SetDataForCommandInTable(std::vector< ChatCommand > &table, const char *text, uint32 permission, std::string const &help, std::string const &fullcommand)
Definition Chat.cpp:333
GameObject * GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry)
Definition Chat.cpp:998
std::string playerLink(std::string const &name) const
Definition Chat.h:108
static bool load_command_table
Definition Chat.h:129
char * extractQuotedArg(char *args)
Definition Chat.cpp:1255
Unit * getSelectedUnit()
Definition Chat.cpp:841
void SendGlobalGMSysMessage(const char *str)
Definition Chat.cpp:188
bool ExecuteCommandInTable(std::vector< ChatCommand > const &table, const char *text, std::string const &fullcmd)
Definition Chat.cpp:231
Player * getSelectedPlayer()
Definition Chat.cpp:829
void SendGlobalSysMessage(const char *str)
Definition Chat.cpp:170
bool HasSentErrorMessage() const
Definition Chat.h:113
virtual LocaleConstant GetSessionDbcLocale() const
Definition Chat.cpp:1277
bool isValidChatMessage(const char *msg)
Definition Chat.cpp:425
virtual bool HasPermission(uint32 permission) const
Definition Chat.h:78
WorldSession * m_session
Definition Chat.h:126
virtual int GetSessionDbLocaleIndex() const
Definition Chat.cpp:1282
bool hasStringAbbr(const char *name, const char *part)
Definition Chat.cpp:128
Creature * getSelectedCreature()
Definition Chat.cpp:865
uint32 extractSpellIdFromLink(char *text)
Definition Chat.cpp:1042
char * extractKeyFromLink(char *text, char const *linkType, char **something1=NULL)
Definition Chat.cpp:873
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
Definition Chat.cpp:221
static size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string const &message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="", std::string const &addonPrefix="")
Definition Chat.cpp:580
void SetSentErrorMessage(bool val)
Definition Chat.h:114
WorldObject * getSelectedObject()
Definition Chat.cpp:852
uint64 extractGuidFromLink(char *text)
Definition Chat.cpp:1119
static char * LineFromMessage(char *&pos)
Definition Chat.h:56
bool ShowHelpForSubCommands(std::vector< ChatCommand > const &table, char const *cmd, char const *subcmd)
Definition Chat.cpp:485
bool extractPlayerTarget(char *args, Player **player, uint64 *player_guid=NULL, std::string *player_name=NULL)
Definition Chat.cpp:1184
virtual bool needReportToTarget(Player *chr) const
Definition Chat.cpp:1271
virtual void SendSysMessage(const char *str)
Definition Chat.cpp:153
virtual const char * GetSkyFireString(int32 entry) const
Definition Chat.cpp:68
bool GetPlayerGroupAndGUIDByName(const char *cname, Player *&player, Group *&group, uint64 &guid, bool offline=false)
Definition Chat.cpp:1319
std::string extractPlayerNameFromLink(char *text)
Definition Chat.cpp:1170
bool ShowHelpForCommand(std::vector< ChatCommand > const &table, const char *cmd)
Definition Chat.cpp:523
GameObject * GetNearbyGameObject()
Definition Chat.cpp:985
bool HasLowerSecurityAccount(WorldSession *target, uint32 account, bool strong=false)
Definition Chat.cpp:98
static std::vector< ChatCommand > const & getCommandTable()
Definition Chat.cpp:29
void SendSysMessage(const char *str)
Definition Chat.cpp:1303
bool needReportToTarget(Player *chr) const
Definition Chat.cpp:1314
const char * GetSkyFireString(int32 entry) const
Definition Chat.cpp:1292
LocaleConstant GetSessionDbcLocale() const
Definition Chat.cpp:1363
int GetSessionDbLocaleIndex() const
Definition Chat.cpp:1368
void * m_callbackArg
Definition Chat.h:150
Print * m_print
Definition Chat.h:151
std::string GetNameLink() const
Definition Chat.cpp:1309
bool isAvailable(ChatCommand const &cmd) const
Definition Chat.cpp:1297
Definition Field.h:16
std::string GetString() const
Definition Field.h:228
uint16 GetUInt16() const
Definition Field.h:69
Definition Group.h:147
uint64 GetGUID() const
Definition Group.cpp:2573
GameObject * GetGameObject(uint64 guid)
Definition Map.cpp:3184
const char * GetMapName() const
Definition Map.cpp:2285
static Creature * GetCreatureOrPetOrVehicle(WorldObject const &, uint64)
static Unit * GetUnit(WorldObject const &, uint64 guid)
static Player * FindPlayer(uint64)
uint64 GetGUID() const
Definition Object.h:119
Player * ToPlayer()
Definition Object.h:204
uint32 GetGuildId() const
Definition Player.h:2291
WorldSession * GetSession() const
Definition Player.h:2417
Group * GetGroup()
Definition Player.h:2972
bool IsVisibleGloballyFor(Player const *player) const
Definition Player.cpp:18107
Unit * GetSelectedUnit() const
Definition Player.cpp:18385
Definition Unit.h:1367
uint64 GetTarget() const
Definition Unit.h:2830
uint32 GetMapId() const
Definition Object.h:546
Map * GetMap() const
Definition Object.h:740
float GetGridActivationRange() const
Definition Object.cpp:2054
std::string const & GetName() const
Definition Object.h:664
virtual std::string const & GetNameForLocaleIdx(LocaleConstant) const
Definition Object.h:667
void VisitNearbyGridObject(float const &radius, NOTIFIER &notifier) const
Definition Object.h:783
uint32 GetAreaId() const
Definition Object.cpp:1602
void Initialize(Opcodes opcode, size_t newres=200)
Definition WorldPacket.h:31
Player session in the World.
AccountTypes GetSecurity() const
uint32 GetVirtualRealmID() const
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition Main.cpp:40
@ SMSG_MESSAGECHAT
Definition Opcodes.h:779
#define sWorld
Definition World.h:910
@ CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY
Definition World.h:275
@ CONFIG_GM_LOWER_SECURITY
Definition World.h:108
CellCoord ComputeCellCoord(float x, float y)
@ RBAC_PERM_COMMANDS_NOTIFY_COMMAND_NOT_FOUND_ERROR
Definition RBAC.h:73
@ RBAC_PERM_COMMAND_GM_CHAT
Definition RBAC.h:260
@ RBAC_PERM_CHECK_FOR_LOWER_SECURITY
Definition RBAC.h:87
Definition Cell.h:37
void Visit(CellCoord const &, TypeContainerVisitor< T, CONTAINER > &visitor, Map &, WorldObject const &, float) const
Definition CellImpl.h:109
uint32 SpellId
float GetPositionZ() const
Definition Object.h:330
float GetPositionX() const
Definition Object.h:328
float GetPositionY() const
Definition Object.h:329
uint32 SpellId