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 "AreaTriggerPackets.h"
21#include "BattlegroundMgr.h"
22#include "CharacterPackets.h"
23#include "Chat.h"
24#include "CinematicMgr.h"
25#include "ClientConfigPackets.h"
26#include "Common.h"
27#include "Corpse.h"
28#include "Creature.h"
29#include "CreatureAI.h"
30#include "DatabaseEnv.h"
31#include "DBCStores.h"
32#include "GameObject.h"
33#include "GameObjectAI.h"
34#include "GameTime.h"
35#include "GossipDef.h"
36#include "Group.h"
37#include "Language.h"
38#include "Log.h"
39#include "MapManager.h"
40#include "MiscPackets.h"
41#include "MovementPackets.h"
42#include "Object.h"
43#include "ObjectAccessor.h"
44#include "ObjectMgr.h"
45#include "OutdoorPvP.h"
46#include "Player.h"
47#include "ScriptMgr.h"
48#include "Spell.h"
49#include "SpellInfo.h"
50#include "SpellPackets.h"
51#include "WhoListStorage.h"
52#include "WhoPackets.h"
53#include "World.h"
54#include "WorldPacket.h"
55#include <cstdarg>
56#include <zlib.h>
57
59{
60 TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_REPOP_REQUEST Message");
61
62 if (GetPlayer()->IsAlive() || GetPlayer()->HasFlag(PLAYER_FLAGS, 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?
82 GetPlayer()->RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
85}
86
88{
89 TC_LOG_DEBUG("network", "WORLD: CMSG_GOSSIP_SELECT_OPTION");
90
91 uint32 gossipListId;
92 uint32 menuId;
93 ObjectGuid guid;
94 std::string code = "";
95
96 recvData >> guid >> menuId >> gossipListId;
97
98 if (!_player->PlayerTalkClass->GetGossipMenu().GetItem(gossipListId))
99 {
100 recvData.rfinish();
101 return;
102 }
103
104 if (_player->PlayerTalkClass->IsGossipOptionCoded(gossipListId))
105 recvData >> code;
106
107 // Prevent cheating on C++ scripted menus
109 return;
110
111 Creature* unit = nullptr;
112 GameObject* go = nullptr;
113 if (guid.IsCreatureOrVehicle())
114 {
116 if (!unit)
117 {
118 TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - {} not found or you can't interact with him.", guid.ToString());
119 return;
120 }
121 }
122 else if (guid.IsGameObject())
123 {
125 if (!go)
126 {
127 TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - {} not found or you can't interact with it.", guid.ToString());
128 return;
129 }
130 }
131 else
132 {
133 TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - unsupported {}.", guid.ToString());
134 return;
135 }
136
137 // remove fake death
138 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
140
141 if ((unit && unit->GetScriptId() != unit->LastUsedScriptID) || (go && go->GetScriptId() != go->LastUsedScriptID))
142 {
143 TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - Script reloaded while in use, ignoring and set new scipt id");
144 if (unit)
145 unit->LastUsedScriptID = unit->GetScriptId();
146 if (go)
147 go->LastUsedScriptID = go->GetScriptId();
149 return;
150 }
151 if (!code.empty())
152 {
153 if (unit)
154 {
155 if (!unit->AI()->OnGossipSelectCode(_player, menuId, gossipListId, code.c_str()))
156 _player->OnGossipSelect(unit, gossipListId, menuId);
157 }
158 else
159 {
160 if (!go->AI()->OnGossipSelectCode(_player, menuId, gossipListId, code.c_str()))
161 _player->OnGossipSelect(go, gossipListId, menuId);
162 }
163 }
164 else
165 {
166 if (unit)
167 {
168 if (!unit->AI()->OnGossipSelect(_player, menuId, gossipListId))
169 _player->OnGossipSelect(unit, gossipListId, menuId);
170 }
171 else
172 {
173 if (!go->AI()->OnGossipSelect(_player, menuId, gossipListId))
174 _player->OnGossipSelect(go, gossipListId, menuId);
175 }
176 }
177}
178
180{
181 WorldPackets::Who::WhoRequest& request = whoRequest.Request;
182
183 TC_LOG_DEBUG("network", "WorldSession::HandleWhoOpcode: MinLevel: {}, MaxLevel: {}, Name: {}, Guild: {}, RaceFilter: 0x{:X}, ClassFilter: {}, Areas: {}, Words: {}.",
184 request.MinLevel, request.MaxLevel, request.Name, request.Guild,
185 request.RaceFilter, request.ClassFilter, whoRequest.Request.Areas.size(), request.Words.size());
186
187 std::vector<std::wstring> wWords;
188 wWords.resize(request.Words.size());
189 for (size_t i = 0; i < request.Words.size(); ++i)
190 {
191 TC_LOG_DEBUG("network", "WorldSession::HandleWhoOpcode: Word: {}", request.Words[i].Word);
192
193 // user entered string, it used as universal search pattern(guild+player name)?
194 if (!Utf8toWStr(request.Words[i].Word, wWords[i]))
195 continue;
196
197 wstrToLower(wWords[i]);
198 }
199
200 std::wstring wPlayerName;
201 std::wstring wGuildName;
202
203 if (!(Utf8toWStr(request.Name, wPlayerName) && Utf8toWStr(request.Guild, wGuildName)))
204 return;
205
206 wstrToLower(wPlayerName);
207 wstrToLower(wGuildName);
208
209 // client send in case not set max level value 100 but Trinity supports 255 max level,
210 // update it to show GMs with characters after 100 level
211 if (whoRequest.Request.MaxLevel >= MAX_LEVEL)
212 whoRequest.Request.MaxLevel = STRONG_MAX_LEVEL;
213
214 uint32 team = _player->GetTeam();
215
216 uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
217
219
220 WhoListInfoVector const& whoList = sWhoListStorageMgr->GetWhoList();
221 for (WhoListPlayerInfo const& target : whoList)
222 {
223 // player can see member of other team only if has RBAC_PERM_TWO_SIDE_WHO_LIST
224 if (target.GetTeam() != team && !HasPermission(rbac::RBAC_PERM_TWO_SIDE_WHO_LIST))
225 continue;
226
227 // player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if has RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS
228 if (target.GetSecurity() > AccountTypes(gmLevelInWhoList) && !HasPermission(rbac::RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS))
229 continue;
230
231 // check if target is globally visible for player
232 if (_player->GetGUID() != target.GetGuid() && !target.IsVisible())
234 continue;
235
236 // check if target's level is in level range
237 int32 lvl = target.GetLevel();
238 if (lvl < request.MinLevel || lvl > request.MaxLevel)
239 continue;
240
241 // check if class matches classmask
242 if (request.ClassFilter >= 0 && !(request.ClassFilter & (1 << target.GetClass())))
243 continue;
244
245 // check if race matches racemask
246 if (request.RaceFilter >= 0 && !(request.RaceFilter & (1 << target.GetRace())))
247 continue;
248
249 if (!whoRequest.Request.Areas.empty())
250 if (std::ranges::find(whoRequest.Request.Areas, int32(target.GetZoneId())) == whoRequest.Request.Areas.end())
251 continue;
252
253 std::wstring const& wTargetName = target.GetWidePlayerName();
254 if (!(wPlayerName.empty() || wTargetName.find(wPlayerName) != std::wstring::npos))
255 continue;
256
257 std::wstring const& wTargetGuildName = target.GetWideGuildName();
258
259 if (!wGuildName.empty() && wTargetGuildName.find(wGuildName) == std::wstring::npos)
260 continue;
261
262 if (!wWords.empty())
263 {
264 std::string aName;
265 if (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(target.GetZoneId()))
266 aName = areaEntry->AreaName[GetSessionDbcLocale()];
267
268 bool show = false;
269 for (size_t i = 0; i < wWords.size(); ++i)
270 {
271 if (!wWords[i].empty())
272 {
273 if (wTargetName.find(wWords[i]) != std::wstring::npos ||
274 wTargetGuildName.find(wWords[i]) != std::wstring::npos ||
275 Utf8FitTo(aName, wWords[i]))
276 {
277 show = true;
278 break;
279 }
280 }
281 }
282
283 if (!show)
284 continue;
285 }
286
287 ++response.Response.TotalMatches;
288
289 // 50 is maximum player count sent to client - can be overridden
290 // through config, but is unstable
291 if (response.Response.Entries.size() >= sWorld->getIntConfig(CONFIG_MAX_WHO))
292 continue;
293
294 WorldPackets::Who::WhoEntry& whoEntry = response.Response.Entries.emplace_back();
295 whoEntry.Name = target.GetPlayerName();
296 whoEntry.GuildName = target.GetGuildName();
297 whoEntry.Level = target.GetLevel();
298 whoEntry.ClassID = target.GetClass();
299 whoEntry.Race = target.GetRace();
300 whoEntry.Sex = target.GetGender();
301 whoEntry.AreaID = target.GetZoneId();
302 }
303
304 SendPacket(response.Write());
305}
306
308{
309 ObjectGuid lguid = GetPlayer()->GetLootGUID();
310 if (!lguid.IsEmpty())
311 DoLootRelease(lguid);
312
313 bool instantLogout = (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat()) ||
315
317 bool canLogoutInCombat = GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
318
319 uint32 reason = 0;
320 if (GetPlayer()->IsInCombat() && !canLogoutInCombat)
321 reason = 1;
322 else if (GetPlayer()->IsFalling())
323 reason = 3; // is jumping or falling
324 else if (GetPlayer()->duel || GetPlayer()->HasAura(9454)) // is dueling or frozen by GM via freeze command
325 reason = 2; // FIXME - Need the correct value
326
328 logoutResponse.LogoutResult = reason;
329 logoutResponse.Instant = instantLogout;
330 SendPacket(logoutResponse.Write());
331
332 if (reason)
333 {
335 return;
336 }
337
338 // instant logout in taverns/cities or on taxi or for admins, gm's, mod's if its enabled in worldserver.conf
339 if (instantLogout)
340 {
341 LogoutPlayer(true);
342 return;
343 }
344
345 // not set flags if player can't free move to prevent lost state at logout cancel
346 if (GetPlayer()->CanFreeMove())
347 {
348 if (GetPlayer()->GetStandState() == UNIT_STAND_STATE_STAND)
350 GetPlayer()->SetRooted(true);
352 }
353
355}
356
360
362{
363 // Player have already logged out serverside, too late to cancel
364 if (!GetPlayer())
365 return;
366
368
370
371 // not remove flags if can't free move - its not set in Logout request code.
372 if (GetPlayer()->CanFreeMove())
373 {
375 GetPlayer()->SetRooted(false);
376
379
382 }
383}
384
386{
387 // this opcode can be used in two ways: Either set explicit new status or toggle old status
388 if (togglePvP.Enable)
389 {
392 }
393 else
394 {
397 }
398
400 {
401 if (!GetPlayer()->IsPvP() || GetPlayer()->pvpInfo.EndTimer)
402 GetPlayer()->UpdatePvP(true, true);
403 }
404 else
405 {
406 if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP())
407 GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
408 }
409}
410
412{
413 uint32 newZone;
414 recvData >> newZone;
415
416 TC_LOG_DEBUG("network", "WORLD: Recvd ZONE_UPDATE: {}", newZone);
417
418 // use server side data, but only after update the player position. See Player::UpdatePosition().
420
421 //GetPlayer()->SendInitWorldStates(true, newZone);
422}
423
425{
427
428 // Update target of current autoshoot spell
429 if (!packet.Selection.IsEmpty())
430 {
431 if (Spell* autoReapeatSpell = _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL))
432 {
433 if (!autoReapeatSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR4_UNK24) // client automatically handles spells with SPELL_ATTR4_AUTO_RANGED_COMBAT
434 && autoReapeatSpell->m_targets.GetUnitTargetGUID() != packet.Selection)
435 {
436 Unit* unitTarget = [&]() -> Unit*
437 {
439 if (unit && _player->IsValidAttackTarget(unit, autoReapeatSpell->GetSpellInfo()))
440 return unit;
441 return nullptr;
442 }();
443
444 if (unitTarget)
445 autoReapeatSpell->m_targets.SetUnitTarget(unitTarget);
446 else
447 autoReapeatSpell->m_targets.RemoveObjectTarget();
448 }
449 }
450 }
451}
452
454{
455 switch (packet.StandState)
456 {
461 break;
462 default:
463 return;
464 }
465
467}
468
470{
471 uint32 suggestion, contentlen, typelen;
472 std::string content, type;
473
474 recvData >> suggestion >> contentlen >> content;
475
476 recvData >> typelen >> type;
477
478 if (suggestion == 0)
479 TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUG [Bug Report]");
480 else
481 TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUG [Suggestion]");
482
483 TC_LOG_DEBUG("network", "{}", type);
484 TC_LOG_DEBUG("network", "{}", content);
485
487
488 stmt->setString(0, type);
489 stmt->setString(1, content);
490
491 CharacterDatabase.Execute(stmt);
492}
493
495{
496 TC_LOG_DEBUG("network", "WORLD: Received CMSG_RECLAIM_CORPSE");
497
498 if (_player->IsAlive())
499 return;
500
501 // do not allow corpse reclaim in arena
502 if (_player->InArena())
503 return;
504
505 // body not released yet
507 return;
508
509 Corpse* corpse = _player->GetCorpse();
510 if (!corpse)
511 return;
512
513 // prevent resurrect before 30-sec delay after body release not finished
515 return;
516
518 return;
519
520 // resurrect
522
523 // spawn bones
525}
526
528{
529 TC_LOG_DEBUG("network", "WORLD: Received CMSG_RESURRECT_RESPONSE");
530
531 if (GetPlayer()->IsAlive())
532 return;
533
534 if (packet.Response == 0)
535 {
537 return;
538 }
539
540 if (!GetPlayer()->IsResurrectRequestedBy(packet.Resurrecter))
541 return;
542
544}
545
547{
548 va_list ap;
549 char szStr [1024];
550 szStr[0] = '\0';
551
552 va_start(ap, Text);
553 vsnprintf(szStr, 1024, Text, ap);
554 va_end(ap);
555
556 uint32 length = strlen(szStr)+1;
558 data << length;
559 data << szStr;
560 SendPacket(&data);
561}
562
564{
565 TC_LOG_DEBUG("network", "CMSG_AREATRIGGER. Trigger ID: {}", packet.AreaTriggerID);
566
567 Player* player = GetPlayer();
568 if (player->IsInFlight())
569 {
570 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} in flight, ignore Area Trigger ID:{}",
571 player->GetName(), player->GetGUID().ToString(), packet.AreaTriggerID);
572 return;
573 }
574
575 AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(packet.AreaTriggerID);
576 if (!atEntry)
577 {
578 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} send unknown (by DBC) Area Trigger ID:{}",
579 player->GetName(), player->GetGUID().ToString(), packet.AreaTriggerID);
580 return;
581 }
582
583 if (!player->IsInAreaTriggerRadius(atEntry))
584 {
585 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} too far, ignore Area Trigger ID: {}",
586 player->GetName(), player->GetGUID().ToString(), packet.AreaTriggerID);
587 return;
588 }
589
590 if (player->isDebugAreaTriggers)
592
593 if (!sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_AREATRIGGER_CLIENT_TRIGGERED, atEntry->ID, player))
594 return;
595
596 if (sScriptMgr->OnAreaTrigger(player, atEntry))
597 return;
598
599 if (player->IsAlive())
600 if (uint32 questId = sObjectMgr->GetQuestForAreaTrigger(packet.AreaTriggerID))
601 if (player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE)
602 player->AreaExploredOrEventHappens(questId);
603
604 if (sObjectMgr->IsTavernAreaTrigger(packet.AreaTriggerID))
605 {
606 // set resting flag we are in the inn
607 player->SetRestFlag(REST_FLAG_IN_TAVERN, atEntry->ID);
608
609 if (sWorld->IsFFAPvPRealm())
611
612 return;
613 }
614
615 if (Battleground* bg = player->GetBattleground())
616 if (bg->GetStatus() == STATUS_IN_PROGRESS)
617 bg->HandleAreaTrigger(player, packet.AreaTriggerID);
618
619 if (OutdoorPvP* pvp = player->GetOutdoorPvP())
620 if (pvp->HandleAreaTrigger(_player, packet.AreaTriggerID))
621 return;
622
623 AreaTriggerTeleport const* at = sObjectMgr->GetAreaTrigger(packet.AreaTriggerID);
624 if (!at)
625 return;
626
627 bool teleported = false;
628 if (player->GetMapId() != at->target_mapId)
629 {
630 if (Map::EnterState denyReason = sMapMgr->PlayerCannotEnter(at->target_mapId, player, false))
631 {
632 bool reviveAtTrigger = false; // should we revive the player if he is trying to enter the correct instance?
633 switch (denyReason)
634 {
636 TC_LOG_DEBUG("maps", "MAP: Player '{}' attempted to enter map with id {} which has no entry", player->GetName(), at->target_mapId);
637 break;
639 TC_LOG_DEBUG("maps", "MAP: Player '{}' attempted to enter dungeon map {} but no instance template was found", player->GetName(), at->target_mapId);
640 break;
642 TC_LOG_DEBUG("maps", "MAP: Player '{}' attempted to enter instance map {} but the requested difficulty was not found", player->GetName(), at->target_mapId);
643 if (MapEntry const* entry = sMapStore.LookupEntry(at->target_mapId))
644 player->SendTransferAborted(entry->ID, TRANSFER_ABORT_DIFFICULTY, player->GetGroup() ? player->GetGroup()->GetDifficultyID(entry) : player->GetDifficultyID(entry));
645 break;
647 {
649 data << uint32(0);
650 data << uint32(2); // You must be in a raid group to enter this instance.
651 player->SendDirectMessage(&data);
652 TC_LOG_DEBUG("maps", "MAP: Player '{}' must be in a raid group to enter instance map {}", player->GetName(), at->target_mapId);
653 reviveAtTrigger = true;
654 break;
655 }
657 {
659 TC_LOG_DEBUG("maps", "MAP: Player '{}' does not have a corpse in instance map {} and cannot enter", player->GetName(), at->target_mapId);
660 break;
661 }
663 if (MapEntry const* entry = sMapStore.LookupEntry(at->target_mapId))
664 {
665 char const* mapName = entry->MapName[player->GetSession()->GetSessionDbcLocale()];
666 TC_LOG_DEBUG("maps", "MAP: Player '{}' cannot enter instance map '{}' because their permanent bind is incompatible with their group's", player->GetName(), mapName);
667 // is there a special opcode for this?
668 // @todo figure out how to get player localized difficulty string (e.g. "10 player", "Heroic" etc)
670 }
671 reviveAtTrigger = true;
672 break;
675 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);
676 reviveAtTrigger = true;
677 break;
680 reviveAtTrigger = true;
681 break;
684 reviveAtTrigger = true;
685 break;
686 default:
687 break;
688 }
689
690 if (reviveAtTrigger) // check if the player is touching the areatrigger leading to the map his corpse is on
691 if (!player->IsAlive() && player->HasCorpse())
692 if (player->GetCorpseLocation().GetMapId() == at->target_mapId)
693 {
694 player->ResurrectPlayer(0.5f);
695 player->SpawnCorpseBones();
696 }
697
698 return;
699 }
700
701 if (Group* group = player->GetGroup())
702 if (group->isLFGGroup() && player->GetMap()->IsDungeon())
703 teleported = player->TeleportToBGEntryPoint();
704 }
705
706 if (!teleported)
708}
709
711{
712 TC_LOG_DEBUG("network", "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA: type {}, time {}, decompressedSize {}",
713 packet.DataType, packet.Time, packet.Size);
714
715 if (packet.DataType >= NUM_ACCOUNT_DATA_TYPES)
716 return;
717
718 if (packet.Size == 0) // erase
719 {
721
723 updateAccountDataComplete.DataType = packet.DataType;
724 updateAccountDataComplete.Result = 0;
725 SendPacket(updateAccountDataComplete.Write());
726
727 return;
728 }
729
730 if (packet.Size > 0xFFFF)
731 {
732 TC_LOG_ERROR("network", "UAD: Account data packet too big, size {}", packet.Size);
733 return;
734 }
735
736 std::string dest;
737 dest.resize(packet.Size);
738
739 uLongf realSize = packet.Size;
740 if (uncompress(reinterpret_cast<Bytef*>(dest.data()), &realSize, packet.CompressedData.data(), packet.CompressedData.size()) != Z_OK)
741 {
742 TC_LOG_ERROR("network", "UAD: Failed to decompress account data");
743 return;
744 }
745
746 SetAccountData(AccountDataType(packet.DataType), packet.Time, dest);
747
749 updateAccountDataComplete.DataType = packet.DataType;
750 updateAccountDataComplete.Result = 0;
751 SendPacket(updateAccountDataComplete.Write());
752}
753
755{
756 TC_LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA: type {}", request.DataType);
757
758 if (request.DataType >= NUM_ACCOUNT_DATA_TYPES)
759 return;
760
761 AccountData const* adata = GetAccountData(AccountDataType(request.DataType));
762
765 data.Time = adata->Time;
766 data.Size = adata->Data.size();
767 data.DataType = request.DataType;
768
769 uLongf destSize = compressBound(data.Size);
770
771 data.CompressedData.resize(destSize);
772
773 if (data.Size && compress(data.CompressedData.data(), &destSize, (uint8 const*)adata->Data.c_str(), data.Size) != Z_OK)
774 {
775 TC_LOG_ERROR("network", "RAD: Failed to compress account data");
776 return;
777 }
778
779 data.CompressedData.resize(destSize);
780
781 SendPacket(data.Write());
782}
783
785{
786 uint32 action = ACTION_BUTTON_ACTION(packet.Action);
787 uint8 type = ACTION_BUTTON_TYPE(packet.Action);
788
789 TC_LOG_DEBUG("network", "CMSG_SET_ACTION_BUTTON Button: {} Action: {} Type: {}", packet.Index, action, uint32(type));
790
791 if (!packet.Action)
793 else
794 GetPlayer()->AddActionButton(packet.Index, action, type);
795}
796
798{
799 // If player has sight bound to visual waypoint NPC we should remove it
801}
802
804{
805 // Sent by client when cinematic actually begun. So we begin the server side process
807}
808
810{
811 uint32 movie = _player->GetMovie();
812 if (!movie)
813 return;
814
815 _player->SetMovie(0);
816 sScriptMgr->OnMovieComplete(_player, movie);
817}
818
820{
821 if (!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED)
822 {
823 if (packet.Mask != 0)
824 TC_LOG_ERROR("network", "WorldSession::HandleSetActionBarToggles in not logged state with value: {}, ignored", uint32(packet.Mask));
825 return;
826 }
827
829}
830
832{
834 playedTime.TotalTime = _player->GetTotalPlayedTime();
835 playedTime.LevelTime = _player->GetLevelPlayedTime();
836 playedTime.TriggerScriptEvent = packet.TriggerScriptEvent; // 0-1 - will not show in chat frame
837 SendPacket(playedTime.Write());
838}
839
841{
842 if (_player->IsInFlight())
843 {
844 TC_LOG_DEBUG("network", "Player '{}' ({}) in flight, ignore worldport command.",
846 return;
847 }
848
849 WorldLocation loc(worldTeleport.MapID, worldTeleport.Pos);
850 loc.SetOrientation(worldTeleport.Facing);
851 TC_LOG_DEBUG("network", "CMSG_WORLD_TELEPORT: Player = {}, time = {}, map = {}, pos = {}",
852 _player->GetName(), worldTeleport.Time, worldTeleport.MapID, loc.ToString());
853
855 _player->TeleportTo(loc);
856 else
858}
859
861{
862 TC_LOG_DEBUG("network", "Received whois command from player {} for character {}",
863 GetPlayer()->GetName(), packet.CharName);
864
866 {
868 return;
869 }
870
871 if (packet.CharName.empty() || !normalizePlayerName(packet.CharName))
872 {
874 return;
875 }
876
878 if (!player)
879 {
881 return;
882 }
883
885 stmt->setUInt32(0, player->GetSession()->GetAccountId());
886
887 PreparedQueryResult result = LoginDatabase.Query(stmt);
888 if (!result)
889 {
891 return;
892 }
893
894 Field* fields = result->Fetch();
895 std::string acc = fields[0].GetString();
896 if (acc.empty())
897 acc = "Unknown";
898
899 std::string email = fields[1].GetString();
900 if (email.empty())
901 email = "Unknown";
902
903 std::string lastip = fields[2].GetString();
904 if (lastip.empty())
905 lastip = "Unknown";
906
908 response.AccountName = packet.CharName + "'s " + "account is " + acc + ", e-mail: " + email + ", last ip: " + lastip;
909 SendPacket(response.Write());
910}
911
913{
914 TC_LOG_DEBUG("network", "WORLD: CMSG_COMPLAIN");
915
916 uint8 spam_type; // 0 - mail, 1 - chat
917 ObjectGuid spammer_guid;
918 uint32 unk1 = 0;
919 uint32 unk2 = 0;
920 uint32 unk3 = 0;
921 uint32 unk4 = 0;
922 std::string description = "";
923 recvData >> spam_type; // unk 0x01 const, may be spam type (mail/chat)
924 recvData >> spammer_guid; // player guid
925 switch (spam_type)
926 {
927 case 0:
928 recvData >> unk1; // const 0
929 recvData >> unk2; // probably mail id
930 recvData >> unk3; // const 0
931 break;
932 case 1:
933 recvData >> unk1; // probably language
934 recvData >> unk2; // message type?
935 recvData >> unk3; // probably channel id
936 recvData >> unk4; // time
937 recvData >> description; // spam description string (messagetype, channel name, player name, message)
938 break;
939 }
940
941 // NOTE: all chat messages from this spammer automatically ignored by spam reporter until logout in case chat spam.
942 // if it's mail spam - ALL mails from this spammer automatically removed by client
943
944 // Complaint Received message
946 data << uint8(0);
947 SendPacket(&data);
948
949 TC_LOG_DEBUG("network", "REPORT SPAM: type {}, {}, unk1 {}, unk2 {}, unk3 {}, unk4 {}, message {}",
950 spam_type, spammer_guid.ToString(), unk1, unk2, unk3, unk4, description);
951}
952
954{
955 TC_LOG_DEBUG("network", "CMSG_REALM_SPLIT");
956
957 uint32 unk;
958 std::string split_date = "01/01/01";
959 recvData >> unk;
960
961 WorldPacket data(SMSG_REALM_SPLIT, 4+4+split_date.size()+1);
962 data << unk;
963 data << uint32(0x00000000); // realm split state
964 // split states:
965 // 0x0 realm normal
966 // 0x1 realm split
967 // 0x2 realm split pending
968 data << split_date;
969 SendPacket(&data);
970 //TC_LOG_DEBUG("response sent {}", unk);
971}
972
974{
975 TC_LOG_DEBUG("network", "WORLD: CMSG_FAR_SIGHT");
976
977 bool apply;
978 recvData >> apply;
979
980 if (apply)
981 {
982 TC_LOG_DEBUG("network", "Added FarSight {} to player {}", _player->GetGuidValue(PLAYER_FARSIGHT).ToString(), _player->GetGUID().ToString());
983 if (WorldObject* target = _player->GetViewpoint())
984 _player->SetSeer(target);
985 else
986 TC_LOG_DEBUG("network", "Player {} {} requests non-existing seer {}", _player->GetName(), _player->GetGUID().ToString(), _player->GetGuidValue(PLAYER_FARSIGHT).ToString());
987 }
988 else
989 {
990 TC_LOG_DEBUG("network", "Player {} set vision to self", _player->GetGUID().ToString());
992 }
993
995}
996
998{
999 TC_LOG_DEBUG("network", "CMSG_SET_TITLE");
1000
1001 int32 title;
1002 recvData >> title;
1003
1004 // -1 at none
1005 if (title > 0 && title < MAX_TITLE_INDEX)
1006 {
1007 if (!GetPlayer()->HasTitle(title))
1008 return;
1009 }
1010 else
1011 title = 0;
1012
1014}
1015
1017{
1018 TC_LOG_DEBUG("network", "WORLD: CMSG_RESET_INSTANCES");
1019
1020 if (Group* group = _player->GetGroup())
1021 {
1022 if (group->IsLeader(_player->GetGUID()))
1023 group->ResetInstances(INSTANCE_RESET_ALL, false, _player);
1024 }
1025 else
1027}
1028
1030{
1031 TC_LOG_DEBUG("network", "MSG_SET_DUNGEON_DIFFICULTY");
1032
1033 if (setDungeonDifficulty.DifficultyID >= MAX_DUNGEON_DIFFICULTY)
1034 {
1035 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent an invalid instance mode {}!",
1036 _player->GetGUID().ToString(), setDungeonDifficulty.DifficultyID);
1037 return;
1038 }
1039
1040 // cannot reset while in an instance
1041 Map* map = _player->FindMap();
1042 if (map && map->IsDungeon())
1043 {
1044 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: {}, {}) tried to reset the instance while player is inside!",
1046 return;
1047 }
1048
1049 Difficulty difficultyID = Difficulty(setDungeonDifficulty.DifficultyID);
1050
1051 Group* group = _player->GetGroup();
1052 if (group)
1053 {
1054 if (difficultyID == group->GetDungeonDifficultyID())
1055 return;
1056
1057 if (!group->IsLeader(_player->GetGUID()))
1058 return;
1059
1060 if (group->isLFGGroup())
1061 return;
1062
1063 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
1064 {
1065 Player* groupGuy = itr->GetSource();
1066 if (!groupGuy)
1067 continue;
1068
1069 if (!groupGuy->IsInWorld())
1070 return;
1071
1072 if (groupGuy->GetMap()->IsNonRaidDungeon())
1073 {
1074 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} tried to reset the instance while group member (Name: {}, {}) is inside!",
1075 _player->GetGUID().ToString(), groupGuy->GetName(), groupGuy->GetGUID().ToString());
1076 return;
1077 }
1078 }
1079 // the difficulty is set even if the instances can't be reset
1080 //_player->SendDungeonDifficulty(true);
1082 group->SetDungeonDifficultyID(Difficulty(setDungeonDifficulty.DifficultyID));
1083 }
1084
1085 if (difficultyID == _player->GetDungeonDifficultyID())
1086 return;
1087
1088 if (!group)
1090
1091 _player->SetDungeonDifficultyID(Difficulty(setDungeonDifficulty.DifficultyID));
1092}
1093
1095{
1096 TC_LOG_DEBUG("network", "MSG_SET_RAID_DIFFICULTY");
1097
1098 if (setRaidDifficulty.DifficultyID >= MAX_RAID_DIFFICULTY)
1099 {
1100 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: {} sent an invalid instance mode {}!",
1101 _player->GetGUID().ToString(), setRaidDifficulty.DifficultyID);
1102 return;
1103 }
1104
1105 // cannot reset while in an instance
1106 Map* map = _player->FindMap();
1107 if (map && map->IsDungeon())
1108 {
1109 TC_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: player (Name: {}, {}) tried to reset the instance while player is inside!",
1111 return;
1112 }
1113
1114 Difficulty difficultyID = Difficulty(setRaidDifficulty.DifficultyID);
1115
1116 Group* group = _player->GetGroup();
1117 if (group)
1118 {
1119 if (difficultyID == group->GetRaidDifficultyID())
1120 return;
1121
1122 if (!group->IsLeader(_player->GetGUID()))
1123 return;
1124
1125 if (group->isLFGGroup())
1126 return;
1127
1128 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
1129 {
1130 Player* groupGuy = itr->GetSource();
1131 if (!groupGuy)
1132 continue;
1133
1134 if (!groupGuy->IsInWorld())
1135 return;
1136
1137 if (groupGuy->GetMap()->IsRaid())
1138 {
1139 TC_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: {} tried to reset the instance while group member (Name: {}, {}) is inside!",
1140 _player->GetGUID().ToString(), groupGuy->GetName(), groupGuy->GetGUID().ToString());
1141 return;
1142 }
1143 }
1144 // the difficulty is set even if the instances can't be reset
1145 //_player->SendDungeonDifficulty(true);
1147 group->SetRaidDifficultyID(Difficulty(setRaidDifficulty.DifficultyID));
1148 }
1149
1150 if (difficultyID == _player->GetRaidDifficultyID())
1151 return;
1152
1153 if (!group)
1155
1157}
1158
1160{
1161 TC_LOG_DEBUG("network", "WORLD: CMSG_SET_TAXI_BENCHMARK_MODE");
1162
1163 uint8 mode;
1164 recvData >> mode;
1165
1167
1168 TC_LOG_DEBUG("network", "Client used \"/timetest {}\" command", mode);
1169}
1170
1177
1179{
1180 // empty opcode
1181 TC_LOG_DEBUG("network", "WORLD: CMSG_READY_FOR_ACCOUNT_DATA_TIMES");
1182
1184}
1185
1187{
1189 data << uint32(PhaseShift);
1190 SendPacket(&data);
1191}
1192
1194{
1195 uint8 accept;
1196 recvPacket >> accept;
1197
1198 if (!_player->HasPendingBind())
1199 {
1200 TC_LOG_INFO("network", "InstanceLockResponse: Player {} {} tried to bind himself/teleport to graveyard without a pending bind!",
1202 return;
1203 }
1204
1205 if (accept)
1207 else
1209
1210 _player->SetPendingBind(0, 0);
1211}
1212
1214{
1215 TC_LOG_DEBUG("network", "WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY");
1216
1217 ObjectGuid guid;
1218 uint32 spellId;
1219 float elevation, speed;
1222 uint8 moveStop;
1223
1224 recvPacket >> guid >> spellId >> elevation >> speed;
1225 recvPacket >> firePos;
1226 recvPacket >> impactPos;
1227 recvPacket >> moveStop;
1228
1229 Unit* caster = ObjectAccessor::GetUnit(*_player, guid);
1230 Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_GENERIC_SPELL) : nullptr;
1231 if (!spell || spell->m_spellInfo->Id != spellId || !spell->m_targets.HasDst() || !spell->m_targets.HasSrc())
1232 {
1233 recvPacket.rfinish();
1234 return;
1235 }
1236
1237 spell->m_targets.ModSrc(firePos);
1238 spell->m_targets.ModDst(impactPos);
1239
1240 spell->m_targets.SetPitch(elevation);
1241 spell->m_targets.SetSpeed(speed);
1242
1243 if (moveStop)
1244 {
1245 OpcodeClient opcode = static_cast<OpcodeClient>(recvPacket.read<uint32>());
1246 MovementInfo movementInfo;
1247 recvPacket >> movementInfo.guid.ReadAsPacked();
1248 recvPacket >> movementInfo;
1249 HandleMovementOpcode(opcode, movementInfo);
1250 }
1251}
@ STATUS_IN_PROGRESS
@ CHAR_INS_BUG_REPORT
AccountTypes
Definition Common.h:39
#define sConditionMgr
@ CONDITION_SOURCE_TYPE_AREATRIGGER_CLIENT_TRIGGERED
#define CORPSE_RECLAIM_RADIUS
Definition Corpse.h:36
@ CORPSE_RESURRECTABLE_PVP
Definition Corpse.h:31
#define MAX_RAID_DIFFICULTY
Definition DBCEnums.h:293
Difficulty
Definition DBCEnums.h:279
#define MAX_DUNGEON_DIFFICULTY
Definition DBCEnums.h:292
@ MAX_LEVEL
Definition DBCEnums.h:49
@ STRONG_MAX_LEVEL
Definition DBCEnums.h:53
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerEntryfmt)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ LANG_PLAYER_NOT_EXIST_OR_OFFLINE
Definition Language.h:763
@ LANG_ACCOUNT_FOR_PLAYER_NOT_FOUND
Definition Language.h:764
@ LANG_DEBUG_AREATRIGGER_REACHED
Definition Language.h:982
@ LANG_INSTANCE_BIND_MISMATCH
Definition Language.h:1239
@ LANG_YOU_NOT_HAVE_PERMISSION
Definition Language.h:759
@ LANG_NEED_CHARACTER_NAME
Definition Language.h:762
#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
#define sMapMgr
Definition MapManager.h:211
@ INSTANCE_RESET_CHANGE_DIFFICULTY
Definition Map.h:888
@ INSTANCE_RESET_ALL
Definition Map.h:887
@ TRANSFER_ABORT_TOO_MANY_INSTANCES
Definition Map.h:79
@ TRANSFER_ABORT_DIFFICULTY
Definition Map.h:83
@ TRANSFER_ABORT_MAX_PLAYERS
Definition Map.h:77
@ TRANSFER_ABORT_ZONE_IN_COMBAT
Definition Map.h:81
bool normalizePlayerName(std::string &name)
#define sObjectMgr
Definition ObjectMgr.h:1721
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:45
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition Player.h:668
@ PLAYER_FLAGS_IN_PVP
Definition Player.h:355
@ PLAYER_FLAGS_RESTING
Definition Player.h:351
@ PLAYER_FLAGS_GHOST
Definition Player.h:350
@ PLAYER_FLAGS_TAXI_BENCHMARK
Definition Player.h:363
@ PLAYER_FLAGS_PVP_TIMER
Definition Player.h:364
@ REST_FLAG_IN_TAVERN
Definition Player.h:660
#define ACTION_BUTTON_TYPE(X)
Definition Player.h:213
#define MAX_TITLE_INDEX
Definition Player.h:424
#define ACTION_BUTTON_ACTION(X)
Definition Player.h:212
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:106
#define sScriptMgr
Definition ScriptMgr.h:1168
@ SPELL_ATTR4_UNK24
@ SPELL_AURA_PREVENT_RESURRECTION
@ SPELL_AURA_FEIGN_DEATH
@ UNIT_STAND_STATE_SLEEP
Definition UnitDefines.h:37
@ UNIT_STAND_STATE_KNEEL
Definition UnitDefines.h:42
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:34
@ UNIT_STAND_STATE_SIT
Definition UnitDefines.h:35
@ UNIT_NPC_FLAG_GOSSIP
@ UNIT_BYTE2_FLAG_FFA_PVP
@ UNIT_FLAG_STUNNED
@ JUST_DIED
Definition Unit.h:226
@ CURRENT_GENERIC_SPELL
Definition Unit.h:621
@ CURRENT_AUTOREPEAT_SPELL
Definition Unit.h:623
@ UNIT_STATE_DIED
Definition Unit.h:234
@ PLAYER_CHOSEN_TITLE
@ PLAYER_FLAGS
@ PLAYER_FARSIGHT
void wstrToLower(std::wstring &str)
Definition Util.cpp:480
bool Utf8FitTo(std::string_view str, std::wstring_view search)
Definition Util.cpp:565
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)
void rfinish()
Definition ByteBuffer.h:320
void PSendSysMessage(char const *fmt, Args &&... args)
Definition Chat.h:61
void EndCinematic()
void BeginCinematic()
time_t const & GetGhostTime() const
Definition Corpse.h:108
CorpseType GetType() const
Definition Corpse.h:110
virtual bool OnGossipSelectCode(Player *, uint32, uint32, char const *)
Definition CreatureAI.h:222
virtual bool OnGossipSelect(Player *, uint32, uint32)
Definition CreatureAI.h:219
uint32 GetScriptId() const
CreatureAI * AI() const
Definition Creature.h:163
Class used to access individual fields of database query result.
Definition Field.h:92
std::string GetString() const
Definition Field.cpp:125
virtual bool OnGossipSelect(Player *, uint32, uint32)
virtual bool OnGossipSelectCode(Player *, uint32, uint32, char const *)
GameObjectAI * AI() const
Definition GameObject.h:275
uint32 GetScriptId() const
GossipMenuItem const * GetItem(uint32 id) const
Definition GossipDef.h:190
ObjectGuid GetSenderGUID() const
Definition GossipDef.h:174
Definition Group.h:165
bool isLFGGroup() const
Definition Group.cpp:2397
bool IsLeader(ObjectGuid guid) const
Definition Group.cpp:2464
void SetDungeonDifficultyID(Difficulty difficulty)
Definition Group.cpp:2084
void SetRaidDifficultyID(Difficulty difficulty)
Definition Group.cpp:2100
void ResetInstances(uint8 method, bool isRaid, Player *SendMsgTo)
Definition Group.cpp:2121
Difficulty GetRaidDifficultyID() const
Definition Group.h:271
GroupReference * GetFirstMember()
Definition Group.h:247
Difficulty GetDungeonDifficultyID() const
Definition Group.h:270
Difficulty GetDifficultyID(MapEntry const *mapEntry) const
Definition Group.cpp:2116
Definition Map.h:302
bool IsDungeon() const
Definition Map.cpp:4231
bool IsNonRaidDungeon() const
Definition Map.cpp:4236
bool IsRaid() const
Definition Map.cpp:4241
EnterState
Definition Map.h:415
@ CANNOT_ENTER_CORPSE_IN_DIFFERENT_INSTANCE
Definition Map.h:422
@ CANNOT_ENTER_TOO_MANY_INSTANCES
Definition Map.h:424
@ CANNOT_ENTER_MAX_PLAYERS
Definition Map.h:425
@ CANNOT_ENTER_ZONE_IN_COMBAT
Definition Map.h:426
@ CANNOT_ENTER_NO_ENTRY
Definition Map.h:418
@ CANNOT_ENTER_DIFFICULTY_UNAVAILABLE
Definition Map.h:420
@ CANNOT_ENTER_INSTANCE_BIND_MISMATCH
Definition Map.h:423
@ CANNOT_ENTER_UNINSTANCED_DUNGEON
Definition Map.h:419
@ CANNOT_ENTER_NOT_IN_RAID
Definition Map.h:421
static ObjectGuid const Empty
Definition ObjectGuid.h:140
bool IsEmpty() const
Definition ObjectGuid.h:172
std::string ToString() const
bool IsGameObject() const
Definition ObjectGuid.h:182
bool IsCreatureOrVehicle() const
Definition ObjectGuid.h:177
PackedGuidReader ReadAsPacked()
Definition ObjectGuid.h:146
bool IsInWorld() const
Definition Object.h:73
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:761
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:776
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
Definition Object.cpp:806
bool HasFlag(uint16 index, uint32 flag) const
Definition Object.cpp:800
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:577
void ToggleFlag(uint16 index, uint32 flag)
Definition Object.cpp:792
ObjectGuid GetGuidValue(uint16 index) const
Definition Object.cpp:273
void SendCloseGossip()
bool IsGossipOptionCoded(uint32 selection) const
Definition GossipDef.h:271
GossipMenu & GetGossipMenu()
Definition GossipDef.h:263
void RemoveActionButton(uint8 button)
Definition Player.cpp:6081
uint32 GetTeam() const
Definition Player.h:1818
WorldLocation const & GetCorpseLocation() const
Definition Player.h:1744
void SetRestFlag(RestFlag restFlag, uint32 triggerId=0)
Definition Player.cpp:26434
void SetSeer(WorldObject *target)
Definition Player.h:2056
void KillPlayer()
Definition Player.cpp:4462
uint32 GetTotalPlayedTime() const
Definition Player.h:1014
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:6163
void ResurrectUsingRequestData()
Definition Player.cpp:23679
ActionButton * AddActionButton(uint8 button, uint32 action, uint8 type)
Definition Player.cpp:6065
GameObject * GetGameObjectIfCanInteractWith(ObjectGuid const &guid) const
Definition Player.cpp:2170
bool InBattleground() const
Definition Player.h:1969
void RemoveGhoul()
Definition Player.cpp:4457
void SpawnCorpseBones(bool triggerSave=true)
Definition Player.cpp:4555
void SetSelection(ObjectGuid const &guid)
Used for serverside target changes, does not apply to players.
Definition Player.h:1408
void SetRaidDifficultyID(Difficulty raid_difficulty)
Definition Player.h:1624
void ResetInstances(uint8 method, bool isRaid)
Reset all solo instances and optionally send a message on success for each.
Definition Player.cpp:20128
bool HasCorpse() const
Definition Player.h:1743
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg=0) const
Definition Player.cpp:22564
bool HasPendingBind() const
Definition Player.h:2143
WorldSession * GetSession() const
Definition Player.h:1705
OutdoorPvP * GetOutdoorPvP() const
Definition Player.cpp:23397
ObjectGuid GetLootGUID() const
Definition Player.h:1700
void RepopAtGraveyard()
Definition Player.cpp:4792
Difficulty GetDungeonDifficultyID() const
Definition Player.h:1621
CinematicMgr * GetCinematicMgr() const
Definition Player.h:1196
void UpdateVisibilityForPlayer()
Definition Player.cpp:22309
void ClearResurrectRequestData()
Definition Player.h:1536
Creature * GetNPCIfCanInteractWith(ObjectGuid const &guid, NPCFlags npcFlags) const
Definition Player.cpp:2126
WorldObject * GetViewpoint() const
Definition Player.cpp:24160
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition Player.cpp:20308
bool TeleportToBGEntryPoint()
Definition Player.cpp:1782
Corpse * GetCorpse() const
Definition Player.cpp:4563
Battleground * GetBattleground() const
Definition Player.cpp:23024
Group * GetGroup()
Definition Player.h:2159
bool IsInAreaTriggerRadius(AreaTriggerEntry const *trigger) const
Definition Player.cpp:2208
void SetMovie(uint32 movie)
Definition Player.h:1557
void SetNeedsZoneUpdate(bool needsUpdate)
Definition Player.h:1574
void SetPendingBind(uint32 instanceId, uint32 bindTimer)
Definition Player.cpp:18704
PvPInfo pvpInfo
Definition Player.h:1567
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
Definition Player.cpp:1539
uint32 GetCorpseReclaimDelay(bool pvp) const
Definition Player.cpp:23784
void OnGossipSelect(WorldObject *source, uint32 gossipListId, uint32 menuId)
Definition Player.cpp:14088
void AreaExploredOrEventHappens(uint32 questId)
Definition Player.cpp:16021
void SetDungeonDifficultyID(Difficulty dungeon_difficulty)
Definition Player.h:1623
Difficulty GetRaidDifficultyID() const
Definition Player.h:1622
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition Player.cpp:15655
bool InArena() const
Definition Player.cpp:23123
void BuildPlayerRepop()
Definition Player.cpp:4320
InstancePlayerBind * BindToInstance(InstanceSave *save, bool permanent, BindExtensionState extendState=EXTEND_STATE_NORMAL, bool load=false)
Definition Player.cpp:18622
uint32 GetLevelPlayedTime() const
Definition Player.h:1015
bool isDebugAreaTriggers
Definition Player.h:2234
void SetMultiActionBars(uint8 mask)
Definition Player.h:1565
void UpdatePvP(bool state, bool override=false)
Definition Player.cpp:21684
uint32 GetMovie() const
Definition Player.h:1556
PlayerMenu * PlayerTalkClass
Definition Player.h:1956
Difficulty GetDifficultyID(MapEntry const *mapEntry) const
Definition Player.cpp:26364
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition Player.cpp:4374
void setUInt32(uint8 index, uint32 value)
void setString(uint8 index, std::string const &value)
void SetPitch(float pitch)
void ModDst(Position const &pos)
Definition Spell.cpp:458
bool HasSrc() const
Definition Spell.cpp:475
void SetSpeed(float speed)
bool HasDst() const
Definition Spell.cpp:480
void ModSrc(Position const &pos)
Definition Spell.cpp:407
uint32 Id
Definition SpellInfo.h:289
Definition Spell.h:152
SpellCastTargets m_targets
Definition Spell.h:409
SpellInfo const *const m_spellInfo
Definition Spell.h:396
Definition Unit.h:783
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3788
bool IsAlive() const
Definition Unit.h:1247
bool IsInFlight() const
Definition Unit.h:1133
void SetRooted(bool apply)
Definition Unit.cpp:11357
void RemovePvpFlag(UnitPVPStateFlags flags)
Definition Unit.h:998
void SetStandState(UnitStandStateType state)
Definition Unit.cpp:10340
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:968
bool IsInCombat() const
Definition Unit.h:1158
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:969
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1489
uint32 GetMapId() const
Definition Position.h:193
Map * GetMap() const
Definition Object.h:451
Map * FindMap() const
Definition Object.h:452
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition Object.cpp:2857
uint32 LastUsedScriptID
Definition Object.h:563
std::string const & GetName() const
Definition Object.h:384
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1193
size_type size() const
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
TaggedPosition< Position::XYZ > Pos
WorldPacket const * Write() override
WorldPacket const * Write() override
void HandleGossipSelectOptionOpcode(WorldPacket &recvPacket)
void LogoutPlayer(bool save)
Log the player out
void HandleMovementOpcode(OpcodeClient opcode, MovementInfo &movementInfo)
void HandleUITimeRequest(WorldPackets::Misc::UITimeRequest &recvData)
char const * GetTrinityString(uint32 entry) const
void HandleNextCinematicCamera(WorldPackets::Misc::NextCinematicCamera &packet)
void HandleSetDungeonDifficultyOpcode(WorldPackets::Misc::SetDungeonDifficulty &setDungeonDifficulty)
void SendNotification(char const *format,...) ATTR_PRINTF(2
void HandleResetInstancesOpcode(WorldPacket &recvData)
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
void HandleLogoutCancelOpcode(WorldPackets::Character::LogoutCancel &logoutCancel)
AccountTypes GetSecurity() const
void HandleComplainOpcode(WorldPacket &recvData)
void HandleTogglePvP(WorldPackets::Misc::TogglePvP &togglePvP)
void void SendSetPhaseShift(uint32 phaseShift)
void HandleSetSelectionOpcode(WorldPackets::Misc::SetSelection &packet)
LocaleConstant GetSessionDbcLocale() const
void HandleSetActionButtonOpcode(WorldPackets::Spells::SetActionButton &packet)
void HandleRepopRequest(WorldPackets::Misc::RepopRequest &packet)
Player * GetPlayer() const
void HandleUpdateAccountData(WorldPackets::ClientConfig::UserClientUpdateAccountData &packet)
void SetLogoutStartTime(time_t requestTime)
Engage the logout process for the user.
void SendAreaTriggerMessage(char const *Text,...) ATTR_PRINTF(2
void HandleBugOpcode(WorldPacket &recvPacket)
AccountData const * GetAccountData(AccountDataType type) const
void HandleWorldTeleportOpcode(WorldPackets::Misc::WorldTeleport &worldTeleport)
void HandleWhoIsOpcode(WorldPackets::Who::WhoIsRequest &packet)
void HandleRequestAccountData(WorldPackets::ClientConfig::RequestAccountData &request)
void HandleCompleteMovie(WorldPackets::Misc::CompleteMovie &packet)
void HandleReadyForAccountDataTimes(WorldPacket &recvData)
void HandleLogoutRequestOpcode(WorldPackets::Character::LogoutRequest &logoutRequest)
void HandleUpdateMissileTrajectory(WorldPacket &recvPacket)
bool HasPermission(uint32 permissionId)
uint32 GetAccountId() const
void HandleInstanceLockResponse(WorldPacket &recvPacket)
void HandleWhoOpcode(WorldPackets::Who::WhoRequestPkt &whoRequest)
void HandleSetRaidDifficultyOpcode(WorldPackets::Misc::SetRaidDifficulty &setRaidDifficulty)
void HandleFarSightOpcode(WorldPacket &recvData)
Player * _player
void DoLootRelease(ObjectGuid lguid)
void HandlePlayedTime(WorldPackets::Character::PlayedTimeClient &packet)
void HandleSetTitleOpcode(WorldPacket &recvData)
void HandleSetActionBarToggles(WorldPackets::Character::SetActionBarToggles &packet)
void HandleSetTaxiBenchmarkOpcode(WorldPacket &recvData)
void SendAccountDataTimes(uint32 mask)
void HandleStandStateChangeOpcode(WorldPackets::Misc::StandStateChange &packet)
void HandleZoneUpdateOpcode(WorldPacket &recvPacket)
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 HandlePlayerLogoutOpcode(WorldPackets::Character::PlayerLogout &playerLogout)
void HandleRealmSplitOpcode(WorldPacket &recvData)
void HandleResurrectResponse(WorldPackets::Misc::ResurrectResponse &packet)
Opcodes
Definition Opcodes.h:29
#define GLOBAL_CACHE_MASK
AccountDataType
#define NUM_ACCOUNT_DATA_TYPES
@ SMSG_AREA_TRIGGER_MESSAGE
Definition Opcodes.h:725
@ SMSG_COMPLAIN_RESULT
Definition Opcodes.h:997
@ SMSG_RAID_GROUP_ONLY
Definition Opcodes.h:675
@ SMSG_REALM_SPLIT
Definition Opcodes.h:936
@ SMSG_SET_PHASE_SHIFT
Definition Opcodes.h:1177
#define sWorld
Definition World.h:901
@ CONFIG_MAX_WHO
Definition World.h:327
@ CONFIG_GM_LEVEL_IN_WHO_LIST
Definition World.h:265
time_t GetGameTime()
Definition GameTime.cpp:42
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Player * FindConnectedPlayerByName(std::string_view name)
@ RBAC_PERM_OPCODE_WHOIS
Definition RBAC.h:96
@ RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS
Definition RBAC.h:88
@ RBAC_PERM_OPCODE_WORLD_TELEPORT
Definition RBAC.h:95
@ RBAC_PERM_TWO_SIDE_WHO_LIST
Definition RBAC.h:81
@ RBAC_PERM_INSTANT_LOGOUT
Definition RBAC.h:54
std::string Data
ObjectGuid guid
std::string ToString() const
Definition Position.cpp:149
void SetOrientation(float orientation)
Definition Position.h:74
time_t EndTimer
‍Marks if player is in an FFAPvP area (such as Gurubashi Arena)
Definition Player.h:250
std::string_view Name
Definition WhoPackets.h:78
std::string_view GuildName
Definition WhoPackets.h:79
Array< int32, 10 > Areas
Definition WhoPackets.h:62
Array< WhoWord, 4 > Words
Definition WhoPackets.h:63
std::vector< WhoEntry > Entries
Definition WhoPackets.h:89