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