TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Player.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef _PLAYER_H
20 #define _PLAYER_H
21 
22 #include "DBCStores.h"
23 #include "DB2Stores.h"
24 #include "GroupReference.h"
25 #include "MapReference.h"
26 
27 #include "Item.h"
28 #include "PetDefines.h"
29 #include "QuestDef.h"
30 #include "SpellMgr.h"
31 #include "SpellHistory.h"
32 #include "Unit.h"
33 #include "WorldSession.h"
34 #include "PlayerTaxi.h"
35 #include "TradeData.h"
36 
37 struct CreatureTemplate;
38 struct Mail;
40 struct TrainerSpell;
41 struct VendorItem;
42 
43 template<class T> class AchievementMgr;
44 class ReputationMgr;
45 class Channel;
46 class Creature;
47 class DynamicObject;
48 class Garrison;
49 class Group;
50 class Guild;
51 class OutdoorPvP;
52 class Pet;
53 class PlayerMenu;
54 class PlayerSocial;
55 class SpellCastTargets;
56 class UpdateMask;
57 
58 typedef std::deque<Mail*> PlayerMails;
59 
60 #define PLAYER_MAX_SKILLS 128
62 {
70 };
71 
72 #define PLAYER_EXPLORED_ZONES_SIZE 200
73 
74 // Note: SPELLMOD_* values is aura types in fact
76 {
77  SPELLMOD_FLAT = 107, // SPELL_AURA_ADD_FLAT_MODIFIER
78  SPELLMOD_PCT = 108 // SPELL_AURA_ADD_PCT_MODIFIER
79 };
80 
81 // 2^n values, Player::m_isunderwater is a bitmask. These are Trinity internal values, they are never send to any client
83 {
85  UNDERWATER_INWATER = 0x01, // terrain type is water and player is afflicted by it
86  UNDERWATER_INLAVA = 0x02, // terrain type is lava and player is afflicted by it
87  UNDERWATER_INSLIME = 0x04, // terrain type is lava and player is afflicted by it
88  UNDERWARER_INDARKWATER = 0x08, // terrain type is dark water and player is afflicted by it
89 
91 };
92 
94 {
99 };
100 
102 {
108 };
109 
111 {
113  bool active : 1; // show in spellbook
114  bool dependent : 1; // learned as result another spell learn, skill grow, quest reward, etc
115  bool disabled : 1; // first rank has been learned in result talent learn but currently talent unlearned, save max learned ranks
116 };
117 
119 
120 enum TalentSpecialization // talent tabs
121 {
156 };
157 
159 {
164 };
165 
166 // Spell modifier (used for modify other spells)
168 {
169  SpellModifier(Aura* _ownerAura = nullptr) : op(SPELLMOD_DAMAGE), type(SPELLMOD_FLAT), charges(0), value(0), mask(), spellId(0), ownerAura(_ownerAura) { }
176  Aura* const ownerAura;
177 };
178 
180 {
184  PLAYERCURRENCY_REMOVED = 3 //not removed just set count == 0
185 };
186 
188 {
194 };
195 
196 typedef std::unordered_map<uint32, PlayerSpellState> PlayerTalentMap;
197 typedef std::unordered_map<uint32, PlayerSpell*> PlayerSpellMap;
198 typedef std::list<SpellModifier*> SpellModList;
199 typedef std::unordered_map<uint32, PlayerCurrency> PlayerCurrenciesMap;
200 
202 #define MAX_CUF_PROFILES 5
203 
206 {
232 
233  // The unks is _LOCKED and _SHOWN and _DYNAMIC, unknown order
234 
236 };
237 
240 {
241  CUFProfile() : ProfileName(), BoolOptions() // might want to change default value for options
242  {
243  FrameHeight = 0;
244  FrameWidth = 0;
245  SortBy = 0;
246  HealthText = 0;
247  TopPoint = 0;
248  BottomPoint = 0;
249  LeftPoint = 0;
250  TopOffset = 0;
251  BottomOffset = 0;
252  LeftOffset = 0;
253  }
254 
255  CUFProfile(const std::string& name, uint16 frameHeight, uint16 frameWidth, uint8 sortBy, uint8 healthText, uint32 boolOptions,
256  uint8 topPoint, uint8 bottomPoint, uint8 leftPoint, uint16 topOffset, uint16 bottomOffset, uint16 leftOffset)
257  : ProfileName(name), BoolOptions(int(boolOptions))
258  {
259  FrameHeight = frameHeight;
260  FrameWidth = frameWidth;
261  SortBy = sortBy;
262  HealthText = healthText;
263  TopPoint = topPoint;
264  BottomPoint = bottomPoint;
265  LeftPoint = leftPoint;
266  TopOffset = topOffset;
267  BottomOffset = bottomOffset;
268  LeftOffset = leftOffset;
269  }
270 
271  std::string ProfileName;
276 
277  // LeftAlign, TopAlight, BottomAlign
281 
282  // LeftOffset, TopOffset and BottomOffset
286 
287  std::bitset<CUF_BOOL_OPTIONS_COUNT> BoolOptions;
288 
289  // More fields can be added to BoolOptions without changing DB schema (up to 32, currently 27)
290 };
291 
292 typedef std::unordered_map<uint32 /*instanceId*/, time_t/*releaseTime*/> InstanceTimeMap;
293 
295 {
299  TRAINER_SPELL_GREEN_DISABLED = 10 // custom value, not send to client: formally green but learn not allowed
300 };
301 
303 {
308 };
309 
311 {
313  ACTION_BUTTON_C = 0x01, // click?
320 };
321 
323 {
331 };
332 
333 #define ACTION_BUTTON_ACTION(X) (uint64(X) & 0x00000000FFFFFFFF)
334 #define ACTION_BUTTON_TYPE(X) ((uint64(X) & 0xFFFFFFFF00000000) >> 56)
335 #define MAX_ACTION_BUTTON_ACTION_VALUE (0xFFFFFFFF)
336 
338 {
340 
343 
344  // helpers
346  uint32 GetAction() const { return ACTION_BUTTON_ACTION(packedData); }
348  {
349  uint64 newData = uint64(action) | (uint64(type) << 56);
350  if (newData != packedData || uState == ACTIONBUTTON_DELETED)
351  {
352  packedData = newData;
353  if (uState != ACTIONBUTTON_NEW)
354  uState = ACTIONBUTTON_CHANGED;
355  }
356  }
357 };
358 
359 #define MAX_ACTION_BUTTONS 132
360 
361 typedef std::map<uint8, ActionButton> ActionButtonList;
362 
364 {
365  PlayerCreateInfoItem(uint32 id, uint32 amount) : item_id(id), item_amount(amount) { }
366 
369 };
370 
371 typedef std::list<PlayerCreateInfoItem> PlayerCreateInfoItems;
372 
374 {
375  PlayerLevelInfo() { for (uint8 i=0; i < MAX_STATS; ++i) stats[i] = 0; }
376 
378 };
379 
380 typedef std::list<uint32> PlayerCreateInfoSpells;
381 
383 {
385  PlayerCreateInfoAction(uint8 _button, uint32 _action, uint8 _type) : button(_button), type(_type), action(_action) { }
386 
390 };
391 
392 typedef std::list<PlayerCreateInfoAction> PlayerCreateInfoActions;
393 
394 typedef std::list<SkillRaceClassInfoEntry const*> PlayerCreateInfoSkills;
395 
397 {
398  // existence checked by displayId != 0
399  PlayerInfo() : mapId(0), areaId(0), positionX(0.0f), positionY(0.0f), positionZ(0.0f), orientation(0.0f), displayId_m(0), displayId_f(0), levelInfo(nullptr) { }
400 
403  float positionX;
404  float positionY;
405  float positionZ;
406  float orientation;
414 
415  PlayerLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1
416 };
417 
418 struct PvPInfo
419 {
421 
422  bool IsHostile;
426  time_t EndTimer;
427 };
428 
429 struct DuelInfo
430 {
431  DuelInfo() : initiator(nullptr), opponent(nullptr), startTimer(0), startTime(0), outOfBound(0), isMounted(false) { }
432 
435  time_t startTimer;
436  time_t startTime;
437  time_t outOfBound;
438  bool isMounted;
439 };
440 
441 struct Areas
442 {
445  float x1;
446  float x2;
447  float y1;
448  float y2;
449 };
450 
451 #define MAX_RUNES 6
452 
454 {
456  RUNE_MISS_COOLDOWN = 1500 // cooldown applied on runes when the spell misses
457 };
458 
460 {
466 };
467 
468 struct RuneInfo
469 {
474 };
475 
476 struct Runes
477 {
479  uint8 runeState; // mask of available runes
481 
482  void SetRuneState(uint8 index, bool set = true)
483  {
484  if (set)
485  runeState |= (1 << index); // usable
486  else
487  runeState &= ~(1 << index); // on cooldown
488  }
489 };
490 
492 {
494  EnchantDuration(Item* _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot),
495  leftduration(_leftduration){ ASSERT(item); }
496 
500 };
501 
502 typedef std::list<EnchantDuration> EnchantDurationList;
503 typedef std::list<Item*> ItemDurationList;
504 
506 {
511 };
512 
513 #define MAX_DRUNKEN 4
514 
516 {
518  PLAYER_FLAGS_AFK = 0x00000002,
519  PLAYER_FLAGS_DND = 0x00000004,
520  PLAYER_FLAGS_GM = 0x00000008,
521  PLAYER_FLAGS_GHOST = 0x00000010,
522  PLAYER_FLAGS_RESTING = 0x00000020,
523  PLAYER_FLAGS_UNK6 = 0x00000040,
524  PLAYER_FLAGS_UNK7 = 0x00000080, // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state
525  PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards
526  PLAYER_FLAGS_IN_PVP = 0x00000200,
529  PLAYER_FLAGS_PLAYED_LONG_TIME = 0x00001000, // played long time
530  PLAYER_FLAGS_PLAYED_TOO_LONG = 0x00002000, // played too long time
532  PLAYER_FLAGS_DEVELOPER = 0x00008000, // <Dev> prefix for something?
533  PLAYER_FLAGS_UNK16 = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary
534  PLAYER_FLAGS_TAXI_BENCHMARK = 0x00020000, // taxi benchmark mode (on/off) (2.0.1)
535  PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually)
536  PLAYER_FLAGS_UBER = 0x00080000,
537  PLAYER_FLAGS_UNK20 = 0x00100000,
538  PLAYER_FLAGS_UNK21 = 0x00200000,
540  PLAYER_ALLOW_ONLY_ABILITY = 0x00800000, // used by bladestorm and killing spree, allowed only spells with SPELL_ATTR0_REQ_AMMO, SPELL_EFFECT_ATTACK, checked only for active player
541  PLAYER_FLAGS_PET_BATTLES_UNLOCKED = 0x01000000, // enables pet battles
543  PLAYER_FLAGS_UNK26 = 0x04000000,
544  PLAYER_FLAGS_AUTO_DECLINE_GUILD = 0x08000000, // Automatically declines guild invites
545  PLAYER_FLAGS_GUILD_LEVEL_ENABLED = 0x10000000, // Lua_GetGuildLevelEnabled() - enables guild leveling related UI
546  PLAYER_FLAGS_VOID_UNLOCKED = 0x20000000, // void storage
547  PLAYER_FLAGS_UNK30 = 0x40000000,
548  PLAYER_FLAGS_UNK31 = 0x80000000
549 };
550 
552 {
555 };
556 
558 {
560  PLAYER_LOCAL_FLAG_RELEASE_TIMER = 0x00000008, // Display time till auto release spirit
561  PLAYER_LOCAL_FLAG_NO_RELEASE_WINDOW = 0x00000010, // Display no "release spirit" window at all
562  PLAYER_LOCAL_FLAG_NO_PET_BAR = 0x00000020, // CGPetInfo::IsPetBarUsed
567 };
568 
570 {
575 };
576 
578 {
583 };
584 
586 {
591 };
592 
594 {
599 };
600 
602 {
605 };
606 
607 static_assert((PLAYER_FIELD_BYTES_2_OFFSET_OVERRIDE_SPELLS_ID & 1) == 0, "PLAYER_FIELD_BYTES_2_OFFSET_OVERRIDE_SPELLS_ID must be aligned to 2 byte boundary");
608 
609 #define PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET (PLAYER_FIELD_BYTES_2_OFFSET_OVERRIDE_SPELLS_ID / 2)
610 
611 #define KNOWN_TITLES_SIZE 6
612 #define MAX_TITLE_INDEX (KNOWN_TITLES_SIZE * 64) // 4 uint64 fields
613 
614 // used in PLAYER_FIELD_BYTES2 values
615 enum PlayerFieldByte2Flags
616 {
617  PLAYER_FIELD_BYTE2_NONE = 0x00,
618  PLAYER_FIELD_BYTE2_STEALTH = 0x20,
619  PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW = 0x40
620 };
621 
622 enum PlayerFieldKillsOffsets
623 {
624  PLAYER_FIELD_KILLS_OFFSET_TODAY_KILLS = 0,
625  PLAYER_FIELD_KILLS_OFFSET_YESTERDAY_KILLS = 1
626 };
627 
628 enum MirrorTimerType
629 {
630  FATIGUE_TIMER = 0,
631  BREATH_TIMER = 1,
632  FIRE_TIMER = 2 // feign death
633 };
634 #define MAX_TIMERS 3
635 #define DISABLED_MIRROR_TIMER -1
636 
637 // 2^n values
638 enum PlayerExtraFlags
639 {
640  // gm abilities
641  PLAYER_EXTRA_GM_ON = 0x0001,
642  PLAYER_EXTRA_ACCEPT_WHISPERS = 0x0004,
643  PLAYER_EXTRA_TAXICHEAT = 0x0008,
644  PLAYER_EXTRA_GM_INVISIBLE = 0x0010,
645  PLAYER_EXTRA_GM_CHAT = 0x0020, // Show GM badge in chat messages
646 
647  // other states
648  PLAYER_EXTRA_PVP_DEATH = 0x0100 // store PvP death status until corpse creating.
649 };
650 
651 // 2^n values
652 enum AtLoginFlags
653 {
654  AT_LOGIN_NONE = 0x000,
655  AT_LOGIN_RENAME = 0x001,
656  AT_LOGIN_RESET_SPELLS = 0x002,
657  AT_LOGIN_RESET_TALENTS = 0x004,
658  AT_LOGIN_CUSTOMIZE = 0x008,
659  AT_LOGIN_RESET_PET_TALENTS = 0x010,
660  AT_LOGIN_FIRST = 0x020,
661  AT_LOGIN_CHANGE_FACTION = 0x040,
662  AT_LOGIN_CHANGE_RACE = 0x080,
663  AT_LOGIN_RESURRECT = 0x100,
664 };
665 
666 typedef std::map<uint32, QuestStatusData> QuestStatusMap;
667 typedef std::set<uint32> RewardedQuestSet;
668 
669 enum QuestSaveType
670 {
671  QUEST_DEFAULT_SAVE_TYPE = 0,
672  QUEST_DELETE_SAVE_TYPE,
673  QUEST_FORCE_DELETE_SAVE_TYPE
674 };
675 
676 // quest
677 typedef std::map<uint32, QuestSaveType> QuestStatusSaveMap;
678 
679 // Size of client completed quests bit map
680 #define QUESTS_COMPLETED_BITS_SIZE 875
681 
682 enum QuestSlotOffsets
683 {
684  QUEST_ID_OFFSET = 0,
685  QUEST_STATE_OFFSET = 1,
686  QUEST_COUNTS_OFFSET = 2,
687  QUEST_TIME_OFFSET = 4
688 };
689 
690 #define MAX_QUEST_OFFSET 15
691 
692 enum QuestSlotStateMask
693 {
694  QUEST_STATE_NONE = 0x0000,
695  QUEST_STATE_COMPLETE = 0x0001,
696  QUEST_STATE_FAIL = 0x0002
697 };
698 
699 enum SkillUpdateState
700 {
701  SKILL_UNCHANGED = 0,
702  SKILL_CHANGED = 1,
703  SKILL_NEW = 2,
704  SKILL_DELETED = 3
705 };
706 
707 struct SkillStatusData
708 {
709  SkillStatusData(uint8 _pos, SkillUpdateState _uState) : pos(_pos), uState(_uState)
710  {
711  }
712  uint8 pos;
713  SkillUpdateState uState;
714 };
715 
716 typedef std::unordered_map<uint32, SkillStatusData> SkillStatusMap;
717 
718 enum AttackSwingErr
719 {
720  ATTACKSWINGERR_CANT_ATTACK = 0,
721  ATTACKSWINGERR_NOTINRANGE = 1,
722  ATTACKSWINGERR_BADFACING = 2,
723  ATTACKSWINGERR_DEADTARGET = 3
724 };
725 
726 class Quest;
727 class Spell;
728 class Item;
729 class WorldSession;
730 
731 enum PlayerSlots
732 {
733  // first slot for item stored (in any way in player m_items data)
734  PLAYER_SLOT_START = 0,
735  // last+1 slot for item stored (in any way in player m_items data)
736  PLAYER_SLOT_END = 184,
737  PLAYER_SLOTS_COUNT = (PLAYER_SLOT_END - PLAYER_SLOT_START)
738 };
739 
740 #define INVENTORY_SLOT_BAG_0 255
741 
742 enum EquipmentSlots // 19 slots
743 {
744  EQUIPMENT_SLOT_START = 0,
745  EQUIPMENT_SLOT_HEAD = 0,
746  EQUIPMENT_SLOT_NECK = 1,
747  EQUIPMENT_SLOT_SHOULDERS = 2,
748  EQUIPMENT_SLOT_BODY = 3,
749  EQUIPMENT_SLOT_CHEST = 4,
750  EQUIPMENT_SLOT_WAIST = 5,
751  EQUIPMENT_SLOT_LEGS = 6,
752  EQUIPMENT_SLOT_FEET = 7,
753  EQUIPMENT_SLOT_WRISTS = 8,
754  EQUIPMENT_SLOT_HANDS = 9,
755  EQUIPMENT_SLOT_FINGER1 = 10,
756  EQUIPMENT_SLOT_FINGER2 = 11,
757  EQUIPMENT_SLOT_TRINKET1 = 12,
758  EQUIPMENT_SLOT_TRINKET2 = 13,
759  EQUIPMENT_SLOT_BACK = 14,
760  EQUIPMENT_SLOT_MAINHAND = 15,
761  EQUIPMENT_SLOT_OFFHAND = 16,
762  EQUIPMENT_SLOT_RANGED = 17,
763  EQUIPMENT_SLOT_TABARD = 18,
764  EQUIPMENT_SLOT_END = 19
765 };
766 
767 #define VISIBLE_ITEM_ENTRY_OFFSET 0
768 #define VISIBLE_ITEM_ENCHANTMENT_OFFSET 1
769 
770 enum InventorySlots // 4 slots
771 {
772  INVENTORY_SLOT_BAG_START = 19,
773  INVENTORY_SLOT_BAG_END = 23
774 };
775 
776 enum InventoryPackSlots // 16 slots
777 {
778  INVENTORY_SLOT_ITEM_START = 23,
779  INVENTORY_SLOT_ITEM_END = 39
780 };
781 
782 enum BankItemSlots // 28 slots
783 {
784  BANK_SLOT_ITEM_START = 39,
785  BANK_SLOT_ITEM_END = 67
786 };
787 
788 enum BankBagSlots // 7 slots
789 {
790  BANK_SLOT_BAG_START = 67,
791  BANK_SLOT_BAG_END = 74
792 };
793 
794 enum BuyBackSlots // 12 slots
795 {
796  // stored in m_buybackitems
797  BUYBACK_SLOT_START = 74,
798  BUYBACK_SLOT_END = 86
799 };
800 
801 enum ReagentSlots
802 {
803  REAGENT_SLOT_START = 87,
804  REAGENT_SLOT_END = 184,
805 };
806 
807 enum EquipmentSetUpdateState
808 {
809  EQUIPMENT_SET_UNCHANGED = 0,
810  EQUIPMENT_SET_CHANGED = 1,
811  EQUIPMENT_SET_NEW = 2,
812  EQUIPMENT_SET_DELETED = 3
813 };
814 
815 struct EquipmentSetInfo
816 {
818  struct EquipmentSetData
819  {
820  uint64 Guid = 0;
821  uint32 SetID = 0;
822  uint32 IgnoreMask = 0;
823  std::string SetName;
824  std::string SetIcon;
825  ObjectGuid Pieces[EQUIPMENT_SLOT_END];
826  } Data;
827 
829  EquipmentSetUpdateState State = EQUIPMENT_SET_NEW;
830 };
831 
832 #define MAX_EQUIPMENT_SET_INDEX 10 // client limit
833 
834 typedef std::map<uint32, EquipmentSetInfo> EquipmentSetContainer;
835 
836 struct ItemPosCount
837 {
838  ItemPosCount(uint16 _pos, uint32 _count) : pos(_pos), count(_count) { }
839  bool isContainedIn(std::vector<ItemPosCount> const& vec) const;
840  uint16 pos;
841  uint32 count;
842 };
843 typedef std::vector<ItemPosCount> ItemPosCountVec;
844 
845 enum TransferAbortReason
846 {
847  TRANSFER_ABORT_NONE = 0,
848  TRANSFER_ABORT_ERROR = 1,
849  TRANSFER_ABORT_MAX_PLAYERS = 2, // Transfer Aborted: instance is full
850  TRANSFER_ABORT_NOT_FOUND = 3, // Transfer Aborted: instance not found
851  TRANSFER_ABORT_TOO_MANY_INSTANCES = 4, // You have entered too many instances recently.
852  TRANSFER_ABORT_ZONE_IN_COMBAT = 6, // Unable to zone in while an encounter is in progress.
853  TRANSFER_ABORT_INSUF_EXPAN_LVL = 7, // You must have <TBC, WotLK> expansion installed to access this area.
854  TRANSFER_ABORT_DIFFICULTY = 8, // <Normal, Heroic, Epic> difficulty mode is not available for %s.
855  TRANSFER_ABORT_UNIQUE_MESSAGE = 9, // Until you've escaped TLK's grasp, you cannot leave this place!
856  TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 10, // Additional instances cannot be launched, please try again later.
857  TRANSFER_ABORT_NEED_GROUP = 11, // Transfer Aborted: you must be in a raid group to enter this instance
858  TRANSFER_ABORT_NOT_FOUND_2 = 12, // Transfer Aborted: instance not found
859  TRANSFER_ABORT_NOT_FOUND_3 = 13, // Transfer Aborted: instance not found
860  TRANSFER_ABORT_NOT_FOUND_4 = 14, // Transfer Aborted: instance not found
861  TRANSFER_ABORT_REALM_ONLY = 15, // All players in the party must be from the same realm to enter %s.
862  TRANSFER_ABORT_MAP_NOT_ALLOWED = 16, // Map cannot be entered at this time.
863  TRANSFER_ABORT_LOCKED_TO_DIFFERENT_INSTANCE = 18, // You are already locked to %s
864  TRANSFER_ABORT_ALREADY_COMPLETED_ENCOUNTER = 19, // You are ineligible to participate in at least one encounter in this instance because you are already locked to an instance in which it has been defeated.
865  TRANSFER_ABORT_DIFFICULTY_NOT_FOUND = 22, // client writes to console "Unable to resolve requested difficultyID %u to actual difficulty for map %d"
866  TRANSFER_ABORT_XREALM_ZONE_DOWN = 24, // Transfer Aborted: cross-realm zone is down
867  TRANSFER_ABORT_SOLO_PLAYER_SWITCH_DIFFICULTY = 26, // This instance is already in progress. You may only switch difficulties from inside the instance.
868 };
869 
870 enum NewWorldReason
871 {
872  NEW_WORLD_NORMAL = 16, // Normal map change
873  NEW_WORLD_SEAMLESS = 21, // Teleport to another map without a loading screen, used for outdoor scenarios
874 };
875 
876 enum InstanceResetWarningType
877 {
878  RAID_INSTANCE_WARNING_HOURS = 1, // WARNING! %s is scheduled to reset in %d hour(s).
879  RAID_INSTANCE_WARNING_MIN = 2, // WARNING! %s is scheduled to reset in %d minute(s)!
880  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!
881  RAID_INSTANCE_WELCOME = 4, // Welcome to %s. This raid instance is scheduled to reset in %s.
882  RAID_INSTANCE_EXPIRED = 5
883 };
884 
885 // PLAYER_FIELD_ARENA_TEAM_INFO_1_1 offsets
886 enum ArenaTeamInfoType
887 {
888  ARENA_TEAM_ID = 0,
889  ARENA_TEAM_TYPE = 1, // new in 3.2 - team type?
890  ARENA_TEAM_MEMBER = 2, // 0 - captain, 1 - member
891  ARENA_TEAM_GAMES_WEEK = 3,
892  ARENA_TEAM_GAMES_SEASON = 4,
893  ARENA_TEAM_WINS_SEASON = 5,
894  ARENA_TEAM_PERSONAL_RATING = 6,
895  ARENA_TEAM_END = 7
896 };
897 
898 class InstanceSave;
899 
900 enum RestFlag
901 {
902  REST_FLAG_IN_TAVERN = 0x1,
903  REST_FLAG_IN_CITY = 0x2,
904  REST_FLAG_IN_FACTION_AREA = 0x4, // used with AREA_FLAG_REST_ZONE_*
905 };
906 
907 enum TeleportToOptions
908 {
909  TELE_TO_GM_MODE = 0x01,
910  TELE_TO_NOT_LEAVE_TRANSPORT = 0x02,
911  TELE_TO_NOT_LEAVE_COMBAT = 0x04,
912  TELE_TO_NOT_UNSUMMON_PET = 0x08,
913  TELE_TO_SPELL = 0x10,
914  TELE_TO_SEAMLESS = 0x20
915 };
916 
918 enum EnviromentalDamage
919 {
920  DAMAGE_EXHAUSTED = 0,
921  DAMAGE_DROWNING = 1,
922  DAMAGE_FALL = 2,
923  DAMAGE_LAVA = 3,
924  DAMAGE_SLIME = 4,
925  DAMAGE_FIRE = 5,
926  DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss
927 };
928 
929 enum PlayedTimeIndex
930 {
931  PLAYED_TIME_TOTAL = 0,
932  PLAYED_TIME_LEVEL = 1
933 };
934 
935 #define MAX_PLAYED_TIME_INDEX 2
936 
937 // used at player loading query list preparing, and later result selection
938 enum PlayerLoginQueryIndex
939 {
940  PLAYER_LOGIN_QUERY_LOAD_FROM,
941  PLAYER_LOGIN_QUERY_LOAD_GROUP,
942  PLAYER_LOGIN_QUERY_LOAD_BOUND_INSTANCES,
943  PLAYER_LOGIN_QUERY_LOAD_AURAS,
944  PLAYER_LOGIN_QUERY_LOAD_AURA_EFFECTS,
945  PLAYER_LOGIN_QUERY_LOAD_SPELLS,
946  PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS,
947  PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_OBJECTIVES,
948  PLAYER_LOGIN_QUERY_LOAD_DAILY_QUEST_STATUS,
949  PLAYER_LOGIN_QUERY_LOAD_REPUTATION,
950  PLAYER_LOGIN_QUERY_LOAD_INVENTORY,
951  PLAYER_LOGIN_QUERY_LOAD_ACTIONS,
952  PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT,
953  PLAYER_LOGIN_QUERY_LOAD_MAIL_DATE,
954  PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST,
955  PLAYER_LOGIN_QUERY_LOAD_HOME_BIND,
956  PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS,
957  PLAYER_LOGIN_QUERY_LOAD_SPELL_CHARGES,
958  PLAYER_LOGIN_QUERY_LOAD_DECLINED_NAMES,
959  PLAYER_LOGIN_QUERY_LOAD_GUILD,
960  PLAYER_LOGIN_QUERY_LOAD_ARENA_INFO,
961  PLAYER_LOGIN_QUERY_LOAD_ACHIEVEMENTS,
962  PLAYER_LOGIN_QUERY_LOAD_CRITERIA_PROGRESS,
963  PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS,
964  PLAYER_LOGIN_QUERY_LOAD_BG_DATA,
965  PLAYER_LOGIN_QUERY_LOAD_GLYPHS,
966  PLAYER_LOGIN_QUERY_LOAD_TALENTS,
967  PLAYER_LOGIN_QUERY_LOAD_ACCOUNT_DATA,
968  PLAYER_LOGIN_QUERY_LOAD_SKILLS,
969  PLAYER_LOGIN_QUERY_LOAD_WEEKLY_QUEST_STATUS,
970  PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG,
971  PLAYER_LOGIN_QUERY_LOAD_BANNED,
972  PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_REW,
973  PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES,
974  PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS,
975  PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS,
976  PLAYER_LOGIN_QUERY_LOAD_VOID_STORAGE,
977  PLAYER_LOGIN_QUERY_LOAD_CURRENCY,
978  PLAYER_LOGIN_QUERY_LOAD_CUF_PROFILES,
979  PLAYER_LOGIN_QUERY_LOAD_CORPSE_LOCATION,
980  PLAYER_LOGIN_QUERY_LOAD_GARRISON,
981  PLAYER_LOGIN_QUERY_LOAD_GARRISON_BLUEPRINTS,
982  PLAYER_LOGIN_QUERY_LOAD_GARRISON_BUILDINGS,
983  PLAYER_LOGIN_QUERY_LOAD_GARRISON_FOLLOWERS,
984  PLAYER_LOGIN_QUERY_LOAD_GARRISON_FOLLOWER_ABILITIES,
985  MAX_PLAYER_LOGIN_QUERY
986 };
987 
988 enum PlayerDelayedOperations
989 {
990  DELAYED_SAVE_PLAYER = 0x01,
991  DELAYED_RESURRECT_PLAYER = 0x02,
992  DELAYED_SPELL_CAST_DESERTER = 0x04,
993  DELAYED_BG_MOUNT_RESTORE = 0x08,
994  DELAYED_BG_TAXI_RESTORE = 0x10,
995  DELAYED_BG_GROUP_RESTORE = 0x20,
996  DELAYED_END
997 };
998 
999 // Player summoning auto-decline time (in secs)
1000 #define MAX_PLAYER_SUMMON_DELAY (2*MINUTE)
1001 // Maximum money amount : 2^31 - 1
1002 TC_GAME_API extern uint64 const MAX_MONEY_AMOUNT;
1003 
1004 enum BindExtensionState
1005 {
1006  EXTEND_STATE_EXPIRED = 0,
1007  EXTEND_STATE_NORMAL = 1,
1008  EXTEND_STATE_EXTENDED = 2,
1009  EXTEND_STATE_KEEP = 255 // special state: keep current save type
1010 };
1011 struct InstancePlayerBind
1012 {
1013  InstanceSave* save;
1014  /* permanent PlayerInstanceBinds are created in Raid/Heroic instances for players
1015  that aren't already permanently bound when they are inside when a boss is killed
1016  or when they enter an instance that the group leader is permanently bound to. */
1017  bool perm;
1018  /* extend state listing:
1019  EXPIRED - doesn't affect anything unless manually re-extended by player
1020  NORMAL - standard state
1021  EXTENDED - won't be promoted to EXPIRED at next reset period, will instead be promoted to NORMAL */
1022  BindExtensionState extendState;
1023 
1024  InstancePlayerBind() : save(NULL), perm(false), extendState(EXTEND_STATE_NORMAL) { }
1025 };
1026 
1027 struct AccessRequirement
1028 {
1029  uint8 levelMin;
1030  uint8 levelMax;
1031  uint32 item;
1032  uint32 item2;
1033  uint32 quest_A;
1034  uint32 quest_H;
1035  uint32 achievement;
1036  std::string questFailedText;
1037 };
1038 
1039 enum CharDeleteMethod
1040 {
1041  CHAR_DELETE_REMOVE = 0, // Completely remove from the database
1042  CHAR_DELETE_UNLINK = 1 // The character gets unlinked from the account,
1043  // the name gets freed up and appears as deleted ingame
1044 };
1045 
1046 enum ReferAFriendError
1047 {
1048  ERR_REFER_A_FRIEND_NONE = 0,
1049  ERR_REFER_A_FRIEND_NOT_REFERRED_BY = 1,
1050  ERR_REFER_A_FRIEND_TARGET_TOO_HIGH = 2,
1051  ERR_REFER_A_FRIEND_INSUFFICIENT_GRANTABLE_LEVELS = 3,
1052  ERR_REFER_A_FRIEND_TOO_FAR = 4,
1053  ERR_REFER_A_FRIEND_DIFFERENT_FACTION = 5,
1054  ERR_REFER_A_FRIEND_NOT_NOW = 6,
1055  ERR_REFER_A_FRIEND_GRANT_LEVEL_MAX_I = 7,
1056  ERR_REFER_A_FRIEND_NO_TARGET = 8,
1057  ERR_REFER_A_FRIEND_NOT_IN_GROUP = 9,
1058  ERR_REFER_A_FRIEND_SUMMON_LEVEL_MAX_I = 10,
1059  ERR_REFER_A_FRIEND_SUMMON_COOLDOWN = 11,
1060  ERR_REFER_A_FRIEND_INSUF_EXPAN_LVL = 12,
1061  ERR_REFER_A_FRIEND_SUMMON_OFFLINE_S = 13,
1062  ERR_REFER_A_FRIEND_NO_XREALM = 14,
1063  ERR_REFER_A_FRIEND_MAP_INCOMING_TRANSFER_NOT_ALLOWED = 15
1064 };
1065 
1066 enum PlayerRestState
1067 {
1068  REST_STATE_RESTED = 0x01,
1069  REST_STATE_NOT_RAF_LINKED = 0x02,
1070  REST_STATE_RAF_LINKED = 0x06
1071 };
1072 
1073 enum PlayerCommandStates
1074 {
1075  CHEAT_NONE = 0x00,
1076  CHEAT_GOD = 0x01,
1077  CHEAT_CASTTIME = 0x02,
1078  CHEAT_COOLDOWN = 0x04,
1079  CHEAT_POWER = 0x08,
1080  CHEAT_WATERWALK = 0x10
1081 };
1082 
1083 enum PlayerLogXPReason
1084 {
1085  LOG_XP_REASON_KILL = 0,
1086  LOG_XP_REASON_NO_KILL = 1
1087 };
1088 
1089 class Player;
1090 
1092 struct BGData
1093 {
1094  BGData() : bgInstanceID(0), bgTypeID(BATTLEGROUND_TYPE_NONE), bgAfkReportedCount(0), bgAfkReportedTimer(0),
1095  bgTeam(0), mountSpell(0) { ClearTaxiPath(); }
1096 
1097  uint32 bgInstanceID;
1098  BattlegroundTypeId bgTypeID;
1100 
1101  GuidSet bgAfkReporter;
1102  uint8 bgAfkReportedCount;
1103  time_t bgAfkReportedTimer;
1104 
1105  uint32 bgTeam;
1106 
1107  uint32 mountSpell;
1108  uint32 taxiPath[2];
1109 
1110  WorldLocation joinPos;
1111 
1112  void ClearTaxiPath() { taxiPath[0] = taxiPath[1] = 0; }
1113  bool HasTaxiPath() const { return taxiPath[0] && taxiPath[1]; }
1114 };
1115 
1116 struct VoidStorageItem
1117 {
1118  VoidStorageItem() : ItemId(0), ItemEntry(0), ItemRandomPropertyId(0), ItemSuffixFactor(0), ItemUpgradeId(0) { }
1119  VoidStorageItem(uint64 id, uint32 entry, ObjectGuid const& creator, uint32 randomPropertyId, uint32 suffixFactor, uint32 upgradeId, std::vector<uint32> const& bonuses)
1120  : ItemId(id), ItemEntry(entry), CreatorGuid(creator), ItemRandomPropertyId(randomPropertyId),
1121  ItemSuffixFactor(suffixFactor), ItemUpgradeId(upgradeId)
1122  {
1123  BonusListIDs.insert(BonusListIDs.end(), bonuses.begin(), bonuses.end());
1124  }
1125  VoidStorageItem(VoidStorageItem&& vsi) : ItemId(vsi.ItemId), ItemEntry(vsi.ItemEntry), CreatorGuid(vsi.CreatorGuid), ItemRandomPropertyId(vsi.ItemRandomPropertyId),
1126  ItemSuffixFactor(vsi.ItemSuffixFactor), ItemUpgradeId(vsi.ItemUpgradeId), BonusListIDs(std::move(vsi.BonusListIDs)) { }
1127 
1128  uint64 ItemId;
1129  uint32 ItemEntry;
1130  ObjectGuid CreatorGuid;
1131  uint32 ItemRandomPropertyId;
1132  uint32 ItemSuffixFactor;
1133  uint32 ItemUpgradeId;
1134  std::vector<int32> BonusListIDs;
1135 };
1136 
1137 struct ResurrectionData
1138 {
1139  ObjectGuid GUID;
1141  uint32 Health;
1142  uint32 Mana;
1143  uint32 Aura;
1144 };
1145 
1146 static uint32 const DefaultTalentRowLevels[MAX_TALENT_TIERS] = { 15, 30, 45, 60, 75, 90, 100 };
1147 static uint32 const DKTalentRowLevels[MAX_TALENT_TIERS] = { 57, 58, 59, 60, 75, 90, 100 };
1148 
1149 struct TC_GAME_API PlayerTalentInfo
1150 {
1151  PlayerTalentInfo() :
1152  ResetTalentsCost(0), ResetTalentsTime(0),
1153  ActiveGroup(0), GroupsCount(1)
1154  {
1155  for (uint8 i = 0; i < MAX_TALENT_GROUPS; ++i)
1156  {
1157  GroupInfo[i].Talents = new PlayerTalentMap();
1158  memset(GroupInfo[i].Glyphs, 0, MAX_GLYPH_SLOT_INDEX * sizeof(uint32));
1159  GroupInfo[i].SpecId = 0;
1160  }
1161  }
1162 
1163  ~PlayerTalentInfo()
1164  {
1165  for (uint8 i = 0; i < MAX_TALENT_GROUPS; ++i)
1166  delete GroupInfo[i].Talents;
1167  }
1168 
1169  struct TalentGroupInfo
1170  {
1171  PlayerTalentMap* Talents;
1172  uint32 Glyphs[MAX_GLYPH_SLOT_INDEX];
1173  uint32 SpecId;
1174  } GroupInfo[MAX_TALENT_GROUPS];
1175 
1176  uint32 ResetTalentsCost;
1177  time_t ResetTalentsTime;
1178  uint8 ActiveGroup;
1179  uint8 GroupsCount;
1180 
1181 private:
1182  PlayerTalentInfo(PlayerTalentInfo const&);
1183 };
1184 
1185 class TC_GAME_API Player : public Unit, public GridObject<Player>
1186 {
1187  friend class WorldSession;
1188  friend void Item::AddToUpdateQueueOf(Player* player);
1189  friend void Item::RemoveFromUpdateQueueOf(Player* player);
1190  public:
1191  explicit Player(WorldSession* session);
1192  ~Player();
1193 
1194  void CleanupsBeforeDelete(bool finalCleanup = true) override;
1195 
1196  void AddToWorld() override;
1197  void RemoveFromWorld() override;
1198 
1199  void SetObjectScale(float scale) override
1200  {
1201  Unit::SetObjectScale(scale);
1204  }
1205 
1206  bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0);
1207  bool TeleportTo(WorldLocation const &loc, uint32 options = 0);
1208  bool TeleportToBGEntryPoint();
1209 
1210  void SetSummonPoint(uint32 mapid, float x, float y, float z);
1211  void SummonIfPossible(bool agree);
1212 
1213  bool Create(ObjectGuid::LowType guidlow, WorldPackets::Character::CharacterCreateInfo const* createInfo);
1214 
1215  void Update(uint32 time) override;
1216 
1217  bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const override; // override Unit::IsImmunedToSpellEffect
1218 
1219  void SetInWater(bool apply);
1220 
1221  bool IsInWater() const override { return m_isInWater; }
1222  bool IsUnderWater() const override;
1223  bool IsInAreaTriggerRadius(const AreaTriggerEntry* trigger) const;
1224 
1225  void SendInitialPacketsBeforeAddToMap();
1226  void SendInitialPacketsAfterAddToMap();
1227  void SendSupercededSpell(uint32 oldSpell, uint32 newSpell) const;
1228  void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg = 0) const;
1229  void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time, bool welcome) const;
1230 
1231  bool CanInteractWithQuestGiver(Object* questGiver) const;
1232  Creature* GetNPCIfCanInteractWith(ObjectGuid const& guid, uint64 npcflagmask) const;
1233  GameObject* GetGameObjectIfCanInteractWith(ObjectGuid const& guid) const;
1234  GameObject* GetGameObjectIfCanInteractWith(ObjectGuid const& guid, GameobjectTypes type) const;
1235 
1236  void ToggleAFK();
1237  void ToggleDND();
1238  bool isAFK() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); }
1239  bool isDND() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); }
1240  uint8 GetChatFlags() const;
1241  std::string autoReplyMsg;
1242 
1243  uint32 GetBarberShopCost(BarberShopStyleEntry const* newHairStyle, uint8 newHairColor, BarberShopStyleEntry const* newFacialHair, BarberShopStyleEntry const* newSkin = nullptr, BarberShopStyleEntry const* newFace = nullptr) const;
1244 
1245  PlayerSocial* GetSocial() const { return m_social; }
1246  void RemoveSocial();
1247 
1248  PlayerTaxi m_taxi;
1249  void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(getRace(), getClass(), getLevel()); }
1250  bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc = nullptr, uint32 spellid = 0);
1251  bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 0);
1252  void CleanupAfterTaxiFlight();
1253  void ContinueTaxiFlight() const;
1254  // mount_id can be used in scripting calls
1255  bool isAcceptWhispers() const { return (m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS) != 0; }
1256  void SetAcceptWhispers(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; }
1257  bool IsGameMaster() const { return (m_ExtraFlags & PLAYER_EXTRA_GM_ON) != 0; }
1258  bool CanBeGameMaster() const;
1259  void SetGameMaster(bool on);
1260  bool isGMChat() const { return (m_ExtraFlags & PLAYER_EXTRA_GM_CHAT) != 0; }
1261  void SetGMChat(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_CHAT; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_CHAT; }
1262  bool isTaxiCheater() const { return (m_ExtraFlags & PLAYER_EXTRA_TAXICHEAT) != 0; }
1263  void SetTaxiCheater(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_TAXICHEAT; else m_ExtraFlags &= ~PLAYER_EXTRA_TAXICHEAT; }
1264  bool isGMVisible() const { return !(m_ExtraFlags & PLAYER_EXTRA_GM_INVISIBLE); }
1265  void SetGMVisible(bool on);
1266  void SetPvPDeath(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
1267 
1268  void GiveXP(uint32 xp, Unit* victim, float group_rate=1.0f);
1269  void GiveLevel(uint8 level);
1270 
1271  void InitStatsForLevel(bool reapplyMods = false);
1272 
1273  // .cheat command related
1274  bool GetCommandStatus(uint32 command) const { return (_activeCheats & command) != 0; }
1275  void SetCommandStatusOn(uint32 command) { _activeCheats |= command; }
1276  void SetCommandStatusOff(uint32 command) { _activeCheats &= ~command; }
1277 
1278  // Played Time Stuff
1279  time_t m_logintime;
1280  time_t m_Last_tick;
1281  uint32 m_Played_time[MAX_PLAYED_TIME_INDEX];
1282  uint32 GetTotalPlayedTime() const { return m_Played_time[PLAYED_TIME_TOTAL]; }
1283  uint32 GetLevelPlayedTime() const { return m_Played_time[PLAYED_TIME_LEVEL]; }
1284 
1285  void setDeathState(DeathState s) override; // overwrite Unit::setDeathState
1286 
1287  float GetRestBonus() const { return m_rest_bonus; }
1288  void SetRestBonus(float rest_bonus_new);
1289 
1290  bool HasRestFlag(RestFlag restFlag) const { return (_restFlagMask & restFlag) != 0; }
1291  void SetRestFlag(RestFlag restFlag, uint32 triggerId = 0);
1292  void RemoveRestFlag(RestFlag restFlag);
1293 
1294  uint32 GetXPRestBonus(uint32 xp);
1295  uint32 GetInnTriggerId() const { return inn_triggerId; }
1296 
1297  Pet* GetPet() const;
1298  Pet* SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 despwtime);
1299  void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false);
1300 
1302  void Say(std::string const& text, Language language, WorldObject const* = nullptr) override;
1304  void Yell(std::string const& text, Language language, WorldObject const* = nullptr) override;
1306  void TextEmote(std::string const& text, WorldObject const* = nullptr, bool = false) override;
1308  void Whisper(std::string const& text, Language language, Player* receiver, bool = false) override;
1309  void WhisperAddon(std::string const& text, std::string const& prefix, Player* receiver);
1310 
1311  /*********************************************************/
1312  /*** STORAGE SYSTEM ***/
1313  /*********************************************************/
1314 
1315  void SetVirtualItemSlot(uint8 i, Item* item);
1316  void SetSheath(SheathState sheathed) override; // overwrite Unit version
1317  uint8 FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const;
1318  uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = nullptr) const;
1319  uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = nullptr) const;
1320  Item* GetItemByGuid(ObjectGuid guid) const;
1321  Item* GetItemByEntry(uint32 entry) const;
1322  std::vector<Item*> GetItemListByEntry(uint32 entry, bool inBankAlso = false) const;
1323  Item* GetItemByPos(uint16 pos) const;
1324  Item* GetItemByPos(uint8 bag, uint8 slot) const;
1325  Item* GetUseableItemByPos(uint8 bag, uint8 slot) const;
1326  Bag* GetBagByPos(uint8 slot) const;
1327  Item* GetWeaponForAttack(WeaponAttackType attackType, bool useable = false) const;
1328  Item* GetShield(bool useable = false) const;
1329  static uint8 GetAttackBySlot(uint8 slot, InventoryType inventoryType); // MAX_ATTACK if not weapon slot
1330  std::vector<Item*> &GetItemUpdateQueue() { return m_itemUpdateQueue; }
1331  static bool IsInventoryPos(uint16 pos) { return IsInventoryPos(pos >> 8, pos & 255); }
1332  static bool IsInventoryPos(uint8 bag, uint8 slot);
1333  static bool IsEquipmentPos(uint16 pos) { return IsEquipmentPos(pos >> 8, pos & 255); }
1334  static bool IsEquipmentPos(uint8 bag, uint8 slot);
1335  static bool IsBagPos(uint16 pos);
1336  static bool IsBankPos(uint16 pos) { return IsBankPos(pos >> 8, pos & 255); }
1337  static bool IsBankPos(uint8 bag, uint8 slot);
1338  bool IsValidPos(uint16 pos, bool explicit_pos) const { return IsValidPos(pos >> 8, pos & 255, explicit_pos); }
1339  bool IsValidPos(uint8 bag, uint8 slot, bool explicit_pos) const;
1340  uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_BANK_BAG_SLOTS); }
1341  void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_BANK_BAG_SLOTS, count); }
1342  bool HasItemCount(uint32 item, uint32 count = 1, bool inBankAlso = false) const;
1343  bool HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem = nullptr) const;
1344  bool CanNoReagentCast(SpellInfo const* spellInfo) const;
1345  bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const;
1346  bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const;
1347  InventoryResult CanTakeMoreSimilarItems(Item* pItem, uint32* offendingItemId = nullptr) const { return CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem, nullptr, offendingItemId); }
1348  InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, uint32* offendingItemId = nullptr) const { return CanTakeMoreSimilarItems(entry, count, nullptr, nullptr, offendingItemId); }
1349  InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = nullptr) const;
1350  InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap = false) const;
1351  InventoryResult CanStoreItems(Item** items, int count, uint32* offendingItemId) const;
1352  InventoryResult CanEquipNewItem(uint8 slot, uint16& dest, uint32 item, bool swap) const;
1353  InventoryResult CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool swap, bool not_loading = true) const;
1354 
1355  InventoryResult CanEquipUniqueItem(Item* pItem, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
1356  InventoryResult CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
1357  InventoryResult CanUnequipItems(uint32 item, uint32 count) const;
1358  InventoryResult CanUnequipItem(uint16 src, bool swap) const;
1359  InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap, bool not_loading = true) const;
1360  InventoryResult CanUseItem(Item* pItem, bool not_loading = true) const;
1361  bool HasItemTotemCategory(uint32 TotemCategory) const;
1362  InventoryResult CanUseItem(ItemTemplate const* pItem) const;
1363  InventoryResult CanRollForItemInLFG(ItemTemplate const* item, WorldObject const* lootedObject) const;
1364  Item* StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool update, int32 randomPropertyId = 0, GuidSet const& allowedLooters = GuidSet(), std::vector<int32> const& bonusListIDs = std::vector<int32>());
1365  Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update);
1366  Item* EquipNewItem(uint16 pos, uint32 item, bool update);
1367  Item* EquipItem(uint16 pos, Item* pItem, bool update);
1368  void AutoUnequipOffhandIfNeed(bool force = false);
1369  bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count);
1370  void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, bool broadcast = false);
1371  void AutoStoreLoot(uint32 loot_id, LootStore const& store, bool broadcast = false) { AutoStoreLoot(NULL_BAG, NULL_SLOT, loot_id, store, broadcast); }
1372  void StoreLootItem(uint8 lootSlot, Loot* loot);
1373 
1374  InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = nullptr, uint32* offendingItemId = nullptr) const;
1375  InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = nullptr, bool swap = false, uint32* no_space_count = nullptr) const;
1376 
1377  void AddRefundReference(ObjectGuid it);
1378  void DeleteRefundReference(ObjectGuid it);
1379 
1381  void SendNewCurrency(uint32 id) const;
1383  void SendCurrencies() const;
1385  void SendPvpRewards() const;
1387  uint32 GetCurrency(uint32 id) const;
1389  uint32 GetCurrencyOnWeek(uint32 id) const;
1391  uint32 GetCurrencyWeekCap(uint32 id) const;
1393  bool HasCurrency(uint32 id, uint32 count) const;
1395  void SetCurrency(uint32 id, uint32 count, bool printLog = true);
1396  void ResetCurrencyWeekCap();
1397 
1407  void ModifyCurrency(uint32 id, int32 count, bool printLog = true, bool ignoreMultipliers = false);
1408 
1409  void ApplyEquipCooldown(Item* pItem);
1410  void QuickEquipItem(uint16 pos, Item* pItem);
1411  void VisualizeItem(uint8 slot, Item* pItem);
1412  void SetVisibleItemSlot(uint8 slot, Item* pItem);
1413  Item* BankItem(ItemPosCountVec const& dest, Item* pItem, bool update);
1414  void RemoveItem(uint8 bag, uint8 slot, bool update);
1415  void MoveItemFromInventory(uint8 bag, uint8 slot, bool update);
1416  // in trade, auction, guild bank, mail....
1417  void MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool update, bool in_characterInventoryDB = false);
1418  // in trade, guild bank, mail....
1419  void RemoveItemDependentAurasAndCasts(Item* pItem);
1420  void DestroyItem(uint8 bag, uint8 slot, bool update);
1421  void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check = false);
1422  void DestroyItemCount(Item* item, uint32& count, bool update);
1423  void DestroyConjuredItems(bool update);
1424  void DestroyZoneLimitedItem(bool update, uint32 new_zone);
1425  void SplitItem(uint16 src, uint16 dst, uint32 count);
1426  void SwapItem(uint16 src, uint16 dst);
1427  void AddItemToBuyBackSlot(Item* pItem);
1428  Item* GetItemFromBuyBackSlot(uint32 slot);
1429  void RemoveItemFromBuyBackSlot(uint32 slot, bool del);
1430  void SendEquipError(InventoryResult msg, Item* item1 = nullptr, Item* item2 = nullptr, uint32 itemId = 0) const;
1431  void SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param) const;
1432  void SendSellError(SellResult msg, Creature* creature, ObjectGuid guid) const;
1433  void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; }
1434  void AddArmorProficiency(uint32 newflag) { m_ArmorProficiency |= newflag; }
1435  uint32 GetWeaponProficiency() const { return m_WeaponProficiency; }
1436  uint32 GetArmorProficiency() const { return m_ArmorProficiency; }
1437  bool IsUseEquipedWeapon(bool mainhand) const;
1438  bool IsTwoHandUsed() const;
1439  void SendNewItem(Item* item, uint32 quantity, bool received, bool created, bool broadcast = false);
1440  bool BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
1441  bool BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorSlot, uint32 currency, uint32 count);
1442  bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
1443 
1444  float GetReputationPriceDiscount(Creature const* creature) const;
1445 
1446  Player* GetTrader() const { return m_trade ? m_trade->GetTrader() : nullptr; }
1447  TradeData* GetTradeData() const { return m_trade; }
1448  void TradeCancel(bool sendback);
1449 
1450  void UpdateEnchantTime(uint32 time);
1451  void UpdateSoulboundTradeItems();
1452  void AddTradeableItem(Item* item);
1453  void RemoveTradeableItem(Item* item);
1454  void UpdateItemDuration(uint32 time, bool realtimeonly = false);
1455  void AddEnchantmentDurations(Item* item);
1456  void RemoveEnchantmentDurations(Item* item);
1457  void RemoveArenaEnchantments(EnchantmentSlot slot);
1458  void AddEnchantmentDuration(Item* item, EnchantmentSlot slot, uint32 duration);
1459  void ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool apply_dur = true, bool ignore_condition = false);
1460  void ApplyEnchantment(Item* item, bool apply);
1461  void UpdateSkillEnchantments(uint16 skill_id, uint16 curr_value, uint16 new_value);
1462  void SendEnchantmentDurations();
1463  void AddItemDurations(Item* item);
1464  void RemoveItemDurations(Item* item);
1465  void SendItemDurations();
1466  void LoadCorpse(PreparedQueryResult result);
1467  void LoadPet();
1468 
1469  bool AddItem(uint32 itemId, uint32 count);
1470 
1471  uint32 m_stableSlots;
1472 
1473  /*********************************************************/
1474  /*** GOSSIP SYSTEM ***/
1475  /*********************************************************/
1476 
1477  void PrepareGossipMenu(WorldObject* source, uint32 menuId = 0, bool showQuests = false);
1478  void SendPreparedGossip(WorldObject* source);
1479  void OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 menuId);
1480 
1481  uint32 GetGossipTextId(uint32 menuId, WorldObject* source);
1482  uint32 GetGossipTextId(WorldObject* source);
1483  static uint32 GetDefaultGossipMenuForSource(WorldObject* source);
1484 
1485  /*********************************************************/
1486  /*** QUEST SYSTEM ***/
1487  /*********************************************************/
1488 
1489  int32 GetQuestLevel(Quest const* quest) const { return quest && (quest->GetQuestLevel() > 0) ? quest->GetQuestLevel() : getLevel(); }
1490 
1491  void PrepareQuestMenu(ObjectGuid guid);
1492  void SendPreparedQuest(ObjectGuid guid);
1493  bool IsActiveQuest(uint32 quest_id) const;
1494  Quest const* GetNextQuest(ObjectGuid guid, Quest const* quest) const;
1495  bool CanSeeStartQuest(Quest const* quest);
1496  bool CanTakeQuest(Quest const* quest, bool msg);
1497  bool CanAddQuest(Quest const* quest, bool msg) const;
1498  bool CanCompleteQuest(uint32 quest_id);
1499  bool CanCompleteRepeatableQuest(Quest const* quest);
1500  bool CanRewardQuest(Quest const* quest, bool msg);
1501  bool CanRewardQuest(Quest const* quest, uint32 reward, bool msg);
1502  void AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver);
1503  void AddQuest(Quest const* quest, Object* questGiver);
1504  void CompleteQuest(uint32 quest_id);
1505  void IncompleteQuest(uint32 quest_id);
1506  uint32 GetQuestMoneyReward(Quest const* quest) const;
1507  uint32 GetQuestXPReward(Quest const* quest);
1508  void RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, bool announce = true);
1509  void FailQuest(uint32 quest_id);
1510  bool SatisfyQuestSkill(Quest const* qInfo, bool msg) const;
1511  bool SatisfyQuestLevel(Quest const* qInfo, bool msg) const;
1512  bool SatisfyQuestLog(bool msg) const;
1513  bool SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg);
1514  bool SatisfyQuestClass(Quest const* qInfo, bool msg) const;
1515  bool SatisfyQuestRace(Quest const* qInfo, bool msg) const;
1516  bool SatisfyQuestReputation(Quest const* qInfo, bool msg);
1517  bool SatisfyQuestStatus(Quest const* qInfo, bool msg) const;
1518  bool SatisfyQuestConditions(Quest const* qInfo, bool msg);
1519  bool SatisfyQuestTimed(Quest const* qInfo, bool msg) const;
1520  bool SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg);
1521  bool SatisfyQuestNextChain(Quest const* qInfo, bool msg) const;
1522  bool SatisfyQuestPrevChain(Quest const* qInfo, bool msg);
1523  bool SatisfyQuestDay(Quest const* qInfo, bool msg) const;
1524  bool SatisfyQuestWeek(Quest const* qInfo, bool msg);
1525  bool SatisfyQuestMonth(Quest const* qInfo, bool msg);
1526  bool SatisfyQuestSeasonal(Quest const* qInfo, bool msg);
1527  bool GiveQuestSourceItem(Quest const* quest);
1528  bool TakeQuestSourceItem(uint32 questId, bool msg);
1529  bool GetQuestRewardStatus(uint32 quest_id) const;
1530  QuestStatus GetQuestStatus(uint32 quest_id) const;
1531  void SetQuestStatus(uint32 questId, QuestStatus status, bool update = true);
1532  void RemoveActiveQuest(uint32 questId, bool update = true);
1533  void RemoveRewardedQuest(uint32 questId, bool update = true);
1534  void SendQuestUpdate(uint32 questId);
1535  QuestGiverStatus GetQuestDialogStatus(Object* questGiver);
1536 
1537  void SetDailyQuestStatus(uint32 quest_id);
1538  void SetWeeklyQuestStatus(uint32 quest_id);
1539  void SetMonthlyQuestStatus(uint32 quest_id);
1540  void SetSeasonalQuestStatus(uint32 quest_id);
1541  void DailyReset();
1542  void ResetWeeklyQuestStatus();
1543  void ResetMonthlyQuestStatus();
1544  void ResetSeasonalQuestStatus(uint16 event_id);
1545 
1546  uint16 FindQuestSlot(uint32 quest_id) const;
1547  uint32 GetQuestSlotQuestId(uint16 slot) const;
1548  uint32 GetQuestSlotState(uint16 slot) const;
1549  uint16 GetQuestSlotCounter(uint16 slot, uint8 counter) const;
1550  uint32 GetQuestSlotTime(uint16 slot) const;
1551  void SetQuestSlot(uint16 slot, uint32 quest_id, uint32 timer = 0);
1552  void SetQuestSlotCounter(uint16 slot, uint8 counter, uint16 count);
1553  void SetQuestSlotState(uint16 slot, uint32 state);
1554  void RemoveQuestSlotState(uint16 slot, uint32 state);
1555  void SetQuestSlotTimer(uint16 slot, uint32 timer);
1556  void SetQuestCompletedBit(uint32 questBit, bool completed);
1557 
1558  uint16 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) const;
1559  void AreaExploredOrEventHappens(uint32 questId);
1560  void GroupEventHappens(uint32 questId, WorldObject const* pEventObject);
1561  void ItemAddedQuestCheck(uint32 entry, uint32 count);
1562  void ItemRemovedQuestCheck(uint32 entry, uint32 count);
1563  void KilledMonster(CreatureTemplate const* cInfo, ObjectGuid guid);
1564  void KilledMonsterCredit(uint32 entry, ObjectGuid guid = ObjectGuid::Empty);
1565  void KilledPlayerCredit();
1566  void KillCreditGO(uint32 entry, ObjectGuid guid = ObjectGuid::Empty);
1567  void TalkedToCreature(uint32 entry, ObjectGuid guid);
1568  void MoneyChanged(uint64 value);
1569  void ReputationChanged(FactionEntry const* factionEntry);
1570  void CurrencyChanged(uint32 currencyId, int32 change);
1571  bool HasQuestForItem(uint32 itemId) const;
1572  bool HasQuestForGO(int32 goId) const;
1573  void UpdateForQuestWorldObjects();
1574  bool CanShareQuest(uint32 questId) const;
1575 
1576  int32 GetQuestObjectiveData(Quest const* quest, int8 storageIndex) const;
1577  void SetQuestObjectiveData(Quest const* quest, int8 storageIndex, int32 data);
1578  void SendQuestComplete(Quest const* quest) const;
1579  void SendQuestReward(Quest const* quest, uint32 XP) const;
1580  void SendQuestFailed(uint32 questID, InventoryResult reason = EQUIP_ERR_OK) const;
1581  void SendQuestTimerFailed(uint32 questID) const;
1582  void SendCanTakeQuestResponse(QuestFailedReason reason, bool sendErrorMessage = true, std::string reasonText = "") const;
1583  void SendQuestConfirmAccept(Quest const* quest, Player* receiver) const;
1584  void SendPushToPartyResponse(Player* player, QuestPushReason reason) const;
1585  void SendQuestUpdateAddCredit(Quest const* quest, ObjectGuid guid, QuestObjective const& obj, uint16 count) const;
1586  void SendQuestUpdateAddPlayer(Quest const* quest, uint16 newCount, uint32 required) const;
1587 
1588  ObjectGuid GetDivider() const { return m_divider; }
1589  void SetDivider(ObjectGuid guid) { m_divider = guid; }
1590 
1591  uint32 GetInGameTime() const { return m_ingametime; }
1592  void SetInGameTime(uint32 time) { m_ingametime = time; }
1593 
1594  void AddTimedQuest(uint32 questId) { m_timedquests.insert(questId); }
1595  void RemoveTimedQuest(uint32 questId) { m_timedquests.erase(questId); }
1596 
1597  void SaveCUFProfile(uint8 id, std::nullptr_t) { _CUFProfiles[id] = nullptr; }
1598  void SaveCUFProfile(uint8 id, std::unique_ptr<CUFProfile> profile) { _CUFProfiles[id] = std::move(profile); }
1599  CUFProfile* GetCUFProfile(uint8 id) const { return _CUFProfiles[id].get(); }
1600  uint8 GetCUFProfilesCount() const
1601  {
1602  uint8 count = 0;
1603  for (uint8 i = 0; i < MAX_CUF_PROFILES; ++i)
1604  if (_CUFProfiles[i])
1605  ++count;
1606  return count;
1607  }
1608 
1609  bool HasPvPForcingQuest() const;
1610 
1611  /*********************************************************/
1612  /*** LOAD SYSTEM ***/
1613  /*********************************************************/
1614 
1615  bool LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder);
1616  bool IsLoading() const override;
1617 
1618  static uint32 GetUInt32ValueFromArray(Tokenizer const& data, uint16 index);
1619  static float GetFloatValueFromArray(Tokenizer const& data, uint16 index);
1620  static uint32 GetZoneIdFromDB(ObjectGuid guid);
1621  static uint32 GetLevelFromDB(ObjectGuid guid);
1622  static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, ObjectGuid guid);
1623 
1624  static bool IsValidGender(uint8 Gender) { return Gender <= GENDER_FEMALE; }
1625  static bool IsValidClass(uint8 Class) { return ((1 << (Class - 1)) & CLASSMASK_ALL_PLAYABLE) != 0; }
1626  static bool IsValidRace(uint8 Race) { return ((1 << (Race - 1)) & RACEMASK_ALL_PLAYABLE) != 0; }
1627  static bool ValidateAppearance(uint8 race, uint8 class_, uint8 gender, uint8 hairID, uint8 hairColor, uint8 faceID, uint8 facialHair, uint8 skinColor, bool create = false);
1628 
1629  /*********************************************************/
1630  /*** SAVE SYSTEM ***/
1631  /*********************************************************/
1632 
1633  void SaveToDB(bool create = false);
1634  void SaveInventoryAndGoldToDB(SQLTransaction& trans); // fast save function for item/money cheating preventing
1635  void SaveGoldToDB(SQLTransaction& trans) const;
1636 
1637  static void SetUInt32ValueInArray(Tokenizer& data, uint16 index, uint32 value);
1638  static void SavePositionInDB(WorldLocation const& loc, uint16 zoneId, ObjectGuid guid, SQLTransaction& trans);
1639 
1640  static void DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRealmChars = true, bool deleteFinally = false);
1641  static void DeleteOldCharacters();
1642  static void DeleteOldCharacters(uint32 keepDays);
1643 
1644  bool m_mailsLoaded;
1645  bool m_mailsUpdated;
1646 
1647  void SetBindPoint(ObjectGuid guid) const;
1648  void SendRespecWipeConfirm(ObjectGuid const& guid, uint32 cost) const;
1649  void ResetPetTalents();
1650  void RegenerateAll();
1651  void Regenerate(Powers power);
1652  void RegenerateHealth();
1653  void setRegenTimerCount(uint32 time) {m_regenTimerCount = time;}
1654  void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;}
1655 
1656  uint64 GetMoney() const { return GetUInt64Value(PLAYER_FIELD_COINAGE); }
1657  bool ModifyMoney(int64 amount, bool sendError = true);
1658  bool HasEnoughMoney(uint64 amount) const { return (GetMoney() >= amount); }
1659  bool HasEnoughMoney(int64 amount) const;
1660  void SetMoney(uint64 value);
1661 
1662  RewardedQuestSet const& getRewardedQuests() const { return m_RewardedQuests; }
1663  QuestStatusMap& getQuestStatusMap() { return m_QuestStatus; }
1664 
1665  size_t GetRewardedQuestCount() const { return m_RewardedQuests.size(); }
1666  bool IsQuestRewarded(uint32 quest_id) const;
1667 
1668  Unit* GetSelectedUnit() const;
1669  Player* GetSelectedPlayer() const;
1670 
1671  void SetTarget(ObjectGuid const& /*guid*/) override { }
1672  void SetSelection(ObjectGuid const& guid) { SetGuidValue(UNIT_FIELD_TARGET, guid); }
1673 
1674  uint32 GetComboPoints() const { return uint32(GetPower(POWER_COMBO_POINTS)); }
1675  void AddComboPoints(int8 count, Spell* spell = nullptr);
1676  void GainSpellComboPoints(int8 count);
1677  void ClearComboPoints();
1678 
1679  void SendMailResult(uint32 mailId, MailResponseType mailAction, MailResponseResult mailError, uint32 equipError = 0, ObjectGuid::LowType item_guid = UI64LIT(0), uint32 item_count = 0) const;
1680  void SendNewMail() const;
1681  void UpdateNextMailTimeAndUnreads();
1682  void AddNewMailDeliverTime(time_t deliver_time);
1683  bool IsMailsLoaded() const { return m_mailsLoaded; }
1684 
1685  void RemoveMail(uint32 id);
1686 
1687  void AddMail(Mail* mail) { m_mail.push_front(mail);}// for call from WorldSession::SendMailTo
1688  uint32 GetMailSize() const { return uint32(m_mail.size()); }
1689  Mail* GetMail(uint32 id);
1690 
1691  PlayerMails const& GetMails() const { return m_mail; }
1692 
1693  void SendItemRetrievalMail(uint32 itemEntry, uint32 count); // Item retrieval mails sent by The Postmaster (34337), used in multiple places.
1694 
1695  /*********************************************************/
1696  /*** MAILED ITEMS SYSTEM ***/
1697  /*********************************************************/
1698 
1699  uint8 unReadMails;
1700  time_t m_nextMailDelivereTime;
1701 
1702  typedef std::unordered_map<ObjectGuid::LowType, Item*> ItemMap;
1703 
1704  ItemMap mMitems; //template defined in objectmgr.cpp
1705 
1706  Item* GetMItem(ObjectGuid::LowType id);
1707  void AddMItem(Item* it);
1708  bool RemoveMItem(ObjectGuid::LowType id);
1709 
1710  void SendOnCancelExpectedVehicleRideAura() const;
1711  void PetSpellInitialize();
1712  void CharmSpellInitialize();
1713  void PossessSpellInitialize();
1714  void VehicleSpellInitialize();
1715  void SendRemoveControlBar() const;
1716  bool HasSpell(uint32 spell) const override;
1717  bool HasActiveSpell(uint32 spell) const; // show in spellbook
1718  SpellInfo const* GetCastSpellInfo(SpellInfo const* spellInfo) const override;
1719  TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const;
1720  bool IsSpellFitByClassAndRace(uint32 spell_id) const;
1721  bool IsNeedCastPassiveSpellAtLearn(SpellInfo const* spellInfo) const;
1722  bool IsCurrentSpecMasterySpell(SpellInfo const* spellInfo) const;
1723 
1724  void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask) const;
1725  void SendKnownSpells();
1726  bool AddSpell(uint32 spellId, bool active, bool learning, bool dependent, bool disabled, bool loading = false, uint32 fromSkill = 0);
1727  void LearnSpell(uint32 spell_id, bool dependent, uint32 fromSkill = 0);
1728  void RemoveSpell(uint32 spell_id, bool disabled = false, bool learn_low_rank = true);
1729  void ResetSpells(bool myClassOnly = false);
1730  void LearnCustomSpells();
1731  void LearnDefaultSkills();
1732  void LearnDefaultSkill(SkillRaceClassInfoEntry const* rcInfo);
1733  void LearnQuestRewardedSpells();
1734  void LearnQuestRewardedSpells(Quest const* quest);
1735  void LearnSpellHighestRank(uint32 spellid);
1736  void AddTemporarySpell(uint32 spellId);
1737  void RemoveTemporarySpell(uint32 spellId);
1738  void AddOverrideSpell(uint32 overridenSpellId, uint32 newSpellId);
1739  void RemoveOverrideSpell(uint32 overridenSpellId, uint32 newSpellId);
1740  void LearnSpecializationSpells();
1741  void RemoveSpecializationSpells();
1742  void SendSpellCategoryCooldowns() const;
1743 
1744  void SetReputation(uint32 factionentry, uint32 value);
1745  uint32 GetReputation(uint32 factionentry) const;
1746  std::string GetGuildName() const;
1747 
1748  // Loot Spec
1749  void SetLootSpecId(uint32 id) { SetUInt32Value(PLAYER_FIELD_LOOT_SPEC_ID, id); }
1750  uint32 GetLootSpecId() const { return GetUInt32Value(PLAYER_FIELD_LOOT_SPEC_ID); }
1751 
1752  // Talents
1753  uint32 GetTalentResetCost() const { return _talentMgr->ResetTalentsCost; }
1754  void SetTalentResetCost(uint32 cost) { _talentMgr->ResetTalentsCost = cost; }
1755  time_t GetTalentResetTime() const { return _talentMgr->ResetTalentsTime; }
1756  void SetTalentResetTime(time_t time_) { _talentMgr->ResetTalentsTime = time_; }
1757  uint32 GetSpecId(uint8 group) const { return _talentMgr->GroupInfo[group].SpecId; }
1758  void SetSpecId(uint8 group, uint32 tree) { _talentMgr->GroupInfo[group].SpecId = tree; }
1759  uint8 GetActiveTalentGroup() const { return _talentMgr->ActiveGroup; }
1760  void SetActiveTalentGroup(uint8 group){ _talentMgr->ActiveGroup = group; }
1761  uint8 GetTalentGroupsCount() const { return _talentMgr->GroupsCount; }
1762  void SetTalentGroupsCount(uint8 count) { _talentMgr->GroupsCount = count; }
1763  uint32 GetDefaultSpecId() const;
1764 
1765  bool ResetTalents(bool noCost = false);
1766  uint32 GetNextResetTalentsCost() const;
1767  void InitTalentForLevel();
1768  void SendTalentsInfoData();
1769  bool LearnTalent(uint32 talentId);
1770  bool AddTalent(TalentEntry const* talent, uint8 spec, bool learning);
1771  bool HasTalent(uint32 spell_id, uint8 spec) const;
1772  void RemoveTalent(TalentEntry const* talent);
1773  uint32 CalculateTalentsTiers() const;
1774  void LearnTalentSpecialization(uint32 talentSpec);
1775  void ResetTalentSpecialization();
1776 
1777  // Dual Spec
1778  void UpdateTalentGroupCount(uint8 count);
1779  void ActivateTalentGroup(uint8 group);
1780 
1781  void InitGlyphsForLevel();
1782  void SetGlyphSlot(uint8 slot, uint32 slottype) { SetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot, slottype); }
1783 
1784  uint32 GetGlyphSlot(uint8 slot) const { return GetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot); }
1785  void SetGlyph(uint8 slot, uint32 glyph);
1786  uint32 GetGlyph(uint8 group, uint8 slot) const { return _talentMgr->GroupInfo[group].Glyphs[slot]; }
1787 
1788  PlayerTalentMap const* GetTalentMap(uint8 spec) const { return _talentMgr->GroupInfo[spec].Talents; }
1789  PlayerTalentMap* GetTalentMap(uint8 spec) { return _talentMgr->GroupInfo[spec].Talents; }
1790  ActionButtonList const& GetActionButtons() const { return m_actionButtons; }
1791 
1792  uint32 GetFreePrimaryProfessionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS); }
1793  void SetFreePrimaryProfessions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS, profs); }
1794  void InitPrimaryProfessions();
1795 
1796  PlayerSpellMap const& GetSpellMap() const { return m_spells; }
1797  PlayerSpellMap & GetSpellMap() { return m_spells; }
1798 
1799  void AddSpellMod(SpellModifier* mod, bool apply);
1800  bool IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod, Spell* spell = nullptr) const;
1801  template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell = nullptr);
1802  void RemoveSpellMods(Spell* spell);
1803  void RestoreSpellMods(Spell* spell, uint32 ownerAuraId = 0, Aura* aura = nullptr);
1804  void RestoreAllSpellMods(uint32 ownerAuraId = 0, Aura* aura = nullptr);
1805  void DropModCharge(SpellModifier* mod, Spell* spell);
1806  void SetSpellModTakingSpell(Spell* spell, bool apply);
1807 
1808  void RemoveArenaSpellCooldowns(bool removeActivePetCooldowns = false);
1809  uint32 GetLastPotionId() const { return m_lastPotionId; }
1810  void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; }
1811  void UpdatePotionCooldown(Spell* spell = nullptr);
1812 
1813  void SetResurrectRequestData(Unit* caster, uint32 health, uint32 mana, uint32 appliedAura);
1814  void ClearResurrectRequestData()
1815  {
1816  _resurrectionData.reset();
1817  }
1818 
1819  bool IsResurrectRequestedBy(ObjectGuid const& guid) const
1820  {
1821  if (!IsResurrectRequested())
1822  return false;
1823 
1824  return !_resurrectionData->GUID.IsEmpty() && _resurrectionData->GUID == guid;
1825  }
1826 
1827  bool IsResurrectRequested() const { return _resurrectionData.get() != nullptr; }
1828  void ResurrectUsingRequestData();
1829  void ResurrectUsingRequestDataImpl();
1830 
1831  uint8 getCinematic() const { return m_cinematic; }
1832  void setCinematic(uint8 cine) { m_cinematic = cine; }
1833 
1834  ActionButton* AddActionButton(uint8 button, uint32 action, uint8 type);
1835  void RemoveActionButton(uint8 button);
1836  ActionButton const* GetActionButton(uint8 button);
1837  void SendInitialActionButtons() const { SendActionButtons(0); }
1838  void SendActionButtons(uint32 state) const;
1839  bool IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) const;
1840 
1841  PvPInfo pvpInfo;
1842  void UpdatePvPState(bool onlyFFA = false);
1843  void SetPvP(bool state) override;
1844  void UpdatePvP(bool state, bool override=false);
1845  void UpdateZone(uint32 newZone, uint32 newArea);
1846  void UpdateArea(uint32 newArea);
1847  void UpdateZoneDependentAuras(uint32 zone_id); // zones
1848  void UpdateAreaDependentAuras(uint32 area_id); // subzones
1849 
1850  void UpdateAfkReport(time_t currTime);
1851  void UpdatePvPFlag(time_t currTime);
1852  void UpdateContestedPvP(uint32 currTime);
1853  void SetContestedPvPTimer(uint32 newTime) {m_contestedPvPTimer = newTime;}
1854  void ResetContestedPvP();
1855 
1857  DuelInfo* duel;
1858  void UpdateDuelFlag(time_t currTime);
1859  void CheckDuelDistance(time_t currTime);
1860  void DuelComplete(DuelCompleteType type);
1861 
1862  bool IsGroupVisibleFor(Player const* p) const;
1863  bool IsInSameGroupWith(Player const* p) const;
1864  bool IsInSameRaidWith(Player const* p) const;
1865  void UninviteFromGroup();
1866  static void RemoveFromGroup(Group* group, ObjectGuid guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker = ObjectGuid::Empty, const char* reason = nullptr);
1867  void RemoveFromGroup(RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT) { RemoveFromGroup(GetGroup(), GetGUID(), method); }
1868  void SendUpdateToOutOfRangeGroupMembers();
1869 
1870  void SetInGuild(ObjectGuid::LowType guildId);
1871  void SetRank(uint8 rankId) { SetUInt32Value(PLAYER_GUILDRANK, rankId); }
1872  uint8 GetRank() const { return uint8(GetUInt32Value(PLAYER_GUILDRANK)); }
1873  void SetGuildLevel(uint32 level) { SetUInt32Value(PLAYER_GUILDLEVEL, level); }
1874  uint32 GetGuildLevel() const { return GetUInt32Value(PLAYER_GUILDLEVEL); }
1875  void SetGuildIdInvited(ObjectGuid::LowType GuildId) { m_GuildIdInvited = GuildId; }
1876  ObjectGuid::LowType GetGuildId() const { return GetUInt64Value(OBJECT_FIELD_DATA); /* return only lower part */ }
1877  Guild* GetGuild();
1878  Guild const* GetGuild() const;
1879  static ObjectGuid::LowType GetGuildIdFromDB(ObjectGuid guid);
1880  static uint8 GetRankFromDB(ObjectGuid guid);
1881  ObjectGuid::LowType GetGuildIdInvited() const { return m_GuildIdInvited; }
1882  static void RemovePetitionsAndSigns(ObjectGuid guid);
1883 
1884  // Arena Team
1885  void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, uint8 type);
1886  void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value);
1887  static uint32 GetArenaTeamIdFromDB(ObjectGuid guid, uint8 slot);
1888  static void LeaveAllArenaTeams(ObjectGuid guid);
1889  uint32 GetArenaTeamId(uint8 slot) const { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID); }
1890  uint32 GetArenaPersonalRating(uint8 slot) const { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING); }
1891  void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; }
1892  uint32 GetArenaTeamIdInvited() const { return m_ArenaTeamIdInvited; }
1893  uint32 GetRBGPersonalRating() const { return 0; }
1894 
1895  Difficulty GetDifficultyID(MapEntry const* mapEntry) const;
1896  Difficulty GetDungeonDifficultyID() const { return m_dungeonDifficulty; }
1897  Difficulty GetRaidDifficultyID() const { return m_raidDifficulty; }
1898  Difficulty GetLegacyRaidDifficultyID() const { return m_legacyRaidDifficulty; }
1899  void SetDungeonDifficultyID(Difficulty dungeon_difficulty) { m_dungeonDifficulty = dungeon_difficulty; }
1900  void SetRaidDifficultyID(Difficulty raid_difficulty) { m_raidDifficulty = raid_difficulty; }
1901  void SetLegacyRaidDifficultyID(Difficulty raid_difficulty) { m_legacyRaidDifficulty = raid_difficulty; }
1902  static Difficulty CheckLoadedDungeonDifficultyID(Difficulty difficulty);
1903  static Difficulty CheckLoadedRaidDifficultyID(Difficulty difficulty);
1904  static Difficulty CheckLoadedLegacyRaidDifficultyID(Difficulty difficulty);
1905  void SendRaidGroupOnlyMessage(RaidGroupReason reason, int32 delay) const;
1906 
1907  bool UpdateSkill(uint32 skill_id, uint32 step);
1908  bool UpdateSkillPro(uint16 skillId, int32 chance, uint32 step);
1909 
1910  bool UpdateCraftSkill(uint32 spellid);
1911  bool UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLevel, uint32 Multiplicator = 1);
1912  bool UpdateFishingSkill();
1913 
1914  float GetHealthBonusFromStamina();
1915 
1916  bool UpdateStats(Stats stat) override;
1917  bool UpdateAllStats() override;
1918  void ApplySpellPenetrationBonus(int32 amount, bool apply);
1919  void UpdateResistances(uint32 school) override;
1920  void UpdateArmor() override;
1921  void UpdateMaxHealth() override;
1922  void UpdateMaxPower(Powers power) override;
1923  void UpdateAttackPowerAndDamage(bool ranged = false) override;
1924  void ApplySpellPowerBonus(int32 amount, bool apply);
1925  void UpdateSpellDamageAndHealingBonus();
1926  void ApplyRatingMod(CombatRating cr, int32 value, bool apply);
1927  void UpdateRating(CombatRating cr);
1928  void UpdateAllRatings();
1929  void UpdateMastery();
1930  bool CanUseMastery() const;
1931 
1932  void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage) override;
1933 
1934  void RecalculateRating(CombatRating cr) { ApplyRatingMod(cr, 0, true);}
1935  float GetMeleeCritFromAgility() const;
1936  void GetDodgeFromAgility(float &diminishing, float &nondiminishing) const;
1937  float GetSpellCritFromIntellect() const;
1938  float OCTRegenMPPerSpirit() const;
1939  float GetRatingMultiplier(CombatRating cr) const;
1940  float GetRatingBonusValue(CombatRating cr) const;
1941 
1943  uint32 GetBaseSpellPowerBonus() const { return m_baseSpellPower; }
1944  int32 GetSpellPenetrationItemMod() const { return m_spellPenetrationItemMod; }
1945 
1946  float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const;
1947  void UpdateBlockPercentage();
1948  void UpdateCritPercentage(WeaponAttackType attType);
1949  void UpdateAllCritPercentages();
1950  void UpdateParryPercentage();
1951  void UpdateDodgePercentage();
1952  void UpdateMeleeHitChances();
1953  void UpdateRangedHitChances();
1954  void UpdateSpellHitChances();
1955 
1956  void UpdateAllSpellCritChances();
1957  void UpdateSpellCritChance(uint32 school);
1958  void UpdateArmorPenetration(int32 amount);
1959  void UpdateExpertise(WeaponAttackType attType);
1960  void ApplyManaRegenBonus(int32 amount, bool apply);
1961  void ApplyHealthRegenBonus(int32 amount, bool apply);
1962  void UpdateManaRegen();
1963  void UpdateRuneRegen(RuneType rune);
1964  uint32 GetRuneTimer(uint8 index) const { return m_runeGraceCooldown[index]; }
1965  void SetRuneTimer(uint8 index, uint32 timer) { m_runeGraceCooldown[index] = timer; }
1966  uint32 GetLastRuneGraceTimer(uint8 index) const { return m_lastRuneGraceTimers[index]; }
1967  void SetLastRuneGraceTimer(uint8 index, uint32 timer) { m_lastRuneGraceTimers[index] = timer; }
1968  void UpdateAllRunesRegen();
1969 
1970  ObjectGuid const& GetLootGUID() const { return GetGuidValue(PLAYER_LOOT_TARGET_GUID); }
1971  void SetLootGUID(ObjectGuid const& guid) { SetGuidValue(PLAYER_LOOT_TARGET_GUID, guid); }
1972 
1973  void RemovedInsignia(Player* looterPlr);
1974 
1975  WorldSession* GetSession() const { return m_session; }
1976 
1977  void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const override;
1978  void DestroyForPlayer(Player* target) const override;
1979 
1980  // notifiers
1981  void SendAttackSwingCantAttack() const;
1982  void SendAttackSwingCancelAttack() const;
1983  void SendAttackSwingDeadTarget() const;
1984  void SendAttackSwingNotInRange() const;
1985  void SendAttackSwingBadFacingAttack() const;
1986  void SendAutoRepeatCancel(Unit* target);
1987  void SendExplorationExperience(uint32 Area, uint32 Experience) const;
1988 
1989  void SendDungeonDifficulty(int32 forcedDifficulty = -1) const;
1990  void SendRaidDifficulty(bool legacy, int32 forcedDifficulty = -1) const;
1991  void ResetInstances(uint8 method, bool isRaid, bool isLegacy);
1992  void SendResetInstanceSuccess(uint32 MapId) const;
1993  void SendResetInstanceFailed(ResetFailedReason reason, uint32 mapID) const;
1994  void SendResetFailedNotify(uint32 mapid) const;
1995 
1996  bool UpdatePosition(float x, float y, float z, float orientation, bool teleport = false) override;
1997  bool UpdatePosition(const Position &pos, bool teleport = false) override { return UpdatePosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }
1998  void UpdateUnderwaterState(Map* m, float x, float y, float z) override;
1999 
2000  void SendMessageToSet(WorldPacket const* data, bool self) override { SendMessageToSetInRange(data, GetVisibilityRange(), self); }
2001  void SendMessageToSetInRange(WorldPacket const* data, float dist, bool self) override;
2002  void SendMessageToSetInRange(WorldPacket const* data, float dist, bool self, bool own_team_only);
2003  void SendMessageToSet(WorldPacket const* data, Player const* skipped_rcvr) override;
2004 
2005  Corpse* GetCorpse() const;
2006  void SpawnCorpseBones(bool triggerSave = true);
2007  Corpse* CreateCorpse();
2008  void KillPlayer();
2009  static void OfflineResurrect(ObjectGuid const& guid, SQLTransaction& trans);
2010  bool HasCorpse() const { return _corpseLocation.GetMapId() != MAPID_INVALID; }
2011  WorldLocation GetCorpseLocation() const { return _corpseLocation; }
2012  uint32 GetResurrectionSpellId() const;
2013  void ResurrectPlayer(float restore_percent, bool applySickness = false);
2014  void BuildPlayerRepop();
2015  void RepopAtGraveyard();
2016 
2017  void DurabilityLossAll(double percent, bool inventory);
2018  void DurabilityLoss(Item* item, double percent);
2019  void DurabilityPointsLossAll(int32 points, bool inventory);
2020  void DurabilityPointsLoss(Item* item, int32 points);
2021  void DurabilityPointLossForEquipSlot(EquipmentSlots slot);
2022  uint32 DurabilityRepairAll(bool cost, float discountMod, bool guildBank);
2023  uint32 DurabilityRepair(uint16 pos, bool cost, float discountMod, bool guildBank);
2024 
2025  void UpdateMirrorTimers();
2026  void StopMirrorTimers();
2027  bool IsMirrorTimerActive(MirrorTimerType type) const;
2028 
2029  bool CanJoinConstantChannelInZone(ChatChannelsEntry const* channel, AreaTableEntry const* zone) const;
2030 
2031  void JoinedChannel(Channel* c);
2032  void LeftChannel(Channel* c);
2033  void CleanupChannels();
2034  void UpdateLocalChannels(uint32 newZone);
2035  void LeaveLFGChannel();
2036 
2037  void SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal);
2038  uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus + temp bonus
2039  uint16 GetPureMaxSkillValue(uint32 skill) const; // max
2040  uint16 GetSkillValue(uint32 skill) const; // skill value + perm. bonus + temp bonus
2041  uint16 GetBaseSkillValue(uint32 skill) const; // skill value + perm. bonus
2042  uint16 GetPureSkillValue(uint32 skill) const; // skill value
2043  int16 GetSkillPermBonusValue(uint32 skill) const;
2044  int16 GetSkillTempBonusValue(uint32 skill) const;
2045  uint16 GetSkillStep(uint16 skill) const; // 0...6
2046  bool HasSkill(uint32 skill) const;
2047  void LearnSkillRewardedSpells(uint32 skillId, uint32 skillValue);
2048 
2049  WorldLocation& GetTeleportDest() { return m_teleport_dest; }
2050  bool IsBeingTeleported() const { return mSemaphoreTeleport_Near || mSemaphoreTeleport_Far; }
2051  bool IsBeingTeleportedNear() const { return mSemaphoreTeleport_Near; }
2052  bool IsBeingTeleportedFar() const { return mSemaphoreTeleport_Far; }
2053  bool IsBeingTeleportedSeamlessly() const { return IsBeingTeleportedFar() && m_teleport_options & TELE_TO_SEAMLESS; }
2054  void SetSemaphoreTeleportNear(bool semphsetting) { mSemaphoreTeleport_Near = semphsetting; }
2055  void SetSemaphoreTeleportFar(bool semphsetting) { mSemaphoreTeleport_Far = semphsetting; }
2056  void ProcessDelayedOperations();
2057 
2058  void CheckAreaExploreAndOutdoor(void);
2059 
2060  static uint32 TeamForRace(uint8 race);
2061  static TeamId TeamIdForRace(uint8 race);
2062  uint32 GetTeam() const { return m_team; }
2063  TeamId GetTeamId() const { return m_team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; }
2064  void setFactionForRace(uint8 race);
2065 
2066  void InitDisplayIds();
2067 
2068  bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const;
2069  bool IsAtRecruitAFriendDistance(WorldObject const* pOther) const;
2070  void RewardPlayerAndGroupAtKill(Unit* victim, bool isBattleGround);
2071  void RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource);
2072  bool isHonorOrXPTarget(Unit const* victim) const;
2073 
2074  bool GetsRecruitAFriendBonus(bool forXP);
2075  uint8 GetGrantableLevels() const { return m_grantableLevels; }
2076  void SetGrantableLevels(uint8 val) { m_grantableLevels = val; }
2077 
2078  ReputationMgr& GetReputationMgr() { return *m_reputationMgr; }
2079  ReputationMgr const& GetReputationMgr() const { return *m_reputationMgr; }
2080  ReputationRank GetReputationRank(uint32 faction_id) const;
2081  void RewardReputation(Unit* victim, float rate);
2082  void RewardReputation(Quest const* quest);
2083 
2084  int32 CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool noQuestBonus = false);
2085 
2086  void UpdateSkillsForLevel();
2087  void UpdateSkillsToMaxSkillsForLevel(); // for .levelup
2088  void ModifySkillBonus(uint32 skillid, int32 val, bool talent);
2089 
2090  /*********************************************************/
2091  /*** PVP SYSTEM ***/
2092  /*********************************************************/
2093  // TODO: Properly implement correncies as of Cataclysm
2094  void UpdateHonorFields();
2095  bool RewardHonor(Unit* victim, uint32 groupsize, int32 honor = -1, bool pvptoken = false);
2096  uint32 GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot) const;
2097 
2098  // duel health and mana reset methods
2099  void SaveHealthBeforeDuel() { healthBeforeDuel = GetHealth(); }
2100  void SaveManaBeforeDuel() { manaBeforeDuel = GetPower(POWER_MANA); }
2101  void RestoreHealthAfterDuel() { SetHealth(healthBeforeDuel); }
2102  void RestoreManaAfterDuel() { SetPower(POWER_MANA, manaBeforeDuel); }
2103 
2104  //End of PvP System
2105 
2106  void SetDrunkValue(uint8 newDrunkValue, uint32 itemId = 0);
2107  uint8 GetDrunkValue() const { return GetByteValue(PLAYER_BYTES_3, PLAYER_BYTES_3_OFFSET_INEBRIATION); }
2108  static DrunkenState GetDrunkenstateByValue(uint8 value);
2109 
2110  uint32 GetDeathTimer() const { return m_deathTimer; }
2111  uint32 GetCorpseReclaimDelay(bool pvp) const;
2112  void UpdateCorpseReclaimDelay();
2113  int32 CalculateCorpseReclaimDelay(bool load = false) const;
2114  void SendCorpseReclaimDelay(uint32 delay) const;
2115 
2116  uint32 GetBlockPercent() const override { return GetUInt32Value(PLAYER_SHIELD_BLOCK); }
2117  bool CanParry() const { return m_canParry; }
2118  void SetCanParry(bool value);
2119  bool CanBlock() const { return m_canBlock; }
2120  void SetCanBlock(bool value);
2121  bool CanTitanGrip() const { return m_canTitanGrip; }
2122  void SetCanTitanGrip(bool value) { m_canTitanGrip = value; }
2123  bool CanTameExoticPets() const { return IsGameMaster() || HasAuraType(SPELL_AURA_ALLOW_TAME_PET_TYPE); }
2124 
2125  void SetRegularAttackTime();
2126  void SetBaseModValue(BaseModGroup modGroup, BaseModType modType, float value) { m_auraBaseMod[modGroup][modType] = value; }
2127  void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply);
2128  float GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const;
2129  float GetTotalBaseModValue(BaseModGroup modGroup) const;
2130  float GetTotalPercentageModValue(BaseModGroup modGroup) const { return m_auraBaseMod[modGroup][FLAT_MOD] + m_auraBaseMod[modGroup][PCT_MOD]; }
2131  void _ApplyAllStatBonuses();
2132  void _RemoveAllStatBonuses();
2133 
2134  void ResetAllPowers();
2135 
2136  void _ApplyWeaponDependentAuraMods(Item* item, WeaponAttackType attackType, bool apply);
2137  void _ApplyWeaponDependentAuraCritMod(Item* item, WeaponAttackType attackType, AuraEffect const* aura, bool apply);
2138  void _ApplyWeaponDependentAuraDamageMod(Item* item, WeaponAttackType attackType, AuraEffect const* aura, bool apply);
2139 
2140  void _ApplyItemMods(Item* item, uint8 slot, bool apply);
2141  void _RemoveAllItemMods();
2142  void _ApplyAllItemMods();
2143  void _ApplyAllLevelScaleItemMods(bool apply);
2144  void _ApplyItemBonuses(Item* item, uint8 slot, bool apply);
2145  void _ApplyWeaponDamage(uint8 slot, Item* item, bool apply);
2146  bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) const;
2147  void ToggleMetaGemsActive(uint8 exceptslot, bool apply);
2148  void CorrectMetaGemEnchants(uint8 slot, bool apply);
2149  void InitDataForForm(bool reapplyMods = false);
2150 
2151  void ApplyItemEquipSpell(Item* item, bool apply, bool formChange = false);
2152  void ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, bool formChange = false);
2153  void UpdateEquipSpellsAtFormChange();
2154  void UpdateItemSetAuras(bool formChange = false);
2155 
2156  void CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx);
2157  void CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 castCount, int32* misc);
2158  void CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item* item, ItemTemplate const* proto);
2159 
2160  void SendEquipmentSetList();
2161  void SetEquipmentSet(EquipmentSetInfo::EquipmentSetData&& newEqSet);
2162  void DeleteEquipmentSet(uint64 id);
2163 
2164  void SendInitWorldStates(uint32 zone, uint32 area);
2165  void SendUpdateWorldState(uint32 variable, uint32 value, bool hidden = false) const;
2166  void SendDirectMessage(WorldPacket const* data) const;
2167  void SendBGWeekendWorldStates() const;
2168  void SendBattlefieldWorldStates() const;
2169 
2170  void SendAurasForTarget(Unit* target) const;
2171 
2172  PlayerMenu* PlayerTalkClass;
2173  std::vector<ItemSetEffect*> ItemSetEff;
2174 
2175  void SendLoot(ObjectGuid guid, LootType loot_type);
2176  void SendLootError(ObjectGuid guid, LootError error) const;
2177  void SendLootRelease(ObjectGuid guid) const;
2178  void SendNotifyLootItemRemoved(ObjectGuid owner, ObjectGuid lootObj, uint8 lootSlot) const;
2179  void SendNotifyLootMoneyRemoved(ObjectGuid lootObj) const;
2180 
2181  /*********************************************************/
2182  /*** BATTLEGROUND SYSTEM ***/
2183  /*********************************************************/
2184 
2185  bool InBattleground() const { return m_bgData.bgInstanceID != 0; }
2186  bool InArena() const;
2187  uint32 GetBattlegroundId() const { return m_bgData.bgInstanceID; }
2188  BattlegroundTypeId GetBattlegroundTypeId() const { return m_bgData.bgTypeID; }
2189  Battleground* GetBattleground() const;
2190 
2191  uint32 GetBattlegroundQueueJoinTime(BattlegroundQueueTypeId bgQueueTypeId) const;
2192  bool InBattlegroundQueue() const;
2193  BattlegroundQueueTypeId GetBattlegroundQueueTypeId(uint32 index) const;
2194  uint32 GetBattlegroundQueueIndex(BattlegroundQueueTypeId bgQueueTypeId) const;
2195  bool IsInvitedForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const;
2196  bool InBattlegroundQueueForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const;
2197 
2198  void SetBattlegroundId(uint32 val, BattlegroundTypeId bgTypeId);
2199  uint32 AddBattlegroundQueueId(BattlegroundQueueTypeId val);
2200  bool HasFreeBattlegroundQueueId() const;
2201  void RemoveBattlegroundQueueId(BattlegroundQueueTypeId val);
2202  void SetInviteForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId, uint32 instanceId);
2203  bool IsInvitedForBattlegroundInstance(uint32 instanceId) const;
2204  WorldLocation const& GetBattlegroundEntryPoint() const { return m_bgData.joinPos; }
2205  void SetBattlegroundEntryPoint();
2206 
2207  void SetBGTeam(uint32 team);
2208  uint32 GetBGTeam() const;
2209 
2210  void LeaveBattleground(bool teleportToEntryPoint = true);
2211  bool CanJoinToBattleground(Battleground const* bg) const;
2212  bool CanReportAfkDueToLimit();
2213  void ReportedAfkBy(Player* reporter);
2214  void ClearAfkReports() { m_bgData.bgAfkReporter.clear(); }
2215 
2216  bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const;
2217  bool isTotalImmunity() const;
2218  bool CanUseBattlegroundObject(GameObject* gameobject) const;
2219  bool isTotalImmune() const;
2220  bool CanCaptureTowerPoint() const;
2221 
2222  bool GetRandomWinner() const { return m_IsBGRandomWinner; }
2223  void SetRandomWinner(bool isWinner);
2224 
2225  /*********************************************************/
2226  /*** OUTDOOR PVP SYSTEM ***/
2227  /*********************************************************/
2228 
2229  OutdoorPvP* GetOutdoorPvP() const;
2230  // returns true if the player is in active state for outdoor pvp objective capturing, false otherwise
2231  bool IsOutdoorPvPActive() const;
2232 
2233  /*********************************************************/
2234  /*** ENVIROMENTAL SYSTEM ***/
2235  /*********************************************************/
2236 
2237  bool IsImmuneToEnvironmentalDamage() const;
2238  uint32 EnvironmentalDamage(EnviromentalDamage type, uint32 damage);
2239 
2240  /*********************************************************/
2241  /*** FLOOD FILTER SYSTEM ***/
2242  /*********************************************************/
2243 
2244  void UpdateSpeakTime();
2245  bool CanSpeak() const;
2246 
2247  /*********************************************************/
2248  /*** VARIOUS SYSTEMS ***/
2249  /*********************************************************/
2250  void UpdateFallInformationIfNeed(MovementInfo const& minfo, uint16 opcode);
2251  Unit* m_mover;
2252  WorldObject* m_seer;
2253  void SetFallInformation(uint32 time, float z);
2254  void HandleFall(MovementInfo const& movementInfo);
2255 
2256  bool CanFlyInZone(uint32 mapid, uint32 zone) const;
2257 
2258  void SetClientControl(Unit* target, bool allowMove);
2259 
2260  void SetMover(Unit* target);
2261 
2262  void SetSeer(WorldObject* target) { m_seer = target; }
2263  void SetViewpoint(WorldObject* target, bool apply);
2264  WorldObject* GetViewpoint() const;
2265  void StopCastingCharm();
2266  void StopCastingBindSight() const;
2267 
2268  uint32 GetSaveTimer() const { return m_nextSave; }
2269  void SetSaveTimer(uint32 timer) { m_nextSave = timer; }
2270 
2271  // Recall position
2272  uint32 m_recallMap;
2273  float m_recallX;
2274  float m_recallY;
2275  float m_recallZ;
2276  float m_recallO;
2277  void SaveRecallPosition();
2278 
2279  void SetHomebind(WorldLocation const& loc, uint32 areaId);
2280  void SendBindPointUpdate() const;
2281 
2282  // Homebind coordinates
2283  uint32 m_homebindMapId;
2284  uint16 m_homebindAreaId;
2285  float m_homebindX;
2286  float m_homebindY;
2287  float m_homebindZ;
2288 
2289  WorldLocation GetStartPosition() const;
2290 
2291  // currently visible objects at player client
2292  GuidUnorderedSet m_clientGUIDs;
2293 
2294  bool HaveAtClient(Object const* u) const;
2295 
2296  bool IsNeverVisible() const override;
2297 
2298  bool IsVisibleGloballyFor(Player const* player) const;
2299 
2300  void SendInitialVisiblePackets(Unit* target) const;
2301  void UpdateObjectVisibility(bool forced = true) override;
2302  void UpdateVisibilityForPlayer();
2303  void UpdateVisibilityOf(WorldObject* target);
2304  void UpdateTriggerVisibility();
2305 
2306  void SendUpdatePhasing();
2307 
2308  template<class T>
2309  void UpdateVisibilityOf(T* target, UpdateData& data, std::set<Unit*>& visibleNow);
2310 
2311  uint8 m_forced_speed_changes[MAX_MOVE_TYPE];
2312 
2313  bool HasAtLoginFlag(AtLoginFlags f) const { return (m_atLoginFlags & f) != 0; }
2314  void SetAtLoginFlag(AtLoginFlags f) { m_atLoginFlags |= f; }
2315  void RemoveAtLoginFlag(AtLoginFlags flags, bool persist = false);
2316 
2317  bool isUsingLfg() const;
2318  bool inRandomLfgDungeon() const;
2319 
2320  typedef std::set<uint32> DFQuestsDoneList;
2321  DFQuestsDoneList m_DFQuests;
2322 
2323  // Temporarily removed pet cache
2324  uint32 GetTemporaryUnsummonedPetNumber() const { return m_temporaryUnsummonedPetNumber; }
2325  void SetTemporaryUnsummonedPetNumber(uint32 petnumber) { m_temporaryUnsummonedPetNumber = petnumber; }
2326  void UnsummonPetTemporaryIfAny();
2327  void ResummonPetTemporaryUnSummonedIfAny();
2328  bool IsPetNeedBeTemporaryUnsummoned() const;
2329 
2330  void SendCinematicStart(uint32 CinematicSequenceId) const;
2331  void SendMovieStart(uint32 MovieId) const;
2332 
2333  /*********************************************************/
2334  /*** INSTANCE SYSTEM ***/
2335  /*********************************************************/
2336 
2337  typedef std::unordered_map< uint32 /*mapId*/, InstancePlayerBind > BoundInstancesMap;
2338 
2339  void UpdateHomebindTime(uint32 time);
2340 
2341  uint32 m_HomebindTimer;
2342  bool m_InstanceValid;
2343  // permanent binds and solo binds by difficulty
2344  BoundInstancesMap m_boundInstances[MAX_DIFFICULTY];
2345  InstancePlayerBind* GetBoundInstance(uint32 mapid, Difficulty difficulty, bool withExpired = false);
2346  InstancePlayerBind const* GetBoundInstance(uint32 mapid, Difficulty difficulty) const;
2347  BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; }
2348  InstanceSave* GetInstanceSave(uint32 mapid);
2349  void UnbindInstance(uint32 mapid, Difficulty difficulty, bool unload = false);
2350  void UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficulty, bool unload = false);
2351  InstancePlayerBind* BindToInstance(InstanceSave* save, bool permanent, BindExtensionState extendState = EXTEND_STATE_NORMAL, bool load = false);
2352  void BindToInstance();
2353  void SetPendingBind(uint32 instanceId, uint32 bindTimer);
2354  bool HasPendingBind() const { return _pendingBindId > 0; }
2355  void SendRaidInfo();
2356  bool Satisfy(AccessRequirement const* ar, uint32 target_map, bool report = false);
2357  bool CheckInstanceValidity(bool /*isLogin*/);
2358  bool CheckInstanceCount(uint32 instanceId) const;
2359  void AddInstanceEnterTime(uint32 instanceId, time_t enterTime);
2360 
2361  // last used pet number (for BG's)
2362  uint32 GetLastPetNumber() const { return m_lastpetnumber; }
2363  void SetLastPetNumber(uint32 petnumber) { m_lastpetnumber = petnumber; }
2364 
2365  /*********************************************************/
2366  /*** GROUP SYSTEM ***/
2367  /*********************************************************/
2368 
2369  Group* GetGroupInvite() const { return m_groupInvite; }
2370  void SetGroupInvite(Group* group) { m_groupInvite = group; }
2371  Group* GetGroup() { return m_group.getTarget(); }
2372  Group const* GetGroup() const { return const_cast<Group const*>(m_group.getTarget()); }
2373  GroupReference& GetGroupRef() { return m_group; }
2374  void SetGroup(Group* group, int8 subgroup = -1);
2375  uint8 GetSubGroup() const { return m_group.getSubGroup(); }
2376  uint32 GetGroupUpdateFlag() const { return m_groupUpdateMask; }
2377  void SetGroupUpdateFlag(uint32 flag) { m_groupUpdateMask |= flag; }
2378  void RemoveGroupUpdateFlag(uint32 flag) { m_groupUpdateMask &= ~flag; }
2379  Player* GetNextRandomRaidMember(float radius);
2380  PartyResult CanUninviteFromGroup(ObjectGuid guidMember = ObjectGuid::Empty) const;
2381 
2382  // Battleground / Battlefield Group System
2383  void SetBattlegroundOrBattlefieldRaid(Group* group, int8 subgroup = -1);
2384  void RemoveFromBattlegroundOrBattlefieldRaid();
2385  Group* GetOriginalGroup() const { return m_originalGroup.getTarget(); }
2386  GroupReference& GetOriginalGroupRef() { return m_originalGroup; }
2387  uint8 GetOriginalSubGroup() const { return m_originalGroup.getSubGroup(); }
2388  void SetOriginalGroup(Group* group, int8 subgroup = -1);
2389 
2390  void SetPassOnGroupLoot(bool bPassOnGroupLoot) { m_bPassOnGroupLoot = bPassOnGroupLoot; }
2391  bool GetPassOnGroupLoot() const { return m_bPassOnGroupLoot; }
2392 
2393  MapReference &GetMapRef() { return m_mapRef; }
2394 
2395  // Set map to player and add reference
2396  void SetMap(Map* map) override;
2397  void ResetMap() override;
2398 
2399  bool isAllowedToLoot(const Creature* creature);
2400 
2401  DeclinedName const* GetDeclinedNames() const { return m_declinedname; }
2402  uint8 GetRunesState() const { return m_runes->runeState; }
2403  RuneType GetBaseRune(uint8 index) const { return RuneType(m_runes->runes[index].BaseRune); }
2404  RuneType GetCurrentRune(uint8 index) const { return RuneType(m_runes->runes[index].CurrentRune); }
2405  uint32 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; }
2406  uint32 GetRuneBaseCooldown(uint8 index) const { return GetRuneTypeBaseCooldown(GetBaseRune(index)); }
2407  uint32 GetRuneTypeBaseCooldown(RuneType runeType) const;
2408  bool IsBaseRuneSlotsOnCooldown(RuneType runeType) const;
2409  RuneType GetLastUsedRune() const { return m_runes->lastUsedRune; }
2410  void SetLastUsedRune(RuneType type) { m_runes->lastUsedRune = type; }
2411  void SetBaseRune(uint8 index, RuneType baseRune) { m_runes->runes[index].BaseRune = baseRune; }
2412  void SetCurrentRune(uint8 index, RuneType currentRune) { m_runes->runes[index].CurrentRune = currentRune; }
2413  void SetRuneCooldown(uint8 index, uint32 cooldown, bool casted = false);
2414  void SetRuneConvertAura(uint8 index, AuraEffect const* aura);
2415  void AddRuneByAuraEffect(uint8 index, RuneType newType, AuraEffect const* aura);
2416  void RemoveRunesByAuraEffect(AuraEffect const* aura);
2417  void RestoreBaseRune(uint8 index);
2418  void ConvertRune(uint8 index, RuneType newType);
2419  void ResyncRunes(uint8 count) const;
2420  void AddRunePower(uint8 index) const;
2421  void InitRunes();
2422 
2423  void SendRespondInspectAchievements(Player* player) const;
2424  uint32 GetAchievementPoints() const;
2425  bool HasAchieved(uint32 achievementId) const;
2426  void ResetAchievements();
2427  void ResetAchievementCriteria(AchievementCriteriaTypes type, uint64 miscValue1 = 0, uint64 miscValue2 = 0, bool evenIfCriteriaComplete = false);
2428  void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint64 miscValue1 = 0, uint64 miscValue2 = 0, uint64 miscValue3 = 0, Unit* unit = NULL);
2429  void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost = 0);
2430  void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry);
2431  void CompletedAchievement(AchievementEntry const* entry);
2432 
2433  bool HasTitle(uint32 bitIndex) const;
2434  bool HasTitle(CharTitlesEntry const* title) const { return HasTitle(title->MaskID); }
2435  void SetTitle(CharTitlesEntry const* title, bool lost = false);
2436 
2437  //bool isActiveObject() const { return true; }
2438  bool CanSeeSpellClickOn(Creature const* creature) const;
2439 
2440  uint32 GetChampioningFaction() const { return m_ChampioningFaction; }
2441  void SetChampioningFaction(uint32 faction) { m_ChampioningFaction = faction; }
2442  Spell* m_spellModTakingSpell;
2443 
2444  float GetAverageItemLevel() const;
2445  bool isDebugAreaTriggers;
2446 
2447  void ClearWhisperWhiteList() { WhisperList.clear(); }
2448  void AddWhisperWhiteList(ObjectGuid guid) { WhisperList.push_back(guid); }
2449  bool IsInWhisperWhiteList(ObjectGuid guid);
2450  void RemoveFromWhisperWhiteList(ObjectGuid guid) { WhisperList.remove(guid); }
2451 
2452  void ValidateMovementInfo(MovementInfo* mi);
2453 
2457  void SendMovementSetCanTransitionBetweenSwimAndFly(bool apply);
2458  void SendMovementSetCollisionHeight(float height);
2459 
2460  bool CanFly() const override { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY); }
2461 
2463  float GetCollisionHeight(bool mounted) const;
2464 
2465  std::string GetMapAreaAndZoneString() const;
2466  std::string GetCoordsMapAreaAndZoneString() const;
2467 
2468  // Void Storage
2469  bool IsVoidStorageUnlocked() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_VOID_UNLOCKED); }
2470  void UnlockVoidStorage() { SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_VOID_UNLOCKED); }
2471  void LockVoidStorage() { RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_VOID_UNLOCKED); }
2472  uint8 GetNextVoidStorageFreeSlot() const;
2473  uint8 GetNumOfVoidStorageFreeSlots() const;
2474  uint8 AddVoidStorageItem(VoidStorageItem&& item);
2475  void DeleteVoidStorageItem(uint8 slot);
2476  bool SwapVoidStorageItem(uint8 oldSlot, uint8 newSlot);
2477  VoidStorageItem* GetVoidStorageItem(uint8 slot) const;
2478  VoidStorageItem* GetVoidStorageItem(uint64 id, uint8& slot) const;
2479 
2480  void OnCombatExit();
2481 
2482  void CreateGarrison(uint32 garrSiteId);
2483  void DeleteGarrison();
2484  Garrison* GetGarrison() const { return _garrison.get(); }
2485 
2486  bool IsAdvancedCombatLoggingEnabled() const { return _advancedCombatLoggingEnabled; }
2487  void SetAdvancedCombatLogging(bool enabled) { _advancedCombatLoggingEnabled = enabled; }
2488 
2489  protected:
2490  // Gamemaster whisper whitelist
2491  GuidList WhisperList;
2492  uint32 m_regenTimerCount;
2493  uint32 m_holyPowerRegenTimerCount;
2494  uint32 m_focusRegenTimerCount;
2495  float m_powerFraction[MAX_POWERS_PER_CLASS];
2496  uint32 m_contestedPvPTimer;
2497 
2498  /*********************************************************/
2499  /*** BATTLEGROUND SYSTEM ***/
2500  /*********************************************************/
2501 
2502  /*
2503  this is an array of BG queues (BgTypeIDs) in which is player
2504  */
2505  struct BgBattlegroundQueueID_Rec
2506  {
2507  BattlegroundQueueTypeId bgQueueTypeId;
2508  uint32 invitedToInstance;
2509  uint32 joinTime;
2510  };
2511 
2512  BgBattlegroundQueueID_Rec m_bgBattlegroundQueueID[PLAYER_MAX_BATTLEGROUND_QUEUES];
2513  BGData m_bgData;
2514 
2515  bool m_IsBGRandomWinner;
2516 
2517  /*********************************************************/
2518  /*** QUEST SYSTEM ***/
2519  /*********************************************************/
2520 
2521  //We allow only one timed quest active at the same time. Below can then be simple value instead of set.
2522  typedef std::set<uint32> QuestSet;
2523  typedef std::set<uint32> SeasonalQuestSet;
2524  typedef std::unordered_map<uint32, SeasonalQuestSet> SeasonalEventQuestMap;
2525  QuestSet m_timedquests;
2526  QuestSet m_weeklyquests;
2527  QuestSet m_monthlyquests;
2528  SeasonalEventQuestMap m_seasonalquests;
2529 
2530  ObjectGuid m_divider;
2531  uint32 m_ingametime;
2532 
2533  /*********************************************************/
2534  /*** LOAD SYSTEM ***/
2535  /*********************************************************/
2536 
2537  void _LoadActions(PreparedQueryResult result);
2538  void _LoadAuras(PreparedQueryResult auraResult, PreparedQueryResult effectResult, uint32 timediff);
2539  void _LoadGlyphAuras();
2540  void _LoadBoundInstances(PreparedQueryResult result);
2541  void _LoadInventory(PreparedQueryResult result, uint32 timeDiff);
2542  void _LoadVoidStorage(PreparedQueryResult result);
2543  void _LoadMailInit(PreparedQueryResult resultUnread, PreparedQueryResult resultDelivery);
2544  void _LoadMail();
2545  void _LoadMailedItems(Mail* mail);
2546  void _LoadQuestStatus(PreparedQueryResult result);
2547  void _LoadQuestStatusObjectives(PreparedQueryResult result);
2548  void _LoadQuestStatusRewarded(PreparedQueryResult result);
2549  void _LoadDailyQuestStatus(PreparedQueryResult result);
2550  void _LoadWeeklyQuestStatus(PreparedQueryResult result);
2551  void _LoadMonthlyQuestStatus(PreparedQueryResult result);
2552  void _LoadSeasonalQuestStatus(PreparedQueryResult result);
2553  void _LoadRandomBGStatus(PreparedQueryResult result);
2554  void _LoadGroup(PreparedQueryResult result);
2555  void _LoadSkills(PreparedQueryResult result);
2556  void _LoadSpells(PreparedQueryResult result);
2557  bool _LoadHomeBind(PreparedQueryResult result);
2558  void _LoadDeclinedNames(PreparedQueryResult result);
2559  void _LoadArenaTeamInfo(PreparedQueryResult result);
2560  void _LoadEquipmentSets(PreparedQueryResult result);
2561  void _LoadBGData(PreparedQueryResult result);
2562  void _LoadGlyphs(PreparedQueryResult result);
2563  void _LoadTalents(PreparedQueryResult result);
2564  void _LoadInstanceTimeRestrictions(PreparedQueryResult result);
2565  void _LoadCurrency(PreparedQueryResult result);
2566  void _LoadCUFProfiles(PreparedQueryResult result);
2567 
2568  /*********************************************************/
2569  /*** SAVE SYSTEM ***/
2570  /*********************************************************/
2571 
2572  void _SaveActions(SQLTransaction& trans);
2573  void _SaveAuras(SQLTransaction& trans);
2574  void _SaveInventory(SQLTransaction& trans);
2575  void _SaveVoidStorage(SQLTransaction& trans);
2576  void _SaveMail(SQLTransaction& trans);
2577  void _SaveQuestStatus(SQLTransaction& trans);
2578  void _SaveDailyQuestStatus(SQLTransaction& trans);
2579  void _SaveWeeklyQuestStatus(SQLTransaction& trans);
2580  void _SaveMonthlyQuestStatus(SQLTransaction& trans);
2581  void _SaveSeasonalQuestStatus(SQLTransaction& trans);
2582  void _SaveSkills(SQLTransaction& trans);
2583  void _SaveSpells(SQLTransaction& trans);
2584  void _SaveEquipmentSets(SQLTransaction& trans);
2585  void _SaveBGData(SQLTransaction& trans);
2586  void _SaveGlyphs(SQLTransaction& trans) const;
2587  void _SaveTalents(SQLTransaction& trans);
2588  void _SaveStats(SQLTransaction& trans) const;
2589  void _SaveInstanceTimeRestrictions(SQLTransaction& trans);
2590  void _SaveCurrency(SQLTransaction& trans);
2591  void _SaveCUFProfiles(SQLTransaction& trans);
2592 
2593  /*********************************************************/
2594  /*** ENVIRONMENTAL SYSTEM ***/
2595  /*********************************************************/
2596  void HandleSobering();
2597  void SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen);
2598  void StopMirrorTimer(MirrorTimerType Type);
2599  void HandleDrowning(uint32 time_diff);
2600  int32 getMaxTimer(MirrorTimerType timer) const;
2601 
2602  /*********************************************************/
2603  /*** HONOR SYSTEM ***/
2604  /*********************************************************/
2605  time_t m_lastHonorUpdateTime;
2606 
2607  void outDebugValues() const;
2608 
2609  uint32 m_team;
2610  uint32 m_nextSave;
2611  time_t m_speakTime;
2612  uint32 m_speakCount;
2613  Difficulty m_dungeonDifficulty;
2614  Difficulty m_raidDifficulty;
2615  Difficulty m_legacyRaidDifficulty;
2616  Difficulty m_prevMapDifficulty;
2617 
2618  uint32 m_atLoginFlags;
2619 
2620  Item* m_items[PLAYER_SLOTS_COUNT];
2621  uint32 m_currentBuybackSlot;
2622 
2623  PlayerCurrenciesMap _currencyStorage;
2624 
2631  uint32 GetCurrencyWeekCap(CurrencyTypesEntry const* currency) const;
2632 
2633  /*
2634  * @name GetCurrencyTotalCap
2635  * @brief return total cap for selected currency
2636 
2637  * @param CurrencyTypesEntry for which to retrieve total cap
2638  */
2639  uint32 GetCurrencyTotalCap(CurrencyTypesEntry const* currency) const;
2640 
2642  void UpdateConquestCurrencyCap(uint32 currency) const;
2643 
2644  VoidStorageItem* _voidStorageItems[VOID_STORAGE_MAX_SLOT];
2645 
2646  std::vector<Item*> m_itemUpdateQueue;
2647  bool m_itemUpdateQueueBlocked;
2648 
2649  uint32 m_ExtraFlags;
2650 
2651  QuestStatusMap m_QuestStatus;
2652  QuestStatusSaveMap m_QuestStatusSave;
2653 
2654  RewardedQuestSet m_RewardedQuests;
2655  QuestStatusSaveMap m_RewardedQuestsSave;
2656 
2657  SkillStatusMap mSkillStatus;
2658 
2659  ObjectGuid::LowType m_GuildIdInvited;
2660  uint32 m_ArenaTeamIdInvited;
2661 
2662  PlayerMails m_mail;
2663  PlayerSpellMap m_spells;
2664  std::unordered_map<uint32 /*overridenSpellId*/, std::unordered_set<uint32> /*newSpellId*/> m_overrideSpells;
2665  uint32 m_lastPotionId; // last used health/mana potion in combat, that block next potion use
2666 
2667  PlayerTalentInfo* _talentMgr;
2668 
2669  ActionButtonList m_actionButtons;
2670 
2671  float m_auraBaseMod[BASEMOD_END][MOD_END];
2672  int16 m_baseRatingValue[MAX_COMBAT_RATING];
2673  uint32 m_baseSpellPower;
2674  uint32 m_baseManaRegen;
2675  uint32 m_baseHealthRegen;
2676  int32 m_spellPenetrationItemMod;
2677 
2678  SpellModList m_spellMods[MAX_SPELLMOD];
2679 
2680  EnchantDurationList m_enchantDuration;
2681  ItemDurationList m_itemDuration;
2682  GuidUnorderedSet m_itemSoulboundTradeable;
2683 
2684  void ResetTimeSync();
2685  void SendTimeSync();
2686 
2687  std::unique_ptr<ResurrectionData> _resurrectionData;
2688 
2689  WorldSession* m_session;
2690 
2691  typedef std::list<Channel*> JoinedChannelsList;
2692  JoinedChannelsList m_channels;
2693 
2694  uint8 m_cinematic;
2695 
2696  TradeData* m_trade;
2697 
2698  bool m_DailyQuestChanged;
2699  bool m_WeeklyQuestChanged;
2700  bool m_MonthlyQuestChanged;
2701  bool m_SeasonalQuestChanged;
2702  time_t m_lastDailyQuestTime;
2703 
2704  uint32 m_drunkTimer;
2705  uint32 m_weaponChangeTimer;
2706 
2707  uint32 m_zoneUpdateId;
2708  uint32 m_zoneUpdateTimer;
2709  uint32 m_areaUpdateId;
2710 
2711  uint32 m_deathTimer;
2712  time_t m_deathExpireTime;
2713 
2714  uint32 m_WeaponProficiency;
2715  uint32 m_ArmorProficiency;
2716  bool m_canParry;
2717  bool m_canBlock;
2718  bool m_canTitanGrip;
2719  uint8 m_swingErrorMsg;
2720 
2722  time_t _restTime;
2723  uint32 inn_triggerId;
2724  float m_rest_bonus;
2725  uint32 _restFlagMask;
2727 
2728  // Social
2729  PlayerSocial* m_social;
2730 
2731  // Groups
2732  GroupReference m_group;
2733  GroupReference m_originalGroup;
2734  Group* m_groupInvite;
2735  uint32 m_groupUpdateMask;
2736  bool m_bPassOnGroupLoot;
2737 
2738  // last used pet number (for BG's)
2739  uint32 m_lastpetnumber;
2740 
2741  // Player summoning
2742  time_t m_summon_expire;
2743  uint32 m_summon_mapid;
2744  float m_summon_x;
2745  float m_summon_y;
2746  float m_summon_z;
2747 
2748  DeclinedName *m_declinedname;
2749  Runes *m_runes;
2750  EquipmentSetContainer _equipmentSets;
2751 
2752  bool CanAlwaysSee(WorldObject const* obj) const override;
2753 
2754  bool IsAlwaysDetectableFor(WorldObject const* seer) const override;
2755 
2756  uint8 m_grantableLevels;
2757 
2758  std::array<std::unique_ptr<CUFProfile>, MAX_CUF_PROFILES> _CUFProfiles;
2759 
2760  private:
2761  // internal common parts for CanStore/StoreItem functions
2762  InventoryResult CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const;
2763  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;
2764  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;
2765  Item* _StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool update);
2766  Item* _LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields);
2767 
2768  GuidSet m_refundableItems;
2769  void SendRefundInfo(Item* item);
2770  void RefundItem(Item* item);
2771  void SendItemRefundResult(Item* item, ItemExtendedCostEntry const* iece, uint8 error) const;
2772 
2773  void AdjustQuestReqItemCount(Quest const* quest);
2774 
2775  bool IsCanDelayTeleport() const { return m_bCanDelayTeleport; }
2776  void SetCanDelayTeleport(bool setting) { m_bCanDelayTeleport = setting; }
2777  bool IsHasDelayedTeleport() const { return m_bHasDelayedTeleport; }
2778  void SetDelayedTeleportFlag(bool setting) { m_bHasDelayedTeleport = setting; }
2779  void ScheduleDelayedOperation(uint32 operation) { if (operation < DELAYED_END) m_DelayedOperations |= operation; }
2780 
2781  bool IsInstanceLoginGameMasterException() const;
2782 
2783  MapReference m_mapRef;
2784 
2785  void UpdateCharmedAI();
2786  uint32 m_lastFallTime;
2787  float m_lastFallZ;
2788 
2789  int32 m_MirrorTimer[MAX_TIMERS];
2790  uint8 m_MirrorTimerFlags;
2791  uint8 m_MirrorTimerFlagsLast;
2792  bool m_isInWater;
2793 
2794  // Rune type / Rune timer
2795  uint32 m_runeGraceCooldown[MAX_RUNES];
2796  uint32 m_lastRuneGraceTimers[MAX_RUNES];
2797 
2798  // Current teleport data
2799  WorldLocation m_teleport_dest;
2800  uint32 m_teleport_options;
2801  bool mSemaphoreTeleport_Near;
2802  bool mSemaphoreTeleport_Far;
2803 
2804  uint32 m_DelayedOperations;
2805  bool m_bCanDelayTeleport;
2806  bool m_bHasDelayedTeleport;
2807 
2808  // Temporary removed pet cache
2809  uint32 m_temporaryUnsummonedPetNumber;
2810  uint32 m_oldpetspell;
2811 
2812  AchievementMgr<Player>* m_achievementMgr;
2813  ReputationMgr* m_reputationMgr;
2814 
2815  uint32 m_ChampioningFaction;
2816 
2817  std::queue<uint32> m_timeSyncQueue;
2818  uint32 m_timeSyncTimer;
2819  uint32 m_timeSyncClient;
2820  uint32 m_timeSyncServer;
2821 
2822  InstanceTimeMap _instanceResetTimes;
2823  uint32 _pendingBindId;
2824  uint32 _pendingBindTimer;
2825 
2826  uint32 _activeCheats;
2827  uint32 _maxPersonalArenaRate;
2828 
2829  std::unique_ptr<Garrison> _garrison;
2830 
2831  bool _advancedCombatLoggingEnabled;
2832 
2833  // variables to save health and mana before duel and restore them after duel
2834  uint32 healthBeforeDuel;
2835  uint32 manaBeforeDuel;
2836 
2837  WorldLocation _corpseLocation;
2838 };
2839 
2840 TC_GAME_API void AddItemsSetItem(Player* player, Item* item);
2841 TC_GAME_API void RemoveItemsSetItem(Player* player, ItemTemplate const* proto);
2842 
2843 // "the bodies of template functions must be made available in a header file"
2844 template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell)
2845 {
2846  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
2847  if (!spellInfo)
2848  return 0;
2849  float totalmul = 1.0f;
2850  int32 totalflat = 0;
2851 
2852  // Drop charges for triggering spells instead of triggered ones
2853  if (m_spellModTakingSpell)
2854  spell = m_spellModTakingSpell;
2855 
2856  for (SpellModList::iterator itr = m_spellMods[op].begin(); itr != m_spellMods[op].end(); ++itr)
2857  {
2858  SpellModifier* mod = *itr;
2859 
2860  // Charges can be set only for mods with auras
2861  if (!mod->ownerAura)
2862  ASSERT(mod->charges == 0);
2863 
2864  if (!IsAffectedBySpellmod(spellInfo, mod, spell))
2865  continue;
2866 
2867  if (mod->type == SPELLMOD_FLAT)
2868  totalflat += mod->value;
2869  else if (mod->type == SPELLMOD_PCT)
2870  {
2871  // skip percent mods for null basevalue (most important for spell mods with charges)
2872  if (basevalue == T(0))
2873  continue;
2874 
2875  // special case (skip > 10sec spell casts for instant cast setting)
2876  if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100)
2877  continue;
2878 
2879  totalmul += CalculatePct(1.0f, mod->value);
2880  }
2881 
2882  DropModCharge(mod, spell);
2883  }
2884  float diff = (float)basevalue * (totalmul - 1.0f) + (float)totalflat;
2885  basevalue = T((float)basevalue + diff);
2886  return T(diff);
2887 }
2888 
2889 #endif
EnchantmentSlot slot
Definition: Player.h:498
void RemoveFromWorld() override
Definition: Unit.cpp:11733
Definition: Player.h:296
TC_GAME_API Pet * GetPet(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:179
Definition: Player.h:131
Definition: Player.h:523
Definition: Object.h:95
SpellModOp op
Definition: Player.h:170
uint8 SortBy
Definition: Player.h:274
Definition: SpellAuraEffects.h:30
Definition: Player.h:491
void CleanupsBeforeDelete(bool finalCleanup=true) override
Definition: Unit.cpp:11802
Definition: Player.h:525
virtual void ResetMap()
Definition: Object.cpp:2187
Definition: SharedDefines.h:252
Definition: Player.h:325
Definition: DBCStructure.h:37
PlayerCreateInfoActions action
Definition: Player.h:412
Definition: Player.h:230
Definition: Player.h:559
virtual void UpdateResistances(uint32 school)=0
Definition: Player.h:587
uint32 GetCount() const
Definition: Item.h:322
Definition: Player.h:86
BaseModGroup
Definition: Unit.h:523
std::list< Item * > ItemDurationList
Definition: Player.h:503
bool IsHostile
Definition: Player.h:422
Difficulty
Definition: DBCEnums.h:402
Definition: Corpse.h:49
Definition: Player.h:304
Definition: Player.h:316
Definition: Player.h:96
Definition: Player.h:187
virtual void UpdateMaxPower(Powers power)=0
virtual bool IsNeverVisible() const
Definition: Object.h:638
uint64 packedData
Definition: Player.h:341
Definition: UpdateMask.h:26
Definition: Position.h:228
#define MAX_CUF_PROFILES
Maximum number of CompactUnitFrames profiles.
Definition: Player.h:202
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: Player.h:441
uint64 const MAX_MONEY_AMOUNT
Definition: Player.cpp:130
BattlegroundTypeId
Definition: SharedDefines.h:4558
Definition: UpdateFields.h:89
SellResult
Definition: Item.h:161
#define MAX_MOVE_TYPE
Definition: Unit.h:610
PlayerLevelInfo()
Definition: Player.h:375
TalentSpecialization
Definition: Player.h:120
time_t startTime
Definition: Player.h:436
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
int8_t int8
Definition: Define.h:148
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
Definition: Player.h:106
PlayerFieldBytes2Offsets
Definition: Player.h:601
Definition: GossipDef.h:236
Definition: Player.h:518
BuyBankSlotResult
Definition: Player.h:93
Definition: Player.h:229
uint32 areaID
Definition: Player.h:443
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const
Definition: Unit.cpp:9339
Definition: Player.h:182
Definition: Player.h:125
Definition: Player.h:163
SpellModOp
Definition: Unit.h:84
Definition: QueryHolder.h:23
Definition: QuestDef.h:279
ReputationRank
Definition: SharedDefines.h:211
Definition: Unit.h:379
Definition: Player.h:507
Definition: Player.h:526
virtual void TextEmote(std::string const &text, WorldObject const *target=nullptr, bool isBossEmote=false)
Definition: Unit.cpp:16403
Definition: Player.h:167
Definition: Player.h:521
Definition: Player.h:582
std::list< EnchantDuration > EnchantDurationList
Definition: Player.h:502
Definition: Player.h:141
Definition: ReputationMgr.h:64
virtual bool IsLoading() const
Definition: Unit.h:2197
int64_t int64
Definition: Define.h:145
Definition: SpellInfo.h:326
Definition: Player.h:110
RuneType CurrentRune
Definition: Player.h:471
Definition: Player.h:220
Definition: Player.h:88
Definition: Player.h:572
DuelCompleteType
Definition: SharedDefines.h:4724
Definition: Player.h:78
float x2
Definition: Player.h:446
Definition: Player.h:154
uint8 type
Definition: Player.h:388
Definition: DBCStructure.h:162
Definition: Player.h:140
Definition: Player.h:147
bool isMounted
Definition: Player.h:438
Definition: Util.h:45
TrainerSpellState
Definition: Player.h:294
ActionButtonType GetType() const
Definition: Player.h:345
ReputationSource
Definition: Player.h:322
Definition: QuestDef.h:261
BuyResult
Definition: Item.h:148
Definition: Player.h:143
Definition: Player.h:153
Class used to access individual fields of database query result.
Definition: Field.h:56
EnchantmentSlot
Definition: Item.h:172
std::list< PlayerCreateInfoItem > PlayerCreateInfoItems
Definition: Player.h:371
#define PLAYER_MAX_BATTLEGROUND_QUEUES
Definition: SharedDefines.h:209
void LoadFromDB()
Definition: AddonMgr.cpp:40
Definition: UpdateFields.h:293
Definition: Player.h:209
float positionZ
Definition: Player.h:405
uint32 Quantity
Definition: Player.h:190
void SetRuneState(uint8 index, bool set=true)
Definition: Player.h:482
Definition: Player.h:299
uint32 item_amount
Definition: Player.h:368
PlayerCreateInfoAction(uint8 _button, uint32 _action, uint8 _type)
Definition: Player.h:385
PlayerCurrencyState state
Definition: Player.h:189
ResetFailedReason
Definition: SharedDefines.h:4906
std::map< uint8, ActionButton > ActionButtonList
Definition: Player.h:361
uint32 areaId
Definition: Player.h:402
Definition: Player.h:66
void AddToUpdateQueueOf(Player *player)
Definition: Item.cpp:717
Definition: Player.h:215
Definition: Object.h:355
Definition: Player.h:226
virtual void SetMap(Map *map)
Definition: Object.cpp:2169
#define MAX_RUNES
Definition: Player.h:451
Definition: Player.h:524
QuestStatus
Definition: QuestDef.h:108
float orientation
Definition: Player.h:406
Definition: DBCEnums.h:426
Definition: UpdateFields.h:276
#define MAX_TIMERS
Definition: Player.h:65
bool active
Definition: Player.h:113
ActionButtonUpdateState uState
Definition: Player.h:342
PlayerFieldBytesOffsets
Definition: Player.h:593
#define UI64LIT(N)
Definition: Define.h:138
Definition: Player.h:561
virtual bool HasSpell(uint32) const
Definition: Unit.h:1593
Definition: Player.h:510
Definition: DBCStructure.h:830
STL namespace.
std::unordered_map< uint32, PlayerCurrency > PlayerCurrenciesMap
Definition: Player.h:199
Definition: Player.h:396
Stats
Definition: SharedDefines.h:235
float GetVisibilityRange() const
Definition: Object.cpp:1912
Definition: Player.h:537
virtual void UpdateArmor()=0
Definition: Garrison.h:83
virtual void SendMessageToSetInRange(WorldPacket const *data, float dist, bool self)
Definition: Object.cpp:2150
arena_t NULL
Definition: jemalloc_internal.h:624
CUFProfile(const std::string &name, uint16 frameHeight, uint16 frameWidth, uint8 sortBy, uint8 healthText, uint32 boolOptions, uint8 topPoint, uint8 bottomPoint, uint8 leftPoint, uint16 topOffset, uint16 bottomOffset, uint16 leftOffset)
Definition: Player.h:255
void AddToWorld() override
Definition: Unit.cpp:11724
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
#define false
Definition: CascPort.h:18
void UpdateObjectVisibility(bool forced=true) override
Definition: Unit.cpp:14630
PlayerLevelInfo * levelInfo
Definition: Player.h:415
std::list< PlayerCreateInfoAction > PlayerCreateInfoActions
Definition: Player.h:392
uint32 action
Definition: Player.h:389
uint32 GetAction() const
Definition: Player.h:346
Aura *const ownerAura
Definition: Player.h:176
Definition: Player.h:127
Definition: UpdateFields.h:214
bool dependent
Definition: Player.h:114
Definition: Player.h:104
Definition: Player.h:148
Definition: Unit.h:799
uint64_t uint64
Definition: g3dmath.h:170
Definition: Player.h:455
virtual SpellInfo const * GetCastSpellInfo(SpellInfo const *spellInfo) const
Definition: Unit.cpp:16483
Definition: Object.h:423
Definition: Creature.h:467
PlayerSpellState
Definition: Player.h:101
float positionY
Definition: Player.h:404
Definition: Player.h:312
Definition: Unit.h:96
std::list< SkillRaceClassInfoEntry const * > PlayerCreateInfoSkills
Definition: Player.h:394
Definition: Player.h:151
Definition: SharedDefines.h:4822
RuneCooldowns
Definition: Player.h:453
#define ACTION_BUTTON_ACTION(X)
Definition: Player.h:333
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
#define MAX_TALENT_GROUPS
Definition: SharedDefines.h:853
uint8 runeState
Definition: Player.h:479
time_t startTimer
Definition: Player.h:435
Definition: Player.h:126
Definition: Player.h:105
float positionX
Definition: Player.h:403
Definition: Item.h:190
Definition: Player.h:315
SpellModType type
Definition: Player.h:171
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
TotemCategory
Definition: SharedDefines.h:4156
uint32 item_id
Definition: Player.h:367
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
uint64 LowType
Definition: ObjectGuid.h:199
Definition: Player.h:223
void apply(T *val)
Definition: ByteConverter.h:41
bool IsInHostileArea
Definition: Player.h:423
InventoryType
Definition: ItemTemplate.h:330
uint16 LeftOffset
Definition: Player.h:285
uint32 MaskID
Definition: DBCStructure.h:168
Definition: Channel.h:126
RuneType BaseRune
Definition: Player.h:470
Definition: UpdateData.h:59
Definition: UpdateFields.h:280
void RemoveItemsSetItem(Player *player, ItemTemplate const *proto)
Definition: Item.cpp:106
uint16 stats[MAX_STATS]
Definition: Player.h:377
Definition: UpdateFields.h:193
Definition: Creature.h:367
std::list< ObjectGuid > GuidList
Definition: ObjectGuid.h:333
Definition: Player.h:144
GameobjectTypes
Definition: SharedDefines.h:2063
PlayerCreateInfoSpells customSpells
Definition: Player.h:410
RemoveMethod
Definition: SharedDefines.h:4685
Definition: Player.h:318
DrunkenState
Definition: Player.h:505
uint8 getSubGroup() const
Definition: GroupReference.h:39
Definition: Player.h:328
#define MAX_POWERS_PER_CLASS
Definition: SharedDefines.h:270
virtual bool IsUnderWater() const
Definition: Unit.cpp:2969
Definition: Player.h:363
uint8 getLevel() const
Definition: Unit.h:1408
uint16 TopOffset
Definition: Player.h:283
Definition: DB2Structure.h:330
Definition: Player.h:184
RaidGroupReason
Definition: SharedDefines.h:4897
Definition: Player.h:573
time_t outOfBound
Definition: Player.h:437
Definition: SharedDefines.h:1000
PvPInfo()
Definition: Player.h:420
#define MAX_STATS
Definition: SharedDefines.h:244
Definition: Player.h:305
Definition: UpdateFields.h:198
Player * initiator
Definition: Player.h:433
Definition: Player.h:161
Definition: Mail.h:166
Definition: Player.h:588
Definition: DynamicObject.h:35
PlayerUnderwaterState
Definition: Player.h:82
Definition: Player.h:297
uint16 FrameWidth
Definition: Player.h:273
virtual void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage)=0
Definition: Player.h:382
Definition: UpdateFields.h:195
Definition: UpdateFields.h:115
std::list< uint32 > PlayerCreateInfoSpells
Definition: Player.h:380
ActionButtonUpdateState
Definition: Player.h:302
Definition: Player.h:535
PetSaveMode
Definition: PetDefines.h:32
Definition: Object.h:267
Definition: SharedDefines.h:94
Definition: Item.h:48
AuraEffect const * ConvertAura
Definition: Player.h:473
void InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level)
Definition: PlayerTaxi.cpp:7
Definition: Bag.h:28
QuestFailedReason
Definition: QuestDef.h:53
Powers
Definition: SharedDefines.h:246
Definition: Unit.h:534
float GetOrientation() const
Definition: Position.h:107
Definition: Unit.h:536
Definition: Player.h:543
Definition: Creature.h:424
#define MAX_GLYPH_SLOT_INDEX
Definition: SharedDefines.h:854
PlayerSpellState state
Definition: Player.h:112
Definition: Player.h:580
virtual bool UpdateStats(Stats stat)=0
std::bitset< CUF_BOOL_OPTIONS_COUNT > BoolOptions
Definition: Player.h:287
Definition: Player.h:476
Definition: Unit.h:378
uint8 button
Definition: Player.h:387
Language
Definition: SharedDefines.h:959
std::list< SpellModifier * > SpellModList
Definition: Player.h:198
Definition: UpdateFields.h:197
RuneInfo runes[MAX_RUNES]
Definition: Player.h:478
Definition: Player.h:212
float y2
Definition: Player.h:448
Definition: DB2Structure.h:27
Definition: Player.h:418
Definition: Player.h:462
Definition: Player.h:134
PartyResult
Definition: SharedDefines.h:4841
PlayerFlagsEx
Definition: Player.h:551
Definition: adtfile.h:39
bool IsInFFAPvPArea
Marks if player is in a sanctuary or friendly capital city
Definition: Player.h:425
PlayerBytes3Offsets
Definition: Player.h:585
bool disabled
Definition: Player.h:115
Definition: Player.h:330
uint32 leftduration
Definition: Player.h:499
Gender
Definition: SharedDefines.h:90
Definition: DB2Structure.h:62
Definition: Player.h:562
uint16 BottomOffset
Definition: Player.h:284
Definition: Player.h:123
Definition: Player.h:208
Definition: Player.h:527
Definition: TradeData.h:34
LootType
Definition: LootMgr.h:86
SheathState
Definition: Unit.h:296
Definition: Player.h:337
Definition: LootMgr.h:314
CUFProfile()
Definition: Player.h:241
BaseModType
Definition: Unit.h:532
AchievementCriteriaTimedTypes
Definition: DBCEnums.h:181
float GetPositionY() const
Definition: Position.h:105
Definition: Player.h:589
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:1080
Definition: Player.h:464
G3D::int16 z
Definition: Vector3int16.h:46
std::unordered_map< uint32, PlayerSpell * > PlayerSpellMap
Definition: Player.h:197
Definition: Player.h:63
Definition: SocialMgr.h:103
AchievementCriteriaTypes
Definition: DBCEnums.h:196
uint32 WeeklyQuantity
Definition: Player.h:191
Definition: Item.h:259
Definition: Player.h:540
Definition: Unit.h:529
Definition: Util.h:362
#define MAX_COMBAT_RATING
Definition: Unit.h:658
virtual void UpdateUnderwaterState(Map *m, float x, float y, float z)
Definition: Unit.cpp:2974
Definition: Player.h:528
Definition: Player.h:69
#define sSpellMgr
Definition: SpellMgr.h:756
RuneType lastUsedRune
Definition: Player.h:480
Definition: Player.h:142
Definition: DB2Structure.h:726
float GetPositionZ() const
Definition: Position.h:106
Definition: Player.h:122
int32_t int32
Definition: Define.h:146
SpellModifier(Aura *_ownerAura=nullptr)
Definition: Player.h:169
Definition: UpdateFields.h:218
float x1
Definition: Player.h:445
#define CLASSMASK_ALL_PLAYABLE
Definition: SharedDefines.h:183
Definition: Unit.h:86
uint32_t uint32
Definition: Define.h:150
Definition: UpdateFields.h:190
TC_GAME_API Corpse * GetCorpse(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:138
uint32 areaFlag
Definition: Player.h:444
uint64_t uint64
Definition: Define.h:149
Definition: Player.h:77
uint32 spellId
Definition: Player.h:175
Definition: Player.h:97
std::unordered_map< uint32, PlayerSpellState > PlayerTalentMap
Definition: Player.h:196
G3D::int16 y
Definition: Vector2int16.h:38
void RemoveFromUpdateQueueOf(Player *player)
Definition: Item.cpp:738
Definition: Player.h:235
ObjectGuid const & GetGuidValue(uint16 index) const
Definition: Object.cpp:332
uint16_t uint16
Definition: Define.h:151
Definition: SharedDefines.h:992
PlayerBytes2Offsets
Definition: Player.h:577
PlayerCreateInfoItems item
Definition: Player.h:409
Definition: Player.h:138
#define DEFAULT_WORLD_OBJECT_SIZE
Definition: Object.h:44
Definition: Player.h:90
bool IsAlwaysDetectableFor(WorldObject const *seer) const override
Definition: Unit.cpp:10352
virtual bool CanAlwaysSee(WorldObject const *) const
Definition: Object.h:659
Definition: GameObject.h:880
Definition: Player.h:307
Definition: Player.h:456
Definition: Player.h:214
void AddItemsSetItem(Player *player, Item *item)
Definition: Item.cpp:35
Definition: Player.h:581
Definition: Player.h:544
Definition: DBCStructure.h:982
Definition: SpellAuraDefines.h:206
Definition: Player.h:139
Definition: Player.h:508
uint16 displayId_m
Definition: Player.h:407
Definition: Player.h:181
ItemClass
Definition: ItemTemplate.h:365
Definition: UpdateFields.h:233
Definition: Player.h:541
QuestGiverStatus
Definition: QuestDef.h:120
Definition: Player.h:517
Definition: Player.h:545
Definition: Player.h:124
virtual void SetSheath(SheathState sheathed)
Definition: Unit.h:1463
Definition: Player.h:67
Definition: Map.h:259
Definition: Spell.h:170
Definition: Player.h:145
Definition: AchievementMgr.h:312
Definition: Player.h:130
Definition: Player.h:150
Definition: InstanceSaveMgr.h:44
Definition: Player.h:129
TeamId
Definition: SharedDefines.h:990
DuelInfo()
Definition: Player.h:431
T CalculatePct(T base, U pct)
Definition: Util.h:92
Definition: Player.h:313
Definition: Player.h:590
uint32 mapId
Definition: Player.h:401
Definition: Player.h:532
Definition: UpdateFields.h:116
Definition: Player.h:216
#define MAX_CLASSES
Definition: SharedDefines.h:181
Definition: Player.h:571
MailResponseType
Definition: SharedDefines.h:4593
PlayerCreateInfoSkills skills
Definition: Player.h:413
Definition: Player.h:529
Definition: Player.h:306
Definition: Player.h:597
ActionButtonType
Definition: Player.h:310
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
Definition: Object.cpp:167
virtual uint32 GetBlockPercent() const
Definition: Unit.h:1557
PlayerCurrencyState
Definition: Player.h:179
Definition: Player.h:324
Definition: DBCStructure.h:405
flag128 mask
Definition: Player.h:174
Definition: Player.h:547
SpecResetType
Definition: Player.h:158
DeathState
Definition: Unit.h:539
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
Definition: Player.h:539
Definition: Player.h:87
Definition: Player.h:228
virtual void Whisper(std::string const &text, Language language, Player *target, bool isBossWhisper=false)
Definition: Unit.cpp:16408
void SetPower(Powers power, int32 val)
Definition: Unit.cpp:11607
TC_GAME_API uint32 const MasterySpells[MAX_CLASSES]
Definition: Player.cpp:114
internal::NamedArg< char > arg(StringRef name, const T &arg)
Definition: format.h:3248
virtual void Yell(std::string const &text, Language language, WorldObject const *target=nullptr)
Definition: Unit.cpp:16398
uint8_t uint8
Definition: g3dmath.h:164
ObjectGuid const & GetGUID() const
Definition: Object.h:105
static Position Location[]
Definition: boss_skadi.cpp:46
Definition: Player.h:183
Definition: Player.h:317
MailResponseResult
Definition: SharedDefines.h:4603
uint8 getRace() const
Definition: Unit.h:1411
Definition: Player.h:319
Definition: Player.h:217
Definition: Player.h:519
bool IsInNoPvPArea
Marks if player is in an area which forces PvP flag
Definition: Player.h:424
Definition: OutdoorPvP.h:188
void DestroyForPlayer(Player *target) const override
Definition: Unit.cpp:16301
Definition: Player.h:219
Definition: ItemTemplate.h:647
BattlegroundQueueTypeId
Definition: SharedDefines.h:4732
Definition: CharacterPackets.h:40
Definition: PlayerTaxi.h:9
virtual void setDeathState(DeathState s)
Definition: Unit.cpp:10593
QuestPushReason
Definition: QuestDef.h:71
Definition: Player.h:542
Definition: DB2Structure.h:710
uint8 BottomPoint
Definition: Player.h:279
Item * item
Definition: Player.h:497
Definition: LootMgr.h:213
PlayerBytesOffsets
Definition: Player.h:569
uint8 HealthText
Definition: Player.h:275
Definition: Player.h:548
Definition: Player.h:152
void SetActionAndType(uint32 action, ActionButtonType type)
Definition: Player.h:347
Definition: Player.h:465
EnchantDuration(Item *_item, EnchantmentSlot _slot, uint32 _leftduration)
Definition: Player.h:494
Definition: Player.h:560
Definition: Player.h:468
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:332
Definition: Player.h:231
virtual void SetObjectScale(float scale)
Definition: Object.h:111
Definition: UpdateFields.h:27
Definition: Player.h:533
Definition: Player.h:95
Definition: Player.h:85
Definition: Player.h:128
#define TC_GAME_API
Definition: Define.h:134
Player * opponent
Definition: Player.h:434
time_t EndTimer
Marks if player is in an FFAPvP area (such as Gurubashi Arena)
Definition: Player.h:426
Definition: Player.h:298
uint8 TopPoint
Definition: Player.h:278
Definition: Player.h:84
Definition: DBCStructure.h:172
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:1067
Definition: Player.h:224
PlayerFlags
Definition: Player.h:515
#define RACEMASK_ALL_PLAYABLE
Definition: SharedDefines.h:133
virtual void SetTarget(ObjectGuid const &)=0
Definition: Player.h:103
Definition: SharedDefines.h:4687
uint8 getClass() const
Definition: Unit.h:1413
Definition: Unit.h:535
virtual bool IsInWater() const
Definition: Unit.cpp:2964
Definition: Player.h:207
#define MAX_SPELLMOD
Definition: Unit.h:125
Definition: Player.h:162
virtual void SetPvP(bool state)
Definition: Unit.cpp:14455
Definition: Player.h:520
uint8_t uint8
Definition: Define.h:152
uint8 Flags
Definition: Player.h:193
Definition: Position.h:27
#define MAPID_INVALID
Definition: Position.h:226
#define ASSERT
Definition: Errors.h:55
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition: Unit.cpp:15454
Definition: Player.h:107
Definition: SharedDefines.h:4560
Definition: Player.h:225
Definition: Battleground.h:235
#define ACTION_BUTTON_TYPE(X)
Definition: Player.h:334
Definition: DBCStructure.h:74
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: UpdateFields.h:191
int32 value
Definition: Player.h:173
SpellModType
Definition: Player.h:75
uint16 FrameHeight
Definition: Player.h:272
Definition: Player.h:218
const FieldDescriptor value
Definition: descriptor.h:1522
std::unordered_set< ObjectGuid > GuidUnorderedSet
Definition: ObjectGuid.h:336
Definition: Player.h:149
uint32 GetEntry() const
Definition: Object.h:107
int16_t int16
Definition: Define.h:147
Definition: Player.h:213
Definition: Player.h:463
Definition: Player.h:579
Definition: Player.h:326
Definition: Player.h:329
Player session in the World.
Definition: WorldSession.h:882
Definition: ObjectGuid.h:189
uint8 LeftPoint
Definition: Player.h:280
uint8 flags
Definition: DisableMgr.cpp:44
uint32_t uint32
Definition: g3dmath.h:168
Definition: Player.h:227
virtual void SendMessageToSet(WorldPacket const *data, bool self)
Definition: Object.cpp:2144
#define const
Definition: zconf.h:217
int32 GetQuestLevel() const
Definition: QuestDef.h:310
Definition: Player.h:509
Definition: Player.h:132
void SetHealth(uint32 val)
Definition: Unit.cpp:11537
EnchantDuration()
Definition: Player.h:493
G3D::int16 x
Definition: Vector2int16.h:37
Definition: Player.h:536
Definition: Player.h:429
Definition: Player.h:327
Definition: Player.h:461
PlayerCreateInfoItem(uint32 id, uint32 amount)
Definition: Player.h:365
virtual bool CanFly() const =0
Definition: Unit.h:1101
Definition: Player.h:155
InventoryResult
Definition: Item.h:46
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
Definition: Player.h:211
PlayerLocalFlags
Definition: Player.h:557
Definition: Player.h:221
RuneType
Definition: Player.h:459
Definition: SpellAuras.h:116
Definition: Player.h:534
float GetPositionX() const
Definition: Position.h:104
Definition: Player.h:314
Definition: Player.h:68
Definition: Player.h:160
virtual void UpdateMaxHealth()=0
uint32 GetHealth() const
Definition: Unit.h:1426
Definition: Player.h:538
WeaponAttackType
Definition: Unit.h:615
float y1
Definition: Player.h:447
Type
Type of JSON value.
Definition: rapidjson.h:642
Definition: SharedDefines.h:993
Definition: Player.h:554
PlayerCreateInfoSpells castSpells
Definition: Player.h:411
Definition: Player.h:373
Definition: Guild.h:320
Definition: DBCStructure.h:1255
#define MAX_PLAYED_TIME_INDEX
CUFBoolOptions
Bit index used in the many bool options of CompactUnitFrames.
Definition: Player.h:205
Definition: Unit.h:1305
Definition: Player.h:146
CombatRating
Definition: Unit.h:623
Say
Definition: boss_broodlord_lashlayer.cpp:23
std::deque< Mail * > PlayerMails
Definition: Player.h:56
int16 charges
Definition: Player.h:172
ActionButton()
Definition: Player.h:339
Definition: Player.h:222
Definition: Player.h:546
PlayerInfo()
Definition: Player.h:399
virtual bool UpdateAllStats()=0
Definition: Player.h:64
uint16 displayId_f
Definition: Player.h:408
uint64 GetUInt64Value(uint16 index) const
Definition: Object.cpp:306
std::string ProfileName
Definition: Player.h:271
Definition: WorldPacket.h:26
PlayerCreateInfoAction()
Definition: Player.h:384
PetType
Definition: PetDefines.h:22
Definition: Creature.h:79
SkillFieldOffset
Definition: Player.h:61
Definition: Player.h:530
uint32 TrackedQuantity
Definition: Player.h:192
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition: Object.cpp:318
Definition: Player.h:137
Data
Definition: molten_core.h:69
#define MAX_TALENT_TIERS
Definition: DBCStructure.h:1252
Definition: Player.h:98
#define DEFAULT_COMBAT_REACH
Definition: Object.h:45
Definition: Player.h:133
Definition: Pet.h:46
Definition: Player.h:136
std::unordered_map< uint32, time_t > InstanceTimeMap
Definition: Player.h:292
Definition: Player.h:210
void Update(uint32 diff)
Definition: WeatherMgr.cpp:150
Definition: Group.h:191
LootError
Definition: LootMgr.h:104
Definition: GroupReference.h:27
Definition: SharedDefines.h:248
uint32 Cooldown
Definition: Player.h:472
virtual void UpdateAttackPowerAndDamage(bool ranged=false)=0
Represents a CompactUnitFrame profile.
Definition: Player.h:239
Definition: Player.h:135
Definition: Player.h:522
Definition: Player.h:574
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58
Definition: Player.h:531
Definition: Spell.h:294
Definition: MapReference.h:25