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