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 "BattlegroundMgr.h"
21#include "CharacterPackets.h"
22#include "Chat.h"
23#include "CinematicMgr.h"
24#include "Common.h"
25#include "Corpse.h"
26#include "Creature.h"
27#include "CreatureAI.h"
28#include "DatabaseEnv.h"
29#include "DBCStores.h"
30#include "GameObject.h"
31#include "GameObjectAI.h"
32#include "GameTime.h"
33#include "GossipDef.h"
34#include "Group.h"
35#include "GuildMgr.h"
36#include "InspectPackets.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 "Opcodes.h"
46#include "OutdoorPvP.h"
47#include "Player.h"
48#include "ScriptMgr.h"
49#include "Spell.h"
50#include "SpellInfo.h"
51#include "WhoListStorage.h"
52#include "World.h"
53#include "WorldPacket.h"
54#include <cstdarg>
55#include <zlib.h>
56
58{
59 TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_REPOP_REQUEST Message");
60
61 if (GetPlayer()->IsAlive() || GetPlayer()->HasFlag(PLAYER_FLAGS, 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?
81 GetPlayer()->RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
84}
85
87{
88 TC_LOG_DEBUG("network", "WORLD: CMSG_GOSSIP_SELECT_OPTION");
89
90 uint32 gossipListId;
91 uint32 menuId;
92 ObjectGuid guid;
93 std::string code = "";
94
95 recvData >> guid >> menuId >> gossipListId;
96
97 if (!_player->PlayerTalkClass->GetGossipMenu().GetItem(gossipListId))
98 {
99 recvData.rfinish();
100 return;
101 }
102
103 if (_player->PlayerTalkClass->IsGossipOptionCoded(gossipListId))
104 recvData >> code;
105
106 // Prevent cheating on C++ scripted menus
108 return;
109
110 Creature* unit = nullptr;
111 GameObject* go = nullptr;
112 if (guid.IsCreatureOrVehicle())
113 {
115 if (!unit)
116 {
117 TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - {} not found or you can't interact with him.", guid.ToString());
118 return;
119 }
120 }
121 else if (guid.IsGameObject())
122 {
124 if (!go)
125 {
126 TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - {} not found or you can't interact with it.", guid.ToString());
127 return;
128 }
129 }
130 else
131 {
132 TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - unsupported {}.", guid.ToString());
133 return;
134 }
135
136 // remove fake death
137 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
139
140 if ((unit && unit->GetScriptId() != unit->LastUsedScriptID) || (go && go->GetScriptId() != go->LastUsedScriptID))
141 {
142 TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - Script reloaded while in use, ignoring and set new scipt id");
143 if (unit)
144 unit->LastUsedScriptID = unit->GetScriptId();
145 if (go)
146 go->LastUsedScriptID = go->GetScriptId();
148 return;
149 }
150 if (!code.empty())
151 {
152 if (unit)
153 {
154 if (!unit->AI()->OnGossipSelectCode(_player, menuId, gossipListId, code.c_str()))
155 _player->OnGossipSelect(unit, gossipListId, menuId);
156 }
157 else
158 {
159 if (!go->AI()->OnGossipSelectCode(_player, menuId, gossipListId, code.c_str()))
160 _player->OnGossipSelect(go, gossipListId, menuId);
161 }
162 }
163 else
164 {
165 if (unit)
166 {
167 if (!unit->AI()->OnGossipSelect(_player, menuId, gossipListId))
168 _player->OnGossipSelect(unit, gossipListId, menuId);
169 }
170 else
171 {
172 if (!go->AI()->OnGossipSelect(_player, menuId, gossipListId))
173 _player->OnGossipSelect(go, gossipListId, menuId);
174 }
175 }
176}
177
179{
180 TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_WHO Message");
181
182 uint32 matchCount = 0;
183
184 uint32 levelMin, levelMax, racemask, classmask, zonesCount, strCount;
185 uint32 zoneids[10]; // 10 is client limit
186 std::string packetPlayerName, packetGuildName;
187
188 recvData >> levelMin; // maximal player level, default 0
189 recvData >> levelMax; // minimal player level, default 100 (MAX_LEVEL)
190 recvData >> packetPlayerName; // player name, case sensitive...
191
192 recvData >> packetGuildName; // guild name, case sensitive...
193
194 recvData >> racemask; // race mask
195 recvData >> classmask; // class mask
196 recvData >> zonesCount; // zones count, client limit = 10 (2.0.10)
197
198 if (zonesCount > 10)
199 return; // can't be received from real client or broken packet
200
201 for (uint32 i = 0; i < zonesCount; ++i)
202 {
203 uint32 temp;
204 recvData >> temp; // zone id, 0 if zone is unknown...
205 zoneids[i] = temp;
206 TC_LOG_DEBUG("network", "Zone {}: {}", i, zoneids[i]);
207 }
208
209 recvData >> strCount; // user entered strings count, client limit=4 (checked on 2.0.10)
210
211 if (strCount > 4)
212 return; // can't be received from real client or broken packet
213
214 TC_LOG_DEBUG("network", "Minlvl {}, maxlvl {}, name {}, guild {}, racemask {}, classmask {}, zones {}, strings {}", levelMin, levelMax, packetPlayerName, packetGuildName, racemask, classmask, zonesCount, strCount);
215
216 std::wstring str[4]; // 4 is client limit
217 for (uint32 i = 0; i < strCount; ++i)
218 {
219 std::string temp;
220 recvData >> temp; // user entered string, it used as universal search pattern(guild+player name)?
221
222 if (!Utf8toWStr(temp, str[i]))
223 continue;
224
225 wstrToLower(str[i]);
226
227 TC_LOG_DEBUG("network", "String {}: {}", i, temp);
228 }
229
230 std::wstring wpacketPlayerName;
231 std::wstring wpacketGuildName;
232 if (!(Utf8toWStr(packetPlayerName, wpacketPlayerName) && Utf8toWStr(packetGuildName, wpacketGuildName)))
233 return;
234
235 wstrToLower(wpacketPlayerName);
236 wstrToLower(wpacketGuildName);
237
238 // client send in case not set max level value 100 but Trinity supports 255 max level,
239 // update it to show GMs with characters after 100 level
240 if (levelMax >= MAX_LEVEL)
241 levelMax = STRONG_MAX_LEVEL;
242
243 uint32 team = _player->GetTeam();
244
245 uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
246 uint32 displayCount = 0;
247
248 WorldPacket data(SMSG_WHO, 500); // guess size
249 data << uint32(matchCount); // placeholder, count of players matching criteria
250 data << uint32(displayCount); // placeholder, count of players displayed
251
252 WhoListInfoVector const& whoList = sWhoListStorageMgr->GetWhoList();
253 for (WhoListPlayerInfo const& target : whoList)
254 {
255 // player can see member of other team only if CONFIG_ALLOW_TWO_SIDE_WHO_LIST
256 if (target.GetTeam() != team && !HasPermission(rbac::RBAC_PERM_TWO_SIDE_WHO_LIST))
257 continue;
258
259 // player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST
260 if (!HasPermission(rbac::RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS) && target.GetSecurity() > AccountTypes(gmLevelInWhoList))
261 continue;
262
263 // check if target is globally visible for player
264 if (_player->GetGUID() != target.GetGuid() && !target.IsVisible())
266 continue;
267
268 // check if target's level is in level range
269 uint8 lvl = target.GetLevel();
270 if (lvl < levelMin || lvl > levelMax)
271 continue;
272
273 // check if class matches classmask
274 uint8 class_ = target.GetClass();
275 if (!(classmask & (1 << class_)))
276 continue;
277
278 // check if race matches racemask
279 uint32 race = target.GetRace();
280 if (!(racemask & (1 << race)))
281 continue;
282
283 uint32 playerZoneId = target.GetZoneId();
284 uint8 gender = target.GetGender();
285
286 bool showZones = true;
287 for (uint32 i = 0; i < zonesCount; ++i)
288 {
289 if (zoneids[i] == playerZoneId)
290 {
291 showZones = true;
292 break;
293 }
294
295 showZones = false;
296 }
297 if (!showZones)
298 continue;
299
300 std::wstring const& wideplayername = target.GetWidePlayerName();
301 if (!(wpacketPlayerName.empty() || wideplayername.find(wpacketPlayerName) != std::wstring::npos))
302 continue;
303
304 std::wstring const& wideguildname = target.GetWideGuildName();
305 if (!(wpacketGuildName.empty() || wideguildname.find(wpacketGuildName) != std::wstring::npos))
306 continue;
307
308 std::string aname;
309 if (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(playerZoneId))
310 aname = areaEntry->AreaName[GetSessionDbcLocale()];
311
312 bool s_show = true;
313 for (uint32 i = 0; i < strCount; ++i)
314 {
315 if (!str[i].empty())
316 {
317 if (wideguildname.find(str[i]) != std::wstring::npos ||
318 wideplayername.find(str[i]) != std::wstring::npos ||
319 Utf8FitTo(aname, str[i]))
320 {
321 s_show = true;
322 break;
323 }
324 s_show = false;
325 }
326 }
327 if (!s_show)
328 continue;
329
330 // 49 is maximum player count sent to client - can be overridden
331 // through config, but is unstable
332 if ((matchCount++) >= sWorld->getIntConfig(CONFIG_MAX_WHO))
333 continue;
334
335 data << target.GetPlayerName(); // player name
336 data << target.GetGuildName(); // guild name
337 data << uint32(lvl); // player level
338 data << uint32(class_); // player class
339 data << uint32(race); // player race
340 data << uint8(gender); // player gender
341 data << uint32(playerZoneId); // player zone id
342
343 ++displayCount;
344 }
345
346 data.put(0, displayCount); // insert right count, count displayed
347 data.put(4, matchCount); // insert right count, count of matches
348
349 SendPacket(&data);
350 TC_LOG_DEBUG("network", "WORLD: Send SMSG_WHO Message");
351}
352
354{
355 ObjectGuid lguid = GetPlayer()->GetLootGUID();
356 if (!lguid.IsEmpty())
357 DoLootRelease(lguid);
358
359 bool instantLogout = (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat()) ||
361
363 bool canLogoutInCombat = GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
364
365 uint32 reason = 0;
366 if (GetPlayer()->IsInCombat() && !canLogoutInCombat)
367 reason = 1;
368 else if (GetPlayer()->IsFalling())
369 reason = 3; // is jumping or falling
370 else if (GetPlayer()->duel || GetPlayer()->HasAura(9454)) // is dueling or frozen by GM via freeze command
371 reason = 2; // FIXME - Need the correct value
372
374 logoutResponse.LogoutResult = reason;
375 logoutResponse.Instant = instantLogout;
376 SendPacket(logoutResponse.Write());
377
378 if (reason)
379 {
381 return;
382 }
383
384 // instant logout in taverns/cities or on taxi or for admins, gm's, mod's if its enabled in worldserver.conf
385 if (instantLogout)
386 {
387 LogoutPlayer(true);
388 return;
389 }
390
391 // not set flags if player can't free move to prevent lost state at logout cancel
392 if (GetPlayer()->CanFreeMove())
393 {
394 if (GetPlayer()->GetStandState() == UNIT_STAND_STATE_STAND)
396 GetPlayer()->SetRooted(true);
398 }
399
401}
402
406
408{
409 // Player have already logged out serverside, too late to cancel
410 if (!GetPlayer())
411 return;
412
414
416
417 // not remove flags if can't free move - its not set in Logout request code.
418 if (GetPlayer()->CanFreeMove())
419 {
421 GetPlayer()->SetRooted(false);
422
425
428 }
429}
430
432{
433 // this opcode can be used in two ways: Either set explicit new status or toggle old status
434 if (togglePvP.Enable)
435 {
438 }
439 else
440 {
443 }
444
446 {
447 if (!GetPlayer()->IsPvP() || GetPlayer()->pvpInfo.EndTimer)
448 GetPlayer()->UpdatePvP(true, true);
449 }
450 else
451 {
452 if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP())
453 GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
454 }
455}
456
458{
459 uint32 newZone;
460 recvData >> newZone;
461
462 TC_LOG_DEBUG("network", "WORLD: Recvd ZONE_UPDATE: {}", newZone);
463
464 // use server side data, but only after update the player position. See Player::UpdatePosition().
466
467 //GetPlayer()->SendInitWorldStates(true, newZone);
468}
469
471{
472 ObjectGuid guid;
473 recvData >> guid;
474
475 _player->SetSelection(guid);
476
477 // Update target of current autoshoot spell
478 if (!guid.IsEmpty())
479 {
480 if (Spell* autoReapeatSpell = _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL))
481 {
482 if (!autoReapeatSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR4_UNK24) // client automatically handles spells with SPELL_ATTR4_AUTO_RANGED_COMBAT
483 && autoReapeatSpell->m_targets.GetUnitTargetGUID() != guid)
484 {
485 Unit* unitTarget = [&]() -> Unit*
486 {
487 Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
488 if (unit && _player->IsValidAttackTarget(unit, autoReapeatSpell->GetSpellInfo()))
489 return unit;
490 return nullptr;
491 }();
492
493 if (unitTarget)
494 autoReapeatSpell->m_targets.SetUnitTarget(unitTarget);
495 else
496 autoReapeatSpell->m_targets.RemoveObjectTarget();
497 }
498 }
499 }
500}
501
503{
504 uint32 animstate;
505 recvData >> animstate;
506
507 switch (animstate)
508 {
513 break;
514 default:
515 return;
516 }
517
519}
520
522{
523 uint32 suggestion, contentlen, typelen;
524 std::string content, type;
525
526 recvData >> suggestion >> contentlen >> content;
527
528 recvData >> typelen >> type;
529
530 if (suggestion == 0)
531 TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUG [Bug Report]");
532 else
533 TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUG [Suggestion]");
534
535 TC_LOG_DEBUG("network", "{}", type);
536 TC_LOG_DEBUG("network", "{}", content);
537
539
540 stmt->setString(0, type);
541 stmt->setString(1, content);
542
543 CharacterDatabase.Execute(stmt);
544}
545
547{
548 TC_LOG_DEBUG("network", "WORLD: Received CMSG_RECLAIM_CORPSE");
549
550 if (_player->IsAlive())
551 return;
552
553 // do not allow corpse reclaim in arena
554 if (_player->InArena())
555 return;
556
557 // body not released yet
559 return;
560
561 Corpse* corpse = _player->GetCorpse();
562 if (!corpse)
563 return;
564
565 // prevent resurrect before 30-sec delay after body release not finished
567 return;
568
570 return;
571
572 // resurrect
574
575 // spawn bones
577}
578
580{
581 TC_LOG_DEBUG("network", "WORLD: Received CMSG_RESURRECT_RESPONSE");
582
583 if (GetPlayer()->IsAlive())
584 return;
585
586 if (packet.Response == 0)
587 {
589 return;
590 }
591
592 if (!GetPlayer()->IsResurrectRequestedBy(packet.Resurrecter))
593 return;
594
596}
597
599{
600 va_list ap;
601 char szStr [1024];
602 szStr[0] = '\0';
603
604 va_start(ap, Text);
605 vsnprintf(szStr, 1024, Text, ap);
606 va_end(ap);
607
608 uint32 length = strlen(szStr)+1;
610 data << length;
611 data << szStr;
612 SendPacket(&data);
613}
614
616{
617 uint32 triggerId;
618 recvData >> triggerId;
619
620 TC_LOG_DEBUG("network", "CMSG_AREATRIGGER. Trigger ID: {}", triggerId);
621
622 Player* player = GetPlayer();
623 if (player->IsInFlight())
624 {
625 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} in flight, ignore Area Trigger ID:{}",
626 player->GetName(), player->GetGUID().ToString(), triggerId);
627 return;
628 }
629
630 AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(triggerId);
631 if (!atEntry)
632 {
633 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} send unknown (by DBC) Area Trigger ID:{}",
634 player->GetName(), player->GetGUID().ToString(), triggerId);
635 return;
636 }
637
638 if (!player->IsInAreaTriggerRadius(atEntry))
639 {
640 TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '{}' {} too far, ignore Area Trigger ID: {}",
641 player->GetName(), player->GetGUID().ToString(), triggerId);
642 return;
643 }
644
645 if (player->isDebugAreaTriggers)
647
648 if (!sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_AREATRIGGER_CLIENT_TRIGGERED, atEntry->ID, player))
649 return;
650
651 if (sScriptMgr->OnAreaTrigger(player, atEntry))
652 return;
653
654 if (player->IsAlive())
655 if (uint32 questId = sObjectMgr->GetQuestForAreaTrigger(triggerId))
656 if (player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE)
657 player->AreaExploredOrEventHappens(questId);
658
659 if (sObjectMgr->IsTavernAreaTrigger(triggerId))
660 {
661 // set resting flag we are in the inn
662 player->SetRestFlag(REST_FLAG_IN_TAVERN, atEntry->ID);
663
664 if (sWorld->IsFFAPvPRealm())
666
667 return;
668 }
669
670 if (Battleground* bg = player->GetBattleground())
671 if (bg->GetStatus() == STATUS_IN_PROGRESS)
672 bg->HandleAreaTrigger(player, triggerId);
673
674 if (OutdoorPvP* pvp = player->GetOutdoorPvP())
675 if (pvp->HandleAreaTrigger(_player, triggerId))
676 return;
677
678 AreaTriggerTeleport const* at = sObjectMgr->GetAreaTrigger(triggerId);
679 if (!at)
680 return;
681
682 bool teleported = false;
683 if (player->GetMapId() != at->target_mapId)
684 {
685 if (Map::EnterState denyReason = sMapMgr->PlayerCannotEnter(at->target_mapId, player, false))
686 {
687 bool reviveAtTrigger = false; // should we revive the player if he is trying to enter the correct instance?
688 switch (denyReason)
689 {
691 TC_LOG_DEBUG("maps", "MAP: Player '{}' attempted to enter map with id {} which has no entry", player->GetName(), at->target_mapId);
692 break;
694 TC_LOG_DEBUG("maps", "MAP: Player '{}' attempted to enter dungeon map {} but no instance template was found", player->GetName(), at->target_mapId);
695 break;
697 TC_LOG_DEBUG("maps", "MAP: Player '{}' attempted to enter instance map {} but the requested difficulty was not found", player->GetName(), at->target_mapId);
698 if (MapEntry const* entry = sMapStore.LookupEntry(at->target_mapId))
699 player->SendTransferAborted(entry->ID, TRANSFER_ABORT_DIFFICULTY, player->GetDifficulty(entry->IsRaid()));
700 break;
702 {
704 data << uint32(0);
705 data << uint32(2); // You must be in a raid group to enter this instance.
706 player->SendDirectMessage(&data);
707 TC_LOG_DEBUG("maps", "MAP: Player '{}' must be in a raid group to enter instance map {}", player->GetName(), at->target_mapId);
708 reviveAtTrigger = true;
709 break;
710 }
712 {
714 player->SendDirectMessage(&data);
715 TC_LOG_DEBUG("maps", "MAP: Player '{}' does not have a corpse in instance map {} and cannot enter", player->GetName(), at->target_mapId);
716 break;
717 }
719 if (MapEntry const* entry = sMapStore.LookupEntry(at->target_mapId))
720 {
721 char const* mapName = entry->MapName[player->GetSession()->GetSessionDbcLocale()];
722 TC_LOG_DEBUG("maps", "MAP: Player '{}' cannot enter instance map '{}' because their permanent bind is incompatible with their group's", player->GetName(), mapName);
723 // is there a special opcode for this?
724 // @todo figure out how to get player localized difficulty string (e.g. "10 player", "Heroic" etc)
726 }
727 reviveAtTrigger = true;
728 break;
731 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);
732 reviveAtTrigger = true;
733 break;
736 reviveAtTrigger = true;
737 break;
740 reviveAtTrigger = true;
741 break;
742 default:
743 break;
744 }
745
746 if (reviveAtTrigger) // check if the player is touching the areatrigger leading to the map his corpse is on
747 if (!player->IsAlive() && player->HasCorpse())
748 if (player->GetCorpseLocation().GetMapId() == at->target_mapId)
749 {
750 player->ResurrectPlayer(0.5f);
751 player->SpawnCorpseBones();
752 }
753
754 return;
755 }
756
757 if (Group* group = player->GetGroup())
758 if (group->isLFGGroup() && player->GetMap()->IsDungeon())
759 teleported = player->TeleportToBGEntryPoint();
760 }
761
762 if (!teleported)
764}
765
767{
768 TC_LOG_DEBUG("network", "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA");
769
770 uint32 type, timestamp, decompressedSize;
771 recvData >> type >> timestamp >> decompressedSize;
772
773 TC_LOG_DEBUG("network", "UAD: type {}, time {}, decompressedSize {}", type, timestamp, decompressedSize);
774
775 if (type >= NUM_ACCOUNT_DATA_TYPES)
776 return;
777
778 if (decompressedSize == 0) // erase
779 {
780 SetAccountData(AccountDataType(type), 0, "");
781
783 data << uint32(type);
784 data << uint32(0);
785 SendPacket(&data);
786
787 return;
788 }
789
790 if (decompressedSize > 0xFFFF)
791 {
792 recvData.rfinish(); // unnneded warning spam in this case
793 TC_LOG_ERROR("network", "UAD: Account data packet too big, size {}", decompressedSize);
794 return;
795 }
796
797 ByteBuffer dest;
798 dest.resize(decompressedSize);
799
800 uLongf realSize = decompressedSize;
801 if (uncompress(dest.contents(), &realSize, recvData.contents() + recvData.rpos(), recvData.size() - recvData.rpos()) != Z_OK)
802 {
803 recvData.rfinish(); // unnneded warning spam in this case
804 TC_LOG_ERROR("network", "UAD: Failed to decompress account data");
805 return;
806 }
807
808 recvData.rfinish(); // uncompress read (recvData.size() - recvData.rpos())
809
810 std::string adata;
811 dest >> adata;
812
813 SetAccountData(AccountDataType(type), timestamp, adata);
814
816 data << uint32(type);
817 data << uint32(0);
818 SendPacket(&data);
819}
820
822{
823 TC_LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA");
824
825 uint32 type;
826 recvData >> type;
827
828 TC_LOG_DEBUG("network", "RAD: type {}", type);
829
830 if (type >= NUM_ACCOUNT_DATA_TYPES)
831 return;
832
834
835 uint32 size = adata->Data.size();
836
837 uLongf destSize = compressBound(size);
838
839 ByteBuffer dest;
840 dest.resize(destSize);
841
842 if (size && compress(dest.contents(), &destSize, (uint8 const*)adata->Data.c_str(), size) != Z_OK)
843 {
844 TC_LOG_DEBUG("network", "RAD: Failed to compress account data");
845 return;
846 }
847
848 dest.resize(destSize);
849
850 WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA, 8+4+4+4+destSize);
851 data << (_player ? _player->GetGUID() : ObjectGuid::Empty);
852 data << uint32(type); // type (0-7)
853 data << uint32(adata->Time); // unix time
854 data << uint32(size); // decompressed length
855 data.append(dest); // compressed data
856 SendPacket(&data);
857}
858
860{
861 uint8 button;
862 uint32 packetData;
863 recvData >> button >> packetData;
864 TC_LOG_DEBUG("network", "CMSG_SET_ACTION_BUTTON Button: {} Data: {}", button, packetData);
865
866 if (!packetData)
867 GetPlayer()->removeActionButton(button);
868 else
869 GetPlayer()->addActionButton(button, ACTION_BUTTON_ACTION(packetData), ACTION_BUTTON_TYPE(packetData));
870}
871
873{
874 // If player has sight bound to visual waypoint NPC we should remove it
876}
877
879{
880 // Sent by client when cinematic actually begun. So we begin the server side process
882}
883
885{
886 uint32 movie = _player->GetMovie();
887 if (!movie)
888 return;
889
890 _player->SetMovie(0);
891 sScriptMgr->OnMovieComplete(_player, movie);
892}
893
895{
896 uint8 actionBar;
897 recvData >> actionBar;
898
899 if (!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED)
900 {
901 if (actionBar != 0)
902 TC_LOG_ERROR("network", "WorldSession::HandleSetActionBarToggles in not logged state with value: {}, ignored", uint32(actionBar));
903 return;
904 }
905
907}
908
910{
912 playedTime.TotalTime = _player->GetTotalPlayedTime();
913 playedTime.LevelTime = _player->GetLevelPlayedTime();
914 playedTime.TriggerScriptEvent = packet.TriggerScriptEvent; // 0-1 - will not show in chat frame
915 SendPacket(playedTime.Write());
916}
917
919{
920 Player* player = ObjectAccessor::GetPlayer(*_player, inspect.Target);
921 if (!player)
922 {
923 TC_LOG_DEBUG("network", "CMSG_INSPECT: No player found from {}", inspect.Target.ToString());
924 return;
925 }
926
927 TC_LOG_DEBUG("network", "WorldSession::HandleInspectOpcode: Target {}.", inspect.Target.ToString());
928
929 if (!GetPlayer()->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
930 return;
931
932 if (GetPlayer()->IsValidAttackTarget(player))
933 return;
934
936 inspectResult.InspecteeGUID = inspect.Target;
937
938 for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
939 {
940 if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
941 {
942 inspectResult.ItemSlots[i] = true;
943 inspectResult.Items.emplace_back(item);
944 }
945 }
946
947 if (GetPlayer()->CanBeGameMaster() || sWorld->getIntConfig(CONFIG_TALENTS_INSPECTING) + (GetPlayer()->GetTeamId() == player->GetTeamId()) > 1)
948 player->BuildPlayerTalentsInfoData(inspectResult.TalentInfo);
949
950 SendPacket(inspectResult.Write());
951}
952
954{
955 ObjectGuid guid;
956 recvData >> guid;
957
958 Player* player = ObjectAccessor::GetPlayer(*_player, guid);
959
960 if (!player)
961 {
962 TC_LOG_DEBUG("network", "MSG_INSPECT_HONOR_STATS: No player found from {}", guid.ToString());
963 return;
964 }
965
966 if (!GetPlayer()->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
967 return;
968
969 if (GetPlayer()->IsValidAttackTarget(player))
970 return;
971
973 data << player->GetGUID();
974 data << uint8(player->GetHonorPoints());
975 data << uint32(player->GetUInt32Value(PLAYER_FIELD_KILLS));
979 SendPacket(&data);
980}
981
983{
984 if (_player->IsInFlight())
985 {
986 TC_LOG_DEBUG("network", "Player '{}' ({}) in flight, ignore worldport command.",
988 return;
989 }
990
991 WorldLocation loc(worldTeleport.MapID, worldTeleport.Pos);
992 loc.SetOrientation(worldTeleport.Facing);
993 TC_LOG_DEBUG("network", "CMSG_WORLD_TELEPORT: Player = {}, time = {}, map = {}, pos = {}",
994 _player->GetName(), worldTeleport.Time, worldTeleport.MapID, loc.ToString());
995
997 _player->TeleportTo(loc);
998 else
1000}
1001
1003{
1004 TC_LOG_DEBUG("network", "Received opcode CMSG_WHOIS");
1005 std::string charname;
1006 recvData >> charname;
1007
1009 {
1011 return;
1012 }
1013
1014 if (charname.empty() || !normalizePlayerName (charname))
1015 {
1017 return;
1018 }
1019
1021
1022 if (!player)
1023 {
1025 return;
1026 }
1027
1028 uint32 accid = player->GetSession()->GetAccountId();
1029
1031
1032 stmt->setUInt32(0, accid);
1033
1034 PreparedQueryResult result = LoginDatabase.Query(stmt);
1035
1036 if (!result)
1037 {
1039 return;
1040 }
1041
1042 Field* fields = result->Fetch();
1043 std::string acc = fields[0].GetString();
1044 if (acc.empty())
1045 acc = "Unknown";
1046 std::string email = fields[1].GetString();
1047 if (email.empty())
1048 email = "Unknown";
1049 std::string lastip = fields[2].GetString();
1050 if (lastip.empty())
1051 lastip = "Unknown";
1052
1053 std::string msg = charname + "'s " + "account is " + acc + ", e-mail: " + email + ", last ip: " + lastip;
1054
1055 WorldPacket data(SMSG_WHOIS, msg.size()+1);
1056 data << msg;
1057 SendPacket(&data);
1058
1059 TC_LOG_DEBUG("network", "Received whois command from player {} for character {}",
1060 GetPlayer()->GetName(), charname);
1061}
1062
1064{
1065 TC_LOG_DEBUG("network", "WORLD: CMSG_COMPLAIN");
1066
1067 uint8 spam_type; // 0 - mail, 1 - chat
1068 ObjectGuid spammer_guid;
1069 uint32 unk1 = 0;
1070 uint32 unk2 = 0;
1071 uint32 unk3 = 0;
1072 uint32 unk4 = 0;
1073 std::string description = "";
1074 recvData >> spam_type; // unk 0x01 const, may be spam type (mail/chat)
1075 recvData >> spammer_guid; // player guid
1076 switch (spam_type)
1077 {
1078 case 0:
1079 recvData >> unk1; // const 0
1080 recvData >> unk2; // probably mail id
1081 recvData >> unk3; // const 0
1082 break;
1083 case 1:
1084 recvData >> unk1; // probably language
1085 recvData >> unk2; // message type?
1086 recvData >> unk3; // probably channel id
1087 recvData >> unk4; // time
1088 recvData >> description; // spam description string (messagetype, channel name, player name, message)
1089 break;
1090 }
1091
1092 // NOTE: all chat messages from this spammer automatically ignored by spam reporter until logout in case chat spam.
1093 // if it's mail spam - ALL mails from this spammer automatically removed by client
1094
1095 // Complaint Received message
1097 data << uint8(0);
1098 SendPacket(&data);
1099
1100 TC_LOG_DEBUG("network", "REPORT SPAM: type {}, {}, unk1 {}, unk2 {}, unk3 {}, unk4 {}, message {}",
1101 spam_type, spammer_guid.ToString(), unk1, unk2, unk3, unk4, description);
1102}
1103
1105{
1106 TC_LOG_DEBUG("network", "CMSG_REALM_SPLIT");
1107
1108 uint32 unk;
1109 std::string split_date = "01/01/01";
1110 recvData >> unk;
1111
1112 WorldPacket data(SMSG_REALM_SPLIT, 4+4+split_date.size()+1);
1113 data << unk;
1114 data << uint32(0x00000000); // realm split state
1115 // split states:
1116 // 0x0 realm normal
1117 // 0x1 realm split
1118 // 0x2 realm split pending
1119 data << split_date;
1120 SendPacket(&data);
1121 //TC_LOG_DEBUG("response sent {}", unk);
1122}
1123
1125{
1126 TC_LOG_DEBUG("network", "WORLD: CMSG_FAR_SIGHT");
1127
1128 bool apply;
1129 recvData >> apply;
1130
1131 if (apply)
1132 {
1133 TC_LOG_DEBUG("network", "Added FarSight {} to player {}", _player->GetGuidValue(PLAYER_FARSIGHT).ToString(), _player->GetGUID().ToString());
1134 if (WorldObject* target = _player->GetViewpoint())
1135 _player->SetSeer(target);
1136 else
1137 TC_LOG_DEBUG("network", "Player {} {} requests non-existing seer {}", _player->GetName(), _player->GetGUID().ToString(), _player->GetGuidValue(PLAYER_FARSIGHT).ToString());
1138 }
1139 else
1140 {
1141 TC_LOG_DEBUG("network", "Player {} set vision to self", _player->GetGUID().ToString());
1143 }
1144
1146}
1147
1149{
1150 TC_LOG_DEBUG("network", "CMSG_SET_TITLE");
1151
1152 int32 title;
1153 recvData >> title;
1154
1155 // -1 at none
1156 if (title > 0 && title < MAX_TITLE_INDEX)
1157 {
1158 if (!GetPlayer()->HasTitle(title))
1159 return;
1160 }
1161 else
1162 title = 0;
1163
1165}
1166
1168{
1169 TC_LOG_DEBUG("network", "WORLD: CMSG_RESET_INSTANCES");
1170
1171 if (Group* group = _player->GetGroup())
1172 {
1173 if (group->IsLeader(_player->GetGUID()))
1174 group->ResetInstances(INSTANCE_RESET_ALL, false, _player);
1175 }
1176 else
1178}
1179
1181{
1182 TC_LOG_DEBUG("network", "MSG_SET_DUNGEON_DIFFICULTY");
1183
1184 uint32 mode;
1185 recvData >> mode;
1186
1187 if (mode >= MAX_DUNGEON_DIFFICULTY)
1188 {
1189 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player {} sent an invalid instance mode {}!", _player->GetGUID().ToString(), mode);
1190 return;
1191 }
1192
1193 if (Difficulty(mode) == _player->GetDungeonDifficulty())
1194 return;
1195
1196 // cannot reset while in an instance
1197 Map* map = _player->FindMap();
1198 if (map && map->IsDungeon())
1199 {
1200 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: {}, {}) tried to reset the instance while player is inside!",
1202 return;
1203 }
1204
1205 Group* group = _player->GetGroup();
1206 if (group)
1207 {
1208 if (group->IsLeader(_player->GetGUID()))
1209 {
1210 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
1211 {
1212 Player* groupGuy = itr->GetSource();
1213 if (!groupGuy)
1214 continue;
1215
1216 if (!groupGuy->IsInWorld())
1217 return;
1218
1219 if (groupGuy->GetMap()->IsNonRaidDungeon())
1220 {
1221 TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player {} tried to reset the instance while group member (Name: {}, {}) is inside!",
1222 _player->GetGUID().ToString(), groupGuy->GetName(), groupGuy->GetGUID().ToString());
1223 return;
1224 }
1225 }
1226 // the difficulty is set even if the instances can't be reset
1227 //_player->SendDungeonDifficulty(true);
1229 group->SetDungeonDifficulty(Difficulty(mode));
1230 }
1231 }
1232 else
1233 {
1236 }
1237}
1238
1240{
1241 TC_LOG_DEBUG("network", "MSG_SET_RAID_DIFFICULTY");
1242
1243 uint32 mode;
1244 recvData >> mode;
1245
1246 if (mode >= MAX_RAID_DIFFICULTY)
1247 {
1248 TC_LOG_ERROR("network", "WorldSession::HandleSetRaidDifficultyOpcode: player {} sent an invalid instance mode {}!", _player->GetGUID().ToString(), mode);
1249 return;
1250 }
1251
1252 // cannot reset while in an instance
1253 Map* map = _player->FindMap();
1254 if (map && map->IsDungeon())
1255 {
1256 TC_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: player {} tried to reset the instance while inside!", _player->GetGUID().ToString());
1257 return;
1258 }
1259
1260 if (Difficulty(mode) == _player->GetRaidDifficulty())
1261 return;
1262
1263 Group* group = _player->GetGroup();
1264 if (group)
1265 {
1266 if (group->IsLeader(_player->GetGUID()))
1267 {
1268 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
1269 {
1270 Player* groupGuy = itr->GetSource();
1271 if (!groupGuy)
1272 continue;
1273
1274 if (!groupGuy->IsInWorld())
1275 return;
1276
1277 if (groupGuy->GetMap()->IsRaid())
1278 {
1279 TC_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: player {} tried to reset the instance while inside!", _player->GetGUID().ToString());
1280 return;
1281 }
1282 }
1283 // the difficulty is set even if the instances can't be reset
1284 //_player->SendDungeonDifficulty(true);
1286 group->SetRaidDifficulty(Difficulty(mode));
1287 }
1288 }
1289 else
1290 {
1293 }
1294}
1295
1297{
1298 TC_LOG_DEBUG("network", "WORLD: CMSG_SET_TAXI_BENCHMARK_MODE");
1299
1300 uint8 mode;
1301 recvData >> mode;
1302
1304
1305 TC_LOG_DEBUG("network", "Client used \"/timetest {}\" command", mode);
1306}
1307
1309{
1310 ObjectGuid guid;
1311 recvData >> guid.ReadAsPacked();
1312
1313 TC_LOG_DEBUG("network", "CMSG_QUERY_INSPECT_ACHIEVEMENTS [{}] Inspected Player [{}]", _player->GetGUID().ToString(), guid.ToString());
1314 Player* player = ObjectAccessor::GetPlayer(*_player, guid);
1315 if (!player)
1316 return;
1317
1318 if (!GetPlayer()->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
1319 return;
1320
1321 if (GetPlayer()->IsValidAttackTarget(player))
1322 return;
1323
1325}
1326
1328{
1329 // empty opcode
1330 TC_LOG_DEBUG("network", "WORLD: CMSG_WORLD_STATE_UI_TIMER_UPDATE");
1331
1333 response.Time = GameTime::GetGameTime();
1334 SendPacket(response.Write());
1335}
1336
1338{
1339 // empty opcode
1340 TC_LOG_DEBUG("network", "WORLD: CMSG_READY_FOR_ACCOUNT_DATA_TIMES");
1341
1343}
1344
1346{
1348 data << uint32(PhaseShift);
1349 SendPacket(&data);
1350}
1351
1353{
1354 uint8 accept;
1355 recvPacket >> accept;
1356
1357 if (!_player->HasPendingBind())
1358 {
1359 TC_LOG_INFO("network", "InstanceLockResponse: Player {} {} tried to bind himself/teleport to graveyard without a pending bind!",
1361 return;
1362 }
1363
1364 if (accept)
1366 else
1368
1369 _player->SetPendingBind(0, 0);
1370}
1371
1373{
1374 TC_LOG_DEBUG("network", "WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY");
1375
1376 ObjectGuid guid;
1377 uint32 spellId;
1378 float elevation, speed;
1381 uint8 moveStop;
1382
1383 recvPacket >> guid >> spellId >> elevation >> speed;
1384 recvPacket >> firePos;
1385 recvPacket >> impactPos;
1386 recvPacket >> moveStop;
1387
1388 Unit* caster = ObjectAccessor::GetUnit(*_player, guid);
1389 Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_GENERIC_SPELL) : nullptr;
1390 if (!spell || spell->m_spellInfo->Id != spellId || !spell->m_targets.HasDst() || !spell->m_targets.HasSrc())
1391 {
1392 recvPacket.rfinish();
1393 return;
1394 }
1395
1396 spell->m_targets.ModSrc(firePos);
1397 spell->m_targets.ModDst(impactPos);
1398
1399 spell->m_targets.SetElevation(elevation);
1400 spell->m_targets.SetSpeed(speed);
1401
1402 if (moveStop)
1403 {
1404 OpcodeClient opcode = static_cast<OpcodeClient>(recvPacket.read<uint32>());
1405 MovementInfo movementInfo;
1406 recvPacket >> movementInfo.guid.ReadAsPacked();
1407 recvPacket >> movementInfo;
1408 HandleMovementOpcode(opcode, movementInfo);
1409 }
1410}
@ 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:295
Difficulty
Definition DBCEnums.h:279
#define MAX_DUNGEON_DIFFICULTY
Definition DBCEnums.h:294
@ 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:868
@ INSTANCE_RESET_ALL
Definition Map.h:867
#define INSPECT_DISTANCE
bool normalizePlayerName(std::string &name)
#define sObjectMgr
Definition ObjectMgr.h:1721
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:45
@ EQUIPMENT_SLOT_END
Definition Player.h:571
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition Player.h:680
@ TRANSFER_ABORT_TOO_MANY_INSTANCES
Definition Player.h:632
@ TRANSFER_ABORT_DIFFICULTY
Definition Player.h:635
@ TRANSFER_ABORT_MAX_PLAYERS
Definition Player.h:630
@ TRANSFER_ABORT_ZONE_IN_COMBAT
Definition Player.h:633
@ PLAYER_FLAGS_IN_PVP
Definition Player.h:353
@ PLAYER_FLAGS_RESTING
Definition Player.h:349
@ PLAYER_FLAGS_GHOST
Definition Player.h:348
@ PLAYER_FLAGS_TAXI_BENCHMARK
Definition Player.h:361
@ PLAYER_FLAGS_PVP_TIMER
Definition Player.h:362
@ PLAYER_FIELD_BYTES_OFFSET_ACTION_BAR_TOGGLES
Definition Player.h:406
@ REST_FLAG_IN_TAVERN
Definition Player.h:672
#define ACTION_BUTTON_TYPE(X)
Definition Player.h:211
#define MAX_TITLE_INDEX
Definition Player.h:422
#define ACTION_BUTTON_ACTION(X)
Definition Player.h:210
#define INVENTORY_SLOT_BAG_0
Definition Player.h:547
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:107
#define sScriptMgr
Definition ScriptMgr.h:1168
@ SPELL_ATTR4_UNK24
@ SPELL_AURA_PREVENT_RESURRECTION
@ SPELL_AURA_FEIGN_DEATH
UnitStandStateType
Definition UnitDefines.h:33
@ 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:212
@ CURRENT_GENERIC_SPELL
Definition Unit.h:607
@ CURRENT_AUTOREPEAT_SPELL
Definition Unit.h:609
@ UNIT_STATE_DIED
Definition Unit.h:220
@ PLAYER_FIELD_TODAY_CONTRIBUTION
@ PLAYER_CHOSEN_TITLE
@ PLAYER_FLAGS
@ PLAYER_FIELD_KILLS
@ PLAYER_FIELD_YESTERDAY_CONTRIBUTION
@ PLAYER_FIELD_LIFETIME_HONORABLE_KILLS
@ PLAYER_FARSIGHT
@ PLAYER_FIELD_BYTES
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)
size_t rpos() const
Definition ByteBuffer.h:308
void resize(size_t newsize)
Definition ByteBuffer.h:412
void append(T value)
Definition ByteBuffer.h:129
void rfinish()
Definition ByteBuffer.h:316
void put(std::size_t pos, T value)
Definition ByteBuffer.h:137
size_t size() const
Definition ByteBuffer.h:409
uint8 * contents()
Definition ByteBuffer.h:395
void PSendSysMessage(char const *fmt, Args &&... args)
Definition Chat.h:69
void EndCinematic()
void BeginCinematic()
time_t const & GetGhostTime() const
Definition Corpse.h:70
CorpseType GetType() const
Definition Corpse.h:72
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:154
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:189
ObjectGuid GetSenderGUID() const
Definition GossipDef.h:173
Definition Group.h:165
void SetRaidDifficulty(Difficulty difficulty)
Definition Group.cpp:2128
void SetDungeonDifficulty(Difficulty difficulty)
Definition Group.cpp:2104
bool IsLeader(ObjectGuid guid) const
Definition Group.cpp:2510
void ResetInstances(uint8 method, bool isRaid, Player *SendMsgTo)
Definition Group.cpp:2165
GroupReference * GetFirstMember()
Definition Group.h:247
Definition Item.h:62
Definition Map.h:281
bool IsDungeon() const
Definition Map.cpp:4236
bool IsNonRaidDungeon() const
Definition Map.cpp:4241
bool IsRaid() const
Definition Map.cpp:4246
EnterState
Definition Map.h:394
@ CANNOT_ENTER_CORPSE_IN_DIFFERENT_INSTANCE
Definition Map.h:401
@ CANNOT_ENTER_TOO_MANY_INSTANCES
Definition Map.h:403
@ CANNOT_ENTER_MAX_PLAYERS
Definition Map.h:404
@ CANNOT_ENTER_ZONE_IN_COMBAT
Definition Map.h:405
@ CANNOT_ENTER_NO_ENTRY
Definition Map.h:397
@ CANNOT_ENTER_DIFFICULTY_UNAVAILABLE
Definition Map.h:399
@ CANNOT_ENTER_INSTANCE_BIND_MISMATCH
Definition Map.h:402
@ CANNOT_ENTER_UNINSTANCED_DUNGEON
Definition Map.h:398
@ CANNOT_ENTER_NOT_IN_RAID
Definition Map.h:400
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
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition Object.cpp:668
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:249
bool IsInWorld() const
Definition Object.h:73
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:760
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:775
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
Definition Object.cpp:805
bool HasFlag(uint16 index, uint32 flag) const
Definition Object.cpp:799
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:585
void ToggleFlag(uint16 index, uint32 flag)
Definition Object.cpp:791
ObjectGuid GetGuidValue(uint16 index) const
Definition Object.cpp:281
void SendCloseGossip()
bool IsGossipOptionCoded(uint32 selection) const
Definition GossipDef.h:270
GossipMenu & GetGossipMenu()
Definition GossipDef.h:262
ActionButton * addActionButton(uint8 button, uint32 action, uint8 type)
Definition Player.cpp:6063
uint32 GetTeam() const
Definition Player.h:1832
Difficulty GetRaidDifficulty() const
Definition Player.h:1636
WorldLocation const & GetCorpseLocation() const
Definition Player.h:1758
void removeActionButton(uint8 button)
Definition Player.cpp:6079
void SetRestFlag(RestFlag restFlag, uint32 triggerId=0)
Definition Player.cpp:26452
void SetSeer(WorldObject *target)
Definition Player.h:2069
void KillPlayer()
Definition Player.cpp:4434
uint32 GetTotalPlayedTime() const
Definition Player.h:1036
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:6161
void ResurrectUsingRequestData()
Definition Player.cpp:23704
void SetDungeonDifficulty(Difficulty dungeon_difficulty)
Definition Player.h:1638
GameObject * GetGameObjectIfCanInteractWith(ObjectGuid const &guid) const
Definition Player.cpp:2138
void BuildPlayerTalentsInfoData(WorldPackets::Talent::TalentInfoUpdate &talentInfo)
Definition Player.cpp:25257
bool InBattleground() const
Definition Player.h:1982
void RemoveGhoul()
Definition Player.cpp:4429
void SpawnCorpseBones(bool triggerSave=true)
Definition Player.cpp:4536
Difficulty GetDifficulty(bool isRaid) const
Definition Player.h:1634
void ResetInstances(uint8 method, bool isRaid)
Reset all solo instances and optionally send a message on success for each.
Definition Player.cpp:20130
bool HasCorpse() const
Definition Player.h:1757
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg=0) const
Definition Player.cpp:22578
void SetRaidDifficulty(Difficulty raid_difficulty)
Definition Player.h:1639
bool HasPendingBind() const
Definition Player.h:2155
WorldSession * GetSession() const
Definition Player.h:1719
OutdoorPvP * GetOutdoorPvP() const
Definition Player.cpp:23422
Item * GetItemByPos(uint16 pos) const
Definition Player.cpp:9552
ObjectGuid GetLootGUID() const
Definition Player.h:1714
void RepopAtGraveyard()
Definition Player.cpp:4773
TeamId GetTeamId() const
Definition Player.h:1833
void SetSelection(ObjectGuid guid)
Used for serverside target changes, does not apply to players.
Definition Player.h:1424
CinematicMgr * GetCinematicMgr() const
Definition Player.h:1213
uint32 GetHonorPoints() const
Definition Player.h:1866
void SendRespondInspectAchievements(Player *player) const
Definition Player.cpp:24915
void UpdateVisibilityForPlayer()
Definition Player.cpp:22312
void ClearResurrectRequestData()
Definition Player.h:1552
Creature * GetNPCIfCanInteractWith(ObjectGuid const &guid, NPCFlags npcFlags) const
Definition Player.cpp:2094
WorldObject * GetViewpoint() const
Definition Player.cpp:24185
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition Player.cpp:20310
bool TeleportToBGEntryPoint()
Definition Player.cpp:1766
Corpse * GetCorpse() const
Definition Player.cpp:4544
Battleground * GetBattleground() const
Definition Player.cpp:23049
Group * GetGroup()
Definition Player.h:2171
bool IsInAreaTriggerRadius(AreaTriggerEntry const *trigger) const
Definition Player.cpp:2176
void SetMovie(uint32 movie)
Definition Player.h:1573
void SetNeedsZoneUpdate(bool needsUpdate)
Definition Player.h:1589
void SetPendingBind(uint32 instanceId, uint32 bindTimer)
Definition Player.cpp:18700
PvPInfo pvpInfo
Definition Player.h:1582
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
Definition Player.cpp:1524
uint32 GetCorpseReclaimDelay(bool pvp) const
Definition Player.cpp:23809
void OnGossipSelect(WorldObject *source, uint32 gossipListId, uint32 menuId)
Definition Player.cpp:14087
void AreaExploredOrEventHappens(uint32 questId)
Definition Player.cpp:16008
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition Player.cpp:15642
bool InArena() const
Definition Player.cpp:23148
void BuildPlayerRepop()
Definition Player.cpp:4292
InstancePlayerBind * BindToInstance(InstanceSave *save, bool permanent, BindExtensionState extendState=EXTEND_STATE_NORMAL, bool load=false)
Definition Player.cpp:18618
uint32 GetLevelPlayedTime() const
Definition Player.h:1037
bool isDebugAreaTriggers
Definition Player.h:2246
void UpdatePvP(bool state, bool override=false)
Definition Player.cpp:21687
Difficulty GetDungeonDifficulty() const
Definition Player.h:1635
uint32 GetMovie() const
Definition Player.h:1572
PlayerMenu * PlayerTalkClass
Definition Player.h:1969
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition Player.cpp:4346
void setUInt32(uint8 index, uint32 value)
void setString(uint8 index, std::string const &value)
void ModDst(Position const &pos)
Definition Spell.cpp:414
bool HasSrc() const
Definition Spell.cpp:431
void SetSpeed(float speed)
bool HasDst() const
Definition Spell.cpp:436
void SetElevation(float elevation)
void ModSrc(Position const &pos)
Definition Spell.cpp:363
uint32 Id
Definition SpellInfo.h:289
Definition Spell.h:152
SpellCastTargets m_targets
Definition Spell.h:402
SpellInfo const *const m_spellInfo
Definition Spell.h:395
Definition Unit.h:769
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3765
bool IsAlive() const
Definition Unit.h:1234
bool IsInFlight() const
Definition Unit.h:1119
void SetRooted(bool apply)
Definition Unit.cpp:11386
void RemovePvpFlag(UnitPVPStateFlags flags)
Definition Unit.h:984
void SetStandState(UnitStandStateType state)
Definition Unit.cpp:10363
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
bool IsInCombat() const
Definition Unit.h:1144
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1476
uint32 GetMapId() const
Definition Position.h:193
Map * GetMap() const
Definition Object.h:449
Map * FindMap() const
Definition Object.h:450
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition Object.cpp:2856
uint32 LastUsedScriptID
Definition Object.h:561
std::string const & GetName() const
Definition Object.h:382
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1192
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< InspectItemData > Items
Talent::TalentInfoUpdate TalentInfo
WorldPacket const * Write() override
TaggedPosition< Position::XYZ > Pos
void HandleGossipSelectOptionOpcode(WorldPacket &recvPacket)
void LogoutPlayer(bool save)
Log the player out
void HandleMovementOpcode(OpcodeClient opcode, MovementInfo &movementInfo)
AccountData * GetAccountData(AccountDataType type)
void HandleSetDungeonDifficultyOpcode(WorldPacket &recvData)
void HandleSetSelectionOpcode(WorldPacket &recvPacket)
char const * GetTrinityString(uint32 entry) const
void HandleNextCinematicCamera(WorldPackets::Misc::NextCinematicCamera &packet)
void HandleResetInstancesOpcode(WorldPacket &recvData)
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
void SendNotification(const char *format,...) ATTR_PRINTF(2
void HandleLogoutCancelOpcode(WorldPackets::Character::LogoutCancel &logoutCancel)
void HandleWorldStateUITimerUpdate(WorldPacket &recvData)
void HandleRequestAccountData(WorldPacket &recvPacket)
AccountTypes GetSecurity() const
void HandleSetActionButtonOpcode(WorldPacket &recvPacket)
void HandleComplainOpcode(WorldPacket &recvData)
void HandleWhoIsOpcode(WorldPacket &recvData)
void HandleWhoOpcode(WorldPacket &recvPacket)
void HandleTogglePvP(WorldPackets::Misc::TogglePvP &togglePvP)
void void SendSetPhaseShift(uint32 phaseShift)
LocaleConstant GetSessionDbcLocale() const
void HandleRepopRequest(WorldPackets::Misc::RepopRequest &packet)
Player * GetPlayer() const
void SetLogoutStartTime(time_t requestTime)
Engage the logout process for the user.
void SendAreaTriggerMessage(char const *Text,...) ATTR_PRINTF(2
void HandleBugOpcode(WorldPacket &recvPacket)
void HandleWorldTeleportOpcode(WorldPackets::Misc::WorldTeleport &worldTeleport)
void HandleSetRaidDifficultyOpcode(WorldPacket &recvData)
void HandleCompleteMovie(WorldPackets::Misc::CompleteMovie &packet)
void HandleStandStateChangeOpcode(WorldPacket &recvPacket)
void HandleReadyForAccountDataTimes(WorldPacket &recvData)
void HandleLogoutRequestOpcode(WorldPackets::Character::LogoutRequest &logoutRequest)
void HandleUpdateMissileTrajectory(WorldPacket &recvPacket)
bool HasPermission(uint32 permissionId)
void HandleAreaTriggerOpcode(WorldPacket &recvPacket)
void HandleInspectOpcode(WorldPackets::Inspect::Inspect &inspect)
uint32 GetAccountId() const
void HandleUpdateAccountData(WorldPacket &recvPacket)
void HandleInstanceLockResponse(WorldPacket &recvPacket)
void HandleFarSightOpcode(WorldPacket &recvData)
Player * _player
void DoLootRelease(ObjectGuid lguid)
void HandlePlayedTime(WorldPackets::Character::PlayedTimeClient &packet)
void HandleSetActionBarToggles(WorldPacket &recvData)
void HandleSetTitleOpcode(WorldPacket &recvData)
void HandleQueryInspectAchievements(WorldPacket &recvData)
void HandleSetTaxiBenchmarkOpcode(WorldPacket &recvData)
void SendAccountDataTimes(uint32 mask)
void HandleZoneUpdateOpcode(WorldPacket &recvPacket)
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)
void SetAccountData(AccountDataType type, time_t tm, std::string const &data)
void HandleInspectHonorStatsOpcode(WorldPacket &recvPacket)
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_WHO
Definition Opcodes.h:128
@ SMSG_WHOIS
Definition Opcodes.h:130
@ SMSG_UPDATE_ACCOUNT_DATA
Definition Opcodes.h:553
@ SMSG_CORPSE_NOT_IN_INSTANCE
Definition Opcodes.h:1315
@ SMSG_UPDATE_ACCOUNT_DATA_COMPLETE
Definition Opcodes.h:1152
@ SMSG_RAID_GROUP_ONLY
Definition Opcodes.h:675
@ SMSG_REALM_SPLIT
Definition Opcodes.h:936
@ SMSG_SET_PHASE_SHIFT
Definition Opcodes.h:1177
@ MSG_INSPECT_HONOR_STATS
Definition Opcodes.h:755
#define sWorld
Definition World.h:900
@ CONFIG_MAX_WHO
Definition World.h:326
@ CONFIG_GM_LEVEL_IN_WHO_LIST
Definition World.h:264
@ CONFIG_TALENTS_INSPECTING
Definition World.h:393
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)
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
@ 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:248