TrinityCore
Player.h
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#ifndef _PLAYER_H
19#define _PLAYER_H
20
21#include "GridObject.h"
22#include "Unit.h"
23#include "CUFProfile.h"
24#include "DatabaseEnvFwd.h"
25#include "DBCEnums.h"
26#include "EquipmentSet.h"
27#include "GroupReference.h"
28#include "Hash.h"
29#include "ItemDefines.h"
30#include "ItemEnchantmentMgr.h"
31#include "MapReference.h"
32#include "PetDefines.h"
33#include "PlayerTaxi.h"
34#include "QuestDef.h"
35#include "SceneMgr.h"
36
38struct AchievementEntry;
39struct AreaTableEntry;
40struct AreaTriggerEntry;
47struct CharTitlesEntry;
50struct CreatureTemplate;
52struct FactionEntry;
56struct ItemSetEffect;
57struct ItemTemplate;
58struct Loot;
59struct Mail;
60struct MapEntry;
61struct PvpTalentEntry;
63struct RewardPackEntry;
65struct SpellCastRequest;
66struct TalentEntry;
67struct TrainerSpell;
69struct VendorItem;
71
72class AELootResult;
73class Bag;
74class Battleground;
75class Channel;
76class CinematicMgr;
77class Creature;
78class DynamicObject;
79class Garrison;
80class Group;
81class Guild;
82class Item;
83class LootRoll;
84class LootStore;
85class OutdoorPvP;
86class Pet;
87class PetAura;
88class PlayerAI;
90class PlayerMenu;
91class PlayerSocial;
93class ReputationMgr;
94class RestMgr;
96class TradeData;
97
98enum class ChrSpecialization : uint32;
99enum GroupCategory : uint8;
100enum class InstanceResetMethod : uint8;
101enum class InstanceResetResult : uint8;
102enum InventoryType : uint8;
103enum ItemClass : uint8;
104enum LootError : uint8;
105enum LootType : uint8;
107enum class PlayerCreateMode : int8;
108enum RestTypes : uint8;
110
111namespace BattlePets
112{
113 struct BattlePet;
114}
115
116namespace WorldPackets
117{
118 namespace Character
119 {
120 struct CharacterCreateInfo;
121 struct CustomTabardInfo;
122 }
123
124 namespace Movement
125 {
127 }
128
129 namespace Traits
130 {
131 struct TraitConfig;
132 struct TraitEntry;
133 }
134}
135
136TC_GAME_API uint32 GetBagSize(Bag const* bag);
137TC_GAME_API Item* GetItemInBag(Bag const* bag, uint8 slot);
138
139typedef std::deque<Mail*> PlayerMails;
140
142{
143 PLAYER_MAX_SKILLS = UF::size<decltype(UF::SkillInfo::SkillLineID)>()
145
147{
148 PLAYER_EXPLORED_ZONES_BITS = UF::size_of_value_type<decltype(UF::ActivePlayerData::DataFlags)::value_type>() * 8,
149
153};
154
156{
157 SPELLMOD_FLAT = 0, // SPELL_AURA_ADD_FLAT_MODIFIER
158 SPELLMOD_PCT = 1, // SPELL_AURA_ADD_PCT_MODIFIER
159 SPELLMOD_LABEL_FLAT = 2, // SPELL_AURA_ADD_FLAT_MODIFIER_BY_SPELL_LABEL
160 SPELLMOD_LABEL_PCT = 3, // SPELL_AURA_ADD_PCT_MODIFIER_BY_SPELL_LABEL
163
164// 2^n values, Player::m_isunderwater is a bitmask. These are Trinity internal values, they are never send to any client
166{
168 UNDERWATER_INWATER = 0x01, // terrain type is water and player is afflicted by it
169 UNDERWATER_INLAVA = 0x02, // terrain type is lava and player is afflicted by it
170 UNDERWATER_INSLIME = 0x04, // terrain type is lava and player is afflicted by it
171 UNDERWATER_INDARKWATER = 0x08, // terrain type is dark water and player is afflicted by it
172
175
177{
183
185{
192
194{
196 bool active : 1; // show in spellbook
197 bool dependent : 1; // learned as result another spell learn, skill grow, quest reward, etc
198 bool disabled : 1; // first rank has been learned in result talent learn but currently talent unlearned, save max learned ranks
199 bool favorite : 1;
201};
202
204{
206
207 enum
208 {
213};
214
216{
222
223// Spell modifier (used for modify other spells)
225{
227 virtual ~SpellModifier() = default;
228
231
234};
235
237{
238 SpellModifierByClassMask(Aura* _ownerAura) : SpellModifier(_ownerAura), value(0), mask() { }
239
242};
243
244template<typename T>
246{
247 SpellModifierByLabel(Aura* _ownerAura) : SpellModifier(_ownerAura) { }
248
250};
251
254
256{
260 PLAYERCURRENCY_REMOVED = 3 //not removed just set count == 0
262
264{
272};
273
274typedef std::unordered_map<uint32, PlayerSpellState> PlayerTalentMap;
275typedef std::array<uint32, MAX_PVP_TALENT_SLOTS> PlayerPvpTalentMap;
276typedef std::unordered_map<uint32, PlayerSpell> PlayerSpellMap;
277typedef std::unordered_set<SpellModifier*> SpellModContainer;
278typedef std::unordered_map<uint32, PlayerCurrency> PlayerCurrenciesMap;
279
280typedef std::unordered_map<uint32 /*instanceId*/, time_t/*releaseTime*/> InstanceTimeMap;
281
283{
289
291{
293 ACTION_BUTTON_C = 0x01, // click?
300 ACTION_BUTTON_ITEM = 0x80
302
304{
313
314#define ACTION_BUTTON_ACTION(X) (uint64(X) & 0x00FFFFFFFFFFFFFF)
315#define ACTION_BUTTON_TYPE(X) ((uint64(X) & 0xFF00000000000000) >> 56)
316#define MAX_ACTION_BUTTON_ACTION_VALUE UI64LIT(0xFFFFFFFFFFFFFF)
317
319{
321
324
325 // helpers
329 {
330 uint64 newData = uint64(action) | (uint64(type) << 56);
331 if (newData != packedData || uState == ACTIONBUTTON_DELETED)
332 {
333 packedData = newData;
336 }
337 }
338};
339
340#define MAX_ACTION_BUTTONS 180
341
342typedef std::map<uint8, ActionButton> ActionButtonList;
343
345{
346 PvPInfo() : IsHostile(false), IsInHostileArea(false), IsInNoPvPArea(false), IsInFFAPvPArea(false), EndTimer(0) { }
347
352 time_t EndTimer;
353};
354
356{
363{
364 DuelInfo(Player* opponent, Player* initiator, bool isMounted) : Opponent(opponent), Initiator(initiator), IsMounted(isMounted) {}
365
368 bool const IsMounted;
370 time_t StartTime = 0;
371 time_t OutOfBoundsTime = 0;
372};
373
374struct Areas
375{
378 float x1;
379 float x2;
380 float y1;
381 float y2;
382};
383
384#define MAX_RUNES 7
385#define MAX_RECHARGING_RUNES 3
386
388{
390 RUNE_MISS_COOLDOWN = 1500 // cooldown applied on runes when the spell misses
392
393struct Runes
394{
395 std::deque<uint8> CooldownOrder;
397 uint8 RuneState; // mask of available runes
398
399 void SetRuneState(uint8 index, bool set = true);
400};
401
403{
405 EnchantDuration(Item* _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot),
406 leftduration(_leftduration){ ASSERT(item); }
407
411};
412
413typedef std::list<EnchantDuration> EnchantDurationList;
414typedef std::list<Item*> ItemDurationList;
415
417{
423
424#define MAX_DRUNKEN 4
425
427{
429 PLAYER_FLAGS_AFK = 0x00000002,
430 PLAYER_FLAGS_DND = 0x00000004,
431 PLAYER_FLAGS_GM = 0x00000008,
432 PLAYER_FLAGS_GHOST = 0x00000010,
435 PLAYER_FLAGS_UNK7 = 0x00000080, // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state
436 PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards
440 PLAYER_FLAGS_PLAYED_LONG_TIME = 0x00001000, // played long time
441 PLAYER_FLAGS_PLAYED_TOO_LONG = 0x00002000, // played too long time
443 PLAYER_FLAGS_DEVELOPER = 0x00008000, // <Dev> prefix for something?
444 PLAYER_FLAGS_LOW_LEVEL_RAID_ENABLED = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary
445 PLAYER_FLAGS_TAXI_BENCHMARK = 0x00020000, // taxi benchmark mode (on/off) (2.0.1)
446 PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually)
447 PLAYER_FLAGS_UBER = 0x00080000,
448 PLAYER_FLAGS_UNK20 = 0x00100000,
449 PLAYER_FLAGS_UNK21 = 0x00200000,
451 PLAYER_FLAGS_HIDE_ACCOUNT_ACHIEVEMENTS = 0x00800000, // do not send account achievments in inspect packets
452 PLAYER_FLAGS_PET_BATTLES_UNLOCKED = 0x01000000, // enables pet battles
454 PLAYER_FLAGS_UNK26 = 0x04000000,
455 PLAYER_FLAGS_AUTO_DECLINE_GUILD = 0x08000000, // Automatically declines guild invites
456 PLAYER_FLAGS_GUILD_LEVEL_ENABLED = 0x10000000, // Lua_GetGuildLevelEnabled() - enables guild leveling related UI
457 PLAYER_FLAGS_VOID_UNLOCKED = 0x20000000, // void storage
461
463
465{
469 PLAYER_FLAGS_EX_IN_PVP_COMBAT = 0x0040, // Forbids /follow
474
476
478{
479 PLAYER_LOCAL_FLAG_CONTROLLING_PET = 0x00000001, // Displays "You have an active summon already" when trying to tame new pet
481 PLAYER_LOCAL_FLAG_RELEASE_TIMER = 0x00000008, // Display time till auto release spirit
482 PLAYER_LOCAL_FLAG_NO_RELEASE_WINDOW = 0x00000010, // Display no "release spirit" window at all
483 PLAYER_LOCAL_FLAG_NO_PET_BAR = 0x00000020, // CGPetInfo::IsPetBarUsed
490 PLAYER_LOCAL_FLAG_ACCOUNT_SECURED = 0x00001000, // Script_IsAccountSecured
494};
495
497
498// used in PLAYER_FIELD_BYTES2 values
500{
505
507{
510 FIRE_TIMER = 2 // feign death
512#define MAX_TIMERS 3
513#define DISABLED_MIRROR_TIMER -1
514
515// 2^n values
517{
518 // gm abilities
523 PLAYER_EXTRA_GM_CHAT = 0x0020, // Show GM badge in chat messages
524
525 // other states
526 PLAYER_EXTRA_PVP_DEATH = 0x0100, // store PvP death status until corpse creating.
527
528 // Character services markers
532};
533
534// 2^n values
536{
547};
548
549typedef std::map<uint32, QuestStatusData> QuestStatusMap;
550
552{
553 QuestStatusMap::iterator QuestStatusItr;
555};
556
557using QuestObjectiveStatusMap = std::unordered_multimap<std::pair<QuestObjectiveType, int32>, QuestObjectiveStatusData>;
558
559typedef std::set<uint32> RewardedQuestSet;
560
562{
567
568// quest
569typedef std::map<uint32, QuestSaveType> QuestStatusSaveMap;
570
571// Size of client completed quests bit map
573{
574 QUESTS_COMPLETED_BITS_SIZE = UF::size<decltype(UF::ActivePlayerData::QuestCompleted)>(),
575 QUESTS_COMPLETED_BITS_PER_BLOCK = UF::size_of_value_type<decltype(UF::ActivePlayerData::QuestCompleted)>() * 8
577
579{
580 MAX_QUEST_COUNTS = UF::size<decltype(UF::QuestLog::ObjectiveProgress)>()
582
584{
587 QUEST_STATE_FAIL = 0x0002
589
591{
595 SKILL_DELETED = 3
597
599{
600 SkillStatusData(uint8 _pos, SkillUpdateState _uState) : pos(_pos), uState(_uState)
601 {
602 }
605};
606
607typedef std::unordered_map<uint32, SkillStatusData> SkillStatusMap;
608
609class Quest;
610class Spell;
611class Item;
612class WorldSession;
613
615{
616 // first slot for item stored (in any way in player m_items data)
618 // last+1 slot for item stored (in any way in player m_items data)
622
623static_assert(UF::size<decltype(UF::ActivePlayerData::InvSlots)>() == PLAYER_SLOT_END);
624
625#define INVENTORY_SLOT_BAG_0 255
626#define INVENTORY_DEFAULT_SIZE 16
627
628enum EquipmentSlots : uint8 // 19 slots
629{
652
654{
666
669
672
673enum InventorySlots : uint8 // 4 slots
674{
678
679enum ReagentBagSlots : uint8 // 1 slot
680{
684
685enum InventoryPackSlots : uint8 // 28 slots
686{
690
691enum BankItemSlots // 28 slots
692{
696
697enum BankBagSlots // 7 slots
698{
702
703enum BuyBackSlots // 12 slots
704{
705 // stored in m_buybackitems
707 BUYBACK_SLOT_END = 110
709
710enum ReagentSlots // 98 slots
711{
714};
715
717{
720};
721
722// slots past 214 are guessed (unused in client)
724{
741};
742
744{
745 ItemPosCount(uint16 _pos, uint32 _count) : pos(_pos), count(_count) { }
746 bool isContainedIn(std::vector<ItemPosCount> const& vec) const;
749};
750typedef std::vector<ItemPosCount> ItemPosCountVec;
751
753{
754 Equipment = 0x01,
755 Inventory = 0x02,
756 Bank = 0x04,
757 ReagentBank = 0x08,
758
761};
762
764
766{
767 Stop,
769};
770
772{
773 NEW_WORLD_NORMAL = 16, // Normal map change
774 NEW_WORLD_SEAMLESS = 21, // Teleport to another map without a loading screen, used for outdoor scenarios
775};
776
778{
779 RAID_INSTANCE_WARNING_HOURS = 1, // WARNING! %s is scheduled to reset in %d hour(s).
780 RAID_INSTANCE_WARNING_MIN = 2, // WARNING! %s is scheduled to reset in %d minute(s)!
781 RAID_INSTANCE_WARNING_MIN_SOON = 3, // WARNING! %s is scheduled to reset in %d minute(s). Please exit the zone or you will be returned to your bind location!
782 RAID_INSTANCE_WELCOME = 4, // Welcome to %s. This raid instance is scheduled to reset in %s.
785
786// PLAYER_FIELD_ARENA_TEAM_INFO_1_1 offsets
788{
790 ARENA_TEAM_TYPE = 1, // new in 3.2 - team type?
791 ARENA_TEAM_MEMBER = 2, // 0 - captain, 1 - member
798
800{
807 TELE_TO_TRANSPORT_TELEPORT = 0x20, // 3.3.5 only
809 TELE_TO_SEAMLESS = 0x80
811
813
816{
823 DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss
825
827{
831
832#define MAX_PLAYED_TIME_INDEX 2
833
834// used at player loading query list preparing, and later result selection
836{
902
904{
913
914// Player summoning auto-decline time (in secs)
915#define MAX_PLAYER_SUMMON_DELAY (2*MINUTE)
916// Maximum money amount : 2^31 - 1
918
920{
921 CHAR_DELETE_REMOVE = 0, // Completely remove from the database
922 CHAR_DELETE_UNLINK = 1 // The character gets unlinked from the account,
923 // the name gets freed up and appears as deleted ingame
925
927{
945
947{
949 CHEAT_GOD = 0x01,
953 CHEAT_WATERWALK = 0x10
955
957{
961
963{
964 NewItem = 0,
965 NewCurrency = 1,
966 Money = 2,
967 Honor = 3
968};
969
971{
972 DoNotDisplay = 0,
973 Loot = 1,
974 PetBattle = 2,
975 PersonalLoot = 3,
977 QuestUpgrade = 5,
979 Shipment = 7,
982 GarrisonCurrency = 10,
983 LessAwesomeLoot = 11,
984 UpgradedLoot = 12,
985 LegendaryLoot = 13,
986 InvasionLoot = 14,
987 Default = 15,
988 QuestComplete = 16,
989 RatedPvPReward = 17,
990 CorruptedLoot = 19
991};
992
993class Player;
994
996struct BGData
997{
1000
1004
1008
1010
1013
1016
1017 void ClearTaxiPath() { taxiPath[0] = taxiPath[1] = 0; }
1018 bool HasTaxiPath() const { return taxiPath[0] && taxiPath[1]; }
1019};
1020
1022{
1024 VoidStorageItem(uint64 id, uint32 entry, ObjectGuid const& creator, ItemRandomBonusListId randomBonusListId,
1025 uint32 fixedScalingLevel, uint32 artifactKnowledgeLevel, ItemContext context, std::vector<int32> const& bonuses)
1026 : ItemId(id), ItemEntry(entry), CreatorGuid(creator), RandomBonusListId(randomBonusListId),
1027 FixedScalingLevel(fixedScalingLevel), ArtifactKnowledgeLevel(artifactKnowledgeLevel), Context(context)
1028 {
1029 BonusListIDs.insert(BonusListIDs.end(), bonuses.begin(), bonuses.end());
1030 }
1031 VoidStorageItem(VoidStorageItem&& vsi) noexcept : ItemId(vsi.ItemId), ItemEntry(vsi.ItemEntry), CreatorGuid(vsi.CreatorGuid), RandomBonusListId(vsi.RandomBonusListId),
1032 FixedScalingLevel(vsi.FixedScalingLevel), ArtifactKnowledgeLevel(vsi.ArtifactKnowledgeLevel), Context(vsi.Context), BonusListIDs(std::move(vsi.BonusListIDs)) { }
1033
1041 std::vector<int32> BonusListIDs;
1042};
1043
1045{
1051};
1052
1054{
1057};
1058
1060{
1073
1075{
1076 SpecializationInfo() : PvpTalents(), ResetTalentsCost(0), ResetTalentsTime(0), ActiveGroup(0)
1077 {
1078 for (PlayerPvpTalentMap& pvpTalents : PvpTalents)
1079 pvpTalents.fill(0);
1080 }
1081
1084 std::vector<uint32> Glyphs[MAX_SPECIALIZATIONS];
1088
1089private:
1092};
1093
1097float constexpr MAX_AREA_SPIRIT_HEALER_RANGE = 20.0f;
1098
1100{
1101 None = 0,
1102 Friendly = 1,
1103 Hostile = 2,
1104 Contested = 3,
1105 Combat = 4
1106};
1107
1108class TC_GAME_API Player final : public Unit, public GridObject<Player>
1109{
1110 friend class WorldSession;
1111 friend class CinematicMgr;
1112 friend class RestMgr;
1113 friend void AddItemToUpdateQueueOf(Item* item, Player* player);
1114 friend void RemoveItemFromUpdateQueueOf(Item* item, Player* player);
1115 public:
1116 explicit Player(WorldSession* session);
1117 ~Player();
1118
1119 PlayerAI* AI() const { return reinterpret_cast<PlayerAI*>(GetAI()); }
1120
1121 void CleanupsBeforeDelete(bool finalCleanup = true) override;
1122
1123 void AddToWorld() override;
1124 void RemoveFromWorld() override;
1125
1126 void SetObjectScale(float scale) override;
1127
1128 bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options = TELE_TO_NONE, Optional<uint32> instanceId = {});
1129 bool TeleportTo(WorldLocation const& loc, TeleportToOptions options = TELE_TO_NONE, Optional<uint32> instanceId = {});
1130 bool TeleportToBGEntryPoint();
1131
1132 bool HasSummonPending() const;
1133 void SendSummonRequestFrom(Unit* summoner);
1134 void SummonIfPossible(bool agree);
1135
1137
1138 void Update(uint32 time) override;
1139
1140 bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, SpellEffectInfo const& spellEffectInfo, WorldObject const* caster, bool requireImmunityPurgesEffectAttribute = false) const override;
1141
1142 bool IsInAreaTriggerRadius(AreaTriggerEntry const* trigger) const;
1143
1144 void SendInitialPacketsBeforeAddToMap();
1145 void SendInitialPacketsAfterAddToMap();
1146 void SendSupercededSpell(uint32 oldSpell, uint32 newSpell) const;
1147 void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg = 0, int32 mapDifficultyXConditionID = 0) const;
1148
1149 bool CanInteractWithQuestGiver(Object* questGiver) const;
1150 Creature* GetNPCIfCanInteractWith(ObjectGuid const& guid, NPCFlags npcFlags, NPCFlags2 npcFlags2) const;
1151 GameObject* GetGameObjectIfCanInteractWith(ObjectGuid const& guid) const;
1152 GameObject* GetGameObjectIfCanInteractWith(ObjectGuid const& guid, GameobjectTypes type) const;
1153
1154 void ToggleAFK();
1155 void ToggleDND();
1156 bool isAFK() const { return HasPlayerFlag(PLAYER_FLAGS_AFK); }
1157 bool isDND() const { return HasPlayerFlag(PLAYER_FLAGS_DND); }
1158 uint16 GetChatFlags() const;
1159 std::string autoReplyMsg;
1160
1161 int64 GetBarberShopCost(Trinity::IteratorPair<UF::ChrCustomizationChoice const*> newCustomizations) const;
1162
1163 PlayerSocial* GetSocial() const { return m_social; }
1164 void RemoveSocial();
1165
1167 void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(GetRace(), GetClass(), GetLevel()); }
1168 bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc = nullptr, uint32 spellid = 0, uint32 preferredMountDisplay = 0);
1169 bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 0);
1170 void FinishTaxiFlight();
1171 void CleanupAfterTaxiFlight();
1172 void ContinueTaxiFlight() const;
1173
1174 bool IsDeveloper() const { return HasPlayerFlag(PLAYER_FLAGS_DEVELOPER); }
1175 void SetDeveloper(bool on) { if (on) SetPlayerFlag(PLAYER_FLAGS_DEVELOPER); else RemovePlayerFlag(PLAYER_FLAGS_DEVELOPER); }
1176 bool isAcceptWhispers() const { return (m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS) != 0; }
1177 void SetAcceptWhispers(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; }
1178 bool IsGameMaster() const { return (m_ExtraFlags & PLAYER_EXTRA_GM_ON) != 0; }
1179 bool IsGameMasterAcceptingWhispers() const { return IsGameMaster() && isAcceptWhispers(); }
1180 bool CanBeGameMaster() const;
1181 void SetGameMaster(bool on);
1182 bool isGMChat() const { return (m_ExtraFlags & PLAYER_EXTRA_GM_CHAT) != 0; }
1183 void SetGMChat(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_CHAT; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_CHAT; }
1184 bool isTaxiCheater() const { return (m_ExtraFlags & PLAYER_EXTRA_TAXICHEAT) != 0; }
1185 void SetTaxiCheater(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_TAXICHEAT; else m_ExtraFlags &= ~PLAYER_EXTRA_TAXICHEAT; }
1186 bool isGMVisible() const { return !(m_ExtraFlags & PLAYER_EXTRA_GM_INVISIBLE); }
1187 void SetGMVisible(bool on);
1188 void SetPvPDeath(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
1189 bool HasRaceChanged() const { return (m_ExtraFlags & PLAYER_EXTRA_HAS_RACE_CHANGED) != 0; }
1191 bool HasBeenGrantedLevelsFromRaF() const { return (m_ExtraFlags & PLAYER_EXTRA_GRANTED_LEVELS_FROM_RAF) != 0; }
1193 bool HasLevelBoosted() const { return (m_ExtraFlags & PLAYER_EXTRA_LEVEL_BOOSTED) != 0; }
1195
1196 uint32 GetXP() const { return m_activePlayerData->XP; }
1197 uint32 GetXPForNextLevel() const { return m_activePlayerData->NextLevelXP; }
1198 void SetXP(uint32 xp);
1199 void GiveXP(uint32 xp, Unit* victim, float group_rate=1.0f);
1200 void GiveLevel(uint8 level);
1201 bool IsMaxLevel() const;
1202
1203 void InitStatsForLevel(bool reapplyMods = false);
1204
1205 // .cheat command related
1206 bool GetCommandStatus(uint32 command) const { return (_activeCheats & command) != 0; }
1207 void SetCommandStatusOn(uint32 command) { _activeCheats |= command; }
1208 void SetCommandStatusOff(uint32 command) { _activeCheats &= ~command; }
1209
1210 // Played Time Stuff
1213 std::array<uint32, MAX_PLAYED_TIME_INDEX> m_Played_time;
1214 uint32 GetTotalPlayedTime() const { return m_Played_time[PLAYED_TIME_TOTAL]; }
1215 uint32 GetLevelPlayedTime() const { return m_Played_time[PLAYED_TIME_LEVEL]; }
1216
1217 Gender GetNativeGender() const override { return Gender(*m_playerData->NativeSex); }
1218 void SetNativeGender(Gender gender) override { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::NativeSex), gender); }
1219
1220 void setDeathState(DeathState s) override; // overwrite Unit::setDeathState
1221
1222 PetStable* GetPetStable() { return m_petStable.get(); }
1223 PetStable& GetOrInitPetStable();
1224 PetStable const* GetPetStable() const { return m_petStable.get(); }
1225 void AddPetToUpdateFields(PetStable::PetInfo const& pet, PetSaveMode slot, PetStableFlags flags);
1226 void SetPetSlot(uint32 petNumber, PetSaveMode dstPetSlot);
1227 ObjectGuid GetStableMaster() const;
1228 void SetStableMaster(ObjectGuid stableMaster);
1229
1230 Pet* GetPet() const;
1231 Pet* SummonPet(uint32 entry, Optional<PetSaveMode> slot, float x, float y, float z, float ang, uint32 despwtime, bool* isNew = nullptr);
1232 void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false);
1233 void SendTameFailure(PetTameResult result);
1234
1235 // pet auras
1236 std::unordered_set<PetAura const*> m_petAuras;
1237 void AddPetAura(PetAura const* petSpell);
1238 void RemovePetAura(PetAura const* petSpell);
1239
1240 Creature* GetSummonedBattlePet() const;
1241 void SetBattlePetData(BattlePets::BattlePet const* pet = nullptr);
1242
1244 void Say(std::string_view text, Language language, WorldObject const* = nullptr) override;
1245 void Say(uint32 textId, WorldObject const* target = nullptr) override;
1247 void Yell(std::string_view text, Language language, WorldObject const* = nullptr) override;
1248 void Yell(uint32 textId, WorldObject const* target = nullptr) override;
1250 void TextEmote(std::string_view text, WorldObject const* = nullptr, bool = false) override;
1251 void TextEmote(uint32 textId, WorldObject const* target = nullptr, bool isBossEmote = false) override;
1253 void Whisper(std::string_view text, Language language, Player* receiver, bool = false) override;
1254 void Whisper(uint32 textId, Player* target, bool isBossWhisper = false) override;
1255 void WhisperAddon(std::string const& text, std::string const& prefix, bool isLogged, Player* receiver);
1256
1257 bool CanUnderstandLanguage(Language language) const;
1258
1259 /*********************************************************/
1260 /*** STORAGE SYSTEM ***/
1261 /*********************************************************/
1262
1269 template <typename T>
1270 bool ForEachItem(ItemSearchLocation location, T callback) const
1271 {
1272 EnumFlag<ItemSearchLocation> flag = location;
1273
1275 {
1277 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
1278 if (callback(pItem) == ItemSearchCallbackResult::Stop)
1279 return false;
1280
1282 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
1283 if (callback(pItem) == ItemSearchCallbackResult::Stop)
1284 return false;
1285 }
1286
1288 {
1289 uint8 inventoryEnd = INVENTORY_SLOT_ITEM_START + GetInventorySlotCount();
1290 for (uint8 i = INVENTORY_SLOT_BAG_START; i < inventoryEnd; ++i)
1291 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
1292 if (callback(pItem) == ItemSearchCallbackResult::Stop)
1293 return false;
1294
1296 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
1297 if (callback(pItem) == ItemSearchCallbackResult::Stop)
1298 return false;
1299
1301 if (Bag* pBag = GetBagByPos(i))
1302 for (uint32 j = 0; j < GetBagSize(pBag); ++j)
1303 if (Item* pItem = GetItemInBag(pBag, j))
1304 if (callback(pItem) == ItemSearchCallbackResult::Stop)
1305 return false;
1306 }
1307
1309 {
1310 for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i)
1311 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
1312 if (callback(pItem) == ItemSearchCallbackResult::Stop)
1313 return false;
1314
1315 for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
1316 if (Bag* pBag = GetBagByPos(i))
1317 for (uint32 j = 0; j < GetBagSize(pBag); ++j)
1318 if (Item* pItem = GetItemInBag(pBag, j))
1319 if (callback(pItem) == ItemSearchCallbackResult::Stop)
1320 return false;
1321 }
1322
1324 {
1326 if (Bag* bag = GetBagByPos(i))
1327 for (uint32 j = 0; j < GetBagSize(bag); ++j)
1328 if (Item* pItem = GetItemInBag(bag, j))
1329 if (callback(pItem) == ItemSearchCallbackResult::Stop)
1330 return false;
1331
1332 for (uint8 i = REAGENT_SLOT_START; i < REAGENT_SLOT_END; ++i)
1333 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
1334 if (callback(pItem) == ItemSearchCallbackResult::Stop)
1335 return false;
1336 }
1337
1338 return true;
1339 }
1340
1341 public:
1342 void UpdateAverageItemLevelTotal();
1343 void UpdateAverageItemLevelEquipped();
1344
1345 uint8 FindEquipSlot(Item const* item, uint32 slot, bool swap) const;
1346 uint32 GetFreeInventorySlotCount(EnumFlag<ItemSearchLocation> location = ItemSearchLocation::Inventory) const;
1347 uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = nullptr) const;
1348 uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = nullptr) const;
1349 Item* GetItemByGuid(ObjectGuid guid) const;
1350 Item* GetItemByEntry(uint32 entry, ItemSearchLocation where = ItemSearchLocation::Default) const;
1351 std::vector<Item*> GetItemListByEntry(uint32 entry, bool inBankAlso = false) const;
1352 Item* GetItemByPos(uint16 pos) const;
1353 Item* GetItemByPos(uint8 bag, uint8 slot) const;
1354 Item* GetUseableItemByPos(uint8 bag, uint8 slot) const;
1355 Bag* GetBagByPos(uint8 slot) const;
1356 std::vector<Item*> GetCraftingReagentItemsToDeposit();
1357 uint32 GetFreeInventorySpace() const;
1358 Item* GetWeaponForAttack(WeaponAttackType attackType, bool useable = false) const;
1359 Item* GetShield(bool useable = false) const;
1360 Item* GetChildItemByGuid(ObjectGuid guid) const;
1361 static WeaponAttackType GetAttackBySlot(uint8 slot, InventoryType inventoryType); // MAX_ATTACK if not weapon slot
1362 std::vector<Item*>& GetItemUpdateQueue() { return m_itemUpdateQueue; }
1363 static bool IsInventoryPos(uint16 pos) { return IsInventoryPos(pos >> 8, pos & 255); }
1364 static bool IsInventoryPos(uint8 bag, uint8 slot);
1365 static bool IsEquipmentPos(uint16 pos) { return IsEquipmentPos(pos >> 8, pos & 255); }
1366 static bool IsEquipmentPos(uint8 bag, uint8 slot);
1367 static bool IsBagPos(uint16 pos);
1368 static bool IsBankPos(uint16 pos) { return IsBankPos(pos >> 8, pos & 255); }
1369 static bool IsBankPos(uint8 bag, uint8 slot);
1370 static bool IsReagentBankPos(uint16 pos) { return IsReagentBankPos(pos >> 8, pos & 255); }
1371 static bool IsReagentBankPos(uint8 bag, uint8 slot);
1372 static bool IsChildEquipmentPos(uint16 pos) { return IsChildEquipmentPos(pos >> 8, pos & 255); }
1373 static bool IsChildEquipmentPos(uint8 bag, uint8 slot);
1374 bool IsValidPos(uint16 pos, bool explicit_pos) const { return IsValidPos(pos >> 8, pos & 255, explicit_pos); }
1375 bool IsValidPos(uint8 bag, uint8 slot, bool explicit_pos) const;
1376 uint8 GetInventorySlotCount() const { return m_activePlayerData->NumBackpackSlots; }
1377 void SetInventorySlotCount(uint8 slots);
1378 uint8 GetBankBagSlotCount() const { return m_activePlayerData->NumBankSlots; }
1380 bool HasItemCount(uint32 item, uint32 count = 1, bool inBankAlso = false) const;
1381 bool HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem = nullptr) const;
1382 bool CanNoReagentCast(SpellInfo const* spellInfo) const;
1384 {
1385 for (uint8 i = 0; i < 4; ++i)
1386 SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::NoReagentCostMask, i), mask[i]);
1387 }
1388 bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const;
1389 bool HasItemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const;
1390 bool HasGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const;
1391 InventoryResult CanTakeMoreSimilarItems(Item* pItem, uint32* offendingItemId = nullptr) const;
1392 InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, uint32* offendingItemId = nullptr) const { return CanTakeMoreSimilarItems(entry, count, nullptr, nullptr, offendingItemId); }
1393 InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = nullptr) const;
1394 InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap = false) const;
1395 InventoryResult CanStoreItems(Item** items, int count, uint32* offendingItemId) const;
1396 InventoryResult CanEquipNewItem(uint8 slot, uint16& dest, uint32 item, bool swap) const;
1397 InventoryResult CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool swap, bool not_loading = true) const;
1398
1399 // This method must be called before equipping parent item!
1400 InventoryResult CanEquipChildItem(Item* parentItem) const;
1401
1402 InventoryResult CanEquipUniqueItem(Item* pItem, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
1403 InventoryResult CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
1404 InventoryResult CanUnequipItems(uint32 item, uint32 count) const;
1405 InventoryResult CanUnequipItem(uint16 src, bool swap) const;
1406 InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap, bool not_loading = true, bool reagentBankOnly = false) const;
1407 InventoryResult CanUseItem(Item* pItem, bool not_loading = true) const;
1408 bool HasItemTotemCategory(uint32 TotemCategory) const;
1409 InventoryResult CanUseItem(ItemTemplate const* pItem, bool skipRequiredLevelCheck = false) const;
1410 InventoryResult CanRollNeedForItem(ItemTemplate const* item, Map const* map, bool restrictOnlyLfg) const;
1411 Item* StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool update, ItemRandomBonusListId randomBonusListId = 0, GuidSet const& allowedLooters = GuidSet(),
1412 ItemContext context = ItemContext::NONE, std::vector<int32> const* bonusListIDs = nullptr, bool addToCollection = true);
1413 Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update);
1414 Item* EquipNewItem(uint16 pos, uint32 item, ItemContext context, bool update);
1415 Item* EquipItem(uint16 pos, Item* pItem, bool update);
1416 void AutoUnequipOffhandIfNeed(bool force = false);
1417 void EquipChildItem(uint8 parentBag, uint8 parentSlot, Item* parentItem);
1418 void AutoUnequipChildItem(Item* parentItem);
1419 bool StoreNewItemInBestSlots(uint32 itemId, uint32 amount, ItemContext context);
1420 void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, ItemContext context = ItemContext::NONE, bool broadcast = false, bool createdByPlayer = false);
1421 void AutoStoreLoot(uint32 loot_id, LootStore const& store, ItemContext context = ItemContext::NONE, bool broadcast = false, bool createdByPlayer = false) { AutoStoreLoot(NULL_BAG, NULL_SLOT, loot_id, store, context, broadcast, createdByPlayer); }
1422 void StoreLootItem(ObjectGuid lootWorldObjectGuid, uint8 lootSlot, Loot* loot, AELootResult* aeResult = nullptr);
1423
1424 InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = nullptr, uint32* offendingItemId = nullptr) const;
1425 InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = nullptr, bool swap = false, uint32* no_space_count = nullptr) const;
1426
1427 void AddRefundReference(ObjectGuid it);
1428 void DeleteRefundReference(ObjectGuid it);
1429
1431 void SendCurrencies() const;
1433 void SendPvpRewards() const;
1435 void SetCreateCurrency(uint32 id, uint32 amount);
1437 void ModifyCurrency(uint32 id, int32 amount, CurrencyGainSource gainSource = CurrencyGainSource::Cheat, CurrencyDestroyReason destroyReason = CurrencyDestroyReason::Cheat);
1438 void AddCurrency(uint32 id, uint32 amount, CurrencyGainSource gainSource = CurrencyGainSource::Cheat);
1439 void RemoveCurrency(uint32 id, int32 amount, CurrencyDestroyReason destroyReason = CurrencyDestroyReason::Cheat);
1441 void IncreaseCurrencyCap(uint32 id, uint32 amount);
1443 void ResetCurrencyWeekCap();
1444
1445 uint32 GetCurrencyQuantity(uint32 id) const;
1446 uint32 GetCurrencyWeeklyQuantity(uint32 id) const;
1447 uint32 GetCurrencyTrackedQuantity(uint32 id) const;
1448 uint32 GetCurrencyIncreasedCapQuantity(uint32 id) const;
1449 uint32 GetCurrencyMaxQuantity(CurrencyTypesEntry const* currency, bool onLoad = false, bool onUpdateVersion = false) const;
1450 uint32 GetCurrencyWeeklyCap(uint32 id) const;
1451 uint32 GetCurrencyWeeklyCap(CurrencyTypesEntry const* currency) const;
1452 bool HasCurrency(uint32 id, uint32 amount) const;
1453
1454 void SetInvSlot(uint32 slot, ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::InvSlots, slot), guid); }
1455
1456 void ApplyEquipCooldown(Item* pItem);
1457 void QuickEquipItem(uint16 pos, Item* pItem);
1458 void VisualizeItem(uint8 slot, Item* pItem);
1459 void SetVisibleItemSlot(uint8 slot, Item* pItem);
1460 Item* BankItem(ItemPosCountVec const& dest, Item* pItem, bool update);
1461 void RemoveItem(uint8 bag, uint8 slot, bool update);
1462 void MoveItemFromInventory(uint8 bag, uint8 slot, bool update);
1463 // in trade, auction, guild bank, mail....
1464 void MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool update, bool in_characterInventoryDB = false);
1465 // in trade, guild bank, mail....
1466 void RemoveItemDependentAurasAndCasts(Item* pItem);
1467 void DestroyItem(uint8 bag, uint8 slot, bool update);
1468 uint32 DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check = false);
1469 void DestroyItemCount(Item* item, uint32& count, bool update);
1470 void DestroyConjuredItems(bool update);
1471 void DestroyZoneLimitedItem(bool update, uint32 new_zone);
1472 void SplitItem(uint16 src, uint16 dst, uint32 count);
1473 void SwapItem(uint16 src, uint16 dst);
1474 void AddItemToBuyBackSlot(Item* pItem);
1475 void SetBuybackPrice(uint32 slot, uint32 price) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::BuybackPrice, slot), price); }
1476 void SetBuybackTimestamp(uint32 slot, time_t timestamp) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::BuybackTimestamp, slot), timestamp); }
1477 Item* GetItemFromBuyBackSlot(uint32 slot);
1478 void RemoveItemFromBuyBackSlot(uint32 slot, bool del);
1479 void SendEquipError(InventoryResult msg, Item const* item1 = nullptr, Item const* item2 = nullptr, uint32 itemId = 0) const;
1480 void SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param) const;
1481 void SendSellError(SellResult msg, Creature* creature, ObjectGuid guid) const;
1482 void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; }
1483 void AddArmorProficiency(uint32 newflag) { m_ArmorProficiency |= newflag; }
1484 uint32 GetWeaponProficiency() const { return m_WeaponProficiency; }
1485 uint32 GetArmorProficiency() const { return m_ArmorProficiency; }
1486 bool IsUseEquipedWeapon(bool mainhand) const;
1487 bool IsTwoHandUsed() const;
1488 bool IsUsingTwoHandedWeaponInOneHand() const;
1489 void SendNewItem(Item* item, uint32 quantity, bool received, bool created, bool broadcast = false, uint32 dungeonEncounterId = 0);
1490 bool BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
1491 bool BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorSlot, uint32 currency, uint32 count);
1492 bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int64 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
1493
1494 float GetReputationPriceDiscount(Creature const* creature) const;
1495 float GetReputationPriceDiscount(FactionTemplateEntry const* factionTemplate) const;
1496
1497 Player* GetTrader() const;
1498 TradeData* GetTradeData() const { return m_trade; }
1499 void TradeCancel(bool sendback);
1500
1501 CinematicMgr* GetCinematicMgr() const { return _cinematicMgr.get(); }
1502
1503 void UpdateEnchantTime(uint32 time);
1504 void UpdateSoulboundTradeItems();
1505 void AddTradeableItem(Item* item);
1506 void RemoveTradeableItem(Item* item);
1507 void UpdateItemDuration(uint32 time, bool realtimeonly = false);
1508 void AddEnchantmentDurations(Item* item);
1509 void RemoveEnchantmentDurations(Item* item);
1510 void RemoveEnchantmentDurationsReferences(Item* item);
1511 void RemoveArenaEnchantments(EnchantmentSlot slot);
1512 void AddEnchantmentDuration(Item* item, EnchantmentSlot slot, uint32 duration);
1513 void ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool apply_dur = true, bool ignore_condition = false);
1514 void ApplyEnchantment(Item* item, bool apply);
1515 void UpdateSkillEnchantments(uint16 skill_id, uint16 curr_value, uint16 new_value);
1516 void SendEnchantmentDurations();
1517 void AddItemDurations(Item* item);
1518 void RemoveItemDurations(Item* item);
1519 void SendItemDurations();
1520 void LoadCorpse(PreparedQueryResult result);
1521
1522 bool AddItem(uint32 itemId, uint32 count);
1523
1524 /*********************************************************/
1525 /*** GOSSIP SYSTEM ***/
1526 /*********************************************************/
1527
1528 void PrepareGossipMenu(WorldObject* source, uint32 menuId, bool showQuests = false);
1529 void SendPreparedGossip(WorldObject* source);
1530 void OnGossipSelect(WorldObject* source, int32 gossipOptionId, uint32 menuId);
1531
1532 uint32 GetGossipTextId(uint32 menuId, WorldObject* source);
1533 uint32 GetGossipTextId(WorldObject* source);
1534 uint32 GetGossipMenuForSource(WorldObject const* source) const;
1535
1536 /*********************************************************/
1537 /*** QUEST SYSTEM ***/
1538 /*********************************************************/
1539
1540 int32 GetQuestMinLevel(Quest const* quest) const;
1541 int32 GetQuestMinLevel(uint32 contentTuningId) const;
1542 int32 GetQuestLevel(Quest const* quest) const;
1543 int32 GetQuestLevel(uint32 contentTuningId) const;
1544 void PrepareQuestMenu(ObjectGuid guid);
1545 void SendPreparedQuest(WorldObject* source);
1546 bool IsActiveQuest(uint32 quest_id) const;
1547 Quest const* GetNextQuest(Object const* questGiver, Quest const* quest) const;
1548 bool CanSeeStartQuest(Quest const* quest) const;
1549 bool CanTakeQuest(Quest const* quest, bool msg) const;
1550 bool CanAddQuest(Quest const* quest, bool msg) const;
1551 bool CanCompleteQuest(uint32 quest_id, uint32 ignoredQuestObjectiveId = 0);
1552 bool CanCompleteRepeatableQuest(Quest const* quest);
1553 bool CanRewardQuest(Quest const* quest, bool msg) const;
1554 bool CanRewardQuest(Quest const* quest, LootItemType rewardType, uint32 rewardId, bool msg) const;
1555 void AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver);
1556 void AddQuest(Quest const* quest, Object* questGiver);
1557 void AbandonQuest(uint32 quest_id);
1558 void CompleteQuest(uint32 quest_id);
1559 void IncompleteQuest(uint32 quest_id);
1560 uint32 GetQuestMoneyReward(Quest const* quest) const;
1561 uint32 GetQuestXPReward(Quest const* quest);
1562 bool CanSelectQuestPackageItem(QuestPackageItemEntry const* questPackageItem) const;
1563 void RewardQuestPackage(uint32 questPackageId, ItemContext context, uint32 onlyItemId = 0);
1564 void RewardQuest(Quest const* quest, LootItemType rewardType, uint32 rewardId, Object* questGiver, bool announce = true);
1565 void SetRewardedQuest(uint32 quest_id);
1566 void FailQuest(uint32 quest_id);
1567 void FailQuestsWithFlag(QuestFlags flag);
1568 bool SatisfyQuestSkill(Quest const* qInfo, bool msg) const;
1569 bool SatisfyQuestLevel(Quest const* qInfo, bool msg) const;
1570 bool SatisfyQuestMinLevel(Quest const* qInfo, bool msg) const;
1571 bool SatisfyQuestMaxLevel(Quest const* qInfo, bool msg) const;
1572 bool SatisfyQuestLog(bool msg) const;
1573 bool SatisfyQuestDependentQuests(Quest const* qInfo, bool msg) const;
1574 bool SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) const;
1575 bool SatisfyQuestDependentPreviousQuests(Quest const* qInfo, bool msg) const;
1576 bool SatisfyQuestBreadcrumbQuest(Quest const* qInfo, bool msg) const;
1577 bool SatisfyQuestDependentBreadcrumbQuests(Quest const* qInfo, bool msg) const;
1578 bool SatisfyQuestClass(Quest const* qInfo, bool msg) const;
1579 bool SatisfyQuestRace(Quest const* qInfo, bool msg) const;
1580 bool SatisfyQuestReputation(Quest const* qInfo, bool msg) const;
1581 bool SatisfyQuestStatus(Quest const* qInfo, bool msg) const;
1582 bool SatisfyQuestConditions(Quest const* qInfo, bool msg) const;
1583 bool SatisfyQuestTimed(Quest const* qInfo, bool msg) const;
1584 bool SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg) const;
1585 bool SatisfyQuestDay(Quest const* qInfo, bool msg) const;
1586 bool SatisfyQuestWeek(Quest const* qInfo, bool msg) const;
1587 bool SatisfyQuestMonth(Quest const* qInfo, bool msg) const;
1588 bool SatisfyQuestSeasonal(Quest const* qInfo, bool msg) const;
1589 bool SatisfyQuestExpansion(Quest const* qInfo, bool msg) const;
1590 bool GiveQuestSourceItem(Quest const* quest);
1591 bool TakeQuestSourceItem(uint32 questId, bool msg);
1592 bool GetQuestRewardStatus(uint32 quest_id) const;
1593 QuestStatus GetQuestStatus(uint32 quest_id) const;
1594 void SetQuestStatus(uint32 questId, QuestStatus status, bool update = true);
1595 void RemoveActiveQuest(uint32 questId, bool update = true);
1596 void RemoveRewardedQuest(uint32 questId, bool update = true);
1597 void SendQuestUpdate(uint32 questId, bool updateInteractions = true, bool updateGameObjectQuestGiverStatus = false);
1598 QuestGiverStatus GetQuestDialogStatus(Object const* questGiver) const;
1599 void SkipQuests(std::vector<uint32> const& questIds); // removes quest from log, flags rewarded, but does not give any rewards to player
1600 void DespawnPersonalSummonsForQuest(uint32 questId);
1601
1602 void SetDailyQuestStatus(uint32 quest_id);
1603 bool IsDailyQuestDone(uint32 quest_id) const;
1604 void SetWeeklyQuestStatus(uint32 quest_id);
1605 void SetMonthlyQuestStatus(uint32 quest_id);
1606 void SetSeasonalQuestStatus(uint32 quest_id);
1607 void DailyReset();
1608 void ResetWeeklyQuestStatus();
1609 void ResetMonthlyQuestStatus();
1610 void ResetSeasonalQuestStatus(uint16 event_id, time_t eventStartTime);
1611
1612 uint16 FindQuestSlot(uint32 quest_id) const;
1613 uint32 GetQuestSlotQuestId(uint16 slot) const;
1614 uint32 GetQuestSlotState(uint16 slot) const;
1615 uint16 GetQuestSlotCounter(uint16 slot, uint8 counter) const;
1616 int64 GetQuestSlotEndTime(uint16 slot) const;
1617 bool GetQuestSlotObjectiveFlag(uint16 slot, int8 objectiveIndex) const;
1618 int32 GetQuestSlotObjectiveData(uint16 slot, QuestObjective const& objective) const;
1619 int32 GetQuestObjectiveData(uint32 questId, uint32 objectiveId) const;
1620 void SetQuestSlot(uint16 slot, uint32 quest_id);
1621 void SetQuestSlotCounter(uint16 slot, uint8 counter, uint16 count);
1622 void SetQuestSlotState(uint16 slot, uint32 state);
1623 void RemoveQuestSlotState(uint16 slot, uint32 state);
1624 void SetQuestSlotEndTime(uint16 slot, time_t endTime);
1625 void SetQuestSlotObjectiveFlag(uint16 slot, int8 objectiveIndex);
1626 void RemoveQuestSlotObjectiveFlag(uint16 slot, int8 objectiveIndex);
1627 void SetQuestCompletedBit(uint32 questBit, bool completed);
1628
1629 uint16 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) const;
1630 void AreaExploredOrEventHappens(uint32 questId);
1631 void GroupEventHappens(uint32 questId, WorldObject const* pEventObject);
1632 void ItemAddedQuestCheck(uint32 entry, uint32 count, Optional<bool> boundItemFlagRequirement = {}, bool* hadBoundItemObjective = nullptr);
1633 void ItemRemovedQuestCheck(uint32 entry, uint32 count);
1634 void KilledMonster(CreatureTemplate const* cInfo, ObjectGuid guid);
1635 void KilledMonsterCredit(uint32 entry, ObjectGuid guid = ObjectGuid::Empty);
1636 void KilledPlayerCredit(ObjectGuid victimGuid);
1637 void KillCreditGO(uint32 entry, ObjectGuid guid = ObjectGuid::Empty);
1638 void TalkedToCreature(uint32 entry, ObjectGuid guid);
1639 void KillCreditCriteriaTreeObjective(QuestObjective const& questObjective);
1640 void MoneyChanged(uint64 value);
1641 void ReputationChanged(FactionEntry const* factionEntry, int32 change);
1642 void CurrencyChanged(uint32 currencyId, int32 change);
1643 void UpdateQuestObjectiveProgress(QuestObjectiveType objectiveType, int32 objectId, int64 addCount, ObjectGuid victimGuid = ObjectGuid::Empty,
1644 std::vector<QuestObjective const*>* updatedObjectives = nullptr, std::function<bool(QuestObjective const*)> const* objectiveFilter = nullptr);
1645 bool HasQuestForItem(uint32 itemId) const;
1646 QuestObjective const* GetQuestObjectiveForItem(uint32 itemId, bool onlyIncomplete) const;
1647 bool HasQuestForGO(int32 goId) const;
1648 void UpdateVisibleObjectInteractions(bool allUnits, bool onlySpellClicks, bool gameObjectQuestGiverStatus, bool questObjectiveGameObjects);
1649 bool CanShareQuest(uint32 questId) const;
1650
1651 int32 GetQuestObjectiveData(QuestObjective const& objective) const;
1652 void SetQuestObjectiveData(QuestObjective const& objective, int32 data);
1653 bool IsQuestObjectiveCompletable(uint16 slot, Quest const* quest, QuestObjective const& objective) const;
1654 bool IsQuestObjectiveComplete(uint16 slot, Quest const* quest, QuestObjective const& objective) const;
1655 bool IsQuestObjectiveComplete(uint32 questId, uint32 objectiveId) const;
1656 bool IsQuestObjectiveProgressBarComplete(uint16 slot, Quest const* quest) const;
1657 void SendQuestComplete(uint32 questId) const;
1658 void SendQuestReward(Quest const* quest, Creature const* questGiver, uint32 xp, bool hideChatMessage) const;
1659 void SendQuestFailed(uint32 questId, InventoryResult reason = EQUIP_ERR_OK) const;
1660 void SendQuestTimerFailed(uint32 questId) const;
1661 void SendCanTakeQuestResponse(QuestFailedReason reason, bool sendErrorMessage = true, std::string reasonText = "") const;
1662 void SendQuestConfirmAccept(Quest const* quest, Player* receiver) const;
1663 void SendPushToPartyResponse(Player const* player, QuestPushReason reason, Quest const* quest = nullptr) const;
1664 void SendQuestUpdateAddCredit(Quest const* quest, ObjectGuid guid, QuestObjective const& obj, uint16 count) const;
1665 void SendQuestUpdateAddCreditSimple(QuestObjective const& obj) const;
1666 void SendQuestUpdateAddItem(ItemTemplate const* itemTemplate, QuestObjective const& obj, uint16 count) const;
1667 void SendQuestUpdateAddPlayer(Quest const* quest, uint16 newCount) const;
1668 void SendQuestGiverStatusMultiple();
1669 void SendQuestGiverStatusMultiple(GuidUnorderedSet const& guids);
1670 void SendDisplayToast(uint32 entry, DisplayToastType type, bool isBonusRoll, uint32 quantity, DisplayToastMethod method, uint32 questId = 0, Item* item = nullptr) const;
1671
1672 uint32 GetSharedQuestID() const { return m_sharedQuestId; }
1673 ObjectGuid GetPlayerSharingQuest() const { return m_playerSharingQuest; }
1674 void SetQuestSharingInfo(ObjectGuid guid, uint32 id) { m_playerSharingQuest = guid; m_sharedQuestId = id; }
1675 void ClearQuestSharingInfo() { m_playerSharingQuest = ObjectGuid::Empty; m_sharedQuestId = 0; }
1676
1677 uint32 GetInGameTime() const { return m_ingametime; }
1678 void SetInGameTime(uint32 time) { m_ingametime = time; }
1679
1680 void AddTimedQuest(uint32 questId) { m_timedquests.insert(questId); }
1681 void RemoveTimedQuest(uint32 questId) { m_timedquests.erase(questId); }
1682
1683 void SaveCUFProfile(uint8 id, std::nullptr_t) { _CUFProfiles[id] = nullptr; }
1684 void SaveCUFProfile(uint8 id, std::unique_ptr<CUFProfile> profile) { _CUFProfiles[id] = std::move(profile); }
1685 CUFProfile* GetCUFProfile(uint8 id) const { return _CUFProfiles[id].get(); }
1687 {
1688 uint8 count = 0;
1689 for (uint8 i = 0; i < MAX_CUF_PROFILES; ++i)
1690 if (_CUFProfiles[i])
1691 ++count;
1692 return count;
1693 }
1694
1695 bool HasPvPForcingQuest() const;
1696
1697 /*********************************************************/
1698 /*** LOAD SYSTEM ***/
1699 /*********************************************************/
1700
1701 bool LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& holder);
1702 bool IsLoading() const override;
1703
1704 static uint32 GetZoneIdFromDB(ObjectGuid guid);
1705 static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, ObjectGuid guid);
1706
1707 static bool IsValidGender(uint8 Gender) { return Gender <= GENDER_FEMALE; }
1708 static bool IsValidClass(uint8 Class) { return ((1 << (Class - 1)) & CLASSMASK_ALL_PLAYABLE) != 0; }
1710
1711 /*********************************************************/
1712 /*** SAVE SYSTEM ***/
1713 /*********************************************************/
1714
1715 void SaveToDB(bool create = false);
1716 void SaveToDB(LoginDatabaseTransaction loginTransaction, CharacterDatabaseTransaction trans, bool create = false);
1717 void SaveInventoryAndGoldToDB(CharacterDatabaseTransaction trans); // fast save function for item/money cheating preventing
1718
1719 static void SaveCustomizations(CharacterDatabaseTransaction trans, ObjectGuid::LowType guid,
1721 static void SavePositionInDB(WorldLocation const& loc, uint16 zoneId, ObjectGuid guid, CharacterDatabaseTransaction trans);
1722
1723 static void DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRealmChars = true, bool deleteFinally = false);
1724 static void DeleteOldCharacters();
1725 static void DeleteOldCharacters(uint32 keepDays);
1726
1728
1729 void SetBindPoint(ObjectGuid guid) const;
1730 void SendRespecWipeConfirm(ObjectGuid const& guid, uint32 cost, SpecResetType respecType) const;
1731 void RegenerateAll();
1732 void Regenerate(Powers power);
1733 void InterruptPowerRegen(Powers power);
1734 void RegenerateHealth();
1735 void setRegenTimerCount(uint32 time) {m_regenTimerCount = time;}
1736 void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;}
1737
1738 uint64 GetMoney() const { return m_activePlayerData->Coinage; }
1739 bool ModifyMoney(int64 amount, bool sendError = true);
1740 bool HasEnoughMoney(uint64 amount) const { return (GetMoney() >= amount); }
1741 bool HasEnoughMoney(int64 amount) const{ return (amount < 0) || HasEnoughMoney(uint64(amount)); }
1742 void SetMoney(uint64 value);
1743
1744 RewardedQuestSet const& getRewardedQuests() const { return m_RewardedQuests; }
1745 QuestStatusMap& getQuestStatusMap() { return m_QuestStatus; }
1746
1747 size_t GetRewardedQuestCount() const { return m_RewardedQuests.size(); }
1748 bool IsQuestRewarded(uint32 quest_id) const;
1749
1750 Unit* GetSelectedUnit() const;
1751 Player* GetSelectedPlayer() const;
1752
1753 void SetTarget(ObjectGuid const& /*guid*/) override { }
1754 void SetSelection(ObjectGuid const& guid) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Target), guid); }
1755
1756 void SendMailResult(uint64 mailId, MailResponseType mailAction, MailResponseResult mailError, uint32 equipError = 0, ObjectGuid::LowType itemGuid = UI64LIT(0), uint32 itemCount = 0) const;
1757 void SendNewMail() const;
1758 void UpdateNextMailTimeAndUnreads();
1759 void AddNewMailDeliverTime(time_t deliver_time);
1760
1761 void RemoveMail(uint64 id);
1762
1763 void AddMail(Mail* mail) { m_mail.push_front(mail);}// for call from WorldSession::SendMailTo
1764 uint32 GetMailSize() const { return uint32(m_mail.size()); }
1765 Mail* GetMail(uint64 id);
1766
1767 PlayerMails const& GetMails() const { return m_mail; }
1768
1769 void SendItemRetrievalMail(uint32 itemEntry, uint32 count, ItemContext context); // Item retrieval mails sent by The Postmaster (34337), used in multiple places.
1770
1771 /*********************************************************/
1772 /*** MAILED ITEMS SYSTEM ***/
1773 /*********************************************************/
1774
1777
1778 typedef std::unordered_map<ObjectGuid::LowType, Item*> ItemMap;
1779
1780 ItemMap mMitems; //template defined in objectmgr.cpp
1781
1782 Item* GetMItem(ObjectGuid::LowType id);
1783 void AddMItem(Item* it);
1784 bool RemoveMItem(ObjectGuid::LowType id);
1785
1786 void SendOnCancelExpectedVehicleRideAura() const;
1787 void PetSpellInitialize();
1788 void CharmSpellInitialize();
1789 void PossessSpellInitialize();
1790 void VehicleSpellInitialize();
1791 void SendRemoveControlBar() const;
1792 bool HasSpell(uint32 spell) const override;
1793 bool HasActiveSpell(uint32 spell) const; // show in spellbook
1794 SpellInfo const* GetCastSpellInfo(SpellInfo const* spellInfo, TriggerCastFlags& triggerFlag) const override;
1795 bool IsSpellFitByClassAndRace(uint32 spell_id) const;
1796 bool HandlePassiveSpellLearn(SpellInfo const* spellInfo);
1797
1798 void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask) const;
1799 void SendKnownSpells();
1800 void SendUnlearnSpells();
1801 bool AddSpell(uint32 spellId, bool active, bool learning, bool dependent, bool disabled, bool loading = false, int32 fromSkill = 0, bool favorite = false, Optional<int32> traitDefinitionId = {});
1802 void LearnSpell(uint32 spell_id, bool dependent, int32 fromSkill = 0, bool suppressMessaging = false, Optional<int32> traitDefinitionId = {});
1803 void RemoveSpell(uint32 spell_id, bool disabled = false, bool learn_low_rank = true, bool suppressMessaging = false);
1804 void ResetSpells(bool myClassOnly = false);
1805 void LearnCustomSpells();
1806 void LearnDefaultSkills();
1807 void LearnDefaultSkill(SkillRaceClassInfoEntry const* rcInfo);
1808 void LearnQuestRewardedSpells();
1809 void LearnQuestRewardedSpells(Quest const* quest);
1810 void AddTemporarySpell(uint32 spellId);
1811 void RemoveTemporarySpell(uint32 spellId);
1812 void SetOverrideSpellsId(int32 overrideSpellsId) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::OverrideSpellsID), overrideSpellsId); }
1813 void AddOverrideSpell(uint32 overridenSpellId, uint32 newSpellId);
1814 void RemoveOverrideSpell(uint32 overridenSpellId, uint32 newSpellId);
1815 void LearnSpecializationSpells();
1816 void RemoveSpecializationSpells();
1817 void AddSpellCategoryCooldownMod(int32 spellCategoryId, int32 mod);
1818 void RemoveSpellCategoryCooldownMod(int32 spellCategoryId, int32 mod);
1819 void SetSpellFavorite(uint32 spellId, bool favorite);
1820
1821 void AddStoredAuraTeleportLocation(uint32 spellId);
1822 void RemoveStoredAuraTeleportLocation(uint32 spellId);
1823 WorldLocation const* GetStoredAuraTeleportLocation(uint32 spellId) const;
1824
1825 void SetReputation(uint32 factionentry, int32 value);
1826 int32 GetReputation(uint32 factionentry) const;
1827 std::string GetGuildName() const;
1828
1829 // Loot Spec
1831 uint32 GetLootSpecId() const { return m_activePlayerData->LootSpecID; }
1832
1833 ZonePVPTypeOverride GetOverrideZonePVPType() const { return ZonePVPTypeOverride(*m_activePlayerData->OverrideZonePVPType); }
1835
1836 // Talents
1837 uint32 GetTalentResetCost() const { return _specializationInfo.ResetTalentsCost; }
1838 void SetTalentResetCost(uint32 cost) { _specializationInfo.ResetTalentsCost = cost; }
1839 time_t GetTalentResetTime() const { return _specializationInfo.ResetTalentsTime; }
1840 void SetTalentResetTime(time_t time_) { _specializationInfo.ResetTalentsTime = time_; }
1841 ChrSpecialization GetPrimarySpecialization() const { return ChrSpecialization(*m_playerData->CurrentSpecID); }
1843 uint8 GetActiveTalentGroup() const { return _specializationInfo.ActiveGroup; }
1844 void SetActiveTalentGroup(uint8 group){ _specializationInfo.ActiveGroup = group; }
1845 uint32 GetDefaultSpecId() const;
1846 ChrSpecializationEntry const* GetPrimarySpecializationEntry() const;
1847
1848 bool ResetTalents(bool noCost = false);
1849 void ResetPvpTalents();
1850 uint32 GetNextResetTalentsCost() const;
1851 void InitTalentForLevel();
1852 void SendTalentsInfoData();
1853 TalentLearnResult LearnTalent(uint32 talentId, int32* spellOnCooldown);
1854 bool AddTalent(TalentEntry const* talent, uint8 spec, bool learning);
1855 bool HasTalent(uint32 spell_id, uint8 spec) const;
1856 void RemoveTalent(TalentEntry const* talent);
1857 void ResetTalentSpecialization();
1858
1859 TalentLearnResult LearnPvpTalent(uint32 talentID, uint8 slot, int32* spellOnCooldown);
1860 bool AddPvpTalent(PvpTalentEntry const* talent, uint8 activeTalentGroup, uint8 slot);
1861 void RemovePvpTalent(PvpTalentEntry const* talent, uint8 activeTalentGroup);
1862 void TogglePvpTalents(bool enable);
1863 bool HasPvpTalent(uint32 talentID, uint8 activeTalentGroup) const;
1864 void EnablePvpRules(bool dueToCombat = false);
1865 void DisablePvpRules();
1866 bool HasPvpRulesEnabled() const;
1867 bool IsInAreaThatActivatesPvpTalents() const;
1868 bool IsAreaThatActivatesPvpTalents(uint32 areaID) const;
1869
1870 // Dual Spec
1871 void ActivateTalentGroup(ChrSpecializationEntry const* spec);
1872
1873 PlayerTalentMap const* GetTalentMap(uint8 spec) const { return &_specializationInfo.Talents[spec]; }
1874 PlayerTalentMap* GetTalentMap(uint8 spec) { return &_specializationInfo.Talents[spec]; }
1875 PlayerPvpTalentMap const& GetPvpTalentMap(uint8 spec) const { return _specializationInfo.PvpTalents[spec]; }
1876 PlayerPvpTalentMap& GetPvpTalentMap(uint8 spec) { return _specializationInfo.PvpTalents[spec]; }
1877 std::vector<uint32> const& GetGlyphs(uint8 spec) const { return _specializationInfo.Glyphs[spec]; }
1878 std::vector<uint32>& GetGlyphs(uint8 spec) { return _specializationInfo.Glyphs[spec]; }
1879 ActionButtonList const& GetActionButtons() const { return m_actionButtons; }
1880 void StartLoadingActionButtons(std::function<void()>&& callback = nullptr);
1881 void LoadActions(PreparedQueryResult result);
1882
1883 // Traits
1884 void CreateTraitConfig(WorldPackets::Traits::TraitConfig& traitConfig);
1885 void AddTraitConfig(WorldPackets::Traits::TraitConfig const& traitConfig);
1886 UF::TraitConfig const* GetTraitConfig(int32 configId) const;
1887 void UpdateTraitConfig(WorldPackets::Traits::TraitConfig&& newConfig, int32 savedConfigId, bool withCastTime);
1888 void ApplyTraitEntryChanges(int32 editedConfigId, WorldPackets::Traits::TraitConfig const& newConfig, bool applyTraits, bool consumeCurrencies);
1889 void RenameTraitConfig(int32 editedConfigId, std::string&& newName);
1890 void DeleteTraitConfig(int32 deletedConfigId);
1891 void ApplyTraitConfig(int32 configId, bool apply);
1892 void ApplyTraitEntry(int32 traitNodeEntryId, int32 rank, int32 grantedRanks, bool apply);
1894 void SetTraitConfigUseStarterBuild(int32 traitConfigId, bool useStarterBuild);
1895 void SetTraitConfigUseSharedActionBars(int32 traitConfigId, bool usesSharedActionBars, bool isLastSelectedSavedConfig);
1896
1897 uint32 GetFreePrimaryProfessionPoints() const { return m_activePlayerData->CharacterPoints; }
1899 void InitPrimaryProfessions();
1900
1901 PlayerSpellMap const& GetSpellMap() const { return m_spells; }
1902 PlayerSpellMap & GetSpellMap() { return m_spells; }
1903
1904 void AddSpellMod(SpellModifier* mod, bool apply);
1905 static bool IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier const* mod, Spell* spell = nullptr);
1906 template <class T>
1907 void GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell* spell, T base, int32* flat, float* pct) const;
1908 template <class T>
1909 void ApplySpellMod(SpellInfo const* spellInfo, SpellModOp op, T& basevalue, Spell* spell = nullptr) const;
1910 static void ApplyModToSpell(SpellModifier* mod, Spell* spell);
1911 void SetSpellModTakingSpell(Spell* spell, bool apply);
1912 void SendSpellModifiers() const;
1913
1914 void RemoveArenaSpellCooldowns(bool removeActivePetCooldowns = false);
1915 uint32 GetLastPotionId() const { return m_lastPotionId; }
1916 void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; }
1917 void UpdatePotionCooldown(Spell* spell = nullptr);
1918
1919 void SetResurrectRequestData(WorldObject const* caster, uint32 health, uint32 mana, uint32 appliedAura);
1921 {
1922 _resurrectionData.reset();
1923 }
1924
1925 bool IsResurrectRequestedBy(ObjectGuid const& guid) const
1926 {
1927 if (!IsResurrectRequested())
1928 return false;
1929
1930 return !_resurrectionData->GUID.IsEmpty() && _resurrectionData->GUID == guid;
1931 }
1932
1933 bool IsResurrectRequested() const { return _resurrectionData.get() != nullptr; }
1934 void ResurrectUsingRequestData();
1935 void ResurrectUsingRequestDataImpl();
1936
1937 PlayerCreateMode GetCreateMode() const { return m_createMode; }
1938
1939 uint8 getCinematic() const { return m_cinematic; }
1940 void setCinematic(uint8 cine) { m_cinematic = cine; }
1941
1942 uint32 GetMovie() const { return m_movie; }
1943 void SetMovie(uint32 movie) { m_movie = movie; }
1944
1945 ActionButton* AddActionButton(uint8 button, uint64 action, uint8 type);
1946 void RemoveActionButton(uint8 button);
1947 ActionButton const* GetActionButton(uint8 button);
1948 void SendInitialActionButtons() const { SendActionButtons(0); }
1949 void SendActionButtons(uint32 state) const;
1950 bool IsActionButtonDataValid(uint8 button, uint64 action, uint8 type) const;
1952
1954 void InitPvP();
1955 void UpdatePvPState(bool onlyFFA = false);
1956 void SetPvP(bool state) override;
1957 void UpdatePvP(bool state, bool override = false);
1958 void UpdateZone(uint32 newZone, uint32 newArea);
1959 void UpdateArea(uint32 newArea);
1960 void UpdateHostileAreaState(AreaTableEntry const* area);
1961 void UpdateZoneDependentAuras(uint32 zone_id); // zones
1962 void UpdateAreaDependentAuras(uint32 area_id); // subzones
1963
1964 void UpdateAfkReport(time_t currTime);
1965 void UpdatePvPFlag(time_t currTime);
1966 void SetContestedPvP(Player* attackedPlayer = nullptr);
1967 void UpdateContestedPvP(uint32 currTime);
1968 void SetContestedPvPTimer(uint32 newTime) {m_contestedPvPTimer = newTime;}
1969 void ResetContestedPvP();
1970
1972 std::unique_ptr<DuelInfo> duel;
1973 void UpdateDuelFlag(time_t currTime);
1974 void CheckDuelDistance(time_t currTime);
1975 void DuelComplete(DuelCompleteType type);
1976 void SetDuelArbiter(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::DuelArbiter), guid); }
1977 void SetDuelTeam(uint32 duelTeam) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::DuelTeam), duelTeam); }
1978
1979 bool IsGroupVisibleFor(Player const* p) const;
1980 bool IsInSameGroupWith(Player const* p) const;
1981 bool IsInSameRaidWith(Player const* p) const;
1982 void UninviteFromGroup();
1983 static void RemoveFromGroup(Group* group, ObjectGuid guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker = ObjectGuid::Empty, char const* reason = nullptr);
1984 void RemoveFromGroup(RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT) { RemoveFromGroup(GetGroup(), GetGUID(), method); }
1985 void SendUpdateToOutOfRangeGroupMembers();
1986
1987 void SetInGuild(ObjectGuid::LowType guildId);
1988 void SetGuildRank(uint8 rankId) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::GuildRankID), rankId); }
1989 uint8 GetGuildRank() const { return uint8(m_playerData->GuildRankID); }
1990 void SetGuildLevel(uint32 level) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::GuildLevel), level); }
1991 uint32 GetGuildLevel() const { return m_playerData->GuildLevel; }
1992 void SetGuildIdInvited(ObjectGuid::LowType GuildId) { m_GuildIdInvited = GuildId; }
1993 ObjectGuid::LowType GetGuildId() const { return m_unitData->GuildGUID->GetCounter(); /* return only lower part */ }
1994 Guild* GetGuild();
1995 Guild const* GetGuild() const;
1996 ObjectGuid::LowType GetGuildIdInvited() const { return m_GuildIdInvited; }
1997 static void RemovePetitionsAndSigns(ObjectGuid guid);
1998 void SetPersonalTabard(uint32 style, uint32 color, uint32 borderStyle, uint32 borderColor, uint32 backgroundColor);
1999
2000 // Arena Team
2001 void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, uint8 type);
2002 void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value);
2003 static void LeaveAllArenaTeams(ObjectGuid guid);
2004 uint32 GetArenaTeamId(uint8 /*slot*/) const { return 0; }
2005 uint32 GetArenaPersonalRating(uint8 slot) const;
2006 void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; }
2007 uint32 GetArenaTeamIdInvited() const { return m_ArenaTeamIdInvited; }
2008 uint32 GetRBGPersonalRating() const { return GetArenaPersonalRating(3); }
2009 UF::PVPInfo const* GetPvpInfoForBracket(int8 bracket) const;
2010
2011 Difficulty GetDifficultyID(MapEntry const* mapEntry) const;
2012 Difficulty GetDungeonDifficultyID() const { return m_dungeonDifficulty; }
2013 Difficulty GetRaidDifficultyID() const { return m_raidDifficulty; }
2014 Difficulty GetLegacyRaidDifficultyID() const { return m_legacyRaidDifficulty; }
2015 void SetDungeonDifficultyID(Difficulty dungeon_difficulty) { m_dungeonDifficulty = dungeon_difficulty; }
2016 void SetRaidDifficultyID(Difficulty raid_difficulty) { m_raidDifficulty = raid_difficulty; }
2017 void SetLegacyRaidDifficultyID(Difficulty raid_difficulty) { m_legacyRaidDifficulty = raid_difficulty; }
2018 static Difficulty CheckLoadedDungeonDifficultyID(Difficulty difficulty);
2019 static Difficulty CheckLoadedRaidDifficultyID(Difficulty difficulty);
2020 static Difficulty CheckLoadedLegacyRaidDifficultyID(Difficulty difficulty);
2021 void SendRaidGroupOnlyMessage(RaidGroupReason reason, int32 delay) const;
2022
2023 bool UpdateSkillPro(uint16 skillId, int32 chance, uint32 step);
2024 bool UpdateCraftSkill(SpellInfo const* spellInfo);
2025 bool UpdateGatherSkill(uint32 skillId, uint32 skillValue, uint32 redLevel, uint32 multiplicator = 1, WorldObject const* object = nullptr);
2026 bool UpdateFishingSkill(int32 expansion);
2027
2028 float GetHealthBonusFromStamina() const;
2029 Stats GetPrimaryStat() const;
2030
2031 bool UpdateStats(Stats stat) override;
2032 bool UpdateAllStats() override;
2033 void ApplySpellPenetrationBonus(int32 amount, bool apply);
2034 void ApplyModTargetResistance(int32 mod, bool apply) { ApplyModUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModTargetResistance), mod, apply); }
2035 void ApplyModTargetPhysicalResistance(int32 mod, bool apply) { ApplyModUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModTargetPhysicalResistance), mod, apply); }
2036 void UpdateResistances(uint32 school) override;
2037 void UpdateArmor() override;
2038 void UpdateMaxHealth() override;
2039 void UpdateMaxPower(Powers power) override;
2040 uint32 GetPowerIndex(Powers power) const override;
2041 void UpdateAttackPowerAndDamage(bool ranged = false) override;
2042 void ApplySpellPowerBonus(int32 amount, bool apply);
2043 void UpdateSpellDamageAndHealingBonus();
2044 void ApplyModDamageDonePos(SpellSchools school, int32 mod, bool apply) { ApplyModUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModDamageDonePos, school), mod, apply); }
2045 void ApplyModDamageDoneNeg(SpellSchools school, int32 mod, bool apply) { ApplyModUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModDamageDoneNeg, school), mod, apply); }
2046 void ApplyModDamageDonePercent(SpellSchools school, float pct, bool apply) { ApplyPercentModUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModDamageDonePercent, school), pct, apply); }
2047 void SetModDamageDonePercent(uint8 school, float pct) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModDamageDonePercent, school), pct); }
2048 void ApplyRatingMod(CombatRating cr, int32 value, bool apply);
2049 void UpdateRating(CombatRating cr);
2050 void UpdateAllRatings();
2051 void UpdateMastery();
2052 void UpdateVersatilityDamageDone();
2053 void UpdateHealingDonePercentMod();
2054 bool CanUseMastery() const;
2055
2056 void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage) const override;
2057
2058 void RecalculateRating(CombatRating cr) { ApplyRatingMod(cr, 0, true);}
2059 void GetDodgeFromAgility(float &diminishing, float &nondiminishing) const;
2060 float GetRatingMultiplier(CombatRating cr) const;
2061 float GetRatingBonusValue(CombatRating cr) const;
2062 float ApplyRatingDiminishing(CombatRating cr, float bonusValue) const;
2063
2065 uint32 GetBaseSpellPowerBonus() const { return m_baseSpellPower; }
2066 int32 GetSpellPenetrationItemMod() const { return m_spellPenetrationItemMod; }
2067
2068 bool CanApplyResilience() const override { return true; }
2069
2070 float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const;
2071 void UpdateBlockPercentage();
2072 void UpdateCritPercentage(WeaponAttackType attType);
2073 void UpdateAllCritPercentages();
2074 void UpdateParryPercentage();
2075 void UpdateDodgePercentage();
2076 void UpdateMeleeHitChances();
2077 void UpdateRangedHitChances();
2078 void UpdateSpellHitChances();
2079
2080 void UpdateSpellCritChance();
2081 void UpdateCorruption();
2082 void UpdateArmorPenetration(int32 amount);
2083 void UpdateExpertise(WeaponAttackType attType);
2084 void ApplyManaRegenBonus(int32 amount, bool apply);
2085 void ApplyHealthRegenBonus(int32 amount, bool apply);
2086 void UpdateManaRegen();
2087 void UpdateAllRunesRegen();
2088
2089 void SetPetSpellPower(uint32 spellPower) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::PetSpellPower), spellPower); }
2090
2091 ObjectGuid const& GetLootGUID() const { return m_playerData->LootTargetGUID; }
2092 void SetLootGUID(ObjectGuid const& guid) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::LootTargetGUID), guid); }
2093 Loot* GetLootByWorldObjectGUID(ObjectGuid const& lootWorldObjectGuid) const;
2094 std::unordered_map<ObjectGuid, Loot*> const& GetAELootView() const { return m_AELootView; }
2095 LootRoll* GetLootRoll(ObjectGuid const& lootObjectGuid, uint8 lootListId);
2096 void AddLootRoll(LootRoll* roll) { m_lootRolls.push_back(roll); }
2097 void RemoveLootRoll(LootRoll* roll);
2098
2099 void RemovedInsignia(Player* looterPlr);
2100
2101 WorldSession* GetSession() const { return m_session; }
2102
2103 protected:
2104 UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const* target) const override;
2105 void BuildValuesCreate(ByteBuffer* data, Player const* target) const override;
2106 void BuildValuesUpdate(ByteBuffer* data, Player const* target) const override;
2107 void ClearUpdateMask(bool remove) override;
2108
2109 public:
2110 void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const override;
2111 void BuildValuesUpdateWithFlag(ByteBuffer* data, UF::UpdateFieldFlag flags, Player const* target) const override;
2112 void BuildValuesUpdateForPlayerWithMask(UpdateData* data, UF::ObjectData::Mask const& requestedObjectMask, UF::UnitData::Mask const& requestedUnitMask,
2113 UF::PlayerData::Mask const& requestedPlayerMask, UF::ActivePlayerData::Mask const& requestedActivePlayerMask, Player const* target) const;
2114
2115 struct ValuesUpdateForPlayerWithMaskSender // sender compatible with MessageDistDeliverer
2116 {
2117 explicit ValuesUpdateForPlayerWithMaskSender(Player const* owner) : Owner(owner) { }
2118
2124
2125 void operator()(Player const* player) const;
2126 };
2127
2128 void DestroyForPlayer(Player* target) const override;
2129
2130 // notifiers
2131 void SendAttackSwingCancelAttack() const;
2132 void SetAttackSwingError(Optional<AttackSwingErr> err);
2133 void SendAutoRepeatCancel(Unit* target);
2134 void SendExplorationExperience(uint32 Area, uint32 Experience) const;
2135
2136 void SendDungeonDifficulty(int32 forcedDifficulty = -1) const;
2137 void SendRaidDifficulty(bool legacy, int32 forcedDifficulty = -1) const;
2138 void ResetInstances(InstanceResetMethod method);
2139 void SendResetInstanceSuccess(uint32 MapId) const;
2140 void SendResetInstanceFailed(ResetFailedReason reason, uint32 mapID) const;
2141 void SendResetFailedNotify(uint32 mapid) const;
2142 bool IsLockedToDungeonEncounter(uint32 dungeonEncounterId) const;
2143 bool IsLockedToDungeonEncounter(uint32 dungeonEncounterId, Difficulty difficulty) const;
2144
2145 bool UpdatePosition(float x, float y, float z, float orientation, bool teleport = false) override;
2146 bool UpdatePosition(Position const& pos, bool teleport = false) override { return UpdatePosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }
2147 void ProcessTerrainStatusUpdate(ZLiquidStatus oldLiquidStatus, Optional<LiquidData> const& newLiquidData) override;
2148 void AtEnterCombat() override;
2149 void AtExitCombat() override;
2150
2151 void SendMessageToSet(WorldPacket const* data, bool self) const override { SendMessageToSetInRange(data, GetVisibilityRange(), self); }
2152 void SendMessageToSetInRange(WorldPacket const* data, float dist, bool self) const override;
2153 void SendMessageToSetInRange(WorldPacket const* data, float dist, bool self, bool own_team_only, bool required3dDist = false) const;
2154 void SendMessageToSet(WorldPacket const* data, Player const* skipped_rcvr) const override;
2155
2156 void SendChatMessageToSetInRange(ChatMsg chatMsg, Language lanugageId, std::string&& text, float range);
2157
2158 Corpse* GetCorpse() const;
2159 void SpawnCorpseBones(bool triggerSave = true);
2160 Corpse* CreateCorpse();
2161 void KillPlayer();
2162 static void OfflineResurrect(ObjectGuid const& guid, CharacterDatabaseTransaction trans);
2163 bool HasCorpse() const { return _corpseLocation.GetMapId() != MAPID_INVALID; }
2164 WorldLocation GetCorpseLocation() const { return _corpseLocation; }
2165 void InitializeSelfResurrectionSpells();
2166 void ResurrectPlayer(float restore_percent, bool applySickness = false);
2167 void BuildPlayerRepop();
2168 void RepopAtGraveyard();
2169
2170 void DurabilityLossAll(double percent, bool inventory);
2171 void DurabilityLoss(Item* item, double percent);
2172 void DurabilityPointsLossAll(int32 points, bool inventory);
2173 void DurabilityPointsLoss(Item* item, int32 points);
2174 void DurabilityPointLossForEquipSlot(EquipmentSlots slot);
2175 void DurabilityRepairAll(bool takeCost, float discountMod, bool guildBank);
2176 void DurabilityRepair(uint16 pos, bool takeCost, float discountMod);
2177
2178 void UpdateMirrorTimers();
2179 void StopMirrorTimers();
2180 bool IsMirrorTimerActive(MirrorTimerType type) const;
2181
2182 bool CanJoinConstantChannelInZone(ChatChannelsEntry const* channel, AreaTableEntry const* zone) const;
2183
2184 void JoinedChannel(Channel* c);
2185 void LeftChannel(Channel* c);
2186 void CleanupChannels();
2187 void UpdateLocalChannels(uint32 newZone);
2188 void LeaveLFGChannel();
2189
2190 typedef std::list<Channel*> JoinedChannelsList;
2191 JoinedChannelsList const& GetJoinedChannels() const { return m_channels; }
2192
2193 void InitializeSkillFields();
2194 void SetSkill(uint32 id, uint16 step, uint16 newVal, uint16 maxVal);
2195 uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus + temp bonus
2196 uint16 GetPureMaxSkillValue(uint32 skill) const; // max
2197 uint16 GetSkillValue(uint32 skill) const; // skill value + perm. bonus + temp bonus
2198 uint16 GetBaseSkillValue(uint32 skill) const; // skill value + perm. bonus
2199 uint16 GetPureSkillValue(uint32 skill) const; // skill value
2200 int16 GetSkillPermBonusValue(uint32 skill) const;
2201 int16 GetSkillTempBonusValue(uint32 skill) const;
2202 uint16 GetSkillStep(uint32 skill) const; // 0...6
2203 uint32 GetProfessionSkillForExp(uint32 skill, int32 expansion) const;
2204 bool HasSkill(uint32 skill) const;
2205 void LearnSkillRewardedSpells(uint32 skillId, uint32 skillValue, Races race);
2206 int32 GetProfessionSlotFor(uint32 skillId) const;
2207 int32 FindEmptyProfessionSlotFor(uint32 skillId) const;
2208 void SetSkillLineId(uint32 pos, uint16 skillLineId) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillLineID, pos), skillLineId); }
2209 void SetSkillStep(uint32 pos, uint16 step) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillStep, pos), step); };
2210 void SetSkillRank(uint32 pos, uint16 rank) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillRank, pos), rank); }
2211 void SetSkillStartingRank(uint32 pos, uint16 starting) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillStartingRank, pos), starting); }
2212 void SetSkillMaxRank(uint32 pos, uint16 max) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillMaxRank, pos), max); }
2213 void SetSkillTempBonus(uint32 pos, uint16 bonus) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillTempBonus, pos), bonus); }
2214 void SetSkillPermBonus(uint32 pos, uint16 bonus) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillPermBonus, pos), bonus); }
2215
2216 WorldLocation& GetTeleportDest() { return m_teleport_dest; }
2217 Optional<uint32> GetTeleportDestInstanceId() const { return m_teleport_instanceId; }
2218 uint32 GetTeleportOptions() const { return m_teleport_options; }
2219 bool IsBeingTeleported() const { return IsBeingTeleportedNear() || IsBeingTeleportedFar(); }
2220 bool IsBeingTeleportedNear() const { return mSemaphoreTeleport_Near; }
2221 bool IsBeingTeleportedFar() const { return mSemaphoreTeleport_Far; }
2222 bool IsBeingTeleportedSeamlessly() const { return IsBeingTeleportedFar() && m_teleport_options & TELE_TO_SEAMLESS; }
2223 void SetSemaphoreTeleportNear(bool semphsetting) { mSemaphoreTeleport_Near = semphsetting; }
2224 void SetSemaphoreTeleportFar(bool semphsetting) { mSemaphoreTeleport_Far = semphsetting; }
2225 void ProcessDelayedOperations();
2226
2227 void CheckAreaExploreAndOutdoor(void);
2228 void AddExploredZones(uint32 pos, uint64 mask);
2229 void RemoveExploredZones(uint32 pos, uint64 mask);
2230 bool HasExploredZone(uint32 areaId) const;
2231
2232 static Team TeamForRace(uint8 race);
2233 static TeamId TeamIdForRace(uint8 race);
2234 static uint8 GetFactionGroupForRace(uint8 race);
2235 Team GetTeam() const { return m_team; }
2236 TeamId GetTeamId() const { return m_team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; }
2237 void SetFactionForRace(uint8 race);
2238
2239 Team GetEffectiveTeam() const { return HasPlayerFlagEx(PLAYER_FLAGS_EX_MERCENARY_MODE) ? (GetTeam() == ALLIANCE ? HORDE : ALLIANCE) : Team(GetTeam()); }
2240 TeamId GetEffectiveTeamId() const { return GetEffectiveTeam() == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; }
2241
2242 void InitDisplayIds();
2243
2244 bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const;
2245 bool IsAtRecruitAFriendDistance(WorldObject const* pOther) const;
2246 void RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource);
2247 bool isHonorOrXPTarget(Unit const* victim) const;
2248
2249 bool GetsRecruitAFriendBonus(bool forXP);
2250
2251 ReputationMgr& GetReputationMgr() { return *m_reputationMgr; }
2252 ReputationMgr const& GetReputationMgr() const { return *m_reputationMgr; }
2253 ReputationRank GetReputationRank(uint32 faction_id) const;
2254 void RewardReputation(Unit* victim, float rate);
2255 void RewardReputation(Quest const* quest);
2256
2257 int32 CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool noQuestBonus = false);
2258
2259 void UpdateSkillsForLevel();
2260 void ModifySkillBonus(uint32 skillid, int32 val, bool talent);
2261
2262 /*********************************************************/
2263 /*** PVP SYSTEM ***/
2264 /*********************************************************/
2265 void UpdateHonorFields();
2266 bool RewardHonor(Unit* victim, uint32 groupsize, int32 honor = -1, bool pvptoken = false);
2267 void ResetHonorStats();
2268 uint32 GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot) const;
2269
2270 // duel health and mana reset methods
2271 void SaveHealthBeforeDuel() { healthBeforeDuel = GetHealth(); }
2272 void SaveManaBeforeDuel() { manaBeforeDuel = GetPower(POWER_MANA); }
2273 void RestoreHealthAfterDuel() { SetHealth(healthBeforeDuel); }
2274 void RestoreManaAfterDuel() { SetPower(POWER_MANA, manaBeforeDuel); }
2275
2276 uint32 GetHonorLevel() const { return m_playerData->HonorLevel; }
2277 void AddHonorXP(uint32 xp);
2278 void SetHonorLevel(uint8 honorLevel);
2279 bool IsMaxHonorLevel() const { return GetHonorLevel() == PLAYER_MAX_HONOR_LEVEL; }
2280 // Updates PLAYER_FIELD_HONOR_NEXT_LEVEL based on PLAYER_FIELD_HONOR_LEVEL
2281 void UpdateHonorNextLevel();
2282 //End of PvP System
2283
2284 void RewardPlayerWithRewardPack(uint32 rewardPackID);
2285 void RewardPlayerWithRewardPack(RewardPackEntry const* rewardPackEntry);
2286
2287 void SetDrunkValue(uint8 newDrunkValue, uint32 itemId = 0);
2288 uint8 GetDrunkValue() const { return m_playerData->Inebriation; }
2289 static DrunkenState GetDrunkenstateByValue(uint8 value);
2290
2291 uint32 GetDeathTimer() const { return m_deathTimer; }
2292 uint32 GetCorpseReclaimDelay(bool pvp) const;
2293 void UpdateCorpseReclaimDelay();
2294 int32 CalculateCorpseReclaimDelay(bool load = false) const;
2295 void SendCorpseReclaimDelay(uint32 delay) const;
2296
2297 float GetBlockPercent(uint8 attackerLevel) const override;
2298 bool CanParry() const { return m_canParry; }
2299 void SetCanParry(bool value);
2300 bool CanBlock() const { return m_canBlock; }
2301 void SetCanBlock(bool value);
2302 bool CanTitanGrip() const { return m_canTitanGrip; }
2303 void SetCanTitanGrip(bool value, uint32 penaltySpellId = 0);
2304 void CheckTitanGripPenalty();
2305 bool CanTameExoticPets() const { return IsGameMaster() || HasAuraType(SPELL_AURA_ALLOW_TAME_PET_TYPE); }
2306
2307 void SetRegularAttackTime();
2308
2309 void HandleBaseModFlatValue(BaseModGroup modGroup, float amount, bool apply);
2310 void ApplyBaseModPctValue(BaseModGroup modGroup, float pct);
2311
2312 void SetBaseModFlatValue(BaseModGroup modGroup, float val);
2313 void SetBaseModPctValue(BaseModGroup modGroup, float val);
2314
2315 void UpdateDamageDoneMods(WeaponAttackType attackType, int32 skipEnchantSlot = -1) override;
2316 void UpdateBaseModGroup(BaseModGroup modGroup);
2317
2318 float GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const;
2319 float GetTotalBaseModValue(BaseModGroup modGroup) const;
2320
2321 void _ApplyAllStatBonuses();
2322 void _RemoveAllStatBonuses();
2323
2324 void ResetAllPowers();
2325
2326 SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType = BASE_ATTACK) const override;
2327
2328 void CastAllObtainSpells();
2329 void ApplyItemObtainSpells(Item* item, bool apply);
2330
2331 void UpdateWeaponDependentCritAuras(WeaponAttackType attackType);
2332 void UpdateAllWeaponDependentCritAuras();
2333
2334 void UpdateWeaponDependentAuras(WeaponAttackType attackType);
2335 void ApplyItemDependentAuras(Item* item, bool apply);
2336
2337 bool CheckAttackFitToAuraRequirement(WeaponAttackType attackType, AuraEffect const* aurEff) const override;
2338
2339 void _ApplyItemMods(Item* item, uint8 slot, bool apply, bool updateItemAuras = true);
2340 void _RemoveAllItemMods();
2341 void _ApplyAllItemMods();
2342 void _ApplyAllLevelScaleItemMods(bool apply);
2343 void ApplyAllAzeriteItemMods(bool apply);
2344 void ApplyAllAzeriteEmpoweredItemMods(bool apply);
2345 void _ApplyItemBonuses(Item* item, uint8 slot, bool apply);
2346 void _ApplyWeaponDamage(uint8 slot, Item* item, bool apply);
2347 bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) const;
2348 void ToggleMetaGemsActive(uint8 exceptslot, bool apply);
2349 void CorrectMetaGemEnchants(uint8 slot, bool apply);
2350 void InitDataForForm(bool reapplyMods = false);
2351
2352 void ApplyItemEquipSpell(Item* item, bool apply, bool formChange = false);
2353 void ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, bool formChange = false);
2354 void UpdateEquipSpellsAtFormChange();
2355 void UpdateItemSetAuras(bool formChange = false);
2356 void ApplyArtifactPowers(Item* item, bool apply);
2357 void ApplyArtifactPowerRank(Item* artifact, ArtifactPowerRankEntry const* artifactPowerRank, bool apply);
2358 void ApplyAzeritePowers(Item* item, bool apply);
2359 void ApplyAzeriteItemMilestonePower(AzeriteItem* item, AzeriteItemMilestonePowerEntry const* azeriteItemMilestonePower, bool apply);
2360 void ApplyAzeriteEssence(AzeriteItem* item, uint32 azeriteEssenceId, uint32 rank, bool major, bool apply);
2361 void ApplyAzeriteEssencePower(AzeriteItem* item, AzeriteEssencePowerEntry const* azeriteEssencePower, bool major, bool apply);
2362 void ApplyAzeritePower(AzeriteEmpoweredItem* item, AzeritePowerEntry const* azeritePower, bool apply);
2363
2364 void CastItemCombatSpell(DamageInfo const& damageInfo);
2365 void CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemTemplate const* proto);
2366 void CastItemUseSpell(Item* item, SpellCastTargets const& targets, ObjectGuid castCount, int32* misc);
2367 void ApplyItemLootedSpell(Item* item, bool apply);
2368 void ApplyItemLootedSpell(ItemTemplate const* itemTemplate);
2369
2370 void SendEquipmentSetList();
2371 void SetEquipmentSet(EquipmentSetInfo::EquipmentSetData const& newEqSet);
2372 void DeleteEquipmentSet(uint64 id);
2373
2374 void SendInitWorldStates(uint32 zoneId, uint32 areaId);
2375 void SendUpdateWorldState(uint32 variable, uint32 value, bool hidden = false) const;
2376 void SendDirectMessage(WorldPacket const* data) const;
2377
2378 void SendAurasForTarget(Unit* target) const;
2379
2380 std::unique_ptr<PlayerMenu> PlayerTalkClass;
2381 std::vector<ItemSetEffect*> ItemSetEff;
2382
2383 void SendLoot(Loot& loot, bool aeLooting = false);
2384 void SendLootError(ObjectGuid const& lootObj, ObjectGuid const& owner, LootError error) const;
2385 void SendLootRelease(ObjectGuid guid) const;
2386 void SendLootReleaseAll() const;
2387 void SendNotifyLootItemRemoved(ObjectGuid lootObj, ObjectGuid owner, uint8 lootListId) const;
2388 void SendNotifyLootMoneyRemoved(ObjectGuid lootObj) const;
2389
2390 /*********************************************************/
2391 /*** BATTLEGROUND SYSTEM ***/
2392 /*********************************************************/
2393
2394 bool InBattleground() const { return m_bgData.bgInstanceID != 0; }
2395 bool InArena() const;
2396 uint32 GetBattlegroundId() const { return m_bgData.bgInstanceID; }
2397 BattlegroundTypeId GetBattlegroundTypeId() const { return m_bgData.bgTypeID; }
2398 Battleground* GetBattleground() const;
2399
2400 uint32 GetBattlegroundQueueJoinTime(BattlegroundQueueTypeId bgQueueTypeId) const;
2401 bool InBattlegroundQueue(bool ignoreArena = false) const;
2402 bool IsDeserter() const { return HasAura(26013); }
2403
2404 BattlegroundQueueTypeId GetBattlegroundQueueTypeId(uint32 index) const;
2405 uint32 GetBattlegroundQueueIndex(BattlegroundQueueTypeId bgQueueTypeId) const;
2406 bool IsInvitedForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const;
2407 bool InBattlegroundQueueForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const;
2408
2409 void SetBattlegroundId(uint32 val, BattlegroundTypeId bgTypeId, BattlegroundQueueTypeId queueId);
2410 uint32 AddBattlegroundQueueId(BattlegroundQueueTypeId val);
2411 bool HasFreeBattlegroundQueueId() const;
2412 void RemoveBattlegroundQueueId(BattlegroundQueueTypeId val);
2413 void SetInviteForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId, uint32 instanceId);
2414 bool IsInvitedForBattlegroundInstance(uint32 instanceId) const;
2415 void SetMercenaryForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId, bool mercenary);
2416 bool IsMercenaryForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const;
2417 WorldLocation const& GetBattlegroundEntryPoint() const { return m_bgData.joinPos; }
2418 void SetBattlegroundEntryPoint();
2419
2420 void SetBGTeam(Team team);
2421 Team GetBGTeam() const;
2422
2423 void LeaveBattleground(bool teleportToEntryPoint = true);
2424 bool CanJoinToBattleground(BattlegroundTemplate const* bg) const;
2425 bool CanReportAfkDueToLimit();
2426 void ReportedAfkBy(Player* reporter);
2427 void ClearAfkReports() { m_bgData.bgAfkReporter.clear(); }
2428
2429 bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const;
2430 bool CanUseBattlegroundObject(GameObject* gameobject) const;
2431 bool isTotalImmune() const;
2432 bool CanCaptureTowerPoint() const;
2433
2434 bool GetRandomWinner() const { return m_IsBGRandomWinner; }
2435 void SetRandomWinner(bool isWinner);
2436
2437 /*********************************************************/
2438 /*** OUTDOOR PVP SYSTEM ***/
2439 /*********************************************************/
2440
2441 OutdoorPvP* GetOutdoorPvP() const;
2442 // returns true if the player is in active state for outdoor pvp objective capturing, false otherwise
2443 bool IsOutdoorPvPActive() const;
2444
2445 /*********************************************************/
2446 /*** ENVIROMENTAL SYSTEM ***/
2447 /*********************************************************/
2448
2449 bool IsImmuneToEnvironmentalDamage() const;
2450 uint32 EnvironmentalDamage(EnviromentalDamage type, uint32 damage);
2451
2452 /*********************************************************/
2453 /*** FLOOD FILTER SYSTEM ***/
2454 /*********************************************************/
2455
2457 {
2459 {
2460 REGULAR = 0,
2461 ADDON = 1,
2462 MAX
2464
2465 time_t Time = 0;
2467 };
2468
2469 void UpdateSpeakTime(ChatFloodThrottle::Index index);
2470
2471 /*********************************************************/
2472 /*** VARIOUS SYSTEMS ***/
2473 /*********************************************************/
2474 void UpdateFallInformationIfNeed(MovementInfo const& minfo, uint16 opcode);
2475 // only changed for direct client control (possess, vehicle etc.), not stuff you control using pet commands
2477 void SetFallInformation(uint32 time, float z);
2478 void HandleFall(MovementInfo const& movementInfo);
2479
2480 void SetClientControl(Unit* target, bool allowMove);
2481
2482 void SetSeer(WorldObject* target) { m_seer = target; }
2483 void SetViewpoint(WorldObject* target, bool apply);
2484 WorldObject* GetViewpoint() const;
2485 void StopCastingCharm();
2486 void StopCastingBindSight() const;
2487
2488 uint32 GetSaveTimer() const { return m_nextSave; }
2489 void SetSaveTimer(uint32 timer) { m_nextSave = timer; }
2490
2492 {
2493 m_recall_location.WorldRelocate(*this);
2494 m_recall_instanceId = GetInstanceId();
2495 }
2496 void Recall() { TeleportTo(m_recall_location, TELE_TO_NONE, m_recall_instanceId); }
2497
2498 void SetHomebind(WorldLocation const& loc, uint32 areaId);
2499 void SendBindPointUpdate() const;
2500 void SendPlayerBound(ObjectGuid const& binderGuid, uint32 areaId) const;
2501
2502 // Homebind coordinates
2505
2506 uint8 GetStartLevel(uint8 race, uint8 playerClass, Optional<int32> characterTemplateId) const;
2507
2508 // currently visible objects at player client
2511
2512 bool HaveAtClient(Object const* u) const;
2513
2514 bool IsNeverVisibleFor(WorldObject const* seer, bool allowServersideObjects = false) const override;
2515
2516 bool IsVisibleGloballyFor(Player const* player) const;
2517
2518 void SendInitialVisiblePackets(WorldObject* target) const;
2519 void OnPhaseChange() override;
2520 void UpdateObjectVisibility(bool forced = true) override;
2521 void UpdateVisibilityForPlayer();
2522 void UpdateVisibilityOf(WorldObject* target);
2523 void UpdateVisibilityOf(Trinity::IteratorPair<WorldObject**> targets);
2524 void UpdateTriggerVisibility();
2525
2526 template<class T>
2527 void UpdateVisibilityOf(T* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
2528
2529 std::array<uint8, MAX_MOVE_TYPE> m_forced_speed_changes;
2531
2532 bool HasAtLoginFlag(AtLoginFlags f) const { return (m_atLoginFlags & f) != 0; }
2533 void SetAtLoginFlag(AtLoginFlags f) { m_atLoginFlags |= f; }
2534 void RemoveAtLoginFlag(AtLoginFlags flags, bool persist = false);
2535
2536 bool isUsingLfg() const;
2537 bool inRandomLfgDungeon() const;
2538
2539 typedef std::set<uint32> DFQuestsDoneList;
2541
2542 // Temporarily removed pet cache
2543 uint32 GetTemporaryUnsummonedPetNumber() const { return m_temporaryUnsummonedPetNumber; }
2544 void SetTemporaryUnsummonedPetNumber(uint32 petnumber) { m_temporaryUnsummonedPetNumber = petnumber; }
2545 Optional<ReactStates> GetTemporaryPetReactState() const { return m_temporaryPetReactState; }
2546 void DisablePetControlsOnMount(ReactStates reactState, CommandStates commandState);
2547 void EnablePetControlsOnDismount();
2548 void UnsummonPetTemporaryIfAny();
2549 void ResummonPetTemporaryUnSummonedIfAny();
2550 void UnsummonBattlePetTemporaryIfAny(bool onFlyingMount = false);
2551 void ResummonBattlePetTemporaryUnSummonedIfAny();
2552 bool IsPetNeedBeTemporaryUnsummoned() const;
2553
2554 void SendCinematicStart(uint32 CinematicSequenceId) const;
2555 void SendMovieStart(uint32 movieId);
2556
2557 uint32 DoRandomRoll(uint32 minimum, uint32 maximum);
2558 uint8 GetItemLimitCategoryQuantity(ItemLimitCategoryEntry const* limitEntry) const;
2559
2560 void UpdateItemLevelAreaBasedScaling();
2561 void ActivatePvpItemLevels(bool activate) { _usePvpItemLevels = activate; }
2562 bool IsUsingPvpItemLevels() const { return _usePvpItemLevels; }
2563
2564 /*********************************************************/
2565 /*** INSTANCE SYSTEM ***/
2566 /*********************************************************/
2567
2568 void UpdateHomebindTime(uint32 time);
2569
2572 // permanent binds and solo binds by difficulty
2574 {
2575 auto itr = m_recentInstances.find(mapId);
2576 return itr != m_recentInstances.end() ? itr->second : 0;
2577 }
2578
2579 void SetRecentInstance(uint32 mapId, uint32 instanceId)
2580 {
2581 m_recentInstances[mapId] = instanceId;
2582 }
2583
2584 std::unordered_map<uint32 /*mapId*/, uint32 /*instanceId*/> m_recentInstances;
2585 void ConfirmPendingBind();
2586 void SetPendingBind(uint32 instanceId, uint32 bindTimer);
2587 bool HasPendingBind() const { return _pendingBindId > 0; }
2588 void SendRaidInfo();
2589 bool Satisfy(AccessRequirement const* ar, uint32 target_map, TransferAbortParams* params = nullptr, bool report = false);
2590 bool CheckInstanceValidity(bool /*isLogin*/);
2591 bool CheckInstanceCount(uint32 instanceId) const;
2592 void AddInstanceEnterTime(uint32 instanceId, time_t enterTime);
2593 WorldSafeLocsEntry const* GetInstanceEntrance(uint32 targetMapId);
2594
2595 // last used pet number (for BG's)
2596 uint32 GetLastPetNumber() const { return m_lastpetnumber; }
2597 void SetLastPetNumber(uint32 petnumber) { m_lastpetnumber = petnumber; }
2598
2599 /*********************************************************/
2600 /*** GROUP SYSTEM ***/
2601 /*********************************************************/
2602
2603 bool IsInGroup(ObjectGuid groupGuid) const;
2604 Group* GetGroupInvite() const { return m_groupInvite; }
2605 void SetGroupInvite(Group* group) { m_groupInvite = group; }
2606 Group* GetGroup(Optional<uint8> partyIndex) { return const_cast<Group*>(const_cast<Player const*>(this)->GetGroup(partyIndex)); }
2607 Group const* GetGroup(Optional<uint8> partyIndex) const;
2608 Group* GetGroup() { return m_group.getTarget(); }
2609 Group const* GetGroup() const { return const_cast<Group const*>(m_group.getTarget()); }
2610 GroupReference& GetGroupRef() { return m_group; }
2611 void SetGroup(Group* group, int8 subgroup = -1);
2612 uint8 GetSubGroup() const { return m_group.getSubGroup(); }
2613 uint32 GetGroupUpdateFlag() const { return m_groupUpdateMask; }
2614 void SetGroupUpdateFlag(uint32 flag) { m_groupUpdateMask |= flag; }
2615 void RemoveGroupUpdateFlag(uint32 flag) { m_groupUpdateMask &= ~flag; }
2616 void SetPartyType(GroupCategory category, uint8 type);
2617 void ResetGroupUpdateSequenceIfNeeded(Group const* group);
2618 int32 NextGroupUpdateSequenceNumber(GroupCategory category);
2619 Player* GetNextRandomRaidMember(float radius);
2620 PartyResult CanUninviteFromGroup(ObjectGuid guidMember, Optional<uint8> partyIndex) const;
2621
2622 // Battleground / Battlefield Group System
2623 void SetBattlegroundOrBattlefieldRaid(Group* group, int8 subgroup = -1);
2624 void RemoveFromBattlegroundOrBattlefieldRaid();
2625 Group* GetOriginalGroup() const { return m_originalGroup.getTarget(); }
2626 GroupReference& GetOriginalGroupRef() { return m_originalGroup; }
2627 uint8 GetOriginalSubGroup() const { return m_originalGroup.getSubGroup(); }
2628 void SetOriginalGroup(Group* group, int8 subgroup = -1);
2629
2630 void SetPassOnGroupLoot(bool bPassOnGroupLoot) { m_bPassOnGroupLoot = bPassOnGroupLoot; }
2631 bool GetPassOnGroupLoot() const { return m_bPassOnGroupLoot; }
2632
2633 MapReference &GetMapRef() { return m_mapRef; }
2634
2635 // Set map to player and add reference
2636 void SetMap(Map* map) override;
2637 void ResetMap() override;
2638
2639 bool isAllowedToLoot(Creature const* creature) const;
2640
2641 UF::DeclinedNames const* GetDeclinedNames() const { return m_playerData->DeclinedNames.has_value() ? &*m_playerData->DeclinedNames : nullptr; }
2642 uint8 GetRunesState() const;
2643 uint32 GetRuneCooldown(uint8 index) const { return m_runes->Cooldown[index]; }
2644 uint32 GetRuneBaseCooldown() const;
2645 void SetRuneCooldown(uint8 index, uint32 cooldown);
2646 void ResyncRunes() const;
2647 void InitRunes();
2648
2649 void SendRespondInspectAchievements(Player* player) const;
2650 uint32 GetAchievementPoints() const;
2651 std::vector<uint32> GetCompletedAchievementIds() const;
2652 bool HasAchieved(uint32 achievementId) const;
2653 void ResetAchievements();
2654 void FailCriteria(CriteriaFailEvent condition, int32 failAsset);
2655 void UpdateCriteria(CriteriaType type, uint64 miscValue1 = 0, uint64 miscValue2 = 0, uint64 miscValue3 = 0, WorldObject* ref = nullptr);
2656 void StartCriteria(CriteriaStartEvent startEvent, uint32 entry, Milliseconds timeLost = Milliseconds::zero());
2657 void CompletedAchievement(AchievementEntry const* entry);
2658 bool ModifierTreeSatisfied(uint32 modifierTreeId) const;
2659
2660 bool HasTitle(uint32 bitIndex) const;
2661 bool HasTitle(CharTitlesEntry const* title) const;
2662 void SetTitle(CharTitlesEntry const* title, bool lost = false);
2663 void SetChosenTitle(int32 title) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::PlayerTitle), title); }
2664 void SetKnownTitles(uint32 index, uint64 mask) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::KnownTitles, index), mask); }
2665
2666 //bool isActiveObject() const { return true; }
2667 bool CanSeeGossipOn(Creature const* creature) const;
2668 bool CanSeeSpellClickOn(Creature const* creature) const;
2669
2670 uint32 GetChampioningFaction() const { return m_ChampioningFaction; }
2671 void SetChampioningFaction(uint32 faction) { m_ChampioningFaction = faction; }
2673
2674 float GetAverageItemLevel() const;
2676
2677 void ClearWhisperWhiteList() { WhisperList.clear(); }
2678 void AddWhisperWhiteList(ObjectGuid guid) { WhisperList.push_back(guid); }
2679 bool IsInWhisperWhiteList(ObjectGuid guid);
2680 void RemoveFromWhisperWhiteList(ObjectGuid guid) { WhisperList.remove(guid); }
2681
2682 void ValidateMovementInfo(MovementInfo* mi);
2683
2684 void SendMovementSetCollisionHeight(float height, WorldPackets::Movement::UpdateCollisionHeightReason reason);
2685
2686 bool CanFly() const override { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY); }
2687 bool CanEnterWater() const override { return true; }
2688
2689 std::string GetMapAreaAndZoneString() const;
2690 std::string GetCoordsMapAreaAndZoneString() const;
2691
2692 // Void Storage
2693 bool IsVoidStorageUnlocked() const { return HasPlayerFlag(PLAYER_FLAGS_VOID_UNLOCKED); }
2695 void LockVoidStorage() { RemovePlayerFlag(PLAYER_FLAGS_VOID_UNLOCKED); }
2696 uint8 GetNextVoidStorageFreeSlot() const;
2697 uint8 GetNumOfVoidStorageFreeSlots() const;
2698 uint8 AddVoidStorageItem(VoidStorageItem&& item);
2699 void DeleteVoidStorageItem(uint8 slot);
2700 bool SwapVoidStorageItem(uint8 oldSlot, uint8 newSlot);
2701 VoidStorageItem* GetVoidStorageItem(uint8 slot) const;
2702 VoidStorageItem* GetVoidStorageItem(uint64 id, uint8& slot) const;
2703
2704 // Reagent Bank
2705 bool IsReagentBankUnlocked() const { return HasPlayerFlagEx(PLAYER_FLAGS_EX_REAGENT_BANK_UNLOCKED); }
2707
2708 void CreateGarrison(uint32 garrSiteId);
2709 void DeleteGarrison();
2710 Garrison* GetGarrison() const { return _garrison.get(); }
2711
2712 bool IsAdvancedCombatLoggingEnabled() const { return _advancedCombatLoggingEnabled; }
2713 void SetAdvancedCombatLogging(bool enabled) { _advancedCombatLoggingEnabled = enabled; }
2714
2715 SceneMgr& GetSceneMgr() { return m_sceneMgr; }
2716 SceneMgr const& GetSceneMgr() const { return m_sceneMgr; }
2717 RestMgr& GetRestMgr() const { return *_restMgr; }
2719 {
2720 SetUpdateFieldValue(m_values
2721 .ModifyValue(&Player::m_activePlayerData)
2722 .ModifyValue(&UF::ActivePlayerData::RestInfo, type)
2723 .ModifyValue(&UF::RestInfo::StateID), state);
2724 }
2725 void SetRestThreshold(RestTypes type, uint32 threshold)
2726 {
2727 SetUpdateFieldValue(m_values
2728 .ModifyValue(&Player::m_activePlayerData)
2729 .ModifyValue(&UF::ActivePlayerData::RestInfo, type)
2730 .ModifyValue(&UF::RestInfo::Threshold), threshold);
2731 }
2732
2733 void SendPlayerChoice(ObjectGuid sender, int32 choiceId);
2734
2735 bool MeetPlayerCondition(uint32 conditionId) const;
2736
2737 bool HasPlayerFlag(PlayerFlags flags) const { return (*m_playerData->PlayerFlags & flags) != 0; }
2738 void SetPlayerFlag(PlayerFlags flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::PlayerFlags), flags); }
2739 void RemovePlayerFlag(PlayerFlags flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::PlayerFlags), flags); }
2741
2742 bool HasPlayerFlagEx(PlayerFlagsEx flags) const { return (*m_playerData->PlayerFlagsEx & flags) != 0; }
2743 void SetPlayerFlagEx(PlayerFlagsEx flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::PlayerFlagsEx), flags); }
2744 void RemovePlayerFlagEx(PlayerFlagsEx flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::PlayerFlagsEx), flags); }
2746
2747 void SetAverageItemLevelTotal(float newItemLevel) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::AvgItemLevel, 0), newItemLevel); }
2748 void SetAverageItemLevelEquipped(float newItemLevel) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::AvgItemLevel, 1), newItemLevel); }
2749
2750 uint32 GetCustomizationChoice(uint32 chrCustomizationOptionId) const
2751 {
2752 int32 choiceIndex = m_playerData->Customizations.FindIndexIf([chrCustomizationOptionId](UF::ChrCustomizationChoice choice)
2753 {
2754 return choice.ChrCustomizationOptionID == chrCustomizationOptionId;
2755 });
2756
2757 if (choiceIndex >= 0)
2758 return m_playerData->Customizations[choiceIndex].ChrCustomizationChoiceID;
2759
2760 return 0;
2761 }
2762
2763 template<typename Iter>
2764 void SetCustomizations(Trinity::IteratorPair<Iter> customizations, bool markChanged = true)
2765 {
2766 if (markChanged)
2767 m_customizationsChanged = true;
2768
2770 for (auto&& customization : customizations)
2771 {
2773 newChoice.ChrCustomizationOptionID = customization.ChrCustomizationOptionID;
2774 newChoice.ChrCustomizationChoiceID = customization.ChrCustomizationChoiceID;
2775 }
2776 }
2777 void SetPvpTitle(uint8 pvpTitle) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::PvpTitle), pvpTitle); }
2778 void SetArenaFaction(uint8 arenaFaction) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::ArenaFaction), arenaFaction); }
2779 void ApplyModFakeInebriation(int32 mod, bool apply) { ApplyModUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::FakeInebriation), mod, apply); }
2780 void SetVirtualPlayerRealm(uint32 virtualRealmAddress) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::VirtualPlayerRealm), virtualRealmAddress); }
2781 void SetCurrentBattlePetBreedQuality(uint8 battlePetBreedQuality) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::CurrentBattlePetBreedQuality), battlePetBreedQuality); }
2782
2784 {
2785 AddDynamicUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Heirlooms)) = itemId;
2787 }
2788 void SetHeirloom(uint32 slot, int32 itemId) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Heirlooms, slot), itemId); }
2790
2791 void AddToy(int32 itemId, uint32 flags)
2792 {
2793 AddDynamicUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Toys)) = itemId;
2795 }
2796
2797 void AddTransmogBlock(uint32 blockValue) { AddDynamicUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Transmog)) = blockValue; }
2798 void AddTransmogFlag(uint32 slot, uint32 flag) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Transmog, slot), flag); }
2799
2800 void AddConditionalTransmog(uint32 itemModifiedAppearanceId) { AddDynamicUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ConditionalTransmog)) = itemModifiedAppearanceId; }
2801 void RemoveConditionalTransmog(uint32 itemModifiedAppearanceId)
2802 {
2803 int32 index = m_activePlayerData->ConditionalTransmog.FindIndex(itemModifiedAppearanceId);
2804 if (index >= 0)
2806 }
2807
2809 void AddIllusionFlag(uint32 slot, uint32 flag) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::TransmogIllusions, slot), flag); }
2810
2813 {
2814 int32 index = m_activePlayerData->SelfResSpells.FindIndex(spellId);
2815 if (index >= 0)
2817 }
2819
2820 ObjectGuid GetSummonedBattlePetGUID() const { return m_activePlayerData->SummonedBattlePetGUID; }
2822
2823 void SetTrackCreatureFlag(uint32 flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::TrackCreatureMask), flags); }
2824 void RemoveTrackCreatureFlag(uint32 flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::TrackCreatureMask), flags); }
2825
2826 void SetVersatilityBonus(float value) { SetUpdateFieldStatValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::VersatilityBonus), value); }
2827
2828 void ApplyModOverrideSpellPowerByAPPercent(float mod, bool apply) { ApplyModUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::OverrideSpellPowerByAPPercent), mod, apply); }
2829
2830 void ApplyModOverrideAPBySpellPowerPercent(float mod, bool apply) { ApplyModUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::OverrideAPBySpellPowerPercent), mod, apply); }
2831
2832 bool HasPlayerLocalFlag(PlayerLocalFlags flags) const { return (*m_activePlayerData->LocalFlags & flags) != 0; }
2833 void SetPlayerLocalFlag(PlayerLocalFlags flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::LocalFlags), flags); }
2834 void RemovePlayerLocalFlag(PlayerLocalFlags flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::LocalFlags), flags); }
2836
2837 uint8 GetNumRespecs() const { return m_activePlayerData->NumRespecs; }
2838 void SetNumRespecs(uint8 numRespecs) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::NumRespecs), numRespecs); }
2839
2841
2842 void AddAuraVision(PlayerFieldByte2Flags flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::AuraVision), flags); }
2843 void RemoveAuraVision(PlayerFieldByte2Flags flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::AuraVision), flags); }
2844
2845 void SetTransportServerTime(int32 transportServerTime) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::TransportServerTime), transportServerTime); }
2846
2847 void SetRequiredMountCapabilityFlag(uint8 flag) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::RequiredMountCapabilityFlags), flag); }
2849
2850 bool IsInFriendlyArea() const;
2851 bool IsFriendlyArea(AreaTableEntry const* inArea) const;
2852
2853 void SetWarModeDesired(bool enabled);
2854 bool IsWarModeDesired() const { return HasPlayerFlag(PLAYER_FLAGS_WAR_MODE_DESIRED); }
2855 bool IsWarModeActive() const { return HasPlayerFlag(PLAYER_FLAGS_WAR_MODE_ACTIVE); }
2856 bool IsWarModeLocalActive() const { return HasPlayerLocalFlag(PLAYER_LOCAL_FLAG_WAR_MODE); }
2857 void SetWarModeLocal(bool enabled);
2858 bool CanEnableWarModeInArea() const;
2859 void UpdateWarModeAuras();
2860
2861 std::string GetDebugInfo() const override;
2862
2865
2866 void SetAreaSpiritHealer(Creature* creature);
2867 ObjectGuid const& GetSpiritHealerGUID() const { return _areaSpiritHealerGUID; }
2868 bool CanAcceptAreaSpiritHealFrom(Unit* spiritHealer) const { return spiritHealer->GetGUID() == _areaSpiritHealerGUID; }
2869 void SendAreaSpiritHealerTime(Unit* spiritHealer) const;
2870 void SendAreaSpiritHealerTime(ObjectGuid const& spiritHealerGUID, int32 timeLeft) const;
2871
2872 protected:
2873 // Gamemaster whisper whitelist
2878 std::array<float, MAX_POWERS_PER_CLASS> m_powerFraction;
2880
2881 /*********************************************************/
2882 /*** BATTLEGROUND SYSTEM ***/
2883 /*********************************************************/
2884
2885 /*
2886 this is an array of BG queues (BgTypeIDs) in which is player
2887 */
2889 {
2894 };
2895
2898
2900
2901 /*********************************************************/
2902 /*** QUEST SYSTEM ***/
2903 /*********************************************************/
2904
2905 void PushQuests();
2906
2907 //We allow only one timed quest active at the same time. Below can then be simple value instead of set.
2908 typedef std::set<uint32> QuestSet;
2909 typedef std::unordered_map<uint32, time_t> SeasonalQuestMapByQuest;
2910 typedef std::unordered_map<uint32, SeasonalQuestMapByQuest> SeasonalQuestMapByEvent;
2915
2919
2920 /*********************************************************/
2921 /*** LOAD SYSTEM ***/
2922 /*********************************************************/
2923
2924 void _LoadActions(PreparedQueryResult result);
2925 void _LoadAuras(PreparedQueryResult auraResult, PreparedQueryResult effectResult, uint32 timediff);
2926 void _LoadGlyphAuras();
2927 void _LoadInventory(PreparedQueryResult result, PreparedQueryResult artifactsResult, PreparedQueryResult azeriteResult,
2928 PreparedQueryResult azeriteItemMilestonePowersResult, PreparedQueryResult azeriteItemUnlockedEssencesResult,
2929 PreparedQueryResult azeriteEmpoweredItemResult, uint32 timeDiff);
2930 void _LoadVoidStorage(PreparedQueryResult result);
2931 void _LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mailItemsResult, PreparedQueryResult artifactResult, PreparedQueryResult azeriteItemResult,
2932 PreparedQueryResult azeriteItemMilestonePowersResult, PreparedQueryResult azeriteItemUnlockedEssencesResult, PreparedQueryResult azeriteEmpoweredItemResult);
2933 static Item* _LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint64 mailId, Mail* mail, Field* fields, ItemAdditionalLoadInfo* addionalData);
2934 void _LoadQuestStatus(PreparedQueryResult result);
2935 void _LoadQuestStatusObjectives(PreparedQueryResult result);
2936 void _LoadQuestStatusRewarded(PreparedQueryResult result);
2937 void _LoadDailyQuestStatus(PreparedQueryResult result);
2938 void _LoadWeeklyQuestStatus(PreparedQueryResult result);
2939 void _LoadMonthlyQuestStatus(PreparedQueryResult result);
2940 void _LoadSeasonalQuestStatus(PreparedQueryResult result);
2941 void _LoadRandomBGStatus(PreparedQueryResult result);
2942 void _LoadGroup(PreparedQueryResult result);
2943 void _LoadSkills(PreparedQueryResult result);
2944 void _LoadSpells(PreparedQueryResult result, PreparedQueryResult favoritesResult);
2945 void _LoadStoredAuraTeleportLocations(PreparedQueryResult result);
2946 bool _LoadHomeBind(PreparedQueryResult result);
2947 void _LoadDeclinedNames(PreparedQueryResult result);
2948 void _LoadArenaTeamInfo(PreparedQueryResult result);
2949 void _LoadEquipmentSets(PreparedQueryResult result);
2950 void _LoadTransmogOutfits(PreparedQueryResult result);
2951 void _LoadBGData(PreparedQueryResult result);
2952 void _LoadGlyphs(PreparedQueryResult result);
2953 void _LoadTalents(PreparedQueryResult result);
2954 void _LoadPvpTalents(PreparedQueryResult result);
2955 void _LoadTraits(PreparedQueryResult configsResult, PreparedQueryResult entriesResult);
2956 void _LoadInstanceTimeRestrictions(PreparedQueryResult result);
2957 void _LoadPetStable(uint32 summonedPetNumber, PreparedQueryResult result);
2958 void _LoadCurrency(PreparedQueryResult result);
2959 void _LoadCUFProfiles(PreparedQueryResult result);
2960
2961 /*********************************************************/
2962 /*** SAVE SYSTEM ***/
2963 /*********************************************************/
2964
2965 void _SaveCustomizations(CharacterDatabaseTransaction trans);
2966 void _SaveActions(CharacterDatabaseTransaction trans);
2967 void _SaveAuras(CharacterDatabaseTransaction trans);
2968 void _SaveInventory(CharacterDatabaseTransaction trans);
2969 void _SaveVoidStorage(CharacterDatabaseTransaction trans);
2970 void _SaveMail(CharacterDatabaseTransaction trans);
2971 void _SaveQuestStatus(CharacterDatabaseTransaction trans);
2972 void _SaveDailyQuestStatus(CharacterDatabaseTransaction trans);
2973 void _SaveWeeklyQuestStatus(CharacterDatabaseTransaction trans);
2974 void _SaveMonthlyQuestStatus(CharacterDatabaseTransaction trans);
2975 void _SaveSeasonalQuestStatus(CharacterDatabaseTransaction trans);
2976 void _SaveSkills(CharacterDatabaseTransaction trans);
2977 void _SaveSpells(CharacterDatabaseTransaction trans);
2978 void _SaveStoredAuraTeleportLocations(CharacterDatabaseTransaction trans);
2979 void _SaveEquipmentSets(CharacterDatabaseTransaction trans);
2980 void _SaveBGData(CharacterDatabaseTransaction trans);
2981 void _SaveGlyphs(CharacterDatabaseTransaction trans) const;
2982 void _SaveTalents(CharacterDatabaseTransaction trans);
2983 void _SaveTraits(CharacterDatabaseTransaction trans);
2984 void _SaveStats(CharacterDatabaseTransaction trans) const;
2985 void _SaveInstanceTimeRestrictions(CharacterDatabaseTransaction trans);
2986 void _SaveCurrency(CharacterDatabaseTransaction trans);
2987 void _SaveCUFProfiles(CharacterDatabaseTransaction trans);
2988
2989 /*********************************************************/
2990 /*** ENVIRONMENTAL SYSTEM ***/
2991 /*********************************************************/
2992 void HandleSobering();
2993 void SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen);
2994 void StopMirrorTimer(MirrorTimerType Type);
2995 void HandleDrowning(uint32 time_diff);
2996 int32 getMaxTimer(MirrorTimerType timer) const;
2997
2998 /*********************************************************/
2999 /*** HONOR SYSTEM ***/
3000 /*********************************************************/
3002
3003 void outDebugValues() const;
3004
3008 std::array<ChatFloodThrottle, ChatFloodThrottle::MAX> m_chatFloodData;
3012
3014
3017
3019
3021
3022 std::vector<Item*> m_itemUpdateQueue;
3024
3026
3030
3033
3035
3038
3041 std::unordered_map<uint32 /*overridenSpellId*/, std::unordered_set<uint32> /*newSpellId*/> m_overrideSpells;
3042 uint32 m_lastPotionId; // last used health/mana potion in combat, that block next potion use
3043 std::unordered_map<uint32, StoredAuraTeleportLocation> m_storedAuraTeleportLocations;
3044
3046
3047 std::unordered_map<int32, PlayerSpellState> m_traitConfigStates;
3048
3050
3051 std::array<float, BASEMOD_END> m_auraBaseFlatMod;
3052 std::array<float, BASEMOD_END> m_auraBasePctMod;
3053 std::array<int16, MAX_COMBAT_RATING> m_baseRatingValue;
3058
3060
3064
3065 std::unique_ptr<ResurrectionData> _resurrectionData;
3066
3068
3070
3074
3076
3078
3084
3088
3092
3095
3103
3104 // Social
3106
3107 // Groups
3113 std::array<GroupUpdateCounter, 2> m_groupUpdateSequences;
3114
3115 // last used pet number (for BG's)
3117
3118 // Player summoning
3122
3123 // Recall position
3126
3127 std::unique_ptr<Runes> m_runes;
3129
3130 bool CanNeverSee(WorldObject const* obj) const override;
3131 bool CanAlwaysSee(WorldObject const* obj) const override;
3132
3133 bool IsAlwaysDetectableFor(WorldObject const* seer) const override;
3134
3136
3137 std::array<std::unique_ptr<CUFProfile>, MAX_CUF_PROFILES> _CUFProfiles;
3138
3140
3141 private:
3142 // internal common parts for CanStore/StoreItem functions
3143 InventoryResult CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const;
3144 InventoryResult CanStoreItem_InBag(uint8 bag, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
3145 InventoryResult CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
3146 Item* _StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool update);
3147 Item* _LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint32 timeDiff, Field* fields);
3148
3149 std::unique_ptr<CinematicMgr> _cinematicMgr;
3150
3152 void SendRefundInfo(Item* item);
3153 void RefundItem(Item* item);
3154 void SendItemRefundResult(Item* item, ItemExtendedCostEntry const* iece, uint8 error) const;
3155
3156 void AdjustQuestObjectiveProgress(Quest const* quest);
3157
3158 bool IsCanDelayTeleport() const { return m_bCanDelayTeleport; }
3159 void SetCanDelayTeleport(bool setting) { m_bCanDelayTeleport = setting; }
3160 bool IsHasDelayedTeleport() const { return m_bHasDelayedTeleport; }
3161 void SetDelayedTeleportFlag(bool setting) { m_bHasDelayedTeleport = setting; }
3162 void ScheduleDelayedOperation(uint32 operation) { if (operation < DELAYED_END) m_DelayedOperations |= operation; }
3163
3164 bool IsInstanceLoginGameMasterException() const;
3165
3167
3170
3171 std::array<int32, MAX_TIMERS> m_MirrorTimer;
3174
3175 // Current teleport data
3181
3185
3186 std::unique_ptr<PetStable> m_petStable;
3187
3188 // Temporary removed pet cache
3193
3194 std::unique_ptr<PlayerAchievementMgr> m_achievementMgr;
3195 std::unique_ptr<ReputationMgr> m_reputationMgr;
3196 std::unique_ptr<QuestObjectiveCriteriaMgr> m_questObjectiveCriteriaMgr;
3197
3199
3203
3205
3206 std::unique_ptr<Garrison> _garrison;
3207
3209
3210 // variables to save health and mana before duel and restore them after duel
3213
3215
3217
3218 std::unordered_map<ObjectGuid /*LootObject*/, Loot*> m_AELootView;
3219 std::vector<LootRoll*> m_lootRolls; // loot rolls waiting for answer
3220
3221 void _InitHonorLevelOnLoadFromDB(uint32 honor, uint32 honorLevel);
3222 std::unique_ptr<RestMgr> _restMgr;
3223
3226
3227 // Spell cast request handling
3228 public:
3229 // Queues up a spell cast request that has been received via packet and processes it whenever possible.
3230 void RequestSpellCast(std::unique_ptr<SpellCastRequest> castRequest);
3231 void CancelPendingCastRequest();
3232 bool CanRequestSpellCast(SpellInfo const* spell, Unit const* castingUnit) const;
3233
3234 private:
3235 std::unique_ptr<SpellCastRequest> _pendingSpellCastRequest;
3236 void ExecutePendingSpellCastRequest();
3237 bool ProcessItemCast(SpellCastRequest& castRequest, SpellCastTargets const& targets);
3238 bool CanExecutePendingSpellCastRequest();
3239};
3240
3241TC_GAME_API void AddItemsSetItem(Player* player, Item const* item);
3242TC_GAME_API void RemoveItemsSetItem(Player* player, Item const* item);
3243
3244// Transforms a container of customization choices with continuous storage into iterator pair that does not depend on container
3245// and doesn't force implementations in header files
3246template<typename Container>
3248{
3249 static_assert(std::is_same<typename Container::value_type, UF::ChrCustomizationChoice>::value,
3250 "MakeChrCustomizationChoiceRange must be used with containers of UF::ChrCustomizationChoice");
3251
3252 return { container.data(), container.data() + container.size() };
3253}
3254
3255#endif
#define MAX_CUF_PROFILES
Maximum number of CompactUnitFrames profiles.
Definition: CUFProfile.h:26
Difficulty
Definition: DBCEnums.h:873
ItemContext
Definition: DBCEnums.h:1063
ChrSpecialization
Definition: DBCEnums.h:357
CriteriaStartEvent
Definition: DBCEnums.h:470
CriteriaFailEvent
Definition: DBCEnums.h:449
CriteriaType
Definition: DBCEnums.h:503
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
SQLTransaction< LoginDatabaseConnection > LoginDatabaseTransaction
std::shared_ptr< PreparedResultSet > PreparedQueryResult
#define TC_GAME_API
Definition: Define.h:123
uint8_t uint8
Definition: Define.h:144
int64_t int64
Definition: Define.h:137
int16_t int16
Definition: Define.h:139
int8_t int8
Definition: Define.h:140
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
#define UI64LIT(N)
Definition: Define.h:127
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
std::unordered_set< uint32 > params[2]
Definition: DisableMgr.cpp:50
uint16 flags
Definition: DisableMgr.cpp:49
std::chrono::steady_clock::time_point TimePoint
time_point shorthand typedefs
Definition: Duration.h:41
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:29
std::map< uint64, EquipmentSetInfo > EquipmentSetContainer
Definition: EquipmentSet.h:69
std::string GetDebugInfo()
Definition: Errors.cpp:157
#define ASSERT
Definition: Errors.h:68
GroupCategory
Definition: Group.h:112
EnchantmentSlot
Definition: ItemDefines.h:178
@ MAX_ENCHANTMENT_SLOT
Definition: ItemDefines.h:195
InventoryResult
Definition: ItemDefines.h:25
@ EQUIP_ERR_OK
Definition: ItemDefines.h:26
BuyResult
Definition: ItemDefines.h:149
SellResult
Definition: ItemDefines.h:163
uint32 ItemRandomBonusListId
ItemClass
Definition: ItemTemplate.h:419
InventoryType
Definition: ItemTemplate.h:378
void RemoveItemFromUpdateQueueOf(Item *item, Player *player)
Definition: Item.cpp:1218
void AddItemToUpdateQueueOf(Item *item, Player *player)
Definition: Item.cpp:1197
LootItemType
Definition: LootItemType.h:24
LootType
Definition: Loot.h:98
LootError
Definition: Loot.h:137
ZLiquidStatus
Definition: MapDefines.h:125
InstanceResetMethod
Definition: Map.h:845
InstanceResetResult
Definition: Map.h:852
TransferAbortReason
Definition: Map.h:86
std::list< ObjectGuid > GuidList
Definition: ObjectGuid.h:394
std::unordered_set< ObjectGuid > GuidUnorderedSet
Definition: ObjectGuid.h:396
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:393
PlayerCreateMode
Definition: ObjectMgr.h:613
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
PetTameResult
Definition: PetDefines.h:101
PetStableFlags
Definition: PetDefines.h:62
PetSaveMode
Definition: PetDefines.h:41
EquipmentSlots
Definition: Player.h:629
@ EQUIPMENT_SLOT_SHOULDERS
Definition: Player.h:633
@ EQUIPMENT_SLOT_BODY
Definition: Player.h:634
@ EQUIPMENT_SLOT_HANDS
Definition: Player.h:640
@ EQUIPMENT_SLOT_FINGER1
Definition: Player.h:641
@ EQUIPMENT_SLOT_NECK
Definition: Player.h:632
@ EQUIPMENT_SLOT_FINGER2
Definition: Player.h:642
@ EQUIPMENT_SLOT_MAINHAND
Definition: Player.h:646
@ EQUIPMENT_SLOT_TABARD
Definition: Player.h:649
@ EQUIPMENT_SLOT_TRINKET1
Definition: Player.h:643
@ EQUIPMENT_SLOT_END
Definition: Player.h:650
@ EQUIPMENT_SLOT_HEAD
Definition: Player.h:631
@ EQUIPMENT_SLOT_LEGS
Definition: Player.h:637
@ EQUIPMENT_SLOT_BACK
Definition: Player.h:645
@ EQUIPMENT_SLOT_OFFHAND
Definition: Player.h:647
@ EQUIPMENT_SLOT_WAIST
Definition: Player.h:636
@ EQUIPMENT_SLOT_FEET
Definition: Player.h:638
@ EQUIPMENT_SLOT_CHEST
Definition: Player.h:635
@ EQUIPMENT_SLOT_WRISTS
Definition: Player.h:639
@ EQUIPMENT_SLOT_TRINKET2
Definition: Player.h:644
@ EQUIPMENT_SLOT_START
Definition: Player.h:630
@ EQUIPMENT_SLOT_RANGED
Definition: Player.h:648
std::deque< Mail * > PlayerMails
Definition: Player.h:139
std::vector< ItemPosCount > ItemPosCountVec
Definition: Player.h:750
ArenaTeamInfoType
Definition: Player.h:788
@ ARENA_TEAM_GAMES_WEEK
Definition: Player.h:792
@ ARENA_TEAM_TYPE
Definition: Player.h:790
@ ARENA_TEAM_ID
Definition: Player.h:789
@ ARENA_TEAM_END
Definition: Player.h:796
@ ARENA_TEAM_PERSONAL_RATING
Definition: Player.h:795
@ ARENA_TEAM_MEMBER
Definition: Player.h:791
@ ARENA_TEAM_WINS_SEASON
Definition: Player.h:794
@ ARENA_TEAM_GAMES_SEASON
Definition: Player.h:793
EnviromentalDamage
Type of environmental damages.
Definition: Player.h:816
@ DAMAGE_SLIME
Definition: Player.h:821
@ DAMAGE_FALL
Definition: Player.h:819
@ DAMAGE_LAVA
Definition: Player.h:820
@ DAMAGE_FALL_TO_VOID
Definition: Player.h:823
@ DAMAGE_DROWNING
Definition: Player.h:818
@ DAMAGE_FIRE
Definition: Player.h:822
@ DAMAGE_EXHAUSTED
Definition: Player.h:817
ReagentSlots
Definition: Player.h:711
@ REAGENT_SLOT_START
Definition: Player.h:712
@ REAGENT_SLOT_END
Definition: Player.h:713
uint32 constexpr PLAYER_MAX_HONOR_LEVEL
Definition: Player.h:1094
NewWorldReason
Definition: Player.h:772
@ NEW_WORLD_NORMAL
Definition: Player.h:773
@ NEW_WORLD_SEAMLESS
Definition: Player.h:774
ReferAFriendError
Definition: Player.h:927
@ ERR_REFER_A_FRIEND_TARGET_TOO_HIGH
Definition: Player.h:930
@ ERR_REFER_A_FRIEND_SUMMON_OFFLINE_S
Definition: Player.h:941
@ ERR_REFER_A_FRIEND_DIFFERENT_FACTION
Definition: Player.h:933
@ ERR_REFER_A_FRIEND_NONE
Definition: Player.h:928
@ ERR_REFER_A_FRIEND_NO_TARGET
Definition: Player.h:936
@ ERR_REFER_A_FRIEND_NOT_NOW
Definition: Player.h:934
@ ERR_REFER_A_FRIEND_INSUF_EXPAN_LVL
Definition: Player.h:940
@ ERR_REFER_A_FRIEND_INSUFFICIENT_GRANTABLE_LEVELS
Definition: Player.h:931
@ ERR_REFER_A_FRIEND_NOT_REFERRED_BY
Definition: Player.h:929
@ ERR_REFER_A_FRIEND_TOO_FAR
Definition: Player.h:932
@ ERR_REFER_A_FRIEND_SUMMON_LEVEL_MAX_I
Definition: Player.h:938
@ ERR_REFER_A_FRIEND_NOT_IN_GROUP
Definition: Player.h:937
@ ERR_REFER_A_FRIEND_MAP_INCOMING_TRANSFER_NOT_ALLOWED
Definition: Player.h:943
@ ERR_REFER_A_FRIEND_GRANT_LEVEL_MAX_I
Definition: Player.h:935
@ ERR_REFER_A_FRIEND_SUMMON_COOLDOWN
Definition: Player.h:939
@ ERR_REFER_A_FRIEND_NO_XREALM
Definition: Player.h:942
InventorySlots
Definition: Player.h:674
@ INVENTORY_SLOT_BAG_START
Definition: Player.h:675
@ INVENTORY_SLOT_BAG_END
Definition: Player.h:676
TeleportToOptions
Definition: Player.h:800
@ TELE_TO_SEAMLESS
Definition: Player.h:809
@ TELE_TO_TRANSPORT_TELEPORT
Definition: Player.h:807
@ TELE_TO_SPELL
Definition: Player.h:806
@ TELE_TO_NOT_LEAVE_COMBAT
Definition: Player.h:804
@ TELE_TO_NOT_UNSUMMON_PET
Definition: Player.h:805
@ TELE_TO_GM_MODE
Definition: Player.h:802
@ TELE_REVIVE_AT_TELEPORT
Definition: Player.h:808
@ TELE_TO_NONE
Definition: Player.h:801
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition: Player.h:803
std::array< uint32, MAX_PVP_TALENT_SLOTS > PlayerPvpTalentMap
Definition: Player.h:275
PlayerCurrencyState
Definition: Player.h:256
@ PLAYERCURRENCY_CHANGED
Definition: Player.h:258
@ PLAYERCURRENCY_UNCHANGED
Definition: Player.h:257
@ PLAYERCURRENCY_NEW
Definition: Player.h:259
@ PLAYERCURRENCY_REMOVED
Definition: Player.h:260
DuelState
Definition: Player.h:356
@ DUEL_STATE_CHALLENGED
Definition: Player.h:357
@ DUEL_STATE_COUNTDOWN
Definition: Player.h:358
@ DUEL_STATE_COMPLETED
Definition: Player.h:360
@ DUEL_STATE_IN_PROGRESS
Definition: Player.h:359
PlayerFieldByte2Flags
Definition: Player.h:500
@ PLAYER_FIELD_BYTE2_STEALTH
Definition: Player.h:502
@ PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
Definition: Player.h:503
@ PLAYER_FIELD_BYTE2_NONE
Definition: Player.h:501
#define MAX_RUNES
Definition: Player.h:384
QuestSlotStateMask
Definition: Player.h:584