aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Player.h')
-rw-r--r--src/game/Player.h991
1 files changed, 485 insertions, 506 deletions
diff --git a/src/game/Player.h b/src/game/Player.h
index 384acf7b760..12d9c4c5efd 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
- * Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,6 +35,9 @@
#include "Pet.h"
#include "MapReference.h"
#include "Util.h" // for Tokens typedef
+#include "AchievementMgr.h"
+#include "ReputationMgr.h"
+#include "BattleGround.h"
#include<string>
#include<vector>
@@ -45,8 +48,8 @@ class DynamicObject;
class Creature;
class Pet;
class PlayerMenu;
-class Transport;
class UpdateMask;
+class SpellCastTargets;
class PlayerSocial;
class OutdoorPvP;
@@ -54,6 +57,7 @@ typedef std::deque<Mail*> PlayerMails;
#define PLAYER_MAX_SKILLS 127
#define PLAYER_MAX_DAILY_QUESTS 25
+#define AT_LOAD_PET_FLAGS 16
// Note: SPELLMOD_* values is aura types in fact
enum SpellModType
@@ -62,6 +66,18 @@ enum SpellModType
SPELLMOD_PCT = 108 // SPELL_AURA_ADD_PCT_MODIFIER
};
+// 2^n values, Player::m_isunderwater is a bitmask. These are mangos internal values, they are never send to any client
+enum PlayerUnderwaterState
+{
+ UNDERWATER_NONE = 0x00,
+ UNDERWATER_INWATER = 0x01, // terrain type is water and player is afflicted by it
+ UNDERWATER_INLAVA = 0x02, // terrain type is lava and player is afflicted by it
+ UNDERWATER_INSLIME = 0x04, // terrain type is lava and player is afflicted by it
+ UNDERWARER_INDARKWATER = 0x08, // terrain type is dark water and player is afflicted by it
+
+ UNDERWATER_EXIST_TIMERS = 0x10
+};
+
enum PlayerSpellState
{
PLAYERSPELL_UNCHANGED = 0,
@@ -72,27 +88,26 @@ enum PlayerSpellState
struct PlayerSpell
{
- uint16 slotId : 16;
PlayerSpellState state : 8;
- bool active : 1;
- bool disabled : 1;
+ bool active : 1; // show in spellbook
+ bool dependent : 1; // learned as result another spell learn, skill grow, quest reward, etc
+ bool disabled : 1; // first rank has been learned in result talent learn but currently talent unlearned, save max learned ranks
};
-#define SPELL_WITHOUT_SLOT_ID uint16(-1)
-
+// Spell modifier (used for modify other spells)
struct SpellModifier
{
+ SpellModifier(Aura * _ownerAura = NULL) : charges(0), ownerAura(_ownerAura) {}
SpellModOp op : 8;
SpellModType type : 8;
int16 charges : 16;
int32 value;
- uint64 mask;
+ flag96 mask;
uint32 spellId;
- uint32 effectId;
- Spell const* lastAffected;
+ Aura *const ownerAura;
};
-typedef UNORDERED_MAP<uint16, PlayerSpell*> PlayerSpellMap;
+typedef UNORDERED_MAP<uint32, PlayerSpell*> PlayerSpellMap;
typedef std::list<SpellModifier*> SpellModList;
struct SpellCooldown
@@ -107,7 +122,8 @@ enum TrainerSpellState
{
TRAINER_SPELL_GREEN = 0,
TRAINER_SPELL_RED = 1,
- TRAINER_SPELL_GRAY = 2
+ TRAINER_SPELL_GRAY = 2,
+ TRAINER_SPELL_GREEN_DISABLED = 10 // custom value, not send to client: formally green but learn not allowed
};
enum ActionButtonUpdateState
@@ -132,6 +148,7 @@ struct ActionButton
enum ActionButtonType
{
ACTION_BUTTON_SPELL = 0,
+ ACTION_BUTTON_EQSET = 32,
ACTION_BUTTON_MACRO = 64,
ACTION_BUTTON_CMACRO= 65,
ACTION_BUTTON_ITEM = 128
@@ -141,8 +158,6 @@ enum ActionButtonType
typedef std::map<uint8,ActionButton> ActionButtonList;
-typedef std::pair<uint16, uint8> CreateSpellPair;
-
struct PlayerCreateInfoItem
{
PlayerCreateInfoItem(uint32 id, uint32 amount) : item_id(id), item_amount(amount) {}
@@ -174,6 +189,8 @@ struct PlayerLevelInfo
uint8 stats[MAX_STATS];
};
+typedef std::list<uint32> PlayerCreateInfoSpells;
+
struct PlayerInfo
{
// existence checked by displayId != 0 // existence checked by displayId != 0
@@ -189,7 +206,7 @@ struct PlayerInfo
uint16 displayId_m;
uint16 displayId_f;
PlayerCreateInfoItems item;
- std::list<CreateSpellPair> spell;
+ PlayerCreateInfoSpells spell;
std::list<uint16> action[4];
PlayerLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1
@@ -197,9 +214,11 @@ struct PlayerInfo
struct PvPInfo
{
- PvPInfo() : inHostileArea(false), endTimer(0) {}
+ PvPInfo() : inHostileArea(false), inNoPvPArea(false), inFFAPvPArea(false), endTimer(0) {}
bool inHostileArea;
+ bool inNoPvPArea;
+ bool inFFAPvPArea;
time_t endTimer;
};
@@ -224,37 +243,44 @@ struct Areas
float y2;
};
-enum FactionFlags
+#define MAX_RUNES 6
+#define RUNE_COOLDOWN 5 // 5*2=10 sec
+
+enum RuneType
{
- FACTION_FLAG_VISIBLE = 0x01, // makes visible in client (set or can be set at interaction with target of this faction)
- FACTION_FLAG_AT_WAR = 0x02, // enable AtWar-button in client. player controlled (except opposition team always war state), Flag only set on initial creation
- FACTION_FLAG_HIDDEN = 0x04, // hidden faction from reputation pane in client (player can gain reputation, but this update not sent to client)
- FACTION_FLAG_INVISIBLE_FORCED = 0x08, // always overwrite FACTION_FLAG_VISIBLE and hide faction in rep.list, used for hide opposite team factions
- FACTION_FLAG_PEACE_FORCED = 0x10, // always overwrite FACTION_FLAG_AT_WAR, used for prevent war with own team factions
- FACTION_FLAG_INACTIVE = 0x20, // player controlled, state stored in characters.data ( CMSG_SET_FACTION_INACTIVE )
- FACTION_FLAG_RIVAL = 0x40 // flag for the two competing outland factions
+ RUNE_BLOOD = 0,
+ RUNE_UNHOLY = 1,
+ RUNE_FROST = 2,
+ RUNE_DEATH = 3,
+ NUM_RUNE_TYPES = 4
};
-typedef uint32 RepListID;
-struct FactionState
+struct RuneInfo
{
- uint32 ID;
- RepListID ReputationListID;
- uint32 Flags;
- int32 Standing;
- bool Changed;
+ uint8 BaseRune;
+ uint8 CurrentRune;
+ uint8 Cooldown;
};
-typedef std::map<RepListID,FactionState> FactionStateList;
-
-typedef std::map<uint32,ReputationRank> ForcedReactions;
+struct Runes
+{
+ RuneInfo runes[MAX_RUNES];
+ uint8 runeState; // mask of available runes
-typedef std::set<uint64> GuardianPetList;
+ void SetRuneState(uint8 index, bool set = true)
+ {
+ if(set)
+ runeState |= (1 << index); // usable
+ else
+ runeState &= ~(1 << index); // on cooldown
+ }
+};
struct EnchantDuration
{
EnchantDuration() : item(NULL), slot(MAX_ENCHANTMENT_SLOT), leftduration(0) {};
- EnchantDuration(Item * _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot), leftduration(_leftduration) { assert(item); };
+ EnchantDuration(Item * _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot),
+ leftduration(_leftduration){ assert(item); };
Item * item;
EnchantmentSlot slot;
@@ -264,14 +290,32 @@ struct EnchantDuration
typedef std::list<EnchantDuration> EnchantDurationList;
typedef std::list<Item*> ItemDurationList;
+enum LfgType
+{
+ LFG_TYPE_NONE = 0,
+ LFG_TYPE_DUNGEON = 1,
+ LFG_TYPE_RAID = 2,
+ LFG_TYPE_QUEST = 3,
+ LFG_TYPE_ZONE = 4,
+ LFG_TYPE_HEROIC_DUNGEON = 5
+};
+
+enum LfgRoles
+{
+ LEADER = 1,
+ TANK = 2,
+ HEALER = 4,
+ DAMAGE = 8
+};
+
struct LookingForGroupSlot
{
LookingForGroupSlot() : entry(0), type(0) {}
bool Empty() const { return !entry && !type; }
void Clear() { entry = 0; type = 0; }
void Set(uint32 _entry, uint32 _type ) { entry = _entry; type = _type; }
- bool Is(uint32 _entry, uint32 _type) const { return entry==_entry && type==_type; }
- bool canAutoJoin() const { return entry && (type == 1 || type == 5); }
+ bool Is(uint32 _entry, uint32 _type) const { return entry == _entry && type == _type; }
+ bool canAutoJoin() const { return entry && (type == LFG_TYPE_DUNGEON || type == LFG_TYPE_HEROIC_DUNGEON); }
uint32 entry;
uint32 type;
@@ -282,11 +326,11 @@ struct LookingForGroupSlot
struct LookingForGroup
{
LookingForGroup() {}
- bool HaveInSlot(LookingForGroupSlot const& slot) const { return HaveInSlot(slot.entry,slot.type); }
+ bool HaveInSlot(LookingForGroupSlot const& slot) const { return HaveInSlot(slot.entry, slot.type); }
bool HaveInSlot(uint32 _entry, uint32 _type) const
{
for(int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
- if(slots[i].Is(_entry,_type))
+ if(slots[i].Is(_entry, _type))
return true;
return false;
}
@@ -328,52 +372,6 @@ enum DrunkenState
DRUNKEN_SMASHED = 3
};
-enum PlayerStateType
-{
- /*
- PLAYER_STATE_DANCE
- PLAYER_STATE_SLEEP
- PLAYER_STATE_SIT
- PLAYER_STATE_STAND
- PLAYER_STATE_READYUNARMED
- PLAYER_STATE_WORK
- PLAYER_STATE_POINT(DNR)
- PLAYER_STATE_NONE // not used or just no state, just standing there?
- PLAYER_STATE_STUN
- PLAYER_STATE_DEAD
- PLAYER_STATE_KNEEL
- PLAYER_STATE_USESTANDING
- PLAYER_STATE_STUN_NOSHEATHE
- PLAYER_STATE_USESTANDING_NOSHEATHE
- PLAYER_STATE_WORK_NOSHEATHE
- PLAYER_STATE_SPELLPRECAST
- PLAYER_STATE_READYRIFLE
- PLAYER_STATE_WORK_NOSHEATHE_MINING
- PLAYER_STATE_WORK_NOSHEATHE_CHOPWOOD
- PLAYER_STATE_AT_EASE
- PLAYER_STATE_READY1H
- PLAYER_STATE_SPELLKNEELSTART
- PLAYER_STATE_SUBMERGED
- */
-
- PLAYER_STATE_NONE = 0,
- PLAYER_STATE_SIT = 1,
- PLAYER_STATE_SIT_CHAIR = 2,
- PLAYER_STATE_SLEEP = 3,
- PLAYER_STATE_SIT_LOW_CHAIR = 4,
- PLAYER_STATE_SIT_MEDIUM_CHAIR = 5,
- PLAYER_STATE_SIT_HIGH_CHAIR = 6,
- PLAYER_STATE_DEAD = 7,
- PLAYER_STATE_KNEEL = 8,
-
- PLAYER_STATE_FORM_ALL = 0x00FF0000,
-
- PLAYER_STATE_FLAG_ALWAYS_STAND = 0x01, // byte 4
- PLAYER_STATE_FLAG_CREEP = 0x02000000,
- PLAYER_STATE_FLAG_UNTRACKABLE = 0x04000000,
- PLAYER_STATE_FLAG_ALL = 0xFF000000,
-};
-
enum PlayerFlags
{
PLAYER_FLAGS_GROUP_LEADER = 0x00000001,
@@ -382,63 +380,71 @@ enum PlayerFlags
PLAYER_FLAGS_GM = 0x00000008,
PLAYER_FLAGS_GHOST = 0x00000010,
PLAYER_FLAGS_RESTING = 0x00000020,
- PLAYER_FLAGS_FFA_PVP = 0x00000080,
+ PLAYER_FLAGS_UNK7 = 0x00000040,
+ PLAYER_FLAGS_UNK8 = 0x00000080, // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state
PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards
PLAYER_FLAGS_IN_PVP = 0x00000200,
PLAYER_FLAGS_HIDE_HELM = 0x00000400,
PLAYER_FLAGS_HIDE_CLOAK = 0x00000800,
- PLAYER_FLAGS_UNK1 = 0x00001000, // played long time
- PLAYER_FLAGS_UNK2 = 0x00002000, // played too long time
- PLAYER_FLAGS_UNK3 = 0x00008000, // strange visual effect (2.0.1), looks like PLAYER_FLAGS_GHOST flag
- PLAYER_FLAGS_SANCTUARY = 0x00010000, // player entered sanctuary
- PLAYER_FLAGS_UNK4 = 0x00020000, // taxi benchmark mode (on/off) (2.0.1)
- PLAYER_UNK = 0x00040000, // 2.0.8...
+ PLAYER_FLAGS_UNK13 = 0x00001000, // played long time
+ PLAYER_FLAGS_UNK14 = 0x00002000, // played too long time
+ PLAYER_FLAGS_UNK15 = 0x00004000,
+ PLAYER_FLAGS_UNK16 = 0x00008000, // strange visual effect (2.0.1), looks like PLAYER_FLAGS_GHOST flag
+ PLAYER_FLAGS_UNK17 = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary
+ PLAYER_FLAGS_UNK18 = 0x00020000, // taxi benchmark mode (on/off) (2.0.1)
+ PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually)
+ PLAYER_FLAGS_UNK20 = 0x00080000,
+ PLAYER_FLAGS_UNK21 = 0x00100000,
+ PLAYER_FLAGS_UNK22 = 0x00200000,
+ PLAYER_FLAGS_UNK23 = 0x00400000,
+ PLAYER_ALLOW_ONLY_ABILITY = 0x00800000, // used by bladestorm and killing spree
+ PLAYER_FLAGS_UNK25 = 0x01000000 // disabled all melee ability on tab include autoattack
};
// used for PLAYER__FIELD_KNOWN_TITLES field (uint64), (1<<bit_index) without (-1)
// can't use enum for uint64 values
-#define PLAYER_TITLE_DISABLED 0x0000000000000000LL
-#define PLAYER_TITLE_NONE 0x0000000000000001LL
-#define PLAYER_TITLE_PRIVATE 0x0000000000000002LL // 1
-#define PLAYER_TITLE_CORPORAL 0x0000000000000004LL // 2
-#define PLAYER_TITLE_SERGEANT_A 0x0000000000000008LL // 3
-#define PLAYER_TITLE_MASTER_SERGEANT 0x0000000000000010LL // 4
-#define PLAYER_TITLE_SERGEANT_MAJOR 0x0000000000000020LL // 5
-#define PLAYER_TITLE_KNIGHT 0x0000000000000040LL // 6
-#define PLAYER_TITLE_KNIGHT_LIEUTENANT 0x0000000000000080LL // 7
-#define PLAYER_TITLE_KNIGHT_CAPTAIN 0x0000000000000100LL // 8
-#define PLAYER_TITLE_KNIGHT_CHAMPION 0x0000000000000200LL // 9
-#define PLAYER_TITLE_LIEUTENANT_COMMANDER 0x0000000000000400LL // 10
-#define PLAYER_TITLE_COMMANDER 0x0000000000000800LL // 11
-#define PLAYER_TITLE_MARSHAL 0x0000000000001000LL // 12
-#define PLAYER_TITLE_FIELD_MARSHAL 0x0000000000002000LL // 13
-#define PLAYER_TITLE_GRAND_MARSHAL 0x0000000000004000LL // 14
-#define PLAYER_TITLE_SCOUT 0x0000000000008000LL // 15
-#define PLAYER_TITLE_GRUNT 0x0000000000010000LL // 16
-#define PLAYER_TITLE_SERGEANT_H 0x0000000000020000LL // 17
-#define PLAYER_TITLE_SENIOR_SERGEANT 0x0000000000040000LL // 18
-#define PLAYER_TITLE_FIRST_SERGEANT 0x0000000000080000LL // 19
-#define PLAYER_TITLE_STONE_GUARD 0x0000000000100000LL // 20
-#define PLAYER_TITLE_BLOOD_GUARD 0x0000000000200000LL // 21
-#define PLAYER_TITLE_LEGIONNAIRE 0x0000000000400000LL // 22
-#define PLAYER_TITLE_CENTURION 0x0000000000800000LL // 23
-#define PLAYER_TITLE_CHAMPION 0x0000000001000000LL // 24
-#define PLAYER_TITLE_LIEUTENANT_GENERAL 0x0000000002000000LL // 25
-#define PLAYER_TITLE_GENERAL 0x0000000004000000LL // 26
-#define PLAYER_TITLE_WARLORD 0x0000000008000000LL // 27
-#define PLAYER_TITLE_HIGH_WARLORD 0x0000000010000000LL // 28
-#define PLAYER_TITLE_GLADIATOR 0x0000000020000000LL // 29
-#define PLAYER_TITLE_DUELIST 0x0000000040000000LL // 30
-#define PLAYER_TITLE_RIVAL 0x0000000080000000LL // 31
-#define PLAYER_TITLE_CHALLENGER 0x0000000100000000LL // 32
-#define PLAYER_TITLE_SCARAB_LORD 0x0000000200000000LL // 33
-#define PLAYER_TITLE_CONQUEROR 0x0000000400000000LL // 34
-#define PLAYER_TITLE_JUSTICAR 0x0000000800000000LL // 35
-#define PLAYER_TITLE_CHAMPION_OF_THE_NAARU 0x0000001000000000LL // 36
-#define PLAYER_TITLE_MERCILESS_GLADIATOR 0x0000002000000000LL // 37
-#define PLAYER_TITLE_OF_THE_SHATTERED_SUN 0x0000004000000000LL // 38
-#define PLAYER_TITLE_HAND_OF_ADAL 0x0000008000000000LL // 39
-#define PLAYER_TITLE_VENGEFUL_GLADIATOR 0x0000010000000000LL // 40
+#define PLAYER_TITLE_DISABLED UI64LIT(0x0000000000000000)
+#define PLAYER_TITLE_NONE UI64LIT(0x0000000000000001)
+#define PLAYER_TITLE_PRIVATE UI64LIT(0x0000000000000002) // 1
+#define PLAYER_TITLE_CORPORAL UI64LIT(0x0000000000000004) // 2
+#define PLAYER_TITLE_SERGEANT_A UI64LIT(0x0000000000000008) // 3
+#define PLAYER_TITLE_MASTER_SERGEANT UI64LIT(0x0000000000000010) // 4
+#define PLAYER_TITLE_SERGEANT_MAJOR UI64LIT(0x0000000000000020) // 5
+#define PLAYER_TITLE_KNIGHT UI64LIT(0x0000000000000040) // 6
+#define PLAYER_TITLE_KNIGHT_LIEUTENANT UI64LIT(0x0000000000000080) // 7
+#define PLAYER_TITLE_KNIGHT_CAPTAIN UI64LIT(0x0000000000000100) // 8
+#define PLAYER_TITLE_KNIGHT_CHAMPION UI64LIT(0x0000000000000200) // 9
+#define PLAYER_TITLE_LIEUTENANT_COMMANDER UI64LIT(0x0000000000000400) // 10
+#define PLAYER_TITLE_COMMANDER UI64LIT(0x0000000000000800) // 11
+#define PLAYER_TITLE_MARSHAL UI64LIT(0x0000000000001000) // 12
+#define PLAYER_TITLE_FIELD_MARSHAL UI64LIT(0x0000000000002000) // 13
+#define PLAYER_TITLE_GRAND_MARSHAL UI64LIT(0x0000000000004000) // 14
+#define PLAYER_TITLE_SCOUT UI64LIT(0x0000000000008000) // 15
+#define PLAYER_TITLE_GRUNT UI64LIT(0x0000000000010000) // 16
+#define PLAYER_TITLE_SERGEANT_H UI64LIT(0x0000000000020000) // 17
+#define PLAYER_TITLE_SENIOR_SERGEANT UI64LIT(0x0000000000040000) // 18
+#define PLAYER_TITLE_FIRST_SERGEANT UI64LIT(0x0000000000080000) // 19
+#define PLAYER_TITLE_STONE_GUARD UI64LIT(0x0000000000100000) // 20
+#define PLAYER_TITLE_BLOOD_GUARD UI64LIT(0x0000000000200000) // 21
+#define PLAYER_TITLE_LEGIONNAIRE UI64LIT(0x0000000000400000) // 22
+#define PLAYER_TITLE_CENTURION UI64LIT(0x0000000000800000) // 23
+#define PLAYER_TITLE_CHAMPION UI64LIT(0x0000000001000000) // 24
+#define PLAYER_TITLE_LIEUTENANT_GENERAL UI64LIT(0x0000000002000000) // 25
+#define PLAYER_TITLE_GENERAL UI64LIT(0x0000000004000000) // 26
+#define PLAYER_TITLE_WARLORD UI64LIT(0x0000000008000000) // 27
+#define PLAYER_TITLE_HIGH_WARLORD UI64LIT(0x0000000010000000) // 28
+#define PLAYER_TITLE_GLADIATOR UI64LIT(0x0000000020000000) // 29
+#define PLAYER_TITLE_DUELIST UI64LIT(0x0000000040000000) // 30
+#define PLAYER_TITLE_RIVAL UI64LIT(0x0000000080000000) // 31
+#define PLAYER_TITLE_CHALLENGER UI64LIT(0x0000000100000000) // 32
+#define PLAYER_TITLE_SCARAB_LORD UI64LIT(0x0000000200000000) // 33
+#define PLAYER_TITLE_CONQUEROR UI64LIT(0x0000000400000000) // 34
+#define PLAYER_TITLE_JUSTICAR UI64LIT(0x0000000800000000) // 35
+#define PLAYER_TITLE_CHAMPION_OF_THE_NAARU UI64LIT(0x0000001000000000) // 36
+#define PLAYER_TITLE_MERCILESS_GLADIATOR UI64LIT(0x0000002000000000) // 37
+#define PLAYER_TITLE_OF_THE_SHATTERED_SUN UI64LIT(0x0000004000000000) // 38
+#define PLAYER_TITLE_HAND_OF_ADAL UI64LIT(0x0000008000000000) // 39
+#define PLAYER_TITLE_VENGEFUL_GLADIATOR UI64LIT(0x0000010000000000) // 40
// used in PLAYER_FIELD_BYTES values
enum PlayerFieldByteFlags
@@ -472,17 +478,7 @@ enum ActivateTaxiReplies
ERR_TAXINOTSTANDING = 12
};
-enum LootType
-{
- LOOT_CORPSE = 1,
- LOOT_SKINNING = 2,
- LOOT_FISHING = 3,
- LOOT_PICKPOCKETING = 4, // unsupported by client, sending LOOT_SKINNING instead
- LOOT_DISENCHANTING = 5, // unsupported by client, sending LOOT_SKINNING instead
- LOOT_PROSPECTING = 6, // unsupported by client, sending LOOT_SKINNING instead
- LOOT_INSIGNIA = 7, // unsupported by client, sending LOOT_SKINNING instead
- LOOT_FISHINGHOLE = 8 // unsupported by client, sending LOOT_FISHING instead
-};
+
enum MirrorTimerType
{
@@ -490,6 +486,8 @@ enum MirrorTimerType
BREATH_TIMER = 1,
FIRE_TIMER = 2
};
+#define MAX_TIMERS 3
+#define DISABLED_MIRROR_TIMER -1
// 2^n values
enum PlayerExtraFlags
@@ -511,7 +509,8 @@ enum AtLoginFlags
AT_LOGIN_NONE = 0,
AT_LOGIN_RENAME = 1,
AT_LOGIN_RESET_SPELLS = 2,
- AT_LOGIN_RESET_TALENTS = 4
+ AT_LOGIN_RESET_TALENTS = 4,
+ AT_LOGIN_CUSTOMIZE = 8,
};
typedef std::map<uint32, QuestStatusData> QuestStatusMap;
@@ -543,11 +542,13 @@ enum PlayerSlots
// first slot for item stored (in any way in player m_items data)
PLAYER_SLOT_START = 0,
// last+1 slot for item stored (in any way in player m_items data)
- PLAYER_SLOT_END = 118,
+ PLAYER_SLOT_END = 200,
PLAYER_SLOTS_COUNT = (PLAYER_SLOT_END - PLAYER_SLOT_START)
};
-enum EquipmentSlots
+#define INVENTORY_SLOT_BAG_0 255
+
+enum EquipmentSlots // 19 slots
{
EQUIPMENT_SLOT_START = 0,
EQUIPMENT_SLOT_HEAD = 0,
@@ -572,111 +573,67 @@ enum EquipmentSlots
EQUIPMENT_SLOT_END = 19
};
-enum InventorySlots
+enum InventorySlots // 4 slots
{
- INVENTORY_SLOT_BAG_0 = 255,
INVENTORY_SLOT_BAG_START = 19,
- INVENTORY_SLOT_BAG_1 = 19,
- INVENTORY_SLOT_BAG_2 = 20,
- INVENTORY_SLOT_BAG_3 = 21,
- INVENTORY_SLOT_BAG_4 = 22,
- INVENTORY_SLOT_BAG_END = 23,
+ INVENTORY_SLOT_BAG_END = 23
+};
+enum InventoryPackSlots // 16 slots
+{
INVENTORY_SLOT_ITEM_START = 23,
- INVENTORY_SLOT_ITEM_1 = 23,
- INVENTORY_SLOT_ITEM_2 = 24,
- INVENTORY_SLOT_ITEM_3 = 25,
- INVENTORY_SLOT_ITEM_4 = 26,
- INVENTORY_SLOT_ITEM_5 = 27,
- INVENTORY_SLOT_ITEM_6 = 28,
- INVENTORY_SLOT_ITEM_7 = 29,
- INVENTORY_SLOT_ITEM_8 = 30,
- INVENTORY_SLOT_ITEM_9 = 31,
- INVENTORY_SLOT_ITEM_10 = 32,
- INVENTORY_SLOT_ITEM_11 = 33,
- INVENTORY_SLOT_ITEM_12 = 34,
- INVENTORY_SLOT_ITEM_13 = 35,
- INVENTORY_SLOT_ITEM_14 = 36,
- INVENTORY_SLOT_ITEM_15 = 37,
- INVENTORY_SLOT_ITEM_16 = 38,
INVENTORY_SLOT_ITEM_END = 39
};
-enum BankSlots
+enum BankItemSlots // 28 slots
{
BANK_SLOT_ITEM_START = 39,
- BANK_SLOT_ITEM_1 = 39,
- BANK_SLOT_ITEM_2 = 40,
- BANK_SLOT_ITEM_3 = 41,
- BANK_SLOT_ITEM_4 = 42,
- BANK_SLOT_ITEM_5 = 43,
- BANK_SLOT_ITEM_6 = 44,
- BANK_SLOT_ITEM_7 = 45,
- BANK_SLOT_ITEM_8 = 46,
- BANK_SLOT_ITEM_9 = 47,
- BANK_SLOT_ITEM_10 = 48,
- BANK_SLOT_ITEM_11 = 49,
- BANK_SLOT_ITEM_12 = 50,
- BANK_SLOT_ITEM_13 = 51,
- BANK_SLOT_ITEM_14 = 52,
- BANK_SLOT_ITEM_15 = 53,
- BANK_SLOT_ITEM_16 = 54,
- BANK_SLOT_ITEM_17 = 55,
- BANK_SLOT_ITEM_18 = 56,
- BANK_SLOT_ITEM_19 = 57,
- BANK_SLOT_ITEM_20 = 58,
- BANK_SLOT_ITEM_21 = 59,
- BANK_SLOT_ITEM_22 = 60,
- BANK_SLOT_ITEM_23 = 61,
- BANK_SLOT_ITEM_24 = 62,
- BANK_SLOT_ITEM_25 = 63,
- BANK_SLOT_ITEM_26 = 64,
- BANK_SLOT_ITEM_27 = 65,
- BANK_SLOT_ITEM_28 = 66,
- BANK_SLOT_ITEM_END = 67,
+ BANK_SLOT_ITEM_END = 67
+};
+enum BankBagSlots // 7 slots
+{
BANK_SLOT_BAG_START = 67,
- BANK_SLOT_BAG_1 = 67,
- BANK_SLOT_BAG_2 = 68,
- BANK_SLOT_BAG_3 = 69,
- BANK_SLOT_BAG_4 = 70,
- BANK_SLOT_BAG_5 = 71,
- BANK_SLOT_BAG_6 = 72,
- BANK_SLOT_BAG_7 = 73,
BANK_SLOT_BAG_END = 74
};
-enum BuyBackSlots
+enum BuyBackSlots // 12 slots
{
// stored in m_buybackitems
BUYBACK_SLOT_START = 74,
- BUYBACK_SLOT_1 = 74,
- BUYBACK_SLOT_2 = 75,
- BUYBACK_SLOT_3 = 76,
- BUYBACK_SLOT_4 = 77,
- BUYBACK_SLOT_5 = 78,
- BUYBACK_SLOT_6 = 79,
- BUYBACK_SLOT_7 = 80,
- BUYBACK_SLOT_8 = 81,
- BUYBACK_SLOT_9 = 82,
- BUYBACK_SLOT_10 = 83,
- BUYBACK_SLOT_11 = 84,
- BUYBACK_SLOT_12 = 85,
BUYBACK_SLOT_END = 86
};
-enum KeyRingSlots
+enum KeyRingSlots // 32 slots
{
KEYRING_SLOT_START = 86,
KEYRING_SLOT_END = 118
};
+enum VanityPetSlots // 18 slots
+{
+ VANITYPET_SLOT_START = 118, // not use, vanity pets stored as spells
+ VANITYPET_SLOT_END = 136 // not allowed any content in.
+};
+
+enum CurrencyTokenSlots // 32 slots
+{
+ CURRENCYTOKEN_SLOT_START = 136,
+ CURRENCYTOKEN_SLOT_END = 168
+};
+
+enum QuestBagSlots // 32 slots
+{
+ QUESTBAG_SLOT_START = 168, // not use
+ QUESTBAG_SLOT_END = 200 // not allowed any content in.
+};
+
struct ItemPosCount
{
- ItemPosCount(uint16 _pos, uint8 _count) : pos(_pos), count(_count) {}
+ ItemPosCount(uint16 _pos, uint32 _count) : pos(_pos), count(_count) {}
bool isContainedIn(std::vector<ItemPosCount> const& vec) const;
uint16 pos;
- uint8 count;
+ uint32 count;
};
typedef std::vector<ItemPosCount> ItemPosCountVec;
@@ -689,14 +646,15 @@ enum TradeSlots
enum TransferAbortReason
{
- TRANSFER_ABORT_MAX_PLAYERS = 0x0001, // Transfer Aborted: instance is full
- TRANSFER_ABORT_NOT_FOUND = 0x0002, // Transfer Aborted: instance not found
- TRANSFER_ABORT_TOO_MANY_INSTANCES = 0x0003, // You have entered too many instances recently.
- TRANSFER_ABORT_ZONE_IN_COMBAT = 0x0005, // Unable to zone in while an encounter is in progress.
- TRANSFER_ABORT_INSUF_EXPAN_LVL1 = 0x0106, // You must have TBC expansion installed to access this area.
- TRANSFER_ABORT_DIFFICULTY1 = 0x0007, // Normal difficulty mode is not available for %s.
- TRANSFER_ABORT_DIFFICULTY2 = 0x0107, // Heroic difficulty mode is not available for %s.
- TRANSFER_ABORT_DIFFICULTY3 = 0x0207 // Epic difficulty mode is not available for %s.
+ TRANSFER_ABORT_ERROR = 0x00,
+ TRANSFER_ABORT_MAX_PLAYERS = 0x01, // Transfer Aborted: instance is full
+ TRANSFER_ABORT_NOT_FOUND = 0x02, // Transfer Aborted: instance not found
+ TRANSFER_ABORT_TOO_MANY_INSTANCES = 0x03, // You have entered too many instances recently.
+ TRANSFER_ABORT_ZONE_IN_COMBAT = 0x05, // Unable to zone in while an encounter is in progress.
+ TRANSFER_ABORT_INSUF_EXPAN_LVL = 0x06, // You must have <TBC,WotLK> expansion installed to access this area.
+ TRANSFER_ABORT_DIFFICULTY = 0x07, // <Normal,Heroic,Epic> difficulty mode is not available for %s.
+ TRANSFER_ABORT_UNIQUE_MESSAGE = 0x08, // Until you've escaped TLK's grasp, you cannot leave this place!
+ TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 0x09 // Additional instances cannot be launched, please try again later.
};
enum InstanceResetWarningType
@@ -707,41 +665,6 @@ enum InstanceResetWarningType
RAID_INSTANCE_WELCOME = 4 // Welcome to %s. This raid instance is scheduled to reset in %s.
};
-struct MovementInfo
-{
- // common
- //uint32 flags;
- uint8 unk1;
- uint32 time;
- float x, y, z, o;
- // transport
- uint64 t_guid;
- float t_x, t_y, t_z, t_o;
- uint32 t_time;
- // swimming and unk
- float s_pitch;
- // last fall time
- uint32 fallTime;
- // jumping
- float j_unk, j_sinAngle, j_cosAngle, j_xyspeed;
- // spline
- float u_unk1;
-
- MovementInfo()
- {
- //flags =
- time = t_time = fallTime = 0;
- unk1 = 0;
- x = y = z = o = t_x = t_y = t_z = t_o = s_pitch = j_unk = j_sinAngle = j_cosAngle = j_xyspeed = u_unk1 = 0.0f;
- t_guid = 0;
- }
-
- /*void SetMovementFlags(uint32 _flags)
- {
- flags = _flags;
- }*/
-};
-
// flags that use in movement check for example at spell casting
MovementFlags const movementFlagsMask = MovementFlags(
MOVEMENTFLAG_FORWARD |MOVEMENTFLAG_BACKWARD |MOVEMENTFLAG_STRAFE_LEFT|MOVEMENTFLAG_STRAFE_RIGHT|
@@ -812,8 +735,9 @@ enum PlayerLoginQueryIndex
PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES = 16,
PLAYER_LOGIN_QUERY_LOADGUILD = 17,
PLAYER_LOGIN_QUERY_LOADARENAINFO = 18,
-
- MAX_PLAYER_LOGIN_QUERY
+ PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS = 19,
+ PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS = 20,
+ MAX_PLAYER_LOGIN_QUERY = 21
};
// Player summoning auto-decline time (in secs)
@@ -842,7 +766,7 @@ struct AccessRequirement
std::string questFailedText;
uint32 heroicQuest;
std::string heroicQuestFailedText;
- };
+};
class TRINITY_DLL_SPEC PlayerTaxi
{
@@ -850,11 +774,9 @@ class TRINITY_DLL_SPEC PlayerTaxi
PlayerTaxi();
~PlayerTaxi() {}
// Nodes
- void InitTaxiNodesForLevel(uint32 race, uint32 level);
+ void InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint32 level);
void LoadTaxiMask(const char* data);
- void SaveTaxiMask(const char* data);
- uint32 GetTaximask( uint8 index ) const { return m_taximask[index]; }
bool IsTaximaskNodeKnown(uint32 nodeidx) const
{
uint8 field = uint8((nodeidx - 1) / 32);
@@ -876,7 +798,7 @@ class TRINITY_DLL_SPEC PlayerTaxi
void AppendTaximaskTo(ByteBuffer& data,bool all);
// Destinations
- bool LoadTaxiDestinationsFromString(const std::string& values);
+ bool LoadTaxiDestinationsFromString(const std::string& values, uint32 team);
std::string SaveTaxiDestinationsToString();
void ClearTaxiDestinations() { m_TaxiDestinations.clear(); }
@@ -890,11 +812,15 @@ class TRINITY_DLL_SPEC PlayerTaxi
return GetTaxiDestination();
}
bool empty() const { return m_TaxiDestinations.empty(); }
+
+ friend std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi);
private:
TaxiMask m_taximask;
std::deque<uint32> m_TaxiDestinations;
};
+std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi);
+
class TRINITY_DLL_SPEC Player : public Unit
{
friend class WorldSession;
@@ -912,16 +838,6 @@ class TRINITY_DLL_SPEC Player : public Unit
void AddToWorld();
void RemoveFromWorld();
- void SetViewport(uint64 guid, bool movable);
- void StopCastingCharm() { Uncharm(); }
- void StopCastingBindSight();
- WorldObject* GetFarsightTarget() const;
- void ClearFarsight();
- void SetFarsightTarget(WorldObject* target);
- // Controls if vision is currently on farsight object, updated in FAR_SIGHT opcode
- void SetFarsightVision(bool apply) { m_farsightVision = apply; }
- bool HasFarsightVision() const { return m_farsightVision; }
-
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0);
bool TeleportTo(WorldLocation const &loc, uint32 options = 0)
@@ -952,10 +868,12 @@ class TRINITY_DLL_SPEC Player : public Unit
void SendInitialPacketsBeforeAddToMap();
void SendInitialPacketsAfterAddToMap();
- void SendTransferAborted(uint32 mapid, uint16 reason);
+ void SendTransferAborted(uint32 mapid, uint8 reason, uint8 arg = 0);
void SendInstanceResetWarning(uint32 mapid, uint32 time);
+ Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask);
bool CanInteractWithNPCs(bool alive = true) const;
+ GameObject* GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const;
bool ToggleAFK();
bool ToggleDND();
@@ -965,11 +883,14 @@ class TRINITY_DLL_SPEC Player : public Unit
std::string afkMsg;
std::string dndMsg;
+ uint32 GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair);
+
PlayerSocial *GetSocial() { return m_social; }
PlayerTaxi m_taxi;
- void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(getRace(),getLevel()); }
- bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, uint32 mount_id = 0 , Creature* npc = NULL);
+ void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(getRace(), getClass(), getLevel()); }
+ bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc = NULL, uint32 spellid = 0);
+ bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 0);
// mount_id can be used in scripting calls
bool isAcceptWhispers() const { return m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS; }
void SetAcceptWhispers(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; }
@@ -985,6 +906,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void GiveXP(uint32 xp, Unit* victim);
void GiveLevel(uint32 level);
+
void InitStatsForLevel(bool reapplyMods = false);
// Played Time Stuff
@@ -1019,16 +941,10 @@ class TRINITY_DLL_SPEC Player : public Unit
int GetTimeInnEnter() const { return time_inn_enter; };
void UpdateInnerTime (int time) { time_inn_enter = time; };
+ Pet* GetPet() const;
Pet* SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 despwtime);
void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false);
- void RemoveMiniPet();
- Pet* GetMiniPet();
- void SetMiniPet(Pet* pet) { m_miniPet = pet->GetGUID(); }
- void RemoveGuardians();
- bool HasGuardianWithEntry(uint32 entry);
- void AddGuardian(Pet* pet) { m_guardianPets.insert(pet->GetGUID()); }
- GuardianPetList const& GetGuardians() const { return m_guardianPets; }
- void Uncharm();
+ uint32 GetPhaseMaskForSpawn() const; // used for proper set phase for DB at GM-mode creature/GO spawn
void Say(const std::string& text, const uint32 language);
void Yell(const std::string& text, const uint32 language);
@@ -1041,15 +957,21 @@ class TRINITY_DLL_SPEC Player : public Unit
/*********************************************************/
void SetVirtualItemSlot( uint8 i, Item* item);
- void SetSheath( uint32 sheathed );
+ void SetSheath( SheathState sheathed ); // overwrite Unit version
uint8 FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap ) const;
uint32 GetItemCount( uint32 item, bool inBankAlso = false, Item* skipItem = NULL ) const;
Item* GetItemByGuid( uint64 guid ) const;
Item* GetItemByPos( uint16 pos ) const;
Item* GetItemByPos( uint8 bag, uint8 slot ) const;
+ inline Item* GetUseableItemByPos( uint8 bag, uint8 slot ) const //Does additional check for disarmed weapons
+ {
+ if (!CanUseAttackType(GetAttackBySlot(slot)))
+ return NULL;
+ return GetItemByPos(bag, slot);
+ }
Item* GetWeaponForAttack(WeaponAttackType attackType, bool useable = false) const;
Item* GetShield(bool useable = false) const;
- static uint32 GetAttackBySlot( uint8 slot ); // MAX_ATTACK if not weapon slot
+ static uint8 GetAttackBySlot( uint8 slot ); // MAX_ATTACK if not weapon slot
std::vector<Item *> &GetItemUpdateQueue() { return m_itemUpdateQueue; }
static bool IsInventoryPos( uint16 pos ) { return IsInventoryPos(pos >> 8,pos & 255); }
static bool IsInventoryPos( uint8 bag, uint8 slot );
@@ -1060,10 +982,13 @@ class TRINITY_DLL_SPEC Player : public Unit
static bool IsBankPos( uint8 bag, uint8 slot );
bool IsValidPos( uint16 pos ) { return IsBankPos(pos >> 8,pos & 255); }
bool IsValidPos( uint8 bag, uint8 slot );
- bool HasBankBagSlot( uint8 slot ) const;
+ uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, 2); }
+ void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, 2, count); }
bool HasItemCount( uint32 item, uint32 count, bool inBankAlso = false ) const;
bool HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item const* ignoreItem = NULL);
- Item* GetItemOrItemWithGemEquipped( uint32 item ) const;
+ bool CanNoReagentCast(SpellEntry const* spellInfo) const;
+ bool HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const;
+ bool HasItemOrGemWithLimitCategoryEquipped( uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const;
uint8 CanTakeMoreSimilarItems(Item* pItem) const { return _CanTakeMoreSimilarItems(pItem->GetEntry(),pItem->GetCount(),pItem); }
uint8 CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return _CanTakeMoreSimilarItems(entry,count,NULL); }
uint8 CanStoreNewItem( uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = NULL ) const
@@ -1081,6 +1006,9 @@ class TRINITY_DLL_SPEC Player : public Unit
uint8 CanStoreItems( Item **pItem,int count) const;
uint8 CanEquipNewItem( uint8 slot, uint16 &dest, uint32 item, bool swap ) const;
uint8 CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading = true ) const;
+
+ uint8 CanEquipUniqueItem( Item * pItem, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1 ) const;
+ uint8 CanEquipUniqueItem( ItemPrototype const* itemProto, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1 ) const;
uint8 CanUnequipItems( uint32 item, uint32 count ) const;
uint8 CanUnequipItem( uint16 src, bool swap ) const;
uint8 CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec& dest, Item *pItem, bool swap, bool not_loading = true ) const;
@@ -1094,6 +1022,8 @@ class TRINITY_DLL_SPEC Player : public Unit
Item* EquipItem( uint16 pos, Item *pItem, bool update );
void AutoUnequipOffhandIfNeed();
bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count);
+ void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, bool broadcast = false);
+ void AutoStoreLoot(uint32 loot_id, LootStore const& store, bool broadcast = false) { AutoStoreLoot(NULL_BAG,NULL_SLOT,loot_id,store,broadcast); }
uint8 _CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const;
uint8 _CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item *pItem = NULL, bool swap = false, uint32* no_space_count = NULL ) const;
@@ -1135,12 +1065,16 @@ class TRINITY_DLL_SPEC Player : public Unit
void AddArmorProficiency(uint32 newflag) { m_ArmorProficiency |= newflag; }
uint32 GetWeaponProficiency() const { return m_WeaponProficiency; }
uint32 GetArmorProficiency() const { return m_ArmorProficiency; }
- bool IsInFeralForm() const { return m_form == FORM_CAT || m_form == FORM_BEAR || m_form == FORM_DIREBEAR; }
bool IsUseEquipedWeapon( bool mainhand ) const
{
// disarm applied only to mainhand weapon
return !IsInFeralForm() && (!mainhand || !HasFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISARMED) );
}
+ bool IsTwoHandUsed() const
+ {
+ Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
+ return mainItem && mainItem->GetProto()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip();
+ }
void SendNewItem( Item *item, uint32 count, bool received, bool created, bool broadcast = false );
bool BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint64 bagguid, uint8 slot);
@@ -1154,7 +1088,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void UpdateItemDuration(uint32 time, bool realtimeonly=false);
void AddEnchantmentDurations(Item *item);
void RemoveEnchantmentDurations(Item *item);
- void RemoveAllEnchantments(EnchantmentSlot slot, bool arena);
+ void RemoveArenaEnchantments(EnchantmentSlot slot);
void AddEnchantmentDuration(Item *item,EnchantmentSlot slot,uint32 duration);
void ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool apply_dur = true, bool ignore_condition = false);
void ApplyEnchantment(Item *item,bool apply);
@@ -1171,6 +1105,8 @@ class TRINITY_DLL_SPEC Player : public Unit
/*** QUEST SYSTEM ***/
/*********************************************************/
+ uint32 GetQuestLevel( Quest const* pQuest ) const { return pQuest && pQuest->GetQuestLevel() ? pQuest->GetQuestLevel() : getLevel(); }
+
void PrepareQuestMenu( uint64 guid );
void SendPreparedQuest( uint64 guid );
bool IsActiveQuest( uint32 quest_id ) const;
@@ -1238,7 +1174,6 @@ class TRINITY_DLL_SPEC Player : public Unit
}
}
uint32 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry);
- void AdjustQuestReqItemCount( Quest const* pQuest );
void AreaExploredOrEventHappens( uint32 questId );
void GroupEventHappens( uint32 questId, WorldObject const* pEventObject );
void ItemAddedQuestCheck( uint32 entry, uint32 count );
@@ -1247,9 +1182,10 @@ class TRINITY_DLL_SPEC Player : public Unit
void CastedCreatureOrGO( uint32 entry, uint64 guid, uint32 spell_id );
void TalkedToCreature( uint32 entry, uint64 guid );
void MoneyChanged( uint32 value );
+ void ReputationChanged(FactionEntry const* factionEntry );
bool HasQuestForItem( uint32 itemid ) const;
- bool HasQuestForGO(int32 GOId);
- void UpdateForQuestsGO();
+ bool HasQuestForGO(int32 GOId) const;
+ void UpdateForQuestWorldObjects();
bool CanShareQuest(uint32 quest_id) const;
void SendQuestComplete( uint32 quest_id );
@@ -1275,6 +1211,7 @@ class TRINITY_DLL_SPEC Player : public Unit
/*********************************************************/
bool LoadFromDB(uint32 guid, SqlQueryHolder *holder);
+
bool MinimalLoadFromDB(QueryResult *result, uint32 guid);
static bool LoadValuesArrayFromDB(Tokens& data,uint64 guid);
static uint32 GetUInt32ValueFromArray(Tokens const& data, uint16 index);
@@ -1296,6 +1233,7 @@ class TRINITY_DLL_SPEC Player : public Unit
static void SetFloatValueInArray(Tokens& data,uint16 index, float value);
static void SetUInt32ValueInDB(uint16 index, uint32 value, uint64 guid);
static void SetFloatValueInDB(uint16 index, float value, uint64 guid);
+ static void Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair);
static void SavePositionInDB(uint32 mapid, float x,float y,float z,float o,uint32 zone,uint64 guid);
bool m_mailsLoaded;
@@ -1328,6 +1266,7 @@ class TRINITY_DLL_SPEC Player : public Unit
{
SetUInt32Value (PLAYER_FIELD_COINAGE, value);
MoneyChanged( value );
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED);
}
uint32 GetTutorialInt(uint32 intId )
@@ -1352,13 +1291,13 @@ class TRINITY_DLL_SPEC Player : public Unit
void SetSelection(const uint64 &guid) { m_curSelection = guid; SetUInt64Value(UNIT_FIELD_TARGET, guid); }
uint8 GetComboPoints() { return m_comboPoints; }
- uint64 GetComboTarget() { return m_comboTarget; }
+ const uint64& GetComboTarget() const { return m_comboTarget; }
void AddComboPoints(Unit* target, int8 count);
void ClearComboPoints();
void SendComboPoints();
- void SendMailResult(uint32 mailId, uint32 mailAction, uint32 mailError, uint32 equipError = 0, uint32 item_guid = 0, uint32 item_count = 0);
+ void SendMailResult(uint32 mailId, MailResponseType mailAction, MailResponseResult mailError, uint32 equipError = 0, uint32 item_guid = 0, uint32 item_count = 0);
void SendNewMail();
void UpdateNextMailTimeAndUnreads();
void AddNewMailDeliverTime(time_t deliver_time);
@@ -1388,10 +1327,7 @@ class TRINITY_DLL_SPEC Player : public Unit
Item* GetMItem(uint32 id)
{
ItemMap::const_iterator itr = mMitems.find(id);
- if (itr != mMitems.end())
- return itr->second;
-
- return NULL;
+ return itr != mMitems.end() ? itr->second : NULL;
}
void AddMItem(Item* it)
@@ -1403,30 +1339,30 @@ class TRINITY_DLL_SPEC Player : public Unit
bool RemoveMItem(uint32 id)
{
- ItemMap::iterator i = mMitems.find(id);
- if (i == mMitems.end())
- return false;
-
- mMitems.erase(i);
- return true;
+ return mMitems.erase(id) ? true : false;
}
void PetSpellInitialize();
void CharmSpellInitialize();
void PossessSpellInitialize();
+ void VehicleSpellInitialize();
+ void SendRemoveControlBar();
bool HasSpell(uint32 spell) const;
+ bool HasActiveSpell(uint32 spell) const; // show in spellbook
TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const;
bool IsSpellFitByClassAndRace( uint32 spell_id ) const;
+ bool IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const;
void SendProficiency(uint8 pr1, uint32 pr2);
void SendInitialSpells();
- bool addSpell(uint32 spell_id, bool active, bool learning = true, bool loading = false, uint16 slot_id=SPELL_WITHOUT_SLOT_ID, bool disabled = false);
- void learnSpell(uint32 spell_id);
- void removeSpell(uint32 spell_id, bool disabled = false);
+ bool addSpell(uint32 spell_id, bool active, bool learning, bool dependent, bool disabled);
+ void learnSpell(uint32 spell_id, bool dependent);
+ void removeSpell(uint32 spell_id, bool disabled = false, bool update_action_bar_for_low_rank = false);
void resetSpells();
- void learnDefaultSpells(bool loading = false);
+ void learnDefaultSpells();
void learnQuestRewardedSpells();
void learnQuestRewardedSpells(Quest const* quest);
+ void learnSpellHighRank(uint32 spellid);
uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); }
void SetFreeTalentPoints(uint32 points) { SetUInt32Value(PLAYER_CHARACTER_POINTS1,points); }
@@ -1434,20 +1370,31 @@ class TRINITY_DLL_SPEC Player : public Unit
uint32 resetTalentsCost() const;
void InitTalentForLevel();
- uint32 GetFreePrimaryProffesionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS2); }
- void SetFreePrimaryProffesions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS2,profs); }
- void InitPrimaryProffesions();
+ void LearnTalent(uint32 talentId, uint32 talentRank);
+ void LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank);
+
+ uint32 CalculateTalentsPoints() const;
+
+ void InitGlyphsForLevel();
+ void SetGlyphSlot(uint8 slot, uint32 slottype) { SetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot, slottype); }
+ uint32 GetGlyphSlot(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot); }
+ void SetGlyph(uint8 slot, uint32 glyph) { SetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot, glyph); }
+ uint32 GetGlyph(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot); }
+
+ uint32 GetFreePrimaryProfessionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS2); }
+ void SetFreePrimaryProfessions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS2, profs); }
+ void InitPrimaryProfessions();
PlayerSpellMap const& GetSpellMap() const { return m_spells; }
PlayerSpellMap & GetSpellMap() { return m_spells; }
void AddSpellMod(SpellModifier* mod, bool apply);
- int32 GetTotalFlatMods(uint32 spellId, SpellModOp op);
- int32 GetTotalPctMods(uint32 spellId, SpellModOp op);
- bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell const* spell = NULL);
- template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell const* spell = NULL);
- void RemoveSpellMods(Spell const* spell);
- void RestoreSpellMods(Spell const* spell);
+ bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell * spell = NULL);
+ template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell * spell = NULL);
+ void RemoveSpellMods(Spell * spell);
+ void RestoreSpellMods(Spell * spell);
+ void DropModCharge(SpellModifier * mod, Spell * spell);
+ void SetSpellModTakingSpell(Spell* spell, bool apply);
bool HasSpellCooldown(uint32 spell_id) const
{
@@ -1460,14 +1407,18 @@ class TRINITY_DLL_SPEC Player : public Unit
time_t t = time(NULL);
return itr != m_spellCooldowns.end() && itr->second.end > t ? itr->second.end - t : 0;
}
+ void AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 itemId, Spell* spell = NULL, bool infinityCooldown = false );
void AddSpellCooldown(uint32 spell_id, uint32 itemid, time_t end_time);
- void SendCooldownEvent(SpellEntry const *spellInfo);
+ void SendCooldownEvent(SpellEntry const *spellInfo, uint32 itemId = 0, Spell* spell = NULL);
void ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs );
- void RemoveSpellCooldown(uint32 spell_id) { m_spellCooldowns.erase(spell_id); }
+ void RemoveSpellCooldown(uint32 spell_id, bool update = false);
+ void RemoveCategoryCooldown(uint32 cat);
void RemoveArenaSpellCooldowns();
void RemoveAllSpellCooldown();
void _LoadSpellCooldowns(QueryResult *result);
void _SaveSpellCooldowns();
+ void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; }
+ void UpdatePotionCooldown(Spell* spell = NULL);
void setResurrectRequestData(uint64 guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana)
{
@@ -1493,13 +1444,20 @@ class TRINITY_DLL_SPEC Player : public Unit
m_cinematic = cine;
}
- void addActionButton(uint8 button, uint16 action, uint8 type, uint8 misc);
+ bool addActionButton(uint8 button, uint16 action, uint8 type, uint8 misc);
void removeActionButton(uint8 button);
- void SendInitialActionButtons();
+ void SendInitialActionButtons() const;
PvPInfo pvpInfo;
+ void UpdatePvPState(bool onlyFFA = false);
+ void SetPvP(bool state)
+ {
+ Unit::SetPvP(state);
+ for(ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
+ (*itr)->SetPvP(state);
+ }
void UpdatePvP(bool state, bool ovrride=false);
- void UpdateZone(uint32 newZone);
+ void UpdateZone(uint32 newZone,uint32 newArea);
void UpdateArea(uint32 newArea);
void UpdateZoneDependentAuras( uint32 zone_id ); // zones
@@ -1549,6 +1507,7 @@ class TRINITY_DLL_SPEC Player : public Unit
static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot);
void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; }
uint32 GetArenaTeamIdInvited() { return m_ArenaTeamIdInvited; }
+ static void LeaveAllArenaTeams(uint64 guid);
void SetDifficulty(uint32 dungeon_difficulty) { m_dungeonDifficulty = dungeon_difficulty; }
uint8 GetDifficulty() { return m_dungeonDifficulty; }
@@ -1574,9 +1533,12 @@ class TRINITY_DLL_SPEC Player : public Unit
void UpdateArmor();
void UpdateMaxHealth();
void UpdateMaxPower(Powers power);
+ void ApplyFeralAPBonus(int32 amount, bool apply);
void UpdateAttackPowerAndDamage(bool ranged = false);
void UpdateShieldBlockValue();
void UpdateDamagePhysical(WeaponAttackType attType);
+ void ApplySpellDamageBonus(int32 amount, bool apply);
+ void ApplySpellHealingBonus(int32 amount, bool apply);
void UpdateSpellDamageAndHealingBonus();
void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, float& min_damage, float& max_damage);
@@ -1594,6 +1556,8 @@ class TRINITY_DLL_SPEC Player : public Unit
uint32 GetRangedCritDamageReduction(uint32 damage) const;
uint32 GetSpellCritDamageReduction(uint32 damage) const;
uint32 GetDotDamageReduction(uint32 damage) const;
+ uint32 GetBaseSpellDamageBonus() { return m_baseSpellDamage;}
+ uint32 GetBaseSpellHealingBonus() { return m_baseSpellHealing;}
float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const;
void UpdateBlockPercentage();
@@ -1601,9 +1565,14 @@ class TRINITY_DLL_SPEC Player : public Unit
void UpdateAllCritPercentages();
void UpdateParryPercentage();
void UpdateDodgePercentage();
+ void UpdateMeleeHitChances();
+ void UpdateRangedHitChances();
+ void UpdateSpellHitChances();
+
void UpdateAllSpellCritChances();
void UpdateSpellCritChance(uint32 school);
void UpdateExpertise(WeaponAttackType attType);
+ void ApplyManaRegenBonus(int32 amount, bool apply);
void UpdateManaRegen();
const uint64& GetLootGUID() const { return m_lootGuid; }
@@ -1619,8 +1588,6 @@ class TRINITY_DLL_SPEC Player : public Unit
void SendDelayResponse(const uint32);
void SendLogXPGain(uint32 GivenXP,Unit* victim,uint32 RestXP);
- //Low Level Packets
- void PlaySound(uint32 Sound, bool OnlySelf);
//notifiers
void SendAttackSwingCantAttack();
void SendAttackSwingCancelAttack();
@@ -1640,9 +1607,9 @@ class TRINITY_DLL_SPEC Player : public Unit
bool SetPosition(float x, float y, float z, float orientation, bool teleport = false);
void UpdateUnderwaterState( Map * m, float x, float y, float z );
- void SendMessageToSet(WorldPacket *data, bool self, bool to_possessor = true);// overwrite Object::SendMessageToSet
- void SendMessageToSetInRange(WorldPacket *data, float fist, bool self, bool to_possessor = true);// overwrite Object::SendMessageToSetInRange
- void SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool to_possessor, bool own_team_only);
+ void SendMessageToSet(WorldPacket *data, bool self);// overwrite Object::SendMessageToSet
+ void SendMessageToSetInRange(WorldPacket *data, float fist, bool self);// overwrite Object::SendMessageToSetInRange
+ void SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only);
static void DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmChars = true);
@@ -1663,6 +1630,7 @@ class TRINITY_DLL_SPEC Player : public Unit
uint32 DurabilityRepairAll(bool cost, float discountMod, bool guildBank);
uint32 DurabilityRepair(uint16 pos, bool cost, float discountMod, bool guildBank);
+ void UpdateMirrorTimers();
void StopMirrorTimers()
{
StopMirrorTimer(FATIGUE_TIMER);
@@ -1680,65 +1648,45 @@ class TRINITY_DLL_SPEC Player : public Unit
void UpdateDefense();
void UpdateWeaponSkill (WeaponAttackType attType);
- void UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, MeleeHitOutcome outcome, bool defence);
+ void UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, bool defence);
void SetSkill(uint32 id, uint16 currVal, uint16 maxVal);
- uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus
+ uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus + temp bonus
uint16 GetPureMaxSkillValue(uint32 skill) const; // max
uint16 GetSkillValue(uint32 skill) const; // skill value + perm. bonus + temp bonus
uint16 GetBaseSkillValue(uint32 skill) const; // skill value + perm. bonus
uint16 GetPureSkillValue(uint32 skill) const; // skill value
+ int16 GetSkillPermBonusValue(uint32 skill) const;
int16 GetSkillTempBonusValue(uint32 skill) const;
bool HasSkill(uint32 skill) const;
- void learnSkillRewardedSpells( uint32 id );
- void learnSkillRewardedSpells();
+ void learnSkillRewardedSpells(uint32 id, uint32 value);
- void SetDontMove(bool dontMove);
- bool GetDontMove() const { return m_dontMove; }
+ WorldLocation& GetTeleportDest() { return m_teleport_dest; }
+ bool IsBeingTeleported() const { return mSemaphoreTeleport_Near || mSemaphoreTeleport_Far; }
+ bool IsBeingTeleportedNear() const { return mSemaphoreTeleport_Near; }
+ bool IsBeingTeleportedFar() const { return mSemaphoreTeleport_Far; }
+ void SetSemaphoreTeleportNear(bool semphsetting) { mSemaphoreTeleport_Near = semphsetting; }
+ void SetSemaphoreTeleportFar(bool semphsetting) { mSemaphoreTeleport_Far = semphsetting; }
void CheckExploreSystem(void);
static uint32 TeamForRace(uint8 race);
uint32 GetTeam() const { return m_team; }
+ TeamId GetTeamId() const { return m_team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; }
static uint32 getFactionForRace(uint8 race);
void setFactionForRace(uint8 race);
bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const;
bool RewardPlayerAndGroupAtKill(Unit* pVictim);
+ void RewardPlayerAndGroupAtEvent(uint32 creature_id,WorldObject* pRewardSource);
+ bool isHonorOrXPTarget(Unit* pVictim);
- FactionStateList m_factions;
- ForcedReactions m_forcedReactions;
- FactionStateList const& GetFactionStateList() { return m_factions; }
- uint32 GetDefaultReputationFlags(const FactionEntry *factionEntry) const;
- int32 GetBaseReputation(const FactionEntry *factionEntry) const;
- int32 GetReputation(uint32 faction_id) const;
- int32 GetReputation(const FactionEntry *factionEntry) const;
- ReputationRank GetReputationRank(uint32 faction) const;
- ReputationRank GetReputationRank(const FactionEntry *factionEntry) const;
- ReputationRank GetBaseReputationRank(const FactionEntry *factionEntry) const;
- ReputationRank ReputationToRank(int32 standing) const;
- const static int32 ReputationRank_Length[MAX_REPUTATION_RANK];
- const static int32 Reputation_Cap = 42999;
- const static int32 Reputation_Bottom = -42000;
- bool ModifyFactionReputation(uint32 FactionTemplateId, int32 DeltaReputation);
- bool ModifyFactionReputation(FactionEntry const* factionEntry, int32 standing);
- bool ModifyOneFactionReputation(FactionEntry const* factionEntry, int32 standing);
- bool SetFactionReputation(uint32 FactionTemplateId, int32 standing);
- bool SetFactionReputation(FactionEntry const* factionEntry, int32 standing);
- bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing);
- int32 CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, bool for_quest);
+ ReputationMgr& GetReputationMgr() { return m_reputationMgr; }
+ ReputationMgr const& GetReputationMgr() const { return m_reputationMgr; }
+ ReputationRank GetReputationRank(uint32 faction_id) const;
void RewardReputation(Unit *pVictim, float rate);
void RewardReputation(Quest const *pQuest);
- void SetInitialFactions();
- void UpdateReputation() const;
- void SendFactionState(FactionState const* faction) const;
- void SendInitialReputations();
- FactionState const* GetFactionState( FactionEntry const* factionEntry) const;
- void SetFactionAtWar(FactionState* faction, bool atWar);
- void SetFactionInactive(FactionState* faction, bool inactive);
- void SetFactionVisible(FactionState* faction);
- void SetFactionVisibleForFactionTemplateId(uint32 FactionTemplateId);
- void SetFactionVisibleForFactionId(uint32 FactionId);
+
void UpdateSkillsForLevel();
void UpdateSkillsToMaxSkillsForLevel(); // for .levelup
void ModifySkillBonus(uint32 skillid,int32 val, bool talent);
@@ -1757,6 +1705,8 @@ class TRINITY_DLL_SPEC Player : public Unit
//End of PvP System
+ inline SpellCooldowns GetSpellCooldowns() const { return m_spellCooldowns; }
+
void SetDrunkValue(uint16 newDrunkValue, uint32 itemid=0);
uint16 GetDrunkValue() const { return m_drunk; }
static DrunkenState GetDrunkenstateByValue(uint16 value);
@@ -1771,6 +1721,9 @@ class TRINITY_DLL_SPEC Player : public Unit
void SetCanParry(bool value);
bool CanBlock() const { return m_canBlock; }
void SetCanBlock(bool value);
+ bool CanTitanGrip() const { return m_canTitanGrip ; }
+ void SetCanTitanGrip(bool value) { m_canTitanGrip = value; }
+ bool CanTameExoticPets() const { return isGameMaster() || HasAuraType(SPELL_AURA_ALLOW_TAME_PET_TYPE); }
void SetRegularAttackTime();
void SetBaseModValue(BaseModGroup modGroup, BaseModType modType, float value) { m_auraBaseMod[modGroup][modType] = value; }
@@ -1782,8 +1735,8 @@ class TRINITY_DLL_SPEC Player : public Unit
void _RemoveAllStatBonuses();
void _ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackType, bool apply);
- void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, Aura* aura, bool apply);
- void _ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, Aura* aura, bool apply);
+ void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect* aura, bool apply);
+ void _ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, AuraEffect* aura, bool apply);
void _ApplyItemMods(Item *item,uint8 slot,bool apply);
void _RemoveAllItemMods();
@@ -1799,12 +1752,13 @@ class TRINITY_DLL_SPEC Player : public Unit
void ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply, bool form_change = false);
void UpdateEquipSpellsAtFormChange();
void CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPrototype const * proto);
+ void CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 cast_count, uint32 glyphIndex);
- void SendInitWorldStates(bool force = false, uint32 forceZoneId = 0);
+ void SendInitWorldStates(uint32 zone, uint32 area);
void SendUpdateWorldState(uint32 Field, uint32 Value);
void SendDirectMessage(WorldPacket *data);
- void SendAuraDurationsForTarget(Unit* target);
+ void SendAurasForTarget(Unit *target);
PlayerMenu* PlayerTalkClass;
std::vector<ItemSetEffect *> ItemSetEff;
@@ -1818,51 +1772,55 @@ class TRINITY_DLL_SPEC Player : public Unit
/*** BATTLEGROUND SYSTEM ***/
/*********************************************************/
- bool InBattleGround() const { return m_bgBattleGroundID != 0; }
- uint32 GetBattleGroundId() const { return m_bgBattleGroundID; }
+ bool InBattleGround() const { return m_bgBattleGroundID != 0; }
+ bool InArena() const;
+ uint32 GetBattleGroundId() const { return m_bgBattleGroundID; }
+ BattleGroundTypeId GetBattleGroundTypeId() const { return m_bgTypeID; }
BattleGround* GetBattleGround() const;
- bool InArena() const;
- static uint32 GetMinLevelForBattleGroundQueueId(uint32 queue_id);
- static uint32 GetMaxLevelForBattleGroundQueueId(uint32 queue_id);
- uint32 GetBattleGroundQueueIdFromLevel() const;
+
+ BGQueueIdBasedOnLevel GetBattleGroundQueueIdFromLevel(BattleGroundTypeId bgTypeId) const;
bool InBattleGroundQueue() const
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
- if (m_bgBattleGroundQueueID[i].bgQueueType != 0)
+ for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
+ if (m_bgBattleGroundQueueID[i].bgQueueTypeId != BATTLEGROUND_QUEUE_NONE)
return true;
return false;
}
- uint32 GetBattleGroundQueueId(uint32 index) const { return m_bgBattleGroundQueueID[index].bgQueueType; }
- uint32 GetBattleGroundQueueIndex(uint32 bgQueueType) const
+ BattleGroundQueueTypeId GetBattleGroundQueueTypeId(uint32 index) const { return m_bgBattleGroundQueueID[index].bgQueueTypeId; }
+ uint32 GetBattleGroundQueueIndex(BattleGroundQueueTypeId bgQueueTypeId) const
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
- if (m_bgBattleGroundQueueID[i].bgQueueType == bgQueueType)
+ for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
+ if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
return i;
return PLAYER_MAX_BATTLEGROUND_QUEUES;
}
- bool IsInvitedForBattleGroundQueueType(uint32 bgQueueType) const
+ bool IsInvitedForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId) const
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
- if (m_bgBattleGroundQueueID[i].bgQueueType == bgQueueType)
+ for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
+ if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
return m_bgBattleGroundQueueID[i].invitedToInstance != 0;
- return PLAYER_MAX_BATTLEGROUND_QUEUES;
+ return false;
}
- bool InBattleGroundQueueForBattleGroundQueueType(uint32 bgQueueType) const
+ bool InBattleGroundQueueForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId) const
{
- return GetBattleGroundQueueIndex(bgQueueType) < PLAYER_MAX_BATTLEGROUND_QUEUES;
+ return GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES;
}
- void SetBattleGroundId(uint32 val) { m_bgBattleGroundID = val; }
- uint32 AddBattleGroundQueueId(uint32 val)
+ void SetBattleGroundId(uint32 val, BattleGroundTypeId bgTypeId)
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
+ m_bgBattleGroundID = val;
+ m_bgTypeID = bgTypeId;
+ }
+ uint32 AddBattleGroundQueueId(BattleGroundQueueTypeId val)
+ {
+ for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
{
- if (m_bgBattleGroundQueueID[i].bgQueueType == 0 || m_bgBattleGroundQueueID[i].bgQueueType == val)
+ if (m_bgBattleGroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE || m_bgBattleGroundQueueID[i].bgQueueTypeId == val)
{
- m_bgBattleGroundQueueID[i].bgQueueType = val;
+ m_bgBattleGroundQueueID[i].bgQueueTypeId = val;
m_bgBattleGroundQueueID[i].invitedToInstance = 0;
return i;
}
@@ -1871,48 +1829,40 @@ class TRINITY_DLL_SPEC Player : public Unit
}
bool HasFreeBattleGroundQueueId()
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
- if (m_bgBattleGroundQueueID[i].bgQueueType == 0)
+ for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
+ if (m_bgBattleGroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE)
return true;
return false;
}
- void RemoveBattleGroundQueueId(uint32 val)
+ void RemoveBattleGroundQueueId(BattleGroundQueueTypeId val)
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
+ for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
{
- if (m_bgBattleGroundQueueID[i].bgQueueType == val)
+ if (m_bgBattleGroundQueueID[i].bgQueueTypeId == val)
{
- m_bgBattleGroundQueueID[i].bgQueueType = 0;
+ m_bgBattleGroundQueueID[i].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
m_bgBattleGroundQueueID[i].invitedToInstance = 0;
return;
}
}
}
- void SetInviteForBattleGroundQueueType(uint32 bgQueueType, uint32 instanceId)
+ void SetInviteForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId, uint32 instanceId)
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
- if (m_bgBattleGroundQueueID[i].bgQueueType == bgQueueType)
+ for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
+ if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
m_bgBattleGroundQueueID[i].invitedToInstance = instanceId;
}
bool IsInvitedForBattleGroundInstance(uint32 instanceId) const
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
+ for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].invitedToInstance == instanceId)
return true;
return false;
}
- uint32 GetBattleGroundEntryPointMap() const { return m_bgEntryPointMap; }
- float GetBattleGroundEntryPointX() const { return m_bgEntryPointX; }
- float GetBattleGroundEntryPointY() const { return m_bgEntryPointY; }
- float GetBattleGroundEntryPointZ() const { return m_bgEntryPointZ; }
- float GetBattleGroundEntryPointO() const { return m_bgEntryPointO; }
+ WorldLocation const& GetBattleGroundEntryPoint() const { return m_bgEntryPoint; }
void SetBattleGroundEntryPoint(uint32 Map, float PosX, float PosY, float PosZ, float PosO )
{
- m_bgEntryPointMap = Map;
- m_bgEntryPointX = PosX;
- m_bgEntryPointY = PosY;
- m_bgEntryPointZ = PosZ;
- m_bgEntryPointO = PosO;
+ m_bgEntryPoint = WorldLocation(Map,PosX,PosY,PosZ,PosO);
}
void SetBGTeam(uint32 team) { m_bgTeam = team; }
@@ -1924,9 +1874,11 @@ class TRINITY_DLL_SPEC Player : public Unit
void ReportedAfkBy(Player* reporter);
void ClearAfkReports() { m_bgAfkReporter.clear(); }
- bool GetBGAccessByLevel(uint32 bgTypeId) const;
- bool isAllowUseBattleGroundObject();
+ bool GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const;
bool isTotalImmunity();
+ bool CanUseBattleGroundObject();
+ bool isTotalImmune();
+ bool CanCaptureTowerPoint();
/*********************************************************/
/*** OUTDOOR PVP SYSTEM ***/
@@ -1940,7 +1892,7 @@ class TRINITY_DLL_SPEC Player : public Unit
/*** REST SYSTEM ***/
/*********************************************************/
- bool isRested() const { return GetRestTime() >= 10000; }
+ bool isRested() const { return GetRestTime() >= 10*IN_MILISECONDS; }
uint32 GetXPRestBonus(uint32 xp);
uint32 GetRestTime() const { return m_restTime;};
void SetRestTime(uint32 v) { m_restTime = v;};
@@ -1949,7 +1901,7 @@ class TRINITY_DLL_SPEC Player : public Unit
/*** ENVIROMENTAL SYSTEM ***/
/*********************************************************/
- void EnvironmentalDamage(uint64 guid, EnviromentalDamage type, uint32 damage);
+ void EnvironmentalDamage(EnviromentalDamage type, uint32 damage);
/*********************************************************/
/*** FLOOD FILTER SYSTEM ***/
@@ -1962,38 +1914,31 @@ class TRINITY_DLL_SPEC Player : public Unit
/*********************************************************/
/*** VARIOUS SYSTEMS ***/
/*********************************************************/
- MovementInfo m_movementInfo;
- uint32 m_lastFallTime;
- float m_lastFallZ;
+ void UpdateFallInformationIfNeed(MovementInfo const& minfo,uint16 opcode);
+ Unit *m_mover;
+ WorldObject *m_seer;
void SetFallInformation(uint32 time, float z)
{
m_lastFallTime = time;
m_lastFallZ = z;
}
+ void HandleFall(MovementInfo const& movementInfo);
+
bool isMoving() const { return HasUnitMovementFlag(movementFlagsMask); }
bool isMovingOrTurning() const { return HasUnitMovementFlag(movementOrTurningFlagsMask); }
bool CanFly() const { return HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); }
bool IsFlying() const { return HasUnitMovementFlag(MOVEMENTFLAG_FLYING); }
-
- void HandleDrowning();
- void HandleFallDamage(MovementInfo& movementInfo);
- void HandleFallUnderMap();
+ bool IsAllowUseFlyMountsHere() const;
void SetClientControl(Unit* target, uint8 allowMove);
- uint64 GetFarSight() const { return GetUInt64Value(PLAYER_FARSIGHT); }
- void SetFarSight(uint64 guid) { SetUInt64Value(PLAYER_FARSIGHT, guid); }
-
- // Transports
- Transport * GetTransport() const { return m_transport; }
- void SetTransport(Transport * t) { m_transport = t; }
-
- float GetTransOffsetX() const { return m_movementInfo.t_x; }
- float GetTransOffsetY() const { return m_movementInfo.t_y; }
- float GetTransOffsetZ() const { return m_movementInfo.t_z; }
- float GetTransOffsetO() const { return m_movementInfo.t_o; }
- uint32 GetTransTime() const { return m_movementInfo.t_time; }
+ void SetMover(Unit* target) { m_mover = target; }
+ void SetSeer(WorldObject *target) { m_seer = target; }
+ void SetViewpoint(WorldObject *target, bool apply);
+ WorldObject* GetViewpoint() const;
+ void StopCastingCharm();
+ void StopCastingBindSight();
uint32 GetSaveTimer() const { return m_nextSave; }
void SetSaveTimer(uint32 timer) { m_nextSave = timer; }
@@ -2012,6 +1957,7 @@ class TRINITY_DLL_SPEC Player : public Unit
float m_homebindX;
float m_homebindY;
float m_homebindZ;
+ void RelocateToHomebind() { SetMapId(m_homebindMapId); Relocate(m_homebindX,m_homebindY,m_homebindZ); }
// currently visible objects at player client
typedef std::set<uint64> ClientGUIDs;
@@ -2037,15 +1983,20 @@ class TRINITY_DLL_SPEC Player : public Unit
bool HasAtLoginFlag(AtLoginFlags f) const { return m_atLoginFlags & f; }
void SetAtLoginFlag(AtLoginFlags f) { m_atLoginFlags |= f; }
+ uint32 GetAtLoginFlag() { return m_atLoginFlags; }
+ void SetPetAtLoginFlag(uint8 f) { m_atLoginFlags |= uint32(f<<AT_LOAD_PET_FLAGS); }
LookingForGroup m_lookingForGroup;
// Temporarily removed pet cache
uint32 GetTemporaryUnsummonedPetNumber() const { return m_temporaryUnsummonedPetNumber; }
void SetTemporaryUnsummonedPetNumber(uint32 petnumber) { m_temporaryUnsummonedPetNumber = petnumber; }
- uint32 GetOldPetSpell() const { return m_oldpetspell; }
- void SetOldPetSpell(uint32 petspell) { m_oldpetspell = petspell; }
+ void UnsummonPetTemporaryIfAny();
+ void ResummonPetTemporaryUnSummonedIfAny();
+ bool IsPetNeedBeTemporaryUnsummoned() const { return !IsInWorld() || !isAlive() || IsMounted() /*+in flight*/; }
+ void SendCinematicStart(uint32 CinematicSequenceId);
+ void SendMovieStart(uint32 MovieId);
/*********************************************************/
/*** INSTANCE SYSTEM ***/
@@ -2080,26 +2031,45 @@ class TRINITY_DLL_SPEC Player : public Unit
GroupReference& GetGroupRef() { return m_group; }
void SetGroup(Group *group, int8 subgroup = -1);
uint8 GetSubGroup() const { return m_group.getSubGroup(); }
- uint32 GetGroupUpdateFlag() { return m_groupUpdateMask; }
+ uint32 GetGroupUpdateFlag() const { return m_groupUpdateMask; }
void SetGroupUpdateFlag(uint32 flag) { m_groupUpdateMask |= flag; }
- uint64 GetAuraUpdateMask() { return m_auraUpdateMask; }
- void SetAuraUpdateMask(uint8 slot) { m_auraUpdateMask |= (uint64(1) << slot); }
- void UnsetAuraUpdateMask(uint8 slot) { m_auraUpdateMask &= ~(uint64(1) << slot); }
+ const uint64& GetAuraUpdateMaskForRaid() const { return m_auraRaidUpdateMask; }
+ void SetAuraUpdateMaskForRaid(uint8 slot) { m_auraRaidUpdateMask |= (uint64(1) << slot); }
Player* GetNextRandomRaidMember(float radius);
PartyResult CanUninviteFromGroup() const;
+ // BattleGround Group System
+ void SetBattleGroundRaid(Group *group, int8 subgroup = -1);
+ void RemoveFromBattleGroundRaid();
+ Group * GetOriginalGroup() { return m_originalGroup.getTarget(); }
+ GroupReference& GetOriginalGroupRef() { return m_originalGroup; }
+ uint8 GetOriginalSubGroup() const { return m_originalGroup.getSubGroup(); }
+ void SetOriginalGroup(Group *group, int8 subgroup = -1);
GridReference<Player> &GetGridRef() { return m_gridRef; }
MapReference &GetMapRef() { return m_mapRef; }
bool isAllowedToLoot(Creature* creature);
- WorldLocation& GetTeleportDest() { return m_teleport_dest; }
-
DeclinedName const* GetDeclinedNames() const { return m_declinedname; }
+ uint8 GetRunesState() const { return m_runes->runeState; }
+ uint8 GetBaseRune(uint8 index) const { return m_runes->runes[index].BaseRune; }
+ uint8 GetCurrentRune(uint8 index) const { return m_runes->runes[index].CurrentRune; }
+ uint8 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; }
+ void SetBaseRune(uint8 index, uint8 baseRune) { m_runes->runes[index].BaseRune = baseRune; }
+ void SetCurrentRune(uint8 index, uint8 currentRune) { m_runes->runes[index].CurrentRune = currentRune; }
+ void SetRuneCooldown(uint8 index, uint8 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0) ? true : false); }
+ void ConvertRune(uint8 index, uint8 newType);
+ void ResyncRunes(uint8 count);
+ void AddRunePower(uint8 index);
+ void InitRunes();
+ AchievementMgr& GetAchievementMgr() { return m_achievementMgr; }
+ void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0, Unit *unit=NULL, uint32 time=0);
bool HasTitle(uint32 bitIndex);
bool HasTitle(CharTitlesEntry const* title) { return HasTitle(title->bit_index); }
void SetTitle(CharTitlesEntry const* title);
+ //bool isActiveObject() const { return true; }
+ bool canSeeSpellClickOn(Creature const* creature) const;
protected:
/*********************************************************/
@@ -2108,20 +2078,17 @@ class TRINITY_DLL_SPEC Player : public Unit
/* this variable is set to bg->m_InstanceID, when player is teleported to BG - (it is battleground's GUID)*/
uint32 m_bgBattleGroundID;
+ BattleGroundTypeId m_bgTypeID;
/*
this is an array of BG queues (BgTypeIDs) in which is player
*/
struct BgBattleGroundQueueID_Rec
{
- uint32 bgQueueType;
+ BattleGroundQueueTypeId bgQueueTypeId;
uint32 invitedToInstance;
};
BgBattleGroundQueueID_Rec m_bgBattleGroundQueueID[PLAYER_MAX_BATTLEGROUND_QUEUES];
- uint32 m_bgEntryPointMap;
- float m_bgEntryPointX;
- float m_bgEntryPointY;
- float m_bgEntryPointZ;
- float m_bgEntryPointO;
+ WorldLocation m_bgEntryPoint;
std::set<uint32> m_bgAfkReporter;
uint8 m_bgAfkReportedCount;
@@ -2145,6 +2112,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void _LoadActions(QueryResult *result);
void _LoadAuras(QueryResult *result, uint32 timediff);
+ void _LoadGlyphAuras();
void _LoadBoundInstances(QueryResult *result);
void _LoadInventory(QueryResult *result, uint32 timediff);
void _LoadMailInit(QueryResult *resultUnread, QueryResult *resultDelivery);
@@ -2153,7 +2121,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void _LoadQuestStatus(QueryResult *result);
void _LoadDailyQuestStatus(QueryResult *result);
void _LoadGroup(QueryResult *result);
- void _LoadReputation(QueryResult *result);
+ void _LoadSkills();
void _LoadSpells(QueryResult *result);
void _LoadTutorials(QueryResult *result);
void _LoadFriendList(QueryResult *result);
@@ -2171,7 +2139,6 @@ class TRINITY_DLL_SPEC Player : public Unit
void _SaveMail();
void _SaveQuestStatus();
void _SaveDailyQuestStatus();
- void _SaveReputation();
void _SaveSpells();
void _SaveTutorials();
@@ -2181,13 +2148,11 @@ class TRINITY_DLL_SPEC Player : public Unit
/*********************************************************/
/*** ENVIRONMENTAL SYSTEM ***/
/*********************************************************/
- void HandleLava();
void HandleSobering();
- void StartMirrorTimer(MirrorTimerType Type, uint32 MaxValue);
- void ModifyMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, uint32 Regen);
+ void SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen);
void StopMirrorTimer(MirrorTimerType Type);
- uint8 m_isunderwater;
- bool m_isInWater;
+ void HandleDrowning(uint32 time_diff);
+ int32 getMaxTimer(MirrorTimerType timer);
/*********************************************************/
/*** HONOR SYSTEM ***/
@@ -2195,7 +2160,6 @@ class TRINITY_DLL_SPEC Player : public Unit
time_t m_lastHonorUpdateTime;
void outDebugValues() const;
- bool _removeSpell(uint16 spell_id);
uint64 m_lootGuid;
uint32 m_race;
@@ -2227,14 +2191,20 @@ class TRINITY_DLL_SPEC Player : public Unit
PlayerMails m_mail;
PlayerSpellMap m_spells;
- SpellCooldowns m_spellCooldowns;
+ uint32 m_lastPotionId; // last used health/mana potion in combat, that block next potion use
ActionButtonList m_actionButtons;
float m_auraBaseMod[BASEMOD_END][MOD_END];
+ int16 m_baseRatingValue[MAX_COMBAT_RATING];
+ uint16 m_baseSpellDamage;
+ uint16 m_baseSpellHealing;
+ uint16 m_baseFeralAP;
+ uint16 m_baseManaRegen;
SpellModList m_spellMods[MAX_SPELLMOD];
- int32 m_SpellModRemoveCount;
+ Spell * m_spellModTakingSpell; // Spell for which charges are dropped in spell::finish
+
EnchantDurationList m_enchantDuration;
ItemDurationList m_itemDuration;
@@ -2248,8 +2218,6 @@ class TRINITY_DLL_SPEC Player : public Unit
typedef std::list<Channel*> JoinedChannelsList;
JoinedChannelsList m_channels;
- bool m_dontMove;
-
int m_cinematic;
Player *pTrader;
@@ -2265,8 +2233,6 @@ class TRINITY_DLL_SPEC Player : public Unit
bool m_DailyQuestChanged;
time_t m_lastDailyQuestTime;
- uint32 m_regenTimer;
- uint32 m_breathTimer;
uint32 m_drunkTimer;
uint16 m_drunk;
uint32 m_weaponChangeTimer;
@@ -2284,8 +2250,10 @@ class TRINITY_DLL_SPEC Player : public Unit
uint32 m_ArmorProficiency;
bool m_canParry;
bool m_canBlock;
+ bool m_canTitanGrip;
uint8 m_swingErrorMsg;
float m_ammoDPS;
+
////////////////////Rest System/////////////////////
int time_inn_enter;
uint32 inn_pos_mapid;
@@ -2296,28 +2264,20 @@ class TRINITY_DLL_SPEC Player : public Unit
RestType rest_type;
////////////////////Rest System/////////////////////
- // Transports
- Transport * m_transport;
-
uint32 m_resetTalentsCost;
time_t m_resetTalentsTime;
uint32 m_usedTalentCount;
+ uint32 m_questRewardTalentCount;
// Social
PlayerSocial *m_social;
// Groups
GroupReference m_group;
+ GroupReference m_originalGroup;
Group *m_groupInvite;
uint32 m_groupUpdateMask;
- uint64 m_auraUpdateMask;
-
- // Temporarily removed pet cache
- uint32 m_temporaryUnsummonedPetNumber;
- uint32 m_oldpetspell;
-
- uint64 m_miniPet;
- GuardianPetList m_guardianPets;
+ uint64 m_auraRaidUpdateMask;
// Player summoning
time_t m_summon_expire;
@@ -2326,12 +2286,8 @@ class TRINITY_DLL_SPEC Player : public Unit
float m_summon_y;
float m_summon_z;
- // Far Teleport
- WorldLocation m_teleport_dest;
-
- bool m_farsightVision;
-
DeclinedName *m_declinedname;
+ Runes *m_runes;
private:
// internal common parts for CanStore/StoreItem functions
uint8 _CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool swap, Item *pSrcItem ) const;
@@ -2339,27 +2295,62 @@ class TRINITY_DLL_SPEC Player : public Unit
uint8 _CanStoreItem_InInventorySlots( uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot ) const;
Item* _StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, bool update );
+ void UpdateKnownCurrencies(uint32 itemId, bool apply);
+ int32 CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool for_quest);
+ void AdjustQuestReqItemCount( Quest const* pQuest, QuestStatusData& questStatusData );
+
GridReference<Player> m_gridRef;
MapReference m_mapRef;
void UpdateCharmedAI();
UnitAI *i_AI;
+
+ uint32 m_lastFallTime;
+ float m_lastFallZ;
+
+ int32 m_MirrorTimer[MAX_TIMERS];
+ uint8 m_MirrorTimerFlags;
+ uint8 m_MirrorTimerFlagsLast;
+ bool m_isInWater;
+
+ // Current teleport data
+ WorldLocation m_teleport_dest;
+ bool mSemaphoreTeleport_Near;
+ bool mSemaphoreTeleport_Far;
+
+ // Temporary removed pet cache
+ uint32 m_temporaryUnsummonedPetNumber;
+ uint32 m_oldpetspell;
+
+ AchievementMgr m_achievementMgr;
+ ReputationMgr m_reputationMgr;
+
+ SpellCooldowns m_spellCooldowns;
};
void AddItemsSetItem(Player*player,Item *item);
void RemoveItemsSetItem(Player*player,ItemPrototype const *proto);
// "the bodies of template functions must be made available in a header file"
-template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell const* spell)
+template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell * spell)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
if (!spellInfo) return 0;
int32 totalpct = 0;
int32 totalflat = 0;
+
+ // Drop charges for triggering spells instead of triggered ones
+ if (m_spellModTakingSpell)
+ spell = m_spellModTakingSpell;
+
for (SpellModList::iterator itr = m_spellMods[op].begin(); itr != m_spellMods[op].end(); ++itr)
{
SpellModifier *mod = *itr;
+ // Charges can be set only for mods with auras
+ if (!mod->ownerAura)
+ assert(mod->charges==0);
+
if(!IsAffectedBySpellmod(spellInfo,mod,spell))
continue;
if (mod->type == SPELLMOD_FLAT)
@@ -2377,19 +2368,7 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
totalpct += mod->value;
}
- if (mod->charges > 0 )
- {
- if( !(spellInfo->SpellFamilyName == 8 && spellInfo->SpellFamilyFlags & 0x200000000LL) )
- --mod->charges;
- if (mod->charges == 0)
- {
- mod->charges = -1;
- mod->lastAffected = spell;
- if(!mod->lastAffected)
- mod->lastAffected = FindCurrentSpellBySpellId(spellId);
- ++m_SpellModRemoveCount;
- }
- }
+ DropModCharge(mod, spell);
}
float diff = (float)basevalue*(float)totalpct/100.0f + (float)totalflat;