Guest User

Untitled

a guest
Nov 15th, 2019
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 137.78 KB | None | 0 0
  1. /*
  2. * Copyright (C) 2008-2018 TrinityCore <https://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 "Arena.h"
  23. #include "ArenaHelper.h"
  24. #include "ArchaeologyPlayerMgr.h"
  25. #include "Unit.h"
  26. #include "CUFProfile.h"
  27. #include "DatabaseEnvFwd.h"
  28. #include "DBCEnums.h"
  29. #include "EquipementSet.h"
  30. #include "GroupReference.h"
  31. #include "ItemDefines.h"
  32. #include "ItemEnchantmentMgr.h"
  33. #include "MapReference.h"
  34. #include "Optional.h"
  35. #include "PetDefines.h"
  36. #include "PlayerTaxi.h"
  37. #include "QuestDef.h"
  38. #include "SceneMgr.h"
  39. #include <queue>
  40. #include "GarrisonMgr.h"
  41.  
  42. struct AccessRequirement;
  43. struct AchievementEntry;
  44. struct AreaTableEntry;
  45. struct AreaTriggerEntry;
  46. struct AreaTriggerTeleportStruct;
  47. struct ArtifactPowerRankEntry;
  48. struct BarberShopStyleEntry;
  49. struct CharTitlesEntry;
  50. struct ChatChannelsEntry;
  51. struct ChrSpecializationEntry;
  52. struct CreatureTemplate;
  53. struct CurrencyTypesEntry;
  54. struct FactionEntry;
  55. struct ItemExtendedCostEntry;
  56. struct ItemLimitCategoryEntry;
  57. struct ItemSetEffect;
  58. struct ItemTemplate;
  59. struct Loot;
  60. struct Mail;
  61. struct MapEntry;
  62. struct PvpTalentEntry;
  63. struct QuestPackageItemEntry;
  64. struct RewardPackEntry;
  65. struct SkillRaceClassInfoEntry;
  66. struct TalentEntry;
  67. struct TrainerSpell;
  68. struct VendorItem;
  69.  
  70. class AELootResult;
  71. class Bag;
  72. class Battleground;
  73. class Channel;
  74. class CinematicMgr;
  75. class Creature;
  76. class DynamicObject;
  77. class Garrison;
  78. class Group;
  79. class Guild;
  80. class Item;
  81. class LootStore;
  82. class OutdoorPvP;
  83. class Pet;
  84. class PlayerAI;
  85. class PlayerAchievementMgr;
  86. class PlayerMenu;
  87. class PlayerSocial;
  88. class QuestObjectiveCriteriaMgr;
  89. class ReputationMgr;
  90. class RestMgr;
  91. class SpellCastTargets;
  92. class TradeData;
  93.  
  94. enum GroupCategory : uint8;
  95. enum InventoryType : uint8;
  96. enum ItemClass : uint8;
  97. enum LootError : uint8;
  98. enum LootType : uint8;
  99. enum ToastDisplayMethod : uint8;
  100.  
  101. namespace WorldPackets
  102. {
  103. namespace Character
  104. {
  105. struct CharacterCreateInfo;
  106. }
  107.  
  108. namespace Battleground
  109. {
  110. struct RatedInfo;
  111. }
  112. }
  113.  
  114. typedef std::deque<Mail*> PlayerMails;
  115.  
  116. // the PlayerFields has 10 * 32bit fields, to store 20 * 16 bit research results.
  117. #define PLAYER_FIELD_RESEARCHING_MAX 19
  118.  
  119. #define PLAYER_MAX_SKILLS 128
  120. enum SkillFieldOffset
  121. {
  122. SKILL_ID_OFFSET = 0,
  123. SKILL_STEP_OFFSET = 64,
  124. SKILL_RANK_OFFSET = SKILL_STEP_OFFSET + 64,
  125. SUBSKILL_START_RANK_OFFSET = SKILL_RANK_OFFSET + 64,
  126. SKILL_MAX_RANK_OFFSET = SUBSKILL_START_RANK_OFFSET + 64,
  127. SKILL_TEMP_BONUS_OFFSET = SKILL_MAX_RANK_OFFSET + 64,
  128. SKILL_PERM_BONUS_OFFSET = SKILL_TEMP_BONUS_OFFSET + 64
  129. };
  130.  
  131. #define PLAYER_EXPLORED_ZONES_SIZE 320
  132.  
  133. // Note: SPELLMOD_* values is aura types in fact
  134. enum SpellModType : uint8
  135. {
  136. SPELLMOD_FLAT = 0, // SPELL_AURA_ADD_FLAT_MODIFIER
  137. SPELLMOD_PCT = 1, // SPELL_AURA_ADD_PCT_MODIFIER
  138. SPELLMOD_END
  139. };
  140.  
  141. // 2^n values, Player::m_isunderwater is a bitmask. These are Trinity internal values, they are never send to any client
  142. enum PlayerUnderwaterState
  143. {
  144. UNDERWATER_NONE = 0x00,
  145. UNDERWATER_INWATER = 0x01, // terrain type is water and player is afflicted by it
  146. UNDERWATER_INLAVA = 0x02, // terrain type is lava and player is afflicted by it
  147. UNDERWATER_INSLIME = 0x04, // terrain type is lava and player is afflicted by it
  148. UNDERWARER_INDARKWATER = 0x08, // terrain type is dark water and player is afflicted by it
  149.  
  150. UNDERWATER_EXIST_TIMERS = 0x10
  151. };
  152.  
  153. enum BuyBankSlotResult
  154. {
  155. ERR_BANKSLOT_FAILED_TOO_MANY = 0,
  156. ERR_BANKSLOT_INSUFFICIENT_FUNDS = 1,
  157. ERR_BANKSLOT_NOTBANKER = 2,
  158. ERR_BANKSLOT_OK = 3
  159. };
  160.  
  161. enum PlayerSpellState : uint8
  162. {
  163. PLAYERSPELL_UNCHANGED = 0,
  164. PLAYERSPELL_CHANGED = 1,
  165. PLAYERSPELL_NEW = 2,
  166. PLAYERSPELL_REMOVED = 3,
  167. PLAYERSPELL_TEMPORARY = 4
  168. };
  169.  
  170. struct PlayerSpell
  171. {
  172. PlayerSpellState state : 8;
  173. bool active : 1; // show in spellbook
  174. bool dependent : 1; // learned as result another spell learn, skill grow, quest reward, etc
  175. bool disabled : 1; // first rank has been learned in result talent learn but currently talent unlearned, save max learned ranks
  176. };
  177.  
  178. struct AnticheatData
  179. {
  180. uint32 lastOpcode;
  181. MovementInfo lastMovementInfo;
  182. bool disableACCheck;
  183. uint32 disableACCheckTimer;
  184. uint32 total_reports;
  185. uint32 type_reports[5];
  186. uint32 average;
  187. uint64 creation_time;
  188. };
  189.  
  190. enum TalentSpecialization // talent tabs
  191. {
  192. TALENT_SPEC_MAGE_ARCANE = 62,
  193. TALENT_SPEC_MAGE_FIRE = 63,
  194. TALENT_SPEC_MAGE_FROST = 64,
  195. TALENT_SPEC_PALADIN_HOLY = 65,
  196. TALENT_SPEC_PALADIN_PROTECTION = 66,
  197. TALENT_SPEC_PALADIN_RETRIBUTION = 70,
  198. TALENT_SPEC_WARRIOR_ARMS = 71,
  199. TALENT_SPEC_WARRIOR_FURY = 72,
  200. TALENT_SPEC_WARRIOR_PROTECTION = 73,
  201. TALENT_SPEC_DRUID_BALANCE = 102,
  202. TALENT_SPEC_DRUID_CAT = 103,
  203. TALENT_SPEC_DRUID_BEAR = 104,
  204. TALENT_SPEC_DRUID_RESTORATION = 105,
  205. TALENT_SPEC_DEATHKNIGHT_BLOOD = 250,
  206. TALENT_SPEC_DEATHKNIGHT_FROST = 251,
  207. TALENT_SPEC_DEATHKNIGHT_UNHOLY = 252,
  208. TALENT_SPEC_HUNTER_BEASTMASTER = 253,
  209. TALENT_SPEC_HUNTER_MARKSMAN = 254,
  210. TALENT_SPEC_HUNTER_SURVIVAL = 255,
  211. TALENT_SPEC_PRIEST_DISCIPLINE = 256,
  212. TALENT_SPEC_PRIEST_HOLY = 257,
  213. TALENT_SPEC_PRIEST_SHADOW = 258,
  214. TALENT_SPEC_ROGUE_ASSASSINATION = 259,
  215. TALENT_SPEC_ROGUE_COMBAT = 260,
  216. TALENT_SPEC_ROGUE_SUBTLETY = 261,
  217. TALENT_SPEC_SHAMAN_ELEMENTAL = 262,
  218. TALENT_SPEC_SHAMAN_ENHANCEMENT = 263,
  219. TALENT_SPEC_SHAMAN_RESTORATION = 264,
  220. TALENT_SPEC_WARLOCK_AFFLICTION = 265,
  221. TALENT_SPEC_WARLOCK_DEMONOLOGY = 266,
  222. TALENT_SPEC_WARLOCK_DESTRUCTION = 267,
  223. TALENT_SPEC_MONK_BREWMASTER = 268,
  224. TALENT_SPEC_MONK_BATTLEDANCER = 269,
  225. TALENT_SPEC_MONK_MISTWEAVER = 270,
  226. TALENT_SPEC_DEMON_HUNTER_HAVOC = 577,
  227. TALENT_SPEC_DEMON_HUNTER_VENGEANCE = 581
  228. };
  229.  
  230. enum SpecResetType
  231. {
  232. SPEC_RESET_TALENTS = 0,
  233. SPEC_RESET_SPECIALIZATION = 1,
  234. SPEC_RESET_GLYPHS = 2,
  235. SPEC_RESET_PET_TALENTS = 3
  236. };
  237.  
  238. // Spell modifier (used for modify other spells)
  239. struct SpellModifier
  240. {
  241. SpellModifier(Aura* _ownerAura) : op(SPELLMOD_DAMAGE), type(SPELLMOD_FLAT), value(0), mask(), spellId(0), ownerAura(_ownerAura) { }
  242.  
  243. SpellModOp op;
  244. SpellModType type;
  245.  
  246. int32 value;
  247. flag128 mask;
  248. uint32 spellId;
  249. Aura* const ownerAura;
  250. };
  251.  
  252. enum PlayerCurrencyState
  253. {
  254. PLAYERCURRENCY_UNCHANGED = 0,
  255. PLAYERCURRENCY_CHANGED = 1,
  256. PLAYERCURRENCY_NEW = 2,
  257. PLAYERCURRENCY_REMOVED = 3 //not removed just set count == 0
  258. };
  259.  
  260. typedef std::list<uint32> ItemSpellList;
  261.  
  262. struct PlayerCurrency
  263. {
  264. PlayerCurrency() : state(PLAYERCURRENCY_NEW), Quantity(0), WeeklyQuantity(0), TrackedQuantity(0), WeekCap(0), Flags(0) { }
  265.  
  266. PlayerCurrencyState state;
  267. uint32 Quantity;
  268. uint32 WeeklyQuantity;
  269. uint32 TrackedQuantity;
  270. uint32 WeekCap;
  271. uint8 Flags;
  272. };
  273.  
  274. typedef std::map<uint32, SpellCooldown> SpellCooldowns;
  275. typedef std::unordered_map<uint32, PlayerSpellState> PlayerTalentMap;
  276. typedef std::unordered_map<uint32, PlayerSpell*> PlayerSpellMap;
  277. typedef std::unordered_set<SpellModifier*> SpellModContainer;
  278. typedef std::unordered_map<uint32, PlayerCurrency> PlayerCurrenciesMap;
  279. typedef std::list<uint32> ExcludeCasterSpellList;
  280. typedef std::unordered_map<uint32 /*instanceId*/, time_t/*releaseTime*/> InstanceTimeMap;
  281.  
  282. enum TrainerSpellState
  283. {
  284. TRAINER_SPELL_GRAY = 0,
  285. TRAINER_SPELL_GREEN = 1,
  286. TRAINER_SPELL_RED = 2,
  287. TRAINER_SPELL_GREEN_DISABLED = 10 // custom value, not send to client: formally green but learn not allowed
  288. };
  289.  
  290. enum ActionButtonUpdateState
  291. {
  292. ACTIONBUTTON_UNCHANGED = 0,
  293. ACTIONBUTTON_CHANGED = 1,
  294. ACTIONBUTTON_NEW = 2,
  295. ACTIONBUTTON_DELETED = 3
  296. };
  297.  
  298. enum ActionButtonType
  299. {
  300. ACTION_BUTTON_SPELL = 0x00,
  301. ACTION_BUTTON_C = 0x01, // click?
  302. ACTION_BUTTON_EQSET = 0x20,
  303. ACTION_BUTTON_DROPDOWN = 0x30,
  304. ACTION_BUTTON_MACRO = 0x40,
  305. ACTION_BUTTON_CMACRO = ACTION_BUTTON_C | ACTION_BUTTON_MACRO,
  306. ACTION_BUTTON_MOUNT = 0x60,
  307. ACTION_BUTTON_ITEM = 0x80
  308. };
  309.  
  310. enum ReputationSource
  311. {
  312. REPUTATION_SOURCE_KILL,
  313. REPUTATION_SOURCE_QUEST,
  314. REPUTATION_SOURCE_DAILY_QUEST,
  315. REPUTATION_SOURCE_WEEKLY_QUEST,
  316. REPUTATION_SOURCE_MONTHLY_QUEST,
  317. REPUTATION_SOURCE_REPEATABLE_QUEST,
  318. REPUTATION_SOURCE_SPELL
  319. };
  320.  
  321. #define ACTION_BUTTON_ACTION(X) (uint64(X) & 0x00000000FFFFFFFF)
  322. #define ACTION_BUTTON_TYPE(X) ((uint64(X) & 0xFFFFFFFF00000000) >> 56)
  323. #define MAX_ACTION_BUTTON_ACTION_VALUE (0xFFFFFFFF)
  324.  
  325. struct ActionButton
  326. {
  327. ActionButton() : packedData(0), uState(ACTIONBUTTON_NEW) { }
  328.  
  329. uint64 packedData;
  330. ActionButtonUpdateState uState;
  331.  
  332. // helpers
  333. ActionButtonType GetType() const { return ActionButtonType(ACTION_BUTTON_TYPE(packedData)); }
  334. uint32 GetAction() const { return ACTION_BUTTON_ACTION(packedData); }
  335. void SetActionAndType(uint32 action, ActionButtonType type)
  336. {
  337. uint64 newData = uint64(action) | (uint64(type) << 56);
  338. if (newData != packedData || uState == ACTIONBUTTON_DELETED)
  339. {
  340. packedData = newData;
  341. if (uState != ACTIONBUTTON_NEW)
  342. uState = ACTIONBUTTON_CHANGED;
  343. }
  344. }
  345. };
  346.  
  347. #define MAX_ACTION_BUTTONS 132
  348.  
  349. typedef std::map<uint8, ActionButton> ActionButtonList;
  350.  
  351. struct SpellCooldown
  352. {
  353. SpellCooldown(double _end, uint32 _itemid) : end(_end), itemid(_itemid) {}
  354.  
  355. double end;
  356. uint32 itemid;
  357. float rate = 1.0f;
  358. };
  359.  
  360. struct PvPInfo
  361. {
  362. PvPInfo() : IsHostile(false), IsInHostileArea(false), IsInNoPvPArea(false), IsInFFAPvPArea(false), EndTimer(0) { }
  363.  
  364. bool IsHostile;
  365. bool IsInHostileArea; ///> Marks if player is in an area which forces PvP flag
  366. bool IsInNoPvPArea; ///> Marks if player is in a sanctuary or friendly capital city
  367. bool IsInFFAPvPArea; ///> Marks if player is in an FFAPvP area (such as Gurubashi Arena)
  368. time_t EndTimer; ///> Time when player unflags himself for PvP (flag removed after 5 minutes)
  369. };
  370.  
  371. struct DuelInfo
  372. {
  373. DuelInfo() : initiator(nullptr), opponent(nullptr), startTimer(0), startTime(0), outOfBound(0), isMounted(false), isCompleted(false) { }
  374.  
  375. Player* initiator;
  376. Player* opponent;
  377. time_t startTimer;
  378. time_t startTime;
  379. time_t outOfBound;
  380. bool isMounted;
  381. bool isCompleted;
  382. };
  383.  
  384. struct Areas
  385. {
  386. uint32 areaID;
  387. uint32 areaFlag;
  388. float x1;
  389. float x2;
  390. float y1;
  391. float y2;
  392. };
  393.  
  394. #define MAX_RUNES 7
  395. #define MAX_RECHARGING_RUNES 3
  396.  
  397. enum RuneCooldowns
  398. {
  399. RUNE_BASE_COOLDOWN = 10000,
  400. RUNE_MISS_COOLDOWN = 1500 // cooldown applied on runes when the spell misses
  401. };
  402.  
  403. struct Runes
  404. {
  405. std::deque<uint8> CooldownOrder;
  406. uint32 Cooldown[MAX_RUNES];
  407. uint8 RuneState; // mask of available runes
  408.  
  409. void SetRuneState(uint8 index, bool set = true);
  410. };
  411.  
  412. struct EnchantDuration
  413. {
  414. EnchantDuration() : item(nullptr), slot(MAX_ENCHANTMENT_SLOT), leftduration(0) { }
  415. EnchantDuration(Item* _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot),
  416. leftduration(_leftduration){ ASSERT(item); }
  417.  
  418. Item* item;
  419. EnchantmentSlot slot;
  420. uint32 leftduration;
  421. };
  422.  
  423. typedef std::list<EnchantDuration> EnchantDurationList;
  424. typedef std::list<Item*> ItemDurationList;
  425.  
  426. enum DrunkenState
  427. {
  428. DRUNKEN_SOBER = 0,
  429. DRUNKEN_TIPSY = 1,
  430. DRUNKEN_DRUNK = 2,
  431. DRUNKEN_SMASHED = 3
  432. };
  433.  
  434. #define MAX_DRUNKEN 4
  435.  
  436. enum PlayerFlags
  437. {
  438. PLAYER_FLAGS_GROUP_LEADER = 0x00000001,
  439. PLAYER_FLAGS_AFK = 0x00000002,
  440. PLAYER_FLAGS_DND = 0x00000004,
  441. PLAYER_FLAGS_GM = 0x00000008,
  442. PLAYER_FLAGS_GHOST = 0x00000010,
  443. PLAYER_FLAGS_RESTING = 0x00000020,
  444. PLAYER_FLAGS_UNK6 = 0x00000040,
  445. PLAYER_FLAGS_UNK7 = 0x00000080, // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state
  446. PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards
  447. PLAYER_FLAGS_IN_PVP = 0x00000200,
  448. PLAYER_FLAGS_HIDE_HELM = 0x00000400,
  449. PLAYER_FLAGS_HIDE_CLOAK = 0x00000800,
  450. PLAYER_FLAGS_PLAYED_LONG_TIME = 0x00001000, // played long time
  451. PLAYER_FLAGS_PLAYED_TOO_LONG = 0x00002000, // played too long time
  452. PLAYER_FLAGS_IS_OUT_OF_BOUNDS = 0x00004000,
  453. PLAYER_FLAGS_DEVELOPER = 0x00008000, // <Dev> prefix for something?
  454. PLAYER_FLAGS_UNK16 = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary
  455. PLAYER_FLAGS_TAXI_BENCHMARK = 0x00020000, // taxi benchmark mode (on/off) (2.0.1)
  456. PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually)
  457. PLAYER_FLAGS_UBER = 0x00080000,
  458. PLAYER_FLAGS_UNK20 = 0x00100000,
  459. PLAYER_FLAGS_UNK21 = 0x00200000,
  460. PLAYER_FLAGS_COMMENTATOR2 = 0x00400000,
  461. 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
  462. PLAYER_FLAGS_PET_BATTLES_UNLOCKED = 0x01000000, // enables pet battles
  463. PLAYER_FLAGS_NO_XP_GAIN = 0x02000000,
  464. PLAYER_FLAGS_UNK26 = 0x04000000,
  465. PLAYER_FLAGS_AUTO_DECLINE_GUILD = 0x08000000, // Automatically declines guild invites
  466. PLAYER_FLAGS_GUILD_LEVEL_ENABLED = 0x10000000, // Lua_GetGuildLevelEnabled() - enables guild leveling related UI
  467. PLAYER_FLAGS_VOID_UNLOCKED = 0x20000000, // void storage
  468. PLAYER_FLAGS_MENTOR = 0x40000000,
  469. PLAYER_FLAGS_UNK31 = 0x80000000
  470. };
  471.  
  472. enum PlayerFlagsEx
  473. {
  474. PLAYER_FLAGS_EX_REAGENT_BANK_UNLOCKED = 0x0001,
  475. PLAYER_FLAGS_EX_MERCENARY_MODE = 0x0002
  476. };
  477.  
  478. enum PlayerLocalFlags
  479. {
  480. PLAYER_LOCAL_FLAG_CONTROLLING_PET = 0x00000001, // Displays "You have an active summon already" when trying to tame new pet
  481. PLAYER_LOCAL_FLAG_TRACK_STEALTHED = 0x00000002,
  482. PLAYER_LOCAL_FLAG_RELEASE_TIMER = 0x00000008, // Display time till auto release spirit
  483. PLAYER_LOCAL_FLAG_NO_RELEASE_WINDOW = 0x00000010, // Display no "release spirit" window at all
  484. PLAYER_LOCAL_FLAG_NO_PET_BAR = 0x00000020, // CGPetInfo::IsPetBarUsed
  485. PLAYER_LOCAL_FLAG_OVERRIDE_CAMERA_MIN_HEIGHT = 0x00000040,
  486. PLAYER_LOCAL_FLAG_NEWLY_BOOSTED_CHARACTER = 0x00000080,
  487. PLAYER_LOCAL_FLAG_USING_PARTY_GARRISON = 0x00000100,
  488. PLAYER_LOCAL_FLAG_CAN_USE_OBJECTS_MOUNTED = 0x00000200,
  489. PLAYER_LOCAL_FLAG_CAN_VISIT_PARTY_GARRISON = 0x00000400,
  490. PLAYER_LOCAL_FLAG_ACCOUNT_SECURED = 0x00001000, // Script_IsAccountSecured
  491. };
  492.  
  493. enum PlayerBytesOffsets
  494. {
  495. PLAYER_BYTES_OFFSET_SKIN_ID = 0,
  496. PLAYER_BYTES_OFFSET_FACE_ID = 1,
  497. PLAYER_BYTES_OFFSET_HAIR_STYLE_ID = 2,
  498. PLAYER_BYTES_OFFSET_HAIR_COLOR_ID = 3
  499. };
  500.  
  501. enum PlayerBytes2Offsets
  502. {
  503. PLAYER_BYTES_2_OFFSET_CUSTOM_DISPLAY_OPTION = 0, // 3 bytes
  504. PLAYER_BYTES_2_OFFSET_FACIAL_STYLE = 3
  505. };
  506.  
  507. enum PlayerBytes3Offsets
  508. {
  509. PLAYER_BYTES_3_OFFSET_PARTY_TYPE = 0,
  510. PLAYER_BYTES_3_OFFSET_BANK_BAG_SLOTS = 1,
  511. PLAYER_BYTES_3_OFFSET_GENDER = 2,
  512. PLAYER_BYTES_3_OFFSET_INEBRIATION = 3
  513. };
  514.  
  515. enum PlayerBytes4Offsets
  516. {
  517. PLAYER_BYTES_4_OFFSET_PVP_TITLE = 0,
  518. PLAYER_BYTES_4_OFFSET_ARENA_FACTION = 1
  519. };
  520.  
  521. enum PlayerFieldBytesOffsets
  522. {
  523. PLAYER_FIELD_BYTES_OFFSET_RAF_GRANTABLE_LEVEL = 0,
  524. PLAYER_FIELD_BYTES_OFFSET_ACTION_BAR_TOGGLES = 1,
  525. PLAYER_FIELD_BYTES_OFFSET_LIFETIME_MAX_PVP_RANK = 2,
  526. PLAYER_FIELD_BYTES_OFFSET_NUM_RESPECS = 3
  527. };
  528.  
  529. enum PlayerFieldBytes2Offsets
  530. {
  531. PLAYER_FIELD_BYTES_2_OFFSET_IGNORE_POWER_REGEN_PREDICTION_MASK = 0,
  532. PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION = 1,
  533. PLAYER_FIELD_BYTES_2_OFFSET_NUM_BACKPACK_SLOTS = 2
  534. };
  535.  
  536. enum PlayerFieldBytes3Offsets
  537. {
  538. PLAYER_FIELD_BYTES_3_OFFSET_OVERRIDE_SPELLS_ID = 0 // uint16!
  539. };
  540.  
  541. enum PlayerAvgItemLevelOffsets
  542. {
  543. PLAYER_AVG_ITEM_LEVEL_EQUIPPED_AND_BAG = 0,
  544. PLAYER_AVG_ITEM_LEVEL_EQUIPPED = 1,
  545. PLAYER_AVG_ITEM_LEVEL_UNK3 = 2,
  546. PLAYER_AVG_ITEM_LEVEL_UNK4 = 3
  547. };
  548.  
  549. static_assert((PLAYER_FIELD_BYTES_3_OFFSET_OVERRIDE_SPELLS_ID & 1) == 0, "PLAYER_FIELD_BYTES_3_OFFSET_OVERRIDE_SPELLS_ID must be aligned to 2 byte boundary");
  550.  
  551. #define PLAYER_BYTES_3_OVERRIDE_SPELLS_UINT16_OFFSET (PLAYER_FIELD_BYTES_3_OFFSET_OVERRIDE_SPELLS_ID / 2)
  552.  
  553. #define KNOWN_TITLES_SIZE 6
  554. #define MAX_TITLE_INDEX (KNOWN_TITLES_SIZE * 64) // 4 uint64 fields
  555.  
  556. // used in PLAYER_FIELD_BYTES2 values
  557. enum PlayerFieldByte2Flags
  558. {
  559. PLAYER_FIELD_BYTE2_NONE = 0x00,
  560. PLAYER_FIELD_BYTE2_STEALTH = 0x20,
  561. PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW = 0x40
  562. };
  563.  
  564. enum PlayerFieldKillsOffsets
  565. {
  566. PLAYER_FIELD_KILLS_OFFSET_TODAY_KILLS = 0,
  567. PLAYER_FIELD_KILLS_OFFSET_YESTERDAY_KILLS = 1
  568. };
  569.  
  570. enum MirrorTimerType
  571. {
  572. FATIGUE_TIMER = 0,
  573. BREATH_TIMER = 1,
  574. FIRE_TIMER = 2 // feign death
  575. };
  576. #define MAX_TIMERS 3
  577. #define DISABLED_MIRROR_TIMER -1
  578.  
  579. // 2^n values
  580. enum PlayerExtraFlags
  581. {
  582. // gm abilities
  583. PLAYER_EXTRA_GM_ON = 0x0001,
  584. PLAYER_EXTRA_ACCEPT_WHISPERS = 0x0004,
  585. PLAYER_EXTRA_TAXICHEAT = 0x0008,
  586. PLAYER_EXTRA_GM_INVISIBLE = 0x0010,
  587. PLAYER_EXTRA_GM_CHAT = 0x0020, // Show GM badge in chat messages
  588.  
  589. // other states
  590. PLAYER_EXTRA_PVP_DEATH = 0x0100 // store PvP death status until corpse creating.
  591. };
  592.  
  593. // 2^n values
  594. enum AtLoginFlags
  595. {
  596. AT_LOGIN_NONE = 0x000,
  597. AT_LOGIN_RENAME = 0x001,
  598. AT_LOGIN_RESET_SPELLS = 0x002,
  599. AT_LOGIN_RESET_TALENTS = 0x004,
  600. AT_LOGIN_CUSTOMIZE = 0x008,
  601. AT_LOGIN_RESET_PET_TALENTS = 0x010,
  602. AT_LOGIN_FIRST = 0x020,
  603. AT_LOGIN_CHANGE_FACTION = 0x040,
  604. AT_LOGIN_CHANGE_RACE = 0x080,
  605. AT_LOGIN_RESURRECT = 0x100,
  606. };
  607.  
  608. typedef std::map<uint32, QuestStatusData> QuestStatusMap;
  609. typedef std::set<uint32> RewardedQuestSet;
  610.  
  611. enum QuestSaveType
  612. {
  613. QUEST_DEFAULT_SAVE_TYPE = 0,
  614. QUEST_DELETE_SAVE_TYPE,
  615. QUEST_FORCE_DELETE_SAVE_TYPE
  616. };
  617.  
  618. // quest
  619. typedef std::map<uint32, QuestSaveType> QuestStatusSaveMap;
  620.  
  621. // Size of client completed quests bit map
  622. #define QUESTS_COMPLETED_BITS_SIZE 1750
  623.  
  624. enum QuestSlotOffsets
  625. {
  626. QUEST_ID_OFFSET = 0,
  627. QUEST_STATE_OFFSET = 1,
  628. QUEST_COUNTS_OFFSET = 2,
  629. QUEST_TIME_OFFSET = 14
  630. };
  631.  
  632. #define MAX_QUEST_COUNTS 24
  633. #define MAX_QUEST_OFFSET 16
  634.  
  635. enum QuestSlotStateMask
  636. {
  637. QUEST_STATE_NONE = 0x0000,
  638. QUEST_STATE_COMPLETE = 0x0001,
  639. QUEST_STATE_FAIL = 0x0002
  640. };
  641.  
  642. enum SkillUpdateState
  643. {
  644. SKILL_UNCHANGED = 0,
  645. SKILL_CHANGED = 1,
  646. SKILL_NEW = 2,
  647. SKILL_DELETED = 3
  648. };
  649.  
  650. struct SkillStatusData
  651. {
  652. SkillStatusData(uint8 _pos, SkillUpdateState _uState) : pos(_pos), uState(_uState)
  653. {
  654. }
  655. uint8 pos;
  656. SkillUpdateState uState;
  657. };
  658.  
  659. typedef std::unordered_map<uint32, SkillStatusData> SkillStatusMap;
  660.  
  661. class Quest;
  662. class Spell;
  663. class Item;
  664. class WorldSession;
  665.  
  666. enum PlayerSlots
  667. {
  668. // first slot for item stored (in any way in player m_items data)
  669. PLAYER_SLOT_START = 0,
  670. // last+1 slot for item stored (in any way in player m_items data)
  671. PLAYER_SLOT_END = 195,
  672. PLAYER_SLOTS_COUNT = (PLAYER_SLOT_END - PLAYER_SLOT_START)
  673. };
  674.  
  675. #define INVENTORY_SLOT_BAG_0 255
  676. #define INVENTORY_DEFAULT_SIZE 16
  677.  
  678. enum EquipmentSlots : uint8 // 19 slots
  679. {
  680. EQUIPMENT_SLOT_START = 0,
  681. EQUIPMENT_SLOT_HEAD = 0,
  682. EQUIPMENT_SLOT_NECK = 1,
  683. EQUIPMENT_SLOT_SHOULDERS = 2,
  684. EQUIPMENT_SLOT_BODY = 3,
  685. EQUIPMENT_SLOT_CHEST = 4,
  686. EQUIPMENT_SLOT_WAIST = 5,
  687. EQUIPMENT_SLOT_LEGS = 6,
  688. EQUIPMENT_SLOT_FEET = 7,
  689. EQUIPMENT_SLOT_WRISTS = 8,
  690. EQUIPMENT_SLOT_HANDS = 9,
  691. EQUIPMENT_SLOT_FINGER1 = 10,
  692. EQUIPMENT_SLOT_FINGER2 = 11,
  693. EQUIPMENT_SLOT_TRINKET1 = 12,
  694. EQUIPMENT_SLOT_TRINKET2 = 13,
  695. EQUIPMENT_SLOT_BACK = 14,
  696. EQUIPMENT_SLOT_MAINHAND = 15,
  697. EQUIPMENT_SLOT_OFFHAND = 16,
  698. EQUIPMENT_SLOT_RANGED = 17,
  699. EQUIPMENT_SLOT_TABARD = 18,
  700. EQUIPMENT_SLOT_END = 19
  701. };
  702.  
  703. #define VISIBLE_ITEM_ENTRY_OFFSET 0
  704. #define VISIBLE_ITEM_ENCHANTMENT_OFFSET 1
  705.  
  706. enum InventorySlots : uint8 // 4 slots
  707. {
  708. INVENTORY_SLOT_BAG_START = 19,
  709. INVENTORY_SLOT_BAG_END = 23
  710. };
  711.  
  712. enum InventoryPackSlots : uint8 // 24 slots
  713. {
  714. INVENTORY_SLOT_ITEM_START = 23,
  715. INVENTORY_SLOT_ITEM_END = 47
  716. };
  717.  
  718. enum BankItemSlots // 28 slots
  719. {
  720. BANK_SLOT_ITEM_START = 47,
  721. BANK_SLOT_ITEM_END = 75
  722. };
  723.  
  724. enum BankBagSlots // 7 slots
  725. {
  726. BANK_SLOT_BAG_START = 75,
  727. BANK_SLOT_BAG_END = 82
  728. };
  729.  
  730. enum BuyBackSlots // 12 slots
  731. {
  732. // stored in m_buybackitems
  733. BUYBACK_SLOT_START = 82,
  734. BUYBACK_SLOT_END = 94
  735. };
  736.  
  737. enum ReagentSlots // 98 slots
  738. {
  739. REAGENT_SLOT_START = 94,
  740. REAGENT_SLOT_END = 192,
  741. };
  742.  
  743. enum ChildEquipmentSlots
  744. {
  745. CHILD_EQUIPMENT_SLOT_START = 192,
  746. CHILD_EQUIPMENT_SLOT_END = 195,
  747. };
  748.  
  749. struct ItemPosCount
  750. {
  751. ItemPosCount(uint16 _pos, uint32 _count) : pos(_pos), count(_count) { }
  752. bool isContainedIn(std::vector<ItemPosCount> const& vec) const;
  753. uint16 pos;
  754. uint32 count;
  755. };
  756. typedef std::vector<ItemPosCount> ItemPosCountVec;
  757.  
  758. enum TransferAbortReason
  759. {
  760. TRANSFER_ABORT_NONE = 0,
  761. TRANSFER_ABORT_ERROR = 1,
  762. TRANSFER_ABORT_MAX_PLAYERS = 2, // Transfer Aborted: instance is full
  763. TRANSFER_ABORT_NOT_FOUND = 3, // Transfer Aborted: instance not found
  764. TRANSFER_ABORT_TOO_MANY_INSTANCES = 4, // You have entered too many instances recently.
  765. TRANSFER_ABORT_ZONE_IN_COMBAT = 6, // Unable to zone in while an encounter is in progress.
  766. TRANSFER_ABORT_INSUF_EXPAN_LVL = 7, // You must have <TBC, WotLK> expansion installed to access this area.
  767. TRANSFER_ABORT_DIFFICULTY = 8, // <Normal, Heroic, Epic> difficulty mode is not available for %s.
  768. TRANSFER_ABORT_UNIQUE_MESSAGE = 9, // Until you've escaped TLK's grasp, you cannot leave this place!
  769. TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 10, // Additional instances cannot be launched, please try again later.
  770. TRANSFER_ABORT_NEED_GROUP = 11, // Transfer Aborted: you must be in a raid group to enter this instance
  771. TRANSFER_ABORT_NOT_FOUND_2 = 12, // Transfer Aborted: instance not found
  772. TRANSFER_ABORT_NOT_FOUND_3 = 13, // Transfer Aborted: instance not found
  773. TRANSFER_ABORT_NOT_FOUND_4 = 14, // Transfer Aborted: instance not found
  774. TRANSFER_ABORT_REALM_ONLY = 15, // All players in the party must be from the same realm to enter %s.
  775. TRANSFER_ABORT_MAP_NOT_ALLOWED = 16, // Map cannot be entered at this time.
  776. TRANSFER_ABORT_LOCKED_TO_DIFFERENT_INSTANCE = 18, // You are already locked to %s
  777. 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.
  778. TRANSFER_ABORT_DIFFICULTY_NOT_FOUND = 22, // client writes to console "Unable to resolve requested difficultyID %u to actual difficulty for map %d"
  779. TRANSFER_ABORT_XREALM_ZONE_DOWN = 24, // Transfer Aborted: cross-realm zone is down
  780. TRANSFER_ABORT_SOLO_PLAYER_SWITCH_DIFFICULTY = 26, // This instance is already in progress. You may only switch difficulties from inside the instance.
  781. };
  782.  
  783. enum NewWorldReason
  784. {
  785. NEW_WORLD_NORMAL = 16, // Normal map change
  786. NEW_WORLD_SEAMLESS = 21, // Teleport to another map without a loading screen, used for outdoor scenarios
  787. };
  788.  
  789. enum InstanceResetWarningType
  790. {
  791. RAID_INSTANCE_WARNING_HOURS = 1, // WARNING! %s is scheduled to reset in %d hour(s).
  792. RAID_INSTANCE_WARNING_MIN = 2, // WARNING! %s is scheduled to reset in %d minute(s)!
  793. 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!
  794. RAID_INSTANCE_WELCOME = 4, // Welcome to %s. This raid instance is scheduled to reset in %s.
  795. RAID_INSTANCE_EXPIRED = 5
  796. };
  797.  
  798. class InstanceSave;
  799.  
  800. enum TeleportToOptions
  801. {
  802. TELE_TO_GM_MODE = 0x01,
  803. TELE_TO_NOT_LEAVE_TRANSPORT = 0x02,
  804. TELE_TO_NOT_LEAVE_COMBAT = 0x04,
  805. TELE_TO_NOT_UNSUMMON_PET = 0x08,
  806. TELE_TO_SPELL = 0x10,
  807. TELE_TO_SEAMLESS = 0x20,
  808. TELE_TO_CAST_ON_ARRIVAL = 0x40
  809. };
  810.  
  811. enum eTransportVisibleState
  812. {
  813. TRANS_STATE_NEW = 0,
  814. TRANS_STATE_VISIBLE = 1,
  815. TRANS_STATE_NOT_VISIBLE = 2
  816. };
  817.  
  818. /// Type of environmental damages
  819. enum EnviromentalDamage : uint8
  820. {
  821. DAMAGE_EXHAUSTED = 0,
  822. DAMAGE_DROWNING = 1,
  823. DAMAGE_FALL = 2,
  824. DAMAGE_LAVA = 3,
  825. DAMAGE_SLIME = 4,
  826. DAMAGE_FIRE = 5,
  827. DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss
  828. };
  829.  
  830. enum PlayedTimeIndex
  831. {
  832. PLAYED_TIME_TOTAL = 0,
  833. PLAYED_TIME_LEVEL = 1
  834. };
  835.  
  836. #define MAX_PLAYED_TIME_INDEX 2
  837.  
  838. // used at player loading query list preparing, and later result selection
  839. enum PlayerLoginQueryIndex
  840. {
  841. PLAYER_LOGIN_QUERY_LOAD_FROM,
  842. PLAYER_LOGIN_QUERY_LOAD_GROUP,
  843. PLAYER_LOGIN_QUERY_LOAD_BOUND_INSTANCES,
  844. PLAYER_LOGIN_QUERY_LOAD_AURAS,
  845. PLAYER_LOGIN_QUERY_LOAD_AURA_EFFECTS,
  846. PLAYER_LOGIN_QUERY_LOAD_SPELLS,
  847. PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS,
  848. PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_OBJECTIVES,
  849. PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_OBJECTIVES_CRITERIA,
  850. PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_OBJECTIVES_CRITERIA_PROGRESS,
  851. PLAYER_LOGIN_QUERY_LOAD_DAILY_QUEST_STATUS,
  852. PLAYER_LOGIN_QUERY_LOAD_REPUTATION,
  853. PLAYER_LOGIN_QUERY_LOAD_INVENTORY,
  854. PLAYER_LOGIN_QUERY_LOAD_ARTIFACTS,
  855. PLAYER_LOGIN_QUERY_LOAD_ACTIONS,
  856. PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT,
  857. PLAYER_LOGIN_QUERY_LOAD_MAIL_DATE,
  858. PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST,
  859. PLAYER_LOGIN_QUERY_LOAD_ARENA_DATA,
  860. PLAYER_LOGIN_QUERY_LOAD_HOME_BIND,
  861. PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS,
  862. PLAYER_LOGIN_QUERY_LOAD_SPELL_CHARGES,
  863. PLAYER_LOGIN_QUERY_LOAD_DECLINED_NAMES,
  864. PLAYER_LOGIN_QUERY_LOAD_GUILD,
  865. PLAYER_LOGIN_QUERY_LOAD_ACHIEVEMENTS,
  866. PLAYER_LOGIN_QUERY_LOAD_CRITERIA_PROGRESS,
  867. PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS,
  868. PLAYER_LOGIN_QUERY_LOAD_TRANSMOG_OUTFITS,
  869. PLAYER_LOGIN_QUERY_LOAD_BG_DATA,
  870. PLAYER_LOGIN_QUERY_LOAD_GLYPHS,
  871. PLAYER_LOGIN_QUERY_LOAD_TALENTS,
  872. PLAYER_LOGIN_QUERY_LOAD_PVP_TALENTS,
  873. PLAYER_LOGIN_QUERY_LOAD_ACCOUNT_DATA,
  874. PLAYER_LOGIN_QUERY_LOAD_SKILLS,
  875. PLAYER_LOGIN_QUERY_LOAD_WEEKLY_QUEST_STATUS,
  876. PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG,
  877. PLAYER_LOGIN_QUERY_LOAD_BANNED,
  878. PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_REW,
  879. PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES,
  880. PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS,
  881. PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS,
  882. PLAYER_LOGIN_QUERY_LOAD_VOID_STORAGE,
  883. PLAYER_LOGIN_QUERY_LOAD_CURRENCY,
  884. PLAYER_LOGIN_QUERY_LOAD_CUF_PROFILES,
  885. PLAYER_LOGIN_QUERY_LOAD_CORPSE_LOCATION,
  886. PLAYER_LOGIN_QUERY_LOAD_ALL_PETS,
  887. PLAYER_LOGIN_QUERY_LOAD_ARCHAEOLOGY_DIGSITES,
  888. PLAYER_LOGIN_QUERY_LOAD_ARCHAEOLOGY_BRANCHS,
  889. PLAYER_LOGIN_QUERY_LOAD_ARCHAEOLOGY_HISTORY,
  890. MAX_PLAYER_LOGIN_QUERY
  891. };
  892.  
  893. enum PlayerDelayedOperations
  894. {
  895. DELAYED_SAVE_PLAYER = 0x01,
  896. DELAYED_RESURRECT_PLAYER = 0x02,
  897. DELAYED_SPELL_CAST_DESERTER = 0x04,
  898. DELAYED_BG_MOUNT_RESTORE = 0x08, ///< Flag to restore mount state after teleport from BG
  899. DELAYED_BG_TAXI_RESTORE = 0x10, ///< Flag to restore taxi state after teleport from BG
  900. DELAYED_BG_GROUP_RESTORE = 0x20, ///< Flag to restore group state after teleport from BG
  901. DELAYED_END
  902. };
  903.  
  904. // Player summoning auto-decline time (in secs)
  905. #define MAX_PLAYER_SUMMON_DELAY (2*MINUTE)
  906. // Maximum money amount : 2^63 - 1
  907. TC_GAME_API extern uint64 const MAX_MONEY_AMOUNT;
  908.  
  909. enum BindExtensionState
  910. {
  911. EXTEND_STATE_EXPIRED = 0,
  912. EXTEND_STATE_NORMAL = 1,
  913. EXTEND_STATE_EXTENDED = 2,
  914. EXTEND_STATE_KEEP = 255 // special state: keep current save type
  915. };
  916. struct InstancePlayerBind
  917. {
  918. InstanceSave* save;
  919. /* permanent PlayerInstanceBinds are created in Raid/Heroic instances for players
  920. that aren't already permanently bound when they are inside when a boss is killed
  921. or when they enter an instance that the group leader is permanently bound to. */
  922. bool perm;
  923. /* extend state listing:
  924. EXPIRED - doesn't affect anything unless manually re-extended by player
  925. NORMAL - standard state
  926. EXTENDED - won't be promoted to EXPIRED at next reset period, will instead be promoted to NORMAL */
  927. BindExtensionState extendState;
  928.  
  929. InstancePlayerBind() : save(NULL), perm(false), extendState(EXTEND_STATE_NORMAL) { }
  930. };
  931.  
  932. enum CharDeleteMethod
  933. {
  934. CHAR_DELETE_REMOVE = 0, // Completely remove from the database
  935. CHAR_DELETE_UNLINK = 1 // The character gets unlinked from the account,
  936. // the name gets freed up and appears as deleted ingame
  937. };
  938.  
  939. enum ReferAFriendError
  940. {
  941. ERR_REFER_A_FRIEND_NONE = 0,
  942. ERR_REFER_A_FRIEND_NOT_REFERRED_BY = 1,
  943. ERR_REFER_A_FRIEND_TARGET_TOO_HIGH = 2,
  944. ERR_REFER_A_FRIEND_INSUFFICIENT_GRANTABLE_LEVELS = 3,
  945. ERR_REFER_A_FRIEND_TOO_FAR = 4,
  946. ERR_REFER_A_FRIEND_DIFFERENT_FACTION = 5,
  947. ERR_REFER_A_FRIEND_NOT_NOW = 6,
  948. ERR_REFER_A_FRIEND_GRANT_LEVEL_MAX_I = 7,
  949. ERR_REFER_A_FRIEND_NO_TARGET = 8,
  950. ERR_REFER_A_FRIEND_NOT_IN_GROUP = 9,
  951. ERR_REFER_A_FRIEND_SUMMON_LEVEL_MAX_I = 10,
  952. ERR_REFER_A_FRIEND_SUMMON_COOLDOWN = 11,
  953. ERR_REFER_A_FRIEND_INSUF_EXPAN_LVL = 12,
  954. ERR_REFER_A_FRIEND_SUMMON_OFFLINE_S = 13,
  955. ERR_REFER_A_FRIEND_NO_XREALM = 14,
  956. ERR_REFER_A_FRIEND_MAP_INCOMING_TRANSFER_NOT_ALLOWED = 15
  957. };
  958.  
  959. enum PlayerCommandStates
  960. {
  961. CHEAT_NONE = 0x00,
  962. CHEAT_GOD = 0x01,
  963. CHEAT_CASTTIME = 0x02,
  964. CHEAT_COOLDOWN = 0x04,
  965. CHEAT_POWER = 0x08,
  966. CHEAT_WATERWALK = 0x10,
  967.  
  968. CHEAT_ALL = CHEAT_GOD | CHEAT_CASTTIME | CHEAT_COOLDOWN | CHEAT_POWER
  969. };
  970.  
  971. enum PlayerLogXPReason : uint8
  972. {
  973. LOG_XP_REASON_KILL = 0,
  974. LOG_XP_REASON_NO_KILL = 1
  975. };
  976.  
  977. struct PlayerPetData
  978. {
  979. uint32 PetId;
  980. uint32 CreatureId;
  981. uint64 Owner;
  982. uint32 DisplayId;
  983. uint32 Petlevel;
  984. uint32 PetExp;
  985. ReactStates Reactstate;
  986. uint8 Slot;
  987. std::string Name;
  988. bool Renamed;
  989. bool Active;
  990. uint32 SavedHealth;
  991. uint32 SavedMana;
  992. std::string Actionbar;
  993. uint32 Timediff;
  994. uint32 SummonSpellId;
  995. PetType Type;
  996. uint16 SpecId;
  997. };
  998.  
  999. class Player;
  1000.  
  1001. /// Holder for Battleground data
  1002. struct BGData
  1003. {
  1004. BGData() : bgInstanceID(0), bgTypeID(BATTLEGROUND_TYPE_NONE), bgAfkReportedCount(0), bgAfkReportedTimer(0),
  1005. bgTeam(0), mountSpell(0) { ClearTaxiPath(); }
  1006.  
  1007. uint32 bgInstanceID; ///< This variable is set to bg->m_InstanceID,
  1008. /// when player is teleported to BG - (it is battleground's GUID)
  1009. BattlegroundTypeId bgTypeID;
  1010.  
  1011. GuidSet bgAfkReporter;
  1012. uint8 bgAfkReportedCount;
  1013. time_t bgAfkReportedTimer;
  1014.  
  1015. uint32 bgTeam; ///< What side the player will be added to
  1016.  
  1017. uint32 mountSpell;
  1018. uint32 taxiPath[2];
  1019.  
  1020. WorldLocation joinPos; ///< From where player entered BG
  1021.  
  1022. void ClearTaxiPath() { taxiPath[0] = taxiPath[1] = 0; }
  1023. bool HasTaxiPath() const { return taxiPath[0] && taxiPath[1]; }
  1024. };
  1025.  
  1026. struct VoidStorageItem
  1027. {
  1028. VoidStorageItem() : ItemId(0), ItemEntry(0), ItemRandomPropertyId(), ItemSuffixFactor(0), ItemUpgradeId(0), FixedScalingLevel(0), ArtifactKnowledgeLevel(0) { }
  1029. VoidStorageItem(uint64 id, uint32 entry, ObjectGuid const& creator, ItemRandomEnchantmentId randomPropertyId, uint32 suffixFactor,
  1030. uint32 upgradeId, uint32 fixedScalingLevel, uint32 artifactKnowledgeLevel, uint8 context, std::vector<uint32> const& bonuses)
  1031. : ItemId(id), ItemEntry(entry), CreatorGuid(creator), ItemRandomPropertyId(randomPropertyId),
  1032. ItemSuffixFactor(suffixFactor), ItemUpgradeId(upgradeId), FixedScalingLevel(fixedScalingLevel), ArtifactKnowledgeLevel(artifactKnowledgeLevel), Context(context)
  1033. {
  1034. BonusListIDs.insert(BonusListIDs.end(), bonuses.begin(), bonuses.end());
  1035. }
  1036. VoidStorageItem(VoidStorageItem&& vsi) : ItemId(vsi.ItemId), ItemEntry(vsi.ItemEntry), CreatorGuid(vsi.CreatorGuid), ItemRandomPropertyId(vsi.ItemRandomPropertyId),
  1037. ItemSuffixFactor(vsi.ItemSuffixFactor), ItemUpgradeId(vsi.ItemUpgradeId), FixedScalingLevel(vsi.FixedScalingLevel),
  1038. ArtifactKnowledgeLevel(vsi.ArtifactKnowledgeLevel), Context(vsi.Context), BonusListIDs(std::move(vsi.BonusListIDs)) { }
  1039.  
  1040. uint64 ItemId;
  1041. uint32 ItemEntry;
  1042. ObjectGuid CreatorGuid;
  1043. ItemRandomEnchantmentId ItemRandomPropertyId;
  1044. uint32 ItemSuffixFactor;
  1045. uint32 ItemUpgradeId;
  1046. uint32 FixedScalingLevel;
  1047. uint32 ArtifactKnowledgeLevel;
  1048. uint8 Context;
  1049. std::vector<int32> BonusListIDs;
  1050. };
  1051.  
  1052. struct ResurrectionData
  1053. {
  1054. ObjectGuid GUID;
  1055. WorldLocation Location;
  1056. uint32 Health;
  1057. uint32 Mana;
  1058. uint32 Aura;
  1059. };
  1060.  
  1061. struct GroupUpdateCounter
  1062. {
  1063. ObjectGuid GroupGuid;
  1064. int32 UpdateSequenceNumber;
  1065. };
  1066.  
  1067. enum TalentLearnResult
  1068. {
  1069. TALENT_LEARN_OK = 0,
  1070. TALENT_FAILED_UNKNOWN = 1,
  1071. TALENT_FAILED_NOT_ENOUGH_TALENTS_IN_PRIMARY_TREE = 2,
  1072. TALENT_FAILED_NO_PRIMARY_TREE_SELECTED = 3,
  1073. TALENT_FAILED_CANT_DO_THAT_RIGHT_NOW = 4,
  1074. TALENT_FAILED_AFFECTING_COMBAT = 5,
  1075. TALENT_FAILED_CANT_REMOVE_TALENT = 6,
  1076. TALENT_FAILED_CANT_DO_THAT_CHALLENGE_MODE_ACTIVE = 7,
  1077. TALENT_FAILED_REST_AREA = 8
  1078. };
  1079.  
  1080. static uint32 const DefaultTalentRowLevels[MAX_TALENT_TIERS] = { 15, 30, 45, 60, 75, 90, 100 };
  1081. static uint32 const DKTalentRowLevels[MAX_TALENT_TIERS] = { 57, 58, 59, 60, 75, 90, 100 };
  1082. static uint32 const DHTalentRowLevels[MAX_TALENT_TIERS] = { 99, 100, 102, 104, 106, 108, 110 };
  1083.  
  1084. struct TC_GAME_API SpecializationInfo
  1085. {
  1086. SpecializationInfo() : ResetTalentsCost(0), ResetTalentsTime(0), PrimarySpecialization(0), ActiveGroup(0)
  1087. {
  1088. }
  1089.  
  1090. PlayerTalentMap Talents[MAX_SPECIALIZATIONS];
  1091. PlayerTalentMap PvpTalents[MAX_SPECIALIZATIONS];
  1092. std::vector<uint32> Glyphs[MAX_SPECIALIZATIONS];
  1093. uint32 ResetTalentsCost;
  1094. time_t ResetTalentsTime;
  1095. uint32 PrimarySpecialization;
  1096. uint8 ActiveGroup;
  1097.  
  1098. private:
  1099. SpecializationInfo(SpecializationInfo const&) = delete;
  1100. SpecializationInfo& operator=(SpecializationInfo const&) = delete;
  1101. };
  1102.  
  1103. #pragma pack(push, 1)
  1104. struct PlayerDynamicFieldSpellModByLabel
  1105. {
  1106. uint32 Mod;
  1107. float Value;
  1108. uint32 Label;
  1109. };
  1110. #pragma pack(pop)
  1111.  
  1112. uint8 constexpr PLAYER_MAX_HONOR_LEVEL = 50;
  1113. uint8 constexpr PLAYER_LEVEL_MIN_HONOR = 110;
  1114. uint32 constexpr SPELL_PVP_RULES_ENABLED = 134735;
  1115.  
  1116. class TC_GAME_API Player : public Unit, public GridObject<Player>
  1117. {
  1118. friend class WorldSession;
  1119. friend class CinematicMgr;
  1120. friend class RestMgr;
  1121. friend void AddItemToUpdateQueueOf(Item* item, Player* player);
  1122. friend void RemoveItemFromUpdateQueueOf(Item* item, Player* player);
  1123. public:
  1124. explicit Player(WorldSession* session);
  1125. ~Player();
  1126.  
  1127. AnticheatData anticheatData;
  1128.  
  1129. PlayerAI* AI() const { return reinterpret_cast<PlayerAI*>(i_AI); }
  1130.  
  1131. void CleanupsBeforeDelete(bool finalCleanup = true) override;
  1132.  
  1133. void AddToWorld() override;
  1134. void RemoveFromWorld() override;
  1135.  
  1136. void SetObjectScale(float scale) override;
  1137.  
  1138. bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0, uint32 optionParam = 0);
  1139. bool TeleportTo(uint32 mapid, Position const &pos, uint32 options = 0, uint32 optionParam = 0);
  1140. bool TeleportTo(WorldLocation const &loc, uint32 options = 0, uint32 optionParam = 0);
  1141. bool TeleportTo(AreaTriggerTeleportStruct const* at);
  1142. bool SeamlessTeleportToMap(uint32 mapid, uint32 options = 0);
  1143. bool TeleportToBGEntryPoint();
  1144.  
  1145. bool HasSummonPending() const;
  1146. void SendSummonRequestFrom(Unit* summoner);
  1147. void SummonIfPossible(bool agree);
  1148.  
  1149. bool Create(ObjectGuid::LowType guidlow, WorldPackets::Character::CharacterCreateInfo const* createInfo);
  1150.  
  1151. void Update(uint32 time) override;
  1152.  
  1153. bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit* caster) const override;
  1154.  
  1155. void SetInWater(bool apply);
  1156.  
  1157. bool IsInWater() const override { return m_isInWater; }
  1158. bool IsUnderWater() const override;
  1159. bool IsInAreaTriggerRadius(const AreaTriggerEntry* trigger) const;
  1160.  
  1161. void SendInitialPacketsBeforeAddToMap();
  1162. void SendInitialPacketsAfterAddToMap();
  1163. void SendSupercededSpell(uint32 oldSpell, uint32 newSpell) const;
  1164. void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg = 0) const;
  1165. void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time, bool welcome) const;
  1166.  
  1167. bool CanInteractWithQuestGiver(Object* questGiver) const;
  1168. Creature* GetNPCIfCanInteractWith(ObjectGuid const& guid, uint64 npcflagmask) const;
  1169. GameObject* GetGameObjectIfCanInteractWith(ObjectGuid const& guid) const;
  1170. GameObject* GetGameObjectIfCanInteractWith(ObjectGuid const& guid, GameobjectTypes type) const;
  1171.  
  1172. void ToggleAFK();
  1173. void ToggleDND();
  1174. bool isAFK() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); }
  1175. bool isDND() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); }
  1176. uint8 GetChatFlags() const;
  1177. std::string autoReplyMsg;
  1178.  
  1179. uint32 GetBarberShopCost(BarberShopStyleEntry const* newHairStyle, uint8 newHairColor, BarberShopStyleEntry const* newFacialHair, BarberShopStyleEntry const* newSkin, BarberShopStyleEntry const* newFace, std::array<BarberShopStyleEntry const*, PLAYER_CUSTOM_DISPLAY_SIZE> const& newCustomDisplay) const;
  1180.  
  1181. PlayerSocial* GetSocial() const { return m_social; }
  1182. void RemoveSocial();
  1183.  
  1184. PlayerTaxi m_taxi;
  1185. void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(getRace(), getClass(), getLevel()); }
  1186. bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc = nullptr, uint32 spellid = 0, uint32 preferredMountDisplay = 0);
  1187. bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 0);
  1188. void CleanupAfterTaxiFlight();
  1189. void ContinueTaxiFlight() const;
  1190. // mount_id can be used in scripting calls
  1191. bool isAcceptWhispers() const { return (m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS) != 0; }
  1192. void SetAcceptWhispers(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; }
  1193. bool IsGameMaster() const { return (m_ExtraFlags & PLAYER_EXTRA_GM_ON) != 0; }
  1194. bool CanBeGameMaster() const;
  1195. void SetGameMaster(bool on);
  1196. bool isGMChat() const { return (m_ExtraFlags & PLAYER_EXTRA_GM_CHAT) != 0; }
  1197. void SetGMChat(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_CHAT; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_CHAT; }
  1198. bool isTaxiCheater() const { return (m_ExtraFlags & PLAYER_EXTRA_TAXICHEAT) != 0; }
  1199. void SetTaxiCheater(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_TAXICHEAT; else m_ExtraFlags &= ~PLAYER_EXTRA_TAXICHEAT; }
  1200. bool isGMVisible() const { return !(m_ExtraFlags & PLAYER_EXTRA_GM_INVISIBLE); }
  1201. void SetGMVisible(bool on);
  1202. void SetPvPDeath(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
  1203.  
  1204. void SetXP(uint32 xp);
  1205. void GiveXP(uint32 xp, Unit* victim, float group_rate=1.0f);
  1206. void GiveLevel(uint8 level);
  1207.  
  1208.  
  1209. void InitStatsForLevel(bool reapplyMods = false);
  1210.  
  1211. // .cheat command related
  1212. bool GetCommandStatus(uint32 command) const { return (_activeCheats & command) != 0; }
  1213. void SetCommandStatusOn(uint32 command) { _activeCheats |= command; }
  1214. void SetCommandStatusOff(uint32 command) { _activeCheats &= ~command; }
  1215.  
  1216. // Played Time Stuff
  1217. time_t m_logintime;
  1218. time_t m_Last_tick;
  1219. uint32 m_Played_time[MAX_PLAYED_TIME_INDEX];
  1220. uint32 GetTotalPlayedTime() const { return m_Played_time[PLAYED_TIME_TOTAL]; }
  1221. uint32 GetLevelPlayedTime() const { return m_Played_time[PLAYED_TIME_LEVEL]; }
  1222.  
  1223. void setDeathState(DeathState s) override; // overwrite Unit::setDeathState
  1224.  
  1225. Pet* GetPet() const;
  1226. Pet* SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 despwtime);
  1227. void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false);
  1228.  
  1229. /// Handles said message in regular chat based on declared language and in config pre-defined Range.
  1230. void Say(std::string const& text, Language language, WorldObject const* = nullptr) override;
  1231. void Say(uint32 textId, WorldObject const* target = nullptr) override;
  1232. /// Handles yelled message in regular chat based on declared language and in config pre-defined Range.
  1233. void Yell(std::string const& text, Language language, WorldObject const* = nullptr) override;
  1234. void Yell(uint32 textId, WorldObject const* target = nullptr) override;
  1235. /// Outputs an universal text which is supposed to be an action.
  1236. void TextEmote(std::string const& text, WorldObject const* = nullptr, bool = false) override;
  1237. void TextEmote(uint32 textId, WorldObject const* target = nullptr, bool isBossEmote = false) override;
  1238. /// Handles whispers from Addons and players based on sender, receiver's guid and language.
  1239. void Whisper(std::string const& text, Language language, Player* receiver, bool = false) override;
  1240. void Whisper(uint32 textId, Player* target, bool isBossWhisper = false) override;
  1241. void WhisperAddon(std::string const& text, std::string const& prefix, Player* receiver);
  1242.  
  1243. /*********************************************************/
  1244. /*** STORAGE SYSTEM ***/
  1245. /*********************************************************/
  1246.  
  1247. uint8 FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const;
  1248. uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = nullptr) const;
  1249. uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = nullptr) const;
  1250. Item* GetItemByGuid(ObjectGuid guid) const;
  1251. Item* GetItemByEntry(uint32 entry) const;
  1252. std::vector<Item*> GetItemListByEntry(uint32 entry, bool inBankAlso = false) const;
  1253. Item* GetItemByPos(uint16 pos) const;
  1254. Item* GetItemByPos(uint8 bag, uint8 slot) const;
  1255. Item* GetEquippedItem(EquipmentSlots slot) const;
  1256. Item* GetUseableItemByPos(uint8 bag, uint8 slot) const;
  1257. Bag* GetBagByPos(uint8 slot) const;
  1258. Item* GetWeaponForAttack(WeaponAttackType attackType, bool useable = false) const;
  1259. Item* GetShield(bool useable = false) const;
  1260. Item* GetChildItemByGuid(ObjectGuid guid) const;
  1261. static uint8 GetAttackBySlot(uint8 slot, InventoryType inventoryType); // MAX_ATTACK if not weapon slot
  1262. std::vector<Item*> &GetItemUpdateQueue() { return m_itemUpdateQueue; }
  1263. static bool IsInventoryPos(uint16 pos) { return IsInventoryPos(pos >> 8, pos & 255); }
  1264. static bool IsInventoryPos(uint8 bag, uint8 slot);
  1265. static bool IsEquipmentPos(uint16 pos) { return IsEquipmentPos(pos >> 8, pos & 255); }
  1266. static bool IsEquipmentPos(uint8 bag, uint8 slot);
  1267. static bool IsBagPos(uint16 pos);
  1268. static bool IsBankPos(uint16 pos) { return IsBankPos(pos >> 8, pos & 255); }
  1269. static bool IsBankPos(uint8 bag, uint8 slot);
  1270. static bool IsReagentBankPos(uint16 pos) { return IsReagentBankPos(pos >> 8, pos & 255); }
  1271. static bool IsReagentBankPos(uint8 bag, uint8 slot);
  1272. static bool IsChildEquipmentPos(uint16 pos) { return IsChildEquipmentPos(pos >> 8, pos & 255); }
  1273. static bool IsChildEquipmentPos(uint8 bag, uint8 slot);
  1274. bool IsValidPos(uint16 pos, bool explicit_pos) const { return IsValidPos(pos >> 8, pos & 255, explicit_pos); }
  1275. bool IsValidPos(uint8 bag, uint8 slot, bool explicit_pos) const;
  1276. uint8 GetInventorySlotCount() const { return GetByteValue(PLAYER_FIELD_BYTES2, PLAYER_FIELD_BYTES_2_OFFSET_NUM_BACKPACK_SLOTS); }
  1277. void SetInventorySlotCount(uint8 slots);
  1278. uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_3, PLAYER_BYTES_3_OFFSET_BANK_BAG_SLOTS); }
  1279. void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_3, PLAYER_BYTES_3_OFFSET_BANK_BAG_SLOTS, count); }
  1280. bool HasItemCount(uint32 item, uint32 count = 1, bool inBankAlso = false) const;
  1281. bool HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem = nullptr) const;
  1282. bool CanNoReagentCast(SpellInfo const* spellInfo) const;
  1283. bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const;
  1284. bool HasItemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const;
  1285. bool HasGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const;
  1286. InventoryResult CanTakeMoreSimilarItems(Item* pItem, uint32* offendingItemId = nullptr) const;
  1287. InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, uint32* offendingItemId = nullptr) const { return CanTakeMoreSimilarItems(entry, count, nullptr, nullptr, offendingItemId); }
  1288. InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = nullptr) const;
  1289. InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap = false, bool removeFromBank = false) const;
  1290. InventoryResult CanStoreItems(Item** items, int count, uint32* offendingItemId) const;
  1291. InventoryResult CanEquipNewItem(uint8 slot, uint16& dest, uint32 item, bool swap) const;
  1292. InventoryResult CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool swap, bool not_loading = true) const;
  1293.  
  1294. // This method must be called before equipping parent item!
  1295. InventoryResult CanEquipChildItem(Item* parentItem) const;
  1296.  
  1297. InventoryResult CanEquipUniqueItem(Item* pItem, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
  1298. InventoryResult CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
  1299. InventoryResult CanUnequipItems(uint32 item, uint32 count) const;
  1300. InventoryResult CanUnequipItem(uint16 src, bool swap) const;
  1301. InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap, bool not_loading = true, bool reagentBank = false) const;
  1302. InventoryResult CanUseItem(Item* pItem, bool not_loading = true) const;
  1303. bool HasItemTotemCategory(uint32 TotemCategory) const;
  1304. InventoryResult CanUseItem(ItemTemplate const* pItem) const;
  1305. InventoryResult CanRollForItemInLFG(ItemTemplate const* item, WorldObject const* lootedObject) const;
  1306. Item* StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool update, ItemRandomEnchantmentId const& randomPropertyId = {}, GuidSet const& allowedLooters = GuidSet(), uint8 context = 0, std::vector<int32> const& bonusListIDs = std::vector<int32>(), bool addToCollection = true);
  1307. Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update);
  1308. Item* EquipNewItem(uint16 pos, uint32 item, bool update);
  1309. Item* EquipItem(uint16 pos, Item* pItem, bool update);
  1310. void AutoUnequipOffhandIfNeed(bool force = false);
  1311. void AutoUnequip(uint8 slot);
  1312. void AutoUnequip(Item* item);
  1313. void EquipChildItem(uint8 parentBag, uint8 parentSlot, Item* parentItem);
  1314. void AutoUnequipChildItem(Item* parentItem);
  1315. bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count, ItemContext context = ItemContext(0));
  1316. void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, bool broadcast = false, bool specOnly = false, ToastDisplayMethod toastMethod = ToastDisplayMethod(0));
  1317. void AutoStoreLoot(uint32 loot_id, LootStore const& store, bool broadcast = false, bool specOnly = false, ToastDisplayMethod toastMethod = ToastDisplayMethod(0)) { AutoStoreLoot(NULL_BAG, NULL_SLOT, loot_id, store, broadcast, specOnly, toastMethod); }
  1318. void StoreLootItem(uint8 lootSlot, Loot* loot, AELootResult* aeResult = nullptr);
  1319.  
  1320. InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = nullptr, uint32* offendingItemId = nullptr) const;
  1321. InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = nullptr, bool swap = false, uint32* no_space_count = nullptr, bool removeFromBank = false) const;
  1322.  
  1323. void AddRefundReference(ObjectGuid it);
  1324. void DeleteRefundReference(ObjectGuid it);
  1325.  
  1326. void UnlockReagentBank();
  1327. bool HasUnlockedReagentBank() const;
  1328.  
  1329. // remove currency from vector list
  1330. void RemoveCurrency(uint32 id);
  1331. /// send initialization of new currency for client
  1332. void SendNewCurrency(uint32 id) const;
  1333. /// send full data about all currencies to client
  1334. void SendCurrencies() const;
  1335. /// send conquest currency points and their cap week/arena
  1336. void SendPvpRewards() const;
  1337. /// return count of currency witch has plr
  1338. uint32 GetCurrency(uint32 id) const;
  1339. /// return count of currency gaind on current week
  1340. uint32 GetCurrencyOnWeek(uint32 id) const;
  1341. /// return week cap by currency id
  1342. uint32 GetCurrencyWeekCap(uint32 id) const;
  1343. /// return presence related currency
  1344. bool HasCurrency(uint32 id, uint32 count) const;
  1345. /// initialize currency count for custom initialization at create character
  1346. void SetCurrency(uint32 id, uint32 count, bool printLog = true);
  1347. void ResetCurrencyWeekCap();
  1348. uint32 CalculateCurrencyWeekCap(uint32 id) const;
  1349.  
  1350. /**
  1351. * @name ModifyCurrency
  1352. * @brief Change specific currency and send result to client
  1353.  
  1354. * @param id currency entry from CurrencyTypes.dbc
  1355. * @param count integer value for adding/removing curent currency
  1356. * @param printLog used on SMSG_SET_CURRENCY
  1357. * @param ignore gain multipliers
  1358. */
  1359. void ModifyCurrency(uint32 id, int32 count, bool printLog = true, bool ignoreMultipliers = false);
  1360.  
  1361. void ApplyEquipCooldown(Item* pItem);
  1362. void QuickEquipItem(uint16 pos, Item* pItem);
  1363. void VisualizeItem(uint8 slot, Item* pItem);
  1364. void SetVisibleItemSlot(uint8 slot, Item* pItem);
  1365. Item* BankItem(ItemPosCountVec const& dest, Item* pItem, bool update);
  1366. void RemoveItem(uint8 bag, uint8 slot, bool update);
  1367. void MoveItemFromInventory(uint8 bag, uint8 slot, bool update);
  1368. // in trade, auction, guild bank, mail....
  1369. void MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool update, bool in_characterInventoryDB = false);
  1370. // in trade, guild bank, mail....
  1371. void RemoveItemDependentAurasAndCasts(Item* pItem);
  1372. void DestroyItem(uint8 bag, uint8 slot, bool update);
  1373. void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check = false);
  1374. void DestroyItemCount(Item* item, uint32& count, bool update);
  1375. void DestroyConjuredItems(bool update);
  1376. void DestroyZoneLimitedItem(bool update, uint32 new_zone);
  1377. void SplitItem(uint16 src, uint16 dst, uint32 count);
  1378. void SwapItem(uint16 src, uint16 dst);
  1379. void AddItemToBuyBackSlot(Item* pItem);
  1380. Item* GetItemFromBuyBackSlot(uint32 slot);
  1381. void RemoveItemFromBuyBackSlot(uint32 slot, bool del);
  1382. void SendEquipError(InventoryResult msg, Item* item1 = nullptr, Item* item2 = nullptr, uint32 itemId = 0) const;
  1383. void SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param) const;
  1384. void SendSellError(SellResult msg, Creature* creature, ObjectGuid guid) const;
  1385. void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; }
  1386. void AddArmorProficiency(uint32 newflag) { m_ArmorProficiency |= newflag; }
  1387. uint32 GetWeaponProficiency() const { return m_WeaponProficiency; }
  1388. uint32 GetArmorProficiency() const { return m_ArmorProficiency; }
  1389. bool IsUseEquipedWeapon(bool mainhand) const;
  1390. bool IsTwoHandUsed() const;
  1391. bool IsUsingTwoHandedWeaponInOneHand() const;
  1392. void SendNewItem(Item* item, uint32 quantity, bool received, bool created, bool broadcast = false);
  1393. bool BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
  1394. bool BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorSlot, uint32 currency, uint32 count);
  1395. bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int64 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
  1396.  
  1397. float GetReputationPriceDiscount(Creature const* creature) const;
  1398. float GetReputationPriceDiscount(FactionTemplateEntry const* factionTemplate) const;
  1399.  
  1400. Player* GetTrader() const;
  1401. TradeData* GetTradeData() const { return m_trade; }
  1402. void TradeCancel(bool sendback);
  1403.  
  1404. // Visible state
  1405. bool IsTransportVisibleStateInserted(ObjectGuid transportGUID)
  1406. {
  1407. return m_TransportVisibleState.find(transportGUID) != m_TransportVisibleState.end();
  1408. }
  1409. eTransportVisibleState GetTransportVisibleState(ObjectGuid transportGUID)
  1410. {
  1411. if (IsTransportVisibleStateInserted(transportGUID))
  1412. return (eTransportVisibleState)m_TransportVisibleState[transportGUID];
  1413. else
  1414. return TRANS_STATE_NEW;
  1415. }
  1416. void SetTransportVisibleState(ObjectGuid transportGUID, eTransportVisibleState state)
  1417. {
  1418. if (IsTransportVisibleStateInserted(transportGUID))
  1419. m_TransportVisibleState[transportGUID] = state;
  1420. else
  1421. m_TransportVisibleState.insert(std::pair<ObjectGuid, uint8>(transportGUID, state));
  1422. }
  1423.  
  1424. CinematicMgr* GetCinematicMgr() const { return _cinematicMgr; }
  1425.  
  1426. void UpdateEnchantTime(uint32 time);
  1427. void UpdateSoulboundTradeItems();
  1428. void AddTradeableItem(Item* item);
  1429. void RemoveTradeableItem(Item* item);
  1430. void UpdateItemDuration(uint32 time, bool realtimeonly = false);
  1431. void AddEnchantmentDurations(Item* item);
  1432. void RemoveEnchantmentDurations(Item* item);
  1433. void RemoveArenaEnchantments(EnchantmentSlot slot);
  1434. void AddEnchantmentDuration(Item* item, EnchantmentSlot slot, uint32 duration);
  1435. void ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool apply_dur = true, bool ignore_condition = false);
  1436. void ApplyEnchantment(Item* item, bool apply);
  1437. void UpdateSkillEnchantments(uint16 skill_id, uint16 curr_value, uint16 new_value);
  1438. void SendEnchantmentDurations();
  1439. void AddItemDurations(Item* item);
  1440. void RemoveItemDurations(Item* item);
  1441. void SendItemDurations();
  1442. void LoadCorpse(PreparedQueryResult result);
  1443. void LoadPet();
  1444. void LoadPetsFromDB(PreparedQueryResult result);
  1445.  
  1446. bool AddItem(uint32 itemId, uint32 count);
  1447. bool AddChallengeKey(uint32 challengeId, uint32 challengeLevel = 2);
  1448.  
  1449. uint32 m_stableSlots;
  1450.  
  1451. /*********************************************************/
  1452. /*** GOSSIP SYSTEM ***/
  1453. /*********************************************************/
  1454.  
  1455. void PrepareGossipMenu(WorldObject* source, uint32 menuId = 0, bool showQuests = false);
  1456. void SendPreparedGossip(WorldObject* source);
  1457. void OnGossipSelect(WorldObject* source, uint32 optionIndex, uint32 menuId);
  1458.  
  1459. uint32 GetGossipTextId(uint32 menuId, WorldObject* source);
  1460. uint32 GetGossipTextId(WorldObject* source);
  1461. static uint32 GetDefaultGossipMenuForSource(WorldObject* source);
  1462.  
  1463. /*********************************************************/
  1464. /*** QUEST SYSTEM ***/
  1465. /*********************************************************/
  1466.  
  1467. int32 GetQuestLevel(Quest const* quest) const
  1468. {
  1469. if (!quest)
  1470. return getLevel();
  1471. return quest->GetQuestLevel() > 0 ? quest->GetQuestLevel() : std::min<int32>(getLevel(), quest->GetQuestMaxScalingLevel());
  1472. }
  1473.  
  1474. void PrepareQuestMenu(ObjectGuid guid);
  1475. void SendPreparedQuest(WorldObject* source);
  1476. bool IsActiveQuest(uint32 quest_id) const;
  1477. Quest const* GetNextQuest(ObjectGuid guid, Quest const* quest) const;
  1478. Quest const * GetQuestFromQuestGiver(Object * questGiver);
  1479. uint32 GetQuestCountFromQuestGiver(Object * questGiver);
  1480. bool CanSeeStartQuest(Quest const* quest);
  1481. bool CanTakeQuest(Quest const* quest, bool msg);
  1482. bool CanAddQuest(Quest const* quest, bool msg) const;
  1483. bool CanCompleteQuest(uint32 quest_id);
  1484. bool CanCompleteRepeatableQuest(Quest const* quest);
  1485. bool CanRewardQuest(Quest const* quest, bool msg);
  1486. bool CanRewardQuest(Quest const* quest, uint32 reward, bool msg);
  1487. void AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver);
  1488. void AddQuest(Quest const* quest, Object* questGiver);
  1489. void AbandonQuest(uint32 quest_id);
  1490. void ForceCompleteQuest(uint32 quest_id);
  1491. void CompleteQuest(uint32 quest_id);
  1492. void IncompleteQuest(uint32 quest_id);
  1493. uint32 GetQuestMoneyReward(Quest const* quest) const;
  1494. uint32 GetQuestXPReward(Quest const* quest);
  1495. bool CanSelectQuestPackageItem(QuestPackageItemEntry const* questPackageItem) const;
  1496. void RewardQuestPackage(uint32 questPackageId, uint32 onlyItemId = 0);
  1497. void RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, bool announce = true);
  1498. void SetRewardedQuest(uint32 quest_id);
  1499. void FailQuest(uint32 quest_id);
  1500. bool SatisfyQuestSkill(Quest const* qInfo, bool msg) const;
  1501. bool SatisfyQuestLevel(Quest const* qInfo, bool msg) const;
  1502. bool SatisfyQuestLog(bool msg) const;
  1503. bool SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg);
  1504. bool SatisfyQuestClass(Quest const* qInfo, bool msg) const;
  1505. bool SatisfyQuestRace(Quest const* qInfo, bool msg) const;
  1506. bool SatisfyQuestReputation(Quest const* qInfo, bool msg);
  1507. bool SatisfyQuestStatus(Quest const* qInfo, bool msg) const;
  1508. bool SatisfyQuestConditions(Quest const* qInfo, bool msg);
  1509. bool SatisfyQuestTimed(Quest const* qInfo, bool msg) const;
  1510. bool SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg);
  1511. bool SatisfyQuestNextChain(Quest const* qInfo, bool msg) const;
  1512. bool SatisfyQuestPrevChain(Quest const* qInfo, bool msg);
  1513. bool SatisfyQuestDay(Quest const* qInfo, bool msg) const;
  1514. bool SatisfyQuestWeek(Quest const* qInfo, bool msg);
  1515. bool SatisfyQuestMonth(Quest const* qInfo, bool msg);
  1516. bool SatisfyQuestSeasonal(Quest const* qInfo, bool msg);
  1517. bool GiveQuestSourceItem(Quest const* quest);
  1518. bool TakeQuestSourceItem(uint32 questId, bool msg);
  1519. bool GetQuestRewardStatus(uint32 quest_id) const;
  1520. QuestStatus GetQuestStatus(uint32 quest_id) const;
  1521. std::string GetQuestStatusString(QuestStatus status) const;
  1522. void SetQuestStatus(uint32 questId, QuestStatus status, bool update = true);
  1523. void RemoveActiveQuest(Quest const* quest, bool update = true);
  1524. void RemoveRewardedQuest(uint32 questId, bool update = true);
  1525. void SendQuestUpdate(uint32 questId);
  1526. QuestGiverStatus GetQuestDialogStatus(Object* questGiver);
  1527.  
  1528. void SetDailyQuestStatus(uint32 quest_id);
  1529. bool IsDailyQuestDone(uint32 quest_id);
  1530. void SetWeeklyQuestStatus(uint32 quest_id);
  1531. void SetMonthlyQuestStatus(uint32 quest_id);
  1532. void SetSeasonalQuestStatus(uint32 quest_id);
  1533. void DailyReset();
  1534. void ResetWeeklyQuestStatus();
  1535. void ResetMonthlyQuestStatus();
  1536. void ResetSeasonalQuestStatus(uint16 event_id);
  1537.  
  1538. uint16 FindQuestSlot(uint32 quest_id) const;
  1539. uint32 GetQuestSlotQuestId(uint16 slot) const;
  1540. uint32 GetQuestSlotState(uint16 slot) const;
  1541. uint16 GetQuestSlotCounter(uint16 slot, uint8 counter) const;
  1542. uint32 GetQuestSlotTime(uint16 slot) const;
  1543. void SetQuestSlot(uint16 slot, uint32 quest_id, uint32 timer = 0);
  1544. void SetQuestSlotCounter(uint16 slot, uint8 counter, uint16 count);
  1545. void SetQuestSlotState(uint16 slot, uint32 state);
  1546. void RemoveQuestSlotState(uint16 slot, uint32 state);
  1547. void SetQuestSlotTimer(uint16 slot, uint32 timer);
  1548. void SetQuestCompletedBit(uint32 questBit, bool completed);
  1549.  
  1550. uint16 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) const;
  1551. void AreaExploredOrEventHappens(uint32 questId);
  1552. void GroupEventHappens(uint32 questId, WorldObject const* pEventObject);
  1553. void ItemAddedQuestCheck(uint32 entry, uint32 count);
  1554. void ItemRemovedQuestCheck(uint32 entry, uint32 count);
  1555. void KilledMonster(CreatureTemplate const* cInfo, ObjectGuid guid);
  1556. void KilledMonsterCredit(uint32 entry, ObjectGuid guid = ObjectGuid::Empty);
  1557. void KilledPlayerCredit();
  1558. void KillCreditGO(uint32 entry, ObjectGuid guid = ObjectGuid::Empty);
  1559. void TalkedToCreature(uint32 entry, ObjectGuid guid);
  1560. void KillCreditCriteriaTreeObjective(QuestObjective const& questObjective);
  1561. void MoneyChanged(uint64 value);
  1562. void ReputationChanged(FactionEntry const* factionEntry);
  1563. void CurrencyChanged(uint32 currencyId, int32 change);
  1564. bool HasQuestForItem(uint32 itemId) const;
  1565. bool HasQuestForGO(int32 goId) const;
  1566. bool HasQuest(uint32 questID) const;
  1567. void UpdateForQuestWorldObjects();
  1568. bool CanShareQuest(uint32 questId) const;
  1569.  
  1570. int32 GetQuestObjectiveData(Quest const* quest, int8 storageIndex) const;
  1571. int32 GetQuestObjectiveData(uint32 questId, int8 storageIndex) const;
  1572. int32 GetQuestObjectiveCounter(uint32 objectiveId) const;
  1573. bool IsQuestObjectiveComplete(QuestObjective const& objective) const;
  1574. void SetQuestObjectiveData(QuestObjective const& objective, int32 data);
  1575. bool IsQuestObjectiveProgressComplete(Quest const* quest) const;
  1576. void SendQuestComplete(Quest const* quest) const;
  1577. void SendQuestReward(Quest const* quest, Creature const* questGiver, uint32 xp, bool hideChatMessage) const;
  1578. void SendQuestFailed(uint32 questID, InventoryResult reason = EQUIP_ERR_OK) const;
  1579. void SendQuestTimerFailed(uint32 questID) const;
  1580. void SendCanTakeQuestResponse(QuestFailedReason reason, bool sendErrorMessage = true, std::string reasonText = "") const;
  1581. void SendQuestConfirmAccept(Quest const* quest, Player* receiver) const;
  1582. void SendPushToPartyResponse(Player* player, QuestPushReason reason) const;
  1583. void SendQuestUpdateAddCredit(Quest const* quest, ObjectGuid guid, QuestObjective const& obj, uint16 count) const;
  1584. void SendQuestUpdateAddCreditSimple(QuestObjective const& obj) const;
  1585. void SendQuestUpdateAddPlayer(Quest const* quest, uint16 newCount) const;
  1586. void SendQuestGiverStatusMultiple();
  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; } ///> Empties a CUF profile at position 0-4
  1598. void SaveCUFProfile(uint8 id, std::unique_ptr<CUFProfile> profile) { _CUFProfiles[id] = std::move(profile); } ///> Replaces a CUF profile at position 0-4
  1599. CUFProfile* GetCUFProfile(uint8 id) const { return _CUFProfiles[id].get(); } ///> Retrieves a CUF profile at position 0-4
  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, std::array<uint8, PLAYER_CUSTOM_DISPLAY_SIZE> const& customDisplay, 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 RegenerateAll();
  1650. void Regenerate(Powers power);
  1651. void RegeneratePowerRunes();
  1652. void RegeneratePowerSoulShards();
  1653. void SendPowerUpdate(Powers power, int32 amount);
  1654. void RegenerateHealth();
  1655. void setRegenTimerCount(uint32 time) {m_regenTimerCount = time;}
  1656. void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;}
  1657.  
  1658. uint64 GetMoney() const { return GetUInt64Value(PLAYER_FIELD_COINAGE); }
  1659. bool ModifyMoney(int64 amount, bool sendError = true);
  1660. bool HasEnoughMoney(uint64 amount) const { return (GetMoney() >= amount); }
  1661. bool HasEnoughMoney(int64 amount) const;
  1662. void SetMoney(uint64 value);
  1663.  
  1664. ItemSpellList m_itemSpellList;
  1665. const ItemSpellList& GetItemSpellList();
  1666.  
  1667. RewardedQuestSet const& getRewardedQuests() const { return m_RewardedQuests; }
  1668. QuestStatusMap& getQuestStatusMap() { return m_QuestStatus; }
  1669.  
  1670. size_t GetRewardedQuestCount() const { return m_RewardedQuests.size(); }
  1671. bool IsQuestRewarded(uint32 quest_id) const;
  1672.  
  1673. Unit* GetSelectedUnit() const;
  1674. Player* GetSelectedPlayer() const;
  1675.  
  1676. void SetTarget(ObjectGuid const& /*guid*/) override { } /// Used for serverside target changes, does not apply to players
  1677. void SetSelection(ObjectGuid const& guid) { SetGuidValue(UNIT_FIELD_TARGET, guid); }
  1678.  
  1679. uint32 GetComboPoints() const { return uint32(GetPower(POWER_COMBO_POINTS)); }
  1680. void AddComboPoints(int8 count, Spell* spell = nullptr);
  1681. void GainSpellComboPoints(int8 count);
  1682. void ClearComboPoints();
  1683.  
  1684. void SendMailResult(uint32 mailId, MailResponseType mailAction, MailResponseResult mailError, uint32 equipError = 0, ObjectGuid::LowType item_guid = UI64LIT(0), uint32 item_count = 0) const;
  1685. void SendNewMail() const;
  1686. void UpdateNextMailTimeAndUnreads();
  1687. void AddNewMailDeliverTime(time_t deliver_time);
  1688. bool IsMailsLoaded() const { return m_mailsLoaded; }
  1689.  
  1690. void RemoveMail(uint32 id);
  1691.  
  1692. void AddMail(Mail* mail) { m_mail.push_front(mail);}// for call from WorldSession::SendMailTo
  1693. uint32 GetMailSize() const { return uint32(m_mail.size()); }
  1694. Mail* GetMail(uint32 id);
  1695.  
  1696. PlayerMails const& GetMails() const { return m_mail; }
  1697.  
  1698. void SendItemRetrievalMail(uint32 itemEntry, uint32 count, ItemRandomEnchantmentId const& randomPropertyId /*= {}*/, std::vector<int32> const& bonusListIDs /*= std::vector<int32>()*/); // Item retrieval mails sent by The Postmaster (34337), used in multiple places.
  1699.  
  1700. /*********************************************************/
  1701. /*** MAILED ITEMS SYSTEM ***/
  1702. /*********************************************************/
  1703.  
  1704. uint8 unReadMails;
  1705. time_t m_nextMailDelivereTime;
  1706.  
  1707. typedef std::unordered_map<ObjectGuid::LowType, Item*> ItemMap;
  1708.  
  1709. ItemMap mMitems; //template defined in objectmgr.cpp
  1710.  
  1711. Item* GetMItem(ObjectGuid::LowType id);
  1712. void AddMItem(Item* it);
  1713. bool RemoveMItem(ObjectGuid::LowType id);
  1714.  
  1715. void SendOnCancelExpectedVehicleRideAura() const;
  1716. void PetSpellInitialize();
  1717. void CharmSpellInitialize();
  1718. void PossessSpellInitialize();
  1719. void VehicleSpellInitialize();
  1720. void SendRemoveControlBar() const;
  1721. bool HasSpell(uint32 spell) const override;
  1722. bool HasActiveSpell(uint32 spell) const; // show in spellbook
  1723. SpellInfo const* GetCastSpellInfo(SpellInfo const* spellInfo) const override;
  1724. TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const;
  1725. bool IsSpellFitByClassAndRace(uint32 spell_id) const;
  1726. bool IsNeedCastPassiveSpellAtLearn(SpellInfo const* spellInfo) const;
  1727. bool IsCurrentSpecMasterySpell(SpellInfo const* spellInfo) const;
  1728. const ExcludeCasterSpellList& GetExcludeCasterSpellList();
  1729.  
  1730. void RemoveSpellCooldown(uint32 spell_id, bool update = false);
  1731.  
  1732. void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask) const;
  1733. void SendKnownSpells();
  1734. bool AddSpell(uint32 spellId, bool active, bool learning, bool dependent, bool disabled, bool loading = false, int32 fromSkill = 0);
  1735. void LearnSpell(uint32 spell_id, bool dependent, int32 fromSkill = 0);
  1736. void RemoveSpell(uint32 spell_id, bool disabled = false, bool learn_low_rank = true);
  1737. void ResetSpells(bool myClassOnly = false);
  1738. void LearnCustomSpells();
  1739. void LearnDefaultSkills();
  1740. void LearnDefaultSkill(SkillRaceClassInfoEntry const* rcInfo);
  1741. void LearnQuestRewardedSpells();
  1742. void LearnQuestRewardedSpells(Quest const* quest);
  1743. void LearnSpellHighestRank(uint32 spellid);
  1744. void AddTemporarySpell(uint32 spellId);
  1745. void RemoveTemporarySpell(uint32 spellId);
  1746. void AddOverrideSpell(uint32 overridenSpellId, uint32 newSpellId);
  1747. void RemoveOverrideSpell(uint32 overridenSpellId, uint32 newSpellId);
  1748. void LearnSpecializationSpells();
  1749. void RemoveSpecializationSpells();
  1750. void RemoveEquipedSpecializationItems();
  1751. bool IsCharStartOutfitItem(uint32 itemId);
  1752. void SendSpellCategoryCooldowns() const;
  1753.  
  1754. void SetReputation(uint32 factionentry, int32 value);
  1755. int32 GetReputation(uint32 factionentry) const;
  1756. std::string GetGuildName() const;
  1757.  
  1758. // Loot Spec
  1759. void SetLootSpecId(uint32 id) { SetUInt32Value(PLAYER_FIELD_LOOT_SPEC_ID, id); }
  1760. uint32 GetLootSpecId() const { return GetUInt32Value(PLAYER_FIELD_LOOT_SPEC_ID); }
  1761.  
  1762. // Talents
  1763. uint32 GetTalentResetCost() const { return _specializationInfo.ResetTalentsCost; }
  1764. void SetTalentResetCost(uint32 cost) { _specializationInfo.ResetTalentsCost = cost; }
  1765. time_t GetTalentResetTime() const { return _specializationInfo.ResetTalentsTime; }
  1766. void SetTalentResetTime(time_t time_) { _specializationInfo.ResetTalentsTime = time_; }
  1767. uint32 GetPrimarySpecialization() const { return _specializationInfo.PrimarySpecialization; }
  1768. void SetPrimarySpecialization(uint32 spec) { _specializationInfo.PrimarySpecialization = spec; }
  1769. uint8 GetActiveTalentGroup() const { return _specializationInfo.ActiveGroup; }
  1770. void SetActiveTalentGroup(uint8 group){ _specializationInfo.ActiveGroup = group; }
  1771. uint32 GetDefaultSpecId() const;
  1772. TalentSpecialization GetSpecializationId() const { return (TalentSpecialization)GetUInt32Value(PLAYER_FIELD_CURRENT_SPEC_ID); }
  1773. uint32 GetRoleForGroup() const;
  1774. static uint32 GetRoleBySpecializationId(uint32 specializationId);
  1775. bool isInTankSpec() const;
  1776.  
  1777. ExcludeCasterSpellList m_excludeCasterSpellList;
  1778.  
  1779.  
  1780. bool ResetTalents(bool noCost = false);
  1781. void ResetPvpTalents();
  1782. uint32 GetNextResetTalentsCost() const;
  1783. void InitTalentForLevel();
  1784. void SendTalentsInfoData();
  1785. TalentLearnResult LearnTalent(uint32 talentId, int32* spellOnCooldown);
  1786. bool AddTalent(TalentEntry const* talent, uint8 spec, bool learning);
  1787. bool HasTalent(uint32 spell_id, uint8 spec) const;
  1788. void RemoveTalent(TalentEntry const* talent);
  1789. uint32 CalculateTalentsTiers() const;
  1790. uint32 GetSkillTierValue(uint32 skillId, uint32 rank);
  1791. std::vector<uint32> GetSkillTierValues(uint32 skillId);
  1792. void ResetTalentSpecialization();
  1793.  
  1794. TalentLearnResult LearnPvpTalent(uint32 talentID, int32* spellOnCooldown);
  1795. bool AddPvpTalent(PvpTalentEntry const* talent, uint8 activeTalentGroup, bool learning);
  1796. void RemovePvpTalent(PvpTalentEntry const* talent);
  1797. void TogglePvpTalents(bool enable);
  1798. bool HasPvpTalent(uint32 talentID, uint8 activeTalentGroup) const;
  1799. void EnablePvpRules(bool dueToCombat = false);
  1800. void DisablePvpRules();
  1801. bool HasPvpRulesEnabled() const;
  1802. bool IsInAreaThatActivatesPvpTalents() const;
  1803. bool IsAreaThatActivatesPvpTalents(uint32 areaID) const;
  1804.  
  1805. // Dual Spec
  1806. void ActivateTalentGroup(ChrSpecializationEntry const* spec);
  1807.  
  1808. PlayerTalentMap const* GetTalentMap(uint8 spec) const { return &_specializationInfo.Talents[spec]; }
  1809. PlayerTalentMap* GetTalentMap(uint8 spec) { return &_specializationInfo.Talents[spec]; }
  1810. PlayerTalentMap const* GetPvpTalentMap(uint8 spec) const { return &_specializationInfo.PvpTalents[spec]; }
  1811. PlayerTalentMap* GetPvpTalentMap(uint8 spec) { return &_specializationInfo.PvpTalents[spec]; }
  1812. std::vector<uint32> const& GetGlyphs(uint8 spec) const { return _specializationInfo.Glyphs[spec]; }
  1813. std::vector<uint32>& GetGlyphs(uint8 spec) { return _specializationInfo.Glyphs[spec]; }
  1814. ActionButtonList const& GetActionButtons() const { return m_actionButtons; }
  1815.  
  1816. uint32 GetFreePrimaryProfessionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS); }
  1817. void SetFreePrimaryProfessions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS, profs); }
  1818. void InitPrimaryProfessions();
  1819.  
  1820. PlayerSpellMap const& GetSpellMap() const { return m_spells; }
  1821. PlayerSpellMap & GetSpellMap() { return m_spells; }
  1822.  
  1823. void AddSpellMod(SpellModifier* mod, bool apply);
  1824. static bool IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod, Spell* spell = nullptr);
  1825. template <class T>
  1826. void ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* spell = nullptr) const;
  1827. static void ApplyModToSpell(SpellModifier* mod, Spell* spell);
  1828. void SetSpellModTakingSpell(Spell* spell, bool apply);
  1829. void SendSpellModifiers() const;
  1830.  
  1831. void RemoveArenaSpellCooldowns(bool removeActivePetCooldowns = false);
  1832. uint32 GetLastPotionId() const { return m_lastPotionId; }
  1833. void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; }
  1834. void UpdatePotionCooldown(Spell* spell = nullptr);
  1835.  
  1836. void SetResurrectRequestData(Unit* caster, uint32 health, uint32 mana, uint32 appliedAura);
  1837. void ClearResurrectRequestData()
  1838. {
  1839. _resurrectionData.reset();
  1840. }
  1841.  
  1842. bool IsResurrectRequestedBy(ObjectGuid const& guid) const
  1843. {
  1844. if (!IsResurrectRequested())
  1845. return false;
  1846.  
  1847. return !_resurrectionData->GUID.IsEmpty() && _resurrectionData->GUID == guid;
  1848. }
  1849.  
  1850. bool IsResurrectRequested() const { return _resurrectionData.get() != nullptr; }
  1851. void ResurrectUsingRequestData();
  1852. void ResurrectUsingRequestDataImpl();
  1853.  
  1854. uint8 getCinematic() const { return m_cinematic; }
  1855. void setCinematic(uint8 cine) { m_cinematic = cine; }
  1856.  
  1857. uint32 GetMovie() const { return m_movie; }
  1858. void SetMovie(uint32 movie) { m_movie = movie; }
  1859.  
  1860. ActionButton* AddActionButton(uint8 button, uint32 action, uint8 type);
  1861. void RemoveActionButton(uint8 button);
  1862. ActionButton const* GetActionButton(uint8 button);
  1863. void SendInitialActionButtons() const { SendActionButtons(0); }
  1864. void SendActionButtons(uint32 state) const;
  1865. bool IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) const;
  1866.  
  1867. PvPInfo pvpInfo;
  1868. void UpdatePvPState(bool onlyFFA = false);
  1869. void SetPvP(bool state) override;
  1870. void UpdatePvP(bool state, bool override=false);
  1871. void UpdateZone(uint32 newZone, uint32 newArea);
  1872. void UpdateArea(uint32 newArea);
  1873. void UpdateZoneDependentAuras(uint32 zone_id); // zones
  1874. void UpdateAreaDependentAuras(uint32 area_id); // subzones
  1875.  
  1876. void UpdateAfkReport(time_t currTime);
  1877. void UpdatePvPFlag(time_t currTime);
  1878. void UpdateContestedPvP(uint32 currTime);
  1879. void SetContestedPvPTimer(uint32 newTime) {m_contestedPvPTimer = newTime;}
  1880. void ResetContestedPvP();
  1881.  
  1882. /// @todo: maybe move UpdateDuelFlag+DuelComplete to independent DuelHandler
  1883. DuelInfo* duel;
  1884. void UpdateDuelFlag(time_t currTime);
  1885. void CheckDuelDistance(time_t currTime);
  1886. void DuelComplete(DuelCompleteType type);
  1887.  
  1888. bool IsGroupVisibleFor(Player const* p) const;
  1889. bool IsInSameGroupWith(Player const* p) const;
  1890. bool IsInSameRaidWith(Player const* p) const;
  1891. void UninviteFromGroup();
  1892. static void RemoveFromGroup(Group* group, ObjectGuid guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker = ObjectGuid::Empty, const char* reason = nullptr);
  1893. void RemoveFromGroup(RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT) { RemoveFromGroup(GetGroup(), GetGUID(), method); }
  1894. void SendUpdateToOutOfRangeGroupMembers();
  1895.  
  1896. void SetInGuild(ObjectGuid::LowType guildId);
  1897. void SetGuildRank(uint8 rankId) { SetUInt32Value(PLAYER_GUILDRANK, rankId); }
  1898. uint8 GetGuildRank() const { return uint8(GetUInt32Value(PLAYER_GUILDRANK)); }
  1899. void SetGuildLevel(uint32 level) { SetUInt32Value(PLAYER_GUILDLEVEL, level); }
  1900. uint32 GetGuildLevel() const { return GetUInt32Value(PLAYER_GUILDLEVEL); }
  1901. void SetGuildIdInvited(ObjectGuid::LowType GuildId) { m_GuildIdInvited = GuildId; }
  1902. ObjectGuid::LowType GetGuildId() const { return GetUInt64Value(OBJECT_FIELD_DATA); /* return only lower part */ }
  1903. Guild* GetGuild();
  1904. Guild const* GetGuild() const;
  1905. static ObjectGuid::LowType GetGuildIdFromDB(ObjectGuid guid);
  1906. static uint8 GetRankFromDB(ObjectGuid guid);
  1907. ObjectGuid::LowType GetGuildIdInvited() const { return m_GuildIdInvited; }
  1908. static void RemovePetitionsAndSigns(ObjectGuid guid);
  1909.  
  1910. // Arena
  1911. std::array<WorldPackets::Battleground::RatedInfo, MAX_PVP_SLOT> GetRatedInfos() { return m_ratedInfos; }
  1912. uint32 GetArenaPersonalRating(uint8 slot) const { ASSERT(slot < MAX_PVP_SLOT); return m_ratedInfos[slot].ArenaPersonalRating; }
  1913. uint32 GetBestRatingOfWeek(uint8 slot) const { ASSERT(slot < MAX_PVP_SLOT); return m_ratedInfos[slot].BestRatingOfWeek; }
  1914. uint32 GetBestRatingOfSeason(uint8 slot) const { ASSERT(slot < MAX_PVP_SLOT); return m_ratedInfos[slot].BestRatingOfSeason; }
  1915. uint32 GetWeekWins(uint8 slot) const { ASSERT(slot < MAX_PVP_SLOT); return m_ratedInfos[slot].WeekWins; }
  1916. uint32 GetPrevWeekWins(uint8 slot) const { ASSERT(slot < MAX_PVP_SLOT); return m_ratedInfos[slot].PrevWeekWins; }
  1917. uint32 GetPrevWeekGames(uint8 slot) const { ASSERT(slot < MAX_PVP_SLOT); return m_ratedInfos[slot].PrevWeekGames; }
  1918. uint32 GetSeasonWins(uint8 slot) const { ASSERT(slot < MAX_PVP_SLOT); return m_ratedInfos[slot].SeasonWins; }
  1919. uint32 GetWeekGames(uint8 slot) const { ASSERT(slot < MAX_PVP_SLOT); return m_ratedInfos[slot].WeekGames; }
  1920. uint32 GetSeasonGames(uint8 slot) const { ASSERT(slot < MAX_PVP_SLOT); return m_ratedInfos[slot].SeasonGames; }
  1921. uint32 GetArenaMatchMakerRating(uint8 slot) const { ASSERT(slot < MAX_PVP_SLOT); return m_ratedInfos[slot].ArenaMatchMakerRating; }
  1922. uint32 GetMaxRating() const;
  1923. void SetArenaPersonalRating(uint8 slot, uint32 value);
  1924. void SetArenaMatchMakerRating(uint8 slot, uint32 value);
  1925. void IncrementWeekGames(uint8 slot);
  1926. void IncrementWeekWins(uint8 slot);
  1927. void IncrementSeasonGames(uint8 slot);
  1928. void IncrementSeasonWins(uint8 slot);
  1929. void FinishWeek();
  1930.  
  1931. Difficulty GetDifficultyID(MapEntry const* mapEntry) const;
  1932. Difficulty GetDungeonDifficultyID() const { return m_dungeonDifficulty; }
  1933. Difficulty GetRaidDifficultyID() const { return m_raidDifficulty; }
  1934. Difficulty GetLegacyRaidDifficultyID() const { return m_legacyRaidDifficulty; }
  1935. void SetDungeonDifficultyID(Difficulty dungeon_difficulty) { m_dungeonDifficulty = dungeon_difficulty; }
  1936. void SetRaidDifficultyID(Difficulty raid_difficulty) { m_raidDifficulty = raid_difficulty; }
  1937. void SetLegacyRaidDifficultyID(Difficulty raid_difficulty) { m_legacyRaidDifficulty = raid_difficulty; }
  1938. static Difficulty CheckLoadedDungeonDifficultyID(Difficulty difficulty);
  1939. static Difficulty CheckLoadedRaidDifficultyID(Difficulty difficulty);
  1940. static Difficulty CheckLoadedLegacyRaidDifficultyID(Difficulty difficulty);
  1941. void SendRaidGroupOnlyMessage(RaidGroupReason reason, int32 delay) const;
  1942.  
  1943. bool UpdateSkill(uint32 skill_id, uint32 step);
  1944. bool UpdateSkillPro(uint16 skillId, int32 chance, uint32 step);
  1945.  
  1946. bool UpdateCraftSkill(uint32 spellid);
  1947. bool UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLevel, uint32 Multiplicator = 1);
  1948. bool UpdateFishingSkill();
  1949.  
  1950. float GetHealthBonusFromStamina();
  1951.  
  1952. bool UpdateStats(Stats stat) override;
  1953. bool UpdateAllStats() override;
  1954. void ApplySpellPenetrationBonus(int32 amount, bool apply);
  1955. void UpdateResistances(uint32 school) override;
  1956. void UpdateArmor() override;
  1957. void UpdateMaxHealth() override;
  1958. void UpdateMaxPower(Powers power) override;
  1959. uint32 GetPowerIndex(Powers power) const override;
  1960. void UpdateAttackPowerAndDamage(bool ranged = false) override;
  1961. void ApplySpellPowerBonus(int32 amount, bool apply);
  1962. void UpdateSpellDamageAndHealingBonus();
  1963. void ApplyRatingMod(CombatRating cr, int32 value, bool apply);
  1964. void UpdateRating(CombatRating cr);
  1965. void UpdateAllRatings();
  1966. void UpdateMastery();
  1967. float GetMasteryPct();
  1968. void UpdateVersatilityDamageDone();
  1969. void UpdateHealingDonePercentMod();
  1970. bool CanUseMastery() const;
  1971. void UpdateAverageItemLevel();
  1972.  
  1973. void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage) override;
  1974.  
  1975. void RecalculateRating(CombatRating cr) { ApplyRatingMod(cr, 0, true);}
  1976. void GetDodgeFromAgility(float &diminishing, float &nondiminishing) const;
  1977. float GetRatingMultiplier(CombatRating cr) const;
  1978. float GetRatingBonusValue(CombatRating cr) const;
  1979.  
  1980. /// Returns base spellpower bonus from spellpower stat on items, without spellpower from intellect stat
  1981. uint32 GetBaseSpellPowerBonus() const { return m_baseSpellPower; }
  1982. int32 GetSpellPenetrationItemMod() const { return m_spellPenetrationItemMod; }
  1983.  
  1984. float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const;
  1985. void UpdateBlockPercentage();
  1986. void UpdateCritPercentage(WeaponAttackType attType);
  1987. void UpdateAllCritPercentages();
  1988. void UpdateParryPercentage();
  1989. void UpdateDodgePercentage();
  1990. void UpdateMeleeHitChances();
  1991. void UpdateRangedHitChances();
  1992. void UpdateSpellHitChances();
  1993. void UpdateLeechPercentage();
  1994.  
  1995. void UpdateSpellCritChance();
  1996. void UpdateArmorPenetration(int32 amount);
  1997. void UpdateExpertise(WeaponAttackType attType);
  1998. void ApplyManaRegenBonus(int32 amount, bool apply);
  1999. void ApplyHealthRegenBonus(int32 amount, bool apply);
  2000. void UpdateManaRegen();
  2001. void UpdateAllRunesRegen();
  2002.  
  2003. ObjectGuid const& GetLootGUID() const { return GetGuidValue(PLAYER_LOOT_TARGET_GUID); }
  2004. void SetLootGUID(ObjectGuid const& guid) { SetGuidValue(PLAYER_LOOT_TARGET_GUID, guid); }
  2005. ObjectGuid GetLootWorldObjectGUID(ObjectGuid const& lootObjectGuid) const;
  2006. void RemoveAELootedObject(ObjectGuid const& lootObjectGuid);
  2007. bool HasLootWorldObjectGUID(ObjectGuid const& lootWorldObjectGuid) const;
  2008. std::unordered_map<ObjectGuid, ObjectGuid> const& GetAELootView() const { return m_AELootView; }
  2009.  
  2010. void RemovedInsignia(Player* looterPlr);
  2011.  
  2012. WorldSession* GetSession() const { return m_session; }
  2013.  
  2014. void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const override;
  2015. void DestroyForPlayer(Player* target) const override;
  2016.  
  2017. // notifiers
  2018. void SendAttackSwingCantAttack() const;
  2019. void SendAttackSwingCancelAttack() const;
  2020. void SendAttackSwingDeadTarget() const;
  2021. void SendAttackSwingNotInRange() const;
  2022. void SendAttackSwingBadFacingAttack() const;
  2023. void SendAutoRepeatCancel(Unit* target);
  2024. void SendExplorationExperience(uint32 Area, uint32 Experience) const;
  2025.  
  2026. void SendDungeonDifficulty(int32 forcedDifficulty = -1) const;
  2027. void SendRaidDifficulty(bool legacy, int32 forcedDifficulty = -1) const;
  2028. void ResetInstances(uint8 method, bool isRaid, bool isLegacy);
  2029. void SendResetInstanceSuccess(uint32 MapId) const;
  2030. void SendResetInstanceFailed(ResetFailedReason reason, uint32 mapID) const;
  2031. void SendResetFailedNotify(uint32 mapid) const;
  2032.  
  2033. bool UpdatePosition(float x, float y, float z, float orientation, bool teleport = false) override;
  2034. bool UpdatePosition(const Position &pos, bool teleport = false) override { return UpdatePosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }
  2035. void UpdateUnderwaterState(Map* m, float x, float y, float z) override;
  2036.  
  2037. bool HasWorldQuestEnabled() const;
  2038. void UpdateWorldQuestPosition(float x, float y);
  2039.  
  2040. void SendMessageToSet(WorldPacket const* data, bool self) const override { SendMessageToSetInRange(data, GetVisibilityRange(), self); }
  2041. void SendMessageToSetInRange(WorldPacket const* data, float dist, bool self) const override;
  2042. void SendMessageToSetInRange(WorldPacket const* data, float dist, bool self, bool own_team_only) const;
  2043. void SendMessageToSet(WorldPacket const* data, Player const* skipped_rcvr) const override;
  2044.  
  2045. Corpse* GetCorpse() const;
  2046. void SpawnCorpseBones(bool triggerSave = true);
  2047. Corpse* CreateCorpse();
  2048. void KillPlayer();
  2049. static void OfflineResurrect(ObjectGuid const& guid, SQLTransaction& trans);
  2050. bool HasCorpse() const { return _corpseLocation.GetMapId() != MAPID_INVALID; }
  2051. WorldLocation GetCorpseLocation() const { return _corpseLocation; }
  2052. void InitializeSelfResurrectionSpells();
  2053. void ResurrectPlayer(float restore_percent, bool applySickness = false);
  2054. void BuildPlayerRepop();
  2055. void RepopAtGraveyard();
  2056.  
  2057. void DurabilityLossAll(double percent, bool inventory);
  2058. void DurabilityLoss(Item* item, double percent);
  2059. void DurabilityPointsLossAll(int32 points, bool inventory);
  2060. void DurabilityPointsLoss(Item* item, int32 points);
  2061. void DurabilityPointLossForEquipSlot(EquipmentSlots slot);
  2062. uint32 DurabilityRepairAll(bool cost, float discountMod, bool guildBank);
  2063. uint32 DurabilityRepair(uint16 pos, bool cost, float discountMod, bool guildBank);
  2064.  
  2065. void UpdateMirrorTimers();
  2066. void StopMirrorTimers();
  2067. bool IsMirrorTimerActive(MirrorTimerType type) const;
  2068.  
  2069. bool CanJoinConstantChannelInZone(ChatChannelsEntry const* channel, AreaTableEntry const* zone) const;
  2070.  
  2071. void JoinedChannel(Channel* c);
  2072. void LeftChannel(Channel* c);
  2073. void CleanupChannels();
  2074. void UpdateLocalChannels(uint32 newZone);
  2075. void LeaveLFGChannel();
  2076.  
  2077. typedef std::list<Channel*> JoinedChannelsList;
  2078. JoinedChannelsList const& GetJoinedChannels() const { return m_channels; }
  2079.  
  2080. void SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal);
  2081. uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus + temp bonus
  2082. uint16 GetPureMaxSkillValue(uint32 skill) const; // max
  2083. uint16 GetSkillValue(uint32 skill) const; // skill value + perm. bonus + temp bonus
  2084. uint16 GetBaseSkillValue(uint32 skill) const; // skill value + perm. bonus
  2085. uint16 GetPureSkillValue(uint32 skill) const; // skill value
  2086. int16 GetSkillPermBonusValue(uint32 skill) const;
  2087. int16 GetSkillTempBonusValue(uint32 skill) const;
  2088. uint16 GetSkillStep(uint16 skill) const; // 0...6
  2089. bool HasSkill(uint32 skill) const;
  2090. void LearnSkillRewardedSpells(uint32 skillId, uint32 skillValue);
  2091.  
  2092. WorldLocation& GetTeleportDest() { return m_teleport_dest; }
  2093. bool IsBeingTeleported() const { return mSemaphoreTeleport_Near || mSemaphoreTeleport_Far; }
  2094. bool IsBeingTeleportedNear() const { return mSemaphoreTeleport_Near; }
  2095. bool IsBeingTeleportedFar() const { return mSemaphoreTeleport_Far; }
  2096. bool IsBeingTeleportedSeamlessly() const { return IsBeingTeleportedFar() && m_teleport_options & TELE_TO_SEAMLESS; }
  2097. bool IsBeingTeleportedWithCastOnArrival() const { return IsBeingTeleportedFar() && m_teleport_options & TELE_TO_CAST_ON_ARRIVAL; }
  2098. uint32 GetOnArrivalCastSpellTeleport() const { return IsBeingTeleportedWithCastOnArrival() ? m_teleport_option_param : 0; }
  2099. void ResetOnArrivalCastSpellTeleport() { m_teleport_option_param = 0; }
  2100. void SetSemaphoreTeleportNear(bool semphsetting) { mSemaphoreTeleport_Near = semphsetting; }
  2101. void SetSemaphoreTeleportFar(bool semphsetting) { mSemaphoreTeleport_Far = semphsetting; }
  2102. void ProcessDelayedOperations();
  2103.  
  2104. void CheckAreaExploreAndOutdoor(void);
  2105. void SendClearCooldown(uint32 spell_id, Unit* target);
  2106. void ModSpellCharge(uint32 SpellID, int32 num);
  2107.  
  2108. struct SpellChargeData
  2109. {
  2110. int8 charges;
  2111. int8 maxCharges;
  2112.  
  2113. SpellCategoryEntry const* categoryEntry;
  2114. uint32 timer;
  2115. uint32 chargeRegenTime;
  2116. float speed = 1.0f;
  2117. SpellInfo const* spellInfo = nullptr;
  2118. };
  2119.  
  2120. typedef std::map<uint32 /*categoryId*/, SpellChargeData> SpellChargeDataMap;
  2121.  
  2122. SpellChargeDataMap m_spellChargeData;
  2123. uint32 GetSpellCategoryChargesTimer(SpellCategoryEntry const* categoryEntry, SpellInfo const* spellInfo = nullptr) const;
  2124. uint8 GetMaxSpellCategoryCharges(SpellCategoryEntry const* categoryEntry) const;
  2125. float SpellCooldownModByRate(SpellInfo const* spellInfo);
  2126. void ModifyExcludeCasterAuraSpell(uint32 auraId, bool apply);
  2127. static uint32 TeamForRace(uint8 race);
  2128. static TeamId TeamIdForRace(uint8 race);
  2129. uint32 GetTeam() const { return m_team; }
  2130. bool IsInAlliance() const { return m_team == ALLIANCE; }
  2131. bool IsInHorde() const { return m_team == HORDE; }
  2132. TeamId GetTeamId() const { return m_team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; }
  2133. void setFactionForRace(uint8 race);
  2134.  
  2135. void InitDisplayIds();
  2136.  
  2137. bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const;
  2138. bool IsAtRecruitAFriendDistance(WorldObject const* pOther) const;
  2139. void RewardPlayerAndGroupAtKill(Unit* victim, bool isBattleGround);
  2140. void RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource);
  2141. bool isHonorOrXPTarget(Unit const* victim) const;
  2142.  
  2143. bool GetsRecruitAFriendBonus(bool forXP);
  2144. uint8 GetGrantableLevels() const { return m_grantableLevels; }
  2145. void SetGrantableLevels(uint8 val) { m_grantableLevels = val; }
  2146.  
  2147. ReputationMgr& GetReputationMgr() { return *m_reputationMgr; }
  2148. ReputationMgr const& GetReputationMgr() const { return *m_reputationMgr; }
  2149. ReputationRank GetReputationRank(uint32 faction_id) const;
  2150. void RewardReputation(Unit* victim, float rate);
  2151. void RewardReputation(Quest const* quest);
  2152.  
  2153. int32 CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool noQuestBonus = false);
  2154.  
  2155. void UpdateSkillsForLevel();
  2156. void UpdateSkillsToMaxSkillsForLevel(); // for .levelup
  2157. void ModifySkillBonus(uint32 skillid, int32 val, bool talent);
  2158.  
  2159. /*********************************************************/
  2160. /*** PVP SYSTEM ***/
  2161. /*********************************************************/
  2162. // TODO: Properly implement correncies as of Cataclysm
  2163. void UpdateHonorFields();
  2164. bool RewardHonor(Unit* victim, uint32 groupsize, int32 honor = -1, bool pvptoken = false);
  2165. uint32 GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot) const;
  2166.  
  2167. // duel health and mana reset methods
  2168. void SaveHealthBeforeDuel() { healthBeforeDuel = GetHealth(); }
  2169. void SaveManaBeforeDuel() { manaBeforeDuel = GetPower(POWER_MANA); }
  2170. void RestoreHealthAfterDuel() { SetHealth(healthBeforeDuel); }
  2171. void RestoreManaAfterDuel() { SetPower(POWER_MANA, manaBeforeDuel); }
  2172.  
  2173. uint32 GetPrestigeLevel() const { return GetUInt32Value(PLAYER_FIELD_PRESTIGE); }
  2174. uint32 GetHonorLevel() const { return GetUInt32Value(PLAYER_FIELD_HONOR_LEVEL); }
  2175. void AddHonorXP(uint32 xp);
  2176. void SetHonorLevel(uint8 honorLevel);
  2177. void Prestige();
  2178. bool CanPrestige() const;
  2179. bool IsMaxPrestige() const;
  2180. bool IsMaxHonorLevelAndPrestige() const { return IsMaxPrestige() && GetHonorLevel() == PLAYER_MAX_HONOR_LEVEL; }
  2181. // Updates PLAYER_FIELD_HONOR_NEXT_LEVEL based on PLAYER_FIELD_HONOR_LEVEL and the smallest value of PLAYER_FIELD_PRESTIGE and (PRESTIGE_COLUMN_COUNT - 1)
  2182. void UpdateHonorNextLevel();
  2183. //End of PvP System
  2184.  
  2185. void RewardPlayerWithRewardPack(uint32 rewardPackID);
  2186. void RewardPlayerWithRewardPack(RewardPackEntry const* rewardPackEntry);
  2187.  
  2188. void SetDrunkValue(uint8 newDrunkValue, uint32 itemId = 0);
  2189. uint8 GetDrunkValue() const { return GetByteValue(PLAYER_BYTES_3, PLAYER_BYTES_3_OFFSET_INEBRIATION); }
  2190. static DrunkenState GetDrunkenstateByValue(uint8 value);
  2191.  
  2192. uint32 GetDeathTimer() const { return m_deathTimer; }
  2193. uint32 GetCorpseReclaimDelay(bool pvp) const;
  2194. void UpdateCorpseReclaimDelay();
  2195. int32 CalculateCorpseReclaimDelay(bool load = false) const;
  2196. void SendCorpseReclaimDelay(uint32 delay) const;
  2197.  
  2198. uint32 GetBlockPercent() const override { return GetUInt32Value(PLAYER_SHIELD_BLOCK); }
  2199. bool CanParry() const { return m_canParry; }
  2200. void SetCanParry(bool value);
  2201. bool CanBlock() const { return m_canBlock; }
  2202. void SetCanBlock(bool value);
  2203. bool CanTitanGrip() const { return m_canTitanGrip; }
  2204. void SetCanTitanGrip(bool value, uint32 penaltySpellId = 0);
  2205. void CheckTitanGripPenalty();
  2206. bool CanTameExoticPets() const { return IsGameMaster() || HasAuraType(SPELL_AURA_ALLOW_TAME_PET_TYPE); }
  2207.  
  2208. void SetRegularAttackTime();
  2209. void SetBaseModValue(BaseModGroup modGroup, BaseModType modType, float value) { m_auraBaseMod[modGroup][modType] = value; }
  2210. void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply);
  2211. float GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const;
  2212. float GetTotalBaseModValue(BaseModGroup modGroup) const;
  2213. float GetTotalPercentageModValue(BaseModGroup modGroup) const { return m_auraBaseMod[modGroup][FLAT_MOD] + m_auraBaseMod[modGroup][PCT_MOD]; }
  2214. void _ApplyAllStatBonuses();
  2215. void _RemoveAllStatBonuses();
  2216.  
  2217. void ResetAllPowers();
  2218.  
  2219. void CastAllObtainSpells();
  2220. void ApplyItemObtainSpells(Item* item, bool apply);
  2221. void ApplyItemDependentAuras(Item* item, bool apply);
  2222.  
  2223. void _ApplyItemMods(Item* item, uint8 slot, bool apply, bool updateItemAuras = true);
  2224. void _RemoveAllItemMods();
  2225. void _ApplyAllItemMods();
  2226. void _ApplyAllLevelScaleItemMods(bool apply);
  2227. void _ApplyItemBonuses(Item* item, uint8 slot, bool apply);
  2228. void _ApplyWeaponDamage(uint8 slot, Item* item, bool apply);
  2229. bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) const;
  2230. void ToggleMetaGemsActive(uint8 exceptslot, bool apply);
  2231. void CorrectMetaGemEnchants(uint8 slot, bool apply);
  2232. void InitDataForForm(bool reapplyMods = false);
  2233.  
  2234. void ApplyItemEquipSpell(Item* item, bool apply, bool formChange = false);
  2235. void ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, bool formChange = false);
  2236. void UpdateEquipSpellsAtFormChange();
  2237. void UpdateItemSetAuras(bool formChange = false);
  2238. void ApplyArtifactPowers(Item* item, bool apply);
  2239. void ApplyArtifactPowerRank(Item* artifact, ArtifactPowerRankEntry const* artifactPowerRank, bool apply);
  2240.  
  2241. void CastItemCombatSpell(DamageInfo const& damageInfo);
  2242. void CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemTemplate const* proto);
  2243. void CastItemUseSpell(Item* item, SpellCastTargets const& targets, ObjectGuid castCount, int32* misc);
  2244.  
  2245. void SendEquipmentSetList();
  2246. void SetEquipmentSet(EquipmentSetInfo::EquipmentSetData const& newEqSet);
  2247. void DeleteEquipmentSet(uint64 id);
  2248.  
  2249. void SendInitWorldStates(uint32 zone, uint32 area);
  2250. void SendUpdateWorldState(uint32 variable, uint32 value, bool hidden = false) const;
  2251. void SendDirectMessage(WorldPacket const* data) const;
  2252. void SetWorldState(uint32 id, uint32 value) { m_WorldStates.erase(id); m_WorldStates.insert(std::pair<uint32, uint32>(id, value)); };
  2253. uint32 GetWorldState(uint32 id) {
  2254. if (m_WorldStates.find(id) == m_WorldStates.end())
  2255. return 0;
  2256. return m_WorldStates.at(id);
  2257. };
  2258. void SendBGWeekendWorldStates() const;
  2259. void SendBattlefieldWorldStates() const;
  2260.  
  2261. void SendAurasForTarget(Unit* target) const;
  2262.  
  2263. PlayerMenu* PlayerTalkClass;
  2264. std::vector<ItemSetEffect*> ItemSetEff;
  2265.  
  2266. void SendLoot(ObjectGuid guid, LootType loot_type, bool aeLooting = false);
  2267. void SendLootError(ObjectGuid const& lootObj, ObjectGuid const& owner, LootError error) const;
  2268. void SendLootRelease(ObjectGuid guid) const;
  2269. void SendLootReleaseAll() const;
  2270. void SendNotifyLootItemRemoved(ObjectGuid lootObj, uint8 lootSlot) const;
  2271. void SendNotifyLootMoneyRemoved(ObjectGuid lootObj) const;
  2272.  
  2273. /*********************************************************/
  2274. /*** BATTLEGROUND SYSTEM ***/
  2275. /*********************************************************/
  2276.  
  2277. bool InBattleground() const { return m_bgData.bgInstanceID != 0; }
  2278. bool InArena() const;
  2279. uint32 GetBattlegroundId() const { return m_bgData.bgInstanceID; }
  2280. BattlegroundTypeId GetBattlegroundTypeId() const { return m_bgData.bgTypeID; }
  2281. Battleground* GetBattleground() const;
  2282.  
  2283. uint32 GetBattlegroundQueueJoinTime(BattlegroundQueueTypeId bgQueueTypeId) const;
  2284. bool InBattlegroundQueue() const;
  2285. BattlegroundQueueTypeId GetBattlegroundQueueTypeId(uint32 index) const;
  2286. uint32 GetBattlegroundQueueIndex(BattlegroundQueueTypeId bgQueueTypeId) const;
  2287. bool IsInvitedForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const;
  2288. bool InBattlegroundQueueForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const;
  2289.  
  2290. void SetBattlegroundId(uint32 val, BattlegroundTypeId bgTypeId);
  2291. uint32 AddBattlegroundQueueId(BattlegroundQueueTypeId val);
  2292. bool HasFreeBattlegroundQueueId() const;
  2293. void RemoveBattlegroundQueueId(BattlegroundQueueTypeId val);
  2294. void SetInviteForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId, uint32 instanceId);
  2295. bool IsInvitedForBattlegroundInstance(uint32 instanceId) const;
  2296. WorldLocation const& GetBattlegroundEntryPoint() const { return m_bgData.joinPos; }
  2297. void SetBattlegroundEntryPoint();
  2298.  
  2299. void SetBGTeam(uint32 team);
  2300. uint32 GetBGTeam() const;
  2301.  
  2302. void LeaveBattleground(bool teleportToEntryPoint = true);
  2303. bool CanJoinToBattleground(Battleground const* bg) const;
  2304. bool CanReportAfkDueToLimit();
  2305. void ReportedAfkBy(Player* reporter);
  2306. void ClearAfkReports() { m_bgData.bgAfkReporter.clear(); }
  2307.  
  2308. bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const;
  2309. bool CanUseBattlegroundObject(GameObject* gameobject) const;
  2310. bool isTotalImmune() const;
  2311. bool CanCaptureTowerPoint() const;
  2312.  
  2313. bool GetRandomWinner() const { return m_IsBGRandomWinner; }
  2314. void SetRandomWinner(bool isWinner);
  2315.  
  2316. /*********************************************************/
  2317. /*** OUTDOOR PVP SYSTEM ***/
  2318. /*********************************************************/
  2319.  
  2320. OutdoorPvP* GetOutdoorPvP() const;
  2321. // returns true if the player is in active state for outdoor pvp objective capturing, false otherwise
  2322. bool IsOutdoorPvPActive() const;
  2323.  
  2324. /*********************************************************/
  2325. /*** ENVIROMENTAL SYSTEM ***/
  2326. /*********************************************************/
  2327.  
  2328. bool IsImmuneToEnvironmentalDamage() const;
  2329. uint32 EnvironmentalDamage(EnviromentalDamage type, uint32 damage);
  2330.  
  2331. /*********************************************************/
  2332. /*** FLOOD FILTER SYSTEM ***/
  2333. /*********************************************************/
  2334.  
  2335. void UpdateSpeakTime();
  2336. bool CanSpeak() const;
  2337.  
  2338. /*********************************************************/
  2339. /*** VARIOUS SYSTEMS ***/
  2340. /*********************************************************/
  2341. void UpdateFallInformationIfNeed(MovementInfo const& minfo, uint16 opcode);
  2342. // only changed for direct client control (possess, vehicle etc.), not stuff you control using pet commands
  2343. Unit* m_unitMovedByMe;
  2344. WorldObject* m_seer;
  2345. void SetFallInformation(uint32 time, float z);
  2346. void HandleFall(MovementInfo const& movementInfo);
  2347.  
  2348. void SetClientControl(Unit* target, bool allowMove);
  2349.  
  2350. void SetMover(Unit* target);
  2351.  
  2352. void SetSeer(WorldObject* target) { m_seer = target; }
  2353. void SetViewpoint(WorldObject* target, bool apply);
  2354. WorldObject* GetViewpoint() const;
  2355. void StopCastingCharm();
  2356. void StopCastingBindSight() const;
  2357.  
  2358. uint32 GetSaveTimer() const { return m_nextSave; }
  2359. void SetSaveTimer(uint32 timer) { m_nextSave = timer; }
  2360.  
  2361. void SaveRecallPosition() { m_recall_location.WorldRelocate(*this); }
  2362. void Recall() { TeleportTo(m_recall_location); }
  2363.  
  2364. void SetHomebind(WorldLocation const& loc, uint32 areaId);
  2365. void SendBindPointUpdate() const;
  2366.  
  2367. // Homebind coordinates
  2368. uint32 m_homebindMapId;
  2369. uint16 m_homebindAreaId;
  2370. float m_homebindX;
  2371. float m_homebindY;
  2372. float m_homebindZ;
  2373.  
  2374. WorldLocation GetStartPosition() const;
  2375.  
  2376. // currently visible objects at player client
  2377. GuidUnorderedSet m_clientGUIDs;
  2378. GuidUnorderedSet m_visibleTransports;
  2379.  
  2380. bool HaveAtClient(Object const* u) const;
  2381.  
  2382. bool IsNeverVisibleFor(WorldObject const* seer) const override;
  2383.  
  2384. bool IsVisibleGloballyFor(Player const* player) const;
  2385.  
  2386. void SendInitialVisiblePackets(Unit* target) const;
  2387. void UpdateObjectVisibility(bool forced = true) override;
  2388. void UpdateVisibilityForPlayer();
  2389. void UpdateVisibilityOf(WorldObject* target);
  2390. void UpdateTriggerVisibility();
  2391.  
  2392. template<class T>
  2393. void UpdateVisibilityOf(T* target, UpdateData& data, std::set<Unit*>& visibleNow);
  2394.  
  2395. uint8 m_forced_speed_changes[MAX_MOVE_TYPE];
  2396.  
  2397. bool HasAtLoginFlag(AtLoginFlags f) const { return (m_atLoginFlags & f) != 0; }
  2398. void SetAtLoginFlag(AtLoginFlags f) { m_atLoginFlags |= f; }
  2399. void RemoveAtLoginFlag(AtLoginFlags flags, bool persist = false);
  2400.  
  2401. bool isUsingLfg() const;
  2402. bool inRandomLfgDungeon() const;
  2403.  
  2404. typedef std::set<uint32> DFQuestsDoneList;
  2405. DFQuestsDoneList m_DFQuests;
  2406.  
  2407. // Temporarily removed pet cache
  2408. uint32 GetTemporaryUnsummonedPetNumber() const { return m_temporaryUnsummonedPetNumber; }
  2409. void SetTemporaryUnsummonedPetNumber(uint32 petnumber) { m_temporaryUnsummonedPetNumber = petnumber; }
  2410. void UnsummonPetTemporaryIfAny();
  2411. void ResummonPetTemporaryUnSummonedIfAny();
  2412. bool IsPetNeedBeTemporaryUnsummoned() const;
  2413.  
  2414. void SendCinematicStart(uint32 CinematicSequenceId) const;
  2415. void SendMovieStart(uint32 movieId);
  2416.  
  2417. uint32 DoRandomRoll(uint32 minimum, uint32 maximum);
  2418. uint8 GetItemLimitCategoryQuantity(ItemLimitCategoryEntry const* limitEntry) const;
  2419. void ShowNeutralPlayerFactionSelectUI();
  2420. void SendDisplayToast(uint32 entry, uint32 questId, uint32 count, DisplayToastMethod method, ToastTypes type, bool bonusRoll, bool mailed, std::vector<int32> bonus = {});
  2421.  
  2422.  
  2423. void SetEffectiveLevelAndMaxItemLevel(uint32 effectiveLevel, uint32 maxItemLevel);
  2424.  
  2425.  
  2426. void UpdateItemLevelAreaBasedScaling();
  2427. void ActivatePvpItemLevels(bool activate) { _usePvpItemLevels = activate; }
  2428. bool IsUsingPvpItemLevels() const { return _usePvpItemLevels; }
  2429.  
  2430. /*********************************************************/
  2431. /*** INSTANCE SYSTEM ***/
  2432. /*********************************************************/
  2433.  
  2434. typedef std::unordered_map< uint32 /*mapId*/, InstancePlayerBind > BoundInstancesMap;
  2435.  
  2436. void UpdateHomebindTime(uint32 time);
  2437.  
  2438. uint32 m_HomebindTimer;
  2439. bool m_InstanceValid;
  2440. // permanent binds and solo binds by difficulty
  2441. BoundInstancesMap m_boundInstances[MAX_DIFFICULTY];
  2442. InstancePlayerBind* GetBoundInstance(uint32 mapid, Difficulty difficulty, bool withExpired = false);
  2443. InstancePlayerBind const* GetBoundInstance(uint32 mapid, Difficulty difficulty) const;
  2444. BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; }
  2445. InstanceSave* GetInstanceSave(uint32 mapid);
  2446. void UnbindInstance(uint32 mapid, Difficulty difficulty, bool unload = false);
  2447. void UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficulty, bool unload = false);
  2448. InstancePlayerBind* BindToInstance(InstanceSave* save, bool permanent, BindExtensionState extendState = EXTEND_STATE_NORMAL, bool load = false);
  2449. void BindToInstance();
  2450. void SetPendingBind(uint32 instanceId, uint32 bindTimer);
  2451. bool HasPendingBind() const { return _pendingBindId > 0; }
  2452. void SendRaidInfo();
  2453. bool Satisfy(AccessRequirement const* ar, uint32 target_map, bool report = false);
  2454. bool CheckInstanceValidity(bool /*isLogin*/);
  2455. bool CheckInstanceCount(uint32 instanceId) const;
  2456. void AddInstanceEnterTime(uint32 instanceId, time_t enterTime);
  2457.  
  2458. // last used pet number (for BG's)
  2459. uint32 GetLastPetNumber() const { return m_lastpetnumber; }
  2460. void SetLastPetNumber(uint32 petnumber) { m_lastpetnumber = petnumber; }
  2461.  
  2462. /*********************************************************/
  2463. /*** GROUP SYSTEM ***/
  2464. /*********************************************************/
  2465.  
  2466. Group* GetGroupInvite() const { return m_groupInvite; }
  2467. void SetGroupInvite(Group* group) { m_groupInvite = group; }
  2468. Group* GetGroup() { return m_group.getTarget(); }
  2469. Group const* GetGroup() const { return const_cast<Group const*>(m_group.getTarget()); }
  2470. GroupReference& GetGroupRef() { return m_group; }
  2471. void SetGroup(Group* group, int8 subgroup = -1);
  2472. uint8 GetSubGroup() const { return m_group.getSubGroup(); }
  2473. uint32 GetGroupUpdateFlag() const { return m_groupUpdateMask; }
  2474. void SetGroupUpdateFlag(uint32 flag) { m_groupUpdateMask |= flag; }
  2475. void RemoveGroupUpdateFlag(uint32 flag) { m_groupUpdateMask &= ~flag; }
  2476. void SetPartyType(GroupCategory category, uint8 type);
  2477. void ResetGroupUpdateSequenceIfNeeded(Group const* group);
  2478. int32 NextGroupUpdateSequenceNumber(GroupCategory category);
  2479. Player* GetNextRandomRaidMember(float radius);
  2480. PartyResult CanUninviteFromGroup(ObjectGuid guidMember = ObjectGuid::Empty) const;
  2481.  
  2482. // Battleground / Battlefield Group System
  2483. void SetBattlegroundOrBattlefieldRaid(Group* group, int8 subgroup = -1);
  2484. void RemoveFromBattlegroundOrBattlefieldRaid();
  2485. Group* GetOriginalGroup() const { return m_originalGroup.getTarget(); }
  2486. GroupReference& GetOriginalGroupRef() { return m_originalGroup; }
  2487. uint8 GetOriginalSubGroup() const { return m_originalGroup.getSubGroup(); }
  2488. void SetOriginalGroup(Group* group, int8 subgroup = -1);
  2489.  
  2490. void SetPassOnGroupLoot(bool bPassOnGroupLoot) { m_bPassOnGroupLoot = bPassOnGroupLoot; }
  2491. bool GetPassOnGroupLoot() const { return m_bPassOnGroupLoot; }
  2492.  
  2493. MapReference &GetMapRef() { return m_mapRef; }
  2494.  
  2495. // Set map to player and add reference
  2496. void SetMap(Map* map) override;
  2497. void ResetMap() override;
  2498.  
  2499. bool isAllowedToLoot(const Creature* creature);
  2500.  
  2501. DeclinedName const* GetDeclinedNames() const { return m_declinedname; }
  2502. uint8 GetRunesState() const;
  2503. uint32 GetRuneCooldown(uint8 index) const { return m_runes->Cooldown[index]; }
  2504. uint32 GetRuneBaseCooldown() const;
  2505. void SetRuneCooldown(uint8 index, uint32 cooldown);
  2506. void ResyncRunes() const;
  2507. void AddRunePower(uint8 index) const;
  2508. void InitRunes();
  2509.  
  2510. void SendRespondInspectAchievements(Player* player) const;
  2511. uint32 GetAchievementPoints() const;
  2512. bool HasAchieved(uint32 achievementId) const;
  2513. void ResetAchievements();
  2514. void ResetCriteria(CriteriaTypes type, uint64 miscValue1 = 0, uint64 miscValue2 = 0, bool evenIfCriteriaComplete = false);
  2515. void UpdateCriteria(CriteriaTypes type, uint64 miscValue1 = 0, uint64 miscValue2 = 0, uint64 miscValue3 = 0, Unit* unit = NULL);
  2516. void StartCriteriaTimer(CriteriaTimedTypes type, uint32 entry, uint32 timeLost = 0);
  2517. void RemoveCriteriaTimer(CriteriaTimedTypes type, uint32 entry);
  2518. void CompletedAchievement(uint32 achievementId);
  2519. void CompletedAchievement(AchievementEntry const* entry);
  2520. bool ModifierTreeSatisfied(uint32 modifierTreeId) const;
  2521.  
  2522. bool HasTitle(uint32 bitIndex) const;
  2523. bool HasTitle(CharTitlesEntry const* title) const;
  2524. void SetTitle(CharTitlesEntry const* title, bool lost = false);
  2525.  
  2526. //bool isActiveObject() const { return true; }
  2527. bool CanSeeSpellClickOn(Creature const* creature) const;
  2528.  
  2529. uint32 GetChampioningFaction() const { return m_ChampioningFaction; }
  2530. void SetChampioningFaction(uint32 faction) { m_ChampioningFaction = faction; }
  2531. Spell* m_spellModTakingSpell;
  2532.  
  2533. float GetAverageItemLevelEquipped() const;
  2534. float GetAverageItemLevelEquippedAndBag() const;
  2535. uint8 GetSlotEquipmentFromInventory(ItemTemplate const* proto) const;
  2536.  
  2537. bool isDebugAreaTriggers;
  2538.  
  2539. void ClearWhisperWhiteList() { WhisperList.clear(); }
  2540. void AddWhisperWhiteList(ObjectGuid guid) { WhisperList.push_back(guid); }
  2541. bool IsInWhisperWhiteList(ObjectGuid guid);
  2542. void RemoveFromWhisperWhiteList(ObjectGuid guid) { WhisperList.remove(guid); }
  2543.  
  2544. void ValidateMovementInfo(MovementInfo* mi);
  2545.  
  2546. void SendMovementSetCollisionHeight(float height);
  2547.  
  2548. bool CanFly() const override { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY); }
  2549.  
  2550. //! Return collision height sent to client
  2551. float GetCollisionHeight(bool mounted) const;
  2552.  
  2553. std::string GetMapAreaAndZoneString() const;
  2554. std::string GetCoordsMapAreaAndZoneString() const;
  2555.  
  2556. // Void Storage
  2557. bool IsVoidStorageUnlocked() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_VOID_UNLOCKED); }
  2558. void UnlockVoidStorage() { SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_VOID_UNLOCKED); }
  2559. void LockVoidStorage() { RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_VOID_UNLOCKED); }
  2560. uint8 GetNextVoidStorageFreeSlot() const;
  2561. uint8 GetNumOfVoidStorageFreeSlots() const;
  2562. uint8 AddVoidStorageItem(VoidStorageItem&& item);
  2563. void DeleteVoidStorageItem(uint8 slot);
  2564. bool SwapVoidStorageItem(uint8 oldSlot, uint8 newSlot);
  2565. VoidStorageItem* GetVoidStorageItem(uint8 slot) const;
  2566. VoidStorageItem* GetVoidStorageItem(uint64 id, uint8& slot) const;
  2567.  
  2568. uint32 GetLastTargetedGO() { return _lastTargetedGO; }
  2569. void SetLastTargetedGO(uint32 lastTargetedGO) { _lastTargetedGO = lastTargetedGO; }
  2570.  
  2571. float GetPersonnalXpRate() { return _PersonnalXpRate; }
  2572. void SetPersonnalXpRate(float PersonnalXpRate);
  2573.  
  2574. void OnCombatExit();
  2575.  
  2576. /*
  2577. * Garrisons
  2578. */
  2579.  
  2580. void CreateGarrison(uint32 garrSiteId);
  2581. void DeleteGarrison(GarrisonType type);
  2582. PlayerGarrisonMap& GetGarrisons() { return _garrisons; }
  2583. Garrison* GetGarrison(GarrisonType type) const { auto garItr = _garrisons.find(type); return (garItr != _garrisons.end()) ? garItr->second.get() : nullptr; }
  2584.  
  2585. GarrisonType GetCurrentGarrison() const;
  2586. void SetCurrentGarrison(GarrisonType type);
  2587. bool IsInGarrison() const;
  2588.  
  2589. void AddGarrisonFollower(uint32 garrFollowerId);
  2590. void AddGarrisonMission(uint32 garrMissionId);
  2591.  
  2592. void SendGarrisonInfo() const;
  2593. void SendGarrisonRemoteInfo() const;
  2594. void SendGarrisonBlueprintAndSpecializationData() const;
  2595.  
  2596. // End Garrisons
  2597.  
  2598. // Arena
  2599. std::array<WorldPackets::Battleground::RatedInfo, MAX_PVP_SLOT> m_ratedInfos;
  2600.  
  2601.  
  2602. bool IsAdvancedCombatLoggingEnabled() const { return _advancedCombatLoggingEnabled; }
  2603. void SetAdvancedCombatLogging(bool enabled) { _advancedCombatLoggingEnabled = enabled; }
  2604.  
  2605. PlayerAchievementMgr* GetAchievementMgr() { return m_achievementMgr; }
  2606. QuestObjectiveCriteriaMgr* GetQuestObjectiveCriteriaMgr() const { return m_questObjectiveCriteriaMgr.get(); }
  2607. SceneMgr& GetSceneMgr() { return m_sceneMgr; }
  2608. SceneMgr const& GetSceneMgr() const { return m_sceneMgr; }
  2609. RestMgr& GetRestMgr() const { return *_restMgr; }
  2610.  
  2611. struct MovieDelayedTeleport
  2612. {
  2613. uint32 movieId;
  2614. WorldLocation loc;
  2615. };
  2616.  
  2617. std::vector<MovieDelayedTeleport> MovieDelayedTeleports;
  2618.  
  2619. void AddMovieDelayedTeleport(uint32 movieId, uint32 mapID, float x, float y, float z, float o)
  2620. {
  2621. MovieDelayedTeleport data;
  2622. data.movieId = movieId;
  2623. data.loc = WorldLocation(mapID);
  2624. data.loc.Relocate(x, y, z, o);
  2625.  
  2626. MovieDelayedTeleports.push_back(data);
  2627. }
  2628. void AddMovieDelayedTeleport(uint32 movieId, uint32 mapID, Position pos)
  2629. {
  2630. AddMovieDelayedTeleport(movieId, mapID, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
  2631. }
  2632.  
  2633. void SendPlayerChoice(ObjectGuid sender, int32 choiceId);
  2634. void UpdateShop(uint32 diff);
  2635.  
  2636. PlayerPetData* GetPlayerPetDataById(uint32 petId);
  2637. PlayerPetData* GetPlayerPetDataBySlot(uint8 slot);
  2638. PlayerPetData* GetPlayerPetDataByCreatureId(uint32 creatureId);
  2639. PlayerPetData* GetPlayerPetDataCurrent();
  2640. Optional<uint8> GetFirstUnusedActivePetSlot();
  2641. Optional<uint8> GetFirstUnusedPetSlot();
  2642. void DeleteFromPlayerPetDataStore(uint32 petNumber);
  2643. void AddToPlayerPetDataStore(PlayerPetData* playerPetData);
  2644.  
  2645. ArchaeologyPlayerMgr& GetArchaeologyMgr() { return m_archaeologyPlayerMgr; }
  2646.  
  2647. bool MeetPlayerCondition(uint32 conditionId) const;
  2648.  
  2649. // Send custom message with system message (addon, custom interfaces ...etc)
  2650. void SendCustomMessage(std::string const& opcode, std::string const& data = "");
  2651. void SendCustomMessage(std::string const& opcode, std::vector<std::string> const& data);
  2652.  
  2653.  
  2654. protected:
  2655. // Gamemaster whisper whitelist
  2656. GuidList WhisperList;
  2657. uint32 m_combatExitTime;
  2658. uint32 m_regenTimerCount;
  2659. uint32 m_soulShardsRegenTimerCount;
  2660. float m_powerFraction[MAX_POWERS_PER_CLASS];
  2661. uint32 m_contestedPvPTimer;
  2662. uint32 m_areaQuestTimer;
  2663.  
  2664. /*********************************************************/
  2665. /*** BATTLEGROUND SYSTEM ***/
  2666. /*********************************************************/
  2667.  
  2668. /*
  2669. this is an array of BG queues (BgTypeIDs) in which is player
  2670. */
  2671. struct BgBattlegroundQueueID_Rec
  2672. {
  2673. BattlegroundQueueTypeId bgQueueTypeId;
  2674. uint32 invitedToInstance;
  2675. uint32 joinTime;
  2676. };
  2677.  
  2678. BgBattlegroundQueueID_Rec m_bgBattlegroundQueueID[PLAYER_MAX_BATTLEGROUND_QUEUES];
  2679. BGData m_bgData;
  2680.  
  2681. bool m_IsBGRandomWinner;
  2682.  
  2683. /*********************************************************/
  2684. /*** QUEST SYSTEM ***/
  2685. /*********************************************************/
  2686.  
  2687. //We allow only one timed quest active at the same time. Below can then be simple value instead of set.
  2688. typedef std::set<uint32> QuestSet;
  2689. typedef std::set<uint32> SeasonalQuestSet;
  2690. typedef std::unordered_map<uint32, SeasonalQuestSet> SeasonalEventQuestMap;
  2691. QuestSet m_timedquests;
  2692. QuestSet m_weeklyquests;
  2693. QuestSet m_monthlyquests;
  2694. SeasonalEventQuestMap m_seasonalquests;
  2695.  
  2696. ObjectGuid m_divider;
  2697. uint32 m_ingametime;
  2698.  
  2699. /*********************************************************/
  2700. /*** LOAD SYSTEM ***/
  2701. /*********************************************************/
  2702.  
  2703. void _LoadActions(PreparedQueryResult result);
  2704. void _LoadAuras(PreparedQueryResult auraResult, PreparedQueryResult effectResult, uint32 timediff);
  2705. void _LoadGlyphAuras();
  2706. void _LoadBoundInstances(PreparedQueryResult result);
  2707. void _LoadInventory(PreparedQueryResult result, PreparedQueryResult artifactsResult, uint32 timeDiff);
  2708. void _LoadVoidStorage(PreparedQueryResult result);
  2709. void _LoadMailInit(PreparedQueryResult resultUnread, PreparedQueryResult resultDelivery);
  2710. void _LoadMail();
  2711. void _LoadMailedItems(Mail* mail);
  2712. void _LoadQuestStatus(PreparedQueryResult result);
  2713. void _LoadQuestStatusObjectives(PreparedQueryResult result);
  2714. void _LoadQuestStatusRewarded(PreparedQueryResult result);
  2715. void _LoadDailyQuestStatus(PreparedQueryResult result);
  2716. void _LoadWeeklyQuestStatus(PreparedQueryResult result);
  2717. void _LoadMonthlyQuestStatus(PreparedQueryResult result);
  2718. void _LoadSeasonalQuestStatus(PreparedQueryResult result);
  2719. void _LoadRandomBGStatus(PreparedQueryResult result);
  2720. void _LoadGroup(PreparedQueryResult result);
  2721. void _LoadSkills(PreparedQueryResult result);
  2722. void AddTemporaryProfessionsSkills();
  2723. uint32 GetFreeTemporarySkillSlot(uint32 skillId);
  2724. bool IsProfessionSkillAll(uint32 skill);
  2725. void _LoadSpells(PreparedQueryResult result);
  2726. bool _LoadHomeBind(PreparedQueryResult result);
  2727. void _LoadDeclinedNames(PreparedQueryResult result);
  2728. void _LoadEquipmentSets(PreparedQueryResult result);
  2729. void _LoadTransmogOutfits(PreparedQueryResult result);
  2730. void _LoadArenaData(PreparedQueryResult result);
  2731. void _LoadBGData(PreparedQueryResult result);
  2732. void _LoadGlyphs(PreparedQueryResult result);
  2733. void _LoadTalents(PreparedQueryResult result);
  2734. void _LoadPvpTalents(PreparedQueryResult result);
  2735. void _LoadInstanceTimeRestrictions(PreparedQueryResult result);
  2736. void _LoadCurrency(PreparedQueryResult result);
  2737. void _LoadCUFProfiles(PreparedQueryResult result);
  2738.  
  2739. /*********************************************************/
  2740. /*** SAVE SYSTEM ***/
  2741. /*********************************************************/
  2742.  
  2743. void _SaveActions(SQLTransaction& trans);
  2744. void _SaveAuras(SQLTransaction& trans);
  2745. void _SaveInventory(SQLTransaction& trans);
  2746. void _SaveVoidStorage(SQLTransaction& trans);
  2747. void _SaveMail(SQLTransaction& trans);
  2748. void _SaveQuestStatus(SQLTransaction& trans);
  2749. void _SaveDailyQuestStatus(SQLTransaction& trans);
  2750. void _SaveWeeklyQuestStatus(SQLTransaction& trans);
  2751. void _SaveMonthlyQuestStatus(SQLTransaction& trans);
  2752. void _SaveSeasonalQuestStatus(SQLTransaction& trans);
  2753. void _SaveSkills(SQLTransaction& trans);
  2754. void _SaveSpells(SQLTransaction& trans);
  2755. void _SaveEquipmentSets(SQLTransaction& trans);
  2756. void _SaveArenaData(SQLTransaction& trans);
  2757. void _SaveBGData(SQLTransaction& trans);
  2758. void _SaveGlyphs(SQLTransaction& trans) const;
  2759. void _SaveTalents(SQLTransaction& trans);
  2760. void _SaveStats(SQLTransaction& trans) const;
  2761. void _SaveInstanceTimeRestrictions(SQLTransaction& trans);
  2762. void _SaveCurrency(SQLTransaction& trans);
  2763. void _SaveCUFProfiles(SQLTransaction& trans);
  2764.  
  2765. /*********************************************************/
  2766. /*** ENVIRONMENTAL SYSTEM ***/
  2767. /*********************************************************/
  2768. void HandleSobering();
  2769. void SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen);
  2770. void StopMirrorTimer(MirrorTimerType Type);
  2771. void HandleDrowning(uint32 time_diff);
  2772. int32 getMaxTimer(MirrorTimerType timer) const;
  2773.  
  2774. /*********************************************************/
  2775. /*** HONOR SYSTEM ***/
  2776. /*********************************************************/
  2777. time_t m_lastHonorUpdateTime;
  2778.  
  2779. void outDebugValues() const;
  2780.  
  2781. uint32 m_team;
  2782. uint32 m_nextSave;
  2783. time_t m_speakTime;
  2784. uint32 m_speakCount;
  2785. Difficulty m_dungeonDifficulty;
  2786. Difficulty m_raidDifficulty;
  2787. Difficulty m_legacyRaidDifficulty;
  2788. Difficulty m_prevMapDifficulty;
  2789.  
  2790. uint32 m_atLoginFlags;
  2791.  
  2792. Item* m_items[PLAYER_SLOTS_COUNT];
  2793. uint32 m_currentBuybackSlot;
  2794.  
  2795. PlayerCurrenciesMap _currencyStorage;
  2796.  
  2797. /**
  2798. * @name GetCurrencyWeekCap
  2799. * @brief return week cap for selected currency
  2800.  
  2801. * @param CurrencyTypesEntry for which to retrieve weekly cap
  2802. */
  2803. uint32 GetCurrencyWeekCap(CurrencyTypesEntry const* currency) const;
  2804.  
  2805. /*
  2806. * @name GetCurrencyTotalCap
  2807. * @brief return total cap for selected currency
  2808.  
  2809. * @param CurrencyTypesEntry for which to retrieve total cap
  2810. */
  2811. uint32 GetCurrencyTotalCap(CurrencyTypesEntry const* currency) const;
  2812.  
  2813. VoidStorageItem* _voidStorageItems[VOID_STORAGE_MAX_SLOT];
  2814.  
  2815. std::vector<Item*> m_itemUpdateQueue;
  2816. bool m_itemUpdateQueueBlocked;
  2817.  
  2818. uint32 m_ExtraFlags;
  2819.  
  2820. QuestStatusMap m_QuestStatus;
  2821. QuestStatusSaveMap m_QuestStatusSave;
  2822.  
  2823. RewardedQuestSet m_RewardedQuests;
  2824. QuestStatusSaveMap m_RewardedQuestsSave;
  2825.  
  2826. SkillStatusMap mSkillStatus;
  2827.  
  2828. ObjectGuid::LowType m_GuildIdInvited;
  2829.  
  2830. PlayerMails m_mail;
  2831. PlayerSpellMap m_spells;
  2832. std::unordered_map<uint32 /*overridenSpellId*/, std::unordered_set<uint32> /*newSpellId*/> m_overrideSpells;
  2833. uint32 m_lastPotionId; // last used health/mana potion in combat, that block next potion use
  2834.  
  2835. SpecializationInfo _specializationInfo;
  2836.  
  2837. ActionButtonList m_actionButtons;
  2838.  
  2839. float m_auraBaseMod[BASEMOD_END][MOD_END];
  2840. int16 m_baseRatingValue[MAX_COMBAT_RATING];
  2841. uint32 m_baseSpellPower;
  2842. uint32 m_baseManaRegen;
  2843. uint32 m_baseHealthRegen;
  2844. int32 m_spellPenetrationItemMod;
  2845.  
  2846. SpellModContainer m_spellMods[MAX_SPELLMOD][SPELLMOD_END];
  2847.  
  2848. EnchantDurationList m_enchantDuration;
  2849. ItemDurationList m_itemDuration;
  2850. GuidUnorderedSet m_itemSoulboundTradeable;
  2851.  
  2852. void ResetTimeSync();
  2853. void SendTimeSync();
  2854.  
  2855. std::unique_ptr<ResurrectionData> _resurrectionData;
  2856.  
  2857. WorldSession* m_session;
  2858.  
  2859. JoinedChannelsList m_channels;
  2860.  
  2861. uint8 m_cinematic;
  2862.  
  2863. uint32 m_movie;
  2864.  
  2865. TradeData* m_trade;
  2866.  
  2867. bool m_DailyQuestChanged;
  2868. bool m_WeeklyQuestChanged;
  2869. bool m_MonthlyQuestChanged;
  2870. bool m_SeasonalQuestChanged;
  2871. time_t m_lastDailyQuestTime;
  2872.  
  2873. uint32 m_drunkTimer;
  2874. uint32 m_weaponChangeTimer;
  2875.  
  2876. uint32 m_zoneUpdateId;
  2877. uint32 m_zoneUpdateTimer;
  2878. uint32 m_areaUpdateId;
  2879.  
  2880. uint32 m_deathTimer;
  2881. time_t m_deathExpireTime;
  2882.  
  2883. uint32 m_WeaponProficiency;
  2884. uint32 m_ArmorProficiency;
  2885. bool m_canParry;
  2886. bool m_canBlock;
  2887. bool m_canTitanGrip;
  2888. uint32 m_titanGripPenaltySpellId;
  2889. uint8 m_swingErrorMsg;
  2890.  
  2891. // Social
  2892. PlayerSocial* m_social;
  2893.  
  2894. // Groups
  2895. GroupReference m_group;
  2896. GroupReference m_originalGroup;
  2897. Group* m_groupInvite;
  2898. uint32 m_groupUpdateMask;
  2899. bool m_bPassOnGroupLoot;
  2900. std::array<GroupUpdateCounter, 2> m_groupUpdateSequences;
  2901.  
  2902. // last used pet number (for BG's)
  2903. uint32 m_lastpetnumber;
  2904.  
  2905. // Player summoning
  2906. time_t m_summon_expire;
  2907. WorldLocation m_summon_location;
  2908.  
  2909. // Recall position
  2910. WorldLocation m_recall_location;
  2911.  
  2912. DeclinedName *m_declinedname;
  2913. Runes *m_runes;
  2914. EquipmentSetContainer _equipmentSets;
  2915.  
  2916. bool CanAlwaysSee(WorldObject const* obj) const override;
  2917.  
  2918. bool IsAlwaysDetectableFor(WorldObject const* seer) const override;
  2919.  
  2920. uint8 m_grantableLevels;
  2921.  
  2922. uint8 m_fishingSteps;
  2923.  
  2924. std::array<std::unique_ptr<CUFProfile>, MAX_CUF_PROFILES> _CUFProfiles;
  2925.  
  2926. private:
  2927. // internal common parts for CanStore/StoreItem functions
  2928. InventoryResult CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const;
  2929. 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;
  2930. 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;
  2931. Item* _StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool update);
  2932. Item* _LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields);
  2933.  
  2934. CinematicMgr* _cinematicMgr;
  2935.  
  2936. GuidSet m_refundableItems;
  2937. void SendRefundInfo(Item* item);
  2938. void RefundItem(Item* item);
  2939. void SendItemRefundResult(Item* item, ItemExtendedCostEntry const* iece, uint8 error) const;
  2940.  
  2941. void AdjustQuestReqItemCount(Quest const* quest);
  2942.  
  2943. bool IsCanDelayTeleport() const { return m_bCanDelayTeleport; }
  2944. void SetCanDelayTeleport(bool setting) { m_bCanDelayTeleport = setting; }
  2945. bool IsHasDelayedTeleport() const { return m_bHasDelayedTeleport; }
  2946. void SetDelayedTeleportFlag(bool setting) { m_bHasDelayedTeleport = setting; }
  2947. void ScheduleDelayedOperation(uint32 operation) { if (operation < DELAYED_END) m_DelayedOperations |= operation; }
  2948.  
  2949. bool IsInstanceLoginGameMasterException() const;
  2950.  
  2951. MapReference m_mapRef;
  2952. SpellCooldowns m_spellCooldowns;
  2953. uint32 m_lastFallTime;
  2954. float m_lastFallZ;
  2955.  
  2956. int32 m_MirrorTimer[MAX_TIMERS];
  2957. uint8 m_MirrorTimerFlags;
  2958. uint8 m_MirrorTimerFlagsLast;
  2959. bool m_isInWater;
  2960.  
  2961. // Current teleport data
  2962. WorldLocation m_teleport_dest;
  2963. uint32 m_teleport_options;
  2964. uint32 m_teleport_option_param;
  2965. bool mSemaphoreTeleport_Near;
  2966. bool mSemaphoreTeleport_Far;
  2967.  
  2968. uint32 m_DelayedOperations;
  2969. bool m_bCanDelayTeleport;
  2970. bool m_bHasDelayedTeleport;
  2971.  
  2972. // Temporary removed pet cache
  2973. uint32 m_temporaryUnsummonedPetNumber;
  2974. uint32 m_oldpetspell;
  2975.  
  2976. PlayerAchievementMgr* m_achievementMgr;
  2977. ReputationMgr* m_reputationMgr;
  2978. std::unique_ptr<QuestObjectiveCriteriaMgr> m_questObjectiveCriteriaMgr;
  2979.  
  2980. uint32 m_ChampioningFaction;
  2981.  
  2982. std::queue<uint32> m_timeSyncQueue;
  2983. uint32 m_timeSyncTimer;
  2984. uint32 m_timeSyncClient;
  2985. uint32 m_timeSyncServer;
  2986.  
  2987. InstanceTimeMap _instanceResetTimes;
  2988. uint32 _pendingBindId;
  2989. uint32 _pendingBindTimer;
  2990.  
  2991. uint32 _lastTargetedGO;
  2992. float _PersonnalXpRate;
  2993.  
  2994. uint32 _activeCheats;
  2995.  
  2996. PlayerGarrisonMap _garrisons;
  2997. GarrisonType _insideGarrisonType;
  2998.  
  2999. bool _advancedCombatLoggingEnabled;
  3000.  
  3001. // variables to save health and mana before duel and restore them after duel
  3002. uint64 healthBeforeDuel;
  3003. uint32 manaBeforeDuel;
  3004.  
  3005. WorldLocation _corpseLocation;
  3006.  
  3007. SceneMgr m_sceneMgr;
  3008.  
  3009. std::unordered_map<ObjectGuid /*LootObject*/, ObjectGuid /*world object*/> m_AELootView;
  3010.  
  3011. void _InitHonorLevelOnLoadFromDB(uint32 /*honor*/, uint32 /*honorLevel*/, uint32 /*prestigeLevel*/);
  3012. std::unique_ptr<RestMgr> _restMgr;
  3013.  
  3014. std::vector<PlayerPetData*> PlayerPetDataStore;
  3015.  
  3016. uint32 m_shopTimer;
  3017.  
  3018. bool _usePvpItemLevels;
  3019.  
  3020. ArchaeologyPlayerMgr m_archaeologyPlayerMgr;
  3021.  
  3022. std::map<uint32, uint32> m_WorldStates;
  3023.  
  3024. typedef std::unordered_map<ObjectGuid, uint8> m_TransportVisibleStateSet;
  3025. m_TransportVisibleStateSet m_TransportVisibleState;
  3026. };
  3027.  
  3028. TC_GAME_API void AddItemsSetItem(Player* player, Item* item);
  3029. TC_GAME_API void RemoveItemsSetItem(Player* player, ItemTemplate const* proto);
  3030.  
  3031. #endif
Add Comment
Please, Sign In to add comment