diff options
Diffstat (limited to 'src/game/Player.h')
-rw-r--r-- | src/game/Player.h | 402 |
1 files changed, 3 insertions, 399 deletions
diff --git a/src/game/Player.h b/src/game/Player.h index 1a218879aa6..655a914c23b 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -17,15 +17,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #ifndef _PLAYER_H #define _PLAYER_H - #include "Common.h" #include "ItemPrototype.h" #include "Unit.h" #include "Item.h" - #include "Database/DatabaseEnv.h" #include "NPCHandler.h" #include "QuestDef.h" @@ -38,10 +35,8 @@ #include "AchievementMgr.h" #include "ReputationMgr.h" #include "BattleGround.h" - #include<string> #include<vector> - struct Mail; class Channel; class DynamicObject; @@ -52,19 +47,15 @@ class UpdateMask; class SpellCastTargets; class PlayerSocial; class OutdoorPvP; - typedef std::deque<Mail*> PlayerMails; - #define PLAYER_MAX_SKILLS 127 #define PLAYER_MAX_DAILY_QUESTS 25 - // Note: SPELLMOD_* values is aura types in fact enum SpellModType { SPELLMOD_FLAT = 107, // SPELL_AURA_ADD_FLAT_MODIFIER 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 { @@ -73,10 +64,8 @@ enum PlayerUnderwaterState 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, @@ -85,7 +74,6 @@ enum PlayerSpellState PLAYERSPELL_REMOVED = 3, PLAYERSPELL_TEMPORARY = 4 }; - struct PlayerSpell { PlayerSpellState state : 8; @@ -93,13 +81,11 @@ struct PlayerSpell 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 }; - struct PlayerTalent { PlayerSpellState state : 8; uint8 spec : 8; }; - // Spell modifier (used for modify other spells) struct SpellModifier { @@ -112,19 +98,15 @@ struct SpellModifier uint32 spellId; Aura *const ownerAura; }; - typedef UNORDERED_MAP<uint32, PlayerTalent*> PlayerTalentMap; typedef UNORDERED_MAP<uint32, PlayerSpell*> PlayerSpellMap; typedef std::list<SpellModifier*> SpellModList; - struct SpellCooldown { time_t end; uint16 itemid; }; - typedef std::map<uint32, SpellCooldown> SpellCooldowns; - enum TrainerSpellState { TRAINER_SPELL_GREEN = 0, @@ -132,7 +114,6 @@ enum TrainerSpellState TRAINER_SPELL_GRAY = 2, TRAINER_SPELL_GREEN_DISABLED = 10 // custom value, not send to client: formally green but learn not allowed }; - enum ActionButtonUpdateState { ACTIONBUTTON_UNCHANGED = 0, @@ -140,7 +121,6 @@ enum ActionButtonUpdateState ACTIONBUTTON_NEW = 2, ACTIONBUTTON_DELETED = 3 }; - enum ActionButtonType { ACTION_BUTTON_SPELL = 0x00, @@ -150,19 +130,15 @@ enum ActionButtonType ACTION_BUTTON_CMACRO = ACTION_BUTTON_C | ACTION_BUTTON_MACRO, ACTION_BUTTON_ITEM = 0x80 }; - #define ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF) #define ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24) #define MAX_ACTION_BUTTON_ACTION_VALUE (0x00FFFFFF+1) - struct ActionButton { ActionButton() : packedData(0), uState( ACTIONBUTTON_NEW ), canRemoveByClient(true){} - uint32 packedData; ActionButtonUpdateState uState; bool canRemoveByClient; - // helpers ActionButtonType GetType() const { return ActionButtonType(ACTION_BUTTON_TYPE(packedData)); } uint32 GetAction() const { return ACTION_BUTTON_ACTION(packedData); } @@ -177,63 +153,47 @@ struct ActionButton } } }; - #define MAX_ACTION_BUTTONS 132 //checked in 2.3.0 - typedef std::map<uint8,ActionButton> ActionButtonList; - struct PlayerCreateInfoItem { PlayerCreateInfoItem(uint32 id, uint32 amount) : item_id(id), item_amount(amount) {} - uint32 item_id; uint32 item_amount; }; - typedef std::list<PlayerCreateInfoItem> PlayerCreateInfoItems; - struct PlayerClassLevelInfo { PlayerClassLevelInfo() : basehealth(0), basemana(0) {} uint16 basehealth; uint16 basemana; }; - struct PlayerClassInfo { PlayerClassInfo() : levelInfo(NULL) { } - PlayerClassLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1 }; - struct PlayerLevelInfo { PlayerLevelInfo() { for(uint8 i=0; i < MAX_STATS; ++i ) stats[i] = 0; } - uint8 stats[MAX_STATS]; }; - typedef std::list<uint32> PlayerCreateInfoSpells; - struct PlayerCreateInfoAction { PlayerCreateInfoAction() : button(0), type(0), action(0) {} PlayerCreateInfoAction(uint8 _button, uint32 _action, uint8 _type) : button(_button), type(_type), action(_action) {} - uint8 button; uint8 type; uint32 action; }; - typedef std::list<PlayerCreateInfoAction> PlayerCreateInfoActions; - struct PlayerInfo { // existence checked by displayId != 0 // existence checked by displayId != 0 PlayerInfo() : displayId_m(0),displayId_f(0),levelInfo(NULL) { } - uint32 mapId; uint32 zoneId; float positionX; @@ -244,31 +204,25 @@ struct PlayerInfo PlayerCreateInfoItems item; PlayerCreateInfoSpells spell; PlayerCreateInfoActions action; - PlayerLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1 }; - struct PvPInfo { PvPInfo() : inHostileArea(false), inNoPvPArea(false), inFFAPvPArea(false), endTimer(0) {} - bool inHostileArea; bool inNoPvPArea; bool inFFAPvPArea; time_t endTimer; }; - struct DuelInfo { DuelInfo() : initiator(NULL), opponent(NULL), startTimer(0), startTime(0), outOfBound(0) {} - Player *initiator; Player *opponent; time_t startTimer; time_t startTime; time_t outOfBound; }; - struct Areas { uint32 areaID; @@ -278,10 +232,8 @@ struct Areas float y1; float y2; }; - #define MAX_RUNES 6 #define RUNE_COOLDOWN 5 // 5*2=10 sec - enum RuneType { RUNE_BLOOD = 0, @@ -290,20 +242,17 @@ enum RuneType RUNE_DEATH = 3, NUM_RUNE_TYPES = 4 }; - struct RuneInfo { uint8 BaseRune; uint8 CurrentRune; uint8 Cooldown; }; - struct Runes { RuneInfo runes[MAX_RUNES]; uint8 runeState; // mask of available runes RuneType lastUsedRune; - void SetRuneState(uint8 index, bool set = true) { if(set) @@ -312,21 +261,17 @@ struct Runes 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), + EnchantDuration(Item * _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot), leftduration(_leftduration){ assert(item); }; - Item * item; EnchantmentSlot slot; uint32 leftduration; }; - typedef std::list<EnchantDuration> EnchantDurationList; typedef std::list<Item*> ItemDurationList; - enum LfgType { LFG_TYPE_NONE = 0, @@ -336,7 +281,6 @@ enum LfgType LFG_TYPE_ZONE = 4, LFG_TYPE_HEROIC_DUNGEON = 5 }; - enum LfgRoles { LEADER = 1, @@ -344,7 +288,6 @@ enum LfgRoles HEALER = 4, DAMAGE = 8 }; - struct LookingForGroupSlot { LookingForGroupSlot() : entry(0), type(0) {} @@ -353,13 +296,10 @@ struct LookingForGroupSlot 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 == LFG_TYPE_DUNGEON || type == LFG_TYPE_HEROIC_DUNGEON); } - uint32 entry; uint32 type; }; - #define MAX_LOOKING_FOR_GROUP_SLOT 3 - struct LookingForGroup { LookingForGroup() {} @@ -371,7 +311,6 @@ struct LookingForGroup return true; return false; } - bool canAutoJoin() const { for(uint8 i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i) @@ -379,7 +318,6 @@ struct LookingForGroup return true; return false; } - bool Empty() const { for(uint8 i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i) @@ -387,13 +325,11 @@ struct LookingForGroup return false; return more.Empty(); } - LookingForGroupSlot slots[MAX_LOOKING_FOR_GROUP_SLOT]; LookingForGroupSlot more; std::string comment; uint8 roles; }; - enum PlayerMovementType { MOVE_ROOT = 1, @@ -401,7 +337,6 @@ enum PlayerMovementType MOVE_WATER_WALK = 3, MOVE_LAND_WALK = 4 }; - enum DrunkenState { DRUNKEN_SOBER = 0, @@ -409,9 +344,7 @@ enum DrunkenState DRUNKEN_DRUNK = 2, DRUNKEN_SMASHED = 3 }; - #define MAX_DRUNKEN 4 - enum PlayerFlags { PLAYER_FLAGS_GROUP_LEADER = 0x00000001, @@ -440,7 +373,6 @@ enum PlayerFlags 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 UI64LIT(0x0000000000000000) @@ -485,9 +417,7 @@ enum PlayerFlags #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 - #define MAX_TITLE_INDEX (3*64) // 3 uint64 fields - // used in PLAYER_FIELD_BYTES values enum PlayerFieldByteFlags { @@ -495,14 +425,12 @@ enum PlayerFieldByteFlags PLAYER_FIELD_BYTE_RELEASE_TIMER = 0x00000008, // Display time till auto release spirit PLAYER_FIELD_BYTE_NO_RELEASE_WINDOW = 0x00000010 // Display no "release spirit" window at all }; - // used in PLAYER_FIELD_BYTES2 values enum PlayerFieldByte2Flags { PLAYER_FIELD_BYTE2_NONE = 0x0000, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW = 0x4000 }; - enum ActivateTaxiReplies { ERR_TAXIOK = 0, @@ -520,8 +448,6 @@ enum ActivateTaxiReplies ERR_TAXINOTSTANDING = 12 }; - - enum MirrorTimerType { FATIGUE_TIMER = 0, @@ -530,7 +456,6 @@ enum MirrorTimerType }; #define MAX_TIMERS 3 #define DISABLED_MIRROR_TIMER -1 - // 2^n values enum PlayerExtraFlags { @@ -540,11 +465,9 @@ enum PlayerExtraFlags PLAYER_EXTRA_TAXICHEAT = 0x0008, PLAYER_EXTRA_GM_INVISIBLE = 0x0010, PLAYER_EXTRA_GM_CHAT = 0x0020, // Show GM badge in chat messages - // other states PLAYER_EXTRA_PVP_DEATH = 0x0100 // store PvP death status until corpse creating. }; - // 2^n values enum AtLoginFlags { @@ -555,9 +478,7 @@ enum AtLoginFlags AT_LOGIN_CUSTOMIZE = 0x08, AT_LOGIN_RESET_PET_TALENTS = 0x10, }; - typedef std::map<uint32, QuestStatusData> QuestStatusMap; - enum QuestSlotOffsets { QUEST_ID_OFFSET = 0, @@ -565,21 +486,17 @@ enum QuestSlotOffsets QUEST_COUNTS_OFFSET = 2, QUEST_TIME_OFFSET = 3 }; - #define MAX_QUEST_OFFSET 4 - enum QuestSlotStateMask { QUEST_STATE_NONE = 0x0000, QUEST_STATE_COMPLETE = 0x0001, QUEST_STATE_FAIL = 0x0002 }; - class Quest; class Spell; class Item; class WorldSession; - enum PlayerSlots { // first slot for item stored (in any way in player m_items data) @@ -588,9 +505,7 @@ enum PlayerSlots PLAYER_SLOT_END = 150, PLAYER_SLOTS_COUNT = (PLAYER_SLOT_END - PLAYER_SLOT_START) }; - #define INVENTORY_SLOT_BAG_0 255 - enum EquipmentSlots // 19 slots { EQUIPMENT_SLOT_START = 0, @@ -615,50 +530,42 @@ enum EquipmentSlots // 19 slots EQUIPMENT_SLOT_TABARD = 18, EQUIPMENT_SLOT_END = 19 }; - enum InventorySlots // 4 slots { INVENTORY_SLOT_BAG_START = 19, INVENTORY_SLOT_BAG_END = 23 }; - enum InventoryPackSlots // 16 slots { INVENTORY_SLOT_ITEM_START = 23, INVENTORY_SLOT_ITEM_END = 39 }; - enum BankItemSlots // 28 slots { BANK_SLOT_ITEM_START = 39, BANK_SLOT_ITEM_END = 67 }; - enum BankBagSlots // 7 slots { BANK_SLOT_BAG_START = 67, BANK_SLOT_BAG_END = 74 }; - enum BuyBackSlots // 12 slots { // stored in m_buybackitems BUYBACK_SLOT_START = 74, BUYBACK_SLOT_END = 86 }; - enum KeyRingSlots // 32 slots { KEYRING_SLOT_START = 86, KEYRING_SLOT_END = 118 }; - enum CurrencyTokenSlots // 32 slots { CURRENCYTOKEN_SLOT_START = 118, CURRENCYTOKEN_SLOT_END = 150 }; - enum EquipmentSetUpdateState { EQUIPMENT_SET_UNCHANGED = 0, @@ -666,7 +573,6 @@ enum EquipmentSetUpdateState EQUIPMENT_SET_NEW = 2, EQUIPMENT_SET_DELETED = 3 }; - struct EquipmentSet { EquipmentSet() : Guid(0), state(EQUIPMENT_SET_NEW) @@ -674,18 +580,14 @@ struct EquipmentSet for(uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) Items[i] = 0; } - uint64 Guid; std::string Name; std::string IconName; uint32 Items[EQUIPMENT_SLOT_END]; EquipmentSetUpdateState state; }; - #define MAX_EQUIPMENT_SET_INDEX 10 // client limit - typedef std::map<uint32, EquipmentSet> EquipmentSets; - struct ItemPosCount { ItemPosCount(uint16 _pos, uint32 _count) : pos(_pos), count(_count) {} @@ -694,14 +596,12 @@ struct ItemPosCount uint32 count; }; typedef std::vector<ItemPosCount> ItemPosCountVec; - enum TradeSlots { TRADE_SLOT_COUNT = 7, TRADE_SLOT_TRADED_COUNT = 6, TRADE_SLOT_NONTRADED = 6 }; - enum TransferAbortReason { TRANSFER_ABORT_NONE = 0x00, @@ -718,7 +618,6 @@ enum TransferAbortReason TRANSFER_ABORT_NOT_FOUND2 = 0x0C, // 3.1 TRANSFER_ABORT_NOT_FOUND3 = 0x0D, // 3.1 }; - enum InstanceResetWarningType { RAID_INSTANCE_WARNING_HOURS = 1, // WARNING! %s is scheduled to reset in %d hour(s). @@ -727,23 +626,19 @@ enum InstanceResetWarningType RAID_INSTANCE_WELCOME = 4, // Welcome to %s. This raid instance is scheduled to reset in %s. RAID_INSTANCE_EXPIRED = 5 }; - class InstanceSave; - enum RestType { REST_TYPE_NO = 0, REST_TYPE_IN_TAVERN = 1, REST_TYPE_IN_CITY = 2 }; - enum DuelCompleteType { DUEL_INTERUPTED = 0, DUEL_WON = 1, DUEL_FLED = 2 }; - enum TeleportToOptions { TELE_TO_GM_MODE = 0x01, @@ -752,7 +647,6 @@ enum TeleportToOptions TELE_TO_NOT_UNSUMMON_PET = 0x08, TELE_TO_SPELL = 0x10, }; - /// Type of environmental damages enum EnviromentalDamage { @@ -764,15 +658,12 @@ enum EnviromentalDamage DAMAGE_FIRE = 5, DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss }; - enum PlayedTimeIndex { PLAYED_TIME_TOTAL = 0, PLAYED_TIME_LEVEL = 1 }; - #define MAX_PLAYED_TIME_INDEX 2 - // used at player loading query list preparing, and later result selection enum PlayerLoginQueryIndex { @@ -803,7 +694,6 @@ enum PlayerLoginQueryIndex PLAYER_LOGIN_QUERY_LOADACCOUNTDATA = 24, MAX_PLAYER_LOGIN_QUERY = 25 }; - enum PlayerDelayedOperations { DELAYED_SAVE_PLAYER = 0x01, @@ -813,11 +703,9 @@ enum PlayerDelayedOperations DELAYED_BG_TAXI_RESTORE = 0x10, ///< Flag to restore taxi state after teleport from BG DELAYED_END }; - // Player summoning auto-decline time (in secs) #define MAX_PLAYER_SUMMON_DELAY (2*MINUTE) #define MAX_MONEY_AMOUNT (0x7FFFFFFF-1) - struct InstancePlayerBind { InstanceSave *save; @@ -827,7 +715,6 @@ struct InstancePlayerBind or when they enter an instance that the group leader is permanently bound to. */ InstancePlayerBind() : save(NULL), perm(false) {} }; - struct AccessRequirement { uint8 levelMin; @@ -842,7 +729,6 @@ struct AccessRequirement uint32 heroicQuest; std::string heroicQuestFailedText; }; - class TRINITY_DLL_SPEC PlayerTaxi { public: @@ -851,7 +737,6 @@ class TRINITY_DLL_SPEC PlayerTaxi // Nodes void InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint32 level); void LoadTaxiMask(const char* data); - bool IsTaximaskNodeKnown(uint32 nodeidx) const { uint8 field = uint8((nodeidx - 1) / 32); @@ -871,11 +756,9 @@ class TRINITY_DLL_SPEC PlayerTaxi return false; } void AppendTaximaskTo(ByteBuffer& data,bool all); - // Destinations bool LoadTaxiDestinationsFromString(const std::string& values, uint32 team); std::string SaveTaxiDestinationsToString(); - void ClearTaxiDestinations() { m_TaxiDestinations.clear(); } void AddTaxiDestination(uint32 dest) { m_TaxiDestinations.push_back(dest); } uint32 GetTaxiSource() const { return m_TaxiDestinations.empty() ? 0 : m_TaxiDestinations.front(); } @@ -887,44 +770,33 @@ 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 Player; - /// Holder for BattleGround data struct BGData { BGData() : bgInstanceID(0), bgTypeID(BATTLEGROUND_TYPE_NONE), bgAfkReportedCount(0), bgAfkReportedTimer(0), bgTeam(0), mountSpell(0) { ClearTaxiPath(); } - uint32 bgInstanceID; ///< This variable is set to bg->m_InstanceID, /// when player is teleported to BG - (it is battleground's GUID) BattleGroundTypeId bgTypeID; - std::set<uint32> bgAfkReporter; uint8 bgAfkReportedCount; time_t bgAfkReportedTimer; - uint32 bgTeam; ///< What side the player will be added to - uint32 mountSpell; uint32 taxiPath[2]; - WorldLocation joinPos; ///< From where player entered BG - void ClearTaxiPath() { taxiPath[0] = taxiPath[1] = 0; } bool HasTaxiPath() const { return taxiPath[0] && taxiPath[1]; } }; - class MANGOS_DLL_SPEC Player : public Unit { friend class WorldSession; @@ -933,25 +805,18 @@ class MANGOS_DLL_SPEC Player : public Unit public: explicit Player (WorldSession *session); ~Player ( ); - void CleanupsBeforeDelete(); - static UpdateMask updateVisualBits; static void InitVisibleBits(); - void AddToWorld(); void RemoveFromWorld(); - bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0); void TeleportOutOfMap(Map *oldMap); - bool TeleportTo(WorldLocation const &loc, uint32 options = 0) { return TeleportTo(loc.GetMapId(), loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ(), loc.GetOrientation(), options); } - bool TeleportToBGEntryPoint(); - void SetSummonPoint(uint32 mapid, float x, float y, float z) { m_summon_expire = time(NULL) + MAX_PLAYER_SUMMON_DELAY; @@ -961,27 +826,19 @@ class MANGOS_DLL_SPEC Player : public Unit m_summon_z = z; } void SummonIfPossible(bool agree); - 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 ); - void Update( uint32 time ); - static bool BuildEnumData( QueryResult * result, WorldPacket * p_data ); - void SetInWater(bool apply); - bool IsInWater() const { return m_isInWater; } bool IsUnderWater() const; - void SendInitialPacketsBeforeAddToMap(); void SendInitialPacketsAfterAddToMap(); void SendTransferAborted(uint32 mapid, uint8 reason, uint8 arg = 0); void SendInstanceResetWarning(uint32 mapid, uint32 difficulty, 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(); bool isAFK() const { return HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_AFK); }; @@ -989,11 +846,8 @@ class MANGOS_DLL_SPEC Player : public Unit uint8 chatTag() const; 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(), getClass(), getLevel()); } bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc = NULL, uint32 spellid = 0); @@ -1012,21 +866,16 @@ class MANGOS_DLL_SPEC Player : public Unit bool isGMVisible() const { return !(m_ExtraFlags & PLAYER_EXTRA_GM_INVISIBLE); } void SetGMVisible(bool on); void SetPvPDeath(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; } - void GiveXP(uint32 xp, Unit* victim); void GiveLevel(uint32 level); - void InitStatsForLevel(bool reapplyMods = false); - // Played Time Stuff time_t m_logintime; time_t m_Last_tick; uint32 m_Played_time[MAX_PLAYED_TIME_INDEX]; uint32 GetTotalPlayedTime() { return m_Played_time[PLAYED_TIME_TOTAL]; }; uint32 GetLevelPlayedTime() { return m_Played_time[PLAYED_TIME_LEVEL]; }; - void setDeathState(DeathState s); // overwrite Unit::setDeathState - void InnEnter (int time,uint32 mapid, float x,float y,float z) { inn_pos_mapid = mapid; @@ -1035,36 +884,28 @@ class MANGOS_DLL_SPEC Player : public Unit inn_pos_z = z; time_inn_enter = time; }; - float GetRestBonus() const { return m_rest_bonus; }; void SetRestBonus(float rest_bonus_new); - RestType GetRestType() const { return rest_type; }; void SetRestType(RestType n_r_type) { rest_type = n_r_type; }; - uint32 GetInnPosMapId() const { return inn_pos_mapid; }; float GetInnPosX() const { return inn_pos_x; }; float GetInnPosY() const { return inn_pos_y; }; float GetInnPosZ() const { return inn_pos_z; }; - 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); 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); void TextEmote(const std::string& text); void Whisper(const std::string& text, const uint32 language,uint64 receiver); void BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string& text, uint32 language) const; - /*********************************************************/ /*** STORAGE SYSTEM ***/ /*********************************************************/ - void SetVirtualItemSlot( uint8 i, Item* item); void SetSheath( SheathState sheathed ); // overwrite Unit version uint8 FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap ) const; @@ -1110,12 +951,10 @@ class MANGOS_DLL_SPEC Player : public Unit return EQUIP_ERR_ITEM_NOT_FOUND; uint32 count = pItem->GetCount(); return _CanStoreItem( bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL ); - } 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; @@ -1133,10 +972,8 @@ class MANGOS_DLL_SPEC Player : public Unit 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; - void ApplyEquipCooldown( Item * pItem ); void SetAmmo( uint32 item ); void RemoveAmmo(); @@ -1186,13 +1023,11 @@ class MANGOS_DLL_SPEC Player : public Unit } void SendNewItem( Item *item, uint32 count, bool received, bool created, bool broadcast = false ); bool BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint8 bag, uint8 slot); - float GetReputationPriceDiscount( Creature const* pCreature ) const; Player* GetTrader() const { return pTrader; } void ClearTrade(); void TradeCancel(bool sendback); uint16 GetItemPosByTradeSlot(uint32 slot) const { return tradeItems[slot]; } - void UpdateEnchantTime(uint32 time); void UpdateItemDuration(uint32 time, bool realtimeonly=false); void AddEnchantmentDurations(Item *item); @@ -1208,15 +1043,11 @@ class MANGOS_DLL_SPEC Player : public Unit void SendItemDurations(); void LoadCorpse(); void LoadPet(); - uint32 m_stableSlots; - /*********************************************************/ /*** 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; @@ -1250,10 +1081,8 @@ class MANGOS_DLL_SPEC Player : public Unit bool GetQuestRewardStatus( uint32 quest_id ) const; QuestStatus GetQuestStatus( uint32 quest_id ) const; void SetQuestStatus( uint32 quest_id, QuestStatus status ); - void SetDailyQuestStatus( uint32 quest_id ); void ResetDailyQuestStatus(); - uint16 FindQuestSlot( uint32 quest_id ) const; uint32 GetQuestSlotQuestId(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_ID_OFFSET); } uint32 GetQuestSlotState(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_STATE_OFFSET); } @@ -1277,7 +1106,6 @@ class MANGOS_DLL_SPEC Player : public Unit { uint32 temp1 = GetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET *slot1 + i); uint32 temp2 = GetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET *slot2 + i); - SetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET *slot1 + i, temp2); SetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET *slot2 + i, temp1); } @@ -1297,7 +1125,6 @@ class MANGOS_DLL_SPEC Player : public Unit bool HasQuestForGO(int32 GOId) const; void UpdateForQuestWorldObjects(); bool CanShareQuest(uint32 quest_id) const; - void SendQuestComplete( uint32 quest_id ); void SendQuestReward( Quest const *pQuest, uint32 XP, Object* questGiver ); void SendQuestFailed( uint32 quest_id ); @@ -1306,24 +1133,17 @@ class MANGOS_DLL_SPEC Player : public Unit void SendPushToPartyResponse( Player *pPlayer, uint32 msg ); void SendQuestUpdateAddItem( Quest const* pQuest, uint32 item_idx, uint32 count ); void SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, uint32 creatureOrGO_idx, uint32 old_count, uint32 add_count ); - uint64 GetDivider() { return m_divider; }; void SetDivider( uint64 guid ) { m_divider = guid; }; - uint32 GetInGameTime() { return m_ingametime; }; - void SetInGameTime( uint32 time ) { m_ingametime = time; }; - void AddTimedQuest( uint32 quest_id ) { m_timedquests.insert(quest_id); } void RemoveTimedQuest( uint32 quest_id ) { m_timedquests.erase(quest_id); } - /*********************************************************/ /*** LOAD SYSTEM ***/ /*********************************************************/ - bool LoadFromDB(uint32 guid, SqlQueryHolder *holder); bool isBeingLoaded() const { return GetSession()->PlayerLoading();} - bool MinimalLoadFromDB(QueryResult *result, uint32 guid); static bool LoadValuesArrayFromDB(Tokens& data,uint64 guid); static uint32 GetUInt32ValueFromArray(Tokens const& data, uint16 index); @@ -1333,11 +1153,9 @@ class MANGOS_DLL_SPEC Player : public Unit static uint32 GetZoneIdFromDB(uint64 guid); static uint32 GetLevelFromDB(uint64 guid); static bool LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float& o, bool& in_flight, uint64 guid); - /*********************************************************/ /*** SAVE SYSTEM ***/ /*********************************************************/ - void SaveToDB(); void SaveInventoryAndGoldToDB(); // fast save function for item/money cheating preventing void SaveGoldToDB(); @@ -1349,10 +1167,8 @@ class MANGOS_DLL_SPEC Player : public Unit 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; bool m_mailsUpdated; - void SetBindPoint(uint64 guid); void SendTalentWipeConfirm(uint64 guid); void SendPetSkillWipeConfirm(); @@ -1362,7 +1178,6 @@ class MANGOS_DLL_SPEC Player : public Unit void RegenerateHealth(); void setRegenTimerCount(uint32 time) {m_regenTimerCount = time;} void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;} - uint32 GetMoney() { return GetUInt32Value (PLAYER_FIELD_COINAGE); } void ModifyMoney( int32 d ) { @@ -1371,7 +1186,6 @@ class MANGOS_DLL_SPEC Player : public Unit SetMoney (GetMoney() > uint32(-d) ? GetMoney() + d : 0); else SetMoney (GetMoney() < uint32(MAX_MONEY_AMOUNT - d) ? GetMoney() + d : MAX_MONEY_AMOUNT); - // "At Gold Limit" if(GetMoney() >= MAX_MONEY_AMOUNT) SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD,NULL,NULL); @@ -1382,67 +1196,51 @@ class MANGOS_DLL_SPEC Player : public Unit MoneyChanged( value ); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED); } - QuestStatusMap& getQuestStatusMap() { return mQuestStatus; }; - const uint64& GetSelection( ) const { return m_curSelection; } Unit *GetSelectedUnit() const; Player *GetSelectedPlayer() const; void SetSelection(const uint64 &guid) { m_curSelection = guid; SetUInt64Value(UNIT_FIELD_TARGET, guid); } - uint8 GetComboPoints() { return m_comboPoints; } const uint64& GetComboTarget() const { return m_comboTarget; } - void AddComboPoints(Unit* target, int8 count, Spell * spell = NULL); void GainSpellComboPoints(int8 count); void ClearComboPoints(); void SendComboPoints(); - 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); bool IsMailsLoaded() const { return m_mailsLoaded; } - //void SetMail(Mail *m); void RemoveMail(uint32 id); - void AddMail(Mail* mail) { m_mail.push_front(mail);}// for call from WorldSession::SendMailTo uint32 GetMailSize() { return m_mail.size();}; Mail* GetMail(uint32 id); - PlayerMails::iterator GetmailBegin() { return m_mail.begin();}; PlayerMails::iterator GetmailEnd() { return m_mail.end();}; - /*********************************************************/ /*** MAILED ITEMS SYSTEM ***/ /*********************************************************/ - uint8 unReadMails; time_t m_nextMailDelivereTime; - typedef UNORDERED_MAP<uint32, Item*> ItemMap; - ItemMap mMitems; //template defined in objectmgr.cpp - Item* GetMItem(uint32 id) { ItemMap::const_iterator itr = mMitems.find(id); return itr != mMitems.end() ? itr->second : NULL; } - void AddMItem(Item* it) { ASSERT( it ); //assert deleted, because items can be added before loading mMitems[it->GetGUIDLow()] = it; } - bool RemoveMItem(uint32 id) { return mMitems.erase(id) ? true : false; } - void PetSpellInitialize(); void CharmSpellInitialize(); void PossessSpellInitialize(); @@ -1453,7 +1251,6 @@ class MANGOS_DLL_SPEC Player : public Unit 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, bool dependent, bool disabled); @@ -1479,12 +1276,9 @@ class MANGOS_DLL_SPEC Player : public Unit void SendTalentsInfoData(bool pet); void LearnTalent(uint32 talentId, uint32 talentRank); void LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank); - bool AddTalent(uint32 spell, uint8 spec, bool learning); bool HasTalent(uint32 spell_id, uint8 spec) const; - uint32 CalculateTalentsPoints() const; - // Dual Spec void UpdateSpecCount(uint8 count); uint32 GetActiveSpec() { return m_activeSpec; } @@ -1492,26 +1286,21 @@ class MANGOS_DLL_SPEC Player : public Unit uint8 GetSpecsCount() { return m_specsCount; } void SetSpecsCount(uint8 count) { m_specsCount = count; } void ActivateSpec(uint8 spec); - 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) - { + { m_Glyphs[m_activeSpec][slot] = glyph; - SetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot, glyph); + SetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot, glyph); } uint32 GetGlyph(uint8 slot) { return m_Glyphs[m_activeSpec][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; } - SpellCooldowns const& GetSpellCooldownMap() const { return m_spellCooldowns; } - void AddSpellMod(SpellModifier* mod, bool apply); bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell * spell = NULL); template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell * spell = NULL); @@ -1519,7 +1308,6 @@ class MANGOS_DLL_SPEC Player : public Unit void RestoreSpellMods(Spell * spell); void DropModCharge(SpellModifier * mod, Spell * spell); void SetSpellModTakingSpell(Spell* spell, bool apply); - static uint32 const infinityCooldownDelay = MONTH; // used for set "infinity cooldowns" for spells and check static uint32 const infinityCooldownDelayCheck = MONTH/2; bool HasSpellCooldown(uint32 spell_id) const @@ -1540,7 +1328,6 @@ class MANGOS_DLL_SPEC Player : public Unit void RemoveSpellCooldown(uint32 spell_id, bool update = false); void RemoveSpellCategoryCooldown(uint32 cat, bool update = false); void SendClearCooldown( uint32 spell_id, Unit* target ); - void RemoveCategoryCooldown(uint32 cat); void RemoveArenaSpellCooldowns(); void RemoveAllSpellCooldown(); @@ -1548,7 +1335,6 @@ class MANGOS_DLL_SPEC Player : public Unit 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) { m_resurrectGUID = guid; @@ -1563,7 +1349,6 @@ class MANGOS_DLL_SPEC Player : public Unit bool isRessurectRequestedBy(uint64 guid) const { return m_resurrectGUID == guid; } bool isRessurectRequested() const { return m_resurrectGUID != 0; } void ResurectUsingRequestData(); - int getCinematic() { return m_cinematic; @@ -1572,12 +1357,10 @@ class MANGOS_DLL_SPEC Player : public Unit { m_cinematic = cine; } - ActionButton* addActionButton(uint8 button, uint32 action, uint8 type); void removeActionButton(uint8 button); void SendInitialActionButtons() const { SendActionButtons(0); } void SendActionButtons(uint32 state) const; - PvPInfo pvpInfo; void UpdatePvPState(bool onlyFFA = false); void SetPvP(bool state) @@ -1589,10 +1372,8 @@ class MANGOS_DLL_SPEC Player : public Unit void UpdatePvP(bool state, bool override=false); void UpdateZone(uint32 newZone,uint32 newArea); void UpdateArea(uint32 newArea); - void UpdateZoneDependentAuras( uint32 zone_id ); // zones void UpdateAreaDependentAuras( uint32 area_id ); // subzones - void UpdateAfkReport(time_t currTime); void UpdatePvPFlag(time_t currTime); void UpdateContestedPvP(uint32 currTime); @@ -1603,13 +1384,11 @@ class MANGOS_DLL_SPEC Player : public Unit RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP); m_contestedPvPTimer = 0; } - /** todo: -maybe move UpdateDuelFlag+DuelComplete to independent DuelHandler.. **/ DuelInfo *duel; void UpdateDuelFlag(time_t currTime); void CheckDuelDistance(time_t currTime); void DuelComplete(DuelCompleteType type); - bool IsGroupVisibleFor(Player* p) const; bool IsInSameGroupWith(Player const* p) const; bool IsInSameRaidWith(Player const* p) const { return p==this || (GetGroup() != NULL && GetGroup() == p->GetGroup()); } @@ -1617,7 +1396,6 @@ class MANGOS_DLL_SPEC Player : public Unit static void RemoveFromGroup(Group* group, uint64 guid); void RemoveFromGroup() { RemoveFromGroup(GetGroup(),GetGUID()); } void SendUpdateToOutOfRangeGroupMembers(); - void SetInGuild(uint32 GuildId) { SetUInt32Value(PLAYER_GUILDID, GuildId); } void SetRank(uint32 rankId){ SetUInt32Value(PLAYER_GUILDRANK, rankId); } void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; } @@ -1627,7 +1405,6 @@ class MANGOS_DLL_SPEC Player : public Unit static uint32 GetRankFromDB(uint64 guid); int GetGuildIdInvited() { return m_GuildIdInvited; } static void RemovePetitionsAndSigns(uint64 guid, uint32 type); - // Arena Team void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot) { @@ -1638,26 +1415,19 @@ class MANGOS_DLL_SPEC Player : public Unit 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; } bool IsHeroic() { return m_dungeonDifficulty == DIFFICULTY_HEROIC; } - bool UpdateSkill(uint32 skill_id, uint32 step); bool UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step); - bool UpdateCraftSkill(uint32 spellid); bool UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLevel, uint32 Multiplicator = 1); bool UpdateFishingSkill(); - uint32 GetBaseDefenseSkillValue() const { return GetBaseSkillValue(SKILL_DEFENSE); } uint32 GetBaseWeaponSkillValue(WeaponAttackType attType) const; - uint32 GetSpellByProto(ItemPrototype *proto); - float GetHealthBonusFromStamina(); float GetManaBonusFromIntellect(); - bool UpdateStats(Stats stat); bool UpdateAllStats(); void UpdateResistances(uint32 school); @@ -1670,9 +1440,7 @@ class MANGOS_DLL_SPEC Player : public Unit void UpdateDamagePhysical(WeaponAttackType attType); void ApplySpellPowerBonus(int32 amount, bool apply); void UpdateSpellDamageAndHealingBonus(); - void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& min_damage, float& max_damage); - void UpdateDefenseBonusesMod(); void ApplyRatingMod(CombatRating cr, int32 value, bool apply); inline void RecalculateRating(CombatRating cr) { ApplyRatingMod(cr, 0, true);} @@ -1688,7 +1456,6 @@ class MANGOS_DLL_SPEC Player : public Unit uint32 GetSpellCritDamageReduction(uint32 damage) const; uint32 GetDotDamageReduction(uint32 damage) const; uint32 GetBaseSpellPowerBonus() { return m_baseSpellPower; } - float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const; void UpdateBlockPercentage(); void UpdateCritPercentage(WeaponAttackType attType); @@ -1698,27 +1465,21 @@ class MANGOS_DLL_SPEC Player : public Unit void UpdateMeleeHitChances(); void UpdateRangedHitChances(); void UpdateSpellHitChances(); - void UpdateAllSpellCritChances(); void UpdateSpellCritChance(uint32 school); void UpdateArmorPenetration(int32 amount); void UpdateExpertise(WeaponAttackType attType); void ApplyManaRegenBonus(int32 amount, bool apply); void UpdateManaRegen(); - const uint64& GetLootGUID() const { return m_lootGuid; } void SetLootGUID(const uint64 &guid) { m_lootGuid = guid; } - void RemovedInsignia(Player* looterPlr); - WorldSession* GetSession() const { return m_session; } void SetSession(WorldSession *s) { m_session = s; } - void BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const; void DestroyForPlayer( Player *target, bool anim = false ) const; void SendDelayResponse(const uint32); void SendLogXPGain(uint32 GivenXP,Unit* victim,uint32 RestXP); - // notifiers void SendAttackSwingCantAttack(); void SendAttackSwingCancelAttack(); @@ -1727,25 +1488,19 @@ class MANGOS_DLL_SPEC Player : public Unit void SendAttackSwingBadFacingAttack(); void SendAutoRepeatCancel(Unit *target); void SendExplorationExperience(uint32 Area, uint32 Experience); - void SendDungeonDifficulty(bool IsInGroup); void ResetInstances(uint8 method); void SendResetInstanceSuccess(uint32 MapId); void SendResetInstanceFailed(uint32 reason, uint32 MapId); void SendResetFailedNotify(uint32 mapid); - bool SetPosition(const Position &pos, bool teleport = false) { return SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); } 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);// 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); - void SendTeleportAckMsg(); - static void DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmChars = true); - Corpse *GetCorpse() const; void SpawnCorpseBones(); void CreateCorpse(); @@ -1755,7 +1510,6 @@ class MANGOS_DLL_SPEC Player : public Unit void ResurrectPlayer(float restore_percent, bool applySickness = false); void BuildPlayerRepop(); void RepopAtGraveyard(); - void DurabilityLossAll(double percent, bool inventory); void DurabilityLoss(Item* item, double percent); void DurabilityPointsLossAll(int32 points, bool inventory); @@ -1763,7 +1517,6 @@ class MANGOS_DLL_SPEC Player : public Unit void DurabilityPointLossForEquipSlot(EquipmentSlots slot); uint32 DurabilityRepairAll(bool cost, float discountMod, bool guildBank); uint32 DurabilityRepair(uint16 pos, bool cost, float discountMod, bool guildBank); - void UpdateMirrorTimers(); void StopMirrorTimers() { @@ -1771,19 +1524,15 @@ class MANGOS_DLL_SPEC Player : public Unit StopMirrorTimer(BREATH_TIMER); StopMirrorTimer(FIRE_TIMER); } - void SetMovement(PlayerMovementType pType); - void JoinedChannel(Channel *c); void LeftChannel(Channel *c); void CleanupChannels(); void UpdateLocalChannels( uint32 newZone ); void LeaveLFGChannel(); - void UpdateDefense(); void UpdateWeaponSkill (WeaponAttackType attType); void UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, bool defence); - void SetSkill(uint32 id, uint16 currVal, uint16 maxVal); uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus + temp bonus uint16 GetPureMaxSkillValue(uint32 skill) const; // max @@ -1794,7 +1543,6 @@ class MANGOS_DLL_SPEC Player : public Unit int16 GetSkillTempBonusValue(uint32 skill) const; bool HasSkill(uint32 skill) const; void learnSkillRewardedSpells(uint32 id, uint32 value); - WorldLocation& GetTeleportDest() { return m_teleport_dest; } bool IsBeingTeleported() const { return mSemaphoreTeleport_Near || mSemaphoreTeleport_Far; } bool IsBeingTeleportedNear() const { return mSemaphoreTeleport_Near; } @@ -1802,32 +1550,25 @@ class MANGOS_DLL_SPEC Player : public Unit void SetSemaphoreTeleportNear(bool semphsetting) { mSemaphoreTeleport_Near = semphsetting; } void SetSemaphoreTeleportFar(bool semphsetting) { mSemaphoreTeleport_Far = semphsetting; } void ProcessDelayedOperations(); - 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); - void InitDisplayIds(); - bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const; bool RewardPlayerAndGroupAtKill(Unit* pVictim); void RewardPlayerAndGroupAtEvent(uint32 creature_id,WorldObject* pRewardSource); bool isHonorOrXPTarget(Unit* pVictim); - 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 UpdateSkillsForLevel(); void UpdateSkillsToMaxSkillsForLevel(); // for .levelup void ModifySkillBonus(uint32 skillid,int32 val, bool talent); - /*********************************************************/ /*** PVP SYSTEM ***/ /*********************************************************/ @@ -1839,20 +1580,15 @@ class MANGOS_DLL_SPEC Player : public Unit void ModifyHonorPoints( int32 value ); void ModifyArenaPoints( int32 value ); uint32 GetMaxPersonalArenaRatingRequirement(); - //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); - uint32 GetDeathTimer() const { return m_deathTimer; } uint32 GetCorpseReclaimDelay(bool pvp) const; void UpdateCorpseReclaimDelay(); void SendCorpseReclaimDelay(bool load = false); - uint32 GetShieldBlockValue() const; // overwrite Unit version (virtual) bool CanParry() const { return m_canParry; } void SetCanParry(bool value); @@ -1861,7 +1597,6 @@ class MANGOS_DLL_SPEC Player : public Unit 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; } void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply); @@ -1870,11 +1605,9 @@ class MANGOS_DLL_SPEC Player : public Unit float GetTotalPercentageModValue(BaseModGroup modGroup) const { return m_auraBaseMod[modGroup][FLAT_MOD] + m_auraBaseMod[modGroup][PCT_MOD]; } void _ApplyAllStatBonuses(); void _RemoveAllStatBonuses(); - void _ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackType, 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(); void _ApplyAllItemMods(); @@ -1885,45 +1618,35 @@ class MANGOS_DLL_SPEC Player : public Unit void ToggleMetaGemsActive(uint8 exceptslot, bool apply); void CorrectMetaGemEnchants(uint8 slot, bool apply); void InitDataForForm(bool reapplyMods = false); - void ApplyItemEquipSpell(Item *item, bool apply, bool form_change = false); void ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply, bool form_change = false); void UpdateEquipSpellsAtFormChange(); void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx); void CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 cast_count, uint32 glyphIndex); void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item *item, ItemPrototype const * proto); - void SendEquipmentSetList(); void SetEquipmentSet(uint32 index, EquipmentSet eqset); void DeleteEquipmentSet(uint64 setGuid); - void SendInitWorldStates(uint32 zone, uint32 area); void SendUpdateWorldState(uint32 Field, uint32 Value); void SendDirectMessage(WorldPacket *data); - void SendAurasForTarget(Unit *target); - PlayerMenu* PlayerTalkClass; std::vector<ItemSetEffect *> ItemSetEff; - void SendLoot(uint64 guid, LootType loot_type); void SendLootRelease( uint64 guid ); void SendNotifyLootItemRemoved(uint8 lootSlot); void SendNotifyLootMoneyRemoved(); - /*********************************************************/ /*** BATTLEGROUND SYSTEM ***/ /*********************************************************/ - bool InBattleGround() const { return m_bgData.bgInstanceID != 0; } bool InArena() const; uint32 GetBattleGroundId() const { return m_bgData.bgInstanceID; } BattleGroundTypeId GetBattleGroundTypeId() const { return m_bgData.bgTypeID; } BattleGround* GetBattleGround() const; - BGQueueIdBasedOnLevel GetBattleGroundQueueIdFromLevel(BattleGroundTypeId bgTypeId) const; - bool InBattleGroundQueue() const { for (uint8 i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) @@ -1931,7 +1654,6 @@ class MANGOS_DLL_SPEC Player : public Unit return true; return false; } - BattleGroundQueueTypeId GetBattleGroundQueueTypeId(uint32 index) const { return m_bgBattleGroundQueueID[index].bgQueueTypeId; } uint32 GetBattleGroundQueueIndex(BattleGroundQueueTypeId bgQueueTypeId) const { @@ -1951,7 +1673,6 @@ class MANGOS_DLL_SPEC Player : public Unit { return GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES; } - void SetBattleGroundId(uint32 val, BattleGroundTypeId bgTypeId) { m_bgData.bgInstanceID = val; @@ -2004,53 +1725,41 @@ class MANGOS_DLL_SPEC Player : public Unit } WorldLocation const& GetBattleGroundEntryPoint() const { return m_bgData.joinPos; } void SetBattleGroundEntryPoint(); - void SetBGTeam(uint32 team) { m_bgData.bgTeam = team; } uint32 GetBGTeam() const { return m_bgData.bgTeam ? m_bgData.bgTeam : GetTeam(); } - void LeaveBattleground(bool teleportToEntryPoint = true); bool CanJoinToBattleground() const; bool CanReportAfkDueToLimit(); void ReportedAfkBy(Player* reporter); void ClearAfkReports() { m_bgData.bgAfkReporter.clear(); } - bool GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const; bool isTotalImmunity(); bool CanUseBattleGroundObject(); bool isTotalImmune(); bool CanCaptureTowerPoint(); - /*********************************************************/ /*** OUTDOOR PVP SYSTEM ***/ /*********************************************************/ - OutdoorPvP * GetOutdoorPvP() const; // returns true if the player is in active state for outdoor pvp objective capturing, false otherwise bool IsOutdoorPvPActive(); - /*********************************************************/ /*** REST SYSTEM ***/ /*********************************************************/ - 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;}; - /*********************************************************/ /*** ENVIROMENTAL SYSTEM ***/ /*********************************************************/ - uint32 EnvironmentalDamage(EnviromentalDamage type, uint32 damage); - /*********************************************************/ /*** FLOOD FILTER SYSTEM ***/ /*********************************************************/ - void UpdateSpeakTime(); bool CanSpeak() const; void ChangeSpeakTime(int utime); - /*********************************************************/ /*** VARIOUS SYSTEMS ***/ /*********************************************************/ @@ -2063,11 +1772,8 @@ class MANGOS_DLL_SPEC Player : public Unit m_lastFallZ = z; } void HandleFall(MovementInfo const& movementInfo); - bool IsKnowHowFlyIn(uint32 mapid, uint32 zone) const; - void SetClientControl(Unit* target, uint8 allowMove); - void SetMover(Unit* target) { m_mover->m_movedPlayer = NULL; @@ -2079,10 +1785,8 @@ class MANGOS_DLL_SPEC Player : public Unit WorldObject* GetViewpoint() const; void StopCastingCharm(); void StopCastingBindSight(); - uint32 GetSaveTimer() const { return m_nextSave; } void SetSaveTimer(uint32 timer) { m_nextSave = timer; } - // Recall position uint32 m_recallMap; float m_recallX; @@ -2090,61 +1794,44 @@ class MANGOS_DLL_SPEC Player : public Unit float m_recallZ; float m_recallO; void SaveRecallPosition(); - // Homebind coordinates uint32 m_homebindMapId; uint16 m_homebindZoneId; float m_homebindX; float m_homebindY; float m_homebindZ; - WorldLocation GetStartPosition() const; - // currently visible objects at player client typedef std::set<uint64> ClientGUIDs; ClientGUIDs m_clientGUIDs; - bool HaveAtClient(WorldObject const* u) const { return u==this || m_clientGUIDs.find(u->GetGUID())!=m_clientGUIDs.end(); } - bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList = false, bool is3dDistance = true) const; bool IsVisibleInGridForPlayer(Player const* pl) const; bool IsVisibleGloballyFor(Player* pl) const; - void UpdateVisibilityOf(WorldObject* target); void SendInitialVisiblePackets(Unit* target); - template<class T> void UpdateVisibilityOf(T* target, UpdateData& data, std::set<WorldObject*>& visibleNow); - // Stealth detection system void HandleStealthedUnitsDetection(); - uint8 m_forced_speed_changes[MAX_MOVE_TYPE]; - bool HasAtLoginFlag(AtLoginFlags f) const { return m_atLoginFlags & f; } void SetAtLoginFlag(AtLoginFlags f) { m_atLoginFlags |= f; } void RemoveAtLoginFlag(AtLoginFlags f, bool in_db_also = false); - LookingForGroup m_lookingForGroup; - // Temporarily removed pet cache uint32 GetTemporaryUnsummonedPetNumber() const { return m_temporaryUnsummonedPetNumber; } void SetTemporaryUnsummonedPetNumber(uint32 petnumber) { m_temporaryUnsummonedPetNumber = petnumber; } void UnsummonPetTemporaryIfAny(); void ResummonPetTemporaryUnSummonedIfAny(); bool IsPetNeedBeTemporaryUnsummoned() const { return !IsInWorld() || !isAlive() || IsMounted() /*+in flight*/; } - void SendCinematicStart(uint32 CinematicSequenceId); void SendMovieStart(uint32 MovieId); - /*********************************************************/ /*** INSTANCE SYSTEM ***/ /*********************************************************/ - typedef UNORDERED_MAP< uint32 /*mapId*/, InstancePlayerBind > BoundInstancesMap; - void UpdateHomebindTime(uint32 time); - uint32 m_HomebindTimer; bool m_InstanceValid; // permanent binds and solo binds by difficulty @@ -2159,15 +1846,12 @@ class MANGOS_DLL_SPEC Player : public Unit void SendSavedInstances(); static void ConvertInstancesToGroup(Player *player, Group *group = NULL, uint64 player_guid = 0); bool Satisfy(AccessRequirement const*, uint32 target_map, bool report = false); - // last used pet number (for BG's) uint32 GetLastPetNumber() const { return m_lastpetnumber; } void SetLastPetNumber(uint32 petnumber) { m_lastpetnumber = petnumber; } - /*********************************************************/ /*** GROUP SYSTEM ***/ /*********************************************************/ - Group * GetGroupInvite() { return m_groupInvite; } void SetGroupInvite(Group *group) { m_groupInvite = group; } Group * GetGroup() { return m_group.getTarget(); } @@ -2188,16 +1872,12 @@ class MANGOS_DLL_SPEC Player : public Unit 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; } - // Set map to player and add reference void SetMap(Map * map); void ResetMap(); - bool isAllowedToLoot(Creature* creature); - DeclinedName const* GetDeclinedNames() const { return m_declinedname; } uint8 GetRunesState() const { return m_runes->runeState; } RuneType GetBaseRune(uint8 index) const { return RuneType(m_runes->runes[index].BaseRune); } @@ -2213,18 +1893,14 @@ class MANGOS_DLL_SPEC Player : public Unit 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); void CompletedAchievement(AchievementEntry const* entry); - bool HasTitle(uint32 bitIndex); bool HasTitle(CharTitlesEntry const* title) { return HasTitle(title->bit_index); } void SetTitle(CharTitlesEntry const* title, bool lost = false); - //bool isActiveObject() const { return true; } bool canSeeSpellClickOn(Creature const* creature) const; - uint32 GetChampioningFaction() const { return m_ChampioningFaction; } void SetChampioningFaction(uint32 faction) { m_ChampioningFaction = faction; } Spell * m_spellModTakingSpell; @@ -2233,11 +1909,9 @@ Spell * m_spellModTakingSpell; uint32 m_regenTimerCount; float m_powerFraction[MAX_POWERS]; uint32 m_contestedPvPTimer; - /*********************************************************/ /*** BATTLEGROUND SYSTEM ***/ /*********************************************************/ - /* this is an array of BG queues (BgTypeIDs) in which is player */ @@ -2246,24 +1920,18 @@ Spell * m_spellModTakingSpell; BattleGroundQueueTypeId bgQueueTypeId; uint32 invitedToInstance; }; - BgBattleGroundQueueID_Rec m_bgBattleGroundQueueID[PLAYER_MAX_BATTLEGROUND_QUEUES]; BGData m_bgData; - /*********************************************************/ /*** QUEST SYSTEM ***/ /*********************************************************/ - //We allow only one timed quest active at the same time. Below can then be simple value instead of set. std::set<uint32> m_timedquests; - uint64 m_divider; uint32 m_ingametime; - /*********************************************************/ /*** LOAD SYSTEM ***/ /*********************************************************/ - void _LoadActions(QueryResult *result, bool startup); void _LoadAuras(QueryResult *result, uint32 timediff); void _LoadGlyphAuras(); @@ -2285,11 +1953,9 @@ Spell * m_spellModTakingSpell; void _LoadBGData(QueryResult* result); void _LoadGlyphs(QueryResult *result); void _LoadTalents(QueryResult *result); - /*********************************************************/ /*** SAVE SYSTEM ***/ /*********************************************************/ - void _SaveActions(); void _SaveAuras(); void _SaveInventory(); @@ -2301,10 +1967,8 @@ Spell * m_spellModTakingSpell; void _SaveBGData(); void _SaveGlyphs(); void _SaveTalents(); - void _SetCreateBits(UpdateMask *updateMask, Player *target) const; void _SetUpdateBits(UpdateMask *updateMask, Player *target) const; - /*********************************************************/ /*** ENVIRONMENTAL SYSTEM ***/ /*********************************************************/ @@ -2313,100 +1977,71 @@ Spell * m_spellModTakingSpell; void StopMirrorTimer(MirrorTimerType Type); void HandleDrowning(uint32 time_diff); int32 getMaxTimer(MirrorTimerType timer); - /*********************************************************/ /*** HONOR SYSTEM ***/ /*********************************************************/ time_t m_lastHonorUpdateTime; - void outDebugValues() const; uint64 m_lootGuid; - uint32 m_team; uint32 m_nextSave; time_t m_speakTime; uint32 m_speakCount; uint32 m_dungeonDifficulty; - uint32 m_atLoginFlags; - Item* m_items[PLAYER_SLOTS_COUNT]; uint32 m_currentBuybackSlot; - std::vector<Item*> m_itemUpdateQueue; bool m_itemUpdateQueueBlocked; - uint32 m_ExtraFlags; uint64 m_curSelection; - uint64 m_comboTarget; int8 m_comboPoints; - QuestStatusMap mQuestStatus; - uint32 m_GuildIdInvited; uint32 m_ArenaTeamIdInvited; - PlayerMails m_mail; PlayerSpellMap m_spells; PlayerTalentMap *m_talents[MAX_TALENT_SPECS]; uint32 m_lastPotionId; // last used health/mana potion in combat, that block next potion use - uint32 m_activeSpec; uint32 m_specsCount; - uint32 m_Glyphs[MAX_TALENT_SPECS][MAX_GLYPH_SLOT_INDEX]; - ActionButtonList m_actionButtons; - float m_auraBaseMod[BASEMOD_END][MOD_END]; int16 m_baseRatingValue[MAX_COMBAT_RATING]; uint16 m_baseSpellPower; uint16 m_baseFeralAP; uint16 m_baseManaRegen; - SpellModList m_spellMods[MAX_SPELLMOD]; uint32 m_pad; // Spell * m_spellModTakingSpell; // Spell for which charges are dropped in spell::finish - EnchantDurationList m_enchantDuration; ItemDurationList m_itemDuration; - uint64 m_resurrectGUID; uint32 m_resurrectMap; float m_resurrectX, m_resurrectY, m_resurrectZ; uint32 m_resurrectHealth, m_resurrectMana; - WorldSession *m_session; - typedef std::list<Channel*> JoinedChannelsList; JoinedChannelsList m_channels; - int m_cinematic; - Player *pTrader; bool acceptTrade; uint16 tradeItems[TRADE_SLOT_COUNT]; uint32 tradeGold; - time_t m_nextThinkTime; - bool m_DailyQuestChanged; time_t m_lastDailyQuestTime; - uint32 m_drunkTimer; uint16 m_drunk; uint32 m_weaponChangeTimer; - uint32 m_zoneUpdateId; uint32 m_zoneUpdateTimer; uint32 m_areaUpdateId; - uint32 m_deathTimer; time_t m_deathExpireTime; - uint32 m_restTime; - uint32 m_WeaponProficiency; uint32 m_ArmorProficiency; bool m_canParry; @@ -2414,7 +2049,6 @@ Spell * m_spellModTakingSpell; bool m_canTitanGrip; uint8 m_swingErrorMsg; float m_ammoDPS; - ////////////////////Rest System///////////////////// int time_inn_enter; uint32 inn_pos_mapid; @@ -2424,32 +2058,26 @@ Spell * m_spellModTakingSpell; float m_rest_bonus; RestType rest_type; ////////////////////Rest System///////////////////// - 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_auraRaidUpdateMask; - // last used pet number (for BG's) uint32 m_lastpetnumber; - // Player summoning time_t m_summon_expire; uint32 m_summon_mapid; float m_summon_x; float m_summon_y; float m_summon_z; - DeclinedName *m_declinedname; Runes *m_runes; EquipmentSets m_EquipmentSets; @@ -2459,63 +2087,47 @@ Spell * m_spellModTakingSpell; uint8 _CanStoreItem_InBag( uint8 bag, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot ) const; 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 ); - bool IsCanDelayTeleport() const { return m_bCanDelayTeleport; } void SetCanDelayTeleport(bool setting) { m_bCanDelayTeleport = setting; } bool IsHasDelayedTeleport() const { return m_bHasDelayedTeleport; } void SetDelayedTeleportFlag(bool setting) { m_bHasDelayedTeleport = setting; } - void ScheduleDelayedOperation(uint32 operation) { if(operation < DELAYED_END) m_DelayedOperations |= operation; } - 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; uint32 m_teleport_options; bool mSemaphoreTeleport_Near; bool mSemaphoreTeleport_Far; - uint32 m_DelayedOperations; bool m_bCanDelayTeleport; bool m_bHasDelayedTeleport; - uint32 m_DetectInvTimer; - // Temporary removed pet cache uint32 m_temporaryUnsummonedPetNumber; uint32 m_oldpetspell; - AchievementMgr m_achievementMgr; ReputationMgr m_reputationMgr; - SpellCooldowns m_spellCooldowns; - uint32 m_ChampioningFaction; }; - 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 * spell) { @@ -2523,19 +2135,15 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas 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) @@ -2545,17 +2153,13 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas // skip percent mods for null basevalue (most important for spell mods with charges ) if(basevalue == T(0)) continue; - // special case (skip >10sec spell casts for instant cast setting) if( mod->op==SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100) continue; - totalpct += mod->value; } - DropModCharge(mod, spell); } - float diff = (float)basevalue*(float)totalpct/100.0f + (float)totalflat; basevalue = T((float)basevalue + diff); return T(diff); |