TrinityCore
Loading...
Searching...
No Matches
MiscHandler.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 "AccountMgr.h"
20#include "AchievementMgr.h"
21#include "AchievementPackets.h"
22#include "AreaTriggerPackets.h"
23#include "Battleground.h"
24#include "CharacterPackets.h"
25#include "Chat.h"
26#include "CinematicMgr.h"
27#include "ClientConfigPackets.h"
28#include "Common.h"
29#include "Conversation.h"
30#include "ConversationAI.h"
31#include "Corpse.h"
32#include "DatabaseEnv.h"
33#include "DB2Stores.h"
34#include "GameTime.h"
35#include "GossipDef.h"
36#include "Group.h"
37#include "Guild.h"
38#include "GuildMgr.h"
39#include "InstancePackets.h"
40#include "InstanceScript.h"
41#include "Language.h"
42#include "Log.h"
43#include "Map.h"
44#include "MiscPackets.h"
45#include "Object.h"
46#include "ObjectAccessor.h"
47#include "ObjectMgr.h"
48#include "OutdoorPvP.h"
49#include "Player.h"
50#include "RestMgr.h"
51#include "ScriptMgr.h"
52#include "Spell.h"
53#include "SpellPackets.h"
54#include "WhoListStorage.h"
55#include "WhoPackets.h"
56#include "World.h"
57#include <cstdarg>
58#include <zlib.h>
59
61{
62 if (GetPlayer()->IsAlive() || GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_GHOST))
63 return;
64
66 return; // silently return, client should display the error by itself
67
68 // the world update order is sessions, players, creatures
69 // the netcode runs in parallel with all of these
70 // creatures can kill players
71 // so if the server is lagging enough the player can
72 // release spirit after he's killed but before he is updated
73 if (GetPlayer()->getDeathState() == JUST_DIED)
74 {
75 TC_LOG_DEBUG("network", "HandleRepopRequestOpcode: got request after player {} {} was killed and before he was updated",
76 GetPlayer()->GetName(), GetPlayer()->GetGUID().ToString());
78 }
79
80 //this is spirit release confirm?
81 GetPlayer()->RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
84}
85
87{
88 WorldPackets::Who::WhoRequest& request = whoRequest.Request;
89
90 TC_LOG_DEBUG("network", "WorldSession::HandleWhoOpcode: MinLevel: {}, MaxLevel: {}, Name: {} (VirtualRealmName: {}), Guild: {} (GuildVirtualRealmName: {}), RaceFilter: 0x{:X}{:08X}, ClassFilter: {}, Areas: {}, Words: {}.",
91 request.MinLevel, request.MaxLevel, request.Name, request.VirtualRealmName, request.Guild, request.GuildVirtualRealmName,
92 request.RaceFilter.RawValue[1], request.RaceFilter.RawValue[0], request.ClassFilter, whoRequest.Areas.size(), request.Words.size());
93
94 // zones count, client limit = 10 (2.0.10)
95 // can't be received from real client or broken packet
96 if (whoRequest.Areas.size() > 10)
97 return;
98
99 // user entered strings count, client limit=4 (checked on 2.0.10)
100 // can't be received from real client or broken packet
101 if (request.Words.size() > 4)
102 return;
103
110
111 std::vector<std::wstring> wWords;
112 wWords.resize(request.Words.size());
113 for (size_t i = 0; i < request.Words.size(); ++i)
114 {
115 TC_LOG_DEBUG("network", "WorldSession::HandleWhoOpcode: Word: {}", request.Words[i].Word);
116
117 // user entered string, it used as universal search pattern(guild+player name)?
118 if (!Utf8toWStr(request.Words[i].Word, wWords[i]))
119 continue;
120
121 wstrToLower(wWords[i]);
122 }
123
124 std::wstring wPlayerName;
125 std::wstring wGuildName;
126
127 if (!(Utf8toWStr(request.Name, wPlayerName) && Utf8toWStr(request.Guild, wGuildName)))
128 return;
129
130 wstrToLower(wPlayerName);
131 wstrToLower(wGuildName);
132
133 // client send in case not set max level value 100 but Trinity supports 255 max level,
134 // update it to show GMs with characters after 100 level
135 if (whoRequest.Request.MaxLevel >= MAX_LEVEL)
136 whoRequest.Request.MaxLevel = STRONG_MAX_LEVEL;
137
138 uint32 team = _player->GetTeam();
139
140 uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
141
143 response.Token = whoRequest.Token;
144
145 WhoListInfoVector const& whoList = sWhoListStorageMgr->GetWhoList();
146 for (WhoListPlayerInfo const& target : whoList)
147 {
148 // player can see member of other team only if has RBAC_PERM_TWO_SIDE_WHO_LIST
149 if (target.GetTeam() != team && !HasPermission(rbac::RBAC_PERM_TWO_SIDE_WHO_LIST))
150 continue;
151
152 // player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if has RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS
153 if (target.GetSecurity() > AccountTypes(gmLevelInWhoList) && !HasPermission(rbac::RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS))
154 continue;
155
156 // check if target is globally visible for player
157 if (_player->GetGUID() != target.GetGuid() && !target.IsVisible())
159 continue;
160
161 // check if target's level is in level range
162 uint8 lvl = target.GetLevel();
163 if (lvl < request.MinLevel || lvl > request.MaxLevel)
164 continue;
165
166 // check if class matches classmask
167 if (request.ClassFilter >= 0 && !(request.ClassFilter & (1 << target.GetClass())))
168 continue;
169
170 // check if race matches racemask
171 if (!request.RaceFilter.HasRace(target.GetRace()))
172 continue;
173
174 if (!whoRequest.Areas.empty())
175 {
176 if (std::find(whoRequest.Areas.begin(), whoRequest.Areas.end(), int32(target.GetZoneId())) == whoRequest.Areas.end())
177 continue;
178 }
179
180 std::wstring const& wTargetName = target.GetWidePlayerName();
181 if (!(wPlayerName.empty() || wTargetName.find(wPlayerName) != std::wstring::npos))
182 continue;
183
184 std::wstring const& wTargetGuildName = target.GetWideGuildName();
185
186 if (!wGuildName.empty() && wTargetGuildName.find(wGuildName) == std::wstring::npos)
187 continue;
188
189 if (!wWords.empty())
190 {
191 std::string aName;
192 if (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(target.GetZoneId()))
193 aName = areaEntry->AreaName[GetSessionDbcLocale()];
194
195 bool show = false;
196 for (size_t i = 0; i < wWords.size(); ++i)
197 {
198 if (!wWords[i].empty())
199 {
200 if (wTargetName.find(wWords[i]) != std::wstring::npos ||
201 wTargetGuildName.find(wWords[i]) != std::wstring::npos ||
202 Utf8FitTo(aName, wWords[i]))
203 {
204 show = true;
205 break;
206 }
207 }
208 }
209
210 if (!show)
211 continue;
212 }
213
215 if (!whoEntry.PlayerData.Initialize(target.GetGuid(), nullptr))
216 continue;
217
218 if (!target.GetGuildGuid().IsEmpty())
219 {
220 whoEntry.GuildGUID = target.GetGuildGuid();
222 whoEntry.GuildName = target.GetGuildName();
223 }
224
225 whoEntry.AreaID = target.GetZoneId();
226 whoEntry.IsGM = target.IsGameMaster();
227
228 response.Response.Entries.push_back(whoEntry);
229
230 // 50 is maximum player count sent to client - can be overridden
231 // through config, but is unstable
232 if (response.Response.Entries.size() >= sWorld->getIntConfig(CONFIG_MAX_WHO))
233 break;
234 }
235
236 SendPacket(response.Write());
237}
238
240{
241 if (!GetPlayer()->GetLootGUID().IsEmpty())
243
244 bool instantLogout = GetPlayer()->IsInFlight();
245 if (!logoutRequest.IdleLogout)
246 instantLogout |= (GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat())
248
250 bool canLogoutInCombat = GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_RESTING);
251
252 uint32 reason = 0;
253 if (GetPlayer()->IsInCombat() && !canLogoutInCombat)
254 reason = 1;
255 else if (GetPlayer()->IsFalling())
256 reason = 3; // is jumping or falling
257 else if (GetPlayer()->duel || GetPlayer()->HasAura(9454)) // is dueling or frozen by GM via freeze command
258 reason = 2; // FIXME - Need the correct value
259
261 logoutResponse.LogoutResult = reason;
262 logoutResponse.Instant = instantLogout;
263 SendPacket(logoutResponse.Write());
264
265 if (reason)
266 {
268 return;
269 }
270
271 // instant logout in taverns/cities or on taxi or for admins, gm's, mod's if its enabled in worldserver.conf
272 if (instantLogout)
273 {
274 LogoutPlayer(true);
275 return;
276 }
277
278 // not set flags if player can't free move to prevent lost state at logout cancel
279 if (GetPlayer()->CanFreeMove())
280 {
281 if (GetPlayer()->GetStandState() == UNIT_STAND_STATE_STAND)
283 GetPlayer()->SetRooted(true);
285 }
286
288}
289
291{
292 // Player have already logged out serverside, too late to cancel
293 if (!GetPlayer())
294 return;
295
297
299
300 // not remove flags if can't free move - its not set in Logout request code.
301 if (GetPlayer()->CanFreeMove())
302 {
304 GetPlayer()->SetRooted(false);
305
308
311 }
312}
313
315{
316 if (!GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_IN_PVP))
317 {
320 if (!GetPlayer()->IsPvP() || GetPlayer()->pvpInfo.EndTimer)
321 GetPlayer()->UpdatePvP(true, true);
322 }
323 else if (!GetPlayer()->IsWarModeLocalActive())
324 {
327 if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP())
328 GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
329 }
330}
331
333{
334 if (packet.EnablePVP)
335 {
338 if (!GetPlayer()->IsPvP() || GetPlayer()->pvpInfo.EndTimer)
339 GetPlayer()->UpdatePvP(true, true);
340 }
341 else if (!GetPlayer()->IsWarModeLocalActive())
342 {
345 if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP())
346 GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
347 }
348}
349
354
356{
357 if (GetPlayer()->IsAlive() || !GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_GHOST))
358 return;
360}
361
363{
364 uint32 zoneId = _player->GetZoneId();
365 uint32 team = _player->GetTeam();
366
367 std::vector<uint32> graveyardIds;
368 auto range = sObjectMgr->GraveyardStore.equal_range(zoneId);
369
370 for (auto it = range.first; it != range.second && graveyardIds.size() < 16; ++it) // client max
371 {
372 ConditionSourceInfo conditionSource(_player);
373 if (!it->second.Conditions.Meets(conditionSource))
374 continue;
375
376 graveyardIds.push_back(it->first);
377 }
378
379 if (graveyardIds.empty())
380 {
381 TC_LOG_DEBUG("network", "No graveyards found for zone {} for {} (team {}) in CMSG_REQUEST_CEMETERY_LIST",
382 zoneId, _player->GetGUID().ToString(), team);
383 return;
384 }
385
387 packet.IsGossipTriggered = false;
388 packet.CemeteryID.reserve(graveyardIds.size());
389
390 for (uint32 id : graveyardIds)
391 packet.CemeteryID.push_back(id);
392
393 SendPacket(packet.Write());
394}
395
400
402{
403 switch (packet.StandState)
404 {
409 break;
410 default:
411 return;
412 }
413
415}
416
418{
419 if (_player->IsAlive())
420 return;
421
422 // do not allow corpse reclaim in arena
423 if (_player->InArena())
424 return;
425
426 // body not released yet
428 return;
429
430 Corpse* corpse = _player->GetCorpse();
431 if (!corpse)
432 return;
433
434 // prevent resurrect before 30-sec delay after body release not finished
435 if (time_t(corpse->GetGhostTime() + _player->GetCorpseReclaimDelay(corpse->GetType() == CORPSE_RESURRECTABLE_PVP)) > time_t(GameTime::GetGameTime()))
436 return;
437
439 return;
440
441 // resurrect
443
444 // spawn bones
446}
447
449{
450 if (GetPlayer()->IsAlive())
451 return;
452
453 if (packet.Response != 0) // Accept = 0 Decline = 1 Timeout = 2
454 {
456 return;
457 }
458
459 if (!GetPlayer()->IsResurrectRequestedBy(packet.Resurrecter))
460 return;
461
462 if (Player* ressPlayer = ObjectAccessor::GetPlayer(*GetPlayer(), packet.Resurrecter))
463 {
464 if (InstanceScript* instance = ressPlayer->GetInstanceScript())
465 {
466 if (instance->IsEncounterInProgress())
467 {
468 if (!instance->GetCombatResurrectionCharges())
469 return;
470 else
471 instance->UseCombatResurrection();
472 }
473 }
474 }
475
477}
478
480{
481 Player* player = GetPlayer();
482 if (player->IsInFlight())
483 {
484 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} in flight, ignore Area Trigger ID: {}",
485 player->GetName(), player->GetGUID().ToString(), packet.AreaTriggerID);
486 return;
487 }
488
489 AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(packet.AreaTriggerID);
490 if (!atEntry)
491 {
492 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} send unknown (by DBC) Area Trigger ID: {}",
493 player->GetName(), player->GetGUID().ToString(), packet.AreaTriggerID);
494 return;
495 }
496
497 if (packet.Entered != player->IsInAreaTrigger(atEntry))
498 {
499 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} too far, ignore Area Trigger ID: {}",
500 player->GetName(), player->GetGUID().ToString(), packet.AreaTriggerID);
501 return;
502 }
503
504 if (player->isDebugAreaTriggers)
506
507 if (!sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_AREATRIGGER_CLIENT_TRIGGERED, atEntry->ID, player))
508 return;
509
510 if (sScriptMgr->OnAreaTrigger(player, atEntry, packet.Entered))
511 return;
512
513 if (atEntry->AreaTriggerActionSetID)
514 {
515 if (packet.Entered)
517 else
519 }
520
521 if (player->IsAlive() && packet.Entered)
522 {
523 // not using Player::UpdateQuestObjectiveProgress, ObjectID in quest_objectives can be set to -1, areatrigger_involvedrelation then holds correct id
524 if (std::unordered_set<uint32> const* quests = sObjectMgr->GetQuestsForAreaTrigger(packet.AreaTriggerID))
525 {
526 bool anyObjectiveChangedCompletionState = false;
527 for (uint32 questId : *quests)
528 {
529 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questId);
530 uint16 slot = player->FindQuestSlot(questId);
531 if (qInfo && slot < MAX_QUEST_LOG_SIZE && player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE)
532 {
533 for (QuestObjective const& obj : qInfo->Objectives)
534 {
535 if (obj.Type != QUEST_OBJECTIVE_AREATRIGGER)
536 continue;
537
538 if (!player->IsQuestObjectiveCompletable(slot, qInfo, obj))
539 continue;
540
541 if (player->IsQuestObjectiveComplete(slot, qInfo, obj))
542 continue;
543
544 if (obj.ObjectID != -1 && obj.ObjectID != packet.AreaTriggerID)
545 continue;
546
547 player->SetQuestObjectiveData(obj, 1);
549 anyObjectiveChangedCompletionState = true;
550 break;
551 }
552
554 player->AreaExploredOrEventHappens(questId);
555
556 if (player->CanCompleteQuest(questId))
557 player->CompleteQuest(questId);
558 }
559 }
560
561 if (anyObjectiveChangedCompletionState)
562 player->UpdateVisibleObjectInteractions(true, false, false, true);
563 }
564 }
565
566 if (sObjectMgr->IsTavernAreaTrigger(packet.AreaTriggerID))
567 {
568 // set resting flag we are in the inn
569 if (packet.Entered)
570 {
571 player->GetRestMgr().SetInnTrigger(InnAreaTrigger{ .IsDBC = true, .AreaTriggerEntryId = atEntry->ID });
572 }
573 else
574 {
576 player->GetRestMgr().SetInnTrigger(std::nullopt);
577 }
578
579 if (sWorld->IsFFAPvPRealm())
580 {
581 if (packet.Entered)
583 else
585 }
586
587 return;
588 }
589
590 if (OutdoorPvP* pvp = player->GetOutdoorPvP())
591 if (pvp->HandleAreaTrigger(_player, packet.AreaTriggerID, packet.Entered))
592 return;
593
594 if (!packet.Entered)
595 return;
596
597 AreaTriggerTeleport const* at = sObjectMgr->GetAreaTrigger(packet.AreaTriggerID);
598 if (!at)
599 return;
600
601 bool teleported = false;
602 if (player->GetMapId() != at->Loc.GetMapId())
603 {
604 if (!player->IsAlive())
605 {
606 if (player->HasCorpse())
607 {
608 // let enter in ghost mode in instance that connected to inner instance with corpse
609 uint32 corpseMap = player->GetCorpseLocation().GetMapId();
610 do
611 {
612 if (corpseMap == at->Loc.GetMapId())
613 break;
614
615 InstanceTemplate const* corpseInstance = sObjectMgr->GetInstanceTemplate(corpseMap);
616 corpseMap = corpseInstance ? corpseInstance->Parent : 0;
617 } while (corpseMap);
618
619 if (!corpseMap)
620 {
622 return;
623 }
624
625 TC_LOG_DEBUG("maps", "MAP: Player '{}' has corpse in instance {} and can enter.", player->GetName(), at->Loc.GetMapId());
626 }
627 else
628 TC_LOG_DEBUG("maps", "Map::CanPlayerEnter - player '{}' is dead but does not have a corpse!", player->GetName());
629 }
630
631 if (TransferAbortParams denyReason = Map::PlayerCannotEnter(at->Loc.GetMapId(), player))
632 {
633 switch (denyReason.Reason)
634 {
636 TC_LOG_DEBUG("maps", "MAP: Player '{}' attempted to enter map with id {} which has no entry", player->GetName(), at->Loc.GetMapId());
637 break;
639 TC_LOG_DEBUG("maps", "MAP: Player '{}' attempted to enter instance map {} but the requested difficulty was not found", player->GetName(), at->Loc.GetMapId());
640 break;
642 TC_LOG_DEBUG("maps", "MAP: Player '{}' must be in a raid group to enter map {}", player->GetName(), at->Loc.GetMapId());
644 break;
646 TC_LOG_DEBUG("maps", "MAP: Player '{}' cannot enter instance map {} because their permanent bind is incompatible with their group's", player->GetName(), at->Loc.GetMapId());
647 break;
649 TC_LOG_DEBUG("maps", "MAP: Player '{}' cannot enter instance map {} because their permanent bind is incompatible with their group's", player->GetName(), at->Loc.GetMapId());
650 break;
652 TC_LOG_DEBUG("maps", "MAP: Player '{}' cannot enter instance map {} because he has exceeded the maximum number of instances per hour.", player->GetName(), at->Loc.GetMapId());
653 break;
655 break;
657 break;
659 TC_LOG_DEBUG("maps", "MAP: Player '{}' cannot enter instance map {} because instance is resetting.", player->GetName(), at->Loc.GetMapId());
660 break;
661 default:
662 break;
663 }
664
665 if (denyReason.Reason != TRANSFER_ABORT_NEED_GROUP)
666 player->SendTransferAborted(at->Loc.GetMapId(), denyReason.Reason, denyReason.Arg, denyReason.MapDifficultyXConditionId);
667
668 if (!player->IsAlive() && player->HasCorpse())
669 {
670 if (player->GetCorpseLocation().GetMapId() == at->Loc.GetMapId())
671 {
672 player->ResurrectPlayer(0.5f);
673 player->SpawnCorpseBones();
674 }
675 }
676
677 return;
678 }
679
680 if (Group* group = player->GetGroup())
681 if (group->isLFGGroup() && player->GetMap()->IsDungeon())
682 teleported = player->TeleportToBGEntryPoint();
683 }
684
685 if (!teleported)
686 {
687 WorldSafeLocsEntry const* entranceLocation = player->GetInstanceEntrance(at->Loc.GetMapId());
688 if (entranceLocation && player->GetMapId() != at->Loc.GetMapId())
689 player->TeleportTo(entranceLocation->Loc, TELE_TO_NOT_LEAVE_TRANSPORT);
690 else
692 }
693}
694
696{
697 TC_LOG_DEBUG("network", "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA: type {}, time {}, decompressedSize {}",
698 packet.DataType, packet.Time.AsUnderlyingType(), packet.Size);
699
700 if (packet.DataType >= NUM_ACCOUNT_DATA_TYPES)
701 return;
702
703 if (packet.Size == 0) // erase
704 {
706
708 updateAccountDataComplete.Player = packet.PlayerGuid;
709 updateAccountDataComplete.DataType = packet.DataType;
710 updateAccountDataComplete.Result = 0;
711 SendPacket(updateAccountDataComplete.Write());
712
713 return;
714 }
715
716 if (packet.Size > 0xFFFF)
717 {
718 TC_LOG_ERROR("network", "UAD: Account data packet too big, size {}", packet.Size);
719 return;
720 }
721
722 std::string dest;
723 dest.resize(packet.Size);
724
725 uLongf realSize = packet.Size;
726 if (uncompress(reinterpret_cast<Bytef*>(dest.data()), &realSize, packet.CompressedData.data(), packet.CompressedData.size()) != Z_OK)
727 {
728 TC_LOG_ERROR("network", "UAD: Failed to decompress account data");
729 return;
730 }
731
732 SetAccountData(AccountDataType(packet.DataType), packet.Time, dest);
733
735 updateAccountDataComplete.Player = packet.PlayerGuid;
736 updateAccountDataComplete.DataType = packet.DataType;
737 updateAccountDataComplete.Result = 0;
738 SendPacket(updateAccountDataComplete.Write());
739}
740
742{
743 TC_LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA: type {}", request.DataType);
744
745 if (request.DataType >= NUM_ACCOUNT_DATA_TYPES)
746 return;
747
748 AccountData const* adata = GetAccountData(AccountDataType(request.DataType));
749
752 data.Time = adata->Time;
753 data.Size = adata->Data.size();
754 data.DataType = request.DataType;
755
756 uLongf destSize = compressBound(data.Size);
757
758 data.CompressedData.resize(destSize);
759
760 if (data.Size && compress(data.CompressedData.data(), &destSize, (uint8 const*)adata->Data.c_str(), data.Size) != Z_OK)
761 {
762 TC_LOG_ERROR("network", "RAD: Failed to compress account data");
763 return;
764 }
765
766 data.CompressedData.resize(destSize);
767
768 SendPacket(data.Write());
769}
770
772{
773 uint64 action = ACTION_BUTTON_ACTION(packet.Action);
774 uint8 type = ACTION_BUTTON_TYPE(packet.Action);
775
776 TC_LOG_DEBUG("network", "CMSG_SET_ACTION_BUTTON Button: {} Action: {} Type: {}", packet.Index, action, uint32(type));
777
778 if (!packet.Action)
780 else
781 GetPlayer()->AddActionButton(packet.Index, action, type);
782}
783
785{
786 // If player has sight bound to visual waypoint NPC we should remove it
788}
789
791{
792 // Sent by client when cinematic actually begun. So we begin the server side process
794}
795
797{
798 uint32 movie = _player->GetMovie();
799 if (!movie)
800 return;
801
802 _player->SetMovie(0);
803 sScriptMgr->OnMovieComplete(_player, movie);
804}
805
807{
808 if (!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED)
809 {
810 if (packet.Mask != 0)
811 TC_LOG_ERROR("network", "WorldSession::HandleSetActionBarToggles in not logged state with value: {}, ignored", uint32(packet.Mask));
812 return;
813 }
814
816}
817
819{
821 playedTime.TotalTime = _player->GetTotalPlayedTime();
822 playedTime.LevelTime = _player->GetLevelPlayedTime();
823 playedTime.TriggerEvent = packet.TriggerScriptEvent; // 0-1 - will not show in chat frame
824 SendPacket(playedTime.Write());
825}
826
828{
829 TC_LOG_DEBUG("network", "Received whois command from player {} for character {}",
830 GetPlayer()->GetName(), packet.CharName);
831
833 {
835 return;
836 }
837
838 if (packet.CharName.empty() || !normalizePlayerName(packet.CharName))
839 {
841 return;
842 }
843
845 if (!player)
846 {
848 return;
849 }
850
852 stmt->setUInt32(0, player->GetSession()->GetAccountId());
853
854 PreparedQueryResult result = LoginDatabase.Query(stmt);
855 if (!result)
856 {
858 return;
859 }
860
861 Field* fields = result->Fetch();
862 std::string acc = fields[0].GetString();
863 if (acc.empty())
864 acc = "Unknown";
865
866 std::string email = fields[1].GetString();
867 if (email.empty())
868 email = "Unknown";
869
870 std::string lastip = fields[2].GetString();
871 if (lastip.empty())
872 lastip = "Unknown";
873
875 response.AccountName = packet.CharName + "'s " + "account is " + acc + ", e-mail: " + email + ", last ip: " + lastip;
876 SendPacket(response.Write());
877}
878
880{
881 if (packet.Enable)
882 {
883 TC_LOG_DEBUG("network", "Added FarSight {} to player {}", _player->m_activePlayerData->FarsightObject->ToString(), _player->GetGUID().ToString());
884 if (WorldObject* target = _player->GetViewpoint())
885 _player->SetSeer(target);
886 else
887 TC_LOG_DEBUG("network", "Player {} {} requests non-existing seer {}", _player->GetName(), _player->GetGUID().ToString(), _player->m_activePlayerData->FarsightObject->ToString());
888 }
889 else
890 {
891 TC_LOG_DEBUG("network", "Player {} set vision to self", _player->GetGUID().ToString());
893 }
894
896}
897
899{
900 // -1 at none
901 if (packet.TitleID > 0)
902 {
903 if (!GetPlayer()->HasTitle(packet.TitleID))
904 return;
905 }
906 else
907 packet.TitleID = 0;
908
910}
911
913{
914 Map* map = _player->FindMap();
915 if (map && map->Instanceable())
916 return;
917
918 if (Group* group = _player->GetGroup())
919 {
920 if (!group->IsLeader(_player->GetGUID()))
921 return;
922
923 if (group->isLFGGroup())
924 return;
925
926 group->ResetInstances(InstanceResetMethod::Manual, _player);
927 }
928 else
930}
931
933{
934 DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(setDungeonDifficulty.DifficultyID);
935 if (!difficultyEntry)
936 {
937 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent an invalid instance mode {}!",
938 _player->GetGUID().ToString(), setDungeonDifficulty.DifficultyID);
939 return;
940 }
941
942 if (difficultyEntry->InstanceType != MAP_INSTANCE)
943 {
944 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent an non-dungeon instance mode {}!",
945 _player->GetGUID().ToString(), difficultyEntry->ID);
946 return;
947 }
948
949 if (!(difficultyEntry->Flags & DIFFICULTY_FLAG_CAN_SELECT))
950 {
951 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player {} sent unselectable instance mode {}!",
952 _player->GetGUID().ToString(), difficultyEntry->ID);
953 return;
954 }
955
956 Difficulty difficultyID = Difficulty(difficultyEntry->ID);
957 if (difficultyID == _player->GetDungeonDifficultyID())
958 return;
959
960 // cannot reset while in an instance
961 Map* map = _player->FindMap();
962 if (map && map->Instanceable())
963 {
964 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: {}, {}) tried to reset the instance while player is inside!",
966 return;
967 }
968
969 Group* group = _player->GetGroup();
970 if (group)
971 {
972 if (!group->IsLeader(_player->GetGUID()))
973 return;
974
975 if (group->isLFGGroup())
976 return;
977
978 // the difficulty is set even if the instances can't be reset
980 group->SetDungeonDifficultyID(difficultyID);
981 }
982 else
983 {
985 _player->SetDungeonDifficultyID(difficultyID);
987 }
988}
989
991{
992 DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(setRaidDifficulty.DifficultyID);
993 if (!difficultyEntry)
994 {
995 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent an invalid instance mode {}!",
996 _player->GetGUID().ToString(), setRaidDifficulty.DifficultyID);
997 return;
998 }
999
1000 if (difficultyEntry->InstanceType != MAP_RAID)
1001 {
1002 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent an non-dungeon instance mode {}!",
1003 _player->GetGUID().ToString(), difficultyEntry->ID);
1004 return;
1005 }
1006
1007 if (!(difficultyEntry->Flags & DIFFICULTY_FLAG_CAN_SELECT))
1008 {
1009 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player {} sent unselectable instance mode {}!",
1010 _player->GetGUID().ToString(), difficultyEntry->ID);
1011 return;
1012 }
1013
1014 if (((difficultyEntry->Flags & DIFFICULTY_FLAG_LEGACY) != 0) != setRaidDifficulty.Legacy)
1015 {
1016 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent not matching legacy difficulty {}!",
1017 _player->GetGUID().ToString(), difficultyEntry->ID);
1018 return;
1019 }
1020
1021 Difficulty difficultyID = Difficulty(difficultyEntry->ID);
1022 if (difficultyID == (setRaidDifficulty.Legacy ? _player->GetLegacyRaidDifficultyID() : _player->GetRaidDifficultyID()))
1023 return;
1024
1025 // cannot reset while in an instance
1026 Map* map = _player->FindMap();
1027 if (map && map->Instanceable())
1028 {
1029 TC_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: player (Name: {}, {}) tried to reset the instance while player is inside!",
1031 return;
1032 }
1033
1034 Group* group = _player->GetGroup();
1035 if (group)
1036 {
1037 if (!group->IsLeader(_player->GetGUID()))
1038 return;
1039
1040 if (group->isLFGGroup())
1041 return;
1042
1043 // the difficulty is set even if the instances can't be reset
1045 if (setRaidDifficulty.Legacy)
1046 group->SetLegacyRaidDifficultyID(difficultyID);
1047 else
1048 group->SetRaidDifficultyID(difficultyID);
1049 }
1050 else
1051 {
1053 if (setRaidDifficulty.Legacy)
1054 _player->SetLegacyRaidDifficultyID(difficultyID);
1055 else
1056 _player->SetRaidDifficultyID(difficultyID);
1057
1058 _player->SendRaidDifficulty(setRaidDifficulty.Legacy != 0);
1059 }
1060}
1061
1069
1071{
1072 if (Guild* guild = sGuildMgr->GetGuildById(_player->GetGuildId()))
1073 guild->GetAchievementMgr().SendAchievementInfo(_player, setFocusedAchievement.AchievementID);
1074}
1075
1082
1084{
1085 if (!_player->HasPendingBind())
1086 {
1087 TC_LOG_INFO("network", "InstanceLockResponse: Player {} {} tried to bind himself/teleport to graveyard without a pending bind!",
1089 return;
1090 }
1091
1092 if (packet.AcceptLock)
1094 else
1096
1097 _player->SetPendingBind(0, 0);
1098}
1099
1101{
1102 // do something?
1103}
1104
1106{
1107 TC_LOG_ERROR("network", "Object update failed for {} for player {} ({})", objectUpdateFailed.ObjectGUID.ToString(), GetPlayerName(), _player->GetGUID().ToString());
1108
1109 // If create object failed for current player then client will be stuck on loading screen
1110 if (_player->GetGUID() == objectUpdateFailed.ObjectGUID)
1111 {
1112 LogoutPlayer(true);
1113 return;
1114 }
1115
1116 // Pretend we've never seen this object
1117 _player->m_clientGUIDs.erase(objectUpdateFailed.ObjectGUID);
1118}
1119
1121{
1122 TC_LOG_ERROR("network", "Object update rescued for {} for player {} ({})", objectUpdateRescued.ObjectGUID.ToString(), GetPlayerName(), _player->GetGUID().ToString());
1123
1124 // Client received values update after destroying object
1125 // re-register object in m_clientGUIDs to send DestroyObject on next visibility update
1126 _player->m_clientGUIDs.insert(objectUpdateRescued.ObjectGUID);
1127}
1128
1130{
1131 if (packet.CUFProfiles.size() > MAX_CUF_PROFILES)
1132 {
1133 TC_LOG_ERROR("entities.player", "HandleSaveCUFProfiles - {} tried to save more than {} CUF profiles. Hacking attempt?", GetPlayerName(), MAX_CUF_PROFILES);
1134 return;
1135 }
1136
1137 for (uint8 i = 0; i < packet.CUFProfiles.size(); ++i)
1138 GetPlayer()->SaveCUFProfile(i, std::move(packet.CUFProfiles[i]));
1139
1140 for (uint8 i = packet.CUFProfiles.size(); i < MAX_CUF_PROFILES; ++i)
1141 GetPlayer()->SaveCUFProfile(i, nullptr);
1142}
1143
1145{
1146 Player* player = GetPlayer();
1147
1149
1150 for (uint8 i = 0; i < MAX_CUF_PROFILES; i++)
1151 if (CUFProfile* cufProfile = player->GetCUFProfile(i))
1152 loadCUFProfiles.CUFProfiles.push_back(cufProfile);
1153 SendPacket(loadCUFProfiles.Write());
1154}
1155
1160
1162{
1163 WorldPackets::Misc::SpecialMountAnim specialMountAnim;
1164 specialMountAnim.UnitGUID = _player->GetGUID();
1165 std::copy(mountSpecial.SpellVisualKitIDs.begin(), mountSpecial.SpellVisualKitIDs.end(), std::back_inserter(specialMountAnim.SpellVisualKitIDs));
1166 specialMountAnim.SequenceVariation = mountSpecial.SequenceVariation;
1167 GetPlayer()->SendMessageToSet(specialMountAnim.Write(), false);
1168}
1169
1171{
1172 _collectionMgr->MountSetFavorite(mountSetFavorite.MountSpellID, mountSetFavorite.IsFavorite);
1173}
1174
1176{
1177 if (_player->PlayerTalkClass->GetInteractionData().IsLaunchedByQuest)
1178 _player->PlayerTalkClass->GetInteractionData().IsLaunchedByQuest = false;
1179 else if (_player->PlayerTalkClass->GetInteractionData().SourceGuid == closeInteraction.SourceGuid)
1180 _player->PlayerTalkClass->GetInteractionData().Reset();
1181
1182 if (_player->GetStableMaster() == closeInteraction.SourceGuid)
1184}
1185
1187{
1188 if (Conversation* conversation = ObjectAccessor::GetConversation(*_player, conversationLineStarted.ConversationGUID))
1189 conversation->AI()->OnLineStarted(conversationLineStarted.LineID, _player);
1190}
1191
1193{
1194 UISplashScreenEntry const* splashScreen = nullptr;
1195 for (auto itr = sUISplashScreenStore.begin(); itr != sUISplashScreenStore.end(); ++itr)
1196 {
1197 if (!ConditionMgr::IsPlayerMeetingCondition(_player, itr->CharLevelConditionID))
1198 continue;
1199
1200 splashScreen = *itr;
1201 }
1202
1203 WorldPackets::Misc::SplashScreenShowLatest splashScreenShowLatest;
1204 splashScreenShowLatest.UISplashScreenID = splashScreen ? splashScreen->ID : 0;
1205 SendPacket(splashScreenShowLatest.Write());
1206}
1207
1209{
1210 Group const* group = _player->GetGroup();
1211 if (!group)
1212 return;
1213
1214 Group::CountdownInfo const* info = group->GetCountdownInfo(queryCountdownTimer.TimerType);
1215 if (!info)
1216 return;
1217
1219 startTimer.Type = queryCountdownTimer.TimerType;
1220 startTimer.TimeLeft = info->GetTimeLeft();
1221 startTimer.TotalTime = info->GetTotalTime();
1222
1223 _player->SendDirectMessage(startTimer.Write());
1224}
1225
1227{
1228 _player->SetCurrencyFlagsFromClient(setCurrenctFlags.CurrencyID, setCurrenctFlags.Flags);
1229}
#define MAX_CUF_PROFILES
Maximum number of CompactUnitFrames profiles.
Definition CUFProfile.h:26
AccountTypes
Definition Common.h:42
#define sConditionMgr
@ CONDITION_SOURCE_TYPE_AREATRIGGER_CLIENT_TRIGGERED
#define CORPSE_RECLAIM_RADIUS
Definition Corpse.h:38
@ CORPSE_RESURRECTABLE_PVP
Definition Corpse.h:33
DB2Storage< UISplashScreenEntry > sUISplashScreenStore("UISplashScreen.db2", &UiSplashScreenLoadInfo::Instance)
DB2Storage< DifficultyEntry > sDifficultyStore("Difficulty.db2", &DifficultyLoadInfo::Instance)
DB2Storage< AreaTriggerEntry > sAreaTriggerStore("AreaTrigger.db2", &AreaTriggerLoadInfo::Instance)
DB2Storage< AreaTableEntry > sAreaTableStore("AreaTable.db2", &AreaTableLoadInfo::Instance)
@ MAX_LEVEL
Definition DBCEnums.h:45
@ STRONG_MAX_LEVEL
Definition DBCEnums.h:49
@ MAP_INSTANCE
Definition DBCEnums.h:1585
@ MAP_RAID
Definition DBCEnums.h:1586
@ DIFFICULTY_FLAG_CAN_SELECT
Definition DBCEnums.h:977
@ DIFFICULTY_FLAG_LEGACY
Definition DBCEnums.h:980
Difficulty
Definition DBCEnums.h:932
@ LeaveAreaTriggerWithActionSet
@ EnterAreaTriggerWithActionSet
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
#define sGuildMgr
Definition GuildMgr.h:76
@ LANG_PLAYER_NOT_EXIST_OR_OFFLINE
Definition Language.h:763
@ LANG_DEBUG_AREATRIGGER_LEFT
Definition Language.h:1029
@ LANG_ACCOUNT_FOR_PLAYER_NOT_FOUND
Definition Language.h:764
@ LANG_YOU_NOT_HAVE_PERMISSION
Definition Language.h:759
@ LANG_NEED_CHARACTER_NAME
Definition Language.h:762
@ LANG_DEBUG_AREATRIGGER_ENTERED
Definition Language.h:982
#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
@ LOGIN_SEL_ACCOUNT_WHOIS
@ TRANSFER_ABORT_TOO_MANY_INSTANCES
Definition Map.h:95
@ TRANSFER_ABORT_DIFFICULTY
Definition Map.h:98
@ TRANSFER_ABORT_MAP_NOT_ALLOWED
Definition Map.h:106
@ TRANSFER_ABORT_MAX_PLAYERS
Definition Map.h:93
@ TRANSFER_ABORT_ZONE_IN_COMBAT
Definition Map.h:96
@ TRANSFER_ABORT_ALREADY_COMPLETED_ENCOUNTER
Definition Map.h:108
@ TRANSFER_ABORT_NOT_FOUND
Definition Map.h:94
@ TRANSFER_ABORT_LOCKED_TO_DIFFERENT_INSTANCE
Definition Map.h:107
@ TRANSFER_ABORT_NEED_GROUP
Definition Map.h:101
bool normalizePlayerName(std::string &name)
#define sObjectMgr
Definition ObjectMgr.h:1885
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:48
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition Player.h:924
@ PLAYER_FLAGS_IN_PVP
Definition Player.h:529
@ PLAYER_FLAGS_RESTING
Definition Player.h:525
@ PLAYER_FLAGS_GHOST
Definition Player.h:524
@ PLAYER_FLAGS_TAXI_BENCHMARK
Definition Player.h:537
@ PLAYER_FLAGS_PVP_TIMER
Definition Player.h:538
#define ACTION_BUTTON_TYPE(X)
Definition Player.h:408
#define ACTION_BUTTON_ACTION(X)
Definition Player.h:407
@ QUEST_OBJECTIVE_AREATRIGGER
Definition QuestDef.h:368
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:150
@ QUEST_FLAGS_COMPLETION_AREA_TRIGGER
Definition QuestDef.h:220
@ REST_FLAG_IN_TAVERN
Definition RestMgr.h:54
#define sScriptMgr
Definition ScriptMgr.h:1449
@ RAID_GROUP_ERR_ONLY
@ SPELL_AURA_PREVENT_RESURRECTION
@ UNIT_STAND_STATE_SLEEP
Definition UnitDefines.h:45
@ UNIT_STAND_STATE_KNEEL
Definition UnitDefines.h:50
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:42
@ UNIT_STAND_STATE_SIT
Definition UnitDefines.h:43
@ UNIT_BYTE2_FLAG_FFA_PVP
Definition UnitDefines.h:95
@ UNIT_FLAG_STUNNED
@ JUST_DIED
Definition Unit.h:253
void wstrToLower(std::wstring &str)
Definition Util.cpp:433
bool Utf8FitTo(std::string_view str, std::wstring_view search)
Definition Util.cpp:707
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition Util.cpp:336
#define sWhoListStorageMgr
std::vector< WhoListPlayerInfo > WhoListInfoVector
AccountDataType
#define NUM_ACCOUNT_DATA_TYPES
static bool IsPlayerAccount(uint32 gmlevel)
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
void PSendSysMessage(char const *fmt, Args &&... args)
Definition Chat.h:62
void EndCinematic()
void NextCinematicCamera()
static bool IsPlayerMeetingCondition(Player const *player, uint32 conditionId)
time_t const & GetGhostTime() const
Definition Corpse.h:125
CorpseType GetType() const
Definition Corpse.h:127
Class used to access individual fields of database query result.
Definition Field.h:94
std::string GetString() const noexcept
Definition Field.cpp:113
Seconds GetTotalTime() const
Definition Group.h:228
Seconds GetTimeLeft() const
Definition Group.cpp:42
Definition Group.h:205
bool isLFGGroup() const
Definition Group.cpp:1623
void ResetInstances(InstanceResetMethod method, Player *notifyPlayer)
Definition Group.cpp:1364
bool IsLeader(ObjectGuid guid) const
Definition Group.cpp:1690
void SetDungeonDifficultyID(Difficulty difficulty)
Definition Group.cpp:1285
void SetRaidDifficultyID(Difficulty difficulty)
Definition Group.cpp:1306
void SetLegacyRaidDifficultyID(Difficulty difficulty)
Definition Group.cpp:1327
CountdownInfo const * GetCountdownInfo(CountdownTimerType timerType) const
Definition Group.cpp:1427
Definition Guild.h:329
Definition Map.h:225
bool IsDungeon() const
Definition Map.cpp:3267
static TransferAbortParams PlayerCannotEnter(uint32 mapid, Player *player)
Definition Map.cpp:1797
bool Instanceable() const
Definition Map.cpp:3262
static ObjectGuid const Empty
Definition ObjectGuid.h:314
std::string ToString() const
void RemoveActionButton(uint8 button)
Definition Player.cpp:6208
WorldLocation const & GetCorpseLocation() const
Definition Player.h:2338
void SetPlayerFlag(PlayerFlags flags)
Definition Player.h:2911
bool CanCompleteQuest(uint32 quest_id, uint32 ignoredQuestObjectiveId=0)
Definition Player.cpp:14558
void RemovePlayerFlag(PlayerFlags flags)
Definition Player.h:2912
void SendRaidGroupOnlyMessage(RaidGroupReason reason, int32 delay) const
Definition Player.cpp:30824
void SetSeer(WorldObject *target)
Definition Player.h:2672
void KillPlayer()
Definition Player.cpp:4460
uint32 GetTotalPlayedTime() const
Definition Player.h:1347
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:6283
ActionButton * AddActionButton(uint8 button, uint64 action, uint8 type)
Definition Player.cpp:6192
UF::UpdateField< UF::ActivePlayerData, int32(WowCS::EntityFragment::CGObject), TYPEID_ACTIVE_PLAYER > m_activePlayerData
Definition Player.h:3062
void ResurrectUsingRequestData()
Definition Player.cpp:26461
uint16 FindQuestSlot(uint32 quest_id) const
Definition Player.cpp:16383
bool InBattleground() const
Definition Player.h:2584
void SendDungeonDifficulty(int32 forcedDifficulty=-1) const
Definition Player.cpp:21866
void SpawnCorpseBones(bool triggerSave=true)
Definition Player.cpp:4554
void SetSelection(ObjectGuid const &guid)
Used for serverside target changes, does not apply to players.
Definition Player.h:1921
void SetRaidDifficultyID(Difficulty raid_difficulty)
Definition Player.h:2187
bool HasCorpse() const
Definition Player.h:2337
GuidUnorderedSet m_clientGUIDs
Definition Player.h:2699
void SetAdvancedCombatLogging(bool enabled)
Definition Player.h:2886
ObjectGuid GetStableMaster() const
Definition Player.cpp:29847
void SetStableMaster(ObjectGuid stableMaster)
Definition Player.cpp:29855
bool HasPendingBind() const
Definition Player.h:2777
void UpdateVisibleObjectInteractions(bool allUnits, bool onlySpellClicks, bool gameObjectQuestGiverStatus, bool questObjectiveGameObjects)
Definition Player.cpp:25949
void CompleteQuest(uint32 quest_id)
Definition Player.cpp:14936
WorldSafeLocsEntry const * GetInstanceEntrance(uint32 targetMapId)
Definition Player.cpp:20226
WorldSession * GetSession() const
Definition Player.h:2272
OutdoorPvP * GetOutdoorPvP() const
Definition Player.cpp:26206
bool IsQuestObjectiveCompletable(uint16 slot, Quest const *quest, QuestObjective const &objective) const
Definition Player.cpp:17133
RestMgr & GetRestMgr() const
Definition Player.h:2890
void RepopAtGraveyard()
Definition Player.cpp:4788
Difficulty GetDungeonDifficultyID() const
Definition Player.h:2183
CinematicMgr * GetCinematicMgr() const
Definition Player.h:1658
void SetLegacyRaidDifficultyID(Difficulty raid_difficulty)
Definition Player.h:2188
void UpdateCriteria(CriteriaType type, uint64 miscValue1=0, uint64 miscValue2=0, uint64 miscValue3=0, WorldObject *ref=nullptr)
Definition Player.cpp:27588
void UpdateVisibilityForPlayer()
Definition Player.cpp:24837
void ClearResurrectRequestData()
Definition Player.h:2091
WorldObject * GetViewpoint() const
Definition Player.cpp:26968
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
bool TeleportToBGEntryPoint()
Definition Player.cpp:1478
bool IsInAreaTrigger(AreaTriggerEntry const *areaTrigger) const
Definition Player.cpp:1998
Corpse * GetCorpse() const
Definition Player.cpp:4562
void ConfirmPendingBind()
Definition Player.cpp:20031
ObjectGuid::LowType GetGuildId() const
Definition Player.h:2164
CUFProfile * GetCUFProfile(uint8 id) const
‍Replaces a CUF profile at position 0-4
Definition Player.h:1847
void SetMovie(uint32 movie)
Definition Player.h:2114
void SetPendingBind(uint32 instanceId, uint32 bindTimer)
Definition Player.cpp:20041
PvPInfo pvpInfo
Definition Player.h:2124
void SaveCUFProfile(uint8 id, std::nullptr_t)
Definition Player.h:1845
uint32 GetCorpseReclaimDelay(bool pvp) const
Definition Player.cpp:26566
void AreaExploredOrEventHappens(uint32 questId)
Definition Player.cpp:16552
void SetDungeonDifficultyID(Difficulty dungeon_difficulty)
Definition Player.h:2186
bool IsQuestObjectiveComplete(uint16 slot, Quest const *quest, QuestObjective const &objective) const
Definition Player.cpp:17208
Difficulty GetRaidDifficultyID() const
Definition Player.h:2184
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg=0, int32 mapDifficultyXConditionID=0) const
Definition Player.cpp:25195
void SetWarModeDesired(bool enabled)
Definition Player.cpp:31032
void SetChosenTitle(int32 title)
Definition Player.h:2853
void SendRaidDifficulty(bool legacy, int32 forcedDifficulty=-1) const
Definition Player.cpp:21873
bool InArena() const
Definition Player.cpp:25849
void SendLootReleaseAll() const
Definition Player.cpp:9162
Group * GetGroup(Optional< uint8 > partyIndex)
Definition Player.h:2796
void BuildPlayerRepop()
Definition Player.cpp:4321
bool HasPlayerFlag(PlayerFlags flags) const
Definition Player.h:2910
void ResetInstances(InstanceResetMethod method)
Reset all solo instances and optionally send a message on success for each.
Definition Player.cpp:21888
void SetCurrencyFlagsFromClient(uint32 id, CurrencyDbFlags flags)
Definition Player.cpp:7457
void SetQuestObjectiveData(QuestObjective const &objective, int32 data)
Definition Player.cpp:17084
void SendMessageToSet(WorldPacket const *data, bool self) const override
Definition Player.h:2325
uint32 GetLevelPlayedTime() const
Definition Player.h:1348
bool isDebugAreaTriggers
Definition Player.h:2865
void SetMultiActionBars(uint8 mask)
Definition Player.h:2122
void UpdatePvP(bool state, bool override=false)
Definition Player.cpp:24109
void SendQuestUpdateAddCreditSimple(QuestObjective const &obj) const
Definition Player.cpp:17442
Difficulty GetLegacyRaidDifficultyID() const
Definition Player.h:2185
uint32 GetMovie() const
Definition Player.h:2113
std::unique_ptr< PlayerMenu > PlayerTalkClass
Definition Player.h:2570
Team GetTeam() const
Definition Player.h:2423
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition Player.cpp:4379
void setUInt32(uint8 index, uint32 value)
QuestObjectives Objectives
Definition QuestDef.h:757
bool HasFlag(QuestFlags flag) const
Definition QuestDef.h:619
void RemoveRestFlag(RestFlag restFlag)
Definition RestMgr.cpp:107
void SetInnTrigger(Optional< InnAreaTrigger > trigger)
Definition RestMgr.h:83
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition Unit.cpp:10731
bool IsAlive() const
Definition Unit.h:1185
void SetPvpFlag(UnitPVPStateFlags flags)
Definition Unit.h:881
bool IsInFlight() const
Definition Unit.h:1027
void SetRooted(bool apply)
Definition Unit.cpp:11673
void RemovePvpFlag(UnitPVPStateFlags flags)
Definition Unit.h:882
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:846
bool IsInCombat() const
Definition Unit.h:1058
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:847
constexpr uint32 GetMapId() const
Definition Position.h:216
Map * GetMap() const
Definition Object.h:411
Map * FindMap() const
Definition Object.h:412
std::string const & GetName() const
Definition Object.h:342
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:501
uint32 GetZoneId() const
Definition Object.h:332
size_type size() const
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< CUFProfile const * > CUFProfiles
Array< int32, 2 > SpellVisualKitIDs
Array< std::unique_ptr< CUFProfile >, MAX_CUF_PROFILES > CUFProfiles
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< int32 > SpellVisualKitIDs
WorldPacket const * Write() override
Duration< Seconds > TotalTime
WorldPacket const * Write() override
Duration< Seconds > TimeLeft
uint64 Action
two packed values (action and type)
Underlying AsUnderlyingType() const
WorldPacket const * Write() override
WorldPacket const * Write() override
void HandleViolenceLevel(WorldPackets::Misc::ViolenceLevel &violenceLevel)
void HandlePlayedTime(WorldPackets::Character::RequestPlayedTime &packet)
void LogoutPlayer(bool save)
Log the player out
void HandleNextCinematicCamera(WorldPackets::Misc::NextCinematicCamera &packet)
void HandleCloseInteraction(WorldPackets::Misc::CloseInteraction &closeInteraction)
void HandleResetInstancesOpcode(WorldPackets::Instance::ResetInstances &packet)
void HandleQueryCountdownTimer(WorldPackets::Misc::QueryCountdownTimer &queryCountdownTimer)
void HandleSaveCUFProfiles(WorldPackets::Misc::SaveCUFProfiles &packet)
void HandleSetDungeonDifficultyOpcode(WorldPackets::Misc::SetDungeonDifficulty &setDungeonDifficulty)
void SendNotification(char const *format,...) ATTR_PRINTF(2
void HandleLogoutCancelOpcode(WorldPackets::Character::LogoutCancel &logoutCancel)
AccountTypes GetSecurity() const
void HandleRequestCemeteryList(WorldPackets::Misc::RequestCemeteryList &packet)
void HandleConversationLineStarted(WorldPackets::Misc::ConversationLineStarted &conversationLineStarted)
void HandleInstanceLockResponse(WorldPackets::Instance::InstanceLockResponse &packet)
void SendLoadCUFProfiles()
void HandleSetSelectionOpcode(WorldPackets::Misc::SetSelection &packet)
void HandleSetCurrencyFlags(WorldPackets::Misc::SetCurrencyFlags const &setCurrenctFlags)
LocaleConstant GetSessionDbcLocale() const
void HandleSetActionButtonOpcode(WorldPackets::Spells::SetActionButton &packet)
void HandleRepopRequest(WorldPackets::Misc::RepopRequest &packet)
Player * GetPlayer() const
std::unique_ptr< CollectionMgr > _collectionMgr
void HandleUpdateAccountData(WorldPackets::ClientConfig::UserClientUpdateAccountData &packet)
void HandleSetAdvancedCombatLogging(WorldPackets::ClientConfig::SetAdvancedCombatLogging &setAdvancedCombatLogging)
void SetLogoutStartTime(time_t requestTime)
Engage the logout process for the user.
void HandleServerTimeOffsetRequest(WorldPackets::Misc::ServerTimeOffsetRequest &)
void HandleSetTaxiBenchmark(WorldPackets::Misc::SetTaxiBenchmarkMode &packet)
AccountData const * GetAccountData(AccountDataType type) const
void HandleWhoIsOpcode(WorldPackets::Who::WhoIsRequest &packet)
void HandleMountSpecialAnimOpcode(WorldPackets::Misc::MountSpecial &mountSpecial)
void HandleSetWarMode(WorldPackets::Misc::SetWarMode &packet)
void HandleRequestAccountData(WorldPackets::ClientConfig::RequestAccountData &request)
void HandleTogglePvP(WorldPackets::Misc::TogglePvP &packet)
void HandleCompleteMovie(WorldPackets::Misc::CompleteMovie &packet)
void HandleObjectUpdateFailedOpcode(WorldPackets::Misc::ObjectUpdateFailed &objectUpdateFailed)
void HandleLogoutRequestOpcode(WorldPackets::Character::LogoutRequest &logoutRequest)
void HandleSetTitleOpcode(WorldPackets::Character::SetTitle &packet)
bool HasPermission(uint32 permissionId)
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
uint32 GetAccountId() const
void HandleWhoOpcode(WorldPackets::Who::WhoRequestPkt &whoRequest)
void HandleSetRaidDifficultyOpcode(WorldPackets::Misc::SetRaidDifficulty &setRaidDifficulty)
void HandleFarSightOpcode(WorldPackets::Misc::FarSight &packet)
Player * _player
void HandleSetPvP(WorldPackets::Misc::SetPvP &packet)
void HandleMountSetFavorite(WorldPackets::Misc::MountSetFavorite &mountSetFavorite)
void HandleObjectUpdateRescuedOpcode(WorldPackets::Misc::ObjectUpdateRescued &objectUpdateRescued)
void HandlePortGraveyard(WorldPackets::Misc::PortGraveyard &packet)
void HandleSetActionBarToggles(WorldPackets::Character::SetActionBarToggles &packet)
void HandleRequestLatestSplashScreen(WorldPackets::Misc::RequestLatestSplashScreen &requestLatestSplashScreen)
void HandleStandStateChangeOpcode(WorldPackets::Misc::StandStateChange &packet)
std::string const & GetPlayerName() const
void HandleAreaTriggerOpcode(WorldPackets::AreaTrigger::AreaTrigger &packet)
void SetAccountData(AccountDataType type, time_t time, std::string const &data)
void HandleCompleteCinematic(WorldPackets::Misc::CompleteCinematic &packet)
void HandleReclaimCorpse(WorldPackets::Misc::ReclaimCorpse &packet)
void HandleResurrectResponse(WorldPackets::Misc::ResurrectResponse &packet)
void HandleGuildSetFocusedAchievement(WorldPackets::Achievement::GuildSetFocusedAchievement &setFocusedAchievement)
#define sWorld
Definition World.h:916
uint32 GetVirtualRealmAddress()
Definition World.cpp:3526
@ CONFIG_MAX_WHO
Definition World.h:348
@ CONFIG_GM_LEVEL_IN_WHO_LIST
Definition World.h:290
SystemTimePoint GetSystemTime()
Current chrono system_clock time point.
Definition GameTime.cpp:62
time_t GetGameTime()
Definition GameTime.cpp:52
TC_GAME_API Player * FindConnectedPlayerByName(std::string_view name)
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
TC_GAME_API Conversation * GetConversation(WorldObject const &u, ObjectGuid const &guid)
@ RBAC_PERM_OPCODE_WHOIS
Definition RBAC.h:96
@ RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS
Definition RBAC.h:88
@ RBAC_PERM_TWO_SIDE_WHO_LIST
Definition RBAC.h:81
@ RBAC_PERM_INSTANT_LOGOUT
Definition RBAC.h:54
std::string Data
int32 AreaTriggerActionSetID
Represents a CompactUnitFrame profile.
Definition CUFProfile.h:64
time_t EndTimer
‍Marks if player is in an FFAPvP area (such as Gurubashi Arena)
Definition Player.h:445
constexpr bool HasRace(uint32 raceId) const
Definition RaceMask.h:96
bool Initialize(ObjectGuid const &guid, Player const *player=nullptr)
Query::PlayerGuidLookupData PlayerData
Definition WhoPackets.h:95
std::vector< WhoWord > Words
Definition WhoPackets.h:72
Trinity::RaceMask< std::array< int32, 2 > > RaceFilter
Definition WhoPackets.h:70
std::vector< WhoEntry > Entries
Definition WhoPackets.h:105
WorldLocation Loc
Definition ObjectMgr.h:836