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
100
101 std::vector<std::wstring> wWords;
102 wWords.resize(request.Words.size());
103 for (size_t i = 0; i < request.Words.size(); ++i)
104 {
105 TC_LOG_DEBUG("network", "WorldSession::HandleWhoOpcode: Word: {}", request.Words[i].Word);
106
107 // user entered string, it used as universal search pattern(guild+player name)?
108 if (!Utf8toWStr(request.Words[i].Word, wWords[i]))
109 continue;
110
111 wstrToLower(wWords[i]);
112 }
113
114 std::wstring wPlayerName;
115 std::wstring wGuildName;
116
117 if (!(Utf8toWStr(request.Name, wPlayerName) && Utf8toWStr(request.Guild, wGuildName)))
118 return;
119
120 wstrToLower(wPlayerName);
121 wstrToLower(wGuildName);
122
123 // client send in case not set max level value 100 but Trinity supports 255 max level,
124 // update it to show GMs with characters after 100 level
125 if (whoRequest.Request.MaxLevel >= MAX_LEVEL)
126 whoRequest.Request.MaxLevel = STRONG_MAX_LEVEL;
127
128 uint32 team = _player->GetTeam();
129
130 uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
131
133 response.Token = whoRequest.Token;
134
135 WhoListInfoVector const& whoList = sWhoListStorageMgr->GetWhoList();
136 for (WhoListPlayerInfo const& target : whoList)
137 {
138 // player can see member of other team only if has RBAC_PERM_TWO_SIDE_WHO_LIST
139 if (target.GetTeam() != team && !HasPermission(rbac::RBAC_PERM_TWO_SIDE_WHO_LIST))
140 continue;
141
142 // player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if has RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS
143 if (target.GetSecurity() > AccountTypes(gmLevelInWhoList) && !HasPermission(rbac::RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS))
144 continue;
145
146 // check if target is globally visible for player
147 if (_player->GetGUID() != target.GetGuid() && !target.IsVisible())
149 continue;
150
151 // check if target's level is in level range
152 int32 lvl = target.GetLevel();
153 if (lvl < request.MinLevel || lvl > request.MaxLevel)
154 continue;
155
156 // check if class matches classmask
157 if (request.ClassFilter >= 0 && !(request.ClassFilter & (1 << target.GetClass())))
158 continue;
159
160 // check if race matches racemask
161 if (!request.RaceFilter.HasRace(target.GetRace()))
162 continue;
163
164 if (!whoRequest.Areas.empty())
165 if (std::ranges::find(whoRequest.Areas, int32(target.GetZoneId())) == whoRequest.Areas.end())
166 continue;
167
168 std::wstring const& wTargetName = target.GetWidePlayerName();
169 if (!(wPlayerName.empty() || wTargetName.find(wPlayerName) != std::wstring::npos))
170 continue;
171
172 std::wstring const& wTargetGuildName = target.GetWideGuildName();
173
174 if (!wGuildName.empty() && wTargetGuildName.find(wGuildName) == std::wstring::npos)
175 continue;
176
177 if (!wWords.empty())
178 {
179 std::string aName;
180 if (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(target.GetZoneId()))
181 aName = areaEntry->AreaName[GetSessionDbcLocale()];
182
183 bool show = false;
184 for (size_t i = 0; i < wWords.size(); ++i)
185 {
186 if (!wWords[i].empty())
187 {
188 if (wTargetName.find(wWords[i]) != std::wstring::npos ||
189 wTargetGuildName.find(wWords[i]) != std::wstring::npos ||
190 Utf8FitTo(aName, wWords[i]))
191 {
192 show = true;
193 break;
194 }
195 }
196 }
197
198 if (!show)
199 continue;
200 }
201
203 if (!whoEntry.PlayerData.Initialize(target.GetGuid(), nullptr))
204 continue;
205
206 if (!target.GetGuildGuid().IsEmpty())
207 {
208 whoEntry.GuildGUID = target.GetGuildGuid();
210 whoEntry.GuildName = target.GetGuildName();
211 }
212
213 whoEntry.AreaID = target.GetZoneId();
214 whoEntry.IsGM = target.IsGameMaster();
215
216 response.Response.Entries.push_back(whoEntry);
217
218 // 50 is maximum player count sent to client - can be overridden
219 // through config, but is unstable
220 if (response.Response.Entries.size() >= sWorld->getIntConfig(CONFIG_MAX_WHO))
221 break;
222 }
223
224 SendPacket(response.Write());
225}
226
228{
229 if (!GetPlayer()->GetLootGUID().IsEmpty())
231
232 bool instantLogout = GetPlayer()->IsInFlight();
233 if (!logoutRequest.IdleLogout)
234 instantLogout |= (GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat())
236
238 bool canLogoutInCombat = GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_RESTING);
239
240 uint32 reason = 0;
241 if (GetPlayer()->IsInCombat() && !canLogoutInCombat)
242 reason = 1;
243 else if (GetPlayer()->IsFalling())
244 reason = 3; // is jumping or falling
245 else if (GetPlayer()->duel || GetPlayer()->HasAura(9454)) // is dueling or frozen by GM via freeze command
246 reason = 2; // FIXME - Need the correct value
247
249 logoutResponse.LogoutResult = reason;
250 logoutResponse.Instant = instantLogout;
251 SendPacket(logoutResponse.Write());
252
253 if (reason)
254 {
256 return;
257 }
258
259 // instant logout in taverns/cities or on taxi or for admins, gm's, mod's if its enabled in worldserver.conf
260 if (instantLogout)
261 {
262 LogoutPlayer(true);
263 return;
264 }
265
266 // not set flags if player can't free move to prevent lost state at logout cancel
267 if (GetPlayer()->CanFreeMove())
268 {
269 if (GetPlayer()->GetStandState() == UNIT_STAND_STATE_STAND)
271 GetPlayer()->SetRooted(true);
273 }
274
276}
277
279{
280 // Player have already logged out serverside, too late to cancel
281 if (!GetPlayer())
282 return;
283
285
287
288 // not remove flags if can't free move - its not set in Logout request code.
289 if (GetPlayer()->CanFreeMove())
290 {
292 GetPlayer()->SetRooted(false);
293
296
299 }
300}
301
303{
304 if (!GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_IN_PVP))
305 {
308 if (!GetPlayer()->IsPvP() || GetPlayer()->pvpInfo.EndTimer)
309 GetPlayer()->UpdatePvP(true, true);
310 }
311 else if (!GetPlayer()->IsWarModeLocalActive())
312 {
315 if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP())
316 GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
317 }
318}
319
321{
322 if (packet.EnablePVP)
323 {
326 if (!GetPlayer()->IsPvP() || GetPlayer()->pvpInfo.EndTimer)
327 GetPlayer()->UpdatePvP(true, true);
328 }
329 else if (!GetPlayer()->IsWarModeLocalActive())
330 {
333 if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP())
334 GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
335 }
336}
337
342
344{
345 if (GetPlayer()->IsAlive() || !GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_GHOST))
346 return;
348}
349
351{
352 uint32 zoneId = _player->GetZoneId();
353 uint32 team = _player->GetTeam();
354
355 std::vector<uint32> graveyardIds;
356 auto range = sObjectMgr->GraveyardStore.equal_range(zoneId);
357
358 for (auto it = range.first; it != range.second && graveyardIds.size() < 16; ++it) // client max
359 {
360 ConditionSourceInfo conditionSource(_player);
361 if (!it->second.Conditions.Meets(conditionSource))
362 continue;
363
364 graveyardIds.push_back(it->first);
365 }
366
367 if (graveyardIds.empty())
368 {
369 TC_LOG_DEBUG("network", "No graveyards found for zone {} for {} (team {}) in CMSG_REQUEST_CEMETERY_LIST",
370 zoneId, _player->GetGUID().ToString(), team);
371 return;
372 }
373
375 packet.IsGossipTriggered = false;
376 packet.CemeteryID.reserve(graveyardIds.size());
377
378 for (uint32 id : graveyardIds)
379 packet.CemeteryID.push_back(id);
380
381 SendPacket(packet.Write());
382}
383
388
390{
391 switch (packet.StandState)
392 {
397 break;
398 default:
399 return;
400 }
401
403}
404
406{
407 if (_player->IsAlive())
408 return;
409
410 // do not allow corpse reclaim in arena
411 if (_player->InArena())
412 return;
413
414 // body not released yet
416 return;
417
418 Corpse* corpse = _player->GetCorpse();
419 if (!corpse)
420 return;
421
422 // prevent resurrect before 30-sec delay after body release not finished
423 if (time_t(corpse->GetGhostTime() + _player->GetCorpseReclaimDelay(corpse->GetType() == CORPSE_RESURRECTABLE_PVP)) > time_t(GameTime::GetGameTime()))
424 return;
425
427 return;
428
429 // resurrect
431
432 // spawn bones
434}
435
437{
438 if (GetPlayer()->IsAlive())
439 return;
440
441 if (packet.Response != 0) // Accept = 0 Decline = 1 Timeout = 2
442 {
444 return;
445 }
446
447 if (!GetPlayer()->IsResurrectRequestedBy(packet.Resurrecter))
448 return;
449
450 if (Player* ressPlayer = ObjectAccessor::GetPlayer(*GetPlayer(), packet.Resurrecter))
451 {
452 if (InstanceScript* instance = ressPlayer->GetInstanceScript())
453 {
454 if (instance->IsEncounterInProgress())
455 {
456 if (!instance->GetCombatResurrectionCharges())
457 return;
458 else
459 instance->UseCombatResurrection();
460 }
461 }
462 }
463
465}
466
468{
469 Player* player = GetPlayer();
470 if (player->IsInFlight())
471 {
472 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} in flight, ignore Area Trigger ID: {}",
473 player->GetName(), player->GetGUID().ToString(), packet.AreaTriggerID);
474 return;
475 }
476
477 AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(packet.AreaTriggerID);
478 if (!atEntry)
479 {
480 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} send unknown (by DBC) Area Trigger ID: {}",
481 player->GetName(), player->GetGUID().ToString(), packet.AreaTriggerID);
482 return;
483 }
484
485 if (packet.Entered != player->IsInAreaTrigger(atEntry))
486 {
487 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} too far, ignore Area Trigger ID: {}",
488 player->GetName(), player->GetGUID().ToString(), packet.AreaTriggerID);
489 return;
490 }
491
492 if (player->isDebugAreaTriggers)
494
495 if (!sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_AREATRIGGER_CLIENT_TRIGGERED, atEntry->ID, player))
496 return;
497
498 if (sScriptMgr->OnAreaTrigger(player, atEntry, packet.Entered))
499 return;
500
501 if (atEntry->AreaTriggerActionSetID)
502 {
503 if (packet.Entered)
505 else
507 }
508
509 if (player->IsAlive() && packet.Entered)
510 {
511 // not using Player::UpdateQuestObjectiveProgress, ObjectID in quest_objectives can be set to -1, areatrigger_involvedrelation then holds correct id
512 if (std::unordered_set<uint32> const* quests = sObjectMgr->GetQuestsForAreaTrigger(packet.AreaTriggerID))
513 {
514 bool anyObjectiveChangedCompletionState = false;
515 for (uint32 questId : *quests)
516 {
517 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questId);
518 uint16 slot = player->FindQuestSlot(questId);
519 if (qInfo && slot < MAX_QUEST_LOG_SIZE && player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE)
520 {
521 for (QuestObjective const& obj : qInfo->Objectives)
522 {
523 if (obj.Type != QUEST_OBJECTIVE_AREATRIGGER)
524 continue;
525
526 if (!player->IsQuestObjectiveCompletable(slot, qInfo, obj))
527 continue;
528
529 if (player->IsQuestObjectiveComplete(slot, qInfo, obj))
530 continue;
531
532 if (obj.ObjectID != -1 && obj.ObjectID != packet.AreaTriggerID)
533 continue;
534
535 player->SetQuestObjectiveData(obj, 1);
537 anyObjectiveChangedCompletionState = true;
538 break;
539 }
540
542 player->AreaExploredOrEventHappens(questId);
543
544 if (player->CanCompleteQuest(questId))
545 player->CompleteQuest(questId);
546 }
547 }
548
549 if (anyObjectiveChangedCompletionState)
550 player->UpdateVisibleObjectInteractions(true, false, false, true);
551 }
552 }
553
554 if (sObjectMgr->IsTavernAreaTrigger(packet.AreaTriggerID))
555 {
556 // set resting flag we are in the inn
557 if (packet.Entered)
558 {
559 player->GetRestMgr().SetInnTrigger(InnAreaTrigger{ .IsDBC = true, .AreaTriggerEntryId = atEntry->ID });
560 }
561 else
562 {
564 player->GetRestMgr().SetInnTrigger(std::nullopt);
565 }
566
567 if (sWorld->IsFFAPvPRealm())
568 {
569 if (packet.Entered)
571 else
573 }
574
575 return;
576 }
577
578 if (OutdoorPvP* pvp = player->GetOutdoorPvP())
579 if (pvp->HandleAreaTrigger(_player, packet.AreaTriggerID, packet.Entered))
580 return;
581
582 if (!packet.Entered)
583 return;
584
585 AreaTriggerTeleport const* at = sObjectMgr->GetAreaTrigger(packet.AreaTriggerID);
586 if (!at)
587 return;
588
589 bool teleported = false;
590 if (player->GetMapId() != at->Loc.GetMapId())
591 {
592 if (!player->IsAlive())
593 {
594 if (player->HasCorpse())
595 {
596 // let enter in ghost mode in instance that connected to inner instance with corpse
597 uint32 corpseMap = player->GetCorpseLocation().GetMapId();
598 do
599 {
600 if (corpseMap == at->Loc.GetMapId())
601 break;
602
603 InstanceTemplate const* corpseInstance = sObjectMgr->GetInstanceTemplate(corpseMap);
604 corpseMap = corpseInstance ? corpseInstance->Parent : 0;
605 } while (corpseMap);
606
607 if (!corpseMap)
608 {
610 return;
611 }
612
613 TC_LOG_DEBUG("maps", "MAP: Player '{}' has corpse in instance {} and can enter.", player->GetName(), at->Loc.GetMapId());
614 }
615 else
616 {
617 TC_LOG_DEBUG("maps", "Map::CanPlayerEnter - player '{}' is dead but does not have a corpse!", player->GetName());
619 return;
620 }
621 }
622
623 if (TransferAbortParams denyReason = Map::PlayerCannotEnter(at->Loc.GetMapId(), player))
624 {
625 switch (denyReason.Reason)
626 {
628 TC_LOG_DEBUG("maps", "MAP: Player '{}' attempted to enter map with id {} which has no entry", player->GetName(), at->Loc.GetMapId());
629 break;
631 TC_LOG_DEBUG("maps", "MAP: Player '{}' attempted to enter instance map {} but the requested difficulty was not found", player->GetName(), at->Loc.GetMapId());
632 break;
634 TC_LOG_DEBUG("maps", "MAP: Player '{}' must be in a raid group to enter map {}", player->GetName(), at->Loc.GetMapId());
636 break;
638 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());
639 break;
641 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());
642 break;
644 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());
645 break;
647 break;
649 break;
651 TC_LOG_DEBUG("maps", "MAP: Player '{}' cannot enter instance map {} because instance is resetting.", player->GetName(), at->Loc.GetMapId());
652 break;
653 default:
654 break;
655 }
656
657 if (denyReason.Reason != TRANSFER_ABORT_NEED_GROUP)
658 player->SendTransferAborted(at->Loc.GetMapId(), denyReason.Reason, denyReason.Arg, denyReason.MapDifficultyXConditionId);
659
660 if (!player->IsAlive() && player->HasCorpse())
661 {
662 if (player->GetCorpseLocation().GetMapId() == at->Loc.GetMapId())
663 {
664 player->ResurrectPlayer(0.5f);
665 player->SpawnCorpseBones();
666 }
667 }
668
669 return;
670 }
671
672 if (Group* group = player->GetGroup())
673 if (group->isLFGGroup() && player->GetMap()->IsDungeon())
674 teleported = player->TeleportToBGEntryPoint();
675 }
676
677 if (!teleported)
678 {
679 WorldSafeLocsEntry const* entranceLocation = player->GetInstanceEntrance(at->Loc.GetMapId());
680 if (entranceLocation && player->GetMapId() != at->Loc.GetMapId())
681 player->TeleportTo(entranceLocation->Loc, TELE_TO_NOT_LEAVE_TRANSPORT);
682 else
684 }
685}
686
688{
689 TC_LOG_DEBUG("network", "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA: type {}, time {}, decompressedSize {}",
690 packet.DataType, packet.Time.AsUnderlyingType(), packet.Size);
691
692 if (packet.DataType >= NUM_ACCOUNT_DATA_TYPES)
693 return;
694
695 if (packet.Size == 0) // erase
696 {
698
700 updateAccountDataComplete.Player = packet.PlayerGuid;
701 updateAccountDataComplete.DataType = packet.DataType;
702 updateAccountDataComplete.Result = 0;
703 SendPacket(updateAccountDataComplete.Write());
704
705 return;
706 }
707
708 if (packet.Size > 0xFFFF)
709 {
710 TC_LOG_ERROR("network", "UAD: Account data packet too big, size {}", packet.Size);
711 return;
712 }
713
714 std::string dest;
715 dest.resize(packet.Size);
716
717 uLongf realSize = packet.Size;
718 if (uncompress(reinterpret_cast<Bytef*>(dest.data()), &realSize, packet.CompressedData.data(), packet.CompressedData.size()) != Z_OK)
719 {
720 TC_LOG_ERROR("network", "UAD: Failed to decompress account data");
721 return;
722 }
723
724 SetAccountData(AccountDataType(packet.DataType), packet.Time, dest);
725
727 updateAccountDataComplete.Player = packet.PlayerGuid;
728 updateAccountDataComplete.DataType = packet.DataType;
729 updateAccountDataComplete.Result = 0;
730 SendPacket(updateAccountDataComplete.Write());
731}
732
734{
735 TC_LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA: type {}", request.DataType);
736
737 if (request.DataType >= NUM_ACCOUNT_DATA_TYPES)
738 return;
739
740 AccountData const* adata = GetAccountData(AccountDataType(request.DataType));
741
744 data.Time = adata->Time;
745 data.Size = adata->Data.size();
746 data.DataType = request.DataType;
747
748 uLongf destSize = compressBound(data.Size);
749
750 data.CompressedData.resize(destSize);
751
752 if (data.Size && compress(data.CompressedData.data(), &destSize, (uint8 const*)adata->Data.c_str(), data.Size) != Z_OK)
753 {
754 TC_LOG_ERROR("network", "RAD: Failed to compress account data");
755 return;
756 }
757
758 data.CompressedData.resize(destSize);
759
760 SendPacket(data.Write());
761}
762
764{
765 uint64 action = ACTION_BUTTON_ACTION(packet.Action);
766 uint8 type = ACTION_BUTTON_TYPE(packet.Action);
767
768 TC_LOG_DEBUG("network", "CMSG_SET_ACTION_BUTTON Button: {} Action: {} Type: {}", packet.Index, action, uint32(type));
769
770 if (!packet.Action)
772 else
773 GetPlayer()->AddActionButton(packet.Index, action, type);
774}
775
777{
778 // If player has sight bound to visual waypoint NPC we should remove it
780}
781
783{
784 // Sent by client when cinematic actually begun. So we begin the server side process
786}
787
789{
790 uint32 movie = _player->GetMovie();
791 if (!movie)
792 return;
793
794 _player->SetMovie(0);
795 sScriptMgr->OnMovieComplete(_player, movie);
796}
797
799{
800 if (!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED)
801 {
802 if (packet.Mask != 0)
803 TC_LOG_ERROR("network", "WorldSession::HandleSetActionBarToggles in not logged state with value: {}, ignored", uint32(packet.Mask));
804 return;
805 }
806
808}
809
811{
813 playedTime.TotalTime = _player->GetTotalPlayedTime();
814 playedTime.LevelTime = _player->GetLevelPlayedTime();
815 playedTime.TriggerEvent = packet.TriggerScriptEvent; // 0-1 - will not show in chat frame
816 SendPacket(playedTime.Write());
817}
818
820{
821 TC_LOG_DEBUG("network", "Received whois command from player {} for character {}",
822 GetPlayer()->GetName(), packet.CharName);
823
825 {
827 return;
828 }
829
830 if (packet.CharName.empty() || !normalizePlayerName(packet.CharName))
831 {
833 return;
834 }
835
837 if (!player)
838 {
840 return;
841 }
842
844 stmt->setUInt32(0, player->GetSession()->GetAccountId());
845
846 PreparedQueryResult result = LoginDatabase.Query(stmt);
847 if (!result)
848 {
850 return;
851 }
852
853 Field* fields = result->Fetch();
854 std::string acc = fields[0].GetString();
855 if (acc.empty())
856 acc = "Unknown";
857
858 std::string email = fields[1].GetString();
859 if (email.empty())
860 email = "Unknown";
861
862 std::string lastip = fields[2].GetString();
863 if (lastip.empty())
864 lastip = "Unknown";
865
867 response.AccountName = packet.CharName + "'s " + "account is " + acc + ", e-mail: " + email + ", last ip: " + lastip;
868 SendPacket(response.Write());
869}
870
872{
873 if (packet.Enable)
874 {
875 TC_LOG_DEBUG("network", "Added FarSight {} to player {}", _player->m_activePlayerData->FarsightObject->ToString(), _player->GetGUID().ToString());
876 if (WorldObject* target = _player->GetViewpoint())
877 _player->SetSeer(target);
878 else
879 TC_LOG_DEBUG("network", "Player {} {} requests non-existing seer {}", _player->GetName(), _player->GetGUID().ToString(), _player->m_activePlayerData->FarsightObject->ToString());
880 }
881 else
882 {
883 TC_LOG_DEBUG("network", "Player {} set vision to self", _player->GetGUID().ToString());
885 }
886
888}
889
891{
892 // -1 at none
893 if (packet.TitleID > 0)
894 {
895 if (!GetPlayer()->HasTitle(packet.TitleID))
896 return;
897 }
898 else
899 packet.TitleID = 0;
900
902}
903
905{
906 Map* map = _player->FindMap();
907 if (map && map->Instanceable())
908 return;
909
910 if (Group* group = _player->GetGroup())
911 {
912 if (!group->IsLeader(_player->GetGUID()))
913 return;
914
915 if (group->isLFGGroup())
916 return;
917
918 group->ResetInstances(InstanceResetMethod::Manual, _player);
919 }
920 else
922}
923
925{
926 DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(setDungeonDifficulty.DifficultyID);
927 if (!difficultyEntry)
928 {
929 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent an invalid instance mode {}!",
930 _player->GetGUID().ToString(), setDungeonDifficulty.DifficultyID);
931 return;
932 }
933
934 if (difficultyEntry->InstanceType != MAP_INSTANCE)
935 {
936 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent an non-dungeon instance mode {}!",
937 _player->GetGUID().ToString(), difficultyEntry->ID);
938 return;
939 }
940
941 if (!(difficultyEntry->Flags & DIFFICULTY_FLAG_CAN_SELECT))
942 {
943 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player {} sent unselectable instance mode {}!",
944 _player->GetGUID().ToString(), difficultyEntry->ID);
945 return;
946 }
947
948 // cannot reset while in an instance
949 Map* map = _player->FindMap();
950 if (map && map->Instanceable())
951 {
952 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: {}, {}) tried to reset the instance while player is inside!",
954 return;
955 }
956
957 Difficulty difficultyID = Difficulty(difficultyEntry->ID);
958
959 Group* group = _player->GetGroup();
960 if (group)
961 {
962 if (difficultyID == group->GetDungeonDifficultyID())
963 return;
964
965 if (!group->IsLeader(_player->GetGUID()))
966 return;
967
968 if (group->isLFGGroup())
969 return;
970
971 // the difficulty is set even if the instances can't be reset
973 group->SetDungeonDifficultyID(difficultyID);
974 }
975
976 if (difficultyID == _player->GetDungeonDifficultyID())
977 return;
978
979 if (!group)
981
982 _player->SetDungeonDifficultyID(difficultyID);
984}
985
987{
988 DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(setRaidDifficulty.DifficultyID);
989 if (!difficultyEntry)
990 {
991 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent an invalid instance mode {}!",
992 _player->GetGUID().ToString(), setRaidDifficulty.DifficultyID);
993 return;
994 }
995
996 if (difficultyEntry->InstanceType != MAP_RAID)
997 {
998 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent an non-dungeon instance mode {}!",
999 _player->GetGUID().ToString(), difficultyEntry->ID);
1000 return;
1001 }
1002
1003 if (!(difficultyEntry->Flags & DIFFICULTY_FLAG_CAN_SELECT))
1004 {
1005 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player {} sent unselectable instance mode {}!",
1006 _player->GetGUID().ToString(), difficultyEntry->ID);
1007 return;
1008 }
1009
1010 if (((difficultyEntry->Flags & DIFFICULTY_FLAG_LEGACY) != 0) != setRaidDifficulty.Legacy)
1011 {
1012 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent not matching legacy difficulty {}!",
1013 _player->GetGUID().ToString(), difficultyEntry->ID);
1014 return;
1015 }
1016
1017 // cannot reset while in an instance
1018 Map* map = _player->FindMap();
1019 if (map && map->Instanceable())
1020 {
1021 TC_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: player (Name: {}, {}) tried to reset the instance while player is inside!",
1023 return;
1024 }
1025
1026 Difficulty difficultyID = Difficulty(difficultyEntry->ID);
1027
1028 Group* group = _player->GetGroup();
1029 if (group)
1030 {
1031 if (difficultyID == (setRaidDifficulty.Legacy ? group->GetLegacyRaidDifficultyID() : group->GetRaidDifficultyID()))
1032 return;
1033
1034 if (!group->IsLeader(_player->GetGUID()))
1035 return;
1036
1037 if (group->isLFGGroup())
1038 return;
1039
1040 // the difficulty is set even if the instances can't be reset
1042 if (setRaidDifficulty.Legacy)
1043 group->SetLegacyRaidDifficultyID(difficultyID);
1044 else
1045 group->SetRaidDifficultyID(difficultyID);
1046 }
1047
1048 if (difficultyID == (setRaidDifficulty.Legacy ? _player->GetLegacyRaidDifficultyID() : _player->GetRaidDifficultyID()))
1049 return;
1050
1051 if (!group)
1053
1054 if (setRaidDifficulty.Legacy)
1055 _player->SetLegacyRaidDifficultyID(difficultyID);
1056 else
1057 _player->SetRaidDifficultyID(difficultyID);
1058
1059 _player->SendRaidDifficulty(setRaidDifficulty.Legacy != 0);
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:1600
@ MAP_RAID
Definition DBCEnums.h:1601
@ DIFFICULTY_FLAG_CAN_SELECT
Definition DBCEnums.h:980
@ DIFFICULTY_FLAG_LEGACY
Definition DBCEnums.h:983
Difficulty
Definition DBCEnums.h:935
@ 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:173
#define TC_LOG_ERROR(filterType__, message__,...)
Definition Log.h:182
#define TC_LOG_INFO(filterType__, message__,...)
Definition Log.h:176
@ LOGIN_SEL_ACCOUNT_WHOIS
@ TRANSFER_ABORT_TOO_MANY_INSTANCES
Definition Map.h:96
@ TRANSFER_ABORT_DIFFICULTY
Definition Map.h:100
@ TRANSFER_ABORT_MAP_NOT_ALLOWED
Definition Map.h:108
@ TRANSFER_ABORT_MAX_PLAYERS
Definition Map.h:94
@ TRANSFER_ABORT_ZONE_IN_COMBAT
Definition Map.h:98
@ TRANSFER_ABORT_ALREADY_COMPLETED_ENCOUNTER
Definition Map.h:110
@ TRANSFER_ABORT_NOT_FOUND
Definition Map.h:95
@ TRANSFER_ABORT_LOCKED_TO_DIFFERENT_INSTANCE
Definition Map.h:109
@ TRANSFER_ABORT_NEED_GROUP
Definition Map.h:103
bool normalizePlayerName(std::string &name)
#define sObjectMgr
Definition ObjectMgr.h:1873
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:48
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition Player.h:910
@ PLAYER_FLAGS_IN_PVP
Definition Player.h:521
@ PLAYER_FLAGS_RESTING
Definition Player.h:517
@ PLAYER_FLAGS_GHOST
Definition Player.h:516
@ PLAYER_FLAGS_TAXI_BENCHMARK
Definition Player.h:529
@ PLAYER_FLAGS_PVP_TIMER
Definition Player.h:530
#define ACTION_BUTTON_TYPE(X)
Definition Player.h:405
#define ACTION_BUTTON_ACTION(X)
Definition Player.h:404
@ QUEST_OBJECTIVE_AREATRIGGER
Definition QuestDef.h:364
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:146
@ QUEST_FLAGS_COMPLETION_AREA_TRIGGER
Definition QuestDef.h:216
@ 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:267
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:137
CorpseType GetType() const
Definition Corpse.h:139
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:232
Seconds GetTimeLeft() const
Definition Group.cpp:42
Definition Group.h:209
bool isLFGGroup() const
Definition Group.cpp:1593
void ResetInstances(InstanceResetMethod method, Player *notifyPlayer)
Definition Group.cpp:1334
bool IsLeader(ObjectGuid guid) const
Definition Group.cpp:1660
void SetDungeonDifficultyID(Difficulty difficulty)
Definition Group.cpp:1270
void SetRaidDifficultyID(Difficulty difficulty)
Definition Group.cpp:1286
void SetLegacyRaidDifficultyID(Difficulty difficulty)
Definition Group.cpp:1302
Difficulty GetRaidDifficultyID() const
Definition Group.h:364
CountdownInfo const * GetCountdownInfo(CountdownTimerType timerType) const
Definition Group.cpp:1397
Difficulty GetDungeonDifficultyID() const
Definition Group.h:363
Difficulty GetLegacyRaidDifficultyID() const
Definition Group.h:365
Definition Guild.h:329
Definition Map.h:227
bool IsDungeon() const
Definition Map.cpp:3303
static TransferAbortParams PlayerCannotEnter(uint32 mapid, Player *player)
Definition Map.cpp:1807
bool Instanceable() const
Definition Map.cpp:3293
static ObjectGuid const Empty
Definition ObjectGuid.h:314
std::string ToString() const
void RemoveActionButton(uint8 button)
Definition Player.cpp:6118
WorldLocation const & GetCorpseLocation() const
Definition Player.h:2323
void SetPlayerFlag(PlayerFlags flags)
Definition Player.h:2896
void SendRaidDifficulty(bool legacy) const
Definition Player.cpp:21820
bool CanCompleteQuest(uint32 quest_id, uint32 ignoredQuestObjectiveId=0)
Definition Player.cpp:14515
void RemovePlayerFlag(PlayerFlags flags)
Definition Player.h:2897
void SendRaidGroupOnlyMessage(RaidGroupReason reason, int32 delay) const
Definition Player.cpp:30741
void SetSeer(WorldObject *target)
Definition Player.h:2658
void KillPlayer()
Definition Player.cpp:4355
uint32 GetTotalPlayedTime() const
Definition Player.h:1331
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:6193
ActionButton * AddActionButton(uint8 button, uint64 action, uint8 type)
Definition Player.cpp:6102
UF::UpdateField< UF::ActivePlayerData, int32(WowCS::EntityFragment::CGObject), TYPEID_ACTIVE_PLAYER > m_activePlayerData
Definition Player.h:3048
void ResurrectUsingRequestData()
Definition Player.cpp:26402
uint16 FindQuestSlot(uint32 quest_id) const
Definition Player.cpp:16350
void SendDungeonDifficulty() const
Definition Player.cpp:21813
bool InBattleground() const
Definition Player.h:2570
void SpawnCorpseBones(bool triggerSave=true)
Definition Player.cpp:4453
void SetSelection(ObjectGuid const &guid)
Used for serverside target changes, does not apply to players.
Definition Player.h:1906
void SetRaidDifficultyID(Difficulty raid_difficulty)
Definition Player.h:2170
bool HasCorpse() const
Definition Player.h:2322
GuidUnorderedSet m_clientGUIDs
Definition Player.h:2686
void SetAdvancedCombatLogging(bool enabled)
Definition Player.h:2871
ObjectGuid GetStableMaster() const
Definition Player.cpp:29791
void SetStableMaster(ObjectGuid stableMaster)
Definition Player.cpp:29799
bool HasPendingBind() const
Definition Player.h:2764
void UpdateVisibleObjectInteractions(bool allUnits, bool onlySpellClicks, bool gameObjectQuestGiverStatus, bool questObjectiveGameObjects)
Definition Player.cpp:25880
void CompleteQuest(uint32 quest_id)
Definition Player.cpp:14893
WorldSafeLocsEntry const * GetInstanceEntrance(uint32 targetMapId)
Definition Player.cpp:20173
WorldSession * GetSession() const
Definition Player.h:2256
OutdoorPvP * GetOutdoorPvP() const
Definition Player.cpp:26147
bool IsQuestObjectiveCompletable(uint16 slot, Quest const *quest, QuestObjective const &objective) const
Definition Player.cpp:17100
RestMgr & GetRestMgr() const
Definition Player.h:2875
void RepopAtGraveyard()
Definition Player.cpp:4687
Difficulty GetDungeonDifficultyID() const
Definition Player.h:2166
CinematicMgr * GetCinematicMgr() const
Definition Player.h:1643
void SetLegacyRaidDifficultyID(Difficulty raid_difficulty)
Definition Player.h:2171
void UpdateCriteria(CriteriaType type, uint64 miscValue1=0, uint64 miscValue2=0, uint64 miscValue3=0, WorldObject *ref=nullptr)
Definition Player.cpp:27532
void UpdateVisibilityForPlayer()
Definition Player.cpp:24787
void ClearResurrectRequestData()
Definition Player.h:2074
WorldObject * GetViewpoint() const
Definition Player.cpp:26922
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition Player.cpp:22031
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:1181
bool TeleportToBGEntryPoint()
Definition Player.cpp:1436
bool IsInAreaTrigger(AreaTriggerEntry const *areaTrigger) const
Definition Player.cpp:1909
Corpse * GetCorpse() const
Definition Player.cpp:4461
void ConfirmPendingBind()
Definition Player.cpp:19990
ObjectGuid::LowType GetGuildId() const
Definition Player.h:2147
CUFProfile * GetCUFProfile(uint8 id) const
‍Replaces a CUF profile at position 0-4
Definition Player.h:1832
void SetMovie(uint32 movie)
Definition Player.h:2097
void SetPendingBind(uint32 instanceId, uint32 bindTimer)
Definition Player.cpp:20000
PvPInfo pvpInfo
Definition Player.h:2107
void SaveCUFProfile(uint8 id, std::nullptr_t)
Definition Player.h:1830
uint32 GetCorpseReclaimDelay(bool pvp) const
Definition Player.cpp:26507
void AreaExploredOrEventHappens(uint32 questId)
Definition Player.cpp:16519
void SetDungeonDifficultyID(Difficulty dungeon_difficulty)
Definition Player.h:2169
bool IsQuestObjectiveComplete(uint16 slot, Quest const *quest, QuestObjective const &objective) const
Definition Player.cpp:17175
Difficulty GetRaidDifficultyID() const
Definition Player.h:2167
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg=0, int32 mapDifficultyXConditionID=0) const
Definition Player.cpp:25130
void SetWarModeDesired(bool enabled)
Definition Player.cpp:30947
void SetChosenTitle(int32 title)
Definition Player.h:2838
bool InArena() const
Definition Player.cpp:25780
void SendLootReleaseAll() const
Definition Player.cpp:9070
Group * GetGroup(Optional< uint8 > partyIndex)
Definition Player.h:2781
void BuildPlayerRepop()
Definition Player.cpp:4212
bool HasPlayerFlag(PlayerFlags flags) const
Definition Player.h:2895
void ResetInstances(InstanceResetMethod method)
Reset all solo instances and optionally send a message on success for each.
Definition Player.cpp:21835
void SetCurrencyFlagsFromClient(uint32 id, CurrencyDbFlags flags)
Definition Player.cpp:7347
void SetQuestObjectiveData(QuestObjective const &objective, int32 data)
Definition Player.cpp:17051
void SendMessageToSet(WorldPacket const *data, bool self) const override
Definition Player.h:2310
uint32 GetLevelPlayedTime() const
Definition Player.h:1332
bool isDebugAreaTriggers
Definition Player.h:2850
void SetMultiActionBars(uint8 mask)
Definition Player.h:2105
void UpdatePvP(bool state, bool override=false)
Definition Player.cpp:24056
void SendQuestUpdateAddCreditSimple(QuestObjective const &obj) const
Definition Player.cpp:17409
Difficulty GetLegacyRaidDifficultyID() const
Definition Player.h:2168
uint32 GetMovie() const
Definition Player.h:2096
std::unique_ptr< PlayerMenu > PlayerTalkClass
Definition Player.h:2556
Team GetTeam() const
Definition Player.h:2406
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition Player.cpp:4269
void setUInt32(uint8 index, uint32 value)
QuestObjectives Objectives
Definition QuestDef.h:753
bool HasFlag(QuestFlags flag) const
Definition QuestDef.h:615
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:10804
bool IsAlive() const
Definition Unit.h:1205
void SetPvpFlag(UnitPVPStateFlags flags)
Definition Unit.h:896
bool IsInFlight() const
Definition Unit.h:1042
void SetRooted(bool apply)
Definition Unit.cpp:11759
void RemovePvpFlag(UnitPVPStateFlags flags)
Definition Unit.h:897
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:861
bool IsInCombat() const
Definition Unit.h:1073
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:862
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:499
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:919
uint32 GetVirtualRealmAddress()
Definition World.cpp:3500
@ 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:442
std::array< T, N > RawValue
Definition RaceMask.h:95
constexpr bool HasRace(uint32 raceId) const
Definition RaceMask.h:149
bool Initialize(ObjectGuid const &guid, Player const *player=nullptr)
Query::PlayerGuidLookupData PlayerData
Definition WhoPackets.h:95
Trinity::RaceMask< int32, 2 > RaceFilter
Definition WhoPackets.h:70
Array< WhoWord, 4 > Words
Definition WhoPackets.h:72
std::vector< WhoEntry > Entries
Definition WhoPackets.h:105
WorldLocation Loc
Definition ObjectMgr.h:835