OregonCore  revision 80751cf-git
Your Favourite TBC server
Player.h
Go to the documentation of this file.
1 /*
2  * This file is part of the OregonCore Project. See AUTHORS file for Copyright information
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef _PLAYER_H
19 #define _PLAYER_H
20 
21 #include "Common.h"
22 #include "ItemPrototype.h"
23 #include "Unit.h"
24 #include "Item.h"
25 
26 #include "Database/DatabaseEnv.h"
27 #include "DBCStores.h"
28 #include "NPCHandler.h"
29 #include "QuestDef.h"
30 #include "Group.h"
31 #include "Bag.h"
32 #include "WorldSession.h"
33 #include "CinematicMgr.h"
34 #include "Pet.h"
35 #include "MapReference.h"
36 #include "Utilities/Util.h" // for Tokens typedef
37 #include "ReputationMgr.h"
38 
39 #include<string>
40 #include<vector>
41 
42 struct Mail;
43 class Channel;
44 class DynamicObject;
45 class Creature;
46 class Pet;
47 class PlayerMenu;
48 class Transport;
49 class UpdateMask;
50 class PlayerSocial;
51 class OutdoorPvP;
52 
53 typedef std::deque<Mail*> PlayerMails;
54 
55 #define PLAYER_MAX_SKILLS 127
56 #define PLAYER_MAX_DAILY_QUESTS 25
57 
58 // Note: SPELLMOD_* values is aura types in fact
60 {
61  SPELLMOD_FLAT = 107, // SPELL_AURA_ADD_FLAT_MODIFIER
62  SPELLMOD_PCT = 108 // SPELL_AURA_ADD_PCT_MODIFIER
63 };
64 
65 // 2^n values, Player::m_isunderwater is a bitmask. These are internal values, they are never send to any client
67 {
69  UNDERWATER_INWATER = 0x01, // terrain type is water and player is afflicted by it
70  UNDERWATER_INLAVA = 0x02, // terrain type is lava and player is afflicted by it
71  UNDERWATER_INSLIME = 0x04, // terrain type is lava and player is afflicted by it
72  UNDERWATER_INDARKWATER = 0x08, // terrain type is dark water and player is afflicted by it
73 
75 };
76 
78 {
83 };
84 
86 {
91 };
92 
94 {
96  bool active : 1;
97  bool disabled : 1;
98 };
99 
100 // Spell modifier (used for modify other spells)
102 {
103  SpellModOp op : 8;
104  SpellModType type : 8;
105  int16 charges : 16;
111 };
112 
113 typedef UNORDERED_MAP<uint16, PlayerSpell> PlayerSpellMap;
114 typedef std::list<SpellModifier*> SpellModList;
115 
117 {
118  time_t end;
120 };
121 
122 typedef std::map<uint32, SpellCooldown> SpellCooldowns;
123 
125 {
129 };
130 
132 {
137 };
138 
140 {
141  ActionButton() : action(0), type(0), misc(0), uState(ACTIONBUTTON_NEW) {}
142  ActionButton(uint16 _action, uint8 _type, uint8 _misc) : action(_action), type(_type), misc(_misc), uState(ACTIONBUTTON_NEW) {}
143 
148 };
149 
151 {
156 };
157 
158 #define MAX_ACTION_BUTTONS 132 //checked in 2.3.0
159 
160 typedef std::map<uint8, ActionButton> ActionButtonList;
161 
162 typedef std::pair<uint16, uint8> CreateSpellPair;
163 
165 {
166  PlayerCreateInfoItem(uint32 id, uint32 amount) : item_id(id), item_amount(amount) {}
167 
170 };
171 
172 typedef std::list<PlayerCreateInfoItem> PlayerCreateInfoItems;
173 
175 {
176  PlayerClassLevelInfo() : basehealth(0), basemana(0) {}
179 };
180 
182 {
183  PlayerClassInfo() : levelInfo(NULL) { }
184 
185  PlayerClassLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1
186 };
187 
189 {
191  {
192  for (int i = 0; i < MAX_STATS; ++i) stats[i] = 0;
193  }
194 
195  uint8 stats[MAX_STATS];
196 };
197 
199 {
200  // existence checked by displayId != 0 // existence checked by displayId != 0
201  PlayerInfo() : mapId(0), areaId(0), positionX(0.0f), positionY(0.0f), positionZ(0.0f), orientation(0.0f), displayId_m(0), displayId_f(0), levelInfo(nullptr) { }
202 
205  float positionX;
206  float positionY;
207  float positionZ;
208  float orientation;
212  std::list<CreateSpellPair> spell;
213  std::list<uint16> action[4];
214 
215  PlayerLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1
216 };
217 
218 struct PvPInfo
219 {
220  PvPInfo() : inHostileArea(false), inNoPvPArea(false), inFFAPvPArea(false), endTimer(0) {}
221 
225  time_t endTimer;
226 };
227 
228 struct DuelInfo
229 {
230  DuelInfo() : initiator(NULL), opponent(NULL), startTimer(0), startTime(0), outOfBound(0) {}
231 
234  time_t startTimer;
235  time_t startTime;
236  time_t outOfBound;
237 };
238 
239 struct Areas
240 {
243  float x1;
244  float x2;
245  float y1;
246  float y2;
247 };
248 
250 {
251  EnchantDuration() : item(NULL), slot(MAX_ENCHANTMENT_SLOT), leftduration(0) {};
252  EnchantDuration(Item* _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot), leftduration(_leftduration)
253  {
254  assert(item);
255  };
256 
257  Item* item;
260 };
261 
262 typedef std::list<EnchantDuration> EnchantDurationList;
263 typedef std::list<Item*> ItemDurationList;
264 
266 {
267  LookingForGroupSlot() : entry(0), type(0) {}
268  bool Empty() const
269  {
270  return !entry && !type;
271  }
272  void Clear()
273  {
274  entry = 0;
275  type = 0;
276  }
277  void Set(uint32 _entry, uint32 _type)
278  {
279  entry = _entry;
280  type = _type;
281  }
282  bool Is(uint32 _entry, uint32 _type) const
283  {
284  return entry == _entry && type == _type;
285  }
286  bool canAutoJoin() const
287  {
288  return entry && (type == 1 || type == 5);
289  }
290 
293 };
294 
295 #define MAX_LOOKING_FOR_GROUP_SLOT 3
296 
298 {
300  bool HaveInSlot(LookingForGroupSlot const& slot) const
301  {
302  return HaveInSlot(slot.entry, slot.type);
303  }
304  bool HaveInSlot(uint32 _entry, uint32 _type) const
305  {
306  for (int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
307  if (slots[i].Is(_entry, _type))
308  return true;
309  return false;
310  }
311 
312  bool canAutoJoin() const
313  {
314  for (int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
315  if (slots[i].canAutoJoin())
316  return true;
317  return false;
318  }
319 
320  bool Empty() const
321  {
322  for (int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
323  if (!slots[i].Empty())
324  return false;
325  return more.Empty();
326  }
327 
330  std::string comment;
331 };
332 
334 {
339 };
340 
342 {
347 };
348 
350 {
352  PLAYER_FLAGS_AFK = 0x00000002,
353  PLAYER_FLAGS_DND = 0x00000004,
354  PLAYER_FLAGS_GM = 0x00000008,
355  PLAYER_FLAGS_GHOST = 0x00000010,
356  PLAYER_FLAGS_RESTING = 0x00000020,
357  PLAYER_FLAGS_FFA_PVP = 0x00000080,
358  PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards
359  PLAYER_FLAGS_IN_PVP = 0x00000200,
362  PLAYER_FLAGS_UNK1 = 0x00001000, // played long time
363  PLAYER_FLAGS_UNK2 = 0x00002000, // played too long time
364  PLAYER_FLAGS_UNK3 = 0x00008000, // strange visual effect (2.0.1), looks like PLAYER_FLAGS_GHOST flag
365  PLAYER_FLAGS_SANCTUARY = 0x00010000, // player entered sanctuary
366  PLAYER_FLAGS_TAXI_BENCHMARK = 0x00020000, // taxi benchmark mode (on/off) (2.0.1)
367  PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 2.0.8...
368 };
369 
370 // used for PLAYER__FIELD_KNOWN_TITLES field (uint64), (1<<bit_index) without (-1)
371 // can't use enum for uint64 values
372 #define PLAYER_TITLE_DISABLED UI64LIT(0x0000000000000000)
373 #define PLAYER_TITLE_NONE UI64LIT(0x0000000000000001)
374 #define PLAYER_TITLE_PRIVATE UI64LIT(0x0000000000000002) // 1
375 #define PLAYER_TITLE_CORPORAL UI64LIT(0x0000000000000004) // 2
376 #define PLAYER_TITLE_SERGEANT_A UI64LIT(0x0000000000000008) // 3
377 #define PLAYER_TITLE_MASTER_SERGEANT UI64LIT(0x0000000000000010) // 4
378 #define PLAYER_TITLE_SERGEANT_MAJOR UI64LIT(0x0000000000000020) // 5
379 #define PLAYER_TITLE_KNIGHT UI64LIT(0x0000000000000040) // 6
380 #define PLAYER_TITLE_KNIGHT_LIEUTENANT UI64LIT(0x0000000000000080) // 7
381 #define PLAYER_TITLE_KNIGHT_CAPTAIN UI64LIT(0x0000000000000100) // 8
382 #define PLAYER_TITLE_KNIGHT_CHAMPION UI64LIT(0x0000000000000200) // 9
383 #define PLAYER_TITLE_LIEUTENANT_COMMANDER UI64LIT(0x0000000000000400) // 10
384 #define PLAYER_TITLE_COMMANDER UI64LIT(0x0000000000000800) // 11
385 #define PLAYER_TITLE_MARSHAL UI64LIT(0x0000000000001000) // 12
386 #define PLAYER_TITLE_FIELD_MARSHAL UI64LIT(0x0000000000002000) // 13
387 #define PLAYER_TITLE_GRAND_MARSHAL UI64LIT(0x0000000000004000) // 14
388 #define PLAYER_TITLE_SCOUT UI64LIT(0x0000000000008000) // 15
389 #define PLAYER_TITLE_GRUNT UI64LIT(0x0000000000010000) // 16
390 #define PLAYER_TITLE_SERGEANT_H UI64LIT(0x0000000000020000) // 17
391 #define PLAYER_TITLE_SENIOR_SERGEANT UI64LIT(0x0000000000040000) // 18
392 #define PLAYER_TITLE_FIRST_SERGEANT UI64LIT(0x0000000000080000) // 19
393 #define PLAYER_TITLE_STONE_GUARD UI64LIT(0x0000000000100000) // 20
394 #define PLAYER_TITLE_BLOOD_GUARD UI64LIT(0x0000000000200000) // 21
395 #define PLAYER_TITLE_LEGIONNAIRE UI64LIT(0x0000000000400000) // 22
396 #define PLAYER_TITLE_CENTURION UI64LIT(0x0000000000800000) // 23
397 #define PLAYER_TITLE_CHAMPION UI64LIT(0x0000000001000000) // 24
398 #define PLAYER_TITLE_LIEUTENANT_GENERAL UI64LIT(0x0000000002000000) // 25
399 #define PLAYER_TITLE_GENERAL UI64LIT(0x0000000004000000) // 26
400 #define PLAYER_TITLE_WARLORD UI64LIT(0x0000000008000000) // 27
401 #define PLAYER_TITLE_HIGH_WARLORD UI64LIT(0x0000000010000000) // 28
402 #define PLAYER_TITLE_GLADIATOR UI64LIT(0x0000000020000000) // 29
403 #define PLAYER_TITLE_DUELIST UI64LIT(0x0000000040000000) // 30
404 #define PLAYER_TITLE_RIVAL UI64LIT(0x0000000080000000) // 31
405 #define PLAYER_TITLE_CHALLENGER UI64LIT(0x0000000100000000) // 32
406 #define PLAYER_TITLE_SCARAB_LORD UI64LIT(0x0000000200000000) // 33
407 #define PLAYER_TITLE_CONQUEROR UI64LIT(0x0000000400000000) // 34
408 #define PLAYER_TITLE_JUSTICAR UI64LIT(0x0000000800000000) // 35
409 #define PLAYER_TITLE_CHAMPION_OF_THE_NAARU UI64LIT(0x0000001000000000) // 36
410 #define PLAYER_TITLE_MERCILESS_GLADIATOR UI64LIT(0x0000002000000000) // 37
411 #define PLAYER_TITLE_OF_THE_SHATTERED_SUN UI64LIT(0x0000004000000000) // 38
412 #define PLAYER_TITLE_HAND_OF_ADAL UI64LIT(0x0000008000000000) // 39
413 #define PLAYER_TITLE_VENGEFUL_GLADIATOR UI64LIT(0x0000010000000000) // 40
414 
415 #define KNOWN_TITLES_SIZE 2
416 #define MAX_TITLE_INDEX (KNOWN_TITLES_SIZE*64) // 2 uint64 fields
417 
418 // used in PLAYER_FIELD_BYTES values
420 {
422  PLAYER_FIELD_BYTE_RELEASE_TIMER = 0x00000008, // Display time till auto release spirit
423  PLAYER_FIELD_BYTE_NO_RELEASE_WINDOW = 0x00000010 // Display no "release spirit" window at all
424 };
425 
426 // used in PLAYER_FIELD_BYTES2 values
428 {
432 };
433 
435 {
449 };
450 
452 {
456 };
457 #define MAX_TIMERS 3
458 #define DISABLED_MIRROR_TIMER -1
459 
460 // 2^n values
462 {
463  // gm abilities
468  PLAYER_EXTRA_GM_CHAT = 0x0020, // Show GM badge in chat messages
469 
470  // other states
471  PLAYER_EXTRA_PVP_DEATH = 0x0100 // store PvP death status until corpse creating.
472 };
473 
474 // 2^n values
476 {
482 };
483 
484 typedef std::map<uint32, QuestStatusData> QuestStatusMap;
485 
487 {
492 };
493 
494 #define MAX_QUEST_OFFSET 4
495 
497 {
501 };
502 
504 {
509 };
510 
512 {
513  SkillStatusData(uint8 _pos, SkillUpdateState _uState) : pos(_pos), uState(_uState)
514  {
515  }
518 };
519 
520 typedef UNORDERED_MAP<uint32, SkillStatusData> SkillStatusMap;
521 
522 class Quest;
523 class Spell;
524 class Item;
525 class WorldSession;
526 
528 {
529  // first slot for item stored (in any way in player m_items data)
531  // last+1 slot for item stored (in any way in player m_items data)
534 };
535 
537 {
559 };
560 
561 enum InventorySlots // 4 slots
562 {
566 };
567 
568 enum InventoryPackSlots // 16 slots
569 {
572 };
573 
574 enum BankItemSlots // 28 slots
575 {
578 };
579 
580 enum BankBagSlots // 7 slots
581 {
584 };
585 
586 enum BuyBackSlots // 12 slots
587 {
588  // stored in m_buybackitems
591 };
592 
593 enum KeyRingSlots // 32 slots
594 {
597 };
598 
600 {
601  ItemPosCount(uint16 _pos, uint8 _count) : pos(_pos), count(_count) {}
602  bool isContainedIn(std::vector<ItemPosCount> const& vec) const;
605 };
606 typedef std::vector<ItemPosCount> ItemPosCountVec;
607 
609 {
613 };
614 
616 {
618  TRANSFER_ABORT_MAX_PLAYERS = 0x0001, // Transfer Aborted: instance is full
619  TRANSFER_ABORT_NOT_FOUND = 0x0002, // Transfer Aborted: instance not found
620  TRANSFER_ABORT_TOO_MANY_INSTANCES = 0x0003, // You have entered too many instances recently.
621  TRANSFER_ABORT_ZONE_IN_COMBAT = 0x0005, // Unable to zone in while an encounter is in progress.
622  TRANSFER_ABORT_INSUF_EXPAN_LVL1 = 0x0106, // You must have TBC expansion installed to access this area.
623  TRANSFER_ABORT_DIFFICULTY1 = 0x0007, // Normal difficulty mode is not available for %s.
624  TRANSFER_ABORT_DIFFICULTY2 = 0x0107, // Heroic difficulty mode is not available for %s.
625 };
626 
628 {
629  RAID_INSTANCE_WARNING_HOURS = 1, // WARNING! %s is scheduled to reset in %d hour(s).
630  RAID_INSTANCE_WARNING_MIN = 2, // WARNING! %s is scheduled to reset in %d minute(s)!
631  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!
632  RAID_INSTANCE_WELCOME = 4 // Welcome to %s. This raid instance is scheduled to reset in %s.
633 };
634 
635 class InstanceSave;
636 
637 // PLAYER_FIELD_ARENA_TEAM_INFO_1_1 offsets
639 {
641  ARENA_TEAM_MEMBER = 1, // 0 - captain, 1 - member
647 };
648 
650 {
653  REST_FLAG_IN_FACTION_AREA = 0x4, // used with AREA_FLAG_REST_ZONE_*
654 };
655 
657 {
659  DUEL_WON = 1,
661 };
662 
664 {
670 };
671 
672 // Type of environmental damages
674 {
681  DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss
682 };
683 
685 {
687  CHAT_TAG_AFK = 0x01,
688  CHAT_TAG_DND = 0x02,
689  CHAT_TAG_GM = 0x04,
690  CHAT_TAG_COM = 0x08, // [Unused WotLK] Commentator
691  CHAT_TAG_DEV = 0x10 // [Unused WotLK]
692 };
693 
695 {
698 };
699 
700 #define MAX_PLAYED_TIME_INDEX 2
701 
702 // used at player loading query list preparing, and later result selection
704 {
712  PLAYER_LOGIN_QUERY_LOADTUTORIALS = 7, // common for all characters for some account at specific realm
726 
728 };
729 
731 {
735  DELAYED_BG_MOUNT_RESTORE = 0x08, // Flag to restore mount state after teleport from BG
736  DELAYED_BG_TAXI_RESTORE = 0x10, // Flag to restore taxi state after teleport from BG
737  DELAYED_GROUP_RESTORE = 0x20, // Flag to tell player he's in a group (client would crash if this is sent at loading screen)
739 };
740 
741 // Player summoning auto-decline time (in secs)
742 #define MAX_PLAYER_SUMMON_DELAY (2*MINUTE)
743 #define MAX_MONEY_AMOUNT (0x7FFFFFFF-1)
744 
746 {
748  bool perm;
749  /* permanent PlayerInstanceBinds are created in Raid/Heroic instances for players
750  that aren't already permanently bound when they are inside when a boss is killed
751  or when they enter an instance that the group leader is permanently bound to. */
752  InstancePlayerBind() : save(NULL), perm(false) {}
753 };
754 
756 {
764  std::string questFailedText;
767 };
768 
770 {
771  CHAR_DELETE_REMOVE = 0, // Completely remove from the database
772  CHAR_DELETE_UNLINK = 1 // The character gets unlinked from the account,
773  // the name gets freed up and appears as deleted ingame
774 };
775 
777 {
778  REST_STATE_RESTED = 1, // 200% xp
779  REST_STATE_NORMAL = 2, // 100% xp
780  REST_STATE_TIRED_1 = 3, // 100% xp
781  REST_STATE_TIRED_2 = 4, // 50% xp
782  REST_STATE_EXHAUSTED = 5, // 25% xp
783  REST_STATE_RAF_LINKED = 6 // 200% xp
784 };
785 
787 {
788  RAF_ERR_OK = 0x00,
789  RAF_ERR_BAD_REFERRER = 0x01, // You were not referred by that player
790  RAF_ERR_LVL_TOO_HIGH = 0x02, // That player's level is too high
791  RAF_ERR_NO_GRANTABLE_LVLS = 0x03, // You have not earned enough levels to grant any more levels
792  RAF_ERR_TOO_FAR_AWAY = 0x04, // That player is too far away
793  RAF_ERR_OPPOSITE_FACTION = 0x05, // No cannot grant level to a character of the opposite faction
794  RAF_ERR_NOT_RIGHT_NOW = 0x06, // You cannot grant that player a level right now
795  RAF_ERR_ONLY_UNTIL_60 = 0x07, // You cannot grant levels to players level 60 or higher
796  RAF_ERR_NO_TARGET = 0x08, // You have no target
797  RAF_ERR_NOT_IN_PARTY = 0x09, // %s is not in your party
798  RAF_ERR_ONLY_UNTIL_60_2 = 0x0A, // You cannot summon players above level 60
799  RAF_ERR_SUMMON_NOT_READY = 0x0B, // You can only summon your friend once per hour
800  RAF_ERR_BUDDY_OFFLINE = 0x0C // %s is offline and cannot be summoned
801 };
802 
804 {
808 };
809 
811 {
812  CHEAT_NONE = 0x00,
813  CHEAT_GOD = 0x01,
816  CHEAT_POWER = 0x08,
818 };
819 
821 {
822  public:
823  PlayerTaxi();
825  // Nodes
826  void InitTaxiNodesForLevel(uint32 race, uint32 level);
827  void LoadTaxiMask(const char* data);
828  void SaveTaxiMask(const char* data);
829 
830  uint32 GetTaximask(uint8 index) const
831  {
832  return m_taximask[index];
833  }
834  bool IsTaximaskNodeKnown(uint32 nodeidx) const
835  {
836  uint8 field = uint8((nodeidx - 1) / 32);
837  uint32 submask = 1 << ((nodeidx - 1) % 32);
838  return (m_taximask[field] & submask) == submask;
839  }
840  bool SetTaximaskNode(uint32 nodeidx)
841  {
842  uint8 field = uint8((nodeidx - 1) / 32);
843  uint32 submask = 1 << ((nodeidx - 1) % 32);
844  if ((m_taximask[field] & submask) != submask)
845  {
846  m_taximask[field] |= submask;
847  return true;
848  }
849  else
850  return false;
851  }
852  void AppendTaximaskTo(ByteBuffer& data, bool all);
853 
854  // Destinations
855  bool LoadTaxiDestinationsFromString(const std::string& values);
856  std::string SaveTaxiDestinationsToString();
857 
859  {
860  m_TaxiDestinations.clear();
861  }
863  {
864  m_TaxiDestinations.push_back(dest);
865  }
867  {
868  return m_TaxiDestinations.empty() ? 0 : m_TaxiDestinations.front();
869  }
871  {
872  return m_TaxiDestinations.size() < 2 ? 0 : m_TaxiDestinations[1];
873  }
874  uint32 GetCurrentTaxiPath() const;
876  {
877  m_TaxiDestinations.pop_front();
878  return GetTaxiDestination();
879  }
880 
881  bool empty() const { return m_TaxiDestinations.empty(); }
882  private:
884  std::deque<uint32> m_TaxiDestinations;
885 };
886 
887 class Player;
888 
889 // Holder for Battleground data
890 struct BGData
891 {
892  BGData() : bgInstanceID(0), bgTypeID(0), bgAfkReportedCount(0), bgAfkReportedTimer(0),
893  bgTeam(0), mountSpell(0)
894  {
895  ClearTaxiPath();
896  }
897 
898  uint32 bgInstanceID; // This variable is set to bg->m_InstanceID,
899  // when player is teleported to BG - (it is battleground's GUID)
901 
902  std::set<uint32> bgAfkReporter;
905 
906  uint32 bgTeam; // What side the player will be added to
907 
909  uint32 taxiPath[2];
910 
911  WorldLocation joinPos; // From where player entered BG
912 
914  {
915  taxiPath[0] = taxiPath[1] = 0;
916  }
917  bool HasTaxiPath() const
918  {
919  return taxiPath[0] && taxiPath[1];
920  }
921 };
922 
923 class Player : public Unit, public GridObject<Player>
924 {
925  friend class WorldSession;
926  friend class CinematicMgr;
927  friend class RegressionTestSuite;
928 
929  friend void Item::AddToUpdateQueueOf(Player* player);
930  friend void Item::RemoveFromUpdateQueueOf(Player* player);
931  public:
932  explicit Player(WorldSession* session);
933  ~Player() override;
934 
935  void CleanupsBeforeDelete() override;
936 
938  static void InitVisibleBits();
939 
940  void AddToWorld() override;
941  void RemoveFromWorld() override;
942 
943  void SetObjectScale(float scale)
944  {
945  Unit::SetObjectScale(scale);
947  SetFloatValue(UNIT_FIELD_COMBATREACH, scale * DEFAULT_COMBAT_REACH);
948  }
949 
950  bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0);
951  bool TeleportTo(WorldLocation const &loc, uint32 options = 0);
952  bool TeleportToBGEntryPoint();
953 
954  void SetSummonPoint(uint32 mapid, float x, float y, float z);
955  void SummonIfPossible(bool agree);
956 
957  bool Create(uint32 guidlow, const std::string& name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId);
958 
959  void Update(uint32 time) override;
960 
961  static bool BuildEnumData(QueryResult_AutoPtr result, WorldPacket* data);
962 
963  void SetInWater(bool apply);
964 
965  bool IsInWater() const override { return m_isInWater; }
966  bool IsUnderWater() const override;
967  bool IsFalling() { return GetPositionZ() < m_lastFallZ; }
968  bool IsInAreaTriggerRadius(const AreaTriggerEntry* trigger) const;
969 
970  void SendInitialPacketsBeforeAddToMap();
971  void SendInitialPacketsAfterAddToMap();
972  void SendTransferAborted(uint32 mapid, uint16 reason);
973  void SendInstanceResetWarning(uint32 mapid, uint32 time);
974 
975  bool CanInteractWithQuestGiver(Object* questGiver);
976  Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask);
977  GameObject* GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const;
978 
979  void ToggleAFK();
980  void ToggleDND();
981  bool isAFK() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); }
982  bool isDND() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); }
983  uint8 GetChatTag() const;
984  std::string autoReplyMsg;
985 
987  {
988  return m_social;
989  }
990 
993  {
994  m_taxi.InitTaxiNodesForLevel(getRace(), getLevel());
995  }
996  bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, uint32 mount_id = 0 , Creature* npc = NULL);
997  bool ActivateTaxiPathTo(uint32 taxi_path_id);
998  void CleanupAfterTaxiFlight();
999  void ContinueTaxiFlight();
1000  // mount_id can be used in scripting calls
1001  bool isAcceptWhispers() const
1002  {
1003  return m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS;
1004  }
1005  void SetAcceptWhispers(bool on)
1006  {
1007  if (on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS;
1008  else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS;
1009  }
1010  bool IsGameMaster() const
1011  {
1012  return m_ExtraFlags & PLAYER_EXTRA_GM_ON;
1013  }
1014  void SetGameMaster(bool on);
1015  bool isGMChat() const
1016  {
1017  return GetSession()->GetSecurity() >= SEC_MODERATOR && (m_ExtraFlags & PLAYER_EXTRA_GM_CHAT);
1018  }
1019  void SetGMChat(bool on)
1020  {
1021  if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_CHAT;
1022  else m_ExtraFlags &= ~PLAYER_EXTRA_GM_CHAT;
1023  }
1024  bool isTaxiCheater() const
1025  {
1026  return m_ExtraFlags & PLAYER_EXTRA_TAXICHEAT;
1027  }
1028  void SetTaxiCheater(bool on)
1029  {
1030  if (on) m_ExtraFlags |= PLAYER_EXTRA_TAXICHEAT;
1031  else m_ExtraFlags &= ~PLAYER_EXTRA_TAXICHEAT;
1032  }
1033  bool isGMVisible() const
1034  {
1035  return !(m_ExtraFlags & PLAYER_EXTRA_GM_INVISIBLE);
1036  }
1037  void SetGMVisible(bool on);
1038  void SetPvPDeath(bool on)
1039  {
1040  if (on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH;
1041  else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH;
1042  }
1043 
1044  void GiveXP(uint32 xp, Unit* victim, bool disableRafBonus = false);
1045  void GiveLevel(uint32 level, bool ignoreRAF = false);
1046  void InitStatsForLevel(bool reapplyMods = false);
1047 
1048  // .cheat command related
1049  bool GetCommandStatus(uint32 command) const { return _activeCheats & command; }
1050  void SetCommandStatusOn(uint32 command) { _activeCheats |= command; }
1051  void SetCommandStatusOff(uint32 command) { _activeCheats &= ~command; }
1052 
1053  // Played Time Stuff
1054  time_t m_logintime;
1055  time_t m_Last_tick;
1058  {
1059  return m_Played_time[PLAYED_TIME_TOTAL];
1060  }
1062  {
1063  return m_Played_time[PLAYED_TIME_LEVEL];
1064  }
1065 
1066  void ResetTimeSync();
1067  void SendTimeSync();
1068 
1069  void setDeathState(DeathState s) override; // overwrite Unit::setDeathState
1070 
1071  float GetRestBonus() const { return m_rest_bonus; }
1072  void SetRestBonus(float rest_bonus_new);
1073 
1074  bool HasRestFlag(RestFlag restFlag) const { return (_restFlagMask & restFlag) != 0; }
1075  void SetRestFlag(RestFlag restFlag, uint32 triggerId = 0);
1076  void RemoveRestFlag(RestFlag restFlag);
1077 
1078  uint32 GetXPRestBonus(uint32 xp);
1079  uint32 GetInnTriggerId() const { return inn_triggerId; }
1080 
1081  Pet* GetPet() const;
1082  Pet* SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 despwtime);
1083  void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false);
1084 
1085  uint32 GetPhaseMaskForSpawn() const; // used for proper set phase for DB at GM-mode creature/GO spawn
1086 
1087  void Say(const std::string& text, const uint32 language);
1088  void Yell(const std::string& text, const uint32 language);
1089  void TextEmote(const std::string& text);
1090  void Whisper(const std::string& text, const uint32 language, uint64 receiver);
1091  void Whisper(const std::string& text, const uint32 language, Player* receiver);
1092  void BuildPlayerChat(WorldPacket* data, uint8 msgtype, const std::string& text, uint32 language) const;
1093 
1094  /*********************************************************/
1095  /*** STORAGE SYSTEM ***/
1096  /*********************************************************/
1097 
1098  void SetVirtualItemSlot(uint8 i, Item* item);
1099  void SetSheath(SheathState sheathed) override; // overwrite Unit version
1100  uint8 FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const;
1101  uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = NULL) const;
1102  Item* GetItemByGuid(uint64 guid) const;
1103  Item* GetItemByPos(uint16 pos) const;
1104  Item* GetItemByPos(uint8 bag, uint8 slot) const;
1105  Item* GetWeaponForAttack(WeaponAttackType attackType, bool useable = false) const;
1106  Item* GetShield(bool useable = false) const;
1107  static uint32 GetAttackBySlot(uint8 slot); // MAX_ATTACK if not weapon slot
1108  std::vector<Item* >& GetItemUpdateQueue()
1109  {
1110  return m_itemUpdateQueue;
1111  }
1112  static bool IsInventoryPos(uint16 pos)
1113  {
1114  return IsInventoryPos(pos >> 8, pos & 255);
1115  }
1116  static bool IsInventoryPos(uint8 bag, uint8 slot);
1117  static bool IsEquipmentPos(uint16 pos)
1118  {
1119  return IsEquipmentPos(pos >> 8, pos & 255);
1120  }
1121  static bool IsEquipmentPos(uint8 bag, uint8 slot);
1122  static bool IsBagPos(uint16 pos);
1123  static bool IsBankPos(uint16 pos)
1124  {
1125  return IsBankPos(pos >> 8, pos & 255);
1126  }
1127  static bool IsBankPos(uint8 bag, uint8 slot);
1128  bool IsValidPos(uint16 pos)
1129  {
1130  return IsBankPos(pos >> 8, pos & 255);
1131  }
1132  bool IsValidPos(uint8 bag, uint8 slot);
1134  {
1135  return GetByteValue(PLAYER_BYTES_2, 2);
1136  }
1137  bool HasBankBagSlot(uint8 slot) const;
1138  bool HasItemCount(uint32 item, uint32 count, bool inBankAlso = false) const;
1139  bool HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item const* ignoreItem = NULL);
1140  bool CanCastNoReagents(SpellEntry const* spellInfo) const;
1141  Item* GetItemOrItemWithGemEquipped(uint32 item) const;
1143  {
1144  return _CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem);
1145  }
1147  {
1148  return _CanTakeMoreSimilarItems(entry, count, NULL);
1149  }
1150  uint8 CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = NULL) const
1151  {
1152  return _CanStoreItem(bag, slot, dest, item, count, NULL, false, no_space_count);
1153  }
1154  uint8 CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap = false) const
1155  {
1156  if (!pItem)
1157  return EQUIP_ERR_ITEM_NOT_FOUND;
1158  uint32 count = pItem->GetCount();
1159  return _CanStoreItem(bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL);
1160 
1161  }
1162  uint8 CanStoreItems(Item** pItem, int count) const;
1163  uint8 CanEquipNewItem(uint8 slot, uint16& dest, uint32 item, bool swap) const;
1164  uint8 CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool swap, bool not_loading = true) const;
1165  uint8 CanUnequipItems(uint32 item, uint32 count) const;
1166  uint8 CanUnequipItem(uint16 src, bool swap) const;
1167  uint8 CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap, bool not_loading = true) const;
1168  uint8 CanUseItem(Item* pItem, bool not_loading = true) const;
1169  bool HasItemTotemCategory(uint32 TotemCategory) const;
1170  bool CanUseItem(ItemTemplate const* pItem);
1171  uint8 CanUseAmmo(uint32 item) const;
1172  Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0);
1173  Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update);
1174  Item* EquipNewItem(uint16 pos, uint32 item, bool update);
1175  Item* EquipItem(uint16 pos, Item* pItem, bool update);
1176  void AutoUnequipOffhandIfNeed();
1177  bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count);
1178 
1179  uint8 _CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const;
1180  uint8 _CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const;
1181 
1182  void ApplyEquipCooldown(Item* pItem);
1183  void SetAmmo(uint32 item);
1184  void RemoveAmmo();
1185  float GetAmmoDPS() const
1186  {
1187  return m_ammoDPS;
1188  }
1189  bool CheckAmmoCompatibility(const ItemTemplate* ammo_proto) const;
1190  void QuickEquipItem(uint16 pos, Item* pItem);
1191  void VisualizeItem(uint8 slot, Item* pItem);
1192  void SetVisibleItemSlot(uint8 slot, Item* pItem);
1193  Item* BankItem(ItemPosCountVec const& dest, Item* pItem, bool update)
1194  {
1195  return StoreItem(dest, pItem, update);
1196  }
1197  Item* BankItem(uint16 pos, Item* pItem, bool update);
1198  void RemoveItem(uint8 bag, uint8 slot, bool update);
1199  void MoveItemFromInventory(uint8 bag, uint8 slot, bool update);
1200  // in trade, auction, guild bank, mail....
1201  void MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool update, bool in_characterInventoryDB = false);
1202  // in trade, guild bank, mail....
1203  void RemoveItemDependentAurasAndCasts(Item* pItem);
1204  void DestroyItem(uint8 bag, uint8 slot, bool update);
1205  void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check = false);
1206  void DestroyItemCount(Item* item, uint32& count, bool update);
1207  void DestroyConjuredItems(bool update);
1208  void DestroyZoneLimitedItem(bool update, uint32 new_zone);
1209  void SplitItem(uint16 src, uint16 dst, uint32 count);
1210  void SwapItem(uint16 src, uint16 dst);
1211  void AddItemToBuyBackSlot(Item* pItem);
1212  Item* GetItemFromBuyBackSlot(uint32 slot);
1213  void RemoveItemFromBuyBackSlot(uint32 slot, bool del);
1215  {
1217  }
1218  void SendEquipError(uint8 msg, Item* pItem, Item* pItem2);
1219  void SendBuyError(uint8 msg, Creature* pCreature, uint32 item, uint32 param);
1220  void SendSellError(uint8 msg, Creature* pCreature, uint64 guid, uint32 param);
1221  void SendReferFriendError(ReferFriendError err, const char* name = 0);
1223  {
1224  m_WeaponProficiency |= newflag;
1225  }
1227  {
1228  m_ArmorProficiency |= newflag;
1229  }
1231  {
1232  return m_WeaponProficiency;
1233  }
1235  {
1236  return m_ArmorProficiency;
1237  }
1238  bool IsInFeralForm() const
1239  {
1240  return m_form == FORM_CAT || m_form == FORM_BEAR || m_form == FORM_DIREBEAR;
1241  }
1242  bool IsUseEquippedWeapon(bool mainhand) const
1243  {
1244  // disarm applied only to mainhand weapon
1245  return !IsInFeralForm() && m_form != FORM_GHOSTWOLF && (!mainhand || !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED));
1246  }
1247  void SendNewItem(Item* item, uint32 count, bool received, bool created, bool broadcast = false);
1248  bool BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint8 bag, uint8 slot);
1249 
1250  float GetReputationPriceDiscount(Creature const* pCreature) const;
1252  {
1253  return pTrader;
1254  }
1255  void ClearTrade();
1256  void TradeCancel(bool sendback);
1257 
1258  CinematicMgr* GetCinematicMgr() const { return _cinematicMgr; }
1259 
1261  {
1262  if (slot < TRADE_SLOT_COUNT && tradeItems[slot])
1263  return GetItemByGuid(tradeItems[slot]);
1264  return NULL;
1265  }
1266 
1267  void UpdateEnchantTime(uint32 time);
1268  void UpdateItemDuration(uint32 time, bool realtimeonly = false);
1269  void AddEnchantmentDurations(Item* item);
1270  void RemoveEnchantmentDurations(Item* item);
1271  void RemoveEnchantmentDurationsReferences(Item* item);
1272  void RemoveAllEnchantments(EnchantmentSlot slot, bool arena);
1273  void AddEnchantmentDuration(Item* item, EnchantmentSlot slot, uint32 duration);
1274  void ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool apply_dur = true, bool ignore_condition = false);
1275  void ApplyEnchantment(Item* item, bool apply);
1276  void SendEnchantmentDurations();
1277  void AddItemDurations(Item* item);
1278  void RemoveItemDurations(Item* item);
1279  void SendItemDurations();
1280  void LoadCorpse();
1281  void LoadPet();
1282 
1284  {
1285  return uint32(m_GrantableLevels);
1286  }
1287  float GetGrantableLevels() const
1288  {
1289  return m_GrantableLevels;
1290  }
1291  void SetGrantableLevels(float amount)
1292  {
1293  if (uint32(m_GrantableLevels = amount) > 0)
1294  SetByteFlag(PLAYER_FIELD_BYTES, 1, 1);
1295  else
1296  RemoveByteFlag(PLAYER_FIELD_BYTES, 1, 1);
1297  }
1298  float GetReferFriendXPMultiplier() const;
1299 
1300  bool AddItem(uint32 itemId, uint32 count);
1301 
1303 
1304  /*********************************************************/
1305  /*** GOSSIP SYSTEM ***/
1306  /*********************************************************/
1307 
1308  void PrepareGossipMenu(WorldObject* source, uint32 menuId = 0, bool showQuests = false);
1309  void SendPreparedGossip(WorldObject* source);
1310  void OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 menuId);
1311 
1312 
1313  uint32 GetGossipTextId(uint32 menuId, WorldObject* source);
1314  uint32 GetGossipTextId(WorldObject* pSource);
1315  uint32 GetDefaultGossipMenuForSource(WorldObject* pSource);
1316 
1317  /*********************************************************/
1318  /*** QUEST SYSTEM ***/
1319  /*********************************************************/
1320 
1321  // Return player level when QuestLevel is dynamic (-1)
1322  uint32 GetQuestLevelForPlayer(Quest const* pQuest) const
1323  {
1324  return pQuest && (pQuest->GetQuestLevel() > 0) ? pQuest->GetQuestLevel() : getLevel();
1325  }
1326 
1327  void PrepareQuestMenu(uint64 guid);
1328  void SendPreparedQuest(uint64 guid);
1329  bool IsActiveQuest(uint32 quest_id) const;
1330  Quest const* GetNextQuest(uint64 guid, Quest const* pQuest);
1331  bool CanSeeStartQuest(Quest const* pQuest);
1332  bool CanTakeQuest(Quest const* pQuest, bool msg);
1333  bool CanAddQuest(Quest const* pQuest, bool msg);
1334  bool CanCompleteQuest(uint32 quest_id);
1335  bool CanCompleteRepeatableQuest(Quest const* pQuest);
1336  bool CanRewardQuest(Quest const* pQuest, bool msg);
1337  bool CanRewardQuest(Quest const* pQuest, uint32 reward, bool msg);
1338  void AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver);
1339  void AddQuest(Quest const* pQuest, Object* questGiver);
1340  void CompleteQuest(uint32 quest_id);
1341  void IncompleteQuest(uint32 quest_id);
1342  void AbandonQuest(uint32 questId);
1343  void RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver, bool announce = true);
1344 
1345  void FailQuest(uint32 questId);
1346  bool SatisfyQuestSkill(Quest const* qInfo, bool msg) const;
1347  bool SatisfyQuestLevel(Quest const* qInfo, bool msg);
1348  bool SatisfyQuestLog(bool msg);
1349  bool SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg);
1350  bool SatisfyQuestClass(Quest const* qInfo, bool msg) const;
1351  bool SatisfyQuestRace(Quest const* qInfo, bool msg);
1352  bool SatisfyQuestReputation(Quest const* qInfo, bool msg);
1353  bool SatisfyQuestStatus(Quest const* qInfo, bool msg);
1354  bool SatisfyQuestConditions(Quest const* qInfo, bool msg);
1355  bool SatisfyQuestTimed(Quest const* qInfo, bool msg);
1356  bool SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg);
1357  bool SatisfyQuestNextChain(Quest const* qInfo, bool msg);
1358  bool SatisfyQuestPrevChain(Quest const* qInfo, bool msg);
1359  bool SatisfyQuestDay(Quest const* qInfo, bool msg);
1360  bool GiveQuestSourceItem(Quest const* pQuest);
1361  bool TakeQuestSourceItem(uint32 quest_id, bool msg);
1362  bool GetQuestRewardStatus(uint32 quest_id) const;
1363  QuestStatus GetQuestStatus(uint32 quest_id) const;
1364  void SetQuestStatus(uint32 quest_id, QuestStatus status);
1365 
1366  void SetDailyQuestStatus(uint32 quest_id);
1367  void ResetDailyQuestStatus();
1368 
1369  uint16 FindQuestSlot(uint32 quest_id) const;
1371  {
1372  return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_ID_OFFSET);
1373  }
1375  {
1376  return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_STATE_OFFSET);
1377  }
1379  {
1380  return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET);
1381  }
1382  uint8 GetQuestSlotCounter(uint16 slot, uint8 counter) const
1383  {
1384  return GetByteValue(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET, counter);
1385  }
1387  {
1388  return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_TIME_OFFSET);
1389  }
1390  void SetQuestSlot(uint16 slot, uint32 quest_id, uint32 timer = 0)
1391  {
1392  SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_ID_OFFSET, quest_id);
1393  SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_STATE_OFFSET, 0);
1394  SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET, 0);
1395  SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_TIME_OFFSET, timer);
1396  }
1397  void SetQuestSlotCounter(uint16 slot, uint8 counter, uint8 count)
1398  {
1399  SetByteValue(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET, counter, count);
1400  }
1402  {
1403  SetFlag(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_STATE_OFFSET, state);
1404  }
1406  {
1407  RemoveFlag(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_STATE_OFFSET, state);
1408  }
1409  void SetQuestSlotTimer(uint16 slot, uint32 timer)
1410  {
1411  SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_TIME_OFFSET, timer);
1412  }
1413  void SwapQuestSlot(uint16 slot1, uint16 slot2)
1414  {
1415  for (int i = 0; i < MAX_QUEST_OFFSET; ++i)
1416  {
1417  uint32 temp1 = GetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET * slot1 + i);
1418  uint32 temp2 = GetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET * slot2 + i);
1419 
1420  SetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET * slot1 + i, temp2);
1421  SetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET * slot2 + i, temp1);
1422  }
1423  }
1424  uint32 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry);
1425  void AdjustQuestReqItemCount(Quest const* pQuest);
1426  void AreaExploredOrEventHappens(uint32 questId);
1427  void GroupEventHappens(uint32 questId, WorldObject const* pEventObject);
1428  void ItemAddedQuestCheck(uint32 entry, uint32 count);
1429  void ItemRemovedQuestCheck(uint32 entry, uint32 count);
1430  void KilledMonster(CreatureInfo const* cInfo, uint64 guid);
1431  void KilledMonsterCredit(uint32 entry, uint64 guid = 0);
1432  void CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id);
1433  void TalkedToCreature(uint32 entry, uint64 guid);
1434  void MoneyChanged(uint32 value);
1435  bool HasQuestForItem(uint32 itemid) const;
1436  bool HasQuestForGO(int32 GOId);
1437  void UpdateForQuestsGO();
1438  bool CanShareQuest(uint32 quest_id) const;
1439 
1440  void SendQuestComplete(uint32 quest_id);
1441  void SendQuestReward(Quest const* pQuest, uint32 XP, Object* questGiver);
1442  void SendQuestFailed(uint32 quest_id);
1443  void SendQuestTimerFailed(uint32 quest_id);
1444  void SendCanTakeQuestResponse(uint32 msg) const;
1445  void SendQuestConfirmAccept(Quest const* pQuest, Player* pReceiver);
1446  void SendPushToPartyResponse(Player* pPlayer, uint32 msg);
1447  void SendQuestUpdateAddItem(Quest const* pQuest, uint32 item_idx, uint32 count);
1448  void SendQuestUpdateAddCreatureOrGo(Quest const* pQuest, uint64 guid, uint32 creatureOrGO_idx, uint32 old_count, uint32 add_count);
1449 
1450  uint32 GetSharedQuestID() const { return m_sharedQuestId; }
1451  ObjectGuid GetPlayerSharingQuest() const { return m_playerSharingQuest; }
1452  void SetQuestSharingInfo(ObjectGuid guid, uint32 id) { m_playerSharingQuest = guid; m_sharedQuestId = id; }
1453  void ClearQuestSharingInfo() { m_playerSharingQuest = 0; m_sharedQuestId = 0; }
1454 
1455  uint32 GetInGameTime() const { return m_ingametime; }
1456  void SetInGameTime(uint32 time) { m_ingametime = time; }
1457 
1458  void AddTimedQuest(uint32 questId) { m_timedquests.insert(questId); }
1459  void RemoveTimedQuest(uint32 questId) { m_timedquests.erase(questId); }
1460 
1461  /*********************************************************/
1462  /*** LOAD SYSTEM ***/
1463  /*********************************************************/
1464 
1465  bool LoadFromDB(uint32 guid, SqlQueryHolder* holder);
1466  void Initialize(uint32 guid);
1467  static bool LoadValuesArrayFromDB(Tokens& data, uint64 guid);
1468  static uint32 GetUInt32ValueFromArray(Tokens const& data, uint16 index);
1469  static float GetFloatValueFromArray(Tokens const& data, uint16 index);
1470  static uint32 GetUInt32ValueFromDB(uint16 index, uint64 guid);
1471  static uint32 GetZoneIdFromDB(uint64 guid);
1472  static uint32 GetLevelFromDB(uint64 guid);
1473  static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, uint64 guid);
1474 
1475  /*********************************************************/
1476  /*** SAVE SYSTEM ***/
1477  /*********************************************************/
1478 
1479  void SaveToDB();
1480  void SaveInventoryAndGoldToDB(); // fast save function for item/money cheating preventing
1481  void SaveGoldToDB();
1482  void SaveDataFieldToDB();
1483  static bool SaveValuesArrayInDB(Tokens const& data, uint64 guid);
1484  static void SetUInt32ValueInArray(Tokens& data, uint16 index, uint32 value);
1485  static void SetFloatValueInArray(Tokens& data, uint16 index, float value);
1486  static void SetUInt32ValueInDB(uint16 index, uint32 value, uint64 guid);
1487  static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, uint64 guid);
1488 
1489  static void DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmChars = true, bool deleteFinally = false);
1490  static void DeleteOldCharacters();
1491  static void DeleteOldCharacters(uint32 keepDays);
1492 
1495 
1496  void SetBindPoint(uint64 guid);
1497  void SendTalentWipeConfirm(uint64 guid);
1498  void RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker);
1499  void SendPetSkillWipeConfirm();
1500  void CalcRage(uint32 damage, bool attacker);
1501  void RegenerateAll();
1502  void Regenerate(Powers power);
1503  void RegenerateHealth();
1505  {
1506  m_regenTimer = time;
1507  }
1509  {
1510  m_weaponChangeTimer = time;
1511  }
1512 
1514  {
1515  return GetUInt32Value (PLAYER_FIELD_COINAGE);
1516  }
1518  {
1519  if (d < 0)
1520  SetMoney (GetMoney() > uint32(-d) ? GetMoney() + d : 0);
1521  else
1522  SetMoney (GetMoney() < uint32(MAX_MONEY_AMOUNT - d) ? GetMoney() + d : MAX_MONEY_AMOUNT);
1523 
1524  // "At Gold Limit"
1525  if (GetMoney() >= MAX_MONEY_AMOUNT)
1526  SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
1527  }
1528  void SetMoney(uint32 value)
1529  {
1530  SetUInt32Value (PLAYER_FIELD_COINAGE, value);
1531  MoneyChanged(value);
1532  }
1533 
1535  {
1536  ASSERT((intId < 8));
1537  return m_Tutorials[intId];
1538  }
1539 
1540  void SetTutorialInt(uint32 intId, uint32 value)
1541  {
1542  ASSERT((intId < 8));
1543  if (m_Tutorials[intId] != value)
1544  {
1545  m_Tutorials[intId] = value;
1546  m_TutorialsChanged = true;
1547  }
1548  }
1549 
1551  {
1552  return mQuestStatus;
1553  };
1554  Unit *GetSelectedUnit() const;
1555  Player *GetSelectedPlayer() const;
1556  const uint64& GetSelection() const
1557  {
1558  return m_curSelection;
1559  }
1560  void SetSelection(const uint64& guid)
1561  {
1562  m_curSelection = guid;
1563  SetUInt64Value(UNIT_FIELD_TARGET, guid);
1564  }
1565 
1567  {
1568  return m_comboPoints;
1569  }
1571  {
1572  return m_comboTarget;
1573  }
1574 
1575  void AddComboPoints(Unit* target, int8 count);
1576  void ClearComboPoints();
1577  void SendComboPoints();
1578 
1579  void SendMailResult(uint32 mailId, MailResponseType mailAction, MailResponseResult mailError, uint32 equipError = 0, uint32 item_guid = 0, uint32 item_count = 0);
1580  void SendNewMail();
1581  void UpdateNextMailTimeAndUnreads();
1582  void AddNewMailDeliverTime(time_t deliver_time);
1583  bool IsMailsLoaded() const
1584  {
1585  return m_mailsLoaded;
1586  }
1587 
1588  //void SetMail(Mail *m);
1589  void RemoveMail(uint32 id);
1590 
1591  void AddMail(Mail* mail)
1592  {
1593  m_mail.push_front(mail); // for call from WorldSession::SendMailTo
1594  }
1596  {
1597  return m_mail.size();
1598  }
1599  Mail* GetMail(uint32 id);
1600 
1601  PlayerMails::iterator GetmailBegin()
1602  {
1603  return m_mail.begin();
1604  };
1605  PlayerMails::iterator GetmailEnd()
1606  {
1607  return m_mail.end();
1608  };
1609 
1610  /*********************************************************/
1611  /*** MAILED ITEMS SYSTEM ***/
1612  /*********************************************************/
1613 
1616 
1617  typedef UNORDERED_MAP<uint32, Item*> ItemMap;
1618 
1619  ItemMap mMitems; //template defined in objectmgr.cpp
1620 
1622  {
1623  ItemMap::const_iterator itr = mMitems.find(id);
1624  return itr != mMitems.end() ? itr->second : NULL;
1625  }
1626 
1627  void AddMItem(Item* it)
1628  {
1629  ASSERT(it);
1630  //assert deleted, because items can be added before loading
1631  mMitems[it->GetGUIDLow()] = it;
1632  }
1633 
1635  {
1636  return mMitems.erase(id) ? true : false;
1637  }
1638 
1639  void PetSpellInitialize();
1640  void CharmSpellInitialize();
1641  void PossessSpellInitialize();
1642  void SendRemoveControlBar();
1643  bool HasSpell(uint32 spell) const override;
1644  bool HasActiveSpell(uint32 spell) const; // shown in spellbook
1645  TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const;
1646  bool IsSpellFitByClassAndRace(uint32 spell_id) const;
1647 
1648  void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask);
1649  void SendInitialSpells();
1650  bool AddSpell(uint32 spell_id, bool active, bool learning = true, bool loading = false, bool disabled = false);
1651  void LearnSpell(uint32 spell_id);
1652  void RemoveSpell(uint32 spell_id, bool disabled = false);
1653  void ResetSpells();
1654  void LearnDefaultSpells(bool loading = false);
1655  void LearnQuestRewardedSpells();
1656  void LearnQuestRewardedSpells(Quest const* quest);
1657  void LearnSpellHighestRank(uint32 spellid);
1658  uint32 GetHighestLearnedRankOf(uint32 spellid) const override;
1659 
1661  {
1662  return GetUInt32Value(PLAYER_CHARACTER_POINTS1);
1663  }
1665  {
1666  SetUInt32Value(PLAYER_CHARACTER_POINTS1, points);
1667  }
1668  bool ResetTalents(bool no_cost = false);
1669  uint32 ResetTalentsCost() const;
1670  void InitTalentForLevel();
1671 
1673  {
1674  return GetUInt32Value(PLAYER_CHARACTER_POINTS2);
1675  }
1677  {
1678  SetUInt32Value(PLAYER_CHARACTER_POINTS2, profs);
1679  }
1680  void InitPrimaryProfessions();
1681 
1683  {
1684  return m_spells;
1685  }
1687  {
1688  return m_spells;
1689  }
1690 
1691  void AddSpellMod(SpellModifier* mod, bool apply);
1692  int32 GetTotalFlatMods(uint32 spellId, SpellModOp op);
1693  int32 GetTotalPctMods(uint32 spellId, SpellModOp op);
1694  bool IsAffectedBySpellmod(SpellEntry const* spellInfo, SpellModifier* mod, Spell const* spell = NULL);
1695  template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell const* spell = NULL);
1696  void RemoveSpellMods(Spell const* spell);
1697  void RestoreSpellMods(Spell const* spell);
1698 
1699  bool HasSpellCooldown(uint32 spell_id) const
1700  {
1701  SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
1702  return itr != m_spellCooldowns.end() && itr->second.end > time(NULL);
1703  }
1705  {
1706  SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
1707  time_t t = time(NULL);
1708  return itr != m_spellCooldowns.end() && itr->second.end > t ? itr->second.end - t : 0;
1709  }
1710  void AddSpellCooldown(uint32 spell_id, uint32 itemid, time_t end_time);
1711  void SendCooldownEvent(SpellEntry const* spellInfo);
1712  void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) override;
1713  void RemoveSpellCooldown(uint32 spell_id, bool update = false);
1714  void SendClearCooldown(uint32 spell_id, Unit* target);
1715  void RemoveArenaSpellCooldowns();
1716  void RemoveAllSpellCooldown();
1717  void _LoadSpellCooldowns(QueryResult_AutoPtr result);
1718  void _SaveSpellCooldowns();
1719 
1720  // global cooldown
1721  void AddGlobalCooldown(SpellEntry const* spellInfo, Spell* spell);
1722  bool HasGlobalCooldown(SpellEntry const* spellInfo) const;
1723  void RemoveGlobalCooldown(SpellEntry const* spellInfo);
1724 
1725  void setResurrectRequestData(uint64 guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana)
1726  {
1727  m_resurrectGUID = guid;
1728  m_resurrectMap = mapId;
1729  m_resurrectX = X;
1730  m_resurrectY = Y;
1731  m_resurrectZ = Z;
1732  m_resurrectHealth = health;
1733  m_resurrectMana = mana;
1734  }
1736  {
1737  setResurrectRequestData(0, 0, 0.0f, 0.0f, 0.0f, 0, 0);
1738  }
1740  {
1741  return m_resurrectGUID == guid;
1742  }
1744  {
1745  return m_resurrectGUID != 0;
1746  }
1747  void ResurectUsingRequestData();
1748 
1750  {
1751  return m_cinematic;
1752  }
1753  void setCinematic(int cine)
1754  {
1755  m_cinematic = cine;
1756  }
1757 
1758  void addActionButton(uint8 button, uint16 action, uint8 type, uint8 misc);
1759  void removeActionButton(uint8 button);
1760  void SendInitialActionButtons();
1761 
1763  void UpdatePvPState(bool onlyFFA = false);
1764  void SetPvP(bool state)
1765  {
1766  Unit::SetPvP(state);
1767  for (ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
1768  (*itr)->SetPvP(state);
1769  }
1770  void UpdatePvP(bool state, bool override = false);
1771  bool IsFFAPvP() const
1772  {
1773  return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP);
1774  }
1775  void SetFFAPvP(bool state);
1776 
1777  void UpdateZone(uint32 newZone);
1778  void UpdateArea(uint32 newArea);
1779 
1780  void UpdateZoneDependentAuras(uint32 zone_id); // zones
1781  void UpdateAreaDependentAuras(uint32 area_id); // subzones
1782 
1783  void UpdateAfkReport(time_t currTime);
1784  void UpdatePvPFlag(time_t currTime);
1785  void UpdateContestedPvP(uint32 currTime);
1787  {
1788  m_contestedPvPTimer = newTime;
1789  }
1791  {
1792  ClearUnitState(UNIT_STATE_ATTACK_PLAYER);
1794  m_contestedPvPTimer = 0;
1795  }
1796 
1799  void UpdateDuelFlag(time_t currTime);
1800  void CheckDuelDistance(time_t currTime);
1801  void DuelComplete(DuelCompleteType type);
1802 
1803  bool IsGroupVisibleFor(Player const* p) const;
1804  bool IsInSameGroupWith(Player const* p) const;
1805  bool IsInSameRaidWith(Player const* p) const
1806  {
1807  return p == this || (GetGroup() != NULL && GetGroup() == p->GetGroup());
1808  }
1809  void UninviteFromGroup();
1810  static void RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0 , const char* reason = NULL);
1811  void RemoveFromGroup(RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT) { RemoveFromGroup(GetGroup(),GetGUID(), method); }
1812  void SendUpdateToOutOfRangeGroupMembers();
1813 
1814  void SetInGuild(uint32 GuildId)
1815  {
1816  SetUInt32Value(PLAYER_GUILDID, GuildId);
1817  }
1818  void SetRank(uint32 rankId)
1819  {
1820  SetUInt32Value(PLAYER_GUILDRANK, rankId);
1821  }
1823  {
1824  m_GuildIdInvited = GuildId;
1825  }
1827  {
1828  return GetUInt32Value(PLAYER_GUILDID);
1829  }
1830  static uint32 GetGuildIdFromDB(uint64 guid);
1832  {
1833  return GetUInt32Value(PLAYER_GUILDRANK);
1834  }
1835  static uint32 GetRankFromDB(uint64 guid);
1837  {
1838  return m_GuildIdInvited;
1839  }
1840  static void RemovePetitionsAndSigns(uint64 guid, uint32 type);
1841 
1842  // Arena Team
1843  void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot)
1844  {
1845  SetArenaTeamInfoField(slot, ARENA_TEAM_ID, ArenaTeamId);
1846  }
1848  {
1849  SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + type, value);
1850  }
1852  {
1853  return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID);
1854  }
1856  {
1858  }
1859  static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot);
1860  void SetArenaTeamIdInvited(uint32 ArenaTeamId)
1861  {
1862  m_ArenaTeamIdInvited = ArenaTeamId;
1863  }
1865  {
1866  return m_ArenaTeamIdInvited;
1867  }
1868 
1869  void SetDifficulty(DungeonDifficulty dungeon_difficulty)
1870  {
1871  m_dungeonDifficulty = dungeon_difficulty;
1872  }
1874  {
1875  return m_dungeonDifficulty;
1876  }
1877 
1878  bool UpdateSkill(uint32 skill_id, uint32 step);
1879  bool UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step);
1880 
1881  bool UpdateCraftSkill(uint32 spellid);
1882  bool UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLevel, uint32 Multiplicator = 1);
1883  bool UpdateFishingSkill();
1884 
1886  {
1887  return GetBaseSkillValue(SKILL_DEFENSE);
1888  }
1889  uint32 GetBaseWeaponSkillValue(WeaponAttackType attType) const;
1890 
1891  uint32 GetSpellByProto(ItemTemplate* proto);
1892 
1893  float GetHealthBonusFromStamina();
1894  float GetManaBonusFromIntellect();
1895 
1896  bool UpdateStats(Stats stat) override;
1897  bool UpdateAllStats() override;
1898  void UpdateResistances(uint32 school) override;
1899  void UpdateArmor() override;
1900  void UpdateMaxHealth() override;
1901  void UpdateMaxPower(Powers power) override;
1902  void UpdateAttackPowerAndDamage(bool ranged = false) override;
1903  void UpdateShieldBlockValue();
1904  void UpdateSpellDamageAndHealingBonus();
1905 
1906  void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage) override;
1907 
1908  void UpdateDefenseBonusesMod();
1909  void ApplyRatingMod(CombatRating cr, int32 value, bool apply);
1910  float GetMeleeCritFromAgility();
1911  float GetDodgeFromAgility();
1912  float GetSpellCritFromIntellect();
1913  float OCTRegenHPPerSpirit();
1914  float OCTRegenMPPerSpirit();
1915  float GetRatingMultiplier(CombatRating cr) const;
1916  float GetRatingBonusValue(CombatRating cr) const;
1917  uint32 GetMeleeCritDamageReduction(uint32 damage) const;
1918  uint32 GetRangedCritDamageReduction(uint32 damage) const;
1919  uint32 GetSpellCritDamageReduction(uint32 damage) const;
1920  uint32 GetDotDamageReduction(uint32 damage) const;
1921 
1922  float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const;
1923  void UpdateBlockPercentage();
1924  void UpdateCritPercentage(WeaponAttackType attType);
1925  void UpdateAllCritPercentages();
1926  void UpdateParryPercentage();
1927  void UpdateDodgePercentage();
1928  void UpdateMeleeHitChances();
1929  void UpdateRangedHitChances();
1930  void UpdateSpellHitChances();
1931  void UpdateAllSpellCritChances();
1932  void UpdateSpellCritChance(uint32 school);
1933  void UpdateExpertise(WeaponAttackType attType);
1934  void UpdateManaRegen();
1935 
1936  const uint64& GetLootGUID() const
1937  {
1938  return m_lootGuid;
1939  }
1940  void SetLootGUID(const uint64& guid)
1941  {
1942  m_lootGuid = guid;
1943  }
1944 
1945  void RemovedInsignia(Player* looterPlr);
1946 
1948  {
1949  return m_session;
1950  }
1952  {
1953  m_session = s;
1954  }
1955 
1956  void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const override;
1957  void DestroyForPlayer(Player* target, bool onDeath = false) const override;
1958  void SendDelayResponse(const uint32);
1959  void SendLogXPGain(uint32 GivenXP, Unit* victim, uint32 RestXP, bool RafBonus = false);
1960 
1961  uint8 LastSwingErrorMsg() const { return m_swingErrorMsg; }
1962  void SwingErrorMsg(uint8 val) { m_swingErrorMsg = val; }
1963 
1964  //notifiers
1965  void SendAttackSwingCantAttack();
1966  void SendAttackSwingCancelAttack();
1967  void SendAttackSwingDeadTarget();
1968  void SendAttackSwingNotStanding();
1969  void SendAttackSwingNotInRange();
1970  void SendAttackSwingBadFacingAttack();
1971  void SendAutoRepeatCancel();
1972  void SendExplorationExperience(uint32 Area, uint32 Experience);
1973 
1974  void SendDungeonDifficulty(bool IsInGroup);
1975  void ResetInstances(uint8 method);
1976  void SendResetInstanceSuccess(uint32 MapId);
1977  void SendResetInstanceFailed(uint32 reason, uint32 MapId);
1978  void SendResetFailedNotify(uint32 mapid);
1979 
1980  bool SetPosition(float x, float y, float z, float orientation, bool teleport = false) override;
1981  bool SetPosition(const Position& pos, bool teleport = false)
1982  {
1983  return SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport);
1984  }
1985 
1986  void UpdateUnderwaterState(Map* m, float x, float y, float z);
1987  void SendMessageToSet(WorldPacket *data, bool self) override {SendMessageToSetInRange(data, GetVisibilityRange(), self); };// overwrite Object::SendMessageToSet
1988  void SendMessageToSetInRange(WorldPacket* data, float fist, bool self) override;// overwrite Object::SendMessageToSetInRange
1989  void SendMessageToSetInRange(WorldPacket* data, float dist, bool self, bool own_team_only);
1990 
1991  Corpse* GetCorpse() const;
1992  void SpawnCorpseBones();
1993  void CreateCorpse();
1994  void KillPlayer();
1995  uint32 GetResurrectionSpellId();
1996  void ResurrectPlayer(float restore_percent, bool applySickness = false);
1997  void BuildPlayerRepop();
1998  void RepopAtGraveyard();
1999 
2000  void DurabilityLossAll(double percent, bool inventory);
2001  void DurabilityLoss(Item* item, double percent);
2002  void DurabilityPointsLossAll(int32 points, bool inventory);
2003  void DurabilityPointsLoss(Item* item, int32 points);
2004  void DurabilityPointLossForEquipSlot(EquipmentSlots slot);
2005  uint32 DurabilityRepairAll(bool cost, float discountMod, bool guildBank);
2006  uint32 DurabilityRepair(uint16 pos, bool cost, float discountMod, bool guildBank);
2007 
2008  void UpdateMirrorTimers();
2010  {
2011  StopMirrorTimer(FATIGUE_TIMER);
2012  StopMirrorTimer(BREATH_TIMER);
2013  StopMirrorTimer(FIRE_TIMER);
2014  }
2015 
2016  void JoinedChannel(Channel* c);
2017  void LeftChannel(Channel* c);
2018  void CleanupChannels();
2019  void UpdateLocalChannels(uint32 newZone);
2020  void LeaveLFGChannel();
2021 
2022  void UpdateDefense();
2023  void UpdateWeaponSkill (WeaponAttackType attType);
2024  void UpdateCombatSkills(Unit* victim, WeaponAttackType attType, MeleeHitOutcome outcome, bool defence);
2025 
2026  void SetSkill(uint32 id, uint16 currVal, uint16 maxVal);
2027  uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus
2028  uint16 GetPureMaxSkillValue(uint32 skill) const; // max
2029  uint16 GetSkillValue(uint32 skill) const; // skill value + perm. bonus + temp bonus
2030  uint16 GetBaseSkillValue(uint32 skill) const; // skill value + perm. bonus
2031  uint16 GetPureSkillValue(uint32 skill) const; // skill value
2032  int16 GetSkillTempBonusValue(uint32 skill) const;
2033  bool HasSkill(uint32 skill) const;
2034  void LearnSkillRewardedSpells(uint32 id);
2035  void LearnSkillRewardedSpells();
2036 
2038  {
2039  return m_teleport_dest;
2040  }
2041  bool IsBeingTeleported() const
2042  {
2043  return mSemaphoreTeleport_Near || mSemaphoreTeleport_Far;
2044  }
2046  {
2047  return mSemaphoreTeleport_Near;
2048  }
2050  {
2051  return mSemaphoreTeleport_Far;
2052  }
2053  void SetSemaphoreTeleportNear(bool semphsetting)
2054  {
2055  mSemaphoreTeleport_Near = semphsetting;
2056  }
2057  void SetSemaphoreTeleportFar(bool semphsetting)
2058  {
2059  mSemaphoreTeleport_Far = semphsetting;
2060  }
2061  void ProcessDelayedOperations();
2062 
2063  void CheckAreaExploreAndOutdoor(void);
2064 
2065  static uint32 TeamForRace(uint8 race);
2066  uint32 GetTeam() const
2067  {
2068  return m_team;
2069  }
2071  {
2072  return m_team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE;
2073  }
2074  static uint32 getFactionForRace(uint8 race);
2075  void setFactionForRace(uint8 race);
2076 
2077  bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const;
2078  void RewardPlayerAndGroupAtKill(Unit* victim);
2079  void RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource);
2080  bool isHonorOrXPTarget(Unit* victim) const;
2081 
2082  ReputationMgr& GetReputationMgr() { return m_reputationMgr; }
2083  ReputationMgr const& GetReputationMgr() const { return m_reputationMgr; }
2084  ReputationRank GetReputationRank(uint32 faction_id) const;
2085  void RewardReputation(Unit* victim, float rate);
2086  void RewardReputation(Quest const* pQuest);
2087 
2088  int32 CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, bool for_quest);
2089 
2090  void UpdateSkillsForLevel();
2091  void UpdateSkillsToMaxSkillsForLevel(); // for .levelup
2092  void ModifySkillBonus(uint32 skillid, int32 val, bool talent);
2093 
2094  /*********************************************************/
2095  /*** PVP SYSTEM ***/
2096  /*********************************************************/
2097  void UpdateHonorFields();
2098  bool RewardHonor(Unit* victim, uint32 groupsize, float honor = -1, bool pvptoken = false);
2100  {
2101  return GetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY);
2102  }
2104  {
2105  return GetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY);
2106  }
2107  void ModifyHonorPoints(int32 value);
2108  void ModifyArenaPoints(int32 value, bool update = true);
2109  uint8 GetHighestPvPRankIndex();
2110  uint32 GetMaxPersonalArenaRatingRequirement();
2111 
2112  //End of PvP System
2113 
2114  void SetDrunkValue(uint16 newDrunkValue, uint32 itemid = 0);
2116  {
2117  return m_drunk;
2118  }
2119  static DrunkenState GetDrunkenstateByValue(uint16 value);
2120 
2122  {
2123  return m_deathTimer;
2124  }
2125  uint32 GetCorpseReclaimDelay(bool pvp) const;
2126  void UpdateCorpseReclaimDelay();
2127  int32 CalculateCorpseReclaimDelay(bool load = false);
2128  void SendCorpseReclaimDelay(uint32 delay);
2129 
2130  uint32 GetShieldBlockValue() const override; // overwrite Unit version (virtual)
2131  bool CanParry() const
2132  {
2133  return m_canParry;
2134  }
2135  void SetCanParry(bool value);
2136  bool CanBlock() const
2137  {
2138  return m_canBlock;
2139  }
2140  void SetCanBlock(bool value);
2141 
2142  void SetRegularAttackTime();
2143  void SetBaseModValue(BaseModGroup modGroup, BaseModType modType, float value)
2144  {
2145  m_auraBaseMod[modGroup][modType] = value;
2146  }
2147  void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply);
2148  float GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const;
2149  float GetTotalBaseModValue(BaseModGroup modGroup) const;
2151  {
2152  return m_auraBaseMod[modGroup][FLAT_MOD] + m_auraBaseMod[modGroup][PCT_MOD];
2153  }
2154  void _ApplyAllStatBonuses();
2155  void _RemoveAllStatBonuses();
2156 
2157  void ResetAllPowers();
2158 
2159  void _ApplyWeaponDependentAuraMods(Item* item, WeaponAttackType attackType, bool apply);
2160  void _ApplyWeaponDependentAuraCritMod(Item* item, WeaponAttackType attackType, Aura* aura, bool apply);
2161  void _ApplyWeaponDependentAuraDamageMod(Item* item, WeaponAttackType attackType, Aura* aura, bool apply);
2162 
2163  void _ApplyItemMods(Item* item, uint8 slot, bool apply);
2164  void _RemoveAllItemMods();
2165  void _ApplyAllItemMods();
2166  void _ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply);
2167  void _ApplyAmmoBonuses();
2168  bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot);
2169  void ToggleMetaGemsActive(uint8 exceptslot, bool apply);
2170  void CorrectMetaGemEnchants(uint8 slot, bool apply);
2171  void InitDataForForm(bool reapplyMods = false);
2172 
2173  void ApplyItemEquipSpell(Item* item, bool apply, bool form_change = false);
2174  void ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply, bool form_change = false);
2175  void UpdateEquipSpellsAtFormChange();
2176  void CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, SpellEntry const* spellInfo = NULL);
2177  void CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item* item, ItemTemplate const* proto, SpellEntry const* spell = NULL);
2178 
2179  void SendInitWorldStates(bool force = false, uint32 forceZoneId = 0);
2180  void SendUpdateWorldState(uint32 Field, uint32 Value);
2181  void SendDirectMessage(WorldPacket* data);
2182 
2183  void SendAuraDurationsForTarget(Unit* target);
2184 
2186  std::vector<ItemSetEffect*> ItemSetEff;
2187 
2188  void SendLoot(uint64 guid, LootType loot_type);
2189  void SendLootError(uint64 guid, LootError error);
2190  void SendLootRelease(uint64 guid);
2191  void SendNotifyLootItemRemoved(uint8 lootSlot);
2192  void SendNotifyLootMoneyRemoved();
2193 
2194  /*********************************************************/
2195  /*** BATTLEGROUND SYSTEM ***/
2196  /*********************************************************/
2197 
2198  bool InBattleground() const
2199  {
2200  return m_bgData.bgInstanceID != 0;
2201  }
2202  bool InArena() const;
2204  {
2205  return m_bgData.bgInstanceID;
2206  }
2207  Battleground* GetBattleground() const;
2208 
2209  static uint32 GetMinLevelForBattlegroundQueueId(uint32 queue_id);
2210  static uint32 GetMaxLevelForBattlegroundQueueId(uint32 queue_id);
2211  uint32 GetBattlegroundQueueIdFromLevel() const;
2212 
2213  bool InBattlegroundQueue() const
2214  {
2215  for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
2216  if (m_bgBattlegroundQueueID[i].bgQueueType != 0)
2217  return true;
2218  return false;
2219  }
2220 
2222  {
2223  return m_bgBattlegroundQueueID[index].bgQueueType;
2224  }
2226  {
2227  for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
2228  if (m_bgBattlegroundQueueID[i].bgQueueType == bgQueueType)
2229  return i;
2231  }
2233  {
2234  for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
2235  if (m_bgBattlegroundQueueID[i].bgQueueType == bgQueueType)
2236  return m_bgBattlegroundQueueID[i].invitedToInstance != 0;
2237  return false;
2238  }
2240  {
2241  return GetBattlegroundQueueIndex(bgQueueType) < PLAYER_MAX_BATTLEGROUND_QUEUES;
2242  }
2243 
2245  {
2246  m_bgData.bgInstanceID = val;
2247  }
2249  {
2250  for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
2251  {
2252  if (m_bgBattlegroundQueueID[i].bgQueueType == 0 || m_bgBattlegroundQueueID[i].bgQueueType == val)
2253  {
2254  m_bgBattlegroundQueueID[i].bgQueueType = val;
2255  m_bgBattlegroundQueueID[i].invitedToInstance = 0;
2256  return i;
2257  }
2258  }
2260  }
2262  {
2263  for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
2264  if (m_bgBattlegroundQueueID[i].bgQueueType == 0)
2265  return true;
2266  return false;
2267  }
2269  {
2270  for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
2271  {
2272  if (m_bgBattlegroundQueueID[i].bgQueueType == val)
2273  {
2274  m_bgBattlegroundQueueID[i].bgQueueType = 0;
2275  m_bgBattlegroundQueueID[i].invitedToInstance = 0;
2276  return;
2277  }
2278  }
2279  }
2280  void SetInviteForBattlegroundQueueType(uint32 bgQueueType, uint32 instanceId)
2281  {
2282  for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
2283  if (m_bgBattlegroundQueueID[i].bgQueueType == bgQueueType)
2284  m_bgBattlegroundQueueID[i].invitedToInstance = instanceId;
2285  }
2287  {
2288  for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
2289  if (m_bgBattlegroundQueueID[i].invitedToInstance == instanceId)
2290  return true;
2291  return false;
2292  }
2294  {
2295  return m_bgData.joinPos;
2296  }
2297  void SetBattlegroundEntryPoint();
2298  void SetBattlegroundEntryPoint(uint32 Map, float PosX, float PosY, float PosZ, float PosO)
2299  {
2300  m_bgData.joinPos = WorldLocation(Map, PosX, PosY, PosZ, PosO);
2301  }
2302 
2303  void SetBGTeam(uint32 team)
2304  {
2305  m_bgData.bgTeam = team;
2306  }
2308  {
2309  return m_bgData.bgTeam ? m_bgData.bgTeam : GetTeam();
2310  }
2311 
2312  void LeaveBattleground(bool teleportToEntryPoint = true);
2313  bool CanJoinToBattleground() const;
2314  bool CanReportAfkDueToLimit();
2315  void ReportedAfkBy(Player* reporter);
2317  {
2318  m_bgData.bgAfkReporter.clear();
2319  }
2320 
2321  bool GetBGAccessByLevel(uint32 bgTypeId) const;
2322  bool isTotalImmunity();
2323  bool CanUseBattlegroundObject(GameObject* gameobject);
2324  bool CanCaptureTowerPoint();
2325 
2326  /*********************************************************/
2327  /*** OUTDOOR PVP SYSTEM ***/
2328  /*********************************************************/
2329 
2330  OutdoorPvP* GetOutdoorPvP() const;
2331  // returns true if the player is in active state for outdoor pvp objective capturing, false otherwise
2332  bool IsOutdoorPvPActive();
2333 
2334  /*********************************************************/
2335  /*** ENVIROMENTAL SYSTEM ***/
2336  /*********************************************************/
2337 
2338  void EnvironmentalDamage(EnviromentalDamage type, uint32 damage);
2339 
2340  /*********************************************************/
2341  /*** FLOOD FILTER SYSTEM ***/
2342  /*********************************************************/
2343 
2344  void UpdateSpeakTime();
2345  bool CanSpeak() const;
2346  void ChangeSpeakTime(int utime);
2347 
2348  /*********************************************************/
2349  /*** VARIOUS SYSTEMS ***/
2350  /*********************************************************/
2355  void SetFallInformation(uint32 time, float z)
2356  {
2357  m_lastFallTime = time;
2358  m_lastFallZ = z;
2359  }
2360 
2361  void BuildTeleportAckMsg( WorldPacket* data, float x, float y, float z, float ang) const;
2362 
2363  bool isMovingOrTurning() const
2364  {
2365  return HasUnitMovementFlag(MOVEMENTFLAG_TURNING);
2366  }
2367 
2368  bool CanFly() const
2369  {
2370  return HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
2371  }
2372 
2373  void HandleFallDamage(MovementInfo& movementInfo);
2374  void HandleFallUnderMap();
2375 
2376  void SetClientControl(Unit* target, bool allowMove);
2377 
2378  void SetMover(Unit* target)
2379  {
2380  //m_mover->m_movedPlayer = NULL;
2381  m_mover = target;
2382  //m_mover->m_movedPlayer = this;
2383  }
2384  void SetSeer(WorldObject* target)
2385  {
2386  m_seer = target;
2387  }
2388  void SetViewpoint(WorldObject* target, bool apply);
2389  WorldObject* GetViewpoint() const;
2390  void StopCastingCharm();
2391  void StopCastingBindSight();
2392 
2393  // Transports
2395  {
2396  return m_transport;
2397  }
2399  {
2400  m_transport = t;
2401  }
2402 
2403  float GetTransOffsetX() const
2404  {
2405  return m_movementInfo.GetTransportPos()->m_positionX;
2406  }
2407  float GetTransOffsetY() const
2408  {
2409  return m_movementInfo.GetTransportPos()->m_positionY;
2410  }
2411  float GetTransOffsetZ() const
2412  {
2413  return m_movementInfo.GetTransportPos()->m_positionZ;
2414  }
2415  float GetTransOffsetO() const
2416  {
2417  return m_movementInfo.GetTransportPos()->GetOrientation();
2418  }
2420  {
2421  return m_movementInfo.GetTransportTime();
2422  }
2423 
2425  {
2426  return m_nextSave;
2427  }
2428  void SetSaveTimer(uint32 timer)
2429  {
2430  m_nextSave = timer;
2431  }
2432 
2433  // Recall position
2435  float m_recallX;
2436  float m_recallY;
2437  float m_recallZ;
2438  float m_recallO;
2439  void SaveRecallPosition();
2440 
2441  // Homebind coordinates
2447  void SetHomebindToLocation(WorldLocation const& loc, uint32 area_id);
2449  {
2450  newMap = m_homebindMapId;
2451  Relocate(m_homebindX, m_homebindY, m_homebindZ);
2452  }
2453  bool TeleportToHomebind(uint32 options = 0)
2454  {
2455  return TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GetOrientation(), options);
2456  }
2457 
2458  WorldLocation GetStartPosition() const;
2459 
2460  // currently visible objects at player client
2461  typedef std::set<uint64> ClientGUIDs;
2462  ClientGUIDs m_clientGUIDs;
2463 
2464  bool HaveAtClient(WorldObject const* u) const;
2465 
2466  bool IsNeverVisible() const override;
2467 
2468  bool IsVisibleGloballyFor(Player* pl) const;
2469 
2470  void UpdateObjectVisibility(bool forced = true) override;
2471  void UpdateVisibilityForPlayer();
2472  void UpdateVisibilityOf(WorldObject* target);
2473  void UpdateTriggerVisibility();
2474 
2475  template<class T>
2476  void UpdateVisibilityOf(T* target, UpdateData& data, std::set<Unit*>& visibleNow);
2477 
2478  uint8 m_forced_speed_changes[MAX_MOVE_TYPE];
2479 
2481  {
2482  return m_atLoginFlags & f;
2483  }
2485  {
2486  m_atLoginFlags |= f;
2487  }
2488 
2490 
2491  // Temporarily removed pet cache
2493  {
2494  return m_temporaryUnsummonedPetNumber;
2495  }
2497  {
2498  m_temporaryUnsummonedPetNumber = petnumber;
2499  }
2501  {
2502  return m_oldpetspell;
2503  }
2504  void SetOldPetSpell(uint32 petspell)
2505  {
2506  m_oldpetspell = petspell;
2507  }
2508 
2509  void UnsummonPetTemporaryIfAny();
2510  void ResummonTemporaryUnsummonedPetIfAny();
2511 
2512  // Handle pet status here
2514  {
2515  return m_petStatus;
2516  }
2518  {
2519  m_petStatus = status;
2520  }
2521 
2522  bool isPetDeadAndRemoved() const
2523  {
2524  return (m_petStatus == PET_STATUS_DEAD_AND_REMOVED);
2525  }
2526  bool isPetDismissed() const
2527  {
2528  return (m_petStatus == PET_STATUS_DISMISSED);
2529  }
2530  bool doesOwnPet() const
2531  {
2532  return (m_petStatus != PET_STATUS_NONE);
2533  }
2534 
2535  void SendCinematicStart(uint32 CinematicSequenceId);
2536 
2537  /*********************************************************/
2538  /*** INSTANCE SYSTEM ***/
2539  /*********************************************************/
2540 
2542 
2543  void UpdateHomebindTime(uint32 time);
2544 
2547  // permanent binds and solo binds by difficulty
2548  BoundInstancesMap m_boundInstances[TOTAL_DIFFICULTIES];
2549  InstancePlayerBind* GetBoundInstance(uint32 mapid, uint8 difficulty);
2550  BoundInstancesMap& GetBoundInstances(uint8 difficulty)
2551  {
2552  return m_boundInstances[difficulty];
2553  }
2554  InstanceSave* GetInstanceSave(uint32 mapid);
2555  void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false);
2556  void UnbindInstance(BoundInstancesMap::iterator& itr, uint8 difficulty, bool unload = false);
2557  InstancePlayerBind* BindToInstance(InstanceSave* save, bool permanent, bool load = false);
2558  void SendRaidInfo();
2559  void SendSavedInstances();
2560  bool CheckInstanceValidity(bool /*isLogin*/);
2561  static void ConvertInstancesToGroup(Player* player, Group* group = NULL, uint64 player_guid = 0);
2562  bool Satisfy(AccessRequirement const*, uint32 target_map, bool report = false);
2563 
2564  // last used pet number (for BG's)
2565  uint32 GetLastPetNumber() const { return m_lastpetnumber; }
2566  void SetLastPetNumber(uint32 petnumber) { m_lastpetnumber = petnumber; }
2567 
2568  /*********************************************************/
2569  /*** GROUP SYSTEM ***/
2570  /*********************************************************/
2571 
2573  {
2574  return m_groupInvite;
2575  }
2576  void SetGroupInvite(Group* group)
2577  {
2578  m_groupInvite = group;
2579  }
2581  {
2582  return m_group.getTarget();
2583  }
2584  const Group* GetGroup() const
2585  {
2586  return (const Group*)m_group.getTarget();
2587  }
2589  {
2590  return m_group;
2591  }
2592  void SetGroup(Group* group, int8 subgroup = -1);
2594  {
2595  return m_group.getSubGroup();
2596  }
2598  {
2599  return m_groupUpdateMask;
2600  }
2601  void SetGroupUpdateFlag(uint32 flag)
2602  {
2603  m_groupUpdateMask |= flag;
2604  }
2606  {
2607  return m_auraUpdateMask;
2608  }
2610  {
2611  m_auraUpdateMask |= (uint64(1) << slot);
2612  }
2614  {
2615  m_auraUpdateMask &= ~(uint64(1) << slot);
2616  }
2617  Player* GetNextRandomRaidMember(float radius);
2618  PartyResult CanUninviteFromGroup() const;
2619 
2620  // Battleground Group System
2621  void SetBattlegroundRaid(Group* group, int8 subgroup = -1);
2622  void RemoveFromBattlegroundRaid();
2624  {
2625  return m_originalGroup.getTarget();
2626  }
2628  {
2629  return m_originalGroup;
2630  }
2632  {
2633  return m_originalGroup.getSubGroup();
2634  }
2635  void SetOriginalGroup(Group* group, int8 subgroup = -1);
2636 
2637  void SetPassOnGroupLoot(bool bPassOnGroupLoot) { _passOnGroupLoot = bPassOnGroupLoot; }
2638  bool GetPassOnGroupLoot() const { return _passOnGroupLoot; }
2639 
2641  {
2642  return m_mapRef;
2643  }
2644 
2645  // Set map to player and add reference
2646  void SetMap(Map* map) override;
2647  void ResetMap() override;
2648 
2649  bool isAllowedToLoot(const Creature* creature);
2650 
2652  {
2653  return m_declinedname;
2654  }
2655  bool HasTitle(uint32 bitIndex);
2656  bool HasTitle(CharTitlesEntry const* title)
2657  {
2658  return HasTitle(title->bit_index);
2659  }
2660  void SetTitle(CharTitlesEntry const* title, bool lost = false);
2661 
2662  bool IsLoading() const;
2663 
2665  {
2666  return m_rafLink;
2667  }
2668 
2670  {
2671  m_rafLink = status;
2672  }
2673 
2674  bool SetFeatherFall(bool apply, bool packetOnly = false) override;
2675  bool SetHover(bool apply, bool packetOnly = false) override;
2676  bool SetCanFly(bool apply, bool packetOnly = false) override;
2677  bool SetLevitate(bool apply, bool packetOnly = false) override;
2678  bool SetWaterWalking(bool enable, bool packetOnly = false) override;
2679 
2680  void ScheduleDelayedOperation(uint32 operation)
2681  {
2682  if (operation < DELAYED_END)
2683  m_DelayedOperations |= operation;
2684  }
2685  protected:
2686 
2688 
2689  /*********************************************************/
2690  /*** BATTLEGROUND SYSTEM ***/
2691  /*********************************************************/
2692 
2693  /*
2694  this is an array of BG queues (BgTypeIDs) in which is player
2695  */
2697  {
2698  uint32 bgQueueType;
2700  };
2701 
2704 
2705  /*********************************************************/
2706  /*** QUEST SYSTEM ***/
2707  /*********************************************************/
2708 
2709  //We allow only one timed quest active at the same time. Below can then be simple value instead of set.
2710  std::set<uint32> m_timedquests;
2711 
2715 
2716  /*********************************************************/
2717  /*** LOAD SYSTEM ***/
2718  /*********************************************************/
2719 
2720  void _LoadActions(QueryResult_AutoPtr result);
2721  void _LoadAuras(QueryResult_AutoPtr result, uint32 timediff);
2722  void _LoadBoundInstances(QueryResult_AutoPtr result);
2723  void _LoadInventory(QueryResult_AutoPtr result, uint32 timediff);
2724  void _LoadMailInit(QueryResult_AutoPtr resultUnread, QueryResult_AutoPtr resultDelivery);
2725  void _LoadMail();
2726  void _LoadMailedItems(Mail* mail);
2727  void _LoadQuestStatus(QueryResult_AutoPtr result);
2728  void _LoadDailyQuestStatus(QueryResult_AutoPtr result);
2729  void _LoadGroup(QueryResult_AutoPtr result);
2730  void _LoadSkills(QueryResult_AutoPtr result);
2731  void _LoadSpells(QueryResult_AutoPtr result);
2732  void _LoadTutorials(QueryResult_AutoPtr result);
2733  void _LoadFriendList(QueryResult_AutoPtr result);
2734  bool _LoadHomeBind(QueryResult_AutoPtr result);
2735  void _LoadDeclinedNames(QueryResult_AutoPtr result);
2736  void _LoadArenaTeamInfo(QueryResult_AutoPtr result);
2737  void _LoadBGData(QueryResult_AutoPtr result);
2738 
2739  /*********************************************************/
2740  /*** SAVE SYSTEM ***/
2741  /*********************************************************/
2742 
2743  void _SaveActions();
2744  void _SaveAuras();
2745  void _SaveInventory();
2746  void _SaveMail();
2747  void _SaveQuestStatus();
2748  void _SaveDailyQuestStatus();
2749  void _SaveSkills();
2750  void _SaveSpells();
2751  void _SaveTutorials();
2752  void _SaveBGData();
2753 
2754  void _SetCreateBits(UpdateMask* updateMask, Player* target) const override;
2755  void _SetUpdateBits(UpdateMask* updateMask, Player* target) const override;
2756 
2757  /*********************************************************/
2758  /*** ENVIRONMENTAL SYSTEM ***/
2759  /*********************************************************/
2760  void HandleSobering();
2761  void SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen);
2762  void StopMirrorTimer(MirrorTimerType Type);
2763  bool HasMirrorTimerFlag(uint32 flag) const { return m_MirrorTimerFlags & flag; }
2764  void HandleDrowning(uint32 time_diff);
2765  int32 getMaxTimer(MirrorTimerType timer);
2766 
2767  /*********************************************************/
2768  /*** HONOR SYSTEM ***/
2769  /*********************************************************/
2771 
2772  void outDebugValues() const;
2773  bool _removeSpell(uint16 spell_id);
2775 
2776  uint32 m_team;
2777  uint32 m_nextSave;
2778  time_t m_speakTime;
2781 
2783 
2786 
2787  std::vector<Item*> m_itemUpdateQueue;
2789 
2792 
2795 
2797 
2799 
2802 
2806  std::map<uint32, uint32> m_globalCooldowns; // whole start recovery category stored in one
2807 
2809 
2810  float m_auraBaseMod[BASEMOD_END][MOD_END];
2811 
2816 
2819  float m_resurrectX, m_resurrectY, m_resurrectZ;
2820  uint32 m_resurrectHealth, m_resurrectMana;
2821 
2823 
2824  typedef std::list<Channel*> JoinedChannelsList;
2825  JoinedChannelsList m_channels;
2826 
2828 
2832  uint32 tradeGold;
2833 
2835 
2836  uint32 m_Tutorials[8];
2838 
2841 
2846 
2850 
2853 
2859  float m_ammoDPS;
2861  time_t _restTime;
2866 
2867  // Transports
2869 
2873 
2874  // Social
2876 
2877  // Groups
2884 
2885  // last used pet number (for BG's)
2887 
2888  // Player summoning
2891  float m_summon_x;
2892  float m_summon_y;
2893  float m_summon_z;
2894 
2896 
2897  bool CanAlwaysSee(WorldObject const* obj) const override;
2898 
2899  bool IsAlwaysDetectableFor(WorldObject const* seer) const override;
2900 
2901  private:
2902  // internal common parts for CanStore/StoreItem functions
2903  uint8 _CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const;
2904  uint8 _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;
2905  uint8 _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;
2906  Item* _StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool update);
2907 
2909 
2911  int32 m_MirrorTimer[MAX_TIMERS];
2917 
2919 
2920  void SetCanDelayTeleport(bool setting)
2921  {
2922  m_bCanDelayTeleport = setting;
2923  }
2925  {
2926  // we should not execute delayed teleports for now dead players but has been alive at teleport
2927  // because we don't want player's ghost teleported from graveyard
2928  return m_bHasDelayedTeleport && (IsAlive() || !m_bHasBeenAliveAtDelayedTeleport);
2929  }
2930 
2932  {
2933  m_bHasDelayedTeleport = m_bCanDelayTeleport;
2934  m_bHasBeenAliveAtDelayedTeleport = IsAlive();
2935  return m_bHasDelayedTeleport;
2936  }
2937 
2938  bool IsInstanceLoginGameMasterException() const;
2939 
2941 
2942  void UpdateCharmedAI();
2944 
2949 
2950  // Current teleport data
2955 
2960 
2962 
2963  // Temporary removed pet cache
2966 
2967  // Status of your currently controlled pet
2969 
2971 };
2972 
2973 void AddItemsSetItem(Player* player, Item* item);
2974 void RemoveItemsSetItem(Player* player, ItemTemplate const* proto);
2975 
2976 // "the bodies of template functions must be made available in a header file"
2977 template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell const* spell)
2978 {
2979  SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
2980  if (!spellInfo)
2981  return 0;
2982  float totalpct = 1.0f;
2983  int32 totalflat = 0;
2984 
2985  for (SpellModList::iterator itr = m_spellMods[op].begin(); itr != m_spellMods[op].end(); ++itr)
2986  {
2987  SpellModifier* mod = *itr;
2988 
2989  if (!IsAffectedBySpellmod(spellInfo, mod, spell))
2990  continue;
2991 
2992  if (mod->type == SPELLMOD_FLAT)
2993  totalflat += mod->value;
2994  else if (mod->type == SPELLMOD_PCT)
2995  {
2996  // skip percent mods for null basevalue (most important for spell mods with charges)
2997  if (basevalue == T(0))
2998  continue;
2999 
3000  // special case (skip >10sec spell casts for instant cast setting)
3001  if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10 * IN_MILLISECONDS) && mod->value <= -100)
3002  continue;
3003 
3004  totalpct += CalculatePct(1.0f, (float)mod->value);
3005  }
3006 
3007  if (mod->charges > 0)
3008  {
3009  if (!(spellInfo->SpellFamilyName == 8 && spellInfo->SpellFamilyFlags & 0x200000000LL))
3010  --mod->charges;
3011  if (mod->charges == 0)
3012  {
3013  mod->charges = -1;
3014  mod->lastAffected = spell;
3015  if (!mod->lastAffected)
3016  mod->lastAffected = FindCurrentSpellBySpellId(spellId);
3017  ++m_SpellModRemoveCount;
3018  }
3019  }
3020  }
3021 
3022  float diff = (float)basevalue * (totalpct - 1.0f) + (float)totalflat;
3023  basevalue = T((float)basevalue + diff);
3024  return T(diff);
3025 }
3026 #endif
3027 
void SetAcceptWhispers(bool on)
Definition: Player.h:1005
EnchantmentSlot slot
Definition: Player.h:258
GameobjectTypes
uint16 m_homebindAreaId
Definition: Player.h:2443
BGData m_bgData
Definition: Player.h:2703
Definition: Object.h:130
SpellModOp op
Definition: Player.h:103
PetSaveMode
Definition: Pet.h:33
uint8 GetSubGroup() const
Definition: Player.h:2593
bool _passOnGroupLoot
Definition: Player.h:2883
uint32 GetArenaPoints()
Definition: Player.h:2103
uint32 GetOldPetSpell() const
Definition: Player.h:2500
DeclinedName const * GetDeclinedNames() const
Definition: Player.h:2651
ActionButtonList m_actionButtons
Definition: Player.h:2808
float m_recallY
Definition: Player.h:2436
void setWeaponChangeTimer(uint32 time)
Definition: Player.h:1508
uint32 GetCount() const
Definition: Item.h:251
BaseModGroup
Definition: Unit.h:419
bool HasTitle(CharTitlesEntry const *title)
Definition: Player.h:2656
ClientGUIDs m_clientGUIDs
Definition: Player.h:2462
QuestSlotOffsets
Definition: Player.h:486
Group * GetGroup()
Definition: Player.h:2580
void ClearQuestSharingInfo()
Definition: Player.h:1453
std::list< Item * > ItemDurationList
Definition: Player.h:263
bool isRessurectRequested() const
Definition: Player.h:1743
SkillStatusData(uint8 _pos, SkillUpdateState _uState)
Definition: Player.h:513
PlayerChatTag
Definition: Player.h:684
float m_rest_bonus
Definition: Player.h:2863
Definition: Corpse.h:48
PetType
Definition: Pet.h:25
static UpdateMask updateVisualBits
Definition: Player.h:937
void SetRAFStatus(RAFLinkStatus status)
Definition: Player.h:2669
void SetAuraUpdateMask(uint8 slot)
Definition: Player.h:2609
float m_recallX
Definition: Player.h:2435
time_t m_nextMailDelivereTime
Definition: Player.h:1615
bool isDND() const
Definition: Player.h:982
void SetLastPetNumber(uint32 petnumber)
Definition: Player.h:2566
void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value)
Definition: Player.h:1847
PlayerSpellMap m_spells
Definition: Player.h:2804
uint32 GetLevelPlayedTime()
Definition: Player.h:1061
PlayerMails::iterator GetmailBegin()
Definition: Player.h:1601
Item * GetItemByTradeSlot(uint8 slot) const
Definition: Player.h:1260
Definition: Player.h:239
DungeonDifficulty m_dungeonDifficulty
Definition: Player.h:2780
void SetSession(WorldSession *s)
Definition: Player.h:1951
InventorySlots
Definition: Player.h:561
#define MAX_MOVE_TYPE
Definition: Unit.h:494
time_t startTime
Definition: Player.h:235
bool IsBeingTeleportedFar() const
Definition: Player.h:2049
void AddArmorProficiency(uint32 newflag)
Definition: Player.h:1226
GroupReference m_originalGroup
Definition: Player.h:2879
PlayerTaxi m_taxi
Definition: Player.h:991
void AddWeaponProficiency(uint32 newflag)
Definition: Player.h:1222
uint32 NextTaxiDestination()
Definition: Player.h:875
uint32 GetQuestSlotCounters(uint16 slot) const
Definition: Player.h:1378
time_t m_nextThinkTime
Definition: Player.h:2834
void ClearTaxiPath()
Definition: Player.h:913
bool m_bHasBeenAliveAtDelayedTeleport
Definition: Player.h:2959
uint32 TaxiMask[TaxiMaskSize]
bool SetTaximaskNode(uint32 nodeidx)
Definition: Player.h:840
BuyBankSlotResult
Definition: Player.h:77
uint8 GetQuestSlotCounter(uint16 slot, uint8 counter) const
Definition: Player.h:1382
bool IsFalling()
Definition: Player.h:967
UnitAI * i_AI
Definition: Player.h:2943
KeyRingSlots
Definition: Player.h:593
uint32 areaID
Definition: Player.h:241
PlayerSpellState
Definition: Player.h:85
UNORDERED_MAP< uint16, PlayerSpell > PlayerSpellMap
Definition: Player.h:113
bool doesOwnPet() const
Definition: Player.h:2530
uint32 m_ingametime
Definition: Player.h:2714
PlayerMenu * PlayerTalkClass
Definition: Player.h:2185
SpellModOp
Definition: Unit.h:99
float GetTransOffsetZ() const
Definition: Player.h:2411
ReputationRank
void SetTutorialInt(uint32 intId, uint32 value)
Definition: Player.h:1540
std::set< uint32 > bgAfkReporter
Definition: Player.h:902
~PlayerTaxi()
Definition: Player.h:824
float m_summon_y
Definition: Player.h:2892
void SetGroupInvite(Group *group)
Definition: Player.h:2576
uint32 GetInnTriggerId() const
Definition: Player.h:1079
std::vector< std::string > Tokens
Definition: Util.h:26
bool SetDelayedTeleportFlagIfCan()
Definition: Player.h:2931
std::list< CreateSpellPair > spell
Definition: Player.h:212
void SetInGuild(uint32 GuildId)
Definition: Player.h:1814
bool HasTaxiPath() const
Definition: Player.h:917
uint32 m_groupUpdateMask
Definition: Player.h:2881
SkillStatusMap mSkillStatus
Definition: Player.h:2798
uint32 GetTemporaryUnsummonedPetNumber() const
Definition: Player.h:2492
const uint64 & GetLootGUID() const
Definition: Player.h:1936
uint32 AddBattlegroundQueueId(uint32 val)
Definition: Player.h:2248
std::list< EnchantDuration > EnchantDurationList
Definition: Player.h:262
void SetQuestSharingInfo(ObjectGuid guid, uint32 id)
Definition: Player.h:1452
UNORDERED_MAP< uint32, Item * > ItemMap
Definition: Player.h:1617
bool GetPassOnGroupLoot() const
Definition: Player.h:2638
SpellSchoolMask
DuelInfo * duel
Definition: Player.h:1798
void SetPvPDeath(bool on)
Definition: Player.h:1038
bool IsHasDelayedTeleport() const
Definition: Player.h:2924
float m_summon_z
Definition: Player.h:2893
float x2
Definition: Player.h:244
RAFLinkStatus
Definition: Player.h:803
bool m_canParry
Definition: Player.h:2856
uint32 GetDeathTimer() const
Definition: Player.h:2121
BuyBackSlots
Definition: Player.h:586
uint32 GetFullGrantableLevels() const
Definition: Player.h:1283
GroupReference & GetGroupRef()
Definition: Player.h:2588
bool m_bHasDelayedTeleport
Definition: Player.h:2958
bool isGMVisible() const
Definition: Player.h:1033
float m_homebindY
Definition: Player.h:2445
uint32 GetMailSize()
Definition: Player.h:1595
WeaponAttackType
Definition: Unit.h:498
TrainerSpellState
Definition: Player.h:124
time_t m_summon_expire
Definition: Player.h:2889
void SetFreeTalentPoints(uint32 points)
Definition: Player.h:1664
uint32 GetTaxiSource() const
Definition: Player.h:866
bool m_wasOutdoors
Definition: Player.h:2916
Definition: Player.h:890
Definition: Field.h:24
void SetObjectScale(float scale)
Definition: Object.h:205
std::list< PlayerCreateInfoItem > PlayerCreateInfoItems
Definition: Player.h:172
#define PLAYER_MAX_BATTLEGROUND_QUEUES
uint32 m_drunkTimer
Definition: Player.h:2843
bool IsValidPos(uint16 pos)
Definition: Player.h:1128
void AddTimedQuest(uint32 questId)
Definition: Player.h:1458
void AddMItem(Item *it)
Definition: Player.h:1627
Item * BankItem(ItemPosCountVec const &dest, Item *pItem, bool update)
Definition: Player.h:1193
PlayerSlots
Definition: Player.h:527
WorldSession * m_session
Definition: Player.h:2822
void SetBGTeam(uint32 team)
Definition: Player.h:2303
bool isPetDismissed() const
Definition: Player.h:2526
uint32 GetSpellCooldownDelay(uint32 spell_id) const
Definition: Player.h:1704
uint32 m_contestedPvPTimer
Definition: Player.h:2687
bool IsFFAPvP() const
Definition: Player.h:1771
LiquidTypeEntry const * _lastLiquid
Definition: Player.h:2910
uint32 mountSpell
Definition: Player.h:908
void AddTaxiDestination(uint32 dest)
Definition: Player.h:862
float positionZ
Definition: Player.h:207
bool IsInWater() const override
Definition: Player.h:965
bool HasSpellCooldown(uint32 spell_id) const
Definition: Player.h:1699
uint32 GetGroupUpdateFlag()
Definition: Player.h:2597
bool canAutoJoin() const
Definition: Player.h:312
void Set(uint32 _entry, uint32 _type)
Definition: Player.h:277
uint32 m_team
Definition: Player.h:2776
bool InBattlegroundQueueForBattlegroundQueueType(uint32 bgQueueType) const
Definition: Player.h:2239
void SetOldPetSpell(uint32 petspell)
Definition: Player.h:2504
uint32 item_amount
Definition: Player.h:169
const Group * GetGroup() const
Definition: Player.h:2584
uint8 m_swingErrorMsg
Definition: Player.h:2858
std::map< uint8, ActionButton > ActionButtonList
Definition: Player.h:160
uint32 areaId
Definition: Player.h:204
void AddToUpdateQueueOf(Player *player)
Definition: Item.cpp:688
uint16 action
Definition: Player.h:144
uint32 m_deathTimer
Definition: Player.h:2851
QuestStatus
Definition: QuestDef.h:89
float orientation
Definition: Player.h:208
void RemoveTimedQuest(uint32 questId)
Definition: Player.h:1459
uint32 m_timeSyncClient
Definition: Player.h:2947
#define MAX_TIMERS
Definition: Player.h:457
bool active
Definition: Player.h:96
ActionButtonUpdateState uState
Definition: Player.h:147
uint32 GetMaxKeyringSize() const
Definition: Player.h:1214
std::pair< uint16, uint8 > CreateSpellPair
Definition: Player.h:162
uint32 m_homebindMapId
Definition: Player.h:2442
uint32 m_resetTalentsCost
Definition: Player.h:2870
void SetContestedPvPTimer(uint32 newTime)
Definition: Player.h:1786
#define MAX_MONEY_AMOUNT
Definition: Player.h:743
UNORDERED_MAP< uint32, SkillStatusData > SkillStatusMap
Definition: Player.h:520
uint32 item2
Definition: Player.h:760
Transport * GetTransport() const
Definition: Player.h:2394
bool HasRestFlag(RestFlag restFlag) const
Definition: Player.h:1074
CinematicMgr * _cinematicMgr
Definition: Player.h:2908
ACE_INT32 int32
Definition: Define.h:67
PlayedTimeIndex
Definition: Player.h:694
void setCinematic(int cine)
Definition: Player.h:1753
PlayerLevelInfo * levelInfo
Definition: Player.h:215
void RemoveItemsSetItem(Player *player, ItemTemplate const *proto)
Definition: Item.cpp:108
NULL Dbg ErrDB Arena Chat Char Map MMap false
Definition: Log.cpp:556
TaxiMask m_taximask
Definition: Player.h:883
float m_recallZ
Definition: Player.h:2437
std::string questFailedText
Definition: Player.h:764
uint32 GetBGTeam() const
Definition: Player.h:2307
void clearResurrectRequestData()
Definition: Player.h:1735
bool empty() const
Definition: Player.h:881
uint32 m_speakCount
Definition: Player.h:2779
bool isAcceptWhispers() const
Definition: Player.h:1001
float m_recallO
Definition: Player.h:2438
uint8 levelMin
Definition: Player.h:757
uint32 effectId
Definition: Player.h:109
void SetPetStatus(PetStatus status)
Definition: Player.h:2517
time_t m_Last_tick
Definition: Player.h:1055
float positionY
Definition: Player.h:206
LookingForGroupSlot more
Definition: Player.h:329
bool IsGameMaster() const
Definition: Player.h:1010
PlayerSpellMap const & GetSpellMap() const
Definition: Player.h:1682
uint32 m_DelayedOperations
Definition: Player.h:2956
uint32 bgTypeID
Definition: Player.h:900
PlayerSpellMap & GetSpellMap()
Definition: Player.h:1686
uint32 GetGUIDLow() const
Definition: Object.h:166
uint32 m_timeSyncTimer
Definition: Player.h:2946
ArenaTeamInfoType
Definition: Player.h:638
time_t startTimer
Definition: Player.h:234
JoinedChannelsList m_channels
Definition: Player.h:2825
float positionX
Definition: Player.h:205
bool CanFly() const
Definition: Player.h:2368
void AddMail(Mail *mail)
Definition: Player.h:1591
uint32 GetQuestSlotState(uint16 slot) const
Definition: Player.h:1374
DungeonDifficulty GetDifficulty()
Definition: Player.h:1873
uint16 itemid
Definition: Player.h:119
SpellModType type
Definition: Player.h:104
uint32 m_areaUpdateId
Definition: Player.h:2849
TotemCategory
bool m_bCanDelayTeleport
Definition: Player.h:2957
DungeonDifficulty
void apply(T *val)
Definition: ByteConverter.h:41
float GetTransOffsetX() const
Definition: Player.h:2403
time_t m_lastDailyQuestTime
Definition: Player.h:2840
float m_GrantableLevels
Definition: Player.h:2914
bool isTaxiCheater() const
Definition: Player.h:1024
BoundInstancesMap & GetBoundInstances(uint8 difficulty)
Definition: Player.h:2550
bool HaveInSlot(LookingForGroupSlot const &slot) const
Definition: Player.h:300
uint32 m_resurrectMana
Definition: Player.h:2820
void SetLootGUID(const uint64 &guid)
Definition: Player.h:1940
bool TeleportToHomebind(uint32 options=0)
Definition: Player.h:2453
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint32 m_zoneUpdateId
Definition: Player.h:2847
uint32 GetLastPetNumber() const
Definition: Player.h:2565
Transport * m_transport
Definition: Player.h:2868
DrunkenState
Definition: Player.h:341
uint32 m_ArenaTeamIdInvited
Definition: Player.h:2801
float GetRestBonus() const
Definition: Player.h:1071
uint32 m_timeSyncServer
Definition: Player.h:2948
uint32 GetSaveTimer() const
Definition: Player.h:2424
CharDeleteMethod
Definition: Player.h:769
uint32 m_summon_mapid
Definition: Player.h:2890
static bool IsInventoryPos(uint16 pos)
Definition: Player.h:1112
time_t m_speakTime
Definition: Player.h:2778
void ClearTaxiDestinations()
Definition: Player.h:858
void InitTaxiNodesForLevel()
Definition: Player.h:992
uint8 CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=NULL) const
Definition: Player.h:1150
void SetTransport(Transport *t)
Definition: Player.h:2398
void SetInviteForBattlegroundQueueType(uint32 bgQueueType, uint32 instanceId)
Definition: Player.h:2280
std::string heroicQuestFailedText
Definition: Player.h:766
ACE_INT8 int8
Definition: Define.h:69
QuestSlotStateMask
Definition: Player.h:496
bool IsBeingTeleported() const
Definition: Player.h:2041
uint8 levelMax
Definition: Player.h:758
bool GetCommandStatus(uint32 command) const
Definition: Player.h:1049
MeleeHitOutcome
Definition: Unit.h:661
InstanceResetWarningType
Definition: Player.h:627
void SetRank(uint32 rankId)
Definition: Player.h:1818
time_t outOfBound
Definition: Player.h:236
PvPInfo()
Definition: Player.h:220
#define MAX_STATS
TradeSlots
Definition: Player.h:608
Player * initiator
Definition: Player.h:232
float m_ammoDPS
Definition: Player.h:2859
uint8 bgAfkReportedCount
Definition: Player.h:903
std::map< uint32, SpellCooldown > SpellCooldowns
Definition: Player.h:122
TeleportToOptions
Definition: Player.h:663
Definition: Mail.h:195
time_t endTimer
Definition: Player.h:225
EquipmentSlots
Definition: Player.h:536
InstanceSave * save
Definition: Player.h:747
SheathState
Definition: Unit.h:220
Group * m_groupInvite
Definition: Player.h:2880
bool Empty() const
Definition: Player.h:320
PlayerUnderwaterState
Definition: Player.h:66
uint32 GetInGameTime() const
Definition: Player.h:1455
InventoryPackSlots
Definition: Player.h:568
void InitTaxiNodesForLevel(uint32 race, uint32 level)
Definition: Player.cpp:136
uint8 CanTakeMoreSimilarItems(uint32 entry, uint32 count) const
Definition: Player.h:1146
ActionButtonUpdateState
Definition: Player.h:131
uint32 GetTotalPlayedTime()
Definition: Player.h:1057
uint32 GetTutorialInt(uint32 intId)
Definition: Player.h:1534
uint32 bgInstanceID
Definition: Player.h:898
time_t end
Definition: Player.h:118
#define MAX_QUEST_OFFSET
Definition: Player.h:494
WorldLocation m_teleport_dest
Definition: Player.h:2951
time_t m_resetTalentsTime
Definition: Player.h:2871
QuestStatusMap mQuestStatus
Definition: Player.h:2796
void SetQuestSlotCounter(uint16 slot, uint8 counter, uint8 count)
Definition: Player.h:1397
CinematicMgr * GetCinematicMgr() const
Definition: Player.h:1258
void SetGuildIdInvited(uint32 GuildId)
Definition: Player.h:1822
uint32 GetBattlegroundQueueId(uint32 index) const
Definition: Player.h:2221
ACE_UINT8 uint8
Definition: Define.h:73
Powers
Definition: Unit.h:430
float GetOrientation() const
Definition: Position.h:100
bool CanBlock() const
Definition: Player.h:2136
Definition: Unit.h:432
uint32 m_stableSlots
Definition: Player.h:1302
PlayerRestState
Definition: Player.h:776
PlayerSpellState state
Definition: Player.h:95
ItemClass
uint32 GetQuestSlotQuestId(uint16 slot) const
Definition: Player.h:1370
ReferFriendError
Definition: Player.h:786
PlayerSocial * GetSocial()
Definition: Player.h:986
int8 m_comboPoints
Definition: Player.h:2794
void SetMover(Unit *target)
Definition: Player.h:2378
uint32 GetQuestLevelForPlayer(Quest const *pQuest) const
Definition: Player.h:1322
uint8 CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap=false) const
Definition: Player.h:1154
bool HasMirrorTimerFlag(uint32 flag) const
Definition: Player.h:2763
PetStatus
Definition: Pet.h:44
std::list< SpellModifier * > SpellModList
Definition: Player.h:114
uint32 m_teleport_options
Definition: Player.h:2952
float y2
Definition: Player.h:246
uint32 m_oldpetspell
Definition: Player.h:2965
uint8 unReadMails
Definition: Player.h:1608
Definition: adtfile.h:38
void SetSemaphoreTeleportFar(bool semphsetting)
Definition: Player.h:2057
uint32 GetBattlegroundQueueIndex(uint32 bgQueueType) const
Definition: Player.h:2225
uint32 quest
Definition: Player.h:763
uint8 m_MirrorTimerFlagsLast
Definition: Player.h:2913
Group * GetGroupInvite()
Definition: Player.h:2572
bool disabled
Definition: Player.h:97
uint8 CanTakeMoreSimilarItems(Item *pItem) const
Definition: Player.h:1142
float GetTransOffsetO() const
Definition: Player.h:2415
std::string comment
Definition: Player.h:330
uint32 leftduration
Definition: Player.h:259
uint32 m_resurrectMap
Definition: Player.h:2818
Definition: Unit.h:194
bool inFFAPvPArea
Definition: Player.h:224
time_t bgAfkReportedTimer
Definition: Player.h:904
PlayerExtraFlags
Definition: Player.h:461
Stats
BankItemSlots
Definition: Player.h:574
uint32 m_atLoginFlags
Definition: Player.h:2782
void AddItemsSetItem(Player *player, Item *item)
Definition: Item.cpp:25
uint32 m_regenTimer
Definition: Player.h:2842
static bool IsBankPos(uint16 pos)
Definition: Player.h:1123
LootType
Definition: LootMgr.h:54
void SetQuestSlotState(uint16 slot, uint32 state)
Definition: Player.h:1401
bool mSemaphoreTeleport_Near
Definition: Player.h:2953
MirrorTimerType
Definition: Player.h:451
uint32 m_HomebindTimer
Definition: Player.h:2545
uint32 GetTaxiDestination() const
Definition: Player.h:870
BaseModType
Definition: Unit.h:428
int GetGuildIdInvited()
Definition: Player.h:1836
float GetPositionY() const
Definition: Position.h:98
void SetDifficulty(DungeonDifficulty dungeon_difficulty)
Definition: Player.h:1869
bool IsBeingTeleportedNear() const
Definition: Player.h:2045
uint64 m_curSelection
Definition: Player.h:2791
void SetArenaTeamIdInvited(uint32 ArenaTeamId)
Definition: Player.h:1860
LookingForGroup m_lookingForGroup
Definition: Player.h:2489
Definition: Item.h:196
void SetCommandStatusOn(uint32 command)
Definition: Player.h:1050
ItemDurationList m_itemDuration
Definition: Player.h:2815
uint64 m_playerSharingQuest
Definition: Player.h:2712
uint8 misc
Definition: Player.h:146
float m_resurrectZ
Definition: Player.h:2819
int getCinematic()
Definition: Player.h:1749
etc mysql my cnf *Then change max_allowed_packet to a bigger value
uint8 GetBankBagSlotCount() const
Definition: Player.h:1133
std::map< uint32, QuestStatusData > QuestStatusMap
Definition: Player.h:484
float GetPositionZ() const
Definition: Position.h:99
uint32 GetRank()
Definition: Player.h:1831
bool IsMailsLoaded() const
Definition: Player.h:1583
int m_cinematic
Definition: Player.h:2827
uint32 GetArenaPersonalRating(uint8 slot)
Definition: Player.h:1855
float GetTransOffsetY() const
Definition: Player.h:2407
float x1
Definition: Player.h:243
TransferAbortReason
Definition: Player.h:615
T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell const *spell=NULL)
Definition: Player.h:2977
PlayerSocial * m_social
Definition: Player.h:2875
uint32 areaFlag
Definition: Player.h:242
uint32 GetBaseDefenseSkillValue() const
Definition: Player.h:1885
AtLoginFlags
Definition: Player.h:475
PvPInfo pvpInfo
Definition: Player.h:1762
uint64 SpellFamilyFlags
Definition: DBCStructure.h:761
uint16 GetDrunkValue() const
Definition: Player.h:2115
const uint64 & GetSelection() const
Definition: Player.h:1556
bool Is(uint32 _entry, uint32 _type) const
Definition: Player.h:282
WorldLocation const & GetBattlegroundEntryPoint() const
Definition: Player.h:2293
uint32 spellId
Definition: Player.h:108
void RemoveFromUpdateQueueOf(Player *player)
Definition: Item.cpp:708
PlayerMails m_mail
Definition: Player.h:2803
int32 m_SpellModRemoveCount
Definition: Player.h:2813
uint32 m_ExtraFlags
Definition: Player.h:2790
PlayerCreateInfoItems item
Definition: Player.h:211
#define DEFAULT_WORLD_OBJECT_SIZE
Definition: Object.h:44
bool m_InstanceValid
Definition: Player.h:2546
uint64 m_resurrectGUID
Definition: Player.h:2817
uint64 m_lootGuid
Definition: Player.h:2774
PlayerLoginQueryIndex
Definition: Player.h:703
std::string autoReplyMsg
Definition: Player.h:984
void SetPassOnGroupLoot(bool bPassOnGroupLoot)
Definition: Player.h:2637
float m_summon_x
Definition: Player.h:2891
void ScheduleDelayedOperation(uint32 operation)
Definition: Player.h:2680
bool CanParry() const
Definition: Player.h:2131
#define UNORDERED_MAP
Definition: UnorderedMap.h:47
SkillUpdateState
Definition: Player.h:503
bool IsTaximaskNodeKnown(uint32 nodeidx) const
Definition: Player.h:834
bool SetPosition(const Position &pos, bool teleport=false)
Definition: Player.h:1981
bool acceptTrade
Definition: Player.h:2830
std::list< Channel * > JoinedChannelsList
Definition: Player.h:2824
UNORDERED_MAP< uint32, InstancePlayerBind > BoundInstancesMap
Definition: Player.h:2541
uint8 count
Definition: Player.h:604
void SetCanDelayTeleport(bool setting)
Definition: Player.h:2920
PlayerFieldByte2Flags
Definition: Player.h:427
uint16 displayId_m
Definition: Player.h:209
uint16 m_drunk
Definition: Player.h:2844
bool isPetDeadAndRemoved() const
Definition: Player.h:2522
PlayerFieldByteFlags
Definition: Player.h:419
uint32 _restFlagMask
Definition: Player.h:2864
uint32 m_WeaponProficiency
Definition: Player.h:2854
void RelocateToHomebind(uint32 &newMap)
Definition: Player.h:2448
PlayerCommandStates
Definition: Player.h:810
void setRegenTimer(uint32 time)
Definition: Player.h:1504
Definition: Map.h:266
bool IsUseEquippedWeapon(bool mainhand) const
Definition: Player.h:1242
bool Empty() const
Definition: Player.h:268
uint32 m_sharedQuestId
Definition: Player.h:2713
void SetAtLoginFlag(AtLoginFlags f)
Definition: Player.h:2484
uint8 GetComboPoints()
Definition: Player.h:1566
TeamId
DuelInfo()
Definition: Player.h:230
std::vector< Item * > m_itemUpdateQueue
Definition: Player.h:2787
T CalculatePct(T base, U pct)
Definition: Util.h:97
bool inNoPvPArea
Definition: Player.h:223
uint32 m_currentBuybackSlot
Definition: Player.h:2785
uint32 mapId
Definition: Player.h:203
void SetMoney(uint32 value)
Definition: Player.h:1528
EnchantDurationList m_enchantDuration
Definition: Player.h:2814
uint32 GetGuildId()
Definition: Player.h:1826
GroupReference & GetOriginalGroupRef()
Definition: Player.h:2627
MailResponseType
ActionButtonType
Definition: Player.h:150
ReputationMgr const & GetReputationMgr() const
Definition: Player.h:2083
void SetBattlegroundId(uint32 val)
Definition: Player.h:2244
ObjectGuid GetPlayerSharingQuest() const
Definition: Player.h:1451
ReputationMgr & GetReputationMgr()
Definition: Player.h:2082
void RemoveQuestSlotState(uint16 slot, uint32 state)
Definition: Player.h:1405
bool HasAtLoginFlag(AtLoginFlags f) const
Definition: Player.h:2480
bool InBattlegroundQueue() const
Definition: Player.h:2213
std::vector< ItemPosCount > ItemPosCountVec
Definition: Player.h:606
void SetBattlegroundEntryPoint(uint32 Map, float PosX, float PosY, float PosZ, float PosO)
Definition: Player.h:2298
DeathState
Definition: Unit.h:435
void SetBaseModValue(BaseModGroup modGroup, BaseModType modType, float value)
Definition: Player.h:2143
ACE_UINT64 uint64
Definition: Define.h:70
void StopMirrorTimers()
Definition: Player.h:2009
bool IsInSameRaidWith(Player const *p) const
Definition: Player.h:1805
bool canAutoJoin() const
Definition: Player.h:286
void ClearAfkReports()
Definition: Player.h:2316
bool IsInvitedForBattlegroundInstance(uint32 instanceId) const
Definition: Player.h:2286
void SetCommandStatusOff(uint32 command)
Definition: Player.h:1051
uint32 GetBattlegroundId() const
Definition: Player.h:2203
void SetGMChat(bool on)
Definition: Player.h:1019
MailResponseResult
static bool IsEquipmentPos(uint16 pos)
Definition: Player.h:1117
uint8 GetOriginalSubGroup() const
Definition: Player.h:2631
bool InBattleground() const
Definition: Player.h:2198
RAFLinkStatus GetRAFStatus() const
Definition: Player.h:2664
float GetGrantableLevels() const
Definition: Player.h:1287
MapReference m_mapRef
Definition: Player.h:2940
void SwapQuestSlot(uint16 slot1, uint16 slot2)
Definition: Player.h:1413
DuelCompleteType
Definition: Player.h:656
void SetObjectScale(float scale)
Definition: Player.h:943
uint32 GetArenaTeamId(uint8 slot)
Definition: Player.h:1851
Group * GetOriginalGroup()
Definition: Player.h:2623
PlayerMails::iterator GetmailEnd()
Definition: Player.h:1605
SpellCooldowns m_spellCooldowns
Definition: Player.h:2805
bool m_mailsLoaded
Definition: Player.h:1493
uint8 LastSwingErrorMsg() const
Definition: Player.h:1961
bool isGMChat() const
Definition: Player.h:1015
ItemMap mMitems
Definition: Player.h:1619
uint32 GetFreePrimaryProfessionPoints() const
Definition: Player.h:1672
void SetPvP(bool state)
Definition: Player.h:1764
SkillUpdateState uState
Definition: Player.h:517
bool mSemaphoreTeleport_Far
Definition: Player.h:2954
Item * item
Definition: Player.h:255
PlayerMovementType
Definition: Player.h:333
DeclinedName * m_declinedname
Definition: Player.h:2895
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
uint32 GetMoney()
Definition: Player.h:1513
void SetSelection(const uint64 &guid)
Definition: Player.h:1560
void SetFreePrimaryProfessions(uint16 profs)
Definition: Player.h:1676
void SetSaveTimer(uint32 timer)
Definition: Player.h:2428
EnviromentalDamage
Definition: Player.h:673
void UnsetAuraUpdateMask(uint8 slot)
Definition: Player.h:2613
bool m_TutorialsChanged
Definition: Player.h:2837
EnchantDuration(Item *_item, EnchantmentSlot _slot, uint32 _leftduration)
Definition: Player.h:252
MapReference & GetMapRef()
Definition: Player.h:2640
PetStatus GetPetStatus() const
Definition: Player.h:2513
uint64 m_comboTarget
Definition: Player.h:2793
uint32 GetTaximask(uint8 index) const
Definition: Player.h:830
bool isRessurectRequestedBy(uint64 guid) const
Definition: Player.h:1739
Player * opponent
Definition: Player.h:233
uint32 SpellFamilyName
Definition: DBCStructure.h:760
bool HasFreeBattlegroundQueueId()
Definition: Player.h:2261
PartyResult
Definition: WorldSession.h:49
Item * GetMItem(uint32 id)
Definition: Player.h:1621
bool m_isInWater
Definition: Player.h:2915
void SetTemporaryUnsummonedPetNumber(uint32 petnumber)
Definition: Player.h:2496
PlayerFlags
Definition: Player.h:349
TeamId GetTeamId() const
Definition: Player.h:2070
uint64 m_auraUpdateMask
Definition: Player.h:2882
uint32 m_usedTalentCount
Definition: Player.h:2872
uint32 GetArenaTeamIdInvited()
Definition: Player.h:1864
WorldLocation joinPos
Definition: Player.h:911
EnchantmentSlot
Definition: Item.h:147
Definition: Unit.h:431
ItemPosCount(uint16 _pos, uint8 _count)
Definition: Player.h:601
uint32 GetSharedQuestID() const
Definition: Player.h:1450
uint64 GetAuraUpdateMask()
Definition: Player.h:2605
PlayerDelayedOperations
Definition: Player.h:730
time_t m_logintime
Definition: Player.h:1054
uint32 GetTeam() const
Definition: Player.h:2066
#define MAX_SPELLMOD
Definition: Unit.h:131
void SetPvP(bool state)
Definition: Unit.h:1143
uint16 pos
Definition: Player.h:603
uint32 bgTeam
Definition: Player.h:906
bool IsInFeralForm() const
Definition: Player.h:1238
void SetQuestSlotTimer(uint16 slot, uint32 timer)
Definition: Player.h:1409
float GetTotalPercentageModValue(BaseModGroup modGroup) const
Definition: Player.h:2150
BGData()
Definition: Player.h:892
#define ASSERT
Definition: Errors.h:29
bool m_canBlock
Definition: Player.h:2857
void SetSemaphoreTeleportNear(bool semphsetting)
Definition: Player.h:2053
uint32 m_ArmorProficiency
Definition: Player.h:2855
void SetFallInformation(uint32 time, float z)
Definition: Player.h:2355
void SetQuestSlot(uint16 slot, uint32 quest_id, uint32 timer=0)
Definition: Player.h:1390
std::deque< uint32 > m_TaxiDestinations
Definition: Player.h:884
uint32 heroicQuest
Definition: Player.h:765
uint32 GetTransTime() const
Definition: Player.h:2419
PlayerClassLevelInfo * levelInfo
Definition: Player.h:185
std::set< uint64 > ClientGUIDs
Definition: Player.h:2461
void setResurrectRequestData(uint64 guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana)
Definition: Player.h:1725
uint32 GetQuestSlotTime(uint16 slot) const
Definition: Player.h:1386
void SetGroupUpdateFlag(uint32 flag)
Definition: Player.h:2601
void SendMessageToSet(WorldPacket *data, bool self) override
Definition: Player.h:1987
int32 value
Definition: Player.h:106
bool isAFK() const
Definition: Player.h:981
SpellModType
Definition: Player.h:59
bool m_mailsUpdated
Definition: Player.h:1494
PetStatus m_petStatus
Definition: Player.h:2968
uint32 GetEntry() const
Definition: Object.h:192
uint32 tradeGold
Definition: Player.h:2832
uint8 m_MirrorTimerFlags
Definition: Player.h:2912
WorldSession * GetSession() const
Definition: Player.h:1947
std::set< uint32 > m_timedquests
Definition: Player.h:2710
std::vector< Item * > & GetItemUpdateQueue()
Definition: Player.h:1108
void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot)
Definition: Player.h:1843
int32 GetQuestLevel() const
Definition: QuestDef.h:197
ACE_UINT16 uint16
Definition: Define.h:72
bool inHostileArea
Definition: Player.h:222
PlayerCreateInfoItem(uint32 id, uint32 amount)
Definition: Player.h:166
#define MAX_LOOKING_FOR_GROUP_SLOT
Definition: Player.h:295
ACE_INT16 int16
Definition: Define.h:68
RAFLinkStatus m_rafLink
Definition: Player.h:2961
uint64 GetComboTarget()
Definition: Player.h:1570
std::map< uint32, uint32 > m_globalCooldowns
Definition: Player.h:2806
time_t _restTime
Definition: Player.h:2861
void RemoveFromGroup(RemoveMethod method=GROUP_REMOVEMETHOD_DEFAULT)
Definition: Player.h:1811
bool m_DailyQuestChanged
Definition: Player.h:2839
WorldObject * m_seer
Definition: Player.h:2354
ActivateTaxiReplies
Definition: Player.h:434
void ModifyMoney(int32 d)
Definition: Player.h:1517
void SetGrantableLevels(float amount)
Definition: Player.h:1291
Player * pTrader
Definition: Player.h:2829
ACE_UINT32 uint32
Definition: Define.h:71
uint32 m_nextSave
Definition: Player.h:2777
uint32 GetWeaponProficiency() const
Definition: Player.h:1230
float GetPositionX() const
Definition: Position.h:97
bool RemoveMItem(uint32 id)
Definition: Player.h:1634
Unit * m_mover
Definition: Player.h:2353