TrinityCore
Loading...
Searching...
No Matches
WorldSession.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#include "WorldSession.h"
19#include "Account.h"
20#include "AccountMgr.h"
22#include "Bag.h"
23#include "BattlePetMgr.h"
24#include "BattlegroundMgr.h"
25#include "BattlenetPackets.h"
26#include "CharacterPackets.h"
27#include "ChatPackets.h"
28#include "ClientConfigPackets.h"
29#include "Containers.h"
30#include "DatabaseEnv.h"
31#include "DB2Stores.h"
32#include "GameTime.h"
33#include "Group.h"
34#include "Guild.h"
35#include "GuildMgr.h"
36#include "Hyperlinks.h"
37#include "IpAddress.h"
38#include "Log.h"
39#include "Map.h"
40#include "Metric.h"
41#include "MiscPackets.h"
42#include "ObjectMgr.h"
43#include "OutdoorPvPMgr.h"
44#include "PacketUtilities.h"
45#include "Player.h"
46#include "QueryHolder.h"
48#include "Random.h"
49#include "RBAC.h"
50#include "RealmList.h"
51#include "ScriptMgr.h"
52#include "SocialMgr.h"
53#include "World.h"
54#include "WorldSocket.h"
55#include <boost/circular_buffer.hpp>
56
57namespace {
58
59std::string const DefaultPlayerName = "<none>";
60
61} // namespace
62
64{
65 ClientOpcodeHandler const* opHandle = opcodeTable[static_cast<OpcodeClient>(packet->GetOpcode())];
66
67 //let's check if our opcode can be really processed in Map::Update()
68 if (opHandle->ProcessingPlace == PROCESS_INPLACE)
69 return true;
70
71 //we do not process thread-unsafe packets
73 return false;
74
75 Player* player = m_pSession->GetPlayer();
76 if (!player)
77 return false;
78
79 //in Map::Update() we do not process packets where player is not in world!
80 return player->IsInWorld();
81}
82
83//we should process ALL packets when player is not in world/logged in
84//OR packet handler is not thread-safe!
86{
87 ClientOpcodeHandler const* opHandle = opcodeTable[static_cast<OpcodeClient>(packet->GetOpcode())];
88
89 //check if packet handler is supposed to be safe
90 if (opHandle->ProcessingPlace == PROCESS_INPLACE)
91 return true;
92
93 //thread-unsafe packets should be processed in World::UpdateSessions()
95 return true;
96
97 //no player attached? -> our client! ^^
98 Player* player = m_pSession->GetPlayer();
99 if (!player)
100 return true;
101
102 //lets process all packets for non-in-the-world player
103 return (player->IsInWorld() == false);
104}
105
107WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccountId, std::string&& battlenetAccountEmail,
108 std::shared_ptr<WorldSocket>&& sock, AccountTypes sec, uint8 expansion, time_t mute_time, std::string&& os, Minutes timezoneOffset,
109 uint32 build, ClientBuild::VariantId clientBuildVariant, LocaleConstant locale, uint32 recruiter, bool isARecruiter) :
110 m_muteTime(mute_time),
111 m_timeOutTime(0),
112 AntiDOS(this),
113 m_GUIDLow(UI64LIT(0)),
114 _player(nullptr),
115 m_Socket({ std::move(sock), nullptr }),
116 _security(sec),
117 _accountId(id),
118 _accountName(std::move(name)),
119 _battlenetAccount(new Battlenet::Account(this, ObjectGuid::Create<HighGuid::BNetAccount>(battlenetAccountId), std::move(battlenetAccountEmail))),
120 m_accountExpansion(expansion),
121 m_expansion(std::min<uint8>(expansion, sWorld->getIntConfig(CONFIG_EXPANSION))),
122 _os(std::move(os)),
123 _clientBuild(build),
124 _clientBuildVariant(clientBuildVariant),
125 _realmListSecret(),
126 _battlenetRequestToken(0),
127 _logoutTime(0),
128 m_inQueue(false),
129 m_playerLogout(false),
130 m_playerRecentlyLogout(false),
131 m_playerSave(false),
132 m_sessionDbcLocale(sWorld->GetAvailableDbcLocale(locale)),
133 m_sessionDbLocaleIndex(locale),
134 _timezoneOffset(timezoneOffset),
135 m_latency(0),
136 _tutorials(),
137 _tutorialsChanged(TUTORIALS_FLAG_NONE),
138 _filterAddonMessages(false),
139 recruiterId(recruiter),
140 isRecruiter(isARecruiter),
141 _RBACData(nullptr),
142 expireTime(60000), // 1 min after socket loss, session is deleted
143 forceExit(false),
144 _timeSyncClockDeltaQueue(std::make_unique<boost::circular_buffer<std::pair<int64, uint32>>>(6)),
145 _timeSyncClockDelta(0),
146 _pendingTimeSyncRequests(),
147 _timeSyncNextCounter(0),
148 _timeSyncTimer(0),
149 _calendarEventCreationCooldown(0),
150 _battlePetMgr(std::make_unique<BattlePets::BattlePetMgr>(this)),
151 _collectionMgr(std::make_unique<CollectionMgr>(this))
152{
153 if (m_Socket[CONNECTION_TYPE_REALM])
154 {
155 m_Address = m_Socket[CONNECTION_TYPE_REALM]->GetRemoteIpAddress().to_string();
156 ResetTimeOutTime(false);
157 LoginDatabase.PExecute("UPDATE account SET online = 1 WHERE id = {};", GetAccountId()); // One-time query
158 }
159
160 _instanceConnectKey.Raw = UI64LIT(0);
161}
162
165{
167 if (_player)
168 LogoutPlayer (true);
169
171 for (uint8 i = 0; i < 2; ++i)
172 {
173 if (m_Socket[i])
174 {
175 m_Socket[i]->CloseSocket();
176 m_Socket[i].reset();
177 }
178 }
179
180 delete _RBACData;
181
183 WorldPacket* packet = nullptr;
184 while (_recvQueue.next(packet))
185 delete packet;
186
187 LoginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = {};", GetAccountId()); // One-time query
188}
189
195
200
205
206std::string const & WorldSession::GetPlayerName() const
207{
208 return _player != nullptr ? _player->GetName() : DefaultPlayerName;
209}
210
212{
213 if (_player)
214 return Trinity::StringFormat("[Player: {} {}, Account: {}]", _player->GetName(), _player->GetGUID(), GetAccountId());
215
217 return Trinity::StringFormat("[Player: Logging in: {}, Account: {}]", m_playerLoading, GetAccountId());
218
219 return Trinity::StringFormat("[Player: Account: {}]", GetAccountId());
220}
221
223void WorldSession::SendPacket(WorldPacket const* packet, bool forced /*= false*/)
224{
225 if (!opcodeTable.IsValid(static_cast<OpcodeServer>(packet->GetOpcode())))
226 {
227 char const* specialName = packet->GetOpcode() == UNKNOWN_OPCODE ? "UNKNOWN_OPCODE" : "INVALID_OPCODE";
228 TC_LOG_ERROR("network.opcode", "Prevented sending of {} (0x{:04X}) to {}", specialName, packet->GetOpcode(), GetPlayerInfo());
229 return;
230 }
231
232 ServerOpcodeHandler const* handler = opcodeTable[static_cast<OpcodeServer>(packet->GetOpcode())];
233 if (!handler)
234 {
235 TC_LOG_ERROR("network.opcode", "Prevented sending of opcode {} with non existing handler to {}", packet->GetOpcode(), GetPlayerInfo());
236 return;
237 }
238
239 // Default connection index defined in Opcodes.cpp table
240 ConnectionType conIdx = handler->ConnectionIndex;
241
242 // Override connection index
243 if (packet->GetConnection() != CONNECTION_TYPE_DEFAULT)
244 {
246 {
247 TC_LOG_ERROR("network.opcode", "Prevented sending of instance only opcode {} with connection type {} to {}", packet->GetOpcode(), uint32(packet->GetConnection()), GetPlayerInfo());
248 return;
249 }
250
251 conIdx = packet->GetConnection();
252 }
253
254 if (!m_Socket[conIdx])
255 {
256 TC_LOG_ERROR("network.opcode", "Prevented sending of {} to non existent socket {} to {}", GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet->GetOpcode())), uint32(conIdx), GetPlayerInfo());
257 return;
258 }
259
260 if (!forced)
261 {
262 if (handler->Status == STATUS_UNHANDLED)
263 {
264 TC_LOG_ERROR("network.opcode", "Prevented sending disabled opcode {} to {}", GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet->GetOpcode())), GetPlayerInfo());
265 return;
266 }
267 }
268
269#ifdef TRINITY_DEBUG
270 // Code for network use statistic
271 static uint64 sendPacketCount = 0;
272 static uint64 sendPacketBytes = 0;
273
274 static time_t firstTime = GameTime::GetGameTime();
275 static time_t lastTime = firstTime; // next 60 secs start time
276
277 static uint64 sendLastPacketCount = 0;
278 static uint64 sendLastPacketBytes = 0;
279
280 time_t cur_time = GameTime::GetGameTime();
281
282 if ((cur_time - lastTime) < 60)
283 {
284 sendPacketCount += 1;
285 sendPacketBytes += packet->size();
286
287 sendLastPacketCount += 1;
288 sendLastPacketBytes += packet->size();
289 }
290 else
291 {
292 uint64 minTime = uint64(cur_time - lastTime);
293 uint64 fullTime = uint64(lastTime - firstTime);
294 TC_LOG_DEBUG("misc", "Send all time packets count: {} bytes: {} avr.count/sec: {} avr.bytes/sec: {} time: {}", sendPacketCount, sendPacketBytes, float(sendPacketCount)/fullTime, float(sendPacketBytes)/fullTime, uint32(fullTime));
295 TC_LOG_DEBUG("misc", "Send last min packets count: {} bytes: {} avr.count/sec: {} avr.bytes/sec: {}", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount)/minTime, float(sendLastPacketBytes)/minTime);
296
297 lastTime = cur_time;
298 sendLastPacketCount = 1;
299 sendLastPacketBytes = packet->wpos(); // wpos is real written size
300 }
301#endif // !TRINITY_DEBUG
302
303 sScriptMgr->OnPacketSend(this, *packet);
304
305 TC_LOG_TRACE("network.opcode", "S->C: {} {}", GetPlayerInfo(), GetOpcodeNameForLogging(static_cast<OpcodeServer>(packet->GetOpcode())));
306 m_Socket[conIdx]->SendPacket(*packet);
307}
308
309void WorldSession::AddInstanceConnection(WorldSession* session, std::weak_ptr<WorldSocket> sockRef, ConnectToKey key)
310{
311 std::shared_ptr<WorldSocket> socket = sockRef.lock();
312 if (!socket || !socket->IsOpen())
313 return;
314
315 if (!session || session->GetConnectToInstanceKey() != key.Raw)
316 {
317 socket->SendAuthResponseError(ERROR_TIMED_OUT);
318 socket->DelayedCloseSocket();
319 return;
320 }
321
322 socket->SetWorldSession(session);
323 session->m_Socket[CONNECTION_TYPE_INSTANCE] = std::move(socket);
324 session->HandleContinuePlayerLogin();
325}
326
329{
330 _recvQueue.add(new WorldPacket(std::move(new_packet)));
331}
332
334void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, char const* status, const char *reason)
335{
336 TC_LOG_ERROR("network.opcode", "Received unexpected opcode {} Status: {} Reason: {} from {}",
337 GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), status, reason, GetPlayerInfo());
338}
339
342{
343 if (!sLog->ShouldLog("network.opcode", LOG_LEVEL_TRACE) || packet->rpos() >= packet->wpos())
344 return;
345
346 TC_LOG_TRACE("network.opcode", "Unprocessed tail data (read stop at {} from {}) Opcode {} from {}",
347 uint32(packet->rpos()), uint32(packet->wpos()), GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())), GetPlayerInfo());
348 packet->print_storage();
349}
350
353{
358 m_Socket[CONNECTION_TYPE_REALM]->CloseSocket();
359
362 WorldPacket* packet = nullptr;
364 bool deletePacket = true;
365 std::vector<WorldPacket*> requeuePackets;
366 uint32 processedPackets = 0;
367 time_t currentTime = GameTime::GetGameTime();
368
369 constexpr uint32 MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE = 100;
370
371 while (m_Socket[CONNECTION_TYPE_REALM] && _recvQueue.next(packet, updater))
372 {
373 OpcodeClient opcode = static_cast<OpcodeClient>(packet->GetOpcode());
374 ClientOpcodeHandler const* opHandle = opcodeTable[opcode];
375 TC_METRIC_DETAILED_TIMER("worldsession_update_opcode_time", TC_METRIC_TAG("opcode", opHandle->Name));
376
377 try
378 {
379 switch (opHandle->Status)
380 {
381 case STATUS_LOGGEDIN:
382 if (!_player)
383 {
384 // skip STATUS_LOGGEDIN opcode unexpected errors if player logout sometime ago - this can be network lag delayed packets
388 {
389 requeuePackets.push_back(packet);
390 deletePacket = false;
391 TC_LOG_DEBUG("network", "Re-enqueueing packet with opcode {} with with status STATUS_LOGGEDIN. "
392 "Player is currently not in world yet.", GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())));
393 }
394 }
395 else if (_player->IsInWorld())
396 {
397 if(AntiDOS.EvaluateOpcode(*packet, currentTime))
398 {
399 sScriptMgr->OnPacketReceive(this, *packet);
400 opHandle->Call(this, *packet);
401 }
402 else
403 processedPackets = MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE; // break out of packet processing loop
404 }
405 // lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer
406 break;
408 if (!_player && !m_playerRecentlyLogout && !m_playerLogout) // There's a short delay between _player = null and m_playerRecentlyLogout = true during logout
409 LogUnexpectedOpcode(packet, "STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT",
410 "the player has not logged in yet and not recently logout");
411 else if (AntiDOS.EvaluateOpcode(*packet, currentTime))
412 {
413 // not expected _player or must checked in packet hanlder
414 sScriptMgr->OnPacketReceive(this, *packet);
415 opHandle->Call(this, *packet);
416 }
417 else
418 processedPackets = MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE; // break out of packet processing loop
419 break;
420 case STATUS_TRANSFER:
421 if (!_player)
422 LogUnexpectedOpcode(packet, "STATUS_TRANSFER", "the player has not logged in yet");
423 else if (_player->IsInWorld())
424 LogUnexpectedOpcode(packet, "STATUS_TRANSFER", "the player is still in world");
425 else if (AntiDOS.EvaluateOpcode(*packet, currentTime))
426 {
427 sScriptMgr->OnPacketReceive(this, *packet);
428 opHandle->Call(this, *packet);
429 }
430 else
431 processedPackets = MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE; // break out of packet processing loop
432 break;
433 case STATUS_AUTHED:
434 // prevent cheating with skip queue wait
435 if (m_inQueue)
436 {
437 LogUnexpectedOpcode(packet, "STATUS_AUTHED", "the player not pass queue yet");
438 break;
439 }
440
441 // some auth opcodes can be recieved before STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes
442 // however when we recieve CMSG_CHAR_ENUM we are surely no longer during the logout process.
443 if (packet->GetOpcode() == CMSG_ENUM_CHARACTERS)
445
446 if (AntiDOS.EvaluateOpcode(*packet, currentTime))
447 {
448 sScriptMgr->OnPacketReceive(this, *packet);
449 opHandle->Call(this, *packet);
450 }
451 else
452 processedPackets = MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE; // break out of packet processing loop
453 break;
454 case STATUS_NEVER:
455 TC_LOG_ERROR("network.opcode", "Received not allowed opcode {} from {}", GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode()))
456 , GetPlayerInfo());
457 break;
458 case STATUS_UNHANDLED:
459 TC_LOG_ERROR("network.opcode", "Received not handled opcode {} from {}", GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode()))
460 , GetPlayerInfo());
461 break;
462 case STATUS_IGNORED:
463 break;
464 }
465 }
467 {
468 TC_LOG_ERROR("network", "WorldSession::Update ByteBufferException {} occured while parsing a packet (opcode: {}) from {} address {}. Skipped packet.",
470
472 {
473 switch (ihe.GetReason())
474 {
476 KickPlayer("WorldSession::Update Invalid chat link");
477 break;
479 KickPlayer("WorldSession::Update Illegal chat link");
480 break;
481 default:
482 break;
483 }
484 }
485 }
486 catch (ByteBufferException const& bbe)
487 {
488 TC_LOG_ERROR("network", "WorldSession::Update ByteBufferException {} occured while parsing a packet (opcode: {}) from {} address {}. Skipped packet.",
490 packet->hexlike();
491 }
492
493 if (deletePacket)
494 delete packet;
495
496 deletePacket = true;
497
498 processedPackets++;
499
500 //process only a max amout of packets in 1 Update() call.
501 //Any leftover will be processed in next update
502 if (processedPackets > MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE)
503 break;
504 }
505
506 TC_METRIC_VALUE("processed_packets", processedPackets);
507
508 _recvQueue.readd(requeuePackets.begin(), requeuePackets.end());
509
510 if (!updater.ProcessUnsafe()) // <=> updater is of type MapSessionFilter
511 {
512 // Send time sync packet every 10s.
513 if (_timeSyncTimer > 0)
514 {
515 if (diff >= _timeSyncTimer)
516 SendTimeSync();
517 else
518 _timeSyncTimer -= diff;
519 }
520 }
521
523
524 //check if we are safe to proceed with logout
525 //logout procedure should happen only in World::UpdateSessions() method!!!
526 if (updater.ProcessUnsafe())
527 {
529 if (ShouldLogOut(currentTime) && m_playerLoading.IsEmpty())
530 LogoutPlayer(true);
531
533 if (std::ranges::any_of(m_Socket, [](std::shared_ptr<WorldSocket> const& s) { return s && !s->IsOpen(); }))
534 {
535 expireTime -= expireTime > diff ? diff : expireTime;
536 if (expireTime < diff || forceExit || !GetPlayer())
537 {
538 for (std::shared_ptr<WorldSocket>& socket : m_Socket)
539 {
540 if (socket)
541 {
542 socket->CloseSocket();
543 socket.reset();
544 }
545 }
546 }
547 }
548
550 return false; //Will remove this session from the world session map
551 }
552
553 return true;
554}
555
558{
559 // finish pending transfers before starting the logout
562
563 m_playerLogout = true;
564 m_playerSave = save;
565
566 if (_player)
567 {
568 if (!_player->GetLootGUID().IsEmpty())
570
572 if (_player->GetDeathTimer())
573 {
577 }
579 {
580 // this will kill character by SPELL_AURA_SPIRIT_OF_REDEMPTION
585 }
586 else if (_player->HasPendingBind())
587 {
589 _player->SetPendingBind(0, 0);
590 }
591
592 //drop a flag if player is carrying it
594 bg->EventPlayerLoggedOut(_player);
595
599
600 sOutdoorPvPMgr->HandlePlayerLeaveZone(_player, _player->GetZoneId());
601
602 for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
603 {
605 if (bgQueueTypeId != BATTLEGROUND_QUEUE_NONE)
606 {
607 _player->RemoveBattlegroundQueueId(bgQueueTypeId);
608 BattlegroundQueue& queue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
609 queue.RemovePlayer(_player->GetGUID(), true);
610 }
611 }
612
613 // Repop at Graveyard or other player far teleport will prevent saving player because of not present map
614 // Teleport player immediately for correct player save
617
619 if (Guild* guild = sGuildMgr->GetGuildById(_player->GetGuildId()))
620 guild->HandleMemberLogout(this);
621
623 _player->RemovePet(nullptr, PET_SAVE_AS_CURRENT, true);
624
626 if (_battlePetMgr->HasJournalLock())
627 _battlePetMgr->ToggleJournalLock(false);
628
631
633
634 // exit areatriggers before saving to remove auras applied by them
636
638 // some save parts only correctly work in case player present in map/player_lists (pets, etc)
639 if (save)
640 {
641 uint32 eslot;
642 for (int j = BUYBACK_SLOT_START; j < BUYBACK_SLOT_END; ++j)
643 {
644 eslot = j - BUYBACK_SLOT_START;
646 _player->SetBuybackPrice(eslot, 0);
647 _player->SetBuybackTimestamp(eslot, 0);
648 }
649 _player->SaveToDB();
650 }
651
654
657
659 if (Group* group = _player->GetGroup())
660 {
661 group->SendUpdate();
662 if (group->GetLeaderGUID() == _player->GetGUID())
663 group->StartLeaderOfflineTimer();
664 }
665
667 sSocialMgr->SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetGUID(), true);
669
671 sScriptMgr->OnPlayerLogout(_player);
672
673 TC_METRIC_EVENT("player_events", "Logout", _player->GetName());
674
676 // the player may not be in the world when logging out
677 // e.g if he got disconnected during a transfer to another map
678 // calls to GetMap in this case may cause crashes
681 TC_LOG_INFO("entities.player.character", "Account: {} (IP: {}) Logout Character:[{}] {} Level: {}, XP: {}/{} ({} left)",
684
685 if (Map* _map = _player->FindMap())
686 _map->RemovePlayerFromMap(_player, true);
687
688 SetPlayer(nullptr);
689
693 TC_LOG_DEBUG("network", "SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
694
697 stmt->setUInt32(0, GetAccountId());
698 CharacterDatabase.Execute(stmt);
699 }
700
702 {
703 m_Socket[CONNECTION_TYPE_INSTANCE]->CloseSocket();
705 }
706
707 m_playerLogout = false;
708 m_playerSave = false;
711}
712
714void WorldSession::KickPlayer(std::string_view reason)
715{
716 TC_LOG_INFO("network.kick", "{} kicked with reason: {}", GetPlayerInfo(), reason);
717
718 for (std::shared_ptr<WorldSocket> const& socket : m_Socket)
719 {
720 if (socket)
721 {
722 socket->CloseSocket();
723 forceExit = true;
724 }
725 }
726}
727
729{
731 return true;
732
733 TC_LOG_ERROR("network", "Player {}{} sent a message with an invalid link:\n{}", GetPlayer()->GetName(),
734 GetPlayer()->GetGUID().ToString(), str);
735
737 KickPlayer("WorldSession::ValidateHyperlinksAndMaybeKick Invalid chat link");
738
739 return false;
740}
741
743{
744 if (str.find('|') == std::string::npos)
745 return true;
746
747 TC_LOG_ERROR("network", "Player {} {} sent a message which illegally contained a hyperlink:\n{}", GetPlayer()->GetName(),
748 GetPlayer()->GetGUID().ToString(), str);
749
751 KickPlayer("WorldSession::DisallowHyperlinksAndMaybeKick Illegal chat link");
752
753 return false;
754}
755
756void WorldSession::SendNotification(char const* format, ...)
757{
758 if (format)
759 {
760 va_list ap;
761 char szStr[1024];
762 szStr[0] = '\0';
763 va_start(ap, format);
764 vsnprintf(szStr, 1024, format, ap);
765 va_end(ap);
766
768 }
769}
770
772{
773 char const* format = GetTrinityString(stringId);
774 if (format)
775 {
776 va_list ap;
777 char szStr[1024];
778 szStr[0] = '\0';
779 va_start(ap, stringId);
780 vsnprintf(szStr, 1024, format, ap);
781 va_end(ap);
782
784 }
785}
786
788{
790}
791
793{
794 return sObjectMgr->GetTrinityString(entry, GetSessionDbLocaleIndex());
795}
796
798{
799 if (GetPlayer())
801 else if (!onlyActive)
803}
804
809
811{
812 TC_LOG_ERROR("network.opcode", "Received unhandled opcode {} from {}", GetOpcodeNameForLogging(null.GetOpcode()), GetPlayerInfo());
813}
814
816{
817 TC_LOG_ERROR("network.opcode", "Received opcode {} that must be processed in WorldSocket::ReadDataHandler from {}"
819}
820
822{
823 boost::system::error_code ignored_error;
824 boost::asio::ip::address instanceAddress;
825 if (std::shared_ptr<Realm const> currentRealm = sRealmList->GetCurrentRealm())
826 instanceAddress = currentRealm->GetAddressForClient(Trinity::Net::make_address(GetRemoteAddress(), ignored_error));
827
830 _instanceConnectKey.Fields.Key = urand(0, 0x7FFFFFFF);
831
833 connectTo.Key = _instanceConnectKey.Raw;
835 connectTo.Serial = serial;
836 connectTo.Payload.Port = sWorld->getIntConfig(CONFIG_PORT_WORLD);
837 if (instanceAddress.is_v4())
838 {
839 memcpy(connectTo.Payload.Where.Address.V4.data(), instanceAddress.to_v4().to_bytes().data(), 4);
841 }
842 else
843 {
844 // client always uses v4 address for loopback and v4 mapped addresses
845 boost::asio::ip::address_v6 v6 = instanceAddress.to_v6();
846 if (v6.is_loopback())
847 {
848 memcpy(connectTo.Payload.Where.Address.V4.data(), boost::asio::ip::address_v4::loopback().to_bytes().data(), 4);
850 }
851 else if (v6.is_v4_mapped())
852 {
853 memcpy(connectTo.Payload.Where.Address.V4.data(), Trinity::Net::make_address_v4(Trinity::Net::v4_mapped, v6).to_bytes().data(), 4);
855 }
856 else
857 {
858 memcpy(connectTo.Payload.Where.Address.V6.data(), v6.to_bytes().data(), 16);
860 }
861 }
862 connectTo.Con = CONNECTION_TYPE_INSTANCE;
863
864 SendPacket(connectTo.Write());
865}
866
868{
869 for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
870 if (mask & (1 << i))
872
873 if (!result)
874 return;
875
876 do
877 {
878 Field* fields = result->Fetch();
879 uint32 type = fields[0].GetUInt8();
880 if (type >= NUM_ACCOUNT_DATA_TYPES)
881 {
882 TC_LOG_ERROR("misc", "Table `{}` have invalid account data type ({}), ignore.",
883 mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
884 continue;
885 }
886
887 if ((mask & (1 << type)) == 0)
888 {
889 TC_LOG_ERROR("misc", "Table `{}` have non appropriate for table account data type ({}), ignore.",
890 mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
891 continue;
892 }
893
894 _accountData[type].Time = fields[1].GetInt64();
895 _accountData[type].Data = fields[2].GetString();
896 }
897 while (result->NextRow());
898}
899
900void WorldSession::SetAccountData(AccountDataType type, time_t time, std::string const& data)
901{
902 if ((1 << type) & GLOBAL_CACHE_MASK)
903 {
905 stmt->setUInt32(0, GetAccountId());
906 stmt->setUInt8(1, type);
907 stmt->setInt64(2, time);
908 stmt->setString(3, data);
909 CharacterDatabase.Execute(stmt);
910 }
911 else
912 {
913 // _player can be NULL and packet received after logout but m_GUID still store correct guid
914 if (!m_GUIDLow)
915 return;
916
918 stmt->setUInt64(0, m_GUIDLow);
919 stmt->setUInt8(1, type);
920 stmt->setInt64(2, time);
921 stmt->setString(3, data);
922 CharacterDatabase.Execute(stmt);
923 }
924
925 _accountData[type].Time = time;
926 _accountData[type].Data = data;
927}
928
930{
932 accountDataTimes.PlayerGuid = playerGuid;
933 accountDataTimes.ServerTime = GameTime::GetSystemTime();
934 for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
935 if (mask & (1 << i))
936 accountDataTimes.AccountTimes[i] = GetAccountData(AccountDataType(i))->Time;
937
938 SendPacket(accountDataTimes.Write());
939}
940
942{
943 _tutorials = { };
944
945 if (result)
946 {
947 for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
948 _tutorials[i] = (*result)[i].GetUInt32();
950 }
951
952 _tutorialsChanged &= ~TUTORIALS_FLAG_CHANGED;
953}
954
961
963{
965 return;
966
967 bool const hasTutorialsInDB = (_tutorialsChanged & TUTORIALS_FLAG_LOADED_FROM_DB) != 0;
968 CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(hasTutorialsInDB ? CHAR_UPD_TUTORIALS : CHAR_INS_TUTORIALS);
969 for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
970 stmt->setUInt32(i, _tutorials[i]);
972 trans->Append(stmt);
973
974 // now has, set flag so next save uses update query
975 if (!hasTutorialsInDB)
977
978 _tutorialsChanged &= ~TUTORIALS_FLAG_CHANGED;
979}
980
982{
983 if (elementsResult)
984 {
985 do
986 {
987 DEFINE_FIELD_ACCESSOR_CACHE_ANONYMOUS(PreparedResultSet, (playerDataElementAccountId)(floatValue)(int64Value)) fields { *elementsResult };
988
989 PlayerDataElementAccountEntry const* entry = sPlayerDataElementAccountStore.LookupEntry(fields.playerDataElementAccountId().GetUInt32());
990 if (!entry)
991 continue;
992
994 element.Id = entry->ID;
995 element.NeedSave = false;
996
997 switch (entry->GetType())
998 {
1000 element.Int64Value = fields.int64Value().GetInt64();
1001 break;
1003 element.FloatValue = fields.floatValue().GetFloat();
1004 break;
1005 default:
1006 break;
1007 }
1008 } while (elementsResult->NextRow());
1009 }
1010
1011 if (flagsResult)
1012 {
1013 do
1014 {
1015 DEFINE_FIELD_ACCESSOR_CACHE_ANONYMOUS(PreparedResultSet, (storageIndex)(mask)) fields { *flagsResult };
1016
1017 Trinity::Containers::EnsureWritableVectorIndex(_playerDataAccount.Flags, fields.storageIndex().GetUInt32()) = { .Value = fields.mask().GetUInt64(), .NeedSave = false };
1018 } while (flagsResult->NextRow());
1019 }
1020}
1021
1023{
1026 {
1027 if (!element.NeedSave)
1028 continue;
1029
1031 stmt->setUInt32(0, GetBattlenetAccountId());
1032 stmt->setUInt32(1, element.Id);
1033 transaction->Append(stmt);
1034
1035 element.NeedSave = false;
1036
1037 PlayerDataElementAccountEntry const* entry = sPlayerDataElementAccountStore.LookupEntry(element.Id);
1038 if (!entry)
1039 continue;
1040
1041 switch (entry->GetType())
1042 {
1044 if (!element.Int64Value)
1045 continue;
1047 stmt->setUInt32(0, GetBattlenetAccountId());
1048 stmt->setUInt32(1, element.Id);
1049 stmt->setNull(2);
1050 stmt->setInt64(3, element.Int64Value);
1051 transaction->Append(stmt);
1052 break;
1054 if (!element.FloatValue)
1055 continue;
1057 stmt->setUInt32(0, GetBattlenetAccountId());
1058 stmt->setUInt32(1, element.Id);
1059 stmt->setFloat(2, element.FloatValue);
1060 stmt->setNull(3);
1061 transaction->Append(stmt);
1062 break;
1063 }
1064 }
1065
1066 for (std::size_t i = 0; i < _playerDataAccount.Flags.size(); ++i)
1067 {
1069 if (!flag.NeedSave)
1070 continue;
1071
1072 stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_BNET_PLAYER_DATA_FLAGS_ACCOUNT);
1073 stmt->setUInt32(0, GetBattlenetAccountId());
1074 stmt->setUInt32(1, i);
1075 transaction->Append(stmt);
1076
1077 flag.NeedSave = false;
1078
1079 if (!flag.Value)
1080 continue;
1081
1082 stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_BNET_PLAYER_DATA_FLAGS_ACCOUNT);
1083 stmt->setUInt32(0, GetBattlenetAccountId());
1084 stmt->setUInt32(1, i);
1085 stmt->setUInt64(2, flag.Value);
1086 transaction->Append(stmt);
1087 }
1088}
1089
1091{
1092 auto elementItr = std::ranges::find(_playerDataAccount.Elements, dataElementId, &PlayerDataAccount::Element::Id);
1093 if (elementItr == _playerDataAccount.Elements.end())
1094 {
1095 elementItr = _playerDataAccount.Elements.emplace(_playerDataAccount.Elements.end());
1096 elementItr->Id = dataElementId;
1097 }
1098
1099 elementItr->NeedSave = true;
1100 elementItr->FloatValue = value;
1101}
1102
1104{
1105 auto elementItr = std::ranges::find(_playerDataAccount.Elements, dataElementId, &PlayerDataAccount::Element::Id);
1106 if (elementItr == _playerDataAccount.Elements.end())
1107 {
1108 elementItr = _playerDataAccount.Elements.emplace(_playerDataAccount.Elements.end());
1109 elementItr->Id = dataElementId;
1110 }
1111
1112 elementItr->NeedSave = true;
1113 elementItr->Int64Value = value;
1114}
1115
1117{
1118 PlayerDataFlagAccountEntry const* entry = sPlayerDataFlagAccountStore.LookupEntry(dataFlagId);
1119 if (!entry)
1120 return;
1121
1122 uint32 fieldOffset = entry->StorageIndex / PLAYER_DATA_FLAG_VALUE_BITS;
1123 uint64 flagValue = UI64LIT(1) << (entry->StorageIndex % PLAYER_DATA_FLAG_VALUE_BITS);
1124
1126 if (on)
1127 flag.Value |= flagValue;
1128 else
1129 flag.Value &= ~flagValue;
1130
1131 flag.NeedSave = true;
1132}
1133
1134bool WorldSession::IsAddonRegistered(std::string_view prefix) const
1135{
1136 if (!_filterAddonMessages) // if we have hit the softcap (64) nothing should be filtered
1137 return true;
1138
1140}
1141
1146
1148{
1149 // This is always sent after CMSG_CHAT_UNREGISTER_ALL_ADDON_PREFIXES
1152 {
1153 _filterAddonMessages = false;
1154 return;
1155 }
1156
1157 _filterAddonMessages = true;
1158}
1159
1161{
1162 _player = player;
1163
1164 // set m_GUID that can be used while player loggined and later until m_playerRecentlyLogout not reset
1165 if (_player)
1167}
1168
1175
1180
1185
1190
1192{
1193 uint32 id = GetAccountId();
1194 uint8 secLevel = GetSecurity();
1195
1196 TC_LOG_DEBUG("rbac", "WorldSession::LoadPermissions [AccountId: {}, Name: {}, realmId: {}, secLevel: {}]",
1197 id, _accountName, sRealmList->GetCurrentRealmId().Realm, secLevel);
1198
1199 _RBACData = new rbac::RBACData(id, _accountName, sRealmList->GetCurrentRealmId().Realm, secLevel);
1201}
1202
1204{
1205 uint32 id = GetAccountId();
1206 uint8 secLevel = GetSecurity();
1207
1208 TC_LOG_DEBUG("rbac", "WorldSession::LoadPermissions [AccountId: {}, Name: {}, realmId: {}, secLevel: {}]",
1209 id, _accountName, sRealmList->GetCurrentRealmId().Realm, secLevel);
1210
1211 _RBACData = new rbac::RBACData(id, _accountName, sRealmList->GetCurrentRealmId().Realm, secLevel);
1212 return _RBACData->LoadFromDBAsync();
1213}
1214
1216{
1217public:
1218 enum
1219 {
1222
1225
1227
1228 bool Initialize(uint32 accountId, uint32 /*battlenetAccountId*/)
1229 {
1230 bool ok = true;
1231
1233 stmt->setUInt32(0, accountId);
1234 ok = SetPreparedQuery(GLOBAL_ACCOUNT_DATA, stmt) && ok;
1235
1236 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_TUTORIALS);
1237 stmt->setUInt32(0, accountId);
1238 ok = SetPreparedQuery(TUTORIALS, stmt) && ok;
1239
1240 return ok;
1241 }
1242};
1243
1245{
1246public:
1247 enum
1248 {
1262
1265
1267
1268 bool Initialize(uint32 accountId, uint32 battlenetAccountId)
1269 {
1270 bool ok = true;
1271
1273 stmt->setUInt32(0, battlenetAccountId);
1274 ok = SetPreparedQuery(GLOBAL_ACCOUNT_TOYS, stmt) && ok;
1275
1276 stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BATTLE_PETS);
1277 stmt->setUInt32(0, battlenetAccountId);
1278 stmt->setInt32(1, sRealmList->GetCurrentRealmId().Realm);
1279 ok = SetPreparedQuery(BATTLE_PETS, stmt) && ok;
1280
1281 stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BATTLE_PET_SLOTS);
1282 stmt->setUInt32(0, battlenetAccountId);
1283 ok = SetPreparedQuery(BATTLE_PET_SLOTS, stmt) && ok;
1284
1285 stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_HEIRLOOMS);
1286 stmt->setUInt32(0, battlenetAccountId);
1288
1289 stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_MOUNTS);
1290 stmt->setUInt32(0, battlenetAccountId);
1291 ok = SetPreparedQuery(MOUNTS, stmt) && ok;
1292
1294 stmt->setUInt32(0, accountId);
1296
1297 stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_ITEM_APPEARANCES);
1298 stmt->setUInt32(0, battlenetAccountId);
1299 ok = SetPreparedQuery(ITEM_APPEARANCES, stmt) && ok;
1300
1301 stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_ITEM_FAVORITE_APPEARANCES);
1302 stmt->setUInt32(0, battlenetAccountId);
1304
1305 stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_TRANSMOG_ILLUSIONS);
1306 stmt->setUInt32(0, battlenetAccountId);
1307 ok = SetPreparedQuery(TRANSMOG_ILLUSIONS, stmt) && ok;
1308
1309 stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_TRANSMOG_OUTFITS);
1310 stmt->setUInt32(0, battlenetAccountId);
1311 ok = SetPreparedQuery(TRANSMOG_OUTFITS, stmt) && ok;
1312
1313 stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_WARBAND_SCENES);
1314 stmt->setUInt32(0, battlenetAccountId);
1315 ok = SetPreparedQuery(WARBAND_SCENES, stmt) && ok;
1316
1318 stmt->setUInt32(0, battlenetAccountId);
1320
1321 stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_PLAYER_DATA_FLAGS_ACCOUNT);
1322 stmt->setUInt32(0, battlenetAccountId);
1324
1325 return ok;
1326 }
1327};
1328
1330{
1331 std::shared_ptr<AccountInfoQueryHolderPerRealm> realmHolder = std::make_shared<AccountInfoQueryHolderPerRealm>();
1332 if (!realmHolder->Initialize(GetAccountId(), GetBattlenetAccountId()))
1333 {
1335 return;
1336 }
1337
1338 std::shared_ptr<AccountInfoQueryHolder> holder = std::make_shared<AccountInfoQueryHolder>();
1339 if (!holder->Initialize(GetAccountId(), GetBattlenetAccountId()))
1340 {
1342 return;
1343 }
1344
1345 struct ForkJoinState
1346 {
1347 std::shared_ptr<AccountInfoQueryHolderPerRealm> Character;
1348 std::shared_ptr<AccountInfoQueryHolder> Login;
1349 };
1350
1351 std::shared_ptr<ForkJoinState> state = std::make_shared<ForkJoinState>();
1352
1353 AddQueryHolderCallback(CharacterDatabase.DelayQueryHolder(realmHolder)).AfterComplete([this, state, realmHolder](SQLQueryHolderBase const& /*result*/)
1354 {
1355 state->Character = realmHolder;
1356 if (state->Login && state->Character)
1357 InitializeSessionCallback(*state->Login, *state->Character);
1358 });
1359
1360 AddQueryHolderCallback(LoginDatabase.DelayQueryHolder(holder)).AfterComplete([this, state, holder](SQLQueryHolderBase const& /*result*/)
1361 {
1362 state->Login = holder;
1363 if (state->Login && state->Character)
1364 InitializeSessionCallback(*state->Login, *state->Character);
1365 });
1366}
1367
1369{
1380
1381 if (!m_inQueue)
1382 SendAuthResponse(ERROR_OK, false);
1383 else
1385
1386 SetInQueue(false);
1387 ResetTimeOutTime(false);
1388
1395
1397 {
1398 do
1399 {
1400 Field* fields = characterCountsResult->Fetch();
1401 _realmCharacterCounts[Battlenet::RealmHandle{ fields[3].GetUInt8(), fields[4].GetUInt8(), fields[2].GetUInt32() }.GetAddress()] = fields[1].GetUInt8();
1402
1403 } while (characterCountsResult->NextRow());
1404 }
1405
1407 bnetConnected.State = 1;
1408 SendPacket(bnetConnected.Write());
1409
1412}
1413
1418
1420{
1421 if (!_RBACData)
1423
1424 bool hasPermission = _RBACData->HasPermission(permission);
1425 TC_LOG_DEBUG("rbac", "WorldSession::HasPermission [AccountId: {}, Name: {}, realmId: {}]",
1426 _RBACData->GetId(), _RBACData->GetName(), sRealmList->GetCurrentRealmId().Realm);
1427
1428 return hasPermission;
1429}
1430
1432{
1433 TC_LOG_DEBUG("rbac", "WorldSession::Invalidaterbac::RBACData [AccountId: {}, Name: {}, realmId: {}]",
1434 _RBACData->GetId(), _RBACData->GetName(), sRealmList->GetCurrentRealmId().Realm);
1435 delete _RBACData;
1436 _RBACData = nullptr;
1437}
1438
1440{
1441 uint32 maxPacketCounterAllowed = GetMaxPacketCounterAllowed(p.GetOpcode());
1442
1443 // Return true if there no limit for the opcode
1444 if (!maxPacketCounterAllowed)
1445 return true;
1446
1447 PacketCounter& packetCounter = _PacketThrottlingMap[p.GetOpcode()];
1448 if (packetCounter.lastReceiveTime != time)
1449 {
1450 packetCounter.lastReceiveTime = time;
1451 packetCounter.amountCounter = 0;
1452 }
1453
1454 // Check if player is flooding some packets
1455 if (++packetCounter.amountCounter <= maxPacketCounterAllowed)
1456 return true;
1457
1458 TC_LOG_WARN("network", "AntiDOS: Account {}, IP: {}, Ping: {}, Character: {}, flooding packet (opc: {} (0x{:X}), count: {})",
1460 opcodeTable[static_cast<OpcodeClient>(p.GetOpcode())]->Name, p.GetOpcode(), packetCounter.amountCounter);
1461
1462 switch (_policy)
1463 {
1464 case POLICY_LOG:
1465 return true;
1466 case POLICY_KICK:
1467 {
1468 TC_LOG_WARN("network", "AntiDOS: Player kicked!");
1469 Session->KickPlayer("WorldSession::DosProtection::EvaluateOpcode AntiDOS");
1470 return false;
1471 }
1472 case POLICY_BAN:
1473 {
1475 uint32 duration = sWorld->getIntConfig(CONFIG_PACKET_SPOOF_BANDURATION); // in seconds
1476 std::string nameOrIp = "";
1477 switch (bm)
1478 {
1479 case BAN_CHARACTER: // not supported, ban account
1480 case BAN_ACCOUNT: (void)sAccountMgr->GetName(Session->GetAccountId(), nameOrIp); break;
1481 case BAN_IP: nameOrIp = Session->GetRemoteAddress(); break;
1482 }
1483 sWorld->BanAccount(bm, nameOrIp, duration, "DOS (Packet Flooding/Spoofing", "Server: AutoDOS");
1484 TC_LOG_WARN("network", "AntiDOS: Player automatically banned for {} seconds.", duration);
1485 Session->KickPlayer("WorldSession::DosProtection::EvaluateOpcode AntiDOS");
1486 return false;
1487 }
1488 default: // invalid policy
1489 return true;
1490 }
1491}
1492
1494{
1495 uint32 maxPacketCounterAllowed;
1496 switch (opcode)
1497 {
1498 // CPU usage sending 2000 packets/second on a 3.70 GHz 4 cores on Win x64
1499 // [% CPU mysqld] [%CPU worldserver RelWithDebInfo]
1500 case CMSG_PLAYER_LOGIN: // 0 0.5
1501 case CMSG_QUERY_PLAYER_NAMES: // 0 1
1502 case CMSG_QUERY_PET_NAME: // 0 1
1503 case CMSG_QUERY_NPC_TEXT: // 0 1
1504 case CMSG_ATTACK_STOP: // 0 1
1505 case CMSG_QUERY_TIME: // 0 1
1506 case CMSG_QUERY_CORPSE_TRANSPORT: // 0 1
1507 case CMSG_MOVE_TIME_SKIPPED: // 0 1
1508 case CMSG_QUERY_NEXT_MAIL_TIME: // 0 1
1509 case CMSG_SET_SHEATHED: // 0 1
1510 case CMSG_UPDATE_RAID_TARGET: // 0 1
1511 case CMSG_LOGOUT_REQUEST: // 0 1
1512 case CMSG_PET_RENAME: // 0 1
1514 case CMSG_COMPLETE_CINEMATIC: // 0 1
1515 case CMSG_BANKER_ACTIVATE: // 0 1
1516 case CMSG_BUY_ACCOUNT_BANK_TAB: // 0 1
1517 case CMSG_OPT_OUT_OF_LOOT: // 0 1
1518 case CMSG_DUEL_RESPONSE: // 0 1
1519 case CMSG_CALENDAR_COMPLAIN: // 0 1
1520 case CMSG_QUERY_QUEST_INFO: // 0 1.5
1521 case CMSG_QUERY_GAME_OBJECT: // 0 1.5
1522 case CMSG_QUERY_CREATURE: // 0 1.5
1523 case CMSG_QUEST_GIVER_STATUS_QUERY: // 0 1.5
1524 case CMSG_QUERY_GUILD_INFO: // 0 1.5
1525 case CMSG_TAXI_NODE_STATUS_QUERY: // 0 1.5
1526 case CMSG_TAXI_QUERY_AVAILABLE_NODES: // 0 1.5
1527 case CMSG_QUEST_GIVER_QUERY_QUEST: // 0 1.5
1528 case CMSG_QUERY_PAGE_TEXT: // 0 1.5
1529 case CMSG_GUILD_BANK_TEXT_QUERY: // 0 1.5
1531 case CMSG_MOVE_SET_FACING: // 0 1.5
1532 case CMSG_MOVE_SET_FACING_HEARTBEAT: // 0 1.5
1533 case CMSG_MOVE_SET_PITCH: // 0 1.5
1534 case CMSG_REQUEST_PARTY_MEMBER_STATS: // 0 1.5
1535 case CMSG_QUEST_GIVER_COMPLETE_QUEST: // 0 1.5
1536 case CMSG_SET_ACTION_BUTTON: // 0 1.5
1537 case CMSG_SET_ACTION_BAR_TOGGLES: // not profiled
1538 case CMSG_RESET_INSTANCES: // 0 1.5
1539 case CMSG_HEARTH_AND_RESURRECT: // 0 1.5
1540 case CMSG_TOGGLE_PVP: // 0 1.5
1541 case CMSG_PET_ABANDON: // 0 1.5
1542 case CMSG_ACTIVATE_TAXI: // 0 1.5
1543 case CMSG_SELF_RES: // 0 1.5
1544 case CMSG_UNLEARN_SKILL: // 0 1.5
1545 case CMSG_SAVE_EQUIPMENT_SET: // 0 1.5
1546 case CMSG_DELETE_EQUIPMENT_SET: // 0 1.5
1547 case CMSG_DISMISS_CRITTER: // 0 1.5
1548 case CMSG_REPOP_REQUEST: // 0 1.5
1549 case CMSG_PARTY_INVITE: // 0 1.5
1550 case CMSG_PARTY_INVITE_RESPONSE: // 0 1.5
1551 case CMSG_PARTY_UNINVITE: // 0 1.5
1552 case CMSG_LEAVE_GROUP: // 0 1.5
1553 case CMSG_BATTLEMASTER_JOIN_ARENA: // 0 1.5
1554 case CMSG_BATTLEFIELD_LEAVE: // 0 1.5
1555 case CMSG_GUILD_BANK_LOG_QUERY: // 0 2
1556 case CMSG_LOGOUT_CANCEL: // 0 2
1557 case CMSG_ALTER_APPEARANCE: // 0 2
1558 case CMSG_QUEST_CONFIRM_ACCEPT: // 0 2
1559 case CMSG_GUILD_EVENT_LOG_QUERY: // 0 2.5
1561 case CMSG_BEGIN_TRADE: // 0 2.5
1562 case CMSG_INITIATE_TRADE: // 0 3
1563 case CMSG_CHAT_ADDON_MESSAGE: // 0 3.5
1565 case CMSG_CHAT_MESSAGE_AFK: // 0 3.5
1566 case CMSG_CHAT_MESSAGE_CHANNEL: // 0 3.5
1567 case CMSG_CHAT_MESSAGE_DND: // 0 3.5
1568 case CMSG_CHAT_MESSAGE_EMOTE: // 0 3.5
1569 case CMSG_CHAT_MESSAGE_GUILD: // 0 3.5
1570 case CMSG_CHAT_MESSAGE_OFFICER: // 0 3.5
1571 case CMSG_CHAT_MESSAGE_PARTY: // 0 3.5
1572 case CMSG_CHAT_MESSAGE_RAID: // 0 3.5
1573 case CMSG_CHAT_MESSAGE_RAID_WARNING: // 0 3.5
1574 case CMSG_CHAT_MESSAGE_SAY: // 0 3.5
1575 case CMSG_CHAT_MESSAGE_WHISPER: // 0 3.5
1576 case CMSG_CHAT_MESSAGE_YELL: // 0 3.5
1577 case CMSG_INSPECT: // 0 3.5
1578 case CMSG_AREA_SPIRIT_HEALER_QUERY: // not profiled
1579 case CMSG_STAND_STATE_CHANGE: // not profiled
1580 case CMSG_RANDOM_ROLL: // not profiled
1581 case CMSG_TIME_SYNC_RESPONSE: // not profiled
1582 case CMSG_MOVE_FORCE_RUN_SPEED_CHANGE_ACK: // not profiled
1583 case CMSG_MOVE_FORCE_SWIM_SPEED_CHANGE_ACK: // not profiled
1585 case CMSG_MOVE_FORCE_RUN_BACK_SPEED_CHANGE_ACK: // not profiled
1586 case CMSG_MOVE_FORCE_FLIGHT_SPEED_CHANGE_ACK: // not profiled
1588 case CMSG_MOVE_FORCE_WALK_SPEED_CHANGE_ACK: // not profiled
1589 case CMSG_MOVE_FORCE_TURN_RATE_CHANGE_ACK: // not profiled
1590 case CMSG_MOVE_FORCE_PITCH_RATE_CHANGE_ACK: // not profiled
1591 {
1592 // "0" is a magic number meaning there's no limit for the opcode.
1593 // All the opcodes above must cause little CPU usage and no sync/async database queries at all
1594 maxPacketCounterAllowed = 0;
1595 break;
1596 }
1597
1599 case CMSG_QUEST_LOG_REMOVE_QUEST: // 0 4
1601 case CMSG_SEND_CONTACT_LIST: // 0 5
1602 case CMSG_AUTOBANK_ITEM: // 0 6
1603 case CMSG_AUTOSTORE_BANK_ITEM: // 0 6
1604 case CMSG_WHO: // 0 7
1605 case CMSG_RIDE_VEHICLE_INTERACT: // 0 8
1607 {
1608 maxPacketCounterAllowed = 200;
1609 break;
1610 }
1611
1612 case CMSG_GUILD_SET_MEMBER_NOTE: // 1 2 1 async db query
1613 case CMSG_SET_CONTACT_NOTES: // 1 2.5 1 async db query
1614 case CMSG_CALENDAR_GET: // 0 1.5 medium upload bandwidth usage
1615 case CMSG_GUILD_BANK_QUERY_TAB: // 0 3.5 medium upload bandwidth usage
1616 case CMSG_QUERY_INSPECT_ACHIEVEMENTS: // 0 13 high upload bandwidth usage
1617 case CMSG_GAME_OBJ_REPORT_USE: // not profiled
1618 case CMSG_GAME_OBJ_USE: // not profiled
1619 case CMSG_DECLINE_PETITION: // not profiled
1620 {
1621 maxPacketCounterAllowed = 50;
1622 break;
1623 }
1624
1625 case CMSG_QUEST_POI_QUERY: // 0 25 very high upload bandwidth usage
1626 {
1627 maxPacketCounterAllowed = MAX_QUEST_LOG_SIZE;
1628 break;
1629 }
1630
1631 case CMSG_SPELL_CLICK: // not profiled
1632 case CMSG_MOVE_DISMISS_VEHICLE: // not profiled
1633 {
1634 maxPacketCounterAllowed = 20;
1635 break;
1636 }
1637
1638 case CMSG_SIGN_PETITION: // 9 4 2 sync 1 async db queries
1639 case CMSG_TURN_IN_PETITION: // 8 5.5 2 sync db query
1640 case CMSG_CHANGE_SUB_GROUP: // 6 5 1 sync 1 async db queries
1641 case CMSG_QUERY_PETITION: // 4 3.5 1 sync db query
1642 case CMSG_CHAR_CUSTOMIZE: // 5 5 1 sync db query
1643 case CMSG_CHAR_RACE_OR_FACTION_CHANGE: // 5 5 1 sync db query
1644 case CMSG_CHAR_DELETE: // 4 4 1 sync db query
1645 case CMSG_DEL_FRIEND: // 7 5 1 async db query
1646 case CMSG_ADD_FRIEND: // 6 4 1 async db query
1647 case CMSG_CHARACTER_RENAME_REQUEST: // 5 3 1 async db query
1648 case CMSG_BUG_REPORT: // 1 1 1 async db query
1649 case CMSG_SET_PARTY_LEADER: // 1 2 1 async db query
1650 case CMSG_CONVERT_RAID: // 1 5 1 async db query
1651 case CMSG_SET_ASSISTANT_LEADER: // 1 2 1 async db query
1652 case CMSG_MOVE_CHANGE_VEHICLE_SEATS: // not profiled
1653 case CMSG_PETITION_BUY: // not profiled 1 sync 1 async db queries
1654 case CMSG_REQUEST_VEHICLE_PREV_SEAT: // not profiled
1655 case CMSG_REQUEST_VEHICLE_NEXT_SEAT: // not profiled
1656 case CMSG_REQUEST_VEHICLE_SWITCH_SEAT: // not profiled
1657 case CMSG_REQUEST_VEHICLE_EXIT: // not profiled
1658 case CMSG_EJECT_PASSENGER: // not profiled
1659 case CMSG_ITEM_PURCHASE_REFUND: // not profiled
1660 case CMSG_SOCKET_GEMS: // not profiled
1661 case CMSG_WRAP_ITEM: // not profiled
1662 case CMSG_REPORT_PVP_PLAYER_AFK: // not profiled
1663 {
1664 maxPacketCounterAllowed = 10;
1665 break;
1666 }
1667
1668 case CMSG_CREATE_CHARACTER: // 7 5 3 async db queries
1669 case CMSG_ENUM_CHARACTERS: // 22 3 2 async db queries
1670 case CMSG_ENUM_CHARACTERS_DELETED_BY_CLIENT: // 22 3 2 async db queries
1671 case CMSG_SUBMIT_USER_FEEDBACK: // not profiled 1 async db query
1672 case CMSG_SUPPORT_TICKET_SUBMIT_COMPLAINT: // not profiled 1 async db query
1673 case CMSG_CALENDAR_ADD_EVENT: // 21 10 2 async db query
1674 case CMSG_CALENDAR_UPDATE_EVENT: // not profiled
1675 case CMSG_CALENDAR_REMOVE_EVENT: // not profiled
1676 case CMSG_CALENDAR_COPY_EVENT: // not profiled
1677 case CMSG_CALENDAR_INVITE: // not profiled
1678 case CMSG_CALENDAR_EVENT_SIGN_UP: // not profiled
1679 case CMSG_CALENDAR_RSVP: // not profiled
1680 case CMSG_CALENDAR_MODERATOR_STATUS: // not profiled
1681 case CMSG_CALENDAR_REMOVE_INVITE: // not profiled
1682 case CMSG_SET_LOOT_METHOD: // not profiled
1683 case CMSG_GUILD_INVITE_BY_NAME: // not profiled
1684 case CMSG_ACCEPT_GUILD_INVITE: // not profiled
1685 case CMSG_GUILD_DECLINE_INVITATION: // not profiled
1686 case CMSG_GUILD_LEAVE: // not profiled
1687 case CMSG_GUILD_DELETE: // not profiled
1688 case CMSG_GUILD_SET_GUILD_MASTER: // not profiled
1689 case CMSG_GUILD_UPDATE_MOTD_TEXT: // not profiled
1690 case CMSG_GUILD_SET_RANK_PERMISSIONS: // not profiled
1691 case CMSG_GUILD_ADD_RANK: // not profiled
1692 case CMSG_GUILD_DELETE_RANK: // not profiled
1693 case CMSG_GUILD_UPDATE_INFO_TEXT: // not profiled
1694 case CMSG_GUILD_BANK_DEPOSIT_MONEY: // not profiled
1695 case CMSG_GUILD_BANK_WITHDRAW_MONEY: // not profiled
1696 case CMSG_GUILD_BANK_BUY_TAB: // not profiled
1697 case CMSG_GUILD_BANK_UPDATE_TAB: // not profiled
1698 case CMSG_GUILD_BANK_SET_TAB_TEXT: // not profiled
1699 case CMSG_SAVE_GUILD_EMBLEM: // not profiled
1700 case CMSG_PETITION_RENAME_GUILD: // not profiled
1701 case CMSG_CONFIRM_RESPEC_WIPE: // not profiled
1702 case CMSG_SET_DUNGEON_DIFFICULTY: // not profiled
1703 case CMSG_SET_RAID_DIFFICULTY: // not profiled
1704 case CMSG_SET_PARTY_ASSIGNMENT: // not profiled
1705 case CMSG_DO_READY_CHECK: // not profiled
1706 {
1707 maxPacketCounterAllowed = 3;
1708 break;
1709 }
1710
1711 case CMSG_GET_ITEM_PURCHASE_DATA: // not profiled
1712 {
1713 maxPacketCounterAllowed = PLAYER_SLOTS_COUNT + MAX_BAG_SIZE * (
1718 break;
1719 }
1720 case CMSG_HOTFIX_REQUEST: // not profiled
1721 {
1722 maxPacketCounterAllowed = 1;
1723 break;
1724 }
1725 case CMSG_CHECK_IS_ADVENTURE_MAP_POI_VALID: // not profiled
1726 {
1727 // 12.0.1: all entries of the db2 are sent
1728 maxPacketCounterAllowed = sAdventureMapPOIStore.GetNumRows();
1729 break;
1730 }
1731 default:
1732 {
1733 maxPacketCounterAllowed = 100;
1734 break;
1735 }
1736 }
1737
1738 return maxPacketCounterAllowed;
1739}
1740
1744
1750
1752{
1754 timeSyncRequest.SequenceIndex = _timeSyncNextCounter;
1755 SendPacket(timeSyncRequest.Write());
1756
1758
1759 // Schedule next sync in 10 sec (except for the 2 first packets, which are spaced by only 5s)
1760 _timeSyncTimer = _timeSyncNextCounter == 0 ? 5000 : 10000;
1762}
1763
1768
1770{
1771 int64 movementTime = int64(time) + _timeSyncClockDelta;
1772 if (_timeSyncClockDelta == 0 || movementTime < 0 || movementTime > 0xFFFFFFFF)
1773 {
1774 TC_LOG_WARN("misc", "The computed movement time using clockDelta is erronous. Using fallback instead");
1775 return GameTime::GetGameTimeMS();
1776 }
1777 else
1778 return uint32(movementTime);
1779}
#define sAccountMgr
Definition AccountMgr.h:104
#define MAX_BAG_SIZE
Definition Bag.h:22
#define sBattlegroundMgr
@ ERROR_TIMED_OUT
@ CHAR_INS_TUTORIALS
@ CHAR_UPD_TUTORIALS
@ CHAR_SEL_TUTORIALS
@ CHAR_SEL_ACCOUNT_DATA
@ CHAR_UPD_ACCOUNT_ONLINE
@ CHAR_REP_PLAYER_ACCOUNT_DATA
@ CHAR_REP_ACCOUNT_DATA
LocaleConstant
Definition Common.h:51
AccountTypes
Definition Common.h:42
DB2Storage< PlayerDataElementAccountEntry > sPlayerDataElementAccountStore("PlayerDataElementAccount.db2", &PlayerDataElementAccountLoadInfo::Instance)
DB2Storage< AdventureMapPOIEntry > sAdventureMapPOIStore("AdventureMapPOI.db2", &AdventureMapPoiLoadInfo::Instance)
DB2Storage< PlayerDataFlagAccountEntry > sPlayerDataFlagAccountStore("PlayerDataFlagAccount.db2", &PlayerDataFlagAccountLoadInfo::Instance)
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
SQLTransaction< LoginDatabaseConnection > LoginDatabaseTransaction
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:156
int64_t int64
Definition Define.h:149
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
#define UI64LIT(N)
Definition Define.h:139
uint32_t uint32
Definition Define.h:154
std::chrono::minutes Minutes
Minutes shorthand typedef.
Definition Duration.h:32
#define sGuildMgr
Definition GuildMgr.h:76
@ LOG_LEVEL_TRACE
Definition LogCommon.h:27
#define TC_LOG_DEBUG(filterType__, message__,...)
Definition Log.h:181
#define TC_LOG_ERROR(filterType__, message__,...)
Definition Log.h:190
#define TC_LOG_INFO(filterType__, message__,...)
Definition Log.h:184
#define sLog
Definition Log.h:156
#define TC_LOG_WARN(filterType__, message__,...)
Definition Log.h:187
#define TC_LOG_TRACE(filterType__, message__,...)
Definition Log.h:178
@ LOGIN_SEL_BATTLE_PETS
@ LOGIN_SEL_BNET_ITEM_FAVORITE_APPEARANCES
@ LOGIN_INS_BNET_PLAYER_DATA_ELEMENTS_ACCOUNT
@ LOGIN_SEL_ACCOUNT_TOYS
@ LOGIN_SEL_BNET_PLAYER_DATA_FLAGS_ACCOUNT
@ LOGIN_SEL_ACCOUNT_MOUNTS
@ LOGIN_SEL_BNET_CHARACTER_COUNTS_BY_ACCOUNT_ID
@ LOGIN_SEL_BNET_TRANSMOG_OUTFITS
@ LOGIN_DEL_BNET_PLAYER_DATA_ELEMENTS_ACCOUNT
@ LOGIN_SEL_ACCOUNT_HEIRLOOMS
@ LOGIN_SEL_BNET_TRANSMOG_ILLUSIONS
@ LOGIN_DEL_BNET_PLAYER_DATA_FLAGS_ACCOUNT
@ LOGIN_SEL_BNET_WARBAND_SCENES
@ LOGIN_INS_BNET_PLAYER_DATA_FLAGS_ACCOUNT
@ LOGIN_SEL_BATTLE_PET_SLOTS
@ LOGIN_SEL_BNET_ITEM_APPEARANCES
@ LOGIN_SEL_BNET_PLAYER_DATA_ELEMENTS_ACCOUNT
#define TC_METRIC_DETAILED_TIMER(category,...)
Definition Metric.h:240
#define TC_METRIC_VALUE(category, value,...)
Definition Metric.h:206
#define TC_METRIC_EVENT(category, title, description)
Definition Metric.h:201
#define TC_METRIC_TAG(name, value)
Definition Metric.h:187
#define sObjectMgr
Definition ObjectMgr.h:1885
OpcodeTable opcodeTable
Definition Opcodes.cpp:37
constexpr uint32 UNKNOWN_OPCODE
Definition Opcodes.h:35
ConnectionType
Definition Opcodes.h:27
@ CONNECTION_TYPE_INSTANCE
Definition Opcodes.h:29
@ CONNECTION_TYPE_DEFAULT
Definition Opcodes.h:32
@ CONNECTION_TYPE_REALM
Definition Opcodes.h:28
constexpr bool IsInstanceOnlyOpcode(uint32 opcode)
Definition Opcodes.h:2522
OpcodeServer
Definition Opcodes.h:1085
constexpr FormattedOpcodeName< OpcodeClient > GetOpcodeNameForLogging(OpcodeClient opcode)
Lookup opcode name for human understandable logging.
Definition Opcodes.h:2603
@ STATUS_IGNORED
Definition Opcodes.h:2552
@ STATUS_LOGGEDIN
Definition Opcodes.h:2547
@ STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT
Definition Opcodes.h:2549
@ STATUS_TRANSFER
Definition Opcodes.h:2548
@ STATUS_NEVER
Definition Opcodes.h:2550
@ STATUS_AUTHED
Definition Opcodes.h:2546
@ STATUS_UNHANDLED
Definition Opcodes.h:2551
@ PROCESS_INPLACE
Definition Opcodes.h:2557
@ PROCESS_THREADUNSAFE
Definition Opcodes.h:2558
OpcodeClient
Definition Opcodes.h:38
@ CMSG_TIME_SYNC_RESPONSE
Definition Opcodes.h:989
@ CMSG_QUERY_PAGE_TEXT
Definition Opcodes.h:770
@ CMSG_TURN_IN_PETITION
Definition Opcodes.h:1007
@ CMSG_CALENDAR_ADD_EVENT
Definition Opcodes.h:149
@ CMSG_ATTACK_STOP
Definition Opcodes.h:66
@ CMSG_SEND_CONTACT_LIST
Definition Opcodes.h:889
@ CMSG_CALENDAR_RSVP
Definition Opcodes.h:161
@ CMSG_ENUM_CHARACTERS
Definition Opcodes.h:345
@ CMSG_CHAT_MESSAGE_YELL
Definition Opcodes.h:228
@ CMSG_EJECT_PASSENGER
Definition Opcodes.h:338
@ CMSG_QUERY_GAME_OBJECT
Definition Opcodes.h:763
@ CMSG_LOGOUT_REQUEST
Definition Opcodes.h:558
@ CMSG_CHAT_MESSAGE_WHISPER
Definition Opcodes.h:227
@ CMSG_PET_RENAME
Definition Opcodes.h:750
@ CMSG_GUILD_SET_RANK_PERMISSIONS
Definition Opcodes.h:449
@ CMSG_CHAT_ADDON_MESSAGE_TARGETED
Definition Opcodes.h:193
@ CMSG_CHAT_MESSAGE_EMOTE
Definition Opcodes.h:219
@ CMSG_SET_SHEATHED
Definition Opcodes.h:933
@ CMSG_REQUEST_VEHICLE_SWITCH_SEAT
Definition Opcodes.h:865
@ CMSG_REPOP_REQUEST
Definition Opcodes.h:826
@ CMSG_PET_ABANDON
Definition Opcodes.h:736
@ CMSG_CHAT_MESSAGE_CHANNEL
Definition Opcodes.h:217
@ CMSG_QUEST_CONFIRM_ACCEPT
Definition Opcodes.h:785
@ CMSG_DELETE_EQUIPMENT_SET
Definition Opcodes.h:317
@ CMSG_TOGGLE_PVP
Definition Opcodes.h:993
@ CMSG_GUILD_BANK_DEPOSIT_MONEY
Definition Opcodes.h:411
@ CMSG_SUBMIT_USER_FEEDBACK
Definition Opcodes.h:970
@ CMSG_GUILD_LEAVE
Definition Opcodes.h:431
@ CMSG_CHANGE_SUB_GROUP
Definition Opcodes.h:184
@ CMSG_CHAT_MESSAGE_GUILD
Definition Opcodes.h:220
@ CMSG_GUILD_SET_GUILD_MASTER
Definition Opcodes.h:447
@ CMSG_CONVERT_RAID
Definition Opcodes.h:297
@ CMSG_GUILD_BANK_WITHDRAW_MONEY
Definition Opcodes.h:418
@ CMSG_SET_CONTACT_NOTES
Definition Opcodes.h:906
@ CMSG_MOVE_FORCE_SWIM_SPEED_CHANGE_ACK
Definition Opcodes.h:612
@ CMSG_CALENDAR_REMOVE_INVITE
Definition Opcodes.h:160
@ CMSG_GUILD_DELETE_RANK
Definition Opcodes.h:423
@ CMSG_SET_ACTION_BAR_TOGGLES
Definition Opcodes.h:897
@ CMSG_CALENDAR_EVENT_SIGN_UP
Definition Opcodes.h:153
@ CMSG_SAVE_EQUIPMENT_SET
Definition Opcodes.h:876
@ CMSG_QUEST_POI_QUERY
Definition Opcodes.h:797
@ CMSG_SIGN_PETITION
Definition Opcodes.h:945
@ CMSG_SOCKET_GEMS
Definition Opcodes.h:948
@ CMSG_QUERY_CREATURE
Definition Opcodes.h:762
@ CMSG_MOVE_DISMISS_VEHICLE
Definition Opcodes.h:595
@ CMSG_CALENDAR_INVITE
Definition Opcodes.h:157
@ CMSG_SUPPORT_TICKET_SUBMIT_COMPLAINT
Definition Opcodes.h:973
@ CMSG_MOVE_HEARTBEAT
Definition Opcodes.h:619
@ CMSG_DUEL_RESPONSE
Definition Opcodes.h:337
@ CMSG_MOVE_TIME_SKIPPED
Definition Opcodes.h:681
@ CMSG_MOVE_FORCE_TURN_RATE_CHANGE_ACK
Definition Opcodes.h:613
@ CMSG_QUEST_GIVER_QUERY_QUEST
Definition Opcodes.h:792
@ CMSG_COMPLETE_CINEMATIC
Definition Opcodes.h:279
@ CMSG_QUEST_GIVER_REQUEST_REWARD
Definition Opcodes.h:793
@ CMSG_SELF_RES
Definition Opcodes.h:885
@ CMSG_ACTIVATE_TAXI
Definition Opcodes.h:49
@ CMSG_REQUEST_VEHICLE_NEXT_SEAT
Definition Opcodes.h:863
@ CMSG_REQUEST_VEHICLE_PREV_SEAT
Definition Opcodes.h:864
@ CMSG_RANDOM_ROLL
Definition Opcodes.h:813
@ CMSG_DECLINE_PETITION
Definition Opcodes.h:316
@ CMSG_REQUEST_VEHICLE_EXIT
Definition Opcodes.h:862
@ CMSG_SET_ASSISTANT_LEADER
Definition Opcodes.h:902
@ CMSG_CHAT_MESSAGE_RAID_WARNING
Definition Opcodes.h:225
@ CMSG_MOVE_FORCE_WALK_SPEED_CHANGE_ACK
Definition Opcodes.h:615
@ CMSG_ACCEPT_GUILD_INVITE
Definition Opcodes.h:40
@ CMSG_OPT_OUT_OF_LOOT
Definition Opcodes.h:718
@ CMSG_MOVE_FORCE_FLIGHT_SPEED_CHANGE_ACK
Definition Opcodes.h:605
@ CMSG_DO_READY_CHECK
Definition Opcodes.h:336
@ CMSG_CALENDAR_COMPLAIN
Definition Opcodes.h:151
@ CMSG_CHAT_MESSAGE_SAY
Definition Opcodes.h:226
@ CMSG_AUTOSTORE_BANK_ITEM
Definition Opcodes.h:89
@ CMSG_CHAT_MESSAGE_AFK
Definition Opcodes.h:216
@ CMSG_GUILD_ADD_RANK
Definition Opcodes.h:407
@ CMSG_DISMISS_CRITTER
Definition Opcodes.h:333
@ CMSG_BUG_REPORT
Definition Opcodes.h:141
@ CMSG_QUEST_GIVER_COMPLETE_QUEST
Definition Opcodes.h:790
@ CMSG_CHAR_DELETE
Definition Opcodes.h:190
@ CMSG_CHAR_RACE_OR_FACTION_CHANGE
Definition Opcodes.h:191
@ CMSG_STAND_STATE_CHANGE
Definition Opcodes.h:964
@ CMSG_ENUM_CHARACTERS_DELETED_BY_CLIENT
Definition Opcodes.h:346
@ CMSG_CONFIRM_RESPEC_WIPE
Definition Opcodes.h:283
@ CMSG_AUTOBANK_ITEM
Definition Opcodes.h:88
@ CMSG_CHAR_CUSTOMIZE
Definition Opcodes.h:189
@ CMSG_SET_PARTY_LEADER
Definition Opcodes.h:921
@ CMSG_CHAT_MESSAGE_RAID
Definition Opcodes.h:224
@ CMSG_CHARACTER_RENAME_REQUEST
Definition Opcodes.h:186
@ CMSG_BANKER_ACTIVATE
Definition Opcodes.h:101
@ CMSG_MOVE_FORCE_RUN_SPEED_CHANGE_ACK
Definition Opcodes.h:610
@ CMSG_LEAVE_GROUP
Definition Opcodes.h:524
@ CMSG_CALENDAR_COPY_EVENT
Definition Opcodes.h:152
@ CMSG_CHAT_MESSAGE_DND
Definition Opcodes.h:218
@ CMSG_MOVE_FORCE_RUN_BACK_SPEED_CHANGE_ACK
Definition Opcodes.h:609
@ CMSG_QUERY_INSPECT_ACHIEVEMENTS
Definition Opcodes.h:766
@ CMSG_MOVE_SET_FACING
Definition Opcodes.h:651
@ CMSG_MOVE_FORCE_SWIM_BACK_SPEED_CHANGE_ACK
Definition Opcodes.h:611
@ CMSG_CALENDAR_MODERATOR_STATUS
Definition Opcodes.h:158
@ CMSG_ALTER_APPEARANCE
Definition Opcodes.h:59
@ CMSG_TAXI_NODE_STATUS_QUERY
Definition Opcodes.h:984
@ CMSG_QUERY_QUEST_INFO
Definition Opcodes.h:777
@ CMSG_QUEST_GIVER_CHOOSE_REWARD
Definition Opcodes.h:788
@ CMSG_GUILD_UPDATE_MOTD_TEXT
Definition Opcodes.h:452
@ CMSG_SET_ACTION_BUTTON
Definition Opcodes.h:898
@ CMSG_WRAP_ITEM
Definition Opcodes.h:1043
@ CMSG_GUILD_DECLINE_INVITATION
Definition Opcodes.h:421
@ CMSG_RIDE_VEHICLE_INTERACT
Definition Opcodes.h:873
@ CMSG_MOVE_CHANGE_VEHICLE_SEATS
Definition Opcodes.h:590
@ CMSG_GET_ITEM_PURCHASE_DATA
Definition Opcodes.h:389
@ CMSG_QUEST_GIVER_ACCEPT_QUEST
Definition Opcodes.h:787
@ CMSG_GAME_OBJ_REPORT_USE
Definition Opcodes.h:350
@ CMSG_QUERY_PETITION
Definition Opcodes.h:771
@ CMSG_SET_DUNGEON_DIFFICULTY
Definition Opcodes.h:909
@ CMSG_GUILD_BANK_LOG_QUERY
Definition Opcodes.h:412
@ CMSG_BEGIN_TRADE
Definition Opcodes.h:135
@ CMSG_INSPECT
Definition Opcodes.h:509
@ CMSG_MOVE_FORCE_PITCH_RATE_CHANGE_ACK
Definition Opcodes.h:607
@ CMSG_QUERY_NPC_TEXT
Definition Opcodes.h:769
@ CMSG_QUEST_GIVER_STATUS_QUERY
Definition Opcodes.h:795
@ CMSG_AREA_SPIRIT_HEALER_QUERY
Definition Opcodes.h:60
@ CMSG_SET_PARTY_ASSIGNMENT
Definition Opcodes.h:920
@ CMSG_DEL_FRIEND
Definition Opcodes.h:319
@ CMSG_GUILD_BANK_TEXT_QUERY
Definition Opcodes.h:416
@ CMSG_TAXI_QUERY_AVAILABLE_NODES
Definition Opcodes.h:985
@ CMSG_QUEST_LOG_REMOVE_QUEST
Definition Opcodes.h:796
@ CMSG_MOVE_SET_PITCH
Definition Opcodes.h:656
@ CMSG_QUERY_NEXT_MAIL_TIME
Definition Opcodes.h:768
@ CMSG_QUEST_GIVER_STATUS_MULTIPLE_QUERY
Definition Opcodes.h:794
@ CMSG_GUILD_EVENT_LOG_QUERY
Definition Opcodes.h:425
@ CMSG_SAVE_GUILD_EMBLEM
Definition Opcodes.h:877
@ CMSG_CHECK_IS_ADVENTURE_MAP_POI_VALID
Definition Opcodes.h:236
@ CMSG_CHAT_ADDON_MESSAGE
Definition Opcodes.h:192
@ CMSG_CHAT_MESSAGE_OFFICER
Definition Opcodes.h:222
@ CMSG_PARTY_INVITE_RESPONSE
Definition Opcodes.h:721
@ CMSG_QUERY_TIME
Definition Opcodes.h:782
@ CMSG_ADD_FRIEND
Definition Opcodes.h:53
@ CMSG_SET_RAID_DIFFICULTY
Definition Opcodes.h:928
@ CMSG_MOVE_SET_FACING_HEARTBEAT
Definition Opcodes.h:652
@ CMSG_GUILD_BANK_SET_TAB_TEXT
Definition Opcodes.h:415
@ CMSG_CALENDAR_GET
Definition Opcodes.h:154
@ CMSG_QUERY_PET_NAME
Definition Opcodes.h:772
@ CMSG_LOGOUT_CANCEL
Definition Opcodes.h:555
@ CMSG_PETITION_RENAME_GUILD
Definition Opcodes.h:733
@ CMSG_BATTLEMASTER_JOIN_ARENA
Definition Opcodes.h:107
@ CMSG_WHO
Definition Opcodes.h:1039
@ CMSG_GUILD_INVITE_BY_NAME
Definition Opcodes.h:430
@ CMSG_HEARTH_AND_RESURRECT
Definition Opcodes.h:453
@ CMSG_GUILD_UPDATE_INFO_TEXT
Definition Opcodes.h:451
@ CMSG_PLAYER_LOGIN
Definition Opcodes.h:755
@ CMSG_CREATE_CHARACTER
Definition Opcodes.h:311
@ CMSG_CALENDAR_UPDATE_EVENT
Definition Opcodes.h:163
@ CMSG_CHAT_MESSAGE_PARTY
Definition Opcodes.h:223
@ CMSG_RESET_INSTANCES
Definition Opcodes.h:870
@ CMSG_GUILD_DELETE
Definition Opcodes.h:422
@ CMSG_HOTFIX_REQUEST
Definition Opcodes.h:455
@ CMSG_PARTY_INVITE
Definition Opcodes.h:720
@ CMSG_GUILD_SET_MEMBER_NOTE
Definition Opcodes.h:448
@ CMSG_BATTLEFIELD_LEAVE
Definition Opcodes.h:102
@ CMSG_PARTY_UNINVITE
Definition Opcodes.h:722
@ CMSG_SET_LOOT_METHOD
Definition Opcodes.h:918
@ CMSG_BUY_ACCOUNT_BANK_TAB
Definition Opcodes.h:145
@ CMSG_ITEM_PURCHASE_REFUND
Definition Opcodes.h:514
@ CMSG_UNLEARN_SKILL
Definition Opcodes.h:1012
@ CMSG_INITIATE_TRADE
Definition Opcodes.h:507
@ CMSG_QUERY_GUILD_INFO
Definition Opcodes.h:765
@ CMSG_QUERY_CORPSE_LOCATION_FROM_CLIENT
Definition Opcodes.h:759
@ CMSG_SPELL_CLICK
Definition Opcodes.h:956
@ CMSG_QUERY_PLAYER_NAMES
Definition Opcodes.h:773
@ CMSG_CALENDAR_REMOVE_EVENT
Definition Opcodes.h:159
@ CMSG_UPDATE_RAID_TARGET
Definition Opcodes.h:1021
@ CMSG_REPORT_PVP_PLAYER_AFK
Definition Opcodes.h:827
@ CMSG_GUILD_BANK_BUY_TAB
Definition Opcodes.h:410
@ CMSG_QUERY_CORPSE_TRANSPORT
Definition Opcodes.h:760
@ CMSG_PETITION_BUY
Definition Opcodes.h:732
@ CMSG_GUILD_BANK_QUERY_TAB
Definition Opcodes.h:413
@ CMSG_REQUEST_PARTY_MEMBER_STATS
Definition Opcodes.h:849
@ CMSG_GUILD_BANK_UPDATE_TAB
Definition Opcodes.h:417
@ CMSG_GAME_OBJ_USE
Definition Opcodes.h:351
@ CMSG_MOVE_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK
Definition Opcodes.h:604
#define sOutdoorPvPMgr
@ PET_SAVE_AS_CURRENT
Definition PetDefines.h:43
@ INVENTORY_SLOT_BAG_START
Definition Player.h:773
@ INVENTORY_SLOT_BAG_END
Definition Player.h:774
@ BUYBACK_SLOT_END
Definition Player.h:799
@ BUYBACK_SLOT_START
Definition Player.h:798
@ BANK_SLOT_BAG_END
Definition Player.h:792
@ BANK_SLOT_BAG_START
Definition Player.h:791
@ ACCOUNT_BANK_SLOT_BAG_END
Definition Player.h:831
@ ACCOUNT_BANK_SLOT_BAG_START
Definition Player.h:830
@ PLAYER_DATA_FLAG_VALUE_BITS
Definition Player.h:159
@ REAGENT_BAG_SLOT_END
Definition Player.h:780
@ REAGENT_BAG_SLOT_START
Definition Player.h:779
@ PLAYER_SLOTS_COUNT
Definition Player.h:718
#define DEFINE_FIELD_ACCESSOR_CACHE_ANONYMOUS(result_type, fields_list)
#define MAX_QUEST_LOG_SIZE
Definition QuestDef.h:46
@ QUEST_FLAGS_FAIL_ON_LOGOUT
Definition QuestDef.h:249
Role Based Access Control related classes definition.
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
#define sRealmList
Definition RealmList.h:93
#define sScriptMgr
Definition ScriptMgr.h:1449
constexpr BattlegroundQueueTypeId BATTLEGROUND_QUEUE_NONE
static constexpr uint8 PLAYER_MAX_BATTLEGROUND_QUEUES
@ EXPANSION_BATTLE_FOR_AZEROTH
#define MAX_ACCOUNT_TUTORIAL_VALUES
BanMode
Ban function modes.
@ BAN_ACCOUNT
@ BAN_IP
@ BAN_CHARACTER
@ FRIEND_OFFLINE
Definition SocialMgr.h:72
#define sSocialMgr
Definition SocialMgr.h:173
@ SPELL_AURA_MOD_SHAPESHIFT
@ SPELL_AURA_SPIRIT_OF_REDEMPTION
uint32 getMSTime()
Definition Timer.h:33
@ TUTORIALS_FLAG_LOADED_FROM_DB
@ TUTORIALS_FLAG_CHANGED
@ TUTORIALS_FLAG_NONE
#define GLOBAL_CACHE_MASK
AccountDataType
#define NUM_ACCOUNT_DATA_TYPES
bool Initialize(uint32 accountId, uint32)
bool Initialize(uint32 accountId, uint32 battlenetAccountId)
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
void SetDestroyedObject(bool destroyed)
Definition BaseEntity.h:199
bool IsInWorld() const
Definition BaseEntity.h:158
void RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
char const * what() const noexcept override
Definition ByteBuffer.h:36
size_t rpos() const
Definition ByteBuffer.h:448
void hexlike() const
void print_storage() const
size_t wpos() const
Definition ByteBuffer.h:461
size_t size() const
Definition ByteBuffer.h:568
Class used to access individual fields of database query result.
Definition Field.h:94
uint32 GetUInt32() const noexcept
Definition Field.cpp:57
uint8 GetUInt8() const noexcept
Definition Field.cpp:29
std::string GetString() const noexcept
Definition Field.cpp:113
int64 GetInt64() const noexcept
Definition Field.cpp:78
Definition Group.h:205
Definition Guild.h:329
void add(T const &item)
Adds an item to the queue.
Definition LockedQueue.h:40
void readd(Iterator begin, Iterator end)
Adds items back to front of the queue.
Definition LockedQueue.h:55
bool next(T &result)
Gets the next result in the queue, if any.
Definition LockedQueue.h:62
virtual bool Process(WorldPacket *packet) override
Definition Map.h:225
LowType GetCounter() const
Definition ObjectGuid.h:336
static ObjectGuid const Empty
Definition ObjectGuid.h:314
bool IsEmpty() const
Definition ObjectGuid.h:362
std::string ToString() const
bool IsValid(OpcodeClient index) const
Definition Opcodes.h:2614
virtual bool ProcessUnsafe() const
WorldSession *const m_pSession
void CleanupChannels()
Definition Player.cpp:4864
uint32 GetXP() const
Definition Player.h:1329
bool m_InstanceValid
Definition Player.h:2761
bool IsBeingTeleportedFar() const
Definition Player.h:2405
void KillPlayer()
Definition Player.cpp:4460
void SetInvSlot(uint32 slot, ObjectGuid guid)
Definition Player.h:1609
void FailQuestsWithFlag(QuestFlags flag)
Definition Player.cpp:15395
void CleanupsBeforeDelete(bool finalCleanup=true) override
Definition Player.cpp:378
uint32 GetDeathTimer() const
Definition Player.h:2482
void RemoveSocial()
Definition Player.cpp:30808
ObjectGuid const & GetLootGUID() const
Definition Player.h:2262
bool HasPendingBind() const
Definition Player.h:2777
WorldLocation m_homebind
Definition Player.h:2693
void RemoveBattlegroundQueueId(BattlegroundQueueTypeId val)
Definition Player.cpp:25804
void RepopAtGraveyard()
Definition Player.cpp:4788
void ClearWhisperWhiteList()
Definition Player.h:2867
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition Player.cpp:22084
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options=TELE_TO_NONE, Optional< uint32 > instanceId={}, uint32 teleportSpellId=0)
Definition Player.cpp:1226
Battleground * GetBattleground() const
Definition Player.cpp:25719
ObjectGuid::LowType GetGuildId() const
Definition Player.h:2164
bool IsGameMaster() const
Definition Player.h:1309
void SetPendingBind(uint32 instanceId, uint32 bindTimer)
Definition Player.cpp:20041
uint32 GetXPForNextLevel() const
Definition Player.h:1330
void SaveToDB(bool create=false)
Definition Player.cpp:20439
void SetBuybackTimestamp(uint32 slot, time_t timestamp)
Definition Player.h:1631
Group * GetGroup(Optional< uint8 > partyIndex)
Definition Player.h:2796
void BuildPlayerRepop()
Definition Player.cpp:4321
void UninviteFromGroup()
Definition Player.cpp:2155
void SetBuybackPrice(uint32 slot, uint32 price)
Definition Player.h:1630
BattlegroundQueueTypeId GetBattlegroundQueueTypeId(uint32 index) const
Definition Player.cpp:25744
void setString(uint8 index, std::string &&value)
void setUInt32(uint8 index, uint32 value)
void setInt64(uint8 index, int64 value)
void setFloat(uint8 index, float value)
void setUInt64(uint8 index, uint64 value)
void setInt32(uint8 index, int32 value)
void setUInt8(uint8 index, uint8 value)
void SetSize(size_t size)
PreparedQueryResult GetPreparedResult(size_t index) const
void AfterComplete(std::function< void(SQLQueryHolderBase const &)> callback) &
Definition QueryHolder.h:70
bool SetPreparedQuery(size_t index, PreparedStatement< T > *stmt)
Definition QueryHolder.h:48
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3955
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
Definition Unit.cpp:6012
void ExitAllAreaTriggers()
Definition Unit.cpp:5533
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:4814
uint8 GetLevel() const
Definition Unit.h:757
Map * FindMap() const
Definition Object.h:412
std::string const & GetName() const
Definition Object.h:342
uint32 GetZoneId() const
Definition Object.h:332
ConnectionType GetConnection() const
Definition WorldPacket.h:86
uint32 GetOpcode() const
Definition WorldPacket.h:83
WorldPacket const * Write() override
Array< std::string, MAX_PREFIXES > Prefixes
std::array< Timestamp<>, NUM_ACCOUNT_DATA_TYPES > AccountTimes
OpcodeClient GetOpcode() const
Definition Packet.h:68
WorldPacket const * Write() override
WorldPacket const * Write() override
std::array< uint32, MAX_ACCOUNT_TUTORIAL_VALUES > TutorialData
bool Process(WorldPacket *packet) override
bool EvaluateOpcode(WorldPacket &p, time_t time) const
uint32 GetMaxPacketCounterAllowed(uint32 opcode) const
PacketThrottlingMap _PacketThrottlingMap
Player session in the World.
void HandleUnregisterAllAddonPrefixesOpcode(WorldPackets::Chat::ChatUnregisterAllAddonPrefixes &packet)
void SetPlayer(Player *player)
bool m_playerRecentlyLogout
bool Update(uint32 diff, PacketFilter &updater)
Update the WorldSession (triggered by World update)
std::unique_ptr< Battlenet::Account > _battlenetAccount
void LogoutPlayer(bool save)
Log the player out
uint8 _tutorialsChanged
AccountData _accountData[NUM_ACCOUNT_DATA_TYPES]
char const * GetTrinityString(uint32 entry) const
ObjectGuid GetBattlenetAccountGUID() const
void LoadTutorialsData(PreparedQueryResult result)
void SendClientCacheVersion(uint32 version)
void SetPlayerDataFlagAccount(uint32 dataFlagId, bool on)
void SendConnectToInstance(WorldPackets::Auth::ConnectToSerial serial)
void HandleMoveWorldportAck()
void SendNotification(char const *format,...) ATTR_PRINTF(2
std::array< std::shared_ptr< WorldSocket >, MAX_CONNECTION_TYPES > m_Socket
bool CanAccessAlliedRaces() const
AsyncCallbackProcessor< SQLQueryHolderCallback > _queryHolderProcessor
void SendAuthResponse(uint32 code, bool queued, uint32 queuePos=0)
void LoadPlayerDataAccount(PreparedQueryResult const &elementsResult, PreparedQueryResult const &flagsResult)
QueryCallbackProcessor _queryProcessor
std::array< uint32, MAX_ACCOUNT_TUTORIAL_VALUES > _tutorials
AccountTypes GetSecurity() const
LocaleConstant GetSessionDbLocaleIndex() const
bool PlayerDisconnected() const
int64 _timeSyncClockDelta
bool DisallowHyperlinksAndMaybeKick(std::string const &str)
uint32 AdjustClientMovementTime(uint32 time) const
class WorldSession::DosProtection AntiDOS
void LoadAccountData(PreparedQueryResult result, uint32 mask)
std::atomic< time_t > m_timeOutTime
uint64 GetConnectToInstanceKey() const
uint32 _timeSyncTimer
std::unordered_map< uint32, uint8 > _realmCharacterCounts
WorldSession(uint32 id, std::string &&name, uint32 battlenetAccountId, std::string &&battlenetAccountEmail, std::shared_ptr< WorldSocket > &&sock, AccountTypes sec, uint8 expansion, time_t mute_time, std::string &&os, Minutes timezoneOffset, uint32 build, ClientBuild::VariantId clientBuildVariant, LocaleConstant locale, uint32 recruiter, bool isARecruiter)
WorldSession constructor.
std::string GetPlayerInfo() const
Player * GetPlayer() const
rbac::RBACData * _RBACData
std::unique_ptr< CollectionMgr > _collectionMgr
void SendAuthWaitQueue(uint32 position)
Handle the authentication waiting queue (to be completed)
void Handle_EarlyProccess(WorldPackets::Null &null)
~WorldSession()
WorldSession destructor.
void SetLogoutStartTime(time_t requestTime)
Engage the logout process for the user.
void SendSetTimeZoneInformation()
void LogUnexpectedOpcode(WorldPacket *packet, char const *status, const char *reason)
Logging helper for unexpected opcodes.
void RegisterTimeSync(uint32 counter)
std::string _accountName
AccountData const * GetAccountData(AccountDataType type) const
TransactionCallback & AddTransactionCallback(TransactionCallback &&callback)
bool CanSpeak() const
uint32 _timeSyncNextCounter
void SavePlayerDataAccount(LoginDatabaseTransaction const &transaction)
void Handle_NULL(WorldPackets::Null &null)
ObjectGuid m_playerLoading
SQLQueryHolderCallback & AddQueryHolderCallback(SQLQueryHolderCallback &&callback)
QueryCallback LoadPermissionsAsync()
std::string const & GetRemoteAddress() const
void SetInQueue(bool state)
Session in auth.queue currently.
ObjectGuid::LowType m_GUIDLow
bool HasPermission(uint32 permissionId)
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
uint32 GetBattlenetAccountId() const
PlayerDataAccount _playerDataAccount
uint32 GetAccountId() const
uint8 GetAccountExpansion() const
ConnectToKey _instanceConnectKey
void SendTutorialsData()
void QueuePacket(WorldPacket &&new_packet)
Add an incoming packet to the queue.
Player * _player
void SetPlayerDataElementAccount(uint32 dataElementId, float value)
uint32 GetLatency() const
void ProcessQueryCallbacks()
void InitializeSessionCallback(LoginDatabaseQueryHolder const &holder, CharacterDatabaseQueryHolder const &realmHolder)
void HandleAddonRegisteredPrefixesOpcode(WorldPackets::Chat::ChatRegisterAddonPrefixes &packet)
void DoLootReleaseAll()
std::vector< std::string > _registeredAddonPrefixes
void SendAccountDataTimes(ObjectGuid playerGuid, uint32 mask)
bool IsAddonRegistered(std::string_view prefix) const
void HandleContinuePlayerLogin()
void SaveTutorialsData(CharacterDatabaseTransaction trans)
LockedQueue< WorldPacket * > _recvQueue
std::string const & GetPlayerName() const
void ResetTimeOutTime(bool onlyActive)
void InitializeSession()
void KickPlayer(std::string_view reason)
Kick a player out of the World.
void InvalidateRBACData()
static void AddInstanceConnection(WorldSession *session, std::weak_ptr< WorldSocket > sockRef, ConnectToKey key)
void SetAccountData(AccountDataType type, time_t time, std::string const &data)
void SendFeatureSystemStatusGlueScreen()
void LogUnprocessedTail(WorldPacket const *packet)
Logging helper for unexpected opcodes.
bool ShouldLogOut(time_t currTime) const
Is logout cooldown expired?
bool ValidateHyperlinksAndMaybeKick(std::string const &str)
AsyncCallbackProcessor< TransactionCallback > _transactionCallbacks
void SendAvailableHotfixes()
rbac::RBACData * GetRBACData()
bool IsConnectionIdle() const
std::unique_ptr< BattlePets::BattlePetMgr > _battlePetMgr
bool _filterAddonMessages
std::map< uint32, int64 > _pendingTimeSyncRequests
uint32 GetId() const
Gets the Id of the Object.
Definition RBAC.h:823
QueryCallback LoadFromDBAsync()
Definition RBAC.cpp:200
std::string const & GetName() const
Gets the Name of the Object.
Definition RBAC.h:821
void LoadFromDB()
Loads all permissions assigned to current account.
Definition RBAC.cpp:187
bool HasPermission(uint32 permission) const
Definition RBAC.h:841
#define sWorld
Definition World.h:916
uint32 GetVirtualRealmAddress()
Definition World.cpp:3526
@ CONFIG_SOCKET_TIMEOUTTIME
Definition World.h:244
@ CONFIG_CLIENTCACHE_VERSION
Definition World.h:357
@ CONFIG_PACKET_SPOOF_BANDURATION
Definition World.h:396
@ CONFIG_SOCKET_TIMEOUTTIME_ACTIVE
Definition World.h:426
@ CONFIG_PACKET_SPOOF_POLICY
Definition World.h:394
@ CONFIG_CHAT_STRICT_LINK_CHECKING_KICK
Definition World.h:318
@ CONFIG_PACKET_SPOOF_BANMODE
Definition World.h:395
@ CONFIG_EXPANSION
Definition World.h:306
@ CONFIG_PORT_WORLD
Definition World.h:243
SystemTimePoint GetSystemTime()
Current chrono system_clock time point.
Definition GameTime.cpp:62
time_t GetGameTime()
Definition GameTime.cpp:52
uint32 GetGameTimeMS()
Definition GameTime.cpp:57
constexpr decltype(auto) EnsureWritableVectorIndex(std::vector< T > &vec, typename std::vector< T >::size_type i)
Definition Containers.h:299
std::string StringFormat(FormatString< Args... > fmt, Args &&... args) noexcept
Default TC string format function.
struct advstd::ranges::Contains contains
@ RBAC_PERM_IGNORE_IDLE_CONNECTION
Definition RBAC.h:60
std::string Data
HandlerFunction Call
Definition Opcodes.h:2571
SessionStatus Status
Definition Opcodes.h:2570
char const * Name
Definition Opcodes.h:2569
PacketProcessing ProcessingPlace
Definition Opcodes.h:2572
uint32 amountCounter
time_t lastReceiveTime
PlayerDataElementType GetType() const
SessionStatus Status
Definition Opcodes.h:2578
ConnectionType ConnectionIndex
Definition Opcodes.h:2579
union WorldPackets::Auth::ConnectTo::SocketAddress::@310 Address
std::vector< Element > Elements
struct WorldSession::ConnectToKey::@318 Fields