TrinityCore
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 "Corpse.h"
31#include "DatabaseEnv.h"
32#include "DB2Stores.h"
33#include "GameTime.h"
34#include "GossipDef.h"
35#include "Group.h"
36#include "Guild.h"
37#include "GuildMgr.h"
38#include "InstancePackets.h"
39#include "InstanceScript.h"
40#include "Language.h"
41#include "Log.h"
42#include "Map.h"
43#include "MiscPackets.h"
44#include "Object.h"
45#include "ObjectAccessor.h"
46#include "ObjectMgr.h"
47#include "OutdoorPvP.h"
48#include "Player.h"
49#include "RestMgr.h"
50#include "ScriptMgr.h"
51#include "Spell.h"
52#include "SpellPackets.h"
53#include "WhoListStorage.h"
54#include "WhoPackets.h"
55#include "World.h"
56#include <cstdarg>
57#include <zlib.h>
58
60{
61 if (GetPlayer()->IsAlive() || GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_GHOST))
62 return;
63
65 return; // silently return, client should display the error by itself
66
67 // the world update order is sessions, players, creatures
68 // the netcode runs in parallel with all of these
69 // creatures can kill players
70 // so if the server is lagging enough the player can
71 // release spirit after he's killed but before he is updated
72 if (GetPlayer()->getDeathState() == JUST_DIED)
73 {
74 TC_LOG_DEBUG("network", "HandleRepopRequestOpcode: got request after player {} {} was killed and before he was updated",
75 GetPlayer()->GetName(), GetPlayer()->GetGUID().ToString());
77 }
78
79 //this is spirit release confirm?
80 GetPlayer()->RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
83}
84
86{
87 WorldPackets::Who::WhoRequest& request = whoRequest.Request;
88
89 TC_LOG_DEBUG("network", "WorldSession::HandleWhoOpcode: MinLevel: {}, MaxLevel: {}, Name: {} (VirtualRealmName: {}), Guild: {} (GuildVirtualRealmName: {}), RaceFilter: {}, ClassFilter: {}, Areas: {}, Words: {}.",
90 request.MinLevel, request.MaxLevel, request.Name, request.VirtualRealmName, request.Guild, request.GuildVirtualRealmName,
91 request.RaceFilter.RawValue, request.ClassFilter, whoRequest.Areas.size(), request.Words.size());
92
93 // zones count, client limit = 10 (2.0.10)
94 // can't be received from real client or broken packet
95 if (whoRequest.Areas.size() > 10)
96 return;
97
98 // user entered strings count, client limit=4 (checked on 2.0.10)
99 // can't be received from real client or broken packet
100 if (request.Words.size() > 4)
101 return;
102
109
110 std::vector<std::wstring> wWords;
111 wWords.resize(request.Words.size());
112 for (size_t i = 0; i < request.Words.size(); ++i)
113 {
114 TC_LOG_DEBUG("network", "WorldSession::HandleWhoOpcode: Word: {}", request.Words[i].Word);
115
116 // user entered string, it used as universal search pattern(guild+player name)?
117 if (!Utf8toWStr(request.Words[i].Word, wWords[i]))
118 continue;
119
120 wstrToLower(wWords[i]);
121 }
122
123 std::wstring wPlayerName;
124 std::wstring wGuildName;
125
126 if (!(Utf8toWStr(request.Name, wPlayerName) && Utf8toWStr(request.Guild, wGuildName)))
127 return;
128
129 wstrToLower(wPlayerName);
130 wstrToLower(wGuildName);
131
132 // client send in case not set max level value 100 but Trinity supports 255 max level,
133 // update it to show GMs with characters after 100 level
134 if (whoRequest.Request.MaxLevel >= MAX_LEVEL)
135 whoRequest.Request.MaxLevel = STRONG_MAX_LEVEL;
136
137 uint32 team = _player->GetTeam();
138
139 uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
140
142 response.RequestID = whoRequest.RequestID;
143
144 WhoListInfoVector const& whoList = sWhoListStorageMgr->GetWhoList();
145 for (WhoListPlayerInfo const& target : whoList)
146 {
147 // player can see member of other team only if has RBAC_PERM_TWO_SIDE_WHO_LIST
148 if (target.GetTeam() != team && !HasPermission(rbac::RBAC_PERM_TWO_SIDE_WHO_LIST))
149 continue;
150
151 // player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if has RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS
152 if (target.GetSecurity() > AccountTypes(gmLevelInWhoList) && !HasPermission(rbac::RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS))
153 continue;
154
155 // check if target is globally visible for player
156 if (_player->GetGUID() != target.GetGuid() && !target.IsVisible())
158 continue;
159
160 // check if target's level is in level range
161 uint8 lvl = target.GetLevel();
162 if (lvl < request.MinLevel || lvl > request.MaxLevel)
163 continue;
164
165 // check if class matches classmask
166 if (request.ClassFilter >= 0 && !(request.ClassFilter & (1 << target.GetClass())))
167 continue;
168
169 // check if race matches racemask
170 if (!request.RaceFilter.HasRace(target.GetRace()))
171 continue;
172
173 if (!whoRequest.Areas.empty())
174 {
175 if (std::find(whoRequest.Areas.begin(), whoRequest.Areas.end(), int32(target.GetZoneId())) == whoRequest.Areas.end())
176 continue;
177 }
178
179 std::wstring const& wTargetName = target.GetWidePlayerName();
180 if (!(wPlayerName.empty() || wTargetName.find(wPlayerName) != std::wstring::npos))
181 continue;
182
183 std::wstring const& wTargetGuildName = target.GetWideGuildName();
184
185 if (!wGuildName.empty() && wTargetGuildName.find(wGuildName) == std::wstring::npos)
186 continue;
187
188 if (!wWords.empty())
189 {
190 std::string aName;
191 if (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(target.GetZoneId()))
192 aName = areaEntry->AreaName[GetSessionDbcLocale()];
193
194 bool show = false;
195 for (size_t i = 0; i < wWords.size(); ++i)
196 {
197 if (!wWords[i].empty())
198 {
199 if (wTargetName.find(wWords[i]) != std::wstring::npos ||
200 wTargetGuildName.find(wWords[i]) != std::wstring::npos ||
201 Utf8FitTo(aName, wWords[i]))
202 {
203 show = true;
204 break;
205 }
206 }
207 }
208
209 if (!show)
210 continue;
211 }
212
214 if (!whoEntry.PlayerData.Initialize(target.GetGuid(), nullptr))
215 continue;
216
217 if (!target.GetGuildGuid().IsEmpty())
218 {
219 whoEntry.GuildGUID = target.GetGuildGuid();
221 whoEntry.GuildName = target.GetGuildName();
222 }
223
224 whoEntry.AreaID = target.GetZoneId();
225 whoEntry.IsGM = target.IsGameMaster();
226
227 response.Response.Entries.push_back(whoEntry);
228
229 // 50 is maximum player count sent to client - can be overridden
230 // through config, but is unstable
231 if (response.Response.Entries.size() >= sWorld->getIntConfig(CONFIG_MAX_WHO))
232 break;
233 }
234
235 SendPacket(response.Write());
236}
237
239{
240 if (!GetPlayer()->GetLootGUID().IsEmpty())
242
243 bool instantLogout = GetPlayer()->IsInFlight();
244 if (!logoutRequest.IdleLogout)
245 instantLogout |= (GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat())
247
249 bool canLogoutInCombat = GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_RESTING);
250
251 uint32 reason = 0;
252 if (GetPlayer()->IsInCombat() && !canLogoutInCombat)
253 reason = 1;
254 else if (GetPlayer()->IsFalling())
255 reason = 3; // is jumping or falling
256 else if (GetPlayer()->duel || GetPlayer()->HasAura(9454)) // is dueling or frozen by GM via freeze command
257 reason = 2; // FIXME - Need the correct value
258
260 logoutResponse.LogoutResult = reason;
261 logoutResponse.Instant = instantLogout;
262 SendPacket(logoutResponse.Write());
263
264 if (reason)
265 {
267 return;
268 }
269
270 // instant logout in taverns/cities or on taxi or for admins, gm's, mod's if its enabled in worldserver.conf
271 if (instantLogout)
272 {
273 LogoutPlayer(true);
274 return;
275 }
276
277 // not set flags if player can't free move to prevent lost state at logout cancel
278 if (GetPlayer()->CanFreeMove())
279 {
280 if (GetPlayer()->GetStandState() == UNIT_STAND_STATE_STAND)
282 GetPlayer()->SetRooted(true);
284 }
285
287}
288
290{
291 // Player have already logged out serverside, too late to cancel
292 if (!GetPlayer())
293 return;
294
296
298
299 // not remove flags if can't free move - its not set in Logout request code.
300 if (GetPlayer()->CanFreeMove())
301 {
303 GetPlayer()->SetRooted(false);
304
307
310 }
311}
312
314{
315 if (!GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_IN_PVP))
316 {
319 if (!GetPlayer()->IsPvP() || GetPlayer()->pvpInfo.EndTimer)
320 GetPlayer()->UpdatePvP(true, true);
321 }
322 else if (!GetPlayer()->IsWarModeLocalActive())
323 {
326 if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP())
327 GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
328 }
329}
330
332{
333 if (packet.EnablePVP)
334 {
337 if (!GetPlayer()->IsPvP() || GetPlayer()->pvpInfo.EndTimer)
338 GetPlayer()->UpdatePvP(true, true);
339 }
340 else if (!GetPlayer()->IsWarModeLocalActive())
341 {
344 if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP())
345 GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
346 }
347}
348
350{
352}
353
355{
356 if (GetPlayer()->IsAlive() || !GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_GHOST))
357 return;
359}
360
362{
363 uint32 zoneId = _player->GetZoneId();
364 uint32 team = _player->GetTeam();
365
366 std::vector<uint32> graveyardIds;
367 auto range = sObjectMgr->GraveyardStore.equal_range(zoneId);
368
369 for (auto it = range.first; it != range.second && graveyardIds.size() < 16; ++it) // client max
370 {
371 ConditionSourceInfo conditionSource(_player);
372 if (!it->second.Conditions.Meets(conditionSource))
373 continue;
374
375 graveyardIds.push_back(it->first);
376 }
377
378 if (graveyardIds.empty())
379 {
380 TC_LOG_DEBUG("network", "No graveyards found for zone {} for {} (team {}) in CMSG_REQUEST_CEMETERY_LIST",
381 zoneId, _player->GetGUID().ToString(), team);
382 return;
383 }
384
386 packet.IsGossipTriggered = false;
387 packet.CemeteryID.reserve(graveyardIds.size());
388
389 for (uint32 id : graveyardIds)
390 packet.CemeteryID.push_back(id);
391
392 SendPacket(packet.Write());
393}
394
396{
398}
399
401{
402 switch (packet.StandState)
403 {
408 break;
409 default:
410 return;
411 }
412
414}
415
417{
418 if (_player->IsAlive())
419 return;
420
421 // do not allow corpse reclaim in arena
422 if (_player->InArena())
423 return;
424
425 // body not released yet
427 return;
428
429 Corpse* corpse = _player->GetCorpse();
430 if (!corpse)
431 return;
432
433 // prevent resurrect before 30-sec delay after body release not finished
434 if (time_t(corpse->GetGhostTime() + _player->GetCorpseReclaimDelay(corpse->GetType() == CORPSE_RESURRECTABLE_PVP)) > time_t(GameTime::GetGameTime()))
435 return;
436
438 return;
439
440 // resurrect
442
443 // spawn bones
445}
446
448{
449 if (GetPlayer()->IsAlive())
450 return;
451
452 if (packet.Response != 0) // Accept = 0 Decline = 1 Timeout = 2
453 {
455 return;
456 }
457
458 if (!GetPlayer()->IsResurrectRequestedBy(packet.Resurrecter))
459 return;
460
461 if (Player* ressPlayer = ObjectAccessor::GetPlayer(*GetPlayer(), packet.Resurrecter))
462 {
463 if (InstanceScript* instance = ressPlayer->GetInstanceScript())
464 {
465 if (instance->IsEncounterInProgress())
466 {
467 if (!instance->GetCombatResurrectionCharges())
468 return;
469 else
470 instance->UseCombatResurrection();
471 }
472 }
473 }
474
476}
477
479{
480 Player* player = GetPlayer();
481 if (player->IsInFlight())
482 {
483 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} in flight, ignore Area Trigger ID:{}",
484 player->GetName(), player->GetGUID().ToString(), packet.AreaTriggerID);
485 return;
486 }
487
488 AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(packet.AreaTriggerID);
489 if (!atEntry)
490 {
491 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} send unknown (by DBC) Area Trigger ID:{}",
492 player->GetName(), player->GetGUID().ToString(), packet.AreaTriggerID);
493 return;
494 }
495
496 if (packet.Entered && !player->IsInAreaTriggerRadius(atEntry))
497 {
498 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} too far, ignore Area Trigger ID: {}",
499 player->GetName(), player->GetGUID().ToString(), packet.AreaTriggerID);
500 return;
501 }
502
503 if (player->isDebugAreaTriggers)
505
506 if (!sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_AREATRIGGER_CLIENT_TRIGGERED, atEntry->ID, player))
507 return;
508
509 if (sScriptMgr->OnAreaTrigger(player, atEntry, packet.Entered))
510 return;
511
512 if (player->IsAlive() && packet.Entered)
513 {
514 // not using Player::UpdateQuestObjectiveProgress, ObjectID in quest_objectives can be set to -1, areatrigger_involvedrelation then holds correct id
515 if (std::unordered_set<uint32> const* quests = sObjectMgr->GetQuestsForAreaTrigger(packet.AreaTriggerID))
516 {
517 bool anyObjectiveChangedCompletionState = false;
518 for (uint32 questId : *quests)
519 {
520 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questId);
521 uint16 slot = player->FindQuestSlot(questId);
522 if (qInfo && slot < MAX_QUEST_LOG_SIZE && player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE)
523 {
524 for (QuestObjective const& obj : qInfo->Objectives)
525 {
527 continue;
528
529 if (!player->IsQuestObjectiveCompletable(slot, qInfo, obj))
530 continue;
531
532 if (player->IsQuestObjectiveComplete(slot, qInfo, obj))
533 continue;
534
535 if (obj.ObjectID != -1 && obj.ObjectID != packet.AreaTriggerID)
536 continue;
537
538 player->SetQuestObjectiveData(obj, 1);
540 anyObjectiveChangedCompletionState = true;
541 break;
542 }
543
545 player->AreaExploredOrEventHappens(questId);
546
547 if (player->CanCompleteQuest(questId))
548 player->CompleteQuest(questId);
549 }
550 }
551
552 if (anyObjectiveChangedCompletionState)
553 player->UpdateVisibleObjectInteractions(true, false, false, true);
554 }
555 }
556
557 if (sObjectMgr->IsTavernAreaTrigger(packet.AreaTriggerID))
558 {
559 // set resting flag we are in the inn
560 if (packet.Entered)
561 player->GetRestMgr().SetRestFlag(REST_FLAG_IN_TAVERN, atEntry->ID);
562 else
564
565 if (sWorld->IsFFAPvPRealm())
566 {
567 if (packet.Entered)
569 else
571 }
572
573 return;
574 }
575
576 if (Battleground* bg = player->GetBattleground())
577 bg->HandleAreaTrigger(player, packet.AreaTriggerID, packet.Entered);
578
579 if (OutdoorPvP* pvp = player->GetOutdoorPvP())
580 if (pvp->HandleAreaTrigger(_player, packet.AreaTriggerID, packet.Entered))
581 return;
582
583 if (!packet.Entered)
584 return;
585
586 AreaTriggerStruct const* at = sObjectMgr->GetAreaTrigger(packet.AreaTriggerID);
587 if (!at)
588 return;
589
590 bool teleported = false;
591 if (player->GetMapId() != at->target_mapId)
592 {
593 if (!player->IsAlive())
594 {
595 if (player->HasCorpse())
596 {
597 // let enter in ghost mode in instance that connected to inner instance with corpse
598 uint32 corpseMap = player->GetCorpseLocation().GetMapId();
599 do
600 {
601 if (corpseMap == at->target_mapId)
602 break;
603
604 InstanceTemplate const* corpseInstance = sObjectMgr->GetInstanceTemplate(corpseMap);
605 corpseMap = corpseInstance ? corpseInstance->Parent : 0;
606 } while (corpseMap);
607
608 if (!corpseMap)
609 {
611 return;
612 }
613
614 TC_LOG_DEBUG("maps", "MAP: Player '{}' has corpse in instance {} and can enter.", player->GetName(), at->target_mapId);
615 }
616 else
617 TC_LOG_DEBUG("maps", "Map::CanPlayerEnter - player '{}' is dead but does not have a corpse!", player->GetName());
618 }
619
620 if (TransferAbortParams denyReason = Map::PlayerCannotEnter(at->target_mapId, player))
621 {
622 switch (denyReason.Reason)
623 {
625 TC_LOG_DEBUG("maps", "MAP: Player '{}' attempted to enter map with id {} which has no entry", player->GetName(), at->target_mapId);
626 break;
628 TC_LOG_DEBUG("maps", "MAP: Player '{}' attempted to enter instance map {} but the requested difficulty was not found", player->GetName(), at->target_mapId);
629 break;
631 TC_LOG_DEBUG("maps", "MAP: Player '{}' must be in a raid group to enter map {}", player->GetName(), at->target_mapId);
633 break;
635 TC_LOG_DEBUG("maps", "MAP: Player '{}' cannot enter instance map {} because their permanent bind is incompatible with their group's", player->GetName(), at->target_mapId);
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->target_mapId);
639 break;
641 TC_LOG_DEBUG("maps", "MAP: Player '{}' cannot enter instance map {} because he has exceeded the maximum number of instances per hour.", player->GetName(), at->target_mapId);
642 break;
644 break;
646 break;
648 TC_LOG_DEBUG("maps", "MAP: Player '{}' cannot enter instance map {} because instance is resetting.", player->GetName(), at->target_mapId);
649 break;
650 default:
651 break;
652 }
653
654 if (denyReason.Reason != TRANSFER_ABORT_NEED_GROUP)
655 player->SendTransferAborted(at->target_mapId, denyReason.Reason, denyReason.Arg, denyReason.MapDifficultyXConditionId);
656
657 if (!player->IsAlive() && player->HasCorpse())
658 {
659 if (player->GetCorpseLocation().GetMapId() == at->target_mapId)
660 {
661 player->ResurrectPlayer(0.5f);
662 player->SpawnCorpseBones();
663 }
664 }
665
666 return;
667 }
668
669 if (Group* group = player->GetGroup())
670 if (group->isLFGGroup() && player->GetMap()->IsDungeon())
671 teleported = player->TeleportToBGEntryPoint();
672 }
673
674 if (!teleported)
675 {
676 WorldSafeLocsEntry const* entranceLocation = player->GetInstanceEntrance(at->target_mapId);
677 if (entranceLocation && player->GetMapId() != at->target_mapId)
678 player->TeleportTo(entranceLocation->Loc, TELE_TO_NOT_LEAVE_TRANSPORT);
679 else
681 }
682}
683
685{
686 TC_LOG_DEBUG("network", "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA: type {}, time {}, decompressedSize {}",
687 packet.DataType, packet.Time.AsUnderlyingType(), packet.Size);
688
689 if (packet.DataType >= NUM_ACCOUNT_DATA_TYPES)
690 return;
691
692 if (packet.Size == 0) // erase
693 {
695 return;
696 }
697
698 if (packet.Size > 0xFFFF)
699 {
700 TC_LOG_ERROR("network", "UAD: Account data packet too big, size {}", packet.Size);
701 return;
702 }
703
704 ByteBuffer dest(packet.Size, ByteBuffer::Resize{});
705
706 uLongf realSize = packet.Size;
707 if (uncompress(dest.contents(), &realSize, packet.CompressedData.contents(), packet.CompressedData.size()) != Z_OK)
708 {
709 TC_LOG_ERROR("network", "UAD: Failed to decompress account data");
710 return;
711 }
712
713 std::string adata;
714 dest >> adata;
715
716 SetAccountData(AccountDataType(packet.DataType), packet.Time, adata);
717}
718
720{
721 TC_LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA: type {}", request.DataType);
722
723 if (request.DataType >= NUM_ACCOUNT_DATA_TYPES)
724 return;
725
726 AccountData const* adata = GetAccountData(AccountDataType(request.DataType));
727
730 data.Time = adata->Time;
731 data.Size = adata->Data.size();
732 data.DataType = request.DataType;
733
734 uLongf destSize = compressBound(data.Size);
735
736 data.CompressedData.resize(destSize);
737
738 if (data.Size && compress(data.CompressedData.contents(), &destSize, (uint8 const*)adata->Data.c_str(), data.Size) != Z_OK)
739 {
740 TC_LOG_ERROR("network", "RAD: Failed to compress account data");
741 return;
742 }
743
744 data.CompressedData.resize(destSize);
745
746 SendPacket(data.Write());
747}
748
750{
751 uint64 action = ACTION_BUTTON_ACTION(packet.Action);
752 uint8 type = ACTION_BUTTON_TYPE(packet.Action);
753
754 TC_LOG_DEBUG("network", "CMSG_SET_ACTION_BUTTON Button: {} Action: {} Type: {}", packet.Index, action, uint32(type));
755
756 if (!packet.Action)
758 else
759 GetPlayer()->AddActionButton(packet.Index, action, type);
760}
761
763{
764 // If player has sight bound to visual waypoint NPC we should remove it
766}
767
769{
770 // Sent by client when cinematic actually begun. So we begin the server side process
772}
773
775{
776 uint32 movie = _player->GetMovie();
777 if (!movie)
778 return;
779
780 _player->SetMovie(0);
781 sScriptMgr->OnMovieComplete(_player, movie);
782}
783
785{
786 if (!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED)
787 {
788 if (packet.Mask != 0)
789 TC_LOG_ERROR("network", "WorldSession::HandleSetActionBarToggles in not logged state with value: {}, ignored", uint32(packet.Mask));
790 return;
791 }
792
794}
795
797{
799 playedTime.TotalTime = _player->GetTotalPlayedTime();
800 playedTime.LevelTime = _player->GetLevelPlayedTime();
801 playedTime.TriggerEvent = packet.TriggerScriptEvent; // 0-1 - will not show in chat frame
802 SendPacket(playedTime.Write());
803}
804
806{
807 TC_LOG_DEBUG("network", "Received whois command from player {} for character {}",
808 GetPlayer()->GetName(), packet.CharName);
809
811 {
813 return;
814 }
815
816 if (packet.CharName.empty() || !normalizePlayerName(packet.CharName))
817 {
819 return;
820 }
821
823 if (!player)
824 {
826 return;
827 }
828
830 stmt->setUInt32(0, player->GetSession()->GetAccountId());
831
832 PreparedQueryResult result = LoginDatabase.Query(stmt);
833 if (!result)
834 {
836 return;
837 }
838
839 Field* fields = result->Fetch();
840 std::string acc = fields[0].GetString();
841 if (acc.empty())
842 acc = "Unknown";
843
844 std::string email = fields[1].GetString();
845 if (email.empty())
846 email = "Unknown";
847
848 std::string lastip = fields[2].GetString();
849 if (lastip.empty())
850 lastip = "Unknown";
851
853 response.AccountName = packet.CharName + "'s " + "account is " + acc + ", e-mail: " + email + ", last ip: " + lastip;
854 SendPacket(response.Write());
855}
856
858{
859 if (packet.Enable)
860 {
861 TC_LOG_DEBUG("network", "Added FarSight {} to player {}", _player->m_activePlayerData->FarsightObject->ToString(), _player->GetGUID().ToString());
862 if (WorldObject* target = _player->GetViewpoint())
863 _player->SetSeer(target);
864 else
865 TC_LOG_DEBUG("network", "Player {} {} requests non-existing seer {}", _player->GetName(), _player->GetGUID().ToString(), _player->m_activePlayerData->FarsightObject->ToString());
866 }
867 else
868 {
869 TC_LOG_DEBUG("network", "Player {} set vision to self", _player->GetGUID().ToString());
871 }
872
874}
875
877{
878 // -1 at none
879 if (packet.TitleID > 0)
880 {
881 if (!GetPlayer()->HasTitle(packet.TitleID))
882 return;
883 }
884 else
885 packet.TitleID = 0;
886
888}
889
891{
892 Map* map = _player->FindMap();
893 if (map && map->Instanceable())
894 return;
895
896 if (Group* group = _player->GetGroup())
897 {
898 if (!group->IsLeader(_player->GetGUID()))
899 return;
900
901 if (group->isLFGGroup())
902 return;
903
904 group->ResetInstances(InstanceResetMethod::Manual, _player);
905 }
906 else
908}
909
911{
912 DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(setDungeonDifficulty.DifficultyID);
913 if (!difficultyEntry)
914 {
915 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent an invalid instance mode {}!",
916 _player->GetGUID().ToString(), setDungeonDifficulty.DifficultyID);
917 return;
918 }
919
920 if (difficultyEntry->InstanceType != MAP_INSTANCE)
921 {
922 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent an non-dungeon instance mode {}!",
923 _player->GetGUID().ToString(), difficultyEntry->ID);
924 return;
925 }
926
927 if (!(difficultyEntry->Flags & DIFFICULTY_FLAG_CAN_SELECT))
928 {
929 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player {} sent unselectable instance mode {}!",
930 _player->GetGUID().ToString(), difficultyEntry->ID);
931 return;
932 }
933
934 Difficulty difficultyID = Difficulty(difficultyEntry->ID);
935 if (difficultyID == _player->GetDungeonDifficultyID())
936 return;
937
938 // cannot reset while in an instance
939 Map* map = _player->FindMap();
940 if (map && map->Instanceable())
941 {
942 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: {}, {}) tried to reset the instance while player is inside!",
944 return;
945 }
946
947 Group* group = _player->GetGroup();
948 if (group)
949 {
950 if (!group->IsLeader(_player->GetGUID()))
951 return;
952
953 if (group->isLFGGroup())
954 return;
955
956 // the difficulty is set even if the instances can't be reset
958 group->SetDungeonDifficultyID(difficultyID);
959 }
960 else
961 {
963 _player->SetDungeonDifficultyID(difficultyID);
965 }
966}
967
969{
970 DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(setRaidDifficulty.DifficultyID);
971 if (!difficultyEntry)
972 {
973 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent an invalid instance mode {}!",
974 _player->GetGUID().ToString(), setRaidDifficulty.DifficultyID);
975 return;
976 }
977
978 if (difficultyEntry->InstanceType != MAP_RAID)
979 {
980 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent an non-dungeon instance mode {}!",
981 _player->GetGUID().ToString(), difficultyEntry->ID);
982 return;
983 }
984
985 if (!(difficultyEntry->Flags & DIFFICULTY_FLAG_CAN_SELECT))
986 {
987 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player {} sent unselectable instance mode {}!",
988 _player->GetGUID().ToString(), difficultyEntry->ID);
989 return;
990 }
991
992 if (((difficultyEntry->Flags & DIFFICULTY_FLAG_LEGACY) != 0) != setRaidDifficulty.Legacy)
993 {
994 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent not matching legacy difficulty {}!",
995 _player->GetGUID().ToString(), difficultyEntry->ID);
996 return;
997 }
998
999 Difficulty difficultyID = Difficulty(difficultyEntry->ID);
1000 if (difficultyID == (setRaidDifficulty.Legacy ? _player->GetLegacyRaidDifficultyID() : _player->GetRaidDifficultyID()))
1001 return;
1002
1003 // cannot reset while in an instance
1004 Map* map = _player->FindMap();
1005 if (map && map->Instanceable())
1006 {
1007 TC_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: player (Name: {}, {}) tried to reset the instance while player is inside!",
1009 return;
1010 }
1011
1012 Group* group = _player->GetGroup();
1013 if (group)
1014 {
1015 if (!group->IsLeader(_player->GetGUID()))
1016 return;
1017
1018 if (group->isLFGGroup())
1019 return;
1020
1021 // the difficulty is set even if the instances can't be reset
1023 if (setRaidDifficulty.Legacy)
1024 group->SetLegacyRaidDifficultyID(difficultyID);
1025 else
1026 group->SetRaidDifficultyID(difficultyID);
1027 }
1028 else
1029 {
1031 if (setRaidDifficulty.Legacy)
1032 _player->SetLegacyRaidDifficultyID(difficultyID);
1033 else
1034 _player->SetRaidDifficultyID(difficultyID);
1035
1036 _player->SendRaidDifficulty(setRaidDifficulty.Legacy != 0);
1037 }
1038}
1039
1041{
1042 if (packet.Enable)
1044 else
1046}
1047
1049{
1050 if (Guild* guild = sGuildMgr->GetGuildById(_player->GetGuildId()))
1051 guild->GetAchievementMgr().SendAchievementInfo(_player, setFocusedAchievement.AchievementID);
1052}
1053
1055{
1057 response.Time = GameTime::GetSystemTime();
1058 SendPacket(response.Write());
1059}
1060
1062{
1063 if (!_player->HasPendingBind())
1064 {
1065 TC_LOG_INFO("network", "InstanceLockResponse: Player {} {} tried to bind himself/teleport to graveyard without a pending bind!",
1067 return;
1068 }
1069
1070 if (packet.AcceptLock)
1072 else
1074
1075 _player->SetPendingBind(0, 0);
1076}
1077
1079{
1080 // do something?
1081}
1082
1084{
1085 TC_LOG_ERROR("network", "Object update failed for {} for player {} ({})", objectUpdateFailed.ObjectGUID.ToString(), GetPlayerName(), _player->GetGUID().ToString());
1086
1087 // If create object failed for current player then client will be stuck on loading screen
1088 if (_player->GetGUID() == objectUpdateFailed.ObjectGUID)
1089 {
1090 LogoutPlayer(true);
1091 return;
1092 }
1093
1094 // Pretend we've never seen this object
1095 _player->m_clientGUIDs.erase(objectUpdateFailed.ObjectGUID);
1096}
1097
1099{
1100 TC_LOG_ERROR("network", "Object update rescued for {} for player {} ({})", objectUpdateRescued.ObjectGUID.ToString(), GetPlayerName(), _player->GetGUID().ToString());
1101
1102 // Client received values update after destroying object
1103 // re-register object in m_clientGUIDs to send DestroyObject on next visibility update
1104 _player->m_clientGUIDs.insert(objectUpdateRescued.ObjectGUID);
1105}
1106
1108{
1109 if (packet.CUFProfiles.size() > MAX_CUF_PROFILES)
1110 {
1111 TC_LOG_ERROR("entities.player", "HandleSaveCUFProfiles - {} tried to save more than {} CUF profiles. Hacking attempt?", GetPlayerName(), MAX_CUF_PROFILES);
1112 return;
1113 }
1114
1115 for (uint8 i = 0; i < packet.CUFProfiles.size(); ++i)
1116 GetPlayer()->SaveCUFProfile(i, std::move(packet.CUFProfiles[i]));
1117
1118 for (uint8 i = packet.CUFProfiles.size(); i < MAX_CUF_PROFILES; ++i)
1119 GetPlayer()->SaveCUFProfile(i, nullptr);
1120}
1121
1123{
1124 Player* player = GetPlayer();
1125
1127
1128 for (uint8 i = 0; i < MAX_CUF_PROFILES; i++)
1129 if (CUFProfile* cufProfile = player->GetCUFProfile(i))
1130 loadCUFProfiles.CUFProfiles.push_back(cufProfile);
1131 SendPacket(loadCUFProfiles.Write());
1132}
1133
1135{
1136 _player->SetAdvancedCombatLogging(setAdvancedCombatLogging.Enable);
1137}
1138
1140{
1141 WorldPackets::Misc::SpecialMountAnim specialMountAnim;
1142 specialMountAnim.UnitGUID = _player->GetGUID();
1143 std::copy(mountSpecial.SpellVisualKitIDs.begin(), mountSpecial.SpellVisualKitIDs.end(), std::back_inserter(specialMountAnim.SpellVisualKitIDs));
1144 specialMountAnim.SequenceVariation = mountSpecial.SequenceVariation;
1145 GetPlayer()->SendMessageToSet(specialMountAnim.Write(), false);
1146}
1147
1149{
1150 _collectionMgr->MountSetFavorite(mountSetFavorite.MountSpellID, mountSetFavorite.IsFavorite);
1151}
1152
1154{
1155 if (_player->PlayerTalkClass->GetInteractionData().SourceGuid == closeInteraction.SourceGuid)
1156 _player->PlayerTalkClass->GetInteractionData().Reset();
1157
1158 if (_player->GetStableMaster() == closeInteraction.SourceGuid)
1160}
1161
1163{
1164 if (Conversation* convo = ObjectAccessor::GetConversation(*_player, conversationLineStarted.ConversationGUID))
1165 sScriptMgr->OnConversationLineStarted(convo, conversationLineStarted.LineID, _player);
1166}
1167
1169{
1170 UISplashScreenEntry const* splashScreen = nullptr;
1171 for (auto itr = sUISplashScreenStore.begin(); itr != sUISplashScreenStore.end(); ++itr)
1172 {
1173 if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(itr->CharLevelConditionID))
1174 if (!ConditionMgr::IsPlayerMeetingCondition(_player, playerCondition))
1175 continue;
1176
1177 splashScreen = *itr;
1178 }
1179
1180 WorldPackets::Misc::SplashScreenShowLatest splashScreenShowLatest;
1181 splashScreenShowLatest.UISplashScreenID = splashScreen ? splashScreen->ID : 0;
1182 SendPacket(splashScreenShowLatest.Write());
1183}
1184
1186{
1187 Group const* group = _player->GetGroup();
1188 if (!group)
1189 return;
1190
1191 Group::CountdownInfo const* info = group->GetCountdownInfo(queryCountdownTimer.TimerType);
1192 if (!info)
1193 return;
1194
1196 startTimer.Type = queryCountdownTimer.TimerType;
1197 startTimer.TimeLeft = info->GetTimeLeft();
1198 startTimer.TotalTime = info->GetTotalTime();
1199
1200 _player->SendDirectMessage(startTimer.Write());
1201}
#define MAX_CUF_PROFILES
Maximum number of CompactUnitFrames profiles.
Definition: CUFProfile.h:26
AccountTypes
Definition: Common.h:39
#define sConditionMgr
Definition: ConditionMgr.h:365
@ CONDITION_SOURCE_TYPE_AREATRIGGER_CLIENT_TRIGGERED
Definition: ConditionMgr.h:184
#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< PlayerConditionEntry > sPlayerConditionStore("PlayerCondition.db2", &PlayerConditionLoadInfo::Instance)
DB2Storage< AreaTableEntry > sAreaTableStore("AreaTable.db2", &AreaTableLoadInfo::Instance)
@ MAX_LEVEL
Definition: DBCEnums.h:51
@ STRONG_MAX_LEVEL
Definition: DBCEnums.h:55
@ MAP_INSTANCE
Definition: DBCEnums.h:1229
@ MAP_RAID
Definition: DBCEnums.h:1230
Difficulty
Definition: DBCEnums.h:873
@ DIFFICULTY_FLAG_CAN_SELECT
Definition: DBCEnums.h:918
@ DIFFICULTY_FLAG_LEGACY
Definition: DBCEnums.h:921
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
#define sGuildMgr
Definition: GuildMgr.h:70
@ LANG_PLAYER_NOT_EXIST_OR_OFFLINE
Definition: Language.h:760
@ LANG_DEBUG_AREATRIGGER_LEFT
Definition: Language.h:1020
@ LANG_ACCOUNT_FOR_PLAYER_NOT_FOUND
Definition: Language.h:761
@ LANG_YOU_NOT_HAVE_PERMISSION
Definition: Language.h:756
@ LANG_NEED_CHARACTER_NAME
Definition: Language.h:759
@ LANG_DEBUG_AREATRIGGER_ENTERED
Definition: Language.h:979
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:156
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:159
@ LOGIN_SEL_ACCOUNT_WHOIS
Definition: LoginDatabase.h:88
@ TRANSFER_ABORT_TOO_MANY_INSTANCES
Definition: Map.h:91
@ TRANSFER_ABORT_DIFFICULTY
Definition: Map.h:94
@ TRANSFER_ABORT_MAP_NOT_ALLOWED
Definition: Map.h:102
@ TRANSFER_ABORT_MAX_PLAYERS
Definition: Map.h:89
@ TRANSFER_ABORT_ZONE_IN_COMBAT
Definition: Map.h:92
@ TRANSFER_ABORT_ALREADY_COMPLETED_ENCOUNTER
Definition: Map.h:104
@ TRANSFER_ABORT_NOT_FOUND
Definition: Map.h:90
@ TRANSFER_ABORT_LOCKED_TO_DIFFERENT_INSTANCE
Definition: Map.h:103
@ TRANSFER_ABORT_NEED_GROUP
Definition: Map.h:97
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:154
#define sObjectMgr
Definition: ObjectMgr.h:1946
@ PET_SAVE_NOT_IN_SLOT
Definition: PetDefines.h:48
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition: Player.h:803
@ PLAYER_FLAGS_IN_PVP
Definition: Player.h:437
@ PLAYER_FLAGS_RESTING
Definition: Player.h:433
@ PLAYER_FLAGS_GHOST
Definition: Player.h:432
@ PLAYER_FLAGS_TAXI_BENCHMARK
Definition: Player.h:445
@ PLAYER_FLAGS_PVP_TIMER
Definition: Player.h:446
#define ACTION_BUTTON_TYPE(X)
Definition: Player.h:315
#define ACTION_BUTTON_ACTION(X)
Definition: Player.h:314
@ QUEST_OBJECTIVE_AREATRIGGER
Definition: QuestDef.h:342
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:145
@ QUEST_FLAGS_COMPLETION_AREA_TRIGGER
Definition: QuestDef.h:196
@ REST_FLAG_IN_TAVERN
Definition: RestMgr.h:53
#define sScriptMgr
Definition: ScriptMgr.h:1418
@ 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
Definition: UnitDefines.h:162
@ JUST_DIED
Definition: Unit.h:247
void wstrToLower(std::wstring &str)
Definition: Util.cpp:480
bool Utf8FitTo(std::string_view str, std::wstring_view search)
Definition: Util.cpp:750
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:383
#define sWhoListStorageMgr
std::vector< WhoListPlayerInfo > WhoListInfoVector
static bool IsPlayerAccount(uint32 gmlevel)
Definition: AccountMgr.cpp:431
void resize(size_t newsize)
Definition: ByteBuffer.h:539
size_t size() const
Definition: ByteBuffer.h:536
uint8 * contents()
Definition: ByteBuffer.h:522
void PSendSysMessage(const char *fmt, Args &&... args)
Definition: Chat.h:57
void EndCinematic()
void NextCinematicCamera()
static bool IsPlayerMeetingCondition(Player const *player, PlayerConditionEntry const *condition)
Definition: Corpse.h:53
time_t const & GetGhostTime() const
Definition: Corpse.h:124
CorpseType GetType() const
Definition: Corpse.h:126
Class used to access individual fields of database query result.
Definition: Field.h:90
std::string GetString() const
Definition: Field.cpp:118
Seconds GetTotalTime() const
Definition: Group.h:220
Seconds GetTimeLeft() const
Definition: Group.cpp:42
Definition: Group.h:197
bool isLFGGroup() const
Definition: Group.cpp:1633
void ResetInstances(InstanceResetMethod method, Player *notifyPlayer)
Definition: Group.cpp:1374
bool IsLeader(ObjectGuid guid) const
Definition: Group.cpp:1700
void SetDungeonDifficultyID(Difficulty difficulty)
Definition: Group.cpp:1286
void SetRaidDifficultyID(Difficulty difficulty)
Definition: Group.cpp:1310
void SetLegacyRaidDifficultyID(Difficulty difficulty)
Definition: Group.cpp:1334
CountdownInfo const * GetCountdownInfo(CountdownTimerType timerType) const
Definition: Group.cpp:1437
Definition: Guild.h:329
Definition: Map.h:189
bool IsDungeon() const
Definition: Map.cpp:3238
static TransferAbortParams PlayerCannotEnter(uint32 mapid, Player *player)
Definition: Map.cpp:1807
bool Instanceable() const
Definition: Map.cpp:3233
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
std::string ToString() const
Definition: ObjectGuid.cpp:554
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
void RemoveActionButton(uint8 button)
Definition: Player.cpp:6249
void SetPlayerFlag(PlayerFlags flags)
Definition: Player.h:2738
bool CanCompleteQuest(uint32 quest_id, uint32 ignoredQuestObjectiveId=0)
Definition: Player.cpp:14656
void RemovePlayerFlag(PlayerFlags flags)
Definition: Player.h:2739
void SendRaidGroupOnlyMessage(RaidGroupReason reason, int32 delay) const
Definition: Player.cpp:29832
void SetSeer(WorldObject *target)
Definition: Player.h:2482
void KillPlayer()
Definition: Player.cpp:4495
uint32 GetTotalPlayedTime() const
Definition: Player.h:1214
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6324
ActionButton * AddActionButton(uint8 button, uint64 action, uint8 type)
Definition: Player.cpp:6233
void ResurrectUsingRequestData()
Definition: Player.cpp:25700
uint16 FindQuestSlot(uint32 quest_id) const
Definition: Player.cpp:16432
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options=TELE_TO_NONE, Optional< uint32 > instanceId={})
Definition: Player.cpp:1250
bool InBattleground() const
Definition: Player.h:2394
void SendDungeonDifficulty(int32 forcedDifficulty=-1) const
Definition: Player.cpp:21319
void SpawnCorpseBones(bool triggerSave=true)
Definition: Player.cpp:4598
void SetSelection(ObjectGuid const &guid)
Used for serverside target changes, does not apply to players.
Definition: Player.h:1754
void SetRaidDifficultyID(Difficulty raid_difficulty)
Definition: Player.h:2016
bool HasCorpse() const
Definition: Player.h:2163
GuidUnorderedSet m_clientGUIDs
Definition: Player.h:2509
void SetAdvancedCombatLogging(bool enabled)
Definition: Player.h:2713
ObjectGuid GetStableMaster() const
Definition: Player.cpp:28834
void SetStableMaster(ObjectGuid stableMaster)
Definition: Player.cpp:28842
bool HasPendingBind() const
Definition: Player.h:2587
void UpdateVisibleObjectInteractions(bool allUnits, bool onlySpellClicks, bool gameObjectQuestGiverStatus, bool questObjectiveGameObjects)
Definition: Player.cpp:25205
void CompleteQuest(uint32 quest_id)
Definition: Player.cpp:15023
WorldSafeLocsEntry const * GetInstanceEntrance(uint32 targetMapId)
Definition: Player.cpp:19867
WorldSession * GetSession() const
Definition: Player.h:2101
OutdoorPvP * GetOutdoorPvP() const
Definition: Player.cpp:25439
bool IsQuestObjectiveCompletable(uint16 slot, Quest const *quest, QuestObjective const &objective) const
Definition: Player.cpp:17032
RestMgr & GetRestMgr() const
Definition: Player.h:2717
void RepopAtGraveyard()
Definition: Player.cpp:4832
Difficulty GetDungeonDifficultyID() const
Definition: Player.h:2012
CinematicMgr * GetCinematicMgr() const
Definition: Player.h:1501
void SetLegacyRaidDifficultyID(Difficulty raid_difficulty)
Definition: Player.h:2017
void UpdateVisibilityForPlayer()
Definition: Player.cpp:24085
void ClearResurrectRequestData()
Definition: Player.h:1920
WorldObject * GetViewpoint() const
Definition: Player.cpp:26184
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition: Player.cpp:21537
WorldLocation GetCorpseLocation() const
Definition: Player.h:2164
bool TeleportToBGEntryPoint()
Definition: Player.cpp:1496
Corpse * GetCorpse() const
Definition: Player.cpp:4606
void ConfirmPendingBind()
Definition: Player.cpp:19672
Battleground * GetBattleground() const
Definition: Player.cpp:24976
ObjectGuid::LowType GetGuildId() const
Definition: Player.h:1993
bool IsInAreaTriggerRadius(AreaTriggerEntry const *trigger) const
Definition: Player.cpp:2042
CUFProfile * GetCUFProfile(uint8 id) const
ā€¨Replaces a CUF profile at position 0-4
Definition: Player.h:1685
void SetMovie(uint32 movie)
Definition: Player.h:1943
void SetPendingBind(uint32 instanceId, uint32 bindTimer)
Definition: Player.cpp:19682
PvPInfo pvpInfo
Definition: Player.h:1953
void SaveCUFProfile(uint8 id, std::nullptr_t)
Definition: Player.h:1683
uint32 GetCorpseReclaimDelay(bool pvp) const
Definition: Player.cpp:25805
void AreaExploredOrEventHappens(uint32 questId)
Definition: Player.cpp:16577
void SetDungeonDifficultyID(Difficulty dungeon_difficulty)
Definition: Player.h:2015
bool IsQuestObjectiveComplete(uint16 slot, Quest const *quest, QuestObjective const &objective) const
Definition: Player.cpp:17090
Difficulty GetRaidDifficultyID() const
Definition: Player.h:2013
UF::UpdateField< UF::ActivePlayerData, 0, TYPEID_ACTIVE_PLAYER > m_activePlayerData
Definition: Player.h:2864
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg=0, int32 mapDifficultyXConditionID=0) const
Definition: Player.cpp:24439
void SetWarModeDesired(bool enabled)
Definition: Player.cpp:30024
void SetChosenTitle(int32 title)
Definition: Player.h:2663
void SendRaidDifficulty(bool legacy, int32 forcedDifficulty=-1) const
Definition: Player.cpp:21326
bool InArena() const
Definition: Player.cpp:25106
void SendLootReleaseAll() const
Definition: Player.cpp:9114
Group * GetGroup(Optional< uint8 > partyIndex)
Definition: Player.h:2606
void BuildPlayerRepop()
Definition: Player.cpp:4350
bool HasPlayerFlag(PlayerFlags flags) const
Definition: Player.h:2737
void ResetInstances(InstanceResetMethod method)
Reset all solo instances and optionally send a message on success for each.
Definition: Player.cpp:21341
void SetQuestObjectiveData(QuestObjective const &objective, int32 data)
Definition: Player.cpp:16983
void SendMessageToSet(WorldPacket const *data, bool self) const override
Definition: Player.h:2151
uint32 GetLevelPlayedTime() const
Definition: Player.h:1215
bool isDebugAreaTriggers
Definition: Player.h:2675
void SetMultiActionBars(uint8 mask)
Definition: Player.h:1951
void UpdatePvP(bool state, bool override=false)
Definition: Player.cpp:23360
void SendQuestUpdateAddCreditSimple(QuestObjective const &obj) const
Definition: Player.cpp:17318
Difficulty GetLegacyRaidDifficultyID() const
Definition: Player.h:2014
uint32 GetMovie() const
Definition: Player.h:1942
std::unique_ptr< PlayerMenu > PlayerTalkClass
Definition: Player.h:2380
Team GetTeam() const
Definition: Player.h:2235
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition: Player.cpp:4408
void setUInt32(const uint8 index, const uint32 value)
QuestObjectives Objectives
Definition: QuestDef.h:702
bool HasFlag(QuestFlags flag) const
Definition: QuestDef.h:569
void SetRestFlag(RestFlag restFlag, uint32 triggerId=0)
Definition: RestMgr.cpp:95
void RemoveRestFlag(RestFlag restFlag)
Definition: RestMgr.cpp:110
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition: Unit.cpp:10100
bool IsAlive() const
Definition: Unit.h:1164
void SetPvpFlag(UnitPVPStateFlags flags)
Definition: Unit.h:868
bool IsInFlight() const
Definition: Unit.h:1012
void SetRooted(bool apply, bool packetOnly=false)
Definition: Unit.cpp:11039
void RemovePvpFlag(UnitPVPStateFlags flags)
Definition: Unit.h:869
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:833
bool IsInCombat() const
Definition: Unit.h:1043
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:834
constexpr uint32 GetMapId() const
Definition: Position.h:201
Map * GetMap() const
Definition: Object.h:624
Map * FindMap() const
Definition: Object.h:625
std::string const & GetName() const
Definition: Object.h:555
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1147
uint32 GetZoneId() const
Definition: Object.h:545
size_type size() const
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< CUFProfile const * > CUFProfiles
Definition: MiscPackets.h:731
Array< int32, 2 > SpellVisualKitIDs
Definition: MiscPackets.h:844
Array< std::unique_ptr< CUFProfile >, MAX_CUF_PROFILES > CUFProfiles
Definition: MiscPackets.h:721
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< int32 > SpellVisualKitIDs
Definition: MiscPackets.h:856
WorldPacket const * Write() override
Duration< Seconds > TotalTime
Definition: MiscPackets.h:947
WorldPacket const * Write() override
Duration< Seconds > TimeLeft
Definition: MiscPackets.h:948
uint64 Action
two packed values (action and type)
Definition: SpellPackets.h:144
Underlying AsUnderlyingType() const
WorldPacket const * Write() override
Definition: WhoPackets.cpp:25
Array< int32, 10 > Areas
Definition: WhoPackets.h:90
WorldPacket const * Write() override
Definition: WhoPackets.cpp:129
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
Definition: WorldSession.h:999
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)
LocaleConstant GetSessionDbcLocale() const
void HandleSetActionButtonOpcode(WorldPackets::Spells::SetActionButton &packet)
void HandleRepopRequest(WorldPackets::Misc::RepopRequest &packet)
Definition: MiscHandler.cpp:59
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)
Definition: MiscHandler.cpp:85
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)
AccountDataType
Definition: WorldSession.h:852
#define NUM_ACCOUNT_DATA_TYPES
Definition: WorldSession.h:870
#define sWorld
Definition: World.h:931
uint32 GetVirtualRealmAddress()
Definition: World.cpp:3968
@ CONFIG_MAX_WHO
Definition: World.h:351
@ CONFIG_GM_LEVEL_IN_WHO_LIST
Definition: World.h:292
TC_GAME_API bool GetName(uint32 accountId, std::string &name)
SystemTimePoint GetSystemTime()
Current chrono system_clock time point.
Definition: GameTime.cpp:54
time_t GetGameTime()
Definition: GameTime.cpp:44
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)
std::string ToString(Type &&val, Params &&... params)
@ 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
Definition: WorldSession.h:879
uint32 target_mapId
Definition: ObjectMgr.h:460
float target_Orientation
Definition: ObjectMgr.h:464
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:352
int32 ObjectID
Definition: QuestDef.h:449
constexpr bool HasRace(uint8 raceId) const
Definition: RaceMask.h:88
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< int64 > RaceFilter
Definition: WhoPackets.h:70
std::string GuildVirtualRealmName
Definition: WhoPackets.h:69
std::vector< WhoEntry > Entries
Definition: WhoPackets.h:105
WorldLocation Loc
Definition: ObjectMgr.h:835