AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Player Class Reference

#include "Player.h"

Inheritance diagram for Player:
Unit GridObject< Player > WorldObject Object WorldLocation Position

Classes

struct  BgBattlegroundQueueID_Rec
 
struct  ChatFloodThrottle
 

Public Types

typedef std::unordered_map< ObjectGuid::LowType, Item * > ItemMap
 
typedef std::set< uint32DFQuestsDoneList
 
- Public Types inherited from Unit
typedef std::unordered_set< Unit * > AttackerSet
 
typedef std::set< Unit * > ControlSet
 
typedef std::multimap< uint32, Aura * > AuraMap
 
typedef std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
 
typedef std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
 
typedef std::multimap< uint32, AuraApplication * > AuraApplicationMap
 
typedef std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
 
typedef std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
 
typedef std::multimap< AuraStateType, AuraApplication * > AuraStateAurasMap
 
typedef std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
 
typedef std::list< AuraEffect * > AuraEffectList
 
typedef std::list< Aura * > AuraList
 
typedef std::list< AuraApplication * > AuraApplicationList
 
typedef std::list< DiminishingReturnDiminishing
 
typedef GuidUnorderedSet ComboPointHolderSet
 
typedef std::map< uint8, AuraApplication * > VisibleAuraMap
 
typedef std::set< PetAura const * > PetAuraSet
 

Public Member Functions

 Player (WorldSession *session)
 
 ~Player () override
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void SetObjectScale (float scale) override
 
bool hasSpanishClient ()
 
bool TeleportTo (uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
 
bool TeleportTo (WorldLocation const &loc, uint32 options=0, Unit *target=nullptr)
 
bool TeleportToEntryPoint ()
 
void SetSummonPoint (uint32 mapid, float x, float y, float z, uint32 delay=0, bool asSpectator=false)
 
bool IsSummonAsSpectator () const
 
void SetSummonAsSpectator (bool on)
 
void SummonIfPossible (bool agree, ObjectGuid summoner_guid)
 
time_t GetSummonExpireTimer () const
 
bool Create (ObjectGuid::LowType guidlow, CharacterCreateInfo *createInfo)
 
void Update (uint32 time) override
 
PlayerFlags GetPlayerFlags () const
 
bool HasPlayerFlag (PlayerFlags flags) const
 
void SetPlayerFlag (PlayerFlags flags)
 
void RemovePlayerFlag (PlayerFlags flags)
 
void ReplaceAllPlayerFlags (PlayerFlags flags)
 
void SetInWater (bool apply)
 
bool IsInWater () const override
 
bool IsFalling () const
 
bool IsInAreaTriggerRadius (AreaTrigger const *trigger, float delta=0.f) const
 
void SendInitialPacketsBeforeAddToMap ()
 
void SendInitialPacketsAfterAddToMap ()
 
void SendTransferAborted (uint32 mapid, TransferAbortReason reason, uint8 arg=0)
 
void SendInstanceResetWarning (uint32 mapid, Difficulty difficulty, uint32 time, bool onEnterMap)
 
bool CanInteractWithQuestGiver (Object *questGiver)
 
CreatureGetNPCIfCanInteractWith (ObjectGuid guid, uint32 npcflagmask)
 
GameObjectGetGameObjectIfCanInteractWith (ObjectGuid guid, GameobjectTypes type) const
 
void ToggleAFK ()
 
void ToggleDND ()
 
bool isAFK () const
 
bool isDND () const
 
uint8 GetChatTag () const
 
uint32 GetBarberShopCost (uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const *newSkin=nullptr)
 
PlayerSocialGetSocial ()
 
void InitTaxiNodesForLevel ()
 
bool ActivateTaxiPathTo (std::vector< uint32 > const &nodes, Creature *npc=nullptr, uint32 spellid=1)
 
bool ActivateTaxiPathTo (uint32 taxi_path_id, uint32 spellid=1)
 
void CleanupAfterTaxiFlight ()
 
void ContinueTaxiFlight ()
 
void SendTaxiNodeStatusMultiple ()
 
bool IsCommentator () const
 
void SetCommentator (bool on)
 
bool IsDeveloper () const
 
void SetDeveloper (bool on)
 
bool isAcceptWhispers () const
 
void SetAcceptWhispers (bool on)
 
bool IsGameMaster () const
 
void SetGameMaster (bool on)
 
bool isGMChat () const
 
void SetGMChat (bool on)
 
bool isTaxiCheater () const
 
void SetTaxiCheater (bool on)
 
bool isGMVisible () const
 
void SetGMVisible (bool on)
 
bool Has310Flyer (bool checkAllSpells, uint32 excludeSpellId=0)
 
void SetHas310Flyer (bool on)
 
void SetPvPDeath (bool on)
 
void GiveXP (uint32 xp, Unit *victim, float group_rate=1.0f, bool isLFGReward=false)
 
void GiveLevel (uint8 level)
 
void InitStatsForLevel (bool reapplyMods=false)
 
bool GetCommandStatus (uint32 command) const
 
void SetCommandStatusOn (uint32 command)
 
void SetCommandStatusOff (uint32 command)
 
uint32 GetTotalPlayedTime ()
 
uint32 GetLevelPlayedTime ()
 
void setDeathState (DeathState s, bool despawn=false) override
 
void SetRestState (uint32 triggerId)
 
void RemoveRestState ()
 
uint32 GetXPRestBonus (uint32 xp)
 
float GetRestBonus () const
 
void SetRestBonus (float rest_bonus_new)
 
bool HasRestFlag (RestFlag restFlag) const
 
void SetRestFlag (RestFlag restFlag, uint32 triggerId=0)
 
void RemoveRestFlag (RestFlag restFlag)
 
uint32 GetInnTriggerId () const
 
PetStableGetPetStable ()
 
PetStableGetOrInitPetStable ()
 
PetStable const * GetPetStable () const
 
PetGetPet () const
 
PetSummonPet (uint32 entry, float x, float y, float z, float ang, PetType petType, Milliseconds duration=0s, uint32 healthPct=0)
 
void RemovePet (Pet *pet, PetSaveMode mode, bool returnreagent=false)
 
bool CanPetResurrect ()
 
bool IsExistPet ()
 
PetCreatePet (Creature *creatureTarget, uint32 spellID=0)
 
PetCreatePet (uint32 creatureEntry, uint32 spellID=0)
 
uint32 GetPhaseMaskForSpawn () const
 
void Say (std::string_view text, Language language, WorldObject const *=nullptr) override
 Handles said message in regular chat based on declared language and in config pre-defined Range.
 
void Say (uint32 textId, WorldObject const *target=nullptr) override
 
void Yell (std::string_view text, Language language, WorldObject const *=nullptr) override
 Handles yelled message in regular chat based on declared language and in config pre-defined Range.
 
void Yell (uint32 textId, WorldObject const *target=nullptr) override
 
void TextEmote (std::string_view text, WorldObject const *=nullptr, bool=false) override
 Outputs an universal text which is supposed to be an action.
 
void TextEmote (uint32 textId, WorldObject const *target=nullptr, bool isBossEmote=false) override
 
void Whisper (std::string_view text, Language language, Player *receiver, bool=false) override
 Handles whispers from Addons and players based on sender, receiver's guid and language.
 
void Whisper (uint32 textId, Player *target, bool isBossWhisper=false) override
 
void SetVirtualItemSlot (uint8 i, Item *item)
 
void SetSheath (SheathState sheathed) override
 
uint8 FindEquipSlot (ItemTemplate const *proto, uint32 slot, bool swap) const
 
uint32 GetItemCount (uint32 item, bool inBankAlso=false, Item *skipItem=nullptr) const
 
uint32 GetItemCountWithLimitCategory (uint32 limitCategory, Item *skipItem=nullptr) const
 
ItemGetItemByGuid (ObjectGuid guid) const
 
ItemGetItemByEntry (uint32 entry) const
 
ItemGetItemByPos (uint16 pos) const
 
ItemGetItemByPos (uint8 bag, uint8 slot) const
 
BagGetBagByPos (uint8 slot) const
 
uint32 GetFreeInventorySpace () const
 
ItemGetUseableItemByPos (uint8 bag, uint8 slot) const
 
ItemGetWeaponForAttack (WeaponAttackType attackType, bool useable=false) const
 
ItemGetShield (bool useable=false) const
 
std::vector< Item * > & GetItemUpdateQueue ()
 
bool IsValidPos (uint16 pos, bool explicit_pos)
 
bool IsValidPos (uint8 bag, uint8 slot, bool explicit_pos)
 
uint8 GetBankBagSlotCount () const
 
void SetBankBagSlotCount (uint8 count)
 
bool HasItemCount (uint32 item, uint32 count=1, bool inBankAlso=false) const
 
bool HasItemFitToSpellRequirements (SpellInfo const *spellInfo, Item const *ignoreItem=nullptr) const
 
bool CanNoReagentCast (SpellInfo 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
 
InventoryResult CanTakeMoreSimilarItems (Item *pItem) const
 
InventoryResult CanTakeMoreSimilarItems (uint32 entry, uint32 count) const
 
InventoryResult CanStoreNewItem (uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
 
InventoryResult CanStoreItem (uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap=false) const
 
InventoryResult CanStoreItems (Item **pItem, int32 count) const
 
InventoryResult CanEquipNewItem (uint8 slot, uint16 &dest, uint32 item, bool swap) const
 
InventoryResult CanEquipItem (uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading=true) const
 
InventoryResult CanEquipUniqueItem (Item *pItem, uint8 except_slot=NULL_SLOT, uint32 limit_count=1) const
 
InventoryResult CanEquipUniqueItem (ItemTemplate const *itemProto, uint8 except_slot=NULL_SLOT, uint32 limit_count=1) const
 
InventoryResult CanUnequipItems (uint32 item, uint32 count) const
 
InventoryResult CanUnequipItem (uint16 src, bool swap) const
 
InventoryResult CanBankItem (uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading=true) const
 
InventoryResult CanUseItem (Item *pItem, bool not_loading=true) const
 
bool HasItemTotemCategory (uint32 TotemCategory) const
 
bool IsTotemCategoryCompatiableWith (ItemTemplate const *pProto, uint32 requiredTotemCategoryId) const
 
InventoryResult CanUseItem (ItemTemplate const *pItem) const
 
InventoryResult CanUseAmmo (uint32 item) const
 
InventoryResult CanRollForItemInLFG (ItemTemplate const *item, WorldObject const *lootedObject) const
 
ItemStoreNewItem (ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0)
 
ItemStoreNewItem (ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet &allowedLooters)
 
ItemStoreItem (ItemPosCountVec const &pos, Item *pItem, bool update)
 
ItemEquipNewItem (uint16 pos, uint32 item, bool update)
 
ItemEquipItem (uint16 pos, Item *pItem, bool update)
 
void AutoUnequipOffhandIfNeed (bool force=false)
 
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)
 
LootItemStoreLootItem (uint8 lootSlot, Loot *loot, InventoryResult &msg)
 
void UpdateLootAchievements (LootItem *item, Loot *loot)
 
void UpdateTitansGrip ()
 
InventoryResult CanTakeMoreSimilarItems (uint32 entry, uint32 count, Item *pItem, uint32 *no_space_count=nullptr) const
 
InventoryResult CanStoreItem (uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 entry, uint32 count, Item *pItem=nullptr, bool swap=false, uint32 *no_space_count=nullptr) const
 
void AddRefundReference (ObjectGuid itemGUID)
 
void DeleteRefundReference (ObjectGuid itemGUID)
 
void ApplyEquipCooldown (Item *pItem)
 
void SetAmmo (uint32 item)
 
void RemoveAmmo ()
 
float GetAmmoDPS () const
 
bool CheckAmmoCompatibility (ItemTemplate const *ammo_proto) const
 
void QuickEquipItem (uint16 pos, Item *pItem)
 
void VisualizeItem (uint8 slot, Item *pItem)
 
void SetVisibleItemSlot (uint8 slot, Item *pItem)
 
ItemBankItem (ItemPosCountVec const &dest, Item *pItem, bool update)
 
ItemBankItem (uint16 pos, Item *pItem, bool update)
 
void RemoveItem (uint8 bag, uint8 slot, bool update, bool swap=false)
 
void MoveItemFromInventory (uint8 bag, uint8 slot, bool update)
 
void MoveItemToInventory (ItemPosCountVec const &dest, Item *pItem, bool update, bool in_characterInventoryDB=false)
 
void RemoveItemDependentAurasAndCasts (Item *pItem)
 
void DestroyItem (uint8 bag, uint8 slot, bool update)
 
void DestroyItemCount (uint32 item, uint32 count, bool update, bool unequip_check=false)
 
void DestroyItemCount (Item *item, uint32 &count, bool update)
 
void DestroyConjuredItems (bool update)
 
void DestroyZoneLimitedItem (bool update, uint32 new_zone)
 
void SplitItem (uint16 src, uint16 dst, uint32 count)
 
void SwapItem (uint16 src, uint16 dst)
 
void AddItemToBuyBackSlot (Item *pItem, uint32 money)
 
ItemGetItemFromBuyBackSlot (uint32 slot)
 
void RemoveItemFromBuyBackSlot (uint32 slot, bool del)
 
uint32 GetMaxKeyringSize () const
 
void SendEquipError (InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
 
void SendBuyError (BuyResult msg, Creature *creature, uint32 item, uint32 param)
 
void SendSellError (SellResult msg, Creature *creature, ObjectGuid guid, uint32 param)
 
void AddWeaponProficiency (uint32 newflag)
 
void AddArmorProficiency (uint32 newflag)
 
uint32 GetWeaponProficiency () const
 
uint32 GetArmorProficiency () const
 
bool IsTwoHandUsed () const
 
void SendNewItem (Item *item, uint32 count, bool received, bool created, bool broadcast=false, bool sendChatMessage=true)
 
bool BuyItemFromVendorSlot (ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot)
 
bool _StoreOrEquipNewItem (uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const *pProto, Creature *pVendor, VendorItem const *crItem, bool bStore)
 
float GetReputationPriceDiscount (Creature const *creature) const
 
float GetReputationPriceDiscount (FactionTemplateEntry const *factionTemplate) const
 
PlayerGetTrader () const
 
TradeDataGetTradeData () const
 
void TradeCancel (bool sendback)
 
CinematicMgrGetCinematicMgr () const
 
void UpdateEnchantTime (uint32 time)
 
void UpdateSoulboundTradeItems ()
 
void AddTradeableItem (Item *item)
 
void RemoveTradeableItem (Item *item)
 
void UpdateItemDuration (uint32 time, bool realtimeonly=false)
 
void AddEnchantmentDurations (Item *item)
 
void RemoveEnchantmentDurations (Item *item)
 
void RemoveEnchantmentDurationsReferences (Item *item)
 
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)
 
void UpdateSkillEnchantments (uint16 skill_id, uint16 curr_value, uint16 new_value)
 
void SendEnchantmentDurations ()
 
void UpdateEnchantmentDurations ()
 
void BuildEnchantmentsInfoData (WorldPacket *data)
 
void AddItemDurations (Item *item)
 
void RemoveItemDurations (Item *item)
 
void SendItemDurations ()
 
void LoadCorpse (PreparedQueryResult result)
 
void LoadPet ()
 
bool AddItem (uint32 itemId, uint32 count)
 
void PrepareGossipMenu (WorldObject *source, uint32 menuId=0, bool showQuests=false)
 
void SendPreparedGossip (WorldObject *source)
 
void OnGossipSelect (WorldObject *source, uint32 gossipListId, uint32 menuId)
 
uint32 GetGossipTextId (uint32 menuId, WorldObject *source)
 
uint32 GetGossipTextId (WorldObject *source)
 
void ToggleInstantFlight ()
 
int32 GetQuestLevel (Quest const *quest) const
 
void PrepareQuestMenu (ObjectGuid guid)
 
void SendPreparedQuest (ObjectGuid guid)
 
bool IsActiveQuest (uint32 quest_id) const
 
Quest const * GetNextQuest (ObjectGuid guid, Quest const *quest)
 
bool CanSeeStartQuest (Quest const *quest)
 
bool CanTakeQuest (Quest const *quest, bool msg)
 
bool CanAddQuest (Quest const *quest, bool msg)
 
bool CanCompleteQuest (uint32 quest_id, const QuestStatusData *q_savedStatus=nullptr)
 
bool CanCompleteRepeatableQuest (Quest const *quest)
 
bool CanRewardQuest (Quest const *quest, bool msg)
 
bool CanRewardQuest (Quest const *quest, uint32 reward, bool msg)
 
void AddQuestAndCheckCompletion (Quest const *quest, Object *questGiver)
 
void AddQuest (Quest const *quest, Object *questGiver)
 
void AbandonQuest (uint32 quest_id)
 
void CompleteQuest (uint32 quest_id)
 
void IncompleteQuest (uint32 quest_id)
 
void RewardQuest (Quest const *quest, uint32 reward, Object *questGiver, bool announce=true, bool isLFGReward=false)
 
void FailQuest (uint32 quest_id)
 
bool SatisfyQuestSkill (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestLevel (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestLog (bool msg)
 
bool SatisfyQuestPreviousQuest (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestClass (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestRace (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestReputation (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestStatus (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestConditions (Quest const *qInfo, bool msg)
 
bool SatisfyQuestTimed (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestExclusiveGroup (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestNextChain (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestPrevChain (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestDay (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestWeek (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestMonth (Quest const *qInfo, bool msg) const
 
bool SatisfyQuestSeasonal (Quest const *qInfo, bool msg) const
 
bool GiveQuestSourceItem (Quest const *quest)
 
bool TakeQuestSourceItem (uint32 questId, bool msg)
 
bool GetQuestRewardStatus (uint32 quest_id) const
 
QuestStatus GetQuestStatus (uint32 quest_id) const
 
void SetQuestStatus (uint32 questId, QuestStatus status, bool update=true)
 
void RemoveActiveQuest (uint32 questId, bool update=true)
 
void RemoveRewardedQuest (uint32 questId, bool update=true)
 
void SendQuestUpdate (uint32 questId)
 
QuestGiverStatus GetQuestDialogStatus (Object *questGiver)
 
float GetQuestRate (bool isDFQuest=false)
 
void SetDailyQuestStatus (uint32 quest_id)
 
bool IsDailyQuestDone (uint32 quest_id)
 
void SetWeeklyQuestStatus (uint32 quest_id)
 
void SetMonthlyQuestStatus (uint32 quest_id)
 
void SetSeasonalQuestStatus (uint32 quest_id)
 
void ResetDailyQuestStatus ()
 
void ResetWeeklyQuestStatus ()
 
void ResetMonthlyQuestStatus ()
 
void ResetSeasonalQuestStatus (uint16 event_id)
 
uint16 FindQuestSlot (uint32 quest_id) const
 
uint32 GetQuestSlotQuestId (uint16 slot) const
 
uint32 GetQuestSlotState (uint16 slot) const
 
uint16 GetQuestSlotCounter (uint16 slot, uint8 counter) const
 
uint32 GetQuestSlotTime (uint16 slot) const
 
void SetQuestSlot (uint16 slot, uint32 quest_id, uint32 timer=0)
 
void SetQuestSlotCounter (uint16 slot, uint8 counter, uint16 count)
 
void SetQuestSlotState (uint16 slot, uint32 state)
 
void RemoveQuestSlotState (uint16 slot, uint32 state)
 
void SetQuestSlotTimer (uint16 slot, uint32 timer)
 
void SwapQuestSlot (uint16 slot1, uint16 slot2)
 
uint16 GetReqKillOrCastCurrentCount (uint32 quest_id, int32 entry)
 
void AreaExploredOrEventHappens (uint32 questId)
 
void GroupEventHappens (uint32 questId, WorldObject const *pEventObject)
 
void ItemAddedQuestCheck (uint32 entry, uint32 count)
 
void ItemRemovedQuestCheck (uint32 entry, uint32 count)
 
void KilledMonster (CreatureTemplate const *cInfo, ObjectGuid guid)
 
void KilledMonsterCredit (uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
 
void KilledPlayerCredit (uint16 count=1)
 
void KilledPlayerCreditForQuest (uint16 count, Quest const *quest)
 
void KillCreditGO (uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
 
void TalkedToCreature (uint32 entry, ObjectGuid guid)
 
void MoneyChanged (uint32 value)
 
void ReputationChanged (FactionEntry const *factionEntry)
 
void ReputationChanged2 (FactionEntry const *factionEntry)
 
bool HasQuestForItem (uint32 itemId, uint32 excludeQuestId=0, bool turnIn=false, bool *showInLoot=nullptr) const
 
bool HasQuestForGO (int32 GOId) const
 
bool HasQuest (uint32 questId) const
 
void UpdateForQuestWorldObjects ()
 
bool CanShareQuest (uint32 quest_id) const
 
void SendQuestComplete (uint32 quest_id)
 
void SendQuestReward (Quest const *quest, uint32 XP)
 
void SendQuestFailed (uint32 questId, InventoryResult reason=EQUIP_ERR_OK)
 
void SendQuestTimerFailed (uint32 quest_id)
 
void SendCanTakeQuestResponse (uint32 msg) const
 
void SendQuestConfirmAccept (Quest const *quest, Player *pReceiver)
 
void SendPushToPartyResponse (Player const *player, uint8 msg) const
 
void SendQuestUpdateAddItem (Quest const *quest, uint32 item_idx, uint16 count)
 
void SendQuestUpdateAddCreatureOrGo (Quest const *quest, ObjectGuid guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count)
 
void SendQuestUpdateAddPlayer (Quest const *quest, uint16 old_count, uint16 add_count)
 
ObjectGuid GetDivider ()
 
void SetDivider (ObjectGuid guid=ObjectGuid::Empty)
 
uint32 GetInGameTime ()
 
void SetInGameTime (uint32 time)
 
void AddTimedQuest (uint32 quest_id)
 
void RemoveTimedQuest (uint32 quest_id)
 
bool HasPvPForcingQuest () const
 
bool LoadFromDB (ObjectGuid guid, CharacterDatabaseQueryHolder const &holder)
 
bool isBeingLoaded () const override
 
void Initialize (ObjectGuid::LowType guid)
 
void SaveToDB (bool create, bool logout)
 
void SaveToDB (CharacterDatabaseTransaction trans, bool create, bool logout)
 
void SaveInventoryAndGoldToDB (CharacterDatabaseTransaction trans)
 
void SaveGoldToDB (CharacterDatabaseTransaction trans)
 
void _SaveSkills (CharacterDatabaseTransaction trans)
 
void SetBindPoint (ObjectGuid guid)
 
void SendTalentWipeConfirm (ObjectGuid guid)
 
void ResetPetTalents ()
 
void CalcRage (uint32 damage, bool attacker)
 
void RegenerateAll ()
 
void Regenerate (Powers power)
 
void RegenerateHealth ()
 
void setRegenTimerCount (uint32 time)
 
void setWeaponChangeTimer (uint32 time)
 
uint32 GetMoney () const
 
bool ModifyMoney (int32 amount, bool sendError=true)
 
bool HasEnoughMoney (uint32 amount) const
 
bool HasEnoughMoney (int32 amount) const
 
void SetMoney (uint32 value)
 
RewardedQuestSet const & getRewardedQuests () const
 
QuestStatusMapgetQuestStatusMap ()
 
QuestStatusSaveMapGetQuestStatusSaveMap ()
 
size_t GetRewardedQuestCount () const
 
bool IsQuestRewarded (uint32 quest_id) const
 
UnitGetSelectedUnit () const
 
PlayerGetSelectedPlayer () const
 
void SetTarget (ObjectGuid=ObjectGuid::Empty) override
 
void SetSelection (ObjectGuid guid)
 Used for serverside target changes, does not apply to players.
 
void SendMailResult (uint32 mailId, MailResponseType mailAction, MailResponseResult mailError, uint32 equipError=0, ObjectGuid::LowType item_guid=0, uint32 item_count=0)
 
void SendNewMail ()
 
void UpdateNextMailTimeAndUnreads ()
 
void AddNewMailDeliverTime (time_t deliver_time)
 
void RemoveMail (uint32 id)
 
void AddMail (Mail *mail)
 
uint32 GetMailSize ()
 
MailGetMail (uint32 id)
 
PlayerMails const & GetMails () const
 
void SendItemRetrievalMail (uint32 itemEntry, uint32 count)
 
void SendItemRetrievalMail (std::vector< std::pair< uint32, uint32 > > mailItems)
 
ItemGetMItem (ObjectGuid::LowType itemLowGuid)
 
void AddMItem (Item *it)
 
bool RemoveMItem (ObjectGuid::LowType itemLowGuid)
 
void PetSpellInitialize ()
 
void CharmSpellInitialize ()
 
void PossessSpellInitialize ()
 
void VehicleSpellInitialize ()
 
void SendRemoveControlBar ()
 
bool HasSpell (uint32 spell) const override
 
bool HasActiveSpell (uint32 spell) const
 
TrainerSpellState GetTrainerSpellState (TrainerSpell const *trainer_spell) const
 
bool IsSpellFitByClassAndRace (uint32 spell_id) const
 
bool IsNeedCastPassiveSpellAtLearn (SpellInfo const *spellInfo) const
 
void SendProficiency (ItemClass itemClass, uint32 itemSubclassMask)
 
void SendInitialSpells ()
 
void SendLearnPacket (uint32 spellId, bool learn)
 
bool addSpell (uint32 spellId, uint8 addSpecMask, bool updateActive, bool temporary=false, bool learnFromSkill=false)
 
bool _addSpell (uint32 spellId, uint8 addSpecMask, bool temporary, bool learnFromSkill=false)
 
void learnSpell (uint32 spellId, bool temporary=false, bool learnFromSkill=false)
 
void removeSpell (uint32 spellId, uint8 removeSpecMask, bool onlyTemporary)
 
void resetSpells ()
 
void LearnCustomSpells ()
 
void LearnDefaultSkills ()
 
void LearnDefaultSkill (uint32 skillId, uint16 rank)
 
void learnQuestRewardedSpells ()
 
void learnQuestRewardedSpells (Quest const *quest)
 
void learnSpellHighRank (uint32 spellid)
 
void SetReputation (uint32 factionentry, float value)
 
uint32 GetReputation (uint32 factionentry) const
 
std::string const & GetGuildName ()
 
uint32 GetFreeTalentPoints () const
 
void SetFreeTalentPoints (uint32 points)
 
bool resetTalents (bool noResetCost=false)
 
uint32 resetTalentsCost () const
 
void InitTalentForLevel ()
 
void BuildPlayerTalentsInfoData (WorldPacket *data)
 
void BuildPetTalentsInfoData (WorldPacket *data)
 
void SendTalentsInfoData (bool pet)
 
void LearnTalent (uint32 talentId, uint32 talentRank, bool command=false)
 
void LearnPetTalent (ObjectGuid petGuid, uint32 talentId, uint32 talentRank)
 
bool addTalent (uint32 spellId, uint8 addSpecMask, uint8 oldTalentRank)
 
void _removeTalent (PlayerTalentMap::iterator &itr, uint8 specMask)
 
void _removeTalent (uint32 spellId, uint8 specMask)
 
void _removeTalentAurasAndSpells (uint32 spellId)
 
void _addTalentAurasAndSpells (uint32 spellId)
 
bool HasTalent (uint32 spell_id, uint8 spec) const
 
uint32 CalculateTalentsPoints () const
 
void UpdateSpecCount (uint8 count)
 
uint8 GetActiveSpec () const
 
uint8 GetActiveSpecMask () const
 
void SetActiveSpec (uint8 spec)
 
uint8 GetSpecsCount () const
 
void SetSpecsCount (uint8 count)
 
void ActivateSpec (uint8 spec)
 
void LoadActions (PreparedQueryResult result)
 
void GetTalentTreePoints (uint8(&specPoints)[3]) const
 
uint8 GetMostPointsTalentTree () const
 
bool HasTankSpec ()
 
bool HasMeleeSpec ()
 
bool HasCasterSpec ()
 
bool HasHealSpec ()
 
uint32 GetSpec (int8 spec=-1)
 
void InitGlyphsForLevel ()
 
void SetGlyphSlot (uint8 slot, uint32 slottype)
 
uint32 GetGlyphSlot (uint8 slot) const
 
void SetGlyph (uint8 slot, uint32 glyph, bool save)
 
uint32 GetGlyph (uint8 slot) const
 
uint32 GetFreePrimaryProfessionPoints () const
 
void SetFreePrimaryProfessions (uint16 profs)
 
void InitPrimaryProfessions ()
 
PlayerSpellMap const & GetSpellMap () const
 
PlayerSpellMapGetSpellMap ()
 
SpellCooldowns const & GetSpellCooldownMap () const
 
SpellCooldownsGetSpellCooldownMap ()
 
void AddSpellMod (SpellModifier *mod, bool apply)
 
bool IsAffectedBySpellmod (SpellInfo const *spellInfo, SpellModifier *mod, Spell *spell=nullptr)
 
bool HasSpellMod (SpellModifier *mod, Spell *spell)
 
template<class T >
void ApplySpellMod (uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr, bool temporaryPet=false)
 
void RemoveSpellMods (Spell *spell)
 
void RestoreSpellMods (Spell *spell, uint32 ownerAuraId=0, Aura *aura=nullptr)
 
void RestoreAllSpellMods (uint32 ownerAuraId=0, Aura *aura=nullptr)
 
void DropModCharge (SpellModifier *mod, Spell *spell)
 
void SetSpellModTakingSpell (Spell *spell, bool apply)
 
bool HasSpellCooldown (uint32 spell_id) const override
 
bool HasSpellItemCooldown (uint32 spell_id, uint32 itemid) const override
 
uint32 GetSpellCooldownDelay (uint32 spell_id) const
 
void AddSpellAndCategoryCooldowns (SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool infinityCooldown=false)
 
void AddSpellCooldown (uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
 
void _AddSpellCooldown (uint32 spell_id, uint16 categoryId, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false)
 
void ModifySpellCooldown (uint32 spellId, int32 cooldown)
 
void SendCooldownEvent (SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool setCooldown=true)
 
void ProhibitSpellSchool (SpellSchoolMask idSchoolMask, uint32 unTimeMs) override
 
void RemoveSpellCooldown (uint32 spell_id, bool update=false)
 
void SendClearCooldown (uint32 spell_id, Unit *target)
 
GlobalCooldownMgrGetGlobalCooldownMgr ()
 
void RemoveCategoryCooldown (uint32 cat)
 
void RemoveArenaSpellCooldowns (bool removeActivePetCooldowns=false)
 
void RemoveAllSpellCooldown ()
 
void _LoadSpellCooldowns (PreparedQueryResult result)
 
void _SaveSpellCooldowns (CharacterDatabaseTransaction trans, bool logout)
 
uint32 GetLastPotionId ()
 
void SetLastPotionId (uint32 item_id)
 
void UpdatePotionCooldown (Spell *spell=nullptr)
 
void setResurrectRequestData (ObjectGuid guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana)
 
void clearResurrectRequestData ()
 
bool isResurrectRequestedBy (ObjectGuid guid) const
 
bool isResurrectRequested () const
 
void ResurectUsingRequestData ()
 
uint8 getCinematic () const
 
void setCinematic (uint8 cine)
 
ActionButtonaddActionButton (uint8 button, uint32 action, uint8 type)
 
void removeActionButton (uint8 button)
 
ActionButton const * GetActionButton (uint8 button)
 
void SendInitialActionButtons () const
 
void SendActionButtons (uint32 state) const
 
bool IsActionButtonDataValid (uint8 button, uint32 action, uint8 type)
 
void UpdatePvPState ()
 
void UpdateFFAPvPState (bool reset=true)
 
void SetPvP (bool state)
 
void UpdatePvP (bool state, bool _override=false)
 
void UpdateZone (uint32 newZone, uint32 newArea)
 
void UpdateArea (uint32 newArea)
 
void SetNeedZoneUpdate (bool needUpdate)
 
void UpdateZoneDependentAuras (uint32 zone_id)
 
void UpdateAreaDependentAuras (uint32 area_id)
 
void UpdateAfkReport (time_t currTime)
 checks the 15 afk reports per 5 minutes limit
 
void UpdatePvPFlag (time_t currTime)
 
void UpdateFFAPvPFlag (time_t currTime)
 
void UpdateContestedPvP (uint32 currTime)
 
void SetContestedPvPTimer (uint32 newTime)
 
void ResetContestedPvP ()
 
void UpdateDuelFlag (time_t currTime)
 
void CheckDuelDistance (time_t currTime)
 
void DuelComplete (DuelCompleteType type)
 
void SendDuelCountdown (uint32 counter)
 
bool IsGroupVisibleFor (Player const *p) const
 
bool IsInSameGroupWith (Player const *p) const
 
bool IsInSameRaidWith (Player const *p) const
 
void UninviteFromGroup ()
 
void RemoveFromGroup (RemoveMethod method=GROUP_REMOVEMETHOD_DEFAULT)
 
void SendUpdateToOutOfRangeGroupMembers ()
 
void SetInGuild (uint32 GuildId)
 
void SetRank (uint8 rankId)
 
uint8 GetRank () const
 
void SetGuildIdInvited (uint32 GuildId)
 
uint32 GetGuildId () const
 
GuildGetGuild () const
 
uint32 GetGuildIdInvited ()
 
void SetInArenaTeam (uint32 ArenaTeamId, uint8 slot, uint8 type)
 
void SetArenaTeamInfoField (uint8 slot, ArenaTeamInfoType type, uint32 value)
 
uint32 GetArenaPersonalRating (uint8 slot) const
 
uint32 GetArenaTeamId (uint8 slot) const
 
void SetArenaTeamIdInvited (uint32 ArenaTeamId)
 
uint32 GetArenaTeamIdInvited ()
 
Difficulty GetDifficulty (bool isRaid) const
 
Difficulty GetDungeonDifficulty () const
 
Difficulty GetRaidDifficulty () const
 
Difficulty GetStoredRaidDifficulty () const
 
void SetDungeonDifficulty (Difficulty dungeon_difficulty)
 
void SetRaidDifficulty (Difficulty raid_difficulty)
 
void StoreRaidMapDifficulty ()
 
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
 
uint32 GetBaseWeaponSkillValue (WeaponAttackType attType) const
 
uint32 GetSpellByProto (ItemTemplate *proto)
 
float GetHealthBonusFromStamina ()
 
float GetManaBonusFromIntellect ()
 
bool UpdateStats (Stats stat) override
 
bool UpdateAllStats () override
 
void ApplySpellPenetrationBonus (int32 amount, bool apply)
 
void UpdateResistances (uint32 school) override
 
void UpdateArmor () override
 
void UpdateMaxHealth () override
 
void UpdateMaxPower (Powers power) override
 
void ApplyFeralAPBonus (int32 amount, bool apply)
 
void UpdateAttackPowerAndDamage (bool ranged=false) override
 
void UpdateShieldBlockValue ()
 
void ApplySpellPowerBonus (int32 amount, bool apply)
 
void UpdateSpellDamageAndHealingBonus ()
 
void ApplyRatingMod (CombatRating cr, int32 value, bool apply)
 
void UpdateRating (CombatRating cr)
 
void UpdateAllRatings ()
 
void CalculateMinMaxDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex) override
 
void UpdateDefenseBonusesMod ()
 
void RecalculateRating (CombatRating cr)
 
float GetMeleeCritFromAgility ()
 
void GetDodgeFromAgility (float &diminishing, float &nondiminishing)
 
float GetMissPercentageFromDefence () const
 
float GetSpellCritFromIntellect ()
 
float OCTRegenHPPerSpirit ()
 
float OCTRegenMPPerSpirit ()
 
float GetRatingMultiplier (CombatRating cr) const
 
float GetRatingBonusValue (CombatRating cr) const
 
uint32 GetBaseSpellPowerBonus ()
 
int32 GetSpellPenetrationItemMod () const
 
float GetExpertiseDodgeOrParryReduction (WeaponAttackType attType) const
 
void UpdateBlockPercentage ()
 
void UpdateCritPercentage (WeaponAttackType attType)
 
void UpdateAllCritPercentages ()
 
void UpdateParryPercentage ()
 
void UpdateDodgePercentage ()
 
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 ApplyHealthRegenBonus (int32 amount, bool apply)
 
void UpdateManaRegen ()
 
void UpdateRuneRegen (RuneType rune)
 
ObjectGuid GetLootGUID () const
 
void SetLootGUID (ObjectGuid guid)
 
void RemovedInsignia (Player *looterPlr)
 
WorldSessionGetSession () const
 
void SetSession (WorldSession *sess)
 
void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const override
 
void DestroyForPlayer (Player *target, bool onDeath=false) const override
 
void SendLogXPGain (uint32 GivenXP, Unit *victim, uint32 BonusXP, bool recruitAFriend=false, float group_rate=1.0f)
 
void SendAttackSwingCantAttack ()
 
void SendAttackSwingCancelAttack ()
 
void SendAttackSwingDeadTarget ()
 
void SendAttackSwingNotInRange ()
 
void SendAttackSwingBadFacingAttack ()
 
void SendAutoRepeatCancel (Unit *target)
 
void SendExplorationExperience (uint32 Area, uint32 Experience)
 
void SendDungeonDifficulty (bool IsInGroup)
 
void SendRaidDifficulty (bool IsInGroup, int32 forcedDifficulty=-1)
 
void SendResetInstanceSuccess (uint32 MapId)
 
void SendResetInstanceFailed (uint32 reason, uint32 MapId)
 
void SendResetFailedNotify (uint32 mapid)
 
bool UpdatePosition (float x, float y, float z, float orientation, bool teleport=false) override
 
bool UpdatePosition (const Position &pos, bool teleport=false)
 
void ProcessTerrainStatusUpdate () override
 
void SendMessageToSet (WorldPacket const *data, bool self) const override
 
void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self, bool includeMargin=false, Player const *skipped_rcvr=nullptr) const override
 
void SendMessageToSetInRange_OwnTeam (WorldPacket const *data, float dist, bool self) const
 
void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const override
 
void SendTeleportAckPacket ()
 
CorpseGetCorpse () const
 
void SpawnCorpseBones (bool triggerSave=true)
 
CorpseCreateCorpse ()
 
void RemoveCorpse ()
 
void KillPlayer ()
 
bool HasCorpse () const
 
WorldLocation GetCorpseLocation () const
 
uint32 GetResurrectionSpellId ()
 
void ResurrectPlayer (float restore_percent, bool applySickness=false)
 
void BuildPlayerRepop ()
 
void RepopAtGraveyard ()
 
void SendDurabilityLoss ()
 
void DurabilityLossAll (double percent, bool inventory)
 
void DurabilityLoss (Item *item, double percent)
 
void DurabilityPointsLossAll (int32 points, bool inventory)
 
void DurabilityPointsLoss (Item *item, int32 points)
 
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 ()
 
bool IsMirrorTimerActive (MirrorTimerType type)
 
void SetMovement (PlayerMovementType pType)
 
bool CanJoinConstantChannelInZone (ChatChannelsEntry const *channel, AreaTableEntry const *zone)
 
void JoinedChannel (Channel *c)
 
void LeftChannel (Channel *c)
 
void CleanupChannels ()
 
void ClearChannelWatch ()
 
void UpdateLocalChannels (uint32 newZone)
 
void UpdateDefense ()
 
void UpdateWeaponSkill (Unit *victim, WeaponAttackType attType, Item *item=nullptr)
 
void UpdateCombatSkills (Unit *victim, WeaponAttackType attType, bool defence, Item *item=nullptr)
 
void SetSkill (uint16 id, uint16 step, uint16 currVal, uint16 maxVal)
 
uint16 GetMaxSkillValue (uint32 skill) const
 
uint16 GetPureMaxSkillValue (uint32 skill) const
 
uint16 GetSkillValue (uint32 skill) const
 
uint16 GetBaseSkillValue (uint32 skill) const
 
uint16 GetPureSkillValue (uint32 skill) const
 
int16 GetSkillPermBonusValue (uint32 skill) const
 
int16 GetSkillTempBonusValue (uint32 skill) const
 
uint16 GetSkillStep (uint16 skill) const
 
bool HasSkill (uint32 skill) const
 
void learnSkillRewardedSpells (uint32 id, uint32 value)
 
WorldLocationGetTeleportDest ()
 
bool IsBeingTeleported () const
 
bool IsBeingTeleportedNear () const
 
bool IsBeingTeleportedFar () const
 
void SetSemaphoreTeleportNear (time_t tm)
 
void SetSemaphoreTeleportFar (time_t tm)
 
time_t GetSemaphoreTeleportNear () const
 
time_t GetSemaphoreTeleportFar () const
 
void ProcessDelayedOperations ()
 
uint32 GetDelayedOperations () const
 
void ScheduleDelayedOperation (uint32 operation)
 
void CheckAreaExploreAndOutdoor ()
 
TeamId GetTeamId (bool original=false) const
 
void SetFactionForRace (uint8 race)
 
void setTeamId (TeamId teamid)
 
void InitDisplayIds ()
 
bool IsAtGroupRewardDistance (WorldObject const *pRewardSource) const
 
bool IsAtLootRewardDistance (WorldObject const *pRewardSource) const
 
bool IsAtRecruitAFriendDistance (WorldObject const *pOther) const
 
void RewardPlayerAndGroupAtKill (Unit *victim, bool isBattleGround)
 
void RewardPlayerAndGroupAtEvent (uint32 creature_id, WorldObject *pRewardSource)
 
bool isHonorOrXPTarget (Unit *victim) const
 
bool GetsRecruitAFriendBonus (bool forXP)
 
uint8 GetGrantableLevels ()
 
void SetGrantableLevels (uint8 val)
 
ReputationMgrGetReputationMgr ()
 
ReputationMgr const & GetReputationMgr () const
 
ReputationRank GetReputationRank (uint32 faction_id) const
 
void RewardReputation (Unit *victim)
 
void RewardReputation (Quest const *quest)
 
float CalculateReputationGain (ReputationSource source, uint32 creatureOrQuestLevel, float rep, int32 faction, bool noQuestBonus=false)
 
void UpdateSkillsForLevel ()
 
void UpdateSkillsToMaxSkillsForLevel ()
 
void ModifySkillBonus (uint32 skillid, int32 val, bool talent)
 
void RewardExtraBonusTalentPoints (uint32 bonusTalentPoints)
 
void UpdateHonorFields ()
 
bool RewardHonor (Unit *victim, uint32 groupsize, int32 honor=-1, bool awardXP=true)
 
uint32 GetHonorPoints () const
 
uint32 GetArenaPoints () const
 
void ModifyHonorPoints (int32 value, CharacterDatabaseTransaction trans=CharacterDatabaseTransaction(nullptr))
 
void ModifyArenaPoints (int32 value, CharacterDatabaseTransaction trans=CharacterDatabaseTransaction(nullptr))
 If trans is specified, honor save query will be added to trans.
 
uint32 GetMaxPersonalArenaRatingRequirement (uint32 minarenaslot) const
 If trans is specified, arena point save query will be added to trans.
 
void SetHonorPoints (uint32 value)
 
void SetArenaPoints (uint32 value)
 
void SaveHealthBeforeDuel ()
 
void SaveManaBeforeDuel ()
 
void RestoreHealthAfterDuel ()
 
void RestoreManaAfterDuel ()
 
SpellCooldowns GetSpellCooldowns () const
 
void SetDrunkValue (uint8 newDrunkValue, uint32 itemId=0)
 
uint8 GetDrunkValue () const
 
uint32 GetDeathTimer () const
 
uint32 GetCorpseReclaimDelay (bool pvp) const
 
void UpdateCorpseReclaimDelay ()
 
int32 CalculateCorpseReclaimDelay (bool load=false)
 
void SendCorpseReclaimDelay (uint32 delay)
 
uint32 GetShieldBlockValue () const override
 
bool CanParry () const
 
void SetCanParry (bool value)
 
bool CanBlock () const
 
void SetCanBlock (bool value)
 
bool CanTitanGrip () const
 
void SetCanTitanGrip (bool value)
 
bool CanTameExoticPets () const
 
void SetRegularAttackTime ()
 
void SetBaseModValue (BaseModGroup modGroup, BaseModType modType, float value)
 
void HandleBaseModValue (BaseModGroup modGroup, BaseModType modType, float amount, bool apply)
 
float GetBaseModValue (BaseModGroup modGroup, BaseModType modType) const
 
float GetTotalBaseModValue (BaseModGroup modGroup) const
 
float GetTotalPercentageModValue (BaseModGroup modGroup) const
 
void _ApplyAllStatBonuses ()
 
void _RemoveAllStatBonuses ()
 
void ResetAllPowers ()
 
SpellSchoolMask GetMeleeDamageSchoolMask (WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const override
 
void _ApplyWeaponDependentAuraMods (Item *item, WeaponAttackType attackType, bool apply)
 
void _ApplyWeaponDependentAuraCritMod (Item *item, WeaponAttackType attackType, AuraEffect const *aura, bool apply)
 
void _ApplyWeaponDependentAuraDamageMod (Item *item, WeaponAttackType attackType, AuraEffect const *aura, bool apply)
 
void _ApplyItemMods (Item *item, uint8 slot, bool apply)
 
void _RemoveAllItemMods ()
 
void _ApplyAllItemMods ()
 
void _ApplyAllLevelScaleItemMods (bool apply)
 
void _ApplyItemBonuses (ItemTemplate const *proto, uint8 slot, bool apply, bool only_level_scale=false)
 
void _ApplyWeaponDamage (uint8 slot, ItemTemplate const *proto, ScalingStatValuesEntry const *ssv, bool apply)
 
void _ApplyAmmoBonuses ()
 
bool EnchantmentFitsRequirements (uint32 enchantmentcondition, int8 slot)
 
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 (SpellInfo 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, ItemTemplate const *proto)
 
void SendEquipmentSetList ()
 
void SetEquipmentSet (uint32 index, EquipmentSet eqset)
 
void DeleteEquipmentSet (uint64 setGuid)
 
void SendInitWorldStates (uint32 zone, uint32 area)
 
void SendUpdateWorldState (uint32 variable, uint32 value) const
 
void SendDirectMessage (WorldPacket const *data) const
 
void SendBGWeekendWorldStates ()
 
void SendBattlefieldWorldStates ()
 
void GetAurasForTarget (Unit *target, bool force=false)
 
void SendLoot (ObjectGuid guid, LootType loot_type)
 
void SendLootError (ObjectGuid guid, LootError error)
 
void SendLootRelease (ObjectGuid guid)
 
void SendNotifyLootItemRemoved (uint8 lootSlot)
 
void SendNotifyLootMoneyRemoved ()
 
bool InBattleground () const
 
bool InArena () const
 
uint32 GetBattlegroundId () const
 
BattlegroundTypeId GetBattlegroundTypeId () const
 
uint32 GetCurrentBattlegroundQueueSlot () const
 
bool IsInvitedForBattlegroundInstance () const
 
bool IsCurrentBattlegroundRandom () const
 
BGDataGetBGData ()
 
void SetBGData (BGData &bgdata)
 
BattlegroundGetBattleground (bool create=false) const
 
bool InBattlegroundQueue (bool ignoreArena=false) const
 
bool IsDeserter () const
 
BattlegroundQueueTypeId GetBattlegroundQueueTypeId (uint32 index) const
 
uint32 GetBattlegroundQueueIndex (BattlegroundQueueTypeId bgQueueTypeId) const
 
bool IsInvitedForBattlegroundQueueType (BattlegroundQueueTypeId bgQueueTypeId) const
 
bool InBattlegroundQueueForBattlegroundQueueType (BattlegroundQueueTypeId bgQueueTypeId) const
 
void SetBattlegroundId (uint32 id, BattlegroundTypeId bgTypeId, uint32 queueSlot, bool invited, bool isRandom, TeamId teamId)
 
uint32 AddBattlegroundQueueId (BattlegroundQueueTypeId val)
 
bool HasFreeBattlegroundQueueId () const
 
void RemoveBattlegroundQueueId (BattlegroundQueueTypeId val)
 
void SetInviteForBattlegroundQueueType (BattlegroundQueueTypeId bgQueueTypeId, uint32 instanceId)
 
bool IsInvitedForBattlegroundInstance (uint32 instanceId) const
 
TeamId GetBgTeamId () const
 
void LeaveBattleground (Battleground *bg=nullptr)
 
bool CanJoinToBattleground () const
 
bool CanReportAfkDueToLimit ()
 
void ReportedAfkBy (Player *reporter)
 This player has been blamed to be inactive in a battleground.
 
void ClearAfkReports ()
 
bool GetBGAccessByLevel (BattlegroundTypeId bgTypeId) const
 
bool CanUseBattlegroundObject (GameObject *gameobject) const
 
bool isTotalImmune () const
 
bool CanCaptureTowerPoint () const
 
bool GetRandomWinner ()
 
void SetRandomWinner (bool isWinner)
 
OutdoorPvPGetOutdoorPvP () const
 
bool IsOutdoorPvPActive ()
 
bool IsImmuneToEnvironmentalDamage ()
 
uint32 EnvironmentalDamage (EnviromentalDamage type, uint32 damage)
 
void UpdateSpeakTime (ChatFloodThrottle::Index index)
 
bool CanSpeak () const
 
void UpdateFallInformationIfNeed (MovementInfo const &minfo, uint16 opcode)
 
void SetFallInformation (uint32 time, float z)
 
void HandleFall (MovementInfo const &movementInfo)
 
bool canFlyInZone (uint32 mapid, uint32 zone, SpellInfo const *bySpell)
 
void SetClientControl (Unit *target, bool allowMove, bool packetOnly=false)
 
void SetMover (Unit *target)
 
void SetSeer (WorldObject *target)
 
void SetViewpoint (WorldObject *target, bool apply)
 
WorldObjectGetViewpoint () const
 
void StopCastingCharm (Aura *except=nullptr)
 
void StopCastingBindSight (Aura *except=nullptr)
 
uint32 GetSaveTimer () const
 
void SetSaveTimer (uint32 timer)
 
void SaveRecallPosition ()
 
void SetHomebind (WorldLocation const &loc, uint32 areaId)
 
WorldLocation GetStartPosition () const
 
WorldLocation const & GetEntryPoint () const
 
void SetEntryPoint ()
 
bool HaveAtClient (WorldObject const *u) const
 
bool HaveAtClient (ObjectGuid guid) const
 
bool IsNeverVisible () const override
 
bool IsVisibleGloballyFor (Player const *player) const
 
void GetInitialVisiblePackets (Unit *target)
 
void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false) override
 
void UpdateVisibilityForPlayer (bool mapChange=false)
 
void UpdateVisibilityOf (WorldObject *target)
 
void UpdateTriggerVisibility ()
 
template<class T >
void UpdateVisibilityOf (T *target, UpdateData &data, std::vector< Unit * > &visibleNow)
 
bool HasAtLoginFlag (AtLoginFlags f) const
 
void SetAtLoginFlag (AtLoginFlags f)
 
void RemoveAtLoginFlag (AtLoginFlags flags, bool persist=false)
 
bool isUsingLfg ()
 
bool inRandomLfgDungeon ()
 
uint32 GetTemporaryUnsummonedPetNumber () const
 
void SetTemporaryUnsummonedPetNumber (uint32 petnumber)
 
void UnsummonPetTemporaryIfAny ()
 
void ResummonPetTemporaryUnSummonedIfAny ()
 
bool IsPetNeedBeTemporaryUnsummoned () const
 
bool CanResummonPet (uint32 spellid)
 
void SendCinematicStart (uint32 CinematicSequenceId) const
 
void SendMovieStart (uint32 MovieId)
 
uint32 DoRandomRoll (uint32 minimum, uint32 maximum)
 
uint16 GetMaxSkillValueForLevel () const
 
bool IsFFAPvP ()
 
bool IsPvP ()
 
void UpdateHomebindTime (uint32 time)
 
void BindToInstance ()
 
void SetPendingBind (uint32 instanceId, uint32 bindTimer)
 
bool HasPendingBind () const
 
uint32 GetPendingBind () const
 
void SendRaidInfo ()
 
void SendSavedInstances ()
 
void PrettyPrintRequirementsQuestList (const std::vector< const ProgressionRequirement * > &missingQuests) const
 
void PrettyPrintRequirementsAchievementsList (const std::vector< const ProgressionRequirement * > &missingAchievements) const
 
void PrettyPrintRequirementsItemsList (const std::vector< const ProgressionRequirement * > &missingItems) const
 
bool Satisfy (DungeonProgressionRequirements const *ar, uint32 target_map, bool report=false)
 
bool CheckInstanceLoginValid ()
 
bool CheckInstanceCount (uint32 instanceId) const
 
void AddInstanceEnterTime (uint32 instanceId, time_t enterTime)
 
uint32 GetLastPetNumber () const
 
void SetLastPetNumber (uint32 petnumber)
 
uint32 GetLastPetSpell () const
 
void SetLastPetSpell (uint32 petspell)
 
GroupGetGroupInvite ()
 
void SetGroupInvite (Group *group)
 
GroupGetGroup ()
 
const GroupGetGroup () const
 
GroupReferenceGetGroupRef ()
 
void SetGroup (Group *group, int8 subgroup=-1)
 
uint8 GetSubGroup () const
 
uint32 GetGroupUpdateFlag () const
 
void SetGroupUpdateFlag (uint32 flag)
 
uint64 GetAuraUpdateMaskForRaid () const
 
void SetAuraUpdateMaskForRaid (uint8 slot)
 
PlayerGetNextRandomRaidMember (float radius)
 
PartyResult CanUninviteFromGroup (ObjectGuid targetPlayerGUID=ObjectGuid::Empty) const
 
void SetBattlegroundOrBattlefieldRaid (Group *group, int8 subgroup=-1)
 
void RemoveFromBattlegroundOrBattlefieldRaid ()
 
GroupGetOriginalGroup ()
 
GroupReferenceGetOriginalGroupRef ()
 
uint8 GetOriginalSubGroup () const
 
void SetOriginalGroup (Group *group, int8 subgroup=-1)
 
void SetPassOnGroupLoot (bool bPassOnGroupLoot)
 
bool GetPassOnGroupLoot () const
 
MapReferenceGetMapRef ()
 
void SetMap (Map *map) override
 
void ResetMap () override
 
bool CanTeleport ()
 
void SetCanTeleport (bool value)
 
bool CanKnockback ()
 
void SetCanKnockback (bool value)
 
bool isAllowedToLoot (Creature const *creature)
 
DeclinedName const * GetDeclinedNames () const
 
uint8 GetRunesState () const
 
RuneType GetBaseRune (uint8 index) const
 
RuneType GetCurrentRune (uint8 index) const
 
uint32 GetRuneCooldown (uint8 index) const
 
uint32 GetGracePeriod (uint8 index) const
 
uint32 GetRuneBaseCooldown (uint8 index, bool skipGrace)
 
bool IsBaseRuneSlotsOnCooldown (RuneType runeType) const
 
RuneType GetLastUsedRune ()
 
void SetLastUsedRune (RuneType type)
 
void SetBaseRune (uint8 index, RuneType baseRune)
 
void SetCurrentRune (uint8 index, RuneType currentRune)
 
void SetRuneCooldown (uint8 index, uint32 cooldown)
 
void SetGracePeriod (uint8 index, uint32 period)
 
void SetRuneConvertAura (uint8 index, AuraEffect const *aura)
 
void AddRuneByAuraEffect (uint8 index, RuneType newType, AuraEffect const *aura)
 
void RemoveRunesByAuraEffect (AuraEffect const *aura)
 
void RestoreBaseRune (uint8 index)
 
void ConvertRune (uint8 index, RuneType newType)
 
void ResyncRunes (uint8 count)
 
void AddRunePower (uint8 index)
 
void InitRunes ()
 
void SendRespondInspectAchievements (Player *player) const
 
bool HasAchieved (uint32 achievementId) const
 
void ResetAchievements ()
 
void CheckAllAchievementCriteria ()
 
void ResetAchievementCriteria (AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete=false)
 
void UpdateAchievementCriteria (AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
 
void StartTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost=0)
 
void RemoveTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
void CompletedAchievement (AchievementEntry const *entry)
 
AchievementMgrGetAchievementMgr () const
 
void SetCreationTime (Seconds creationTime)
 
Seconds GetCreationTime () const
 
bool HasTitle (uint32 bitIndex) const
 
bool HasTitle (CharTitlesEntry const *title) const
 
void SetTitle (CharTitlesEntry const *title, bool lost=false)
 
void SetCurrentTitle (CharTitlesEntry const *title, bool clear=false)
 
bool CanSeeSpellClickOn (Creature const *creature) const
 
bool CanSeeVendor (Creature const *creature) const
 
uint32 GetChampioningFaction () const
 
void SetChampioningFaction (uint32 faction)
 
float GetAverageItemLevel ()
 
float GetAverageItemLevelForDF ()
 
void ClearWhisperWhiteList ()
 
void AddWhisperWhiteList (ObjectGuid guid)
 
bool IsInWhisperWhiteList (ObjectGuid guid)
 
void RemoveFromWhisperWhiteList (ObjectGuid guid)
 
bool SetDisableGravity (bool disable, bool packetOnly=false, bool updateAnimationTier=true) override
 
bool SetCanFly (bool apply, bool packetOnly=false) override
 
bool SetWaterWalking (bool apply, bool packetOnly=false) override
 
bool SetFeatherFall (bool apply, bool packetOnly=false) override
 
bool SetHover (bool enable, bool packetOnly=false, bool updateAnimationTier=true) override
 
bool CanFly () const override
 
bool CanEnterWater () const override
 
void AdditionalSavingAddMask (uint8 mask)
 
bool IsSpectator () const
 
void SetIsSpectator (bool on)
 
bool NeedSendSpectatorData () const
 
void SetPendingSpectatorForBG (uint32 bgInstanceId)
 
bool HasPendingSpectatorForBG (uint32 bgInstanceId) const
 
void SetPendingSpectatorInviteInstanceId (uint32 bgInstanceId)
 
uint32 GetPendingSpectatorInviteInstanceId () const
 
bool HasReceivedSpectatorResetFor (ObjectGuid guid)
 
void ClearReceivedSpectatorResetFor ()
 
void AddReceivedSpectatorResetFor (ObjectGuid guid)
 
void RemoveReceivedSpectatorResetFor (ObjectGuid guid)
 
void setRuneWeaponGUID (ObjectGuid guid)
 
ObjectGuid getRuneWeaponGUID ()
 
bool CanSeeDKPet () const
 
void SetShowDKPet (bool on)
 
void PrepareCharmAISpells ()
 
bool NeedToSaveGlyphs ()
 
void SetNeedToSaveGlyphs (bool val)
 
uint32 GetMountBlockId ()
 
void SetMountBlockId (uint32 mount)
 
float GetRealParry () const
 
float GetRealDodge () const
 
const PlayerTalentMapGetTalentMap () const
 
uint32 GetNextSave () const
 
SpellModList const & GetSpellModList (uint32 type) const
 
void SetServerSideVisibility (ServerSideVisibilityType type, AccountTypes sec)
 
void SetServerSideVisibilityDetect (ServerSideVisibilityType type, AccountTypes sec)
 
void SetFarSightDistance (float radius)
 
void ResetFarSightDistance ()
 
Optional< float > GetFarSightDistance () const
 
float GetSightRange (WorldObject const *target=nullptr) const override
 
std::string GetPlayerName ()
 
PlayerSetting GetPlayerSetting (std::string source, uint8 index)
 
void UpdatePlayerSetting (std::string source, uint8 index, uint32 value)
 
void SendSystemMessage (std::string_view msg, bool escapeCharacters=false)
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from Unit
 ~Unit () override
 
UnitAIGetAI ()
 
void SetAI (UnitAI *newAI)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupBeforeRemoveFromMap (bool finalCleanup)
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
uint32 GetDynamicFlags () const override
 
void ReplaceAllDynamicFlags (uint32 flag) override
 
DiminishingLevels GetDiminishing (DiminishingGroup group)
 
void IncrDiminishing (DiminishingGroup group)
 
float ApplyDiminishingToDuration (DiminishingGroup group, int32 &duration, Unit *caster, DiminishingLevels Level, int32 limitduration)
 
void ApplyDiminishingAura (DiminishingGroup group, bool apply)
 
void ClearDiminishings ()
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
void Update (uint32 time) override
 
void setAttackTimer (WeaponAttackType type, int32 time)
 
void resetAttackTimer (WeaponAttackType type=BASE_ATTACK)
 
int32 getAttackTimer (WeaponAttackType type) const
 
bool isAttackReady (WeaponAttackType type=BASE_ATTACK) const
 
bool haveOffhandWeapon () const
 
bool CanDualWield () const
 
virtual void SetCanDualWield (bool value)
 
float GetCombatReach () const override
 
float GetMeleeReach () const
 
bool IsWithinRange (Unit const *obj, float dist) const
 
bool IsWithinCombatRange (Unit const *obj, float dist2compare) const
 
bool IsWithinMeleeRange (Unit const *obj, float dist=0.f) const
 
float GetMeleeRange (Unit const *target) const
 
virtual SpellSchoolMask GetMeleeDamageSchoolMask (WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const =0
 
bool GetRandomContactPoint (Unit const *target, float &x, float &y, float &z, bool force=false) const
 
void _addAttacker (Unit *pAttacker)
 
void _removeAttacker (Unit *pAttacker)
 
UnitgetAttackerForHelper () const
 
bool Attack (Unit *victim, bool meleeAttack)
 
void CastStop (uint32 except_spellid=0, bool withInstant=true)
 
bool AttackStop ()
 
void RemoveAllAttackers ()
 
AttackerSet const & getAttackers () const
 
bool GetMeleeAttackPoint (Unit *attacker, Position &pos)
 
bool isAttackingPlayer () const
 
UnitGetVictim () const
 
void CombatStop (bool includingCast=false)
 
void CombatStopWithPets (bool includingCast=false)
 
void StopAttackFaction (uint32 faction_id)
 
void StopAttackingInvalidTarget ()
 
UnitSelectNearbyTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
UnitSelectNearbyNoTotemTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
void SendMeleeAttackStop (Unit *victim=nullptr)
 
void SendMeleeAttackStart (Unit *victim, Player *sendTo=nullptr)
 
void AddUnitState (uint32 f)
 
bool HasUnitState (const uint32 f) const
 
void ClearUnitState (uint32 f)
 
uint32 GetUnitState () const
 
bool CanFreeMove () const
 
uint32 HasUnitTypeMask (uint32 mask) const
 
void AddUnitTypeMask (uint32 mask)
 
uint32 GetUnitTypeMask () const
 
bool IsSummon () const
 
bool IsGuardian () const
 
bool IsControllableGuardian () const
 
bool IsPet () const
 
bool IsHunterPet () const
 
bool IsTotem () const
 
bool IsVehicle () const
 
uint8 getLevel () const
 
uint8 GetLevel () const
 
uint8 getLevelForTarget (WorldObject const *) const override
 
void SetLevel (uint8 lvl, bool showLevelChange=true)
 
uint8 getRace (bool original=false) const
 
void setRace (uint8 race)
 
uint32 getRaceMask () const
 
uint8 getClass () const
 
uint32 getClassMask () const
 
uint8 getGender () const
 
DisplayRace GetDisplayRaceFromModelId (uint32 modelId) const
 
DisplayRace GetDisplayRace () const
 
float GetStat (Stats stat) const
 
void SetStat (Stats stat, int32 val)
 
uint32 GetArmor () const
 
void SetArmor (int32 val)
 
uint32 GetResistance (SpellSchools school) const
 
uint32 GetResistance (SpellSchoolMask mask) const
 
void SetResistance (SpellSchools school, int32 val)
 
uint32 GetHealth () const
 
uint32 GetMaxHealth () const
 
bool IsFullHealth () const
 
bool HealthBelowPct (int32 pct) const
 
bool HealthBelowPctDamaged (int32 pct, uint32 damage) const
 
bool HealthAbovePct (int32 pct) const
 
bool HealthAbovePctHealed (int32 pct, uint32 heal) const
 
float GetHealthPct () const
 
uint32 CountPctFromMaxHealth (int32 pct) const
 
uint32 CountPctFromCurHealth (int32 pct) const
 
float GetPowerPct (Powers power) const
 
void SetHealth (uint32 val)
 
void SetMaxHealth (uint32 val)
 
void SetFullHealth ()
 
int32 ModifyHealth (int32 val)
 
int32 GetHealthGain (int32 dVal)
 
Powers getPowerType () const
 
void setPowerType (Powers power)
 
uint32 GetPower (Powers power) const
 
uint32 GetMaxPower (Powers power) const
 
void SetPower (Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
 
void SetMaxPower (Powers power, uint32 val)
 
int32 ModifyPower (Powers power, int32 val, bool withPowerUpdate=true)
 
int32 ModifyPowerPct (Powers power, float pct, bool apply=true)
 
uint32 GetAttackTime (WeaponAttackType att) const
 
void SetAttackTime (WeaponAttackType att, uint32 val)
 
void ApplyAttackTimePercentMod (WeaponAttackType att, float val, bool apply)
 
void ApplyCastTimePercentMod (float val, bool apply)
 
UnitFlags GetUnitFlags () const
 
bool HasUnitFlag (UnitFlags flags) const
 
void SetUnitFlag (UnitFlags flags)
 
void RemoveUnitFlag (UnitFlags flags)
 
void ReplaceAllUnitFlags (UnitFlags flags)
 
UnitFlags2 GetUnitFlags2 () const
 
bool HasUnitFlag2 (UnitFlags2 flags) const
 
void SetUnitFlag2 (UnitFlags2 flags)
 
void RemoveUnitFlag2 (UnitFlags2 flags)
 
void ReplaceAllUnitFlags2 (UnitFlags2 flags)
 
SheathState GetSheath () const
 
virtual void SetSheath (SheathState sheathed)
 
uint32 GetFaction () const
 
void SetFaction (uint32 faction)
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
ReputationRank GetReactionTo (Unit const *target, bool checkOriginalFaction=false) const
 
ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
 
bool IsHostileTo (Unit const *unit) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (Unit const *unit) const
 
bool IsNeutralToAll () const
 
bool IsInPartyWith (Unit const *unit) const
 
bool IsInRaidWith (Unit const *unit) const
 
void GetPartyMembers (std::list< Unit * > &units)
 
bool IsContestedGuard () const
 
bool IsInSanctuary () const
 
bool IsPvP () const
 
bool IsFFAPvP () const
 
void SetPvP (bool state)
 
uint32 GetCreatureType () const
 
uint32 GetCreatureTypeMask () const
 
uint8 getStandState () const
 
bool IsSitState () const
 
bool IsStandState () const
 
void SetStandState (uint8 state)
 
void SetStandFlags (uint8 flags)
 
void RemoveStandFlags (uint8 flags)
 
bool IsMounted () const
 
uint32 GetMountID () const
 
void Mount (uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
 
void Dismount ()
 
uint16 GetMaxSkillValueForLevel (Unit const *target=nullptr) const
 
void KillSelf (bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
void ProcDamageAndSpellFor (bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpellInfo, uint32 damage, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
void GetProcAurasTriggeredOnEvent (std::list< AuraApplication * > &aurasTriggeringProc, std::list< AuraApplication * > *procAuras, ProcEventInfo eventInfo)
 
void TriggerAurasProcOnEvent (CalcDamageInfo &damageInfo)
 
void TriggerAurasProcOnEvent (std::list< AuraApplication * > *myProcAuras, std::list< AuraApplication * > *targetProcAuras, Unit *actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
 
void TriggerAurasProcOnEvent (ProcEventInfo &eventInfo, std::list< AuraApplication * > &procAuras)
 
void HandleEmoteCommand (uint32 emoteId)
 
void AttackerStateUpdate (Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
 
void CalculateMeleeDamage (Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
 
void DealMeleeDamage (CalcDamageInfo *damageInfo, bool durabilityLoss)
 
void HandleProcExtraAttackFor (Unit *victim, uint32 count)
 
void SetLastExtraAttackSpell (uint32 spellId)
 
uint32 GetLastExtraAttackSpell () const
 
void AddExtraAttacks (uint32 count)
 
void SetLastDamagedTargetGuid (ObjectGuid const &guid)
 
ObjectGuid const & GetLastDamagedTargetGuid () const
 
void CalculateSpellDamageTaken (SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
 
void DealSpellDamage (SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
 
float GetMeleeCritChanceReduction () const
 
float GetRangedCritChanceReduction () const
 
float GetSpellCritChanceReduction () const
 
uint32 GetMeleeCritDamageReduction (uint32 damage) const
 
uint32 GetRangedCritDamageReduction (uint32 damage) const
 
uint32 GetSpellCritDamageReduction (uint32 damage) const
 
uint32 GetMeleeDamageReduction (uint32 damage) const
 
uint32 GetRangedDamageReduction (uint32 damage) const
 
uint32 GetSpellDamageReduction (uint32 damage) const
 
float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
 
SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spell, bool canReflect=false)
 
SpellMissInfo SpellHitResult (Unit *victim, Spell const *spell, bool canReflect=false)
 
float GetUnitDodgeChance () const
 
float GetUnitParryChance () const
 
float GetUnitBlockChance () const
 
float GetUnitMissChance (WeaponAttackType attType) const
 
float GetUnitCriticalChance (WeaponAttackType attackType, Unit const *victim) const
 
int32 GetMechanicResistChance (SpellInfo const *spell)
 
bool CanUseAttackType (uint8 attacktype) const
 
virtual uint32 GetShieldBlockValue () const =0
 
uint32 GetShieldBlockValue (uint32 soft_cap, uint32 hard_cap) const
 
uint32 GetUnitMeleeSkill (Unit const *target=nullptr) const
 
uint32 GetDefenseSkillValue (Unit const *target=nullptr) const
 
uint32 GetWeaponSkillValue (WeaponAttackType attType, Unit const *target=nullptr) const
 
float GetWeaponProcChance () const
 
float GetPPMProcChance (uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const
 
NPCFlags GetNpcFlags () const
 
bool HasNpcFlag (NPCFlags flags) const
 
void SetNpcFlag (NPCFlags flags)
 
void RemoveNpcFlag (NPCFlags flags)
 
void ReplaceAllNpcFlags (NPCFlags flags)
 
bool IsVendor () const
 
bool IsTrainer () const
 
bool IsQuestGiver () const
 
bool IsGossip () const
 
bool IsTaxi () const
 
bool IsGuildMaster () const
 
bool IsBattleMaster () const
 
bool IsBanker () const
 
bool IsInnkeeper () const
 
bool IsSpiritHealer () const
 
bool IsSpiritGuide () const
 
bool IsTabardDesigner () const
 
bool IsAuctioner () const
 
bool IsArmorer () const
 
bool IsServiceProvider () const
 
bool IsSpiritService () const
 
bool IsCritter () const
 
bool IsInFlight () const
 
void SetImmuneToAll (bool apply, bool keepCombat=false)
 
bool IsImmuneToAll () const
 
void SetImmuneToPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToPC () const
 
void SetImmuneToNPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToNPC () const
 
bool IsEngaged () const
 
bool IsEngagedBy (Unit const *who) const
 
bool IsInCombat () const
 
bool IsInCombatWith (Unit const *who) const
 
bool IsPetInCombat () const
 
void CombatStart (Unit *target, bool initialAggro=true)
 
void CombatStartOnCast (Unit *target, bool initialAggro=true, uint32 duration=0)
 
void SetInCombatState (bool PvP, Unit *enemy=nullptr, uint32 duration=0)
 
void SetInCombatWith (Unit *enemy, uint32 duration=0)
 
void ClearInCombat ()
 
void ClearInPetCombat ()
 
uint32 GetCombatTimer () const
 
void SetCombatTimer (uint32 timer)
 
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, uint32 familyFlags) const
 
virtual bool HasSpell (uint32) const
 
bool HasBreakableByDamageAuraType (AuraType type, uint32 excludeAura=0) const
 
bool HasBreakableByDamageCrowdControlAura (Unit *excludeCasterChannel=nullptr) const
 
bool HasStealthAura () const
 
bool HasInvisibilityAura () const
 
bool isFeared () const
 
bool isInRoots () const
 
bool IsPolymorphed () const
 
bool isFrozen () const
 
bool isTargetableForAttack (bool checkFakeDeath=true, Unit const *byWho=nullptr) const
 
bool IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell=nullptr) const
 
bool _IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
 
bool IsValidAssistTarget (Unit const *target) const
 
bool _IsValidAssistTarget (Unit const *target, SpellInfo const *bySpell) const
 
virtual bool IsInWater () const
 
virtual bool IsUnderWater () const
 
bool isInAccessiblePlaceFor (Creature const *c) const
 
void SendHealSpellLog (HealInfo const &healInfo, bool critical=false)
 
int32 HealBySpell (HealInfo &healInfo, bool critical=false)
 
void SendEnergizeSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void EnergizeBySpell (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
SpellCastResult CastSpell (SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (float x, float y, float z, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (GameObject *go, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, CustomSpellValues const &value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
AuraAddAura (uint32 spellId, Unit *target)
 
AuraAddAura (SpellInfo const *spellInfo, uint8 effMask, Unit *target)
 
void SetAuraStack (uint32 spellId, Unit *target, uint32 stack)
 
void SendPlaySpellVisual (uint32 id)
 
void SendPlaySpellImpact (ObjectGuid guid, uint32 id)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, PacketCooldowns const &cooldowns)
 
void DeMorph ()
 
void SendAttackStateUpdate (CalcDamageInfo *damageInfo)
 
void SendAttackStateUpdate (uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
 
void SendSpellNonMeleeDamageLog (SpellNonMeleeDamage *log)
 
void SendSpellNonMeleeReflectLog (SpellNonMeleeDamage *log, Unit *attacker)
 
void SendSpellNonMeleeDamageLog (Unit *target, SpellInfo const *spellInfo, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit=false, bool Split=false)
 
void SendPeriodicAuraLog (SpellPeriodicAuraLogInfo *pInfo)
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
void SendSpellDamageResist (Unit *target, uint32 spellId)
 
void SendSpellDamageImmune (Unit *target, uint32 spellId)
 
void NearTeleportTo (Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void NearTeleportTo (float x, float y, float z, float orientation, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void SendTameFailure (uint8 result)
 
void SendTeleportPacket (Position &pos)
 
virtual bool UpdatePosition (float x, float y, float z, float ang, bool teleport=false)
 
bool UpdatePosition (const Position &pos, bool teleport=false)
 
void UpdateOrientation (float orientation)
 Only server-side orientation update, does not broadcast to client.
 
void UpdateHeight (float newZ)
 Only server-side height update, does not broadcast to client.
 
void KnockbackFrom (float x, float y, float speedXY, float speedZ)
 
void JumpTo (float speedXY, float speedZ, bool forward=true)
 
void JumpTo (WorldObject *obj, float speedZ)
 
void SendMonsterMove (float NewPosX, float NewPosY, float NewPosZ, uint32 TransitTime, SplineFlags sf=SPLINEFLAG_WALK_MODE)
 
void MonsterMoveWithSpeed (float x, float y, float z, float speed)
 
void SendMovementFlagUpdate (bool self=false)
 
virtual bool SetWalk (bool enable)
 
virtual bool SetDisableGravity (bool disable, bool packetOnly=false, bool updateAnimationTier=true)
 
virtual bool SetSwim (bool enable)
 
virtual bool SetCanFly (bool enable, bool packetOnly=false)
 
virtual bool SetWaterWalking (bool enable, bool packetOnly=false)
 
virtual bool SetFeatherFall (bool enable, bool packetOnly=false)
 
virtual bool SetHover (bool enable, bool packetOnly=false, bool updateAnimationTier=true)
 
void SendMovementWaterWalking (Player *sendTo)
 
void SendMovementFeatherFall (Player *sendTo)
 
void SendMovementHover (Player *sendTo)
 
void SetInFront (WorldObject const *target)
 
void SetFacingTo (float ori)
 
void SetFacingToObject (WorldObject *object)
 
void SendChangeCurrentVictimOpcode (HostileReference *pHostileReference)
 
void SendClearThreatListOpcode ()
 
void SendRemoveFromThreatListOpcode (HostileReference *pHostileReference)
 
void SendThreatListUpdate ()
 
void SendClearTarget ()
 
void BuildHeartBeatMsg (WorldPacket *data) const
 
bool IsAlive () const
 
bool isDying () const
 
bool isDead () const
 
DeathState getDeathState ()
 
virtual void setDeathState (DeathState s, bool despawn=false)
 
ObjectGuid GetOwnerGUID () const
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetCreatorGUID () const
 
void SetCreatorGUID (ObjectGuid creator)
 
ObjectGuid GetMinionGUID () const
 
void SetMinionGUID (ObjectGuid guid)
 
ObjectGuid GetCharmerGUID () const
 
void SetCharmerGUID (ObjectGuid owner)
 
ObjectGuid GetCharmGUID () const
 
void SetPetGUID (ObjectGuid guid)
 
ObjectGuid GetPetGUID () const
 
void SetCritterGUID (ObjectGuid guid)
 
ObjectGuid GetCritterGUID () const
 
bool IsControlledByPlayer () const
 
bool IsCreatedByPlayer () const
 
ObjectGuid GetCharmerOrOwnerGUID () const
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
bool IsCharmedOwnedByPlayerOrPlayer () const
 
PlayerGetSpellModOwner () const
 
UnitGetOwner () const
 
GuardianGetGuardianPet () const
 
MinionGetFirstMinion () const
 
UnitGetCharmer () const
 
UnitGetCharm () const
 
UnitGetCharmerOrOwner () const
 
UnitGetCharmerOrOwnerOrSelf () const
 
PlayerGetCharmerOrOwnerPlayerOrPlayerItself () const
 
PlayerGetAffectingPlayer () const
 
void SetMinion (Minion *minion, bool apply)
 
void GetAllMinionsByEntry (std::list< Creature * > &Minions, uint32 entry)
 
void RemoveAllMinionsByEntry (uint32 entry)
 
void SetCharm (Unit *target, bool apply)
 
UnitGetNextRandomRaidMemberOrPet (float radius)
 
bool SetCharmedBy (Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
 
void RemoveCharmedBy (Unit *charmer)
 
void RestoreFaction ()
 
UnitGetFirstControlled () const
 
void RemoveAllControlled (bool onDeath=false)
 
bool IsCharmed () const
 
bool isPossessed () const
 
bool isPossessedByPlayer () const
 
bool isPossessing () const
 
bool isPossessing (Unit *u) const
 
CharmInfoGetCharmInfo ()
 
CharmInfoInitCharmInfo ()
 
void DeleteCharmInfo ()
 
void UpdateCharmAI ()
 
SharedVisionList const & GetSharedVisionList ()
 
void AddPlayerToVision (Player *player)
 
void RemovePlayerFromVision (Player *player)
 
bool HasSharedVision () const
 
void RemoveBindSightAuras ()
 
void RemoveCharmAuras ()
 
PetCreateTamedPetFrom (Creature *creatureTarget, uint32 spell_id=0)
 
PetCreateTamedPetFrom (uint32 creatureEntry, uint32 spell_id=0)
 
bool InitTamedPet (Pet *pet, uint8 level, uint32 spell_id)
 
Aura_TryStackingOrRefreshingExistingAura (SpellInfo const *newAura, uint8 effMask, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool periodicReset=false)
 
void _AddAura (UnitAura *aura, Unit *caster)
 
AuraApplication_CreateAuraApplication (Aura *aura, uint8 effMask)
 
void _ApplyAuraEffect (Aura *aura, uint8 effIndex)
 
void _ApplyAura (AuraApplication *aurApp, uint8 effMask)
 
void _UnapplyAura (AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
 
void _UnapplyAura (AuraApplication *aurApp, AuraRemoveMode removeMode)
 
void _RemoveNoStackAuraApplicationsDueToAura (Aura *aura)
 
void _RemoveNoStackAurasDueToAura (Aura *aura)
 
bool _IsNoStackAuraDueToAura (Aura *appliedAura, Aura *existingAura) const
 
void _RegisterAuraEffect (AuraEffect *aurEff, bool apply)
 
AuraMapGetOwnedAuras ()
 
AuraMap const & GetOwnedAuras () const
 
void RemoveOwnedAura (AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (Aura *aura, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
AuraGetOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
 
AuraApplicationMapGetAppliedAuras ()
 
AuraApplicationMap const & GetAppliedAuras () const
 
void RemoveAura (AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (AuraApplication *aurApp, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (Aura *aur, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAppliedAuras (std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (std::function< bool(Aura const *)> const &check)
 
void RemoveAppliedAuras (uint32 spellId, std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (uint32 spellId, std::function< bool(Aura const *)> const &check)
 
void RemoveAurasDueToSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAuraFromStack (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAurasDueToSpellByDispel (uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit *dispeller, uint8 chargesRemoved=1)
 
void RemoveAurasDueToSpellBySteal (uint32 spellId, ObjectGuid casterGUID, Unit *stealer)
 
void RemoveAurasDueToItemSpell (uint32 spellId, ObjectGuid castItemGuid)
 
void RemoveAurasByType (AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
 
void RemoveNotOwnSingleTargetAuras ()
 
void RemoveAurasWithInterruptFlags (uint32 flag, uint32 except=0, bool isAutoshot=false)
 
void RemoveAurasWithAttribute (uint32 flags)
 
void RemoveAurasWithFamily (SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID)
 
void RemoveAurasWithMechanic (uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
 
void RemoveMovementImpairingAuras (bool withRoot)
 
void RemoveAurasByShapeShift ()
 
void RemoveAreaAurasDueToLeaveWorld ()
 
void RemoveAllAuras ()
 
void RemoveArenaAuras ()
 
void RemoveAllAurasOnDeath ()
 
void RemoveAllAurasRequiringDeadTarget ()
 
void RemoveAllAurasExceptType (AuraType type)
 
void RemoveEvadeAuras ()
 
void DelayOwnedAuras (uint32 spellId, ObjectGuid caster, int32 delaytime)
 
void _RemoveAllAuraStatMods ()
 
void _ApplyAllAuraStatMods ()
 
AuraEffectList const & GetAuraEffectsByType (AuraType type) const
 
AuraListGetSingleCastAuras ()
 
AuraList const & GetSingleCastAuras () const
 
AuraEffectGetAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectOfRankedSpell (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectDummy (uint32 spellid) const
 
AuraEffectGetDummyAuraEffect (SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraApplicationGetAuraApplication (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
AuraApplicationGetAuraApplicationOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAuraOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
void GetDispellableAuraList (Unit *caster, uint32 dispelMask, DispelChargesList &dispelList, SpellInfo const *dispelSpell)
 
bool HasAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
 
uint32 GetAuraCount (uint32 spellId) const
 
bool HasAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
bool HasAuraType (AuraType auraType) const
 
bool HasAuraTypeWithCaster (AuraType auratype, ObjectGuid caster) const
 
bool HasAuraTypeWithMiscvalue (AuraType auratype, int32 miscvalue) const
 
bool HasAuraTypeWithAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
bool HasAuraTypeWithValue (AuraType auratype, int32 value) const
 
bool HasAuraTypeWithTriggerSpell (AuraType auratype, uint32 triggerSpell) const
 
bool HasNegativeAuraWithInterruptFlag (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasVisibleAuraType (AuraType auraType) const
 
bool HasNegativeAuraWithAttribute (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasAuraWithMechanic (uint32 mechanicMask) const
 
AuraEffectIsScriptOverriden (SpellInfo const *spell, int32 script) const
 
uint32 GetDiseasesByCaster (ObjectGuid casterGUID, uint8 mode=0)
 
uint32 GetDoTsByCaster (ObjectGuid casterGUID) const
 
int32 GetTotalAuraModifierAreaExclusive (AuraType auratype) const
 
int32 GetTotalAuraModifier (AuraType auratype) const
 
float GetTotalAuraMultiplier (AuraType auratype) const
 
int32 GetMaxPositiveAuraModifier (AuraType auratype)
 
int32 GetMaxNegativeAuraModifier (AuraType auratype) const
 
int32 GetTotalAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
float GetTotalAuraMultiplierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetMaxPositiveAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
 
int32 GetMaxNegativeAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetTotalAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
float GetTotalAuraMultiplierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxPositiveAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxNegativeAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetTotalAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetTotalAuraMultiplierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxPositiveAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxNegativeAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetResistanceBuffMods (SpellSchools school, bool positive) const
 
void SetResistanceBuffMods (SpellSchools school, bool positive, float val)
 
void ApplyResistanceBuffModsMod (SpellSchools school, bool positive, float val, bool apply)
 
void ApplyResistanceBuffModsPercentMod (SpellSchools school, bool positive, float val, bool apply)
 
void InitStatBuffMods ()
 
void ApplyStatBuffMod (Stats stat, float val, bool apply)
 
void ApplyStatPercentBuffMod (Stats stat, float val, bool apply)
 
void SetCreateStat (Stats stat, float val)
 
void SetCreateHealth (uint32 val)
 
uint32 GetCreateHealth () const
 
void SetCreateMana (uint32 val)
 
uint32 GetCreateMana () const
 
uint32 GetCreatePowers (Powers power) const
 
float GetPosStat (Stats stat) const
 
float GetNegStat (Stats stat) const
 
float GetCreateStat (Stats stat) const
 
void SetCurrentCastedSpell (Spell *pSpell)
 
virtual void ProhibitSpellSchool (SpellSchoolMask, uint32)
 
void InterruptSpell (CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
 
void FinishSpell (CurrentSpellTypes spellType, bool ok=true)
 
bool IsNonMeleeSpellCast (bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
 
void InterruptNonMeleeSpells (bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
 
SpellGetCurrentSpell (CurrentSpellTypes spellType) const
 
SpellGetCurrentSpell (uint32 spellType) const
 
SpellFindCurrentSpellBySpellId (uint32 spell_id) const
 
int32 GetCurrentSpellCastTime (uint32 spell_id) const
 
virtual bool IsMovementPreventedByCasting () const
 
ShapeshiftForm GetShapeshiftForm () const
 
void SetShapeshiftForm (ShapeshiftForm form)
 
bool IsInFeralForm () const
 
bool IsInDisallowedMountForm () const
 
bool HandleStatModifier (UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
 
void SetModifierValue (UnitMods unitMod, UnitModifierType modifierType, float value)
 
float GetModifierValue (UnitMods unitMod, UnitModifierType modifierType) const
 
float GetTotalStatValue (Stats stat, float additionalValue=0.0f) const
 
float GetTotalAuraModValue (UnitMods unitMod) const
 
SpellSchools GetSpellSchoolByAuraGroup (UnitMods unitMod) const
 
Stats GetStatByAuraGroup (UnitMods unitMod) const
 
Powers GetPowerTypeByAuraGroup (UnitMods unitMod) const
 
bool CanModifyStats () const
 
void SetCanModifyStats (bool modifyStats)
 
virtual bool UpdateStats (Stats stat)=0
 
virtual bool UpdateAllStats ()=0
 
virtual void UpdateResistances (uint32 school)=0
 
virtual void UpdateAllResistances ()
 
virtual void UpdateArmor ()=0
 
virtual void UpdateMaxHealth ()=0
 
virtual void UpdateMaxPower (Powers power)=0
 
virtual void UpdateAttackPowerAndDamage (bool ranged=false)=0
 
virtual void UpdateDamagePhysical (WeaponAttackType attType)
 
float GetTotalAttackPowerValue (WeaponAttackType attType, Unit *pVictim=nullptr) const
 
float GetWeaponDamageRange (WeaponAttackType attType, WeaponDamageRange type, uint8 damageIndex=0) const
 
void SetBaseWeaponDamage (WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
 
virtual void CalculateMinMaxDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex=0)=0
 
uint32 CalculateDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
 
float GetAPMultiplier (WeaponAttackType attType, bool normalized)
 
bool isInFrontInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool isInBackInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool IsVisible () const
 
void SetVisible (bool x)
 
void SetModelVisible (bool on)
 
uint32 GetPhaseByAuras () const
 
void SetPhaseMask (uint32 newPhaseMask, bool update) override
 
void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false) override
 
bool CanHaveThreatList () const
 
void AddThreat (Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
 
float ApplyTotalThreatModifier (float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
void TauntApply (Unit *victim)
 
void TauntFadeOut (Unit *taunter)
 
ThreatMgrGetThreatMgr ()
 
ThreatMgr const & GetThreatMgr () const
 
void addHatedBy (HostileReference *pHostileReference)
 
void removeHatedBy (HostileReference *)
 
HostileRefMgrgetHostileRefMgr ()
 
VisibleAuraMap const * GetVisibleAuras ()
 
AuraApplicationGetVisibleAura (uint8 slot)
 
void SetVisibleAura (uint8 slot, AuraApplication *aur)
 
void RemoveVisibleAura (uint8 slot)
 
uint32 GetInterruptMask () const
 
void AddInterruptMask (uint32 mask)
 
void UpdateInterruptMask ()
 
virtual float GetNativeObjectScale () const
 
virtual void RecalculateObjectScale ()
 
uint32 GetDisplayId () const
 
virtual void SetDisplayId (uint32 modelId)
 
uint32 GetNativeDisplayId () const
 
void RestoreDisplayId ()
 
void SetNativeDisplayId (uint32 modelId)
 
void setTransForm (uint32 spellid)
 
uint32 getTransForm () const
 
void _RegisterDynObject (DynamicObject *dynObj)
 
void _UnregisterDynObject (DynamicObject *dynObj)
 
DynamicObjectGetDynObject (uint32 spellId)
 
bool RemoveDynObject (uint32 spellId)
 
void RemoveAllDynObjects ()
 
GameObjectGetGameObject (uint32 spellId) const
 
void AddGameObject (GameObject *gameObj)
 
void RemoveGameObject (GameObject *gameObj, bool del)
 
void RemoveGameObject (uint32 spellid, bool del)
 
void RemoveAllGameObjects ()
 
void ModifyAuraState (AuraStateType flag, bool apply)
 
uint32 BuildAuraStateUpdateForTarget (Unit *target) const
 
bool HasAuraState (AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
 
void UnsummonAllTotems (bool onDeath=false)
 
UnitGetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
UnitGetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo=nullptr)
 
int32 SpellBaseDamageBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseDamageBonusTaken (SpellSchoolMask schoolMask, bool isDoT=false)
 
float SpellPctDamageModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellDamageBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellDamageBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
 
int32 SpellBaseHealingBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseHealingBonusTaken (SpellSchoolMask schoolMask)
 
float SpellPctHealingModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellHealingBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellHealingBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
 
uint32 MeleeDamageBonusDone (Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
uint32 MeleeDamageBonusTaken (Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
bool isSpellBlocked (Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
 
bool isBlockCritical ()
 
float SpellDoneCritChance (Unit const *, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType, bool skipEffectCheck) const
 
float SpellTakenCritChance (Unit const *caster, SpellInfo const *spellProto, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType, bool skipEffectCheck) const
 
void SetLastManaUse (uint32 spellCastTime)
 
bool IsUnderLastManaUseEffect () const
 
void SetContestedPvP (Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
 
uint32 GetCastingTimeForBonus (SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
 
float CalculateDefaultCoefficient (SpellInfo const *spellInfo, DamageEffectType damagetype) const
 
void CastDelayedSpellWithPeriodicAmount (Unit *caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex=0)
 
void ApplySpellImmune (uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
 
void ApplySpellDispelImmunity (SpellInfo const *spellProto, DispelType type, bool apply)
 
virtual bool IsImmunedToSpell (SpellInfo const *spellInfo, Spell const *spell=nullptr)
 
bool IsImmunedToDamage (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamage (SpellInfo const *spellInfo) const
 
bool IsImmunedToDamage (Spell const *spell) const
 
bool IsImmunedToSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToSchool (SpellInfo const *spellInfo) const
 
bool IsImmunedToSchool (Spell const *spell) const
 
bool IsImmunedToDamageOrSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamageOrSchool (SpellInfo const *spellInfo) const
 
virtual bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, uint32 index) const
 
void UpdateSpeed (UnitMoveType mtype, bool forced)
 
float GetSpeed (UnitMoveType mtype) const
 
float GetSpeedRate (UnitMoveType mtype) const
 
void SetSpeed (UnitMoveType mtype, float rate, bool forced=false)
 
void SetSpeedRate (UnitMoveType mtype, float rate)
 
float ApplyEffectModifiers (SpellInfo const *spellProto, uint8 effect_index, float value) const
 
int32 CalculateSpellDamage (Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
 
int32 CalcSpellDuration (SpellInfo const *spellProto)
 
int32 ModSpellDuration (SpellInfo const *spellProto, Unit const *target, int32 duration, bool positive, uint32 effectMask)
 
void ModSpellCastTime (SpellInfo const *spellProto, int32 &castTime, Spell *spell=nullptr)
 
float CalculateLevelPenalty (SpellInfo const *spellProto) const
 
void addFollower (FollowerReference *pRef)
 
void removeFollower (FollowerReference *)
 
MotionMasterGetMotionMaster ()
 
const MotionMasterGetMotionMaster () const
 
virtual MovementGeneratorType GetDefaultMovementType () const
 -------—End of Pet responses methods-------—
 
bool IsStopped () const
 
void StopMoving ()
 
void StopMovingOnCurrentPos ()
 
virtual void PauseMovement (uint32 timer=0, uint8 slot=0)
 
void ResumeMovement (uint32 timer=0, uint8 slot=0)
 
void AddUnitMovementFlag (uint32 f)
 
void RemoveUnitMovementFlag (uint32 f)
 
bool HasUnitMovementFlag (uint32 f) const
 
uint32 GetUnitMovementFlags () const
 
void SetUnitMovementFlags (uint32 f)
 
void AddExtraUnitMovementFlag (uint16 f)
 
void RemoveExtraUnitMovementFlag (uint16 f)
 
uint16 HasExtraUnitMovementFlag (uint16 f) const
 
uint16 GetExtraUnitMovementFlags () const
 
void SetExtraUnitMovementFlags (uint16 f)
 
void SetControlled (bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
 
void DisableRotate (bool apply)
 
void DisableSpline ()
 
uint8 GetComboPoints (Unit const *who=nullptr) const
 --------—Combo point system----------------—
 
uint8 GetComboPoints (ObjectGuid const &guid) const
 
UnitGetComboTarget () const
 
ObjectGuid const GetComboTargetGUID () const
 
void AddComboPoints (Unit *target, int8 count)
 
void AddComboPoints (int8 count)
 
void ClearComboPoints ()
 
void SendComboPoints ()
 
void AddComboPointHolder (Unit *unit)
 
void RemoveComboPointHolder (Unit *unit)
 
void ClearComboPointHolders ()
 
void SendPetActionFeedback (uint8 msg)
 -------—Pet responses methods--------------—
 
void SendPetTalk (uint32 pettalk)
 
void SendPetAIReaction (ObjectGuid guid)
 
void propagateSpeedChange ()
 -------—End of Pet responses methods-------—
 
void ClearAllReactives ()
 
void StartReactiveTimer (ReactiveType reactive)
 
void UpdateReactives (uint32 p_time)
 
void UpdateAuraForGroup (uint8 slot)
 
bool CanProc ()
 
void SetCantProc (bool apply)
 
void AddPetAura (PetAura const *petSpell)
 
void RemovePetAura (PetAura const *petSpell)
 
void CastPetAura (PetAura const *aura)
 
bool IsPetAura (Aura const *aura)
 
uint32 GetModelForForm (ShapeshiftForm form, uint32 spellId) const
 
uint32 GetModelForTotem (PlayerTotemType totemType)
 
void SetRedirectThreat (ObjectGuid guid, uint32 pct)
 
void ResetRedirectThreat ()
 
void ModifyRedirectThreat (int32 amount)
 
uint32 GetRedirectThreatPercent ()
 
UnitGetRedirectThreatTarget () const
 
bool CreateVehicleKit (uint32 id, uint32 creatureEntry)
 
void RemoveVehicleKit ()
 
VehicleGetVehicleKit () const
 
VehicleGetVehicle () const
 
bool IsOnVehicle (Unit const *vehicle) const
 
UnitGetVehicleBase () const
 
CreatureGetVehicleCreatureBase () const
 
ObjectGuid GetTransGUID () const override
 
TransportBaseGetDirectTransport () const
 Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
 
bool HandleSpellClick (Unit *clicker, int8 seatId=-1)
 
void EnterVehicle (Unit *base, int8 seatId=-1)
 
void EnterVehicleUnattackable (Unit *base, int8 seatId=-1)
 
void ExitVehicle (Position const *exitPosition=nullptr)
 
void ChangeSeat (int8 seatId, bool next=true)
 
void _ExitVehicle (Position const *exitPosition=nullptr)
 
void _EnterVehicle (Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
 
void BuildMovementPacket (ByteBuffer *data) const
 
virtual bool CanSwim () const
 this method checks the current flag of a unit
 
bool IsLevitating () const
 
bool IsWalking () const
 
bool isMoving () const
 
bool isTurning () const
 
bool IsHovering () const
 
bool isSwimming () const
 
virtual bool CanFly () const =0
 
bool IsFlying () const
 
bool IsFalling () const
 
float GetHoverHeight () const
 
virtual bool CanEnterWater () const =0
 
void RewardRage (uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
 
virtual float GetFollowAngle () const
 
void OutDebugInfo () const
 
virtual bool isBeingLoaded () const
 
bool IsDuringRemoveFromWorld () const
 
PetToPet ()
 
TotemToTotem ()
 
TempSummonToTempSummon ()
 
const TempSummonToTempSummon () const
 
void AddPointedBy (SafeUnitPointer *sup)
 
void RemovePointedBy (SafeUnitPointer *sup)
 
void ExecuteDelayedUnitRelocationEvent ()
 
void ExecuteDelayedUnitAINotifyEvent ()
 
virtual bool HasSpellCooldown (uint32) const
 
virtual bool HasSpellItemCooldown (uint32, uint32) const
 
virtual void AddSpellCooldown (uint32, uint32, uint32, bool needSendToClient=false, bool forceSendToSpectator=false)
 
bool CanApplyResilience () const
 
void PetSpellFail (SpellInfo const *spellInfo, Unit *target, uint32 result)
 
int32 CalculateAOEDamageReduction (int32 damage, uint32 schoolMask, Unit *caster) const
 
ObjectGuid GetTarget () const
 
virtual void SetTarget (ObjectGuid=ObjectGuid::Empty)=0
 
void SetInstantCast (bool set)
 
bool CanInstantCast () const
 
virtual void Talk (std::string_view text, ChatMsg msgType, Language language, float textRange, WorldObject const *target)
 
virtual void Say (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void Yell (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void TextEmote (std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (std::string_view text, Language language, Player *target, bool isBossWhisper=false)
 
virtual void Talk (uint32 textId, ChatMsg msgType, float textRange, WorldObject const *target)
 
virtual void Say (uint32 textId, WorldObject const *target=nullptr)
 
virtual void Yell (uint32 textId, WorldObject const *target=nullptr)
 
virtual void TextEmote (uint32 textId, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (uint32 textId, Player *target, bool isBossWhisper=false)
 
float GetCollisionHeight () const override
 Return collision height sent to client.
 
float GetCollisionWidth () const override
 this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by the DBC
 
float GetCollisionRadius () const override
 this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by the DBC
 
void ProcessPositionDataChanged (PositionFullTerrainStatus const &data) override
 
virtual void ProcessTerrainStatusUpdate ()
 
bool CanRestoreMana (SpellInfo const *spellInfo) const
 
std::string GetDebugInfo () const override
 
uint32 GetOldFactionId () const
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
virtual void Update (uint32)
 
void _Create (ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
 
void GetVoidClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0, float controlZ=0) const
 
bool GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) const
 
void MovePosition (Position &pos, float dist, float angle)
 
Position GetNearPosition (float dist, float angle)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float startX, float startY, float startZ, float destX, float destY)
 
Position GetFirstCollisionPosition (float destX, float destY, float destZ)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
void GetChargeContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () const
 
virtual float GetCombatReach () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr) const
 
void GetRandomPoint (const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (const Position &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
 
uint32 GetPhaseMask () const
 
bool InSamePhase (WorldObject const *obj) const
 
bool InSamePhase (uint32 phasemask) const
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsOutdoors () const
 
LiquidData const & GetLiquidData () const
 
InstanceScriptGetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string const &newname)
 
virtual std::string const & GetNameForLocaleIdx (LocaleConstant) const
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (const Position &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (const Position *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (const Position *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
 
bool IsWithinLOSInMap (WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
Position GetHitSpherePointFor (Position const &dest, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=M_PI) const
 
bool isInBack (WorldObject const *target, float arc=M_PI) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void CleanupsBeforeDelete (bool finalCleanup=true)
 
virtual void SendMessageToSet (WorldPacket const *data, bool self) const
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool, bool includeMargin=false, Player const *skipped_rcvr=nullptr) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
virtual uint8 getLevelForTarget (WorldObject const *) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
virtual float GetSightRange (WorldObject const *target=nullptr) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
void SendPlayMusic (uint32 Music, bool OnlySelf)
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
void SetZoneScript ()
 
void ClearZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool onlySpawned=false) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float distance=0) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetDeadCreatureListInGrid (std::list< Creature * > &lList, float maxSearchRange, bool alive=false) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false)
 
void BuildUpdate (UpdateDataMapType &data_map, UpdatePlayerSet &player_set) override
 
void GetCreaturesWithEntryInRange (std::list< Creature * > &creatureList, float radius, uint32 entry)
 
void SetPositionDataUpdate ()
 
void UpdatePositionData ()
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
void RemoveFromNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
bool NotifyExecuted (uint16 f) const
 
void SetNotified (uint16 f)
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
bool IsFarVisible () const
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
bool IsInWintergrasp () const
 
TransportGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
virtual ObjectGuid GetTransGUID () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
float GetMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr) const
 
float GetMapHeight (float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
 
float GetFloorZ () const
 
float GetMinHeightInWater () const
 Get the minimum height of a object that should be in water to start floating/swim.
 
virtual float GetCollisionHeight () const
 
virtual float GetCollisionWidth () const
 
virtual float GetCollisionRadius () const
 
void AddAllowedLooter (ObjectGuid guid)
 
void ResetAllowedLooters ()
 
void SetAllowedLooters (GuidUnorderedSet const looters)
 
bool HasAllowedLooter (ObjectGuid guid) const
 
GuidUnorderedSet const & GetAllowedLooters () const
 
void RemoveAllowedLooter (ObjectGuid guid)
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
virtual void AddToWorld ()
 
virtual void RemoveFromWorld ()
 
ObjectGuid GetGUID () const
 
PackedGuid const & GetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
virtual uint32 GetDynamicFlags () const
 
bool HasDynamicFlag (uint32 flag) const
 
virtual void SetDynamicFlag (uint32 flag)
 
virtual void RemoveDynamicFlag (uint32 flag)
 
virtual void ReplaceAllDynamicFlags (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
 
virtual void DestroyForPlayer (Player *target, bool onDeath=false) const
 
int32 GetInt32Value (uint16 index) const
 
uint32 GetUInt32Value (uint16 index) const
 
uint64 GetUInt64Value (uint16 index) const
 
float GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
ObjectGuid GetGuidValue (uint16 index) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void UpdateUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, uint64 value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetInt16Value (uint16 index, uint8 offset, int16 value)
 
void SetGuidValue (uint16 index, ObjectGuid value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt64Value (uint16 index, int32 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
virtual void BuildUpdate (UpdateDataMapType &, UpdatePlayerSet &)
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
virtual std::string GetDebugInfo () const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (uint32 mapId, Position const &position)
 
void WorldRelocate (const WorldLocation &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
void SetMapId (uint32 mapId)
 
uint32 GetMapId () const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z, float &o) const
 
void GetWorldLocation (WorldLocation *location) const
 
WorldLocation GetWorldLocation () const
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
 Position (Position &&)=default
 
Positionoperator= (const Position &)=default
 
Positionoperator= (Position &&)=default
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a)
 
 operator G3D::Vector3 () const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (const Position &pos)
 
void Relocate (const Position *pos)
 
void RelocatePolarOffset (float angle, float dist, float z=0.0f)
 
void RelocateOffset (const Position &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
bool IsPositionValid () const
 
float GetExactDist2dSq (const float x, const float y) const
 
float GetExactDist2dSq (Position const &pos) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2d (Position const &pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDistSq (Position const &pos) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDist (Position const &pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (const Position &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (const Position *pos) const
 
float GetAngle (float x, float y) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float GetRelativeAngle (const Position *pos) const
 
float GetRelativeAngle (float x, float y) const
 
float ToAbsoluteAngle (float relAngle) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (const Position *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (const Position *pos, float dist) const
 
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, const Position *pos, float targetRadius=0.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
std::string ToString () const
 
- Public Member Functions inherited from GridObject< Player >
bool IsInGrid () const
 
void AddToGrid (GridRefMgr< Player > &m)
 
void RemoveFromGrid ()
 

Static Public Member Functions

static bool BuildEnumData (PreparedQueryResult result, WorldPacket *data)
 
static uint8 GetAttackBySlot (uint8 slot)
 
static bool IsInventoryPos (uint16 pos)
 
static bool IsInventoryPos (uint8 bag, uint8 slot)
 
static bool IsEquipmentPos (uint16 pos)
 
static bool IsEquipmentPos (uint8 bag, uint8 slot)
 
static bool IsBagPos (uint16 pos)
 
static bool IsBankPos (uint16 pos)
 
static bool IsBankPos (uint8 bag, uint8 slot)
 
static uint32 GetDefaultGossipMenuForSource (WorldObject *source)
 
static uint32 GetZoneIdFromDB (ObjectGuid guid)
 
static bool LoadPositionFromDB (uint32 &mapid, float &x, float &y, float &z, float &o, bool &in_flight, ObjectGuid::LowType guid)
 
static bool IsValidGender (uint8 Gender)
 
static void Customize (CharacterCustomizeInfo const *customizeInfo, CharacterDatabaseTransaction trans)
 
static void SavePositionInDB (uint32 mapid, float x, float y, float z, float o, uint32 zone, ObjectGuid guid)
 
static void SavePositionInDB (WorldLocation const &loc, uint16 zoneId, ObjectGuid guid, CharacterDatabaseTransaction trans)
 
static void DeleteFromDB (ObjectGuid::LowType lowGuid, uint32 accountId, bool updateRealmChars, bool deleteFinally)
 
static void DeleteOldCharacters ()
 
static void DeleteOldCharacters (uint32 keepDays)
 
static void RemoveFromGroup (Group *group, ObjectGuid guid, RemoveMethod method=GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker=ObjectGuid::Empty, const char *reason=nullptr)
 
static void RemovePetitionsAndSigns (ObjectGuid guid, uint32 type)
 
static uint32 GetArenaTeamIdFromDB (ObjectGuid guid, uint8 slot)
 
static void LeaveAllArenaTeams (ObjectGuid guid)
 
static void ResetInstances (ObjectGuid guid, uint8 method, bool isRaid)
 Reset all solo instances and optionally send a message on success for each.
 
static void OfflineResurrect (ObjectGuid const guid, CharacterDatabaseTransaction trans)
 
static TeamId TeamIdForRace (uint8 race)
 
static DrunkenState GetDrunkenstateByValue (uint8 value)
 
- Static Public Member Functions inherited from Unit
static float GetEffectiveResistChance (Unit const *owner, SpellSchoolMask schoolMask, Unit const *victim)
 
static void DealDamageMods (Unit const *victim, uint32 &damage, uint32 *absorb)
 
static uint32 DealDamage (Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
 
static void Kill (Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
static int32 DealHeal (Unit *healer, Unit *victim, uint32 addhealth)
 
static void ProcDamageAndSpell (Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
static void ApplyResilience (Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
 
static uint32 SpellCriticalDamageBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static uint32 SpellCriticalHealingBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static bool IsDamageReducedByArmor (SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
 
static uint32 CalcArmorReducedDamage (Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
 
static void CalcAbsorbResist (DamageInfo &dmgInfo, bool Splited=false)
 
static void CalcHealAbsorb (HealInfo &healInfo)
 
static void HandleSafeUnitPointersOnDelete (Unit *thisUnit)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

std::string autoReplyMsg
 
PlayerTaxi m_taxi
 
time_t m_logintime
 
time_t m_Last_tick
 
uint32 m_Played_time [MAX_PLAYED_TIME_INDEX]
 
bool m_mailsUpdated
 
uint8 unReadMails
 
time_t m_nextMailDelivereTime
 
ItemMap mMitems
 
PvPInfo pvpInfo
 
std::unique_ptr< DuelInfoduel
 
PlayerMenuPlayerTalkClass
 
std::vector< ItemSetEffect * > ItemSetEff
 
SafeUnitPointer m_mover
 
WorldObjectm_seer
 
std::set< Unit * > m_isInSharedVisionOf
 
uint32 m_recallMap
 
float m_recallX
 
float m_recallY
 
float m_recallZ
 
float m_recallO
 
uint32 m_homebindMapId
 
uint16 m_homebindAreaId
 
float m_homebindX
 
float m_homebindY
 
float m_homebindZ
 
float m_homebindO
 
GuidUnorderedSet m_clientGUIDs
 
std::vector< Unit * > m_newVisible
 
uint8 m_forced_speed_changes [MAX_MOVE_TYPE]
 
DFQuestsDoneList m_DFQuests
 
uint32 m_HomebindTimer
 
bool m_InstanceValid
 
Spellm_spellModTakingSpell
 
bool isDebugAreaTriggers
 
uint32 m_pendingSpectatorForBG
 
uint32 m_pendingSpectatorInviteInstanceId
 
GuidSet m_receivedSpectatorResetFor
 
ObjectGuid m_drwGUID
 
uint32 m_charmUpdateTimer
 
- Public Attributes inherited from Unit
uint32 m_extraAttacks
 
bool m_canDualWield
 
ControlSet m_Controlled
 
SafeUnitPointer m_movedByPlayer
 
ObjectGuid m_SummonSlot [MAX_SUMMON_SLOT]
 
ObjectGuid m_ObjectSlot [MAX_GAMEOBJECT_SLOT]
 
float m_modMeleeHitChance
 
float m_modRangedHitChance
 
float m_modSpellHitChance
 
int32 m_baseSpellCritChance
 
float m_threatModifier [MAX_SPELL_SCHOOL]
 
float m_modAttackSpeedPct [3]
 
EventProcessor m_Events
 
SpellImmuneList m_spellImmune [MAX_SPELL_IMMUNITY]
 
uint32 m_lastSanctuaryTime
 
PetAuraSet m_petAuras
 
bool IsAIEnabled
 
bool NeedChangeAI
 
bool m_ControlledByPlayer
 
bool m_CreatedByPlayer
 
std::set< SafeUnitPointer * > SafeUnitPointerSet
 
Position m_last_notify_position
 
uint32 m_last_notify_mstime
 
uint16 m_delayed_unit_relocation_timer
 
uint16 m_delayed_unit_ai_notify_timer
 
bool bRequestForcedVisibilityUpdate
 
Movement::MoveSplinemovespline
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
ElunaEventProcessor * elunaEvents
 
- Public Attributes inherited from Object
DataMap CustomData
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX = 0
 
float m_positionY = 0
 
float m_positionZ = 0
 
float m_orientation = 0
 

Static Public Attributes

static std::unordered_map< int, bgZoneRefbgZoneIdToFillWorldStates = {}
 

Protected Types

typedef std::set< uint32QuestSet
 
typedef std::set< uint32SeasonalQuestSet
 
typedef std::unordered_map< uint32, SeasonalQuestSetSeasonalEventQuestMap
 
typedef std::list< Channel * > JoinedChannelsList
 
- Protected Types inherited from Unit
typedef std::list< DynamicObject * > DynObjectList
 
typedef GuidList GameObjectList
 
typedef std::map< ObjectGuid, float > CharmThreatMap
 

Protected Member Functions

void _LoadActions (PreparedQueryResult result)
 
void _LoadAuras (PreparedQueryResult result, uint32 timediff)
 
void _LoadGlyphAuras ()
 
void _LoadInventory (PreparedQueryResult result, uint32 timeDiff)
 
void _LoadMail (PreparedQueryResult mailsResult, PreparedQueryResult mailItemsResult)
 
void _LoadQuestStatus (PreparedQueryResult result)
 
void _LoadQuestStatusRewarded (PreparedQueryResult result)
 
void _LoadDailyQuestStatus (PreparedQueryResult result)
 
void _LoadWeeklyQuestStatus (PreparedQueryResult result)
 
void _LoadMonthlyQuestStatus (PreparedQueryResult result)
 
void _LoadSeasonalQuestStatus (PreparedQueryResult result)
 
void _LoadRandomBGStatus (PreparedQueryResult result)
 
void _LoadGroup ()
 
void _LoadSkills (PreparedQueryResult result)
 
void _LoadSpells (PreparedQueryResult result)
 
void _LoadFriendList (PreparedQueryResult result)
 
bool _LoadHomeBind (PreparedQueryResult result)
 
void _LoadDeclinedNames (PreparedQueryResult result)
 
void _LoadArenaTeamInfo ()
 
void _LoadEquipmentSets (PreparedQueryResult result)
 
void _LoadEntryPointData (PreparedQueryResult result)
 
void _LoadGlyphs (PreparedQueryResult result)
 
void _LoadTalents (PreparedQueryResult result)
 
void _LoadInstanceTimeRestrictions (PreparedQueryResult result)
 
void _LoadBrewOfTheMonth (PreparedQueryResult result)
 
void _LoadCharacterSettings (PreparedQueryResult result)
 
void _LoadPetStable (uint8 petStableSlots, PreparedQueryResult result)
 
void _SaveActions (CharacterDatabaseTransaction trans)
 
void _SaveAuras (CharacterDatabaseTransaction trans, bool logout)
 
void _SaveInventory (CharacterDatabaseTransaction trans)
 
void _SaveMail (CharacterDatabaseTransaction trans)
 
void _SaveQuestStatus (CharacterDatabaseTransaction trans)
 
void _SaveDailyQuestStatus (CharacterDatabaseTransaction trans)
 
void _SaveWeeklyQuestStatus (CharacterDatabaseTransaction trans)
 
void _SaveMonthlyQuestStatus (CharacterDatabaseTransaction trans)
 
void _SaveSeasonalQuestStatus (CharacterDatabaseTransaction trans)
 
void _SaveSpells (CharacterDatabaseTransaction trans)
 
void _SaveEquipmentSets (CharacterDatabaseTransaction trans)
 
void _SaveEntryPoint (CharacterDatabaseTransaction trans)
 
void _SaveGlyphs (CharacterDatabaseTransaction trans)
 
void _SaveTalents (CharacterDatabaseTransaction trans)
 
void _SaveStats (CharacterDatabaseTransaction trans)
 
void _SaveCharacter (bool create, CharacterDatabaseTransaction trans)
 
void _SaveInstanceTimeRestrictions (CharacterDatabaseTransaction trans)
 
void _SavePlayerSettings (CharacterDatabaseTransaction trans)
 
void HandleSobering ()
 The player sobers by 1% every 9 seconds.
 
void SendMirrorTimer (MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen)
 
void StopMirrorTimer (MirrorTimerType Type)
 
void HandleDrowning (uint32 time_diff)
 
int32 getMaxTimer (MirrorTimerType timer)
 
void outDebugValues () const
 
void SendQuestGiverStatusMultiple ()
 
bool CanAlwaysSee (WorldObject const *obj) const override
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
- Protected Member Functions inherited from Unit
 Unit (bool isWorldObject)
 
void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const override
 
void _UpdateSpells (uint32 time)
 
void _DeleteRemovedAuras ()
 
void _UpdateAutoRepeatSpell ()
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
void SetFeared (bool apply, Unit *fearedBy=nullptr, bool isFear=false)
 
void SetConfused (bool apply)
 
void SetStunned (bool apply)
 
void SetRooted (bool apply, bool isStun=false)
 
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
virtual void ProcessPositionDataChanged (PositionFullTerrainStatus const &data)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool IsNeverVisible () const
 
virtual bool IsAlwaysVisibleFor (WorldObject const *) const
 
virtual bool IsInvisibleDueToDespawn () const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
bool _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint16 flags) const
 
virtual void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
 
virtual void AddToObjectUpdate ()=0
 
virtual void RemoveFromObjectUpdate ()=0
 
void AddToObjectUpdateIfNeeded ()
 

Static Protected Member Functions

static Item_LoadMailedItem (ObjectGuid const &playerGuid, Player *player, uint32 mailId, Mail *mail, Field *fields)
 

Protected Attributes

WhisperListContainer WhisperList
 
bool m_NeedToSaveGlyphs
 
uint32 m_MountBlockId
 
float m_realDodge
 
float m_realParry
 
uint32 m_charmAISpells [NUM_CAI_SPELLS]
 
uint32 m_AreaID
 
uint32 m_regenTimerCount
 
uint32 m_foodEmoteTimerCount
 
float m_powerFraction [MAX_POWERS]
 
uint32 m_contestedPvPTimer
 
std::array< BgBattlegroundQueueID_Rec, PLAYER_MAX_BATTLEGROUND_QUEUES_BgBattlegroundQueueID
 
BGData m_bgData
 
bool m_IsBGRandomWinner
 
EntryPointData m_entryPointData
 
QuestSet m_timedquests
 
QuestSet m_weeklyquests
 
QuestSet m_monthlyquests
 
SeasonalEventQuestMap m_seasonalquests
 
ObjectGuid m_divider
 
uint32 m_ingametime
 
time_t m_lastHonorUpdateTime
 
ObjectGuid m_lootGuid
 
TeamId m_team
 
uint32 m_nextSave
 
uint16 m_additionalSaveTimer
 
uint8 m_additionalSaveMask
 
uint16 m_hostileReferenceCheckTimer
 
std::array< ChatFloodThrottle, ChatFloodThrottle::MAXm_chatFloodData
 
Difficulty m_dungeonDifficulty
 
Difficulty m_raidDifficulty
 
Difficulty m_raidMapDifficulty
 
uint32 m_atLoginFlags
 
Itemm_items [PLAYER_SLOTS_COUNT]
 
uint32 m_currentBuybackSlot
 
std::vector< Item * > m_itemUpdateQueue
 
bool m_itemUpdateQueueBlocked
 
uint32 m_ExtraFlags
 
QuestStatusMap m_QuestStatus
 
QuestStatusSaveMap m_QuestStatusSave
 
RewardedQuestSet m_RewardedQuests
 
QuestStatusSaveMap m_RewardedQuestsSave
 
SkillStatusMap mSkillStatus
 
uint32 m_GuildIdInvited
 
uint32 m_ArenaTeamIdInvited
 
PlayerMails m_mail
 
PlayerSpellMap m_spells
 
PlayerTalentMap m_talents
 
uint32 m_lastPotionId
 
GlobalCooldownMgr m_GlobalCooldownMgr
 
uint8 m_activeSpec
 
uint8 m_specsCount
 
uint32 m_Glyphs [MAX_TALENT_SPECS][MAX_GLYPH_SLOT_INDEX]
 
ActionButtonList m_actionButtons
 
float m_auraBaseMod [BASEMOD_END][MOD_END]
 
int32 m_baseRatingValue [MAX_COMBAT_RATING]
 
uint32 m_baseSpellPower
 
uint32 m_baseFeralAP
 
uint32 m_baseManaRegen
 
uint32 m_baseHealthRegen
 
int32 m_spellPenetrationItemMod
 
SpellModList m_spellMods [MAX_SPELLMOD]
 
EnchantDurationList m_enchantDuration
 
ItemDurationList m_itemDuration
 
ItemDurationList m_itemSoulboundTradeable
 
std::mutex m_soulboundTradableLock
 
ObjectGuid m_resurrectGUID
 
uint32 m_resurrectMap
 
float m_resurrectX
 
float m_resurrectY
 
float m_resurrectZ
 
uint32 m_resurrectHealth
 
uint32 m_resurrectMana
 
WorldSessionm_session
 
JoinedChannelsList m_channels
 
uint8 m_cinematic
 
TradeDatam_trade
 
bool m_DailyQuestChanged
 
bool m_WeeklyQuestChanged
 
bool m_MonthlyQuestChanged
 
bool m_SeasonalQuestChanged
 
time_t m_lastDailyQuestTime
 
uint32 m_drunkTimer
 
uint32 m_weaponChangeTimer
 
uint32 m_zoneUpdateId
 
uint32 m_zoneUpdateTimer
 
uint32 m_areaUpdateId
 
uint32 m_deathTimer
 
time_t m_deathExpireTime
 
uint32 m_WeaponProficiency
 
uint32 m_ArmorProficiency
 
bool m_canParry
 
bool m_canBlock
 
bool m_canTitanGrip
 
uint8 m_swingErrorMsg
 
float m_ammoDPS
 
time_t _restTime
 
uint32 _innTriggerId
 
float _restBonus
 
uint32 _restFlagMask
 
uint32 m_resetTalentsCost
 
time_t m_resetTalentsTime
 
uint32 m_usedTalentCount
 
uint32 m_questRewardTalentCount
 
uint32 m_extraBonusTalentCount
 
PlayerSocialm_social
 
GroupReference m_group
 
GroupReference m_originalGroup
 
Groupm_groupInvite
 
uint32 m_groupUpdateMask
 
uint64 m_auraRaidUpdateMask
 
bool m_bPassOnGroupLoot
 
uint32 m_lastpetnumber
 
time_t m_summon_expire
 
uint32 m_summon_mapid
 
float m_summon_x
 
float m_summon_y
 
float m_summon_z
 
bool m_summon_asSpectator
 
DeclinedNamem_declinedname
 
Runesm_runes
 
EquipmentSets m_EquipmentSets
 
uint8 m_grantableLevels
 
bool m_needZoneUpdate
 
- Protected Attributes inherited from Unit
UnitAIi_AI
 
UnitAIi_disabledAI
 
uint8 m_realRace
 
uint8 m_race
 
bool m_AutoRepeatFirstCast
 
int32 m_attackTimer [MAX_ATTACK]
 
float m_createStats [MAX_STATS]
 
AttackerSet m_attackers
 
Unitm_attacking
 
DeathState m_deathState
 
int32 m_procDeep
 
DynObjectList m_dynObj
 
GameObjectList m_gameObj
 
uint32 m_transform
 
Spellm_currentSpells [CURRENT_MAX_SPELL]
 
AuraMap m_ownedAuras
 
AuraApplicationMap m_appliedAuras
 
AuraList m_removedAuras
 
AuraMap::iterator m_auraUpdateIterator
 
uint32 m_removedAurasCount
 
AuraEffectList m_modAuras [TOTAL_AURAS]
 
AuraList m_scAuras
 
AuraApplicationList m_interruptableAuras
 
AuraStateAurasMap m_auraStateAuras
 
uint32 m_interruptMask
 
float m_auraModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_END]
 
float m_weaponDamage [MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
 
bool m_canModifyStats
 
VisibleAuraMap m_visibleAuras
 
float m_speed_rate [MAX_MOVE_TYPE]
 
CharmInfom_charmInfo
 
SharedVisionList m_sharedVision
 
MotionMasteri_motionMaster
 
uint32 m_reactiveTimer [MAX_REACTIVE]
 
int32 m_regenTimer
 
ThreatMgr m_ThreatMgr
 
CharmThreatMap _charmThreatInfo
 
Vehiclem_vehicle
 
Vehiclem_vehicleKit
 
uint32 m_unitTypeMask
 
LiquidTypeEntry const * _lastLiquid
 
bool m_applyResilience
 
bool _instantCast
 
uint32 m_rootTimes
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
bool m_isFarVisible
 
Optional< float > m_visibilityDistanceOverride
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
uint32 _zoneId
 
uint32 _areaId
 
float _floorZ
 
bool _outdoors
 
LiquidData _liquidData
 
bool _updatePositionData
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint16 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
UpdateMask _changesMask
 
uint16 m_valuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Private Types

typedef GuidSet RefundableItemsSet
 

Private Member Functions

InventoryResult CanStoreItem_InSpecificSlot (uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32 &count, bool swap, Item *pSrcItem) const
 
InventoryResult CanStoreItem_InBag (uint8 bag, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32 &count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const
 
InventoryResult CanStoreItem_InInventorySlots (uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32 &count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const
 
Item_StoreItem (uint16 pos, Item *pItem, uint32 count, bool clone, bool update)
 
Item_LoadItem (CharacterDatabaseTransaction trans, uint32 zoneId, uint32 timeDiff, Field *fields)
 
void SendRefundInfo (Item *item)
 
void RefundItem (Item *item)
 
void AddKnownCurrency (uint32 itemId)
 
void AdjustQuestReqItemCount (Quest const *quest, QuestStatusData &questStatusData)
 
bool MustDelayTeleport () const
 
void SetMustDelayTeleport (bool setting)
 
bool HasDelayedTeleport () const
 
void SetHasDelayedTeleport (bool setting)
 
void UpdateCharmedAI ()
 

Private Attributes

CinematicMgr_cinematicMgr
 
RefundableItemsSet m_refundableItems
 
MapReference m_mapRef
 
uint32 m_lastFallTime
 
float m_lastFallZ
 
int32 m_MirrorTimer [MAX_TIMERS]
 
uint8 m_MirrorTimerFlags
 
uint8 m_MirrorTimerFlagsLast
 
bool m_isInWater
 
WorldLocation teleportStore_dest
 
uint32 teleportStore_options
 
time_t mSemaphoreTeleport_Near
 
time_t mSemaphoreTeleport_Far
 
uint32 m_DelayedOperations
 
bool m_bMustDelayTeleport
 
bool m_bHasDelayedTeleport
 
bool m_canTeleport
 
bool m_canKnockback
 
std::unique_ptr< PetStablem_petStable
 
uint32 m_temporaryUnsummonedPetNumber
 
uint32 m_oldpetspell
 
AchievementMgrm_achievementMgr
 
ReputationMgrm_reputationMgr
 
SpellCooldowns m_spellCooldowns
 
uint32 m_ChampioningFaction
 
InstanceTimeMap _instanceResetTimes
 
uint32 _pendingBindId
 
uint32 _pendingBindTimer
 
uint32 _activeCheats
 
uint32 healthBeforeDuel
 
uint32 manaBeforeDuel
 
bool m_isInstantFlightOn
 
uint32 m_flightSpellActivated
 
WorldLocation _corpseLocation
 
Optional< float > _farSightDistance = { }
 
bool _wasOutdoor
 
PlayerSettingMap m_charSettingsMap
 
Seconds m_creationTime
 

Friends

class WorldSession
 
class CinematicMgr
 
void Item::AddToUpdateQueueOf (Player *player)
 
void Item::RemoveFromUpdateQueueOf (Player *player)
 

Detailed Description

Member Typedef Documentation

◆ DFQuestsDoneList

typedef std::set<uint32> Player::DFQuestsDoneList

◆ ItemMap

typedef std::unordered_map<ObjectGuid::LowType, Item*> Player::ItemMap

◆ JoinedChannelsList

typedef std::list<Channel*> Player::JoinedChannelsList
protected

◆ QuestSet

typedef std::set<uint32> Player::QuestSet
protected

◆ RefundableItemsSet

◆ SeasonalEventQuestMap

typedef std::unordered_map<uint32, SeasonalQuestSet> Player::SeasonalEventQuestMap
protected

◆ SeasonalQuestSet

typedef std::set<uint32> Player::SeasonalQuestSet
protected

Constructor & Destructor Documentation

◆ Player()

Player::Player ( WorldSession session)
explicit
149 : Unit(true), m_mover(this)
150{
151#ifdef _MSC_VER
152#pragma warning(default:4355)
153#endif
154
157
159
160 m_session = session;
161
162 m_ingametime = 0;
163
164 m_ExtraFlags = 0;
165
166 m_spellModTakingSpell = nullptr;
167 //m_pad = 0;
168
169 // players always accept
171 SetAcceptWhispers(true);
172
176
177 m_regenTimer = 0;
181
184
185 m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
186
187 m_areaUpdateId = 0;
189
190 m_needZoneUpdate = false;
191
195
197
198 memset(m_items, 0, sizeof(Item*)*PLAYER_SLOTS_COUNT);
199
200 m_social = nullptr;
201
202 // group is initialized in the reference constructor
203 SetGroupInvite(nullptr);
206 m_bPassOnGroupLoot = false;
207
210
212
215
217 m_bMustDelayTeleport = false;
218 m_bHasDelayedTeleport = false;
220 m_canTeleport = false;
221 m_canKnockback = false;
222
223 m_trade = nullptr;
224
225 m_cinematic = 0;
226
229
230 m_DailyQuestChanged = false;
232
233 for (uint8 i = 0; i < MAX_TIMERS; i++)
235
238 m_isInWater = false;
239 m_drunkTimer = 0;
240 m_deathTimer = 0;
242
244
245 m_swingErrorMsg = 0;
246
247 for (uint8 j = 0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; ++j)
248 {
250 _BgBattlegroundQueueID[j].invitedToInstance = 0;
251 }
252
259 m_canParry = false;
260 m_canBlock = false;
261 m_canTitanGrip = false;
262 m_ammoDPS = 0.0f;
263
265 //cache for UNIT_CREATED_BY_SPELL to allow
266 //returning reagents for temporarily removed pets
267 //when dying/logging out
268 m_oldpetspell = 0;
269 m_lastpetnumber = 0;
270
272 _restTime = 0;
273 _innTriggerId = 0;
274 _restBonus = 0;
275 _restFlagMask = 0;
277
278 m_mailsUpdated = false;
279 unReadMails = 0;
280 m_nextMailDelivereTime = time_t(0);
281
285
286 for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
288
290
291 m_HomebindTimer = 0;
292 m_InstanceValid = true;
296
297 m_lastPotionId = 0;
298
299 m_activeSpec = 0;
300 m_specsCount = 1;
301
302 for (uint8 i = 0; i < MAX_TALENT_SPECS; ++i)
303 {
304 for (uint8 g = 0; g < MAX_GLYPH_SLOT_INDEX; ++g)
305 m_Glyphs[i][g] = 0;
306 }
307
308 for (uint8 i = 0; i < BASEMOD_END; ++i)
309 {
310 m_auraBaseMod[i][FLAT_MOD] = 0.0f;
311 m_auraBaseMod[i][PCT_MOD] = 1.0f;
312 }
313
314 for (uint8 i = 0; i < MAX_COMBAT_RATING; i++)
315 m_baseRatingValue[i] = 0;
316
318 m_baseFeralAP = 0;
319 m_baseManaRegen = 0;
322
323 // Honor System
325
326 m_IsBGRandomWinner = false;
327
328 // Player summoning
329 m_summon_expire = 0;
330 m_summon_mapid = 0;
331 m_summon_x = 0.0f;
332 m_summon_y = 0.0f;
333 m_summon_z = 0.0f;
334 m_summon_asSpectator = false;
335
336 //m_mover = this;
338 m_seer = this;
339
340 m_recallMap = 0;
341 m_recallX = 0;
342 m_recallY = 0;
343 m_recallZ = 0;
344 m_recallO = 0;
345
346 m_homebindMapId = 0;
348 m_homebindX = 0;
349 m_homebindY = 0;
350 m_homebindZ = 0;
351 m_homebindO = 0;
352
354
355 m_declinedname = nullptr;
356
357 m_isActive = true;
358
359 m_runes = nullptr;
360
361 m_lastFallTime = 0;
362 m_lastFallZ = 0;
363
365
367
368 sWorld->IncreasePlayerCount();
369
371
372 for (uint8 i = 0; i < MAX_POWERS; ++i)
373 m_powerFraction[i] = 0;
374
375 isDebugAreaTriggers = false;
376
377 m_WeeklyQuestChanged = false;
378
379 m_MonthlyQuestChanged = false;
380
382
383 SetPendingBind(0, 0);
384
386
387 m_creationTime = 0s;
388
389 _cinematicMgr = new CinematicMgr(this);
390
392 m_reputationMgr = new ReputationMgr(this);
393
394 // Ours
395 m_NeedToSaveGlyphs = false;
396 m_MountBlockId = 0;
397 m_realDodge = 0.0f;
398 m_realParry = 0.0f;
401
403
404 for( int i = 0; i < NUM_CAI_SPELLS; ++i )
405 m_charmAISpells[i] = 0;
406
407 m_applyResilience = true;
408
409 m_isInstantFlightOn = true;
410
411 _wasOutdoor = true;
412 sScriptMgr->OnConstructPlayer(this);
413}
std::uint8_t uint8
Definition: Define.h:110
std::uint32_t uint32
Definition: Define.h:108
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
@ TYPEMASK_PLAYER
Definition: ObjectGuid.h:52
@ PLAYER_END
Definition: UpdateFields.h:392
@ NUM_CAI_SPELLS
Definition: Player.h:917
@ CHEAT_NONE
Definition: Player.h:990
@ BUYBACK_SLOT_START
Definition: Player.h:725
#define MAX_TIMERS
Definition: Player.h:579
#define DISABLED_MIRROR_TIMER
Definition: Player.h:580
@ PLAYED_TIME_TOTAL
Definition: Player.h:848
@ PLAYED_TIME_LEVEL
Definition: Player.h:849
@ UNDERWATER_NONE
Definition: Player.h:101
@ AT_LOGIN_NONE
Definition: Player.h:600
@ PLAYER_SLOTS_COUNT
Definition: Player.h:668
@ FLAT_MOD
Definition: Unit.h:308
@ PCT_MOD
Definition: Unit.h:309
#define MAX_MOVE_TYPE
Definition: Unit.h:389
#define MAX_COMBAT_RATING
Definition: Unit.h:431
@ BASEMOD_END
Definition: Unit.h:303
#define sScriptMgr
Definition: ScriptMgr.h:698
@ CONFIG_INTERVAL_SAVE
Definition: IWorld.h:214
@ RAID_DIFFICULTY_10MAN_NORMAL
Definition: DBCEnums.h:281
@ DUNGEON_DIFFICULTY_NORMAL
Definition: DBCEnums.h:277
@ MAX_POWERS
Definition: SharedDefines.h:276
#define MAX_TALENT_SPECS
Definition: SharedDefines.h:675
#define MAX_GLYPH_SLOT_INDEX
Definition: SharedDefines.h:676
@ BATTLEGROUND_QUEUE_NONE
Definition: SharedDefines.h:3620
@ TEAM_NEUTRAL
Definition: SharedDefines.h:762
#define PLAYER_MAX_BATTLEGROUND_QUEUES
Definition: SharedDefines.h:176
#define sWorld
Definition: World.h:447
bool IsPlayerAccount(uint32 gmlevel)
Definition: AccountMgr.cpp:276
uint32 GetSecurity(uint32 accountId)
Definition: AccountMgr.cpp:209
Seconds GetGameTime()
Definition: GameTime.cpp:38
Definition: AchievementMgr.h:280
Definition: GossipDef.h:258
Definition: Item.h:214
uint16 m_objectType
Definition: Object.h:228
uint16 m_valuesCount
Definition: Object.h:242
TypeID m_objectTypeId
Definition: Object.h:230
bool m_isActive
Definition: Object.h:625
bool m_canParry
Definition: Player.h:2822
time_t m_summon_expire
Definition: Player.h:2855
bool m_needZoneUpdate
Definition: Player.h:2872
uint16 m_additionalSaveTimer
Definition: Player.h:2729
float m_ammoDPS
Definition: Player.h:2826
uint32 m_temporaryUnsummonedPetNumber
Definition: Player.h:2926
uint32 m_ChampioningFaction
Definition: Player.h:2934
bool m_bHasDelayedTeleport
Definition: Player.h:2919
bool m_InstanceValid
Definition: Player.h:2399
time_t m_deathExpireTime
Definition: Player.h:2818
ReputationMgr * m_reputationMgr
Definition: Player.h:2930
float m_auraBaseMod[BASEMOD_END][MOD_END]
Definition: Player.h:2773
float m_homebindZ
Definition: Player.h:2335
uint32 m_lastFallTime
Definition: Player.h:2903
uint32 m_lastPotionId
Definition: Player.h:2762
CinematicMgr * _cinematicMgr
Definition: Player.h:2882
bool m_canTeleport
Definition: Player.h:2920
uint32 m_usedTalentCount
Definition: Player.h:2836
friend class CinematicMgr
Definition: Player.h:1058
bool m_MonthlyQuestChanged
Definition: Player.h:2806
PlayerSocial * m_social
Definition: Player.h:2841
uint32 m_homebindMapId
Definition: Player.h:2331
Seconds m_creationTime
Definition: Player.h:2958
void SetAcceptWhispers(bool on)
Definition: Player.h:1147
float m_summon_z
Definition: Player.h:2859
time_t m_lastHonorUpdateTime
Definition: Player.h:2722
time_t _restTime
Definition: Player.h:2829
SafeUnitPointer m_mover
Definition: Player.h:2295
uint8 m_forced_speed_changes[MAX_MOVE_TYPE]
Definition: Player.h:2363
uint32 _activeCheats
Definition: Player.h:2940
uint32 m_resetTalentsCost
Definition: Player.h:2834
uint8 m_MirrorTimerFlags
Definition: Player.h:2907
uint32 m_atLoginFlags
Definition: Player.h:2737
uint32 m_ExtraFlags
Definition: Player.h:2745
float m_recallX
Definition: Player.h:2322
uint32 m_ingametime
Definition: Player.h:2652
float m_recallO
Definition: Player.h:2325
bool m_WeeklyQuestChanged
Definition: Player.h:2805
uint8 unReadMails
Definition: Player.h:1632
uint32 m_pendingSpectatorInviteInstanceId
Definition: Player.h:2551
void SetGroupInvite(Group *group)
Definition: Player.h:2430
uint32 m_DelayedOperations
Definition: Player.h:2917
TradeData * m_trade
Definition: Player.h:2802
float m_realParry
Definition: Player.h:2608
uint32 m_nextSave
Definition: Player.h:2728
uint32 m_zoneUpdateTimer
Definition: Player.h:2814
bool m_mailsUpdated
Definition: Player.h:1568
time_t mSemaphoreTeleport_Far
Definition: Player.h:2915
float _restBonus
Definition: Player.h:2831
uint32 m_foodEmoteTimerCount
Definition: Player.h:2614
uint32 m_baseFeralAP
Definition: Player.h:2776
float m_summon_y
Definition: Player.h:2858
WorldObject * m_seer
Definition: Player.h:2296
float m_summon_x
Definition: Player.h:2857
uint32 m_charmAISpells[NUM_CAI_SPELLS]
Definition: Player.h:2610
uint8 m_additionalSaveMask
Definition: Player.h:2730
bool m_bMustDelayTeleport
Definition: Player.h:2918
bool m_SeasonalQuestChanged
Definition: Player.h:2807
TeamId m_team
Definition: Player.h:2727
uint32 m_areaUpdateId
Definition: Player.h:2815
uint8 m_specsCount
Definition: Player.h:2767
uint32 m_extraBonusTalentCount
Definition: Player.h:2838
WorldSession * GetSession() const
Definition: Player.h:1961
float m_powerFraction[MAX_POWERS]
Definition: Player.h:2615
uint32 m_oldpetspell
Definition: Player.h:2927
Runes * m_runes
Definition: Player.h:2863
uint32 m_currentBuybackSlot
Definition: Player.h:2740
uint32 m_deathTimer
Definition: Player.h:2817
uint32 m_regenTimerCount
Definition: Player.h:2613
AchievementMgr * m_achievementMgr
Definition: Player.h:2929
uint8 m_swingErrorMsg
Definition: Player.h:2825
time_t m_nextMailDelivereTime
Definition: Player.h:1633
std::array< BgBattlegroundQueueID_Rec, PLAYER_MAX_BATTLEGROUND_QUEUES > _BgBattlegroundQueueID
Definition: Player.h:2628
void clearResurrectRequestData()
Definition: Player.h:1789
bool m_bPassOnGroupLoot
Definition: Player.h:2849
float m_recallZ
Definition: Player.h:2324
uint32 m_pendingSpectatorForBG
Definition: Player.h:2550
bool m_DailyQuestChanged
Definition: Player.h:2804
uint32 m_Glyphs[MAX_TALENT_SPECS][MAX_GLYPH_SLOT_INDEX]
Definition: Player.h:2769
Difficulty m_dungeonDifficulty
Definition: Player.h:2733
uint32 m_weaponChangeTimer
Definition: Player.h:2811
uint32 m_WeaponProficiency
Definition: Player.h:2820
float m_realDodge
Definition: Player.h:2607
bool m_canKnockback
Definition: Player.h:2921
bool m_isInstantFlightOn
Definition: Player.h:2946
time_t mSemaphoreTeleport_Near
Definition: Player.h:2914
DeclinedName * m_declinedname
Definition: Player.h:2862
bool m_IsBGRandomWinner
Definition: Player.h:2630
uint32 m_drunkTimer
Definition: Player.h:2810
uint32 m_contestedPvPTimer
Definition: Player.h:2616
float m_homebindY
Definition: Player.h:2334
float m_homebindO
Definition: Player.h:2336
uint32 m_Played_time[MAX_PLAYED_TIME_INDEX]
Definition: Player.h:1173
uint32 m_baseSpellPower
Definition: Player.h:2775
bool _wasOutdoor
Definition: Player.h:2954
void SetPendingBind(uint32 instanceId, uint32 bindTimer)
Definition: Player.h:2401
uint32 _restFlagMask
Definition: Player.h:2832
uint8 m_grantableLevels
Definition: Player.h:2870
Item * m_items[PLAYER_SLOTS_COUNT]
Definition: Player.h:2739
uint16 m_homebindAreaId
Definition: Player.h:2332
Difficulty m_raidMapDifficulty
Definition: Player.h:2735
uint32 m_zoneUpdateId
Definition: Player.h:2813
bool m_isInWater
Definition: Player.h:2909
uint8 m_MirrorTimerFlagsLast
Definition: Player.h:2908
time_t m_lastDailyQuestTime
Definition: Player.h:2808
time_t m_resetTalentsTime
Definition: Player.h:2835
uint32 m_baseHealthRegen
Definition: Player.h:2778
uint32 m_charmUpdateTimer
Definition: Player.h:2562
uint32 m_summon_mapid
Definition: Player.h:2856
Difficulty m_raidDifficulty
Definition: Player.h:2734
float m_lastFallZ
Definition: Player.h:2904
bool m_summon_asSpectator
Definition: Player.h:2860
uint32 m_baseManaRegen
Definition: Player.h:2777
time_t m_logintime
Definition: Player.h:1171
int32 m_MirrorTimer[MAX_TIMERS]
Definition: Player.h:2906
uint32 _innTriggerId
Definition: Player.h:2830
uint32 m_ArenaTeamIdInvited
Definition: Player.h:2757
uint32 m_recallMap
Definition: Player.h:2321
float m_recallY
Definition: Player.h:2323
uint32 m_questRewardTalentCount
Definition: Player.h:2837
bool m_NeedToSaveGlyphs
Definition: Player.h:2603
uint32 m_HomebindTimer
Definition: Player.h:2398
uint64 m_auraRaidUpdateMask
Definition: Player.h:2848
bool m_canTitanGrip
Definition: Player.h:2824
bool m_canBlock
Definition: Player.h:2823
uint8 m_cinematic
Definition: Player.h:2800
int32 m_spellPenetrationItemMod
Definition: Player.h:2779
uint8 m_activeSpec
Definition: Player.h:2766
WorldSession * m_session
Definition: Player.h:2795
uint32 m_flightSpellActivated
Definition: Player.h:2948
uint32 teleportStore_options
Definition: Player.h:2913
int32 m_baseRatingValue[MAX_COMBAT_RATING]
Definition: Player.h:2774
uint32 m_ArmorProficiency
Definition: Player.h:2821
bool isDebugAreaTriggers
Definition: Player.h:2519
uint32 m_groupUpdateMask
Definition: Player.h:2847
Spell * m_spellModTakingSpell
Definition: Player.h:2515
uint32 m_lastpetnumber
Definition: Player.h:2852
time_t m_Last_tick
Definition: Player.h:1172
PlayerMenu * PlayerTalkClass
Definition: Player.h:2201
uint32 m_GuildIdInvited
Definition: Player.h:2756
float m_homebindX
Definition: Player.h:2333
uint16 m_hostileReferenceCheckTimer
Definition: Player.h:2731
bool m_itemUpdateQueueBlocked
Definition: Player.h:2743
uint32 m_MountBlockId
Definition: Player.h:2605
void Initialize(Unit *defVal)
Definition: Unit.h:1289
Definition: Unit.h:1302
int32 m_regenTimer
Definition: Unit.h:2542
bool m_ControlledByPlayer
Definition: Unit.h:2376
SafeUnitPointer m_movedByPlayer
Definition: Unit.h:1902
bool m_applyResilience
Definition: Unit.h:2555
Definition: ReputationMgr.h:58

References _activeCheats, _BgBattlegroundQueueID, _cinematicMgr, _innTriggerId, _restBonus, _restFlagMask, _restTime, _wasOutdoor, AT_LOGIN_NONE, BASEMOD_END, BATTLEGROUND_QUEUE_NONE, BUYBACK_SLOT_START, CHEAT_NONE, CinematicMgr, clearResurrectRequestData(), CONFIG_INTERVAL_SAVE, DISABLED_MIRROR_TIMER, DUNGEON_DIFFICULTY_NORMAL, FLAT_MOD, GameTime::GetGameTime(), GetSession(), SafeUnitPointer::Initialize(), isDebugAreaTriggers, AccountMgr::IsPlayerAccount(), m_achievementMgr, m_activeSpec, m_additionalSaveMask, m_additionalSaveTimer, m_ammoDPS, Unit::m_applyResilience, m_areaUpdateId, m_ArenaTeamIdInvited, m_ArmorProficiency, m_atLoginFlags, m_auraBaseMod, m_auraRaidUpdateMask, m_baseFeralAP, m_baseHealthRegen, m_baseManaRegen, m_baseRatingValue, m_baseSpellPower, m_bHasDelayedTeleport, m_bMustDelayTeleport, m_bPassOnGroupLoot, m_canBlock, m_canKnockback, m_canParry, m_canTeleport, m_canTitanGrip, m_ChampioningFaction, m_charmAISpells, m_charmUpdateTimer, m_cinematic, m_contestedPvPTimer, Unit::m_ControlledByPlayer, m_creationTime, m_currentBuybackSlot, m_DailyQuestChanged, m_deathExpireTime, m_deathTimer, m_declinedname, m_DelayedOperations, m_drunkTimer, m_dungeonDifficulty, m_extraBonusTalentCount, m_ExtraFlags, m_flightSpellActivated, m_foodEmoteTimerCount, m_forced_speed_changes, m_Glyphs, m_grantableLevels, m_groupUpdateMask, m_GuildIdInvited, m_homebindAreaId, m_homebindMapId, m_homebindO, m_HomebindTimer, m_homebindX, m_homebindY, m_homebindZ, m_hostileReferenceCheckTimer, m_ingametime, m_InstanceValid, WorldObject::m_isActive, m_IsBGRandomWinner, m_isInstantFlightOn, m_isInWater, m_items, m_itemUpdateQueueBlocked, m_Last_tick, m_lastDailyQuestTime, m_lastFallTime, m_lastFallZ, m_lastHonorUpdateTime, m_lastpetnumber, m_lastPotionId, m_logintime, m_mailsUpdated, m_MirrorTimer, m_MirrorTimerFlags, m_MirrorTimerFlagsLast, m_MonthlyQuestChanged, m_MountBlockId, Unit::m_movedByPlayer, m_NeedToSaveGlyphs, m_needZoneUpdate, m_nextMailDelivereTime, m_nextSave, Object::m_objectType, Object::m_objectTypeId, m_oldpetspell, m_pendingSpectatorForBG, m_pendingSpectatorInviteInstanceId, m_Played_time, m_powerFraction, m_questRewardTalentCount, m_raidDifficulty, m_raidMapDifficulty, m_realDodge, m_realParry, m_recallMap, m_recallO, m_recallX, m_recallY, m_recallZ, Unit::m_regenTimer, m_regenTimerCount, m_reputationMgr, m_resetTalentsCost, m_resetTalentsTime, m_runes, m_SeasonalQuestChanged, m_seer, m_session, m_social, m_specsCount, m_spellModTakingSpell, m_spellPenetrationItemMod, m_summon_asSpectator, m_summon_expire, m_summon_mapid, m_summon_x, m_summon_y, m_summon_z, m_swingErrorMsg, m_team, m_temporaryUnsummonedPetNumber, m_trade, m_usedTalentCount, Object::m_valuesCount, m_weaponChangeTimer, m_WeaponProficiency, m_WeeklyQuestChanged, m_zoneUpdateId, m_zoneUpdateTimer, MAX_COMBAT_RATING, MAX_GLYPH_SLOT_INDEX, MAX_MOVE_TYPE, MAX_POWERS, MAX_TALENT_SPECS, MAX_TIMERS, mSemaphoreTeleport_Far, mSemaphoreTeleport_Near, NUM_CAI_SPELLS, PCT_MOD, PLAYED_TIME_LEVEL, PLAYED_TIME_TOTAL, PLAYER_END, PLAYER_MAX_BATTLEGROUND_QUEUES, PLAYER_SLOTS_COUNT, PlayerTalkClass, RAID_DIFFICULTY_10MAN_NORMAL, SetAcceptWhispers(), SetGroupInvite(), SetPendingBind(), sScriptMgr, sWorld, TEAM_NEUTRAL, teleportStore_options, TYPEID_PLAYER, TYPEMASK_PLAYER, UNDERWATER_NONE, and unReadMails.

◆ ~Player()

Player::~Player ( )
override
416{
417 sScriptMgr->OnDestructPlayer(this);
418
419 // it must be unloaded already in PlayerLogout and accessed only for loggined player
420 //m_social = nullptr;
421
422 // Note: buy back item already deleted from DB when player was saved
423 for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; ++i)
424 delete m_items[i];
425
426 for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
427 delete itr->second;
428
429 for (PlayerTalentMap::const_iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr)
430 delete itr->second;
431
432 //all mailed items should be deleted, also all mail should be deallocated
433 for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
434 {
435 delete *itr;
436 }
437
438 for (ItemMap::iterator iter = mMitems.begin(); iter != mMitems.end(); ++iter)
439 delete iter->second; //if item is duplicated... then server may crash ... but that item should be deallocated
440
441 delete PlayerTalkClass;
442
443 for (size_t x = 0; x < ItemSetEff.size(); x++)
444 delete ItemSetEff[x];
445
446 delete m_declinedname;
447 delete m_runes;
448 delete m_achievementMgr;
449 delete m_reputationMgr;
450
451 sWorld->DecreasePlayerCount();
452
453 if (!m_isInSharedVisionOf.empty())
454 {
455 do
456 {
457 Unit* u = *(m_isInSharedVisionOf.begin());
458 u->RemovePlayerFromVision(this);
459 } while (!m_isInSharedVisionOf.empty());
460 }
461}
ItemMap mMitems
Definition: Player.h:1637
PlayerSpellMap m_spells
Definition: Player.h:2760
std::vector< ItemSetEffect * > ItemSetEff
Definition: Player.h:2202
PlayerMails m_mail
Definition: Player.h:2759
PlayerTalentMap m_talents
Definition: Player.h:2761
std::set< Unit * > m_isInSharedVisionOf
Definition: Player.h:2297
void RemovePlayerFromVision(Player *player)
Definition: Unit.cpp:11175

References ItemSetEff, m_achievementMgr, m_declinedname, m_isInSharedVisionOf, m_items, m_mail, m_reputationMgr, m_runes, m_spells, m_talents, mMitems, PLAYER_SLOTS_COUNT, PlayerTalkClass, Unit::RemovePlayerFromVision(), sScriptMgr, and sWorld.

Member Function Documentation

◆ _addSpell()

bool Player::_addSpell ( uint32  spellId,
uint8  addSpecMask,
bool  temporary,
bool  learnFromSkill = false 
)
Todo:
confirm if rogues start wth lockpicking skill at level 1 but only recieve the spell to use it at level 16
3056{
3057 // pussywizard: this can be called to OVERWRITE currently existing spell params! usually to set active = false for lower ranks of a spell
3058
3059 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
3060 if (!SpellMgr::CheckSpellValid(spellInfo, spellId, false))
3061 return false;
3062
3063 // pussywizard: already found and temporary, nothing to do
3064 PlayerSpellMap::iterator itr = m_spells.find(spellId);
3065 if (itr != m_spells.end() && itr->second->State == PLAYERSPELL_TEMPORARY)
3066 return false;
3067
3068 // xinef: send packet so client can properly recognize this new spell
3069 // xinef: ignore passive spells and spells with learn effect
3070 // xinef: send spells with no aura effects (ie dual wield)
3071 if (IsInWorld() && !isBeingLoaded() && temporary && !learnFromSkill && (!spellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE | SPELL_ATTR0_DO_NOT_DISPLAY)) || !spellInfo->HasAnyAura()) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
3072 SendLearnPacket(spellInfo->Id, true);
3073
3074 // xinef: DO NOT allow to learn spell with effect learn spell!
3075 // xinef: if spell possess spell learn effects only, learn those spells as temporary (eg. Metamorphosis, Tree of Life)
3076 if (temporary && spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
3077 {
3078 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3079 if (spellInfo->Effects[i].IsEffect())
3080 {
3081 if (spellInfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL)
3082 {
3083 LOG_INFO("entities.player", "TRYING TO LEARN SPELL WITH EFFECT LEARN: {}, PLAYER: {}", spellId, GetGUID().ToString());
3084 return false;
3085 //ABORT();
3086 }
3087 else if (SpellInfo const* learnSpell = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell))
3089 }
3090
3091 return false;
3092 }
3093
3094 if (itr != m_spells.end()) // pussywizard: already know this spell, so update information
3095 {
3096 // pussywizard: do nothing if already set as wanted
3097 if (itr->second->State != PLAYERSPELL_REMOVED && (itr->second->specMask & addSpecMask) == addSpecMask)
3098 return false;
3099
3100 // pussywizard: need cast auras, learn linked spells, do professions stuff, etc.
3101 // pussywizard: but only for spells that are really added (inactive -> active OR added to current spec)
3102 bool spellIsNew = true;
3103
3104 // pussywizard: present in m_spells, not removed, already in current spec, already active
3105 if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(m_activeSpec))
3106 spellIsNew = false;
3107
3108 // pussywizard: update info in m_spells
3109 if (itr->second->State != PLAYERSPELL_NEW && (itr->second->specMask & addSpecMask) != addSpecMask)
3110 itr->second->State = PLAYERSPELL_CHANGED;
3111 itr->second->Active = true;
3112 itr->second->specMask |= addSpecMask;
3113
3114 if (!spellIsNew)
3115 return true;
3116 }
3117 else // pussywizard: not found in m_spells
3118 {
3119 PlayerSpell* newspell = new PlayerSpell;
3120 newspell->Active = true;
3122 newspell->specMask = addSpecMask;
3123
3124 m_spells[spellId] = newspell;
3125 }
3126
3127 // pussywizard: return if spell not in current spec
3128 // pussywizard: return true to fix active for ranks, this condition is true only at loading, so no problems with learning packets
3129 if (!((1 << GetActiveSpec()) & addSpecMask))
3130 return true;
3131
3132 // xinef: do not add spells with effect learn spell
3133 if (spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
3134 {
3135 LOG_INFO("entities.player", "TRYING TO LEARN SPELL WITH EFFECT LEARN 2: {}, PLAYER: {}", spellId, GetGUID().ToString());
3136 m_spells.erase(spellInfo->Id); // mem leak, but should never happen
3137 return false;
3138 //ABORT();
3139 }
3140 // pussywizard: cast passive spells (including all talents without SPELL_EFFECT_LEARN_SPELL) with additional checks
3141 else if (spellInfo->IsPassive() || (spellInfo->HasAttribute(SPELL_ATTR0_DO_NOT_DISPLAY) && spellInfo->Stances))
3142 {
3143 if (IsNeedCastPassiveSpellAtLearn(spellInfo))
3144 CastSpell(this, spellId, true);
3145 }
3146 // pussywizard: cast and return, learnt spells will update profession count, etc.
3147 else if (spellInfo->HasEffect(SPELL_EFFECT_SKILL_STEP))
3148 {
3149 CastSpell(this, spellId, true);
3150 return false;
3151 }
3152
3153 // xinef: unapply aura stats if dont meet requirements
3154 // xinef: handle only if player is not loaded, loading is handled in loadfromdb
3155 if (!isBeingLoaded())
3156 if (Aura* aura = GetAura(spellId))
3157 {
3158 if (aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTHLESS_35_PERCENT ||
3159 aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTH_ABOVE_75_PERCENT ||
3160 aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTHLESS_20_PERCENT )
3161 if (!HasAuraState((AuraStateType)aura->GetSpellInfo()->CasterAuraState))
3162 aura->HandleAllEffects(aura->GetApplicationOfTarget(GetGUID()), AURA_EFFECT_HANDLE_REAL, false);
3163 }
3164
3165 // pussywizard: update free primary prof points
3166 if (uint32 freeProfs = GetFreePrimaryProfessionPoints())
3167 {
3168 if (spellInfo->IsPrimaryProfessionFirstRank())
3169 SetFreePrimaryProfessions(freeProfs - 1);
3170 }
3171
3172 uint16 maxskill = GetMaxSkillValueForLevel();
3173 SpellLearnSkillNode const* spellLearnSkill = sSpellMgr->GetSpellLearnSkill(spellId);
3174 SkillLineAbilityMapBounds skill_bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId);
3175 // xinef: set appropriate skill value
3176 if (spellLearnSkill)
3177 {
3178 uint32 skill_value = GetPureSkillValue(spellLearnSkill->skill);
3179 uint32 skill_max_value = GetPureMaxSkillValue(spellLearnSkill->skill);
3180 uint32 new_skill_max_value = spellLearnSkill->maxvalue == 0 ? maxskill : spellLearnSkill->maxvalue;
3181
3182 if (skill_value < spellLearnSkill->value)
3183 skill_value = spellLearnSkill->value;
3184 if (skill_max_value < new_skill_max_value)
3185 skill_max_value = new_skill_max_value;
3186
3187 SetSkill(spellLearnSkill->skill, spellLearnSkill->step, skill_value, skill_max_value);
3188 }
3189 else
3190 {
3191 // not ranked skills
3192 for (SkillLineAbilityMap::const_iterator _spell_idx = skill_bounds.first; _spell_idx != skill_bounds.second; ++_spell_idx)
3193 {
3194 SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->SkillLine);
3195 if (!pSkill)
3196 {
3197 continue;
3198 }
3199
3201 // Added for runeforging, it is confirmed via sniff that this happens when death knights learn the spell, not on character creation.
3202 if ((_spell_idx->second->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN && !HasSkill(pSkill->id)) || ((pSkill->id == SKILL_LOCKPICKING || pSkill->id == SKILL_RUNEFORGING) && _spell_idx->second->TrivialSkillLineRankHigh == 0))
3203 {
3204 LearnDefaultSkill(pSkill->id, 0);
3205 }
3206
3207 if (pSkill->id == SKILL_MOUNTS && !Has310Flyer(false))
3208 {
3209 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3210 {
3211 if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED && spellInfo->Effects[i].CalcValue() == 310)
3212 {
3213 SetHas310Flyer(true);
3214 }
3215 }
3216 }
3217 }
3218 }
3219
3220 // xinef: update achievement criteria
3221 if (!GetSession()->PlayerLoading())
3222 {
3223 for (SkillLineAbilityMap::const_iterator _spell_idx = skill_bounds.first; _spell_idx != skill_bounds.second; ++_spell_idx)
3224 {
3227 }
3229 }
3230
3231 return true;
3232}
std::uint16_t uint16
Definition: Define.h:109
#define LOG_INFO(filterType__,...)
Definition: Log.h:165
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
#define SPEC_MASK_ALL
Definition: Player.h:178
@ PLAYERSPELL_REMOVED
Definition: Player.h:123
@ PLAYERSPELL_UNCHANGED
Definition: Player.h:120
@ PLAYERSPELL_CHANGED
Definition: Player.h:121
@ PLAYERSPELL_NEW
Definition: Player.h:122
@ PLAYERSPELL_TEMPORARY
Definition: Player.h:124
@ SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
Definition: SpellAuraDefines.h:270
@ AURA_EFFECT_HANDLE_REAL
Definition: SpellAuraDefines.h:42
#define sSpellMgr
Definition: SpellMgr.h:825
std::pair< SkillLineAbilityMap::const_iterator, SkillLineAbilityMap::const_iterator > SkillLineAbilityMapBounds
Definition: SpellMgr.h:584
@ SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN
Definition: DBCEnums.h:369
@ ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL
Definition: DBCEnums.h:156
@ ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS
Definition: DBCEnums.h:193
@ ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE
Definition: DBCEnums.h:226
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1635
@ SPELL_EFFECT_LEARN_SPELL
Definition: SharedDefines.h:814
@ SPELL_EFFECT_SKILL_STEP
Definition: SharedDefines.h:822
SpellAttr0
Definition: SharedDefines.h:381
@ SPELL_ATTR0_PASSIVE
Definition: SharedDefines.h:388
@ SPELL_ATTR0_DO_NOT_DISPLAY
Definition: SharedDefines.h:389
AuraStateType
Definition: SharedDefines.h:1288
@ AURA_STATE_HEALTHLESS_35_PERCENT
Definition: SharedDefines.h:1305
@ AURA_STATE_HEALTH_ABOVE_75_PERCENT
Definition: SharedDefines.h:1315
@ AURA_STATE_HEALTHLESS_20_PERCENT
Definition: SharedDefines.h:1293
@ SKILL_RUNEFORGING
Definition: SharedDefines.h:3004
@ SKILL_LOCKPICKING
Definition: SharedDefines.h:2975
@ SKILL_MOUNTS
Definition: SharedDefines.h:3005
bool IsInWorld() const
Definition: Object.h:101
ObjectGuid GetGUID() const
Definition: Object.h:107
std::string ToString() const
Definition: Position.cpp:51
Definition: Player.h:128
PlayerSpellState State
Definition: Player.h:129
bool Active
Definition: Player.h:130
uint8 specMask
Definition: Player.h:131
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition: PlayerUpdates.cpp:2131
bool _addSpell(uint32 spellId, uint8 addSpecMask, bool temporary, bool learnFromSkill=false)
Definition: Player.cpp:3055
void learnSpell(uint32 spellId, bool temporary=false, bool learnFromSkill=false)
Definition: Player.cpp:3243
void LearnDefaultSkill(uint32 skillId, uint16 rank)
Definition: Player.cpp:11792
bool isBeingLoaded() const override
Definition: PlayerStorage.cpp:4934
void SendLearnPacket(uint32 spellId, bool learn)
Definition: Player.cpp:2991
uint16 GetMaxSkillValueForLevel() const
Definition: Player.cpp:16156
bool IsNeedCastPassiveSpellAtLearn(SpellInfo const *spellInfo) const
Definition: Player.cpp:3234
uint16 GetPureSkillValue(uint32 skill) const
Definition: Player.cpp:5432
bool HasSkill(uint32 skill) const
Definition: Player.cpp:5346
uint16 GetPureMaxSkillValue(uint32 skill) const
Definition: Player.cpp:5402
void SetSkill(uint16 id, uint16 step, uint16 currVal, uint16 maxVal)
Definition: Player.cpp:5244
bool Has310Flyer(bool checkAllSpells, uint32 excludeSpellId=0)
Definition: Player.cpp:3437
uint8 GetActiveSpec() const
Definition: Player.h:1707
void SetHas310Flyer(bool on)
Definition: Player.h:1157
void SetFreePrimaryProfessions(uint16 profs)
Definition: Player.h:1736
uint32 GetFreePrimaryProfessionPoints() const
Definition: Player.h:1735
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5519
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
Definition: Unit.cpp:10546
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1169
Definition: SpellAuras.h:87
Definition: SpellInfo.h:314
uint32 Stances
Definition: SpellInfo.h:331
bool IsPassive() const
Definition: SpellInfo.cpp:1085
uint32 Id
Definition: SpellInfo.h:318
bool HasAnyAura() const
Definition: SpellInfo.cpp:888
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:412
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:391
bool IsPrimaryProfessionFirstRank() const
Definition: SpellInfo.cpp:970
bool HasEffect(SpellEffects effect) const
Definition: SpellInfo.cpp:872
Definition: SpellMgr.h:574
uint16 value
Definition: SpellMgr.h:577
uint16 step
Definition: SpellMgr.h:576
uint16 maxvalue
Definition: SpellMgr.h:578
uint16 skill
Definition: SpellMgr.h:575
static bool CheckSpellValid(SpellInfo const *spellInfo, uint32 spellId, bool isTalent)
Definition: SpellMgr.cpp:460
Definition: DBCStructure.h:1581
uint32 id
Definition: DBCStructure.h:1582

References _addSpell(), ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE, ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS, ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL, PlayerSpell::Active, AURA_EFFECT_HANDLE_REAL, AURA_STATE_HEALTH_ABOVE_75_PERCENT, AURA_STATE_HEALTHLESS_20_PERCENT, AURA_STATE_HEALTHLESS_35_PERCENT, Unit::CastSpell(), SpellMgr::CheckSpellValid(), SpellInfo::Effects, GetActiveSpec(), Unit::GetAura(), GetFreePrimaryProfessionPoints(), Object::GetGUID(), GetMaxSkillValueForLevel(), GetPureMaxSkillValue(), GetPureSkillValue(), GetSession(), Has310Flyer(), SpellInfo::HasAnyAura(), SpellInfo::HasAttribute(), Unit::HasAuraState(), SpellInfo::HasEffect(), HasSkill(), SpellInfo::Id, SkillLineEntry::id, isBeingLoaded(), Object::IsInWorld(), IsNeedCastPassiveSpellAtLearn(), SpellInfo::IsPassive(), SpellInfo::IsPrimaryProfessionFirstRank(), LearnDefaultSkill(), learnSpell(), LOG_INFO, m_activeSpec, m_spells, MAX_SPELL_EFFECTS, SpellLearnSkillNode::maxvalue, PLAYERSPELL_CHANGED, PLAYERSPELL_NEW, PLAYERSPELL_REMOVED, PLAYERSPELL_TEMPORARY, PLAYERSPELL_UNCHANGED, SendLearnPacket(), SetFreePrimaryProfessions(), SetHas310Flyer(), SetSkill(), SpellLearnSkillNode::skill, SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN, SKILL_LOCKPICKING, SKILL_MOUNTS, SKILL_RUNEFORGING, SPEC_MASK_ALL, PlayerSpell::specMask, SPELL_ATTR0_DO_NOT_DISPLAY, SPELL_ATTR0_PASSIVE, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_EFFECT_LEARN_SPELL, SPELL_EFFECT_SKILL_STEP, sSkillLineStore, sSpellMgr, SpellInfo::Stances, PlayerSpell::State, SpellLearnSkillNode::step, Position::ToString(), UpdateAchievementCriteria(), and SpellLearnSkillNode::value.

Referenced by _addSpell(), _addTalentAurasAndSpells(), addSpell(), AuraEffect::HandleAuraModShapeshift(), and AuraEffect::HandleAuraOverrideSpells().

◆ _AddSpellCooldown()

void Player::_AddSpellCooldown ( uint32  spell_id,
uint16  categoryId,
uint32  itemid,
uint32  end_time,
bool  needSendToClient = false,
bool  forceSendToSpectator = false 
)
10983{
10984 SpellCooldown sc;
10985 sc.end = GameTime::GetGameTimeMS().count() + end_time;
10986 sc.category = categoryId;
10987 sc.itemid = itemid;
10988 sc.maxduration = end_time;
10989 sc.sendToSpectator = false;
10990 sc.needSendToClient = needSendToClient;
10991
10993 {
10994 if (NeedSendSpectatorData() && forceSendToSpectator && (itemid || HasActiveSpell(spellid)))
10995 {
10996 sc.sendToSpectator = true;
10997 ArenaSpectator::SendCommand_Cooldown(FindMap(), GetGUID(), "ACD", spellid, end_time / IN_MILLISECONDS, end_time / IN_MILLISECONDS);
10998 }
10999 }
11000
11001 m_spellCooldowns[spellid] = std::move(sc);
11002}
constexpr auto IN_MILLISECONDS
Definition: Common.h:55
#define SPECTATOR_COOLDOWN_MAX
Definition: ArenaSpectator.h:37
#define SPECTATOR_COOLDOWN_MIN
Definition: ArenaSpectator.h:36
void SendCommand_Cooldown(T *o, ObjectGuid targetGUID, const char *prefix, uint32 id, uint32 dur, uint32 maxdur)
Definition: ArenaSpectator.h:89
Milliseconds GetGameTimeMS()
Definition: GameTime.cpp:43
Map * FindMap() const
Definition: Object.h:518
Definition: Player.h:200
uint32 itemid
Definition: Player.h:203
bool sendToSpectator
Definition: Player.h:205
bool needSendToClient
Definition: Player.h:206
uint32 end
Definition: Player.h:201
uint32 maxduration
Definition: Player.h:204
uint16 category
Definition: Player.h:202
bool NeedSendSpectatorData() const
Definition: Player.cpp:15319
bool HasActiveSpell(uint32 spell) const
Definition: Player.cpp:3843
SpellCooldowns m_spellCooldowns
Definition: Player.h:2932

References SpellCooldown::category, SpellCooldown::end, WorldObject::FindMap(), GameTime::GetGameTimeMS(), Object::GetGUID(), HasActiveSpell(), IN_MILLISECONDS, SpellCooldown::itemid, m_spellCooldowns, SpellCooldown::maxduration, NeedSendSpectatorData(), SpellCooldown::needSendToClient, ArenaSpectator::SendCommand_Cooldown(), SpellCooldown::sendToSpectator, SPECTATOR_COOLDOWN_MAX, and SPECTATOR_COOLDOWN_MIN.

Referenced by _LoadSpellCooldowns(), AddSpellAndCategoryCooldowns(), and AddSpellCooldown().

◆ _addTalentAurasAndSpells()

void Player::_addTalentAurasAndSpells ( uint32  spellId)
2975{
2976 // pussywizard: spells learnt from talents are added as TEMPORARY, so not saved to db (only the talent itself is saved)
2977 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
2978 if (spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
2979 {
2980 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2981 if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL && !sSpellMgr->IsAdditionalTalentSpell(spellInfo->Effects[i].TriggerSpell))
2982 _addSpell(spellInfo->Effects[i].TriggerSpell, SPEC_MASK_ALL, true);
2983 }
2984 else if (spellInfo->IsPassive() || (spellInfo->HasAttribute(SPELL_ATTR0_DO_NOT_DISPLAY) && spellInfo->Stances))
2985 {
2986 if (IsNeedCastPassiveSpellAtLearn(spellInfo))
2987 CastSpell(this, spellId, true);
2988 }
2989}

References _addSpell(), Unit::CastSpell(), SpellInfo::Effects, SpellInfo::HasAttribute(), SpellInfo::HasEffect(), IsNeedCastPassiveSpellAtLearn(), SpellInfo::IsPassive(), MAX_SPELL_EFFECTS, SPEC_MASK_ALL, SPELL_ATTR0_DO_NOT_DISPLAY, SPELL_EFFECT_LEARN_SPELL, sSpellMgr, and SpellInfo::Stances.

Referenced by ActivateSpec(), and addTalent().

◆ _ApplyAllItemMods()

void Player::_ApplyAllItemMods ( )
7476{
7477 LOG_DEBUG("entities.player.items", "_ApplyAllItemMods start.");
7478
7479 for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
7480 {
7481 if (m_items[i])
7482 {
7483 if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
7484 continue;
7485
7486 ItemTemplate const* proto = m_items[i]->GetTemplate();
7487 if (!proto)
7488 continue;
7489
7490 uint32 attacktype = Player::GetAttackBySlot(i);
7491 if (attacktype < MAX_ATTACK)
7493
7494 _ApplyItemBonuses(proto, i, true);
7495
7496 if (i == EQUIPMENT_SLOT_RANGED)
7498 }
7499 }
7500
7501 for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
7502 {
7503 if (m_items[i])
7504 {
7505 ItemTemplate const* proto = m_items[i]->GetTemplate();
7506 if (!proto)
7507 continue;
7508
7509 // item set bonuses not dependent from item broken state
7510 if (proto->ItemSet)
7511 AddItemsSetItem(this, m_items[i]);
7512
7513 if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
7514 continue;
7515
7516 ApplyItemEquipSpell(m_items[i], true);
7517 ApplyEnchantment(m_items[i], true);
7518 }
7519 }
7520
7521 LOG_DEBUG("entities.player.items", "_ApplyAllItemMods complete.");
7522}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:169
void AddItemsSetItem(Player *player, Item *item)
Definition: Item.cpp:33
@ INVENTORY_SLOT_BAG_END
Definition: Player.h:701
@ EQUIPMENT_SLOT_RANGED
Definition: Player.h:693
WeaponAttackType
Definition: Unit.h:395
@ MAX_ATTACK
Definition: Unit.h:399
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:545
Definition: ItemTemplate.h:628
uint32 ItemSet
Definition: ItemTemplate.h:684
void _ApplyAmmoBonuses()
Definition: Player.cpp:7542
void ApplyItemEquipSpell(Item *item, bool apply, bool form_change=false)
Definition: Player.cpp:7009
void ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool apply_dur=true, bool ignore_condition=false)
Definition: PlayerStorage.cpp:4326
void _ApplyItemBonuses(ItemTemplate const *proto, uint8 slot, bool apply, bool only_level_scale=false)
Definition: Player.cpp:6507
void _ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackType, bool apply)
Definition: Player.cpp:6905
static uint8 GetAttackBySlot(uint8 slot)
Definition: PlayerStorage.cpp:570
bool CanUseAttackType(uint8 attacktype) const
Definition: Unit.h:1621

References _ApplyAmmoBonuses(), _ApplyItemBonuses(), _ApplyWeaponDependentAuraMods(), AddItemsSetItem(), ApplyEnchantment(), ApplyItemEquipSpell(), Unit::CanUseAttackType(), EQUIPMENT_SLOT_RANGED, GetAttackBySlot(), Item::GetTemplate(), INVENTORY_SLOT_BAG_END, ItemTemplate::ItemSet, LOG_DEBUG, m_items, and MAX_ATTACK.

Referenced by _ApplyAllStatBonuses(), and _LoadInventory().

◆ _ApplyAllLevelScaleItemMods()

void Player::_ApplyAllLevelScaleItemMods ( bool  apply)
7525{
7526 for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
7527 {
7528 if (m_items[i])
7529 {
7530 if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
7531 continue;
7532
7533 ItemTemplate const* proto = m_items[i]->GetTemplate();
7534 if (!proto)
7535 continue;
7536
7537 _ApplyItemMods(m_items[i], i, apply);
7538 }
7539 }
7540}
void _ApplyItemMods(Item *item, uint8 slot, bool apply)
Definition: Player.cpp:6472

References _ApplyItemMods(), Unit::CanUseAttackType(), GetAttackBySlot(), Item::GetTemplate(), INVENTORY_SLOT_BAG_END, and m_items.

Referenced by GiveLevel(), and reset_commandscript::HandleResetLevelCommand().

◆ _ApplyAllStatBonuses()

void Player::_ApplyAllStatBonuses ( )
987{
988 SetCanModifyStats(false);
989
992
993 SetCanModifyStats(true);
994
996}
void _ApplyAllItemMods()
Definition: Player.cpp:7475
bool UpdateAllStats() override
Definition: StatSystem.cpp:188
void _ApplyAllAuraStatMods()
Definition: Unit.cpp:5426
void SetCanModifyStats(bool modifyStats)
Definition: Unit.h:2120

References Unit::_ApplyAllAuraStatMods(), _ApplyAllItemMods(), Unit::SetCanModifyStats(), and UpdateAllStats().

Referenced by InitStatsForLevel().

◆ _ApplyAmmoBonuses()

void Player::_ApplyAmmoBonuses ( )
7543{
7544 // check ammo
7546 if (!ammo_id)
7547 return;
7548
7549 float currentAmmoDPS;
7550
7551 ItemTemplate const* ammo_proto = sObjectMgr->GetItemTemplate(ammo_id);
7552 if (!ammo_proto || ammo_proto->Class != ITEM_CLASS_PROJECTILE || !CheckAmmoCompatibility(ammo_proto))
7553 currentAmmoDPS = 0.0f;
7554 else
7555 currentAmmoDPS = (ammo_proto->Damage[0].DamageMin + ammo_proto->Damage[0].DamageMax) / 2;
7556
7557 sScriptMgr->OnApplyAmmoBonuses(this, ammo_proto, currentAmmoDPS);
7558
7559 if (currentAmmoDPS == GetAmmoDPS())
7560 return;
7561
7562 m_ammoDPS = currentAmmoDPS;
7563
7564 if (CanModifyStats())
7566}
@ ITEM_CLASS_PROJECTILE
Definition: ItemTemplate.h:306
@ PLAYER_AMMO_ID
Definition: UpdateFields.h:369
@ RANGED_ATTACK
Definition: Unit.h:398
#define sObjectMgr
Definition: ObjectMgr.h:1640
float DamageMin
Definition: ItemTemplate.h:588
float DamageMax
Definition: ItemTemplate.h:589
_Damage Damage[MAX_ITEM_PROTO_DAMAGES]
Definition: ItemTemplate.h:660
uint32 Class
Definition: ItemTemplate.h:630
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305
bool CheckAmmoCompatibility(ItemTemplate const *ammo_proto) const
Definition: Player.cpp:7568
float GetAmmoDPS() const
Definition: Player.h:1308
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:60
bool CanModifyStats() const
Definition: Unit.h:2119

References Unit::CanModifyStats(), CheckAmmoCompatibility(), ItemTemplate::Class, ItemTemplate::Damage, _Damage::DamageMax, _Damage::DamageMin, GetAmmoDPS(), Object::GetUInt32Value(), ITEM_CLASS_PROJECTILE, m_ammoDPS, PLAYER_AMMO_ID, RANGED_ATTACK, sObjectMgr, sScriptMgr, and Unit::UpdateDamagePhysical().

Referenced by _ApplyAllItemMods(), _ApplyItemMods(), _RemoveAllItemMods(), and SetAmmo().

◆ _ApplyItemBonuses()

void Player::_ApplyItemBonuses ( ItemTemplate const *  proto,
uint8  slot,
bool  apply,
bool  only_level_scale = false 
)
Deprecated:
item mods
6508{
6509 if (slot >= INVENTORY_SLOT_BAG_END || !proto)
6510 return;
6511
6512 ScalingStatDistributionEntry const* ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : nullptr;
6513 if (only_level_scale && !ssd)
6514 return;
6515
6516 // req. check at equip, but allow use for extended range if range limit max level, set proper level
6517 uint32 ssd_level = GetLevel();
6518 uint32 CustomScalingStatValue = 0;
6519
6520 sScriptMgr->OnCustomScalingStatValueBefore(this, proto, slot, apply, CustomScalingStatValue);
6521
6522 uint32 ScalingStatValue = proto->ScalingStatValue > 0 ? proto->ScalingStatValue : CustomScalingStatValue;
6523
6524 if (ssd && ssd_level > ssd->MaxLevel)
6525 ssd_level = ssd->MaxLevel;
6526
6527 ScalingStatValuesEntry const* ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(ssd_level) : nullptr;
6528 if (only_level_scale && !ssv)
6529 return;
6530
6531 for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
6532 {
6533 uint32 statType = 0;
6534 int32 val = 0;
6535 // If set ScalingStatDistribution need get stats and values from it
6536 if (ssv)
6537 {
6538 if (ssd)
6539 {
6540 if (ssd->StatMod[i] < 0)
6541 continue;
6542
6543 statType = ssd->StatMod[i];
6544 val = (ssv->getssdMultiplier(ScalingStatValue) * ssd->Modifier[i]) / 10000;
6545 }
6546 else
6547 {
6548 if (i >= proto->StatsCount)
6549 continue;
6550
6551 // OnCustomScalingStatValue(Player* player, ItemTemplate const* proto, uint32& statType, int32& val, uint8 itemProtoStatNumber, uint32 ScalingStatValue, ScalingStatValuesEntry const* ssv)
6552 sScriptMgr->OnCustomScalingStatValue(this, proto, statType, val, i, ScalingStatValue, ssv);
6553 }
6554 }
6555 else
6556 {
6557 if (i >= proto->StatsCount)
6558 continue;
6559
6560 statType = proto->ItemStat[i].ItemStatType;
6561 val = proto->ItemStat[i].ItemStatValue;
6562 }
6563
6564 if (val == 0)
6565 continue;
6566
6567 switch (statType)
6568 {
6569 case ITEM_MOD_MANA:
6570 HandleStatModifier(UNIT_MOD_MANA, BASE_VALUE, float(val), apply);
6571 break;
6572 case ITEM_MOD_HEALTH: // modify HP
6573 HandleStatModifier(UNIT_MOD_HEALTH, BASE_VALUE, float(val), apply);
6574 break;
6575 case ITEM_MOD_AGILITY: // modify agility
6577 ApplyStatBuffMod(STAT_AGILITY, float(val), apply);
6578 break;
6579 case ITEM_MOD_STRENGTH: //modify strength
6581 ApplyStatBuffMod(STAT_STRENGTH, float(val), apply);
6582 break;
6583 case ITEM_MOD_INTELLECT: //modify intellect
6585 ApplyStatBuffMod(STAT_INTELLECT, float(val), apply);
6586 break;
6587 case ITEM_MOD_SPIRIT: //modify spirit
6589 ApplyStatBuffMod(STAT_SPIRIT, float(val), apply);
6590 break;
6591 case ITEM_MOD_STAMINA: //modify stamina
6593 ApplyStatBuffMod(STAT_STAMINA, float(val), apply);
6594 break;
6597 break;
6599 ApplyRatingMod(CR_DODGE, int32(val), apply);
6600 break;
6602 ApplyRatingMod(CR_PARRY, int32(val), apply);
6603 break;
6605 ApplyRatingMod(CR_BLOCK, int32(val), apply);
6606 break;
6608 ApplyRatingMod(CR_HIT_MELEE, int32(val), apply);
6609 break;
6611 ApplyRatingMod(CR_HIT_RANGED, int32(val), apply);
6612 break;
6614 ApplyRatingMod(CR_HIT_SPELL, int32(val), apply);
6615 break;
6617 ApplyRatingMod(CR_CRIT_MELEE, int32(val), apply);
6618 break;
6620 ApplyRatingMod(CR_CRIT_RANGED, int32(val), apply);
6621 break;
6623 ApplyRatingMod(CR_CRIT_SPELL, int32(val), apply);
6624 break;
6627 break;
6630 break;
6633 break;
6636 break;
6639 break;
6642 break;
6644 ApplyRatingMod(CR_HASTE_MELEE, int32(val), apply);
6645 break;
6647 ApplyRatingMod(CR_HASTE_RANGED, int32(val), apply);
6648 break;
6650 ApplyRatingMod(CR_HASTE_SPELL, int32(val), apply);
6651 break;
6653 ApplyRatingMod(CR_HIT_MELEE, int32(val), apply);
6654 ApplyRatingMod(CR_HIT_RANGED, int32(val), apply);
6655 ApplyRatingMod(CR_HIT_SPELL, int32(val), apply);
6656 break;
6658 ApplyRatingMod(CR_CRIT_MELEE, int32(val), apply);
6659 ApplyRatingMod(CR_CRIT_RANGED, int32(val), apply);
6660 ApplyRatingMod(CR_CRIT_SPELL, int32(val), apply);
6661 break;
6666 break;
6672 break;
6674 ApplyRatingMod(CR_HASTE_MELEE, int32(val), apply);
6675 ApplyRatingMod(CR_HASTE_RANGED, int32(val), apply);
6676 ApplyRatingMod(CR_HASTE_SPELL, int32(val), apply);
6677 break;
6679 ApplyRatingMod(CR_EXPERTISE, int32(val), apply);
6680 break;
6684 break;
6687 break;
6688 // case ITEM_MOD_FERAL_ATTACK_POWER:
6689 // ApplyFeralAPBonus(int32(val), apply);
6690 // break;
6692 ApplyManaRegenBonus(int32(val), apply);
6693 break;
6696 break;
6698 ApplySpellPowerBonus(int32(val), apply);
6699 break;
6701 ApplyHealthRegenBonus(int32(val), apply);
6702 break;
6704 ApplySpellPenetrationBonus(val, apply);
6705 break;
6707 HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(val), apply);
6708 break;
6712 break;
6713 }
6714 }
6715
6716 // Apply Spell Power from ScalingStatValue if set
6717 if (ssv)
6718 if (int32 spellbonus = ssv->getSpellBonus(ScalingStatValue))
6719 ApplySpellPowerBonus(spellbonus, apply);
6720
6721 // If set ScalingStatValue armor get it or use item armor
6722 uint32 armor = proto->Armor;
6723 if (ssv)
6724 {
6725 if (uint32 ssvarmor = ssv->getArmorMod(ScalingStatValue))
6726 if (proto->ScalingStatValue > 0 || ssvarmor < proto->Armor) //Check to avoid higher values than stat itself (heirloom OR items with correct armor value)
6727 armor = ssvarmor;
6728 }
6729 else if (armor && proto->ArmorDamageModifier)
6730 armor -= uint32(proto->ArmorDamageModifier);
6731
6732 if (armor)
6733 {
6734 UnitModifierType modType = TOTAL_VALUE;
6735 if (proto->Class == ITEM_CLASS_ARMOR)
6736 {
6737 switch (proto->SubClass)
6738 {
6744 modType = BASE_VALUE;
6745 break;
6746 }
6747 }
6748 HandleStatModifier(UNIT_MOD_ARMOR, modType, float(armor), apply);
6749 }
6750
6751 // Add armor bonus from ArmorDamageModifier if > 0
6752 if (proto->ArmorDamageModifier > 0 && sScriptMgr->CanArmorDamageModifier(this))
6753 HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(proto->ArmorDamageModifier), apply);
6754
6755 if (proto->Block)
6756 HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(proto->Block), apply);
6757
6758 if (proto->HolyRes)
6759 HandleStatModifier(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(proto->HolyRes), apply);
6760
6761 if (proto->FireRes)
6762 HandleStatModifier(UNIT_MOD_RESISTANCE_FIRE, BASE_VALUE, float(proto->FireRes), apply);
6763
6764 if (proto->NatureRes)
6765 HandleStatModifier(UNIT_MOD_RESISTANCE_NATURE, BASE_VALUE, float(proto->NatureRes), apply);
6766
6767 if (proto->FrostRes)
6768 HandleStatModifier(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, float(proto->FrostRes), apply);
6769
6770 if (proto->ShadowRes)
6771 HandleStatModifier(UNIT_MOD_RESISTANCE_SHADOW, BASE_VALUE, float(proto->ShadowRes), apply);
6772
6773 if (proto->ArcaneRes)
6774 HandleStatModifier(UNIT_MOD_RESISTANCE_ARCANE, BASE_VALUE, float(proto->ArcaneRes), apply);
6775
6776 uint8 attType = Player::GetAttackBySlot(slot);
6777 if (attType != MAX_ATTACK)
6778 {
6779 _ApplyWeaponDamage(slot, proto, ssv, apply);
6780 }
6781
6782 // Druids get feral AP bonus from weapon dps (also use DPS from ScalingStatValue)
6783 if (getClass() == CLASS_DRUID)
6784 {
6785 int32 dpsMod = 0;
6786 int32 feral_bonus = 0;
6787 if (ssv)
6788 {
6789 dpsMod = ssv->getDPSMod(ScalingStatValue);
6790 feral_bonus += ssv->getFeralBonus(ScalingStatValue);
6791 }
6792
6793 feral_bonus += proto->getFeralBonus(dpsMod);
6794 sScriptMgr->OnGetFeralApBonus(this, feral_bonus, dpsMod, proto, ssv);
6795 if (feral_bonus)
6796 ApplyFeralAPBonus(feral_bonus, apply);
6797 }
6798}
std::int32_t int32
Definition: Define.h:104
DBCStorage< ScalingStatDistributionEntry > sScalingStatDistributionStore(ScalingStatDistributionfmt)
DBCStorage< ScalingStatValuesEntry > sScalingStatValuesStore(ScalingStatValuesfmt)
@ ITEM_MOD_CRIT_TAKEN_RANGED_RATING
Definition: ItemTemplate.h:49
@ ITEM_MOD_HIT_MELEE_RATING
Definition: ItemTemplate.h:39
@ ITEM_MOD_HIT_TAKEN_MELEE_RATING
Definition: ItemTemplate.h:45
@ ITEM_MOD_STAMINA
Definition: ItemTemplate.h:34
@ ITEM_MOD_HIT_SPELL_RATING
Definition: ItemTemplate.h:41
@ ITEM_MOD_SPELL_PENETRATION
Definition: ItemTemplate.h:70
@ ITEM_MOD_PARRY_RATING
Definition: ItemTemplate.h:37
@ ITEM_MOD_DEFENSE_SKILL_RATING
Definition: ItemTemplate.h:35
@ ITEM_MOD_HASTE_RANGED_RATING
Definition: ItemTemplate.h:52
@ ITEM_MOD_CRIT_TAKEN_RATING
Definition: ItemTemplate.h:57
@ ITEM_MOD_EXPERTISE_RATING
Definition: ItemTemplate.h:60
@ ITEM_MOD_MANA
Definition: ItemTemplate.h:28
@ ITEM_MOD_RANGED_ATTACK_POWER
Definition: ItemTemplate.h:62
@ ITEM_MOD_HEALTH
Definition: ItemTemplate.h:29
@ ITEM_MOD_CRIT_TAKEN_SPELL_RATING
Definition: ItemTemplate.h:50
@ ITEM_MOD_HIT_TAKEN_SPELL_RATING
Definition: ItemTemplate.h:47
@ ITEM_MOD_SPIRIT
Definition: ItemTemplate.h:33
@ ITEM_MOD_SPELL_POWER
Definition: ItemTemplate.h:68
@ ITEM_MOD_HASTE_SPELL_RATING
Definition: ItemTemplate.h:53
@ ITEM_MOD_ATTACK_POWER
Definition: ItemTemplate.h:61
@ ITEM_MOD_HASTE_RATING
Definition: ItemTemplate.h:59
@ ITEM_MOD_HIT_RANGED_RATING
Definition: ItemTemplate.h:40
@ ITEM_MOD_CRIT_SPELL_RATING
Definition: ItemTemplate.h:44
@ ITEM_MOD_BLOCK_VALUE
Definition: ItemTemplate.h:71
@ ITEM_MOD_CRIT_RANGED_RATING
Definition: ItemTemplate.h:43
@ ITEM_MOD_CRIT_MELEE_RATING
Definition: ItemTemplate.h:42
@ ITEM_MOD_STRENGTH
Definition: ItemTemplate.h:31
@ ITEM_MOD_HEALTH_REGEN
Definition: ItemTemplate.h:69
@ ITEM_MOD_BLOCK_RATING
Definition: ItemTemplate.h:38
@ ITEM_MOD_ARMOR_PENETRATION_RATING
Definition: ItemTemplate.h:67
@ ITEM_MOD_SPELL_HEALING_DONE
Definition: ItemTemplate.h:64
@ ITEM_MOD_CRIT_TAKEN_MELEE_RATING
Definition: ItemTemplate.h:48
@ ITEM_MOD_HIT_TAKEN_RATING
Definition: ItemTemplate.h:56
@ ITEM_MOD_HASTE_MELEE_RATING
Definition: ItemTemplate.h:51
@ ITEM_MOD_MANA_REGENERATION
Definition: ItemTemplate.h:66
@ ITEM_MOD_HIT_RATING
Definition: ItemTemplate.h:54
@ ITEM_MOD_INTELLECT
Definition: ItemTemplate.h:32
@ ITEM_MOD_RESILIENCE_RATING
Definition: ItemTemplate.h:58
@ ITEM_MOD_AGILITY
Definition: ItemTemplate.h:30
@ ITEM_MOD_DODGE_RATING
Definition: ItemTemplate.h:36
@ ITEM_MOD_CRIT_RATING
Definition: ItemTemplate.h:55
@ ITEM_MOD_SPELL_DAMAGE_DONE
Definition: ItemTemplate.h:65
@ ITEM_MOD_HIT_TAKEN_RANGED_RATING
Definition: ItemTemplate.h:46
@ ITEM_SUBCLASS_ARMOR_MAIL
Definition: ItemTemplate.h:402
@ ITEM_SUBCLASS_ARMOR_CLOTH
Definition: ItemTemplate.h:400
@ ITEM_SUBCLASS_ARMOR_LEATHER
Definition: ItemTemplate.h:401
@ ITEM_SUBCLASS_ARMOR_SHIELD
Definition: ItemTemplate.h:405
@ ITEM_SUBCLASS_ARMOR_PLATE
Definition: ItemTemplate.h:403
@ ITEM_CLASS_ARMOR
Definition: ItemTemplate.h:304
#define MAX_ITEM_PROTO_STATS
Definition: ItemTemplate.h:625
@ UNIT_MOD_STAT_INTELLECT
Definition: Unit.h:265
@ UNIT_MOD_STAT_SPIRIT
Definition: Unit.h:266
@ UNIT_MOD_ARMOR
Definition: Unit.h:275
@ UNIT_MOD_RESISTANCE_SHADOW
Definition: Unit.h:280
@ UNIT_MOD_RESISTANCE_FROST
Definition: Unit.h:279
@ UNIT_MOD_ATTACK_POWER
Definition: Unit.h:282
@ UNIT_MOD_RESISTANCE_HOLY
Definition: Unit.h:276
@ UNIT_MOD_RESISTANCE_ARCANE
Definition: Unit.h:281
@ UNIT_MOD_HEALTH
Definition: Unit.h:267
@ UNIT_MOD_RESISTANCE_FIRE
Definition: Unit.h:277
@ UNIT_MOD_STAT_STRENGTH
Definition: Unit.h:262
@ UNIT_MOD_RESISTANCE_NATURE
Definition: Unit.h:278
@ UNIT_MOD_STAT_AGILITY
Definition: Unit.h:263
@ UNIT_MOD_MANA
Definition: Unit.h:268
@ UNIT_MOD_STAT_STAMINA
Definition: Unit.h:264
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition: Unit.h:283
@ SHIELD_BLOCK_VALUE
Definition: Unit.h:302
UnitModifierType
Definition: Unit.h:244
@ BASE_VALUE
Definition: Unit.h:245
@ TOTAL_VALUE
Definition: Unit.h:247
@ CR_EXPERTISE
Definition: Unit.h:427
@ CR_HIT_TAKEN_MELEE
Definition: Unit.h:415
@ CR_HASTE_RANGED
Definition: Unit.h:422
@ CR_HIT_MELEE
Definition: Unit.h:409
@ CR_CRIT_TAKEN_RANGED
Definition: Unit.h:419
@ CR_CRIT_TAKEN_SPELL
Definition: Unit.h:420
@ CR_ARMOR_PENETRATION
Definition: Unit.h:428
@ CR_CRIT_MELEE
Definition: Unit.h:412
@ CR_CRIT_RANGED
Definition: Unit.h:413
@ CR_HIT_TAKEN_SPELL
Definition: Unit.h:417
@ CR_PARRY
Definition: Unit.h:407
@ CR_DODGE
Definition: Unit.h:406
@ CR_DEFENSE_SKILL
Definition: Unit.h:405
@ CR_HASTE_MELEE
Definition: Unit.h:421
@ CR_BLOCK
Definition: Unit.h:408
@ CR_HASTE_SPELL
Definition: Unit.h:423
@ CR_HIT_SPELL
Definition: Unit.h:411
@ CR_HIT_TAKEN_RANGED
Definition: Unit.h:416
@ CR_CRIT_SPELL
Definition: Unit.h:414
@ CR_HIT_RANGED
Definition: Unit.h:410
@ CR_CRIT_TAKEN_MELEE
Definition: Unit.h:418
@ CLASS_DRUID
Definition: SharedDefines.h:151
@ STAT_SPIRIT
Definition: SharedDefines.h:262
@ STAT_INTELLECT
Definition: SharedDefines.h:261
@ STAT_AGILITY
Definition: SharedDefines.h:259
@ STAT_STRENGTH
Definition: SharedDefines.h:258
@ STAT_STAMINA
Definition: SharedDefines.h:260
void ApplyRatingMod(CombatRating cr, int32 value, bool apply)
Definition: Player.cpp:5174
void ApplySpellPenetrationBonus(int32 amount, bool apply)
Definition: StatSystem.cpp:219
void _ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, ScalingStatValuesEntry const *ssv, bool apply)
Definition: Player.cpp:6800
void ApplyManaRegenBonus(int32 amount, bool apply)
Definition: StatSystem.cpp:920
void ApplySpellPowerBonus(int32 amount, bool apply)
Definition: StatSystem.cpp:167
void ApplyFeralAPBonus(int32 amount, bool apply)
Definition: StatSystem.cpp:324
void ApplyHealthRegenBonus(int32 amount, bool apply)
Definition: StatSystem.cpp:926
void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply)
Definition: Player.cpp:4933
void ApplyStatBuffMod(Stats stat, float val, bool apply)
Definition: Unit.h:2048
uint8 getClass() const
Definition: Unit.h:1438
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:15189
uint8 GetLevel() const
Definition: Unit.h:1432
Definition: DBCStructure.h:1471
uint32 MaxLevel
Definition: DBCStructure.h:1475
uint32 Modifier[10]
Definition: DBCStructure.h:1474
int32 StatMod[10]
Definition: DBCStructure.h:1473
Definition: DBCStructure.h:1479
uint32 getArmorMod(uint32 mask) const
Definition: DBCStructure.h:1504
uint32 getDPSMod(uint32 mask) const
Definition: DBCStructure.h:1522
uint32 getFeralBonus(uint32 mask) const
Definition: DBCStructure.h:1552
uint32 getssdMultiplier(uint32 mask) const
Definition: DBCStructure.h:1490
uint32 getSpellBonus(uint32 mask) const
Definition: DBCStructure.h:1546

References _ApplyWeaponDamage(), ApplyFeralAPBonus(), ApplyHealthRegenBonus(), ApplyManaRegenBonus(), ApplyRatingMod(), ApplySpellPenetrationBonus(), ApplySpellPowerBonus(), Unit::ApplyStatBuffMod(), ItemTemplate::ArcaneRes, ItemTemplate::Armor, ItemTemplate::ArmorDamageModifier, BASE_VALUE, ItemTemplate::Block, ItemTemplate::Class, CLASS_DRUID, CR_ARMOR_PENETRATION, CR_BLOCK, CR_CRIT_MELEE, CR_CRIT_RANGED, CR_CRIT_SPELL, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, CR_DEFENSE_SKILL, CR_DODGE, CR_EXPERTISE, CR_HASTE_MELEE, CR_HASTE_RANGED, CR_HASTE_SPELL, CR_HIT_MELEE, CR_HIT_RANGED, CR_HIT_SPELL, CR_HIT_TAKEN_MELEE, CR_HIT_TAKEN_RANGED, CR_HIT_TAKEN_SPELL, CR_PARRY, ItemTemplate::FireRes, FLAT_MOD, ItemTemplate::FrostRes, ScalingStatValuesEntry::getArmorMod(), GetAttackBySlot(), Unit::getClass(), ScalingStatValuesEntry::getDPSMod(), ItemTemplate::getFeralBonus(), ScalingStatValuesEntry::getFeralBonus(), Unit::GetLevel(), ScalingStatValuesEntry::getSpellBonus(), ScalingStatValuesEntry::getssdMultiplier(), HandleBaseModValue(), Unit::HandleStatModifier(), ItemTemplate::HolyRes, INVENTORY_SLOT_BAG_END, ITEM_CLASS_ARMOR, ITEM_MOD_AGILITY, ITEM_MOD_ARMOR_PENETRATION_RATING, ITEM_MOD_ATTACK_POWER, ITEM_MOD_BLOCK_RATING, ITEM_MOD_BLOCK_VALUE, ITEM_MOD_CRIT_MELEE_RATING, ITEM_MOD_CRIT_RANGED_RATING, ITEM_MOD_CRIT_RATING, ITEM_MOD_CRIT_SPELL_RATING, ITEM_MOD_CRIT_TAKEN_MELEE_RATING, ITEM_MOD_CRIT_TAKEN_RANGED_RATING, ITEM_MOD_CRIT_TAKEN_RATING, ITEM_MOD_CRIT_TAKEN_SPELL_RATING, ITEM_MOD_DEFENSE_SKILL_RATING, ITEM_MOD_DODGE_RATING, ITEM_MOD_EXPERTISE_RATING, ITEM_MOD_HASTE_MELEE_RATING, ITEM_MOD_HASTE_RANGED_RATING, ITEM_MOD_HASTE_RATING, ITEM_MOD_HASTE_SPELL_RATING, ITEM_MOD_HEALTH, ITEM_MOD_HEALTH_REGEN, ITEM_MOD_HIT_MELEE_RATING, ITEM_MOD_HIT_RANGED_RATING, ITEM_MOD_HIT_RATING, ITEM_MOD_HIT_SPELL_RATING, ITEM_MOD_HIT_TAKEN_MELEE_RATING, ITEM_MOD_HIT_TAKEN_RANGED_RATING, ITEM_MOD_HIT_TAKEN_RATING, ITEM_MOD_HIT_TAKEN_SPELL_RATING, ITEM_MOD_INTELLECT, ITEM_MOD_MANA, ITEM_MOD_MANA_REGENERATION, ITEM_MOD_PARRY_RATING, ITEM_MOD_RANGED_ATTACK_POWER, ITEM_MOD_RESILIENCE_RATING, ITEM_MOD_SPELL_DAMAGE_DONE, ITEM_MOD_SPELL_HEALING_DONE, ITEM_MOD_SPELL_PENETRATION, ITEM_MOD_SPELL_POWER, ITEM_MOD_SPIRIT, ITEM_MOD_STAMINA, ITEM_MOD_STRENGTH, ITEM_SUBCLASS_ARMOR_CLOTH, ITEM_SUBCLASS_ARMOR_LEATHER, ITEM_SUBCLASS_ARMOR_MAIL, ITEM_SUBCLASS_ARMOR_PLATE, ITEM_SUBCLASS_ARMOR_SHIELD, ItemTemplate::ItemStat, _ItemStat::ItemStatType, _ItemStat::ItemStatValue, MAX_ATTACK, MAX_ITEM_PROTO_STATS, ScalingStatDistributionEntry::MaxLevel, ScalingStatDistributionEntry::Modifier, ItemTemplate::NatureRes, ItemTemplate::ScalingStatDistribution, ItemTemplate::ScalingStatValue, ItemTemplate::ShadowRes, SHIELD_BLOCK_VALUE, sScalingStatDistributionStore, sScalingStatValuesStore, sScriptMgr, STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STAMINA, STAT_STRENGTH, ScalingStatDistributionEntry::StatMod, ItemTemplate::StatsCount, ItemTemplate::SubClass, TOTAL_VALUE, UNIT_MOD_ARMOR, UNIT_MOD_ATTACK_POWER, UNIT_MOD_ATTACK_POWER_RANGED, UNIT_MOD_HEALTH, UNIT_MOD_MANA, UNIT_MOD_RESISTANCE_ARCANE, UNIT_MOD_RESISTANCE_FIRE, UNIT_MOD_RESISTANCE_FROST, UNIT_MOD_RESISTANCE_HOLY, UNIT_MOD_RESISTANCE_NATURE, UNIT_MOD_RESISTANCE_SHADOW, UNIT_MOD_STAT_AGILITY, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_STAMINA, and UNIT_MOD_STAT_STRENGTH.

Referenced by _ApplyAllItemMods(), _ApplyItemMods(), and _RemoveAllItemMods().

◆ _ApplyItemMods()

void Player::_ApplyItemMods ( Item item,
uint8  slot,
bool  apply 
)
6473{
6474 if (slot >= INVENTORY_SLOT_BAG_END || !item)
6475 return;
6476
6477 ItemTemplate const* proto = item->GetTemplate();
6478
6479 if (!proto)
6480 return;
6481
6482 // not apply/remove mods for broken item
6483 if (item->IsBroken())
6484 return;
6485
6486 LOG_DEBUG("entities.player", "applying mods for item {} ", item->GetGUID().ToString());
6487
6488 uint8 attacktype = Player::GetAttackBySlot(slot);
6489
6490 if (item->HasSocket()) //only (un)equipping of items with sockets can influence metagems, so no need to waste time with normal items
6491 CorrectMetaGemEnchants(slot, apply);
6492
6493 if (attacktype < MAX_ATTACK)
6494 _ApplyWeaponDependentAuraMods(item, WeaponAttackType(attacktype), apply);
6495
6496 _ApplyItemBonuses(proto, slot, apply);
6497
6498 if (slot == EQUIPMENT_SLOT_RANGED)
6500
6501 ApplyItemEquipSpell(item, apply);
6502 ApplyEnchantment(item, apply);
6503
6504 LOG_DEBUG("entities.player.items", "_ApplyItemMods complete.");
6505}
bool HasSocket() const
Definition: Item.cpp:1008
bool IsBroken() const
Definition: Item.h:251
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
std::string ToString() const
Definition: ObjectGuid.cpp:47
void CorrectMetaGemEnchants(uint8 slot, bool apply)
Definition: Player.cpp:11125

References _ApplyAmmoBonuses(), _ApplyItemBonuses(), _ApplyWeaponDependentAuraMods(), ApplyEnchantment(), ApplyItemEquipSpell(), CorrectMetaGemEnchants(), EQUIPMENT_SLOT_RANGED, GetAttackBySlot(), Object::GetGUID(), Item::GetTemplate(), Item::HasSocket(), INVENTORY_SLOT_BAG_END, Item::IsBroken(), LOG_DEBUG, MAX_ATTACK, and ObjectGuid::ToString().

Referenced by _ApplyAllLevelScaleItemMods(), DestroyItem(), DurabilityPointsLoss(), DurabilityRepair(), EquipItem(), and RemoveItem().

◆ _ApplyWeaponDamage()

void Player::_ApplyWeaponDamage ( uint8  slot,
ItemTemplate const *  proto,
ScalingStatValuesEntry const *  ssv,
bool  apply 
)
6801{
6802 uint32 CustomScalingStatValue = 0;
6803
6804 sScriptMgr->OnCustomScalingStatValueBefore(this, proto, slot, apply, CustomScalingStatValue);
6805
6806 uint32 ScalingStatValue = proto->ScalingStatValue > 0 ? proto->ScalingStatValue : CustomScalingStatValue;
6807
6808 // following part fix disarm issue
6809 // that doesn't apply the scaling after disarmed
6810 if (!ssv)
6811 {
6812 ScalingStatDistributionEntry const* ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : nullptr;
6813
6814 // req. check at equip, but allow use for extended range if range limit max level, set proper level
6815 uint32 ssd_level = GetLevel();
6816
6817 if (ssd && ssd_level > ssd->MaxLevel)
6818 ssd_level = ssd->MaxLevel;
6819
6820 ssv = ScalingStatValue ? sScalingStatValuesStore.LookupEntry(ssd_level) : nullptr;
6821 }
6822
6823 uint8 attType = Player::GetAttackBySlot(slot);
6824 if (!IsInFeralForm() && apply && !CanUseAttackType(attType))
6825 {
6826 return;
6827 }
6828
6829 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
6830 {
6831 float minDamage = proto->Damage[i].DamageMin;
6832 float maxDamage = proto->Damage[i].DamageMax;
6833
6834 // If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage
6835 if (ssv)
6836 {
6837 int32 extraDPS = ssv->getDPSMod(ScalingStatValue);
6838 if (extraDPS)
6839 {
6840 float average = extraDPS * proto->Delay / 1000.0f;
6841 float mod = ssv->IsTwoHand(proto->ScalingStatValue) ? 0.2f : 0.3f;
6842
6843 minDamage = (1.0f - mod) * average;
6844 maxDamage = (1.0f + mod) * average;
6845 }
6846 }
6847
6848 if (apply)
6849 {
6850 if (minDamage > 0.f)
6851 {
6852 SetBaseWeaponDamage(WeaponAttackType(attType), MINDAMAGE, minDamage, i);
6853 }
6854
6855 if (maxDamage > 0.f)
6856 {
6857 SetBaseWeaponDamage(WeaponAttackType(attType), MAXDAMAGE, maxDamage, i);
6858 }
6859 }
6860 }
6861
6862 if (!apply)
6863 {
6864 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
6865 {
6868 }
6869
6870 if (attType == BASE_ATTACK)
6871 {
6874 }
6875 }
6876
6877 if (proto->Delay && !IsInFeralForm())
6878 {
6879 if (slot == EQUIPMENT_SLOT_RANGED)
6880 SetAttackTime(RANGED_ATTACK, apply ? proto->Delay : BASE_ATTACK_TIME);
6881 else if (slot == EQUIPMENT_SLOT_MAINHAND)
6882 SetAttackTime(BASE_ATTACK, apply ? proto->Delay : BASE_ATTACK_TIME);
6883 else if (slot == EQUIPMENT_SLOT_OFFHAND)
6884 SetAttackTime(OFF_ATTACK, apply ? proto->Delay : BASE_ATTACK_TIME);
6885 }
6886
6887 // No need to modify any physical damage for ferals as it is calculated from stats only
6888 if (IsInFeralForm())
6889 return;
6890
6891 if (CanModifyStats() && (GetWeaponDamageRange(WeaponAttackType(attType), MAXDAMAGE) || proto->Delay))
6893}
#define MAX_ITEM_PROTO_DAMAGES
Definition: ItemTemplate.h:622
@ EQUIPMENT_SLOT_MAINHAND
Definition: Player.h:691
@ EQUIPMENT_SLOT_OFFHAND
Definition: Player.h:692
@ MINDAMAGE
Definition: Unit.h:254
@ MAXDAMAGE
Definition: Unit.h:255
#define BASE_ATTACK_TIME
Definition: Unit.h:40
@ OFF_ATTACK
Definition: Unit.h:397
@ BASE_ATTACK
Definition: Unit.h:396
#define BASE_MAXDAMAGE
Definition: Unit.h:39
#define BASE_MINDAMAGE
Definition: Unit.h:38
float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type, uint8 damageIndex=0) const
Definition: Unit.cpp:15438
void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
Definition: Unit.h:2132
bool IsInFeralForm() const
Definition: Unit.h:2091
void SetAttackTime(WeaponAttackType att, uint32 val)
Definition: Unit.h:1489

References BASE_ATTACK, BASE_ATTACK_TIME, BASE_MAXDAMAGE, BASE_MINDAMAGE, Unit::CanModifyStats(), Unit::CanUseAttackType(), ItemTemplate::Damage, _Damage::DamageMax, _Damage::DamageMin, ItemTemplate::Delay, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, GetAttackBySlot(), ScalingStatValuesEntry::getDPSMod(), Unit::GetLevel(), Unit::GetWeaponDamageRange(), Unit::IsInFeralForm(), ScalingStatValuesEntry::IsTwoHand(), MAX_ITEM_PROTO_DAMAGES, MAXDAMAGE, ScalingStatDistributionEntry::MaxLevel, MINDAMAGE, OFF_ATTACK, RANGED_ATTACK, ItemTemplate::ScalingStatDistribution, ItemTemplate::ScalingStatValue, Unit::SetAttackTime(), Unit::SetBaseWeaponDamage(), sScalingStatDistributionStore, sScalingStatValuesStore, sScriptMgr, and Unit::UpdateDamagePhysical().

Referenced by _ApplyItemBonuses(), AuraEffect::HandleAuraModDisarm(), and AuraEffect::HandleAuraModShapeshift().

◆ _ApplyWeaponDependentAuraCritMod()

void Player::_ApplyWeaponDependentAuraCritMod ( Item item,
WeaponAttackType  attackType,
AuraEffect const *  aura,
bool  apply 
)
6921{
6922 // don't apply mod if item is broken or cannot be used
6923 if (item->IsBroken() || !CanUseAttackType(attackType))
6924 return;
6925
6926 // generic not weapon specific case processes in aura code
6927 if (aura->GetSpellInfo()->EquippedItemClass == -1)
6928 return;
6929
6930 if (!sScriptMgr->CanApplyWeaponDependentAuraDamageMod(this, item, attackType, aura, apply))
6931 return;
6932
6934 switch (attackType)
6935 {
6936 case BASE_ATTACK:
6937 mod = CRIT_PERCENTAGE;
6938 break;
6939 case OFF_ATTACK:
6941 break;
6942 case RANGED_ATTACK:
6944 break;
6945 default:
6946 return;
6947 }
6948
6949 if (item->IsFitToSpellRequirements(aura->GetSpellInfo()))
6950 HandleBaseModValue(mod, FLAT_MOD, float (aura->GetAmount()), apply);
6951}
BaseModGroup
Definition: Unit.h:298
@ OFFHAND_CRIT_PERCENTAGE
Definition: Unit.h:301
@ CRIT_PERCENTAGE
Definition: Unit.h:299
@ RANGED_CRIT_PERCENTAGE
Definition: Unit.h:300
bool IsFitToSpellRequirements(SpellInfo const *spellInfo) const
Definition: Item.cpp:885

References BASE_ATTACK, BASEMOD_END, Unit::CanUseAttackType(), CRIT_PERCENTAGE, SpellInfo::EquippedItemClass, FLAT_MOD, AuraEffect::GetAmount(), AuraEffect::GetSpellInfo(), HandleBaseModValue(), Item::IsBroken(), Item::IsFitToSpellRequirements(), OFF_ATTACK, OFFHAND_CRIT_PERCENTAGE, RANGED_ATTACK, RANGED_CRIT_PERCENTAGE, and sScriptMgr.

Referenced by _ApplyWeaponDependentAuraMods(), and AuraEffect::HandleAuraModWeaponCritPercent().

◆ _ApplyWeaponDependentAuraDamageMod()

void Player::_ApplyWeaponDependentAuraDamageMod ( Item item,
WeaponAttackType  attackType,
AuraEffect const *  aura,
bool  apply 
)
6954{
6955 // don't apply mod if item is broken or cannot be used
6956 if (item->IsBroken() || !CanUseAttackType(attackType))
6957 return;
6958
6959 // ignore spell mods for not wands
6960 if ((aura->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) == 0 && (getClassMask() & CLASSMASK_WAND_USERS) == 0)
6961 return;
6962
6963 // generic not weapon specific case processes in aura code
6964 if (aura->GetSpellInfo()->EquippedItemClass == -1)
6965 return;
6966
6967 UnitMods unitMod = UNIT_MOD_END;
6968 switch (attackType)
6969 {
6970 case BASE_ATTACK:
6971 unitMod = UNIT_MOD_DAMAGE_MAINHAND;
6972 break;
6973 case OFF_ATTACK:
6974 unitMod = UNIT_MOD_DAMAGE_OFFHAND;
6975 break;
6976 case RANGED_ATTACK:
6977 unitMod = UNIT_MOD_DAMAGE_RANGED;
6978 break;
6979 default:
6980 return;
6981 }
6982
6983 UnitModifierType unitModType = TOTAL_VALUE;
6984 switch (aura->GetAuraType())
6985 {
6987 unitModType = TOTAL_VALUE;
6988 break;
6990 unitModType = TOTAL_PCT;
6991 break;
6992 default:
6993 return;
6994 }
6995
6996 if (item->IsFitToSpellRequirements(aura->GetSpellInfo()))
6997 {
6998 HandleStatModifier(unitMod, unitModType, float(aura->GetAmount()), apply);
6999 if (unitModType == TOTAL_VALUE)
7000 {
7001 if (aura->GetAmount() > 0)
7002 ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, aura->GetAmount(), apply);
7003 else
7004 ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG, aura->GetAmount(), apply);
7005 }
7006 }
7007}
@ PLAYER_FIELD_MOD_DAMAGE_DONE_POS
Definition: UpdateFields.h:360
@ PLAYER_FIELD_MOD_DAMAGE_DONE_NEG
Definition: UpdateFields.h:361
UnitMods
Definition: Unit.h:261
@ UNIT_MOD_DAMAGE_OFFHAND
Definition: Unit.h:285
@ UNIT_MOD_END
Definition: Unit.h:287
@ UNIT_MOD_DAMAGE_RANGED
Definition: Unit.h:286
@ UNIT_MOD_DAMAGE_MAINHAND
Definition: Unit.h:284
@ TOTAL_PCT
Definition: Unit.h:248
@ SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
Definition: SpellAuraDefines.h:142
@ SPELL_AURA_MOD_DAMAGE_DONE
Definition: SpellAuraDefines.h:76
#define CLASSMASK_WAND_USERS
Definition: SharedDefines.h:174
@ SPELL_SCHOOL_MASK_NORMAL
Definition: SharedDefines.h:297
void ApplyModUInt32Value(uint16 index, int32 val, bool apply)
Definition: Object.cpp:806
uint32 getClassMask() const
Definition: Unit.h:1439

References Object::ApplyModUInt32Value(), BASE_ATTACK, Unit::CanUseAttackType(), CLASSMASK_WAND_USERS, SpellInfo::EquippedItemClass, AuraEffect::GetAmount(), AuraEffect::GetAuraType(), Unit::getClassMask(), AuraEffect::GetMiscValue(), AuraEffect::GetSpellInfo(), Unit::HandleStatModifier(), Item::IsBroken(), Item::IsFitToSpellRequirements(), OFF_ATTACK, PLAYER_FIELD_MOD_DAMAGE_DONE_NEG, PLAYER_FIELD_MOD_DAMAGE_DONE_POS, RANGED_ATTACK, SPELL_AURA_MOD_DAMAGE_DONE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_SCHOOL_MASK_NORMAL, TOTAL_PCT, TOTAL_VALUE, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_DAMAGE_RANGED, and UNIT_MOD_END.

Referenced by _ApplyWeaponDependentAuraMods(), AuraEffect::HandleModDamageDone(), and AuraEffect::HandleModDamagePercentDone().

◆ _ApplyWeaponDependentAuraMods()

void Player::_ApplyWeaponDependentAuraMods ( Item item,
WeaponAttackType  attackType,
bool  apply 
)
6906{
6908 for (AuraEffectList::const_iterator itr = auraCritList.begin(); itr != auraCritList.end(); ++itr)
6909 _ApplyWeaponDependentAuraCritMod(item, attackType, *itr, apply);
6910
6912 for (AuraEffectList::const_iterator itr = auraDamageFlatList.begin(); itr != auraDamageFlatList.end(); ++itr)
6913 _ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply);
6914
6916 for (AuraEffectList::const_iterator itr = auraDamagePctList.begin(); itr != auraDamagePctList.end(); ++itr)
6917 _ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply);
6918}
@ SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
Definition: SpellAuraDefines.h:115
void _ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, AuraEffect const *aura, bool apply)
Definition: Player.cpp:6953
void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect const *aura, bool apply)
Definition: Player.cpp:6920
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1981
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1318

References _ApplyWeaponDependentAuraCritMod(), _ApplyWeaponDependentAuraDamageMod(), Unit::GetAuraEffectsByType(), SPELL_AURA_MOD_DAMAGE_DONE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, and SPELL_AURA_MOD_WEAPON_CRIT_PERCENT.

Referenced by _ApplyAllItemMods(), _ApplyItemMods(), _RemoveAllItemMods(), and AuraEffect::HandleAuraModDisarm().

◆ _LoadActions()

void Player::_LoadActions ( PreparedQueryResult  result)
protected
5696{
5697 m_actionButtons.clear();
5698
5699 if (result)
5700 {
5701 do
5702 {
5703 Field* fields = result->Fetch();
5704 uint8 button = fields[0].Get<uint8>();
5705 uint32 action = fields[1].Get<uint32>();
5706 uint8 type = fields[2].Get<uint8>();
5707
5708 if (ActionButton* ab = addActionButton(button, action, type))
5709 ab->uState = ACTIONBUTTON_UNCHANGED;
5710 else
5711 {
5712 LOG_ERROR("entities.player", "ActionButton loading problem, will be deleted from db...");
5713
5714 // Will deleted in DB at next save (it can create data until save but marked as deleted)
5715 m_actionButtons[button].uState = ACTIONBUTTON_DELETED;
5716 }
5717 } while (result->NextRow());
5718 }
5719}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
@ ACTIONBUTTON_UNCHANGED
Definition: Player.h:222
@ ACTIONBUTTON_DELETED
Definition: Player.h:225
Class used to access individual fields of database query result.
Definition: Field.h:99
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition: Field.h:113
Definition: Player.h:254
ActionButton * addActionButton(uint8 button, uint32 action, uint8 type)
Definition: Player.cpp:5539
ActionButtonList m_actionButtons
Definition: Player.h:2771

References ACTIONBUTTON_DELETED, ACTIONBUTTON_UNCHANGED, addActionButton(), Field::Get(), LOG_ERROR, and m_actionButtons.

Referenced by WorldSession::HandleLoadActionsSwitchSpec(), LoadActions(), and LoadFromDB().

◆ _LoadArenaTeamInfo()

void Player::_LoadArenaTeamInfo ( )
protected
4817{
4819
4820 for (auto const& itr : ArenaTeam::ArenaSlotByType)
4821 if (uint32 arenaTeamId = sCharacterCache->GetCharacterArenaTeamIdByGuid(GetGUID(), itr.second))
4822 {
4823 ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
4824 if (!arenaTeam)
4825 {
4826 LOG_ERROR("bg.arena", "Player::_LoadArenaTeamInfo: No arena team was found.");
4827 continue;
4828 }
4829 ArenaTeamMember const* member = arenaTeam->GetMember(GetGUID());
4830 if (!member)
4831 {
4832 LOG_ERROR("bg.arena", "Player::_LoadArenaTeamInfo: No members in the arena team ({}) was found.", arenaTeamId);
4833 continue;
4834 }
4835 uint8 slot = itr.second;
4836
4837 SetArenaTeamInfoField(slot, ARENA_TEAM_ID, arenaTeamId);
4838 SetArenaTeamInfoField(slot, ARENA_TEAM_TYPE, arenaTeam->GetType());
4839 SetArenaTeamInfoField(slot, ARENA_TEAM_MEMBER, (arenaTeam->GetCaptain() == GetGUID()) ? 0 : 1);
4844 }
4845}
#define MAX_ARENA_SLOT
Definition: ArenaTeam.h:135
@ ARENA_TEAM_GAMES_WEEK
Definition: ArenaTeam.h:78
@ ARENA_TEAM_TYPE
Definition: ArenaTeam.h:76
@ ARENA_TEAM_ID
Definition: ArenaTeam.h:75
@ ARENA_TEAM_END
Definition: ArenaTeam.h:82
@ ARENA_TEAM_PERSONAL_RATING
Definition: ArenaTeam.h:81
@ ARENA_TEAM_MEMBER
Definition: ArenaTeam.h:77
@ ARENA_TEAM_WINS_SEASON
Definition: ArenaTeam.h:80
@ ARENA_TEAM_GAMES_SEASON
Definition: ArenaTeam.h:79
#define sArenaTeamMgr
Definition: ArenaTeamMgr.h:67
#define sCharacterCache
Definition: CharacterCache.h:83
@ PLAYER_FIELD_ARENA_TEAM_INFO_1_1
Definition: UpdateFields.h:381
Definition: ArenaTeam.h:109
uint16 PersonalRating
Definition: ArenaTeam.h:117
uint16 SeasonWins
Definition: ArenaTeam.h:116
uint16 WeekGames
Definition: ArenaTeam.h:113
uint16 SeasonGames
Definition: ArenaTeam.h:115
Definition: ArenaTeam.h:138
ObjectGuid GetCaptain() const
Definition: ArenaTeam.h:154
ArenaTeamMember * GetMember(ObjectGuid guid)
Definition: ArenaTeam.cpp:1012
uint32 GetType() const
Definition: ArenaTeam.h:150
static std::unordered_map< uint32, uint8 > ArenaSlotByType
Definition: ArenaTeam.h:218
uint32 * m_uint32Values
Definition: Object.h:236
void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value)
Definition: Player.cpp:16114

References ARENA_TEAM_END, ARENA_TEAM_GAMES_SEASON, ARENA_TEAM_GAMES_WEEK, ARENA_TEAM_ID, ARENA_TEAM_MEMBER, ARENA_TEAM_PERSONAL_RATING, ARENA_TEAM_TYPE, ARENA_TEAM_WINS_SEASON, ArenaTeam::ArenaSlotByType, ArenaTeam::GetCaptain(), Object::GetGUID(), ArenaTeam::GetMember(), ArenaTeam::GetType(), LOG_ERROR, Object::m_uint32Values, MAX_ARENA_SLOT, ArenaTeamMember::PersonalRating, PLAYER_FIELD_ARENA_TEAM_INFO_1_1, sArenaTeamMgr, sCharacterCache, ArenaTeamMember::SeasonGames, ArenaTeamMember::SeasonWins, SetArenaTeamInfoField(), and ArenaTeamMember::WeekGames.

Referenced by LoadFromDB().

◆ _LoadAuras()

void Player::_LoadAuras ( PreparedQueryResult  result,
uint32  timediff 
)
protected
5722{
5723 LOG_DEBUG("entities.player.loading", "Loading auras for player {}", GetGUID().ToString());
5724
5725 /* 0 1 2 3 4 5 6 7 8 9 10 11
5726 QueryResult* result = CharacterDatabase.Query("SELECT casterGuid, itemGuid, spell, effectMask, recalculateMask, stackCount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2,
5727 12 13 14
5728 maxDuration, remainTime, remainCharges FROM character_aura WHERE guid = '{}'", GetGUID().GetCounter());
5729 */
5730
5731 if (result)
5732 {
5733 do
5734 {
5735 Field* fields = result->Fetch();
5736 int32 damage[3];
5737 int32 baseDamage[3];
5738 ObjectGuid caster_guid = ObjectGuid(fields[0].Get<uint64>());
5739 ObjectGuid itemGuid = ObjectGuid(fields[1].Get<uint64>());
5740 uint32 spellid = fields[2].Get<uint32>();
5741 uint8 effmask = fields[3].Get<uint8>();
5742 uint8 recalculatemask = fields[4].Get<uint8>();
5743 uint8 stackcount = fields[5].Get<uint8>();
5744 damage[0] = fields[6].Get<int32>();
5745 damage[1] = fields[7].Get<int32>();
5746 damage[2] = fields[8].Get<int32>();
5747 baseDamage[0] = fields[9].Get<int32>();
5748 baseDamage[1] = fields[10].Get<int32>();
5749 baseDamage[2] = fields[11].Get<int32>();
5750 int32 maxduration = fields[12].Get<int32>();
5751 int32 remaintime = fields[13].Get<int32>();
5752 uint8 remaincharges = fields[14].Get<uint8>();
5753
5754 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
5755 if (!spellInfo)
5756 {
5757 LOG_ERROR("entities.player", "Unknown aura (spellid {}), ignore.", spellid);
5758 continue;
5759 }
5760
5761 // Xinef: leave this
5762 if (spellInfo->HasAura(SPELL_AURA_MOUNTED))
5763 {
5764 SetMountBlockId(spellInfo->Id);
5765 continue;
5766 }
5767
5768 // negative effects should continue counting down after logout
5769 if (remaintime != -1 && ((!spellInfo->IsPositive() && spellInfo->Id != 15007) || spellInfo->HasAttribute(SPELL_ATTR4_AURA_EXPIRES_OFFLINE))) // Xinef: resurrection sickness should not tick when logged off
5770 {
5771 if (remaintime / IN_MILLISECONDS <= int32(timediff))
5772 continue;
5773
5774 remaintime -= timediff * IN_MILLISECONDS;
5775 }
5776
5777 // prevent wrong values of remaincharges
5778 if (spellInfo->ProcCharges)
5779 {
5780 // we have no control over the order of applying auras and modifiers allow auras
5781 // to have more charges than value in SpellInfo
5782 if (remaincharges <= 0/* || remaincharges > spellproto->procCharges*/)
5783 remaincharges = spellInfo->ProcCharges;
5784 }
5785 else
5786 remaincharges = 0;
5787
5788 if (Aura* aura = Aura::TryCreate(spellInfo, effmask, this, nullptr, &baseDamage[0], nullptr, caster_guid, itemGuid))
5789 {
5790 if (!aura->CanBeSaved())
5791 {
5792 aura->Remove();
5793 continue;
5794 }
5795
5796 aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]);
5797 aura->ApplyForTargets();
5798 LOG_DEBUG("entities.player", "Added aura spellid {}, effectmask {}", spellInfo->Id, effmask);
5799 }
5800 } while (result->NextRow());
5801 }
5802}
@ SPELL_AURA_MOUNTED
Definition: SpellAuraDefines.h:141
@ SPELL_ATTR4_AURA_EXPIRES_OFFLINE
Definition: SharedDefines.h:532
Definition: ObjectGuid.h:120
void SetMountBlockId(uint32 mount)
Definition: Player.h:2568
static Aura * TryCreate(SpellInfo const *spellproto, uint8 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemGUID=ObjectGuid::Empty)
Definition: SpellAuras.cpp:352

References Field::Get(), Object::GetGUID(), IN_MILLISECONDS, LOG_DEBUG, LOG_ERROR, SetMountBlockId(), SPELL_ATTR4_AURA_EXPIRES_OFFLINE, SPELL_AURA_MOUNTED, sSpellMgr, Position::ToString(), and Aura::TryCreate().

Referenced by LoadFromDB().

◆ _LoadBrewOfTheMonth()

void Player::_LoadBrewOfTheMonth ( PreparedQueryResult  result)
protected
15701{
15702 uint32 lastEventId = 0;
15703 if (result)
15704 {
15705 Field* fields = result->Fetch();
15706 lastEventId = fields[0].Get<uint32>();
15707 }
15708
15709 uint16 month = static_cast<uint16>(Acore::Time::GetMonth());
15710 uint16 eventId = month;
15711 if (eventId < 9)
15712 eventId += 3;
15713 else
15714 eventId -= 9;
15715
15716 // Brew of the Month October (first in list)
15717 eventId += 34;
15718
15719 if (lastEventId != eventId && IsEventActive(eventId) && HasAchieved(2796 /* Brew of the Month*/))
15720 {
15721 // Send Mail
15722 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
15723 MailSender sender(MAIL_CREATURE, 27487 /*NPC_BREW_OF_THE_MONTH_CLUB*/);
15724 MailDraft draft(uint16(212 + month)); // 212 is starting template id
15725 draft.SendMailTo(trans, MailReceiver(this, GetGUID().GetCounter()), sender);
15726
15727 // Update Event Id
15729 stmt->SetData(0, GetGUID().GetCounter());
15730 stmt->SetData(1, uint32(eventId));
15731 trans->Append(stmt);
15732
15733 CharacterDatabase.CommitTransaction(trans);
15734 }
15735}
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:70
@ CHAR_REP_BREW_OF_THE_MONTH
Definition: CharacterDatabase.h:103
bool IsEventActive(uint16 event_id)
Definition: GameEventMgr.cpp:1924
@ MAIL_CREATURE
Definition: Mail.h:40
AC_COMMON_API uint32 GetMonth(Seconds time=0s)
Definition: Timer.cpp:424
Definition: PreparedStatement.h:158
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78
bool HasAchieved(uint32 achievementId) const
Definition: Player.cpp:13831
Definition: Mail.h:84
Definition: Mail.h:106
Definition: Mail.h:120

References CHAR_REP_BREW_OF_THE_MONTH, CharacterDatabase, Field::Get(), Object::GetGUID(), Acore::Time::GetMonth(), HasAchieved(), IsEventActive(), MAIL_CREATURE, MailDraft::SendMailTo(), and PreparedStatementBase::SetData().

Referenced by LoadFromDB().

◆ _LoadCharacterSettings()

void Player::_LoadCharacterSettings ( PreparedQueryResult  result)
protected
27{
28 m_charSettingsMap.clear();
29
30 if (!sWorld->getBoolConfig(CONFIG_PLAYER_SETTINGS_ENABLED))
31 {
32 return;
33 }
34
35 if (result)
36 {
37 do
38 {
39 Field* fields = result->Fetch();
40
41 std::string source = fields[0].Get<std::string>();;
42 std::string data = fields[1].Get<std::string>();
43
44 std::vector<std::string_view> tokens = Acore::Tokenize(data, ' ', false);
45
46 PlayerSettingVector setting;
47 setting.resize(tokens.size());
48
49 uint32 count = 0;
50
51 for (auto& token : tokens)
52 {
53 if (token.empty())
54 {
55 continue;
56 }
57
58 PlayerSetting set;
59 set.value = Acore::StringTo<uint32>(token).value();
60 setting[count] = set;
61 ++count;
62 }
63
64 m_charSettingsMap[source] = setting;
65
66 } while (result->NextRow());
67 }
68}
std::vector< PlayerSetting > PlayerSettingVector
Definition: PlayerSettings.h:48
@ CONFIG_PLAYER_SETTINGS_ENABLED
Definition: IWorld.h:175
std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
Definition: Tokenize.cpp:20
PlayerSettingMap m_charSettingsMap
Definition: Player.h:2956
Definition: PlayerSettings.h:39
uint32 value
Definition: PlayerSettings.h:40

References CONFIG_PLAYER_SETTINGS_ENABLED, Field::Get(), m_charSettingsMap, sWorld, Acore::Tokenize(), and PlayerSetting::value.

Referenced by LoadFromDB().

◆ _LoadDailyQuestStatus()

void Player::_LoadDailyQuestStatus ( PreparedQueryResult  result)
protected
6372{
6373 for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
6374 SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, 0);
6375
6376 m_DFQuests.clear();
6377
6378 //QueryResult* result = CharacterDatabase.Query("SELECT quest, time FROM character_queststatus_daily WHERE guid = '{}'", GetGUID().GetCounter());
6379
6380 if (result)
6381 {
6382 uint32 quest_daily_idx = 0;
6383
6384 do
6385 {
6386 Field* fields = result->Fetch();
6387 if (Quest const* qQuest = sObjectMgr->GetQuestTemplate(fields[0].Get<uint32>()))
6388 {
6389 if (qQuest->IsDFQuest())
6390 {
6391 m_DFQuests.insert(qQuest->GetQuestId());
6392 m_lastDailyQuestTime = time_t(fields[1].Get<uint32>());
6393 continue;
6394 }
6395 }
6396
6397 if (quest_daily_idx >= PLAYER_MAX_DAILY_QUESTS) // max amount with exist data in query
6398 {
6399 LOG_ERROR("entities.player", "Player ({}) have more 25 daily quest records in `charcter_queststatus_daily`", GetGUID().ToString());
6400 break;
6401 }
6402
6403 uint32 quest_id = fields[0].Get<uint32>();
6404
6405 // save _any_ from daily quest times (it must be after last reset anyway)
6406 m_lastDailyQuestTime = time_t(fields[1].Get<uint32>());
6407
6408 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
6409 if (!quest)
6410 continue;
6411
6412 SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, quest_id);
6413 ++quest_daily_idx;
6414
6415 LOG_DEBUG("entities.player.loading", "Daily quest ({}) cooldown for player ({})", quest_id, GetGUID().ToString());
6416 } while (result->NextRow());
6417 }
6418
6419 m_DailyQuestChanged = false;
6420}
@ PLAYER_FIELD_DAILY_QUESTS_1
Definition: UpdateFields.h:385
#define PLAYER_MAX_DAILY_QUESTS
Definition: Player.h:72
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
DFQuestsDoneList m_DFQuests
Definition: Player.h:2373
Definition: QuestDef.h:207

References Field::Get(), Object::GetGUID(), LOG_DEBUG, LOG_ERROR, m_DailyQuestChanged, m_DFQuests, m_lastDailyQuestTime, PLAYER_FIELD_DAILY_QUESTS_1, PLAYER_MAX_DAILY_QUESTS, Object::SetUInt32Value(), sObjectMgr, and Position::ToString().

Referenced by LoadFromDB().

◆ _LoadDeclinedNames()

void Player::_LoadDeclinedNames ( PreparedQueryResult  result)
protected
4806{
4807 if (!result)
4808 return;
4809
4810 delete m_declinedname;
4812 for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
4813 m_declinedname->name[i] = (*result)[i].Get<std::string>();
4814}
#define MAX_DECLINED_NAME_CASES
Definition: Unit.h:981
Definition: Unit.h:984
std::string name[MAX_DECLINED_NAME_CASES]
Definition: Unit.h:985

References m_declinedname, MAX_DECLINED_NAME_CASES, and DeclinedName::name.

Referenced by LoadFromDB().

◆ _LoadEntryPointData()

void Player::_LoadEntryPointData ( PreparedQueryResult  result)
protected
4879{
4880 if (!result)
4881 return;
4882
4883 Field* fields = result->Fetch();
4884 m_entryPointData.joinPos = WorldLocation(fields[4].Get<uint32>(), // Map
4885 fields[0].Get<float>(), // X
4886 fields[1].Get<float>(), // Y
4887 fields[2].Get<float>(), // Z
4888 fields[3].Get<float>()); // Orientation
4889
4890 m_entryPointData.taxiPath[0] = fields[5].Get<uint32>();
4891 m_entryPointData.taxiPath[1] = fields[6].Get<uint32>();
4892 m_entryPointData.mountSpell = fields[7].Get<uint32>();
4893}
Definition: Position.h:251
uint32 mountSpell
Definition: Player.h:1047
std::array< uint32, 2 > taxiPath
Definition: Player.h:1048
WorldLocation joinPos
Definition: Player.h:1049
EntryPointData m_entryPointData
Definition: Player.h:2636

References Field::Get(), EntryPointData::joinPos, m_entryPointData, EntryPointData::mountSpell, and EntryPointData::taxiPath.

Referenced by LoadFromDB().

◆ _LoadEquipmentSets()

void Player::_LoadEquipmentSets ( PreparedQueryResult  result)
protected
4848{
4849 // SetQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '{}' ORDER BY setindex", m_guid.GetCounter());
4850 if (!result)
4851 return;
4852
4853 uint32 count = 0;
4854 do
4855 {
4856 Field* fields = result->Fetch();
4857 EquipmentSet eqSet;
4858
4859 eqSet.Guid = fields[0].Get<uint64>();
4860 uint8 index = fields[1].Get<uint8>();
4861 eqSet.Name = fields[2].Get<std::string>();
4862 eqSet.IconName = fields[3].Get<std::string>();
4863 eqSet.IgnoreMask = fields[4].Get<uint32>();
4865
4866 for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
4867 eqSet.Items[i] = ObjectGuid::Create<HighGuid::Item>(fields[5 + i].Get<uint32>());
4868
4869 m_EquipmentSets[index] = eqSet;
4870
4871 ++count;
4872
4873 if (count >= MAX_EQUIPMENT_SET_INDEX) // client limit
4874 break;
4875 } while (result->NextRow());
4876}
std::uint64_t uint64
Definition: Define.h:107
@ EQUIPMENT_SET_UNCHANGED
Definition: Player.h:743
#define MAX_EQUIPMENT_SET_INDEX
Definition: Player.h:761
@ EQUIPMENT_SLOT_END
Definition: Player.h:695
Definition: Player.h:750
ObjectGuid Items[EQUIPMENT_SLOT_END]
Definition: Player.h:757
std::string Name
Definition: Player.h:754
std::string IconName
Definition: Player.h:755
EquipmentSetUpdateState state
Definition: Player.h:758
uint64 Guid
Definition: Player.h:753
uint32 IgnoreMask
Definition: Player.h:756
EquipmentSets m_EquipmentSets
Definition: Player.h:2864

References EQUIPMENT_SET_UNCHANGED, EQUIPMENT_SLOT_END, Field::Get(), EquipmentSet::Guid, EquipmentSet::IconName, EquipmentSet::IgnoreMask, EquipmentSet::Items, m_EquipmentSets, MAX_EQUIPMENT_SET_INDEX, EquipmentSet::Name, and EquipmentSet::state.

Referenced by LoadFromDB().

◆ _LoadFriendList()

void Player::_LoadFriendList ( PreparedQueryResult  result)
protected

◆ _LoadGlyphAuras()

void Player::_LoadGlyphAuras ( )
protected
5805{
5806 for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
5807 {
5808 if (uint32 glyph = GetGlyph(i))
5809 {
5810 if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyph))
5811 {
5812 if (GlyphSlotEntry const* glyphSlotEntry = sGlyphSlotStore.LookupEntry(GetGlyphSlot(i)))
5813 {
5814 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(glyphEntry->SpellId);
5815 if (glyphEntry->TypeFlags == glyphSlotEntry->TypeFlags)
5816 {
5817 if (!spellInfo->Stances)
5819 continue;
5820 }
5821 else
5822 LOG_ERROR("entities.player", "Player {} has glyph with typeflags {} in slot with typeflags {}, removing.", m_name, glyphEntry->TypeFlags, glyphSlotEntry->TypeFlags);
5823 }
5824 else
5825 LOG_ERROR("entities.player", "Player {} has not existing glyph slot entry {} on index {}", m_name, GetGlyphSlot(i), i);
5826 }
5827 else
5828 LOG_ERROR("entities.player", "Player {} has not existing glyph entry {} on index {}", m_name, glyph, i);
5829
5830 // On any error remove glyph
5831 SetGlyph(i, 0, true);
5832 }
5833 }
5834}
DBCStorage< GlyphSlotEntry > sGlyphSlotStore(GlyphSlotfmt)
DBCStorage< GlyphPropertiesEntry > sGlyphPropertiesStore(GlyphPropertiesfmt)
TriggerCastFlags
Definition: SpellDefines.h:130
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition: SpellDefines.h:148
@ TRIGGERED_IGNORE_CASTER_AURASTATE
Will ignore shapeshift checks.
Definition: SpellDefines.h:143
@ TRIGGERED_IGNORE_SHAPESHIFT
Will not adjust facing to target (if any)
Definition: SpellDefines.h:142
std::string m_name
Definition: Object.h:624
uint32 GetGlyph(uint8 slot) const
Definition: Player.h:1733
uint32 GetGlyphSlot(uint8 slot) const
Definition: Player.h:1724
void SetGlyph(uint8 slot, uint32 glyph, bool save)
Definition: Player.h:1725
Definition: DBCStructure.h:1012
Definition: DBCStructure.h:1020

References Unit::CastSpell(), GetGlyph(), GetGlyphSlot(), LOG_ERROR, WorldObject::m_name, MAX_GLYPH_SLOT_INDEX, SetGlyph(), sGlyphPropertiesStore, sGlyphSlotStore, sSpellMgr, SpellInfo::Stances, TRIGGERED_FULL_MASK, TRIGGERED_IGNORE_CASTER_AURASTATE, and TRIGGERED_IGNORE_SHAPESHIFT.

Referenced by LoadFromDB().

◆ _LoadGlyphs()

void Player::_LoadGlyphs ( PreparedQueryResult  result)
protected
14874{
14875 // SELECT talentGroup, glyph1, glyph2, glyph3, glyph4, glyph5, glyph6 from character_glyphs WHERE guid = '%u'
14876 if (!result)
14877 return;
14878
14879 do
14880 {
14881 Field* fields = result->Fetch();
14882
14883 uint8 spec = fields[0].Get<uint8>();
14884 if (spec >= m_specsCount)
14885 continue;
14886
14887 m_Glyphs[spec][0] = fields[1].Get<uint16>();
14888 m_Glyphs[spec][1] = fields[2].Get<uint16>();
14889 m_Glyphs[spec][2] = fields[3].Get<uint16>();
14890 m_Glyphs[spec][3] = fields[4].Get<uint16>();
14891 m_Glyphs[spec][4] = fields[5].Get<uint16>();
14892 m_Glyphs[spec][5] = fields[6].Get<uint16>();
14893 } while (result->NextRow());
14894}

References Field::Get(), m_Glyphs, and m_specsCount.

Referenced by LoadFromDB().

◆ _LoadGroup()

void Player::_LoadGroup ( )
protected
6503{
6504 if (ObjectGuid groupId = sCharacterCache->GetCharacterGroupGuidByGuid(GetGUID()))
6505 {
6506 if (Group* group = sGroupMgr->GetGroupByGUID(groupId.GetCounter()))
6507 {
6508 if (group->GetMemberGroup(GetGUID()) <= MAX_RAID_SUBGROUPS)
6509 {
6510 if (group->IsLeader(GetGUID()))
6511 {
6513 }
6514
6515 uint8 subgroup = group->GetMemberGroup(GetGUID());
6516 SetGroup(group, subgroup);
6517
6518 // the group leader may change the instance difficulty while the player is offline
6519 SetDungeonDifficulty(group->GetDungeonDifficulty());
6520 SetRaidDifficulty(group->GetRaidDifficulty());
6521 }
6522 }
6523 }
6524
6525 if (!GetGroup() || !GetGroup()->IsLeader(GetGUID()))
6527}
@ PLAYER_FLAGS_GROUP_LEADER
Definition: Player.h:475
#define MAX_RAID_SUBGROUPS
Definition: Group.h:45
#define sGroupMgr
Definition: GroupMgr.h:51
void SetPlayerFlag(PlayerFlags flags)
Definition: Player.h:1101
void RemovePlayerFlag(PlayerFlags flags)
Definition: Player.h:1102
void SetDungeonDifficulty(Difficulty dungeon_difficulty)
Definition: Player.h:1887
void SetGroup(Group *group, int8 subgroup=-1)
Definition: Player.cpp:11478
void SetRaidDifficulty(Difficulty raid_difficulty)
Definition: Player.h:1888
Group * GetGroup()
Definition: Player.h:2431
Definition: Group.h:169

References GetGroup(), Object::GetGUID(), MAX_RAID_SUBGROUPS, PLAYER_FLAGS_GROUP_LEADER, RemovePlayerFlag(), sCharacterCache, SetDungeonDifficulty(), SetGroup(), SetPlayerFlag(), SetRaidDifficulty(), and sGroupMgr.

Referenced by LoadFromDB().

◆ _LoadHomeBind()

bool Player::_LoadHomeBind ( PreparedQueryResult  result)
protected
7010{
7011 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass());
7012 if (!info)
7013 {
7014 LOG_ERROR("entities.player", "Player (Name {}) has incorrect race/class pair. Can't be loaded.", GetName());
7015 return false;
7016 }
7017
7018 bool ok = false;
7019 // SELECT mapId, zoneId, posX, posY, posZ, pozO FROM character_homebind WHERE guid = ?
7020 if (result)
7021 {
7022 Field* fields = result->Fetch();
7023
7024 m_homebindMapId = fields[0].Get<uint16>();
7025 m_homebindAreaId = fields[1].Get<uint16>();
7026 m_homebindX = fields[2].Get<float>();
7027 m_homebindY = fields[3].Get<float>();
7028 m_homebindZ = fields[4].Get<float>();
7029 m_homebindO = fields[5].Get<float>();
7030
7031 MapEntry const* bindMapEntry = sMapStore.LookupEntry(m_homebindMapId);
7032
7033 // accept saved data only for valid position (and non instanceable), and accessable
7035 !bindMapEntry->Instanceable() && GetSession()->Expansion() >= bindMapEntry->Expansion())
7036 ok = true;
7037 else
7038 {
7040 stmt->SetData(0, GetGUID().GetCounter());
7041 CharacterDatabase.Execute(stmt);
7042 }
7043 }
7044
7045 if (!ok)
7046 {
7047 m_homebindMapId = info->mapId;
7048 m_homebindAreaId = info->areaId;
7049 m_homebindX = info->positionX;
7050 m_homebindY = info->positionY;
7051 m_homebindZ = info->positionZ;
7052 m_homebindO = info->orientation;
7054 stmt->SetData(0, GetGUID().GetCounter());
7055 stmt->SetData(1, m_homebindMapId);
7056 stmt->SetData(2, m_homebindAreaId);
7057 stmt->SetData(3, m_homebindX);
7058 stmt->SetData(4, m_homebindY);
7059 stmt->SetData(5, m_homebindZ);
7060 stmt->SetData(6, m_homebindO);
7061 CharacterDatabase.Execute(stmt);
7062 }
7063
7064 LOG_DEBUG("entities.player", "Setting player home position - mapid: {}, areaid: {}, X: {}, Y: {}, Z: {}, O: {}",
7066 return true;
7067}
@ CHAR_INS_PLAYER_HOMEBIND
Definition: CharacterDatabase.h:240
@ CHAR_DEL_PLAYER_HOMEBIND
Definition: CharacterDatabase.h:242
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
std::string const & GetName() const
Definition: Object.h:446
LowType GetCounter() const
Definition: ObjectGuid.h:147
Definition: Player.h:336
float orientation
Definition: Player.h:345
float positionX
Definition: Player.h:342
uint32 areaId
Definition: Player.h:341
float positionY
Definition: Player.h:343
float positionZ
Definition: Player.h:344
uint32 mapId
Definition: Player.h:340
uint8 getRace(bool original=false) const
Definition: Unit.cpp:21287
static bool IsValidMapCoord(uint32 mapid, Position const &pos)
Definition: MapMgr.h:91
uint8 Expansion() const
Definition: WorldSession.h:375
Definition: DBCStructure.h:1323

References PlayerInfo::areaId, CHAR_DEL_PLAYER_HOMEBIND, CHAR_INS_PLAYER_HOMEBIND, CharacterDatabase, WorldSession::Expansion(), Field::Get(), Unit::getClass(), ObjectGuid::GetCounter(), Object::GetGUID(), WorldObject::GetName(), Unit::getRace(), GetSession(), MapMgr::IsValidMapCoord(), LOG_DEBUG, LOG_ERROR, m_homebindAreaId, m_homebindMapId, m_homebindO, m_homebindX, m_homebindY, m_homebindZ, PlayerInfo::mapId, PlayerInfo::orientation, PlayerInfo::positionX, PlayerInfo::positionY, PlayerInfo::positionZ, PreparedStatementBase::SetData(), sMapStore, and sObjectMgr.

Referenced by LoadFromDB().

◆ _LoadInstanceTimeRestrictions()

void Player::_LoadInstanceTimeRestrictions ( PreparedQueryResult  result)
protected
15689{
15690 if (!result)
15691 return;
15692
15693 do
15694 {
15695 Field* fields = result->Fetch();
15696 _instanceResetTimes.insert(InstanceTimeMap::value_type(fields[0].Get<uint32>(), fields[1].Get<uint64>()));
15697 } while (result->NextRow());
15698}
InstanceTimeMap _instanceResetTimes
Definition: Player.h:2936

References _instanceResetTimes.

Referenced by LoadFromDB().

◆ _LoadInventory()

void Player::_LoadInventory ( PreparedQueryResult  result,
uint32  timeDiff 
)
protected
5857{
5858 //QueryResult* result = CharacterDatabase.Query("SELECT data, text, bag, slot, item, item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '{}' ORDER BY bag, slot", GetGUID().GetCounter());
5859 //NOTE: the "order by `bag`" is important because it makes sure
5860 //the bagMap is filled before items in the bags are loaded
5861 //NOTE2: the "order by `slot`" is needed because mainhand weapons are (wrongly?)
5862 //expected to be equipped before offhand items (TODO: fixme)
5863
5864 if (result)
5865 {
5866 uint32 zoneId = GetZoneId();
5867
5868 std::map<ObjectGuid::LowType, Bag*> bagMap; // fast guid lookup for bags
5869 std::map<ObjectGuid::LowType, Item*> invalidBagMap; // fast guid lookup for bags
5870 std::list<Item*> problematicItems;
5871 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
5872
5873 // Prevent items from being added to the queue while loading
5875 do
5876 {
5877 Field* fields = result->Fetch();
5878 if (Item* item = _LoadItem(trans, zoneId, timeDiff, fields))
5879 {
5880 ObjectGuid::LowType bagGuid = fields[11].Get<uint32>();
5881 uint8 slot = fields[12].Get<uint8>();
5882
5883 uint8 err = EQUIP_ERR_OK;
5884 // Item is not in bag
5885 if (!bagGuid)
5886 {
5887 item->SetContainer(nullptr);
5888 item->SetSlot(slot);
5889
5891 {
5892 ItemPosCountVec dest;
5893 err = CanStoreItem(INVENTORY_SLOT_BAG_0, slot, dest, item, false);
5894 if (err == EQUIP_ERR_OK)
5895 item = StoreItem(dest, item, true);
5896 }
5897 else if (IsEquipmentPos(INVENTORY_SLOT_BAG_0, slot))
5898 {
5899 uint16 dest;
5900 if (sScriptMgr->CheckItemInSlotAtLoadInventory(this, item, slot, err, dest))
5901 err = CanEquipItem(slot, dest, item, false, false);
5902 if (err == EQUIP_ERR_OK)
5903 QuickEquipItem(dest, item);
5904 }
5905 else if (IsBankPos(INVENTORY_SLOT_BAG_0, slot))
5906 {
5907 ItemPosCountVec dest;
5908 err = CanBankItem(INVENTORY_SLOT_BAG_0, slot, dest, item, false, false);
5909 if (err == EQUIP_ERR_OK)
5910 item = BankItem(dest, item, true);
5911 }
5912
5913 // Remember bags that may contain items in them
5914 if (err == EQUIP_ERR_OK)
5915 {
5916 if (IsBagPos(item->GetPos()))
5917 if (Bag* pBag = item->ToBag())
5918 bagMap[item->GetGUID().GetCounter()] = pBag;
5919 }
5920 else if (IsBagPos(item->GetPos()))
5921 if (item->IsBag())
5922 invalidBagMap[item->GetGUID().GetCounter()] = item;
5923 }
5924 else
5925 {
5926 item->SetSlot(NULL_SLOT);
5927 // Item is in the bag, find the bag
5928 std::map<ObjectGuid::LowType, Bag*>::iterator itr = bagMap.find(bagGuid);
5929 if (itr != bagMap.end())
5930 {
5931 ItemPosCountVec dest;
5932 err = CanStoreItem(itr->second->GetSlot(), slot, dest, item);
5933 if (err == EQUIP_ERR_OK)
5934 item = StoreItem(dest, item, true);
5935 }
5936 else if (invalidBagMap.find(bagGuid) != invalidBagMap.end())
5937 {
5938 std::map<ObjectGuid::LowType, Item*>::iterator iterator = invalidBagMap.find(bagGuid);
5939 if (std::find(problematicItems.begin(), problematicItems.end(), iterator->second) != problematicItems.end())
5940 {
5942 }
5943 }
5944 else
5945 {
5946 LOG_ERROR("entities.player", "Player::_LoadInventory: player ({}, name: '{}') has item ({}, entry: {}) which doesnt have a valid bag (Bag GUID: {}, slot: {}). Possible cheat?",
5947 GetGUID().ToString(), GetName(), item->GetGUID().ToString(), item->GetEntry(), bagGuid, slot);
5948 item->DeleteFromInventoryDB(trans);
5949 delete item;
5950 continue;
5951 }
5952 }
5953
5954 // Item's state may have changed after storing
5955 if (err == EQUIP_ERR_OK)
5956 item->SetState(ITEM_UNCHANGED, this);
5957 else
5958 {
5959 LOG_ERROR("entities.player", "Player::_LoadInventory: player ({}, name: '{}') has item ({}, entry: {}) which can't be loaded into inventory (Bag GUID: {}, slot: {}) by reason {}. Item will be sent by mail.",
5960 GetGUID().ToString(), GetName(), item->GetGUID().ToString(), item->GetEntry(), bagGuid, slot, err);
5961 item->DeleteFromInventoryDB(trans);
5962 problematicItems.push_back(item);
5963 }
5964 }
5965 } while (result->NextRow());
5966
5968
5969 // Send problematic items by mail
5970 while (!problematicItems.empty())
5971 {
5972 std::string subject = GetSession()->GetAcoreString(LANG_NOT_EQUIPPED_ITEM);
5973
5974 MailDraft draft(subject, "There were problems with equipping item(s).");
5975 for (uint8 i = 0; !problematicItems.empty() && i < MAX_MAIL_ITEMS; ++i)
5976 {
5977 draft.AddItem(problematicItems.front());
5978 problematicItems.pop_front();
5979 }
5980 draft.SendMailTo(trans, this, MailSender(this, MAIL_STATIONERY_GM), MAIL_CHECK_MASK_COPIED);
5981 }
5982 CharacterDatabase.CommitTransaction(trans);
5983 }
5984 //if (IsAlive())
5986}
@ EQUIP_ERR_OK
Definition: Item.h:41
@ EQUIP_ERR_INT_BAG_ERROR
Definition: Item.h:81
@ ITEM_UNCHANGED
Definition: Item.h:203
std::vector< ItemPosCount > ItemPosCountVec
Definition: Player.h:772
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:671
@ NULL_SLOT
Definition: Unit.h:211
#define MAX_MAIL_ITEMS
Definition: Mail.h:34
@ MAIL_CHECK_MASK_COPIED
This mail was returned. Do not allow returning mail back again.
Definition: Mail.h:50
@ MAIL_STATIONERY_GM
Definition: Mail.h:60
@ LANG_NOT_EQUIPPED_ITEM
Definition: Language.h:654
Definition: Bag.h:28
Bag * ToBag()
Definition: Item.h:244
uint32 GetZoneId() const
Definition: Object.cpp:3100
uint32 LowType
Definition: ObjectGuid.h:124
static bool IsEquipmentPos(uint16 pos)
Definition: Player.h:1244
InventoryResult CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading=true) const
Definition: PlayerStorage.cpp:1833
void QuickEquipItem(uint16 pos, Item *pItem)
Definition: PlayerStorage.cpp:2857
Item * BankItem(ItemPosCountVec const &dest, Item *pItem, bool update)
Definition: Player.h:1313
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap=false) const
Definition: Player.h:1264
Item * StoreItem(ItemPosCountVec const &pos, Item *pItem, bool update)
Definition: PlayerStorage.cpp:2596
static bool IsInventoryPos(uint16 pos)
Definition: Player.h:1242
Item * _LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint32 timeDiff, Field *fields)
Definition: PlayerStorage.cpp:5988
static bool IsBagPos(uint16 pos)
Definition: PlayerStorage.cpp:618
InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading=true) const
Definition: PlayerStorage.cpp:2052
static bool IsBankPos(uint16 pos)
Definition: Player.h:1247
char const * GetAcoreString(uint32 entry) const
Definition: WorldSession.cpp:820

References _ApplyAllItemMods(), _LoadItem(), MailDraft::AddItem(), BankItem(), CanBankItem(), CanEquipItem(), CanStoreItem(), CharacterDatabase, EQUIP_ERR_INT_BAG_ERROR, EQUIP_ERR_OK, Field::Get(), WorldSession::GetAcoreString(), Object::GetGUID(), WorldObject::GetName(), GetSession(), WorldObject::GetZoneId(), INVENTORY_SLOT_BAG_0, IsBagPos(), IsBankPos(), IsEquipmentPos(), IsInventoryPos(), ITEM_UNCHANGED, LANG_NOT_EQUIPPED_ITEM, LOG_ERROR, m_itemUpdateQueueBlocked, MAIL_CHECK_MASK_COPIED, MAIL_STATIONERY_GM, MAX_MAIL_ITEMS, NULL_SLOT, QuickEquipItem(), MailDraft::SendMailTo(), sScriptMgr, StoreItem(), Item::ToBag(), and Position::ToString().

Referenced by LoadFromDB().

◆ _LoadItem()

Item * Player::_LoadItem ( CharacterDatabaseTransaction  trans,
uint32  zoneId,
uint32  timeDiff,
Field fields 
)
private
5989{
5990 Item* item = nullptr;
5991 ObjectGuid::LowType itemGuid = fields[13].Get<uint32>();
5992 uint32 itemEntry = fields[14].Get<uint32>();
5993 if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry))
5994 {
5995 bool remove = false;
5996 item = NewItemOrBag(proto);
5997 if (item->LoadFromDB(itemGuid, GetGUID(), fields, itemEntry))
5998 {
5999 CharacterDatabasePreparedStatement* stmt = nullptr;
6000
6001 // Do not allow to have item limited to another map/zone in alive state
6002 if (IsAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zoneId))
6003 {
6004 LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player ({}, name: '{}', map: {}) has item ({}, entry: {}) limited to another map ({}). Deleting item.",
6005 GetGUID().ToString(), GetName(), GetMapId(), item->GetGUID().ToString(), item->GetEntry(), zoneId);
6006 remove = true;
6007 }
6008 // "Conjured items disappear if you are logged out for more than 15 minutes"
6009 else if (timeDiff > 15 * MINUTE && proto->Flags & ITEM_FLAG_CONJURED)
6010 {
6011 LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player ({}, name: '{}', diff: {}) has conjured item ({}, entry: {}) with expired lifetime (15 minutes). Deleting item.",
6012 GetGUID().ToString(), GetName(), timeDiff, item->GetGUID().ToString(), item->GetEntry());
6013 remove = true;
6014 }
6016 {
6017 if (item->GetPlayedTime() > (2 * HOUR))
6018 {
6019 LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player ({}, name: '{}') has item ({}, entry: {}) with expired refund time ({}). Deleting refund data and removing refundable flag.",
6020 GetGUID().ToString(), GetName(), item->GetGUID().ToString(), item->GetEntry(), item->GetPlayedTime());
6021 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE);
6022 stmt->SetData(0, item->GetGUID().GetCounter());
6023 trans->Append(stmt);
6024
6026 }
6027 else
6028 {
6029 // xinef: sync query
6030 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_REFUNDS);
6031 stmt->SetData(0, item->GetGUID().GetCounter());
6032 stmt->SetData(1, GetGUID().GetCounter());
6033 if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
6034 {
6035 item->SetRefundRecipient((*result)[0].Get<uint32>());
6036 item->SetPaidMoney((*result)[1].Get<uint32>());
6037 item->SetPaidExtendedCost((*result)[2].Get<uint16>());
6038 AddRefundReference(item->GetGUID());
6039 }
6040 else
6041 {
6042 LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player ({}, name: '{}') has item ({}, entry: {}) with refundable flags, but without data in item_refund_instance. Removing flag.",
6043 GetGUID().ToString(), GetName(), item->GetGUID().ToString(), item->GetEntry());
6045 }
6046 }
6047 }
6049 {
6050 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_BOP_TRADE);
6051 stmt->SetData(0, item->GetGUID().GetCounter());
6052
6053 if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
6054 {
6055 AllowedLooterSet looters;
6056 for (std::string_view guidStr : Acore::Tokenize((*result)[0].Get<std::string_view>(), ' ', false))
6057 {
6058 if (Optional<ObjectGuid::LowType> guid = Acore::StringTo<ObjectGuid::LowType>(guidStr))
6059 {
6060 looters.insert(ObjectGuid::Create<HighGuid::Player>(*guid));
6061 }
6062 else
6063 {
6064 LOG_WARN("entities.player.loading", "Player::_LoadInventory: invalid item_soulbound_trade_data GUID '{}' for item {}. Skipped.", guidStr, item->GetGUID().ToString());
6065 }
6066 }
6067
6068 if (looters.size() > 1 && item->GetTemplate()->GetMaxStackSize() == 1 && item->IsSoulBound())
6069 {
6070 item->SetSoulboundTradeable(looters);
6071 AddTradeableItem(item);
6072 }
6073 else
6074 item->ClearSoulboundTradeable(this);
6075 }
6076 else
6077 {
6078 LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player ({}, name: '{}') has item ({}, entry: {}) with ITEM_FIELD_FLAG_BOP_TRADEABLE flag, but without data in item_soulbound_trade_data. Removing flag.",
6079 GetGUID().ToString(), GetName(), item->GetGUID().ToString(), item->GetEntry());
6081 }
6082 }
6083 else if (proto->HolidayId)
6084 {
6085 remove = true;
6086 GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
6087 GameEventMgr::ActiveEvents const& activeEventsList = sGameEventMgr->GetActiveEventList();
6088 for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr)
6089 {
6090 if (uint32(events[*itr].holiday_id) == proto->HolidayId)
6091 {
6092 remove = false;
6093 break;
6094 }
6095 }
6096 }
6097 }
6098 else
6099 {
6100 LOG_ERROR("entities.player", "Player::_LoadInventory: player ({}, name: '{}') has broken item (GUID: {}, entry: {}) in inventory. Deleting item.",
6101 GetGUID().ToString(), GetName(), itemGuid, itemEntry);
6102 remove = true;
6103 }
6104 // Remove item from inventory if necessary
6105 if (remove)
6106 {
6107 Item::DeleteFromInventoryDB(trans, itemGuid);
6108 item->FSetState(ITEM_REMOVED);
6109 item->SaveToDB(trans); // it also deletes item object!
6110 item = nullptr;
6111 }
6112 }
6113 else
6114 {
6115 LOG_ERROR("entities.player", "Player::_LoadInventory: player ({}, name: '{}') has unknown item (entry: {}) in inventory. Deleting item.",
6116 GetGUID().ToString(), GetName(), itemEntry);
6117 Item::DeleteFromInventoryDB(trans, itemGuid);
6118 Item::DeleteFromDB(trans, itemGuid);
6119 }
6120 return item;
6121}
constexpr auto HOUR
Definition: Common.h:50
constexpr auto MINUTE
Definition: Common.h:49
#define LOG_WARN(filterType__,...)
Definition: Log.h:161
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:24
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: DatabaseEnvFwd.h:46
@ CHAR_DEL_ITEM_REFUND_INSTANCE
Definition: CharacterDatabase.h:371
@ CHAR_SEL_ITEM_BOP_TRADE
Definition: CharacterDatabase.h:120
@ CHAR_SEL_ITEM_REFUNDS
Definition: CharacterDatabase.h:119
Item * NewItemOrBag(ItemTemplate const *proto)
Definition: Bag.h:67
@ ITEM_REMOVED
Definition: Item.h:206
@ ITEM_FIELD_FLAG_REFUNDABLE
Definition: ItemTemplate.h:122
@ ITEM_FIELD_FLAG_BOP_TRADEABLE
Definition: ItemTemplate.h:118
@ ITEM_FLAG_CONJURED
Definition: ItemTemplate.h:149
@ ITEM_FIELD_FLAGS
Definition: UpdateFields.h:42
#define sGameEventMgr
Definition: GameEventMgr.h:186
GuidSet AllowedLooterSet
Definition: LootMgr.h:152
events
Definition: boss_sartura.cpp:43
uint32 GetPlayedTime()
Definition: Item.cpp:1247
static void DeleteFromInventoryDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
Definition: Item.cpp:533
virtual bool LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field *fields, uint32 entry)
Definition: Item.cpp:420
virtual void SaveToDB(CharacterDatabaseTransaction trans)
Definition: Item.cpp:337
bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const
Definition: Item.cpp:1057
void SetSoulboundTradeable(AllowedLooterSet &allowedLooters)
Definition: Item.cpp:1259
void SetPaidMoney(uint32 money)
Definition: Item.h:336
bool IsSoulBound() const
Definition: Item.h:230
void SetRefundRecipient(ObjectGuid::LowType pGuidLow)
Definition: Item.h:335
void FSetState(ItemUpdateState state)
Definition: Item.h:321
void SetPaidExtendedCost(uint32 iece)
Definition: Item.h:337
void ClearSoulboundTradeable(Player *currentOwner)
Definition: Item.cpp:1265
static void DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
Definition: Item.cpp:519
uint32 GetMaxStackSize() const
Definition: ItemTemplate.h:738
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:860
uint32 GetEntry() const
Definition: Object.h:109
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:889
uint32 GetMapId() const
Definition: Position.h:276
void AddRefundReference(ObjectGuid itemGUID)
Definition: Player.cpp:15426
void AddTradeableItem(Item *item)
Definition: PlayerStorage.cpp:4154
bool IsAlive() const
Definition: Unit.h:1822
std::vector< GameEventData > GameEventDataMap
Definition: GameEventMgr.h:107
std::set< uint16 > ActiveEvents
Definition: GameEventMgr.h:106

References AddRefundReference(), AddTradeableItem(), CHAR_DEL_ITEM_REFUND_INSTANCE, CHAR_SEL_ITEM_BOP_TRADE, CHAR_SEL_ITEM_REFUNDS, CharacterDatabase, Item::ClearSoulboundTradeable(), Item::DeleteFromDB(), Item::DeleteFromInventoryDB(), Item::FSetState(), Field::Get(), ObjectGuid::GetCounter(), Object::GetEntry(), Object::GetGUID(), WorldLocation::GetMapId(), ItemTemplate::GetMaxStackSize(), WorldObject::GetName(), Item::GetPlayedTime(), Item::GetTemplate(), Object::HasFlag(), HOUR, Unit::IsAlive(), Item::IsLimitedToAnotherMapOrZone(), Item::IsSoulBound(), ITEM_FIELD_FLAG_BOP_TRADEABLE, ITEM_FIELD_FLAG_REFUNDABLE, ITEM_FIELD_FLAGS, ITEM_FLAG_CONJURED, ITEM_REMOVED, Item::LoadFromDB(), LOG_DEBUG, LOG_ERROR, LOG_WARN, MINUTE, NewItemOrBag(), Object::RemoveFlag(), Item::SaveToDB(), PreparedStatementBase::SetData(), Item::SetPaidExtendedCost(), Item::SetPaidMoney(), Item::SetRefundRecipient(), Item::SetSoulboundTradeable(), sGameEventMgr, sObjectMgr, Acore::Tokenize(), ObjectGuid::ToString(), and Position::ToString().

Referenced by _LoadInventory().

◆ _LoadMail()

void Player::_LoadMail ( PreparedQueryResult  mailsResult,
PreparedQueryResult  mailItemsResult 
)
protected
6177{
6178 time_t cur_time = GameTime::GetGameTime().count();
6179
6180 m_mail.clear();
6181
6182 std::unordered_map<uint32, Mail*> mailById;
6183
6184 if (mailsResult)
6185 {
6186 do
6187 {
6188 Field* fields = mailsResult->Fetch();
6189 Mail* m = new Mail;
6190
6191 m->messageID = fields[0].Get<uint32>();
6192 m->messageType = fields[1].Get<uint8>();
6193 m->sender = fields[2].Get<uint32>();
6194 m->receiver = fields[3].Get<uint32>();
6195 m->subject = fields[4].Get<std::string>();
6196 m->body = fields[5].Get<std::string>();
6197 m->expire_time = time_t(fields[6].Get<uint32>());
6198 m->deliver_time = time_t(fields[7].Get<uint32>());
6199 m->money = fields[8].Get<uint32>();
6200 m->COD = fields[9].Get<uint32>();
6201 m->checked = fields[10].Get<uint8>();
6202 m->stationery = fields[11].Get<uint8>();
6203 m->mailTemplateId = fields[12].Get<int16>();
6204
6205 if (cur_time > m->expire_time)
6206 {
6207 LOG_DEBUG("entities.player", "Player::_LoadMail: Mail ({}) has expired - ignored.", m->messageID);
6208 continue;
6209 }
6210
6211 if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId))
6212 {
6213 LOG_ERROR("entities.player", "Player::_LoadMail: Mail ({}) has nonexistent MailTemplateId ({}), remove at load", m->messageID, m->mailTemplateId);
6214 m->mailTemplateId = 0;
6215 }
6216
6218
6219 m_mail.push_back(m);
6220 mailById[m->messageID] = m;
6221 } while (mailsResult->NextRow());
6222 }
6223
6224 if (mailItemsResult)
6225 {
6226 do
6227 {
6228 Field* fields = mailItemsResult->Fetch();
6229 uint32 mailId = fields[14].Get<uint32>();
6230 _LoadMailedItem(GetGUID(), this, mailId, mailById[mailId], fields);
6231 } while (mailItemsResult->NextRow());
6232 }
6233
6235}
std::int16_t int16
Definition: Define.h:105
DBCStorage< MailTemplateEntry > sMailTemplateStore(MailTemplateEntryfmt)
@ MAIL_STATE_UNCHANGED
Definition: Mail.h:69
void UpdateNextMailTimeAndUnreads()
Definition: PlayerUpdates.cpp:434
static Item * _LoadMailedItem(ObjectGuid const &playerGuid, Player *player, uint32 mailId, Mail *mail, Field *fields)
Definition: PlayerStorage.cpp:6124
Definition: Mail.h:168
ObjectGuid::LowType receiver
Definition: Mail.h:174
uint8 messageType
Definition: Mail.h:170
uint32 messageID
Definition: Mail.h:169
time_t expire_time
Definition: Mail.h:179
uint32 sender
Definition: Mail.h:173
uint8 stationery
Definition: Mail.h:171
std::string subject
Definition: Mail.h:175
std::string body
Definition: Mail.h:176
time_t deliver_time
Definition: Mail.h:180
uint32 COD
Definition: Mail.h:182
uint32 checked
Definition: Mail.h:183
MailState state
Definition: Mail.h:184
uint32 money
Definition: Mail.h:181
uint16 mailTemplateId
Definition: Mail.h:172

References _LoadMailedItem(), Mail::body, Mail::checked, Mail::COD, Mail::deliver_time, Mail::expire_time, Field::Get(), GameTime::GetGameTime(), Object::GetGUID(), LOG_DEBUG, LOG_ERROR, m_mail, MAIL_STATE_UNCHANGED, Mail::mailTemplateId, Mail::messageID, Mail::messageType, Mail::money, Mail::receiver, Mail::sender, sMailTemplateStore, Mail::state, Mail::stationery, Mail::subject, and UpdateNextMailTimeAndUnreads().

Referenced by LoadFromDB().

◆ _LoadMailedItem()

Item * Player::_LoadMailedItem ( ObjectGuid const &  playerGuid,
Player player,
uint32  mailId,
Mail mail,
Field fields 
)
staticprotected
6125{
6126 ObjectGuid::LowType itemGuid = fields[11].Get<uint32>();
6127 uint32 itemEntry = fields[12].Get<uint32>();
6128
6129 ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
6130 if (!proto)
6131 {
6132 LOG_ERROR("entities.player", "Player {} ({}) has unknown item in mailed items (GUID: {}, Entry: {}) in mail ({}), deleted.",
6133 player ? player->GetName() : "<unknown>", playerGuid.ToString(), itemGuid, itemEntry, mailId);
6134
6135 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
6136
6138 stmt->SetData(0, itemGuid);
6139 trans->Append(stmt);
6140
6141 CharacterDatabase.CommitTransaction(trans);
6142 return nullptr;
6143 }
6144
6145 Item* item = NewItemOrBag(proto);
6146
6147 ObjectGuid ownerGuid = fields[13].Get<uint32>() ? ObjectGuid::Create<HighGuid::Player>(fields[13].Get<uint32>()) : ObjectGuid::Empty;
6148 if (!item->LoadFromDB(itemGuid, ownerGuid, fields, itemEntry))
6149 {
6150 LOG_ERROR("entities.player", "Player::_LoadMailedItems: Item (GUID: {}) in mail ({}) doesn't exist, deleted from mail.", itemGuid, mailId);
6151
6153 stmt->SetData(0, itemGuid);
6154 CharacterDatabase.Execute(stmt);
6155
6156 item->FSetState(ITEM_REMOVED);
6157
6159 item->SaveToDB(temp);
6160 return nullptr;
6161 }
6162
6163 if (mail)
6164 {
6165 mail->AddItem(itemGuid, itemEntry);
6166 }
6167
6168 if (player)
6169 {
6170 player->AddMItem(item);
6171 }
6172
6173 return item;
6174}
@ CHAR_DEL_INVALID_MAIL_ITEM
Definition: CharacterDatabase.h:113
@ CHAR_DEL_MAIL_ITEM
Definition: CharacterDatabase.h:112
static ObjectGuid const Empty
Definition: ObjectGuid.h:122
void AddMItem(Item *it)
Definition: Player.h:1645
void AddItem(ObjectGuid::LowType itemGuidLow, uint32 item_template)
Definition: Mail.h:186

References Mail::AddItem(), AddMItem(), CHAR_DEL_INVALID_MAIL_ITEM, CHAR_DEL_MAIL_ITEM, CharacterDatabase, ObjectGuid::Empty, Item::FSetState(), Field::Get(), WorldObject::GetName(), ITEM_REMOVED, Item::LoadFromDB(), LOG_ERROR, NewItemOrBag(), Item::SaveToDB(), PreparedStatementBase::SetData(), sObjectMgr, and ObjectGuid::ToString().

Referenced by _LoadMail(), and DeleteFromDB().

◆ _LoadMonthlyQuestStatus()

void Player::_LoadMonthlyQuestStatus ( PreparedQueryResult  result)
protected
6468{
6469 m_monthlyquests.clear();
6470
6471 if (result)
6472 {
6473 do
6474 {
6475 Field* fields = result->Fetch();
6476 uint32 quest_id = fields[0].Get<uint32>();
6477 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
6478 if (!quest)
6479 continue;
6480
6481 m_monthlyquests.insert(quest_id);
6482 LOG_DEBUG("entities.player.loading", "Monthly quest {{}} cooldown for player ({})", quest_id, GetGUID().ToString());
6483 } while (result->NextRow());
6484 }
6485
6486 m_MonthlyQuestChanged = false;
6487}
QuestSet m_monthlyquests
Definition: Player.h:2648

References Field::Get(), Object::GetGUID(), LOG_DEBUG, m_MonthlyQuestChanged, m_monthlyquests, sObjectMgr, and Position::ToString().

Referenced by LoadFromDB().

◆ _LoadPetStable()

void Player::_LoadPetStable ( uint8  petStableSlots,
PreparedQueryResult  result 
)
protected
15738{
15739 if (!petStableSlots && !result)
15740 return;
15741
15742 m_petStable = std::make_unique<PetStable>();
15743 m_petStable->MaxStabledPets = petStableSlots;
15744
15745 if (m_petStable->MaxStabledPets > MAX_PET_STABLES)
15746 {
15747 LOG_ERROR("entities.player", "Player::LoadFromDB: Player ({}) can't have more stable slots than {}, but has {} in DB",
15748 GetGUID().ToString(), MAX_PET_STABLES, m_petStable->MaxStabledPets);
15749
15750 m_petStable->MaxStabledPets = MAX_PET_STABLES;
15751 }
15752
15753 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
15754 // SELECT id, entry, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType FROM character_pet WHERE owner = ?
15755 if (result)
15756 {
15757 do
15758 {
15759 Field* fields = result->Fetch();
15760 PetStable::PetInfo petInfo;
15761 petInfo.PetNumber = fields[0].Get<uint32>();
15762 petInfo.CreatureId = fields[1].Get<uint32>();
15763 petInfo.DisplayId = fields[2].Get<uint32>();
15764 petInfo.Level = fields[3].Get<uint16>();
15765 petInfo.Experience = fields[4].Get<uint32>();
15766 petInfo.ReactState = ReactStates(fields[5].Get<uint8>());
15767 PetSaveMode slot = PetSaveMode(fields[6].Get<uint8>());
15768 petInfo.Name = fields[7].Get<std::string>();
15769 petInfo.WasRenamed = fields[8].Get<bool>();
15770 petInfo.Health = fields[9].Get<uint32>();
15771 petInfo.Mana = fields[10].Get<uint32>();
15772 petInfo.Happiness = fields[11].Get<uint32>();
15773 petInfo.ActionBar = fields[12].Get<std::string>();
15774 petInfo.LastSaveTime = fields[13].Get<uint32>();
15775 petInfo.CreatedBySpellId = fields[14].Get<uint32>();
15776 petInfo.Type = PetType(fields[15].Get<uint8>());
15777
15778 if (slot == PET_SAVE_AS_CURRENT)
15779 m_petStable->CurrentPet = std::move(petInfo);
15780 else if (slot >= PET_SAVE_FIRST_STABLE_SLOT && slot <= PET_SAVE_LAST_STABLE_SLOT)
15781 m_petStable->StabledPets[slot - 1] = std::move(petInfo);
15782 else if (slot == PET_SAVE_NOT_IN_SLOT)
15783 m_petStable->UnslottedPets.push_back(std::move(petInfo));
15784
15785 } while (result->NextRow());
15786 }
15787}
PetSaveMode
Definition: PetDefines.h:40
@ PET_SAVE_FIRST_STABLE_SLOT
Definition: PetDefines.h:43
@ PET_SAVE_LAST_STABLE_SLOT
Definition: PetDefines.h:44
@ PET_SAVE_NOT_IN_SLOT
Definition: PetDefines.h:45
@ PET_SAVE_AS_CURRENT
Definition: PetDefines.h:42
PetType
Definition: PetDefines.h:30
constexpr auto MAX_PET_STABLES
Definition: PetDefines.h:36
ReactStates
Definition: Unit.h:1034
Definition: PetDefines.h:205
uint32 Mana
Definition: PetDefines.h:215
uint32 Happiness
Definition: PetDefines.h:216
uint32 CreatedBySpellId
Definition: PetDefines.h:218
uint32 Health
Definition: PetDefines.h:214
uint32 CreatureId
Definition: PetDefines.h:211
bool WasRenamed
Definition: PetDefines.h:222
uint8 Level
Definition: PetDefines.h:219
uint32 DisplayId
Definition: PetDefines.h:212
ReactStates ReactState
Definition: PetDefines.h:220
std::string Name
Definition: PetDefines.h:208
PetType Type
Definition: PetDefines.h:221
uint32 Experience
Definition: PetDefines.h:213
uint32 PetNumber
Definition: PetDefines.h:210
uint32 LastSaveTime
Definition: PetDefines.h:217
std::string ActionBar
Definition: PetDefines.h:209
std::unique_ptr< PetStable > m_petStable
Definition: Player.h:2923

References PetStable::PetInfo::ActionBar, PetStable::PetInfo::CreatedBySpellId, PetStable::PetInfo::CreatureId, PetStable::PetInfo::DisplayId, PetStable::PetInfo::Experience, Field::Get(), Object::GetGUID(), PetStable::PetInfo::Happiness, PetStable::PetInfo::Health, PetStable::PetInfo::LastSaveTime, PetStable::PetInfo::Level, LOG_ERROR, m_petStable, PetStable::PetInfo::Mana, MAX_PET_STABLES, PetStable::PetInfo::Name, PET_SAVE_AS_CURRENT, PET_SAVE_FIRST_STABLE_SLOT, PET_SAVE_LAST_STABLE_SLOT, PET_SAVE_NOT_IN_SLOT, PetStable::PetInfo::PetNumber, PetStable::PetInfo::ReactState, Position::ToString(), PetStable::PetInfo::Type, and PetStable::PetInfo::WasRenamed.

Referenced by LoadFromDB().

◆ _LoadQuestStatus()

void Player::_LoadQuestStatus ( PreparedQueryResult  result)
protected
6250{
6251 uint16 slot = 0;
6252
6254 //QueryResult* result = CharacterDatabase.Query("SELECT quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3,
6255 // 11 12 13 14
6256 // itemcount4, itemcount5, itemcount6, playercount FROM character_queststatus WHERE guid = '{}'", GetGUID().GetCounter());
6257
6258 if (result)
6259 {
6260 do
6261 {
6262 Field* fields = result->Fetch();
6263
6264 uint32 quest_id = fields[0].Get<uint32>();
6265 // used to be new, no delete?
6266 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
6267 if (quest)
6268 {
6269 // find or create
6270 QuestStatusData& questStatusData = m_QuestStatus[quest_id];
6271
6272 uint8 qstatus = fields[1].Get<uint8>();
6273 if (qstatus < MAX_QUEST_STATUS)
6274 questStatusData.Status = QuestStatus(qstatus);
6275 else
6276 {
6277 questStatusData.Status = QUEST_STATUS_INCOMPLETE;
6278 LOG_ERROR("entities.player", "Player {} ({}) has invalid quest {} status ({}), replaced by QUEST_STATUS_INCOMPLETE(3).",
6279 GetName(), GetGUID().ToString(), quest_id, qstatus);
6280 }
6281
6282 questStatusData.Explored = (fields[2].Get<uint8>() > 0);
6283
6284 time_t quest_time = time_t(fields[3].Get<uint32>());
6285
6286 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED) && !GetQuestRewardStatus(quest_id))
6287 {
6288 AddTimedQuest(quest_id);
6289
6290 if (quest_time <= GameTime::GetGameTime().count())
6291 questStatusData.Timer = 1;
6292 else
6293 questStatusData.Timer = uint32((quest_time - GameTime::GetGameTime().count()) * IN_MILLISECONDS);
6294 }
6295 else
6296 quest_time = 0;
6297
6298 for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
6299 questStatusData.CreatureOrGOCount[i] = fields[4 + i].Get<uint16>();
6300
6301 for (uint32 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
6302 questStatusData.ItemCount[i] = fields[8 + i].Get<uint16>();
6303
6304 questStatusData.PlayerCount = fields[14].Get<uint16>();
6305
6306 // add to quest log
6307 if (slot < MAX_QUEST_LOG_SIZE && questStatusData.Status != QUEST_STATUS_NONE)
6308 {
6309 SetQuestSlot(slot, quest_id, uint32(quest_time)); // cast can't be helped
6310
6311 if (questStatusData.Status == QUEST_STATUS_COMPLETE)
6313 else if (questStatusData.Status == QUEST_STATUS_FAILED)
6315
6316 for (uint8 idx = 0; idx < QUEST_OBJECTIVES_COUNT; ++idx)
6317 if (questStatusData.CreatureOrGOCount[idx])
6318 SetQuestSlotCounter(slot, idx, questStatusData.CreatureOrGOCount[idx]);
6319
6320 if (questStatusData.PlayerCount)
6321 SetQuestSlotCounter(slot, QUEST_PVP_KILL_SLOT, questStatusData.PlayerCount);
6322
6323 ++slot;
6324 }
6325
6326 LOG_DEBUG("entities.player.loading", "Quest status is {{}} for quest {{}} for player ({})", questStatusData.Status, quest_id, GetGUID().ToString());
6327 }
6328 } while (result->NextRow());
6329 }
6330
6331 // clear quest log tail
6332 for (uint16 i = slot; i < MAX_QUEST_LOG_SIZE; ++i)
6333 SetQuestSlot(i, 0);
6334}
@ QUEST_STATE_COMPLETE
Definition: Player.h:634
@ QUEST_STATE_FAIL
Definition: Player.h:635
#define QUEST_ITEM_OBJECTIVES_COUNT
Definition: QuestDef.h:36
#define QUEST_OBJECTIVES_COUNT
Definition: QuestDef.h:35
#define MAX_QUEST_LOG_SIZE
Definition: QuestDef.h:33
#define QUEST_PVP_KILL_SLOT
Definition: QuestDef.h:43
QuestStatus
Definition: QuestDef.h:99
@ QUEST_STATUS_FAILED
Definition: QuestDef.h:105
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:103
@ QUEST_STATUS_NONE
Definition: QuestDef.h:100
@ MAX_QUEST_STATUS
Definition: QuestDef.h:107
@ QUEST_STATUS_COMPLETE
Definition: QuestDef.h:101
@ QUEST_SPECIAL_FLAGS_TIMED
Definition: QuestDef.h:175
QuestStatusMap m_QuestStatus
Definition: Player.h:2747
bool GetQuestRewardStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1401
void SetQuestSlotCounter(uint16 slot, uint8 counter, uint16 count)
Definition: Player.h:1473
void SetQuestSlot(uint16 slot, uint32 quest_id, uint32 timer=0)
Definition: Player.h:1465
void SetQuestSlotState(uint16 slot, uint32 state)
Definition: Player.h:1480
void AddTimedQuest(uint32 quest_id)
Definition: Player.h:1532
Definition: QuestDef.h:405
uint32 Timer
Definition: QuestDef.h:413
uint16 PlayerCount
Definition: QuestDef.h:416
uint16 ItemCount[QUEST_ITEM_OBJECTIVES_COUNT]
Definition: QuestDef.h:414
QuestStatus Status
Definition: QuestDef.h:412
bool Explored
Definition: QuestDef.h:417
uint16 CreatureOrGOCount[QUEST_OBJECTIVES_COUNT]
Definition: QuestDef.h:415

References AddTimedQuest(), QuestStatusData::CreatureOrGOCount, QuestStatusData::Explored, Field::Get(), GameTime::GetGameTime(), Object::GetGUID(), WorldObject::GetName(), GetQuestRewardStatus(), IN_MILLISECONDS, QuestStatusData::ItemCount, LOG_DEBUG, LOG_ERROR, m_QuestStatus, MAX_QUEST_LOG_SIZE, MAX_QUEST_STATUS, QuestStatusData::PlayerCount, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_OBJECTIVES_COUNT, QUEST_PVP_KILL_SLOT, QUEST_SPECIAL_FLAGS_TIMED, QUEST_STATE_COMPLETE, QUEST_STATE_FAIL, QUEST_STATUS_COMPLETE, QUEST_STATUS_FAILED, QUEST_STATUS_INCOMPLETE, QUEST_STATUS_NONE, SetQuestSlot(), SetQuestSlotCounter(), SetQuestSlotState(), sObjectMgr, QuestStatusData::Status, QuestStatusData::Timer, and Position::ToString().

Referenced by LoadFromDB().

◆ _LoadQuestStatusRewarded()

void Player::_LoadQuestStatusRewarded ( PreparedQueryResult  result)
protected
6337{
6338 // SELECT quest FROM character_queststatus_rewarded WHERE guid = ?
6339
6340 if (result)
6341 {
6342 m_RewardedQuests.rehash(result->GetRowCount());
6343 do
6344 {
6345 Field* fields = result->Fetch();
6346
6347 uint32 quest_id = fields[0].Get<uint32>();
6348 // used to be new, no delete?
6349 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
6350 if (quest)
6351 {
6352 // learn rewarded spell if unknown
6354
6355 // set rewarded title if any
6356 if (quest->GetCharTitleId())
6357 {
6358 if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(quest->GetCharTitleId()))
6359 SetTitle(titleEntry);
6360 }
6361
6362 if (quest->GetBonusTalents())
6363 m_questRewardTalentCount += quest->GetBonusTalents();
6364 }
6365
6366 m_RewardedQuests.insert(quest_id);
6367 } while (result->NextRow());
6368 }
6369}
DBCStorage< CharTitlesEntry > sCharTitlesStore(CharTitlesEntryfmt)
RewardedQuestSet m_RewardedQuests
Definition: Player.h:2750
void SetTitle(CharTitlesEntry const *title, bool lost=false)
Definition: Player.cpp:13251
void learnQuestRewardedSpells()
Definition: Player.cpp:11894
Definition: DBCStructure.h:632

References Field::Get(), learnQuestRewardedSpells(), m_questRewardTalentCount, m_RewardedQuests, sCharTitlesStore, SetTitle(), and sObjectMgr.

Referenced by LoadFromDB().

◆ _LoadRandomBGStatus()

void Player::_LoadRandomBGStatus ( PreparedQueryResult  result)
protected
15636{
15637 if (result)
15638 m_IsBGRandomWinner = true;
15639}

References m_IsBGRandomWinner.

Referenced by LoadFromDB().

◆ _LoadSeasonalQuestStatus()

void Player::_LoadSeasonalQuestStatus ( PreparedQueryResult  result)
protected
6445{
6446 m_seasonalquests.clear();
6447
6448 if (result)
6449 {
6450 do
6451 {
6452 Field* fields = result->Fetch();
6453 uint32 quest_id = fields[0].Get<uint32>();
6454 uint32 event_id = fields[1].Get<uint32>();
6455 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
6456 if (!quest)
6457 continue;
6458
6459 m_seasonalquests[event_id].insert(quest_id);
6460 LOG_DEBUG("entities.player.loading", "Seasonal quest {{}} cooldown for player ({})", quest_id, GetGUID().ToString());
6461 } while (result->NextRow());
6462 }
6463
6464 m_SeasonalQuestChanged = false;
6465}
SeasonalEventQuestMap m_seasonalquests
Definition: Player.h:2649

References Field::Get(), Object::GetGUID(), LOG_DEBUG, m_SeasonalQuestChanged, m_seasonalquests, sObjectMgr, and Position::ToString().

Referenced by LoadFromDB().

◆ _LoadSkills()

void Player::_LoadSkills ( PreparedQueryResult  result)
protected
13588{
13589 // 0 1 2
13590 // SetQuery(PLAYER_LOGIN_QUERY_LOADSKILLS, "SELECT skill, value, max FROM character_skills WHERE guid = '{}'", m_guid.GetCounter());
13591
13592 uint32 count = 0;
13593 std::unordered_map<uint32, uint32> loadedSkillValues;
13594 if (result)
13595 {
13596 do
13597 {
13598 Field* fields = result->Fetch();
13599 uint16 skill = fields[0].Get<uint16>();
13600 uint16 value = fields[1].Get<uint16>();
13601 uint16 max = fields[2].Get<uint16>();
13602
13603 SkillRaceClassInfoEntry const* rcEntry = GetSkillRaceClassInfo(skill, getRace(), getClass());
13604 if (!rcEntry)
13605 {
13606 LOG_ERROR("entities.player", "Character {} has skill {} that does not exist.", GetGUID().ToString(), skill);
13607 continue;
13608 }
13609
13610 // set fixed skill ranges
13611 switch (GetSkillRangeType(rcEntry))
13612 {
13613 case SKILL_RANGE_LANGUAGE: // 300..300
13614 value = max = 300;
13615 break;
13616 case SKILL_RANGE_MONO: // 1..1, grey monolite bar
13617 value = max = 1;
13618 break;
13619 case SKILL_RANGE_LEVEL:
13621 default:
13622 break;
13623 }
13624
13625 if (value == 0)
13626 {
13627 LOG_ERROR("entities.player", "Character {} has skill {} with value 0. Will be deleted.", GetGUID().ToString(), skill);
13628
13630
13631 stmt->SetData(0, GetGUID().GetCounter());
13632 stmt->SetData(1, skill);
13633
13634 CharacterDatabase.Execute(stmt);
13635
13636 continue;
13637 }
13638
13639 uint16 skillStep = 0;
13640 if (SkillTiersEntry const* skillTier = sSkillTiersStore.LookupEntry(rcEntry->SkillTierID))
13641 {
13642 for (uint32 i = 0; i < MAX_SKILL_STEP; ++i)
13643 {
13644 if (skillTier->Value[skillStep] == max)
13645 {
13646 skillStep = i + 1;
13647 break;
13648 }
13649 }
13650 }
13651
13652 SetUInt32Value(PLAYER_SKILL_INDEX(count), MAKE_PAIR32(skill, skillStep));
13653
13656
13657 mSkillStatus.insert(SkillStatusMap::value_type(skill, SkillStatusData(count, SKILL_UNCHANGED)));
13658
13659 loadedSkillValues[skill] = value;
13660
13661 ++count;
13662
13663 if (count >= PLAYER_MAX_SKILLS) // client limit
13664 {
13665 LOG_ERROR("entities.player", "Character {} has more than {} skills.", GetGUID().ToString(), PLAYER_MAX_SKILLS);
13666 break;
13667 }
13668 } while (result->NextRow());
13669 }
13670
13671 // Learn skill rewarded spells after all skills have been loaded to prevent learning a skill from them before its loaded with proper value from DB
13672 for (auto& skill : loadedSkillValues)
13673 {
13674 learnSkillRewardedSpells(skill.first, skill.second);
13675 }
13676
13677 for (; count < PLAYER_MAX_SKILLS; ++count)
13678 {
13682 }
13683}
@ CHAR_DEL_CHARACTER_SKILL
Definition: CharacterDatabase.h:316
SkillRaceClassInfoEntry const * GetSkillRaceClassInfo(uint32 skill, uint8 race, uint8 class_)
Definition: DBCStores.cpp:891
DBCStorage< SkillTiersEntry > sSkillTiersStore(SkillTiersfmt)
uint32 MAKE_PAIR32(uint16 l, uint16 h)
Definition: ObjectDefines.h:87
#define PLAYER_SKILL_BONUS_INDEX(x)
Definition: Player.h:81
#define PLAYER_SKILL_VALUE_INDEX(x)
Definition: Player.h:80
#define PLAYER_SKILL_INDEX(x)
Definition: Player.h:79
#define PLAYER_MAX_SKILLS
Definition: Player.h:71
@ SKILL_UNCHANGED
Definition: Player.h:640
#define MAKE_SKILL_VALUE(v, m)
Definition: Player.h:85
SkillRangeType GetSkillRangeType(SkillRaceClassInfoEntry const *rcEntry)
Definition: ObjectMgr.cpp:8742
@ SKILL_RANGE_MONO
Definition: ObjectMgr.h:681
@ SKILL_RANGE_LANGUAGE
Definition: ObjectMgr.h:679
@ SKILL_RANGE_LEVEL
Definition: ObjectMgr.h:680
#define MAX_SKILL_STEP
Definition: DBCStructure.h:1578
Definition: Player.h:647
SkillStatusMap mSkillStatus
Definition: Player.h:2754
void learnSkillRewardedSpells(uint32 id, uint32 value)
Definition: Player.cpp:11907
Definition: DBCStructure.h:1567
Definition: DBCStructure.h:1613

References CHAR_DEL_CHARACTER_SKILL, CharacterDatabase, Field::Get(), Unit::getClass(), Object::GetGUID(), GetMaxSkillValueForLevel(), Unit::getRace(), GetSkillRaceClassInfo(), GetSkillRangeType(), learnSkillRewardedSpells(), LOG_ERROR, MAKE_PAIR32(), MAKE_SKILL_VALUE, MAX_SKILL_STEP, mSkillStatus, PLAYER_MAX_SKILLS, PLAYER_SKILL_BONUS_INDEX, PLAYER_SKILL_INDEX, PLAYER_SKILL_VALUE_INDEX, PreparedStatementBase::SetData(), Object::SetUInt32Value(), SKILL_RANGE_LANGUAGE, SKILL_RANGE_LEVEL, SKILL_RANGE_MONO, SKILL_UNCHANGED, sSkillTiersStore, and Position::ToString().

Referenced by LoadFromDB().

◆ _LoadSpellCooldowns()

void Player::_LoadSpellCooldowns ( PreparedQueryResult  result)
3540{
3541 // some cooldowns can be already set at aura loading...
3542
3543 //QueryResult* result = CharacterDatabase.Query("SELECT spell, category, item, time FROM character_spell_cooldown WHERE guid = '{}'", GetGUID().GetCounter()());
3544
3545 if (result)
3546 {
3547 time_t curTime = GameTime::GetGameTime().count();
3548
3549 do
3550 {
3551 Field* fields = result->Fetch();
3552 uint32 spell_id = fields[0].Get<uint32>();
3553 uint16 category = fields[1].Get<uint16>();
3554 uint32 item_id = fields[2].Get<uint32>();
3555 uint32 db_time = fields[3].Get<uint32>();
3556 bool needSend = fields[4].Get<bool>();
3557
3558 if (!sSpellMgr->GetSpellInfo(spell_id))
3559 {
3560 LOG_ERROR("entities.player", "Player {} has unknown spell {} in `character_spell_cooldown`, skipping.", GetGUID().ToString(), spell_id);
3561 continue;
3562 }
3563
3564 // skip outdated cooldown
3565 if (db_time <= curTime)
3566 continue;
3567
3568 _AddSpellCooldown(spell_id, category, item_id, (db_time - curTime) * IN_MILLISECONDS, needSend);
3569
3570 LOG_DEBUG("entities.player.loading", "Player ({}) spell {}, item {} cooldown loaded ({} secs).", GetGUID().ToString(), spell_id, item_id, uint32(db_time - curTime));
3571 } while (result->NextRow());
3572 }
3573}
void _AddSpellCooldown(uint32 spell_id, uint16 categoryId, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false)
Definition: Player.cpp:10982

References _AddSpellCooldown(), Field::Get(), GameTime::GetGameTime(), Object::GetGUID(), IN_MILLISECONDS, LOG_DEBUG, LOG_ERROR, sSpellMgr, and Position::ToString().

Referenced by LoadFromDB().

◆ _LoadSpells()

void Player::_LoadSpells ( PreparedQueryResult  result)
protected
6490{
6491 //QueryResult* result = CharacterDatabase.Query("SELECT spell, specMask FROM character_spell WHERE guid = '{}'", GetGUID().GetCounter());
6492
6493 if (result)
6494 {
6495 do
6496 // xinef: checked
6497 addSpell((*result)[0].Get<uint32>(), (*result)[1].Get<uint8>(), true);
6498 while (result->NextRow());
6499 }
6500}
bool addSpell(uint32 spellId, uint8 addSpecMask, bool updateActive, bool temporary=false, bool learnFromSkill=false)
Definition: Player.cpp:3008

References addSpell().

Referenced by LoadFromDB().

◆ _LoadTalents()

void Player::_LoadTalents ( PreparedQueryResult  result)
protected
14923{
14924 // SetQuery(PLAYER_LOGIN_QUERY_LOADTALENTS, "SELECT spell, specMask FROM character_talent WHERE guid = '{}'", m_guid.GetCounter());
14925 if (result)
14926 {
14927 do
14928 {
14929 // xinef: checked
14930 uint32 spellId = (*result)[0].Get<uint32>();
14931 uint8 specMask = (*result)[1].Get<uint8>();
14932 addTalent(spellId, specMask, 0);
14933 TalentSpellPos const* talentPos = GetTalentSpellPos(spellId);
14934 ASSERT(talentPos);
14935
14936 // xinef: increase used talent points count
14937 if (GetActiveSpecMask() & specMask)
14938 m_usedTalentCount += talentPos->rank + 1;
14939 } while (result->NextRow());
14940 }
14941}
#define ASSERT
Definition: Errors.h:68
TalentSpellPos const * GetTalentSpellPos(uint32 spellId)
Definition: DBCStores.cpp:673
bool addTalent(uint32 spellId, uint8 addSpecMask, uint8 oldTalentRank)
Definition: Player.cpp:2863
uint8 GetActiveSpecMask() const
Definition: Player.h:1708
Definition: DBCStructure.h:2230
uint8 rank
Definition: DBCStructure.h:2235

References addTalent(), ASSERT, GetActiveSpecMask(), GetTalentSpellPos(), m_usedTalentCount, and TalentSpellPos::rank.

Referenced by LoadFromDB().

◆ _LoadWeeklyQuestStatus()

void Player::_LoadWeeklyQuestStatus ( PreparedQueryResult  result)
protected
6423{
6424 m_weeklyquests.clear();
6425
6426 if (result)
6427 {
6428 do
6429 {
6430 Field* fields = result->Fetch();
6431 uint32 quest_id = fields[0].Get<uint32>();
6432 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
6433 if (!quest)
6434 continue;
6435
6436 m_weeklyquests.insert(quest_id);
6437 LOG_DEBUG("entities.player.loading", "Weekly quest {{}} cooldown for player ({})", quest_id, GetGUID().ToString());
6438 } while (result->NextRow());
6439 }
6440
6441 m_WeeklyQuestChanged = false;
6442}
QuestSet m_weeklyquests
Definition: Player.h:2647

References Field::Get(), Object::GetGUID(), LOG_DEBUG, m_WeeklyQuestChanged, m_weeklyquests, sObjectMgr, and Position::ToString().

Referenced by LoadFromDB().

◆ _RemoveAllItemMods()

void Player::_RemoveAllItemMods ( )
7428{
7429 LOG_DEBUG("entities.player.items", "_RemoveAllItemMods start.");
7430
7431 for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
7432 {
7433 if (m_items[i])
7434 {
7435 ItemTemplate const* proto = m_items[i]->GetTemplate();
7436 if (!proto)
7437 continue;
7438
7439 // item set bonuses not dependent from item broken state
7440 if (proto->ItemSet)
7441 RemoveItemsSetItem(this, proto);
7442
7443 if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
7444 continue;
7445
7446 ApplyItemEquipSpell(m_items[i], false);
7447 ApplyEnchantment(m_items[i], false);
7448 }
7449 }
7450
7451 for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
7452 {
7453 if (m_items[i])
7454 {
7455 if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
7456 continue;
7457 ItemTemplate const* proto = m_items[i]->GetTemplate();
7458 if (!proto)
7459 continue;
7460
7461 uint32 attacktype = Player::GetAttackBySlot(i);
7462 if (attacktype < MAX_ATTACK)
7464
7465 _ApplyItemBonuses(proto, i, false);
7466
7467 if (i == EQUIPMENT_SLOT_RANGED)
7469 }
7470 }
7471
7472 LOG_DEBUG("entities.player.items", "_RemoveAllItemMods complete.");
7473}
void RemoveItemsSetItem(Player *player, ItemTemplate const *proto)
Definition: Item.cpp:119

References _ApplyAmmoBonuses(), _ApplyItemBonuses(), _ApplyWeaponDependentAuraMods(), ApplyEnchantment(), ApplyItemEquipSpell(), Unit::CanUseAttackType(), EQUIPMENT_SLOT_RANGED, GetAttackBySlot(), Item::GetTemplate(), INVENTORY_SLOT_BAG_END, ItemTemplate::ItemSet, LOG_DEBUG, m_items, MAX_ATTACK, and RemoveItemsSetItem().

Referenced by _RemoveAllStatBonuses().

◆ _RemoveAllStatBonuses()

void Player::_RemoveAllStatBonuses ( )
999{
1000 SetCanModifyStats(false);
1001
1004
1005 SetCanModifyStats(true);
1006
1008}
void _RemoveAllItemMods()
Definition: Player.cpp:7427
void _RemoveAllAuraStatMods()
Definition: Unit.cpp:5420

References Unit::_RemoveAllAuraStatMods(), _RemoveAllItemMods(), Unit::SetCanModifyStats(), and UpdateAllStats().

Referenced by InitStatsForLevel().

◆ _removeTalent() [1/2]

void Player::_removeTalent ( PlayerTalentMap::iterator &  itr,
uint8  specMask 
)
2928{
2929 // xinef: remove spec mask from iterator
2930 itr->second->specMask &= ~specMask;
2931
2932 // xinef: if talent is not present in any spec - remove
2933 if (itr->second->specMask == 0)
2934 {
2935 if (itr->second->State == PLAYERSPELL_NEW)
2936 {
2937 delete itr->second;
2938 m_talents.erase(itr);
2939 return;
2940 }
2941 else
2942 itr->second->State = PLAYERSPELL_REMOVED;
2943 }
2944 // xinef: otherwise save changes to DB
2945 else if (itr->second->State != PLAYERSPELL_NEW)
2946 itr->second->State = PLAYERSPELL_CHANGED;
2947}

References m_talents, PLAYERSPELL_CHANGED, PLAYERSPELL_NEW, and PLAYERSPELL_REMOVED.

Referenced by _removeTalent(), addTalent(), and resetTalents().

◆ _removeTalent() [2/2]

void Player::_removeTalent ( uint32  spellId,
uint8  specMask 
)
2919{
2920 PlayerTalentMap::iterator itr = m_talents.find(spellId);
2921 if (itr == m_talents.end() || itr->second->State == PLAYERSPELL_REMOVED)
2922 return;
2923
2924 _removeTalent(itr, specMask);
2925}
void _removeTalent(PlayerTalentMap::iterator &itr, uint8 specMask)
Definition: Player.cpp:2927

References _removeTalent(), m_talents, and PLAYERSPELL_REMOVED.

◆ _removeTalentAurasAndSpells()

void Player::_removeTalentAurasAndSpells ( uint32  spellId)
2950{
2951 RemoveOwnedAura(spellId);
2952
2953 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
2954 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
2955 {
2956 // pussywizard: remove pet auras
2957 if (PetAura const* petSpell = sSpellMgr->GetPetAura(spellId, i))
2958 RemovePetAura(petSpell);
2959
2960 // pussywizard: remove all triggered auras
2961 if (spellInfo->Effects[i].TriggerSpell > 0)
2962 RemoveAurasDueToSpell(spellInfo->Effects[i].TriggerSpell);
2963
2964 // xinef: remove temporary spells added by talent
2965 // xinef: recursively remove all learnt spells
2966 if (spellInfo->Effects[i].TriggerSpell > 0 && spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL)
2967 {
2968 removeSpell(spellInfo->Effects[i].TriggerSpell, SPEC_MASK_ALL, true);
2969 _removeTalentAurasAndSpells(spellInfo->Effects[i].TriggerSpell);
2970 }
2971 }
2972}
void removeSpell(uint32 spellId, uint8 removeSpecMask, bool onlyTemporary)
Definition: Player.cpp:3284
void _removeTalentAurasAndSpells(uint32 spellId)
Definition: Player.cpp:2949
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4651
void RemovePetAura(PetAura const *petSpell)
Definition: Unit.cpp:17563
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4855
Definition: SpellMgr.h:470

References _removeTalentAurasAndSpells(), SpellInfo::Effects, MAX_SPELL_EFFECTS, Unit::RemoveAurasDueToSpell(), Unit::RemoveOwnedAura(), Unit::RemovePetAura(), removeSpell(), SPEC_MASK_ALL, SPELL_EFFECT_LEARN_SPELL, and sSpellMgr.

Referenced by _removeTalentAurasAndSpells(), ActivateSpec(), addTalent(), and resetTalents().

◆ _SaveActions()

void Player::_SaveActions ( CharacterDatabaseTransaction  trans)
protected
7159{
7160 CharacterDatabasePreparedStatement* stmt = nullptr;
7161
7162 for (ActionButtonList::iterator itr = m_actionButtons.begin(); itr != m_actionButtons.end();)
7163 {
7164 switch (itr->second.uState)
7165 {
7166 case ACTIONBUTTON_NEW:
7167 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACTION);
7168 stmt->SetData(0, GetGUID().GetCounter());
7169 stmt->SetData(1, m_activeSpec);
7170 stmt->SetData(2, itr->first);
7171 stmt->SetData(3, itr->second.GetAction());
7172 stmt->SetData(4, uint8(itr->second.GetType()));
7173 trans->Append(stmt);
7174
7175 itr->second.uState = ACTIONBUTTON_UNCHANGED;
7176 ++itr;
7177 break;
7179 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ACTION);
7180 stmt->SetData(0, itr->second.GetAction());
7181 stmt->SetData(1, uint8(itr->second.GetType()));
7182 stmt->SetData(2, GetGUID().GetCounter());
7183 stmt->SetData(3, itr->first);
7184 stmt->SetData(4, m_activeSpec);
7185 trans->Append(stmt);
7186
7187 itr->second.uState = ACTIONBUTTON_UNCHANGED;
7188 ++itr;
7189 break;
7191 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACTION_BY_BUTTON_SPEC);
7192 stmt->SetData(0, GetGUID().GetCounter());
7193 stmt->SetData(1, itr->first);
7194 stmt->SetData(2, m_activeSpec);
7195 trans->Append(stmt);
7196
7197 m_actionButtons.erase(itr++);
7198 break;
7199 default:
7200 ++itr;
7201 break;
7202 }
7203 }
7204}
@ CHAR_DEL_CHAR_ACTION_BY_BUTTON_SPEC
Definition: CharacterDatabase.h:429
@ CHAR_UPD_CHAR_ACTION
Definition: CharacterDatabase.h:428
@ CHAR_INS_CHAR_ACTION
Definition: CharacterDatabase.h:427
@ ACTIONBUTTON_NEW
Definition: Player.h:224
@ ACTIONBUTTON_CHANGED
Definition: Player.h:223

References ACTIONBUTTON_CHANGED, ACTIONBUTTON_DELETED, ACTIONBUTTON_NEW, ACTIONBUTTON_UNCHANGED, CHAR_DEL_CHAR_ACTION_BY_BUTTON_SPEC, CHAR_INS_CHAR_ACTION, CHAR_UPD_CHAR_ACTION, CharacterDatabase, Object::GetGUID(), m_actionButtons, m_activeSpec, and PreparedStatementBase::SetData().

Referenced by ActivateSpec(), SaveToDB(), and UpdateSpecCount().

◆ _SaveAuras()

void Player::_SaveAuras ( CharacterDatabaseTransaction  trans,
bool  logout 
)
protected
7207{
7209 stmt->SetData(0, GetGUID().GetCounter());
7210 trans->Append(stmt);
7211
7212 for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end(); ++itr)
7213 {
7214 if (!itr->second->CanBeSaved())
7215 continue;
7216
7217 Aura* aura = itr->second;
7218 if( !logout && aura->GetDuration() < 60 * IN_MILLISECONDS )
7219 continue;
7220
7221 int32 damage[MAX_SPELL_EFFECTS];
7222 int32 baseDamage[MAX_SPELL_EFFECTS];
7223 uint8 effMask = 0;
7224 uint8 recalculateMask = 0;
7225 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
7226 {
7227 if (AuraEffect const* effect = aura->GetEffect(i))
7228 {
7229 baseDamage[i] = effect->GetBaseAmount();
7230 damage[i] = effect->GetAmount();
7231 effMask |= 1 << i;
7232 if (effect->CanBeRecalculated())
7233 recalculateMask |= 1 << i;
7234 }
7235 else
7236 {
7237 baseDamage[i] = 0;
7238 damage[i] = 0;
7239 }
7240 }
7241
7242 uint8 index = 0;
7243 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AURA);
7244 stmt->SetData(index++, GetGUID().GetCounter());
7245 stmt->SetData(index++, itr->second->GetCasterGUID().GetRawValue());
7246 stmt->SetData(index++, itr->second->GetCastItemGUID().GetRawValue());
7247 stmt->SetData(index++, itr->second->GetId());
7248 stmt->SetData(index++, effMask);
7249 stmt->SetData(index++, recalculateMask);
7250 stmt->SetData(index++, itr->second->GetStackAmount());
7251 stmt->SetData(index++, damage[0]);
7252 stmt->SetData(index++, damage[1]);
7253 stmt->SetData(index++, damage[2]);
7254 stmt->SetData(index++, baseDamage[0]);
7255 stmt->SetData(index++, baseDamage[1]);
7256 stmt->SetData(index++, baseDamage[2]);
7257 stmt->SetData(index++, itr->second->GetMaxDuration());
7258 stmt->SetData(index++, itr->second->GetDuration());
7259 stmt->SetData(index, itr->second->GetCharges());
7260 trans->Append(stmt);
7261 }
7262}
@ CHAR_INS_AURA
Definition: CharacterDatabase.h:196
@ CHAR_DEL_CHAR_AURA
Definition: CharacterDatabase.h:404
AuraMap m_ownedAuras
Definition: Unit.h:2517
Definition: SpellAuraEffects.h:39
int32 GetDuration() const
Definition: SpellAuras.h:133
AuraEffect * GetEffect(uint8 effIndex) const
Definition: SpellAuras.h:175

References CHAR_DEL_CHAR_AURA, CHAR_INS_AURA, CharacterDatabase, Aura::GetDuration(), Aura::GetEffect(), Object::GetGUID(), IN_MILLISECONDS, Unit::m_ownedAuras, MAX_SPELL_EFFECTS, and PreparedStatementBase::SetData().

Referenced by SaveToDB(), and SpawnCorpseBones().

◆ _SaveCharacter()

void Player::_SaveCharacter ( bool  create,
CharacterDatabaseTransaction  trans 
)
protected

Insert query TO DO: Filter out more redundant fields that can take their default value at player create

14598{
14599 CharacterDatabasePreparedStatement* stmt = nullptr;
14600 uint8 index = 0;
14601
14602 auto finiteAlways = [](float f) { return std::isfinite(f) ? f : 0.0f; };
14603
14604 if (create)
14605 {
14608 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER);
14609 stmt->SetData(index++, GetGUID().GetCounter());
14610 stmt->SetData(index++, GetSession()->GetAccountId());
14611 stmt->SetData(index++, GetName());
14612 stmt->SetData(index++, getRace(true));
14613 stmt->SetData(index++, getClass());
14614 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_3, 0)); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect
14615 stmt->SetData(index++, GetLevel());
14616 stmt->SetData(index++, GetUInt32Value(PLAYER_XP));
14617 stmt->SetData(index++, GetMoney());
14618 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 0));
14619 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 1));
14620 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 2));
14621 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 3));
14622 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 0));
14623 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 2));
14624 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 3));
14625 stmt->SetData(index++, (uint32)GetPlayerFlags());
14626 stmt->SetData(index++, (uint16)GetMapId());
14627 stmt->SetData(index++, (uint32)GetInstanceId());
14628 stmt->SetData(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
14629 stmt->SetData(index++, finiteAlways(GetPositionX()));
14630 stmt->SetData(index++, finiteAlways(GetPositionY()));
14631 stmt->SetData(index++, finiteAlways(GetPositionZ()));
14632 stmt->SetData(index++, finiteAlways(GetOrientation()));
14633 stmt->SetData(index++, finiteAlways(GetTransOffsetX()));
14634 stmt->SetData(index++, finiteAlways(GetTransOffsetY()));
14635 stmt->SetData(index++, finiteAlways(GetTransOffsetZ()));
14636 stmt->SetData(index++, finiteAlways(GetTransOffsetO()));
14637
14638 int32 lowGuidOrSpawnId = 0;
14639 if (Transport* transport = GetTransport())
14640 {
14641 if (transport->IsMotionTransport())
14642 lowGuidOrSpawnId = static_cast<int32>(transport->GetGUID().GetCounter());
14643 else if (transport->IsStaticTransport())
14644 lowGuidOrSpawnId = -static_cast<int32>(transport->GetSpawnId());
14645 }
14646 stmt->SetData(index++, lowGuidOrSpawnId);
14647
14648 std::ostringstream ss;
14649 ss << m_taxi;
14650 stmt->SetData(index++, ss.str());
14651 stmt->SetData(index++, m_cinematic);
14652 stmt->SetData(index++, m_Played_time[PLAYED_TIME_TOTAL]);
14653 stmt->SetData(index++, m_Played_time[PLAYED_TIME_LEVEL]);
14654 stmt->SetData(index++, finiteAlways(_restBonus));
14655 stmt->SetData(index++, uint32(GameTime::GetGameTime().count()));
14656 stmt->SetData(index++, (HasPlayerFlag(PLAYER_FLAGS_RESTING) ? 1 : 0));
14657 //save, far from tavern/city
14658 //save, but in tavern/city
14659 stmt->SetData(index++, m_resetTalentsCost);
14660 stmt->SetData(index++, uint32(m_resetTalentsTime));
14661 stmt->SetData(index++, (uint16)m_ExtraFlags);
14662 stmt->SetData(index++, m_petStable ? m_petStable->MaxStabledPets : 0);
14663 stmt->SetData(index++, (uint16)m_atLoginFlags);
14664 stmt->SetData(index++, GetZoneId());
14665 stmt->SetData(index++, uint32(m_deathExpireTime));
14666
14667 ss.str("");
14669
14670 stmt->SetData(index++, ss.str());
14671 stmt->SetData(index++, GetArenaPoints());
14672 stmt->SetData(index++, GetHonorPoints());
14676 stmt->SetData(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 0));
14677 stmt->SetData(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 1));
14681 stmt->SetData(index++, GetDrunkValue());
14682 stmt->SetData(index++, GetHealth());
14683
14684 for (uint32 i = 0; i < MAX_POWERS; ++i)
14685 stmt->SetData(index++, GetPower(Powers(i)));
14686
14687 stmt->SetData(index++, GetSession()->GetLatency());
14688
14689 stmt->SetData(index++, m_specsCount);
14690 stmt->SetData(index++, m_activeSpec);
14691
14692 ss.str("");
14693 for (uint32 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
14694 ss << GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + i) << ' ';
14695 stmt->SetData(index++, ss.str());
14696
14697 ss.str("");
14698 // cache equipment...
14699 for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i)
14701
14702 // ...and bags for enum opcode
14704 {
14705 if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
14706 ss << item->GetEntry();
14707 else
14708 ss << '0';
14709 ss << " 0 ";
14710 }
14711
14712 stmt->SetData(index++, ss.str());
14713 stmt->SetData(index++, GetUInt32Value(PLAYER_AMMO_ID));
14714
14715 ss.str("");
14716 for (uint32 i = 0; i < KNOWN_TITLES_SIZE * 2; ++i)
14718
14719 stmt->SetData(index++, ss.str());
14720 stmt->SetData(index++, GetByteValue(PLAYER_FIELD_BYTES, 2));
14721 stmt->SetData(index++, m_grantableLevels);
14722 stmt->SetData(index++, _innTriggerId);
14723 stmt->SetData(index++, m_extraBonusTalentCount);
14724 }
14725 else
14726 {
14727 // Update query
14728 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER);
14729 stmt->SetData(index++, GetName());
14730 stmt->SetData(index++, getRace(true));
14731 stmt->SetData(index++, getClass());
14732 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_3, 0)); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect
14733 stmt->SetData(index++, GetLevel());
14734 stmt->SetData(index++, GetUInt32Value(PLAYER_XP));
14735 stmt->SetData(index++, GetMoney());
14736 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 0));
14737 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 1));
14738 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 2));
14739 stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 3));
14740 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 0));
14741 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 2));
14742 stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 3));
14743 stmt->SetData(index++, GetPlayerFlags());
14744
14745 if (!IsBeingTeleported())
14746 {
14748 if (Map* m = FindMap())
14749 if (m->IsDungeon())
14750 {
14751 if (m->IsNonRaidDungeon()) dd = m->GetDifficulty();
14752 else rd = m->GetDifficulty();
14753 }
14754 stmt->SetData(index++, (uint16)GetMapId());
14755 stmt->SetData(index++, (uint32)GetInstanceId());
14756 stmt->SetData(index++, (uint8(dd) | uint8(rd) << 4));
14757 stmt->SetData(index++, finiteAlways(GetPositionX()));
14758 stmt->SetData(index++, finiteAlways(GetPositionY()));
14759 stmt->SetData(index++, finiteAlways(GetPositionZ()));
14760 stmt->SetData(index++, finiteAlways(GetOrientation()));
14761 }
14762 else
14763 {
14764 stmt->SetData(index++, (uint16)GetTeleportDest().GetMapId());
14765 stmt->SetData(index++, (uint32)0);
14766 stmt->SetData(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
14767 stmt->SetData(index++, finiteAlways(GetTeleportDest().GetPositionX()));
14768 stmt->SetData(index++, finiteAlways(GetTeleportDest().GetPositionY()));
14769 stmt->SetData(index++, finiteAlways(GetTeleportDest().GetPositionZ()));
14770 stmt->SetData(index++, finiteAlways(GetTeleportDest().GetOrientation()));
14771 }
14772
14773 stmt->SetData(index++, finiteAlways(GetTransOffsetX()));
14774 stmt->SetData(index++, finiteAlways(GetTransOffsetY()));
14775 stmt->SetData(index++, finiteAlways(GetTransOffsetZ()));
14776 stmt->SetData(index++, finiteAlways(GetTransOffsetO()));
14777
14778 int32 lowGuidOrSpawnId = 0;
14779 if (Transport* transport = GetTransport())
14780 {
14781 if (transport->IsMotionTransport())
14782 lowGuidOrSpawnId = static_cast<int32>(transport->GetGUID().GetCounter());
14783 else if (transport->IsStaticTransport())
14784 lowGuidOrSpawnId = -static_cast<int32>(transport->GetSpawnId());
14785 }
14786 stmt->SetData(index++, lowGuidOrSpawnId);
14787
14788 std::ostringstream ss;
14789 ss << m_taxi;
14790 stmt->SetData(index++, ss.str());
14791 stmt->SetData(index++, m_cinematic);
14792 stmt->SetData(index++, m_Played_time[PLAYED_TIME_TOTAL]);
14793 stmt->SetData(index++, m_Played_time[PLAYED_TIME_LEVEL]);
14794 stmt->SetData(index++, finiteAlways(_restBonus));
14795 stmt->SetData(index++, uint32(GameTime::GetGameTime().count()));
14796 stmt->SetData(index++, (HasPlayerFlag(PLAYER_FLAGS_RESTING) ? 1 : 0));
14797 //save, far from tavern/city
14798 //save, but in tavern/city
14799 stmt->SetData(index++, m_resetTalentsCost);
14800 stmt->SetData(index++, uint32(m_resetTalentsTime));
14801 stmt->SetData(index++, (uint16)m_ExtraFlags);
14802 stmt->SetData(index++, m_petStable ? m_petStable->MaxStabledPets : 0);
14803 stmt->SetData(index++, (uint16)m_atLoginFlags);
14804 stmt->SetData(index++, GetZoneId());
14805 stmt->SetData(index++, uint32(m_deathExpireTime));
14806
14807 ss.str("");
14809
14810 stmt->SetData(index++, ss.str());
14811 stmt->SetData(index++, GetArenaPoints());
14812 stmt->SetData(index++, GetHonorPoints());
14816 stmt->SetData(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 0));
14817 stmt->SetData(index++, GetUInt16Value(PLAYER_FIELD_KILLS, 1));
14821 stmt->SetData(index++, GetDrunkValue());
14822 stmt->SetData(index++, GetHealth());
14823
14824 for (uint32 i = 0; i < MAX_POWERS; ++i)
14825 stmt->SetData(index++, GetPower(Powers(i)));
14826
14827 stmt->SetData(index++, GetSession()->GetLatency());
14828
14829 stmt->SetData(index++, m_specsCount);
14830 stmt->SetData(index++, m_activeSpec);
14831
14832 ss.str("");
14833 for (uint32 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
14834 ss << GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + i) << ' ';
14835 stmt->SetData(index++, ss.str());
14836
14837 ss.str("");
14838 // cache equipment...
14839 for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i)
14841
14842 // ...and bags for enum opcode
14844 {
14845 if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
14846 ss << item->GetEntry();
14847 else
14848 ss << '0';
14849 ss << " 0 ";
14850 }
14851
14852 stmt->SetData(index++, ss.str());
14853 stmt->SetData(index++, GetUInt32Value(PLAYER_AMMO_ID));
14854
14855 ss.str("");
14856 for (uint32 i = 0; i < KNOWN_TITLES_SIZE * 2; ++i)
14858
14859 stmt->SetData(index++, ss.str());
14860 stmt->SetData(index++, GetByteValue(PLAYER_FIELD_BYTES, 2));
14861 stmt->SetData(index++, m_grantableLevels);
14862 stmt->SetData(index++, _innTriggerId);
14863 stmt->SetData(index++, m_extraBonusTalentCount);
14864
14865 stmt->SetData(index++, IsInWorld() && !GetSession()->PlayerLogout() ? 1 : 0);
14866 // Index
14867 stmt->SetData(index++, GetGUID().GetCounter());
14868 }
14869
14870 trans->Append(stmt);
14871}
@ CHAR_INS_CHARACTER
Definition: CharacterDatabase.h:271
@ CHAR_UPD_CHARACTER
Definition: CharacterDatabase.h:272
@ PLAYER_FIELD_TODAY_CONTRIBUTION
Definition: UpdateFields.h:375
@ PLAYER_BYTES_3
Definition: UpdateFields.h:183
@ PLAYER_XP
Definition: UpdateFields.h:339
@ PLAYER_CHOSEN_TITLE
Definition: UpdateFields.h:324
@ PLAYER_EXPLORED_ZONES_1
Definition: UpdateFields.h:357
@ PLAYER_FIELD_KNOWN_CURRENCIES
Definition: UpdateFields.h:338
@ PLAYER_BYTES_2
Definition: UpdateFields.h:182
@ PLAYER__FIELD_KNOWN_TITLES
Definition: UpdateFields.h:335
@ PLAYER_BYTES
Definition: UpdateFields.h:181
@ PLAYER_FIELD_KILLS
Definition: UpdateFields.h:374
@ PLAYER_FIELD_YESTERDAY_CONTRIBUTION
Definition: UpdateFields.h:376
@ PLAYER_FIELD_WATCHED_FACTION_INDEX
Definition: UpdateFields.h:379
@ PLAYER_VISIBLE_ITEM_1_ENTRYID
Definition: UpdateFields.h:286
@ PLAYER_FIELD_LIFETIME_HONORABLE_KILLS
Definition: UpdateFields.h:377
@ PLAYER_FIELD_BYTES
Definition: UpdateFields.h:368
#define KNOWN_TITLES_SIZE
Definition: Player.h:554
@ PLAYER_FLAGS_RESTING
Definition: Player.h:480
@ INVENTORY_SLOT_BAG_START
Definition: Player.h:700
#define PLAYER_EXPLORED_ZONES_SIZE
Definition: Player.h:73
Difficulty
Definition: DBCEnums.h:274
Powers
Definition: SharedDefines.h:268
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition: Object.cpp:323
uint16 GetUInt16Value(uint16 index, uint8 offset) const
Definition: Object.cpp:330
uint64 GetUInt64Value(uint16 index) const
Definition: Object.cpp:311
float GetTransOffsetX() const
Definition: Object.h:586
uint32 GetInstanceId() const
Definition: Object.h:431
float GetTransOffsetY() const
Definition: Object.h:587
float GetTransOffsetZ() const
Definition: Object.h:588
Transport * GetTransport() const
Definition: Object.h:585
float GetTransOffsetO() const
Definition: Object.h:589
float GetPositionZ() const
Definition: Position.h:119
float GetOrientation() const
Definition: Position.h:120
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
Difficulty GetRaidDifficulty() const
Definition: Player.h:1885
WorldLocation & GetTeleportDest()
Definition: Player.h:2053
uint32 GetArenaPoints() const
Definition: Player.h:2117
uint8 GetDrunkValue() const
Definition: Player.h:2135
Item * GetItemByPos(uint16 pos) const
Definition: PlayerStorage.cpp:469
uint32 GetHonorPoints() const
Definition: Player.h:2116
PlayerFlags GetPlayerFlags() const
Definition: Player.h:1099
uint32 GetMoney() const
Definition: Player.h:1580
PlayerTaxi m_taxi
Definition: Player.h:1133
bool HasPlayerFlag(PlayerFlags flags) const
Definition: Player.h:1100
Difficulty GetDungeonDifficulty() const
Definition: Player.h:1884
bool IsBeingTeleported() const
Definition: Player.h:2054
std::string SaveTaxiDestinationsToString()
Definition: PlayerTaxi.cpp:193
Definition: Transport.h:29
uint32 GetHealth() const
Definition: Unit.h:1454
uint32 GetPower(Powers power) const
Definition: Unit.h:1475
Definition: Map.h:313
bool PlayerLogout() const
Definition: WorldSession.h:338
uint32 GetLatency() const
Definition: WorldSession.h:503

References _innTriggerId, _restBonus, CHAR_INS_CHARACTER, CHAR_UPD_CHARACTER, CharacterDatabase, EQUIPMENT_SLOT_END, WorldObject::FindMap(), GetArenaPoints(), Object::GetByteValue(), Unit::getClass(), ObjectGuid::GetCounter(), GetDrunkValue(), GetDungeonDifficulty(), GameTime::GetGameTime(), Object::GetGUID(), Unit::GetHealth(), GetHonorPoints(), WorldObject::GetInstanceId(), GetItemByPos(), WorldSession::GetLatency(), Unit::GetLevel(), WorldLocation::GetMapId(), GetMoney(), WorldObject::GetName(), Position::GetOrientation(), GetPlayerFlags(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Unit::GetPower(), Unit::getRace(), GetRaidDifficulty(), GetSession(), GetTeleportDest(), WorldObject::GetTransOffsetO(), WorldObject::GetTransOffsetX(), WorldObject::GetTransOffsetY(), WorldObject::GetTransOffsetZ(), WorldObject::GetTransport(), Object::GetUInt16Value(), Object::GetUInt32Value(), Object::GetUInt64Value(), WorldObject::GetZoneId(), HasPlayerFlag(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, IsBeingTeleported(), Object::IsInWorld(), KNOWN_TITLES_SIZE, m_activeSpec, m_atLoginFlags, m_cinematic, m_deathExpireTime, m_extraBonusTalentCount, m_ExtraFlags, m_grantableLevels, m_petStable, m_Played_time, m_resetTalentsCost, m_resetTalentsTime, m_specsCount, m_taxi, MAX_POWERS, PLAYED_TIME_LEVEL, PLAYED_TIME_TOTAL, PLAYER__FIELD_KNOWN_TITLES, PLAYER_AMMO_ID, PLAYER_BYTES, PLAYER_BYTES_2, PLAYER_BYTES_3, PLAYER_CHOSEN_TITLE, PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE, PLAYER_FIELD_BYTES, PLAYER_FIELD_KILLS, PLAYER_FIELD_KNOWN_CURRENCIES, PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, PLAYER_FIELD_TODAY_CONTRIBUTION, PLAYER_FIELD_WATCHED_FACTION_INDEX, PLAYER_FIELD_YESTERDAY_CONTRIBUTION, PLAYER_FLAGS_RESTING, PLAYER_VISIBLE_ITEM_1_ENTRYID, PLAYER_XP, WorldSession::PlayerLogout(), PlayerTaxi::SaveTaxiDestinationsToString(), and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SaveDailyQuestStatus()

void Player::_SaveDailyQuestStatus ( CharacterDatabaseTransaction  trans)
protected
7545{
7547 return;
7548
7549 m_DailyQuestChanged = false;
7550
7551 // save last daily quest time for all quests: we need only mostly reset time for reset check anyway
7552
7553 // we don't need transactions here.
7555 stmt->SetData(0, GetGUID().GetCounter());
7556 trans->Append(stmt);
7557 for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
7558 {
7559 if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx))
7560 {
7561 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS);
7562 stmt->SetData(0, GetGUID().GetCounter());
7563 stmt->SetData(1, GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx));
7565 trans->Append(stmt);
7566 }
7567 }
7568
7569 if (!m_DFQuests.empty())
7570 {
7571 for (DFQuestsDoneList::iterator itr = m_DFQuests.begin(); itr != m_DFQuests.end(); ++itr)
7572 {
7573 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS);
7574 stmt->SetData(0, GetGUID().GetCounter());
7575 stmt->SetData(1, (*itr));
7577 trans->Append(stmt);
7578 }
7579 }
7580}
@ CHAR_DEL_QUEST_STATUS_DAILY_CHAR
Definition: CharacterDatabase.h:59
@ CHAR_INS_CHARACTER_DAILYQUESTSTATUS
Definition: CharacterDatabase.h:74

References CHAR_DEL_QUEST_STATUS_DAILY_CHAR, CHAR_INS_CHARACTER_DAILYQUESTSTATUS, CharacterDatabase, Object::GetGUID(), Object::GetUInt32Value(), m_DailyQuestChanged, m_DFQuests, m_lastDailyQuestTime, PLAYER_FIELD_DAILY_QUESTS_1, PLAYER_MAX_DAILY_QUESTS, and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SaveEntryPoint()

void Player::_SaveEntryPoint ( CharacterDatabaseTransaction  trans)
protected
14515{
14516 // xinef: dont save joinpos with invalid mapid
14517 MapEntry const* mEntry = sMapStore.LookupEntry(m_entryPointData.joinPos.GetMapId());
14518 if (!mEntry)
14519 return;
14520
14522 stmt->SetData(0, GetGUID().GetCounter());
14523 trans->Append(stmt);
14524
14525 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PLAYER_ENTRY_POINT);
14526 stmt->SetData(0, GetGUID().GetCounter());
14532 stmt->SetData(6, m_entryPointData.taxiPath[0]);
14533 stmt->SetData(7, m_entryPointData.taxiPath[1]);
14535 trans->Append(stmt);
14536}
@ CHAR_INS_PLAYER_ENTRY_POINT
Definition: CharacterDatabase.h:237
@ CHAR_DEL_PLAYER_ENTRY_POINT
Definition: CharacterDatabase.h:238

References CHAR_DEL_PLAYER_ENTRY_POINT, CHAR_INS_PLAYER_ENTRY_POINT, CharacterDatabase, Object::GetGUID(), WorldLocation::GetMapId(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), EntryPointData::joinPos, m_entryPointData, EntryPointData::mountSpell, PreparedStatementBase::SetData(), sMapStore, and EntryPointData::taxiPath.

Referenced by SaveToDB().

◆ _SaveEquipmentSets()

void Player::_SaveEquipmentSets ( CharacterDatabaseTransaction  trans)
protected
14464{
14465 for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end();)
14466 {
14467 uint32 index = itr->first;
14468 EquipmentSet& eqset = itr->second;
14469 CharacterDatabasePreparedStatement* stmt = nullptr;
14470 uint8 j = 0;
14471 switch (eqset.state)
14472 {
14474 ++itr;
14475 break; // nothing do
14477 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_EQUIP_SET);
14478 stmt->SetData(j++, eqset.Name.c_str());
14479 stmt->SetData(j++, eqset.IconName.c_str());
14480 stmt->SetData(j++, eqset.IgnoreMask);
14481 for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
14482 stmt->SetData(j++, eqset.Items[i].GetCounter());
14483 stmt->SetData(j++, GetGUID().GetCounter());
14484 stmt->SetData(j++, eqset.Guid);
14485 stmt->SetData(j, index);
14486 trans->Append(stmt);
14488 ++itr;
14489 break;
14490 case EQUIPMENT_SET_NEW:
14491 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_EQUIP_SET);
14492 stmt->SetData(j++, GetGUID().GetCounter());
14493 stmt->SetData(j++, eqset.Guid);
14494 stmt->SetData(j++, index);
14495 stmt->SetData(j++, eqset.Name.c_str());
14496 stmt->SetData(j++, eqset.IconName.c_str());
14497 stmt->SetData(j++, eqset.IgnoreMask);
14498 for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
14499 stmt->SetData(j++, eqset.Items[i].GetCounter());
14500 trans->Append(stmt);
14502 ++itr;
14503 break;
14505 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EQUIP_SET);
14506 stmt->SetData(0, eqset.Guid);
14507 trans->Append(stmt);
14508 m_EquipmentSets.erase(itr++);
14509 break;
14510 }
14511 }
14512}
@ CHAR_UPD_EQUIP_SET
Definition: CharacterDatabase.h:192
@ CHAR_INS_EQUIP_SET
Definition: CharacterDatabase.h:193
@ CHAR_DEL_EQUIP_SET
Definition: CharacterDatabase.h:194
@ EQUIPMENT_SET_CHANGED
Definition: Player.h:744
@ EQUIPMENT_SET_DELETED
Definition: Player.h:746
@ EQUIPMENT_SET_NEW
Definition: Player.h:745

References CHAR_DEL_EQUIP_SET, CHAR_INS_EQUIP_SET, CHAR_UPD_EQUIP_SET, CharacterDatabase, EQUIPMENT_SET_CHANGED, EQUIPMENT_SET_DELETED, EQUIPMENT_SET_NEW, EQUIPMENT_SET_UNCHANGED, EQUIPMENT_SLOT_END, ObjectGuid::GetCounter(), Object::GetGUID(), EquipmentSet::Guid, EquipmentSet::IconName, EquipmentSet::IgnoreMask, EquipmentSet::Items, m_EquipmentSets, EquipmentSet::Name, PreparedStatementBase::SetData(), and EquipmentSet::state.

Referenced by SaveToDB().

◆ _SaveGlyphs()

void Player::_SaveGlyphs ( CharacterDatabaseTransaction  trans)
protected
14897{
14898 if (!NeedToSaveGlyphs())
14899 return;
14900
14902 stmt->SetData(0, GetGUID().GetCounter());
14903 trans->Append(stmt);
14904
14905 for (uint8 spec = 0; spec < m_specsCount; ++spec)
14906 {
14907 uint8 index = 0;
14908
14909 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GLYPHS);
14910 stmt->SetData(index++, GetGUID().GetCounter());
14911 stmt->SetData(index++, spec);
14912
14913 for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
14914 stmt->SetData(index++, uint16(m_Glyphs[spec][i]));
14915
14916 trans->Append(stmt);
14917 }
14918
14919 SetNeedToSaveGlyphs(false);
14920}
@ CHAR_DEL_CHAR_GLYPHS
Definition: CharacterDatabase.h:417
@ CHAR_INS_CHAR_GLYPHS
Definition: CharacterDatabase.h:451
void SetNeedToSaveGlyphs(bool val)
Definition: Player.h:2565
bool NeedToSaveGlyphs()
Definition: Player.h:2564

References CHAR_DEL_CHAR_GLYPHS, CHAR_INS_CHAR_GLYPHS, CharacterDatabase, Object::GetGUID(), m_Glyphs, m_specsCount, MAX_GLYPH_SLOT_INDEX, NeedToSaveGlyphs(), PreparedStatementBase::SetData(), and SetNeedToSaveGlyphs().

Referenced by SaveToDB().

◆ _SaveInstanceTimeRestrictions()

void Player::_SaveInstanceTimeRestrictions ( CharacterDatabaseTransaction  trans)
protected
15790{
15791 if (_instanceResetTimes.empty())
15792 return;
15793
15795 stmt->SetData(0, GetSession()->GetAccountId());
15796 trans->Append(stmt);
15797
15798 for (InstanceTimeMap::const_iterator itr = _instanceResetTimes.begin(); itr != _instanceResetTimes.end(); ++itr)
15799 {
15800 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ACCOUNT_INSTANCE_LOCK_TIMES);
15801 stmt->SetData(0, GetSession()->GetAccountId());
15802 stmt->SetData(1, itr->first);
15803 stmt->SetData(2, (int64)itr->second);
15804 trans->Append(stmt);
15805 }
15806}
std::int64_t int64
Definition: Define.h:103
@ CHAR_DEL_ACCOUNT_INSTANCE_LOCK_TIMES
Definition: CharacterDatabase.h:133
@ CHAR_INS_ACCOUNT_INSTANCE_LOCK_TIMES
Definition: CharacterDatabase.h:134

References _instanceResetTimes, CHAR_DEL_ACCOUNT_INSTANCE_LOCK_TIMES, CHAR_INS_ACCOUNT_INSTANCE_LOCK_TIMES, CharacterDatabase, GetSession(), and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SaveInventory()

void Player::_SaveInventory ( CharacterDatabaseTransaction  trans)
protected
7265{
7266 CharacterDatabasePreparedStatement* stmt = nullptr;
7267 // force items in buyback slots to new state
7268 // and remove those that aren't already
7269 for (uint8 i = BUYBACK_SLOT_START; i < BUYBACK_SLOT_END; ++i)
7270 {
7271 Item* item = m_items[i];
7272 if (!item)
7273 continue;
7274
7275 if (item->GetState() == ITEM_NEW)
7276 {
7277 // Xinef: item is removed, remove loot from storage if any
7278 if (item->GetTemplate()->Flags & ITEM_FLAG_HAS_LOOT)
7279 sLootItemStorage->RemoveStoredLoot(item->GetGUID());
7280 continue;
7281 }
7282
7283 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM);
7284 stmt->SetData(0, item->GetGUID().GetCounter());
7285 trans->Append(stmt);
7286
7287 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
7288 stmt->SetData(0, item->GetGUID().GetCounter());
7289 trans->Append(stmt);
7291
7292 // Xinef: item is removed, remove loot from storage if any
7293 if (item->GetTemplate()->Flags & ITEM_FLAG_HAS_LOOT)
7294 sLootItemStorage->RemoveStoredLoot(item->GetGUID());
7295 }
7296
7297 // Updated played time for refundable items. We don't do this in Player::Update because there's simply no need for it,
7298 // the client auto counts down in real time after having received the initial played time on the first
7299 // SMSG_ITEM_REFUND_INFO_RESPONSE packet.
7300 // Item::UpdatePlayedTime is only called when needed, which is in DB saves, and item refund info requests.
7301 RefundableItemsSet::iterator i_next;
7302 for (RefundableItemsSet::iterator itr = m_refundableItems.begin(); itr != m_refundableItems.end(); itr = i_next)
7303 {
7304 // use copy iterator because itr may be invalid after operations in this loop
7305 i_next = itr;
7306 ++i_next;
7307
7308 Item* iPtr = GetItemByGuid((*itr));
7309 if (iPtr)
7310 {
7311 iPtr->UpdatePlayedTime(this);
7312 continue;
7313 }
7314 else
7315 {
7316 LOG_ERROR("entities.player", "Can't find item {} but is in refundable storage for player {} ! Removing.", (*itr).ToString(), GetGUID().ToString());
7317 m_refundableItems.erase(itr);
7318 }
7319 }
7320
7321 // update enchantment durations
7322 for (EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr)
7323 itr->item->SetEnchantmentDuration(itr->slot, itr->leftduration, this);
7324
7325 // if no changes
7326 if (m_itemUpdateQueue.empty())
7327 return;
7328
7330 for (size_t i = 0; i < m_itemUpdateQueue.size(); ++i)
7331 {
7332 Item* item = m_itemUpdateQueue[i];
7333 if (!item)
7334 continue;
7335
7336 Bag* container = item->GetContainer();
7337 ObjectGuid::LowType bag_guid = container ? container->GetGUID().GetCounter() : 0;
7338
7339 if (item->GetState() != ITEM_REMOVED)
7340 {
7341 Item* test = GetItemByPos(item->GetBagSlot(), item->GetSlot());
7342 if (!test)
7343 {
7344 ObjectGuid::LowType bagTestGUID = 0;
7345 if (Item* test2 = GetItemByPos(INVENTORY_SLOT_BAG_0, item->GetBagSlot()))
7346 bagTestGUID = test2->GetGUID().GetCounter();
7347 LOG_ERROR("entities.player", "Player(GUID: {} Name: {})::_SaveInventory - the bag({}) and slot({}) values for the item {} (state {}) are incorrect, the player doesn't have an item at that position!",
7348 lowGuid, GetName(), item->GetBagSlot(), item->GetSlot(), item->GetGUID().ToString(), (int32)item->GetState());
7349 // according to the test that was just performed nothing should be in this slot, delete
7350 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT);
7351 stmt->SetData(0, bagTestGUID);
7352 stmt->SetData(1, item->GetSlot());
7353 stmt->SetData(2, lowGuid);
7354 trans->Append(stmt);
7355
7356 RemoveTradeableItem(item); // pussywizard
7357 RemoveEnchantmentDurationsReferences(item); // pussywizard
7358 RemoveItemDurations(item); // pussywizard
7359
7360 // also THIS item should be somewhere else, cheat attempt
7361 item->FSetState(ITEM_REMOVED); // we are IN updateQueue right now, can't use SetState which modifies the queue
7363 // don't skip, let the switch delete it
7364 continue;
7365 }
7366 else if (test != item)
7367 {
7368 LOG_ERROR("entities.player", "Player(GUID: {} Name: {})::_SaveInventory - the bag({}) and slot({}) values for the item ({}) are incorrect, the item ({}) is there instead!",
7369 lowGuid, GetName(), item->GetBagSlot(), item->GetSlot(), item->GetGUID().ToString(), test->GetGUID().ToString());
7370 // save all changes to the item...
7371 if (item->GetState() != ITEM_NEW) // only for existing items, no dupes
7372 item->SaveToDB(trans);
7373 // ...but do not save position in invntory
7374 continue;
7375 }
7376 }
7377
7378 switch (item->GetState())
7379 {
7380 case ITEM_NEW:
7381 case ITEM_CHANGED:
7382 stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_INVENTORY_ITEM);
7383 stmt->SetData(0, lowGuid);
7384 stmt->SetData(1, bag_guid);
7385 stmt->SetData (2, item->GetSlot());
7386 stmt->SetData(3, item->GetGUID().GetCounter());
7387 trans->Append(stmt);
7388 break;
7389 case ITEM_REMOVED:
7390 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM);
7391 stmt->SetData(0, item->GetGUID().GetCounter());
7392 trans->Append(stmt);
7393 case ITEM_UNCHANGED:
7394 break;
7395 }
7396
7397 item->SaveToDB(trans); // item have unchanged inventory record and can be save standalone
7398 }
7399 m_itemUpdateQueue.clear();
7400}
@ CHAR_DEL_ITEM_INSTANCE
Definition: CharacterDatabase.h:127
@ CHAR_DEL_CHAR_INVENTORY_BY_ITEM
Definition: CharacterDatabase.h:430
@ CHAR_REP_INVENTORY_ITEM
Definition: CharacterDatabase.h:123
@ CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT
Definition: CharacterDatabase.h:431
@ ITEM_CHANGED
Definition: Item.h:204
@ ITEM_NEW
Definition: Item.h:205
@ ITEM_FLAG_HAS_LOOT
Definition: ItemTemplate.h:150
@ BUYBACK_SLOT_END
Definition: Player.h:726
#define sLootItemStorage
Definition: LootItemStorage.h:75
uint8 GetSlot() const
Definition: Item.h:272
Bag * GetContainer()
Definition: Item.h:273
ItemUpdateState GetState() const
Definition: Item.h:315
void UpdatePlayedTime(Player *owner)
Definition: Item.cpp:1219
uint8 GetBagSlot() const
Definition: Item.cpp:785
uint32 Flags
Definition: ItemTemplate.h:636
std::vector< Item * > m_itemUpdateQueue
Definition: Player.h:2742
void DeleteRefundReference(ObjectGuid itemGUID)
Definition: Player.cpp:15431
void RemoveTradeableItem(Item *item)
Definition: PlayerStorage.cpp:4161
EnchantDurationList m_enchantDuration
Definition: Player.h:2785
void RemoveItemDurations(Item *item)
Definition: Player.cpp:12363
void RemoveEnchantmentDurationsReferences(Item *item)
Definition: PlayerStorage.cpp:4236
RefundableItemsSet m_refundableItems
Definition: Player.h:2885
Item * GetItemByGuid(ObjectGuid guid) const
Definition: PlayerStorage.cpp:435

References BUYBACK_SLOT_END, BUYBACK_SLOT_START, CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT, CHAR_DEL_CHAR_INVENTORY_BY_ITEM, CHAR_DEL_ITEM_INSTANCE, CHAR_REP_INVENTORY_ITEM, CharacterDatabase, DeleteRefundReference(), ItemTemplate::Flags, Item::FSetState(), Item::GetBagSlot(), Item::GetContainer(), ObjectGuid::GetCounter(), Object::GetGUID(), GetItemByGuid(), GetItemByPos(), WorldObject::GetName(), Item::GetSlot(), Item::GetState(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, ITEM_CHANGED, ITEM_FLAG_HAS_LOOT, ITEM_NEW, ITEM_REMOVED, ITEM_UNCHANGED, LOG_ERROR, m_enchantDuration, m_items, m_itemUpdateQueue, m_refundableItems, RemoveEnchantmentDurationsReferences(), RemoveItemDurations(), RemoveTradeableItem(), Item::SaveToDB(), PreparedStatementBase::SetData(), sLootItemStorage, ObjectGuid::ToString(), Position::ToString(), and Item::UpdatePlayedTime().

Referenced by SaveInventoryAndGoldToDB(), and SaveToDB().

◆ _SaveMail()

void Player::_SaveMail ( CharacterDatabaseTransaction  trans)
protected
7403{
7404 if (!GetMailSize() || !m_mailsUpdated)
7405 {
7406 return;
7407 }
7408
7409 CharacterDatabasePreparedStatement* stmt = nullptr;
7410
7411 for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
7412 {
7413 Mail* m = (*itr);
7414 if (m->state == MAIL_STATE_CHANGED)
7415 {
7416 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_MAIL);
7417 stmt->SetData(0, uint8(m->HasItems() ? 1 : 0));
7418 stmt->SetData(1, uint32(m->expire_time));
7419 stmt->SetData(2, uint32(m->deliver_time));
7420 stmt->SetData(3, m->money);
7421 stmt->SetData(4, m->COD);
7422 stmt->SetData(5, uint8(m->checked));
7423 stmt->SetData(6, m->messageID);
7424
7425 trans->Append(stmt);
7426
7427 if (!m->removedItems.empty())
7428 {
7429 for (std::vector<uint32>::iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2)
7430 {
7431 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM);
7432 stmt->SetData(0, *itr2);
7433 trans->Append(stmt);
7434 }
7435 m->removedItems.clear();
7436 }
7438 }
7439 else if (m->state == MAIL_STATE_DELETED)
7440 {
7441 if (m->HasItems())
7442 {
7443 for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
7444 {
7445 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
7446 stmt->SetData(0, itr2->item_guid);
7447 trans->Append(stmt);
7448 }
7449 }
7450 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID);
7451 stmt->SetData(0, m->messageID);
7452 trans->Append(stmt);
7453
7454 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID);
7455 stmt->SetData(0, m->messageID);
7456 trans->Append(stmt);
7457 }
7458 }
7459
7460 //deallocate deleted mails...
7461 for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end();)
7462 {
7463 if ((*itr)->state == MAIL_STATE_DELETED)
7464 {
7465 Mail* m = *itr;
7466 m_mail.erase(itr);
7467 delete m;
7468 itr = m_mail.begin();
7469 }
7470 else
7471 ++itr;
7472 }
7473
7474 m_mailsUpdated = false;
7475}
@ CHAR_UPD_MAIL
Definition: CharacterDatabase.h:432
@ CHAR_DEL_MAIL_BY_ID
Definition: CharacterDatabase.h:110
@ CHAR_DEL_MAIL_ITEM_BY_ID
Definition: CharacterDatabase.h:377
@ MAIL_STATE_DELETED
Definition: Mail.h:71
@ MAIL_STATE_CHANGED
Definition: Mail.h:70
uint32 GetMailSize()
Definition: Player.h:1621
bool HasItems() const
Definition: Mail.h:207
std::vector< uint32 > removedItems
Definition: Mail.h:178
std::vector< MailItemInfo > items
Definition: Mail.h:177

References CHAR_DEL_ITEM_INSTANCE, CHAR_DEL_MAIL_BY_ID, CHAR_DEL_MAIL_ITEM, CHAR_DEL_MAIL_ITEM_BY_ID, CHAR_UPD_MAIL, CharacterDatabase, Mail::checked, Mail::COD, Mail::deliver_time, Mail::expire_time, GetMailSize(), Mail::HasItems(), Mail::items, m_mail, m_mailsUpdated, MAIL_STATE_CHANGED, MAIL_STATE_DELETED, MAIL_STATE_UNCHANGED, Mail::messageID, Mail::money, Mail::removedItems, PreparedStatementBase::SetData(), and Mail::state.

Referenced by WorldSession::HandleMailTakeItem(), WorldSession::HandleMailTakeMoney(), and SaveToDB().

◆ _SaveMonthlyQuestStatus()

void Player::_SaveMonthlyQuestStatus ( CharacterDatabaseTransaction  trans)
protected
7640{
7641 if (!m_MonthlyQuestChanged || m_monthlyquests.empty())
7642 return;
7643
7644 // we don't need transactions here.
7646 stmt->SetData(0, GetGUID().GetCounter());
7647 trans->Append(stmt);
7648
7649 for (QuestSet::const_iterator iter = m_monthlyquests.begin(); iter != m_monthlyquests.end(); ++iter)
7650 {
7651 uint32 quest_id = *iter;
7652 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_MONTHLYQUESTSTATUS);
7653 stmt->SetData(0, GetGUID().GetCounter());
7654 stmt->SetData(1, quest_id);
7655 trans->Append(stmt);
7656 }
7657
7658 m_MonthlyQuestChanged = false;
7659}
@ CHAR_INS_CHARACTER_MONTHLYQUESTSTATUS
Definition: CharacterDatabase.h:76
@ CHAR_DEL_QUEST_STATUS_MONTHLY_CHAR
Definition: CharacterDatabase.h:61

References CHAR_DEL_QUEST_STATUS_MONTHLY_CHAR, CHAR_INS_CHARACTER_MONTHLYQUESTSTATUS, CharacterDatabase, Object::GetGUID(), m_MonthlyQuestChanged, m_monthlyquests, and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SavePlayerSettings()

void Player::_SavePlayerSettings ( CharacterDatabaseTransaction  trans)
protected
92{
93 if (!sWorld->getBoolConfig(CONFIG_PLAYER_SETTINGS_ENABLED))
94 {
95 return;
96 }
97
98 for (auto& itr : m_charSettingsMap)
99 {
100 std::ostringstream data;
101
102 for (auto& setting : itr.second)
103 {
104 data << setting.value << ' ';
105 }
106
108 stmt->SetData(0, GetGUID().GetCounter());
109 stmt->SetData(1, itr.first);
110 stmt->SetData(2, data.str());
111 trans->Append(stmt);
112 }
113}
@ CHAR_REP_CHAR_SETTINGS
Definition: CharacterDatabase.h:516

References CHAR_REP_CHAR_SETTINGS, CharacterDatabase, CONFIG_PLAYER_SETTINGS_ENABLED, Object::GetGUID(), m_charSettingsMap, PreparedStatementBase::SetData(), and sWorld.

Referenced by SaveToDB().

◆ _SaveQuestStatus()

void Player::_SaveQuestStatus ( CharacterDatabaseTransaction  trans)
protected
7478{
7479 bool isTransaction = static_cast<bool>(trans);
7480 if (!isTransaction)
7481 trans = CharacterDatabase.BeginTransaction();
7482
7483 QuestStatusSaveMap::iterator saveItr;
7484 QuestStatusMap::iterator statusItr;
7485 CharacterDatabasePreparedStatement* stmt = nullptr;
7486
7487 bool keepAbandoned = !(sWorld->GetCleaningFlags() & CharacterDatabaseCleaner::CLEANING_FLAG_QUESTSTATUS);
7488
7489 for (saveItr = m_QuestStatusSave.begin(); saveItr != m_QuestStatusSave.end(); ++saveItr)
7490 {
7491 if (saveItr->second)
7492 {
7493 statusItr = m_QuestStatus.find(saveItr->first);
7494 if (statusItr != m_QuestStatus.end() && (keepAbandoned || statusItr->second.Status != QUEST_STATUS_NONE))
7495 {
7496 uint8 index = 0;
7497 stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHAR_QUESTSTATUS);
7498
7499 stmt->SetData(index++, GetGUID().GetCounter());
7500 stmt->SetData(index++, statusItr->first);
7501 stmt->SetData(index++, uint8(statusItr->second.Status));
7502 stmt->SetData(index++, statusItr->second.Explored);
7503 stmt->SetData(index++, uint32(statusItr->second.Timer / IN_MILLISECONDS + GameTime::GetGameTime().count()));
7504
7505 for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
7506 stmt->SetData(index++, statusItr->second.CreatureOrGOCount[i]);
7507
7508 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
7509 stmt->SetData(index++, statusItr->second.ItemCount[i]);
7510
7511 stmt->SetData(index, statusItr->second.PlayerCount);
7512 trans->Append(stmt);
7513 }
7514 }
7515 else
7516 {
7517 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_BY_QUEST);
7518 stmt->SetData(0, GetGUID().GetCounter());
7519 stmt->SetData(1, saveItr->first);
7520 trans->Append(stmt);
7521 }
7522 }
7523
7524 m_QuestStatusSave.clear();
7525
7526 for (saveItr = m_RewardedQuestsSave.begin(); saveItr != m_RewardedQuestsSave.end(); ++saveItr)
7527 {
7528 if (saveItr->second)
7529 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_QUESTSTATUS_REWARDED);
7530 else // xinef: what the is this? quest can be removed by spelleffect if (!keepAbandoned)
7532
7533 stmt->SetData(0, GetGUID().GetCounter());
7534 stmt->SetData(1, saveItr->first);
7535 trans->Append(stmt);
7536 }
7537
7538 m_RewardedQuestsSave.clear();
7539
7540 if (!isTransaction)
7541 CharacterDatabase.CommitTransaction(trans);
7542}
@ CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST
Definition: CharacterDatabase.h:436
@ CHAR_DEL_CHAR_QUESTSTATUS_BY_QUEST
Definition: CharacterDatabase.h:434
@ CHAR_REP_CHAR_QUESTSTATUS
Definition: CharacterDatabase.h:433
@ CHAR_INS_CHAR_QUESTSTATUS_REWARDED
Definition: CharacterDatabase.h:435
@ CLEANING_FLAG_QUESTSTATUS
Definition: CharacterDatabaseCleaner.h:31
QuestStatusSaveMap m_QuestStatusSave
Definition: Player.h:2748
QuestStatusSaveMap m_RewardedQuestsSave
Definition: Player.h:2751

References CHAR_DEL_CHAR_QUESTSTATUS_BY_QUEST, CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST, CHAR_INS_CHAR_QUESTSTATUS_REWARDED, CHAR_REP_CHAR_QUESTSTATUS, CharacterDatabase, CharacterDatabaseCleaner::CLEANING_FLAG_QUESTSTATUS, ObjectGuid::GetCounter(), GameTime::GetGameTime(), Object::GetGUID(), IN_MILLISECONDS, m_QuestStatus, m_QuestStatusSave, m_RewardedQuestsSave, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_OBJECTIVES_COUNT, QUEST_STATUS_NONE, PreparedStatementBase::SetData(), and sWorld.

Referenced by SaveToDB().

◆ _SaveSeasonalQuestStatus()

void Player::_SaveSeasonalQuestStatus ( CharacterDatabaseTransaction  trans)
protected
7606{
7608 {
7609 return;
7610 }
7611
7612 // we don't need transactions here.
7614 stmt->SetData(0, GetGUID().GetCounter());
7615 trans->Append(stmt);
7616
7617 m_SeasonalQuestChanged = false;
7618
7619 if (m_seasonalquests.empty())
7620 {
7621 return;
7622 }
7623
7624 for (SeasonalEventQuestMap::const_iterator iter = m_seasonalquests.begin(); iter != m_seasonalquests.end(); ++iter)
7625 {
7626 uint16 eventId = iter->first;
7627
7628 for (SeasonalQuestSet::const_iterator itr = iter->second.begin(); itr != iter->second.end(); ++itr)
7629 {
7630 uint32 questId = *itr;
7631
7632 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_SEASONALQUESTSTATUS);
7633 stmt->SetArguments(GetGUID().GetCounter(), questId, eventId);
7634 trans->Append(stmt);
7635 }
7636 }
7637}
@ CHAR_INS_CHARACTER_SEASONALQUESTSTATUS
Definition: CharacterDatabase.h:77
@ CHAR_DEL_QUEST_STATUS_SEASONAL_CHAR
Definition: CharacterDatabase.h:62
void SetArguments(Args &&... args)
Definition: PreparedStatement.h:119

References CHAR_DEL_QUEST_STATUS_SEASONAL_CHAR, CHAR_INS_CHARACTER_SEASONALQUESTSTATUS, CharacterDatabase, Object::GetGUID(), m_SeasonalQuestChanged, m_seasonalquests, PreparedStatementBase::SetArguments(), and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SaveSkills()

void Player::_SaveSkills ( CharacterDatabaseTransaction  trans)
7662{
7663 CharacterDatabasePreparedStatement* stmt = nullptr;
7664 // we don't need transactions here.
7665 for (SkillStatusMap::iterator itr = mSkillStatus.begin(); itr != mSkillStatus.end();)
7666 {
7667 if (itr->second.uState == SKILL_UNCHANGED)
7668 {
7669 ++itr;
7670 continue;
7671 }
7672
7673 if (itr->second.uState == SKILL_DELETED)
7674 {
7675 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SKILL_BY_SKILL);
7676 stmt->SetData(0, GetGUID().GetCounter());
7677 stmt->SetData(1, itr->first);
7678 trans->Append(stmt);
7679
7680 mSkillStatus.erase(itr++);
7681 continue;
7682 }
7683
7684 uint32 valueData = GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos));
7685 uint16 value = SKILL_VALUE(valueData);
7686 uint16 max = SKILL_MAX(valueData);
7687
7688 switch (itr->second.uState)
7689 {
7690 case SKILL_NEW:
7691 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILLS);
7692 stmt->SetData(0, GetGUID().GetCounter());
7693 stmt->SetData(1, uint16(itr->first));
7694 stmt->SetData(2, value);
7695 stmt->SetData(3, max);
7696 trans->Append(stmt);
7697
7698 break;
7699 case SKILL_CHANGED:
7700 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_SKILLS);
7701 stmt->SetData(0, value);
7702 stmt->SetData(1, max);
7703 stmt->SetData(2, GetGUID().GetCounter());
7704 stmt->SetData(3, uint16(itr->first));
7705 trans->Append(stmt);
7706
7707 break;
7708 default:
7709 break;
7710 }
7711 itr->second.uState = SKILL_UNCHANGED;
7712
7713 ++itr;
7714 }
7715}
@ CHAR_INS_CHAR_SKILLS
Definition: CharacterDatabase.h:441
@ CHAR_UDP_CHAR_SKILLS
Definition: CharacterDatabase.h:442
@ CHAR_DEL_CHAR_SKILL_BY_SKILL
Definition: CharacterDatabase.h:440
#define SKILL_MAX(x)
Definition: Player.h:84
#define SKILL_VALUE(x)
Definition: Player.h:83
@ SKILL_DELETED
Definition: Player.h:643
@ SKILL_CHANGED
Definition: Player.h:641
@ SKILL_NEW
Definition: Player.h:642

References CHAR_DEL_CHAR_SKILL_BY_SKILL, CHAR_INS_CHAR_SKILLS, CHAR_UDP_CHAR_SKILLS, CharacterDatabase, Object::GetGUID(), Object::GetUInt32Value(), mSkillStatus, PLAYER_SKILL_VALUE_INDEX, PreparedStatementBase::SetData(), SKILL_CHANGED, SKILL_DELETED, SKILL_MAX, SKILL_NEW, SKILL_UNCHANGED, and SKILL_VALUE.

Referenced by SaveToDB().

◆ _SaveSpellCooldowns()

void Player::_SaveSpellCooldowns ( CharacterDatabaseTransaction  trans,
bool  logout 
)
3576{
3578 stmt->SetData(0, GetGUID().GetCounter());
3579 trans->Append(stmt);
3580
3581 time_t curTime = GameTime::GetGameTime().count();
3582 uint32 curMSTime = GameTime::GetGameTimeMS().count();
3583 uint32 infTime = curMSTime + infinityCooldownDelayCheck;
3584
3585 bool first_round = true;
3586 std::ostringstream ss;
3587
3588 // remove outdated and save active
3589 for (SpellCooldowns::iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end();)
3590 {
3591 // Xinef: dummy cooldown for procs
3592 if (itr->first == uint32(-1))
3593 {
3594 ++itr;
3595 continue;
3596 }
3597
3598 if (itr->second.end <= curMSTime + 1000)
3599 m_spellCooldowns.erase(itr++);
3600 else if (itr->second.end <= infTime && (logout || itr->second.end > (curMSTime + 5 * MINUTE * IN_MILLISECONDS))) // not save locked cooldowns, it will be reset or set at reload
3601 {
3602 if (first_round)
3603 {
3604 ss << "INSERT INTO character_spell_cooldown (guid, spell, category, item, time, needSend) VALUES ";
3605 first_round = false;
3606 }
3607 // next new/changed record prefix
3608 else
3609 ss << ',';
3610
3611 uint64 cooldown = uint64(((itr->second.end - curMSTime) / IN_MILLISECONDS) + curTime);
3612 ss << '(' << GetGUID().GetCounter() << ',' << itr->first << ',' << itr->second.category << "," << itr->second.itemid << ',' << cooldown << ',' << (itr->second.needSendToClient ? '1' : '0') << ')';
3613 ++itr;
3614 }
3615 else
3616 ++itr;
3617 }
3618 // if something changed execute
3619 if (!first_round)
3620 trans->Append(ss.str().c_str());
3621}
@ CHAR_DEL_CHAR_SPELL_COOLDOWN
Definition: CharacterDatabase.h:401
static constexpr uint32 infinityCooldownDelayCheck
Definition: Unit.h:155

References CHAR_DEL_CHAR_SPELL_COOLDOWN, CharacterDatabase, ObjectGuid::GetCounter(), GameTime::GetGameTime(), GameTime::GetGameTimeMS(), Object::GetGUID(), IN_MILLISECONDS, infinityCooldownDelayCheck, m_spellCooldowns, MINUTE, and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SaveSpells()

void Player::_SaveSpells ( CharacterDatabaseTransaction  trans)
protected
7718{
7719 CharacterDatabasePreparedStatement* stmt = nullptr;
7720
7721 for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end();)
7722 {
7723 // xinef: skip temporary spells
7724 if (itr->second->State == PLAYERSPELL_TEMPORARY)
7725 {
7726 ++itr;
7727 continue;
7728 }
7729
7730 // xinef: Delete statement for removed / updated spell
7731 if (itr->second->State == PLAYERSPELL_REMOVED || itr->second->State == PLAYERSPELL_CHANGED)
7732 {
7733 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL);
7734 stmt->SetData(0, GetGUID().GetCounter());
7735 stmt->SetData(1, itr->first);
7736 trans->Append(stmt);
7737 }
7738
7739 // xinef: insert statement for new / updated spell
7740 if (itr->second->State == PLAYERSPELL_NEW || itr->second->State == PLAYERSPELL_CHANGED)
7741 {
7742 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SPELL);
7743 stmt->SetData(0, GetGUID().GetCounter());
7744 stmt->SetData(1, itr->first);
7745 stmt->SetData(2, itr->second->specMask);
7746 trans->Append(stmt);
7747 }
7748
7749 if (itr->second->State == PLAYERSPELL_REMOVED)
7750 {
7751 delete itr->second;
7752 m_spells.erase(itr++);
7753 }
7754 else
7755 {
7756 itr->second->State = PLAYERSPELL_UNCHANGED;
7757 ++itr;
7758 }
7759 }
7760}
@ CHAR_INS_CHAR_SPELL
Definition: CharacterDatabase.h:443
@ CHAR_DEL_CHAR_SPELL_BY_SPELL
Definition: CharacterDatabase.h:394

References CHAR_DEL_CHAR_SPELL_BY_SPELL, CHAR_INS_CHAR_SPELL, CharacterDatabase, Object::GetGUID(), m_spells, PLAYERSPELL_CHANGED, PLAYERSPELL_NEW, PLAYERSPELL_REMOVED, PLAYERSPELL_TEMPORARY, PLAYERSPELL_UNCHANGED, and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SaveStats()

void Player::_SaveStats ( CharacterDatabaseTransaction  trans)
protected
7765{
7766 // check if stat saving is enabled and if char level is high enough
7767 if (!sWorld->getIntConfig(CONFIG_MIN_LEVEL_STAT_SAVE) || GetLevel() < sWorld->getIntConfig(CONFIG_MIN_LEVEL_STAT_SAVE))
7768 return;
7769
7770 CharacterDatabasePreparedStatement* stmt = nullptr;
7771
7772 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_STATS);
7773 stmt->SetData(0, GetGUID().GetCounter());
7774 trans->Append(stmt);
7775
7776 uint8 index = 0;
7777
7778 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_STATS);
7779 stmt->SetData(index++, GetGUID().GetCounter());
7780 stmt->SetData(index++, GetMaxHealth());
7781
7782 for (uint8 i = 0; i < MAX_POWERS; ++i)
7783 stmt->SetData(index++, GetMaxPower(Powers(i)));
7784
7785 for (uint8 i = 0; i < MAX_STATS; ++i)
7786 stmt->SetData(index++, GetStat(Stats(i)));
7787
7788 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
7789 stmt->SetData(index++, GetResistance(SpellSchools(i)));
7790
7799 stmt->SetData(index++, GetBaseSpellPowerBonus());
7801
7802 trans->Append(stmt);
7803}
@ CHAR_DEL_CHAR_STATS
Definition: CharacterDatabase.h:444
@ CHAR_INS_CHAR_STATS
Definition: CharacterDatabase.h:445
@ PLAYER_RANGED_CRIT_PERCENTAGE
Definition: UpdateFields.h:352
@ PLAYER_CRIT_PERCENTAGE
Definition: UpdateFields.h:351
@ PLAYER_SPELL_CRIT_PERCENTAGE1
Definition: UpdateFields.h:354
@ PLAYER_FIELD_COMBAT_RATING_1
Definition: UpdateFields.h:380
@ PLAYER_PARRY_PERCENTAGE
Definition: UpdateFields.h:348
@ PLAYER_BLOCK_PERCENTAGE
Definition: UpdateFields.h:346
@ UNIT_FIELD_RANGED_ATTACK_POWER
Definition: UpdateFields.h:165
@ PLAYER_DODGE_PERCENTAGE
Definition: UpdateFields.h:347
@ UNIT_FIELD_ATTACK_POWER
Definition: UpdateFields.h:162
@ CONFIG_MIN_LEVEL_STAT_SAVE
Definition: IWorld.h:348
#define MAX_STATS
Definition: SharedDefines.h:265
SpellSchools
Definition: SharedDefines.h:282
constexpr auto MAX_SPELL_SCHOOL
Definition: SharedDefines.h:292
Stats
Definition: SharedDefines.h:257
float GetFloatValue(uint16 index) const
Definition: Object.cpp:317
uint32 GetBaseSpellPowerBonus()
Definition: Player.h:1934
uint32 GetResistance(SpellSchools school) const
Definition: Unit.h:1449
uint32 GetMaxHealth() const
Definition: Unit.h:1455
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:1476
float GetStat(Stats stat) const
Definition: Unit.h:1444

References CHAR_DEL_CHAR_STATS, CHAR_INS_CHAR_STATS, CharacterDatabase, CONFIG_MIN_LEVEL_STAT_SAVE, CR_CRIT_TAKEN_SPELL, GetBaseSpellPowerBonus(), Object::GetFloatValue(), Object::GetGUID(), Unit::GetLevel(), Unit::GetMaxHealth(), Unit::GetMaxPower(), Unit::GetResistance(), Unit::GetStat(), Object::GetUInt32Value(), MAX_POWERS, MAX_SPELL_SCHOOL, MAX_STATS, PLAYER_BLOCK_PERCENTAGE, PLAYER_CRIT_PERCENTAGE, PLAYER_DODGE_PERCENTAGE, PLAYER_FIELD_COMBAT_RATING_1, PLAYER_PARRY_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, PLAYER_SPELL_CRIT_PERCENTAGE1, PreparedStatementBase::SetData(), sWorld, UNIT_FIELD_ATTACK_POWER, and UNIT_FIELD_RANGED_ATTACK_POWER.

Referenced by SaveToDB().

◆ _SaveTalents()

void Player::_SaveTalents ( CharacterDatabaseTransaction  trans)
protected
14944{
14945 CharacterDatabasePreparedStatement* stmt = nullptr;
14946
14947 for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end();)
14948 {
14949 // xinef: skip temporary spells
14950 if (itr->second->State == PLAYERSPELL_TEMPORARY)
14951 {
14952 ++itr;
14953 continue;
14954 }
14955
14956 // xinef: delete statement for removed / updated talent
14957 if (itr->second->State == PLAYERSPELL_REMOVED || itr->second->State == PLAYERSPELL_CHANGED)
14958 {
14959 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_TALENT_BY_SPELL);
14960 stmt->SetData(0, GetGUID().GetCounter());
14961 stmt->SetData(1, itr->first);
14962 trans->Append(stmt);
14963 }
14964
14965 // xinef: insert statement for new / updated spell
14966 if (itr->second->State == PLAYERSPELL_NEW || itr->second->State == PLAYERSPELL_CHANGED)
14967 {
14968 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_TALENT);
14969 stmt->SetData(0, GetGUID().GetCounter());
14970 stmt->SetData(1, itr->first);
14971 stmt->SetData(2, itr->second->specMask);
14972 trans->Append(stmt);
14973 }
14974
14975 if (itr->second->State == PLAYERSPELL_REMOVED)
14976 {
14977 delete itr->second;
14978 m_talents.erase(itr++);
14979 }
14980 else
14981 {
14982 itr->second->State = PLAYERSPELL_UNCHANGED;
14983 ++itr;
14984 }
14985 }
14986}
@ CHAR_INS_CHAR_TALENT
Definition: CharacterDatabase.h:453
@ CHAR_DEL_CHAR_TALENT_BY_SPELL
Definition: CharacterDatabase.h:452

References CHAR_DEL_CHAR_TALENT_BY_SPELL, CHAR_INS_CHAR_TALENT, CharacterDatabase, Object::GetGUID(), m_talents, PLAYERSPELL_CHANGED, PLAYERSPELL_NEW, PLAYERSPELL_REMOVED, PLAYERSPELL_TEMPORARY, PLAYERSPELL_UNCHANGED, and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _SaveWeeklyQuestStatus()

void Player::_SaveWeeklyQuestStatus ( CharacterDatabaseTransaction  trans)
protected
7583{
7584 if (!m_WeeklyQuestChanged || m_weeklyquests.empty())
7585 return;
7586
7587 // we don't need transactions here.
7589 stmt->SetData(0, GetGUID().GetCounter());
7590 trans->Append(stmt);
7591
7592 for (QuestSet::const_iterator iter = m_weeklyquests.begin(); iter != m_weeklyquests.end(); ++iter)
7593 {
7594 uint32 quest_id = *iter;
7595
7596 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_WEEKLYQUESTSTATUS);
7597 stmt->SetData(0, GetGUID().GetCounter());
7598 stmt->SetData(1, quest_id);
7599 trans->Append(stmt);
7600 }
7601
7602 m_WeeklyQuestChanged = false;
7603}
@ CHAR_DEL_QUEST_STATUS_WEEKLY_CHAR
Definition: CharacterDatabase.h:60
@ CHAR_INS_CHARACTER_WEEKLYQUESTSTATUS
Definition: CharacterDatabase.h:75

References CHAR_DEL_QUEST_STATUS_WEEKLY_CHAR, CHAR_INS_CHARACTER_WEEKLYQUESTSTATUS, CharacterDatabase, Object::GetGUID(), m_WeeklyQuestChanged, m_weeklyquests, and PreparedStatementBase::SetData().

Referenced by SaveToDB().

◆ _StoreItem()

Item * Player::_StoreItem ( uint16  pos,
Item pItem,
uint32  count,
bool  clone,
bool  update 
)
private
2632{
2633 if (!pItem)
2634 return nullptr;
2635
2636 uint8 bag = pos >> 8;
2637 uint8 slot = pos & 255;
2638
2639 LOG_DEBUG("entities.player.items", "STORAGE: StoreItem bag = {}, slot = {}, item = {}, count = {}, {}", bag, slot, pItem->GetEntry(), count, pItem->GetGUID().ToString());
2640
2641 Item* pItem2 = GetItemByPos(bag, slot);
2642
2643 if (!pItem2)
2644 {
2645 if (clone)
2646 pItem = pItem->CloneItem(count, this);
2647 else
2648 pItem->SetCount(count);
2649
2650 if (!pItem)
2651 return nullptr;
2652
2653 if (pItem->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP ||
2654 pItem->GetTemplate()->Bonding == BIND_QUEST_ITEM ||
2655 (pItem->GetTemplate()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos)))
2656 pItem->SetBinding(true);
2657
2658 Bag* pBag = (bag == INVENTORY_SLOT_BAG_0) ? nullptr : GetBagByPos(bag);
2659 if (!pBag)
2660 {
2661 m_items[slot] = pItem;
2662 SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID());
2665
2666 pItem->SetSlot(slot);
2667 pItem->SetContainer(nullptr);
2668
2669 // need update known currency
2671 AddKnownCurrency(pItem->GetEntry());
2672 }
2673 else
2674 pBag->StoreItem(slot, pItem, update);
2675
2676 if (IsInWorld() && update)
2677 {
2678 pItem->AddToWorld();
2679 pItem->SendUpdateToPlayer(this);
2680 }
2681
2682 pItem->SetState(ITEM_CHANGED, this);
2683 if (pBag)
2684 pBag->SetState(ITEM_CHANGED, this);
2685
2687 AddItemDurations(pItem);
2688
2689 return pItem;
2690 }
2691 else
2692 {
2693 if (pItem2->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP ||
2694 pItem2->GetTemplate()->Bonding == BIND_QUEST_ITEM ||
2695 (pItem2->GetTemplate()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos)))
2696 pItem2->SetBinding(true);
2697
2698 pItem2->SetCount(pItem2->GetCount() + count);
2699 if (IsInWorld() && update)
2700 pItem2->SendUpdateToPlayer(this);
2701
2702 if (!clone)
2703 {
2704 // delete item (it not in any slot currently)
2705 if (IsInWorld() && update)
2706 {
2707 pItem->RemoveFromWorld();
2708 pItem->DestroyForPlayer(this);
2709 }
2710
2712 RemoveItemDurations(pItem);
2713
2714 pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor
2715 pItem->SetNotRefundable(this);
2716 pItem->ClearSoulboundTradeable(this);
2717 RemoveTradeableItem(pItem);
2718 pItem->SetState(ITEM_REMOVED, this);
2719 }
2720
2722
2723 pItem2->SetState(ITEM_CHANGED, this);
2724
2725 return pItem2;
2726 }
2727}
@ BIND_WHEN_EQUIPED
Definition: ItemTemplate.h:98
@ BIND_QUEST_ITEM
Definition: ItemTemplate.h:100
@ BIND_WHEN_PICKED_UP
Definition: ItemTemplate.h:97
@ PLAYER_FIELD_INV_SLOT_HEAD
Definition: UpdateFields.h:327
@ ITEM_FIELD_OWNER
Definition: UpdateFields.h:35
@ ITEM_FIELD_CONTAINED
Definition: UpdateFields.h:36
@ CURRENCYTOKEN_SLOT_END
Definition: Player.h:738
@ CURRENCYTOKEN_SLOT_START
Definition: Player.h:737
void StoreItem(uint8 slot, Item *pItem, bool update)
Definition: Bag.cpp:154
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition: Item.cpp:715
void SetBinding(bool val)
Definition: Item.h:229
Item * CloneItem(uint32 count, Player const *player=nullptr) const
Definition: Item.cpp:1119
void SetCount(uint32 value)
Definition: Item.h:264
void SetNotRefundable(Player *owner, bool changestate=true, CharacterDatabaseTransaction *trans=nullptr)
Definition: Item.cpp:1201
void SetSlot(uint8 slot)
Definition: Item.h:275
uint32 GetCount() const
Definition: Item.h:263
void SetOwnerGUID(ObjectGuid guid)
Definition: Item.h:226
void SetContainer(Bag *container)
Definition: Item.h:277
uint32 Bonding
Definition: ItemTemplate.h:672
virtual void DestroyForPlayer(Player *target, bool onDeath=false) const
Definition: Object.cpp:274
void SetGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:723
virtual void AddToWorld()
Definition: Object.cpp:152
virtual void RemoveFromWorld()
Definition: Object.cpp:166
void SendUpdateToPlayer(Player *player)
Definition: Object.cpp:246
Bag * GetBagByPos(uint8 slot) const
Definition: PlayerStorage.cpp:485
void AddEnchantmentDurations(Item *item)
Definition: PlayerStorage.cpp:4208
void RemoveEnchantmentDurations(Item *item)
Definition: PlayerStorage.cpp:4221
void AddItemDurations(Item *item)
Definition: Player.cpp:12375
void AddKnownCurrency(uint32 itemId)
Definition: Player.cpp:14127

References AddEnchantmentDurations(), AddItemDurations(), AddKnownCurrency(), Object::AddToWorld(), BIND_QUEST_ITEM, BIND_WHEN_EQUIPED, BIND_WHEN_PICKED_UP, ItemTemplate::Bonding, Item::ClearSoulboundTradeable(), Item::CloneItem(), CURRENCYTOKEN_SLOT_END, CURRENCYTOKEN_SLOT_START, Object::DestroyForPlayer(), GetBagByPos(), Item::GetCount(), Object::GetEntry(), Object::GetGUID(), GetItemByPos(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, IsBagPos(), Object::IsInWorld(), ITEM_CHANGED, ITEM_FIELD_CONTAINED, ITEM_FIELD_OWNER, ITEM_REMOVED, LOG_DEBUG, m_items, PLAYER_FIELD_INV_SLOT_HEAD, RemoveEnchantmentDurations(), Object::RemoveFromWorld(), RemoveItemDurations(), RemoveTradeableItem(), Object::SendUpdateToPlayer(), Item::SetBinding(), Item::SetContainer(), Item::SetCount(), Object::SetGuidValue(), Item::SetNotRefundable(), Item::SetOwnerGUID(), Item::SetSlot(), Item::SetState(), Bag::StoreItem(), and ObjectGuid::ToString().

Referenced by StoreItem().

◆ _StoreOrEquipNewItem()

bool Player::_StoreOrEquipNewItem ( uint32  vendorslot,
uint32  item,
uint8  count,
uint8  bag,
uint8  slot,
int32  price,
ItemTemplate const *  pProto,
Creature pVendor,
VendorItem const *  crItem,
bool  bStore 
)
inline
10562{
10563 ItemPosCountVec vDest;
10564 uint16 uiDest = 0;
10565 InventoryResult msg = bStore ?
10566 CanStoreNewItem(bag, slot, vDest, item, pProto->BuyCount * count) :
10567 CanEquipNewItem(slot, uiDest, item, false);
10568 if (msg != EQUIP_ERR_OK)
10569 {
10570 SendEquipError(msg, nullptr, nullptr, item);
10571 return false;
10572 }
10573
10574 ModifyMoney(-price);
10575
10576 if (crItem->ExtendedCost) // case for new honor system
10577 {
10578 ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost);
10579 if (iece->reqhonorpoints)
10580 ModifyHonorPoints(- int32(iece->reqhonorpoints * count));
10581
10582 if (iece->reqarenapoints)
10583 ModifyArenaPoints(- int32(iece->reqarenapoints * count));
10584
10585 for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i)
10586 {
10587 if (iece->reqitem[i])
10588 DestroyItemCount(iece->reqitem[i], (iece->reqitemcount[i] * count), true);
10589 }
10590 }
10591
10592 sScriptMgr->OnBeforeStoreOrEquipNewItem(this, vendorslot, item, count, bag, slot, pProto, pVendor, crItem, bStore);
10593
10594 Item* it = bStore ? StoreNewItem(vDest, item, true) : EquipNewItem(uiDest, item, true);
10595 if (it)
10596 {
10597 uint32 new_count = pVendor->UpdateVendorItemCurrentCount(crItem, pProto->BuyCount * count);
10598
10599 WorldPacket data(SMSG_BUY_ITEM, (8 + 4 + 4 + 4));
10600 data << pVendor->GetGUID();
10601 data << uint32(vendorslot + 1); // numbered from 1 at client
10602 data << int32(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF);
10603 data << uint32(count);
10604 GetSession()->SendPacket(&data);
10605 SendNewItem(it, pProto->BuyCount * count, true, false, false);
10606
10607 if (!bStore)
10609
10610 if (pProto->Flags & ITEM_FLAG_ITEM_PURCHASE_RECORD && crItem->ExtendedCost && pProto->GetMaxStackSize() == 1)
10611 {
10613 it->SetRefundRecipient(GetGUID().GetCounter());
10614 it->SetPaidMoney(price);
10615 it->SetPaidExtendedCost(crItem->ExtendedCost);
10616 it->SaveRefundDataToDB();
10618 }
10619 }
10620
10621 sScriptMgr->OnAfterStoreOrEquipNewItem(this, vendorslot, it, count, bag, slot, pProto, pVendor, crItem, bStore);
10622
10623 return true;
10624}
DBCStorage< ItemExtendedCostEntry > sItemExtendedCostStore(ItemExtendedCostEntryfmt)
InventoryResult
Definition: Item.h:40
@ ITEM_FLAG_ITEM_PURCHASE_RECORD
Definition: ItemTemplate.h:160
#define MAX_ITEM_EXTENDED_COST_REQUIREMENTS
Definition: DBCStructure.h:1173
@ SMSG_BUY_ITEM
Definition: Opcodes.h:450
uint32 UpdateVendorItemCurrentCount(VendorItem const *vItem, uint32 used_count)
Definition: Creature.cpp:3013
void SaveRefundDataToDB()
Definition: Item.cpp:1173
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:845
InventoryResult CanEquipNewItem(uint8 slot, uint16 &dest, uint32 item, bool swap) const
Definition: PlayerStorage.cpp:1819
bool ModifyMoney(int32 amount, bool sendError=true)
Definition: Player.cpp:11430
Item * EquipNewItem(uint16 pos, uint32 item, bool update)
Definition: PlayerStorage.cpp:2729
void SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast=false, bool sendChatMessage=true)
Definition: PlayerStorage.cpp:4770
void AutoUnequipOffhandIfNeed(bool force=false)
Definition: Player.cpp:12384
void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
Definition: PlayerStorage.cpp:3143
void ModifyHonorPoints(int32 value, CharacterDatabaseTransaction trans=CharacterDatabaseTransaction(nullptr))
Definition: Player.cpp:6186
void ModifyArenaPoints(int32 value, CharacterDatabaseTransaction trans=CharacterDatabaseTransaction(nullptr))
If trans is specified, honor save query will be added to trans.
Definition: Player.cpp:6202
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0)
Definition: PlayerStorage.cpp:2546
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition: PlayerStorage.cpp:4043
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition: Player.h:1260
Definition: WorldPacket.h:27
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:212
Definition: DBCStructure.h:1176
uint32 reqarenapoints
Definition: DBCStructure.h:1179
uint32 reqitemcount[MAX_ITEM_EXTENDED_COST_REQUIREMENTS]
Definition: DBCStructure.h:1182
uint32 reqitem[MAX_ITEM_EXTENDED_COST_REQUIREMENTS]
Definition: DBCStructure.h:1181
uint32 reqhonorpoints
Definition: DBCStructure.h:1178

References AddRefundReference(), AutoUnequipOffhandIfNeed(), ItemTemplate::BuyCount, CanEquipNewItem(), CanStoreNewItem(), DestroyItemCount(), EQUIP_ERR_OK, EquipNewItem(), VendorItem::ExtendedCost, ItemTemplate::Flags, Object::GetGUID(), ItemTemplate::GetMaxStackSize(), GetSession(), ITEM_FIELD_FLAG_REFUNDABLE, ITEM_FIELD_FLAGS, ITEM_FLAG_ITEM_PURCHASE_RECORD, MAX_ITEM_EXTENDED_COST_REQUIREMENTS, VendorItem::maxcount, ModifyArenaPoints(), ModifyHonorPoints(), ModifyMoney(), ItemExtendedCostEntry::reqarenapoints, ItemExtendedCostEntry::reqhonorpoints, ItemExtendedCostEntry::reqitem, ItemExtendedCostEntry::reqitemcount, Item::SaveRefundDataToDB(), SendEquipError(), SendNewItem(), WorldSession::SendPacket(), Object::SetFlag(), Item::SetPaidExtendedCost(), Item::SetPaidMoney(), Item::SetRefundRecipient(), sItemExtendedCostStore, SMSG_BUY_ITEM, sScriptMgr, StoreNewItem(), and Creature::UpdateVendorItemCurrentCount().

Referenced by BuyItemFromVendorSlot().

◆ AbandonQuest()

void Player::AbandonQuest ( uint32  quest_id)
930{
931 if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
932 {
933 // It will Destroy quest items on quests abandons.
934 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
935 if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
936 if (quest->RequiredItemCount[i] > 0 && itemTemplate->Bonding == BIND_QUEST_ITEM)
937 DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true);
938
939 for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
940 if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->ItemDrop[i]))
941 if (quest->ItemDropQuantity[i] > 0 && itemTemplate->Bonding == BIND_QUEST_ITEM)
942 DestroyItemCount(quest->ItemDrop[i], quest->ItemDropQuantity[i], true);
943 }
944}
#define QUEST_SOURCE_ITEM_IDS_COUNT
Definition: QuestDef.h:37

References BIND_QUEST_ITEM, DestroyItemCount(), QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SOURCE_ITEM_IDS_COUNT, and sObjectMgr.

Referenced by WorldSession::HandleQuestLogRemoveQuest().

◆ ActivateSpec()

void Player::ActivateSpec ( uint8  spec)
14989{
14990 // xinef: some basic checks
14991 if (GetActiveSpec() == spec)
14992 return;
14993
14994 if (spec > GetSpecsCount())
14995 return;
14996
14997 // xinef: interrupt currently casted spell just in case
14998 if (IsNonMeleeSpellCast(false))
15000
15001 // xinef: save current actions order
15002 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
15003 _SaveActions(trans);
15004 CharacterDatabase.CommitTransaction(trans);
15005
15006 // xinef: remove pet, it will be resummoned later
15007 if (Pet* pet = GetPet())
15009
15010 // xinef: remove other summoned units and clear reactives
15014
15015 // xinef: let client clear his current Actions
15017 uint8 oldSpec = GetActiveSpec();
15018
15019 std::unordered_set<uint32> removedSpecAuras;
15020
15021 // xinef: reset talent auras
15022 for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr)
15023 {
15024 if (itr->second->State == PLAYERSPELL_REMOVED)
15025 continue;
15026
15027 // xinef: remove all active talent auras
15028 if (!(itr->second->specMask & GetActiveSpecMask()))
15029 continue;
15030
15031 _removeTalentAurasAndSpells(itr->first);
15032
15033 // pussywizard: was => isn't
15034 if (!itr->second->IsInSpec(spec) && !itr->second->inSpellBook)
15035 SendLearnPacket(itr->first, false);
15036
15037 removedSpecAuras.insert(itr->first);
15038 }
15039
15040 // xinef: remove glyph auras
15041 for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot)
15042 if (uint32 glyphId = m_Glyphs[GetActiveSpec()][slot])
15043 if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyphId))
15044 {
15045 RemoveAurasDueToSpell(glyphEntry->SpellId);
15046 removedSpecAuras.insert(glyphEntry->SpellId);
15047 }
15048
15049 // xinef: set active spec as new one
15050 SetActiveSpec(spec);
15051 uint32 spentTalents = 0;
15052
15053 // xinef: add talent auras
15054 for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr)
15055 {
15056 if (itr->second->State == PLAYERSPELL_REMOVED)
15057 continue;
15058
15059 // xinef: talent not in new spec
15060 if (!(itr->second->specMask & GetActiveSpecMask()))
15061 continue;
15062
15063 // pussywizard: wasn't => is
15064 if (!itr->second->IsInSpec(oldSpec) && !itr->second->inSpellBook)
15065 SendLearnPacket(itr->first, true);
15066
15067 _addTalentAurasAndSpells(itr->first);
15068 TalentSpellPos const* talentPos = GetTalentSpellPos(itr->first);
15069 spentTalents += talentPos->rank + 1;
15070
15071 removedSpecAuras.erase(itr->first);
15072 }
15073
15074 // pussywizard: remove spells that are in previous spec, but are not present in new one (or are in new spec, but not in the old one)
15075 for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
15076 {
15077 if (!itr->second->Active || itr->second->State == PLAYERSPELL_REMOVED)
15078 continue;
15079
15080 // pussywizard: was => isn't
15081 if (itr->second->IsInSpec(oldSpec) && !itr->second->IsInSpec(spec))
15082 {
15083 SendLearnPacket(itr->first, false);
15084 // We want to remove all auras of the unlearned spell
15085 _removeTalentAurasAndSpells(itr->first);
15086
15087 removedSpecAuras.insert(itr->first);
15088 }
15089 // pussywizard: wasn't => is
15090 else if (!itr->second->IsInSpec(oldSpec) && itr->second->IsInSpec(spec))
15091 {
15092 SendLearnPacket(itr->first, true);
15093
15094 removedSpecAuras.erase(itr->first);
15095 }
15096 }
15097
15098 // xinef: apply glyphs from second spec
15099 if (GetActiveSpec() != oldSpec)
15100 {
15101 for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot)
15102 {
15103 uint32 glyphId = m_Glyphs[GetActiveSpec()][slot];
15104 if (glyphId)
15105 {
15106 if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyphId))
15107 {
15109 removedSpecAuras.erase(glyphEntry->SpellId);
15110 }
15111 }
15112
15113 SetGlyph(slot, glyphId, true);
15114 }
15115 }
15116
15117 // Remove auras triggered/activated by talents/glyphs
15118 // Mostly explicit casts in dummy aura scripts
15119 if (!removedSpecAuras.empty())
15120 {
15121 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
15122 {
15123 Aura* aura = iter->second;
15124 if (SpellInfo const* triggeredByAuraSpellInfo = aura->GetTriggeredByAuraSpellInfo())
15125 {
15126 if (removedSpecAuras.find(triggeredByAuraSpellInfo->Id) != removedSpecAuras.end())
15127 {
15128 RemoveOwnedAura(iter);
15129 continue;
15130 }
15131 }
15132 ++iter;
15133 }
15134 }
15135
15136 m_usedTalentCount = spentTalents;
15138
15139 // load them asynchronously
15140 {
15142 stmt->SetData(0, GetGUID().GetCounter());
15143 stmt->SetData(1, m_activeSpec);
15144
15145 WorldSession* mySess = GetSession();
15146 mySess->GetQueryProcessor().AddCallback(CharacterDatabase.AsyncQuery(stmt)
15147 .WithPreparedCallback([mySess](PreparedQueryResult result)
15148 {
15149 // safe callback, we can't pass this pointer directly
15150 // in case player logs out before db response (player would be deleted in that case)
15151 if (Player* thisPlayer = mySess->GetPlayer())
15152 thisPlayer->LoadActions(result);
15153 }));
15154 }
15155
15156 // xinef: reset power
15157 Powers pw = getPowerType();
15158 if (pw != POWER_MANA)
15159 SetPower(POWER_MANA, 0); // Mana must be 0 even if it isn't the active power type.
15160 SetPower(pw, 0);
15161
15162 // xinef: remove titan grip if player had it set and does not have appropriate talent
15163 if (!HasTalent(46917, GetActiveSpec()) && m_canTitanGrip)
15164 SetCanTitanGrip(false);
15165 // xinef: remove dual wield if player does not have dual wield spell (shamans)
15166 if (!HasSpell(674) && m_canDualWield)
15167 SetCanDualWield(false);
15168
15170
15171 // Xinef: Patch 3.2.0: Switching spec removes paladins spell Righteous Fury (25780)
15172 if (getClass() == CLASS_PALADIN)
15173 RemoveAurasDueToSpell(25780);
15174
15175 // Xinef: Remove talented single target auras at other targets
15176 AuraList& scAuras = GetSingleCastAuras();
15177 for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
15178 {
15179 Aura* aura = *iter;
15180 if (!HasActiveSpell(aura->GetId()) && !HasTalent(aura->GetId(), GetActiveSpec()) && !aura->GetCastItemGUID())
15181 {
15182 aura->Remove();
15183 iter = scAuras.begin();
15184 }
15185 else
15186 ++iter;
15187 }
15188
15189 sScriptMgr->OnAfterSpecSlotChanged(this, GetActiveSpec());
15190}
@ CHAR_SEL_CHARACTER_ACTIONS_SPEC
Definition: CharacterDatabase.h:81
@ POWER_MANA
Definition: SharedDefines.h:269
@ CLASS_PALADIN
Definition: SharedDefines.h:142
T & AddCallback(T &&query)
Definition: AsyncCallbackProcessor.h:35
Definition: Pet.h:40
void InitTalentForLevel()
Definition: Player.cpp:2533
void SetCanTitanGrip(bool value)
Definition: Player.cpp:13059
void SetActiveSpec(uint8 spec)
Definition: Player.h:1709
Pet * GetPet() const
Definition: Player.cpp:8819
bool HasTalent(uint32 spell_id, uint8 spec) const
Definition: Player.cpp:3837
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition: Player.cpp:8970
void _SaveActions(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7158
uint8 GetSpecsCount() const
Definition: Player.h:1710
bool HasSpell(uint32 spell) const override
Definition: Player.cpp:3831
void SendActionButtons(uint32 state) const
Definition: Player.cpp:5468
void _addTalentAurasAndSpells(uint32 spellId)
Definition: Player.cpp:2974
virtual void SetCanDualWield(bool value)
Definition: Unit.h:1358
std::list< Aura * > AuraList
Definition: Unit.h:1319
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4081
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition: Unit.cpp:15552
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:4051
void ClearAllReactives()
Definition: Unit.cpp:17192
void UnsummonAllTotems(bool onDeath=false)
Definition: Unit.cpp:11199
bool m_canDualWield
Definition: Unit.h:1368
Powers getPowerType() const
Definition: Unit.h:1473
AuraList & GetSingleCastAuras()
Definition: Unit.h:1982
void RemoveAllControlled(bool onDeath=false)
Definition: Unit.cpp:11080
Player session in the World.
Definition: WorldSession.h:330
QueryCallbackProcessor & GetQueryProcessor()
Definition: WorldSession.h:1078
uint32 GetId() const
Definition: SpellAuras.cpp:466
ObjectGuid GetCastItemGUID() const
Definition: SpellAuras.h:103
SpellInfo const * GetTriggeredByAuraSpellInfo() const
Definition: SpellAuras.cpp:2775
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0

References _addTalentAurasAndSpells(), _removeTalentAurasAndSpells(), _SaveActions(), AsyncCallbackProcessor< T >::AddCallback(), AutoUnequipOffhandIfNeed(), Unit::CastSpell(), CHAR_SEL_CHARACTER_ACTIONS_SPEC, CharacterDatabase, CLASS_PALADIN, Unit::ClearAllReactives(), GetActiveSpec(), GetActiveSpecMask(), Aura::GetCastItemGUID(), Unit::getClass(), Object::GetGUID(), Aura::GetId(), GetPet(), Unit::getPowerType(), WorldSession::GetQueryProcessor(), GetSession(), Unit::GetSingleCastAuras(), GetSpecsCount(), GetTalentSpellPos(), Aura::GetTriggeredByAuraSpellInfo(), HasActiveSpell(), HasSpell(), HasTalent(), InitTalentForLevel(), Unit::InterruptNonMeleeSpells(), Unit::IsNonMeleeSpellCast(), m_activeSpec, Unit::m_canDualWield, m_canTitanGrip, m_Glyphs, Unit::m_ownedAuras, m_spells, m_talents, m_usedTalentCount, MAX_GLYPH_SLOT_INDEX, PET_SAVE_NOT_IN_SLOT, PLAYERSPELL_REMOVED, POWER_MANA, TalentSpellPos::rank, Aura::Remove(), Unit::RemoveAllControlled(), Unit::RemoveAurasDueToSpell(), Unit::RemoveOwnedAura(), RemovePet(), SendActionButtons(), SendLearnPacket(), SetActiveSpec(), Unit::SetCanDualWield(), SetCanTitanGrip(), PreparedStatementBase::SetData(), SetGlyph(), Unit::SetPower(), sGlyphPropertiesStore, sScriptMgr, TRIGGERED_FULL_MASK, TRIGGERED_IGNORE_CASTER_AURASTATE, TRIGGERED_IGNORE_SHAPESHIFT, and Unit::UnsummonAllTotems().

Referenced by UpdateSpecCount().

◆ ActivateTaxiPathTo() [1/2]

bool Player::ActivateTaxiPathTo ( std::vector< uint32 > const &  nodes,
Creature npc = nullptr,
uint32  spellid = 1 
)
10150{
10151 if (nodes.size() < 2)
10152 return false;
10153
10154 // not let cheating with start flight in time of logout process || while in combat || has type state: stunned || has type state: root
10156 {
10158 return false;
10159 }
10160
10162 return false;
10163
10164 // taximaster case
10165 if (npc)
10166 {
10167 // not let cheating with start flight mounted
10168 if (IsMounted())
10169 {
10171 return false;
10172 }
10173
10175 {
10177 return false;
10178 }
10179
10180 // not let cheating with start flight in time of logout process || if casting not finished || while in combat || if not use Spell's with EffectSendTaxi
10181 if (IsNonMeleeSpellCast(false))
10182 {
10184 return false;
10185 }
10186 }
10187 // cast case or scripted call case
10188 else
10189 {
10191
10194
10196 if (spell->m_spellInfo->Id != spellid)
10198
10200
10202 if (spell->m_spellInfo->Id != spellid)
10204 }
10205
10206 uint32 sourcenode = nodes[0];
10207
10208 // starting node too far away (cheat?)
10209 TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(sourcenode);
10210 if (!node)
10211 {
10213 return false;
10214 }
10215
10216 // Prepare to flight start now
10217
10218 // stop combat at start taxi flight if any
10219 CombatStop();
10220
10223 ExitVehicle();
10224
10225 // stop trade (client cancel trade at taxi map open but cheating tools can be used for reopen it)
10226 TradeCancel(true);
10227
10228 // clean not finished taxi path if any
10230
10231 // 0 element current node
10232 m_taxi.AddTaxiDestination(sourcenode);
10233
10234 // fill destinations path tail
10235 uint32 sourcepath = 0;
10236 uint32 totalcost = 0;
10237 uint32 firstcost = 0;
10238
10239 uint32 prevnode = sourcenode;
10240 uint32 lastnode = 0;
10241
10242 for (uint32 i = 1; i < nodes.size(); ++i)
10243 {
10244 uint32 path, cost;
10245
10246 lastnode = nodes[i];
10247 sObjectMgr->GetTaxiPath(prevnode, lastnode, path, cost);
10248
10249 if (!path)
10250 {
10252 return false;
10253 }
10254
10255 totalcost += cost;
10256 if (i == 1)
10257 firstcost = cost;
10258
10259 if (prevnode == sourcenode)
10260 sourcepath = path;
10261
10262 m_taxi.AddTaxiDestination(lastnode);
10263
10264 prevnode = lastnode;
10265 }
10266
10267 // get mount model (in case non taximaster (npc == nullptr) allow more wide lookup)
10268 //
10269 // Hack-Fix for Alliance not being able to use Acherus taxi. There is
10270 // only one mount ID for both sides. Probably not good to use 315 in case DBC nodes
10271 // change but I couldn't find a suitable alternative. OK to use class because only DK
10272 // can use this taxi.
10273 uint32 mount_display_id = sObjectMgr->GetTaxiMountDisplayId(sourcenode, GetTeamId(true), npc == nullptr || (sourcenode == 315 && getClass() == CLASS_DEATH_KNIGHT));
10274
10275 // in spell case allow 0 model
10276 if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0)
10277 {
10280 return false;
10281 }
10282
10283 uint32 money = GetMoney();
10284
10285 if (npc)
10286 {
10287 float discount = GetReputationPriceDiscount(npc);
10288 totalcost = uint32(ceil(totalcost * discount));
10289 firstcost = uint32(ceil(firstcost * discount));
10291 }
10292 else
10293 {
10295 }
10296
10297 if (money < totalcost)
10298 {
10301 return false;
10302 }
10303
10304 //Checks and preparations done, DO FLIGHT
10306
10307 // prevent stealth flight
10308 //RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK);
10309
10310 // Xinef: dont use instant flight paths if spellid is present (custom calls use spellid = 1)
10311 if ((sWorld->getIntConfig(CONFIG_INSTANT_TAXI) == 1 || (sWorld->getIntConfig(CONFIG_INSTANT_TAXI) == 2 && m_isInstantFlightOn)) && !spellid)
10312 {
10313 TaxiNodesEntry const* lastPathNode = sTaxiNodesStore.LookupEntry(nodes[nodes.size() - 1]);
10315 ModifyMoney(-(int32)totalcost);
10317 TeleportTo(lastPathNode->map_id, lastPathNode->x, lastPathNode->y, lastPathNode->z, GetOrientation());
10318 return false;
10319 }
10320 else
10321 {
10322 m_flightSpellActivated = spellid;
10323 ModifyMoney(-(int32)firstcost);
10326 GetSession()->SendDoFlight(mount_display_id, sourcepath);
10327 }
10328 return true;
10329}
npc
Definition: BattlegroundSA.h:75
DBCStorage< TaxiNodesEntry > sTaxiNodesStore(TaxiNodesEntryfmt)
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:992
@ CURRENT_GENERIC_SPELL
Definition: Unit.h:991
@ CURRENT_AUTOREPEAT_SPELL
Definition: Unit.h:993
@ UNIT_STATE_ROOT
Definition: Unit.h:335
@ UNIT_STATE_STUNNED
Definition: Unit.h:328
@ UNIT_FLAG_DISABLE_MOVE
Definition: Unit.h:450
@ SPELL_AURA_MOD_SHAPESHIFT
Definition: SpellAuraDefines.h:99
@ CONFIG_INSTANT_TAXI
Definition: IWorld.h:382
@ ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN
Definition: DBCEnums.h:223
@ ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING
Definition: DBCEnums.h:184
@ CLASS_DEATH_KNIGHT
Definition: SharedDefines.h:146
@ ERR_TAXIPLAYERBUSY
Definition: SharedDefines.h:3602
@ ERR_TAXIOK
Definition: SharedDefines.h:3595
@ ERR_TAXINOSUCHPATH
Definition: SharedDefines.h:3597
@ ERR_TAXIUNSPECIFIEDSERVERERROR
Definition: SharedDefines.h:3596
@ ERR_TAXIPLAYERSHAPESHIFTED
Definition: SharedDefines.h:3604
@ ERR_TAXIPLAYERALREADYMOUNTED
Definition: SharedDefines.h:3603
@ ERR_TAXINOTENOUGHMONEY
Definition: SharedDefines.h:3598
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2072
float GetReputationPriceDiscount(Creature const *creature) const
Definition: Player.cpp:12257
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition: Player.cpp:1314
void TradeCancel(bool sendback)
Definition: PlayerStorage.cpp:4110
void StopCastingCharm(Aura *except=nullptr)
Definition: Player.cpp:9207
void StopCastingBindSight(Aura *except=nullptr)
Definition: Player.cpp:13072
void AddTaxiDestination(uint32 dest)
Definition: PlayerTaxi.h:63
void SetFlightMasterFactionTemplateId(uint32 factionTemplateId)
Definition: PlayerTaxi.h:76
void ClearTaxiDestinations()
Definition: PlayerTaxi.h:62
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4014
void CombatStop(bool includingCast=false)
Definition: Unit.cpp:10440
bool IsInDisallowedMountForm() const
Definition: Unit.cpp:21526
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:1494
bool IsMounted() const
Definition: Unit.h:1556
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1410
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition: Unit.cpp:5045
bool IsInCombat() const
Definition: Unit.h:1702
void ExitVehicle(Position const *exitPosition=nullptr)
Definition: Unit.cpp:19992
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:2075
void SendActivateTaxiReply(ActivateTaxiReply reply)
Definition: TaxiHandler.cpp:284
void SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathNode=0)
Definition: TaxiHandler.cpp:110
Definition: Spell.h:284
Definition: DBCStructure.h:1954
float z
Definition: DBCStructure.h:1959
uint32 map_id
Definition: DBCStructure.h:1956
float x
Definition: DBCStructure.h:1957
float y
Definition: DBCStructure.h:1958

References ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN, ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, PlayerTaxi::AddTaxiDestination(), CLASS_DEATH_KNIGHT, PlayerTaxi::ClearTaxiDestinations(), Unit::CombatStop(), CONFIG_INSTANT_TAXI, CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, ERR_TAXINOSUCHPATH, ERR_TAXINOTENOUGHMONEY, ERR_TAXIOK, ERR_TAXIPLAYERALREADYMOUNTED, ERR_TAXIPLAYERBUSY, ERR_TAXIPLAYERSHAPESHIFTED, ERR_TAXIUNSPECIFIEDSERVERERROR, Unit::ExitVehicle(), Unit::getClass(), Unit::GetCurrentSpell(), GetMoney(), Position::GetOrientation(), GetReputationPriceDiscount(), GetSession(), GetTeamId(), Unit::HasUnitFlag(), Unit::HasUnitState(), Unit::InterruptSpell(), Unit::IsInCombat(), Unit::IsInDisallowedMountForm(), Unit::IsMounted(), Unit::IsNonMeleeSpellCast(), m_flightSpellActivated, m_isInstantFlightOn, m_taxi, TaxiNodesEntry::map_id, ModifyMoney(), Unit::RemoveAurasByType(), WorldSession::SendActivateTaxiReply(), WorldSession::SendDoFlight(), PlayerTaxi::SetFlightMasterFactionTemplateId(), sObjectMgr, SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOUNTED, sTaxiNodesStore, StopCastingBindSight(), StopCastingCharm(), sWorld, TeleportTo(), TradeCancel(), UNIT_FLAG_DISABLE_MOVE, UNIT_STATE_ROOT, UNIT_STATE_STUNNED, UpdateAchievementCriteria(), TaxiNodesEntry::x, TaxiNodesEntry::y, and TaxiNodesEntry::z.

Referenced by ActivateTaxiPathTo(), WorldSession::HandleActivateTaxiExpressOpcode(), WorldSession::HandleActivateTaxiOpcode(), Aura::HandleAuraSpecificMods(), OPvPCapturePointNA::HandleCustomSpell(), npc_taxi::OnGossipSelect(), npc_bunthen_plainswind::OnGossipSelect(), npc_silva_filnaveth::OnGossipSelect(), and npc_karynaku::OnQuestAccept().

◆ ActivateTaxiPathTo() [2/2]

bool Player::ActivateTaxiPathTo ( uint32  taxi_path_id,
uint32  spellid = 1 
)
10332{
10333 TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(taxi_path_id);
10334 if (!entry)
10335 return false;
10336
10337 std::vector<uint32> nodes;
10338
10339 nodes.resize(2);
10340 nodes[0] = entry->from;
10341 nodes[1] = entry->to;
10342
10343 return ActivateTaxiPathTo(nodes, nullptr, spellid);
10344}
DBCStorage< TaxiPathEntry > sTaxiPathStore(TaxiPathEntryfmt)
bool ActivateTaxiPathTo(std::vector< uint32 > const &nodes, Creature *npc=nullptr, uint32 spellid=1)
Definition: Player.cpp:10149
Definition: DBCStructure.h:1966
uint32 to
Definition: DBCStructure.h:1969
uint32 from
Definition: DBCStructure.h:1968

References ActivateTaxiPathTo(), TaxiPathEntry::from, sTaxiPathStore, and TaxiPathEntry::to.

◆ addActionButton()

ActionButton * Player::addActionButton ( uint8  button,
uint32  action,
uint8  type 
)
5540{
5541 if (!IsActionButtonDataValid(button, action, type))
5542 return nullptr;
5543
5544 // it create new button (NEW state) if need or return existed
5545 ActionButton& ab = m_actionButtons[button];
5546
5547 // set data and update to CHANGED if not NEW
5548 ab.SetActionAndType(action, ActionButtonType(type));
5549
5550 LOG_DEBUG("entities.player", "Player {} Added Action {} (type {}) to Button {}", GetGUID().ToString(), action, type, button);
5551 return &ab;
5552}
ActionButtonType
Definition: Player.h:229
void SetActionAndType(uint32 action, ActionButtonType type)
Definition: Player.h:263
bool IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
Definition: Player.cpp:5496

References Object::GetGUID(), IsActionButtonDataValid(), LOG_DEBUG, m_actionButtons, ActionButton::SetActionAndType(), and Position::ToString().

Referenced by _LoadActions(), Create(), and WorldSession::HandleSetActionButtonOpcode().

◆ AddArmorProficiency()

void Player::AddArmorProficiency ( uint32  newflag)
inline
1339{ m_ArmorProficiency |= newflag; }

References m_ArmorProficiency.

Referenced by Spell::EffectProficiency().

◆ AddBattlegroundQueueId()

uint32 Player::AddBattlegroundQueueId ( BattlegroundQueueTypeId  val)
12166{
12167 for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
12168 {
12169 if (_BgBattlegroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE || _BgBattlegroundQueueID[i].bgQueueTypeId == val)
12170 {
12171 _BgBattlegroundQueueID[i].bgQueueTypeId = val;
12172 _BgBattlegroundQueueID[i].invitedToInstance = 0;
12173 return i;
12174 }
12175 }
12176
12178}

References _BgBattlegroundQueueID, BATTLEGROUND_QUEUE_NONE, and PLAYER_MAX_BATTLEGROUND_QUEUES.

Referenced by WorldSession::HandleBattlemasterJoinArena(), and WorldSession::HandleBattlemasterJoinOpcode().

◆ AddEnchantmentDuration()

void Player::AddEnchantmentDuration ( Item item,
EnchantmentSlot  slot,
uint32  duration 
)
4297{
4298 if (!item)
4299 return;
4300
4301 if (slot >= MAX_ENCHANTMENT_SLOT)
4302 return;
4303
4304 for (EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr)
4305 {
4306 if (itr->item == item && itr->slot == slot)
4307 {
4308 itr->item->SetEnchantmentDuration(itr->slot, itr->leftduration, this);
4309 m_enchantDuration.erase(itr);
4310 break;
4311 }
4312 }
4313 if (item && duration > 0)
4314 {
4315 GetSession()->SendItemEnchantTimeUpdate(GetGUID(), item->GetGUID(), slot, uint32(duration / 1000));
4316 m_enchantDuration.push_back(EnchantDuration(item, slot, duration));
4317 }
4318}
@ MAX_ENCHANTMENT_SLOT
Definition: Item.h:177
Definition: Player.h:442
void SendItemEnchantTimeUpdate(ObjectGuid Playerguid, ObjectGuid Itemguid, uint32 slot, uint32 Duration)
Definition: ItemHandler.cpp:1232

References Object::GetGUID(), GetSession(), m_enchantDuration, MAX_ENCHANTMENT_SLOT, and WorldSession::SendItemEnchantTimeUpdate().

Referenced by AddEnchantmentDurations(), and ApplyEnchantment().

◆ AddEnchantmentDurations()

void Player::AddEnchantmentDurations ( Item item)
4209{
4210 for (int x = 0; x < MAX_ENCHANTMENT_SLOT; ++x)
4211 {
4212 if (!item->GetEnchantmentId(EnchantmentSlot(x)))
4213 continue;
4214
4215 uint32 duration = item->GetEnchantmentDuration(EnchantmentSlot(x));
4216 if (duration > 0)
4217 AddEnchantmentDuration(item, EnchantmentSlot(x), duration);
4218 }
4219}
EnchantmentSlot
Definition: Item.h:162
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:295
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
Definition: Item.h:296
void AddEnchantmentDuration(Item *item, EnchantmentSlot slot, uint32 duration)
Definition: PlayerStorage.cpp:4296

References AddEnchantmentDuration(), Item::GetEnchantmentDuration(), Item::GetEnchantmentId(), and MAX_ENCHANTMENT_SLOT.

Referenced by _StoreItem(), EquipItem(), and QuickEquipItem().

◆ AddInstanceEnterTime()

void Player::AddInstanceEnterTime ( uint32  instanceId,
time_t  enterTime 
)
inline
2414 {
2415 if (_instanceResetTimes.find(instanceId) == _instanceResetTimes.end())
2416 _instanceResetTimes.insert(InstanceTimeMap::value_type(instanceId, enterTime + HOUR));
2417 }

References _instanceResetTimes, and HOUR.

Referenced by InstanceMap::AddPlayerToMap().

◆ AddItem()

bool Player::AddItem ( uint32  itemId,
uint32  count 
)
15479{
15480 uint32 noSpaceForCount = 0;
15481 ItemPosCountVec dest;
15482 InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
15483 if (msg != EQUIP_ERR_OK)
15484 count -= noSpaceForCount;
15485
15486 if (count == 0 || dest.empty())
15487 {
15488 // -- TODO: Send to mailbox if no space
15489 ChatHandler(GetSession()).PSendSysMessage("You don't have any space in your bags.");
15490 return false;
15491 }
15492
15493 Item* item = StoreNewItem(dest, itemId, true);
15494 if (item)
15495 SendNewItem(item, count, true, false);
15496 else
15497 return false;
15498 return true;
15499}
@ NULL_BAG
Definition: Unit.h:210
Definition: Chat.h:38
void PSendSysMessage(char const *fmt, Args &&... args)
Definition: Chat.h:60

References CanStoreNewItem(), EQUIP_ERR_OK, GetSession(), NULL_BAG, NULL_SLOT, ChatHandler::PSendSysMessage(), SendNewItem(), and StoreNewItem().

Referenced by spell_brewfest_fill_keg::HandleAfterHit(), spell_brewfest_unfill_keg::HandleAfterHit(), spell_q9452_cast_net::HandleDummy(), spell_catch_the_wild_wolpertinger::HandleEffectApply(), RewardHonor(), and npc_tharnarian::npc_tharnarianAI::sGossipSelect().

◆ AddItemDurations()

void Player::AddItemDurations ( Item item)
12376{
12378 {
12379 m_itemDuration.push_back(item);
12380 item->SendTimeUpdate(this);
12381 }
12382}
@ ITEM_FIELD_DURATION
Definition: UpdateFields.h:40
void SendTimeUpdate(Player *owner)
Definition: Item.cpp:1076
ItemDurationList m_itemDuration
Definition: Player.h:2786

References Object::GetUInt32Value(), ITEM_FIELD_DURATION, m_itemDuration, and Item::SendTimeUpdate().

Referenced by _StoreItem(), EquipItem(), and QuickEquipItem().

◆ AddItemToBuyBackSlot()

void Player::AddItemToBuyBackSlot ( Item pItem,
uint32  money 
)
3959{
3960 if (pItem)
3961 {
3963 // if current back slot non-empty search oldest or free
3964 if (m_items[slot])
3965 {
3967 uint32 oldest_slot = BUYBACK_SLOT_START;
3968
3969 for (uint32 i = BUYBACK_SLOT_START + 1; i < BUYBACK_SLOT_END; ++i)
3970 {
3971 // found empty
3972 if (!m_items[i])
3973 {
3974 slot = i;
3975 break;
3976 }
3977
3979
3980 if (oldest_time > i_time)
3981 {
3982 oldest_time = i_time;
3983 oldest_slot = i;
3984 }
3985 }
3986
3987 // find oldest
3988 slot = oldest_slot;
3989 }
3990
3991 RemoveItemFromBuyBackSlot(slot, true);
3992 LOG_DEBUG("entities.player.items", "STORAGE: AddItemToBuyBackSlot item = {}, slot = {}", pItem->GetEntry(), slot);
3993
3994 m_items[slot] = pItem;
3995 time_t base = GameTime::GetGameTime().count();
3996 uint32 etime = uint32(base - m_logintime + (30 * 3600));
3997 uint32 eslot = slot - BUYBACK_SLOT_START;
3998
4002
4003 // move to next (for non filled list is move most optimized choice)
4006 }
4007}
@ PLAYER_FIELD_BUYBACK_PRICE_1
Definition: UpdateFields.h:372
@ PLAYER_FIELD_VENDORBUYBACK_SLOT_1
Definition: UpdateFields.h:331
@ PLAYER_FIELD_BUYBACK_TIMESTAMP_1
Definition: UpdateFields.h:373
void RemoveItemFromBuyBackSlot(uint32 slot, bool del)
Definition: PlayerStorage.cpp:4017

References BUYBACK_SLOT_END, BUYBACK_SLOT_START, Object::GetEntry(), GameTime::GetGameTime(), Object::GetGUID(), Object::GetUInt32Value(), LOG_DEBUG, m_currentBuybackSlot, m_items, m_logintime, PLAYER_FIELD_BUYBACK_PRICE_1, PLAYER_FIELD_BUYBACK_TIMESTAMP_1, PLAYER_FIELD_VENDORBUYBACK_SLOT_1, RemoveItemFromBuyBackSlot(), Object::SetGuidValue(), and Object::SetUInt32Value().

Referenced by WorldSession::HandleSellItemOpcode().

◆ AdditionalSavingAddMask()

◆ AddKnownCurrency()

void Player::AddKnownCurrency ( uint32  itemId)
private
14128{
14129 if (CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemId))
14130 SetFlag64(PLAYER_FIELD_KNOWN_CURRENCIES, (1LL << (ctEntry->BitIndex - 1)));
14131}
DBCStorage< CurrencyTypesEntry > sCurrencyTypesStore(CurrencyTypesfmt)
void SetFlag64(uint16 index, uint64 newFlag)
Definition: Object.cpp:956
Definition: DBCStructure.h:826

References PLAYER_FIELD_KNOWN_CURRENCIES, sCurrencyTypesStore, and Object::SetFlag64().

Referenced by _StoreItem(), SetArenaPoints(), and SetHonorPoints().

◆ AddMail()

void Player::AddMail ( Mail mail)
inline
1620{ m_mail.push_front(mail); }// for call from WorldSession::SendMailTo

References m_mail.

Referenced by MailDraft::SendMailTo().

◆ AddMItem()

void Player::AddMItem ( Item it)
inline
1646 {
1647 ASSERT(it);
1648 //ASSERT deleted, because items can be added before loading
1649 mMitems[it->GetGUID().GetCounter()] = it;
1650 }

References ASSERT, ObjectGuid::GetCounter(), Object::GetGUID(), and mMitems.

Referenced by _LoadMailedItem(), and MailDraft::SendMailTo().

◆ AddNewMailDeliverTime()

void Player::AddNewMailDeliverTime ( time_t  deliver_time)
2850{
2851 if (deliver_time <= GameTime::GetGameTime().count()) // ready now
2852 {
2853 ++unReadMails;
2854 SendNewMail();
2855 }
2856 else // not ready and no have ready mails
2857 {
2858 if (!m_nextMailDelivereTime || m_nextMailDelivereTime > deliver_time)
2859 m_nextMailDelivereTime = deliver_time;
2860 }
2861}
void SendNewMail()
Definition: Player.cpp:2841

References GameTime::GetGameTime(), m_nextMailDelivereTime, SendNewMail(), and unReadMails.

Referenced by MailDraft::SendMailTo().

◆ AddQuest()

void Player::AddQuest ( Quest const *  quest,
Object questGiver 
)
507{
508 uint16 log_slot = FindQuestSlot(0);
509
510 if (log_slot >= MAX_QUEST_LOG_SIZE) // Player does not have any free slot in the quest log
511 return;
512
513 uint32 quest_id = quest->GetQuestId();
514
515 // if not exist then created with set uState == NEW and rewarded=false
516 QuestStatusData& questStatusData = m_QuestStatus[quest_id];
517
518 // check for repeatable quests status reset
519 questStatusData.Status = QUEST_STATUS_INCOMPLETE;
520 questStatusData.Explored = false;
521
522 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
523 {
524 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
525 questStatusData.ItemCount[i] = 0;
526 }
527
529 {
530 for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
531 questStatusData.CreatureOrGOCount[i] = 0;
532 }
533
534 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_PLAYER_KILL))
535 questStatusData.PlayerCount = 0;
536
537 GiveQuestSourceItem(quest);
538 AdjustQuestReqItemCount(quest, questStatusData);
539
540 if (quest->GetRepObjectiveFaction())
541 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->GetRepObjectiveFaction()))
542 GetReputationMgr().SetVisible(factionEntry);
543
544 if (quest->GetRepObjectiveFaction2())
545 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->GetRepObjectiveFaction2()))
546 GetReputationMgr().SetVisible(factionEntry);
547
548 uint32 qtime = 0;
549 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED))
550 {
551 uint32 timeAllowed = quest->GetTimeAllowed();
552
553 // shared timed quest
554 if (questGiver && questGiver->GetTypeId() == TYPEID_PLAYER)
555 timeAllowed = questGiver->ToPlayer()->getQuestStatusMap()[quest_id].Timer / IN_MILLISECONDS;
556
557 AddTimedQuest(quest_id);
558 questStatusData.Timer = timeAllowed * IN_MILLISECONDS;
559 qtime = static_cast<uint32>(GameTime::GetGameTime().count()) + timeAllowed;
560 }
561 else
562 questStatusData.Timer = 0;
563
564 if (quest->HasFlag(QUEST_FLAGS_FLAGS_PVP))
565 {
566 pvpInfo.IsHostile = true;
568 }
569
570 SetQuestSlot(log_slot, quest_id, qtime);
571
572 m_QuestStatusSave[quest_id] = true;
573
575
576 SendQuestUpdate(quest_id);
577
578 // check if Quest Tracker is enabled
579 if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER))
580 {
581 // prepare Quest Tracker datas
582 auto stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_QUEST_TRACK);
583 stmt->SetData(0, quest_id);
584 stmt->SetData(1, GetGUID().GetCounter());
585 stmt->SetData(2, GitRevision::GetHash());
586 stmt->SetData(3, GitRevision::GetDate());
587
588 // add to Quest Tracker
589 CharacterDatabase.Execute(stmt);
590 }
591
592 // Xinef: area auras may change on quest accept!
595}
@ CHAR_INS_QUEST_TRACK
Definition: CharacterDatabase.h:498
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
@ QUEST_FLAGS_FLAGS_PVP
Definition: QuestDef.h:145
@ QUEST_SPECIAL_FLAGS_CAST
Definition: QuestDef.h:165
@ QUEST_SPECIAL_FLAGS_DELIVER
Definition: QuestDef.h:172
@ QUEST_SPECIAL_FLAGS_KILL
Definition: QuestDef.h:174
@ QUEST_SPECIAL_FLAGS_SPEAKTO
Definition: QuestDef.h:173
@ QUEST_SPECIAL_FLAGS_PLAYER_KILL
Definition: QuestDef.h:176
@ CONFIG_QUEST_ENABLE_QUEST_TRACKER
Definition: IWorld.h:151
@ ACHIEVEMENT_TIMED_TYPE_QUEST
Definition: DBCEnums.h:119
AC_COMMON_API char const * GetDate()
Definition: GitRevision.cpp:26
AC_COMMON_API char const * GetHash()
Definition: GitRevision.cpp:21
Player * ToPlayer()
Definition: Object.h:195
TypeID GetTypeId() const
Definition: Object.h:121
uint32 GetAreaId() const
Definition: Object.cpp:3108
bool IsHostile
Definition: Player.h:361
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost=0)
Definition: Player.cpp:13836
QuestStatusMap & getQuestStatusMap()
Definition: Player.h:1598
uint16 FindQuestSlot(uint32 quest_id) const
Definition: PlayerQuest.cpp:1768
void UpdatePvPState()
Definition: PlayerUpdates.cpp:1394
void UpdateAreaDependentAuras(uint32 area_id)
Definition: PlayerUpdates.cpp:1821
void SendQuestUpdate(uint32 questId)
Definition: PlayerQuest.cpp:1512
void AdjustQuestReqItemCount(Quest const *quest, QuestStatusData &questStatusData)
Definition: PlayerQuest.cpp:1750
PvPInfo pvpInfo
Definition: Player.h:1810
void UpdateZoneDependentAuras(uint32 zone_id)
Definition: PlayerUpdates.cpp:1807
bool GiveQuestSourceItem(Quest const *quest)
Definition: PlayerQuest.cpp:1334
ReputationMgr & GetReputationMgr()
Definition: Player.h:2089
void SetVisible(FactionTemplateEntry const *factionTemplateEntry)
Definition: ReputationMgr.cpp:458
Definition: DBCStructure.h:898

References ACHIEVEMENT_TIMED_TYPE_QUEST, AddTimedQuest(), AdjustQuestReqItemCount(), CHAR_INS_QUEST_TRACK, CharacterDatabase, CONFIG_QUEST_ENABLE_QUEST_TRACKER, QuestStatusData::CreatureOrGOCount, QuestStatusData::Explored, FindQuestSlot(), WorldObject::GetAreaId(), GitRevision::GetDate(), GameTime::GetGameTime(), Object::GetGUID(), GitRevision::GetHash(), Quest::GetQuestId(), getQuestStatusMap(), Quest::GetRepObjectiveFaction(), Quest::GetRepObjectiveFaction2(), GetReputationMgr(), Quest::GetTimeAllowed(), Object::GetTypeId(), WorldObject::GetZoneId(), GiveQuestSourceItem(), Quest::HasFlag(), Quest::HasSpecialFlag(), IN_MILLISECONDS, PvPInfo::IsHostile, QuestStatusData::ItemCount, m_QuestStatus, m_QuestStatusSave, MAX_QUEST_LOG_SIZE, QuestStatusData::PlayerCount, pvpInfo, QUEST_FLAGS_FLAGS_PVP, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_CAST, QUEST_SPECIAL_FLAGS_DELIVER, QUEST_SPECIAL_FLAGS_KILL, QUEST_SPECIAL_FLAGS_PLAYER_KILL, QUEST_SPECIAL_FLAGS_SPEAKTO, QUEST_SPECIAL_FLAGS_TIMED, QUEST_STATUS_INCOMPLETE, SendQuestUpdate(), SetQuestSlot(), ReputationMgr::SetVisible(), sFactionStore, StartTimedAchievement(), QuestStatusData::Status, sWorld, QuestStatusData::Timer, Object::ToPlayer(), TYPEID_PLAYER, UpdateAreaDependentAuras(), UpdatePvPState(), and UpdateZoneDependentAuras().

Referenced by AddQuestAndCheckCompletion().

◆ AddQuestAndCheckCompletion()

void Player::AddQuestAndCheckCompletion ( Quest const *  quest,
Object questGiver 
)
421{
422 AddQuest(quest, questGiver);
423
424 if (CanCompleteQuest(quest->GetQuestId()))
425 CompleteQuest(quest->GetQuestId());
426
427 if (!questGiver)
428 return;
429
430 switch (questGiver->GetTypeId())
431 {
432 case TYPEID_UNIT:
433 sScriptMgr->OnQuestAccept(this, questGiver->ToCreature(), quest);
434 questGiver->ToCreature()->AI()->sQuestAccept(this, quest);
435 break;
436 case TYPEID_ITEM:
437 case TYPEID_CONTAINER:
438 {
439 Item* item = (Item*)questGiver;
440 sScriptMgr->OnQuestAccept(this, item, quest);
441
442 // destroy not required for quest finish quest starting item
443 bool destroyItem = true;
444 for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
445 {
446 if (quest->RequiredItemId[i] == item->GetEntry() && item->GetTemplate()->MaxCount > 0)
447 {
448 destroyItem = false;
449 break;
450 }
451 }
452
453 if (destroyItem)
454 DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
455
456 break;
457 }
459 sScriptMgr->OnQuestAccept(this, questGiver->ToGameObject(), quest);
460 questGiver->ToGameObject()->AI()->QuestAccept(this, quest);
461 break;
462 default:
463 break;
464 }
465}
@ TYPEID_GAMEOBJECT
Definition: ObjectGuid.h:39
@ TYPEID_UNIT
Definition: ObjectGuid.h:37
@ TYPEID_ITEM
Definition: ObjectGuid.h:35
@ TYPEID_CONTAINER
Definition: ObjectGuid.h:36
virtual bool QuestAccept(Player *, Quest const *)
Definition: GameObjectAI.h:58
virtual void sQuestAccept(Player *, Quest const *)
Definition: UnitAI.h:403
CreatureAI * AI() const
Definition: Creature.h:136
GameObjectAI * AI() const
Definition: GameObject.h:310
int32 MaxCount
Definition: ItemTemplate.h:653
GameObject * ToGameObject()
Definition: Object.h:202
Creature * ToCreature()
Definition: Object.h:197
void AddQuest(Quest const *quest, Object *questGiver)
Definition: PlayerQuest.cpp:506
void CompleteQuest(uint32 quest_id)
Definition: PlayerQuest.cpp:597
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition: PlayerStorage.cpp:3045
bool CanCompleteQuest(uint32 quest_id, const QuestStatusData *q_savedStatus=nullptr)
Definition: PlayerQuest.cpp:288

References AddQuest(), Creature::AI(), GameObject::AI(), CanCompleteQuest(), CompleteQuest(), DestroyItem(), Item::GetBagSlot(), Object::GetEntry(), Quest::GetQuestId(), Item::GetSlot(), Item::GetTemplate(), Object::GetTypeId(), ItemTemplate::MaxCount, QUEST_ITEM_OBJECTIVES_COUNT, GameObjectAI::QuestAccept(), Quest::RequiredItemId, UnitAI::sQuestAccept(), sScriptMgr, Object::ToCreature(), Object::ToGameObject(), TYPEID_CONTAINER, TYPEID_GAMEOBJECT, TYPEID_ITEM, and TYPEID_UNIT.

Referenced by Spell::EffectQuestStart(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleQuestConfirmAccept(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverQueryQuestOpcode(), and SendPreparedQuest().

◆ AddReceivedSpectatorResetFor()

void Player::AddReceivedSpectatorResetFor ( ObjectGuid  guid)
inline
2548{ m_receivedSpectatorResetFor.insert(guid); }
GuidSet m_receivedSpectatorResetFor
Definition: Player.h:2552

References m_receivedSpectatorResetFor.

Referenced by ArenaSpectator::HandleResetCommand().

◆ AddRefundReference()

void Player::AddRefundReference ( ObjectGuid  itemGUID)
15427{
15428 m_refundableItems.insert(itemGUID);
15429}

References m_refundableItems.

Referenced by _LoadItem(), and _StoreOrEquipNewItem().

◆ AddRuneByAuraEffect()

void Player::AddRuneByAuraEffect ( uint8  index,
RuneType  newType,
AuraEffect const *  aura 
)
inline
2482{ SetRuneConvertAura(index, aura); ConvertRune(index, newType); }
void ConvertRune(uint8 index, RuneType newType)
Definition: Player.cpp:13333
void SetRuneConvertAura(uint8 index, AuraEffect const *aura)
Definition: Player.h:2481

References ConvertRune(), and SetRuneConvertAura().

Referenced by AuraEffect::HandleAuraConvertRune().

◆ AddRunePower()

void Player::AddRunePower ( uint8  index)
13356{
13358 data << uint32(1 << index); // mask (0x00-0x3F probably)
13359 GetSession()->SendPacket(&data);
13360}
@ SMSG_ADD_RUNE_POWER
Definition: Opcodes.h:1190

References GetSession(), WorldSession::SendPacket(), and SMSG_ADD_RUNE_POWER.

◆ addSpell()

bool Player::addSpell ( uint32  spellId,
uint8  addSpecMask,
bool  updateActive,
bool  temporary = false,
bool  learnFromSkill = false 
)
3009{
3010 if (!_addSpell(spellId, addSpecMask, temporary, learnFromSkill))
3011 return false;
3012
3013 if (!updateActive)
3014 return true;
3015
3016 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); // must exist, checked in _addSpell
3017
3018 // pussywizard: now update active state for all ranks of this spell! and send packet to swap on action bar
3019 // pussywizard: assumption - it's in all specs, can't be a talent
3020 if (!spellInfo->IsStackableWithRanks() && spellInfo->IsRanked())
3021 {
3022 SpellInfo const* nextSpellInfo = sSpellMgr->GetSpellInfo(sSpellMgr->GetFirstSpellInChain(spellInfo->Id));
3023 while (nextSpellInfo)
3024 {
3025 PlayerSpellMap::iterator itr = m_spells.find(nextSpellInfo->Id);
3026 if (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->Active)
3027 {
3028 if (nextSpellInfo->GetRank() < spellInfo->GetRank())
3029 {
3030 itr->second->Active = false;
3031 if (IsInWorld())
3032 {
3034 data << uint32(nextSpellInfo->Id);
3035 data << uint32(spellInfo->Id);
3036 GetSession()->SendPacket(&data);
3037 }
3038 return false;
3039 }
3040 else if (nextSpellInfo->GetRank() > spellInfo->GetRank())
3041 {
3042 PlayerSpellMap::iterator itr2 = m_spells.find(spellInfo->Id);
3043 if (itr2 != m_spells.end())
3044 itr2->second->Active = false;
3045 return false;
3046 }
3047 }
3048 nextSpellInfo = nextSpellInfo->GetNextRankSpell();
3049 }
3050 }
3051
3052 return true;
3053}
@ SMSG_SUPERCEDED_SPELL
Definition: Opcodes.h:330
uint8 GetRank() const
Definition: SpellInfo.cpp:2480
bool IsRanked() const
Definition: SpellInfo.cpp:2475
bool IsStackableWithRanks() const
Definition: SpellInfo.cpp:1132
SpellInfo const * GetNextRankSpell() const
Definition: SpellInfo.cpp:2499

References _addSpell(), SpellInfo::GetNextRankSpell(), SpellInfo::GetRank(), GetSession(), SpellInfo::Id, Object::IsInWorld(), SpellInfo::IsRanked(), SpellInfo::IsStackableWithRanks(), m_spells, PLAYERSPELL_REMOVED, WorldSession::SendPacket(), SMSG_SUPERCEDED_SPELL, and sSpellMgr.

Referenced by _LoadSpells(), LearnCustomSpells(), learnSkillRewardedSpells(), and learnSpell().

◆ AddSpellAndCategoryCooldowns()

void Player::AddSpellAndCategoryCooldowns ( SpellInfo const *  spellInfo,
uint32  itemId,
Spell spell = nullptr,
bool  infinityCooldown = false 
)
10827{
10828 // init cooldown values
10829 uint32 cat = 0;
10830 int32 rec = -1;
10831 int32 catrec = -1;
10832
10833 // some special item spells without correct cooldown in SpellInfo
10834 // cooldown information stored in item prototype
10835 // This used in same way in WorldSession::HandleItemQuerySingleOpcode data sending to client.
10836
10837 if (itemId)
10838 {
10839 if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId))
10840 {
10841 for (uint8 idx = 0; idx < MAX_ITEM_SPELLS; ++idx)
10842 {
10843 if (uint32(proto->Spells[idx].SpellId) == spellInfo->Id)
10844 {
10845 cat = proto->Spells[idx].SpellCategory;
10846 rec = proto->Spells[idx].SpellCooldown;
10847 catrec = proto->Spells[idx].SpellCategoryCooldown;
10848 break;
10849 }
10850 }
10851 }
10852 }
10853
10854 // if no cooldown found above then base at DBC data
10855 if (rec < 0 && catrec < 0)
10856 {
10857 cat = spellInfo->GetCategory();
10858 rec = spellInfo->RecoveryTime;
10859 catrec = spellInfo->CategoryRecoveryTime;
10860 }
10861
10862 time_t catrecTime;
10863 time_t recTime;
10864
10865 bool needsCooldownPacket = false;
10866
10867 // overwrite time for selected category
10868 if (infinityCooldown)
10869 {
10870 // use +MONTH as infinity mark for spell cooldown (will checked as MONTH/2 at save ans skipped)
10871 // but not allow ignore until reset or re-login
10872 catrecTime = catrec > 0 ? infinityCooldownDelay : 0;
10873 recTime = rec > 0 ? infinityCooldownDelay : catrecTime;
10874 }
10875 else
10876 {
10877 // shoot spells used equipped item cooldown values already assigned in GetAttackTime(RANGED_ATTACK)
10878 // prevent 0 cooldowns set by another way
10879 if (rec <= 0 && catrec <= 0 && (cat == 76 || (spellInfo->IsAutoRepeatRangedSpell() && spellInfo->Id != 75)))
10881
10882 // Now we have cooldown data (if found any), time to apply mods
10883 if (rec > 0)
10884 ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, rec, spell);
10885
10886 if (catrec > 0 && !spellInfo->HasAttribute(SPELL_ATTR6_NO_CATEGORY_COOLDOWN_MODS))
10887 {
10888 ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, catrec, spell);
10889 }
10890
10892 {
10893 // Apply SPELL_AURA_MOD_COOLDOWN only to own spells
10894 if (HasSpell(spellInfo->Id))
10895 {
10896 needsCooldownPacket = true;
10897 rec += cooldownMod * IN_MILLISECONDS; // SPELL_AURA_MOD_COOLDOWN does not affect category cooldows, verified with shaman shocks
10898 }
10899 }
10900
10901 // replace negative cooldowns by 0
10902 if (rec < 0) rec = 0;
10903 if (catrec < 0) catrec = 0;
10904
10905 // no cooldown after applying spell mods
10906 if (rec == 0 && catrec == 0)
10907 return;
10908
10909 catrecTime = catrec ? catrec : 0;
10910 recTime = rec ? rec : catrecTime;
10911 }
10912
10913 // category spells
10914 if (cat && catrec > 0)
10915 {
10916 _AddSpellCooldown(spellInfo->Id, 0, itemId, recTime, true, true);
10917 if (needsCooldownPacket)
10918 {
10919 WorldPacket data;
10920 BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spellInfo->Id, recTime);
10921 SendDirectMessage(&data);
10922 }
10923
10924 PacketCooldowns forcedCategoryCooldowns;
10925
10926 SpellCategoryStore::const_iterator i_scstore = sSpellsByCategoryStore.find(cat);
10927 if (i_scstore != sSpellsByCategoryStore.end())
10928 {
10929 for (SpellCategorySet::const_iterator i_scset = i_scstore->second.begin(); i_scset != i_scstore->second.end(); ++i_scset)
10930 {
10931 if (i_scset->second == spellInfo->Id) // skip main spell, already handled above
10932 {
10933 continue;
10934 }
10935
10936 // If spell category is applied by item, then other spells should be exists in item templates
10937 if ((itemId > 0) != i_scset->first)
10938 {
10939 continue;
10940 }
10941
10942 // Only within the same spellfamily
10943 SpellInfo const* categorySpellInfo = sSpellMgr->GetSpellInfo(i_scset->second);
10944 if (!categorySpellInfo || categorySpellInfo->SpellFamilyName != spellInfo->SpellFamilyName)
10945 {
10946 continue;
10947 }
10948
10949 _AddSpellCooldown(i_scset->second, cat, itemId, catrecTime, !spellInfo->IsCooldownStartedOnEvent() && catrec && rec && catrec != rec);
10950
10951 if (spellInfo->HasAttribute(SPELL_ATTR0_CU_FORCE_SEND_CATEGORY_COOLDOWNS))
10952 {
10953 forcedCategoryCooldowns[i_scset->second] = catrecTime;
10954 }
10955 }
10956 }
10957
10958 if (!forcedCategoryCooldowns.empty())
10959 {
10960 WorldPacket data;
10961 BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, forcedCategoryCooldowns);
10962 SendDirectMessage(&data);
10963 }
10964 }
10965 else
10966 {
10967 // self spell cooldown
10968 if (recTime > 0)
10969 {
10970 _AddSpellCooldown(spellInfo->Id, 0, itemId, recTime, true, true);
10971
10972 if (needsCooldownPacket)
10973 {
10974 WorldPacket data;
10975 BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spellInfo->Id, rec);
10976 SendDirectMessage(&data);
10977 }
10978 }
10979 }
10980}
SpellCategoryStore sSpellsByCategoryStore
Definition: DBCStores.cpp:151
#define MAX_ITEM_SPELLS
Definition: Item.h:209
static constexpr uint32 infinityCooldownDelay
Definition: Unit.h:154
@ SPELL_COOLDOWN_FLAG_NONE
Definition: Unit.h:1242
std::unordered_map< uint32, uint32 > PacketCooldowns
Definition: Unit.h:1247
@ SPELL_AURA_MOD_COOLDOWN
Definition: SpellAuraDefines.h:259
@ SPELLMOD_COOLDOWN
Definition: SpellDefines.h:88
@ SPELL_ATTR0_CU_FORCE_SEND_CATEGORY_COOLDOWNS
Definition: SpellInfo.h:204
@ SPELL_ATTR6_NO_CATEGORY_COOLDOWN_MODS
Definition: SharedDefines.h:635
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:5607
void ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr, bool temporaryPet=false)
Definition: Player.cpp:9648
void BuildCooldownPacket(WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
Definition: Unit.cpp:21266
uint32 GetAttackTime(WeaponAttackType att) const
Definition: Unit.h:1483
int32 GetTotalAuraModifier(AuraType auratype) const
Definition: Unit.cpp:5848
uint32 SpellFamilyName
Definition: SpellInfo.h:385

References _AddSpellCooldown(), ApplySpellMod(), Unit::BuildCooldownPacket(), SpellInfo::CategoryRecoveryTime, Unit::GetAttackTime(), SpellInfo::GetCategory(), Unit::GetTotalAuraModifier(), SpellInfo::HasAttribute(), HasSpell(), SpellInfo::Id, IN_MILLISECONDS, infinityCooldownDelay, SpellInfo::IsAutoRepeatRangedSpell(), SpellInfo::IsCooldownStartedOnEvent(), MAX_ITEM_SPELLS, RANGED_ATTACK, SpellInfo::RecoveryTime, SendDirectMessage(), sObjectMgr, SPELL_ATTR0_CU_FORCE_SEND_CATEGORY_COOLDOWNS, SPELL_ATTR6_NO_CATEGORY_COOLDOWN_MODS, SPELL_AURA_MOD_COOLDOWN, SPELL_COOLDOWN_FLAG_NONE, SpellInfo::SpellFamilyName, SPELLMOD_COOLDOWN, sSpellMgr, and sSpellsByCategoryStore.

Referenced by Aura::_ApplyForTarget(), Unit::AddGameObject(), spell_pvp_trinket_wotf_shared_cd::HandleScript(), SendCooldownEvent(), Spell::SendSpellCooldown(), and Unit::SetMinion().

◆ AddSpellCooldown()

void Player::AddSpellCooldown ( uint32  spell_id,
uint32  itemid,
uint32  end_time,
bool  needSendToClient = false,
bool  forceSendToSpectator = false 
)
overridevirtual

◆ AddSpellMod()

void Player::AddSpellMod ( SpellModifier mod,
bool  apply 
)
9807{
9808 LOG_DEBUG("spells.aura", "Player::AddSpellMod {}", mod->spellId);
9810
9811 int i = 0;
9812 flag96 _mask = 0;
9813 for (int eff = 0; eff < 96; ++eff)
9814 {
9815 if (eff != 0 && eff % 32 == 0)
9816 _mask[i++] = 0;
9817
9818 _mask[i] = uint32(1) << (eff - (32 * i));
9819 if (mod->mask & _mask)
9820 {
9821 int32 val = 0;
9822 for (SpellModList::iterator itr = m_spellMods[mod->op].begin(); itr != m_spellMods[mod->op].end(); ++itr)
9823 {
9824 if ((*itr)->type == mod->type && (*itr)->mask & _mask)
9825 val += (*itr)->value;
9826 }
9827 val += apply ? mod->value : -(mod->value);
9828 WorldPacket data(Opcode, (1 + 1 + 4));
9829 data << uint8(eff);
9830 data << uint8(mod->op);
9831 data << int32(val);
9832 SendDirectMessage(&data);
9833 }
9834 }
9835
9836 if (apply)
9837 {
9838 m_spellMods[mod->op].push_back(mod);
9839 if (getClass() == CLASS_MAGE)
9840 m_spellMods[mod->op].sort(MageSpellModPred());
9841 else
9842 m_spellMods[mod->op].sort(SpellModPred());
9843 }
9844 else
9845 {
9846 m_spellMods[mod->op].remove(mod);
9847 // mods bound to aura will be removed in AuraEffect::~AuraEffect
9848 if (!mod->ownerAura)
9849 delete mod;
9850 }
9851}
@ SPELLMOD_FLAT
Definition: Player.h:94
@ CLASS_MAGE
Definition: SharedDefines.h:148
@ SMSG_SET_FLAT_SPELL_MODIFIER
Definition: Opcodes.h:644
@ SMSG_SET_PCT_SPELL_MODIFIER
Definition: Opcodes.h:645
void apply(T *val)
Definition: ByteConverter.h:40
Definition: Util.h:451
Definition: Player.cpp:9780
Definition: Player.cpp:9791
SpellModOp op
Definition: Player.h:184
SpellModType type
Definition: Player.h:185
int32 value
Definition: Player.h:187
uint32 spellId
Definition: Player.h:189
Aura *const ownerAura
Definition: Player.h:190
flag96 mask
Definition: Player.h:188
SpellModList m_spellMods[MAX_SPELLMOD]
Definition: Player.h:2781

References CLASS_MAGE, Unit::getClass(), LOG_DEBUG, m_spellMods, SpellModifier::mask, SpellModifier::op, SpellModifier::ownerAura, SendDirectMessage(), SMSG_SET_FLAT_SPELL_MODIFIER, SMSG_SET_PCT_SPELL_MODIFIER, SpellModifier::spellId, SPELLMOD_FLAT, SpellModifier::type, and SpellModifier::value.

Referenced by AuraEffect::ApplySpellMod().

◆ addTalent()

bool Player::addTalent ( uint32  spellId,
uint8  addSpecMask,
uint8  oldTalentRank 
)
2864{
2865 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
2866 if (!SpellMgr::CheckSpellValid(spellInfo, spellId, true))
2867 return false;
2868
2869 TalentSpellPos const* talentPos = GetTalentSpellPos(spellId);
2870 if (!talentPos)
2871 return false;
2872
2873 TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id);
2874 if (!talentInfo)
2875 return false;
2876
2877 // xinef: remove old talent rank if any
2878 if (oldTalentRank)
2879 {
2880 _removeTalent(talentInfo->RankID[oldTalentRank - 1], addSpecMask);
2881 _removeTalentAurasAndSpells(talentInfo->RankID[oldTalentRank - 1]);
2882 SendLearnPacket(talentInfo->RankID[oldTalentRank - 1], false);
2883 }
2884
2885 // xinef: add talent auras and spells
2886 if (GetActiveSpecMask() & addSpecMask)
2887 _addTalentAurasAndSpells(spellId);
2888
2889 // xinef: find the spell on our talent map
2890 PlayerTalentMap::iterator itr = m_talents.find(spellId);
2891
2892 // xinef: we do not have such a spell on our talent map
2893 if (itr == m_talents.end())
2894 {
2896 PlayerTalent* newTalent = new PlayerTalent();
2897 newTalent->State = state;
2898 newTalent->specMask = addSpecMask;
2899 newTalent->talentID = talentInfo->TalentID;
2900 newTalent->inSpellBook = talentInfo->addToSpellBook && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL);
2901
2902 m_talents[spellId] = newTalent;
2903 return true;
2904 }
2905 // xinef: if current mask does not cover addMask, add it to iterator and save changes to DB
2906 else if (!(itr->second->specMask & addSpecMask))
2907 {
2908 itr->second->specMask |= addSpecMask;
2909 if (itr->second->State != PLAYERSPELL_NEW)
2910 itr->second->State = PLAYERSPELL_CHANGED;
2911
2912 return true;
2913 }
2914
2915 return false;
2916}
DBCStorage< TalentEntry > sTalentStore(TalentEntryfmt)
PlayerSpellState
Definition: Player.h:119
Definition: Player.h:136
PlayerSpellState State
Definition: Player.h:137
bool inSpellBook
Definition: Player.h:140
uint32 talentID
Definition: Player.h:139
uint8 specMask
Definition: Player.h:138
Definition: DBCStructure.h:1924
std::array< uint32, MAX_TALENT_RANK > RankID
Definition: DBCStructure.h:1929
uint32 TalentID
Definition: DBCStructure.h:1925
uint32 addToSpellBook
Definition: DBCStructure.h:1935
uint16 talent_id
Definition: DBCStructure.h:2234

References _addTalentAurasAndSpells(), _removeTalent(), _removeTalentAurasAndSpells(), TalentEntry::addToSpellBook, SpellMgr::CheckSpellValid(), GetActiveSpecMask(), GetTalentSpellPos(), SpellInfo::HasAttribute(), SpellInfo::HasEffect(), PlayerTalent::inSpellBook, isBeingLoaded(), m_talents, PLAYERSPELL_CHANGED, PLAYERSPELL_NEW, PLAYERSPELL_UNCHANGED, TalentEntry::RankID, SendLearnPacket(), PlayerTalent::specMask, SPELL_ATTR0_PASSIVE, SPELL_EFFECT_LEARN_SPELL, sSpellMgr, sTalentStore, PlayerTalent::State, TalentSpellPos::talent_id, PlayerTalent::talentID, and TalentEntry::TalentID.

Referenced by _LoadTalents(), and LearnTalent().

◆ AddTimedQuest()

void Player::AddTimedQuest ( uint32  quest_id)
inline
1532{ m_timedquests.insert(quest_id); }
QuestSet m_timedquests
Definition: Player.h:2646

References m_timedquests.

Referenced by _LoadQuestStatus(), and AddQuest().

◆ AddToWorld()

void Player::AddToWorld ( )
overridevirtual
  • Do not add/remove the player from the object storage
  • It will crash when updating the ObjectAccessor
  • The player should only be added when logging in

Reimplemented from WorldObject.

1686{
1691
1692 for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
1693 if (m_items[i])
1694 m_items[i]->AddToWorld();
1695}
@ PLAYER_SLOT_START
Definition: Player.h:665
@ PLAYER_SLOT_END
Definition: Player.h:667
void AddToWorld() override
Definition: Unit.cpp:15674

References Object::AddToWorld(), Unit::AddToWorld(), m_items, PLAYER_SLOT_END, and PLAYER_SLOT_START.

Referenced by Map::AddPlayerToMap().

◆ AddTradeableItem()

void Player::AddTradeableItem ( Item item)
4155{
4156 std::lock_guard<std::mutex> guard(m_soulboundTradableLock);
4157 m_itemSoulboundTradeable.push_back(item);
4158}
std::mutex m_soulboundTradableLock
Definition: Player.h:2788
ItemDurationList m_itemSoulboundTradeable
Definition: Player.h:2787

References m_itemSoulboundTradeable, and m_soulboundTradableLock.

Referenced by _LoadItem(), MoveItemToInventory(), and StoreNewItem().

◆ AddWeaponProficiency()

void Player::AddWeaponProficiency ( uint32  newflag)
inline
1338{ m_WeaponProficiency |= newflag; }

References m_WeaponProficiency.

Referenced by Spell::EffectProficiency().

◆ AddWhisperWhiteList()

void Player::AddWhisperWhiteList ( ObjectGuid  guid)
inline
2522{ WhisperList.push_back(guid); }
WhisperListContainer WhisperList
Definition: Player.h:2600

References WhisperList.

Referenced by WorldSession::HandleMessagechatOpcode().

◆ AdjustQuestReqItemCount()

void Player::AdjustQuestReqItemCount ( Quest const *  quest,
QuestStatusData questStatusData 
)
private
1751{
1752 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
1753 {
1754 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
1755 {
1756 uint32 reqitemcount = quest->RequiredItemCount[i];
1757 if (reqitemcount != 0)
1758 {
1759 uint32 curitemcount = GetItemCount(quest->RequiredItemId[i], true);
1760
1761 questStatusData.ItemCount[i] = std::min(curitemcount, reqitemcount);
1762 m_QuestStatusSave[quest->GetQuestId()] = true;
1763 }
1764 }
1765 }
1766}
uint32 GetItemCount(uint32 item, bool inBankAlso=false, Item *skipItem=nullptr) const
Definition: PlayerStorage.cpp:355

References GetItemCount(), Quest::GetQuestId(), Quest::HasSpecialFlag(), QuestStatusData::ItemCount, m_QuestStatusSave, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_DELIVER, Quest::RequiredItemCount, and Quest::RequiredItemId.

Referenced by AddQuest().

◆ ApplyEnchantment() [1/2]

void Player::ApplyEnchantment ( Item item,
bool  apply 
)
4321{
4322 for (uint32 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
4323 ApplyEnchantment(item, EnchantmentSlot(slot), apply);
4324}

References ApplyEnchantment(), and MAX_ENCHANTMENT_SLOT.

◆ ApplyEnchantment() [2/2]

void Player::ApplyEnchantment ( Item item,
EnchantmentSlot  slot,
bool  apply,
bool  apply_dur = true,
bool  ignore_condition = false 
)
4327{
4328 if (!item || !item->IsEquipped())
4329 return;
4330
4331 if (slot >= MAX_ENCHANTMENT_SLOT)
4332 return;
4333
4334 uint32 enchant_id = item->GetEnchantmentId(slot);
4335 if (!enchant_id)
4336 return;
4337
4338 SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
4339 if (!pEnchant)
4340 return;
4341
4342 if (!ignore_condition && pEnchant->EnchantmentCondition && !EnchantmentFitsRequirements(pEnchant->EnchantmentCondition, -1))
4343 return;
4344
4345 if (pEnchant->requiredLevel > GetLevel())
4346 return;
4347
4348 if (pEnchant->requiredSkill > 0 && pEnchant->requiredSkillValue > GetSkillValue(pEnchant->requiredSkill))
4349 return;
4350
4351 if (!sScriptMgr->CanApplyEnchantment(this, item, slot, apply, apply_dur, ignore_condition))
4352 return;
4353
4354 // If we're dealing with a gem inside a prismatic socket we need to check the prismatic socket requirements
4355 // rather than the gem requirements itself. If the socket has no color it is a prismatic socket.
4357 && !item->GetTemplate()->Socket[slot - SOCK_ENCHANTMENT_SLOT].Color)
4358 {
4359 // Check if the requirements for the prismatic socket are met before applying the gem stats
4361 if (!pPrismaticEnchant || (pPrismaticEnchant->requiredSkill > 0 && pPrismaticEnchant->requiredSkillValue > GetSkillValue(pPrismaticEnchant->requiredSkill)))
4362 return;
4363 }
4364
4365 if (!item->IsBroken())
4366 {
4367 for (int s = 0; s < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; ++s)
4368 {
4369 uint32 enchant_display_type = pEnchant->type[s];
4370 uint32 enchant_amount = pEnchant->amount[s];
4371 uint32 enchant_spell_id = pEnchant->spellid[s];
4372
4373 switch (enchant_display_type)
4374 {
4376 break;
4378 // processed in Player::CastItemCombatSpell
4379 break;
4381 if (item->GetSlot() == EQUIPMENT_SLOT_MAINHAND)
4382 HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(enchant_amount), apply);
4383 else if (item->GetSlot() == EQUIPMENT_SLOT_OFFHAND)
4384 HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(enchant_amount), apply);
4385 else if (item->GetSlot() == EQUIPMENT_SLOT_RANGED)
4386 HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(enchant_amount), apply);
4387 break;
4389 if (enchant_spell_id)
4390 {
4391 if (apply)
4392 {
4393 int32 basepoints = 0;
4394 // Random Property Exist - try found basepoints for spell (basepoints depends from item suffix factor)
4395 if (item->GetItemRandomPropertyId())
4396 {
4397 ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(std::abs(item->GetItemRandomPropertyId()));
4398 if (item_rand)
4399 {
4400 // Search enchant_amount
4401 for (int k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; ++k)
4402 {
4403 if (item_rand->Enchantment[k] == enchant_id)
4404 {
4405 basepoints = int32((item_rand->AllocationPct[k] * item->GetItemSuffixFactor()) / 10000);
4406 break;
4407 }
4408 }
4409 }
4410 }
4411 // Cast custom spell vs all equal basepoints got from enchant_amount
4412 if (basepoints)
4413 CastCustomSpell(this, enchant_spell_id, &basepoints, &basepoints, &basepoints, true, item);
4414 else
4415 CastSpell(this, enchant_spell_id, true, item);
4416 }
4417 else
4418 RemoveAurasDueToItemSpell(enchant_spell_id, item->GetGUID());
4419 }
4420 break;
4422 if (!enchant_amount)
4423 {
4424 ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(std::abs(item->GetItemRandomPropertyId()));
4425 if (item_rand)
4426 {
4427 for (int k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; ++k)
4428 {
4429 if (item_rand->Enchantment[k] == enchant_id)
4430 {
4431 enchant_amount = uint32((item_rand->AllocationPct[k] * item->GetItemSuffixFactor()) / 10000);
4432 break;
4433 }
4434 }
4435 }
4436 }
4437
4438 HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + enchant_spell_id), TOTAL_VALUE, float(enchant_amount), apply);
4439 break;
4441 {
4442 if (!enchant_amount)
4443 {
4444 ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(std::abs(item->GetItemRandomPropertyId()));
4445 if (item_rand_suffix)
4446 {
4447 for (int k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; ++k)
4448 {
4449 if (item_rand_suffix->Enchantment[k] == enchant_id)
4450 {
4451 enchant_amount = uint32((item_rand_suffix->AllocationPct[k] * item->GetItemSuffixFactor()) / 10000);
4452 break;
4453 }
4454 }
4455 }
4456 }
4457
4458 LOG_DEBUG("entities.player.items", "Adding {} to stat nb {}", enchant_amount, enchant_spell_id);
4459 switch (enchant_spell_id)
4460 {
4461 case ITEM_MOD_MANA:
4462 LOG_DEBUG("entities.player.items", "+ {} MANA", enchant_amount);
4463 HandleStatModifier(UNIT_MOD_MANA, BASE_VALUE, float(enchant_amount), apply);
4464 break;
4465 case ITEM_MOD_HEALTH:
4466 LOG_DEBUG("entities.player.items", "+ {} HEALTH", enchant_amount);
4467 HandleStatModifier(UNIT_MOD_HEALTH, BASE_VALUE, float(enchant_amount), apply);
4468 break;
4469 case ITEM_MOD_AGILITY:
4470 LOG_DEBUG("entities.player.items", "+ {} AGILITY", enchant_amount);
4471 HandleStatModifier(UNIT_MOD_STAT_AGILITY, TOTAL_VALUE, float(enchant_amount), apply);
4472 ApplyStatBuffMod(STAT_AGILITY, (float)enchant_amount, apply);
4473 break;
4474 case ITEM_MOD_STRENGTH:
4475 LOG_DEBUG("entities.player.items", "+ {} STRENGTH", enchant_amount);
4476 HandleStatModifier(UNIT_MOD_STAT_STRENGTH, TOTAL_VALUE, float(enchant_amount), apply);
4477 ApplyStatBuffMod(STAT_STRENGTH, (float)enchant_amount, apply);
4478 break;
4479 case ITEM_MOD_INTELLECT:
4480 LOG_DEBUG("entities.player.items", "+ {} INTELLECT", enchant_amount);
4481 HandleStatModifier(UNIT_MOD_STAT_INTELLECT, TOTAL_VALUE, float(enchant_amount), apply);
4482 ApplyStatBuffMod(STAT_INTELLECT, (float)enchant_amount, apply);
4483 break;
4484 case ITEM_MOD_SPIRIT:
4485 LOG_DEBUG("entities.player.items", "+ {} SPIRIT", enchant_amount);
4486 HandleStatModifier(UNIT_MOD_STAT_SPIRIT, TOTAL_VALUE, float(enchant_amount), apply);
4487 ApplyStatBuffMod(STAT_SPIRIT, (float)enchant_amount, apply);
4488 break;
4489 case ITEM_MOD_STAMINA:
4490 LOG_DEBUG("entities.player.items", "+ {} STAMINA", enchant_amount);
4491 HandleStatModifier(UNIT_MOD_STAT_STAMINA, TOTAL_VALUE, float(enchant_amount), apply);
4492 ApplyStatBuffMod(STAT_STAMINA, (float)enchant_amount, apply);
4493 break;
4495 ApplyRatingMod(CR_DEFENSE_SKILL, enchant_amount, apply);
4496 LOG_DEBUG("entities.player.items", "+ {} DEFENCE", enchant_amount);
4497 break;
4499 ApplyRatingMod(CR_DODGE, enchant_amount, apply);
4500 LOG_DEBUG("entities.player.items", "+ {} DODGE", enchant_amount);
4501 break;
4503 ApplyRatingMod(CR_PARRY, enchant_amount, apply);
4504 LOG_DEBUG("entities.player.items", "+ {} PARRY", enchant_amount);
4505 break;
4507 ApplyRatingMod(CR_BLOCK, enchant_amount, apply);
4508 LOG_DEBUG("entities.player.items", "+ {} SHIELD_BLOCK", enchant_amount);
4509 break;
4511 ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply);
4512 LOG_DEBUG("entities.player.items", "+ {} MELEE_HIT", enchant_amount);
4513 break;
4515 ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply);
4516 LOG_DEBUG("entities.player.items", "+ {} RANGED_HIT", enchant_amount);
4517 break;
4519 ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply);
4520 LOG_DEBUG("entities.player.items", "+ {} SPELL_HIT", enchant_amount);
4521 break;
4523 ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply);
4524 LOG_DEBUG("entities.player.items", "+ {} MELEE_CRIT", enchant_amount);
4525 break;
4527 ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply);
4528 LOG_DEBUG("entities.player.items", "+ {} RANGED_CRIT", enchant_amount);
4529 break;
4531 ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply);
4532 LOG_DEBUG("entities.player.items", "+ {} SPELL_CRIT", enchant_amount);
4533 break;
4534 // Values from ITEM_STAT_MELEE_HA_RATING to ITEM_MOD_HASTE_RANGED_RATING are never used
4535 // in Enchantments
4536 // case ITEM_MOD_HIT_TAKEN_MELEE_RATING:
4537 // ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply);
4538 // break;
4539 // case ITEM_MOD_HIT_TAKEN_RANGED_RATING:
4540 // ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply);
4541 // break;
4542 // case ITEM_MOD_HIT_TAKEN_SPELL_RATING:
4543 // ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply);
4544 // break;
4545 // case ITEM_MOD_CRIT_TAKEN_MELEE_RATING:
4546 // ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
4547 // break;
4548 // case ITEM_MOD_CRIT_TAKEN_RANGED_RATING:
4549 // ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
4550 // break;
4551 // case ITEM_MOD_CRIT_TAKEN_SPELL_RATING:
4552 // ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
4553 // break;
4554 // case ITEM_MOD_HASTE_MELEE_RATING:
4555 // ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply);
4556 // break;
4558 ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply);
4559 break;
4561 ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply);
4562 break;
4564 ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply);
4565 ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply);
4566 ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply);
4567 LOG_DEBUG("entities.player.items", "+ {} HIT", enchant_amount);
4568 break;
4570 ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply);
4571 ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply);
4572 ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply);
4573 LOG_DEBUG("entities.player.items", "+ {} CRITICAL", enchant_amount);
4574 break;
4575 // Values ITEM_MOD_HIT_TAKEN_RATING and ITEM_MOD_CRIT_TAKEN_RATING are never used in Enchantment
4576 // case ITEM_MOD_HIT_TAKEN_RATING:
4577 // ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply);
4578 // ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply);
4579 // ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply);
4580 // break;
4581 // case ITEM_MOD_CRIT_TAKEN_RATING:
4582 // ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
4583 // ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
4584 // ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
4585 // break;
4587 ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
4588 ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
4589 ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
4590 LOG_DEBUG("entities.player.items", "+ {} RESILIENCE", enchant_amount);
4591 break;
4593 ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply);
4594 ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply);
4595 ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply);
4596 LOG_DEBUG("entities.player.items", "+ {} HASTE", enchant_amount);
4597 break;
4599 ApplyRatingMod(CR_EXPERTISE, enchant_amount, apply);
4600 LOG_DEBUG("entities.player.items", "+ {} EXPERTISE", enchant_amount);
4601 break;
4603 HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(enchant_amount), apply);
4604 HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(enchant_amount), apply);
4605 LOG_DEBUG("entities.player.items", "+ {} ATTACK_POWER", enchant_amount);
4606 break;
4608 HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(enchant_amount), apply);
4609 LOG_DEBUG("entities.player.items", "+ {} RANGED_ATTACK_POWER", enchant_amount);
4610 break;
4611 // case ITEM_MOD_FERAL_ATTACK_POWER:
4612 // ApplyFeralAPBonus(enchant_amount, apply);
4613 // LOG_DEBUG("entities.player.items", "+ {} FERAL_ATTACK_POWER", enchant_amount);
4614 // break;
4616 ApplyManaRegenBonus(enchant_amount, apply);
4617 LOG_DEBUG("entities.player.items", "+ {} MANA_REGENERATION", enchant_amount);
4618 break;
4620 ApplyRatingMod(CR_ARMOR_PENETRATION, enchant_amount, apply);
4621 LOG_DEBUG("entities.player.items", "+ {} ARMOR PENETRATION", enchant_amount);
4622 break;
4624 ApplySpellPowerBonus(enchant_amount, apply);
4625 LOG_DEBUG("entities.player.items", "+ {} SPELL_POWER", enchant_amount);
4626 break;
4628 ApplyHealthRegenBonus(enchant_amount, apply);
4629 LOG_DEBUG("entities.player.items", "+ {} HEALTH_REGENERATION", enchant_amount);
4630 break;
4632 ApplySpellPenetrationBonus(enchant_amount, apply);
4633 LOG_DEBUG("entities.player.items", "+ {} SPELL_PENETRATION", enchant_amount);
4634 break;
4636 HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(enchant_amount), apply);
4637 LOG_DEBUG("entities.player.items", "+ {} BLOCK_VALUE", enchant_amount);
4638 break;
4639 case ITEM_MOD_SPELL_HEALING_DONE: // deprecated
4640 case ITEM_MOD_SPELL_DAMAGE_DONE: // deprecated
4641 default:
4642 break;
4643 }
4644 break;
4645 }
4646 case ITEM_ENCHANTMENT_TYPE_TOTEM: // Shaman Rockbiter Weapon
4647 {
4648 if (getClass() == CLASS_SHAMAN)
4649 {
4650 float addValue = 0.0f;
4651 if (item->GetSlot() == EQUIPMENT_SLOT_MAINHAND)
4652 {
4653 addValue = float(enchant_amount * item->GetTemplate()->Delay / 1000.0f);
4655 }
4656 else if (item->GetSlot() == EQUIPMENT_SLOT_OFFHAND)
4657 {
4658 addValue = float(enchant_amount * item->GetTemplate()->Delay / 1000.0f);
4660 }
4661 }
4662 break;
4663 }
4665 // processed in Player::CastItemUseSpell
4666 break;
4668 // nothing do..
4669 break;
4670 default:
4671 LOG_ERROR("entities.player", "Unknown item enchantment (id = {}) display type: {}", enchant_id, enchant_display_type);
4672 break;
4673 } /*switch (enchant_display_type)*/
4674 } /*for*/
4675 }
4676
4677 // visualize enchantment at player and equipped items
4678 if (slot == PERM_ENCHANTMENT_SLOT)
4679 SetUInt16Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (item->GetSlot() * 2), 0, apply ? item->GetEnchantmentId(slot) : 0);
4680
4681 if (slot == TEMP_ENCHANTMENT_SLOT)
4682 SetUInt16Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (item->GetSlot() * 2), 1, apply ? item->GetEnchantmentId(slot) : 0);
4683
4684 if (apply_dur)
4685 {
4686 if (apply)
4687 {
4688 // set duration
4689 uint32 duration = item->GetEnchantmentDuration(slot);
4690 if (duration > 0)
4691 AddEnchantmentDuration(item, slot, duration);
4692 }
4693 else
4694 {
4695 // duration == 0 will remove EnchantDuration
4696 AddEnchantmentDuration(item, slot, 0);
4697 }
4698 }
4699}
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
DBCStorage< ItemRandomSuffixEntry > sItemRandomSuffixStore(ItemRandomSuffixfmt)
@ PERM_ENCHANTMENT_SLOT
Definition: Item.h:163
@ SOCK_ENCHANTMENT_SLOT_3
Definition: Item.h:167
@ TEMP_ENCHANTMENT_SLOT
Definition: Item.h:164
@ SOCK_ENCHANTMENT_SLOT_2
Definition: Item.h:166
@ PRISMATIC_ENCHANTMENT_SLOT
Definition: Item.h:169
@ SOCK_ENCHANTMENT_SLOT
Definition: Item.h:165
@ PLAYER_VISIBLE_ITEM_1_ENCHANTMENT
Definition: UpdateFields.h:287
@ UNIT_MOD_RESISTANCE_START
Definition: Unit.h:291
@ ITEM_ENCHANTMENT_TYPE_DAMAGE
Definition: DBCEnums.h:376
@ ITEM_ENCHANTMENT_TYPE_USE_SPELL
Definition: DBCEnums.h:381
@ ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL
Definition: DBCEnums.h:375
@ ITEM_ENCHANTMENT_TYPE_STAT
Definition: DBCEnums.h:379
@ ITEM_ENCHANTMENT_TYPE_RESISTANCE
Definition: DBCEnums.h:378
@ ITEM_ENCHANTMENT_TYPE_NONE
Definition: DBCEnums.h:374
@ ITEM_ENCHANTMENT_TYPE_EQUIP_SPELL
Definition: DBCEnums.h:377
@ ITEM_ENCHANTMENT_TYPE_TOTEM
Definition: DBCEnums.h:380
@ ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET
Definition: DBCEnums.h:382
#define MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS
Definition: DBCStructure.h:1839
#define MAX_ITEM_ENCHANTMENT_EFFECTS
Definition: DBCStructure.h:1195
@ CLASS_SHAMAN
Definition: SharedDefines.h:147
int32 GetItemRandomPropertyId() const
Definition: Item.h:286
uint32 GetItemSuffixFactor() const
Definition: Item.h:287
bool IsEquipped() const
Definition: Item.cpp:790
uint32 Color
Definition: ItemTemplate.h:611
uint32 Delay
Definition: ItemTemplate.h:668
_Socket Socket[MAX_ITEM_PROTO_SOCKETS]
Definition: ItemTemplate.h:690
void SetUInt16Value(uint16 index, uint8 offset, uint16 value)
Definition: Object.cpp:770
uint16 GetSkillValue(uint32 skill) const
Definition: Player.cpp:5367
bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
Definition: Player.cpp:11038
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1226
void RemoveAurasDueToItemSpell(uint32 spellId, ObjectGuid castItemGuid)
Definition: Unit.cpp:5031
Definition: DBCStructure.h:1208
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > AllocationPct
Definition: DBCStructure.h:1215
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > Enchantment
Definition: DBCStructure.h:1213
Definition: DBCStructure.h:1842
uint32 EnchantmentCondition
Definition: DBCStructure.h:1854
uint32 amount[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition: DBCStructure.h:1846
uint32 requiredLevel
Definition: DBCStructure.h:1857
uint32 spellid[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition: DBCStructure.h:1848
uint32 requiredSkill
Definition: DBCStructure.h:1855
uint32 requiredSkillValue
Definition: DBCStructure.h:1856
uint32 type[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition: DBCStructure.h:1845

References AddEnchantmentDuration(), ItemRandomSuffixEntry::AllocationPct, SpellItemEnchantmentEntry::amount, ApplyHealthRegenBonus(), ApplyManaRegenBonus(), ApplyRatingMod(), ApplySpellPenetrationBonus(), ApplySpellPowerBonus(), Unit::ApplyStatBuffMod(), BASE_VALUE, Unit::CastCustomSpell(), Unit::CastSpell(), CLASS_SHAMAN, _Socket::Color, CR_ARMOR_PENETRATION, CR_BLOCK, CR_CRIT_MELEE, CR_CRIT_RANGED, CR_CRIT_SPELL, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, CR_DEFENSE_SKILL, CR_DODGE, CR_EXPERTISE, CR_HASTE_MELEE, CR_HASTE_RANGED, CR_HASTE_SPELL, CR_HIT_MELEE, CR_HIT_RANGED, CR_HIT_SPELL, CR_PARRY, ItemTemplate::Delay, ItemRandomSuffixEntry::Enchantment, SpellItemEnchantmentEntry::EnchantmentCondition, EnchantmentFitsRequirements(), EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, FLAT_MOD, Unit::getClass(), Item::GetEnchantmentDuration(), Item::GetEnchantmentId(), Object::GetGUID(), Item::GetItemRandomPropertyId(), Item::GetItemSuffixFactor(), Unit::GetLevel(), GetSkillValue(), Item::GetSlot(), Item::GetTemplate(), HandleBaseModValue(), Unit::HandleStatModifier(), Item::IsBroken(), Item::IsEquipped(), ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL, ITEM_ENCHANTMENT_TYPE_DAMAGE, ITEM_ENCHANTMENT_TYPE_EQUIP_SPELL, ITEM_ENCHANTMENT_TYPE_NONE, ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET, ITEM_ENCHANTMENT_TYPE_RESISTANCE, ITEM_ENCHANTMENT_TYPE_STAT, ITEM_ENCHANTMENT_TYPE_TOTEM, ITEM_ENCHANTMENT_TYPE_USE_SPELL, ITEM_MOD_AGILITY, ITEM_MOD_ARMOR_PENETRATION_RATING, ITEM_MOD_ATTACK_POWER, ITEM_MOD_BLOCK_RATING, ITEM_MOD_BLOCK_VALUE, ITEM_MOD_CRIT_MELEE_RATING, ITEM_MOD_CRIT_RANGED_RATING, ITEM_MOD_CRIT_RATING, ITEM_MOD_CRIT_SPELL_RATING, ITEM_MOD_DEFENSE_SKILL_RATING, ITEM_MOD_DODGE_RATING, ITEM_MOD_EXPERTISE_RATING, ITEM_MOD_HASTE_RANGED_RATING, ITEM_MOD_HASTE_RATING, ITEM_MOD_HASTE_SPELL_RATING, ITEM_MOD_HEALTH, ITEM_MOD_HEALTH_REGEN, ITEM_MOD_HIT_MELEE_RATING, ITEM_MOD_HIT_RANGED_RATING, ITEM_MOD_HIT_RATING, ITEM_MOD_HIT_SPELL_RATING, ITEM_MOD_INTELLECT, ITEM_MOD_MANA, ITEM_MOD_MANA_REGENERATION, ITEM_MOD_PARRY_RATING, ITEM_MOD_RANGED_ATTACK_POWER, ITEM_MOD_RESILIENCE_RATING, ITEM_MOD_SPELL_DAMAGE_DONE, ITEM_MOD_SPELL_HEALING_DONE, ITEM_MOD_SPELL_PENETRATION, ITEM_MOD_SPELL_POWER, ITEM_MOD_SPIRIT, ITEM_MOD_STAMINA, ITEM_MOD_STRENGTH, LOG_DEBUG, LOG_ERROR, MAX_ENCHANTMENT_SLOT, MAX_ITEM_ENCHANTMENT_EFFECTS, MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS, PERM_ENCHANTMENT_SLOT, PLAYER_VISIBLE_ITEM_1_ENCHANTMENT, PRISMATIC_ENCHANTMENT_SLOT, Unit::RemoveAurasDueToItemSpell(), SpellItemEnchantmentEntry::requiredLevel, SpellItemEnchantmentEntry::requiredSkill, SpellItemEnchantmentEntry::requiredSkillValue, Object::SetUInt16Value(), SHIELD_BLOCK_VALUE, sItemRandomSuffixStore, SOCK_ENCHANTMENT_SLOT, SOCK_ENCHANTMENT_SLOT_2, SOCK_ENCHANTMENT_SLOT_3, ItemTemplate::Socket, SpellItemEnchantmentEntry::spellid, sScriptMgr, sSpellItemEnchantmentStore, STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STAMINA, STAT_STRENGTH, TEMP_ENCHANTMENT_SLOT, TOTAL_VALUE, SpellItemEnchantmentEntry::type, UNIT_MOD_ATTACK_POWER, UNIT_MOD_ATTACK_POWER_RANGED, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_DAMAGE_RANGED, UNIT_MOD_HEALTH, UNIT_MOD_MANA, UNIT_MOD_RESISTANCE_START, UNIT_MOD_STAT_AGILITY, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_STAMINA, and UNIT_MOD_STAT_STRENGTH.

Referenced by _ApplyAllItemMods(), _ApplyItemMods(), _RemoveAllItemMods(), ApplyEnchantment(), CastItemCombatSpell(), CorrectMetaGemEnchants(), Spell::EffectEnchantHeldItem(), Spell::EffectEnchantItemPerm(), Spell::EffectEnchantItemPrismatic(), Spell::EffectEnchantItemTmp(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleCancelTempEnchantmentOpcode(), WorldSession::HandleSocketOpcode(), RemoveArenaEnchantments(), SetVirtualItemSlot(), SwapItem(), ToggleMetaGemsActive(), UpdateEnchantTime(), and UpdateSkillEnchantments().

◆ ApplyEquipCooldown()

void Player::ApplyEquipCooldown ( Item pItem)
11687{
11689 return;
11690
11691 for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
11692 {
11693 _Spell const& spellData = pItem->GetTemplate()->Spells[i];
11694
11695 // no spell
11696 if (!spellData.SpellId)
11697 continue;
11698
11699 // xinef: apply hidden cooldown for procs
11701 {
11702 // xinef: uint32(-1) special marker for proc cooldowns
11703 AddSpellCooldown(spellData.SpellId, uint32(-1), 30 * IN_MILLISECONDS);
11704 continue;
11705 }
11706
11707 // wrong triggering type (note: ITEM_SPELLTRIGGER_ON_NO_DELAY_USE not have cooldown)
11708 if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE)
11709 continue;
11710
11711 // xinef: dont apply equip cooldown if spell on item has insignificant cooldown
11712 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
11713 if (spellData.SpellCooldown <= 3000 && spellData.SpellCategoryCooldown <= 3000 && (!spellInfo || (spellInfo->RecoveryTime <= 3000 && spellInfo->CategoryRecoveryTime <= 3000)))
11714 continue;
11715
11716 // Don't replace longer cooldowns by equip cooldown if we have any.
11717 SpellCooldowns::iterator itr = m_spellCooldowns.find(spellData.SpellId);
11718 if (itr != m_spellCooldowns.end() && itr->second.itemid == pItem->GetEntry() && itr->second.end > GameTime::GetGameTimeMS().count() + 30 * IN_MILLISECONDS)
11719 continue;
11720
11721 // xinef: dont apply eqiup cooldown for spells with this attribute
11722 if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR0_NOT_IN_COMBAT_ONLY_PEACEFUL))
11723 continue;
11724
11725 AddSpellCooldown(spellData.SpellId, pItem->GetEntry(), 30 * IN_MILLISECONDS, true, true);
11726
11728 data << pItem->GetGUID();
11729 data << uint32(spellData.SpellId);
11730 GetSession()->SendPacket(&data);
11731 }
11732}
@ ITEM_SPELLTRIGGER_ON_USE
Definition: ItemTemplate.h:78
@ ITEM_SPELLTRIGGER_ON_EQUIP
Definition: ItemTemplate.h:79
@ ITEM_FLAG_NO_EQUIP_COOLDOWN
Definition: ItemTemplate.h:155
#define MAX_ITEM_PROTO_SPELLS
Definition: ItemTemplate.h:624
@ SPELL_ATTR0_NOT_IN_COMBAT_ONLY_PEACEFUL
Definition: SharedDefines.h:410
@ SMSG_ITEM_COOLDOWN
Definition: Opcodes.h:206
Definition: ItemTemplate.h:599
uint32 SpellTrigger
Definition: ItemTemplate.h:601
int32 SpellCategoryCooldown
Definition: ItemTemplate.h:606
int32 SpellCooldown
Definition: ItemTemplate.h:604
int32 SpellId
Definition: ItemTemplate.h:600
_Spell Spells[MAX_ITEM_PROTO_SPELLS]
Definition: ItemTemplate.h:671
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition: Player.cpp:11004
uint32 RecoveryTime
Definition: SpellInfo.h:346
uint32 CategoryRecoveryTime
Definition: SpellInfo.h:347

References AddSpellCooldown(), SpellInfo::CategoryRecoveryTime, Object::GetEntry(), GameTime::GetGameTimeMS(), Object::GetGUID(), GetSession(), Item::GetTemplate(), SpellInfo::HasAttribute(), Object::HasFlag(), IN_MILLISECONDS, ITEM_FIELD_FLAGS, ITEM_FLAG_NO_EQUIP_COOLDOWN, ITEM_SPELLTRIGGER_ON_EQUIP, ITEM_SPELLTRIGGER_ON_USE, m_spellCooldowns, MAX_ITEM_PROTO_SPELLS, SpellInfo::RecoveryTime, WorldSession::SendPacket(), SMSG_ITEM_COOLDOWN, SPELL_ATTR0_NOT_IN_COMBAT_ONLY_PEACEFUL, _Spell::SpellCategoryCooldown, _Spell::SpellCooldown, _Spell::SpellId, ItemTemplate::Spells, _Spell::SpellTrigger, and sSpellMgr.

Referenced by EquipItem().

◆ ApplyEquipSpell()

void Player::ApplyEquipSpell ( SpellInfo const *  spellInfo,
Item item,
bool  apply,
bool  form_change = false 
)
7061{
7062 if (apply)
7063 {
7064 if (!sScriptMgr->CanApplyEquipSpell(this, spellInfo, item, apply, form_change))
7065 return;
7066
7067 // Cannot be used in this stance/form
7068 if (spellInfo->CheckShapeshift(GetShapeshiftForm()) != SPELL_CAST_OK)
7069 return;
7070
7071 if (form_change) // check aura active state from other form
7072 {
7073 AuraApplicationMapBounds range = GetAppliedAuras().equal_range(spellInfo->Id);
7074 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
7075 if (!item || itr->second->GetBase()->GetCastItemGUID() == item->GetGUID())
7076 return;
7077 }
7078
7079 LOG_DEBUG("entities.player", "WORLD: cast {} Equip spellId - {}", (item ? "item" : "itemset"), spellInfo->Id);
7080
7081 //Ignore spellInfo->DurationEntry, cast with -1 duration
7082 CastCustomSpell(spellInfo->Id, SPELLVALUE_AURA_DURATION, -1, this, true, item);
7083 }
7084 else
7085 {
7086 if (form_change) // check aura compatibility
7087 {
7088 // Cannot be used in this stance/form
7089 if (spellInfo->CheckShapeshift(GetShapeshiftForm()) == SPELL_CAST_OK)
7090 return; // and remove only not compatible at form change
7091 }
7092
7093 if (item)
7094 RemoveAurasDueToItemSpell(spellInfo->Id, item->GetGUID()); // un-apply all spells, not only at-equipped
7095 else
7096 RemoveAurasDueToSpell(spellInfo->Id); // un-apply spell (item set case)
7097
7098 // Xinef: Remove Proc Spells and Summons
7099 for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
7100 {
7101 // Xinef: Remove procs
7102 if (spellInfo->Effects[i].TriggerSpell)
7103 RemoveAurasDueToSpell(spellInfo->Effects[i].TriggerSpell);
7104
7105 // Xinef: remove minions summoned by item
7106 if (spellInfo->Effects[i].Effect == SPELL_EFFECT_SUMMON)
7107 RemoveAllMinionsByEntry(spellInfo->Effects[i].MiscValue);
7108 }
7109 }
7110}
@ SPELLVALUE_AURA_DURATION
Definition: SpellDefines.h:120
@ EFFECT_0
Definition: SharedDefines.h:31
@ SPELL_EFFECT_SUMMON
Definition: SharedDefines.h:806
@ SPELL_CAST_OK
Definition: SharedDefines.h:1138
ShapeshiftForm GetShapeshiftForm() const
Definition: Unit.h:2085
std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
Definition: Unit.h:1312
AuraApplicationMap & GetAppliedAuras()
Definition: Unit.h:1938
void RemoveAllMinionsByEntry(uint32 entry)
Definition: Unit.cpp:10857

References Unit::CastCustomSpell(), SpellInfo::CheckShapeshift(), EFFECT_0, SpellInfo::Effects, Unit::GetAppliedAuras(), Object::GetGUID(), Unit::GetShapeshiftForm(), SpellInfo::Id, LOG_DEBUG, MAX_SPELL_EFFECTS, Unit::RemoveAllMinionsByEntry(), Unit::RemoveAurasDueToItemSpell(), Unit::RemoveAurasDueToSpell(), SPELL_CAST_OK, SPELL_EFFECT_SUMMON, SPELLVALUE_AURA_DURATION, and sScriptMgr.

Referenced by AddItemsSetItem(), ApplyItemEquipSpell(), RemoveItemsSetItem(), and UpdateEquipSpellsAtFormChange().

◆ ApplyFeralAPBonus()

void Player::ApplyFeralAPBonus ( int32  amount,
bool  apply 
)
325{
326 _ModifyUInt32(apply, m_baseFeralAP, amount);
328}
bool _ModifyUInt32(bool apply, uint32 &baseValue, int32 &amount)
Definition: StatSystem.cpp:28
void UpdateAttackPowerAndDamage(bool ranged=false) override
Definition: StatSystem.cpp:330

References _ModifyUInt32(), m_baseFeralAP, and UpdateAttackPowerAndDamage().

Referenced by _ApplyItemBonuses().

◆ ApplyHealthRegenBonus()

void Player::ApplyHealthRegenBonus ( int32  amount,
bool  apply 
)
927{
928 _ModifyUInt32(apply, m_baseHealthRegen, amount);
929}

References _ModifyUInt32(), and m_baseHealthRegen.

Referenced by _ApplyItemBonuses(), and ApplyEnchantment().

◆ ApplyItemEquipSpell()

void Player::ApplyItemEquipSpell ( Item item,
bool  apply,
bool  form_change = false 
)
7010{
7011 if (!item)
7012 return;
7013
7014 ItemTemplate const* proto = item->GetTemplate();
7015 if (!proto)
7016 return;
7017
7018 for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
7019 {
7020 _Spell const& spellData = proto->Spells[i];
7021
7022 // no spell
7023 if (!spellData.SpellId)
7024 continue;
7025
7026 // Spells that should stay on the caster after removing the item.
7027 constexpr std::array<int32, 2> spellExceptions =
7028 {
7029 11826, //Electromagnetic Gigaflux Reactivator
7030 17490 //Book of the Dead - Summon Skeleton
7031 };
7032 const auto found = std::find(std::begin(spellExceptions), std::end(spellExceptions), spellData.SpellId);
7033
7034 // wrong triggering type
7035 if (apply)
7036 {
7038 {
7039 continue;
7040 }
7041 }
7042 else
7043 {
7044 // If the spell is an exception do not remove it.
7045 if (found != std::end(spellExceptions))
7046 {
7047 continue;
7048 }
7049 }
7050
7051 // check if it is valid spell
7052 SpellInfo const* spellproto = sSpellMgr->GetSpellInfo(spellData.SpellId);
7053 if (!spellproto)
7054 continue;
7055
7056 ApplyEquipSpell(spellproto, item, apply, form_change);
7057 }
7058}
void ApplyEquipSpell(SpellInfo const *spellInfo, Item *item, bool apply, bool form_change=false)
Definition: Player.cpp:7060

References ApplyEquipSpell(), Item::GetTemplate(), ITEM_SPELLTRIGGER_ON_EQUIP, MAX_ITEM_PROTO_SPELLS, _Spell::SpellId, ItemTemplate::Spells, _Spell::SpellTrigger, and sSpellMgr.

Referenced by _ApplyAllItemMods(), _ApplyItemMods(), _RemoveAllItemMods(), and UpdateEquipSpellsAtFormChange().

◆ ApplyManaRegenBonus()

void Player::ApplyManaRegenBonus ( int32  amount,
bool  apply 
)
921{
922 _ModifyUInt32(apply, m_baseManaRegen, amount);
924}
void UpdateManaRegen()
Definition: StatSystem.cpp:931

References _ModifyUInt32(), m_baseManaRegen, and UpdateManaRegen().

Referenced by _ApplyItemBonuses(), and ApplyEnchantment().

◆ ApplyRatingMod()

void Player::ApplyRatingMod ( CombatRating  cr,
int32  value,
bool  apply 
)
5175{
5176 float oldRating = m_baseRatingValue[cr];
5177 m_baseRatingValue[cr] += (apply ? value : -value);
5178 // explicit affected values
5179 if (cr == CR_HASTE_MELEE || cr == CR_HASTE_RANGED || cr == CR_HASTE_SPELL)
5180 {
5181 float const mult = GetRatingMultiplier(cr);
5182 float const oldVal = oldRating * mult;
5183 float const newVal = m_baseRatingValue[cr] * mult;
5184 switch (cr)
5185 {
5186 case CR_HASTE_MELEE:
5187 ApplyAttackTimePercentMod(BASE_ATTACK, oldVal, false);
5188 ApplyAttackTimePercentMod(OFF_ATTACK, oldVal, false);
5191 break;
5192 case CR_HASTE_RANGED:
5195 break;
5196 case CR_HASTE_SPELL:
5197 ApplyCastTimePercentMod(oldVal, false);
5198 ApplyCastTimePercentMod(newVal, true);
5199 break;
5200 default:
5201 break;
5202 }
5203 }
5204
5205 UpdateRating(cr);
5206}
float GetRatingMultiplier(CombatRating cr) const
Definition: Player.cpp:5097
void UpdateRating(CombatRating cr)
Definition: PlayerUpdates.cpp:575
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition: Unit.cpp:17319
void ApplyCastTimePercentMod(float val, bool apply)
Definition: Unit.cpp:17335

References Unit::ApplyAttackTimePercentMod(), Unit::ApplyCastTimePercentMod(), BASE_ATTACK, CR_HASTE_MELEE, CR_HASTE_RANGED, CR_HASTE_SPELL, GetRatingMultiplier(), m_baseRatingValue, OFF_ATTACK, RANGED_ATTACK, and UpdateRating().

Referenced by _ApplyItemBonuses(), ApplyEnchantment(), AuraEffect::HandleModRating(), AuraEffect::HandleModRatingFromStat(), RecalculateRating(), and UpdateStats().

◆ ApplySpellMod()

template<class T >
template AC_GAME_API void Player::ApplySpellMod ( uint32  spellId,
SpellModOp  op,
T &  basevalue,
Spell spell = nullptr,
bool  temporaryPet = false 
)
9649{
9650 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
9651 if (!spellInfo)
9652 {
9653 return;
9654 }
9655
9656 float totalmul = 1.0f;
9657 int32 totalflat = 0;
9658
9659 auto calculateSpellMod = [&](SpellModifier* mod)
9660 {
9661 // xinef: temporary pets cannot use charged mods of owner, needed for mirror image QQ they should use their own auras
9662 if (temporaryPet && mod->charges != 0)
9663 {
9664 return;
9665 }
9666
9667 if (mod->type == SPELLMOD_FLAT)
9668 {
9669 // xinef: do not allow to consume more than one 100% crit increasing spell
9670 if (mod->op == SPELLMOD_CRITICAL_CHANCE && totalflat >= 100)
9671 {
9672 return;
9673 }
9674
9675 int32 flatValue = mod->value;
9676
9677 // SPELL_MOD_THREAT - divide by 100 (in packets we send threat * 100)
9678 if (mod->op == SPELLMOD_THREAT)
9679 {
9680 flatValue /= 100;
9681 }
9682
9683 totalflat += flatValue;
9684 }
9685 else if (mod->type == SPELLMOD_PCT)
9686 {
9687 // skip percent mods for null basevalue (most important for spell mods with charges)
9688 if (basevalue == T(0) || totalmul == 0.0f)
9689 {
9690 return;
9691 }
9692
9693 // special case (skip > 10sec spell casts for instant cast setting)
9694 if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100)
9695 {
9696 return;
9697 }
9698 // xinef: special exception for surge of light, dont affect crit chance if previous mods were not applied
9699 else if (mod->op == SPELLMOD_CRITICAL_CHANCE && spell && !HasSpellMod(mod, spell))
9700 {
9701 return;
9702 }
9703 // xinef: special case for backdraft gcd reduce with backlast time reduction, dont affect gcd if cast time was not applied
9704 else if (mod->op == SPELLMOD_GLOBAL_COOLDOWN && spell && !HasSpellMod(mod, spell))
9705 {
9706 return;
9707 }
9708
9709 // xinef: those two mods should be multiplicative (Glyph of Renew)
9710 if (mod->op == SPELLMOD_DAMAGE || mod->op == SPELLMOD_DOT)
9711 {
9712 totalmul *= CalculatePct(1.0f, 100.0f + mod->value);
9713 }
9714 else
9715 {
9716 totalmul += CalculatePct(1.0f, mod->value);
9717 }
9718 }
9719
9720 DropModCharge(mod, spell);
9721 };
9722
9723 // Drop charges for triggering spells instead of triggered ones
9725 {
9726 spell = m_spellModTakingSpell;
9727 }
9728
9729 SpellModifier* chargedMod = nullptr;
9730 for (auto mod : m_spellMods[op])
9731 {
9732 // Charges can be set only for mods with auras
9733 if (!mod->ownerAura)
9734 {
9735 ASSERT(!mod->charges);
9736 }
9737
9738 if (!IsAffectedBySpellmod(spellInfo, mod, spell))
9739 {
9740 continue;
9741 }
9742
9743 if (mod->ownerAura->IsUsingCharges())
9744 {
9745 if (!chargedMod || (chargedMod->ownerAura->GetSpellInfo()->SpellPriority < mod->ownerAura->GetSpellInfo()->SpellPriority))
9746 {
9747 chargedMod = mod;
9748 }
9749
9750 continue;
9751 }
9752
9753 calculateSpellMod(mod);
9754 }
9755
9756 if (chargedMod)
9757 {
9758 calculateSpellMod(chargedMod);
9759 }
9760
9761 float diff = 0.0f;
9762 if (op == SPELLMOD_CASTING_TIME || op == SPELLMOD_DURATION)
9763 {
9764 diff = ((float)basevalue + totalflat) * (totalmul - 1.0f) + (float)totalflat;
9765 }
9766 else
9767 {
9768 diff = (float)basevalue * (totalmul - 1.0f) + (float)totalflat;
9769 }
9770
9771 basevalue = T((float)basevalue + diff);
9772}
T CalculatePct(T base, U pct)
Definition: Util.h:61
@ SPELLMOD_PCT
Definition: Player.h:95
@ SPELLMOD_DAMAGE
Definition: SpellDefines.h:77
@ SPELLMOD_DOT
Definition: SpellDefines.h:99
@ SPELLMOD_CRITICAL_CHANCE
Definition: SpellDefines.h:84
@ SPELLMOD_GLOBAL_COOLDOWN
Definition: SpellDefines.h:98
@ SPELLMOD_THREAT
Definition: SpellDefines.h:79
@ SPELLMOD_DURATION
Definition: SpellDefines.h:78
@ SPELLMOD_CASTING_TIME
Definition: SpellDefines.h:87
Definition: Player.h:182
void DropModCharge(SpellModifier *mod, Spell *spell)
Definition: Player.cpp:9985
bool HasSpellMod(SpellModifier *mod, Spell *spell)
Definition: Player.cpp:9623
bool IsAffectedBySpellmod(SpellInfo const *spellInfo, SpellModifier *mod, Spell *spell=nullptr)
Definition: Player.cpp:9631
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:100
uint32 SpellPriority
Definition: SpellInfo.h:380

References ASSERT, CalculatePct(), DropModCharge(), Aura::GetSpellInfo(), HasSpellMod(), IsAffectedBySpellmod(), m_spellMods, m_spellModTakingSpell, SpellModifier::ownerAura, SPELLMOD_CASTING_TIME, SPELLMOD_CRITICAL_CHANCE, SPELLMOD_DAMAGE, SPELLMOD_DOT, SPELLMOD_DURATION, SPELLMOD_FLAT, SPELLMOD_GLOBAL_COOLDOWN, SPELLMOD_PCT, SPELLMOD_THREAT, SpellInfo::SpellPriority, and sSpellMgr.

Referenced by AddSpellAndCategoryCooldowns(), Aura::CalcMaxDuration(), AuraEffect::CalculatePeriodic(), CastItemCombatSpell(), Spell::Delayed(), Spell::DelayedChannel(), and Spell::TriggerGlobalCooldown().

◆ ApplySpellPenetrationBonus()

void Player::ApplySpellPenetrationBonus ( int32  amount,
bool  apply 
)
220{
222 m_spellPenetrationItemMod += apply ? amount : -amount;
223}
@ PLAYER_FIELD_MOD_TARGET_RESISTANCE
Definition: UpdateFields.h:366
void ApplyModInt32Value(uint16 index, int32 val, bool apply)
Definition: Object.cpp:815

References Object::ApplyModInt32Value(), m_spellPenetrationItemMod, and PLAYER_FIELD_MOD_TARGET_RESISTANCE.

Referenced by _ApplyItemBonuses(), and ApplyEnchantment().

◆ ApplySpellPowerBonus()

void Player::ApplySpellPowerBonus ( int32  amount,
bool  apply 
)
168{
169 apply = _ModifyUInt32(apply, m_baseSpellPower, amount);
170
171 // For speed just update for client
173 for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
175}
@ PLAYER_FIELD_MOD_HEALING_DONE_POS
Definition: UpdateFields.h:363
@ SPELL_SCHOOL_HOLY
Definition: SharedDefines.h:284

References _ModifyUInt32(), Object::ApplyModInt32Value(), Object::ApplyModUInt32Value(), m_baseSpellPower, MAX_SPELL_SCHOOL, PLAYER_FIELD_MOD_DAMAGE_DONE_POS, PLAYER_FIELD_MOD_HEALING_DONE_POS, and SPELL_SCHOOL_HOLY.

Referenced by _ApplyItemBonuses(), and ApplyEnchantment().

◆ AreaExploredOrEventHappens()

void Player::AreaExploredOrEventHappens ( uint32  questId)
1778{
1779 if (questId)
1780 {
1781 uint16 log_slot = FindQuestSlot(questId);
1782 QuestStatusData* q_status = nullptr;
1783 if (log_slot < MAX_QUEST_LOG_SIZE)
1784 {
1785 q_status = &m_QuestStatus[questId];
1786
1787 // xinef: added failed check
1788 if (!q_status->Explored && q_status->Status != QUEST_STATUS_FAILED)
1789 {
1790 q_status->Explored = true;
1791 m_QuestStatusSave[questId] = true;
1792
1793 SendQuestComplete(questId);
1794 }
1795 }
1796 if (CanCompleteQuest(questId, q_status))
1797 CompleteQuest(questId);
1798 else
1800 }
1801}
@ ADDITIONAL_SAVING_QUEST_STATUS
Definition: Player.h:985
void SendQuestComplete(uint32 quest_id)
Definition: PlayerQuest.cpp:2332
void AdditionalSavingAddMask(uint8 mask)
Definition: Player.h:2537

References ADDITIONAL_SAVING_QUEST_STATUS, AdditionalSavingAddMask(), CanCompleteQuest(), CompleteQuest(), QuestStatusData::Explored, FindQuestSlot(), m_QuestStatus, m_QuestStatusSave, MAX_QUEST_LOG_SIZE, QUEST_STATUS_FAILED, SendQuestComplete(), and QuestStatusData::Status.

Referenced by npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), Spell::EffectQuestComplete(), SmartAI::EndPath(), GroupEventHappens(), WorldSession::HandleAreaTriggerOpcode(), boss_alar::boss_alarAI::JustDied(), go_table_theka::OnGossipHello(), npc_parqual_fintallas::OnGossipSelect(), npc_great_bear_spirit::OnGossipSelect(), npc_thrall_warchief::OnGossipSelect(), npc_braug_dimspirit::OnGossipSelect(), npc_stone_watcher_of_norgannon::OnGossipSelect(), npc_vekjik::OnGossipSelect(), go_ahune_ice_stone::OnGossipSelect(), AreaTrigger_at_celestial_planetarium_enterance::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), npc_doctor::npc_doctorAI::PatientSaved(), npc_shenthul::npc_shenthulAI::ReceiveEmote(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), and npc_commander_dawnforge::npc_commander_dawnforgeAI::UpdateAI().

◆ AutoStoreLoot() [1/2]

void Player::AutoStoreLoot ( uint32  loot_id,
LootStore const &  store,
bool  broadcast = false 
)
inline
1294{ AutoStoreLoot(NULL_BAG, NULL_SLOT, loot_id, store, broadcast); }
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const &store, bool broadcast=false)
Definition: Player.cpp:13405

References AutoStoreLoot(), NULL_BAG, and NULL_SLOT.

Referenced by AutoStoreLoot().

◆ AutoStoreLoot() [2/2]

void Player::AutoStoreLoot ( uint8  bag,
uint8  slot,
uint32  loot_id,
LootStore const &  store,
bool  broadcast = false 
)
13406{
13407 Loot loot;
13408 loot.FillLoot (loot_id, store, this, true);
13409
13410 uint32 max_slot = loot.GetMaxSlotInLootFor(this);
13411 for (uint32 i = 0; i < max_slot; ++i)
13412 {
13413 LootItem* lootItem = loot.LootItemInSlot(i, this);
13414
13415 ItemPosCountVec dest;
13416 InventoryResult msg = CanStoreNewItem(bag, slot, dest, lootItem->itemid, lootItem->count);
13417 if (msg != EQUIP_ERR_OK && slot != NULL_SLOT)
13418 msg = CanStoreNewItem(bag, NULL_SLOT, dest, lootItem->itemid, lootItem->count);
13419 if (msg != EQUIP_ERR_OK && bag != NULL_BAG)
13420 msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, lootItem->itemid, lootItem->count);
13421 if (msg != EQUIP_ERR_OK)
13422 {
13423 SendEquipError(msg, nullptr, nullptr, lootItem->itemid);
13424 continue;
13425 }
13426
13427 Item* pItem = StoreNewItem(dest, lootItem->itemid, true, lootItem->randomPropertyId);
13428 SendNewItem(pItem, lootItem->count, false, false, broadcast);
13429 }
13430}
Definition: LootMgr.h:155
uint32 itemid
Definition: LootMgr.h:156
int32 randomPropertyId
Definition: LootMgr.h:159
uint8 count
Definition: LootMgr.h:163
Definition: LootMgr.h:313
uint32 GetMaxSlotInLootFor(Player *player) const
Definition: LootMgr.cpp:896
LootItem * LootItemInSlot(uint32 lootslot, Player *player, QuestItem **qitem=nullptr, QuestItem **ffaitem=nullptr, QuestItem **conditem=nullptr)
Definition: LootMgr.cpp:831
bool FillLoot(uint32 lootId, LootStore const &store, Player *lootOwner, bool personal, bool noEmptyError=false, uint16 lootMode=LOOT_MODE_DEFAULT, WorldObject *lootSource=nullptr)
Definition: LootMgr.cpp:553

References CanStoreNewItem(), LootItem::count, EQUIP_ERR_OK, Loot::FillLoot(), Loot::GetMaxSlotInLootFor(), LootItem::itemid, Loot::LootItemInSlot(), NULL_BAG, NULL_SLOT, LootItem::randomPropertyId, SendEquipError(), SendNewItem(), and StoreNewItem().

Referenced by Group::CountTheRoll(), Spell::EffectCreateItem2(), Spell::EffectCreateRandomItem(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ AutoUnequipOffhandIfNeed()

void Player::AutoUnequipOffhandIfNeed ( bool  force = false)
12385{
12387 if (!offItem)
12388 {
12390 return;
12391 }
12392
12393 // unequip offhand weapon if player doesn't have dual wield anymore
12395 force = true;
12396
12397 // need unequip offhand for 2h-weapon without TitanGrip (in any from hands)
12398 if (!force && (CanTitanGrip() || (offItem->GetTemplate()->InventoryType != INVTYPE_2HWEAPON && !IsTwoHandUsed())))
12399 {
12401 return;
12402 }
12403
12404 ItemPosCountVec off_dest;
12405 uint8 off_msg = CanStoreItem(NULL_BAG, NULL_SLOT, off_dest, offItem, false);
12406 if (off_msg == EQUIP_ERR_OK)
12407 {
12409 StoreItem(off_dest, offItem, true);
12410 }
12411 else
12412 {
12414 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
12415 offItem->DeleteFromInventoryDB(trans); // deletes item from character's inventory
12416 offItem->SaveToDB(trans); // recursive and not have transaction guard into self, item not in inventory and can be save standalone
12417
12418 std::string subject = GetSession()->GetAcoreString(LANG_NOT_EQUIPPED_ITEM);
12419 MailDraft(subject, "There were problems with equipping one or several items").AddItem(offItem).SendMailTo(trans, this, MailSender(this, MAIL_STATIONERY_GM), MAIL_CHECK_MASK_COPIED);
12420
12421 CharacterDatabase.CommitTransaction(trans);
12422 }
12424}
@ INVTYPE_WEAPON
Definition: ItemTemplate.h:278
@ INVTYPE_WEAPONOFFHAND
Definition: ItemTemplate.h:287
@ INVTYPE_2HWEAPON
Definition: ItemTemplate.h:282
uint32 InventoryType
Definition: ItemTemplate.h:641
bool CanTitanGrip() const
Definition: Player.h:2149
bool IsTwoHandUsed() const
Definition: Player.h:1343
void MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
Definition: PlayerStorage.cpp:3000
void RemoveItem(uint8 bag, uint8 slot, bool update, bool swap=false)
Definition: PlayerStorage.cpp:2921
void UpdateTitansGrip()
Definition: PlayerUpdates.cpp:1798
bool CanDualWield() const
Definition: Unit.h:1357
void SendMailTo(CharacterDatabaseTransaction trans, MailReceiver const &receiver, MailSender const &sender, MailCheckMask checked=MAIL_CHECK_MASK_NONE, uint32 deliver_delay=0, uint32 custom_expiration=0, bool deleteMailItemsFromDB=false, bool sendMail=true)
Definition: Mail.cpp:186
MailDraft & AddItem(Item *item)
Definition: Mail.cpp:94

References MailDraft::AddItem(), Unit::CanDualWield(), CanStoreItem(), CanTitanGrip(), CharacterDatabase, Item::DeleteFromInventoryDB(), EQUIP_ERR_OK, EQUIPMENT_SLOT_OFFHAND, WorldSession::GetAcoreString(), GetItemByPos(), GetSession(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, ItemTemplate::InventoryType, INVTYPE_2HWEAPON, INVTYPE_WEAPON, INVTYPE_WEAPONOFFHAND, IsTwoHandUsed(), LANG_NOT_EQUIPPED_ITEM, MAIL_CHECK_MASK_COPIED, MAIL_STATIONERY_GM, MoveItemFromInventory(), NULL_BAG, NULL_SLOT, RemoveItem(), Item::SaveToDB(), MailDraft::SendMailTo(), StoreItem(), and UpdateTitansGrip().

Referenced by _StoreOrEquipNewItem(), ActivateSpec(), Spell::EffectSummonChangeItem(), FindEquipSlot(), WorldSession::HandleAutoEquipItemOpcode(), resetTalents(), SplitItem(), StoreNewItemInBestSlots(), SwapItem(), and UpdateZone().

◆ BankItem() [1/2]

Item * Player::BankItem ( ItemPosCountVec const &  dest,
Item pItem,
bool  update 
)
inline

◆ BankItem() [2/2]

Item * Player::BankItem ( uint16  pos,
Item pItem,
bool  update 
)

◆ BindToInstance()

void Player::BindToInstance ( )
6530{
6531 InstanceSave* mapSave = sInstanceSaveMgr->GetInstanceSave(_pendingBindId);
6532 if (!mapSave) //it seems sometimes mapSave is nullptr, but I did not check why
6533 return;
6534
6536 data << uint32(0);
6537 GetSession()->SendPacket(&data);
6538 sInstanceSaveMgr->PlayerBindToInstance(this->GetGUID(), mapSave, true, this);
6539}
#define sInstanceSaveMgr
Definition: InstanceSaveMgr.h:202
@ SMSG_INSTANCE_SAVE_CREATED
Definition: Opcodes.h:745
uint32 _pendingBindId
Definition: Player.h:2937
Definition: InstanceSaveMgr.h:56

References _pendingBindId, Object::GetGUID(), GetSession(), WorldSession::SendPacket(), sInstanceSaveMgr, and SMSG_INSTANCE_SAVE_CREATED.

Referenced by WorldSession::HandleInstanceLockResponse(), and Update().

◆ BuildCreateUpdateBlockForPlayer()

void Player::BuildCreateUpdateBlockForPlayer ( UpdateData data,
Player target 
) const
overridevirtual

Reimplemented from Object.

3770{
3771 if (target == this)
3772 {
3773 for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
3774 {
3775 if (!m_items[i])
3776 continue;
3777
3778 m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
3779 }
3780
3782 {
3783 if (!m_items[i])
3784 continue;
3785
3786 m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
3787 }
3789 {
3790 if (!m_items[i])
3791 continue;
3792
3793 m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
3794 }
3795 }
3796
3798}
@ KEYRING_SLOT_START
Definition: Player.h:731
@ BANK_SLOT_BAG_END
Definition: Player.h:719
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
Definition: Object.cpp:189

References BANK_SLOT_BAG_END, Object::BuildCreateUpdateBlockForPlayer(), CURRENCYTOKEN_SLOT_END, EQUIPMENT_SLOT_END, INVENTORY_SLOT_BAG_START, KEYRING_SLOT_START, and m_items.

Referenced by Map::SendInitSelf().

◆ BuildEnchantmentsInfoData()

void Player::BuildEnchantmentsInfoData ( WorldPacket data)
14350{
14351 uint32 slotUsedMask = 0;
14352 size_t slotUsedMaskPos = data->wpos();
14353 *data << uint32(slotUsedMask); // slotUsedMask < 0x80000
14354
14355 for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
14356 {
14358
14359 if (!item)
14360 continue;
14361
14362 slotUsedMask |= (1 << i);
14363
14364 *data << uint32(item->GetEntry()); // item entry
14365
14366 uint16 enchantmentMask = 0;
14367 size_t enchantmentMaskPos = data->wpos();
14368 *data << uint16(enchantmentMask); // enchantmentMask < 0x1000
14369
14370 for (uint32 j = 0; j < MAX_ENCHANTMENT_SLOT; ++j)
14371 {
14372 uint32 enchId = item->GetEnchantmentId(EnchantmentSlot(j));
14373
14374 if (!enchId)
14375 continue;
14376
14377 enchantmentMask |= (1 << j);
14378
14379 *data << uint16(enchId); // enchantmentId?
14380 }
14381
14382 data->put<uint16>(enchantmentMaskPos, enchantmentMask);
14383
14384 *data << int16(item->GetItemRandomPropertyId()); // item random property id
14385 *data << item->GetGuidValue(ITEM_FIELD_CREATOR).WriteAsPacked(); // item creator
14386 *data << uint32(item->GetItemSuffixFactor()); // item suffix factor
14387 }
14388
14389 data->put<uint32>(slotUsedMaskPos, slotUsedMask);
14390}
@ ITEM_FIELD_CREATOR
Definition: UpdateFields.h:37
ObjectGuid GetGuidValue(uint16 index) const
Definition: Object.cpp:337
PackedGuid WriteAsPacked() const
Definition: ObjectGuid.h:318
size_t wpos() const
Definition: ByteBuffer.h:330
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:137

References EQUIPMENT_SLOT_END, Item::GetEnchantmentId(), Object::GetEntry(), Object::GetGuidValue(), GetItemByPos(), Item::GetItemRandomPropertyId(), Item::GetItemSuffixFactor(), INVENTORY_SLOT_BAG_0, ITEM_FIELD_CREATOR, MAX_ENCHANTMENT_SLOT, ByteBuffer::put(), ByteBuffer::wpos(), and ObjectGuid::WriteAsPacked().

Referenced by WorldSession::HandleInspectOpcode().

◆ BuildEnumData()

bool Player::BuildEnumData ( PreparedQueryResult  result,
WorldPacket data 
)
static
1080{
1081 // 0 1 2 3 4 5 6 7
1082 // "SELECT characters.guid, characters.name, characters.race, characters.class, characters.gender, characters.skin, characters.face, characters.hairStyle,
1083 // 8 9 10 11 12 13 14 15
1084 // characters.hairColor, characters.facialStyle, character.level, characters.zone, characters.map, characters.position_x, characters.position_y, characters.position_z,
1085 // 16 17 18 19 20 21 22 23
1086 // guild_member.guildid, characters.playerFlags, characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, characters.equipmentCache, character_banned.guid,
1087 // 24 25
1088 // characters.extra_flags, character_declinedname.genitive
1089
1090 Field* fields = result->Fetch();
1091
1092 ObjectGuid::LowType guidLow = fields[0].Get<uint32>();
1093 uint8 plrRace = fields[2].Get<uint8>();
1094 uint8 plrClass = fields[3].Get<uint8>();
1095 uint8 gender = fields[4].Get<uint8>();
1096
1097 ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>(guidLow);
1098
1099 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(plrRace, plrClass);
1100 if (!info)
1101 {
1102 LOG_ERROR("entities.player", "Player {} has incorrect race/class pair. Don't build enum.", guid.ToString());
1103 return false;
1104 }
1105 else if (!IsValidGender(gender))
1106 {
1107 LOG_ERROR("entities.player", "Player ({}) has incorrect gender ({}), don't build enum.", guid.ToString(), gender);
1108 return false;
1109 }
1110
1111 *data << guid;
1112 *data << fields[1].Get<std::string>(); // name
1113 *data << uint8(plrRace); // race
1114 *data << uint8(plrClass); // class
1115 *data << uint8(gender); // gender
1116
1117 uint8 skin = fields[5].Get<uint8>();
1118 uint8 face = fields[6].Get<uint8>();
1119 uint8 hairStyle = fields[7].Get<uint8>();
1120 uint8 hairColor = fields[8].Get<uint8>();
1121 uint8 facialStyle = fields[9].Get<uint8>();
1122
1123 uint32 charFlags = 0;
1124 uint32 playerFlags = fields[17].Get<uint32>();
1125 uint16 atLoginFlags = fields[18].Get<uint16>();
1126 uint32 zone = (atLoginFlags & AT_LOGIN_FIRST) != 0 ? 0 : fields[11].Get<uint16>(); // if first login do not show the zone
1127
1128 *data << uint8(skin);
1129 *data << uint8(face);
1130 *data << uint8(hairStyle);
1131 *data << uint8(hairColor);
1132 *data << uint8(facialStyle);
1133
1134 *data << uint8(fields[10].Get<uint8>()); // level
1135 *data << uint32(zone); // zone
1136 *data << uint32(fields[12].Get<uint16>()); // map
1137
1138 *data << fields[13].Get<float>(); // x
1139 *data << fields[14].Get<float>(); // y
1140 *data << fields[15].Get<float>(); // z
1141
1142 *data << uint32(fields[16].Get<uint32>()); // guild id
1143
1144 if (atLoginFlags & AT_LOGIN_RESURRECT)
1145 playerFlags &= ~PLAYER_FLAGS_GHOST;
1146 if (playerFlags & PLAYER_FLAGS_HIDE_HELM)
1147 charFlags |= CHARACTER_FLAG_HIDE_HELM;
1148 if (playerFlags & PLAYER_FLAGS_HIDE_CLOAK)
1149 charFlags |= CHARACTER_FLAG_HIDE_CLOAK;
1150 if (playerFlags & PLAYER_FLAGS_GHOST)
1151 charFlags |= CHARACTER_FLAG_GHOST;
1152 if (atLoginFlags & AT_LOGIN_RENAME)
1153 charFlags |= CHARACTER_FLAG_RENAME;
1154 if (fields[23].Get<uint32>())
1156 if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED))
1157 {
1158 if (!fields[25].Get<std::string>().empty())
1159 charFlags |= CHARACTER_FLAG_DECLINED;
1160 }
1161 else
1162 charFlags |= CHARACTER_FLAG_DECLINED;
1163
1164 *data << uint32(charFlags); // character flags
1165
1166 // character customize flags
1167 if (atLoginFlags & AT_LOGIN_CUSTOMIZE)
1169 else if (atLoginFlags & AT_LOGIN_CHANGE_FACTION)
1171 else if (atLoginFlags & AT_LOGIN_CHANGE_RACE)
1173 else
1175
1176 // First login
1177 *data << uint8(atLoginFlags & AT_LOGIN_FIRST ? 1 : 0);
1178
1179 // Pets info
1180 uint32 petDisplayId = 0;
1181 uint32 petLevel = 0;
1182 uint32 petFamily = 0;
1183
1184 // show pet at selection character in character list only for non-ghost character
1185 if (result && !(playerFlags & PLAYER_FLAGS_GHOST) && (plrClass == CLASS_WARLOCK || plrClass == CLASS_HUNTER || (plrClass == CLASS_DEATH_KNIGHT && (fields[21].Get<uint32>()&PLAYER_EXTRA_SHOW_DK_PET))))
1186 {
1187 uint32 entry = fields[19].Get<uint32>();
1188 CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(entry);
1189 if (creatureInfo)
1190 {
1191 petDisplayId = fields[20].Get<uint32>();
1192 petLevel = fields[21].Get<uint16>();
1193 petFamily = creatureInfo->family;
1194 }
1195 }
1196
1197 *data << uint32(petDisplayId);
1198 *data << uint32(petLevel);
1199 *data << uint32(petFamily);
1200
1201 std::vector<std::string_view> equipment = Acore::Tokenize(fields[22].Get<std::string_view>(), ' ', false);
1202 for (uint8 slot = 0; slot < INVENTORY_SLOT_BAG_END; ++slot)
1203 {
1204 uint32 const visualBase = slot * 2;
1205 Optional<uint32> itemId;
1206
1207 if (visualBase < equipment.size())
1208 {
1209 itemId = Acore::StringTo<uint32>(equipment[visualBase]);
1210 }
1211
1212 ItemTemplate const* proto = nullptr;
1213 if (itemId)
1214 {
1215 proto = sObjectMgr->GetItemTemplate(*itemId);
1216 }
1217
1218 if (!proto)
1219 {
1220 if (!itemId || *itemId)
1221 {
1222 LOG_WARN("entities.player.loading", "Player {} has invalid equipment '{}' in `equipmentcache` at index {}. Skipped.",
1223 guid.ToString(), (visualBase < equipment.size()) ? equipment[visualBase] : "<none>", visualBase);
1224 }
1225
1226 *data << uint32(0);
1227 *data << uint8(0);
1228 *data << uint32(0);
1229
1230 continue;
1231 }
1232
1233 SpellItemEnchantmentEntry const* enchant = nullptr;
1234
1235 Optional<uint32> enchants = {};
1236 if ((visualBase + 1) < equipment.size())
1237 {
1238 enchants = Acore::StringTo<uint32>(equipment[visualBase + 1]);
1239 }
1240
1241 if (!enchants)
1242 {
1243 LOG_WARN("entities.player.loading", "Player {} has invalid enchantment info '{}' in `equipmentcache` at index {}. Skipped.",
1244 guid.ToString(), ((visualBase + 1) < equipment.size()) ? equipment[visualBase + 1] : "<none>", visualBase + 1);
1245
1246 enchants = 0;
1247 }
1248
1249 for (uint8 enchantSlot = PERM_ENCHANTMENT_SLOT; enchantSlot <= TEMP_ENCHANTMENT_SLOT; ++enchantSlot)
1250 {
1251 // values stored in 2 uint16
1252 uint32 enchantId = 0x0000FFFF & ((*enchants) >> enchantSlot * 16);
1253 if (!enchantId)
1254 {
1255 continue;
1256 }
1257
1258 enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId);
1259 if (enchant)
1260 {
1261 break;
1262 }
1263 }
1264
1265 *data << uint32(proto->DisplayInfoID);
1266 *data << uint8(proto->InventoryType);
1267 *data << uint32(enchant ? enchant->aura_id : 0);
1268 }
1269
1270 return true;
1271}
@ CHAR_CUSTOMIZE_FLAG_RACE
Definition: Player.cpp:139
@ CHAR_CUSTOMIZE_FLAG_NONE
Definition: Player.cpp:136
@ CHAR_CUSTOMIZE_FLAG_FACTION
Definition: Player.cpp:138
@ CHAR_CUSTOMIZE_FLAG_CUSTOMIZE
Definition: Player.cpp:137
@ CHARACTER_FLAG_GHOST
Definition: Player.cpp:113
@ CHARACTER_FLAG_DECLINED
Definition: Player.cpp:125
@ CHARACTER_FLAG_HIDE_HELM
Definition: Player.cpp:110
@ CHARACTER_FLAG_HIDE_CLOAK
Definition: Player.cpp:111
@ CHARACTER_FLAG_LOCKED_BY_BILLING
Definition: Player.cpp:124
@ CHARACTER_FLAG_RENAME
Definition: Player.cpp:114
@ PLAYER_EXTRA_SHOW_DK_PET
Definition: Player.h:594
@ PLAYER_FLAGS_HIDE_CLOAK
Definition: Player.h:486
@ PLAYER_FLAGS_GHOST
Definition: Player.h:479
@ PLAYER_FLAGS_HIDE_HELM
Definition: Player.h:485
@ AT_LOGIN_FIRST
Definition: Player.h:606
@ AT_LOGIN_RESURRECT
Definition: Player.h:612
@ AT_LOGIN_CUSTOMIZE
Definition: Player.h:604
@ AT_LOGIN_RENAME
Definition: Player.h:601
@ AT_LOGIN_CHANGE_RACE
Definition: Player.h:608
@ AT_LOGIN_CHANGE_FACTION
Definition: Player.h:607
@ CONFIG_DECLINED_NAMES_USED
Definition: IWorld.h:113
@ CLASS_HUNTER
Definition: SharedDefines.h:143
@ CLASS_WARLOCK
Definition: SharedDefines.h:149
Definition: CreatureData.h:176
uint32 DisplayInfoID
Definition: ItemTemplate.h:634
static bool IsValidGender(uint8 Gender)
Definition: Player.h:1548
uint32 aura_id
Definition: DBCStructure.h:1851

References AT_LOGIN_CHANGE_FACTION, AT_LOGIN_CHANGE_RACE, AT_LOGIN_CUSTOMIZE, AT_LOGIN_FIRST, AT_LOGIN_RENAME, AT_LOGIN_RESURRECT, SpellItemEnchantmentEntry::aura_id, CHAR_CUSTOMIZE_FLAG_CUSTOMIZE, CHAR_CUSTOMIZE_FLAG_FACTION, CHAR_CUSTOMIZE_FLAG_NONE, CHAR_CUSTOMIZE_FLAG_RACE, CHARACTER_FLAG_DECLINED, CHARACTER_FLAG_GHOST, CHARACTER_FLAG_HIDE_CLOAK, CHARACTER_FLAG_HIDE_HELM, CHARACTER_FLAG_LOCKED_BY_BILLING, CHARACTER_FLAG_RENAME, CLASS_DEATH_KNIGHT, CLASS_HUNTER, CLASS_WARLOCK, CONFIG_DECLINED_NAMES_USED, ItemTemplate::DisplayInfoID, Field::Get(), INVENTORY_SLOT_BAG_END, ItemTemplate::InventoryType, IsValidGender(), LOG_ERROR, LOG_WARN, PERM_ENCHANTMENT_SLOT, PLAYER_EXTRA_SHOW_DK_PET, PLAYER_FLAGS_GHOST, PLAYER_FLAGS_HIDE_CLOAK, PLAYER_FLAGS_HIDE_HELM, sObjectMgr, sSpellItemEnchantmentStore, sWorld, TEMP_ENCHANTMENT_SLOT, and Acore::Tokenize().

Referenced by WorldSession::HandleCharEnum().

◆ BuildPetTalentsInfoData()

void Player::BuildPetTalentsInfoData ( WorldPacket data)
14267{
14268 uint32 unspentTalentPoints = 0;
14269 size_t pointsPos = data->wpos();
14270 *data << uint32(unspentTalentPoints); // [PH], unspentTalentPoints
14271
14272 uint8 talentIdCount = 0;
14273 size_t countPos = data->wpos();
14274 *data << uint8(talentIdCount); // [PH], talentIdCount
14275
14276 Pet* pet = GetPet();
14277 if (!pet)
14278 return;
14279
14280 unspentTalentPoints = pet->GetFreeTalentPoints();
14281
14282 data->put<uint32>(pointsPos, unspentTalentPoints); // put real points
14283
14284 CreatureTemplate const* ci = pet->GetCreatureTemplate();
14285 if (!ci)
14286 return;
14287
14288 CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->family);
14289 if (!pet_family || pet_family->petTalentType < 0)
14290 return;
14291
14292 for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId)
14293 {
14294 TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentTabId);
14295 if (!talentTabInfo)
14296 continue;
14297
14298 if (!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask))
14299 continue;
14300
14301 for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
14302 {
14303 TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
14304 if (!talentInfo)
14305 continue;
14306
14307 // skip another tab talents
14308 if (talentInfo->TalentTab != talentTabId)
14309 continue;
14310
14311 // find max talent rank (0~4)
14312 int8 curtalent_maxrank = -1;
14313 for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank)
14314 {
14315 if (talentInfo->RankID[rank] && pet->HasSpell(talentInfo->RankID[rank]))
14316 {
14317 curtalent_maxrank = rank;
14318 break;
14319 }
14320 }
14321
14322 // not learned talent
14323 if (curtalent_maxrank < 0)
14324 continue;
14325
14326 *data << uint32(talentInfo->TalentID); // Talent.dbc
14327 *data << uint8(curtalent_maxrank); // talentMaxRank (0-4)
14328
14329 ++talentIdCount;
14330 }
14331
14332 data->put<uint8>(countPos, talentIdCount); // put real count
14333
14334 break;
14335 }
14336}
std::int8_t int8
Definition: Define.h:106
DBCStorage< TalentTabEntry > sTalentTabStore(TalentTabEntryfmt)
DBCStorage< CreatureFamilyEntry > sCreatureFamilyStore(CreatureFamilyfmt)
#define MAX_TALENT_RANK
Definition: DBCStructure.h:1919
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:199
uint8 GetFreeTalentPoints()
Definition: Pet.h:130
bool HasSpell(uint32 spell) const override
Definition: Pet.cpp:2334
Definition: DBCStructure.h:754
int32 petTalentType
Definition: DBCStructure.h:762
uint32 TalentTab
Definition: DBCStructure.h:1926
Definition: DBCStructure.h:1941
uint32 petTalentMask
Definition: DBCStructure.h:1948

References Creature::GetCreatureTemplate(), Pet::GetFreeTalentPoints(), GetPet(), Pet::HasSpell(), MAX_TALENT_RANK, TalentTabEntry::petTalentMask, CreatureFamilyEntry::petTalentType, ByteBuffer::put(), TalentEntry::RankID, sCreatureFamilyStore, sTalentStore, sTalentTabStore, TalentEntry::TalentID, TalentEntry::TalentTab, and ByteBuffer::wpos().

Referenced by SendTalentsInfoData().

◆ BuildPlayerRepop()

void Player::BuildPlayerRepop ( )
4340{
4342 data << GetPackGUID();
4343 GetSession()->SendPacket(&data);
4344 if (getRace(true) == RACE_NIGHTELF)
4345 {
4346 CastSpell(this, 20584, true);
4347 }
4348 CastSpell(this, 8326, true);
4349
4350 // there must be SMSG.FORCE_RUN_SPEED_CHANGE, SMSG.FORCE_SWIM_SPEED_CHANGE, SMSG.MOVE_WATER_WALK
4351 // there must be SMSG.STOP_MIRROR_TIMER
4352
4353 // the player cannot have a corpse already on current map, only bones which are not returned by GetCorpse
4354 WorldLocation corpseLocation = GetCorpseLocation();
4355 if (GetCorpse() && corpseLocation.GetMapId() == GetMapId())
4356 {
4357 LOG_ERROR("entities.player", "BuildPlayerRepop: player {} ({}) already has a corpse", GetName(), GetGUID().ToString());
4358 return;
4359 }
4360
4361 // create a corpse and place it at the player's location
4362 Corpse* corpse = CreateCorpse();
4363 if (!corpse)
4364 {
4365 LOG_ERROR("entities.player", "Error creating corpse for Player {} [{}]", GetName(), GetGUID().ToString());
4366 return;
4367 }
4368 GetMap()->AddToMap(corpse);
4369 SetHealth(1); // convert player body to ghost
4371 SetWaterWalking(true);
4372 if (!GetSession()->isLogingOut())
4373 {
4375 }
4376 RemoveUnitFlag(UNIT_FLAG_SKINNABLE); // BG - remove insignia related
4377 int32 corpseReclaimDelay = CalculateCorpseReclaimDelay();
4378 if (corpseReclaimDelay >= 0)
4379 {
4380 SendCorpseReclaimDelay(corpseReclaimDelay);
4381 }
4382 corpse->ResetGhostTime(); // to prevent cheating
4383 StopMirrorTimers(); // disable timers on bars
4385 sScriptMgr->OnPlayerReleasedGhost(this);
4386}
@ UNIT_FIELD_BYTES_1
Definition: UpdateFields.h:131
@ MOVE_UNROOT
Definition: Player.h:458
@ MOVE_WATER_WALK
Definition: Player.h:459
@ UNIT_BYTE1_FLAG_ALWAYS_STAND
Definition: Unit.h:80
@ UNIT_BYTES_1_OFFSET_ANIM_TIER
Definition: Unit.h:47
@ UNIT_FLAG_SKINNABLE
Definition: Unit.h:474
@ RACE_NIGHTELF
Definition: SharedDefines.h:74
@ SMSG_PRE_RESURRECT
Definition: Opcodes.h:1202
Definition: Corpse.h:49
void ResetGhostTime()
Definition: Corpse.cpp:196
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:750
PackedGuid const & GetPackGUID() const
Definition: Object.h:108
Map * GetMap() const
Definition: Object.h:517
void SendCorpseReclaimDelay(uint32 delay)
Definition: Player.cpp:12893
void StopMirrorTimers()
Definition: Player.h:2019
WorldLocation GetCorpseLocation() const
Definition: Player.h:2003
Corpse * GetCorpse() const
Definition: Player.cpp:4620
bool SetWaterWalking(bool apply, bool packetOnly=false) override
Definition: Player.cpp:15881
int32 CalculateCorpseReclaimDelay(bool load=false)
Definition: Player.cpp:12852
Corpse * CreateCorpse()
Definition: Player.cpp:4505
void SetMovement(PlayerMovementType pType)
Definition: Player.cpp:4309
void SetHealth(uint32 val)
Definition: Unit.cpp:15464
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:1496
bool AddToMap(T *, bool checkTransport=false)
Definition: Map.cpp:555

References Map::AddToMap(), CalculateCorpseReclaimDelay(), Unit::CastSpell(), CreateCorpse(), GetCorpse(), GetCorpseLocation(), Object::GetGUID(), WorldObject::GetMap(), WorldLocation::GetMapId(), WorldObject::GetName(), Object::GetPackGUID(), Unit::getRace(), GetSession(), LOG_ERROR, MOVE_UNROOT, MOVE_WATER_WALK, RACE_NIGHTELF, Unit::RemoveUnitFlag(), Corpse::ResetGhostTime(), SendCorpseReclaimDelay(), WorldSession::SendPacket(), Object::SetByteValue(), Unit::SetHealth(), SetMovement(), SetWaterWalking(), SMSG_PRE_RESURRECT, sScriptMgr, StopMirrorTimers(), Position::ToString(), UNIT_BYTE1_FLAG_ALWAYS_STAND, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_FIELD_BYTES_1, and UNIT_FLAG_SKINNABLE.

Referenced by Spell::EffectStuck(), WorldSession::HandleHearthAndResurrect(), WorldSession::HandleRepopRequestOpcode(), WorldSession::LogoutPlayer(), RemovedInsignia(), and Update().

◆ BuildPlayerTalentsInfoData()

void Player::BuildPlayerTalentsInfoData ( WorldPacket data)
14233{
14234 *data << uint32(GetFreeTalentPoints()); // unspentTalentPoints
14235 *data << uint8(m_specsCount); // talent group count (0, 1 or 2)
14236 *data << uint8(m_activeSpec); // talent group index (0 or 1)
14237
14240
14241 for (uint32 specIdx = 0; specIdx < m_specsCount; ++specIdx)
14242 {
14243 uint8 talentIdCount = 0;
14244 size_t pos = data->wpos();
14245 *data << uint8(talentIdCount); // [PH], talentIdCount
14246
14247 const PlayerTalentMap& talentMap = GetTalentMap();
14248 for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr)
14249 if (TalentSpellPos const* talentPos = GetTalentSpellPos(itr->first))
14250 if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(specIdx)) // pussywizard
14251 {
14252 *data << uint32(talentPos->talent_id); // Talent.dbc
14253 *data << uint8(talentPos->rank); // talentMaxRank (0-4)
14254 ++talentIdCount;
14255 }
14256
14257 data->put<uint8>(pos, talentIdCount); // put real count
14258
14259 *data << uint8(MAX_GLYPH_SLOT_INDEX); // glyphs count
14260
14261 for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
14262 *data << uint16(m_Glyphs[specIdx][i]); // GlyphProperties.dbc
14263 }
14264}
std::unordered_map< uint32, PlayerTalent * > PlayerTalentMap
Definition: Player.h:193
uint32 GetFreeTalentPoints() const
Definition: Player.h:1685
const PlayerTalentMap & GetTalentMap() const
Definition: Player.h:2573

References GetFreeTalentPoints(), GetTalentMap(), GetTalentSpellPos(), m_activeSpec, m_Glyphs, m_specsCount, MAX_GLYPH_SLOT_INDEX, MAX_TALENT_SPECS, PLAYERSPELL_REMOVED, ByteBuffer::put(), and ByteBuffer::wpos().

Referenced by WorldSession::HandleInspectOpcode(), and SendTalentsInfoData().

◆ BuyItemFromVendorSlot()

bool Player::BuyItemFromVendorSlot ( ObjectGuid  vendorguid,
uint32  vendorslot,
uint32  item,
uint8  count,
uint8  bag,
uint8  slot 
)
10628{
10629 sScriptMgr->OnBeforeBuyItemFromVendor(this, vendorguid, vendorslot, item, count, bag, slot);
10630
10631 // this check can be used from the hook to implement a custom vendor process
10632 if (item == 0)
10633 return true;
10634
10635 // cheating attempt
10636 if (count < 1) count = 1;
10637
10638 // cheating attempt
10639 if (slot > MAX_BAG_SIZE && slot != NULL_SLOT)
10640 return false;
10641
10642 if (!IsAlive())
10643 return false;
10644
10645 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
10646 if (!pProto)
10647 {
10648 SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, item, 0);
10649 return false;
10650 }
10651
10652 if (!(pProto->AllowableClass & getClassMask()) && pProto->Bonding == BIND_WHEN_PICKED_UP && !IsGameMaster())
10653 {
10654 SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, item, 0);
10655 return false;
10656 }
10657
10659 {
10660 return false;
10661 }
10662
10663 Creature* creature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
10664 if (!creature)
10665 {
10666 LOG_DEBUG("network", "WORLD: BuyItemFromVendor - Unit ({}) not found or you can't interact with him.", vendorguid.ToString());
10667 SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, nullptr, item, 0);
10668 return false;
10669 }
10670
10671 ConditionList conditions = sConditionMgr->GetConditionsForNpcVendorEvent(creature->GetEntry(), item);
10672 if (!sConditionMgr->IsObjectMeetToConditions(this, creature, conditions))
10673 {
10674 //LOG_DEBUG("condition", "BuyItemFromVendor: conditions not met for creature entry {} item {}", creature->GetEntry(), item);
10675 SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
10676 return false;
10677 }
10678
10679 VendorItemData const* vItems = GetSession()->GetCurrentVendor() ? sObjectMgr->GetNpcVendorItemList(GetSession()->GetCurrentVendor()) : creature->GetVendorItems();
10680 if (!vItems || vItems->Empty())
10681 {
10682 SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
10683 return false;
10684 }
10685
10686 if (vendorslot >= vItems->GetItemCount())
10687 {
10688 SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
10689 return false;
10690 }
10691
10692 VendorItem const* crItem = vItems->GetItem(vendorslot);
10693 // store diff item (cheating)
10694 if (!crItem || crItem->item != item)
10695 {
10696 SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
10697 return false;
10698 }
10699
10700 // check current item amount if it limited
10701 if (crItem->maxcount != 0)
10702 {
10703 if (creature->GetVendorItemCurrentCount(crItem) < pProto->BuyCount * count)
10704 {
10705 SendBuyError(BUY_ERR_ITEM_ALREADY_SOLD, creature, item, 0);
10706 return false;
10707 }
10708 }
10709
10711 {
10712 SendBuyError(BUY_ERR_REPUTATION_REQUIRE, creature, item, 0);
10713 return false;
10714 }
10715
10716 if (crItem->ExtendedCost)
10717 {
10718 ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost);
10719 if (!iece)
10720 {
10721 LOG_ERROR("entities.player", "Item {} have wrong ExtendedCost field value {}", pProto->ItemId, crItem->ExtendedCost);
10722 return false;
10723 }
10724
10725 // honor points price
10726 if (GetHonorPoints() < (iece->reqhonorpoints * count))
10727 {
10729 return false;
10730 }
10731
10732 // arena points price
10733 if (GetArenaPoints() < (iece->reqarenapoints * count))
10734 {
10736 return false;
10737 }
10738
10739 // item base price
10740 for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i)
10741 {
10742 if (iece->reqitem[i] && !HasItemCount(iece->reqitem[i], (iece->reqitemcount[i] * count)))
10743 {
10745 return false;
10746 }
10747 }
10748
10749 // check for personal arena rating requirement
10751 {
10752 // probably not the proper equip err
10753 SendEquipError(EQUIP_ERR_CANT_EQUIP_RANK, nullptr, nullptr);
10754 return false;
10755 }
10756 }
10757
10758 uint32 price = 0;
10759 if (crItem->IsGoldRequired(pProto) && pProto->BuyPrice > 0) //Assume price cannot be negative (do not know why it is int32)
10760 {
10761 uint32 maxCount = MAX_MONEY_AMOUNT / pProto->BuyPrice;
10762 if ((uint32)count > maxCount)
10763 {
10764 LOG_ERROR("entities.player", "Player {} tried to buy {} item id {}, causing overflow", GetName(), (uint32)count, pProto->ItemId);
10765 count = (uint8)maxCount;
10766 }
10767 price = pProto->BuyPrice * count; //it should not exceed MAX_MONEY_AMOUNT
10768
10769 // reputation discount
10770 price = uint32(floor(price * GetReputationPriceDiscount(creature)));
10771
10772 if (!HasEnoughMoney(price))
10773 {
10774 SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, item, 0);
10775 return false;
10776 }
10777 }
10778
10779 if ((bag == NULL_BAG && slot == NULL_SLOT) || IsInventoryPos(bag, slot))
10780 {
10781 if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, creature, crItem, true))
10782 return false;
10783 }
10784 else if (IsEquipmentPos(bag, slot))
10785 {
10786 if (pProto->BuyCount * count != 1)
10787 {
10789 return false;
10790 }
10791 if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, creature, crItem, false))
10792 return false;
10793 }
10794 else
10795 {
10797 return false;
10798 }
10799
10800 return crItem->maxcount != 0;
10801}
#define sConditionMgr
Definition: ConditionMgr.h:289
std::list< Condition * > ConditionList
Definition: ConditionMgr.h:236
#define MAX_BAG_SIZE
Definition: Bag.h:22
@ EQUIP_ERR_CANT_EQUIP_RANK
Definition: Item.h:104
@ EQUIP_ERR_ITEM_CANT_BE_EQUIPPED
Definition: Item.h:61
@ EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS
Definition: Item.h:110
@ EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT
Definition: Item.h:44
@ EQUIP_ERR_VENDOR_MISSING_TURNINS
Definition: Item.h:109
@ EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS
Definition: Item.h:111
@ BUY_ERR_CANT_FIND_ITEM
Definition: Item.h:135
@ BUY_ERR_DISTANCE_TOO_FAR
Definition: Item.h:139
@ BUY_ERR_NOT_ENOUGHT_MONEY
Definition: Item.h:137
@ BUY_ERR_REPUTATION_REQUIRE
Definition: Item.h:143
@ BUY_ERR_ITEM_ALREADY_SOLD
Definition: Item.h:136
@ ITEM_FLAGS_EXTRA_ALLIANCE_ONLY
Definition: ItemTemplate.h:221
@ ITEM_FLAGS_EXTRA_HORDE_ONLY
Definition: ItemTemplate.h:220
#define MAX_MONEY_AMOUNT
Definition: Player.h:922
@ UNIT_NPC_FLAG_VENDOR
Definition: Unit.h:523
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
Definition: Creature.h:46
VendorItemData const * GetVendorItems() const
Definition: Creature.cpp:2973
uint32 GetVendorItemCurrentCount(VendorItem const *vItem)
Definition: Creature.cpp:2978
Definition: CreatureData.h:443
uint32 ExtendedCost
Definition: CreatureData.h:450
bool IsGoldRequired(ItemTemplate const *pProto) const
Definition: CreatureData.h:453
uint32 item
Definition: CreatureData.h:447
uint32 maxcount
Definition: CreatureData.h:448
Definition: CreatureData.h:458
VendorItem * GetItem(uint32 slot) const
Definition: CreatureData.h:461
bool Empty() const
Definition: CreatureData.h:468
uint8 GetItemCount() const
Definition: CreatureData.h:469
uint32 BuyCount
Definition: ItemTemplate.h:638
uint32 AllowableClass
Definition: ItemTemplate.h:642
int32 BuyPrice
Definition: ItemTemplate.h:639
uint32 RequiredReputationRank
Definition: ItemTemplate.h:652
uint32 RequiredReputationFaction
Definition: ItemTemplate.h:651
uint32 Flags2
Definition: ItemTemplate.h:637
uint32 ItemId
Definition: ItemTemplate.h:629
bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const *pProto, Creature *pVendor, VendorItem const *crItem, bool bStore)
Definition: Player.cpp:10561
bool HasItemCount(uint32 item, uint32 count=1, bool inBankAlso=false) const
Definition: PlayerStorage.cpp:683
bool HasEnoughMoney(uint32 amount) const
Definition: Player.h:1582
Creature * GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
Definition: Player.cpp:2063
bool IsGameMaster() const
Definition: Player.h:1148
ReputationRank GetReputationRank(uint32 faction_id) const
Definition: Player.cpp:5777
void SendBuyError(BuyResult msg, Creature *creature, uint32 item, uint32 param)
Definition: PlayerStorage.cpp:4086
uint32 GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot) const
If trans is specified, arena point save query will be added to trans.
Definition: Player.cpp:10803
uint32 GetCurrentVendor() const
Definition: WorldSession.h:368
uint32 reqarenaslot
Definition: DBCStructure.h:1180
uint32 reqpersonalarenarating
Definition: DBCStructure.h:1183

References _StoreOrEquipNewItem(), ItemTemplate::AllowableClass, BIND_WHEN_PICKED_UP, ItemTemplate::Bonding, BUY_ERR_CANT_FIND_ITEM, BUY_ERR_DISTANCE_TOO_FAR, BUY_ERR_ITEM_ALREADY_SOLD, BUY_ERR_NOT_ENOUGHT_MONEY, BUY_ERR_REPUTATION_REQUIRE, ItemTemplate::BuyCount, ItemTemplate::BuyPrice, VendorItemData::Empty(), EQUIP_ERR_CANT_EQUIP_RANK, EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS, EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS, EQUIP_ERR_VENDOR_MISSING_TURNINS, VendorItem::ExtendedCost, ItemTemplate::Flags2, GetArenaPoints(), Unit::getClassMask(), WorldSession::GetCurrentVendor(), Object::GetEntry(), GetHonorPoints(), VendorItemData::GetItem(), VendorItemData::GetItemCount(), GetMaxPersonalArenaRatingRequirement(), WorldObject::GetName(), GetNPCIfCanInteractWith(), GetReputationPriceDiscount(), GetReputationRank(), GetSession(), GetTeamId(), Creature::GetVendorItemCurrentCount(), Creature::GetVendorItems(), HasEnoughMoney(), HasItemCount(), Unit::IsAlive(), IsEquipmentPos(), IsGameMaster(), VendorItem::IsGoldRequired(), IsInventoryPos(), VendorItem::item, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY, ITEM_FLAGS_EXTRA_HORDE_ONLY, ItemTemplate::ItemId, LOG_DEBUG, LOG_ERROR, MAX_BAG_SIZE, MAX_ITEM_EXTENDED_COST_REQUIREMENTS, MAX_MONEY_AMOUNT, VendorItem::maxcount, NULL_BAG, NULL_SLOT, ItemExtendedCostEntry::reqarenapoints, ItemExtendedCostEntry::reqarenaslot, ItemExtendedCostEntry::reqhonorpoints, ItemExtendedCostEntry::reqitem, ItemExtendedCostEntry::reqitemcount, ItemExtendedCostEntry::reqpersonalarenarating, ItemTemplate::RequiredReputationFaction, ItemTemplate::RequiredReputationRank, sConditionMgr, SendBuyError(), SendEquipError(), sItemExtendedCostStore, sObjectMgr, sScriptMgr, TEAM_ALLIANCE, TEAM_HORDE, ObjectGuid::ToString(), and UNIT_NPC_FLAG_VENDOR.

Referenced by WorldSession::HandleBuyItemInSlotOpcode(), and WorldSession::HandleBuyItemOpcode().

◆ CalcRage()

void Player::CalcRage ( uint32  damage,
bool  attacker 
)

◆ CalculateCorpseReclaimDelay()

int32 Player::CalculateCorpseReclaimDelay ( bool  load = false)
12853{
12854 Corpse* corpse = GetCorpse();
12855
12856 if (load && !corpse)
12857 return -1;
12858
12859 bool pvp = corpse ? corpse->GetType() == CORPSE_RESURRECTABLE_PVP : m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH;
12860
12861 uint32 delay;
12862
12863 if (load)
12864 {
12865 if (corpse->GetGhostTime() > m_deathExpireTime)
12866 return -1;
12867
12868 uint64 count = 0;
12869
12870 if ((pvp && sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) ||
12871 (!pvp && sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE)))
12872 {
12873 count = (m_deathExpireTime - corpse->GetGhostTime()) / DEATH_EXPIRE_STEP;
12874
12875 if (count >= MAX_DEATH_COUNT)
12876 count = MAX_DEATH_COUNT - 1;
12877 }
12878
12879 time_t expected_time = corpse->GetGhostTime() + copseReclaimDelay[count];
12880 time_t now = GameTime::GetGameTime().count();
12881
12882 if (now >= expected_time)
12883 return -1;
12884
12885 delay = expected_time - now;
12886 }
12887 else
12888 delay = GetCorpseReclaimDelay(pvp);
12889
12890 return delay * IN_MILLISECONDS;
12891}
@ CORPSE_RESURRECTABLE_PVP
Definition: Corpse.h:30
static uint32 copseReclaimDelay[MAX_DEATH_COUNT]
Definition: Player.cpp:142
@ PLAYER_EXTRA_PVP_DEATH
Definition: Player.h:593
#define DEATH_EXPIRE_STEP
Definition: Player.h:76
#define MAX_DEATH_COUNT
Definition: Player.h:77
@ CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP
Definition: IWorld.h:108
@ CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE
Definition: IWorld.h:109
time_t const & GetGhostTime() const
Definition: Corpse.h:70
CorpseType GetType() const
Definition: Corpse.h:72
uint32 GetCorpseReclaimDelay(bool pvp) const
Definition: Player.cpp:12835

References CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP, copseReclaimDelay, CORPSE_RESURRECTABLE_PVP, DEATH_EXPIRE_STEP, GetCorpse(), GetCorpseReclaimDelay(), GameTime::GetGameTime(), Corpse::GetGhostTime(), Corpse::GetType(), IN_MILLISECONDS, m_deathExpireTime, m_ExtraFlags, MAX_DEATH_COUNT, PLAYER_EXTRA_PVP_DEATH, and sWorld.

Referenced by BuildPlayerRepop(), and KillPlayer().

◆ CalculateMinMaxDamage()

void Player::CalculateMinMaxDamage ( WeaponAttackType  attType,
bool  normalized,
bool  addTotalPct,
float &  minDamage,
float &  maxDamage,
uint8  damageIndex 
)
overridevirtual

Implements Unit.

535{
536 // Only proto damage, not affected by any mods
537 if (damageIndex != 0)
538 {
539 minDamage = 0.0f;
540 maxDamage = 0.0f;
541
542 if (!IsInFeralForm() && CanUseAttackType(attType))
543 {
544 minDamage = GetWeaponDamageRange(attType, MINDAMAGE, damageIndex);
545 maxDamage = GetWeaponDamageRange(attType, MAXDAMAGE, damageIndex);
546 }
547
548 return;
549 }
550
551 UnitMods unitMod;
552
553 switch (attType)
554 {
555 case BASE_ATTACK:
556 default:
557 unitMod = UNIT_MOD_DAMAGE_MAINHAND;
558 break;
559 case OFF_ATTACK:
560 unitMod = UNIT_MOD_DAMAGE_OFFHAND;
561 break;
562 case RANGED_ATTACK:
563 unitMod = UNIT_MOD_DAMAGE_RANGED;
564 break;
565 }
566
567 float attackSpeedMod = GetAPMultiplier(attType, normalized);
568
569 float baseValue = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType) / 14.0f * attackSpeedMod;
570 float basePct = GetModifierValue(unitMod, BASE_PCT);
571 float totalValue = GetModifierValue(unitMod, TOTAL_VALUE);
572 float totalPct = addTotalPct ? GetModifierValue(unitMod, TOTAL_PCT) : 1.0f;
573
574 float weaponMinDamage = GetWeaponDamageRange(attType, MINDAMAGE);
575 float weaponMaxDamage = GetWeaponDamageRange(attType, MAXDAMAGE);
576
577 if (IsInFeralForm()) // check if player is druid and in cat or bear forms
578 {
579 uint8 lvl = GetLevel();
580 if (lvl > 60)
581 lvl = 60;
582
583 weaponMinDamage = lvl * 0.85f * attackSpeedMod;
584 weaponMaxDamage = lvl * 1.25f * attackSpeedMod;
585 }
586 else if (!CanUseAttackType(attType)) // check if player not in form but still can't use (disarm case)
587 {
588 // cannot use ranged/off attack, set values to 0
589 if (attType != BASE_ATTACK)
590 {
591 minDamage = 0.0f;
592 maxDamage = 0.0f;
593 return;
594 }
595 weaponMinDamage = BASE_MINDAMAGE;
596 weaponMaxDamage = BASE_MAXDAMAGE;
597 }
598 else if (attType == RANGED_ATTACK) // add ammo DPS to ranged damage
599 {
600 weaponMinDamage += GetAmmoDPS() * attackSpeedMod;
601 weaponMaxDamage += GetAmmoDPS() * attackSpeedMod;
602 }
603
604 minDamage = ((weaponMinDamage + baseValue) * basePct + totalValue) * totalPct;
605 maxDamage = ((weaponMaxDamage + baseValue) * basePct + totalValue) * totalPct;
606
607 // pussywizard: crashfix (casting negative to uint => min > max => assertion in urand)
608 if (minDamage < 0.0f || minDamage > 1000000000.0f)
609 minDamage = 0.0f;
610 if (maxDamage < 0.0f || maxDamage > 1000000000.0f)
611 maxDamage = 0.0f;
612 if (minDamage > maxDamage)
613 minDamage = maxDamage;
614}
@ BASE_PCT
Definition: Unit.h:246
float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim=nullptr) const
Definition: Unit.cpp:15414
float GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) const
Definition: Unit.cpp:15274
float GetAPMultiplier(WeaponAttackType attType, bool normalized)
Definition: Unit.cpp:17483

References BASE_ATTACK, BASE_MAXDAMAGE, BASE_MINDAMAGE, BASE_PCT, BASE_VALUE, Unit::CanUseAttackType(), GetAmmoDPS(), Unit::GetAPMultiplier(), Unit::GetLevel(), Unit::GetModifierValue(), Unit::GetTotalAttackPowerValue(), Unit::GetWeaponDamageRange(), Unit::IsInFeralForm(), MAXDAMAGE, MINDAMAGE, OFF_ATTACK, RANGED_ATTACK, TOTAL_PCT, TOTAL_VALUE, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, and UNIT_MOD_DAMAGE_RANGED.

◆ CalculateReputationGain()

float Player::CalculateReputationGain ( ReputationSource  source,
uint32  creatureOrQuestLevel,
float  rep,
int32  faction,
bool  noQuestBonus = false 
)
5785{
5786 float percent = 100.0f;
5787
5788 float repMod = noQuestBonus ? 0.0f : float(GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
5789
5790 // faction specific auras only seem to apply to kills
5791 if (source == REPUTATION_SOURCE_KILL)
5793
5794 percent += rep > 0.f ? repMod : -repMod;
5795
5796 float rate;
5797 switch (source)
5798 {
5800 rate = sWorld->getRate(RATE_REPUTATION_LOWLEVEL_KILL);
5801 break;
5807 rate = sWorld->getRate(RATE_REPUTATION_LOWLEVEL_QUEST);
5808 break;
5810 default:
5811 rate = 1.0f;
5812 break;
5813 }
5814
5815 if (rate != 1.0f && creatureOrQuestLevel <= Acore::XP::GetGrayLevel(GetLevel()))
5816 percent *= rate;
5817
5818 if (percent <= 0.0f)
5819 return 0;
5820
5821 // Multiply result with the faction specific rate
5822 if (RepRewardRate const* repData = sObjectMgr->GetRepRewardRate(faction))
5823 {
5824 float repRate = 0.0f;
5825 switch (source)
5826 {
5828 repRate = repData->creatureRate;
5829 break;
5831 repRate = repData->questRate;
5832 break;
5834 repRate = repData->questDailyRate;
5835 break;
5837 repRate = repData->questWeeklyRate;
5838 break;
5840 repRate = repData->questMonthlyRate;
5841 break;
5843 repRate = repData->questRepeatableRate;
5844 break;
5846 repRate = repData->spellRate;
5847 break;
5848 }
5849
5850 // for custom, a rate of 0.0 will totally disable reputation gain for this faction/type
5851 if (repRate <= 0.0f)
5852 return 0;
5853
5854 percent *= repRate;
5855 }
5856
5857 if (source != REPUTATION_SOURCE_SPELL && GetsRecruitAFriendBonus(false))
5858 percent *= 1.0f + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS);
5859
5860 return CalculatePct(rep, percent);
5861}
@ REPUTATION_SOURCE_KILL
Definition: Player.h:240
@ REPUTATION_SOURCE_SPELL
Definition: Player.h:246
@ REPUTATION_SOURCE_QUEST
Definition: Player.h:241
@ REPUTATION_SOURCE_MONTHLY_QUEST
Definition: Player.h:244
@ REPUTATION_SOURCE_REPEATABLE_QUEST
Definition: Player.h:245
@ REPUTATION_SOURCE_WEEKLY_QUEST
Definition: Player.h:243
@ REPUTATION_SOURCE_DAILY_QUEST
Definition: Player.h:242
@ SPELL_AURA_MOD_REPUTATION_GAIN
Definition: SpellAuraDefines.h:219
@ SPELL_AURA_MOD_FACTION_REPUTATION_GAIN
Definition: SpellAuraDefines.h:253
@ RATE_REPUTATION_LOWLEVEL_QUEST
Definition: IWorld.h:479
@ RATE_REPUTATION_LOWLEVEL_KILL
Definition: IWorld.h:478
@ RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS
Definition: IWorld.h:480
uint8 GetGrayLevel(uint8 pl_level)
Definition: Formulas.h:46
bool GetsRecruitAFriendBonus(bool forXP)
Definition: Player.cpp:12604
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition: Unit.cpp:5952
Definition: ObjectMgr.h:551

References CalculatePct(), Acore::XP::GetGrayLevel(), Unit::GetLevel(), GetsRecruitAFriendBonus(), Unit::GetTotalAuraModifier(), Unit::GetTotalAuraModifierByMiscValue(), RATE_REPUTATION_LOWLEVEL_KILL, RATE_REPUTATION_LOWLEVEL_QUEST, RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS, REPUTATION_SOURCE_DAILY_QUEST, REPUTATION_SOURCE_KILL, REPUTATION_SOURCE_MONTHLY_QUEST, REPUTATION_SOURCE_QUEST, REPUTATION_SOURCE_REPEATABLE_QUEST, REPUTATION_SOURCE_SPELL, REPUTATION_SOURCE_WEEKLY_QUEST, sObjectMgr, SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, SPELL_AURA_MOD_REPUTATION_GAIN, and sWorld.

Referenced by Spell::EffectReputation(), and RewardReputation().

◆ CalculateTalentsPoints()

uint32 Player::CalculateTalentsPoints ( ) const
13536{
13537 uint32 base_talent = GetLevel() < 10 ? 0 : GetLevel() - 9;
13538
13539 uint32 talentPointsForLevel = 0;
13540 if (getClass() != CLASS_DEATH_KNIGHT || GetMapId() != 609)
13541 {
13542 talentPointsForLevel = base_talent;
13543 }
13544 else
13545 {
13546 talentPointsForLevel = GetLevel() < 56 ? 0 : GetLevel() - 55;
13547 talentPointsForLevel += m_questRewardTalentCount;
13548
13549 if (talentPointsForLevel > base_talent)
13550 {
13551 talentPointsForLevel = base_talent;
13552 }
13553 }
13554
13555 talentPointsForLevel += m_extraBonusTalentCount;
13556 return uint32(talentPointsForLevel * sWorld->getRate(RATE_TALENT));
13557}
@ RATE_TALENT
Definition: IWorld.h:506

References CLASS_DEATH_KNIGHT, Unit::getClass(), Unit::GetLevel(), WorldLocation::GetMapId(), m_extraBonusTalentCount, m_questRewardTalentCount, RATE_TALENT, and sWorld.

Referenced by InitTalentForLevel(), and resetTalents().

◆ CanAddQuest()

bool Player::CanAddQuest ( Quest const *  quest,
bool  msg 
)
265{
266 if (!SatisfyQuestLog(msg))
267 return false;
268
269 uint32 srcitem = quest->GetSrcItemId();
270 if (srcitem > 0)
271 {
272 uint32 count = quest->GetSrcItemCount();
273 ItemPosCountVec dest;
274 InventoryResult msg2 = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, srcitem, count);
275
276 // player already have max number (in most case 1) source item, no additional item needed and quest can be added.
278 return true;
279 else if (msg2 != EQUIP_ERR_OK)
280 {
281 SendEquipError(msg2, nullptr, nullptr, srcitem);
282 return false;
283 }
284 }
285 return true;
286}
@ EQUIP_ERR_CANT_CARRY_MORE_OF_THIS
Definition: Item.h:58
bool SatisfyQuestLog(bool msg)
Definition: PlayerQuest.cpp:983

References CanStoreNewItem(), EQUIP_ERR_CANT_CARRY_MORE_OF_THIS, EQUIP_ERR_OK, Quest::GetSrcItemCount(), Quest::GetSrcItemId(), NULL_BAG, NULL_SLOT, SatisfyQuestLog(), and SendEquipError().

Referenced by Spell::EffectQuestStart(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleQuestConfirmAccept(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverQueryQuestOpcode(), and SendPreparedQuest().

◆ CanAlwaysSee()

bool Player::CanAlwaysSee ( WorldObject const *  obj) const
overrideprotectedvirtual

Reimplemented from WorldObject.

11368{
11369 // Always can see self
11370 if (m_mover == obj)
11371 return true;
11372
11374 if (obj->GetGUID() == guid)
11375 return true;
11376
11377 return false;
11378}
@ PLAYER_FARSIGHT
Definition: UpdateFields.h:334

References Object::GetGUID(), Object::GetGuidValue(), m_mover, and PLAYER_FARSIGHT.

◆ CanBankItem()

InventoryResult Player::CanBankItem ( uint8  bag,
uint8  slot,
ItemPosCountVec dest,
Item pItem,
bool  swap,
bool  not_loading = true 
) const
2053{
2054 if (!pItem)
2056
2057 uint32 count = pItem->GetCount();
2058
2059 LOG_DEBUG("entities.player.items", "STORAGE: CanBankItem bag = {}, slot = {}, item = {}, count = {}", bag, slot, pItem->GetEntry(), pItem->GetCount());
2060 ItemTemplate const* pProto = pItem->GetTemplate();
2061 if (!pProto)
2063
2064 // Xinef: Removed next loot generated check
2065 if (pItem->GetGUID() == GetLootGUID())
2067
2068 if (pItem->IsBindedNotWith(this))
2070
2071 // Currency tokens are not supposed to be swapped out of their hidden bag
2072 uint8 pItemslot = pItem->GetSlot();
2073 if (pItemslot >= CURRENCYTOKEN_SLOT_START && pItemslot < CURRENCYTOKEN_SLOT_END)
2074 {
2075 LOG_ERROR("entities.player", "Possible hacking attempt: Player {} [{}] tried to move token [{}, entry: {}] out of the currency bag!",
2076 GetName(), GetGUID().ToString(), pItem->GetGUID().ToString(), pProto->ItemId);
2078 }
2079
2080 // check count of items (skip for auto move for same player from bank)
2082 if (res != EQUIP_ERR_OK)
2083 return res;
2084
2085 // in specific slot
2086 if (bag != NULL_BAG && slot != NULL_SLOT)
2087 {
2088 if (slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END)
2089 {
2090 if (!pItem->IsBag())
2092
2095
2096 res = CanUseItem(pItem, not_loading);
2097 if (res != EQUIP_ERR_OK)
2098 return res;
2099 }
2100
2101 res = CanStoreItem_InSpecificSlot(bag, slot, dest, pProto, count, swap, pItem);
2102 if (res != EQUIP_ERR_OK)
2103 return res;
2104
2105 if (count == 0)
2106 return EQUIP_ERR_OK;
2107 }
2108
2109 // not specific slot or have space for partly store only in specific slot
2110
2111 // in specific bag
2112 if (bag != NULL_BAG)
2113 {
2114 if (pItem->IsNotEmptyBag())
2116
2117 // search stack in bag for merge to
2118 if (pProto->Stackable != 1)
2119 {
2120 if (bag == INVENTORY_SLOT_BAG_0)
2121 {
2122 res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
2123 if (res != EQUIP_ERR_OK)
2124 return res;
2125
2126 if (count == 0)
2127 return EQUIP_ERR_OK;
2128 }
2129 else
2130 {
2131 res = CanStoreItem_InBag(bag, dest, pProto, count, true, false, pItem, NULL_BAG, slot);
2132 if (res != EQUIP_ERR_OK)
2133 res = CanStoreItem_InBag(bag, dest, pProto, count, true, true, pItem, NULL_BAG, slot);
2134
2135 if (res != EQUIP_ERR_OK)
2136 return res;
2137
2138 if (count == 0)
2139 return EQUIP_ERR_OK;
2140 }
2141 }
2142
2143 // search free slot in bag
2144 if (bag == INVENTORY_SLOT_BAG_0)
2145 {
2146 res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
2147 if (res != EQUIP_ERR_OK)
2148 return res;
2149
2150 if (count == 0)
2151 return EQUIP_ERR_OK;
2152 }
2153 else
2154 {
2155 res = CanStoreItem_InBag(bag, dest, pProto, count, false, false, pItem, NULL_BAG, slot);
2156 if (res != EQUIP_ERR_OK)
2157 res = CanStoreItem_InBag(bag, dest, pProto, count, false, true, pItem, NULL_BAG, slot);
2158
2159 if (res != EQUIP_ERR_OK)
2160 return res;
2161
2162 if (count == 0)
2163 return EQUIP_ERR_OK;
2164 }
2165 }
2166
2167 // not specific bag or have space for partly store only in specific bag
2168
2169 // search stack for merge to
2170 if (pProto->Stackable != 1)
2171 {
2172 // in slots
2173 res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
2174 if (res != EQUIP_ERR_OK)
2175 return res;
2176
2177 if (count == 0)
2178 return EQUIP_ERR_OK;
2179
2180 // in special bags
2181 if (pProto->BagFamily)
2182 {
2183 for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
2184 {
2185 res = CanStoreItem_InBag(i, dest, pProto, count, true, false, pItem, bag, slot);
2186 if (res != EQUIP_ERR_OK)
2187 continue;
2188
2189 if (count == 0)
2190 return EQUIP_ERR_OK;
2191 }
2192 }
2193
2194 for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
2195 {
2196 res = CanStoreItem_InBag(i, dest, pProto, count, true, true, pItem, bag, slot);
2197 if (res != EQUIP_ERR_OK)
2198 continue;
2199
2200 if (count == 0)
2201 return EQUIP_ERR_OK;
2202 }
2203 }
2204
2205 // search free place in special bag
2206 if (pProto->BagFamily)
2207 {
2208 for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
2209 {
2210 res = CanStoreItem_InBag(i, dest, pProto, count, false, false, pItem, bag, slot);
2211 if (res != EQUIP_ERR_OK)
2212 continue;
2213
2214 if (count == 0)
2215 return EQUIP_ERR_OK;
2216 }
2217 }
2218
2219 // search free space
2220 res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
2221 if (res != EQUIP_ERR_OK)
2222 return res;
2223
2224 if (count == 0)
2225 return EQUIP_ERR_OK;
2226
2227 for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
2228 {
2229 res = CanStoreItem_InBag(i, dest, pProto, count, false, true, pItem, bag, slot);
2230 if (res != EQUIP_ERR_OK)
2231 continue;
2232
2233 if (count == 0)
2234 return EQUIP_ERR_OK;
2235 }
2236 return EQUIP_ERR_BANK_FULL;
2237}
@ EQUIP_ERR_ALREADY_LOOTED
Definition: Item.h:90
@ EQUIP_ERR_DONT_OWN_THAT_ITEM
Definition: Item.h:73
@ EQUIP_ERR_MUST_PURCHASE_THAT_BAG_SLOT
Definition: Item.h:75
@ EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG
Definition: Item.h:46
@ EQUIP_ERR_BANK_FULL
Definition: Item.h:92
@ EQUIP_ERR_ITEM_NOT_FOUND
Definition: Item.h:64
@ EQUIP_ERR_ITEMS_CANT_BE_SWAPPED
Definition: Item.h:62
@ BANK_SLOT_BAG_START
Definition: Player.h:718
@ BANK_SLOT_ITEM_START
Definition: Player.h:712
@ BANK_SLOT_ITEM_END
Definition: Player.h:713
bool IsBindedNotWith(Player const *player) const
Definition: Item.cpp:1133
bool IsBag() const
Definition: Item.h:248
bool IsNotEmptyBag() const
Definition: Item.cpp:312
uint32 BagFamily
Definition: ItemTemplate.h:688
int32 Stackable
Definition: ItemTemplate.h:654
uint8 GetBankBagSlotCount() const
Definition: Player.h:1251
ObjectGuid GetLootGUID() const
Definition: Player.h:1956
InventoryResult CanTakeMoreSimilarItems(Item *pItem) const
Definition: Player.h:1258
InventoryResult CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32 &count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const
Definition: PlayerStorage.cpp:1078
InventoryResult CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32 &count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const
Definition: PlayerStorage.cpp:1008
InventoryResult CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32 &count, bool swap, Item *pSrcItem) const
Definition: PlayerStorage.cpp:937
InventoryResult CanUseItem(Item *pItem, bool not_loading=true) const
Definition: PlayerStorage.cpp:2239

References ItemTemplate::BagFamily, BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_END, BANK_SLOT_ITEM_START, CanStoreItem_InBag(), CanStoreItem_InInventorySlots(), CanStoreItem_InSpecificSlot(), CanTakeMoreSimilarItems(), CanUseItem(), CURRENCYTOKEN_SLOT_END, CURRENCYTOKEN_SLOT_START, EQUIP_ERR_ALREADY_LOOTED, EQUIP_ERR_BANK_FULL, EQUIP_ERR_DONT_OWN_THAT_ITEM, EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, EQUIP_ERR_MUST_PURCHASE_THAT_BAG_SLOT, EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG, EQUIP_ERR_OK, GetBankBagSlotCount(), Item::GetCount(), Object::GetEntry(), Object::GetGUID(), GetLootGUID(), WorldObject::GetName(), Item::GetSlot(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, Item::IsBag(), Item::IsBindedNotWith(), Item::IsNotEmptyBag(), ItemTemplate::ItemId, LOG_DEBUG, LOG_ERROR, NULL_BAG, NULL_SLOT, ItemTemplate::Stackable, ObjectGuid::ToString(), and Position::ToString().

Referenced by _LoadInventory(), Spell::EffectSummonChangeItem(), WorldSession::HandleAutoBankItemOpcode(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleAutoStoreBankItemOpcode(), SplitItem(), and SwapItem().

◆ CanBlock()

bool Player::CanBlock ( ) const
inline
2147{ return m_canBlock; }

References m_canBlock.

Referenced by UpdateBlockPercentage().

◆ CanCaptureTowerPoint()

bool Player::CanCaptureTowerPoint ( ) const
13158{
13159 return (!HasStealthAura() && // not stealthed
13160 !HasInvisibilityAura() && // not invisible
13161 IsAlive() // live player
13162 );
13163}
bool HasStealthAura() const
Definition: Unit.h:1720
bool HasInvisibilityAura() const
Definition: Unit.h:1721

References Unit::HasInvisibilityAura(), Unit::HasStealthAura(), and Unit::IsAlive().

◆ CanCompleteQuest()

bool Player::CanCompleteQuest ( uint32  quest_id,
const QuestStatusData q_savedStatus = nullptr 
)
289{
290 if (quest_id)
291 {
292 Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id);
293 if (!qInfo)
294 return false;
295
296 // Xinef: take seasonals into account
297 if(!qInfo->IsRepeatable() && !qInfo->IsSeasonal() && IsQuestRewarded(quest_id))
298 return false; // not allow re-complete quest
299
300 // auto complete quest
301 if ((qInfo->IsAutoComplete() || !qInfo->GetQuestMethod()) && CanTakeQuest(qInfo, false))
302 return true;
303
304 QuestStatusData q_status;
305 if (q_savedStatus)
306 q_status = *q_savedStatus;
307 else
308 {
309 QuestStatusMap::const_iterator itr = m_QuestStatus.find(quest_id);
310 if (itr == m_QuestStatus.end())
311 return false;
312
313 q_status = itr->second;
314 }
315
316 if (q_status.Status == QUEST_STATUS_INCOMPLETE)
317 {
319 {
320 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
321 {
322 if (qInfo->RequiredItemCount[i] != 0 && q_status.ItemCount[i] < qInfo->RequiredItemCount[i])
323 return false;
324 }
325 }
326
328 {
329 for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
330 {
331 if (qInfo->RequiredNpcOrGo[i] == 0)
332 continue;
333
334 if (qInfo->RequiredNpcOrGoCount[i] != 0 && q_status.CreatureOrGOCount[i] < qInfo->RequiredNpcOrGoCount[i])
335 return false;
336 }
337 }
338
340 if (qInfo->GetPlayersSlain() != 0 && q_status.PlayerCount < qInfo->GetPlayersSlain())
341 return false;
342
344 return false;
345
346 if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED) && q_status.Timer == 0)
347 return false;
348
349 if (qInfo->GetRewOrReqMoney() < 0)
350 {
351 if (!HasEnoughMoney(-qInfo->GetRewOrReqMoney()))
352 return false;
353 }
354
355 uint32 repFacId = qInfo->GetRepObjectiveFaction();
356 if (repFacId && GetReputationMgr().GetReputation(repFacId) < qInfo->GetRepObjectiveValue())
357 return false;
358
359 return true;
360 }
361 }
362 return false;
363}
@ QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT
Definition: QuestDef.h:161
bool CanTakeQuest(Quest const *quest, bool msg)
Definition: PlayerQuest.cpp:251
uint32 GetReputation(uint32 factionentry) const
Definition: Player.cpp:15257
bool IsQuestRewarded(uint32 quest_id) const
Definition: Player.h:1602
bool HasSpecialFlag(uint32 flag) const
Definition: QuestDef.h:221
int32 GetRepObjectiveValue() const
Definition: QuestDef.h:237
int32 RequiredNpcOrGo[QUEST_OBJECTIVES_COUNT]
Definition: QuestDef.h:301
uint32 GetRepObjectiveFaction() const
Definition: QuestDef.h:236
uint32 RequiredNpcOrGoCount[QUEST_OBJECTIVES_COUNT]
Definition: QuestDef.h:302
bool IsRepeatable() const
Definition: QuestDef.h:280
bool IsAutoComplete() const
Definition: QuestDef.cpp:271
uint32 GetPlayersSlain() const
Definition: QuestDef.h:251
uint32 RequiredItemCount[QUEST_ITEM_OBJECTIVES_COUNT]
Definition: QuestDef.h:298
int32 GetRewOrReqMoney(uint8 playerLevel=0) const
Definition: QuestDef.cpp:239
bool IsSeasonal() const
Definition: QuestDef.h:287
uint32 GetQuestMethod() const
Definition: QuestDef.h:226

References CanTakeQuest(), QuestStatusData::CreatureOrGOCount, QuestStatusData::Explored, Quest::GetPlayersSlain(), Quest::GetQuestMethod(), Quest::GetRepObjectiveFaction(), Quest::GetRepObjectiveValue(), GetReputation(), GetReputationMgr(), Quest::GetRewOrReqMoney(), HasEnoughMoney(), Quest::HasSpecialFlag(), Quest::IsAutoComplete(), IsQuestRewarded(), Quest::IsRepeatable(), Quest::IsSeasonal(), QuestStatusData::ItemCount, m_QuestStatus, QuestStatusData::PlayerCount, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_CAST, QUEST_SPECIAL_FLAGS_DELIVER, QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT, QUEST_SPECIAL_FLAGS_KILL, QUEST_SPECIAL_FLAGS_PLAYER_KILL, QUEST_SPECIAL_FLAGS_SPEAKTO, QUEST_SPECIAL_FLAGS_TIMED, QUEST_STATUS_INCOMPLETE, Quest::RequiredItemCount, Quest::RequiredNpcOrGo, Quest::RequiredNpcOrGoCount, sObjectMgr, QuestStatusData::Status, and QuestStatusData::Timer.

Referenced by AddQuestAndCheckCompletion(), AreaExploredOrEventHappens(), WorldSession::HandleQuestgiverQueryQuestOpcode(), WorldSession::HandleQuestgiverRequestRewardOpcode(), ItemAddedQuestCheck(), KillCreditGO(), KilledMonsterCredit(), KilledPlayerCreditForQuest(), MoneyChanged(), ReputationChanged(), ReputationChanged2(), PlayerMenu::SendQuestGiverRequestItems(), and TalkedToCreature().

◆ CanCompleteRepeatableQuest()

bool Player::CanCompleteRepeatableQuest ( Quest const *  quest)
366{
367 // Solve problem that player don't have the quest and try complete it.
368 // if repeatable she must be able to complete event if player don't have it.
369 // Seem that all repeatable quest are DELIVER Flag so, no need to add more.
370 if (!CanTakeQuest(quest, false))
371 return false;
372
373 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
374 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
375 if (quest->RequiredItemId[i] && quest->RequiredItemCount[i] && !HasItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i]))
376 return false;
377
378 if (!CanRewardQuest(quest, false))
379 return false;
380
381 return true;
382}
bool CanRewardQuest(Quest const *quest, bool msg)
Definition: PlayerQuest.cpp:384

References CanRewardQuest(), CanTakeQuest(), HasItemCount(), Quest::HasSpecialFlag(), QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_DELIVER, Quest::RequiredItemCount, and Quest::RequiredItemId.

Referenced by WorldSession::HandlePushQuestToParty(), WorldSession::HandleQuestgiverCompleteQuest(), and SendPreparedQuest().

◆ CanEnterWater()

bool Player::CanEnterWater ( ) const
inlineoverridevirtual

Implements Unit.

2533{ return true; }

◆ CanEquipItem()

InventoryResult Player::CanEquipItem ( uint8  slot,
uint16 dest,
Item pItem,
bool  swap,
bool  not_loading = true 
) const
1834{
1835 dest = 0;
1836 if (pItem)
1837 {
1838 LOG_DEBUG("entities.player.items", "STORAGE: CanEquipItem slot = {}, item = {}, count = {}", slot, pItem->GetEntry(), pItem->GetCount());
1839 ItemTemplate const* pProto = pItem->GetTemplate();
1840 if (pProto)
1841 {
1842 if (!sScriptMgr->CanEquipItem(const_cast<Player*>(this), slot, dest, pItem, swap, not_loading))
1844
1845 // item used
1846 if (pItem->m_lootGenerated)
1848
1849 if (pItem->IsBindedNotWith(this))
1851
1852 // check count of items (skip for auto move for same player from bank)
1854 if (res != EQUIP_ERR_OK)
1855 return res;
1856
1857 // check this only in game
1858 if (not_loading)
1859 {
1860 // May be here should be more stronger checks; STUNNED checked
1861 // ROOT, CONFUSED, DISTRACTED, FLEEING this needs to be checked.
1864
1865 // do not allow equipping gear except weapons, offhands, projectiles, relics in
1866 // - combat
1867 // - in-progress arenas
1868 if (!pProto->CanChangeEquipStateInCombat())
1869 {
1870 if (IsInCombat())
1872
1873 if (Battleground* bg = GetBattleground())
1874 if (bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS)
1876 }
1877
1878 if (IsInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer != 0)
1879 return EQUIP_ERR_CANT_DO_RIGHT_NOW; // maybe exist better err
1880
1881 if (IsNonMeleeSpellCast(false))
1883 }
1884
1886 // check allowed level (extend range to upper values if MaxLevel more or equal max player level, this let GM set high level with 1...max range items)
1887 if (ssd && ssd->MaxLevel < DEFAULT_MAX_LEVEL && ssd->MaxLevel < GetLevel())
1889
1890 uint8 eslot = FindEquipSlot(pProto, slot, swap);
1891 if (eslot == NULL_SLOT)
1893
1894 // Xinef: dont allow to equip items on disarmed slot
1895 if (!CanUseAttackType(GetAttackBySlot(eslot)))
1897
1898 res = CanUseItem(pItem, not_loading);
1899 if (res != EQUIP_ERR_OK)
1900 return res;
1901
1902 if (!swap && GetItemByPos(INVENTORY_SLOT_BAG_0, eslot))
1904
1905 // if we are swapping 2 equiped items, CanEquipUniqueItem check
1906 // should ignore the item we are trying to swap, and not the
1907 // destination item. CanEquipUniqueItem should ignore destination
1908 // item only when we are swapping weapon from bag
1909 uint8 ignore = uint8(NULL_SLOT);
1910 switch (eslot)
1911 {
1913 ignore = EQUIPMENT_SLOT_OFFHAND;
1914 break;
1916 ignore = EQUIPMENT_SLOT_MAINHAND;
1917 break;
1919 ignore = EQUIPMENT_SLOT_FINGER2;
1920 break;
1922 ignore = EQUIPMENT_SLOT_FINGER1;
1923 break;
1925 ignore = EQUIPMENT_SLOT_TRINKET2;
1926 break;
1928 ignore = EQUIPMENT_SLOT_TRINKET1;
1929 break;
1930 }
1931
1932 if (ignore == uint8(NULL_SLOT) || pItem != GetItemByPos(INVENTORY_SLOT_BAG_0, ignore))
1933 ignore = eslot;
1934
1935 InventoryResult res2 = CanEquipUniqueItem(pItem, swap ? ignore : uint8(NULL_SLOT));
1936 if (res2 != EQUIP_ERR_OK)
1937 return res2;
1938
1939 // check unique-equipped special item classes
1940 if (pProto->Class == ITEM_CLASS_QUIVER)
1942 if (Item* pBag = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
1943 if (pBag != pItem)
1944 if (ItemTemplate const* pBagProto = pBag->GetTemplate())
1945 if (pBagProto->Class == pProto->Class && (!swap || pBag->GetSlot() != eslot))
1946 return (pBagProto->SubClass == ITEM_SUBCLASS_AMMO_POUCH)
1949
1950 uint32 type = pProto->InventoryType;
1951
1952 if (eslot == EQUIPMENT_SLOT_OFFHAND)
1953 {
1954 // Do not allow polearm to be equipped in the offhand (rare case for the only 1h polearm 41750)
1955 // xinef: same for fishing poles
1958
1959 else if (type == INVTYPE_WEAPON || type == INVTYPE_WEAPONOFFHAND)
1960 {
1961 if (!CanDualWield())
1963 }
1964 else if (type == INVTYPE_2HWEAPON)
1965 {
1966 if (!CanDualWield() || !CanTitanGrip())
1968 }
1969
1970 if (IsTwoHandUsed())
1972 }
1973
1974 // equip two-hand weapon case (with possible unequip 2 items)
1975 if (type == INVTYPE_2HWEAPON)
1976 {
1977 if (eslot == EQUIPMENT_SLOT_OFFHAND)
1978 {
1979 if (!CanTitanGrip())
1981 }
1982 else if (eslot != EQUIPMENT_SLOT_MAINHAND)
1984
1985 if (!CanTitanGrip())
1986 {
1987 // offhand item must can be stored in inventory for offhand item and it also must be unequipped
1989 ItemPosCountVec off_dest;
1990 if (offItem && (!not_loading ||
1992 CanStoreItem(NULL_BAG, NULL_SLOT, off_dest, offItem, false) != EQUIP_ERR_OK))
1994 }
1995 }
1996 dest = ((INVENTORY_SLOT_BAG_0 << 8) | eslot);
1997 return EQUIP_ERR_OK;
1998 }
1999 }
2000
2002}
@ STATUS_IN_PROGRESS
Definition: Battleground.h:197
@ EQUIP_ERR_CAN_EQUIP_ONLY1_AMMOPOUCH
Definition: Item.h:83
@ EQUIP_ERR_CANT_DUAL_WIELD
Definition: Item.h:55
@ EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE
Definition: Item.h:50
@ EQUIP_ERR_NOT_DURING_ARENA_MATCH
Definition: Item.h:118
@ EQUIP_ERR_NOT_IN_COMBAT
Definition: Item.h:101
@ EQUIP_ERR_CANT_EQUIP_WITH_TWOHANDED
Definition: Item.h:54
@ EQUIP_ERR_NOT_WHILE_DISARMED
Definition: Item.h:102
@ EQUIP_ERR_CANT_DO_RIGHT_NOW
Definition: Item.h:80
@ EQUIP_ERR_CAN_EQUIP_ONLY1_QUIVER
Definition: Item.h:74
@ EQUIP_ERR_YOU_ARE_STUNNED
Definition: Item.h:78
@ EQUIP_ERR_INVENTORY_FULL
Definition: Item.h:91
@ ITEM_SUBCLASS_WEAPON_FISHING_POLE
Definition: ItemTemplate.h:373
@ ITEM_SUBCLASS_WEAPON_POLEARM
Definition: ItemTemplate.h:359
@ INVTYPE_RELIC
Definition: ItemTemplate.h:293
@ ITEM_SUBCLASS_AMMO_POUCH
Definition: ItemTemplate.h:490
@ ITEM_CLASS_QUIVER
Definition: ItemTemplate.h:311
@ ITEM_CLASS_WEAPON
Definition: ItemTemplate.h:302
@ EQUIPMENT_SLOT_FINGER1
Definition: Player.h:686
@ EQUIPMENT_SLOT_FINGER2
Definition: Player.h:687
@ EQUIPMENT_SLOT_TRINKET1
Definition: Player.h:688
@ EQUIPMENT_SLOT_TRINKET2
Definition: Player.h:689
#define DEFAULT_MAX_LEVEL
Definition: DBCEnums.h:43
Definition: Battleground.h:298
bool m_lootGenerated
Definition: Item.h:312
bool CanChangeEquipStateInCombat() const
Definition: ItemTemplate.h:716
uint32 ScalingStatDistribution
Definition: ItemTemplate.h:658
uint32 SubClass
Definition: ItemTemplate.h:631
Definition: Player.h:1056
InventoryResult CanUnequipItem(uint16 src, bool swap) const
Definition: PlayerStorage.cpp:2004
InventoryResult CanEquipUniqueItem(Item *pItem, uint8 except_slot=NULL_SLOT, uint32 limit_count=1) const
Definition: Player.cpp:13700
Battleground * GetBattleground(bool create=false) const
Definition: Player.cpp:12117
uint8 FindEquipSlot(ItemTemplate const *proto, uint32 slot, bool swap) const
Definition: PlayerStorage.cpp:134

References ItemTemplate::CanChangeEquipStateInCombat(), Unit::CanDualWield(), CanEquipUniqueItem(), CanStoreItem(), CanTakeMoreSimilarItems(), CanTitanGrip(), CanUnequipItem(), Unit::CanUseAttackType(), CanUseItem(), ItemTemplate::Class, DEFAULT_MAX_LEVEL, EQUIP_ERR_ALREADY_LOOTED, EQUIP_ERR_CAN_EQUIP_ONLY1_AMMOPOUCH, EQUIP_ERR_CAN_EQUIP_ONLY1_QUIVER, EQUIP_ERR_CANT_DO_RIGHT_NOW, EQUIP_ERR_CANT_DUAL_WIELD, EQUIP_ERR_CANT_EQUIP_WITH_TWOHANDED, EQUIP_ERR_DONT_OWN_THAT_ITEM, EQUIP_ERR_INVENTORY_FULL, EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE, EQUIP_ERR_NOT_DURING_ARENA_MATCH, EQUIP_ERR_NOT_IN_COMBAT, EQUIP_ERR_NOT_WHILE_DISARMED, EQUIP_ERR_OK, EQUIP_ERR_YOU_ARE_STUNNED, EQUIPMENT_SLOT_FINGER1, EQUIPMENT_SLOT_FINGER2, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_TRINKET1, EQUIPMENT_SLOT_TRINKET2, FindEquipSlot(), GetAttackBySlot(), GetBattleground(), Item::GetCount(), Object::GetEntry(), GetItemByPos(), Unit::GetLevel(), Item::GetTemplate(), Unit::HasUnitState(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, ItemTemplate::InventoryType, INVTYPE_2HWEAPON, INVTYPE_RELIC, INVTYPE_WEAPON, INVTYPE_WEAPONOFFHAND, Item::IsBindedNotWith(), Unit::IsInCombat(), Unit::IsNonMeleeSpellCast(), IsTwoHandUsed(), ITEM_CLASS_QUIVER, ITEM_CLASS_WEAPON, ITEM_SUBCLASS_AMMO_POUCH, ITEM_SUBCLASS_WEAPON_FISHING_POLE, ITEM_SUBCLASS_WEAPON_POLEARM, LOG_DEBUG, Item::m_lootGenerated, m_weaponChangeTimer, ScalingStatDistributionEntry::MaxLevel, NULL_BAG, NULL_SLOT, ItemTemplate::ScalingStatDistribution, sScalingStatDistributionStore, sScriptMgr, STATUS_IN_PROGRESS, ItemTemplate::SubClass, and UNIT_STATE_STUNNED.

Referenced by _LoadInventory(), CanEquipNewItem(), Create(), Spell::EffectSummonChangeItem(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleEquipmentSetUse(), SplitItem(), and SwapItem().

◆ CanEquipNewItem()

InventoryResult Player::CanEquipNewItem ( uint8  slot,
uint16 dest,
uint32  item,
bool  swap 
) const
1820{
1821 dest = 0;
1822 Item* pItem = Item::CreateItem(item, 1, this);
1823 if (pItem)
1824 {
1825 InventoryResult result = CanEquipItem(slot, dest, pItem, swap);
1826 delete pItem;
1827 return result;
1828 }
1829
1831}
static Item * CreateItem(uint32 item, uint32 count, Player const *player=nullptr, bool clone=false, uint32 randomPropertyId=0)
Definition: Item.cpp:1088

References CanEquipItem(), Item::CreateItem(), and EQUIP_ERR_ITEM_NOT_FOUND.

Referenced by _StoreOrEquipNewItem(), and StoreNewItemInBestSlots().

◆ CanEquipUniqueItem() [1/2]

InventoryResult Player::CanEquipUniqueItem ( Item pItem,
uint8  except_slot = NULL_SLOT,
uint32  limit_count = 1 
) const
13701{
13702 ItemTemplate const* pProto = pItem->GetTemplate();
13703
13704 // proto based limitations
13705 if (InventoryResult res = CanEquipUniqueItem(pProto, eslot, limit_count))
13706 return res;
13707
13708 // check unique-equipped on gems
13709 for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + 3; ++enchant_slot)
13710 {
13711 uint32 enchant_id = pItem->GetEnchantmentId(EnchantmentSlot(enchant_slot));
13712 if (!enchant_id)
13713 continue;
13714 SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
13715 if (!enchantEntry)
13716 continue;
13717
13718 ItemTemplate const* pGem = sObjectMgr->GetItemTemplate(enchantEntry->GemID);
13719 if (!pGem)
13720 continue;
13721
13722 // include for check equip another gems with same limit category for not equipped item (and then not counted)
13723 uint32 gem_limit_count = !pItem->IsEquipped() && pGem->ItemLimitCategory
13725
13726 if (InventoryResult res = CanEquipUniqueItem(pGem, eslot, gem_limit_count))
13727 return res;
13728 }
13729
13730 return EQUIP_ERR_OK;
13731}
uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const
Definition: Item.cpp:1034
uint32 ItemLimitCategory
Definition: ItemTemplate.h:696
uint32 GemID
Definition: DBCStructure.h:1853

References CanEquipUniqueItem(), EQUIP_ERR_OK, SpellItemEnchantmentEntry::GemID, Item::GetEnchantmentId(), Item::GetGemCountWithLimitCategory(), Item::GetTemplate(), Item::IsEquipped(), ItemTemplate::ItemLimitCategory, sObjectMgr, SOCK_ENCHANTMENT_SLOT, and sSpellItemEnchantmentStore.

Referenced by CanEquipItem(), CanEquipUniqueItem(), and WorldSession::HandleSocketOpcode().

◆ CanEquipUniqueItem() [2/2]

InventoryResult Player::CanEquipUniqueItem ( ItemTemplate const *  itemProto,
uint8  except_slot = NULL_SLOT,
uint32  limit_count = 1 
) const
13734{
13735 // check unique-equipped on item
13736 if (itemProto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE)
13737 {
13738 // there is an equip limit on this item
13739 if (HasItemOrGemWithIdEquipped(itemProto->ItemId, 1, except_slot))
13741 }
13742
13743 // check unique-equipped limit
13744 if (itemProto->ItemLimitCategory)
13745 {
13746 ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(itemProto->ItemLimitCategory);
13747 if (!limitEntry)
13749
13750 // NOTE: limitEntry->mode not checked because if item have have-limit then it applied and to equip case
13751
13752 if (limit_count > limitEntry->maxCount)
13754
13755 // there is an equip limit on this item
13756 if (HasItemOrGemWithLimitCategoryEquipped(itemProto->ItemLimitCategory, limitEntry->maxCount - limit_count + 1, except_slot))
13758 }
13759
13760 return EQUIP_ERR_OK;
13761}
DBCStorage< ItemLimitCategoryEntry > sItemLimitCategoryStore(ItemLimitCategoryEntryfmt)
@ EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED
Definition: Item.h:129
@ EQUIP_ERR_ITEM_UNIQUE_EQUIPABLE
Definition: Item.h:108
@ EQUIP_ERR_ITEM_MAX_COUNT_EQUIPPED_SOCKETED
Definition: Item.h:115
@ ITEM_FLAG_UNIQUE_EQUIPPABLE
Definition: ItemTemplate.h:167
bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot=NULL_SLOT) const
Definition: PlayerStorage.cpp:756
bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot=NULL_SLOT) const
Definition: PlayerStorage.cpp:794
Definition: DBCStructure.h:1187
uint32 maxCount
Definition: DBCStructure.h:1191

References EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, EQUIP_ERR_ITEM_MAX_COUNT_EQUIPPED_SOCKETED, EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED, EQUIP_ERR_ITEM_UNIQUE_EQUIPABLE, EQUIP_ERR_OK, ItemTemplate::Flags, HasItemOrGemWithIdEquipped(), HasItemOrGemWithLimitCategoryEquipped(), ITEM_FLAG_UNIQUE_EQUIPPABLE, ItemTemplate::ItemId, ItemTemplate::ItemLimitCategory, ItemLimitCategoryEntry::maxCount, and sItemLimitCategoryStore.

◆ CanFly()

bool Player::CanFly ( ) const
inlineoverridevirtual

Implements Unit.

@ MOVEMENTFLAG_CAN_FLY
Definition: Unit.h:576
bool HasMovementFlag(uint32 flag) const
Definition: Object.h:322
MovementInfo m_movementInfo
Definition: Object.h:595

References MovementInfo::HasMovementFlag(), WorldObject::m_movementInfo, and MOVEMENTFLAG_CAN_FLY.

◆ canFlyInZone()

bool Player::canFlyInZone ( uint32  mapid,
uint32  zone,
SpellInfo const *  bySpell 
)
13560{
13561 if (!sScriptMgr->OnCanPlayerFlyInZone(this, mapid,zone,bySpell))
13562 {
13563 return false;
13564 }
13565
13566 // continent checked in SpellInfo::CheckLocation at cast and area update
13567 uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
13568 if (v_map == 571 && !bySpell->HasAttribute(SPELL_ATTR7_IGNORES_COLD_WEATHER_FLYING_REQUIREMENT))
13569 {
13570 if (!HasSpell(54197)) // 54197 = Cold Weather Flying
13571 {
13572 return false;
13573 }
13574 }
13575
13576 return true;
13577}
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
Definition: DBCStores.cpp:699
@ SPELL_ATTR7_IGNORES_COLD_WEATHER_FLYING_REQUIREMENT
Definition: SharedDefines.h:663

References GetVirtualMapForMapAndZone(), SpellInfo::HasAttribute(), HasSpell(), SPELL_ATTR7_IGNORES_COLD_WEATHER_FLYING_REQUIREMENT, and sScriptMgr.

Referenced by SpellInfo::CheckLocation().

◆ CanInteractWithQuestGiver()

bool Player::CanInteractWithQuestGiver ( Object questGiver)
2046{
2047 switch (questGiver->GetTypeId())
2048 {
2049 case TYPEID_UNIT:
2050 return GetNPCIfCanInteractWith(questGiver->GetGUID(), UNIT_NPC_FLAG_QUESTGIVER) != nullptr;
2051 case TYPEID_GAMEOBJECT:
2052 return GetGameObjectIfCanInteractWith(questGiver->GetGUID(), GAMEOBJECT_TYPE_QUESTGIVER) != nullptr;
2053 case TYPEID_PLAYER:
2054 return IsAlive() && questGiver->ToPlayer()->IsAlive();
2055 case TYPEID_ITEM:
2056 return IsAlive();
2057 default:
2058 break;
2059 }
2060 return false;
2061}
@ UNIT_NPC_FLAG_QUESTGIVER
Definition: Unit.h:517
@ GAMEOBJECT_TYPE_QUESTGIVER
Definition: SharedDefines.h:1562
GameObject * GetGameObjectIfCanInteractWith(ObjectGuid guid, GameobjectTypes type) const
Definition: Player.cpp:2120

References GAMEOBJECT_TYPE_QUESTGIVER, GetGameObjectIfCanInteractWith(), Object::GetGUID(), GetNPCIfCanInteractWith(), Object::GetTypeId(), Unit::IsAlive(), Object::ToPlayer(), TYPEID_GAMEOBJECT, TYPEID_ITEM, TYPEID_PLAYER, TYPEID_UNIT, and UNIT_NPC_FLAG_QUESTGIVER.

Referenced by WorldSession::HandleQuestgiverAcceptQuestOpcode(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverCompleteQuest(), and WorldSession::HandleQuestgiverRequestRewardOpcode().

◆ CanJoinConstantChannelInZone()

bool Player::CanJoinConstantChannelInZone ( ChatChannelsEntry const *  channel,
AreaTableEntry const *  zone 
)
4890{
4891 // Player can join LFG anywhere
4892 if (channel->flags & CHANNEL_DBC_FLAG_LFG && sWorld->getBoolConfig(CONFIG_LFG_LOCATION_ALL))
4893 return true;
4894
4895 if (channel->flags & CHANNEL_DBC_FLAG_ZONE_DEP && zone->flags & AREA_FLAG_ARENA_INSTANCE)
4896 return false;
4897
4898 if ((channel->flags & CHANNEL_DBC_FLAG_CITY_ONLY) && (!(zone->flags & AREA_FLAG_SLAVE_CAPITAL)))
4899 return false;
4900
4901 if ((channel->flags & CHANNEL_DBC_FLAG_GUILD_REQ) && GetGuildId())
4902 return false;
4903
4904 return true;
4905}
@ CHANNEL_DBC_FLAG_CITY_ONLY
Definition: Channel.h:101
@ CHANNEL_DBC_FLAG_GUILD_REQ
Definition: Channel.h:104
@ CHANNEL_DBC_FLAG_ZONE_DEP
Definition: Channel.h:98
@ CHANNEL_DBC_FLAG_LFG
Definition: Channel.h:105
@ CONFIG_LFG_LOCATION_ALL
Definition: IWorld.h:161
@ AREA_FLAG_ARENA_INSTANCE
Definition: DBCEnums.h:258
@ AREA_FLAG_SLAVE_CAPITAL
Definition: DBCEnums.h:245
uint32 GetGuildId() const
Definition: Player.h:1864

References AREA_FLAG_ARENA_INSTANCE, AREA_FLAG_SLAVE_CAPITAL, CHANNEL_DBC_FLAG_CITY_ONLY, CHANNEL_DBC_FLAG_GUILD_REQ, CHANNEL_DBC_FLAG_LFG, CHANNEL_DBC_FLAG_ZONE_DEP, CONFIG_LFG_LOCATION_ALL, AreaTableEntry::flags, ChatChannelsEntry::flags, GetGuildId(), and sWorld.

Referenced by UpdateLocalChannels().

◆ CanJoinToBattleground()

bool Player::CanJoinToBattleground ( ) const
11275{
11276 // check Deserter debuff
11277 if (HasAura(26013))
11278 return false;
11279
11280 return true;
11281}
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5636

References Unit::HasAura().

Referenced by Group::CanJoinBattlegroundQueue(), WorldSession::HandleBattleFieldPortOpcode(), and WorldSession::HandleBattlemasterJoinOpcode().

◆ CanKnockback()

bool Player::CanKnockback ( )
inline
2462{ return m_canKnockback; }

References m_canKnockback.

◆ CanNoReagentCast()

bool Player::CanNoReagentCast ( SpellInfo const *  spellInfo) const
12477{
12478 // don't take reagents for spells with SPELL_ATTR5_NO_REAGENT_COST_WITH_AURA
12480 return true;
12481
12482 // Check no reagent use mask
12483 flag96 noReagentMask;
12484 noReagentMask[0] = GetUInt32Value(PLAYER_NO_REAGENT_COST_1);
12485 noReagentMask[1] = GetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 1);
12486 noReagentMask[2] = GetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 2);
12487 if (spellInfo->SpellFamilyFlags & noReagentMask)
12488 return true;
12489
12490 return false;
12491}
@ PLAYER_NO_REAGENT_COST_1
Definition: UpdateFields.h:387
@ UNIT_FLAG_PREPARATION
Definition: Unit.h:453
@ SPELL_ATTR5_NO_REAGENT_COST_WITH_AURA
Definition: SharedDefines.h:568

References Object::GetUInt32Value(), SpellInfo::HasAttribute(), Unit::HasUnitFlag(), PLAYER_NO_REAGENT_COST_1, SPELL_ATTR5_NO_REAGENT_COST_WITH_AURA, SpellInfo::SpellFamilyFlags, and UNIT_FLAG_PREPARATION.

Referenced by Spell::CheckItems(), spell_dk_raise_dead::CheckReagents(), and Spell::TakeReagents().

◆ CanParry()

bool Player::CanParry ( ) const
inline

◆ CanPetResurrect()

bool Player::CanPetResurrect ( )
9076{
9077 PetStable* const petStable = GetPetStable();
9078 if (!petStable)
9079 {
9080 // No pets
9081 return false;
9082 }
9083
9084 auto const& currectPet = petStable->CurrentPet;
9085 auto const& unslottedHunterPet = petStable->GetUnslottedHunterPet();
9086
9087 if (!currectPet && !unslottedHunterPet)
9088 {
9089 // No pets
9090 return false;
9091 }
9092
9093 // Check current pet
9094 if (currectPet && !currectPet->Health)
9095 {
9096 return true;
9097 }
9098
9099 // Check dismiss/unslotted hunter pet
9100 if (unslottedHunterPet && !unslottedHunterPet->Health)
9101 {
9102 return true;
9103 }
9104
9105 return false;
9106}
Definition: PetDefines.h:202
PetInfo const * GetUnslottedHunterPet() const
Definition: PetDefines.h:230
Optional< PetInfo > CurrentPet
Definition: PetDefines.h:225
PetStable * GetPetStable()
Definition: Player.h:1190

References PetStable::CurrentPet, GetPetStable(), and PetStable::GetUnslottedHunterPet().

◆ CanReportAfkDueToLimit()

bool Player::CanReportAfkDueToLimit ( )
11284{
11285 // a player can complain about 15 people per 5 minutes
11286 if (m_bgData.bgAfkReportedCount++ >= 15)
11287 return false;
11288
11289 return true;
11290}
uint8 bgAfkReportedCount
Definition: Player.h:1035
BGData m_bgData
Definition: Player.h:2629

References BGData::bgAfkReportedCount, and m_bgData.

Referenced by ReportedAfkBy().

◆ CanResummonPet()

bool Player::CanResummonPet ( uint32  spellid)
14171{
14172 switch (getClass())
14173 {
14174 case CLASS_DEATH_KNIGHT:
14175 if (CanSeeDKPet())
14176 return true;
14177 else if (spellid == 52150) //Raise Dead
14178 return false;
14179 break;
14180 case CLASS_MAGE:
14181 if (HasSpell(31687) && HasAura(70937)) //Has [Summon Water Elemental] spell and [Glyph of Eternal Water].
14182 return true;
14183 break;
14184 case CLASS_HUNTER:
14185 case CLASS_WARLOCK:
14186 return true;
14187 break;
14188 default:
14189 break;
14190 }
14191
14192 return HasSpell(spellid);
14193}
bool CanSeeDKPet() const
Definition: Player.h:2559

References CanSeeDKPet(), CLASS_DEATH_KNIGHT, CLASS_HUNTER, CLASS_MAGE, CLASS_WARLOCK, Unit::getClass(), Unit::HasAura(), and HasSpell().

Referenced by spell_gen_pet_summoned::HandleScript(), and ResummonPetTemporaryUnSummonedIfAny().

◆ CanRewardQuest() [1/2]

bool Player::CanRewardQuest ( Quest const *  quest,
bool  msg 
)
385{
386 // not auto complete quest and not completed quest (only cheating case, then ignore without message)
387 if (!quest->IsDFQuest() && !quest->IsAutoComplete() && quest->GetQuestMethod() && GetQuestStatus(quest->GetQuestId()) != QUEST_STATUS_COMPLETE)
388 return false;
389
390 // daily quest can't be rewarded (25 daily quest already completed)
391 if (!SatisfyQuestDay(quest, true) || !SatisfyQuestWeek(quest, true) || !SatisfyQuestMonth(quest, true) || !SatisfyQuestSeasonal(quest, true))
392 return false;
393
394 // rewarded and not repeatable quest (only cheating case, then ignore without message)
395 if (GetQuestRewardStatus(quest->GetQuestId()))
396 return false;
397
398 // prevent receive reward with quest items in bank
399 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
400 {
401 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
402 {
403 if (quest->RequiredItemCount[i] != 0 &&
404 GetItemCount(quest->RequiredItemId[i]) < quest->RequiredItemCount[i])
405 {
406 if (msg)
407 SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr, quest->RequiredItemId[i]);
408 return false;
409 }
410 }
411 }
412
413 // prevent receive reward with low money and GetRewOrReqMoney() < 0
414 if (quest->GetRewOrReqMoney() < 0 && !HasEnoughMoney(-quest->GetRewOrReqMoney()))
415 return false;
416
417 return true;
418}
bool SatisfyQuestDay(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:1267
bool SatisfyQuestMonth(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:1325
bool SatisfyQuestSeasonal(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:1310
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1416
bool SatisfyQuestWeek(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:1301

References EQUIP_ERR_ITEM_NOT_FOUND, GetItemCount(), Quest::GetQuestId(), Quest::GetQuestMethod(), GetQuestRewardStatus(), GetQuestStatus(), Quest::GetRewOrReqMoney(), HasEnoughMoney(), Quest::HasSpecialFlag(), Quest::IsAutoComplete(), Quest::IsDFQuest(), QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_DELIVER, QUEST_STATUS_COMPLETE, Quest::RequiredItemCount, Quest::RequiredItemId, SatisfyQuestDay(), SatisfyQuestMonth(), SatisfyQuestSeasonal(), SatisfyQuestWeek(), and SendEquipError().

Referenced by CanCompleteRepeatableQuest(), CanRewardQuest(), lfg::LFGMgr::FinishDungeon(), WorldSession::HandleLfgPlayerLockInfoRequestOpcode(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverCompleteQuest(), npc_elder_clearwater::OnGossipHello(), and SendPreparedQuest().

◆ CanRewardQuest() [2/2]

bool Player::CanRewardQuest ( Quest const *  quest,
uint32  reward,
bool  msg 
)
468{
469 // prevent receive reward with quest items in bank or for not completed quest
470 if (!CanRewardQuest(quest, msg))
471 return false;
472
473 ItemPosCountVec dest;
474 if (quest->GetRewChoiceItemsCount() > 0)
475 {
476 if (quest->RewardChoiceItemId[reward])
477 {
478 InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, quest->RewardChoiceItemId[reward], quest->RewardChoiceItemCount[reward]);
479 if (res != EQUIP_ERR_OK)
480 {
481 SendEquipError(res, nullptr, nullptr, quest->RewardChoiceItemId[reward]);
482 return false;
483 }
484 }
485 }
486
487 if (quest->GetRewItemsCount() > 0)
488 {
489 for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i)
490 {
491 if (quest->RewardItemId[i])
492 {
493 InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, quest->RewardItemId[i], quest->RewardItemIdCount[i]);
494 if (res != EQUIP_ERR_OK)
495 {
496 SendEquipError(res, nullptr, nullptr, quest->RewardItemId[i]);
497 return false;
498 }
499 }
500 }
501 }
502
503 return true;
504}

References CanRewardQuest(), CanStoreNewItem(), EQUIP_ERR_OK, Quest::GetRewChoiceItemsCount(), Quest::GetRewItemsCount(), NULL_BAG, NULL_SLOT, Quest::RewardChoiceItemCount, Quest::RewardChoiceItemId, Quest::RewardItemId, Quest::RewardItemIdCount, and SendEquipError().

◆ CanRollForItemInLFG()

InventoryResult Player::CanRollForItemInLFG ( ItemTemplate const *  item,
WorldObject const *  lootedObject 
) const
2361{
2362 if (!GetGroup() || !GetGroup()->isLFGGroup(true))
2363 return EQUIP_ERR_OK; // not in LFG group
2364
2365 // check if looted object is inside the lfg dungeon
2366 Map const* map = lootedObject->GetMap();
2367 if (!sLFGMgr->inLfgDungeonMap(GetGroup()->GetGUID(), map->GetId(), map->GetDifficulty()))
2368 return EQUIP_ERR_OK;
2369
2370 if (!proto)
2372 // Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player
2373
2374 const static uint32 item_weapon_skills[MAX_ITEM_SUBCLASS_WEAPON] =
2375 {
2381 }; //Copy from function Item::GetSkill()
2382
2383 if ((proto->AllowableClass & getClassMask()) == 0 || (proto->AllowableRace & getRaceMask()) == 0)
2385
2386 if (proto->RequiredSpell != 0 && !HasSpell(proto->RequiredSpell))
2388
2389 if (proto->RequiredSkill != 0)
2390 {
2391 if (!GetSkillValue(proto->RequiredSkill))
2393 else if (GetSkillValue(proto->RequiredSkill) < proto->RequiredSkillRank)
2395 }
2396
2397 uint8 _class = getClass();
2398
2399 if (proto->Class == ITEM_CLASS_WEAPON && GetSkillValue(item_weapon_skills[proto->SubClass]) == 0)
2401
2402 if (proto->Class == ITEM_CLASS_ARMOR)
2403 {
2404 // Check for shields
2405 if (proto->SubClass == ITEM_SUBCLASS_ARMOR_SHIELD && !(_class == CLASS_PALADIN || _class == CLASS_WARRIOR || _class == CLASS_SHAMAN))
2406 {
2408 }
2409
2410 // Check for librams.
2411 if (proto->SubClass == ITEM_SUBCLASS_ARMOR_LIBRAM && _class != CLASS_PALADIN)
2412 {
2414 }
2415
2416 // CHeck for idols.
2417 if (proto->SubClass == ITEM_SUBCLASS_ARMOR_IDOL && _class != CLASS_DRUID)
2418 {
2420 }
2421
2422 // Check for totems.
2423 if (proto->SubClass == ITEM_SUBCLASS_ARMOR_TOTEM && _class != CLASS_SHAMAN)
2424 {
2426 }
2427
2428 // Check for sigils.
2429 if (proto->SubClass == ITEM_SUBCLASS_ARMOR_SIGIL && _class != CLASS_DEATH_KNIGHT)
2430 {
2432 }
2433 }
2434
2435 if (proto->Class == ITEM_CLASS_ARMOR && proto->SubClass > ITEM_SUBCLASS_ARMOR_MISC && proto->SubClass < ITEM_SUBCLASS_ARMOR_BUCKLER &&
2436 proto->InventoryType != INVTYPE_CLOAK)
2437 {
2438 uint32 subclassToCompare = ITEM_SUBCLASS_ARMOR_CLOTH;
2439 switch (_class)
2440 {
2441 case CLASS_WARRIOR:
2442 if (proto->HasStat(ITEM_MOD_SPELL_POWER) || proto->HasSpellPowerStat())
2443 {
2445 }
2446 [[fallthrough]];
2447 case CLASS_DEATH_KNIGHT:
2448 case CLASS_PALADIN:
2449 subclassToCompare = ITEM_SUBCLASS_ARMOR_PLATE;
2450 break;
2451 case CLASS_HUNTER:
2452 case CLASS_SHAMAN:
2453 subclassToCompare = ITEM_SUBCLASS_ARMOR_MAIL;
2454 break;
2455 case CLASS_ROGUE:
2456 if (proto->HasStat(ITEM_MOD_SPELL_POWER) || proto->HasSpellPowerStat())
2457 {
2459 }
2460 [[fallthrough]];
2461 case CLASS_DRUID:
2462 subclassToCompare = ITEM_SUBCLASS_ARMOR_LEATHER;
2463 break;
2464 default:
2465 break;
2466 }
2467
2468 if (proto->SubClass > subclassToCompare)
2469 {
2471 }
2472 else if (sWorld->getIntConfig(CONFIG_LOOT_NEED_BEFORE_GREED_ILVL_RESTRICTION) && proto->ItemLevel > sWorld->getIntConfig(CONFIG_LOOT_NEED_BEFORE_GREED_ILVL_RESTRICTION))
2473 {
2474 if (proto->SubClass < subclassToCompare)
2475 {
2477 }
2478 }
2479 }
2480
2481 return EQUIP_ERR_OK;
2482}
#define sLFGMgr
Definition: LFGMgr.h:641
@ EQUIP_ERR_CANT_EQUIP_SKILL
Definition: Item.h:43
@ EQUIP_ERR_NO_REQUIRED_PROFICIENCY
Definition: Item.h:49
@ EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM
Definition: Item.h:51
@ INVTYPE_CLOAK
Definition: ItemTemplate.h:281
@ ITEM_SUBCLASS_ARMOR_BUCKLER
Definition: ItemTemplate.h:404
@ ITEM_SUBCLASS_ARMOR_LIBRAM
Definition: ItemTemplate.h:406
@ ITEM_SUBCLASS_ARMOR_MISC
Definition: ItemTemplate.h:399
@ ITEM_SUBCLASS_ARMOR_SIGIL
Definition: ItemTemplate.h:409
@ ITEM_SUBCLASS_ARMOR_TOTEM
Definition: ItemTemplate.h:408
@ ITEM_SUBCLASS_ARMOR_IDOL
Definition: ItemTemplate.h:407
#define MAX_ITEM_SUBCLASS_WEAPON
Definition: ItemTemplate.h:380
@ CONFIG_LOOT_NEED_BEFORE_GREED_ILVL_RESTRICTION
Definition: IWorld.h:414
@ CLASS_WARRIOR
Definition: SharedDefines.h:141
@ CLASS_ROGUE
Definition: SharedDefines.h:144
@ SKILL_BOWS
Definition: SharedDefines.h:2873
@ SKILL_MACES
Definition: SharedDefines.h:2877
@ SKILL_WANDS
Definition: SharedDefines.h:2941
@ SKILL_GUNS
Definition: SharedDefines.h:2874
@ SKILL_CROSSBOWS
Definition: SharedDefines.h:2940
@ SKILL_THROWN
Definition: SharedDefines.h:2914
@ SKILL_FISHING
Definition: SharedDefines.h:2957
@ SKILL_SWORDS
Definition: SharedDefines.h:2871
@ SKILL_DAGGERS
Definition: SharedDefines.h:2913
@ SKILL_2H_AXES
Definition: SharedDefines.h:2912
@ SKILL_POLEARMS
Definition: SharedDefines.h:2942
@ SKILL_2H_SWORDS
Definition: SharedDefines.h:2878
@ SKILL_FIST_WEAPONS
Definition: SharedDefines.h:2966
@ SKILL_2H_MACES
Definition: SharedDefines.h:2906
@ SKILL_AXES
Definition: SharedDefines.h:2872
@ SKILL_STAVES
Definition: SharedDefines.h:2894
@ SKILL_ASSASSINATION
Definition: SharedDefines.h:2946
uint32 getRaceMask() const
Definition: Unit.h:1437
uint32 GetId() const
Definition: Map.h:379
Difficulty GetDifficulty() const
Definition: Map.h:443

References ItemTemplate::AllowableClass, ItemTemplate::AllowableRace, ItemTemplate::Class, CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_HUNTER, CLASS_PALADIN, CLASS_ROGUE, CLASS_SHAMAN, CLASS_WARRIOR, CONFIG_LOOT_NEED_BEFORE_GREED_ILVL_RESTRICTION, EQUIP_ERR_CANT_DO_RIGHT_NOW, EQUIP_ERR_CANT_EQUIP_SKILL, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_NO_REQUIRED_PROFICIENCY, EQUIP_ERR_OK, EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM, Unit::getClass(), Unit::getClassMask(), Map::GetDifficulty(), GetGroup(), Object::GetGUID(), Map::GetId(), WorldObject::GetMap(), Unit::getRaceMask(), GetSkillValue(), HasSpell(), ItemTemplate::HasSpellPowerStat(), ItemTemplate::HasStat(), ItemTemplate::InventoryType, INVTYPE_CLOAK, ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON, ITEM_MOD_SPELL_POWER, ITEM_SUBCLASS_ARMOR_BUCKLER, ITEM_SUBCLASS_ARMOR_CLOTH, ITEM_SUBCLASS_ARMOR_IDOL, ITEM_SUBCLASS_ARMOR_LEATHER, ITEM_SUBCLASS_ARMOR_LIBRAM, ITEM_SUBCLASS_ARMOR_MAIL, ITEM_SUBCLASS_ARMOR_MISC, ITEM_SUBCLASS_ARMOR_PLATE, ITEM_SUBCLASS_ARMOR_SHIELD, ITEM_SUBCLASS_ARMOR_SIGIL, ITEM_SUBCLASS_ARMOR_TOTEM, ItemTemplate::ItemLevel, MAX_ITEM_SUBCLASS_WEAPON, ItemTemplate::RequiredSkill, ItemTemplate::RequiredSkillRank, ItemTemplate::RequiredSpell, SKILL_2H_AXES, SKILL_2H_MACES, SKILL_2H_SWORDS, SKILL_ASSASSINATION, SKILL_AXES, SKILL_BOWS, SKILL_CROSSBOWS, SKILL_DAGGERS, SKILL_FISHING, SKILL_FIST_WEAPONS, SKILL_GUNS, SKILL_MACES, SKILL_POLEARMS, SKILL_STAVES, SKILL_SWORDS, SKILL_THROWN, SKILL_WANDS, sLFGMgr, ItemTemplate::SubClass, and sWorld.

Referenced by Group::NeedBeforeGreed().

◆ CanSeeDKPet()

bool Player::CanSeeDKPet ( ) const
inline

◆ CanSeeSpellClickOn()

bool Player::CanSeeSpellClickOn ( Creature const *  creature) const
14196{
14197 if (!c->HasNpcFlag(UNIT_NPC_FLAG_SPELLCLICK))
14198 return false;
14199
14200 SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(c->GetEntry());
14201 if (clickPair.first == clickPair.second)
14202 return true;
14203
14204 for (SpellClickInfoContainer::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
14205 {
14206 if (!itr->second.IsFitToRequirements(this, c))
14207 return false;
14208
14209 ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(c->GetEntry(), itr->second.spellId);
14210 ConditionSourceInfo info = ConditionSourceInfo(const_cast<Player*>(this), const_cast<Creature*>(c));
14211 if (sConditionMgr->IsObjectMeetToConditions(info, conds))
14212 return true;
14213 }
14214
14215 return false;
14216}
@ UNIT_NPC_FLAG_SPELLCLICK
Definition: Unit.h:540
std::pair< SpellClickInfoContainer::const_iterator, SpellClickInfoContainer::const_iterator > SpellClickInfoMapBounds
Definition: ObjectMgr.h:409
Definition: ConditionMgr.h:181

References Object::GetEntry(), Unit::HasNpcFlag(), sConditionMgr, sObjectMgr, and UNIT_NPC_FLAG_SPELLCLICK.

Referenced by Unit::BuildValuesUpdate().

◆ CanSeeStartQuest()

bool Player::CanSeeStartQuest ( Quest const *  quest)
238{
239 if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this) && SatisfyQuestClass(quest, false) && SatisfyQuestRace(quest, false) &&
240 SatisfyQuestSkill(quest, false) && SatisfyQuestExclusiveGroup(quest, false) && SatisfyQuestReputation(quest, false) &&
241 SatisfyQuestPreviousQuest(quest, false) && SatisfyQuestNextChain(quest, false) &&
242 SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) &&
243 SatisfyQuestMonth(quest, false) && SatisfyQuestSeasonal(quest, false))
244 {
245 return GetLevel() + sWorld->getIntConfig(CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF) >= quest->GetMinLevel();
246 }
247
248 return false;
249}
@ DISABLE_TYPE_QUEST
Definition: DisableMgr.h:30
@ CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF
Definition: IWorld.h:288
bool IsDisabledFor(DisableType type, uint32 entry, Unit const *unit, uint8 flags)
Definition: DisableMgr.cpp:306
bool SatisfyQuestNextChain(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:1219
bool SatisfyQuestExclusiveGroup(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:1182
bool SatisfyQuestRace(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:1102
bool SatisfyQuestClass(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:1084
bool SatisfyQuestReputation(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:1116
bool SatisfyQuestPreviousQuest(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:998
bool SatisfyQuestSkill(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:946
bool SatisfyQuestPrevChain(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:1239

References CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF, DISABLE_TYPE_QUEST, Unit::GetLevel(), Quest::GetMinLevel(), Quest::GetQuestId(), DisableMgr::IsDisabledFor(), SatisfyQuestClass(), SatisfyQuestDay(), SatisfyQuestExclusiveGroup(), SatisfyQuestMonth(), SatisfyQuestNextChain(), SatisfyQuestPrevChain(), SatisfyQuestPreviousQuest(), SatisfyQuestRace(), SatisfyQuestReputation(), SatisfyQuestSeasonal(), SatisfyQuestSkill(), SatisfyQuestWeek(), and sWorld.

Referenced by npc_wg_quest_giver::GetDialogStatus(), GetQuestDialogStatus(), WorldSession::HandleQuestgiverChooseRewardOpcode(), and WorldSession::HandleQuestgiverCompleteQuest().

◆ CanSeeVendor()

bool Player::CanSeeVendor ( Creature const *  creature) const
14219{
14220 if (!creature->HasNpcFlag(UNIT_NPC_FLAG_VENDOR))
14221 return true;
14222
14223 ConditionList conditions = sConditionMgr->GetConditionsForNpcVendorEvent(creature->GetEntry(), 0);
14224 if (!sConditionMgr->IsObjectMeetToConditions(const_cast<Player*>(this), const_cast<Creature*>(creature), conditions))
14225 {
14226 return false;
14227 }
14228
14229 return true;
14230}

References Object::GetEntry(), Unit::HasNpcFlag(), sConditionMgr, and UNIT_NPC_FLAG_VENDOR.

Referenced by Unit::BuildValuesUpdate().

◆ CanShareQuest()

bool Player::CanShareQuest ( uint32  quest_id) const
1445{
1446 Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id);
1447 if (qInfo && qInfo->HasFlag(QUEST_FLAGS_SHARABLE))
1448 {
1449 QuestStatusMap::const_iterator itr = m_QuestStatus.find(quest_id);
1450 if (itr != m_QuestStatus.end())
1451 {
1452 // in pool and not currently available (wintergrasp weekly, dalaran weekly) - can't share
1453 if (sPoolMgr->IsPartOfAPool<Quest>(quest_id) && !sPoolMgr->IsSpawnedObject<Quest>(quest_id))
1454 {
1456 return false;
1457 }
1458
1459 return true;
1460 }
1461 }
1462 return false;
1463}
#define sPoolMgr
Definition: PoolMgr.h:163
@ QUEST_FLAGS_SHARABLE
Definition: QuestDef.h:135
@ QUEST_PARTY_MSG_CANT_BE_SHARED_TODAY
Definition: QuestDef.h:74
void SendPushToPartyResponse(Player const *player, uint8 msg) const
Definition: PlayerQuest.cpp:2421
bool HasFlag(uint32 flag) const
Definition: QuestDef.h:218

References Quest::HasFlag(), m_QuestStatus, QUEST_FLAGS_SHARABLE, QUEST_PARTY_MSG_CANT_BE_SHARED_TODAY, SendPushToPartyResponse(), sObjectMgr, and sPoolMgr.

Referenced by WorldSession::HandlePushQuestToParty(), and WorldSession::HandleQuestgiverAcceptQuestOpcode().

◆ CanSpeak()

bool Player::CanSpeak ( ) const
70{
71 return GetSession()->m_muteTime <= time (nullptr);
72}
time_t m_muteTime
Definition: WorldSession.h:496

References GetSession(), and WorldSession::m_muteTime.

Referenced by WorldSession::HandleMessagechatOpcode(), and misc_commandscript::HandleUnmuteCommand().

◆ CanStoreItem() [1/2]

◆ CanStoreItem() [2/2]

InventoryResult Player::CanStoreItem ( uint8  bag,
uint8  slot,
ItemPosCountVec dest,
uint32  entry,
uint32  count,
Item pItem = nullptr,
bool  swap = false,
uint32 no_space_count = nullptr 
) const
1130{
1131 LOG_DEBUG("entities.player.items", "STORAGE: CanStoreItem bag = {}, slot = {}, item = {}, count = {}", bag, slot, entry, count);
1132
1133 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(entry);
1134 if (!pProto)
1135 {
1136 if (no_space_count)
1137 *no_space_count = count;
1139 }
1140
1141 if (pItem)
1142 {
1143 // you bad chet0rz, wpe pro
1144 if( bag == NULL_BAG && slot == NULL_SLOT )
1145 if( pItem->IsBag() && pItem->IsNotEmptyBag() )
1147
1148 // Xinef: Removed next loot generated check
1149 if (pItem->GetGUID() == GetLootGUID())
1150 {
1151 if (no_space_count)
1152 *no_space_count = count;
1154 }
1155
1156 if (pItem->IsBindedNotWith(this))
1157 {
1158 if (no_space_count)
1159 *no_space_count = count;
1161 }
1162 }
1163
1164 // check count of items (skip for auto move for same player from bank)
1165 uint32 no_similar_count = 0; // can't store this amount similar items
1166 InventoryResult res = CanTakeMoreSimilarItems(entry, count, pItem, &no_similar_count);
1167 if (res != EQUIP_ERR_OK)
1168 {
1169 if (count == no_similar_count)
1170 {
1171 if (no_space_count)
1172 *no_space_count = no_similar_count;
1173 return res;
1174 }
1175 count -= no_similar_count;
1176 }
1177
1178 // in specific slot
1179 if (bag != NULL_BAG && slot != NULL_SLOT)
1180 {
1181 res = CanStoreItem_InSpecificSlot(bag, slot, dest, pProto, count, swap, pItem);
1182 if (res != EQUIP_ERR_OK)
1183 {
1184 if (no_space_count)
1185 *no_space_count = count + no_similar_count;
1186 return res;
1187 }
1188
1189 if (count == 0)
1190 {
1191 if (no_similar_count == 0)
1192 return EQUIP_ERR_OK;
1193
1194 if (no_space_count)
1195 *no_space_count = count + no_similar_count;
1197 }
1198 }
1199
1200 // not specific slot or have space for partly store only in specific slot
1201
1202 // in specific bag
1203 if (bag != NULL_BAG)
1204 {
1205 // search stack in bag for merge to
1206 if (pProto->Stackable != 1)
1207 {
1208 if (bag == INVENTORY_SLOT_BAG_0) // inventory
1209 {
1210 res = CanStoreItem_InInventorySlots(KEYRING_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, true, pItem, bag, slot);
1211 if (res != EQUIP_ERR_OK)
1212 {
1213 if (no_space_count)
1214 *no_space_count = count + no_similar_count;
1215 return res;
1216 }
1217
1218 if (count == 0)
1219 {
1220 if (no_similar_count == 0)
1221 return EQUIP_ERR_OK;
1222
1223 if (no_space_count)
1224 *no_space_count = count + no_similar_count;
1226 }
1227
1228 res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
1229 if (res != EQUIP_ERR_OK)
1230 {
1231 if (no_space_count)
1232 *no_space_count = count + no_similar_count;
1233 return res;
1234 }
1235
1236 if (count == 0)
1237 {
1238 if (no_similar_count == 0)
1239 return EQUIP_ERR_OK;
1240
1241 if (no_space_count)
1242 *no_space_count = count + no_similar_count;
1244 }
1245 }
1246 else // equipped bag
1247 {
1248 // we need check 2 time (specialized/non_specialized), use NULL_BAG to prevent skipping bag
1249 res = CanStoreItem_InBag(bag, dest, pProto, count, true, false, pItem, NULL_BAG, slot);
1250 if (res != EQUIP_ERR_OK)
1251 res = CanStoreItem_InBag(bag, dest, pProto, count, true, true, pItem, NULL_BAG, slot);
1252
1253 if (res != EQUIP_ERR_OK)
1254 {
1255 if (no_space_count)
1256 *no_space_count = count + no_similar_count;
1257 return res;
1258 }
1259
1260 if (count == 0)
1261 {
1262 if (no_similar_count == 0)
1263 return EQUIP_ERR_OK;
1264
1265 if (no_space_count)
1266 *no_space_count = count + no_similar_count;
1268 }
1269 }
1270 }
1271
1272 // search free slot in bag for place to
1273 if (bag == INVENTORY_SLOT_BAG_0) // inventory
1274 {
1275 // search free slot - keyring case
1276 if (pProto->BagFamily & BAG_FAMILY_MASK_KEYS)
1277 {
1278 uint32 keyringSize = GetMaxKeyringSize();
1279 res = CanStoreItem_InInventorySlots(KEYRING_SLOT_START, KEYRING_SLOT_START + keyringSize, dest, pProto, count, false, pItem, bag, slot);
1280 if (res != EQUIP_ERR_OK)
1281 {
1282 if (no_space_count)
1283 *no_space_count = count + no_similar_count;
1284 return res;
1285 }
1286
1287 if (count == 0)
1288 {
1289 if (no_similar_count == 0)
1290 return EQUIP_ERR_OK;
1291
1292 if (no_space_count)
1293 *no_space_count = count + no_similar_count;
1295 }
1296
1297 res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
1298 if (res != EQUIP_ERR_OK)
1299 {
1300 if (no_space_count)
1301 *no_space_count = count + no_similar_count;
1302 return res;
1303 }
1304
1305 if (count == 0)
1306 {
1307 if (no_similar_count == 0)
1308 return EQUIP_ERR_OK;
1309
1310 if (no_space_count)
1311 *no_space_count = count + no_similar_count;
1313 }
1314 }
1315 else if (pProto->IsCurrencyToken())
1316 {
1317 res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
1318 if (res != EQUIP_ERR_OK)
1319 {
1320 if (no_space_count)
1321 *no_space_count = count + no_similar_count;
1322 return res;
1323 }
1324
1325 if (count == 0)
1326 {
1327 if (no_similar_count == 0)
1328 return EQUIP_ERR_OK;
1329
1330 if (no_space_count)
1331 *no_space_count = count + no_similar_count;
1333 }
1334 }
1335
1336 res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
1337 if (res != EQUIP_ERR_OK)
1338 {
1339 if (no_space_count)
1340 *no_space_count = count + no_similar_count;
1341 return res;
1342 }
1343
1344 if (count == 0)
1345 {
1346 if (no_similar_count == 0)
1347 return EQUIP_ERR_OK;
1348
1349 if (no_space_count)
1350 *no_space_count = count + no_similar_count;
1352 }
1353 }
1354 else // equipped bag
1355 {
1356 res = CanStoreItem_InBag(bag, dest, pProto, count, false, false, pItem, NULL_BAG, slot);
1357 if (res != EQUIP_ERR_OK)
1358 res = CanStoreItem_InBag(bag, dest, pProto, count, false, true, pItem, NULL_BAG, slot);
1359
1360 if (res != EQUIP_ERR_OK)
1361 {
1362 if (no_space_count)
1363 *no_space_count = count + no_similar_count;
1364 return res;
1365 }
1366
1367 if (count == 0)
1368 {
1369 if (no_similar_count == 0)
1370 return EQUIP_ERR_OK;
1371
1372 if (no_space_count)
1373 *no_space_count = count + no_similar_count;
1375 }
1376 }
1377 }
1378
1379 // not specific bag or have space for partly store only in specific bag
1380
1381 // search stack for merge to
1382 if (pProto->Stackable != 1)
1383 {
1384 res = CanStoreItem_InInventorySlots(KEYRING_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, true, pItem, bag, slot);
1385 if (res != EQUIP_ERR_OK)
1386 {
1387 if (no_space_count)
1388 *no_space_count = count + no_similar_count;
1389 return res;
1390 }
1391
1392 if (count == 0)
1393 {
1394 if (no_similar_count == 0)
1395 return EQUIP_ERR_OK;
1396
1397 if (no_space_count)
1398 *no_space_count = count + no_similar_count;
1400 }
1401
1402 res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
1403 if (res != EQUIP_ERR_OK)
1404 {
1405 if (no_space_count)
1406 *no_space_count = count + no_similar_count;
1407 return res;
1408 }
1409
1410 if (count == 0)
1411 {
1412 if (no_similar_count == 0)
1413 return EQUIP_ERR_OK;
1414
1415 if (no_space_count)
1416 *no_space_count = count + no_similar_count;
1418 }
1419
1420 if (pProto->BagFamily)
1421 {
1423 {
1424 res = CanStoreItem_InBag(i, dest, pProto, count, true, false, pItem, bag, slot);
1425 if (res != EQUIP_ERR_OK)
1426 continue;
1427
1428 if (count == 0)
1429 {
1430 if (no_similar_count == 0)
1431 return EQUIP_ERR_OK;
1432
1433 if (no_space_count)
1434 *no_space_count = count + no_similar_count;
1436 }
1437 }
1438 }
1439
1441 {
1442 res = CanStoreItem_InBag(i, dest, pProto, count, true, true, pItem, bag, slot);
1443 if (res != EQUIP_ERR_OK)
1444 continue;
1445
1446 if (count == 0)
1447 {
1448 if (no_similar_count == 0)
1449 return EQUIP_ERR_OK;
1450
1451 if (no_space_count)
1452 *no_space_count = count + no_similar_count;
1454 }
1455 }
1456 }
1457
1458 // search free slot - special bag case
1459 if (pProto->BagFamily)
1460 {
1461 if (pProto->BagFamily & BAG_FAMILY_MASK_KEYS)
1462 {
1463 uint32 keyringSize = GetMaxKeyringSize();
1464 res = CanStoreItem_InInventorySlots(KEYRING_SLOT_START, KEYRING_SLOT_START + keyringSize, dest, pProto, count, false, pItem, bag, slot);
1465 if (res != EQUIP_ERR_OK)
1466 {
1467 if (no_space_count)
1468 *no_space_count = count + no_similar_count;
1469 return res;
1470 }
1471
1472 if (count == 0)
1473 {
1474 if (no_similar_count == 0)
1475 return EQUIP_ERR_OK;
1476
1477 if (no_space_count)
1478 *no_space_count = count + no_similar_count;
1480 }
1481 }
1482 else if (pProto->IsCurrencyToken())
1483 {
1484 res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
1485 if (res != EQUIP_ERR_OK)
1486 {
1487 if (no_space_count)
1488 *no_space_count = count + no_similar_count;
1489 return res;
1490 }
1491
1492 if (count == 0)
1493 {
1494 if (no_similar_count == 0)
1495 return EQUIP_ERR_OK;
1496
1497 if (no_space_count)
1498 *no_space_count = count + no_similar_count;
1500 }
1501 }
1502
1504 {
1505 res = CanStoreItem_InBag(i, dest, pProto, count, false, false, pItem, bag, slot);
1506 if (res != EQUIP_ERR_OK)
1507 continue;
1508
1509 if (count == 0)
1510 {
1511 if (no_similar_count == 0)
1512 return EQUIP_ERR_OK;
1513
1514 if (no_space_count)
1515 *no_space_count = count + no_similar_count;
1517 }
1518 }
1519 }
1520
1521 if (pItem && pItem->IsNotEmptyBag())
1523
1524 // search free slot
1525 res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
1526 if (res != EQUIP_ERR_OK)
1527 {
1528 if (no_space_count)
1529 *no_space_count = count + no_similar_count;
1530 return res;
1531 }
1532
1533 if (count == 0)
1534 {
1535 if (no_similar_count == 0)
1536 return EQUIP_ERR_OK;
1537
1538 if (no_space_count)
1539 *no_space_count = count + no_similar_count;
1541 }
1542
1544 {
1545 res = CanStoreItem_InBag(i, dest, pProto, count, false, true, pItem, bag, slot);
1546 if (res != EQUIP_ERR_OK)
1547 continue;
1548
1549 if (count == 0)
1550 {
1551 if (no_similar_count == 0)
1552 return EQUIP_ERR_OK;
1553
1554 if (no_space_count)
1555 *no_space_count = count + no_similar_count;
1557 }
1558 }
1559
1560 if (no_space_count)
1561 *no_space_count = count + no_similar_count;
1562
1564}
@ EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS
Definition: Item.h:72
@ BAG_FAMILY_MASK_KEYS
Definition: ItemTemplate.h:244
@ INVENTORY_SLOT_ITEM_START
Definition: Player.h:706
@ INVENTORY_SLOT_ITEM_END
Definition: Player.h:707
bool IsCurrencyToken() const
Definition: ItemTemplate.h:736
uint32 GetMaxKeyringSize() const
Definition: Player.h:1334

References BAG_FAMILY_MASK_KEYS, ItemTemplate::BagFamily, CanStoreItem_InBag(), CanStoreItem_InInventorySlots(), CanStoreItem_InSpecificSlot(), CanTakeMoreSimilarItems(), CURRENCYTOKEN_SLOT_END, CURRENCYTOKEN_SLOT_START, EQUIP_ERR_ALREADY_LOOTED, EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS, EQUIP_ERR_CANT_CARRY_MORE_OF_THIS, EQUIP_ERR_DONT_OWN_THAT_ITEM, EQUIP_ERR_INVENTORY_FULL, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG, EQUIP_ERR_OK, Object::GetGUID(), GetLootGUID(), GetMaxKeyringSize(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, Item::IsBag(), Item::IsBindedNotWith(), ItemTemplate::IsCurrencyToken(), Item::IsNotEmptyBag(), KEYRING_SLOT_START, LOG_DEBUG, NULL_BAG, NULL_SLOT, sObjectMgr, and ItemTemplate::Stackable.

◆ CanStoreItem_InBag()

InventoryResult Player::CanStoreItem_InBag ( uint8  bag,
ItemPosCountVec dest,
ItemTemplate const *  pProto,
uint32 count,
bool  merge,
bool  non_specialized,
Item pSrcItem,
uint8  skip_bag,
uint8  skip_slot 
) const
private
1009{
1010 // skip specific bag already processed in first called CanStoreItem_InBag
1011 if (bag == skip_bag)
1013
1014 // skip not existed bag or self targeted bag
1015 Bag* pBag = GetBagByPos(bag);
1016 if (!pBag || pBag == pSrcItem || (pSrcItem && (pSrcItem->GetGUID() == pBag->GetGUID())) )
1018
1019 if (pSrcItem && pSrcItem->IsNotEmptyBag())
1021
1022 ItemTemplate const* pBagProto = pBag->GetTemplate();
1023 if (!pBagProto)
1025
1026 // specialized bag mode or non-specilized
1027 if (non_specialized != (pBagProto->Class == ITEM_CLASS_CONTAINER && pBagProto->SubClass == ITEM_SUBCLASS_CONTAINER))
1029
1030 if (!ItemCanGoIntoBag(pProto, pBagProto))
1032
1033 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
1034 {
1035 // skip specific slot already processed in first called CanStoreItem_InSpecificSlot
1036 if (j == skip_slot)
1037 continue;
1038
1039 Item* pItem2 = GetItemByPos(bag, j);
1040
1041 // ignore move item (this slot will be empty at move)
1042 if (pItem2 == pSrcItem)
1043 pItem2 = nullptr;
1044
1045 // if merge skip empty, if !merge skip non-empty
1046 if ((pItem2 != nullptr) != merge)
1047 continue;
1048
1049 uint32 need_space = pProto->GetMaxStackSize();
1050
1051 if (pItem2)
1052 {
1053 // can be merged at least partly
1054 uint8 res = pItem2->CanBeMergedPartlyWith(pProto);
1055 if (res != EQUIP_ERR_OK)
1056 continue;
1057
1058 // descrease at current stacksize
1059 need_space -= pItem2->GetCount();
1060 }
1061
1062 if (need_space > count)
1063 need_space = count;
1064
1065 ItemPosCount newPosition = ItemPosCount((bag << 8) | j, need_space);
1066 if (!newPosition.isContainedIn(dest))
1067 {
1068 dest.push_back(newPosition);
1069 count -= need_space;
1070
1071 if (count == 0)
1072 return EQUIP_ERR_OK;
1073 }
1074 }
1075 return EQUIP_ERR_OK;
1076}
bool ItemCanGoIntoBag(ItemTemplate const *pProto, ItemTemplate const *pBagProto)
Definition: Item.cpp:177
@ EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG
Definition: Item.h:56
@ ITEM_SUBCLASS_CONTAINER
Definition: ItemTemplate.h:338
@ ITEM_CLASS_CONTAINER
Definition: ItemTemplate.h:301
uint32 GetBagSize() const
Definition: Bag.h:48
InventoryResult CanBeMergedPartlyWith(ItemTemplate const *proto) const
Definition: Item.cpp:868
Definition: Player.h:766
bool isContainedIn(std::vector< ItemPosCount > const &vec) const
Definition: Player.cpp:13064

References Item::CanBeMergedPartlyWith(), ItemTemplate::Class, EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS, EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG, EQUIP_ERR_OK, GetBagByPos(), Bag::GetBagSize(), Item::GetCount(), Object::GetGUID(), GetItemByPos(), ItemTemplate::GetMaxStackSize(), Item::GetTemplate(), ItemPosCount::isContainedIn(), Item::IsNotEmptyBag(), ITEM_CLASS_CONTAINER, ITEM_SUBCLASS_CONTAINER, ItemCanGoIntoBag(), and ItemTemplate::SubClass.

Referenced by CanBankItem(), and CanStoreItem().

◆ CanStoreItem_InInventorySlots()

InventoryResult Player::CanStoreItem_InInventorySlots ( uint8  slot_begin,
uint8  slot_end,
ItemPosCountVec dest,
ItemTemplate const *  pProto,
uint32 count,
bool  merge,
Item pSrcItem,
uint8  skip_bag,
uint8  skip_slot 
) const
private
1079{
1080 //this is never called for non-bag slots so we can do this
1081 if (pSrcItem && pSrcItem->IsNotEmptyBag())
1083
1084 for (uint32 j = slot_begin; j < slot_end; j++)
1085 {
1086 // skip specific slot already processed in first called CanStoreItem_InSpecificSlot
1087 if (INVENTORY_SLOT_BAG_0 == skip_bag && j == skip_slot)
1088 continue;
1089
1091
1092 // ignore move item (this slot will be empty at move)
1093 if (pItem2 == pSrcItem)
1094 pItem2 = nullptr;
1095
1096 // if merge skip empty, if !merge skip non-empty
1097 if ((pItem2 != nullptr) != merge)
1098 continue;
1099
1100 uint32 need_space = pProto->GetMaxStackSize();
1101
1102 if (pItem2)
1103 {
1104 // can be merged at least partly
1105 uint8 res = pItem2->CanBeMergedPartlyWith(pProto);
1106 if (res != EQUIP_ERR_OK)
1107 continue;
1108
1109 // descrease at current stacksize
1110 need_space -= pItem2->GetCount();
1111 }
1112
1113 if (need_space > count)
1114 need_space = count;
1115
1116 ItemPosCount newPosition = ItemPosCount((INVENTORY_SLOT_BAG_0 << 8) | j, need_space);
1117 if (!newPosition.isContainedIn(dest))
1118 {
1119 dest.push_back(newPosition);
1120 count -= need_space;
1121
1122 if (count == 0)
1123 return EQUIP_ERR_OK;
1124 }
1125 }
1126 return EQUIP_ERR_OK;
1127}

References Item::CanBeMergedPartlyWith(), EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS, EQUIP_ERR_OK, Item::GetCount(), GetItemByPos(), ItemTemplate::GetMaxStackSize(), INVENTORY_SLOT_BAG_0, ItemPosCount::isContainedIn(), and Item::IsNotEmptyBag().

Referenced by CanBankItem(), and CanStoreItem().

◆ CanStoreItem_InSpecificSlot()

InventoryResult Player::CanStoreItem_InSpecificSlot ( uint8  bag,
uint8  slot,
ItemPosCountVec dest,
ItemTemplate const *  pProto,
uint32 count,
bool  swap,
Item pSrcItem 
) const
private
938{
939 Item* pItem2 = GetItemByPos(bag, slot);
940
941 // ignore move item (this slot will be empty at move)
942 if (pItem2 == pSrcItem)
943 pItem2 = nullptr;
944
945 uint32 need_space;
946
947 // empty specific slot - check item fit to slot
948 if (!pItem2 || swap)
949 {
950 if (bag == INVENTORY_SLOT_BAG_0)
951 {
952 // keyring case
953 if (slot >= KEYRING_SLOT_START && slot < KEYRING_SLOT_START + GetMaxKeyringSize() && !(pProto->BagFamily & BAG_FAMILY_MASK_KEYS))
955
956 // currencytoken case
957 if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(pProto->IsCurrencyToken()))
959
960 // prevent cheating
961 if ((slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) || slot >= PLAYER_SLOT_END)
963 }
964 else
965 {
966 Bag* pBag = GetBagByPos(bag);
967 if (!pBag)
969
970 ItemTemplate const* pBagProto = pBag->GetTemplate();
971 if (!pBagProto)
973
974 if (slot >= pBagProto->ContainerSlots)
976
977 if (!ItemCanGoIntoBag(pProto, pBagProto))
979 }
980
981 // non empty stack with space
982 need_space = pProto->GetMaxStackSize();
983 }
984 // non empty slot, check item type
985 else
986 {
987 // can be merged at least partly
988 InventoryResult res = pItem2->CanBeMergedPartlyWith(pProto);
989 if (res != EQUIP_ERR_OK)
990 return res;
991
992 // free stack space or infinity
993 need_space = pProto->GetMaxStackSize() - pItem2->GetCount();
994 }
995
996 if (need_space > count)
997 need_space = count;
998
999 ItemPosCount newPosition = ItemPosCount((bag << 8) | slot, need_space);
1000 if (!newPosition.isContainedIn(dest))
1001 {
1002 dest.push_back(newPosition);
1003 count -= need_space;
1004 }
1005 return EQUIP_ERR_OK;
1006}
uint32 ContainerSlots
Definition: ItemTemplate.h:655

References BAG_FAMILY_MASK_KEYS, ItemTemplate::BagFamily, BUYBACK_SLOT_END, BUYBACK_SLOT_START, Item::CanBeMergedPartlyWith(), ItemTemplate::ContainerSlots, CURRENCYTOKEN_SLOT_END, CURRENCYTOKEN_SLOT_START, EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG, EQUIP_ERR_OK, GetBagByPos(), Item::GetCount(), GetItemByPos(), GetMaxKeyringSize(), ItemTemplate::GetMaxStackSize(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, ItemPosCount::isContainedIn(), ItemTemplate::IsCurrencyToken(), ItemCanGoIntoBag(), KEYRING_SLOT_START, and PLAYER_SLOT_END.

Referenced by CanBankItem(), and CanStoreItem().

◆ CanStoreItems()

InventoryResult Player::CanStoreItems ( Item **  pItem,
int32  count 
) const
1568{
1569 Item* pItem2;
1570
1571 // fill space table
1574 int inv_keys[KEYRING_SLOT_END - KEYRING_SLOT_START];
1576
1577 memset(inv_slot_items, 0, sizeof(int) * (INVENTORY_SLOT_ITEM_END - INVENTORY_SLOT_ITEM_START));
1578 memset(inv_bags, 0, sizeof(int) * (INVENTORY_SLOT_BAG_END - INVENTORY_SLOT_BAG_START) * MAX_BAG_SIZE);
1579 memset(inv_keys, 0, sizeof(int) * (KEYRING_SLOT_END - KEYRING_SLOT_START));
1580 memset(inv_tokens, 0, sizeof(int) * (CURRENCYTOKEN_SLOT_END - CURRENCYTOKEN_SLOT_START));
1581
1583 {
1585 if (pItem2 && !pItem2->IsInTrade())
1586 inv_slot_items[i - INVENTORY_SLOT_ITEM_START] = pItem2->GetCount();
1587 }
1588
1589 for (uint8 i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++)
1590 {
1592 if (pItem2 && !pItem2->IsInTrade())
1593 inv_keys[i - KEYRING_SLOT_START] = pItem2->GetCount();
1594 }
1595
1597 {
1599 if (pItem2 && !pItem2->IsInTrade())
1600 inv_tokens[i - CURRENCYTOKEN_SLOT_START] = pItem2->GetCount();
1601 }
1602
1604 if (Bag* pBag = GetBagByPos(i))
1605 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
1606 {
1607 pItem2 = GetItemByPos(i, j);
1608 if (pItem2 && !pItem2->IsInTrade())
1609 inv_bags[i - INVENTORY_SLOT_BAG_START][j] = pItem2->GetCount();
1610 }
1611
1612 // check free space for all items
1613 for (int k = 0; k < count; ++k)
1614 {
1615 Item* pItem = pItems[k];
1616
1617 // no item
1618 if (!pItem)
1619 continue;
1620
1621 LOG_DEBUG("entities.player.items", "STORAGE: CanStoreItems {}. item = {}, count = {}", k + 1, pItem->GetEntry(), pItem->GetCount());
1622 ItemTemplate const* pProto = pItem->GetTemplate();
1623
1624 // strange item
1625 if (!pProto)
1627
1628 // Xinef: Removed next loot generated check
1629 if (pItem->GetGUID() == GetLootGUID())
1631
1632 // item it 'bind'
1633 if (pItem->IsBindedNotWith(this))
1635
1636 ItemTemplate const* pBagProto;
1637
1638 // item is 'one item only'
1640 if (res != EQUIP_ERR_OK)
1641 return res;
1642
1643 // search stack for merge to
1644 if (pProto->Stackable != 1)
1645 {
1646 bool b_found = false;
1647
1648 for (uint8 t = KEYRING_SLOT_START; t < KEYRING_SLOT_END; ++t)
1649 {
1651 if (pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_keys[t - KEYRING_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
1652 {
1653 inv_keys[t - KEYRING_SLOT_START] += pItem->GetCount();
1654 b_found = true;
1655 break;
1656 }
1657 }
1658 if (b_found)
1659 continue;
1660
1661 for (int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t)
1662 {
1664 if (pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_tokens[t - CURRENCYTOKEN_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
1665 {
1666 inv_tokens[t - CURRENCYTOKEN_SLOT_START] += pItem->GetCount();
1667 b_found = true;
1668 break;
1669 }
1670 }
1671 if (b_found)
1672 continue;
1673
1675 {
1677 if (pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_slot_items[t - INVENTORY_SLOT_ITEM_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
1678 {
1679 inv_slot_items[t - INVENTORY_SLOT_ITEM_START] += pItem->GetCount();
1680 b_found = true;
1681 break;
1682 }
1683 }
1684 if (b_found)
1685 continue;
1686
1687 for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
1688 {
1689 if (Bag* bag = GetBagByPos(t))
1690 {
1691 if (ItemCanGoIntoBag(pItem->GetTemplate(), bag->GetTemplate()))
1692 {
1693 for (uint32 j = 0; j < bag->GetBagSize(); j++)
1694 {
1695 pItem2 = GetItemByPos(t, j);
1696 if (pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_bags[t - INVENTORY_SLOT_BAG_START][j] + pItem->GetCount() <= pProto->GetMaxStackSize())
1697 {
1698 inv_bags[t - INVENTORY_SLOT_BAG_START][j] += pItem->GetCount();
1699 b_found = true;
1700 break;
1701 }
1702 }
1703 }
1704 }
1705 }
1706 if (b_found)
1707 continue;
1708 }
1709
1710 // special bag case
1711 if (pProto->BagFamily)
1712 {
1713 bool b_found = false;
1714 if (pProto->BagFamily & BAG_FAMILY_MASK_KEYS)
1715 {
1716 uint32 keyringSize = GetMaxKeyringSize();
1717 for (uint32 t = KEYRING_SLOT_START; t < KEYRING_SLOT_START + keyringSize; ++t)
1718 {
1719 if (inv_keys[t - KEYRING_SLOT_START] == 0)
1720 {
1721 inv_keys[t - KEYRING_SLOT_START] = 1;
1722 b_found = true;
1723 break;
1724 }
1725 }
1726 }
1727
1728 if (b_found)
1729 continue;
1730
1731 if (pProto->IsCurrencyToken())
1732 {
1734 {
1735 if (inv_tokens[t - CURRENCYTOKEN_SLOT_START] == 0)
1736 {
1737 inv_tokens[t - CURRENCYTOKEN_SLOT_START] = 1;
1738 b_found = true;
1739 break;
1740 }
1741 }
1742 }
1743
1744 if (b_found)
1745 continue;
1746
1747 for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
1748 {
1749 if (Bag* bag = GetBagByPos(t))
1750 {
1751 pBagProto = bag->GetTemplate();
1752
1753 // not plain container check
1754 if (pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER) &&
1755 ItemCanGoIntoBag(pProto, pBagProto))
1756 {
1757 for (uint32 j = 0; j < bag->GetBagSize(); j++)
1758 {
1759 if (inv_bags[t - INVENTORY_SLOT_BAG_START][j] == 0)
1760 {
1761 inv_bags[t - INVENTORY_SLOT_BAG_START][j] = 1;
1762 b_found = true;
1763 break;
1764 }
1765 }
1766 }
1767 }
1768 }
1769 if (b_found)
1770 continue;
1771 }
1772
1773 // search free slot
1774 bool b_found = false;
1776 {
1777 if (inv_slot_items[t - INVENTORY_SLOT_ITEM_START] == 0)
1778 {
1779 inv_slot_items[t - INVENTORY_SLOT_ITEM_START] = 1;
1780 b_found = true;
1781 break;
1782 }
1783 }
1784 if (b_found)
1785 continue;
1786
1787 // search free slot in bags
1788 for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
1789 {
1790 if (Bag* bag = GetBagByPos(t))
1791 {
1792 pBagProto = bag->GetTemplate();
1793
1794 // special bag already checked
1795 if (pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER))
1796 continue;
1797
1798 for (uint32 j = 0; j < bag->GetBagSize(); j++)
1799 {
1800 if (inv_bags[t - INVENTORY_SLOT_BAG_START][j] == 0)
1801 {
1802 inv_bags[t - INVENTORY_SLOT_BAG_START][j] = 1;
1803 b_found = true;
1804 break;
1805 }
1806 }
1807 }
1808 }
1809
1810 // no free slot found?
1811 if (!b_found)
1813 }
1814
1815 return EQUIP_ERR_OK;
1816}
@ KEYRING_SLOT_END
Definition: Player.h:732
bool IsInTrade() const
Definition: Item.h:254

References BAG_FAMILY_MASK_KEYS, ItemTemplate::BagFamily, Item::CanBeMergedPartlyWith(), CanTakeMoreSimilarItems(), ItemTemplate::Class, CURRENCYTOKEN_SLOT_END, CURRENCYTOKEN_SLOT_START, EQUIP_ERR_ALREADY_LOOTED, EQUIP_ERR_DONT_OWN_THAT_ITEM, EQUIP_ERR_INVENTORY_FULL, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_OK, GetBagByPos(), Item::GetCount(), Object::GetEntry(), Object::GetGUID(), GetItemByPos(), GetLootGUID(), GetMaxKeyringSize(), ItemTemplate::GetMaxStackSize(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, Item::IsBindedNotWith(), ItemTemplate::IsCurrencyToken(), Item::IsInTrade(), ITEM_CLASS_CONTAINER, ITEM_SUBCLASS_CONTAINER, ItemCanGoIntoBag(), KEYRING_SLOT_END, KEYRING_SLOT_START, LOG_DEBUG, MAX_BAG_SIZE, ItemTemplate::Stackable, and ItemTemplate::SubClass.

Referenced by WorldSession::HandleAcceptTradeOpcode().

◆ CanStoreNewItem()

◆ CanTakeMoreSimilarItems() [1/3]

InventoryResult Player::CanTakeMoreSimilarItems ( Item pItem) const
inline

◆ CanTakeMoreSimilarItems() [2/3]

InventoryResult Player::CanTakeMoreSimilarItems ( uint32  entry,
uint32  count 
) const
inline
1259{ return CanTakeMoreSimilarItems(entry, count, nullptr); }

References CanTakeMoreSimilarItems().

Referenced by CanTakeMoreSimilarItems().

◆ CanTakeMoreSimilarItems() [3/3]

InventoryResult Player::CanTakeMoreSimilarItems ( uint32  entry,
uint32  count,
Item pItem,
uint32 no_space_count = nullptr 
) const
829{
830 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(entry);
831 if (!pProto)
832 {
833 if (no_space_count)
834 *no_space_count = count;
836 }
837
838 // no maximum
839 if ((pProto->MaxCount <= 0 && pProto->ItemLimitCategory == 0) || pProto->MaxCount == 2147483647)
840 return EQUIP_ERR_OK;
841
842 if (pProto->MaxCount > 0)
843 {
844 uint32 curcount = GetItemCount(pProto->ItemId, true, pItem);
845 if (curcount + count > uint32(pProto->MaxCount))
846 {
847 if (no_space_count)
848 *no_space_count = count + curcount - pProto->MaxCount;
850 }
851 }
852
853 // check unique-equipped limit
854 if (pProto->ItemLimitCategory)
855 {
856 ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(pProto->ItemLimitCategory);
857 if (!limitEntry)
858 {
859 if (no_space_count)
860 *no_space_count = count;
862 }
863
864 if (limitEntry->mode == ITEM_LIMIT_CATEGORY_MODE_HAVE)
865 {
866 uint32 curcount = GetItemCountWithLimitCategory(pProto->ItemLimitCategory, pItem);
867 if (curcount + count > uint32(limitEntry->maxCount))
868 {
869 if (no_space_count)
870 *no_space_count = count + curcount - limitEntry->maxCount;
872 }
873 }
874 }
875
876 return EQUIP_ERR_OK;
877}
@ EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED
Definition: Item.h:124
@ ITEM_LIMIT_CATEGORY_MODE_HAVE
Definition: DBCEnums.h:387
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item *skipItem=nullptr) const
Definition: PlayerStorage.cpp:400
uint32 mode
Definition: DBCStructure.h:1192

References EQUIP_ERR_CANT_CARRY_MORE_OF_THIS, EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED, EQUIP_ERR_OK, GetItemCount(), GetItemCountWithLimitCategory(), ITEM_LIMIT_CATEGORY_MODE_HAVE, ItemTemplate::ItemId, ItemTemplate::ItemLimitCategory, ItemTemplate::MaxCount, ItemLimitCategoryEntry::maxCount, ItemLimitCategoryEntry::mode, sItemLimitCategoryStore, and sObjectMgr.

◆ CanTakeQuest()

bool Player::CanTakeQuest ( Quest const *  quest,
bool  msg 
)
252{
253 return !DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this)
254 && SatisfyQuestStatus(quest, msg) && SatisfyQuestExclusiveGroup(quest, msg)
255 && SatisfyQuestClass(quest, msg) && SatisfyQuestRace(quest, msg) && SatisfyQuestLevel(quest, msg)
256 && SatisfyQuestSkill(quest, msg) && SatisfyQuestReputation(quest, msg)
257 && SatisfyQuestPreviousQuest(quest, msg) && SatisfyQuestTimed(quest, msg)
258 && SatisfyQuestNextChain(quest, msg) && SatisfyQuestPrevChain(quest, msg)
259 && SatisfyQuestDay(quest, msg) && SatisfyQuestWeek(quest, msg)
260 && SatisfyQuestMonth(quest, msg) && SatisfyQuestSeasonal(quest, msg)
261 && SatisfyQuestConditions(quest, msg);
262}
bool SatisfyQuestConditions(Quest const *qInfo, bool msg)
Definition: PlayerQuest.cpp:1158
bool SatisfyQuestTimed(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:1171
bool SatisfyQuestLevel(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:966
bool SatisfyQuestStatus(Quest const *qInfo, bool msg) const
Definition: PlayerQuest.cpp:1147

References DISABLE_TYPE_QUEST, Quest::GetQuestId(), DisableMgr::IsDisabledFor(), SatisfyQuestClass(), SatisfyQuestConditions(), SatisfyQuestDay(), SatisfyQuestExclusiveGroup(), SatisfyQuestLevel(), SatisfyQuestMonth(), SatisfyQuestNextChain(), SatisfyQuestPrevChain(), SatisfyQuestPreviousQuest(), SatisfyQuestRace(), SatisfyQuestReputation(), SatisfyQuestSeasonal(), SatisfyQuestSkill(), SatisfyQuestStatus(), SatisfyQuestTimed(), and SatisfyQuestWeek().

Referenced by CanCompleteQuest(), CanCompleteRepeatableQuest(), Spell::EffectQuestComplete(), Spell::EffectQuestStart(), npc_wg_quest_giver::GetDialogStatus(), GetQuestDialogStatus(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleQuestConfirmAccept(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverQueryQuestOpcode(), npc_wg_quest_giver::OnGossipHello(), PrepareQuestMenu(), SendPreparedQuest(), and npc_costumed_orphan_matron::sGossipHello().

◆ CanTameExoticPets()

bool Player::CanTameExoticPets ( ) const
inline

◆ CanTeleport()

bool Player::CanTeleport ( )
inline
2460{ return m_canTeleport; }

References m_canTeleport.

◆ CanTitanGrip()

bool Player::CanTitanGrip ( ) const
inline

◆ CanUnequipItem()

InventoryResult Player::CanUnequipItem ( uint16  src,
bool  swap 
) const
2005{
2006 if (!sScriptMgr->CanUnequipItem(const_cast<Player*>(this), pos, swap))
2008
2009 // Applied only to equipped items and bank bags
2010 if (!IsEquipmentPos(pos) && !IsBagPos(pos))
2011 return EQUIP_ERR_OK;
2012
2013 Item* pItem = GetItemByPos(pos);
2014
2015 // Applied only to existed equipped item
2016 if (!pItem)
2017 return EQUIP_ERR_OK;
2018
2019 LOG_DEBUG("entities.player.items", "STORAGE: CanUnequipItem slot = {}, item = {}, count = {}", pos, pItem->GetEntry(), pItem->GetCount());
2020
2021 ItemTemplate const* pProto = pItem->GetTemplate();
2022 if (!pProto)
2024
2025 // item used
2026 if (pItem->m_lootGenerated)
2028
2029 // do not allow unequipping gear except weapons, offhands, projectiles, relics in
2030 // - combat
2031 // - in-progress arenas
2032 if (!pProto->CanChangeEquipStateInCombat())
2033 {
2034 if (IsInCombat())
2036
2037 if (Battleground* bg = GetBattleground())
2038 if (bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS)
2040 }
2041
2042 // Xinef: dont allow to unequip items on disarmed slot
2045
2046 if (!swap && pItem->IsNotEmptyBag())
2048
2049 return EQUIP_ERR_OK;
2050}

References ItemTemplate::CanChangeEquipStateInCombat(), Unit::CanUseAttackType(), EQUIP_ERR_ALREADY_LOOTED, EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS, EQUIP_ERR_CANT_DO_RIGHT_NOW, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_NOT_DURING_ARENA_MATCH, EQUIP_ERR_NOT_IN_COMBAT, EQUIP_ERR_NOT_WHILE_DISARMED, EQUIP_ERR_OK, GetAttackBySlot(), GetBattleground(), Item::GetCount(), Object::GetEntry(), GetItemByPos(), Item::GetSlot(), Item::GetTemplate(), IsBagPos(), IsEquipmentPos(), Unit::IsInCombat(), Item::IsNotEmptyBag(), LOG_DEBUG, Item::m_lootGenerated, sScriptMgr, and STATUS_IN_PROGRESS.

Referenced by CanEquipItem(), CanUnequipItems(), DestroyItemCount(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleAutoStoreBagItemOpcode(), WorldSession::HandleDestroyItemOpcode(), WorldSession::HandleEquipmentSetUse(), and SwapItem().

◆ CanUnequipItems()

InventoryResult Player::CanUnequipItems ( uint32  item,
uint32  count 
) const
302{
303 uint32 tempcount = 0;
304
306
308 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
309 if (pItem->GetEntry() == item)
310 {
312 if (ires == EQUIP_ERR_OK)
313 {
314 tempcount += pItem->GetCount();
315 if (tempcount >= count)
316 return EQUIP_ERR_OK;
317 }
318 else
319 res = ires;
320 }
321
323 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
324 if (pItem->GetEntry() == item)
325 {
326 tempcount += pItem->GetCount();
327 if (tempcount >= count)
328 return EQUIP_ERR_OK;
329 }
330
332 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
333 if (pItem->GetEntry() == item)
334 {
335 tempcount += pItem->GetCount();
336 if (tempcount >= count)
337 return EQUIP_ERR_OK;
338 }
339
341 if (Bag* pBag = GetBagByPos(i))
342 for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
343 if (Item* pItem = GetItemByPos(i, j))
344 if (pItem->GetEntry() == item)
345 {
346 tempcount += pItem->GetCount();
347 if (tempcount >= count)
348 return EQUIP_ERR_OK;
349 }
350
351 // not found req. item count and have unequippable items
352 return res;
353}
@ EQUIPMENT_SLOT_START
Definition: Player.h:675

References CanUnequipItem(), CURRENCYTOKEN_SLOT_END, EQUIP_ERR_OK, EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, and KEYRING_SLOT_START.

Referenced by TakeQuestSourceItem().

◆ CanUninviteFromGroup()

PartyResult Player::CanUninviteFromGroup ( ObjectGuid  targetPlayerGUID = ObjectGuid::Empty) const
Todo:
: Should also be sent when anyone has recently left combat, with an aprox ~5 seconds timer.
12927{
12928 Group const* grp = GetGroup();
12929 if (!grp)
12930 return ERR_NOT_IN_GROUP;
12931
12932 if (grp->isLFGGroup(true))
12933 {
12934 ObjectGuid gguid = grp->GetGUID();
12935 if (!sLFGMgr->GetKicksLeft(gguid))
12937
12938 lfg::LfgState state = sLFGMgr->GetState(gguid);
12939 if (state == lfg::LFG_STATE_BOOT)
12941
12944
12947
12948 if (grp->isRollLootActive())
12950
12952 for (GroupReference const* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next())
12953 if (itr->GetSource() && itr->GetSource()->IsInMap(this) && itr->GetSource()->IsInCombat())
12955
12956 if (Player* target = ObjectAccessor::FindConnectedPlayer(targetPlayerGUID))
12957 {
12958 if (Aura* dungeonCooldownAura = target->GetAura(lfg::LFG_SPELL_DUNGEON_COOLDOWN))
12959 {
12960 int32 elapsedTime = dungeonCooldownAura->GetMaxDuration() - dungeonCooldownAura->GetDuration();
12961 if (static_cast<int32>(sWorld->getIntConfig(CONFIG_LFG_KICK_PREVENTION_TIMER)) > elapsedTime)
12962 {
12964 }
12965 }
12966 }
12967
12968 /* Missing support for these types
12969 return ERR_PARTY_LFG_BOOT_COOLDOWN_S;
12970 */
12971 }
12972 else
12973 {
12974 if (!grp->IsLeader(GetGUID()) && !grp->IsAssistant(GetGUID()))
12975 return ERR_NOT_LEADER;
12976
12977 if (InBattleground())
12978 return ERR_INVITE_RESTRICTED;
12979 }
12980
12981 return ERR_PARTY_RESULT_OK;
12982}
@ CONFIG_LFG_KICK_PREVENTION_TIMER
Definition: IWorld.h:416
@ ERR_PARTY_LFG_BOOT_LOOT_ROLLS
Definition: SharedDefines.h:3732
@ ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S
Definition: SharedDefines.h:3727
@ ERR_PARTY_LFG_BOOT_LIMIT
Definition: SharedDefines.h:3723
@ ERR_NOT_LEADER
Definition: SharedDefines.h:3712
@ ERR_NOT_IN_GROUP
Definition: SharedDefines.h:3711
@ ERR_PARTY_LFG_BOOT_DUNGEON_COMPLETE
Definition: SharedDefines.h:3731
@ ERR_PARTY_LFG_BOOT_IN_COMBAT
Definition: SharedDefines.h:3729
@ ERR_PARTY_LFG_BOOT_IN_PROGRESS
Definition: SharedDefines.h:3725
@ ERR_INVITE_RESTRICTED
Definition: SharedDefines.h:3716
@ ERR_PARTY_RESULT_OK
Definition: SharedDefines.h:3705
@ ERR_PARTY_LFG_BOOT_TOO_FEW_PLAYERS
Definition: SharedDefines.h:3726
LfgState
Definition: LFG.h:70
@ LFG_STATE_FINISHED_DUNGEON
Definition: LFG.h:77
@ LFG_STATE_BOOT
Definition: LFG.h:75
@ LFG_SPELL_DUNGEON_COOLDOWN
Definition: LFGMgr.h:52
@ LFG_GROUP_KICK_VOTES_NEEDED
Definition: LFGMgr.h:55
Player * FindConnectedPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:260
bool InBattleground() const
Definition: Player.h:2214
bool isLFGGroup(bool restricted=false) const
Definition: Group.cpp:2204
bool IsAssistant(ObjectGuid guid) const
Definition: Group.cpp:2294
bool isRollLootActive() const
Definition: Group.cpp:2397
bool IsLeader(ObjectGuid guid) const
Definition: Group.cpp:2280
ObjectGuid GetGUID() const
Definition: Group.cpp:2245
uint32 GetMembersCount() const
Definition: Group.h:245
GroupReference * GetFirstMember()
Definition: Group.h:243
Definition: GroupReference.h:27
GroupReference * next()
Definition: GroupReference.h:36

References CONFIG_LFG_KICK_PREVENTION_TIMER, ERR_INVITE_RESTRICTED, ERR_NOT_IN_GROUP, ERR_NOT_LEADER, ERR_PARTY_LFG_BOOT_DUNGEON_COMPLETE, ERR_PARTY_LFG_BOOT_IN_COMBAT, ERR_PARTY_LFG_BOOT_IN_PROGRESS, ERR_PARTY_LFG_BOOT_LIMIT, ERR_PARTY_LFG_BOOT_LOOT_ROLLS, ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S, ERR_PARTY_LFG_BOOT_TOO_FEW_PLAYERS, ERR_PARTY_RESULT_OK, ObjectAccessor::FindConnectedPlayer(), Group::GetFirstMember(), GetGroup(), Object::GetGUID(), Group::GetGUID(), Group::GetMembersCount(), InBattleground(), Group::IsAssistant(), Group::IsLeader(), Group::isLFGGroup(), Group::isRollLootActive(), lfg::LFG_GROUP_KICK_VOTES_NEEDED, lfg::LFG_SPELL_DUNGEON_COOLDOWN, lfg::LFG_STATE_BOOT, lfg::LFG_STATE_FINISHED_DUNGEON, GroupReference::next(), sLFGMgr, and sWorld.

Referenced by WorldSession::HandleGroupUninviteGuidOpcode(), and WorldSession::HandleGroupUninviteOpcode().

◆ CanUseAmmo()

InventoryResult Player::CanUseAmmo ( uint32  item) const
2485{
2486 LOG_DEBUG("entities.player.items", "STORAGE: CanUseAmmo item = {}", item);
2487 if (!IsAlive())
2489 //if (isStunned())
2490 // return EQUIP_ERR_YOU_ARE_STUNNED;
2491 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
2492 if (pProto)
2493 {
2494 if (pProto->InventoryType != INVTYPE_AMMO)
2496
2497 InventoryResult res = CanUseItem(pProto);
2498 if (res != EQUIP_ERR_OK)
2499 return res;
2500
2501 /*if (GetReputationMgr().GetReputation() < pProto->RequiredReputation)
2502 return EQUIP_ERR_CANT_EQUIP_REPUTATION;
2503 */
2504
2505 // Requires No Ammo
2506 if (HasAura(46699))
2507 return EQUIP_ERR_BAG_FULL6;
2508
2509 return EQUIP_ERR_OK;
2510 }
2512}
@ EQUIP_ERR_YOU_ARE_DEAD
Definition: Item.h:79
@ EQUIP_ERR_ONLY_AMMO_CAN_GO_HERE
Definition: Item.h:48
@ EQUIP_ERR_BAG_FULL6
Definition: Item.h:103
@ INVTYPE_AMMO
Definition: ItemTemplate.h:289

References CanUseItem(), EQUIP_ERR_BAG_FULL6, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_OK, EQUIP_ERR_ONLY_AMMO_CAN_GO_HERE, EQUIP_ERR_YOU_ARE_DEAD, Unit::HasAura(), ItemTemplate::InventoryType, INVTYPE_AMMO, Unit::IsAlive(), LOG_DEBUG, and sObjectMgr.

Referenced by Create(), and SetAmmo().

◆ CanUseBattlegroundObject()

bool Player::CanUseBattlegroundObject ( GameObject gameobject) const
Bug:
sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet Note: Mount, stealth and invisibility will be removed when used
13136{
13137 // It is possible to call this method will a nullptr pointer, only skipping faction check.
13138 if (gameobject)
13139 {
13140 FactionTemplateEntry const* playerFaction = GetFactionTemplateEntry();
13141 FactionTemplateEntry const* faction = sFactionTemplateStore.LookupEntry(gameobject->GetUInt32Value(GAMEOBJECT_FACTION));
13142
13143 if (playerFaction && faction && !playerFaction->IsFriendlyTo(*faction))
13144 return false;
13145 }
13146
13152 return (!isTotalImmune() && // Damage immune
13153 !HasAura(SPELL_RECENTLY_DROPPED_FLAG) && // Still has recently held flag debuff
13154 IsAlive()); // Alive
13155}
@ SPELL_RECENTLY_DROPPED_FLAG
Definition: Battleground.h:139
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
@ GAMEOBJECT_FACTION
Definition: UpdateFields.h:402
bool isTotalImmune() const
Definition: Player.cpp:13227
FactionTemplateEntry const * GetFactionTemplateEntry() const
Definition: Unit.cpp:10042
Definition: DBCStructure.h:930
bool IsFriendlyTo(FactionTemplateEntry const &entry) const
Definition: DBCStructure.h:942

References GAMEOBJECT_FACTION, Unit::GetFactionTemplateEntry(), Object::GetUInt32Value(), Unit::HasAura(), Unit::IsAlive(), FactionTemplateEntry::IsFriendlyTo(), isTotalImmune(), sFactionTemplateStore, and SPELL_RECENTLY_DROPPED_FLAG.

Referenced by Spell::CheckCast(), and GameObject::Use().

◆ CanUseItem() [1/2]

InventoryResult Player::CanUseItem ( Item pItem,
bool  not_loading = true 
) const
Todo:
: when you right-click already equipped item it throws EQUIP_ERR_NO_REQUIRED_PROFICIENCY.
2240{
2241 if (pItem)
2242 {
2243 LOG_DEBUG("entities.player.items", "STORAGE: CanUseItem item = {}", pItem->GetEntry());
2244
2245 if (!IsAlive() && not_loading)
2247
2248 //if (isStunned())
2249 // return EQUIP_ERR_YOU_ARE_STUNNED;
2250
2251 ItemTemplate const* pProto = pItem->GetTemplate();
2252 if (pProto)
2253 {
2254 if (pItem->IsBindedNotWith(this))
2256
2257 InventoryResult res = CanUseItem(pProto);
2258 if (res != EQUIP_ERR_OK)
2259 return res;
2260
2261 if (pItem->GetSkill() != 0)
2262 {
2263 bool allowEquip = false;
2264 uint32 itemSkill = pItem->GetSkill();
2265 // Armor that is binded to account can "morph" from plate to mail, etc. if skill is not learned yet.
2266 if (pProto->Quality == ITEM_QUALITY_HEIRLOOM && pProto->Class == ITEM_CLASS_ARMOR && !HasSkill(itemSkill))
2267 {
2269
2270 // In fact it's a visual bug, everything works properly... I need sniffs of operations with
2271 // binded to account items from off server.
2272
2273 switch (getClass())
2274 {
2275 case CLASS_HUNTER:
2276 case CLASS_SHAMAN:
2277 allowEquip = (itemSkill == SKILL_MAIL);
2278 break;
2279 case CLASS_PALADIN:
2280 case CLASS_WARRIOR:
2281 allowEquip = (itemSkill == SKILL_PLATE_MAIL);
2282 break;
2283 }
2284 }
2285 if (!allowEquip && GetSkillValue(itemSkill) == 0)
2287 }
2288
2291
2292 return EQUIP_ERR_OK;
2293 }
2294 }
2296}
@ EQUIP_ERR_CANT_EQUIP_REPUTATION
Definition: Item.h:105
@ ITEM_QUALITY_HEIRLOOM
Definition: SharedDefines.h:336
@ SKILL_PLATE_MAIL
Definition: SharedDefines.h:2951
@ SKILL_MAIL
Definition: SharedDefines.h:2962
uint32 GetSkill()
Definition: Item.cpp:556
uint32 Quality
Definition: ItemTemplate.h:635

References CanUseItem(), ItemTemplate::Class, CLASS_HUNTER, CLASS_PALADIN, CLASS_SHAMAN, CLASS_WARRIOR, EQUIP_ERR_CANT_EQUIP_REPUTATION, EQUIP_ERR_DONT_OWN_THAT_ITEM, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_NO_REQUIRED_PROFICIENCY, EQUIP_ERR_OK, EQUIP_ERR_YOU_ARE_DEAD, Unit::getClass(), Object::GetEntry(), GetReputationRank(), Item::GetSkill(), GetSkillValue(), Item::GetTemplate(), HasSkill(), Unit::IsAlive(), Item::IsBindedNotWith(), ITEM_CLASS_ARMOR, ITEM_QUALITY_HEIRLOOM, LOG_DEBUG, ItemTemplate::Quality, ItemTemplate::RequiredReputationFaction, ItemTemplate::RequiredReputationRank, SKILL_MAIL, and SKILL_PLATE_MAIL.

Referenced by AuctionHouseObject::BuildListAuctionItems(), CanBankItem(), CanEquipItem(), CanUseAmmo(), CanUseItem(), WorldSession::HandleReadItem(), and WorldSession::HandleUseItemOpcode().

◆ CanUseItem() [2/2]

InventoryResult Player::CanUseItem ( ItemTemplate const *  pItem) const
2299{
2300 // Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player
2301
2302 if (!proto)
2303 {
2305 }
2306
2307 if ((proto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && GetTeamId(true) != TEAM_HORDE)
2308 {
2310 }
2311
2312 if ((proto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && GetTeamId(true) != TEAM_ALLIANCE)
2313 {
2315 }
2316
2317 if ((proto->AllowableClass & getClassMask()) == 0 || (proto->AllowableRace & getRaceMask()) == 0)
2318 {
2320 }
2321
2322 if (proto->RequiredSkill != 0)
2323 {
2324 if (GetSkillValue(proto->RequiredSkill) == 0)
2325 {
2327 }
2328 else if (GetSkillValue(proto->RequiredSkill) < proto->RequiredSkillRank)
2329 {
2331 }
2332 }
2333
2334 if (proto->RequiredSpell != 0 && !HasSpell(proto->RequiredSpell))
2335 {
2337 }
2338
2339 if (GetLevel() < proto->RequiredLevel)
2340 {
2342 }
2343
2344 // If World Event is not active, prevent using event dependant items
2345 if (proto->HolidayId && !IsHolidayActive((HolidayIds)proto->HolidayId))
2346 {
2348 }
2349
2351
2352 if (!sScriptMgr->CanUseItem(const_cast<Player*>(this), proto, result))
2353 {
2354 return result;
2355 }
2356
2357 return EQUIP_ERR_OK;
2358}
@ EQUIP_ERR_CANT_EQUIP_LEVEL_I
Definition: Item.h:42
bool IsHolidayActive(HolidayIds id)
Definition: GameEventMgr.cpp:1909
HolidayIds
Definition: SharedDefines.h:2741

References ItemTemplate::AllowableClass, ItemTemplate::AllowableRace, EQUIP_ERR_CANT_DO_RIGHT_NOW, EQUIP_ERR_CANT_EQUIP_LEVEL_I, EQUIP_ERR_CANT_EQUIP_SKILL, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_NO_REQUIRED_PROFICIENCY, EQUIP_ERR_OK, EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM, ItemTemplate::Flags2, Unit::getClassMask(), Unit::GetLevel(), Unit::getRaceMask(), GetSkillValue(), GetTeamId(), HasSpell(), ItemTemplate::HolidayId, IsHolidayActive(), ITEM_FLAGS_EXTRA_ALLIANCE_ONLY, ITEM_FLAGS_EXTRA_HORDE_ONLY, ItemTemplate::RequiredLevel, ItemTemplate::RequiredSkill, ItemTemplate::RequiredSkillRank, ItemTemplate::RequiredSpell, sScriptMgr, TEAM_ALLIANCE, and TEAM_HORDE.

◆ CastItemCombatSpell() [1/2]

void Player::CastItemCombatSpell ( Unit target,
WeaponAttackType  attType,
uint32  procVictim,
uint32  procEx 
)
7113{
7114 if (!target || !target->IsAlive() || target == this)
7115 return;
7116
7117 // Xinef: do not use disarmed weapons, special exception - shaman ghost wolf form
7118 // Xinef: normal forms proc on hit enchants / built in item bonuses
7120 return;
7121
7123 {
7124 // If usable, try to cast item spell
7125 if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
7126 if (!item->IsBroken())
7127 if (ItemTemplate const* proto = item->GetTemplate())
7128 {
7129 // Additional check for weapons
7130 if (proto->Class == ITEM_CLASS_WEAPON)
7131 {
7132 // offhand item cannot proc from main hand hit etc
7133 EquipmentSlots slot;
7134 switch (attType)
7135 {
7136 case BASE_ATTACK:
7138 break;
7139 case OFF_ATTACK:
7141 break;
7142 case RANGED_ATTACK:
7143 slot = EQUIPMENT_SLOT_RANGED;
7144 break;
7145 default:
7146 slot = EQUIPMENT_SLOT_END;
7147 break;
7148 }
7149 if (slot != i)
7150 continue;
7151 }
7152
7153 CastItemCombatSpell(target, attType, procVictim, procEx, item, proto);
7154 }
7155 }
7156}
EquipmentSlots
Definition: Player.h:674
@ FORM_GHOSTWOLF
Definition: Unit.h:106
void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx)
Definition: Player.cpp:7112

References BASE_ATTACK, Unit::CanUseAttackType(), CastItemCombatSpell(), EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, EQUIPMENT_SLOT_START, FORM_GHOSTWOLF, GetItemByPos(), Unit::GetShapeshiftForm(), INVENTORY_SLOT_BAG_0, Unit::IsAlive(), ITEM_CLASS_WEAPON, OFF_ATTACK, and RANGED_ATTACK.

Referenced by CastItemCombatSpell(), Unit::DealMeleeDamage(), and Spell::DoAllEffectOnTarget().

◆ CastItemCombatSpell() [2/2]

void Player::CastItemCombatSpell ( Unit target,
WeaponAttackType  attType,
uint32  procVictim,
uint32  procEx,
Item item,
ItemTemplate const *  proto 
)
7159{
7160 if (!sScriptMgr->CanCastItemCombatSpell(this, target, attType, procVictim, procEx, item, proto))
7161 return;
7162
7163 // Can do effect if any damage done to target
7164 if (procVictim & PROC_FLAG_TAKEN_DAMAGE)
7165 //if (damageInfo->procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE)
7166 {
7167 for (uint8 i = 0; i < MAX_ITEM_SPELLS; ++i)
7168 {
7169 _Spell const& spellData = proto->Spells[i];
7170
7171 // no spell
7172 if (!spellData.SpellId)
7173 continue;
7174
7175 // wrong triggering type
7177 continue;
7178
7179 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
7180 if (!spellInfo)
7181 {
7182 LOG_ERROR("entities.player", "WORLD: unknown Item spellid {}", spellData.SpellId);
7183 continue;
7184 }
7185
7186 float chance = (float)spellInfo->ProcChance;
7187
7188 if (spellData.SpellPPMRate)
7189 {
7190 uint32 WeaponSpeed = GetAttackTime(attType);
7191 chance = GetPPMProcChance(WeaponSpeed, spellData.SpellPPMRate, spellInfo);
7192 }
7193 else if (chance > 100.0f)
7194 {
7195 chance = GetWeaponProcChance();
7196 }
7197
7198 if (roll_chance_f(chance) && sScriptMgr->OnCastItemCombatSpell(this, target, spellInfo, item))
7200 }
7201 }
7202
7203 // item combat enchantments
7204 for (uint8 e_slot = 0; e_slot < MAX_ENCHANTMENT_SLOT; ++e_slot)
7205 {
7206 uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot));
7207 SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
7208 if (!pEnchant)
7209 continue;
7210
7211 for (uint8 s = 0; s < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; ++s)
7212 {
7213 if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
7214 continue;
7215
7216 SpellEnchantProcEntry const* entry = sSpellMgr->GetSpellEnchantProcEvent(enchant_id);
7217
7218 if (entry && entry->procEx)
7219 {
7220 // Check hit/crit/dodge/parry requirement
7221 if ((entry->procEx & procEx) == 0)
7222 continue;
7223 }
7224 else
7225 {
7226 // Can do effect if any damage done to target
7227 if (!(procVictim & PROC_FLAG_TAKEN_DAMAGE))
7228 //if (!(damageInfo->procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE))
7229 continue;
7230 }
7231
7232 if (entry && (entry->attributeMask & ENCHANT_PROC_ATTR_WHITE_HIT) && (procVictim & SPELL_PROC_FLAG_MASK))
7233 continue;
7234
7235 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
7236 if (!spellInfo)
7237 {
7238 LOG_ERROR("entities.player", "Player::CastItemCombatSpell({}, name: {}, enchant: {}): unknown spell {} is casted, ignoring...",
7239 GetGUID().ToString(), GetName(), pEnchant->ID, pEnchant->spellid[s]);
7240 continue;
7241 }
7242
7243 if (entry && (entry->attributeMask & ENCHANT_PROC_ATTR_EXCLUSIVE) != 0)
7244 {
7245 Unit* checkTarget = spellInfo->IsPositive() ? this : target;
7246 if (checkTarget->HasAura(spellInfo->Id, GetGUID()))
7247 {
7248 continue;
7249 }
7250 }
7251
7252 float chance = pEnchant->amount[s] != 0 ? float(pEnchant->amount[s]) : GetWeaponProcChance();
7253
7254 if (entry)
7255 {
7256 if (entry->PPMChance)
7257 chance = GetPPMProcChance(proto->Delay, entry->PPMChance, spellInfo);
7258 else if (entry->customChance)
7259 chance = (float)entry->customChance;
7260 }
7261
7262 // Apply spell mods
7263 ApplySpellMod(pEnchant->spellid[s], SPELLMOD_CHANCE_OF_SUCCESS, chance);
7264
7265 // Shiv has 100% chance to apply the poison
7266 if (FindCurrentSpellBySpellId(5938) && e_slot == TEMP_ENCHANTMENT_SLOT)
7267 chance = 100.0f;
7268
7269 if (roll_chance_f(chance))
7270 {
7271 // Xinef: implement enchant charges
7272 if (uint32 charges = item->GetEnchantmentCharges(EnchantmentSlot(e_slot)))
7273 {
7274 if (!--charges)
7275 {
7276 ApplyEnchantment(item, EnchantmentSlot(e_slot), false);
7277 item->ClearEnchantment(EnchantmentSlot(e_slot));
7278 }
7279 else
7280 item->SetEnchantmentCharges(EnchantmentSlot(e_slot), charges);
7281 }
7282
7283 Unit* unitTarget = spellInfo->IsPositive() ? this : target;
7285 }
7286 }
7287 }
7288}
bool roll_chance_f(float chance)
Definition: Random.h:53
@ ITEM_SPELLTRIGGER_CHANCE_ON_HIT
Definition: ItemTemplate.h:80
@ SPELLMOD_CHANCE_OF_SUCCESS
Definition: SpellDefines.h:95
@ TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
Will ignore GCD.
Definition: SpellDefines.h:133
@ PROC_FLAG_TAKEN_DAMAGE
Definition: SpellMgr.h:137
@ SPELL_PROC_FLAG_MASK
Definition: SpellMgr.h:156
@ ENCHANT_PROC_ATTR_WHITE_HIT
Definition: SpellMgr.h:310
@ ENCHANT_PROC_ATTR_EXCLUSIVE
Definition: SpellMgr.h:309
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges)
Definition: Item.cpp:952
void ClearEnchantment(EnchantmentSlot slot)
Definition: Item.cpp:961
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
Definition: Item.h:297
float SpellPPMRate
Definition: ItemTemplate.h:603
float GetPPMProcChance(uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
Definition: Unit.cpp:13445
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
Definition: Unit.cpp:4096
float GetWeaponProcChance() const
Definition: Unit.cpp:13434
bool IsPositive() const
Definition: SpellInfo.cpp:1224
uint32 ProcChance
Definition: SpellInfo.h:354
Definition: SpellMgr.h:314
uint32 procEx
Definition: SpellMgr.h:317
uint32 attributeMask
Definition: SpellMgr.h:318
uint32 customChance
Definition: SpellMgr.h:315
float PPMChance
Definition: SpellMgr.h:316
uint32 ID
Definition: DBCStructure.h:1843

References SpellItemEnchantmentEntry::amount, ApplyEnchantment(), ApplySpellMod(), SpellEnchantProcEntry::attributeMask, Unit::CastSpell(), Item::ClearEnchantment(), SpellEnchantProcEntry::customChance, ItemTemplate::Delay, ENCHANT_PROC_ATTR_EXCLUSIVE, ENCHANT_PROC_ATTR_WHITE_HIT, Unit::FindCurrentSpellBySpellId(), Unit::GetAttackTime(), Item::GetEnchantmentCharges(), Item::GetEnchantmentId(), Object::GetGUID(), WorldObject::GetName(), Unit::GetPPMProcChance(), Unit::GetWeaponProcChance(), Unit::HasAura(), SpellInfo::Id, SpellItemEnchantmentEntry::ID, SpellInfo::IsPositive(), ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL, ITEM_SPELLTRIGGER_CHANCE_ON_HIT, LOG_ERROR, MAX_ENCHANTMENT_SLOT, MAX_ITEM_SPELLS, MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS, SpellEnchantProcEntry::PPMChance, PROC_FLAG_TAKEN_DAMAGE, SpellInfo::ProcChance, SpellEnchantProcEntry::procEx, roll_chance_f(), Item::SetEnchantmentCharges(), SPELL_PROC_FLAG_MASK, _Spell::SpellId, SpellItemEnchantmentEntry::spellid, SPELLMOD_CHANCE_OF_SUCCESS, _Spell::SpellPPMRate, ItemTemplate::Spells, _Spell::SpellTrigger, sScriptMgr, sSpellItemEnchantmentStore, sSpellMgr, TEMP_ENCHANTMENT_SLOT, Position::ToString(), TRIGGERED_FULL_MASK, TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD, and SpellItemEnchantmentEntry::type.

◆ CastItemUseSpell()

void Player::CastItemUseSpell ( Item item,
SpellCastTargets const &  targets,
uint8  cast_count,
uint32  glyphIndex 
)
7291{
7292 if (!sScriptMgr->CanCastItemUseSpell(this, item, targets, cast_count, glyphIndex))
7293 return;
7294
7295 ItemTemplate const* proto = item->GetTemplate();
7296 // special learning case
7297 if (proto->Spells[0].SpellId == 483 || proto->Spells[0].SpellId == 55884)
7298 {
7299 uint32 learn_spell_id = proto->Spells[0].SpellId;
7300 uint32 learning_spell_id = proto->Spells[1].SpellId;
7301
7302 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(learn_spell_id);
7303 if (!spellInfo)
7304 {
7305 LOG_ERROR("entities.player", "Player::CastItemUseSpell: Item (Entry: {}) in have wrong spell id {}, ignoring ", proto->ItemId, learn_spell_id);
7306 SendEquipError(EQUIP_ERR_NONE, item, nullptr);
7307 return;
7308 }
7309
7310 Spell* spell = new Spell(this, spellInfo, TRIGGERED_NONE);
7311 spell->m_CastItem = item;
7312 spell->m_cast_count = cast_count; //set count of casts
7313 spell->SetSpellValue(SPELLVALUE_BASE_POINT0, learning_spell_id);
7314 spell->prepare(&targets);
7315 return;
7316 }
7317
7318 // use triggered flag only for items with many spell casts and for not first cast
7319 uint8 count = 0;
7320
7321 std::list<Spell*> pushSpells;
7322 // item spells casted at use
7323 for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
7324 {
7325 _Spell const& spellData = proto->Spells[i];
7326
7327 // no spell
7328 if (!spellData.SpellId)
7329 continue;
7330
7331 // wrong triggering type
7332 if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE)
7333 continue;
7334
7335 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
7336 if (!spellInfo)
7337 {
7338 LOG_ERROR("entities.player", "Player::CastItemUseSpell: Item (Entry: {}) in have wrong spell id {}, ignoring", proto->ItemId, spellData.SpellId);
7339 continue;
7340 }
7341
7342 if (HasSpellCooldown(spellInfo->Id))
7343 {
7344 continue;
7345 }
7346
7347 if (!spellInfo->CheckElixirStacking(this))
7348 {
7349 Spell::SendCastResult(this, spellInfo, cast_count, SPELL_FAILED_AURA_BOUNCED);
7350 continue;
7351 }
7352
7353 Spell* spell = new Spell(this, spellInfo, (count > 0) ? TRIGGERED_FULL_MASK : TRIGGERED_NONE);
7354 spell->m_CastItem = item;
7355 spell->m_cast_count = cast_count; // set count of casts
7356 spell->m_glyphIndex = glyphIndex; // glyph index
7357 spell->InitExplicitTargets(targets);
7358
7359 // Xinef: dont allow to cast such spells, it may happen that spell possess 2 spells, one for players and one for items / gameobjects
7360 // Xinef: if first one is cast on player, it may be deleted thus resulting in crash because second spell has saved pointer to the item
7361 // Xinef: there is one problem with scripts which wont be loaded at the moment of call
7362 SpellCastResult result = spell->CheckCast(true);
7363 if (result != SPELL_CAST_OK)
7364 {
7365 spell->SendCastResult(result);
7366 delete spell;
7367 continue;
7368 }
7369
7370 pushSpells.push_back(spell);
7371 //spell->prepare(&targets);
7372
7373 ++count;
7374 }
7375
7376 // Item enchantments spells casted at use
7377 for (uint8 e_slot = 0; e_slot < MAX_ENCHANTMENT_SLOT; ++e_slot)
7378 {
7379 uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot));
7380 SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
7381 if (!pEnchant)
7382 continue;
7383 for (uint8 s = 0; s < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; ++s)
7384 {
7385 if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_USE_SPELL)
7386 continue;
7387
7388 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
7389 if (!spellInfo)
7390 {
7391 LOG_ERROR("entities.player", "Player::CastItemUseSpell Enchant {}, cast unknown spell {}", pEnchant->ID, pEnchant->spellid[s]);
7392 continue;
7393 }
7394
7395 if (HasSpellCooldown(spellInfo->Id))
7396 continue;
7397
7398 Spell* spell = new Spell(this, spellInfo, (count > 0) ? TRIGGERED_FULL_MASK : TRIGGERED_NONE);
7399 spell->m_CastItem = item;
7400 spell->m_cast_count = cast_count; // set count of casts
7401 spell->m_glyphIndex = glyphIndex; // glyph index
7402 spell->InitExplicitTargets(targets);
7403
7404 // Xinef: dont allow to cast such spells, it may happen that spell possess 2 spells, one for players and one for items / gameobjects
7405 // Xinef: if first one is cast on player, it may be deleted thus resulting in crash because second spell has saved pointer to the item
7406 // Xinef: there is one problem with scripts which wont be loaded at the moment of call
7407 SpellCastResult result = spell->CheckCast(true);
7408 if (result != SPELL_CAST_OK)
7409 {
7410 spell->SendCastResult(result);
7411 delete spell;
7412 continue;
7413 }
7414
7415 pushSpells.push_back(spell);
7416 //spell->prepare(&targets);
7417
7418 ++count;
7419 }
7420 }
7421
7422 // xinef: send all spells in one go, prevents crash because container is not set
7423 for (std::list<Spell*>::const_iterator itr = pushSpells.begin(); itr != pushSpells.end(); ++itr)
7424 (*itr)->prepare(&targets);
7425}
@ EQUIP_ERR_NONE
Definition: Item.h:100
@ SPELLVALUE_BASE_POINT0
Definition: SpellDefines.h:114
@ TRIGGERED_NONE
Definition: SpellDefines.h:131
SpellCastResult
Definition: SharedDefines.h:948
@ SPELL_FAILED_AURA_BOUNCED
Definition: SharedDefines.h:958
bool HasSpellCooldown(uint32 spell_id) const override
Definition: Player.cpp:16251
SpellCastResult prepare(SpellCastTargets const *targets, AuraEffect const *triggeredByAura=nullptr)
Definition: Spell.cpp:3464
void SetSpellValue(SpellValueMod mod, int32 value)
Definition: Spell.cpp:8391
uint8 m_cast_count
Definition: Spell.h:524
uint32 m_glyphIndex
Definition: Spell.h:525
SpellCastResult CheckCast(bool strict)
Definition: Spell.cpp:5626
void InitExplicitTargets(SpellCastTargets const &targets)
Definition: Spell.cpp:712
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition: Spell.cpp:4645
Item * m_CastItem
Definition: Spell.h:521
bool CheckElixirStacking(Unit const *caster) const
Definition: SpellInfo.cpp:2876

References Spell::CheckCast(), SpellInfo::CheckElixirStacking(), EQUIP_ERR_NONE, Item::GetEnchantmentId(), Item::GetTemplate(), HasSpellCooldown(), SpellInfo::Id, SpellItemEnchantmentEntry::ID, Spell::InitExplicitTargets(), ITEM_ENCHANTMENT_TYPE_USE_SPELL, ITEM_SPELLTRIGGER_ON_USE, ItemTemplate::ItemId, LOG_ERROR, Spell::m_cast_count, Spell::m_CastItem, Spell::m_glyphIndex, MAX_ENCHANTMENT_SLOT, MAX_ITEM_PROTO_SPELLS, MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS, Spell::prepare(), Spell::SendCastResult(), SendEquipError(), Spell::SetSpellValue(), SPELL_CAST_OK, SPELL_FAILED_AURA_BOUNCED, _Spell::SpellId, SpellItemEnchantmentEntry::spellid, ItemTemplate::Spells, _Spell::SpellTrigger, SPELLVALUE_BASE_POINT0, sScriptMgr, sSpellItemEnchantmentStore, sSpellMgr, TRIGGERED_FULL_MASK, TRIGGERED_NONE, and SpellItemEnchantmentEntry::type.

Referenced by WorldSession::HandleUseItemOpcode().

◆ CharmSpellInitialize()

void Player::CharmSpellInitialize ( )
9563{
9564 Unit* charm = GetFirstControlled();
9565 if (!charm)
9566 return;
9567
9568 CharmInfo* charmInfo = charm->GetCharmInfo();
9569 if (!charmInfo)
9570 {
9571 LOG_ERROR("entities.player", "Player::CharmSpellInitialize(): the player's charm ({}) has no charminfo!", charm->GetGUID().ToString());
9572 return;
9573 }
9574
9575 uint8 addlist = 0;
9576 if (charm->GetTypeId() != TYPEID_PLAYER)
9577 {
9578 //CreatureInfo const* cinfo = charm->ToCreature()->GetCreatureTemplate();
9579 //if (cinfo && cinfo->type == CREATURE_TYPE_DEMON && getClass() == CLASS_WARLOCK)
9580 {
9581 for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
9582 if (charmInfo->GetCharmSpell(i)->GetAction())
9583 ++addlist;
9584 }
9585 }
9586
9587 WorldPacket data(SMSG_PET_SPELLS, 8 + 2 + 4 + 4 + 4 * MAX_UNIT_ACTION_BAR_INDEX + 1 + 4 * addlist + 1);
9588 data << charm->GetGUID();
9589 data << uint16(0);
9590 data << uint32(0);
9591
9592 if (charm->GetTypeId() != TYPEID_PLAYER)
9593 data << uint8(charm->ToCreature()->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0);
9594 else
9595 data << uint32(0);
9596
9597 charmInfo->BuildActionBar(&data);
9598
9599 data << uint8(addlist);
9600
9601 if (addlist)
9602 {
9603 for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
9604 {
9605 CharmSpellInfo* cspell = charmInfo->GetCharmSpell(i);
9606 if (cspell->GetAction())
9607 data << uint32(cspell->packedData);
9608 }
9609 }
9610
9611 data << uint8(0); // cooldowns count
9612
9613 GetSession()->SendPacket(&data);
9614}
#define MAX_SPELL_CHARM
Definition: Unit.h:157
#define MAX_UNIT_ACTION_BAR_INDEX
Definition: Unit.h:1103
@ SMSG_PET_SPELLS
Definition: Opcodes.h:407
ReactStates GetReactState() const
Definition: Creature.h:91
Definition: Unit.h:1053
uint32 packedData
Definition: Unit.h:1056
uint32 GetAction() const
Definition: Unit.h:1060
Definition: Unit.h:1106
CharmSpellInfo * GetCharmSpell(uint8 index)
Definition: Unit.h:1137
CommandStates GetCommandState() const
Definition: Unit.h:1115
void BuildActionBar(WorldPacket *data)
Definition: Unit.cpp:16079
CharmInfo * GetCharmInfo()
Definition: Unit.h:1897
Unit * GetFirstControlled() const
Definition: Unit.cpp:11069

References CharmInfo::BuildActionBar(), UnitActionBarEntry::GetAction(), Unit::GetCharmInfo(), CharmInfo::GetCharmSpell(), CharmInfo::GetCommandState(), Unit::GetFirstControlled(), Object::GetGUID(), Creature::GetReactState(), GetSession(), Object::GetTypeId(), LOG_ERROR, MAX_SPELL_CHARM, MAX_UNIT_ACTION_BAR_INDEX, UnitActionBarEntry::packedData, WorldSession::SendPacket(), SMSG_PET_SPELLS, Object::ToCreature(), ObjectGuid::ToString(), and TYPEID_PLAYER.

Referenced by spell_mage_summon_water_elemental::HandleDummy(), WorldSession::HandleRequestPetInfo(), Unit::SetCharmedBy(), and Unit::SetMinion().

◆ CheckAllAchievementCriteria()

void Player::CheckAllAchievementCriteria ( )
13817{
13819}
void CheckAllAchievementCriteria()
Definition: AchievementMgr.cpp:773

References AchievementMgr::CheckAllAchievementCriteria(), and m_achievementMgr.

Referenced by Create(), and WorldSession::HandlePlayerLoginFromDB().

◆ CheckAmmoCompatibility()

bool Player::CheckAmmoCompatibility ( ItemTemplate const *  ammo_proto) const
7569{
7570 if (!ammo_proto)
7571 return false;
7572
7573 // check ranged weapon
7575 if (!weapon || weapon->IsBroken())
7576 return false;
7577
7578 ItemTemplate const* weapon_proto = weapon->GetTemplate();
7579 if (!weapon_proto || weapon_proto->Class != ITEM_CLASS_WEAPON)
7580 return false;
7581
7582 // check ammo ws. weapon compatibility
7583 switch (weapon_proto->SubClass)
7584 {
7587 if (ammo_proto->SubClass != ITEM_SUBCLASS_ARROW)
7588 return false;
7589 break;
7591 if (ammo_proto->SubClass != ITEM_SUBCLASS_BULLET)
7592 return false;
7593 break;
7594 default:
7595 return false;
7596 }
7597
7598 return true;
7599}
@ ITEM_SUBCLASS_WEAPON_CROSSBOW
Definition: ItemTemplate.h:371
@ ITEM_SUBCLASS_WEAPON_GUN
Definition: ItemTemplate.h:356
@ ITEM_SUBCLASS_WEAPON_BOW
Definition: ItemTemplate.h:355
@ ITEM_SUBCLASS_ARROW
Definition: ItemTemplate.h:425
@ ITEM_SUBCLASS_BULLET
Definition: ItemTemplate.h:426
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition: PlayerStorage.cpp:516

References ItemTemplate::Class, Item::GetTemplate(), GetWeaponForAttack(), Item::IsBroken(), ITEM_CLASS_WEAPON, ITEM_SUBCLASS_ARROW, ITEM_SUBCLASS_BULLET, ITEM_SUBCLASS_WEAPON_BOW, ITEM_SUBCLASS_WEAPON_CROSSBOW, ITEM_SUBCLASS_WEAPON_GUN, RANGED_ATTACK, and ItemTemplate::SubClass.

Referenced by _ApplyAmmoBonuses().

◆ CheckAreaExploreAndOutdoor()

void Player::CheckAreaExploreAndOutdoor ( )
5631{
5632 if (!IsAlive())
5633 return;
5634
5635 if (IsInFlight())
5636 return;
5637
5638 bool isOutdoor = IsOutdoors();
5639 uint32 areaId = GetAreaId();
5640 AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId);
5641
5642 if (sWorld->getBoolConfig(CONFIG_VMAP_INDOOR_CHECK) && _wasOutdoor != isOutdoor)
5643 {
5644 _wasOutdoor = isOutdoor;
5645
5647 SpellAttr0 attrToRecalculate = isOutdoor ? SPELL_ATTR0_ONLY_OUTDOORS : SPELL_ATTR0_ONLY_INDOORS;
5648 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5649 {
5650 Aura* aura = iter->second->GetBase();
5651 SpellInfo const* spell = aura->GetSpellInfo();
5652 if (spell->Attributes & attrToRemove)
5653 {
5654 // if passive - do not remove and just turn off all effects
5655 if (aura->IsPassive())
5656 {
5657 aura->HandleAllEffects(iter->second, AURA_EFFECT_HANDLE_REAL, false);
5658 ++iter;
5659 continue;
5660 }
5661
5662 RemoveAura(iter);
5663 }
5664 else if ((spell->Attributes & attrToRecalculate) && aura->IsPassive())
5665 {
5666 // if passive - turn on all effects
5667 aura->HandleAllEffects(iter->second, AURA_EFFECT_HANDLE_REAL, true);
5668 ++iter;
5669 }
5670 else
5671 {
5672 ++iter;
5673 }
5674 }
5675 }
5676
5677 if (!sScriptMgr->CanAreaExploreAndOutdoor(this))
5678 return;
5679
5680 if (!areaId)
5681 return;
5682
5683 if (!areaEntry)
5684 {
5685 LOG_ERROR("entities.player", "Player '{}' ({}) discovered unknown area (x: {} y: {} z: {} map: {})",
5687 return;
5688 }
5689
5690 uint32 offset = areaEntry->exploreFlag / 32;
5691
5692 if (offset >= PLAYER_EXPLORED_ZONES_SIZE)
5693 {
5694 LOG_ERROR("entities.player", "Wrong area flag {} in map data for (X: {} Y: {}) point to field PLAYER_EXPLORED_ZONES_1 + {} ( {} must be < {} ).", areaEntry->flags, GetPositionX(), GetPositionY(), offset, offset, PLAYER_EXPLORED_ZONES_SIZE);
5695 return;
5696 }
5697
5698 uint32 val = (uint32)(1 << (areaEntry->exploreFlag % 32));
5699 uint32 currFields = GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
5700
5701 if (!(currFields & val))
5702 {
5703 SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, (uint32)(currFields | val));
5704
5706
5707 if (areaEntry->area_level > 0)
5708 {
5709 if (GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
5710 {
5711 SendExplorationExperience(areaId, 0);
5712 }
5713 else
5714 {
5715 int32 diff = int32(GetLevel()) - areaEntry->area_level;
5716 uint32 XP = 0;
5717 if (diff < -5)
5718 {
5719 XP = uint32(sObjectMgr->GetBaseXP(GetLevel() + 5) * sWorld->getRate(RATE_XP_EXPLORE));
5720 }
5721 else if (diff > 5)
5722 {
5723 int32 exploration_percent = (100 - ((diff - 5) * 5));
5724 if (exploration_percent > 100)
5725 exploration_percent = 100;
5726 else if (exploration_percent < 0)
5727 exploration_percent = 0;
5728
5729 XP = uint32(sObjectMgr->GetBaseXP(areaEntry->area_level) * exploration_percent / 100 * sWorld->getRate(RATE_XP_EXPLORE));
5730 }
5731 else
5732 {
5733 XP = uint32(sObjectMgr->GetBaseXP(areaEntry->area_level) * sWorld->getRate(RATE_XP_EXPLORE));
5734 }
5735
5736 sScriptMgr->OnGivePlayerXP(this, XP, nullptr, PlayerXPSource::XPSOURCE_EXPLORE);
5737 GiveXP(XP, nullptr);
5738 SendExplorationExperience(areaId, XP);
5739 }
5740 LOG_DEBUG("entities.player", "Player {} discovered a new area: {}", GetGUID().ToString(), areaId);
5741 }
5742 }
5743}
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
@ CONFIG_MAX_PLAYER_LEVEL
Definition: IWorld.h:236
@ CONFIG_VMAP_INDOOR_CHECK
Definition: IWorld.h:128
@ RATE_XP_EXPLORE
Definition: IWorld.h:473
@ ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA
Definition: DBCEnums.h:165
@ SPELL_ATTR0_ONLY_INDOORS
Definition: SharedDefines.h:396
@ SPELL_ATTR0_ONLY_OUTDOORS
Definition: SharedDefines.h:397
bool IsOutdoors() const
Definition: Object.cpp:3125
void SendExplorationExperience(uint32 Area, uint32 Experience)
Definition: PlayerMisc.cpp:159
void GiveXP(uint32 xp, Unit *victim, float group_rate=1.0f, bool isLFGReward=false)
Definition: Player.cpp:2356
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4722
bool IsInFlight() const
Definition: Unit.h:1690
AuraApplicationMap m_appliedAuras
Definition: Unit.h:2518
void HandleAllEffects(AuraApplication *aurApp, uint8 mode, bool apply)
Definition: SpellAuras.cpp:1255
bool IsPassive() const
Definition: SpellAuras.cpp:1096
uint32 Attributes
Definition: SpellInfo.h:322
Definition: DBCStructure.h:519
int32 area_level
Definition: DBCStructure.h:526
uint32 flags
Definition: DBCStructure.h:524
uint32 exploreFlag
Definition: DBCStructure.h:523

References _wasOutdoor, ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA, AreaTableEntry::area_level, SpellInfo::Attributes, AURA_EFFECT_HANDLE_REAL, CONFIG_MAX_PLAYER_LEVEL, CONFIG_VMAP_INDOOR_CHECK, AreaTableEntry::exploreFlag, AreaTableEntry::flags, WorldObject::GetAreaId(), Object::GetGUID(), Unit::GetLevel(), WorldLocation::GetMapId(), WorldObject::GetName(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Aura::GetSpellInfo(), Object::GetUInt32Value(), GiveXP(), Aura::HandleAllEffects(), Unit::IsAlive(), Unit::IsInFlight(), WorldObject::IsOutdoors(), Aura::IsPassive(), LOG_DEBUG, LOG_ERROR, Unit::m_appliedAuras, PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE, RATE_XP_EXPLORE, Unit::RemoveAura(), sAreaTableStore, SendExplorationExperience(), Object::SetUInt32Value(), sObjectMgr, SPELL_ATTR0_ONLY_INDOORS, SPELL_ATTR0_ONLY_OUTDOORS, sScriptMgr, sWorld, Position::ToString(), and UpdateAchievementCriteria().

Referenced by UpdatePosition().

◆ CheckDuelDistance()

void Player::CheckDuelDistance ( time_t  currTime)
6285{
6286 if (!duel)
6287 {
6288 return;
6289 }
6290
6292 GameObject* obj = GetMap()->GetGameObject(duelFlagGUID);
6293 if (!obj)
6294 return;
6295
6296 if (!duel->OutOfBoundsTime)
6297 {
6298 if (!IsWithinDistInMap(obj, 50))
6299 {
6300 duel->OutOfBoundsTime = currTime + 10;
6301
6303 GetSession()->SendPacket(&data);
6304 }
6305 }
6306 else
6307 {
6308 if (IsWithinDistInMap(obj, 40))
6309 {
6310 duel->OutOfBoundsTime = 0;
6311
6313 GetSession()->SendPacket(&data);
6314 }
6315 else if (currTime >= duel->OutOfBoundsTime)
6317 }
6318}
@ PLAYER_DUEL_ARBITER
Definition: UpdateFields.h:177
@ DUEL_FLED
Definition: SharedDefines.h:3614
@ SMSG_DUEL_INBOUNDS
Definition: Opcodes.h:391
@ SMSG_DUEL_OUTOFBOUNDS
Definition: Opcodes.h:390
Definition: GameObject.h:122
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1321
void DuelComplete(DuelCompleteType type)
Definition: Player.cpp:6325
std::unique_ptr< DuelInfo > duel
Definition: Player.h:1841
GameObject * GetGameObject(ObjectGuid const guid)
Definition: Map.cpp:3312

References duel, DUEL_FLED, DuelComplete(), Map::GetGameObject(), Object::GetGuidValue(), WorldObject::GetMap(), GetSession(), WorldObject::IsWithinDistInMap(), PLAYER_DUEL_ARBITER, WorldSession::SendPacket(), SMSG_DUEL_INBOUNDS, and SMSG_DUEL_OUTOFBOUNDS.

Referenced by Update().

◆ CheckInstanceCount()

bool Player::CheckInstanceCount ( uint32  instanceId) const
7003{
7004 if (_instanceResetTimes.size() < sWorld->getIntConfig(CONFIG_MAX_INSTANCES_PER_HOUR))
7005 return true;
7006 return _instanceResetTimes.find(instanceId) != _instanceResetTimes.end();
7007}
@ CONFIG_MAX_INSTANCES_PER_HOUR
Definition: IWorld.h:363

References _instanceResetTimes, CONFIG_MAX_INSTANCES_PER_HOUR, and sWorld.

Referenced by MapMgr::PlayerCannotEnter().

◆ CheckInstanceLoginValid()

bool Player::CheckInstanceLoginValid ( )
6974{
6975 if (!GetMap())
6976 return false;
6977
6978 if (!GetMap()->IsDungeon() || IsGameMaster())
6979 return true;
6980
6981 if (GetMap()->IsRaid())
6982 {
6983 // cannot be in raid instance without a group
6984 if (!GetGroup() && !sWorld->getBoolConfig(CONFIG_INSTANCE_IGNORE_RAID))
6985 return false;
6986 }
6987 else
6988 {
6989 // cannot be in normal instance without a group and more players than 1 in instance
6990 if (!GetGroup() && GetMap()->GetPlayersCountExceptGMs() > 1)
6991 return false;
6992 }
6993
6994 // pussywizard: check CanEnter for GetMap(), because in PlayerCannotEnter it is called for a map decided before loading screen (can change)
6995 if (GetMap()->CannotEnter(this, true))
6996 return false;
6997
6998 // do checks for satisfy accessreqs, instance full, encounter in progress (raid), perm bind group != perm bind player
6999 return sMapMgr->PlayerCannotEnter(GetMap()->GetId(), this, true) == Map::CAN_ENTER;
7000}
#define sMapMgr
Definition: MapMgr.h:221
@ CONFIG_INSTANCE_IGNORE_RAID
Definition: IWorld.h:90
uint32 GetId(std::string const &username)
Definition: AccountMgr.cpp:200
@ CAN_ENTER
Definition: Map.h:424

References Map::CAN_ENTER, CONFIG_INSTANCE_IGNORE_RAID, GetGroup(), WorldObject::GetMap(), IsGameMaster(), sMapMgr, and sWorld.

Referenced by WorldSession::HandlePlayerLoginFromDB().

◆ CleanupAfterTaxiFlight()

void Player::CleanupAfterTaxiFlight ( )
10347{
10348 // For spells that trigger flying paths remove them at arrival
10350 {
10353 }
10354 m_taxi.ClearTaxiDestinations(); // not destinations, clear source node
10355 Dismount();
10358}
@ UNIT_FLAG_TAXI_FLIGHT
Definition: Unit.h:468
void setOnlineOfflineState(bool isOnline)
Definition: HostileRefMgr.cpp:98
void Dismount()
Definition: Unit.cpp:13518
HostileRefMgr & getHostileRefMgr()
Definition: Unit.h:2163

References PlayerTaxi::ClearTaxiDestinations(), Unit::Dismount(), Unit::getHostileRefMgr(), m_flightSpellActivated, m_taxi, Unit::RemoveAurasDueToSpell(), Unit::RemoveUnitFlag(), HostileRefMgr::setOnlineOfflineState(), UNIT_FLAG_DISABLE_MOVE, and UNIT_FLAG_TAXI_FLIGHT.

Referenced by go_commandscript::DoTeleport(), misc_commandscript::HandleAppearCommand(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoTicketCommand(), go_commandscript::HandleGoZoneXYCommand(), misc_commandscript::HandleGroupSummonCommand(), WorldSession::HandleMoveSplineDoneOpcode(), WorldSession::HandleMoveWorldportAck(), tele_commandscript::HandleTeleCommand(), tele_commandscript::HandleTeleGroupCommand(), and TeleportTo().

◆ CleanupChannels()

void Player::CleanupChannels ( )
4918{
4919 while (!m_channels.empty())
4920 {
4921 Channel* ch = *m_channels.begin();
4922 m_channels.erase(m_channels.begin()); // remove from player's channel list
4923 ch->LeaveChannel(this, false); // not send to client, not remove from player's channel list
4924 }
4925}
Definition: Channel.h:148
void LeaveChannel(Player *player, bool send=true)
Definition: Channel.cpp:252
JoinedChannelsList m_channels
Definition: Player.h:2798

References Channel::LeaveChannel(), and m_channels.

Referenced by WorldSession::HandlePlayerLoginToCharInWorld(), and WorldSession::LogoutPlayer().

◆ CleanupsBeforeDelete()

void Player::CleanupsBeforeDelete ( bool  finalCleanup = true)
overridevirtual

Reimplemented from WorldObject.

464{
465 TradeCancel(false);
467
468 Unit::CleanupsBeforeDelete(finalCleanup);
469}
@ DUEL_INTERRUPTED
Definition: SharedDefines.h:3612
void CleanupsBeforeDelete(bool finalCleanup=true) override
Definition: Unit.cpp:15758

References Unit::CleanupsBeforeDelete(), DUEL_INTERRUPTED, DuelComplete(), and TradeCancel().

Referenced by WorldSession::LogoutPlayer().

◆ ClearAfkReports()

void Player::ClearAfkReports ( )
inline
2246{ m_bgData.bgAfkReporter.clear(); }
GuidSet bgAfkReporter
Definition: Player.h:1034

References BGData::bgAfkReporter, and m_bgData.

Referenced by Battleground::RemovePlayerAtLeave().

◆ ClearChannelWatch()

void Player::ClearChannelWatch ( )
4928{
4929 for (JoinedChannelsList::iterator itr = m_channels.begin(); itr != m_channels.end(); ++itr)
4930 (*itr)->RemoveWatching(this);
4931}

References m_channels.

Referenced by WorldSession::HandleSetChannelWatch().

◆ ClearReceivedSpectatorResetFor()

void Player::ClearReceivedSpectatorResetFor ( )
inline

◆ clearResurrectRequestData()

void Player::clearResurrectRequestData ( )
inline
1789{ setResurrectRequestData(ObjectGuid::Empty, 0, 0.0f, 0.0f, 0.0f, 0, 0); }
void setResurrectRequestData(ObjectGuid guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana)
Definition: Player.h:1779

References ObjectGuid::Empty, and setResurrectRequestData().

Referenced by WorldSession::HandleResurrectResponseOpcode(), Player(), and setDeathState().

◆ ClearWhisperWhiteList()

void Player::ClearWhisperWhiteList ( )
inline
2521{ WhisperList.clear(); }

References WhisperList.

Referenced by message_commandscript::HandleWhispersCommand().

◆ CompletedAchievement()

void Player::CompletedAchievement ( AchievementEntry const *  entry)
13852{
13854}
void CompletedAchievement(AchievementEntry const *entry)
Definition: AchievementMgr.cpp:2227

References AchievementMgr::CompletedAchievement(), and m_achievementMgr.

Referenced by achievement_commandscript::HandleAchievementAddCommand().

◆ CompleteQuest()

void Player::CompleteQuest ( uint32  quest_id)
598{
599 if (!quest_id)
600 {
601 return;
602 }
603
604 if (!sScriptMgr->OnBeforePlayerQuestComplete(this, quest_id))
605 {
606 return;
607 }
608
610
611 auto log_slot = FindQuestSlot(quest_id);
612 if (log_slot < MAX_QUEST_LOG_SIZE)
613 {
615 }
616
617 Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id);
618 if (qInfo && qInfo->HasFlag(QUEST_FLAGS_TRACKING))
619 {
620 RewardQuest(qInfo, 0, this, false);
621 }
622
623 // Xinef: area auras may change on quest completion!
627
628 // check if Quest Tracker is enabled
629 if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER))
630 {
631 // prepare Quest Tracker datas
632 auto stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_COMPLETE_TIME);
633 stmt->SetData(0, quest_id);
634 stmt->SetData(1, GetGUID().GetCounter());
635
636 // add to Quest Tracker
637 CharacterDatabase.Execute(stmt);
638 }
639}
@ CHAR_UPD_QUEST_TRACK_COMPLETE_TIME
Definition: CharacterDatabase.h:500
@ ADDITIONAL_SAVING_INVENTORY_AND_GOLD
Definition: Player.h:984
@ QUEST_FLAGS_TRACKING
Definition: QuestDef.h:142
void RewardQuest(Quest const *quest, uint32 reward, Object *questGiver, bool announce=true, bool isLFGReward=false)
Definition: PlayerQuest.cpp:658
void SetQuestStatus(uint32 questId, QuestStatus status, bool update=true)
Definition: PlayerQuest.cpp:1465

References ADDITIONAL_SAVING_INVENTORY_AND_GOLD, ADDITIONAL_SAVING_QUEST_STATUS, AdditionalSavingAddMask(), CHAR_UPD_QUEST_TRACK_COMPLETE_TIME, CharacterDatabase, CONFIG_QUEST_ENABLE_QUEST_TRACKER, FindQuestSlot(), WorldObject::GetAreaId(), Object::GetGUID(), WorldObject::GetZoneId(), Quest::HasFlag(), MAX_QUEST_LOG_SIZE, QUEST_FLAGS_TRACKING, QUEST_STATE_COMPLETE, QUEST_STATUS_COMPLETE, RewardQuest(), SetQuestSlotState(), SetQuestStatus(), sObjectMgr, sScriptMgr, sWorld, UpdateAreaDependentAuras(), and UpdateZoneDependentAuras().

Referenced by AddQuestAndCheckCompletion(), AreaExploredOrEventHappens(), Spell::EffectQuestComplete(), WorldSession::HandleQuestgiverRequestRewardOpcode(), ItemAddedQuestCheck(), KillCreditGO(), KilledMonsterCredit(), KilledPlayerCreditForQuest(), MoneyChanged(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_plucky::OnGossipSelect(), ReputationChanged(), ReputationChanged2(), PlayerMenu::SendQuestGiverRequestItems(), TalkedToCreature(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), and npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::WaypointReached().

◆ ContinueTaxiFlight()

void Player::ContinueTaxiFlight ( )
10361{
10362 uint32 sourceNode = m_taxi.GetTaxiSource();
10363 if (!sourceNode)
10364 return;
10365
10366 LOG_DEBUG("entities.unit", "WORLD: Restart character {} taxi flight", GetGUID().ToString());
10367
10368 uint32 mountDisplayId = sObjectMgr->GetTaxiMountDisplayId(sourceNode, GetTeamId(true), true);
10369 if (!mountDisplayId)
10370 return;
10371
10373
10374 // search appropriate start path node
10375 uint32 startNode = 0;
10376
10377 TaxiPathNodeList const& nodeList = sTaxiPathNodesByPath[path];
10378
10379 float bestDist = SIZE_OF_GRIDS * SIZE_OF_GRIDS; // xinef: large value
10380 float currDist = 0.0f;
10381
10382 // xinef: changed to -1, we dont want to catch last node
10383 for (uint32 i = 0; i < nodeList.size() - 1; ++i)
10384 {
10385 TaxiPathNodeEntry const* node = nodeList[i];
10386 TaxiPathNodeEntry const* nextNode = nodeList[i + 1];
10387
10388 // xinef: skip nodes at another map, get last valid node on current map
10389 if (nextNode->mapid != GetMapId() || node->mapid != GetMapId())
10390 continue;
10391
10392 currDist = (node->x - GetPositionX()) * (node->x - GetPositionX()) + (node->y - GetPositionY()) * (node->y - GetPositionY()) + (node->z - GetPositionZ()) * (node->z - GetPositionZ());
10393 if (currDist < bestDist)
10394 {
10395 startNode = i;
10396 bestDist = currDist;
10397 }
10398 }
10399
10400 // xinef: no proper node was found
10401 if (startNode == 0)
10402 {
10404 return;
10405 }
10406
10408 {
10410 }
10411
10412 if (IsMounted())
10413 {
10415 }
10416
10417 SetCanTeleport(true);
10418
10419 GetSession()->SendDoFlight(mountDisplayId, path, startNode);
10420}
#define SIZE_OF_GRIDS
Definition: MapDefines.h:25
TaxiPathNodesByPath sTaxiPathNodesByPath
Definition: DBCStores.cpp:186
std::vector< TaxiPathNodeEntry const * > TaxiPathNodeList
Definition: DBCStructure.h:2243
void SetCanTeleport(bool value)
Definition: Player.h:2461
uint32 GetTaxiSource() const
Definition: PlayerTaxi.h:64
uint32 GetCurrentTaxiPath() const
Definition: PlayerTaxi.cpp:213
Definition: DBCStructure.h:1974
float y
Definition: DBCStructure.h:1980
float x
Definition: DBCStructure.h:1979
uint32 mapid
Definition: DBCStructure.h:1978
float z
Definition: DBCStructure.h:1981

References PlayerTaxi::ClearTaxiDestinations(), PlayerTaxi::GetCurrentTaxiPath(), Object::GetGUID(), WorldLocation::GetMapId(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetSession(), PlayerTaxi::GetTaxiSource(), GetTeamId(), Unit::IsInDisallowedMountForm(), Unit::IsMounted(), LOG_DEBUG, m_taxi, TaxiPathNodeEntry::mapid, Unit::RemoveAurasByType(), WorldSession::SendDoFlight(), SetCanTeleport(), SIZE_OF_GRIDS, sObjectMgr, SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOUNTED, sTaxiPathNodesByPath, Position::ToString(), TaxiPathNodeEntry::x, TaxiPathNodeEntry::y, and TaxiPathNodeEntry::z.

Referenced by WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), and ProcessDelayedOperations().

◆ ConvertRune()

void Player::ConvertRune ( uint8  index,
RuneType  newType 
)
13334{
13335 SetCurrentRune(index, newType);
13336
13338 data << uint8(index);
13339 data << uint8(newType);
13340 GetSession()->SendPacket(&data);
13341}
@ SMSG_CONVERT_RUNE
Definition: Opcodes.h:1188
void SetCurrentRune(uint8 index, RuneType currentRune)
Definition: Player.h:2478

References GetSession(), WorldSession::SendPacket(), SetCurrentRune(), and SMSG_CONVERT_RUNE.

Referenced by AddRuneByAuraEffect(), RemoveRunesByAuraEffect(), and RestoreBaseRune().

◆ CorrectMetaGemEnchants()

void Player::CorrectMetaGemEnchants ( uint8  slot,
bool  apply 
)
11126{
11127 //cycle all equipped items
11128 for (uint32 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
11129 {
11130 //enchants for the slot being socketed are handled by Player::ApplyItemMods
11131 if (slot == exceptslot)
11132 continue;
11133
11134 Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
11135
11136 if (!pItem || !pItem->HasSocket())
11137 continue;
11138
11139 for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + 3; ++enchant_slot)
11140 {
11141 uint32 enchant_id = pItem->GetEnchantmentId(EnchantmentSlot(enchant_slot));
11142 if (!enchant_id)
11143 continue;
11144
11145 SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
11146 if (!enchantEntry)
11147 continue;
11148
11149 uint32 condition = enchantEntry->EnchantmentCondition;
11150 if (condition)
11151 {
11152 //was enchant active with/without item?
11153 bool wasactive = EnchantmentFitsRequirements(condition, apply ? exceptslot : -1);
11154 //should it now be?
11155 if (wasactive ^ EnchantmentFitsRequirements(condition, apply ? -1 : exceptslot))
11156 {
11157 // ignore item gem conditions
11158 //if state changed, (dis)apply enchant
11159 ApplyEnchantment(pItem, EnchantmentSlot(enchant_slot), !wasactive, true, true);
11160 }
11161 }
11162 }
11163 }
11164}

References ApplyEnchantment(), SpellItemEnchantmentEntry::EnchantmentCondition, EnchantmentFitsRequirements(), EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, Item::GetEnchantmentId(), GetItemByPos(), Item::HasSocket(), INVENTORY_SLOT_BAG_0, SOCK_ENCHANTMENT_SLOT, and sSpellItemEnchantmentStore.

Referenced by _ApplyItemMods().

◆ Create()

bool Player::Create ( ObjectGuid::LowType  guidlow,
CharacterCreateInfo createInfo 
)
Todo:
: need more checks against packet modifications
472{
473 // FIXME: outfitId not used in player creating
475 // should check that skin, face, hair* are valid via DBC per race/class
476 // also do it in Player::BuildEnumData, Player::LoadFromDB
477
478 Object::_Create(guidlow, 0, HighGuid::Player);
479
480 m_name = createInfo->Name;
481
482 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(createInfo->Race, createInfo->Class);
483 if (!info)
484 {
485 LOG_ERROR("entities.player", "Player::Create: Possible hacking-attempt: Account {} tried creating a character named '{}' with an invalid race/class pair ({}/{}) - refusing to do so.",
486 GetSession()->GetAccountId(), m_name, createInfo->Race, createInfo->Class);
487 return false;
488 }
489
490 for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; i++)
491 m_items[i] = nullptr;
492
493 Relocate(info->positionX, info->positionY, info->positionZ, info->orientation);
494
495 ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(createInfo->Class);
496 if (!cEntry)
497 {
498 LOG_ERROR("entities.player", "Player::Create: Possible hacking-attempt: Account {} tried creating a character named '{}' with an invalid character class ({}) - refusing to do so (wrong DBC-files?)",
499 GetSession()->GetAccountId(), m_name, createInfo->Class);
500 return false;
501 }
502
503 SetMap(sMapMgr->CreateMap(info->mapId, this));
504
505 uint8 powertype = cEntry->powerType;
506
507 SetObjectScale(1.0f);
508
509 m_realRace = createInfo->Race; // set real race flag
510 m_race = createInfo->Race; // set real race flag
511
512 SetFactionForRace(createInfo->Race);
513
514 if (!IsValidGender(createInfo->Gender))
515 {
516 LOG_ERROR("entities.player", "Player::Create: Possible hacking-attempt: Account {} tried creating a character named '{}' with an invalid gender ({}) - refusing to do so",
517 GetSession()->GetAccountId(), m_name, createInfo->Gender);
518 return false;
519 }
520
521 uint32 RaceClassGender = (createInfo->Race) | (createInfo->Class << 8) | (createInfo->Gender << 16);
522
523 SetUInt32Value(UNIT_FIELD_BYTES_0, (RaceClassGender | (powertype << 24)));
525 if (sWorld->getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || sWorld->getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP)
526 {
529 }
531 SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); // fix cast time showed in spell tooltip on client
532 SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f); // default for players in 3.0.3
533
534 // -1 is default value
536
537 SetUInt32Value(PLAYER_BYTES, (createInfo->Skin | (createInfo->Face << 8) | (createInfo->HairStyle << 16) | (createInfo->HairColor << 24)));
539 (0x00 << 8) |
540 (0x00 << 16) |
541 (((GetSession()->IsARecruiter() || GetSession()->GetRecruiterId() != 0) ? REST_STATE_RAF_LINKED : REST_STATE_NOT_RAF_LINKED) << 24)));
542 SetByteValue(PLAYER_BYTES_3, 0, createInfo->Gender);
543 SetByteValue(PLAYER_BYTES_3, 3, 0); // BattlefieldArenaFaction (0 or 1)
544
548
549 for (int i = 0; i < KNOWN_TITLES_SIZE; ++i)
550 SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES + i, 0); // 0=disabled
552
557
558 // set starting level
559 uint32 start_level = getClass() != CLASS_DEATH_KNIGHT
560 ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)
562
564 {
565 uint32 gm_level = sWorld->getIntConfig(CONFIG_START_GM_LEVEL);
566 if (gm_level > start_level)
567 start_level = gm_level;
568 }
569
570 SetUInt32Value(UNIT_FIELD_LEVEL, start_level);
571
572 InitRunes();
573
575 ? sWorld->getIntConfig(CONFIG_START_PLAYER_MONEY)
579
580 // Played time
584
585 // base stats and related field values
590 InitPrimaryProfessions(); // to max set before any spell added
591
592 // apply original stats mods before spell loading or item equipment that call before equip _RemoveStatsMods()
593 UpdateMaxHealth(); // Update max Health (for add bonus from stamina)
595 if (getPowerType() == POWER_MANA)
596 {
597 UpdateMaxPower(POWER_MANA); // Update max Mana (for add bonus from intellect)
599 }
600
602 {
607 }
608
609 // original spells
612
613 // original action bar
614 for (PlayerCreateInfoActions::const_iterator action_itr = info->action.begin(); action_itr != info->action.end(); ++action_itr)
615 addActionButton(action_itr->button, action_itr->action, action_itr->type);
616
617 // original items
618 if (CharStartOutfitEntry const* oEntry = GetCharStartOutfitEntry(createInfo->Race, createInfo->Class, createInfo->Gender))
619 {
620 for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j)
621 {
622 if (oEntry->ItemId[j] <= 0)
623 continue;
624
625 uint32 itemId = oEntry->ItemId[j];
626
627 // just skip, reported in ObjectMgr::LoadItemTemplates
628 ItemTemplate const* iProto = sObjectMgr->GetItemTemplate(itemId);
629 if (!iProto)
630 continue;
631
632 // BuyCount by default
633 uint32 count = iProto->BuyCount;
634
635 // special amount for food/drink
636 if (iProto->Class == ITEM_CLASS_CONSUMABLE && iProto->SubClass == ITEM_SUBCLASS_FOOD)
637 {
638 switch (iProto->Spells[0].SpellCategory)
639 {
640 case SPELL_CATEGORY_FOOD: // food
641 count = getClass() == CLASS_DEATH_KNIGHT ? 10 : 4;
642 break;
643 case SPELL_CATEGORY_DRINK: // drink
644 count = 2;
645 break;
646 }
647 if (iProto->GetMaxStackSize() < count)
648 count = iProto->GetMaxStackSize();
649 }
650 StoreNewItemInBestSlots(itemId, count);
651 }
652 }
653
654 for (PlayerCreateInfoItems::const_iterator item_id_itr = info->item.begin(); item_id_itr != info->item.end(); ++item_id_itr)
655 StoreNewItemInBestSlots(item_id_itr->item_id, item_id_itr->item_amount);
656
657 // bags and main-hand weapon must equipped at this moment
658 // now second pass for not equipped (offhand weapon/shield if it attempt equipped before main-hand weapon)
659 // or ammo not equipped in special bag
661 {
662 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
663 {
664 uint16 eDest;
665 // equip offhand weapon/shield if it attempt equipped before main-hand weapon
666 InventoryResult msg = CanEquipItem(NULL_SLOT, eDest, pItem, false);
667 if (msg == EQUIP_ERR_OK)
668 {
670 EquipItem(eDest, pItem, true);
671 }
672 // move other items to more appropriate slots (ammo not equipped in special bag)
673 else
674 {
675 ItemPosCountVec sDest;
676 msg = CanStoreItem(NULL_BAG, NULL_SLOT, sDest, pItem, false);
677 if (msg == EQUIP_ERR_OK)
678 {
680 pItem = StoreItem(sDest, pItem, true);
681 }
682
683 // if this is ammo then use it
684 msg = CanUseAmmo(pItem->GetEntry());
685 if (msg == EQUIP_ERR_OK)
686 SetAmmo(pItem->GetEntry());
687 }
688 }
689 }
690 // all item positions resolved
691
693
694 return true;
695}
CharStartOutfitEntry const * GetCharStartOutfitEntry(uint8 race, uint8 class_, uint8 gender)
Definition: DBCStores.cpp:838
DBCStorage< ChrClassesEntry > sChrClassesStore(ChrClassesEntryfmt)
@ ITEM_CLASS_CONSUMABLE
Definition: ItemTemplate.h:300
@ ITEM_SUBCLASS_FOOD
Definition: ItemTemplate.h:328
@ PLAYER_GUILD_TIMESTAMP
Definition: UpdateFields.h:185
@ PLAYER_GUILDID
Definition: UpdateFields.h:179
@ PLAYER_FIELD_COINAGE
Definition: UpdateFields.h:359
@ UNIT_FIELD_BYTES_0
Definition: UpdateFields.h:95
@ UNIT_FIELD_LEVEL
Definition: UpdateFields.h:114
@ UNIT_MOD_CAST_SPEED
Definition: UpdateFields.h:137
@ PLAYER_GUILDRANK
Definition: UpdateFields.h:180
@ UNIT_FIELD_HOVERHEIGHT
Definition: UpdateFields.h:173
@ UNIT_FIELD_BYTES_2
Definition: UpdateFields.h:161
@ REST_STATE_RAF_LINKED
Definition: Player.h:978
@ REST_STATE_NOT_RAF_LINKED
Definition: Player.h:977
@ UNIT_FLAG2_REGENERATE_POWER
Definition: Unit.h:498
@ UNIT_BYTE2_FLAG_PVP
Definition: Unit.h:136
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition: Unit.h:451
@ CONFIG_START_HEROIC_PLAYER_MONEY
Definition: IWorld.h:241
@ CONFIG_GAME_TYPE
Definition: IWorld.h:218
@ CONFIG_START_GM_LEVEL
Definition: IWorld.h:261
@ CONFIG_START_HEROIC_PLAYER_LEVEL
Definition: IWorld.h:239
@ CONFIG_START_ARENA_POINTS
Definition: IWorld.h:246
@ CONFIG_START_PLAYER_MONEY
Definition: IWorld.h:240
@ CONFIG_START_PLAYER_LEVEL
Definition: IWorld.h:238
@ CONFIG_START_HONOR_POINTS
Definition: IWorld.h:244
#define MAX_OUTFIT_ITEMS
Definition: DBCStructure.h:617
@ REALM_TYPE_RPPVP
Definition: Realm.h:57
@ REALM_TYPE_PVP
Definition: Realm.h:54
@ POWER_RUNIC_POWER
Definition: SharedDefines.h:275
@ POWER_RUNE
Definition: SharedDefines.h:274
@ SPELL_CATEGORY_DRINK
Definition: SharedDefines.h:344
@ SPELL_CATEGORY_FOOD
Definition: SharedDefines.h:343
uint32 SpellCategory
Definition: ItemTemplate.h:605
void _Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
Definition: Object.cpp:134
void SetInt32Value(uint16 index, int32 value)
Definition: Object.cpp:637
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:737
void SetUInt64Value(uint16 index, uint64 value)
Definition: Object.cpp:671
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition: Object.cpp:911
void Relocate(float x, float y)
Definition: Position.h:73
PlayerCreateInfoActions action
Definition: Player.h:351
PlayerCreateInfoItems item
Definition: Player.h:348
bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count)
Definition: Player.cpp:697
void InitPrimaryProfessions()
Definition: Player.cpp:11425
void InitGlyphsForLevel()
Definition: Player.cpp:13202
void UpdateMaxPower(Powers power) override
Definition: StatSystem.cpp:309
void LearnCustomSpells()
Definition: Player.cpp:11752
void SetArenaPoints(uint32 value)
Definition: Player.cpp:6177
void SetObjectScale(float scale) override
Definition: Player.h:1070
void InitDisplayIds()
Definition: Player.cpp:10535
InventoryResult CanUseAmmo(uint32 item) const
Definition: PlayerStorage.cpp:2484
void SetAmmo(uint32 item)
Definition: PlayerStorage.cpp:2514
void SetHonorPoints(uint32 value)
Definition: Player.cpp:6156
void InitTaxiNodesForLevel()
Definition: Player.h:1134
void InitStatsForLevel(bool reapplyMods=false)
Definition: Player.cpp:2548
void UpdateMaxHealth() override
Definition: StatSystem.cpp:296
Item * EquipItem(uint16 pos, Item *pItem, bool update)
Definition: PlayerStorage.cpp:2749
void InitRunes()
Definition: Player.cpp:13372
void SetMap(Map *map) override
Definition: Player.cpp:14591
void SetFactionForRace(uint8 race)
Definition: Player.cpp:5764
void CheckAllAchievementCriteria()
Definition: Player.cpp:13816
void LearnDefaultSkills()
Definition: Player.cpp:11778
void SetFullHealth()
Definition: Unit.h:1469
uint8 m_realRace
Definition: Unit.h:2492
uint8 m_race
Definition: Unit.h:2493
void SetUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:1501
void SetMaxPower(Powers power, uint32 val)
Definition: Unit.cpp:15617
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:1495
uint8 HairColor
Definition: WorldSession.h:281
uint8 Skin
Definition: WorldSession.h:278
uint8 Class
Definition: WorldSession.h:276
std::string Name
User specified variables.
Definition: WorldSession.h:274
uint8 FacialHair
Definition: WorldSession.h:282
uint8 HairStyle
Definition: WorldSession.h:280
uint8 Face
Definition: WorldSession.h:279
uint8 Gender
Definition: WorldSession.h:277
uint8 Race
Definition: WorldSession.h:275
Definition: DBCStructure.h:620
Definition: DBCStructure.h:653
uint32 powerType
Definition: DBCStructure.h:656

References Object::_Create(), PlayerInfo::action, addActionButton(), ItemTemplate::BuyCount, CanEquipItem(), CanStoreItem(), CanUseAmmo(), CheckAllAchievementCriteria(), ItemTemplate::Class, CharacterCreateInfo::Class, CLASS_DEATH_KNIGHT, CONFIG_GAME_TYPE, CONFIG_START_ARENA_POINTS, CONFIG_START_GM_LEVEL, CONFIG_START_HEROIC_PLAYER_LEVEL, CONFIG_START_HEROIC_PLAYER_MONEY, CONFIG_START_HONOR_POINTS, CONFIG_START_PLAYER_LEVEL, CONFIG_START_PLAYER_MONEY, EQUIP_ERR_OK, EquipItem(), CharacterCreateInfo::Face, CharacterCreateInfo::FacialHair, CharacterCreateInfo::Gender, GetCharStartOutfitEntry(), Unit::getClass(), GameTime::GetGameTime(), GetItemByPos(), Unit::GetMaxPower(), ItemTemplate::GetMaxStackSize(), Unit::getPowerType(), GetSession(), CharacterCreateInfo::HairColor, CharacterCreateInfo::HairStyle, InitDisplayIds(), InitGlyphsForLevel(), InitPrimaryProfessions(), InitRunes(), InitStatsForLevel(), InitTalentForLevel(), InitTaxiNodesForLevel(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, AccountMgr::IsPlayerAccount(), IsValidGender(), PlayerInfo::item, ITEM_CLASS_CONSUMABLE, ITEM_SUBCLASS_FOOD, KNOWN_TITLES_SIZE, LearnCustomSpells(), LearnDefaultSkills(), LOG_ERROR, m_items, m_Last_tick, WorldObject::m_name, m_Played_time, Unit::m_race, Unit::m_realRace, PlayerInfo::mapId, MAX_OUTFIT_ITEMS, CharacterCreateInfo::Name, NULL_BAG, NULL_SLOT, PlayerInfo::orientation, PLAYED_TIME_LEVEL, PLAYED_TIME_TOTAL, PLAYER__FIELD_KNOWN_TITLES, PLAYER_BYTES, PLAYER_BYTES_2, PLAYER_BYTES_3, PLAYER_CHOSEN_TITLE, PLAYER_FIELD_COINAGE, PLAYER_FIELD_KILLS, PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, PLAYER_FIELD_TODAY_CONTRIBUTION, PLAYER_FIELD_WATCHED_FACTION_INDEX, PLAYER_FIELD_YESTERDAY_CONTRIBUTION, PLAYER_GUILD_TIMESTAMP, PLAYER_GUILDID, PLAYER_GUILDRANK, PLAYER_SLOTS_COUNT, PlayerInfo::positionX, PlayerInfo::positionY, PlayerInfo::positionZ, POWER_MANA, POWER_RUNE, POWER_RUNIC_POWER, ChrClassesEntry::powerType, CharacterCreateInfo::Race, REALM_TYPE_PVP, REALM_TYPE_RPPVP, Position::Relocate(), RemoveItem(), REST_STATE_NOT_RAF_LINKED, REST_STATE_RAF_LINKED, sChrClassesStore, SetAmmo(), SetArenaPoints(), Object::SetByteFlag(), Object::SetByteValue(), SetFactionForRace(), Object::SetFloatValue(), Unit::SetFullHealth(), SetHonorPoints(), Object::SetInt32Value(), SetMap(), Unit::SetMaxPower(), SetObjectScale(), Unit::SetPower(), Object::SetUInt32Value(), Object::SetUInt64Value(), Unit::SetUnitFlag(), Unit::SetUnitFlag2(), CharacterCreateInfo::Skin, sMapMgr, sObjectMgr, SPELL_CATEGORY_DRINK, SPELL_CATEGORY_FOOD, _Spell::SpellCategory, ItemTemplate::Spells, StoreItem(), StoreNewItemInBestSlots(), ItemTemplate::SubClass, sWorld, UNIT_BYTE2_FLAG_PVP, UNIT_FIELD_BYTES_0, UNIT_FIELD_BYTES_2, UNIT_FIELD_HOVERHEIGHT, UNIT_FIELD_LEVEL, UNIT_FLAG2_REGENERATE_POWER, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_MOD_CAST_SPEED, UpdateMaxHealth(), and UpdateMaxPower().

◆ CreateCorpse()

Corpse * Player::CreateCorpse ( )
4506{
4507 // prevent existence 2 corpse for player
4509
4510 uint32 _uf, _pb, _pb2, _cfb1, _cfb2;
4511
4513 SetPvPDeath(false);
4514
4515 if (!corpse->Create(GetMap()->GenerateLowGuid<HighGuid::Corpse>(), this))
4516 {
4517 delete corpse;
4518 return nullptr;
4519 }
4520
4522
4523 _uf = getRace();
4526
4527 uint8 race = (uint8)(_uf);
4528 uint8 skin = (uint8)(_pb);
4529 uint8 face = (uint8)(_pb >> 8);
4530 uint8 hairstyle = (uint8)(_pb >> 16);
4531 uint8 haircolor = (uint8)(_pb >> 24);
4532 uint8 facialhair = (uint8)(_pb2);
4533
4534 _cfb1 = ((0x00) | (race << 8) | (GetByteValue(PLAYER_BYTES_3, 0) << 16) | (skin << 24));
4535 _cfb2 = ((face) | (hairstyle << 8) | (haircolor << 16) | (facialhair << 24));
4536
4537 corpse->SetUInt32Value(CORPSE_FIELD_BYTES_1, _cfb1);
4538 corpse->SetUInt32Value(CORPSE_FIELD_BYTES_2, _cfb2);
4539
4540 uint32 flags = CORPSE_FLAG_UNK2;
4542 flags |= CORPSE_FLAG_HIDE_HELM;
4544 flags |= CORPSE_FLAG_HIDE_CLOAK;
4545
4546 // Xinef: Player can loop corpses while in BG or in WG
4547 if (InBattleground() && !InArena())
4548 flags |= CORPSE_FLAG_LOOTABLE;
4549 Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
4550 if (Bf && Bf->IsWarTime())
4551 flags |= CORPSE_FLAG_LOOTABLE;
4552
4553 corpse->SetUInt32Value(CORPSE_FIELD_FLAGS, flags);
4554
4556
4558
4559 uint32 iDisplayID;
4560 uint32 iIventoryType;
4561 uint32 _cfi;
4562 for (uint8 i = 0; i < EQUIPMENT_SLOT_END; i++)
4563 {
4564 if (m_items[i])
4565 {
4566 iDisplayID = m_items[i]->GetTemplate()->DisplayInfoID;
4567 iIventoryType = m_items[i]->GetTemplate()->InventoryType;
4568
4569 _cfi = iDisplayID | (iIventoryType << 24);
4570 corpse->SetUInt32Value(CORPSE_FIELD_ITEM + i, _cfi);
4571 }
4572 }
4573
4574 // register for player, but not show
4575 GetMap()->AddCorpse(corpse);
4576
4578
4579 // we do not need to save corpses for BG/arenas
4580 if (!GetMap()->IsBattlegroundOrArena())
4581 corpse->SaveToDB();
4582
4583 return corpse;
4584}
@ BATTLEFIELD_BATTLEID_WG
Definition: Battlefield.h:37
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:77
@ CORPSE_RESURRECTABLE_PVE
Definition: Corpse.h:29
@ CORPSE_FLAG_HIDE_CLOAK
Definition: Corpse.h:44
@ CORPSE_FLAG_UNK2
Definition: Corpse.h:42
@ CORPSE_FLAG_HIDE_HELM
Definition: Corpse.h:43
@ CORPSE_FLAG_LOOTABLE
Definition: Corpse.h:45
@ CORPSE_FIELD_BYTES_2
Definition: UpdateFields.h:425
@ CORPSE_FIELD_FLAGS
Definition: UpdateFields.h:427
@ CORPSE_FIELD_BYTES_1
Definition: UpdateFields.h:424
@ CORPSE_FIELD_DISPLAY_ID
Definition: UpdateFields.h:422
@ CORPSE_FIELD_ITEM
Definition: UpdateFields.h:423
@ CORPSE_FIELD_GUILD
Definition: UpdateFields.h:426
Definition: Battlefield.h:206
bool IsWarTime()
Return true if battle is start, false if battle is not started.
Definition: Battlefield.h:249
void SaveToDB()
Definition: Corpse.cpp:91
bool Create(ObjectGuid::LowType guidlow)
Definition: Corpse.cpp:62
void UpdatePositionData()
Definition: Object.cpp:1154
void WorldRelocate(const WorldLocation &loc)
Definition: Position.h:259
WorldLocation _corpseLocation
Definition: Player.h:2950
void SpawnCorpseBones(bool triggerSave=true)
Definition: Player.cpp:4600
void SetPvPDeath(bool on)
Definition: Player.h:1158
bool InArena() const
Definition: Player.cpp:12218
uint32 GetNativeDisplayId() const
Definition: Unit.h:2184
void AddCorpse(Corpse *corpse)
Definition: Map.cpp:3590

References _corpseLocation, Map::AddCorpse(), BATTLEFIELD_BATTLEID_WG, CORPSE_FIELD_BYTES_1, CORPSE_FIELD_BYTES_2, CORPSE_FIELD_DISPLAY_ID, CORPSE_FIELD_FLAGS, CORPSE_FIELD_GUILD, CORPSE_FIELD_ITEM, CORPSE_FLAG_HIDE_CLOAK, CORPSE_FLAG_HIDE_HELM, CORPSE_FLAG_LOOTABLE, CORPSE_FLAG_UNK2, CORPSE_RESURRECTABLE_PVE, CORPSE_RESURRECTABLE_PVP, Corpse::Create(), ItemTemplate::DisplayInfoID, EQUIPMENT_SLOT_END, Object::GetByteValue(), GetGuildId(), WorldObject::GetMap(), Unit::GetNativeDisplayId(), Unit::getRace(), Item::GetTemplate(), Object::GetUInt32Value(), HasPlayerFlag(), InArena(), InBattleground(), ItemTemplate::InventoryType, Battlefield::IsWarTime(), m_ExtraFlags, m_items, PLAYER_BYTES, PLAYER_BYTES_2, PLAYER_BYTES_3, PLAYER_EXTRA_PVP_DEATH, PLAYER_FLAGS_HIDE_CLOAK, PLAYER_FLAGS_HIDE_HELM, Corpse::SaveToDB(), sBattlefieldMgr, SetPvPDeath(), Object::SetUInt32Value(), SpawnCorpseBones(), WorldObject::UpdatePositionData(), and WorldLocation::WorldRelocate().

Referenced by BuildPlayerRepop().

◆ CreatePet() [1/2]

Pet * Player::CreatePet ( Creature creatureTarget,
uint32  spellID = 0 
)
9115{
9116 if (IsExistPet())
9117 {
9118 return nullptr;
9119 }
9120
9121 if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
9122 {
9123 return nullptr;
9124 }
9125
9126 CreatureTemplate const* creatrueTemplate = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry());
9127 if (!creatrueTemplate->family)
9128 {
9129 // Creatures with family 0 crashes the server
9130 return nullptr;
9131 }
9132
9133 // Everything looks OK, create new pet
9134 Pet* pet = CreateTamedPetFrom(creatureTarget, spellID);
9135 if (!pet)
9136 {
9137 return nullptr;
9138 }
9139
9140 // "kill" original creature
9141 creatureTarget->DespawnOrUnsummon();
9142
9143 // calculate proper level
9144 uint8 level = (creatureTarget->GetLevel() < (GetLevel() - 5)) ? (GetLevel() - 5) : GetLevel();
9145
9146 // prepare visual effect for levelup
9147 pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
9148
9149 // add to world
9150 pet->GetMap()->AddToMap(pet->ToCreature());
9151
9152 // visual effect for levelup
9153 pet->SetUInt32Value(UNIT_FIELD_LEVEL, level);
9154
9155 // caster have pet now
9156 SetMinion(pet, true);
9157
9158 pet->InitTalentForLevel();
9159
9162
9163 return pet;
9164}
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition: Creature.cpp:2117
uint32 family
Definition: CreatureData.h:210
void InitTalentForLevel()
Definition: Pet.cpp:2216
void SavePetToDB(PetSaveMode mode)
Definition: Pet.cpp:493
bool IsExistPet()
Definition: Player.cpp:9108
void PetSpellInitialize()
Definition: Player.cpp:9387
void SetMinion(Minion *minion, bool apply)
Definition: Unit.cpp:10679
Pet * CreateTamedPetFrom(Creature *creatureTarget, uint32 spell_id=0)
Definition: Unit.cpp:17605
bool IsPet() const
Definition: Unit.h:1425

References Map::AddToMap(), Unit::CreateTamedPetFrom(), Creature::DespawnOrUnsummon(), CreatureTemplate::family, Object::GetEntry(), Unit::GetLevel(), WorldObject::GetMap(), Object::GetTypeId(), Pet::InitTalentForLevel(), IsExistPet(), Unit::IsPet(), PET_SAVE_AS_CURRENT, PetSpellInitialize(), Pet::SavePetToDB(), Unit::SetMinion(), Object::SetUInt32Value(), sObjectMgr, Object::ToCreature(), TYPEID_PLAYER, and UNIT_FIELD_LEVEL.

Referenced by npc_commandscript::HandleNpcTameCommand(), and pet_commandscript::HandlePetCreateCommand().

◆ CreatePet() [2/2]

Pet * Player::CreatePet ( uint32  creatureEntry,
uint32  spellID = 0 
)
9167{
9168 if (IsExistPet())
9169 {
9170 return nullptr;
9171 }
9172
9173 CreatureTemplate const* creatrueTemplate = sObjectMgr->GetCreatureTemplate(creatureEntry);
9174 if (!creatrueTemplate->family)
9175 {
9176 // Creatures with family 0 crashes the server
9177 return nullptr;
9178 }
9179
9180 // Everything looks OK, create new pet
9181 Pet* pet = CreateTamedPetFrom(creatureEntry, spellID);
9182 if (!pet)
9183 {
9184 return nullptr;
9185 }
9186
9187 // prepare visual effect for levelup
9189
9190 // add to world
9191 pet->GetMap()->AddToMap(pet->ToCreature());
9192
9193 // visual effect for levelup
9195
9196 // caster have pet now
9197 SetMinion(pet, true);
9198
9199 pet->InitTalentForLevel();
9200
9203
9204 return pet;
9205}

References Map::AddToMap(), Unit::CreateTamedPetFrom(), CreatureTemplate::family, Unit::GetLevel(), WorldObject::GetMap(), Pet::InitTalentForLevel(), IsExistPet(), PET_SAVE_AS_CURRENT, PetSpellInitialize(), Pet::SavePetToDB(), Unit::SetMinion(), Object::SetUInt32Value(), sObjectMgr, Object::ToCreature(), and UNIT_FIELD_LEVEL.

◆ Customize()

void Player::Customize ( CharacterCustomizeInfo const *  customizeInfo,
CharacterDatabaseTransaction  trans 
)
static
115{
117 stmt->SetData(0, customizeInfo->Gender);
118 stmt->SetData(1, customizeInfo->Skin);
119 stmt->SetData(2, customizeInfo->Face);
120 stmt->SetData(3, customizeInfo->HairStyle);
121 stmt->SetData(4, customizeInfo->HairColor);
122 stmt->SetData(5, customizeInfo->FacialHair);
123 stmt->SetData(6, customizeInfo->Guid.GetCounter());
124
125 CharacterDatabase.ExecuteOrAppend(trans, stmt);
126}
@ CHAR_UPD_GENDER_AND_APPEARANCE
Definition: CharacterDatabase.h:315

References CHAR_UPD_GENDER_AND_APPEARANCE, CharacterDatabase, CharacterCustomizeInfo::Face, CharacterCustomizeInfo::FacialHair, CharacterCustomizeInfo::Gender, ObjectGuid::GetCounter(), CharacterRenameInfo::Guid, CharacterCustomizeInfo::HairColor, CharacterCustomizeInfo::HairStyle, PreparedStatementBase::SetData(), and CharacterCustomizeInfo::Skin.

Referenced by WorldSession::HandleCharCustomizeCallback(), and WorldSession::HandleCharFactionOrRaceChangeCallback().

◆ DeleteEquipmentSet()

void Player::DeleteEquipmentSet ( uint64  setGuid)
14539{
14540 for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
14541 {
14542 if (itr->second.Guid == setGuid)
14543 {
14544 if (itr->second.state == EQUIPMENT_SET_NEW)
14545 m_EquipmentSets.erase(itr);
14546 else
14547 itr->second.state = EQUIPMENT_SET_DELETED;
14548 break;
14549 }
14550 }
14551}

References EQUIPMENT_SET_DELETED, EQUIPMENT_SET_NEW, and m_EquipmentSets.

Referenced by WorldSession::HandleEquipmentSetDelete().

◆ DeleteFromDB()

void Player::DeleteFromDB ( ObjectGuid::LowType  lowGuid,
uint32  accountId,
bool  updateRealmChars,
bool  deleteFinally 
)
static

Deletes a character from the database

The way, how the characters will be deleted is decided based on the config option.

Parameters
playerguidthe low-GUID from the player which should be deleted
accountIdthe account id from the player
updateRealmCharswhen this flag is set, the amount of characters on that realm will be updated in the realmlist
deleteFinallyif this flag is set, the config option will be ignored and the character will be permanently removed from the database
3928{
3929 // for not existed account avoid update realm
3930 if (!accountId)
3931 updateRealmChars = false;
3932
3933 ObjectGuid playerGuid = ObjectGuid::Create<HighGuid::Player>(lowGuid);
3934
3935 uint32 charDelete_method = sWorld->getIntConfig(CONFIG_CHARDELETE_METHOD);
3936 uint32 charDelete_minLvl = sWorld->getIntConfig(CONFIG_CHARDELETE_MIN_LEVEL);
3937
3938 // if we want to finally delete the character or the character does not meet the level requirement,
3939 // we set it to mode CHAR_DELETE_REMOVE
3940 if (deleteFinally || sCharacterCache->GetCharacterLevelByGuid(playerGuid) < charDelete_minLvl)
3941 charDelete_method = CHAR_DELETE_REMOVE;
3942
3943 if (uint32 guildId = sCharacterCache->GetCharacterGuildIdByGuid(playerGuid))
3944 if (Guild* guild = sGuildMgr->GetGuildById(guildId))
3945 guild->DeleteMember(playerGuid, false, false, true);
3946
3947 // remove from arena teams
3948 LeaveAllArenaTeams(playerGuid);
3949
3950 // close player ticket if any
3951 GmTicket* ticket = sTicketMgr->GetTicketByPlayer(playerGuid);
3952 if (ticket)
3953 sTicketMgr->CloseTicket(ticket->GetId(), playerGuid);
3954
3955 // remove from group
3956 if (uint32 groupId = sCharacterCache->GetCharacterGuildIdByGuid(playerGuid))
3957 if (Group* group = sGroupMgr->GetGroupByGUID(groupId))
3958 RemoveFromGroup(group, playerGuid);
3959
3960 // Remove signs from petitions (also remove petitions if owner);
3961 RemovePetitionsAndSigns(playerGuid, 10);
3962
3963 CharacterDatabasePreparedStatement* stmt = nullptr;
3964
3965 switch (charDelete_method)
3966 {
3967 // Completely remove from the database
3968 case CHAR_DELETE_REMOVE:
3969 {
3970 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
3971
3972 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_COD_ITEM_MAIL);
3973 stmt->SetData(0, lowGuid);
3974 PreparedQueryResult resultMail = CharacterDatabase.Query(stmt);
3975
3976 if (resultMail)
3977 {
3978 std::unordered_map<uint32, std::vector<Item*>> itemsByMail;
3979
3980 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS);
3981 stmt->SetData(0, lowGuid);
3982 PreparedQueryResult resultItems = CharacterDatabase.Query(stmt);
3983
3984 if (resultItems)
3985 {
3986 do
3987 {
3988 Field* fields = resultItems->Fetch();
3989 uint32 mailId = fields[14].Get<uint32>();
3990 if (Item* mailItem = _LoadMailedItem(playerGuid, nullptr, mailId, nullptr, fields))
3991 {
3992 itemsByMail[mailId].push_back(mailItem);
3993 }
3994 } while (resultItems->NextRow());
3995 }
3996
3997 do
3998 {
3999 Field* mailFields = resultMail->Fetch();
4000
4001 uint32 mail_id = mailFields[0].Get<uint32>();
4002 uint8 mailType = mailFields[1].Get<uint8>();
4003 uint16 mailTemplateId = mailFields[2].Get<uint16>();
4004 uint32 sender = mailFields[3].Get<uint32>();
4005 std::string subject = mailFields[4].Get<std::string>();
4006 std::string body = mailFields[5].Get<std::string>();
4007 uint32 money = mailFields[6].Get<uint32>();
4008 bool has_items = mailFields[7].Get<bool>();
4009
4010 // We can return mail now
4011 // So firstly delete the old one
4012 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID);
4013 stmt->SetData(0, mail_id);
4014 trans->Append(stmt);
4015
4016 // Mail is not from player
4017 if (mailType != MAIL_NORMAL)
4018 {
4019 if (has_items)
4020 {
4021 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID);
4022 stmt->SetData(0, mail_id);
4023 trans->Append(stmt);
4024 }
4025 continue;
4026 }
4027
4028 MailDraft draft(subject, body);
4029 if (mailTemplateId)
4030 draft = MailDraft(mailTemplateId, false); // items are already included
4031
4032 auto itemsItr = itemsByMail.find(mail_id);
4033 if (itemsItr != itemsByMail.end())
4034 {
4035 for (Item* item : itemsItr->second)
4036 {
4037 draft.AddItem(item);
4038 }
4039
4040 // MailDraft will take care of freeing memory.
4041 itemsByMail.erase(itemsItr);
4042 }
4043
4044 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID);
4045 stmt->SetData(0, mail_id);
4046 trans->Append(stmt);
4047
4048 uint32 pl_account = sCharacterCache->GetCharacterAccountIdByGuid(ObjectGuid(HighGuid::Player, lowGuid));
4049
4050 draft.AddMoney(money).SendReturnToSender(pl_account, lowGuid, sender, trans);
4051 } while (resultMail->NextRow());
4052 }
4053
4054 // Unsummon and delete for pets in world is not required: player deleted from CLI or character list with not loaded pet.
4055 // NOW we can finally clear other DB data related to character
4056 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET_IDS);
4057 stmt->SetData(0, lowGuid);
4058 PreparedQueryResult resultPets = CharacterDatabase.Query(stmt);
4059
4060 if (resultPets)
4061 {
4062 do
4063 {
4064 ObjectGuid::LowType petguidlow = (*resultPets)[0].Get<uint32>();
4065 Pet::DeleteFromDB(petguidlow);
4066 } while (resultPets->NextRow());
4067 }
4068
4069 // Delete char from social list of online chars
4070 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_SOCIAL);
4071 stmt->SetData(0, lowGuid);
4072 PreparedQueryResult resultFriends = CharacterDatabase.Query(stmt);
4073
4074 if (resultFriends)
4075 {
4076 do
4077 {
4078 if (Player* pFriend = ObjectAccessor::FindPlayerByLowGUID((*resultFriends)[0].Get<uint32>()))
4079 {
4080 pFriend->GetSocial()->RemoveFromSocialList(playerGuid, SOCIAL_FLAG_ALL);
4081 sSocialMgr->SendFriendStatus(pFriend, FRIEND_REMOVED, playerGuid, false);
4082 }
4083 } while (resultFriends->NextRow());
4084 }
4085
4086 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER);
4087 stmt->SetData(0, lowGuid);
4088 trans->Append(stmt);
4089
4090 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_ACCOUNT_DATA);
4091 stmt->SetData(0, lowGuid);
4092 trans->Append(stmt);
4093
4094 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_DECLINED_NAME);
4095 stmt->SetData(0, lowGuid);
4096 trans->Append(stmt);
4097
4098 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACTION);
4099 stmt->SetData(0, lowGuid);
4100 trans->Append(stmt);
4101
4102 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA);
4103 stmt->SetData(0, lowGuid);
4104 trans->Append(stmt);
4105
4106 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_GIFT);
4107 stmt->SetData(0, lowGuid);
4108 trans->Append(stmt);
4109
4110 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_HOMEBIND);
4111 stmt->SetData(0, lowGuid);
4112 trans->Append(stmt);
4113
4114 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE);
4115 stmt->SetData(0, lowGuid);
4116 trans->Append(stmt);
4117
4118 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY);
4119 stmt->SetData(0, lowGuid);
4120 trans->Append(stmt);
4121
4122 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS);
4123 stmt->SetData(0, lowGuid);
4124 trans->Append(stmt);
4125
4126 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED);
4127 stmt->SetData(0, lowGuid);
4128 trans->Append(stmt);
4129
4130 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REPUTATION);
4131 stmt->SetData(0, lowGuid);
4132 trans->Append(stmt);
4133
4134 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL);
4135 stmt->SetData(0, lowGuid);
4136 trans->Append(stmt);
4137
4138 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_COOLDOWN);
4139 stmt->SetData(0, lowGuid);
4140 trans->Append(stmt);
4141
4142 if (sWorld->getBoolConfig(CONFIG_DELETE_CHARACTER_TICKET_TRACE))
4143 {
4145 stmt->SetData(0, lowGuid);
4146 trans->Append(stmt);
4147 }
4148 else
4149 {
4150 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_GM_TICKETS);
4151 stmt->SetData(0, lowGuid);
4152 trans->Append(stmt);
4153 }
4154
4155 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_BY_OWNER);
4156 stmt->SetData(0, lowGuid);
4157 trans->Append(stmt);
4158
4159 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND);
4160 stmt->SetData(0, lowGuid);
4161 trans->Append(stmt);
4162
4163 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID);
4164 stmt->SetData(0, lowGuid);
4165 trans->Append(stmt);
4166
4167 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL);
4168 stmt->SetData(0, lowGuid);
4169 trans->Append(stmt);
4170
4171 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEMS);
4172 stmt->SetData(0, lowGuid);
4173 trans->Append(stmt);
4174
4175 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_OWNER);
4176 stmt->SetData(0, lowGuid);
4177 trans->Append(stmt);
4178
4180 stmt->SetData(0, lowGuid);
4181 trans->Append(stmt);
4182
4183 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENTS);
4184 stmt->SetData(0, lowGuid);
4185 trans->Append(stmt);
4186
4187 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS);
4188 stmt->SetData(0, lowGuid);
4189 trans->Append(stmt);
4190
4191 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_EQUIPMENTSETS);
4192 stmt->SetData(0, lowGuid);
4193 trans->Append(stmt);
4194
4195 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_EVENTLOG_BY_PLAYER);
4196 stmt->SetData(0, lowGuid);
4197 stmt->SetData(1, lowGuid);
4198 trans->Append(stmt);
4199
4200 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_BANK_EVENTLOG_BY_PLAYER);
4201 stmt->SetData(0, lowGuid);
4202 trans->Append(stmt);
4203
4204 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_ENTRY_POINT);
4205 stmt->SetData(0, lowGuid);
4206 trans->Append(stmt);
4207
4208 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_GLYPHS);
4209 stmt->SetData(0, lowGuid);
4210 trans->Append(stmt);
4211
4212 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_DAILY_CHAR);
4213 stmt->SetData(0, lowGuid);
4214 trans->Append(stmt);
4215
4216 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_WEEKLY_CHAR);
4217 stmt->SetData(0, lowGuid);
4218 trans->Append(stmt);
4219
4220 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_MONTHLY_CHAR);
4221 stmt->SetData(0, lowGuid);
4222 trans->Append(stmt);
4223
4224 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_SEASONAL_CHAR);
4225 stmt->SetData(0, lowGuid);
4226 trans->Append(stmt);
4227
4228 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_TALENT);
4229 stmt->SetData(0, lowGuid);
4230 trans->Append(stmt);
4231
4232 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SKILLS);
4233 stmt->SetData(0, lowGuid);
4234 trans->Append(stmt);
4235
4236 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SETTINGS);
4237 stmt->SetData(0, lowGuid);
4238 trans->Append(stmt);
4239
4240 Corpse::DeleteFromDB(playerGuid, trans);
4241
4242 sScriptMgr->OnDeleteFromDB(trans, lowGuid);
4243
4244 CharacterDatabase.CommitTransaction(trans);
4245 break;
4246 }
4247 // The character gets unlinked from the account, the name gets freed up and appears as deleted ingame
4248 case CHAR_DELETE_UNLINK:
4249 {
4250 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_DELETE_INFO);
4251
4252 stmt->SetData(0, lowGuid);
4253
4254 CharacterDatabase.Execute(stmt);
4255 break;
4256 }
4257 default:
4258 LOG_ERROR("entities.player", "Player::DeleteFromDB: Unsupported delete method: {}.", charDelete_method);
4259 return;
4260 }
4261
4262 if (CharacterCacheEntry const* cache = sCharacterCache->GetCharacterCacheByGuid(playerGuid))
4263 {
4264 std::string name = cache->Name;
4265 sCharacterCache->DeleteCharacterCacheEntry(playerGuid, name);
4266 }
4267
4268 if (updateRealmChars)
4269 {
4270 sWorld->UpdateRealmCharCount(accountId);
4271 }
4272}
@ CHAR_DEL_CHAR_SOCIAL_BY_FRIEND
Definition: CharacterDatabase.h:390
@ CHAR_DEL_CHAR_GIFT
Definition: CharacterDatabase.h:405
@ CHAR_DEL_CHAR_PET_DECLINEDNAME_BY_OWNER
Definition: CharacterDatabase.h:473
@ CHAR_DEL_GUILD_BANK_EVENTLOG_BY_PLAYER
Definition: CharacterDatabase.h:416
@ CHAR_DEL_GUILD_EVENTLOG_BY_PLAYER
Definition: CharacterDatabase.h:415
@ CHAR_DEL_CHAR_SKILLS
Definition: CharacterDatabase.h:419
@ CHAR_DEL_CHAR_PET_BY_OWNER
Definition: CharacterDatabase.h:472
@ CHAR_DEL_ITEM_INSTANCE_BY_OWNER
Definition: CharacterDatabase.h:128
@ CHAR_DEL_CHAR_DECLINED_NAME
Definition: CharacterDatabase.h:381
@ CHAR_SEL_MAILITEMS
Definition: CharacterDatabase.h:101
@ CHAR_UPD_DELETE_INFO
Definition: CharacterDatabase.h:292
@ CHAR_DEL_CHAR_EQUIPMENTSETS
Definition: CharacterDatabase.h:414
@ CHAR_DEL_PLAYER_ACCOUNT_DATA
Definition: CharacterDatabase.h:203
@ CHAR_DEL_MAIL
Definition: CharacterDatabase.h:411
@ CHAR_DEL_CHAR_TALENT
Definition: CharacterDatabase.h:418
@ CHAR_SEL_CHAR_SOCIAL
Definition: CharacterDatabase.h:348
@ CHAR_DEL_CHAR_INVENTORY
Definition: CharacterDatabase.h:407
@ CHAR_DEL_CHAR_QUESTSTATUS
Definition: CharacterDatabase.h:388
@ CHAR_DEL_CHAR_ACTION
Definition: CharacterDatabase.h:403
@ CHAR_SEL_CHAR_PET_IDS
Definition: CharacterDatabase.h:475
@ CHAR_DEL_CHAR_ACHIEVEMENTS
Definition: CharacterDatabase.h:413
@ CHAR_SEL_CHAR_COD_ITEM_MAIL
Definition: CharacterDatabase.h:347
@ CHAR_UPD_PLAYER_GM_TICKETS_ON_CHAR_DELETION
Definition: CharacterDatabase.h:265
@ CHAR_DEL_CHAR_REPUTATION
Definition: CharacterDatabase.h:409
@ CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS
Definition: CharacterDatabase.h:364
@ CHAR_DEL_CHARACTER
Definition: CharacterDatabase.h:402
@ CHAR_DEL_CHAR_SOCIAL_BY_GUID
Definition: CharacterDatabase.h:389
@ CHAR_DEL_CHAR_SETTINGS
Definition: CharacterDatabase.h:517
@ CHAR_DEL_CHAR_SPELL
Definition: CharacterDatabase.h:410
@ CHAR_DEL_CHAR_QUESTSTATUS_REWARDED
Definition: CharacterDatabase.h:408
@ CHAR_DEL_PLAYER_GM_TICKETS
Definition: CharacterDatabase.h:264
@ CHAR_DEL_MAIL_ITEMS
Definition: CharacterDatabase.h:412
@ CHAR_DEL_CHAR_INSTANCE
Definition: CharacterDatabase.h:406
@ CHAR_DELETE_REMOVE
Definition: Player.h:945
@ CHAR_DELETE_UNLINK
Definition: Player.h:946
@ FRIEND_REMOVED
Definition: SocialMgr.h:72
#define sSocialMgr
Definition: SocialMgr.h:148
@ SOCIAL_FLAG_ALL
Definition: SocialMgr.h:45
#define sGuildMgr
Definition: GuildMgr.h:51
@ MAIL_NORMAL
Definition: Mail.h:38
#define sTicketMgr
Definition: TicketMgr.h:258
@ CONFIG_CHARDELETE_METHOD
Definition: IWorld.h:353
@ CONFIG_CHARDELETE_MIN_LEVEL
Definition: IWorld.h:354
@ CONFIG_DELETE_CHARACTER_TICKET_TRACE
Definition: IWorld.h:141
Player * FindPlayerByLowGUID(ObjectGuid::LowType lowguid)
Definition: ObjectAccessor.cpp:254
Definition: CharacterCache.h:28
void DeleteFromDB(CharacterDatabaseTransaction trans)
Definition: Corpse.cpp:120
void DeleteFromDB() override
Definition: Pet.h:170
static void RemoveFromGroup(Group *group, ObjectGuid guid, RemoveMethod method=GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker=ObjectGuid::Empty, const char *reason=nullptr)
Definition: Player.cpp:2328
static void RemovePetitionsAndSigns(ObjectGuid guid, uint32 type)
Definition: Player.cpp:10027
static void LeaveAllArenaTeams(ObjectGuid guid)
Definition: Player.cpp:10095
Definition: Guild.h:295
Definition: TicketMgr.h:88
uint32 GetId() const
Definition: TicketMgr.h:101

References _LoadMailedItem(), MailDraft::AddItem(), MailDraft::AddMoney(), CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS, CHAR_DEL_CHAR_ACHIEVEMENTS, CHAR_DEL_CHAR_ACTION, CHAR_DEL_CHAR_AURA, CHAR_DEL_CHAR_DECLINED_NAME, CHAR_DEL_CHAR_EQUIPMENTSETS, CHAR_DEL_CHAR_GIFT, CHAR_DEL_CHAR_GLYPHS, CHAR_DEL_CHAR_INSTANCE, CHAR_DEL_CHAR_INVENTORY, CHAR_DEL_CHAR_PET_BY_OWNER, CHAR_DEL_CHAR_PET_DECLINEDNAME_BY_OWNER, CHAR_DEL_CHAR_QUESTSTATUS, CHAR_DEL_CHAR_QUESTSTATUS_REWARDED, CHAR_DEL_CHAR_REPUTATION, CHAR_DEL_CHAR_SETTINGS, CHAR_DEL_CHAR_SKILLS, CHAR_DEL_CHAR_SOCIAL_BY_FRIEND, CHAR_DEL_CHAR_SOCIAL_BY_GUID, CHAR_DEL_CHAR_SPELL, CHAR_DEL_CHAR_SPELL_COOLDOWN, CHAR_DEL_CHAR_TALENT, CHAR_DEL_CHARACTER, CHAR_DEL_GUILD_BANK_EVENTLOG_BY_PLAYER, CHAR_DEL_GUILD_EVENTLOG_BY_PLAYER, CHAR_DEL_ITEM_INSTANCE_BY_OWNER, CHAR_DEL_MAIL, CHAR_DEL_MAIL_BY_ID, CHAR_DEL_MAIL_ITEM_BY_ID, CHAR_DEL_MAIL_ITEMS, CHAR_DEL_PLAYER_ACCOUNT_DATA, CHAR_DEL_PLAYER_ENTRY_POINT, CHAR_DEL_PLAYER_GM_TICKETS, CHAR_DEL_PLAYER_HOMEBIND, CHAR_DEL_QUEST_STATUS_DAILY_CHAR, CHAR_DEL_QUEST_STATUS_MONTHLY_CHAR, CHAR_DEL_QUEST_STATUS_SEASONAL_CHAR, CHAR_DEL_QUEST_STATUS_WEEKLY_CHAR, CHAR_DELETE_REMOVE, CHAR_DELETE_UNLINK, CHAR_SEL_CHAR_COD_ITEM_MAIL, CHAR_SEL_CHAR_PET_IDS, CHAR_SEL_CHAR_SOCIAL, CHAR_SEL_MAILITEMS, CHAR_UPD_DELETE_INFO, CHAR_UPD_PLAYER_GM_TICKETS_ON_CHAR_DELETION, CharacterDatabase, CONFIG_CHARDELETE_METHOD, CONFIG_CHARDELETE_MIN_LEVEL, CONFIG_DELETE_CHARACTER_TICKET_TRACE, Pet::DeleteFromDB(), Corpse::DeleteFromDB(), ObjectAccessor::FindPlayerByLowGUID(), FRIEND_REMOVED, Field::Get(), GmTicket::GetId(), LeaveAllArenaTeams(), LOG_ERROR, MAIL_NORMAL, RemoveFromGroup(), RemovePetitionsAndSigns(), sCharacterCache, MailDraft::SendReturnToSender(), PreparedStatementBase::SetData(), sGroupMgr, sGuildMgr, SOCIAL_FLAG_ALL, sScriptMgr, sSocialMgr, sTicketMgr, and sWorld.

Referenced by AccountMgr::DeleteAccount(), DeleteOldCharacters(), character_commandscript::HandleCharacterDeletedDeleteCommand(), character_commandscript::HandleCharacterEraseCommand(), and WorldSession::HandleCharDeleteOpcode().

◆ DeleteOldCharacters() [1/2]

void Player::DeleteOldCharacters ( )
static

Characters which were kept back in the database after being deleted and are now too old (see config option "CharDelete.KeepDays"), will be completely deleted.

4278{
4279 uint32 keepDays = sWorld->getIntConfig(CONFIG_CHARDELETE_KEEP_DAYS);
4280 if (!keepDays)
4281 return;
4282
4284}
@ CONFIG_CHARDELETE_KEEP_DAYS
Definition: IWorld.h:352
static void DeleteOldCharacters()
Definition: Player.cpp:4277

References CONFIG_CHARDELETE_KEEP_DAYS, DeleteOldCharacters(), and sWorld.

Referenced by DeleteOldCharacters(), character_commandscript::HandleCharacterDeletedPurgeCommand(), and World::SetInitialWorldSettings().

◆ DeleteOldCharacters() [2/2]

void Player::DeleteOldCharacters ( uint32  keepDays)
static

Characters which were kept back in the database after being deleted and are older than the specified amount of days, will be completely deleted.

4290{
4291 LOG_INFO("server.loading", "Player::DeleteOldChars: Deleting all characters which have been deleted {} days before...", keepDays);
4292 LOG_INFO("server.loading", " ");
4293
4295 stmt->SetData(0, uint32(GameTime::GetGameTime().count() - time_t(keepDays * DAY)));
4296 PreparedQueryResult result = CharacterDatabase.Query(stmt);
4297
4298 if (result)
4299 {
4300 LOG_INFO("server.loading", "Player::DeleteOldChars: Found {} character(s) to delete", result->GetRowCount());
4301 do
4302 {
4303 Field* fields = result->Fetch();
4304 Player::DeleteFromDB(fields[0].Get<uint32>(), fields[1].Get<uint32>(), true, true);
4305 } while (result->NextRow());
4306 }
4307}
constexpr auto DAY
Definition: Common.h:51
@ CHAR_SEL_CHAR_OLD_CHARS
Definition: CharacterDatabase.h:349
static void DeleteFromDB(ObjectGuid::LowType lowGuid, uint32 accountId, bool updateRealmChars, bool deleteFinally)
Definition: Player.cpp:3927

References CHAR_SEL_CHAR_OLD_CHARS, CharacterDatabase, DAY, DeleteFromDB(), GameTime::GetGameTime(), LOG_INFO, and PreparedStatementBase::SetData().

◆ DeleteRefundReference()

void Player::DeleteRefundReference ( ObjectGuid  itemGUID)
15432{
15433 RefundableItemsSet::iterator itr = m_refundableItems.find(itemGUID);
15434 if (itr != m_refundableItems.end())
15435 m_refundableItems.erase(itr);
15436}

References m_refundableItems.

Referenced by _SaveInventory(), Item::SetNotRefundable(), and Item::SetState().

◆ DestroyConjuredItems()

void Player::DestroyConjuredItems ( bool  update)
3365{
3366 // used when entering arena
3367 // destroys all conjured items
3368 LOG_DEBUG("entities.player.items", "STORAGE: DestroyConjuredItems");
3369
3370 // in inventory
3372 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3373 if (pItem->IsConjuredConsumable())
3375
3376 // in inventory bags
3378 if (Bag* pBag = GetBagByPos(i))
3379 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
3380 if (Item* pItem = pBag->GetItemByPos(j))
3381 if (pItem->IsConjuredConsumable())
3382 DestroyItem(i, j, update);
3383
3384 // in equipment and bag list
3386 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3387 if (pItem->IsConjuredConsumable())
3389}

References DestroyItem(), EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, and LOG_DEBUG.

Referenced by Battleground::AddPlayer().

◆ DestroyForPlayer()

void Player::DestroyForPlayer ( Player target,
bool  onDeath = false 
) const
overridevirtual

Reimplemented from Object.

3801{
3802 Unit::DestroyForPlayer(target, onDeath);
3803
3804 for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) // xinef: previously INVENTORY_SLOT_BAG_END
3805 {
3806 if (!m_items[i])
3807 continue;
3808
3809 m_items[i]->DestroyForPlayer(target);
3810 }
3811
3812 if (target == this)
3813 {
3815 {
3816 if (!m_items[i])
3817 continue;
3818
3819 m_items[i]->DestroyForPlayer(target);
3820 }
3822 {
3823 if (!m_items[i])
3824 continue;
3825
3826 m_items[i]->DestroyForPlayer(target);
3827 }
3828 }
3829}

References BANK_SLOT_BAG_END, CURRENCYTOKEN_SLOT_END, Object::DestroyForPlayer(), EQUIPMENT_SLOT_END, INVENTORY_SLOT_BAG_START, KEYRING_SLOT_START, and m_items.

◆ DestroyItem()

void Player::DestroyItem ( uint8  bag,
uint8  slot,
bool  update 
)
3046{
3047 Item* pItem = GetItemByPos(bag, slot);
3048 if (pItem)
3049 {
3050 LOG_DEBUG("entities.player.items", "STORAGE: DestroyItem bag = {}, slot = {}, item = {}", bag, slot, pItem->GetEntry());
3051 // Also remove all contained items if the item is a bag.
3052 // This if () prevents item saving crashes if the condition for a bag to be empty before being destroyed was bypassed somehow.
3053 if (pItem->IsNotEmptyBag())
3054 for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
3055 DestroyItem(slot, i, update);
3056
3058 {
3060 stmt->SetData(0, pItem->GetGUID().GetCounter());
3061 CharacterDatabase.Execute(stmt);
3062 }
3063
3065 RemoveItemDurations(pItem);
3066
3067 pItem->SetNotRefundable(this);
3068 pItem->ClearSoulboundTradeable(this);
3069 RemoveTradeableItem(pItem);
3070
3071 ItemTemplate const* proto = pItem->GetTemplate();
3072 for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
3073 if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger
3075
3076 ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount());
3077
3078 sScriptMgr->OnItemRemove(this, pItem);
3079
3080 if (bag == INVENTORY_SLOT_BAG_0)
3081 {
3083
3084 // equipment and equipped bags can have applied bonuses
3085 if (slot < INVENTORY_SLOT_BAG_END)
3086 {
3087 ItemTemplate const* pProto = pItem->GetTemplate();
3088
3089 // item set bonuses applied only at equip and removed at unequip, and still active for broken items
3090 if (pProto && pProto->ItemSet)
3091 RemoveItemsSetItem(this, pProto);
3092
3093 _ApplyItemMods(pItem, slot, false);
3094 }
3095
3096 if (slot < EQUIPMENT_SLOT_END)
3097 {
3098 // remove item dependent auras and casts (only weapon and armor slots)
3100
3101 // update expertise and armor penetration - passive auras may need it
3102 switch (slot)
3103 {
3108 default:
3109 break;
3110 }
3111
3112 if (slot == EQUIPMENT_SLOT_MAINHAND)
3114 else if (slot == EQUIPMENT_SLOT_OFFHAND)
3116
3117 // equipment visual show
3118 SetVisibleItemSlot(slot, nullptr);
3119 }
3120
3121 m_items[slot] = nullptr;
3122 }
3123 else if (Bag* pBag = GetBagByPos(bag))
3124 pBag->RemoveItem(slot, update);
3125
3126 // Xinef: item is removed, remove loot from storage if any
3127 if (proto->Flags & ITEM_FLAG_HAS_LOOT)
3128 sLootItemStorage->RemoveStoredLoot(pItem->GetGUID());
3129
3130 if (IsInWorld() && update)
3131 {
3132 pItem->RemoveFromWorld();
3133 pItem->DestroyForPlayer(this);
3134 }
3135
3136 //pItem->SetOwnerGUID(0);
3138 pItem->SetSlot(NULL_SLOT);
3139 pItem->SetState(ITEM_REMOVED, this);
3140 }
3141}
@ CHAR_DEL_GIFT
Definition: CharacterDatabase.h:130
@ ITEM_FIELD_FLAG_WRAPPED
Definition: ItemTemplate.h:113
@ ITEM_SPELLTRIGGER_ON_NO_DELAY_USE
Definition: ItemTemplate.h:88
void ItemRemovedQuestCheck(uint32 entry, uint32 count)
Definition: PlayerQuest.cpp:1860
void RemoveItemDependentAurasAndCasts(Item *pItem)
Definition: Player.cpp:12493
void RecalculateRating(CombatRating cr)
Definition: Player.h:1925
void UpdateExpertise(WeaponAttackType attType)
Definition: StatSystem.cpp:884
void SetVisibleItemSlot(uint8 slot, Item *pItem)
Definition: PlayerStorage.cpp:2880

References _ApplyItemMods(), BASE_ATTACK, CHAR_DEL_GIFT, CharacterDatabase, Item::ClearSoulboundTradeable(), CR_ARMOR_PENETRATION, Object::DestroyForPlayer(), DestroyItem(), ObjectGuid::Empty, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, ItemTemplate::Flags, GetBagByPos(), Item::GetCount(), ObjectGuid::GetCounter(), Object::GetEntry(), Object::GetGUID(), GetItemByPos(), Item::GetTemplate(), Object::HasFlag(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, Object::IsInWorld(), Item::IsNotEmptyBag(), ITEM_FIELD_CONTAINED, ITEM_FIELD_FLAG_WRAPPED, ITEM_FIELD_FLAGS, ITEM_FLAG_HAS_LOOT, ITEM_REMOVED, ITEM_SPELLTRIGGER_ON_NO_DELAY_USE, ItemRemovedQuestCheck(), ItemTemplate::ItemSet, LOG_DEBUG, m_items, MAX_BAG_SIZE, MAX_ITEM_PROTO_SPELLS, NULL_SLOT, OFF_ATTACK, PLAYER_FIELD_INV_SLOT_HEAD, RecalculateRating(), Unit::RemoveAurasDueToSpell(), RemoveEnchantmentDurations(), Object::RemoveFromWorld(), RemoveItemDependentAurasAndCasts(), RemoveItemDurations(), RemoveItemsSetItem(), RemoveTradeableItem(), PreparedStatementBase::SetData(), Object::SetGuidValue(), Item::SetNotRefundable(), Item::SetSlot(), Item::SetState(), SetVisibleItemSlot(), sLootItemStorage, _Spell::SpellId, ItemTemplate::Spells, _Spell::SpellTrigger, sScriptMgr, and UpdateExpertise().

Referenced by AddQuestAndCheckCompletion(), DestroyConjuredItems(), DestroyItem(), DestroyItemCount(), DestroyZoneLimitedItem(), WorldSession::DoLootRelease(), Spell::EffectSummonChangeItem(), bg_commandscript::HandleBagsClearCommand(), debug_commandscript::HandleDebugItemExpireCommand(), WorldSession::HandleDestroyItemOpcode(), WorldSession::HandleOpenWrappedItemCallback(), WorldSession::HandleSocketOpcode(), WorldSession::HandleTurnInPetitionOpcode(), RefundItem(), and Item::UpdateDuration().

◆ DestroyItemCount() [1/2]

void Player::DestroyItemCount ( Item item,
uint32 count,
bool  update 
)
3420{
3421 if (!pItem)
3422 return;
3423
3424 LOG_DEBUG("entities.player.items", "STORAGE: DestroyItemCount item ({}, Entry: {}) count = {}", pItem->GetGUID().ToString(), pItem->GetEntry(), count);
3425
3426 if (pItem->GetCount() <= count)
3427 {
3428 count -= pItem->GetCount();
3429
3430 DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), update);
3431 }
3432 else
3433 {
3434 ItemRemovedQuestCheck(pItem->GetEntry(), count);
3435 pItem->SetCount(pItem->GetCount() - count);
3436 count = 0;
3437 if (IsInWorld() && update)
3438 pItem->SendUpdateToPlayer(this);
3439 pItem->SetState(ITEM_CHANGED, this);
3440 }
3441}

References DestroyItem(), Item::GetBagSlot(), Item::GetCount(), Object::GetEntry(), Object::GetGUID(), Item::GetSlot(), Object::IsInWorld(), ITEM_CHANGED, ItemRemovedQuestCheck(), LOG_DEBUG, Object::SendUpdateToPlayer(), Item::SetCount(), Item::SetState(), and ObjectGuid::ToString().

◆ DestroyItemCount() [2/2]

void Player::DestroyItemCount ( uint32  item,
uint32  count,
bool  update,
bool  unequip_check = false 
)
3144{
3145 LOG_DEBUG("entities.player.items", "STORAGE: DestroyItemCount item = {}, count = {}", itemEntry, count);
3146 uint32 remcount = 0;
3147
3148 // in inventory
3150 {
3151 if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3152 {
3153 if (item->GetEntry() == itemEntry && !item->IsInTrade())
3154 {
3155 if (item->GetCount() + remcount <= count)
3156 {
3157 // all items in inventory can unequipped
3158 remcount += item->GetCount();
3160
3161 if (remcount >= count)
3162 return;
3163 }
3164 else
3165 {
3166 ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
3167 item->SetCount(item->GetCount() - count + remcount);
3168 if (IsInWorld() && update)
3169 item->SendUpdateToPlayer(this);
3170 item->SetState(ITEM_CHANGED, this);
3171 return;
3172 }
3173 }
3174 }
3175 }
3176
3178 {
3179 if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3180 {
3181 if (item->GetEntry() == itemEntry && !item->IsInTrade())
3182 {
3183 if (item->GetCount() + remcount <= count)
3184 {
3185 // all keys can be unequipped
3186 remcount += item->GetCount();
3188
3189 if (remcount >= count)
3190 return;
3191 }
3192 else
3193 {
3194 ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
3195 item->SetCount(item->GetCount() - count + remcount);
3196 if (IsInWorld() && update)
3197 item->SendUpdateToPlayer(this);
3198 item->SetState(ITEM_CHANGED, this);
3199 return;
3200 }
3201 }
3202 }
3203 }
3204
3205 // in inventory bags
3207 {
3208 if (Bag* bag = GetBagByPos(i))
3209 {
3210 for (uint32 j = 0; j < bag->GetBagSize(); j++)
3211 {
3212 if (Item* item = bag->GetItemByPos(j))
3213 {
3214 if (item->GetEntry() == itemEntry && !item->IsInTrade())
3215 {
3216 // all items in bags can be unequipped
3217 if (item->GetCount() + remcount <= count)
3218 {
3219 remcount += item->GetCount();
3220 DestroyItem(i, j, update);
3221
3222 if (remcount >= count)
3223 return;
3224 }
3225 else
3226 {
3227 ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
3228 item->SetCount(item->GetCount() - count + remcount);
3229 if (IsInWorld() && update)
3230 item->SendUpdateToPlayer(this);
3231 item->SetState(ITEM_CHANGED, this);
3232 return;
3233 }
3234 }
3235 }
3236 }
3237 }
3238 }
3239
3240 // in equipment and bag list
3242 {
3243 if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3244 {
3245 if (item && item->GetEntry() == itemEntry && !item->IsInTrade())
3246 {
3247 if (item->GetCount() + remcount <= count)
3248 {
3249 if (!unequip_check || CanUnequipItem(INVENTORY_SLOT_BAG_0 << 8 | i, false) == EQUIP_ERR_OK)
3250 {
3251 remcount += item->GetCount();
3253
3254 if (remcount >= count)
3255 return;
3256 }
3257 }
3258 else
3259 {
3260 ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
3261 item->SetCount(item->GetCount() - count + remcount);
3262 if (IsInWorld() && update)
3263 item->SendUpdateToPlayer(this);
3264 item->SetState(ITEM_CHANGED, this);
3265 return;
3266 }
3267 }
3268 }
3269 }
3270
3271 // in bank
3273 {
3274 if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3275 {
3276 if (item->GetEntry() == itemEntry && !item->IsInTrade())
3277 {
3278 if (item->GetCount() + remcount <= count)
3279 {
3280 remcount += item->GetCount();
3282 if (remcount >= count)
3283 return;
3284 }
3285 else
3286 {
3287 ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
3288 item->SetCount(item->GetCount() - count + remcount);
3289 if (IsInWorld() && update)
3290 item->SendUpdateToPlayer(this);
3291 item->SetState(ITEM_CHANGED, this);
3292 return;
3293 }
3294 }
3295 }
3296 }
3297
3298 // in bank bags
3299 for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
3300 {
3301 if (Bag* bag = GetBagByPos(i))
3302 {
3303 for (uint32 j = 0; j < bag->GetBagSize(); j++)
3304 {
3305 if (Item* item = bag->GetItemByPos(j))
3306 {
3307 if (item->GetEntry() == itemEntry && !item->IsInTrade())
3308 {
3309 // all items in bags can be unequipped
3310 if (item->GetCount() + remcount <= count)
3311 {
3312 remcount += item->GetCount();
3313 DestroyItem(i, j, update);
3314
3315 if (remcount >= count)
3316 return;
3317 }
3318 else
3319 {
3320 ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
3321 item->SetCount(item->GetCount() - count + remcount);
3322 if (IsInWorld() && update)
3323 item->SendUpdateToPlayer(this);
3324 item->SetState(ITEM_CHANGED, this);
3325 return;
3326 }
3327 }
3328 }
3329 }
3330 }
3331 }
3332}

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_END, BANK_SLOT_ITEM_START, CanUnequipItem(), CURRENCYTOKEN_SLOT_END, DestroyItem(), EQUIP_ERR_OK, EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, Object::IsInWorld(), ITEM_CHANGED, ItemRemovedQuestCheck(), KEYRING_SLOT_START, and LOG_DEBUG.

Referenced by _StoreOrEquipNewItem(), AbandonQuest(), WorldSession::DoLootRelease(), Spell::EffectCreateItem2(), Spell::EffectEnchantItemPerm(), Spell::EffectFeedPet(), Spell::EffectScriptEffect(), FailQuest(), misc_commandscript::HandleAddItemCommand(), spell_brewfest_fill_keg::HandleAfterHit(), spell_brewfest_unfill_keg::HandleAfterHit(), WorldSession::HandleDestroyItemOpcode(), spell_item_massive_seaforium_charge::HandleItemRemove(), WorldSession::HandleWrapItemOpcode(), npc_brewfest_keg_reciver::MoveInLineOfSight(), go_ahune_ice_stone::OnGossipSelect(), at_hor_battered_hilt_throw::OnTrigger(), npc_oculus_drakegiver::RemoveEssence(), RewardQuest(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), Spell::TakeAmmo(), Spell::TakeCastItem(), TakeQuestSourceItem(), and Spell::TakeReagents().

◆ DestroyZoneLimitedItem()

void Player::DestroyZoneLimitedItem ( bool  update,
uint32  new_zone 
)
3335{
3336 LOG_DEBUG("entities.player.items", "STORAGE: DestroyZoneLimitedItem in map {} and area {}", GetMapId(), new_zone);
3337
3338 // in inventory
3340 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3341 if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone))
3343
3345 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3346 if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone))
3348
3349 // in inventory bags
3351 if (Bag* pBag = GetBagByPos(i))
3352 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
3353 if (Item* pItem = pBag->GetItemByPos(j))
3354 if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone))
3355 DestroyItem(i, j, update);
3356
3357 // in equipment and bag list
3359 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3360 if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone))
3362}

References CURRENCYTOKEN_SLOT_END, DestroyItem(), EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), WorldLocation::GetMapId(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, KEYRING_SLOT_START, and LOG_DEBUG.

Referenced by UpdateZone().

◆ DoRandomRoll()

uint32 Player::DoRandomRoll ( uint32  minimum,
uint32  maximum 
)
16096{
16097 ASSERT(minimum <= maximum);
16098
16099 uint32 roll = urand(minimum, maximum);
16100
16102 randomRoll.Min = minimum;
16103 randomRoll.Max = maximum;
16104 randomRoll.Result = roll;
16105 randomRoll.Roller = GetGUID();
16106 if (Group* group = GetGroup())
16107 group->BroadcastPacket(randomRoll.Write(), false);
16108 else
16109 SendDirectMessage(randomRoll.Write());
16110
16111 return roll;
16112}
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
Definition: MiscPackets.h:108
uint32 Max
Definition: MiscPackets.h:115
uint32 Result
Definition: MiscPackets.h:116
WorldPacket const * Write() override
Definition: MiscPackets.cpp:76
uint32 Min
Definition: MiscPackets.h:114
ObjectGuid Roller
Definition: MiscPackets.h:117

References ASSERT, GetGroup(), Object::GetGUID(), WorldPackets::Misc::RandomRoll::Max, WorldPackets::Misc::RandomRoll::Min, WorldPackets::Misc::RandomRoll::Result, WorldPackets::Misc::RandomRoll::Roller, SendDirectMessage(), urand(), and WorldPackets::Misc::RandomRoll::Write().

Referenced by WorldSession::HandleRandomRollOpcode(), and spell_item_worn_troll_dice::HandleScript().

◆ DropModCharge()

void Player::DropModCharge ( SpellModifier mod,
Spell spell 
)
9986{
9987 if (spell && mod->ownerAura && mod->charges > 0)
9988 {
9989 if (--mod->charges == 0)
9990 mod->charges = -1;
9991
9992 spell->m_appliedMods.insert(mod->ownerAura);
9993 }
9994}
int16 charges
Definition: Player.h:186
UsedSpellMods m_appliedMods
Definition: Spell.h:545

References SpellModifier::charges, Spell::m_appliedMods, and SpellModifier::ownerAura.

Referenced by ApplySpellMod().

◆ DuelComplete()

void Player::DuelComplete ( DuelCompleteType  type)
6326{
6327 // duel not requested
6328 if (!duel)
6329 return;
6330
6331 // Check if DuelComplete() has been called already up in the stack and in that case don't do anything else here
6332 if (duel->State == DUEL_STATE_COMPLETED)
6333 return;
6334
6335 Player* opponent = duel->Opponent;
6336 duel->State = DUEL_STATE_COMPLETED;
6337 opponent->duel->State = DUEL_STATE_COMPLETED;
6338
6339 LOG_DEBUG("entities.unit", "Player::DuelComplete: Player '{}' ({}), Opponent: '{}' ({})", GetName(), GetGUID().ToString(), opponent->GetName(), opponent->GetGUID().ToString());
6340
6342 data << uint8((type != DUEL_INTERRUPTED) ? 1 : 0);
6343 SendDirectMessage(&data);
6344 if (opponent->GetSession())
6345 {
6346 opponent->SendDirectMessage(&data);
6347 }
6348
6349 if (type != DUEL_INTERRUPTED)
6350 {
6351 data.Initialize(SMSG_DUEL_WINNER, (1 + 20)); // we guess size
6352 data << uint8(type == DUEL_WON ? 0 : 1); // 0 = just won; 1 = fled
6353 data << opponent->GetName();
6354 data << GetName();
6355 SendMessageToSet(&data, true);
6356 }
6357
6358 sScriptMgr->OnPlayerDuelEnd(opponent, this, type);
6359
6360 switch (type)
6361 {
6362 case DUEL_FLED:
6363 // if initiator and opponent are on the same team
6364 // or initiator and opponent are not PvP enabled, forcibly stop attacking
6365 if (GetTeamId() == opponent->GetTeamId())
6366 {
6367 AttackStop();
6368 opponent->AttackStop();
6369 }
6370 else
6371 {
6372 if (!IsPvP())
6373 {
6374 AttackStop();
6375 }
6376 if (!opponent->IsPvP())
6377 {
6378 opponent->AttackStop();
6379 }
6380 }
6381 break;
6382 case DUEL_WON:
6385
6386 // Credit for quest Death's Challenge
6387 if (getClass() == CLASS_DEATH_KNIGHT && opponent->GetQuestStatus(12733) == QUEST_STATUS_INCOMPLETE)
6388 {
6389 opponent->CastSpell(opponent, 52994, true);
6390 }
6391
6392 // Honor points after duel (the winner) - ImpConfig
6393 if (uint32 amount = sWorld->getIntConfig(CONFIG_HONOR_AFTER_DUEL))
6394 {
6395 opponent->RewardHonor(nullptr, 1, amount);
6396 }
6397
6398 break;
6399 default:
6400 break;
6401 }
6402
6403 // Victory emote spell
6404 if (type != DUEL_INTERRUPTED)
6405 {
6406 opponent->CastSpell(opponent, 52852, true);
6407 }
6408
6409 // Remove Duel Flag object
6411 if (obj)
6412 {
6413 duel->Initiator->RemoveGameObject(obj, true);
6414 }
6415
6416 /* remove auras */
6417 AuraApplicationMap& itsAuras = opponent->GetAppliedAuras();
6418 for (AuraApplicationMap::iterator i = itsAuras.begin(); i != itsAuras.end();)
6419 {
6420 Aura const* aura = i->second->GetBase();
6421 if (!i->second->IsPositive() && aura->GetCasterGUID() == GetGUID() && aura->GetApplyTime() >= duel->StartTime)
6422 {
6423 opponent->RemoveAura(i);
6424 }
6425 else
6426 {
6427 ++i;
6428 }
6429 }
6430
6432 for (AuraApplicationMap::iterator i = myAuras.begin(); i != myAuras.end();)
6433 {
6434 Aura const* aura = i->second->GetBase();
6435 if (!i->second->IsPositive() && aura->GetCasterGUID() == opponent->GetGUID() && aura->GetApplyTime() >= duel->StartTime)
6436 RemoveAura(i);
6437 else
6438 ++i;
6439 }
6440
6441 // cleanup combo points
6442 if (GetComboTarget() == duel->Opponent)
6443 {
6445 }
6446 else if (GetComboTargetGUID() == duel->Opponent->GetPetGUID())
6447 {
6449 }
6450
6451 if (duel->Opponent->GetComboTarget() == this)
6452 {
6453 duel->Opponent->ClearComboPoints();
6454 }
6455 else if (duel->Opponent->GetComboTargetGUID() == GetPetGUID())
6456 {
6457 duel->Opponent->ClearComboPoints();
6458 }
6459
6460 //cleanups
6464 opponent->SetUInt32Value(PLAYER_DUEL_TEAM, 0);
6465
6466 opponent->duel.reset(nullptr);
6467 duel.reset(nullptr);
6468}
@ PLAYER_DUEL_TEAM
Definition: UpdateFields.h:184
@ DUEL_STATE_COMPLETED
Definition: Player.h:374
@ CONFIG_HONOR_AFTER_DUEL
Definition: IWorld.h:333
@ ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL
Definition: DBCEnums.h:194
@ ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL
Definition: DBCEnums.h:195
@ DUEL_WON
Definition: SharedDefines.h:3613
@ SMSG_DUEL_WINNER
Definition: Opcodes.h:393
@ SMSG_DUEL_COMPLETE
Definition: Opcodes.h:392
bool RewardHonor(Unit *victim, uint32 groupsize, int32 honor=-1, bool awardXP=true)
Definition: Player.cpp:5979
void SendMessageToSet(WorldPacket const *data, bool self) const override
Definition: Player.h:1989
bool IsPvP()
Definition: Player.cpp:16147
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:1311
void ClearComboPoints()
Definition: Unit.cpp:17129
Unit * GetComboTarget() const
Definition: Unit.h:2306
bool AttackStop()
Definition: Unit.cpp:10407
ObjectGuid const GetComboTargetGUID() const
Definition: Unit.h:2307
ObjectGuid GetPetGUID() const
Definition: Unit.h:1838
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:105
time_t GetApplyTime() const
Definition: SpellAuras.h:128

References ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL, ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL, Unit::AttackStop(), Unit::CastSpell(), CLASS_DEATH_KNIGHT, Unit::ClearComboPoints(), CONFIG_HONOR_AFTER_DUEL, duel, DUEL_FLED, DUEL_INTERRUPTED, DUEL_STATE_COMPLETED, DUEL_WON, ObjectGuid::Empty, Unit::GetAppliedAuras(), Aura::GetApplyTime(), Aura::GetCasterGUID(), Unit::getClass(), Unit::GetComboTarget(), Unit::GetComboTargetGUID(), Map::GetGameObject(), Object::GetGUID(), Object::GetGuidValue(), WorldObject::GetMap(), WorldObject::GetName(), Unit::GetPetGUID(), GetQuestStatus(), GetSession(), GetTeamId(), WorldPacket::Initialize(), IsPvP(), LOG_DEBUG, PLAYER_DUEL_ARBITER, PLAYER_DUEL_TEAM, QUEST_STATUS_INCOMPLETE, Unit::RemoveAura(), RewardHonor(), SendDirectMessage(), SendMessageToSet(), Object::SetGuidValue(), Object::SetUInt32Value(), SMSG_DUEL_COMPLETE, SMSG_DUEL_WINNER, sScriptMgr, sWorld, ObjectGuid::ToString(), Position::ToString(), and UpdateAchievementCriteria().

Referenced by Unit::_ExitVehicle(), CheckDuelDistance(), CleanupsBeforeDelete(), Unit::DealDamage(), WorldSession::HandleDuelCancelledOpcode(), and TeleportTo().

◆ DurabilityLoss()

void Player::DurabilityLoss ( Item item,
double  percent 
)
4657{
4658 if(!item || percent == 0.0)
4659 return;
4660
4661 uint32 pMaxDurability = item ->GetUInt32Value(ITEM_FIELD_MAXDURABILITY);
4662
4663 if (!pMaxDurability)
4664 return;
4665
4666 uint32 pDurabilityLoss = uint32(pMaxDurability * percent);
4667
4668 if (pDurabilityLoss < 1)
4669 pDurabilityLoss = 1;
4670
4671 DurabilityPointsLoss(item, pDurabilityLoss);
4672}
@ ITEM_FIELD_MAXDURABILITY
Definition: UpdateFields.h:70
void DurabilityPointsLoss(Item *item, int32 points)
Definition: Player.cpp:4700

References DurabilityPointsLoss(), Object::GetUInt32Value(), and ITEM_FIELD_MAXDURABILITY.

Referenced by DurabilityLossAll(), Spell::EffectDurabilityDamagePCT(), and Spell::EffectSummonChangeItem().

◆ DurabilityLossAll()

void Player::DurabilityLossAll ( double  percent,
bool  inventory 
)
4631{
4633 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
4634 DurabilityLoss(pItem, percent);
4635
4636 if (inventory)
4637 {
4638 // bags not have durability
4639 // for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
4640
4642 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
4643 DurabilityLoss(pItem, percent);
4644
4645 // keys not have durability
4646 //for (int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++)
4647
4649 if (Bag* pBag = GetBagByPos(i))
4650 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
4651 if (Item* pItem = GetItemByPos(i, j))
4652 DurabilityLoss(pItem, percent);
4653 }
4654}
void DurabilityLoss(Item *item, double percent)
Definition: Player.cpp:4656

References DurabilityLoss(), EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, and INVENTORY_SLOT_ITEM_START.

Referenced by Spell::EffectDurabilityDamagePCT(), EnvironmentalDamage(), and WorldSession::SendSpiritResurrect().

◆ DurabilityPointLossForEquipSlot()

void Player::DurabilityPointLossForEquipSlot ( EquipmentSlots  slot)
4733{
4734 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
4735 DurabilityPointsLoss(pItem, 1);
4736}

References DurabilityPointsLoss(), GetItemByPos(), and INVENTORY_SLOT_BAG_0.

Referenced by Unit::DealDamage(), and Spell::TakeAmmo().

◆ DurabilityPointsLoss()

void Player::DurabilityPointsLoss ( Item item,
int32  points 
)
4701{
4703 {
4704 return;
4705 }
4706
4707 int32 pMaxDurability = item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY);
4708 int32 pOldDurability = item->GetUInt32Value(ITEM_FIELD_DURABILITY);
4709 int32 pNewDurability = pOldDurability - points;
4710
4711 if (pNewDurability < 0)
4712 pNewDurability = 0;
4713 else if (pNewDurability > pMaxDurability)
4714 pNewDurability = pMaxDurability;
4715
4716 if (pOldDurability != pNewDurability)
4717 {
4718 // modify item stats _before_ Durability set to 0 to pass _ApplyItemMods internal check
4719 if (pNewDurability == 0 && pOldDurability > 0 && item->IsEquipped())
4720 _ApplyItemMods(item, item->GetSlot(), false);
4721
4722 item->SetUInt32Value(ITEM_FIELD_DURABILITY, pNewDurability);
4723
4724 // modify item stats _after_ restore durability to pass _ApplyItemMods internal check
4725 if (pNewDurability > 0 && pOldDurability == 0 && item->IsEquipped())
4726 _ApplyItemMods(item, item->GetSlot(), true);
4727
4728 item->SetState(ITEM_CHANGED, this);
4729 }
4730}
@ ITEM_FIELD_DURABILITY
Definition: UpdateFields.h:69
@ SPELL_AURA_PREVENT_DURABILITY_LOSS
Definition: SpellAuraDefines.h:352

References _ApplyItemMods(), Item::GetSlot(), Object::GetUInt32Value(), Unit::HasAuraType(), Item::IsEquipped(), ITEM_CHANGED, ITEM_FIELD_DURABILITY, ITEM_FIELD_MAXDURABILITY, Item::SetState(), Object::SetUInt32Value(), and SPELL_AURA_PREVENT_DURABILITY_LOSS.

Referenced by DurabilityLoss(), DurabilityPointLossForEquipSlot(), DurabilityPointsLossAll(), and Spell::EffectDurabilityDamage().

◆ DurabilityPointsLossAll()

void Player::DurabilityPointsLossAll ( int32  points,
bool  inventory 
)
4675{
4677 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
4678 DurabilityPointsLoss(pItem, points);
4679
4680 if (inventory)
4681 {
4682 // bags not have durability
4683 // for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
4684
4686 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
4687 DurabilityPointsLoss(pItem, points);
4688
4689 // keys not have durability
4690 //for (int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++)
4691
4693 if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i))
4694 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
4695 if (Item* pItem = GetItemByPos(i, j))
4696 DurabilityPointsLoss(pItem, points);
4697 }
4698}

References DurabilityPointsLoss(), EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, and INVENTORY_SLOT_ITEM_START.

Referenced by Spell::EffectDurabilityDamage().

◆ DurabilityRepair()

uint32 Player::DurabilityRepair ( uint16  pos,
bool  cost,
float  discountMod,
bool  guildBank 
)
4755{
4756 Item* item = GetItemByPos(pos);
4757
4758 uint32 TotalCost = 0;
4759 if (!item)
4760 return TotalCost;
4761
4762 uint32 maxDurability = item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY);
4763 if (!maxDurability)
4764 return TotalCost;
4765
4766 uint32 curDurability = item->GetUInt32Value(ITEM_FIELD_DURABILITY);
4767
4768 if (cost)
4769 {
4770 uint32 LostDurability = maxDurability - curDurability;
4771 if (LostDurability > 0)
4772 {
4773 ItemTemplate const* ditemProto = item->GetTemplate();
4774
4775 DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel);
4776 if (!dcost)
4777 {
4778 LOG_ERROR("entities.player", "RepairDurability: Wrong item lvl {}", ditemProto->ItemLevel);
4779 return TotalCost;
4780 }
4781
4782 uint32 dQualitymodEntryId = (ditemProto->Quality + 1) * 2;
4783 DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId);
4784 if (!dQualitymodEntry)
4785 {
4786 LOG_ERROR("entities.player", "RepairDurability: Wrong dQualityModEntry {}", dQualitymodEntryId);
4787 return TotalCost;
4788 }
4789
4790 uint32 dmultiplier = dcost->multiplier[ItemSubClassToDurabilityMultiplierId(ditemProto->Class, ditemProto->SubClass)];
4791 uint32 costs = uint32(LostDurability * dmultiplier * double(dQualitymodEntry->quality_mod));
4792
4793 costs = uint32(costs * discountMod * sWorld->getRate(RATE_REPAIRCOST));
4794
4795 if (costs == 0) //fix for ITEM_QUALITY_ARTIFACT
4796 costs = 1;
4797
4798 if (guildBank)
4799 {
4800 if (GetGuildId() == 0)
4801 {
4802 // LOG_DEBUG("entities.player", "You are not member of a guild");
4803 return TotalCost;
4804 }
4805
4806 Guild* guild = sGuildMgr->GetGuildById(GetGuildId());
4807 if (!guild)
4808 return TotalCost;
4809
4810 if (!guild->HandleMemberWithdrawMoney(GetSession(), costs, true))
4811 return TotalCost;
4812
4813 TotalCost = costs;
4814 }
4815 else if (!HasEnoughMoney(costs))
4816 {
4817 // LOG_DEBUG("entities.player", "You do not have enough money");
4818 return TotalCost;
4819 }
4820 else
4821 ModifyMoney(-int32(costs));
4822 }
4823 }
4824
4825 item->SetUInt32Value(ITEM_FIELD_DURABILITY, maxDurability);
4826 item->SetState(ITEM_CHANGED, this);
4827
4828 // reapply mods for total broken and repaired item if equipped
4829 if (IsEquipmentPos(pos) && !curDurability)
4830 _ApplyItemMods(item, pos & 255, true);
4831 return TotalCost;
4832}
DBCStorage< DurabilityQualityEntry > sDurabilityQualityStore(DurabilityQualityfmt)
DBCStorage< DurabilityCostsEntry > sDurabilityCostsStore(DurabilityCostsfmt)
uint8 ItemSubClassToDurabilityMultiplierId(uint32 ItemClass, uint32 ItemSubClass)
Definition: ItemTemplate.h:566
@ RATE_REPAIRCOST
Definition: IWorld.h:476
uint32 ItemLevel
Definition: ItemTemplate.h:644
bool HandleMemberWithdrawMoney(WorldSession *session, uint32 amount, bool repair=false)
Definition: Guild.cpp:1687
Definition: DBCStructure.h:869
uint32 multiplier[29]
Definition: DBCStructure.h:871
Definition: DBCStructure.h:875
float quality_mod
Definition: DBCStructure.h:877

References _ApplyItemMods(), ItemTemplate::Class, GetGuildId(), GetItemByPos(), GetSession(), Item::GetTemplate(), Object::GetUInt32Value(), Guild::HandleMemberWithdrawMoney(), HasEnoughMoney(), IsEquipmentPos(), ITEM_CHANGED, ITEM_FIELD_DURABILITY, ITEM_FIELD_MAXDURABILITY, ItemTemplate::ItemLevel, ItemSubClassToDurabilityMultiplierId(), LOG_ERROR, ModifyMoney(), DurabilityCostsEntry::multiplier, ItemTemplate::Quality, DurabilityQualityEntry::quality_mod, RATE_REPAIRCOST, sDurabilityCostsStore, sDurabilityQualityStore, Item::SetState(), Object::SetUInt32Value(), sGuildMgr, ItemTemplate::SubClass, and sWorld.

Referenced by DurabilityRepairAll(), and WorldSession::HandleRepairItemOpcode().

◆ DurabilityRepairAll()

uint32 Player::DurabilityRepairAll ( bool  cost,
float  discountMod,
bool  guildBank 
)
4739{
4740 uint32 TotalCost = 0;
4741 // equipped, backpack, bags itself
4743 TotalCost += DurabilityRepair(((INVENTORY_SLOT_BAG_0 << 8) | i), cost, discountMod, guildBank);
4744
4745 // bank, buyback and keys not repaired
4746
4747 // items in inventory bags
4749 for (uint8 i = 0; i < MAX_BAG_SIZE; i++)
4750 TotalCost += DurabilityRepair(((j << 8) | i), cost, discountMod, guildBank);
4751 return TotalCost;
4752}
uint32 DurabilityRepair(uint16 pos, bool cost, float discountMod, bool guildBank)
Definition: Player.cpp:4754

References DurabilityRepair(), EQUIPMENT_SLOT_START, INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, and MAX_BAG_SIZE.

Referenced by WorldSession::HandleRepairItemOpcode().

◆ EnchantmentFitsRequirements()

bool Player::EnchantmentFitsRequirements ( uint32  enchantmentcondition,
int8  slot 
)
11039{
11040 if (!enchantmentcondition)
11041 return true;
11042
11043 SpellItemEnchantmentConditionEntry const* Condition = sSpellItemEnchantmentConditionStore.LookupEntry(enchantmentcondition);
11044
11045 if (!Condition)
11046 return true;
11047
11048 uint8 curcount[4] = {0, 0, 0, 0};
11049
11050 //counting current equipped gem colors
11052 {
11053 if (i == slot)
11054 continue;
11056 if (pItem2 && !pItem2->IsBroken() && pItem2->HasSocket())
11057 {
11058 for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot <= PRISMATIC_ENCHANTMENT_SLOT; ++enchant_slot)
11059 {
11060 if (enchant_slot == BONUS_ENCHANTMENT_SLOT)
11061 continue;
11062
11063 uint32 enchant_id = pItem2->GetEnchantmentId(EnchantmentSlot(enchant_slot));
11064 if (!enchant_id)
11065 continue;
11066
11067 SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
11068 if (!enchantEntry)
11069 continue;
11070
11071 uint32 gemid = enchantEntry->GemID;
11072 if (!gemid)
11073 continue;
11074
11075 ItemTemplate const* gemProto = sObjectMgr->GetItemTemplate(gemid);
11076 if (!gemProto)
11077 continue;
11078
11079 GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties);
11080 if (!gemProperty)
11081 continue;
11082
11083 uint8 GemColor = gemProperty->color;
11084
11085 for (uint8 b = 0, tmpcolormask = 1; b < 4; b++, tmpcolormask <<= 1)
11086 {
11087 if (tmpcolormask & GemColor)
11088 ++curcount[b];
11089 }
11090 }
11091 }
11092 }
11093
11094 bool activate = true;
11095
11096 for (uint8 i = 0; i < 5; i++)
11097 {
11098 if (!Condition->Color[i])
11099 continue;
11100
11101 uint32 _cur_gem = curcount[Condition->Color[i] - 1];
11102
11103 // if have <CompareColor> use them as count, else use <value> from Condition
11104 uint32 _cmp_gem = Condition->CompareColor[i] ? curcount[Condition->CompareColor[i] - 1] : Condition->Value[i];
11105
11106 switch (Condition->Comparator[i])
11107 {
11108 case 2: // requires less <color> than (<value> || <comparecolor>) gems
11109 activate &= (_cur_gem < _cmp_gem);
11110 break;
11111 case 3: // requires more <color> than (<value> || <comparecolor>) gems
11112 activate &= (_cur_gem > _cmp_gem);
11113 break;
11114 case 5: // requires at least <color> than (<value> || <comparecolor>) gems
11115 activate &= (_cur_gem >= _cmp_gem);
11116 break;
11117 }
11118 }
11119
11120 LOG_DEBUG("entities.player.items", "Checking Condition {}, there are {} Meta Gems, {} Red Gems, {} Yellow Gems and {} Blue Gems, Activate:{}", enchantmentcondition, curcount[0], curcount[1], curcount[2], curcount[3], activate ? "yes" : "no");
11121
11122 return activate;
11123}
DBCStorage< SpellItemEnchantmentConditionEntry > sSpellItemEnchantmentConditionStore(SpellItemEnchantmentConditionfmt)
DBCStorage< GemPropertiesEntry > sGemPropertiesStore(GemPropertiesEntryfmt)
@ BONUS_ENCHANTMENT_SLOT
Definition: Item.h:168
Definition: ConditionMgr.h:194
uint32 GemProperties
Definition: ItemTemplate.h:692
Definition: DBCStructure.h:1005
uint32 color
Definition: DBCStructure.h:1008
Definition: DBCStructure.h:1861

References BONUS_ENCHANTMENT_SLOT, GemPropertiesEntry::color, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, SpellItemEnchantmentEntry::GemID, ItemTemplate::GemProperties, Item::GetEnchantmentId(), GetItemByPos(), Item::HasSocket(), INVENTORY_SLOT_BAG_0, Item::IsBroken(), LOG_DEBUG, PRISMATIC_ENCHANTMENT_SLOT, sGemPropertiesStore, sObjectMgr, SOCK_ENCHANTMENT_SLOT, sSpellItemEnchantmentConditionStore, and sSpellItemEnchantmentStore.

Referenced by ApplyEnchantment(), and CorrectMetaGemEnchants().

◆ EnvironmentalDamage()

uint32 Player::EnvironmentalDamage ( EnviromentalDamage  type,
uint32  damage 
)
756{
758 return 0;
759
760 // Absorb, resist some environmental damage type
761 uint32 absorb = 0;
762 uint32 resist = 0;
763
764 switch (type)
765 {
766 case DAMAGE_LAVA:
767 case DAMAGE_SLIME:
768 {
769 DamageInfo dmgInfo(this, this, damage, nullptr, type == DAMAGE_LAVA ? SPELL_SCHOOL_MASK_FIRE : SPELL_SCHOOL_MASK_NATURE, DIRECT_DAMAGE);
770 Unit::CalcAbsorbResist(dmgInfo);
771 absorb = dmgInfo.GetAbsorb();
772 resist = dmgInfo.GetResist();
773 damage = dmgInfo.GetDamage();
774 }
775 default:
776 break;
777 }
778
779 Unit::DealDamageMods(this, damage, &absorb);
780
782 packet.Victim = GetGUID();
783 packet.Type = type != DAMAGE_FALL_TO_VOID ? type : DAMAGE_FALL;
784 packet.Amount = damage;
785 packet.Absorbed = absorb;
786 packet.Resisted = resist;
787 SendMessageToSet(packet.Write(), true);
788
789 uint32 final_damage = Unit::DealDamage(this, this, damage, nullptr, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
790
791 if (!IsAlive())
792 {
793 if (type == DAMAGE_FALL) // DealDamage not apply item durability loss at self damage
794 {
795 LOG_DEBUG("entities.player", "Player::EnvironmentalDamage: Player '{}' ({}) fall to death, losing {} durability",
798 // durability lost message
800 }
801
803 }
804
805 return final_damage;
806}
@ DAMAGE_SLIME
Definition: Player.h:831
@ DAMAGE_FALL
Definition: Player.h:829
@ DAMAGE_LAVA
Definition: Player.h:830
@ DAMAGE_FALL_TO_VOID
Definition: Player.h:833
@ SELF_DAMAGE
Definition: Unit.h:440
@ DIRECT_DAMAGE
Definition: Unit.h:435
@ RATE_DURABILITY_LOSS_ON_DEATH
Definition: IWorld.h:510
@ ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM
Definition: DBCEnums.h:148
@ SPELL_SCHOOL_MASK_NATURE
Definition: SharedDefines.h:300
@ SPELL_SCHOOL_MASK_FIRE
Definition: SharedDefines.h:299
void DurabilityLossAll(double percent, bool inventory)
Definition: Player.cpp:4630
void SendDurabilityLoss()
Definition: Player.cpp:4625
bool IsImmuneToEnvironmentalDamage()
Definition: Player.cpp:749
Definition: Unit.h:761
static void CalcAbsorbResist(DamageInfo &dmgInfo, bool Splited=false)
Definition: Unit.cpp:2127
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition: Unit.cpp:805
static uint32 DealDamage(Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
Definition: Unit.cpp:815
Definition: CombatLogPackets.h:29
ObjectGuid Victim
Definition: CombatLogPackets.h:35
uint32 Amount
Definition: CombatLogPackets.h:37
uint32 Absorbed
Definition: CombatLogPackets.h:39
EnviromentalDamage Type
Definition: CombatLogPackets.h:36
uint32 Resisted
Definition: CombatLogPackets.h:38
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:20

References WorldPackets::CombatLog::EnvironmentalDamageLog::Absorbed, ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM, WorldPackets::CombatLog::EnvironmentalDamageLog::Amount, Unit::CalcAbsorbResist(), DAMAGE_FALL, DAMAGE_FALL_TO_VOID, DAMAGE_LAVA, DAMAGE_SLIME, Unit::DealDamage(), Unit::DealDamageMods(), DIRECT_DAMAGE, DurabilityLossAll(), DamageInfo::GetAbsorb(), DamageInfo::GetDamage(), Object::GetGUID(), WorldObject::GetName(), DamageInfo::GetResist(), Unit::IsAlive(), IsImmuneToEnvironmentalDamage(), LOG_DEBUG, RATE_DURABILITY_LOSS_ON_DEATH, WorldPackets::CombatLog::EnvironmentalDamageLog::Resisted, SELF_DAMAGE, SendDurabilityLoss(), SendMessageToSet(), SPELL_SCHOOL_MASK_FIRE, SPELL_SCHOOL_MASK_NATURE, SPELL_SCHOOL_MASK_NORMAL, sWorld, Position::ToString(), WorldPackets::CombatLog::EnvironmentalDamageLog::Type, UpdateAchievementCriteria(), WorldPackets::CombatLog::EnvironmentalDamageLog::Victim, and WorldPackets::CombatLog::EnvironmentalDamageLog::Write().

Referenced by Spell::EffectEnvironmentalDMG(), HandleDrowning(), HandleFall(), and WorldSession::HandleMovementOpcodes().

◆ EquipItem()

Item * Player::EquipItem ( uint16  pos,
Item pItem,
bool  update 
)
2750{
2752 AddItemDurations(pItem);
2753
2754 uint8 bag = pos >> 8;
2755 uint8 slot = pos & 255;
2756
2757 Item* pItem2 = GetItemByPos(bag, slot);
2758
2759 if (!pItem2)
2760 {
2761 VisualizeItem(slot, pItem);
2762
2763 if (IsAlive())
2764 {
2765 ItemTemplate const* pProto = pItem->GetTemplate();
2766
2767 // item set bonuses applied only at equip and removed at unequip, and still active for broken items
2768 if (pProto && pProto->ItemSet)
2769 AddItemsSetItem(this, pItem);
2770
2771 _ApplyItemMods(pItem, slot, true);
2772
2773 if (pProto && IsInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer == 0)
2774 {
2775 uint32 cooldownSpell = getClass() == CLASS_ROGUE ? 6123 : 6119;
2776 SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cooldownSpell);
2777
2778 if (!spellProto)
2779 LOG_ERROR("entities.player", "Weapon switch cooldown spell {} couldn't be found in Spell.dbc", cooldownSpell);
2780 else
2781 {
2783
2785
2786 WorldPacket data;
2788 GetSession()->SendPacket(&data);
2789 }
2790 }
2791 }
2792
2793 if (IsInWorld() && update)
2794 {
2795 pItem->AddToWorld();
2796 pItem->SendUpdateToPlayer(this);
2797 }
2798
2799 ApplyEquipCooldown(pItem);
2800
2801 // update expertise and armor penetration - passive auras may need it
2802
2803 if (slot == EQUIPMENT_SLOT_MAINHAND)
2805
2806 else if (slot == EQUIPMENT_SLOT_OFFHAND)
2808
2809 switch (slot)
2810 {
2815 default:
2816 break;
2817 }
2818 }
2819 else
2820 {
2821 pItem2->SetCount(pItem2->GetCount() + pItem->GetCount());
2822 if (IsInWorld() && update)
2823 pItem2->SendUpdateToPlayer(this);
2824
2825 // delete item (it not in any slot currently)
2826 //pItem->DeleteFromDB();
2827 if (IsInWorld() && update)
2828 {
2829 pItem->RemoveFromWorld();
2830 pItem->DestroyForPlayer(this);
2831 }
2832
2834 RemoveItemDurations(pItem);
2835
2836 pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor
2837 pItem->SetNotRefundable(this);
2838 pItem->ClearSoulboundTradeable(this);
2839 RemoveTradeableItem(pItem);
2840 pItem->SetState(ITEM_REMOVED, this);
2841 pItem2->SetState(ITEM_CHANGED, this);
2842
2843 ApplyEquipCooldown(pItem2);
2844 sScriptMgr->OnEquip(this, pItem2, bag, slot, update);
2845 return pItem2;
2846 }
2847
2848 // only for full equip instead adding to stack
2851
2852 sScriptMgr->OnEquip(this, pItem, bag, slot, update);
2854 return pItem;
2855}
@ SPELL_COOLDOWN_FLAG_INCLUDE_GCD
Starts GCD in addition to normal cooldown specified in the packet.
Definition: Unit.h:1243
@ ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM
Definition: DBCEnums.h:179
@ ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM
Definition: DBCEnums.h:171
void UpdateForQuestWorldObjects()
Definition: PlayerUpdates.cpp:1746
GlobalCooldownMgr & GetGlobalCooldownMgr()
Definition: Player.h:1768
void ApplyEquipCooldown(Item *pItem)
Definition: Player.cpp:11686
void VisualizeItem(uint8 slot, Item *pItem)
Definition: PlayerStorage.cpp:2897
void AddGlobalCooldown(SpellInfo const *spellInfo, uint32 gcd)
Definition: Unit.cpp:347
uint32 StartRecoveryTime
Definition: SpellInfo.h:349

References _ApplyItemMods(), ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, AddEnchantmentDurations(), GlobalCooldownMgr::AddGlobalCooldown(), AddItemDurations(), AddItemsSetItem(), Object::AddToWorld(), ApplyEquipCooldown(), BASE_ATTACK, Unit::BuildCooldownPacket(), ItemTemplate::Class, CLASS_ROGUE, Item::ClearSoulboundTradeable(), CR_ARMOR_PENETRATION, Object::DestroyForPlayer(), EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, Unit::getClass(), Item::GetCount(), Object::GetEntry(), GetGlobalCooldownMgr(), Object::GetGUID(), GetItemByPos(), GetSession(), Item::GetTemplate(), ItemTemplate::InventoryType, INVTYPE_RELIC, Unit::IsAlive(), Unit::IsInCombat(), Object::IsInWorld(), ITEM_CHANGED, ITEM_CLASS_WEAPON, ITEM_REMOVED, ItemTemplate::ItemSet, LOG_ERROR, m_weaponChangeTimer, OFF_ATTACK, RecalculateRating(), RemoveEnchantmentDurations(), Object::RemoveFromWorld(), RemoveItemDurations(), RemoveTradeableItem(), WorldSession::SendPacket(), Object::SendUpdateToPlayer(), Item::SetCount(), Item::SetNotRefundable(), Item::SetOwnerGUID(), Item::SetState(), SPELL_COOLDOWN_FLAG_INCLUDE_GCD, sScriptMgr, sSpellMgr, SpellInfo::StartRecoveryTime, UpdateAchievementCriteria(), UpdateExpertise(), UpdateForQuestWorldObjects(), and VisualizeItem().

Referenced by Create(), Spell::EffectSummonChangeItem(), EquipNewItem(), WorldSession::HandleAutoEquipItemOpcode(), SplitItem(), and SwapItem().

◆ EquipNewItem()

Item * Player::EquipNewItem ( uint16  pos,
uint32  item,
bool  update 
)
2730{
2731 Item* _item = Item::CreateItem(item, 1, this);
2732 if (!_item)
2733 return nullptr;
2734
2735 if (!IsEquipmentPos(pos) || sScriptMgr->CanSaveEquipNewItem(this, _item, pos, update))
2736 {
2737 // pussywizard: obtaining blue or better items saves to db
2738 if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item))
2739 if (pProto->Quality >= ITEM_QUALITY_RARE)
2741
2742 ItemAddedQuestCheck(item, 1);
2744 }
2745
2746 return EquipItem(pos, _item, update);
2747}
@ ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM
Definition: DBCEnums.h:207
@ ITEM_QUALITY_RARE
Definition: SharedDefines.h:332
void ItemAddedQuestCheck(uint32 entry, uint32 count)
Definition: PlayerQuest.cpp:1821

References ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, ADDITIONAL_SAVING_INVENTORY_AND_GOLD, AdditionalSavingAddMask(), Item::CreateItem(), EquipItem(), IsEquipmentPos(), ITEM_QUALITY_RARE, ItemAddedQuestCheck(), sObjectMgr, sScriptMgr, and UpdateAchievementCriteria().

Referenced by _StoreOrEquipNewItem(), and StoreNewItemInBestSlots().

◆ FailQuest()

void Player::FailQuest ( uint32  quest_id)
886{
887 if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
888 {
889 QuestStatus qStatus = GetQuestStatus(questId);
890 // xinef: if quest is marked as failed, dont do it again
891 if (qStatus != QUEST_STATUS_INCOMPLETE)
892 return;
893
895
896 uint16 log_slot = FindQuestSlot(questId);
897
898 if (log_slot < MAX_QUEST_LOG_SIZE)
899 {
900 SetQuestSlotTimer(log_slot, 1);
902 }
903
904 if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED))
905 {
906 QuestStatusData& q_status = m_QuestStatus[questId];
907
908 RemoveTimedQuest(questId);
909 q_status.Timer = 0;
910
911 SendQuestTimerFailed(questId);
912 }
913 else
914 SendQuestFailed(questId);
915
916 // Destroy quest items on quest failure.
917 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
918 if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
919 if (quest->RequiredItemCount[i] > 0 && itemTemplate->Bonding == BIND_QUEST_ITEM)
920 DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true);
921
922 for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
923 if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->ItemDrop[i]))
924 if (quest->ItemDropQuantity[i] > 0 && itemTemplate->Bonding == BIND_QUEST_ITEM)
925 DestroyItemCount(quest->ItemDrop[i], quest->ItemDropQuantity[i], true);
926 }
927}
void SendQuestTimerFailed(uint32 quest_id)
Definition: PlayerQuest.cpp:2380
void SendQuestFailed(uint32 questId, InventoryResult reason=EQUIP_ERR_OK)
Definition: PlayerQuest.cpp:2368
void SetQuestSlotTimer(uint16 slot, uint32 timer)
Definition: Player.h:1482
void RemoveTimedQuest(uint32 quest_id)
Definition: Player.h:1533

References BIND_QUEST_ITEM, DestroyItemCount(), FindQuestSlot(), GetQuestStatus(), m_QuestStatus, MAX_QUEST_LOG_SIZE, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SOURCE_ITEM_IDS_COUNT, QUEST_SPECIAL_FLAGS_TIMED, QUEST_STATE_FAIL, QUEST_STATUS_FAILED, QUEST_STATUS_INCOMPLETE, RemoveTimedQuest(), SendQuestFailed(), SendQuestTimerFailed(), SetQuestSlotState(), SetQuestSlotTimer(), SetQuestStatus(), sObjectMgr, and QuestStatusData::Timer.

Referenced by npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI::CheckEventFail(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::CheckEventFail(), SmartAI::EndPath(), npc_clintar_spirit::npc_clintar_spiritAI::JustDied(), npc_captain_saeed::npc_captain_saeedAI::JustDied(), npc_doctor::npc_doctorAI::PatientDied(), Map::ScriptsProcess(), Update(), and npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI().

◆ FindEquipSlot()

uint8 Player::FindEquipSlot ( ItemTemplate const *  proto,
uint32  slot,
bool  swap 
) const
135{
136 uint8 playerClass = getClass();
137
138 uint8 slots[4];
139 slots[0] = NULL_SLOT;
140 slots[1] = NULL_SLOT;
141 slots[2] = NULL_SLOT;
142 slots[3] = NULL_SLOT;
143 switch (proto->InventoryType)
144 {
145 case INVTYPE_HEAD:
146 slots[0] = EQUIPMENT_SLOT_HEAD;
147 break;
148 case INVTYPE_NECK:
149 slots[0] = EQUIPMENT_SLOT_NECK;
150 break;
152 slots[0] = EQUIPMENT_SLOT_SHOULDERS;
153 break;
154 case INVTYPE_BODY:
155 slots[0] = EQUIPMENT_SLOT_BODY;
156 break;
157 case INVTYPE_CHEST:
158 case INVTYPE_ROBE:
159 slots[0] = EQUIPMENT_SLOT_CHEST;
160 break;
161 case INVTYPE_WAIST:
162 slots[0] = EQUIPMENT_SLOT_WAIST;
163 break;
164 case INVTYPE_LEGS:
165 slots[0] = EQUIPMENT_SLOT_LEGS;
166 break;
167 case INVTYPE_FEET:
168 slots[0] = EQUIPMENT_SLOT_FEET;
169 break;
170 case INVTYPE_WRISTS:
171 slots[0] = EQUIPMENT_SLOT_WRISTS;
172 break;
173 case INVTYPE_HANDS:
174 slots[0] = EQUIPMENT_SLOT_HANDS;
175 break;
176 case INVTYPE_FINGER:
177 slots[0] = EQUIPMENT_SLOT_FINGER1;
178 slots[1] = EQUIPMENT_SLOT_FINGER2;
179 break;
180 case INVTYPE_TRINKET:
181 slots[0] = EQUIPMENT_SLOT_TRINKET1;
182 slots[1] = EQUIPMENT_SLOT_TRINKET2;
183 break;
184 case INVTYPE_CLOAK:
185 slots[0] = EQUIPMENT_SLOT_BACK;
186 break;
187 case INVTYPE_WEAPON:
188 {
189 slots[0] = EQUIPMENT_SLOT_MAINHAND;
190
191 // suggest offhand slot only if know dual wielding
192 // (this will be replace mainhand weapon at auto equip instead unwonted "you don't known dual wielding" ...
193 if (CanDualWield())
194 slots[1] = EQUIPMENT_SLOT_OFFHAND;
195 break;
196 }
197 case INVTYPE_SHIELD:
199 case INVTYPE_HOLDABLE:
200 slots[0] = EQUIPMENT_SLOT_OFFHAND;
201 break;
202 case INVTYPE_RANGED:
204 case INVTYPE_THROWN:
205 slots[0] = EQUIPMENT_SLOT_RANGED;
206 break;
207 case INVTYPE_2HWEAPON:
208 slots[0] = EQUIPMENT_SLOT_MAINHAND;
210 {
211 if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
212 {
213 if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF)
214 {
215 const_cast<Player*>(this)->AutoUnequipOffhandIfNeed(true);
216 break;
217 }
218 }
219 }
220
222 {
223 if (proto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || proto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF)
224 {
225 const_cast<Player*>(this)->AutoUnequipOffhandIfNeed(true);
226 break;
227 }
228 }
229 if (CanDualWield() && CanTitanGrip() && proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF && proto->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
230 slots[1] = EQUIPMENT_SLOT_OFFHAND;
231 break;
232 case INVTYPE_TABARD:
233 slots[0] = EQUIPMENT_SLOT_TABARD;
234 break;
236 slots[0] = EQUIPMENT_SLOT_MAINHAND;
237 break;
238 case INVTYPE_BAG:
239 slots[0] = INVENTORY_SLOT_BAG_START + 0;
240 slots[1] = INVENTORY_SLOT_BAG_START + 1;
241 slots[2] = INVENTORY_SLOT_BAG_START + 2;
242 slots[3] = INVENTORY_SLOT_BAG_START + 3;
243 break;
244 case INVTYPE_RELIC:
245 {
246 switch (proto->SubClass)
247 {
249 if (playerClass == CLASS_PALADIN)
250 slots[0] = EQUIPMENT_SLOT_RANGED;
251 break;
253 if (playerClass == CLASS_DRUID)
254 slots[0] = EQUIPMENT_SLOT_RANGED;
255 break;
257 if (playerClass == CLASS_SHAMAN)
258 slots[0] = EQUIPMENT_SLOT_RANGED;
259 break;
261 if (playerClass == CLASS_WARLOCK)
262 slots[0] = EQUIPMENT_SLOT_RANGED;
263 break;
265 if (playerClass == CLASS_DEATH_KNIGHT)
266 slots[0] = EQUIPMENT_SLOT_RANGED;
267 break;
268 }
269 break;
270 }
271 default:
272 return NULL_SLOT;
273 }
274
275 if (slot != NULL_SLOT)
276 {
277 if (swap || !GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
278 for (uint8 i = 0; i < 4; ++i)
279 if (slots[i] == slot)
280 return slot;
281 }
282 else
283 {
284 // search free slot at first
285 for (uint8 i = 0; i < 4; ++i)
286 if (slots[i] != NULL_SLOT && !GetItemByPos(INVENTORY_SLOT_BAG_0, slots[i]))
287 // in case 2hand equipped weapon (without titan grip) offhand slot empty but not free
288 if (slots[i] != EQUIPMENT_SLOT_OFFHAND || !IsTwoHandUsed())
289 return slots[i];
290
291 // if not found free and can swap return first appropriate from used
292 for (uint8 i = 0; i < 4; ++i)
293 if (slots[i] != NULL_SLOT && swap)
294 return slots[i];
295 }
296
297 // no free position
298 return NULL_SLOT;
299}
@ ITEM_SUBCLASS_WEAPON_STAFF
Definition: ItemTemplate.h:363
@ INVTYPE_BODY
Definition: ItemTemplate.h:269
@ INVTYPE_FINGER
Definition: ItemTemplate.h:276
@ INVTYPE_HEAD
Definition: ItemTemplate.h:266
@ INVTYPE_ROBE
Definition: ItemTemplate.h:285
@ INVTYPE_HOLDABLE
Definition: ItemTemplate.h:288
@ INVTYPE_TRINKET
Definition: ItemTemplate.h:277
@ INVTYPE_RANGED
Definition: ItemTemplate.h:280
@ INVTYPE_THROWN
Definition: ItemTemplate.h:290
@ INVTYPE_WAIST
Definition: ItemTemplate.h:271
@ INVTYPE_RANGEDRIGHT
Definition: ItemTemplate.h:291
@ INVTYPE_WRISTS
Definition: ItemTemplate.h:274
@ INVTYPE_WEAPONMAINHAND
Definition: ItemTemplate.h:286
@ INVTYPE_BAG
Definition: ItemTemplate.h:283
@ INVTYPE_NECK
Definition: ItemTemplate.h:267
@ INVTYPE_SHOULDERS
Definition: ItemTemplate.h:268
@ INVTYPE_FEET
Definition: ItemTemplate.h:273
@ INVTYPE_SHIELD
Definition: ItemTemplate.h:279
@ INVTYPE_TABARD
Definition: ItemTemplate.h:284
@ INVTYPE_LEGS
Definition: ItemTemplate.h:272
@ INVTYPE_CHEST
Definition: ItemTemplate.h:270
@ INVTYPE_HANDS
Definition: ItemTemplate.h:275
@ EQUIPMENT_SLOT_SHOULDERS
Definition: Player.h:678
@ EQUIPMENT_SLOT_BODY
Definition: Player.h:679
@ EQUIPMENT_SLOT_HANDS
Definition: Player.h:685
@ EQUIPMENT_SLOT_NECK
Definition: Player.h:677
@ EQUIPMENT_SLOT_TABARD
Definition: Player.h:694
@ EQUIPMENT_SLOT_HEAD
Definition: Player.h:676
@ EQUIPMENT_SLOT_LEGS
Definition: Player.h:682
@ EQUIPMENT_SLOT_BACK
Definition: Player.h:690
@ EQUIPMENT_SLOT_WAIST
Definition: Player.h:681
@ EQUIPMENT_SLOT_FEET
Definition: Player.h:683
@ EQUIPMENT_SLOT_CHEST
Definition: Player.h:680
@ EQUIPMENT_SLOT_WRISTS
Definition: Player.h:684

References AutoUnequipOffhandIfNeed(), Unit::CanDualWield(), CanTitanGrip(), CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_PALADIN, CLASS_SHAMAN, CLASS_WARLOCK, EQUIPMENT_SLOT_BACK, EQUIPMENT_SLOT_BODY, EQUIPMENT_SLOT_CHEST, EQUIPMENT_SLOT_FEET, EQUIPMENT_SLOT_FINGER1, EQUIPMENT_SLOT_FINGER2, EQUIPMENT_SLOT_HANDS, EQUIPMENT_SLOT_HEAD, EQUIPMENT_SLOT_LEGS, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_NECK, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, EQUIPMENT_SLOT_SHOULDERS, EQUIPMENT_SLOT_TABARD, EQUIPMENT_SLOT_TRINKET1, EQUIPMENT_SLOT_TRINKET2, EQUIPMENT_SLOT_WAIST, EQUIPMENT_SLOT_WRISTS, Unit::getClass(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_START, ItemTemplate::InventoryType, INVTYPE_2HWEAPON, INVTYPE_BAG, INVTYPE_BODY, INVTYPE_CHEST, INVTYPE_CLOAK, INVTYPE_FEET, INVTYPE_FINGER, INVTYPE_HANDS, INVTYPE_HEAD, INVTYPE_HOLDABLE, INVTYPE_LEGS, INVTYPE_NECK, INVTYPE_RANGED, INVTYPE_RANGEDRIGHT, INVTYPE_RELIC, INVTYPE_ROBE, INVTYPE_SHIELD, INVTYPE_SHOULDERS, INVTYPE_TABARD, INVTYPE_THROWN, INVTYPE_TRINKET, INVTYPE_WAIST, INVTYPE_WEAPON, INVTYPE_WEAPONMAINHAND, INVTYPE_WEAPONOFFHAND, INVTYPE_WRISTS, IsTwoHandUsed(), ITEM_SUBCLASS_ARMOR_IDOL, ITEM_SUBCLASS_ARMOR_LIBRAM, ITEM_SUBCLASS_ARMOR_MISC, ITEM_SUBCLASS_ARMOR_SIGIL, ITEM_SUBCLASS_ARMOR_TOTEM, ITEM_SUBCLASS_WEAPON_FISHING_POLE, ITEM_SUBCLASS_WEAPON_POLEARM, ITEM_SUBCLASS_WEAPON_STAFF, NULL_SLOT, and ItemTemplate::SubClass.

Referenced by CanEquipItem(), and WorldSession::HandleAutoEquipItemOpcode().

◆ FindQuestSlot()

uint16 Player::FindQuestSlot ( uint32  quest_id) const

◆ GetAchievementMgr()

AchievementMgr * Player::GetAchievementMgr ( ) const
inline
2499{ return m_achievementMgr; }

References m_achievementMgr.

◆ GetActionButton()

ActionButton const * Player::GetActionButton ( uint8  button)
5569{
5570 ActionButtonList::iterator buttonItr = m_actionButtons.find(button);
5571 if (buttonItr == m_actionButtons.end() || buttonItr->second.uState == ACTIONBUTTON_DELETED)
5572 return nullptr;
5573
5574 return &buttonItr->second;
5575}

References ACTIONBUTTON_DELETED, and m_actionButtons.

Referenced by Spell::EffectCastButtons().

◆ GetActiveSpec()

◆ GetActiveSpecMask()

uint8 Player::GetActiveSpecMask ( ) const
inline

◆ GetAmmoDPS()

float Player::GetAmmoDPS ( ) const
inline
1308{ return m_ammoDPS; }

References m_ammoDPS.

Referenced by _ApplyAmmoBonuses(), and CalculateMinMaxDamage().

◆ GetArenaPersonalRating()

uint32 Player::GetArenaPersonalRating ( uint8  slot) const
16121{
16123
16124 sScriptMgr->OnGetArenaPersonalRating(const_cast<Player*>(this), slot, result);
16125
16126 return result;
16127}

References ARENA_TEAM_END, ARENA_TEAM_PERSONAL_RATING, Object::GetUInt32Value(), PLAYER_FIELD_ARENA_TEAM_INFO_1_1, and sScriptMgr.

Referenced by GetMaxPersonalArenaRatingRequirement().

◆ GetArenaPoints()

uint32 Player::GetArenaPoints ( ) const
inline

◆ GetArenaTeamId()

◆ GetArenaTeamIdFromDB()

uint32 Player::GetArenaTeamIdFromDB ( ObjectGuid  guid,
uint8  slot 
)
static
6219{
6221 stmt->SetData(0, guid.GetCounter());
6222 stmt->SetData(1, type);
6223 PreparedQueryResult result = CharacterDatabase.Query(stmt);
6224
6225 if (!result)
6226 return 0;
6227
6228 uint32 id = (*result)[0].Get<uint32>();
6229 return id;
6230}
@ CHAR_SEL_ARENA_TEAM_ID_BY_PLAYER_GUID
Definition: CharacterDatabase.h:350

References CHAR_SEL_ARENA_TEAM_ID_BY_PLAYER_GUID, CharacterDatabase, ObjectGuid::GetCounter(), and PreparedStatementBase::SetData().

Referenced by arena_commandscript::HandleArenaCreateCommand().

◆ GetArenaTeamIdInvited()

◆ GetArmorProficiency()

uint32 Player::GetArmorProficiency ( ) const
inline
1341{ return m_ArmorProficiency; }

References m_ArmorProficiency.

Referenced by Spell::EffectProficiency().

◆ GetAttackBySlot()

◆ GetAurasForTarget()

void Player::GetAurasForTarget ( Unit target,
bool  force = false 
)

Blizz sends certain movement packets sometimes even before CreateObject These movement packets are usually found in SMSG_COMPRESSED_MOVES

11982{
11983 if (!target || (!force && target->GetVisibleAuras()->empty())) // speedup things
11984 return;
11985
11990 target->SendMovementFeatherFall(this);
11991
11993 target->SendMovementWaterWalking(this);
11994
11995 if (target->HasAuraType(SPELL_AURA_HOVER))
11996 target->SendMovementHover(this);
11997
11999 data<< target->GetPackGUID();
12000
12001 Unit::VisibleAuraMap const* visibleAuras = target->GetVisibleAuras();
12002 for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
12003 {
12004 AuraApplication* auraApp = itr->second;
12005 auraApp->BuildUpdatePacket(data, false);
12006 }
12007
12008 GetSession()->SendPacket(&data);
12009}
@ SPELL_AURA_FEATHER_FALL
Definition: SpellAuraDefines.h:168
@ SPELL_AURA_WATER_WALK
Definition: SpellAuraDefines.h:167
@ SPELL_AURA_HOVER
Definition: SpellAuraDefines.h:169
@ SMSG_AURA_UPDATE_ALL
Definition: Opcodes.h:1203
void SendMovementHover(Player *sendTo)
Definition: Unit.cpp:21048
std::map< uint8, AuraApplication * > VisibleAuraMap
Definition: Unit.h:1324
void SendMovementWaterWalking(Player *sendTo)
Definition: Unit.cpp:20989
VisibleAuraMap const * GetVisibleAuras()
Definition: Unit.h:2165
void SendMovementFeatherFall(Player *sendTo)
Definition: Unit.cpp:21011
Definition: SpellAuras.h:37
void BuildUpdatePacket(ByteBuffer &data, bool remove) const
Definition: SpellAuras.cpp:248

References AuraApplication::BuildUpdatePacket(), Object::GetPackGUID(), GetSession(), Unit::GetVisibleAuras(), Unit::HasAuraType(), Unit::SendMovementFeatherFall(), Unit::SendMovementHover(), Unit::SendMovementWaterWalking(), WorldSession::SendPacket(), SMSG_AURA_UPDATE_ALL, SPELL_AURA_FEATHER_FALL, SPELL_AURA_HOVER, and SPELL_AURA_WATER_WALK.

Referenced by GetInitialVisiblePackets(), and Map::SendInitSelf().

◆ GetAuraUpdateMaskForRaid()

uint64 Player::GetAuraUpdateMaskForRaid ( ) const
inline

◆ GetAverageItemLevel()

float Player::GetAverageItemLevel ( )
15642{
15643 float sum = 0;
15644 uint32 count = 0;
15645 uint8 level = GetLevel();
15646
15648 {
15649 // don't check tabard, ranged, offhand or shirt
15651 continue;
15652
15653 if (m_items[i] && m_items[i]->GetTemplate())
15655
15656 ++count;
15657 }
15658
15659 return std::max<float>(0.0f, sum / (float)count);
15660}
float GetItemLevelIncludingQuality(uint8 pLevel) const
Definition: ItemTemplate.h:768

References EQUIPMENT_SLOT_BODY, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, EQUIPMENT_SLOT_START, EQUIPMENT_SLOT_TABARD, ItemTemplate::GetItemLevelIncludingQuality(), Unit::GetLevel(), Item::GetTemplate(), and m_items.

Referenced by spell_gen_vehicle_scaling_aura::CalculateAmount(), gear_commandscript::HandleGearStatsCommand(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetAverageItemLevelForDF()

float Player::GetAverageItemLevelForDF ( )
15663{
15664 float sum = 0;
15665 uint32 count = 0;
15666 uint8 level = GetLevel();
15667
15668 for (int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
15669 {
15670 // don't check tabard, ranged, offhand or shirt
15672 continue;
15673
15674 if (m_items[i] && m_items[i]->GetTemplate())
15675 {
15676 if (m_items[i]->GetTemplate()->Quality == ITEM_QUALITY_HEIRLOOM)
15677 sum += level * 2.33f;
15678 else
15679 sum += m_items[i]->GetTemplate()->ItemLevel;
15680 }
15681
15682 ++count;
15683 }
15684
15685 return std::max(0.0f, sum / (float)count);
15686}

References EQUIPMENT_SLOT_BODY, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, EQUIPMENT_SLOT_START, EQUIPMENT_SLOT_TABARD, Unit::GetLevel(), Item::GetTemplate(), ITEM_QUALITY_HEIRLOOM, ItemTemplate::ItemLevel, and m_items.

Referenced by lfg::LFGMgr::InitializeLockedDungeons(), and Satisfy().

◆ GetBagByPos()

◆ GetBankBagSlotCount()

uint8 Player::GetBankBagSlotCount ( ) const
inline

◆ GetBarberShopCost()

uint32 Player::GetBarberShopCost ( uint8  newhairstyle,
uint8  newhaircolor,
uint8  newfacialhair,
BarberShopStyleEntry const *  newSkin = nullptr 
)
13166{
13167 uint8 level = GetLevel();
13168
13169 if (level > GT_MAX_LEVEL)
13170 level = GT_MAX_LEVEL; // max level in this dbc
13171
13172 uint8 hairstyle = GetByteValue(PLAYER_BYTES, 2);
13173 uint8 haircolor = GetByteValue(PLAYER_BYTES, 3);
13174 uint8 facialhair = GetByteValue(PLAYER_BYTES_2, 0);
13175 uint8 skincolor = GetByteValue(PLAYER_BYTES, 0);
13176
13177 if ((hairstyle == newhairstyle) && (haircolor == newhaircolor) && (facialhair == newfacialhair) && (!newSkin || (newSkin->hair_id == skincolor)))
13178 return 0;
13179
13180 GtBarberShopCostBaseEntry const* bsc = sGtBarberShopCostBaseStore.LookupEntry(level - 1);
13181
13182 if (!bsc) // shouldn't happen
13183 return 0xFFFFFFFF;
13184
13185 float cost = 0;
13186
13187 if (hairstyle != newhairstyle)
13188 cost += bsc->cost; // full price
13189
13190 if ((haircolor != newhaircolor) && (hairstyle == newhairstyle))
13191 cost += bsc->cost * 0.5f; // +1/2 of price
13192
13193 if (facialhair != newfacialhair)
13194 cost += bsc->cost * 0.75f; // +3/4 of price
13195
13196 if (newSkin && skincolor != newSkin->hair_id)
13197 cost += bsc->cost * 0.75f; // +5/6 of price
13198
13199 return uint32(cost);
13200}
DBCStorage< GtBarberShopCostBaseEntry > sGtBarberShopCostBaseStore(GtBarberShopCostBasefmt)
#define GT_MAX_LEVEL
Definition: DBCStructure.h:1027
Definition: DBCStructure.h:1033
float cost
Definition: DBCStructure.h:1034

References GtBarberShopCostBaseEntry::cost, Object::GetByteValue(), Unit::GetLevel(), GT_MAX_LEVEL, BarberShopStyleEntry::hair_id, PLAYER_BYTES, PLAYER_BYTES_2, and sGtBarberShopCostBaseStore.

Referenced by WorldSession::HandleAlterAppearance().

◆ GetBaseDefenseSkillValue()

uint32 Player::GetBaseDefenseSkillValue ( ) const
inline
@ SKILL_DEFENSE
Definition: SharedDefines.h:2881
uint16 GetBaseSkillValue(uint32 skill) const
Definition: Player.cpp:5418

References GetBaseSkillValue(), and SKILL_DEFENSE.

Referenced by UpdateCombatSkills().

◆ GetBaseModValue()

float Player::GetBaseModValue ( BaseModGroup  modGroup,
BaseModType  modType 
) const
4974{
4975 if (modGroup >= BASEMOD_END)
4976 {
4977 LOG_ERROR("entities.player", "trial to access non existed BaseModGroup!");
4978 return 0.0f;
4979 }
4980
4981 if (modType == PCT_MOD && m_auraBaseMod[modGroup][PCT_MOD] <= 0.0f)
4982 return 0.0f;
4983
4984 return m_auraBaseMod[modGroup][modType];
4985}

References BASEMOD_END, LOG_ERROR, m_auraBaseMod, and PCT_MOD.

◆ GetBaseRune()

RuneType Player::GetBaseRune ( uint8  index) const
inline
2469{ return RuneType(m_runes->runes[index].BaseRune); }
RuneType
Definition: Player.h:409
uint8 BaseRune
Definition: Player.h:419
RuneInfo runes[MAX_RUNES]
Definition: Player.h:428

References RuneInfo::BaseRune, m_runes, and Runes::runes.

Referenced by Spell::EffectActivateRune(), GetRuneBaseCooldown(), IsBaseRuneSlotsOnCooldown(), RemoveRunesByAuraEffect(), RestoreBaseRune(), Spell::TakeRunePower(), and UpdateRuneRegen().

◆ GetBaseSkillValue()

uint16 Player::GetBaseSkillValue ( uint32  skill) const
5419{
5420 if (!skill)
5421 return 0;
5422
5423 SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
5424 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
5425 return 0;
5426
5427 int32 result = int32(SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
5428 result += SKILL_PERM_BONUS(GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos)));
5429 return result < 0 ? 0 : result;
5430}
#define SKILL_PERM_BONUS(x)
Definition: Player.h:88

References Object::GetUInt32Value(), mSkillStatus, PLAYER_SKILL_BONUS_INDEX, PLAYER_SKILL_VALUE_INDEX, SKILL_DELETED, SKILL_PERM_BONUS, and SKILL_VALUE.

Referenced by npc_engineering_tele_trinket::CanLearn(), GetBaseDefenseSkillValue(), GetBaseWeaponSkillValue(), GetTrainerSpellState(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), go_evil_book_for_dummies::OnGossipHello(), and SatisfyQuestSkill().

◆ GetBaseSpellPowerBonus()

uint32 Player::GetBaseSpellPowerBonus ( )
inline

◆ GetBaseWeaponSkillValue()

uint32 Player::GetBaseWeaponSkillValue ( WeaponAttackType  attType) const
12729{
12730 Item* item = GetWeaponForAttack(attType, true);
12731
12732 // unarmed only with base attack
12733 if (attType != BASE_ATTACK && !item)
12734 return 0;
12735
12736 // weapon skill or (unarmed for base attack)
12737 uint32 skill = item ? item->GetSkill() : uint32(SKILL_UNARMED);
12738 return GetBaseSkillValue(skill);
12739}
@ SKILL_UNARMED
Definition: SharedDefines.h:2907

References BASE_ATTACK, GetBaseSkillValue(), Item::GetSkill(), GetWeaponForAttack(), and SKILL_UNARMED.

Referenced by UpdateCombatSkills().

◆ GetBattleground()

Battleground * Player::GetBattleground ( bool  create = false) const
12118{
12119 if (GetBattlegroundId() == 0)
12120 return nullptr;
12121
12123 return (create || (bg && bg->FindBgMap()) ? bg : nullptr);
12124}
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:188
BattlegroundMap * FindBgMap() const
Definition: Battleground.h:433
BattlegroundTypeId GetBattlegroundTypeId() const
Definition: Player.h:2217
uint32 GetBattlegroundId() const
Definition: Player.h:2216

References Battleground::FindBgMap(), GetBattlegroundId(), GetBattlegroundTypeId(), and sBattlegroundMgr.

Referenced by GameObject::ActivateToQuest(), CanEquipItem(), CanUnequipItem(), Spell::CheckCast(), MapInstanced::CreateInstanceForPlayer(), Object::DestroyForPlayer(), Spell::EffectOpenLock(), WorldSession::HandleAreaSpiritHealerQueryOpcode(), WorldSession::HandleAreaSpiritHealerQueueOpcode(), WorldSession::HandleAreaTriggerOpcode(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModEffectImmunity(), WorldSession::HandleBattlefieldLeaveOpcode(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::HandleBattlefieldStatusOpcode(), WorldSession::HandleBattlegroundPlayerPositionsOpcode(), spell_item_rocket_boots::HandleDummy(), WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleMovementOpcodes(), WorldSession::HandleMoveWorldportAck(), WorldSession::HandlePVPLogDataOpcode(), WorldSession::HandleQuestgiverCompleteQuest(), spell_ioc_gunship_portal::spell_ioc_gunship_portal_SpellScript::HandleScript2(), InArena(), SpellArea::IsFitToRequirements(), Unit::Kill(), LeaveBattleground(), AchievementCriteriaData::Meets(), Unit::Mount(), achievement_resilient_victory::OnCheck(), achievement_bg_control_all_nodes::OnCheck(), achievement_bg_ic_resource_glut::OnCheck(), achievement_arena_by_type::OnCheck(), achievement_everything_counts::OnCheck(), achievement_bg_av_perfection::OnCheck(), achievement_sa_defense_of_the_ancients::OnCheck(), achievement_not_even_a_scratch::OnCheck(), achievement_save_the_day::OnCheck(), go_arena_ready_marker::OnGossipHello(), RepopAtGraveyard(), ReportedAfkBy(), ResurrectPlayer(), RewardHonor(), SendInitWorldStates(), SendLoot(), SummonIfPossible(), AchievementMgr::UpdateAchievementCriteria(), and GameObject::Use().

◆ GetBattlegroundId()

◆ GetBattlegroundQueueIndex()

◆ GetBattlegroundQueueTypeId()

BattlegroundQueueTypeId Player::GetBattlegroundQueueTypeId ( uint32  index) const

◆ GetBattlegroundTypeId()

BattlegroundTypeId Player::GetBattlegroundTypeId ( ) const
inline
2217{ return m_bgData.bgTypeID; }
BattlegroundTypeId bgTypeID
Definition: Player.h:1028

References BGData::bgTypeID, and m_bgData.

Referenced by GetBattleground(), and ArenaSpectator::HandleSpectatorSpectateCommand().

◆ GetBGAccessByLevel()

bool Player::GetBGAccessByLevel ( BattlegroundTypeId  bgTypeId) const
12240{
12241 // get a template bg instead of running one
12242 Battleground* bgt = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId);
12243 if (!bgt)
12244 return false;
12245
12246 // limit check leel to dbc compatible level range
12247 uint32 level = GetLevel();
12248 if (level > DEFAULT_MAX_LEVEL)
12249 level = DEFAULT_MAX_LEVEL;
12250
12251 if (level < bgt->GetMinLevel() || level > bgt->GetMaxLevel())
12252 return false;
12253
12254 return true;
12255}
uint32 GetMaxLevel() const
Definition: Battleground.h:334

References DEFAULT_MAX_LEVEL, Unit::GetLevel(), Battleground::GetMaxLevel(), and sBattlegroundMgr.

Referenced by Group::CanJoinBattlegroundQueue(), WorldSession::HandleBattlemasterHelloOpcode(), WorldSession::HandleBattlemasterJoinOpcode(), and Creature::isCanInteractWithBattleMaster().

◆ GetBGData()

BGData & Player::GetBGData ( )
inline
2221{ return m_bgData; }

References m_bgData.

◆ GetBgTeamId()

◆ GetChampioningFaction()

uint32 Player::GetChampioningFaction ( ) const
inline
2513{ return m_ChampioningFaction; }

References m_ChampioningFaction.

Referenced by RewardReputation().

◆ GetChatTag()

uint8 Player::GetChatTag ( ) const
1288{
1289 uint8 tag = CHAT_TAG_NONE;
1290
1291 if (isGMChat())
1292 tag |= CHAT_TAG_GM;
1293 if (isDND())
1294 tag |= CHAT_TAG_DND;
1295 if (isAFK())
1296 tag |= CHAT_TAG_AFK;
1297 if (IsCommentator())
1298 tag |= CHAT_TAG_COM;
1299 if (IsDeveloper())
1300 tag |= CHAT_TAG_DEV;
1301
1302 return tag;
1303}
@ CHAT_TAG_COM
Definition: Player.h:842
@ CHAT_TAG_DND
Definition: Player.h:840
@ CHAT_TAG_DEV
Definition: Player.h:843
@ CHAT_TAG_AFK
Definition: Player.h:839
@ CHAT_TAG_GM
Definition: Player.h:841
@ CHAT_TAG_NONE
Definition: Player.h:838
bool IsCommentator() const
Definition: Player.h:1142
bool isGMChat() const
Definition: Player.h:1150
bool isDND() const
Definition: Player.h:1125
bool IsDeveloper() const
Definition: Player.h:1144
bool isAFK() const
Definition: Player.h:1124

References CHAT_TAG_AFK, CHAT_TAG_COM, CHAT_TAG_DEV, CHAT_TAG_DND, CHAT_TAG_GM, CHAT_TAG_NONE, isAFK(), IsCommentator(), IsDeveloper(), isDND(), and isGMChat().

◆ getCinematic()

uint8 Player::getCinematic ( ) const
inline
1795 {
1796 return m_cinematic;
1797 }

References m_cinematic.

Referenced by WorldSession::HandlePlayerLoginFromDB().

◆ GetCinematicMgr()

CinematicMgr * Player::GetCinematicMgr ( ) const
inline

◆ GetCommandStatus()

◆ GetCorpse()

◆ GetCorpseLocation()

◆ GetCorpseReclaimDelay()

uint32 Player::GetCorpseReclaimDelay ( bool  pvp) const
12836{
12837 if (pvp)
12838 {
12839 if (!sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP))
12840 return copseReclaimDelay[0];
12841 }
12842 else if (!sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE))
12843 return 0;
12844
12845 time_t now = GameTime::GetGameTime().count();
12846 // 0..2 full period
12847 // should be std::ceil(x)-1 but not floor(x)
12848 uint64 count = (now < m_deathExpireTime - 1) ? (m_deathExpireTime - 1 - now) / DEATH_EXPIRE_STEP : 0;
12849 return copseReclaimDelay[count];
12850}

References CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP, copseReclaimDelay, DEATH_EXPIRE_STEP, GameTime::GetGameTime(), m_deathExpireTime, and sWorld.

Referenced by CalculateCorpseReclaimDelay(), and WorldSession::HandleReclaimCorpseOpcode().

◆ GetCreationTime()

Seconds Player::GetCreationTime ( ) const
inline
2502{ return m_creationTime; }

References m_creationTime.

◆ GetCurrentBattlegroundQueueSlot()

uint32 Player::GetCurrentBattlegroundQueueSlot ( ) const
inline

◆ GetCurrentRune()

RuneType Player::GetCurrentRune ( uint8  index) const
inline

◆ GetDeathTimer()

uint32 Player::GetDeathTimer ( ) const
inline
2138{ return m_deathTimer; }

References m_deathTimer.

Referenced by WorldSession::LogoutPlayer().

◆ GetDebugInfo()

std::string Player::GetDebugInfo ( ) const
overridevirtual

Reimplemented from WorldObject.

16270{
16271 std::stringstream sstr;
16272 sstr << Unit::GetDebugInfo();
16273 return sstr.str();
16274}
std::string GetDebugInfo() const override
Definition: Unit.cpp:21581

References Unit::GetDebugInfo().

◆ GetDeclinedNames()

DeclinedName const * Player::GetDeclinedNames ( ) const
inline
2467{ return m_declinedname; }

References m_declinedname.

◆ GetDefaultGossipMenuForSource()

uint32 Player::GetDefaultGossipMenuForSource ( WorldObject source)
static
422{
423 switch (source->GetTypeId())
424 {
425 case TYPEID_UNIT:
426 return source->ToCreature()->GetCreatureTemplate()->GossipMenuId;
428 return source->ToGameObject()->GetGOInfo()->GetGossipMenuId();
429 default:
430 break;
431 }
432
433 return 0;
434}
uint32 GossipMenuId
Definition: CreatureData.h:187
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:138
uint32 GetGossipMenuId() const
Definition: GameObjectData.h:553

References Creature::GetCreatureTemplate(), GameObject::GetGOInfo(), GameObjectTemplate::GetGossipMenuId(), Object::GetTypeId(), CreatureTemplate::GossipMenuId, Object::ToCreature(), Object::ToGameObject(), TYPEID_GAMEOBJECT, and TYPEID_UNIT.

Referenced by GetGossipTextId(), and PrepareGossipMenu().

◆ GetDelayedOperations()

uint32 Player::GetDelayedOperations ( ) const
inline

◆ GetDifficulty()

◆ GetDivider()

◆ GetDodgeFromAgility()

void Player::GetDodgeFromAgility ( float &  diminishing,
float &  nondiminishing 
)
Todo:
: research if talents/effects that increase total agility by x% should increase non-diminishing part
5028{
5029 // Table for base dodge values
5030 const float dodge_base[MAX_CLASSES] =
5031 {
5032 0.036640f, // Warrior
5033 0.034943f, // Paladi
5034 -0.040873f, // Hunter
5035 0.020957f, // Rogue
5036 0.034178f, // Priest
5037 0.036640f, // DK
5038 0.021080f, // Shaman
5039 0.036587f, // Mage
5040 0.024211f, // Warlock
5041 0.0f, // ??
5042 0.056097f // Druid
5043 };
5044 // Crit/agility to dodge/agility coefficient multipliers; 3.2.0 increased required agility by 15%
5045 const float crit_to_dodge[MAX_CLASSES] =
5046 {
5047 0.85f / 1.15f, // Warrior
5048 1.00f / 1.15f, // Paladin
5049 1.11f / 1.15f, // Hunter
5050 2.00f / 1.15f, // Rogue
5051 1.00f / 1.15f, // Priest
5052 0.85f / 1.15f, // DK
5053 1.60f / 1.15f, // Shaman
5054 1.00f / 1.15f, // Mage
5055 0.97f / 1.15f, // Warlock (?)
5056 0.0f, // ??
5057 2.00f / 1.15f // Druid
5058 };
5059
5060 uint8 level = GetLevel();
5061 uint32 pclass = getClass();
5062
5063 if (level > GT_MAX_LEVEL)
5064 level = GT_MAX_LEVEL;
5065
5066 // Dodge per agility is proportional to crit per agility, which is available from DBC files
5067 GtChanceToMeleeCritEntry const* dodgeRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
5068 if (!dodgeRatio || pclass > MAX_CLASSES)
5069 return;
5070
5073 float bonus_agility = GetStat(STAT_AGILITY) - base_agility;
5074
5075 // calculate diminishing (green in char screen) and non-diminishing (white) contribution
5076 diminishing = 100.0f * bonus_agility * dodgeRatio->ratio * crit_to_dodge[pclass - 1];
5077 nondiminishing = 100.0f * (dodge_base[pclass - 1] + base_agility * dodgeRatio->ratio * crit_to_dodge[pclass - 1]);
5078}
DBCStorage< GtChanceToMeleeCritEntry > sGtChanceToMeleeCritStore(GtChanceToMeleeCritfmt)
@ UNIT_MOD_STAT_START
Definition: Unit.h:289
#define MAX_CLASSES
Definition: SharedDefines.h:155
float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END]
Definition: Unit.h:2529
float GetCreateStat(Stats stat) const
Definition: Unit.h:2059
Definition: DBCStructure.h:1048
float ratio
Definition: DBCStructure.h:1049

References BASE_PCT, Unit::getClass(), Unit::GetCreateStat(), Unit::GetLevel(), Unit::GetStat(), GT_MAX_LEVEL, Unit::m_auraModifiersGroup, MAX_CLASSES, GtChanceToMeleeCritEntry::ratio, sGtChanceToMeleeCritStore, STAT_AGILITY, and UNIT_MOD_STAT_START.

Referenced by UpdateDodgePercentage().

◆ GetDrunkenstateByValue()

DrunkenState Player::GetDrunkenstateByValue ( uint8  value)
static
962{
963 if (value >= 90)
964 return DRUNKEN_SMASHED;
965 if (value >= 50)
966 return DRUNKEN_DRUNK;
967 if (value)
968 return DRUNKEN_TIPSY;
969 return DRUNKEN_SOBER;
970}
@ DRUNKEN_TIPSY
Definition: Player.h:466
@ DRUNKEN_DRUNK
Definition: Player.h:467
@ DRUNKEN_SOBER
Definition: Player.h:465
@ DRUNKEN_SMASHED
Definition: Player.h:468

References DRUNKEN_DRUNK, DRUNKEN_SMASHED, DRUNKEN_SOBER, and DRUNKEN_TIPSY.

Referenced by Condition::Meets(), AchievementCriteriaData::Meets(), and SetDrunkValue().

◆ GetDrunkValue()

◆ GetDungeonDifficulty()

◆ GetEntryPoint()

WorldLocation const & Player::GetEntryPoint ( ) const
inline

◆ GetExpertiseDodgeOrParryReduction()

float Player::GetExpertiseDodgeOrParryReduction ( WeaponAttackType  attType) const
5119{
5120 switch (attType)
5121 {
5122 case BASE_ATTACK:
5123 return GetUInt32Value(PLAYER_EXPERTISE) / 4.0f;
5124 case OFF_ATTACK:
5126 default:
5127 break;
5128 }
5129 return 0.0f;
5130}
@ PLAYER_EXPERTISE
Definition: UpdateFields.h:349
@ PLAYER_OFFHAND_EXPERTISE
Definition: UpdateFields.h:350

References BASE_ATTACK, Object::GetUInt32Value(), OFF_ATTACK, PLAYER_EXPERTISE, and PLAYER_OFFHAND_EXPERTISE.

◆ GetFarSightDistance()

Optional< float > Player::GetFarSightDistance ( ) const
16199{
16200 return _farSightDistance;
16201}
Optional< float > _farSightDistance
Definition: Player.h:2952

References _farSightDistance.

◆ GetFreeInventorySpace()

uint32 Player::GetFreeInventorySpace ( ) const
495{
496 uint32 freeSpace = 0;
497
498 // Check backpack
499 for (uint8 slot = INVENTORY_SLOT_ITEM_START; slot < INVENTORY_SLOT_ITEM_END; ++slot)
500 {
502 if (!item)
503 freeSpace += 1;
504 }
505
506 // Check bags
508 {
509 if (Bag* bag = GetBagByPos(i))
510 freeSpace += bag->GetFreeSlots();
511 }
512
513 return freeSpace;
514}

References GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, and INVENTORY_SLOT_ITEM_START.

Referenced by Spell::CheckItems().

◆ GetFreePrimaryProfessionPoints()

uint32 Player::GetFreePrimaryProfessionPoints ( ) const
inline

◆ GetFreeTalentPoints()

uint32 Player::GetFreeTalentPoints ( ) const
inline
@ PLAYER_CHARACTER_POINTS1
Definition: UpdateFields.h:342

References Object::GetUInt32Value(), and PLAYER_CHARACTER_POINTS1.

Referenced by BuildPlayerTalentsInfoData(), and LearnTalent().

◆ GetGameObjectIfCanInteractWith()

GameObject * Player::GetGameObjectIfCanInteractWith ( ObjectGuid  guid,
GameobjectTypes  type 
) const
2121{
2122 if (GameObject* go = GetMap()->GetGameObject(guid))
2123 {
2124 if (go->GetGoType() == type)
2125 {
2126 // Players cannot interact with gameobjects that use the "Point" icon
2127 if (go->GetGOInfo()->IconName == "Point")
2128 {
2129 return nullptr;
2130 }
2131
2132 if (go->IsWithinDistInMap(this))
2133 {
2134 return go;
2135 }
2136
2137 LOG_DEBUG("maps", "IsGameObjectOfTypeInRange: GameObject '{}' [{}] is too far away from player {} [{}] to be used by him (distance={}, maximal 10 is allowed)",
2138 go->GetGOInfo()->name, go->GetGUID().ToString(), GetName(), GetGUID().ToString(), go->GetDistance(this));
2139 }
2140 }
2141 return nullptr;
2142}
GameObject * GetGameObject(uint32 spellId) const
Definition: Unit.cpp:6107

References Unit::GetGameObject(), Object::GetGUID(), WorldObject::GetMap(), WorldObject::GetName(), LOG_DEBUG, and Position::ToString().

Referenced by CanInteractWithQuestGiver(), WorldSession::CanOpenMailBox(), and WorldSession::HandleGuildBankerActivate().

◆ GetGlobalCooldownMgr()

GlobalCooldownMgr & Player::GetGlobalCooldownMgr ( )
inline
1768{ return m_GlobalCooldownMgr; }
GlobalCooldownMgr m_GlobalCooldownMgr
Definition: Player.h:2764

References m_GlobalCooldownMgr.

Referenced by Spell::CancelGlobalCooldown(), EquipItem(), Spell::HasGlobalCooldown(), and Spell::TriggerGlobalCooldown().

◆ GetGlyph()

◆ GetGlyphSlot()

uint32 Player::GetGlyphSlot ( uint8  slot) const
inline
@ PLAYER_FIELD_GLYPH_SLOTS_1
Definition: UpdateFields.h:388

References Object::GetUInt32Value(), and PLAYER_FIELD_GLYPH_SLOTS_1.

Referenced by _LoadGlyphAuras(), and Spell::EffectApplyGlyph().

◆ GetGossipTextId() [1/2]

uint32 Player::GetGossipTextId ( uint32  menuId,
WorldObject source 
)
404{
406
407 if (!menuId)
408 return textId;
409
410 GossipMenusMapBounds menuBounds = sObjectMgr->GetGossipMenusMapBounds(menuId);
411
412 for (GossipMenusContainer::const_iterator itr = menuBounds.first; itr != menuBounds.second; ++itr)
413 {
414 if (sConditionMgr->IsObjectMeetToConditions(this, source, itr->second.Conditions))
415 textId = itr->second.TextID;
416 }
417
418 return textId;
419}
#define DEFAULT_GOSSIP_MESSAGE
Definition: GossipDef.h:30
std::pair< GossipMenusContainer::const_iterator, GossipMenusContainer::const_iterator > GossipMenusMapBounds
Definition: ObjectMgr.h:636

References DEFAULT_GOSSIP_MESSAGE, sConditionMgr, and sObjectMgr.

Referenced by GetGossipTextId(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), boss_gloomrel::OnGossipHello(), npc_death_knight_initiate::OnGossipHello(), npc_highlord_darion_mograine::OnGossipHello(), npc_augustus_the_touched::OnGossipHello(), npc_varian_wrynn::OnGossipHello(), npc_thrall_bfu::OnGossipHello(), npc_zulaman_hostage::OnGossipHello(), npc_thrall_warchief::OnGossipHello(), npc_rivern_frostwind::OnGossipHello(), npc_hor_leader::OnGossipHello(), npc_high_overlord_saurfang_icc::OnGossipHello(), npc_muradin_bronzebeard_icc::OnGossipHello(), npc_shandy_dalaran::OnGossipHello(), npc_razael_and_lyana::OnGossipHello(), npc_mcmanus::OnGossipHello(), npc_vekjik::OnGossipHello(), npc_adventurous_dwarf::OnGossipHello(), npc_roxi_ramrocket::OnGossipHello(), npc_wg_demolisher_engineer::OnGossipHello(), npc_wg_spirit_guide::OnGossipHello(), npc_wg_quest_giver::OnGossipHello(), npc_finklestein::OnGossipHello(), npc_drake_dealer_hurlunk::OnGossipHello(), npcs_flanis_swiftwing_and_kagrosh::OnGossipHello(), npc_zephyr::OnGossipHello(), npc_innkeeper::OnGossipHello(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_engineering_tele_trinket::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), npc_artorius::OnGossipHello(), npc_simone::OnGossipHello(), npc_nelson::OnGossipHello(), npc_franklin::OnGossipHello(), npc_taxi::OnGossipHello(), npc_sayge::OnGossipHello(), npc_wormhole::OnGossipHello(), npc_locksmith::OnGossipHello(), npc_experience::OnGossipHello(), go_evil_book_for_dummies::OnGossipHello(), icecrown_citadel_teleport::OnGossipHello(), npc_prof_blacksmith::SendActionMenu(), npc_prof_alchemy::SendConfirmLearn(), npc_prof_blacksmith::SendConfirmLearn(), npc_prof_tailor::SendConfirmLearn(), go_evil_book_for_dummies::SendConfirmLearn(), npc_prof_alchemy::SendConfirmUnlearn(), npc_prof_blacksmith::SendConfirmUnlearn(), npc_prof_tailor::SendConfirmUnlearn(), go_evil_book_for_dummies::SendConfirmUnlearn(), SendPreparedGossip(), SendPreparedQuest(), npc_echo_of_medivh::sGossipHello(), and npc_chesspiece::sGossipHello().

◆ GetGossipTextId() [2/2]

uint32 Player::GetGossipTextId ( WorldObject source)
396{
397 if (!source)
399
400 return GetGossipTextId(GetDefaultGossipMenuForSource(source), source);
401}
static uint32 GetDefaultGossipMenuForSource(WorldObject *source)
Definition: PlayerGossip.cpp:421
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: PlayerGossip.cpp:403

References DEFAULT_GOSSIP_MESSAGE, GetDefaultGossipMenuForSource(), and GetGossipTextId().

◆ GetGracePeriod()

uint32 Player::GetGracePeriod ( uint8  index) const
inline
2472{ return m_runes->runes[index].GracePeriod; }
uint32 GracePeriod
Definition: Player.h:422

References RuneInfo::GracePeriod, m_runes, and Runes::runes.

Referenced by GetRuneBaseCooldown(), and RegenerateAll().

◆ GetGrantableLevels()

uint8 Player::GetGrantableLevels ( )
inline

◆ GetGroup() [1/2]

Group * Player::GetGroup ( )
inline
2431{ return m_group.getTarget(); }
TO * getTarget() const
Definition: Reference.h:95
GroupReference m_group
Definition: Player.h:2844

References Reference< TO, FROM >::getTarget(), and m_group.

Referenced by _LoadGroup(), Group::AddInvite(), Loot::AddItem(), Group::AddMember(), Battlefield::AddOrSetPlayerToCorrectBfGroup(), Battleground::AddOrSetPlayerToCorrectBgGroup(), Arena::AddPlayer(), InstanceMap::AddPlayerToMap(), LootItem::AllowedForPlayer(), Group::BroadcastPacket(), npc_coren_direbrew::CanBeSeen(), go_loosely_turned_soil::go_loosely_turned_soilAI::CanBeSeen(), InstanceMap::CannotEnter(), CanRollForItemInLFG(), CanUninviteFromGroup(), Spell::CheckCast(), npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI::CheckEventFail(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::CheckEventFail(), CheckInstanceLoginValid(), MapInstanced::CreateInstanceForPlayer(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), ArenaTeam::DelMember(), Group::Disband(), WorldSession::DoLootRelease(), DoRandomRoll(), SmartAI::EndPath(), Loot::FillLoot(), GetNextRandomRaidMember(), Unit::GetNextRandomRaidMemberOrPet(), Unit::GetPartyMembers(), ChatHandler::GetPlayerGroupAndGUIDByName(), GetsRecruitAFriendBonus(), GroupEventHappens(), misc_commandscript::HandleAppearCommand(), WorldSession::HandleAreaTriggerOpcode(), Unit::HandleAuraRaidProcFromChargeWithValue(), WorldSession::HandleBattlemasterJoinArena(), WorldSession::HandleBattlemasterJoinOpcode(), Unit::HandleDummyAuraProc(), WorldSession::HandleGrantLevel(), WorldSession::HandleGroupAssistantLeaderOpcode(), WorldSession::HandleGroupChangeSubGroupOpcode(), WorldSession::HandleGroupDisbandOpcode(), WorldSession::HandleGroupInviteOpcode(), group_commandscript::HandleGroupJoinCommand(), WorldSession::HandleGroupRaidConvertOpcode(), WorldSession::HandleGroupSetLeaderOpcode(), misc_commandscript::HandleGroupSummonCommand(), WorldSession::HandleGroupSwapSubGroupOpcode(), WorldSession::HandleGroupUninviteGuidOpcode(), WorldSession::HandleGroupUninviteOpcode(), WorldSession::HandleInstanceLockResponse(), OutdoorPvP::HandleKill(), WorldSession::HandleLfgLeaveOpcode(), WorldSession::HandleLfgPartyLockInfoRequestOpcode(), WorldSession::HandleLfgSetRolesOpcode(), WorldSession::HandleLootMasterGiveOpcode(), WorldSession::HandleLootMethodOpcode(), WorldSession::HandleLootMoneyOpcode(), WorldSession::HandleLootRoll(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandleMinimapPingOpcode(), WorldSession::HandlePartyAssignmentOpcode(), WorldSession::HandlePetRename(), Battlefield::HandlePlayerLeaveZone(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), WorldSession::HandleRaidReadyCheckFinishedOpcode(), WorldSession::HandleRaidReadyCheckOpcode(), WorldSession::HandleRaidTargetUpdateOpcode(), WorldSession::HandleResetInstancesOpcode(), WorldSession::HandleSetDungeonDifficultyOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), misc_commandscript::HandleSkirmishCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), misc_commandscript::HandleSummonCommand(), tele_commandscript::HandleTeleGroupCommand(), HasQuestForGO(), HasQuestForItem(), isAllowedToLoot(), SmartAI::IsEscortInvokerInRange(), Unit::IsInPartyWith(), IsInSameGroupWith(), IsInSameRaidWith(), GameObject::IsLootAllowedFor(), Creature::isTappedBy(), Channel::JoinChannel(), lfg::LFGMgr::JoinLfg(), boss_apothecary_hummel::boss_apothecary_hummelAI::JustDied(), npc_coren_direbrew::JustDied(), boss_headless_horseman::JustDied(), boss_ahune::JustDied(), Unit::Kill(), KilledMonsterCredit(), KilledPlayerCredit(), Pet::LoadPetFromDB(), WorldSession::LogoutPlayer(), lfg::LFGMgr::MakeNewGroup(), lfg::LFGPlayerScript::OnBindToInstance(), go_ahune_ice_stone::OnGossipHello(), npc_icc_buff_switcher::OnGossipSelect(), go_ahune_ice_stone::OnGossipSelect(), lfg::LFGPlayerScript::OnLevelChanged(), lfg::LFGPlayerScript::OnLogin(), lfg::LFGPlayerScript::OnLogout(), lfg::LFGPlayerScript::OnMapChanged(), Acore::MostHPMissingGroupInRange::operator()(), InstanceMap::PermBindAllPlayers(), MapMgr::PlayerCannotEnter(), InstanceSaveMgr::PlayerGetDestinationInstanceId(), ProcessDelayedOperations(), RemoveFromGroup(), RemovePet(), RewardPlayerAndGroupAtEvent(), Group::SameSubGroup(), Satisfy(), SendInitialPacketsAfterAddToMap(), SendLoot(), SendNewItem(), lfg::LFGMgr::SendRaidBrowserJoinedPacket(), SendUpdateToOutOfRangeGroupMembers(), Group::SendUpdateToPlayer(), SetBattlegroundOrBattlefieldRaid(), Unit::SetHealth(), Creature::SetLootRecipient(), Unit::SetMaxHealth(), Unit::SetMaxPower(), Unit::SetPower(), Unit::setPowerType(), StoreLootItem(), lfg::LFGMgr::TeleportPlayer(), PetAI::UpdateAllies(), Unit::UpdateAuraForGroup(), UpdatePosition(), lfg::LFGMgr::UpdateRaidBrowser(), UpdateZone(), and GameObject::Use().

◆ GetGroup() [2/2]

const Group * Player::GetGroup ( ) const
inline
2432{ return (const Group*)m_group.getTarget(); }

References Reference< TO, FROM >::getTarget(), and m_group.

◆ GetGroupInvite()

◆ GetGroupRef()

GroupReference & Player::GetGroupRef ( )
inline
2433{ return m_group; }

References m_group.

◆ GetGroupUpdateFlag()

uint32 Player::GetGroupUpdateFlag ( ) const
inline

◆ GetGuild()

Guild * Player::GetGuild ( ) const
15924{
15925 uint32 guildId = GetGuildId();
15926 return guildId ? sGuildMgr->GetGuildById(guildId) : nullptr;
15927}

References GetGuildId(), and sGuildMgr.

Referenced by GiveLevel(), WorldSession::HandleGuildBankerActivate(), WorldSession::HandleGuildBankSwapItems(), WorldSession::HandleGuildRankOpcode(), Guild::HandleInviteMember(), and UpdateZone().

◆ GetGuildId()

◆ GetGuildIdInvited()

◆ GetGuildName()

std::string const & Player::GetGuildName ( )
15263{
15264 return sGuildMgr->GetGuildById(GetGuildId())->GetName();
15265}

References GetGuildId(), and sGuildMgr.

◆ GetHealthBonusFromStamina()

float Player::GetHealthBonusFromStamina ( )
277{
278 float stamina = GetStat(STAT_STAMINA);
279
280 float baseStam = stamina < 20 ? stamina : 20;
281 float moreStam = stamina - baseStam;
282
283 return baseStam + (moreStam * 10.0f);
284}

References Unit::GetStat(), and STAT_STAMINA.

Referenced by UpdateMaxHealth().

◆ GetHonorPoints()

◆ GetInGameTime()

uint32 Player::GetInGameTime ( )
inline
1528{ return m_ingametime; }

References m_ingametime.

◆ GetInitialVisiblePackets()

void Player::GetInitialVisiblePackets ( Unit target)
1661{
1662 GetAurasForTarget(target);
1663 if (target->IsAlive())
1664 {
1666 target->GetVictim())
1667 target->SendMeleeAttackStart(target->GetVictim(), this);
1668 }
1669}
@ UNIT_STATE_MELEE_ATTACKING
Definition: Unit.h:326
void GetAurasForTarget(Unit *target, bool force=false)
Definition: Player.cpp:11981
Unit * GetVictim() const
Definition: Unit.h:1398
void SendMeleeAttackStart(Unit *victim, Player *sendTo=nullptr)
Definition: Unit.cpp:3033

References GetAurasForTarget(), Unit::GetVictim(), Unit::HasUnitState(), Unit::IsAlive(), Unit::SendMeleeAttackStart(), and UNIT_STATE_MELEE_ATTACKING.

Referenced by Acore::VisibleNotifier::SendToSelf(), and UpdateVisibilityOf().

◆ GetInnTriggerId()

uint32 Player::GetInnTriggerId ( ) const
inline
1188{ return _innTriggerId; }

References _innTriggerId.

Referenced by Update().

◆ GetItemByEntry()

Item * Player::GetItemByEntry ( uint32  entry) const
3392{
3393 // in inventory
3395 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3396 if (pItem->GetEntry() == entry)
3397 return pItem;
3398
3400 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3401 if (pItem->GetEntry() == entry)
3402 return pItem;
3403
3404 for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
3405 if (Bag* pBag = GetBagByPos(i))
3406 for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
3407 if (Item* pItem = pBag->GetItemByPos(j))
3408 if (pItem->GetEntry() == entry)
3409 return pItem;
3410
3411 for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; ++i)
3412 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
3413 if (pItem->GetEntry() == entry)
3414 return pItem;
3415
3416 return nullptr;
3417}

References CURRENCYTOKEN_SLOT_END, EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, and KEYRING_SLOT_START.

Referenced by Spell::CheckItems(), Spell::EffectRechargeManaGem(), and Spell::EffectStuck().

◆ GetItemByGuid()

Item * Player::GetItemByGuid ( ObjectGuid  guid) const
436{
438 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
439 if (pItem->GetGUID() == guid)
440 return pItem;
441
443 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
444 if (pItem->GetGUID() == guid)
445 return pItem;
446
447 for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i)
448 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
449 if (pItem->GetGUID() == guid)
450 return pItem;
451
453 if (Bag* pBag = GetBagByPos(i))
454 for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
455 if (Item* pItem = pBag->GetItemByPos(j))
456 if (pItem->GetGUID() == guid)
457 return pItem;
458
460 if (Bag* pBag = GetBagByPos(i))
461 for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
462 if (Item* pItem = pBag->GetItemByPos(j))
463 if (pItem->GetGUID() == guid)
464 return pItem;
465
466 return nullptr;
467}

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_START, CURRENCYTOKEN_SLOT_END, EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, and KEYRING_SLOT_START.

Referenced by _SaveInventory(), Spell::CheckCast(), WorldSession::DoLootRelease(), TradeData::GetItem(), TradeData::GetSpellCastItem(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleAutoEquipItemSlotOpcode(), WorldSession::HandleAutostoreLootItemOpcode(), debug_commandscript::HandleDebugGetItemValueCommand(), debug_commandscript::HandleDebugItemExpireCommand(), debug_commandscript::HandleDebugSetItemValueCommand(), Unit::HandleDummyAuraProc(), WorldSession::HandleEquipmentSetUse(), WorldSession::HandleGossipSelectOptionOpcode(), WorldSession::HandleItemRefund(), WorldSession::HandleItemRefundInfoRequest(), WorldSession::HandleItemTextQuery(), WorldSession::HandleLootMoneyOpcode(), Unit::HandleOverrideClassScriptAuraProc(), WorldSession::HandlePetitionRenameOpcode(), Unit::HandleProcTriggerSpell(), WorldSession::HandleRepairItemOpcode(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSendMail(), WorldSession::HandleSocketOpcode(), WorldSession::HandleTurnInPetitionOpcode(), SendLoot(), SpellCastTargets::Update(), and Spell::UpdatePointers().

◆ GetItemByPos() [1/2]

Item * Player::GetItemByPos ( uint16  pos) const
470{
471 uint8 bag = pos >> 8;
472 uint8 slot = pos & 255;
473 return GetItemByPos(bag, slot);
474}

References GetItemByPos().

Referenced by _SaveCharacter(), _SaveInventory(), _StoreItem(), AutoUnequipOffhandIfNeed(), BuildEnchantmentsInfoData(), CanEquipItem(), CanStoreItem_InBag(), CanStoreItem_InInventorySlots(), CanStoreItem_InSpecificSlot(), CanStoreItems(), CanUnequipItem(), CanUnequipItems(), CastItemCombatSpell(), CorrectMetaGemEnchants(), Create(), DestroyConjuredItems(), DestroyItem(), DestroyItemCount(), DestroyZoneLimitedItem(), DurabilityLossAll(), DurabilityPointLossForEquipSlot(), DurabilityPointsLossAll(), DurabilityRepair(), Spell::EffectDurabilityDamage(), Spell::EffectDurabilityDamagePCT(), Spell::EffectEnchantHeldItem(), EnchantmentFitsRequirements(), EquipItem(), EquippedOk(), FindEquipSlot(), GetBagByPos(), GetFreeInventorySpace(), GetItemByEntry(), GetItemByGuid(), GetItemByPos(), GetItemCount(), GetItemCountWithLimitCategory(), GetShield(), GetUseableItemByPos(), GetWeaponForAttack(), misc_commandscript::HandleAddItemCommand(), spell_rog_deadly_poison::HandleAfterHit(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleAuraModShapeshift(), WorldSession::HandleAutoBankItemOpcode(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleAutoStoreBagItemOpcode(), WorldSession::HandleAutoStoreBankItemOpcode(), bg_commandscript::HandleBagsClearCommand(), WorldSession::HandleCancelTempEnchantmentOpcode(), character_commandscript::HandleCharacterCheckBagCommand(), debug_commandscript::HandleDebugGetItemStateCommand(), WorldSession::HandleDestroyItemOpcode(), WorldSession::HandleEquipmentSetSave(), WorldSession::HandleEquipmentSetUse(), inventory_commandscript::HandleInventoryCountCommand(), WorldSession::HandleMirrorImageDataRequest(), WorldSession::HandleOpenItemOpcode(), WorldSession::HandleOpenWrappedItemCallback(), WorldSession::HandleReadItem(), WorldSession::HandleSetTradeItemOpcode(), WorldSession::HandleWrapItemOpcode(), HasItemCount(), HasItemOrGemWithIdEquipped(), HasItemOrGemWithLimitCategoryEquipped(), HasItemTotemCategory(), IsTwoHandUsed(), MoveItemFromInventory(), RemoveArenaEnchantments(), RemoveItem(), SplitItem(), SwapItem(), and ToggleMetaGemsActive().

◆ GetItemByPos() [2/2]

Item * Player::GetItemByPos ( uint8  bag,
uint8  slot 
) const
477{
478 if (bag == INVENTORY_SLOT_BAG_0 && (slot < BANK_SLOT_BAG_END || (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END)))
479 return m_items[slot];
480 else if (Bag* pBag = GetBagByPos(bag))
481 return pBag->GetItemByPos(slot);
482 return nullptr;
483}

References BANK_SLOT_BAG_END, CURRENCYTOKEN_SLOT_END, GetBagByPos(), INVENTORY_SLOT_BAG_0, KEYRING_SLOT_START, and m_items.

◆ GetItemCount()

uint32 Player::GetItemCount ( uint32  item,
bool  inBankAlso = false,
Item skipItem = nullptr 
) const
356{
357 uint32 count = 0;
359 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
360 if (pItem != skipItem && pItem->GetEntry() == item)
361 count += pItem->GetCount();
362
364 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
365 if (pItem != skipItem && pItem->GetEntry() == item)
366 count += pItem->GetCount();
367
369 if (Bag* pBag = GetBagByPos(i))
370 count += pBag->GetItemCount(item, skipItem);
371
372 if (skipItem && skipItem->GetTemplate()->GemProperties)
374 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
375 if (pItem != skipItem && pItem->GetTemplate()->Socket[0].Color)
376 count += pItem->GetGemCountWithID(item);
377
378 if (inBankAlso)
379 {
380 // checking every item from 39 to 74 (including bank bags)
382 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
383 if (pItem != skipItem && pItem->GetEntry() == item)
384 count += pItem->GetCount();
385
387 if (Bag* pBag = GetBagByPos(i))
388 count += pBag->GetItemCount(item, skipItem);
389
390 if (skipItem && skipItem->GetTemplate()->GemProperties)
392 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
393 if (pItem != skipItem && pItem->GetTemplate()->Socket[0].Color)
394 count += pItem->GetGemCountWithID(item);
395 }
396
397 return count;
398}

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_END, BANK_SLOT_ITEM_START, _Socket::Color, CURRENCYTOKEN_SLOT_END, EQUIPMENT_SLOT_START, ItemTemplate::GemProperties, GetBagByPos(), Object::GetEntry(), GetItemByPos(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, KEYRING_SLOT_START, and ItemTemplate::Socket.

Referenced by AdjustQuestReqItemCount(), CanRewardQuest(), CanTakeMoreSimilarItems(), WorldSession::HandleSetAmmoOpcode(), HasQuestForItem(), npc_venomhide_hatchling::npc_venomhide_hatchlingAI::IsSummonedBy(), ItemRemovedQuestCheck(), npc_adventurous_dwarf::OnGossipHello(), SendNewItem(), and PlayerMenu::SendQuestGiverRequestItems().

◆ GetItemCountWithLimitCategory()

uint32 Player::GetItemCountWithLimitCategory ( uint32  limitCategory,
Item skipItem = nullptr 
) const
401{
402 uint32 count = 0;
403 for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
404 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
405 if (pItem != skipItem)
406 if (ItemTemplate const* pProto = pItem->GetTemplate())
407 if (pProto->ItemLimitCategory == limitCategory)
408 count += pItem->GetCount();
409
410 for (int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
411 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
412 if (pItem != skipItem)
413 if (ItemTemplate const* pProto = pItem->GetTemplate())
414 if (pProto->ItemLimitCategory == limitCategory)
415 count += pItem->GetCount();
416
418 if (Bag* pBag = GetBagByPos(i))
419 count += pBag->GetItemCountWithLimitCategory(limitCategory, skipItem);
420
421 for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; ++i)
422 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
423 if (pItem != skipItem)
424 if (ItemTemplate const* pProto = pItem->GetTemplate())
425 if (pProto->ItemLimitCategory == limitCategory)
426 count += pItem->GetCount();
427
428 for (int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
429 if (Bag* pBag = GetBagByPos(i))
430 count += pBag->GetItemCountWithLimitCategory(limitCategory, skipItem);
431
432 return count;
433}

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_START, CURRENCYTOKEN_SLOT_END, EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, and KEYRING_SLOT_START.

Referenced by CanTakeMoreSimilarItems().

◆ GetItemFromBuyBackSlot()

Item * Player::GetItemFromBuyBackSlot ( uint32  slot)
4010{
4011 LOG_DEBUG("entities.player.items", "STORAGE: GetItemFromBuyBackSlot slot = {}", slot);
4012 if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END)
4013 return m_items[slot];
4014 return nullptr;
4015}

References BUYBACK_SLOT_END, BUYBACK_SLOT_START, LOG_DEBUG, and m_items.

Referenced by WorldSession::HandleBuybackItem().

◆ GetItemUpdateQueue()

std::vector< Item * > & Player::GetItemUpdateQueue ( )
inline

◆ GetLastPetNumber()

uint32 Player::GetLastPetNumber ( ) const
inline
2420{ return m_lastpetnumber; }

References m_lastpetnumber.

Referenced by spell_gen_pet_summoned::HandleScript().

◆ GetLastPetSpell()

uint32 Player::GetLastPetSpell ( ) const
inline

◆ GetLastPotionId()

uint32 Player::GetLastPotionId ( )
inline
1775{ return m_lastPotionId; }

References m_lastPotionId.

Referenced by Spell::CheckCast(), and UpdatePotionCooldown().

◆ GetLastUsedRune()

RuneType Player::GetLastUsedRune ( )
inline
2475{ return m_runes->lastUsedRune; }
RuneType lastUsedRune
Definition: Player.h:430

References Runes::lastUsedRune, and m_runes.

◆ GetLevelPlayedTime()

uint32 Player::GetLevelPlayedTime ( )
inline

◆ GetLootGUID()

◆ GetMail()

Mail * Player::GetMail ( uint32  id)
3758{
3759 for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
3760 {
3761 if ((*itr)->messageID == id)
3762 {
3763 return (*itr);
3764 }
3765 }
3766 return nullptr;
3767}

References m_mail.

Referenced by WorldSession::HandleMailCreateTextItem(), WorldSession::HandleMailDelete(), WorldSession::HandleMailMarkAsRead(), WorldSession::HandleMailReturnToSender(), WorldSession::HandleMailTakeItem(), and WorldSession::HandleMailTakeMoney().

◆ GetMails()

PlayerMails const & Player::GetMails ( ) const
inline

◆ GetMailSize()

uint32 Player::GetMailSize ( )
inline
1621{ return m_mail.size();}

References m_mail.

Referenced by _SaveMail(), and WorldSession::HandleSendMail().

◆ GetManaBonusFromIntellect()

float Player::GetManaBonusFromIntellect ( )
287{
288 float intellect = GetStat(STAT_INTELLECT);
289
290 float baseInt = intellect < 20 ? intellect : 20;
291 float moreInt = intellect - baseInt;
292
293 return baseInt + (moreInt * 15.0f);
294}

References Unit::GetStat(), and STAT_INTELLECT.

Referenced by UpdateMaxPower().

◆ GetMapRef()

MapReference & Player::GetMapRef ( )
inline
2454{ return m_mapRef; }
MapReference m_mapRef
Definition: Player.h:2899

References m_mapRef.

Referenced by InstanceMap::CannotEnter(), BattlegroundMap::CannotEnter(), ResetMap(), and Map::UpdateIteratorBack().

◆ GetMaxKeyringSize()

uint32 Player::GetMaxKeyringSize ( ) const
inline

◆ GetMaxPersonalArenaRatingRequirement()

uint32 Player::GetMaxPersonalArenaRatingRequirement ( uint32  minarenaslot) const

If trans is specified, arena point save query will be added to trans.

10804{
10805 // returns the maximal personal arena rating that can be used to purchase items requiring this condition
10806 // the personal rating of the arena team must match the required limit as well
10807 // so return max[in arenateams](min(personalrating[teamtype], teamrating[teamtype]))
10808 uint32 max_personal_rating = 0;
10809 for (uint8 i = minarenaslot; i < MAX_ARENA_SLOT; ++i)
10810 {
10811 if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamId(i)))
10812 {
10813 uint32 p_rating = GetArenaPersonalRating(i);
10814 uint32 t_rating = at->GetRating();
10815 p_rating = p_rating < t_rating ? p_rating : t_rating;
10816 if (max_personal_rating < p_rating)
10817 max_personal_rating = p_rating;
10818 }
10819 }
10820
10821 sScriptMgr->OnGetMaxPersonalArenaRatingRequirement(this, minarenaslot, max_personal_rating);
10822
10823 return max_personal_rating;
10824}
uint32 GetArenaPersonalRating(uint8 slot) const
Definition: Player.cpp:16120
uint32 GetArenaTeamId(uint8 slot) const
Definition: Player.cpp:16129

References GetArenaPersonalRating(), GetArenaTeamId(), MAX_ARENA_SLOT, sArenaTeamMgr, and sScriptMgr.

Referenced by BuyItemFromVendorSlot().

◆ GetMaxSkillValue()

uint16 Player::GetMaxSkillValue ( uint32  skill) const
5385{
5386 if (!skill)
5387 return 0;
5388
5389 SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
5390 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
5391 return 0;
5392
5393 uint32 bonus = GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos));
5394
5395 int32 result = int32(SKILL_MAX(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
5396 sScriptMgr->OnGetMaxSkillValue(const_cast<Player*>(this), skill, result, false);
5397 result += SKILL_TEMP_BONUS(bonus);
5398 result += SKILL_PERM_BONUS(bonus);
5399 return result < 0 ? 0 : result;
5400}
#define SKILL_TEMP_BONUS(x)
Definition: Player.h:87

References Object::GetUInt32Value(), mSkillStatus, PLAYER_SKILL_BONUS_INDEX, PLAYER_SKILL_VALUE_INDEX, SKILL_DELETED, SKILL_MAX, SKILL_PERM_BONUS, SKILL_TEMP_BONUS, and sScriptMgr.

Referenced by Unit::GetDefenseSkillValue(), and UpdateFishingSkill().

◆ GetMaxSkillValueForLevel()

uint16 Player::GetMaxSkillValueForLevel ( ) const
16157{
16159
16160 sScriptMgr->OnGetMaxSkillValueForLevel(const_cast<Player*>(this), result);
16161
16162 return result;
16163}
uint16 GetMaxSkillValueForLevel(Unit const *target=nullptr) const
Definition: Unit.h:1561

References Unit::GetMaxSkillValueForLevel(), and sScriptMgr.

Referenced by _addSpell(), _LoadSkills(), GetMissPercentageFromDefence(), LearnDefaultSkill(), removeSpell(), UpdateBlockPercentage(), UpdateCritPercentage(), UpdateDodgePercentage(), UpdateParryPercentage(), and UpdateSkillsForLevel().

◆ getMaxTimer()

int32 Player::getMaxTimer ( MirrorTimerType  timer)
protected
809{
810 switch (timer)
811 {
812 case FATIGUE_TIMER:
813 return MINUTE * IN_MILLISECONDS;
814 case BREATH_TIMER:
815 {
818 int32 UnderWaterTime = sWorld->getIntConfig(CONFIG_WATER_BREATH_TIMER);
820 for (AuraEffectList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i)
821 AddPct(UnderWaterTime, (*i)->GetAmount());
822 return UnderWaterTime;
823 }
824 case FIRE_TIMER:
825 {
826 if (!IsAlive())
828 return 2020;
829 }
830 default:
831 return 0;
832 }
833}
AccountTypes
Definition: Common.h:58
T AddPct(T &base, U pct)
Definition: Util.h:67
@ FIRE_TIMER
Definition: Player.h:577
@ FATIGUE_TIMER
Definition: Player.h:575
@ BREATH_TIMER
Definition: Player.h:576
@ SPELL_AURA_MOD_WATER_BREATHING
Definition: SpellAuraDefines.h:218
@ SPELL_AURA_WATER_BREATHING
Definition: SpellAuraDefines.h:145
@ CONFIG_WATER_BREATH_TIMER
Definition: IWorld.h:418
@ CONFIG_DISABLE_BREATHING
Definition: IWorld.h:307

References AddPct(), BREATH_TIMER, CONFIG_DISABLE_BREATHING, CONFIG_WATER_BREATH_TIMER, DISABLED_MIRROR_TIMER, FATIGUE_TIMER, FIRE_TIMER, Unit::GetAuraEffectsByType(), GetSession(), Unit::HasAuraType(), IN_MILLISECONDS, Unit::IsAlive(), MINUTE, SPELL_AURA_MOD_WATER_BREATHING, SPELL_AURA_WATER_BREATHING, and sWorld.

Referenced by HandleDrowning(), and IsMirrorTimerActive().

◆ GetMeleeCritFromAgility()

float Player::GetMeleeCritFromAgility ( )
5011{
5012 uint8 level = GetLevel();
5013 uint32 pclass = getClass();
5014
5015 if (level > GT_MAX_LEVEL)
5016 level = GT_MAX_LEVEL;
5017
5018 GtChanceToMeleeCritBaseEntry const* critBase = sGtChanceToMeleeCritBaseStore.LookupEntry(pclass - 1);
5019 GtChanceToMeleeCritEntry const* critRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
5020 if (!critBase || !critRatio)
5021 return 0.0f;
5022
5023 float crit = critBase->base + GetStat(STAT_AGILITY) * critRatio->ratio;
5024 return crit * 100.0f;
5025}
DBCStorage< GtChanceToMeleeCritBaseEntry > sGtChanceToMeleeCritBaseStore(GtChanceToMeleeCritBasefmt)
Definition: DBCStructure.h:1043
float base
Definition: DBCStructure.h:1044

References GtChanceToMeleeCritBaseEntry::base, Unit::getClass(), Unit::GetLevel(), Unit::GetStat(), GT_MAX_LEVEL, GtChanceToMeleeCritEntry::ratio, sGtChanceToMeleeCritBaseStore, sGtChanceToMeleeCritStore, and STAT_AGILITY.

Referenced by UpdateAllCritPercentages().

◆ GetMeleeDamageSchoolMask()

SpellSchoolMask Player::GetMeleeDamageSchoolMask ( WeaponAttackType  attackType = BASE_ATTACK,
uint8  damageIndex = 0 
) const
overridevirtual

Implements Unit.

6896{
6897 if (Item const* weapon = GetWeaponForAttack(attackType, true))
6898 {
6899 return SpellSchoolMask(1 << weapon->GetTemplate()->Damage[damageIndex].DamageType);
6900 }
6901
6903}
SpellSchoolMask
Definition: SharedDefines.h:295

References GetWeaponForAttack(), and SPELL_SCHOOL_MASK_NORMAL.

◆ GetMissPercentageFromDefence()

float Player::GetMissPercentageFromDefence ( ) const
716{
717 float const miss_cap[MAX_CLASSES] =
718 {
719 16.00f, // Warrior //correct
720 16.00f, // Paladin //correct
721 16.00f, // Hunter //?
722 16.00f, // Rogue //?
723 16.00f, // Priest //?
724 16.00f, // DK //correct
725 16.00f, // Shaman //?
726 16.00f, // Mage //?
727 16.00f, // Warlock //?
728 0.0f, // ??
729 16.00f // Druid //?
730 };
731
732 float diminishing = 0.0f, nondiminishing = 0.0f;
733 // Modify value from defense skill (only bonus from defense rating diminishes)
734 nondiminishing += (GetSkillValue(SKILL_DEFENSE) - GetMaxSkillValueForLevel()) * 0.04f;
735 diminishing += (int32(GetRatingBonusValue(CR_DEFENSE_SKILL))) * 0.04f;
736
737 // apply diminishing formula to diminishing miss chance
738 uint32 pclass = getClass() - 1;
739 return nondiminishing + (diminishing * miss_cap[pclass] / (diminishing + miss_cap[pclass] * m_diminishing_k[pclass]));
740}
const float m_diminishing_k[MAX_CLASSES]
Definition: StatSystem.cpp:700
float GetRatingBonusValue(CombatRating cr) const
Definition: Player.cpp:5113

References CR_DEFENSE_SKILL, Unit::getClass(), GetMaxSkillValueForLevel(), GetRatingBonusValue(), GetSkillValue(), m_diminishing_k, MAX_CLASSES, and SKILL_DEFENSE.

◆ GetMItem()

Item * Player::GetMItem ( ObjectGuid::LowType  itemLowGuid)
inline
1640 {
1641 ItemMap::const_iterator itr = mMitems.find(itemLowGuid);
1642 return itr != mMitems.end() ? itr->second : nullptr;
1643 }

References mMitems.

Referenced by WorldSession::HandleGetMailList(), WorldSession::HandleMailReturnToSender(), and WorldSession::HandleMailTakeItem().

◆ GetMoney()

◆ GetMostPointsTalentTree()

uint8 Player::GetMostPointsTalentTree ( ) const
15222{
15223 uint32 specPoints[3] = {0, 0, 0};
15224 const PlayerTalentMap& talentMap = GetTalentMap();
15225 for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr)
15226 if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(GetActiveSpec()))
15227 if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(itr->second->talentID))
15228 if (TalentTabEntry const* tab = sTalentTabStore.LookupEntry(talentInfo->TalentTab))
15229 if (tab->tabpage < 3)
15230 {
15231 // find current talent rank
15232 uint8 currentTalentRank = 0;
15233 for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank)
15234 if (talentInfo->RankID[rank] && itr->first == talentInfo->RankID[rank])
15235 {
15236 currentTalentRank = rank + 1;
15237 break;
15238 }
15239 specPoints[tab->tabpage] += currentTalentRank;
15240 }
15241 uint8 maxIndex = 0;
15242 uint8 maxCount = specPoints[0];
15243 for (uint8 i = 1; i < 3; ++i)
15244 if (specPoints[i] > maxCount)
15245 {
15246 maxIndex = i;
15247 maxCount = specPoints[i];
15248 }
15249 return maxIndex;
15250}

References GetActiveSpec(), GetTalentMap(), MAX_TALENT_RANK, PLAYERSPELL_REMOVED, sTalentStore, and sTalentTabStore.

◆ GetMountBlockId()

uint32 Player::GetMountBlockId ( )
inline

◆ GetNextQuest()

Quest const * Player::GetNextQuest ( ObjectGuid  guid,
Quest const *  quest 
)
208{
209 QuestRelationBounds objectQR;
210
212 if (creature)
213 objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
214 else
215 {
216 //we should obtain map pointer from GetMap() in 99% of cases. Special case
217 //only for quests which cast teleport spells on player
219 ASSERT(_map);
220 GameObject* pGameObject = _map->GetGameObject(guid);
221 if (pGameObject)
222 objectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry());
223 else
224 return nullptr;
225 }
226
227 uint32 nextQuestID = quest->GetNextQuestInChain();
228 for (QuestRelations::const_iterator itr = objectQR.first; itr != objectQR.second; ++itr)
229 {
230 if (itr->second == nextQuestID)
231 return sObjectMgr->GetQuestTemplate(nextQuestID);
232 }
233
234 return nullptr;
235}
std::pair< QuestRelations::const_iterator, QuestRelations::const_iterator > QuestRelationBounds
Definition: ObjectMgr.h:519
Creature * GetCreatureOrPetOrVehicle(WorldObject const &, ObjectGuid const)
Definition: ObjectAccessor.cpp:237

References ASSERT, ObjectAccessor::GetCreatureOrPetOrVehicle(), Object::GetEntry(), Map::GetGameObject(), WorldObject::GetInstanceId(), WorldObject::GetMap(), WorldLocation::GetMapId(), Quest::GetNextQuestInChain(), Object::IsInWorld(), sMapMgr, and sObjectMgr.

Referenced by WorldSession::HandleQuestgiverChooseRewardOpcode().

◆ GetNextRandomRaidMember()

Player * Player::GetNextRandomRaidMember ( float  radius)
12901{
12902 Group* group = GetGroup();
12903 if (!group)
12904 return nullptr;
12905
12906 std::vector<Player*> nearMembers;
12907 nearMembers.reserve(group->GetMembersCount());
12908
12909 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
12910 {
12911 Player* Target = itr->GetSource();
12912
12913 // IsHostileTo check duel and controlled by enemy
12914 if (Target && Target != this && IsWithinDistInMap(Target, radius) &&
12915 !Target->HasInvisibilityAura() && !IsHostileTo(Target))
12916 nearMembers.push_back(Target);
12917 }
12918
12919 if (nearMembers.empty())
12920 return nullptr;
12921
12922 uint32 randTarget = urand(0, nearMembers.size() - 1);
12923 return nearMembers[randTarget];
12924}
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:10244

References Group::GetFirstMember(), GetGroup(), Group::GetMembersCount(), Unit::HasInvisibilityAura(), Unit::IsHostileTo(), WorldObject::IsWithinDistInMap(), GroupReference::next(), and urand().

◆ GetNextSave()

uint32 Player::GetNextSave ( ) const
inline
2574{ return m_nextSave; }

References m_nextSave.

◆ GetNPCIfCanInteractWith()

Creature * Player::GetNPCIfCanInteractWith ( ObjectGuid  guid,
uint32  npcflagmask 
)
2064{
2065 // unit checks
2066 if (!guid)
2067 return nullptr;
2068
2069 if (!IsInWorld())
2070 return nullptr;
2071
2072 if (IsInFlight())
2073 return nullptr;
2074
2075 // exist (we need look pets also for some interaction (quest/etc)
2076 Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
2077 if (!creature)
2078 return nullptr;
2079
2080 // Deathstate checks
2082 return nullptr;
2083
2084 // alive or spirit healer
2086 return nullptr;
2087
2088 // appropriate npc type
2089 if (npcflagmask && !creature->HasNpcFlag(NPCFlags(npcflagmask)))
2090 return nullptr;
2091
2092 // not allow interaction under control, but allow with own pets
2093 if (creature->GetCharmerGUID())
2094 return nullptr;
2095
2096 // xinef: perform better check
2097 if (creature->GetReactionTo(this) <= REP_UNFRIENDLY)
2098 return nullptr;
2099
2100 // xinef: not needed, CORRECTLY checked above including forced reputations etc
2101 // not unfriendly
2102 //if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(creature->GetFaction()))
2103 // if (factionTemplate->faction)
2104 // if (FactionEntry const* faction = sFactionStore.LookupEntry(factionTemplate->faction))
2105 // if (faction->reputationListID >= 0 && GetReputationMgr().GetRank(faction) <= REP_UNFRIENDLY)
2106 // return nullptr;
2107
2108 // not too far
2109 if (!creature->IsWithinDistInMap(this, INTERACTION_DISTANCE))
2110 return nullptr;
2111
2112 // pussywizard: many npcs have missing conditions for class training and rogue trainer can for eg. train dual wield to a shaman :/ too many to change in sql and watch in the future
2113 // pussywizard: this function is not used when talking, but when already taking action (buy spell, reset talents, show spell list)
2115 return nullptr;
2116
2117 return creature;
2118}
#define INTERACTION_DISTANCE
Definition: ObjectDefines.h:24
NPCFlags
Non Player Character flags.
Definition: Unit.h:514
@ UNIT_NPC_FLAG_TRAINER_CLASS
Definition: Unit.h:521
@ UNIT_NPC_FLAG_TRAINER
Definition: Unit.h:520
@ REP_UNFRIENDLY
Definition: SharedDefines.h:182
@ TRAINER_TYPE_CLASS
Definition: SharedDefines.h:2617
@ CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS
Definition: SharedDefines.h:2696
@ CREATURE_TYPE_FLAG_INTERACT_WHILE_DEAD
Definition: SharedDefines.h:2702
uint32 trainer_class
Definition: CreatureData.h:213
uint32 type_flags
Definition: CreatureData.h:216
uint32 trainer_type
Definition: CreatureData.h:211
ReputationRank GetReactionTo(Unit const *target, bool checkOriginalFaction=false) const
Definition: Unit.cpp:10072
bool HasNpcFlag(NPCFlags flags) const
Definition: Unit.h:1660
ObjectGuid GetCharmerGUID() const
Definition: Unit.h:1834

References CREATURE_TYPE_FLAG_INTERACT_WHILE_DEAD, CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS, Unit::GetCharmerGUID(), Unit::getClass(), ObjectAccessor::GetCreatureOrPetOrVehicle(), Creature::GetCreatureTemplate(), Unit::GetReactionTo(), Unit::HasNpcFlag(), INTERACTION_DISTANCE, Unit::IsAlive(), Unit::IsInFlight(), Object::IsInWorld(), WorldObject::IsWithinDistInMap(), REP_UNFRIENDLY, CreatureTemplate::trainer_class, CreatureTemplate::trainer_type, TRAINER_TYPE_CLASS, CreatureTemplate::type_flags, UNIT_NPC_FLAG_TRAINER, and UNIT_NPC_FLAG_TRAINER_CLASS.

Referenced by BuyItemFromVendorSlot(), CanInteractWithQuestGiver(), WorldSession::CanOpenMailBox(), WorldSession::CanUseBank(), AuctionListItemsDelayEvent::Execute(), WorldSession::HandleActivateTaxiExpressOpcode(), WorldSession::HandleActivateTaxiOpcode(), WorldSession::HandleAuctionHelloOpcode(), WorldSession::HandleAuctionListBidderItems(), WorldSession::HandleAuctionListOwnerItemsEvent(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleBankerActivateOpcode(), WorldSession::HandleBinderActivateOpcode(), WorldSession::HandleBuybackItem(), WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleGossipSelectOptionOpcode(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), WorldSession::HandleRepairItemOpcode(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSpiritHealerActivateOpcode(), WorldSession::HandleTabardVendorActivateOpcode(), WorldSession::HandleTalentWipeConfirmOpcode(), WorldSession::HandleTaxiQueryAvailableNodes(), WorldSession::HandleTrainerBuySpellOpcode(), WorldSession::SendListInventory(), WorldSession::SendPetitionShowList(), and WorldSession::SendTrainerList().

◆ GetOriginalGroup()

◆ GetOriginalGroupRef()

GroupReference & Player::GetOriginalGroupRef ( )
inline
2447{ return m_originalGroup; }

References m_originalGroup.

◆ GetOriginalSubGroup()

uint8 Player::GetOriginalSubGroup ( ) const
inline
2448{ return m_originalGroup.getSubGroup(); }
uint8 getSubGroup() const
Definition: GroupReference.h:38

References GroupReference::getSubGroup(), and m_originalGroup.

Referenced by RemoveFromBattlegroundOrBattlefieldRaid().

◆ GetOrInitPetStable()

PetStable & Player::GetOrInitPetStable ( )
15502{
15503 if (!m_petStable)
15504 m_petStable = std::make_unique<PetStable>();
15505
15506 return *m_petStable;
15507}

References m_petStable.

Referenced by WorldSession::HandleBuyStableSlot(), Unit::InitTamedPet(), and SummonPet().

◆ GetOutdoorPvP()

OutdoorPvP * Player::GetOutdoorPvP ( ) const
12427{
12428 return sOutdoorPvPMgr->GetOutdoorPvPToZoneId(GetZoneId());
12429}
#define sOutdoorPvPMgr
Definition: OutdoorPvPMgr.h:103

References WorldObject::GetZoneId(), and sOutdoorPvPMgr.

Referenced by WorldSession::HandleAreaTriggerOpcode(), and Unit::Kill().

◆ GetPassOnGroupLoot()

bool Player::GetPassOnGroupLoot ( ) const
inline
2452{ return m_bPassOnGroupLoot; }

References m_bPassOnGroupLoot.

Referenced by Group::GroupLoot(), and Group::NeedBeforeGreed().

◆ GetPendingBind()

uint32 Player::GetPendingBind ( ) const
inline
2403{ return _pendingBindId; }

References _pendingBindId.

Referenced by WorldSession::HandleInstanceLockResponse().

◆ GetPendingSpectatorInviteInstanceId()

uint32 Player::GetPendingSpectatorInviteInstanceId ( ) const
inline

◆ GetPet()

Pet * Player::GetPet ( ) const
8820{
8821 if (ObjectGuid pet_guid = GetPetGUID())
8822 {
8823 if (!pet_guid.IsPet())
8824 return nullptr;
8825
8826 Pet* pet = ObjectAccessor::GetPet(*this, pet_guid);
8827
8828 if (!pet)
8829 return nullptr;
8830
8831 if (IsInWorld())
8832 return pet;
8833
8834 //there may be a guardian in slot
8835 //LOG_ERROR("entities.player", "Player::GetPet: Pet {} not exist.", pet_guid.ToString());
8836 //const_cast<Player*>(this)->SetPetGUID(0);
8837 }
8838
8839 return nullptr;
8840}
Pet * GetPet(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:218

References ObjectAccessor::GetPet(), Unit::GetPetGUID(), and Object::IsInWorld().

Referenced by Spell::_cast(), KillRewarder::_RewardXP(), ActivateSpec(), Battleground::AddPlayer(), AuraEffect::ApplySpellMod(), WorldSession::BuildPartyMemberStatsChangedPacket(), BuildPetTalentsInfoData(), spell_hun_bestial_wrath::CheckCast(), Spell::CheckCast(), Unit::DealDamage(), spell_hun_masters_call::DoCheckCast(), InstanceScript::DoRemoveAurasDueToSpellOnPlayers(), Spell::EffectFeedPet(), Spell::EffectResurrectPet(), Spell::EffectSummonPet(), GiveLevel(), AuraEffect::HandleAuraModPetTalentsPoints(), spell_hun_masters_call::HandleDummy(), learn_commandscript::HandleLearnAllMyPetTalentsCommand(), AuraEffect::HandleModPossessPet(), WorldSession::HandleMoveTeleportAck(), pet_commandscript::HandlePetLearnCommand(), pet_commandscript::HandlePetUnlearnCommand(), Unit::HandleProcTriggerSpell(), WorldSession::HandleRequestPartyMemberStatsOpcode(), WorldSession::HandleRequestPetInfo(), ArenaSpectator::HandleResetCommand(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetTalentsCommand(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), WorldSession::HandleUnstablePet(), InitStatsForLevel(), Unit::Kill(), LearnPetTalent(), Pet::LoadPetFromDB(), go_orb_of_domination::OnGossipHello(), PetSpellInitialize(), PrepareGossipMenu(), RemoveArenaSpellCooldowns(), RemovePet(), ResetPetTalents(), SaveToDB(), SendUpdateToOutOfRangeGroupMembers(), SetGameMaster(), Unit::SetSpeed(), TeleportTo(), UnsummonPetTemporaryIfAny(), and Update().

◆ GetPetStable() [1/2]

◆ GetPetStable() [2/2]

PetStable const * Player::GetPetStable ( ) const
inline
1192{ return m_petStable.get(); }

References m_petStable.

◆ GetPhaseMaskForSpawn()

uint32 Player::GetPhaseMaskForSpawn ( ) const
13686{
13688
13689 if (!phase)
13691
13692 // some aura phases include 1 normal map in addition to phase itself
13693 uint32 n_phase = phase & ~PHASEMASK_NORMAL;
13694 if (n_phase > 0)
13695 return n_phase;
13696
13697 return phase;
13698}
@ PHASEMASK_NORMAL
Definition: Object.h:56
phase
Definition: boss_skadi.cpp:103
uint32 GetPhaseMask() const
Definition: Object.h:434
uint32 GetPhaseByAuras() const
Definition: Unit.cpp:19302

References Unit::GetPhaseByAuras(), WorldObject::GetPhaseMask(), IsGameMaster(), and PHASEMASK_NORMAL.

Referenced by gobject_commandscript::HandleGameObjectAddCommand(), npc_commandscript::HandleNpcAddCommand(), wp_commandscript::HandleWpModifyCommand(), and wp_commandscript::HandleWpShowCommand().

◆ GetPlayerFlags()

PlayerFlags Player::GetPlayerFlags ( ) const
inline
@ PLAYER_FLAGS
Definition: UpdateFields.h:178
PlayerFlags
Definition: Player.h:474

References Object::GetUInt32Value(), and PLAYER_FLAGS.

Referenced by _SaveCharacter().

◆ GetPlayerName()

std::string Player::GetPlayerName ( )
16215{
16216 std::string name = GetName();
16217 std::string color = "";
16218
16219 switch (getClass())
16220 {
16221 case CLASS_DEATH_KNIGHT: color = "|cffC41F3B"; break;
16222 case CLASS_DRUID: color = "|cffFF7D0A"; break;
16223 case CLASS_HUNTER: color = "|cffABD473"; break;
16224 case CLASS_MAGE: color = "|cff69CCF0"; break;
16225 case CLASS_PALADIN: color = "|cffF58CBA"; break;
16226 case CLASS_PRIEST: color = "|cffFFFFFF"; break;
16227 case CLASS_ROGUE: color = "|cffFFF569"; break;
16228 case CLASS_SHAMAN: color = "|cff0070DE"; break;
16229 case CLASS_WARLOCK: color = "|cff9482C9"; break;
16230 case CLASS_WARRIOR: color = "|cffC79C6E"; break;
16231 }
16232
16233 return "|Hplayer:" + name + "|h" + color + name + "|h|r";
16234}
@ CLASS_PRIEST
Definition: SharedDefines.h:145

References CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_HUNTER, CLASS_MAGE, CLASS_PALADIN, CLASS_PRIEST, CLASS_ROGUE, CLASS_SHAMAN, CLASS_WARLOCK, CLASS_WARRIOR, Unit::getClass(), and WorldObject::GetName().

Referenced by gear_commandscript::HandleGearStatsCommand().

◆ GetPlayerSetting()

PlayerSetting Player::GetPlayerSetting ( std::string  source,
uint8  index 
)
71{
72 auto itr = m_charSettingsMap.find(source);
73
74 if (itr == m_charSettingsMap.end())
75 {
76 // Settings not found, this will initialize a new entry.
77 UpdatePlayerSetting(source, index, 0);
78 return GetPlayerSetting(source, index);
79 }
80
81 PlayerSettingVector settingVector = itr->second;
82 if (settingVector.size() < (uint8)(index + 1))
83 {
84 UpdatePlayerSetting(source, index, 0);
85 return GetPlayerSetting(source, index);
86 }
87
88 return itr->second[index];
89}
void UpdatePlayerSetting(std::string source, uint8 index, uint32 value)
Definition: PlayerSettings.cpp:115
PlayerSetting GetPlayerSetting(std::string source, uint8 index)
Definition: PlayerSettings.cpp:70

References GetPlayerSetting(), m_charSettingsMap, and UpdatePlayerSetting().

Referenced by GetPlayerSetting(), and player_settings_commandscript::HandleSettingsAnnouncerFlags().

◆ GetPureMaxSkillValue()

uint16 Player::GetPureMaxSkillValue ( uint32  skill) const
5403{
5404 if (!skill)
5405 return 0;
5406
5407 SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
5408 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
5409 return 0;
5410
5411 int32 result = int32(SKILL_MAX(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
5412
5413 sScriptMgr->OnGetMaxSkillValue(const_cast<Player*>(this), skill, result, true);
5414
5415 return result < 0 ? 0 : result;
5416}

References Object::GetUInt32Value(), mSkillStatus, PLAYER_SKILL_VALUE_INDEX, SKILL_DELETED, SKILL_MAX, and sScriptMgr.

Referenced by _addSpell(), learn_commandscript::HandleLearnAllRecipesCommand(), lookup_commandscript::HandleLookupSkillCommand(), misc_commandscript::HandleSetSkillCommand(), and removeSpell().

◆ GetPureSkillValue()

uint16 Player::GetPureSkillValue ( uint32  skill) const

◆ GetQuestDialogStatus()

QuestGiverStatus Player::GetQuestDialogStatus ( Object questGiver)
1582{
1585
1586 sScriptMgr->GetDialogStatus(this, questgiver);
1587
1588 switch (questgiver->GetTypeId())
1589 {
1590 case TYPEID_GAMEOBJECT:
1591 {
1592 QuestGiverStatus questStatus = QuestGiverStatus(sScriptMgr->GetDialogStatus(this, questgiver->ToGameObject()));
1593 if (questStatus != DIALOG_STATUS_SCRIPTED_NO_STATUS)
1594 return questStatus;
1595 qr = sObjectMgr->GetGOQuestRelationBounds(questgiver->GetEntry());
1596 qir = sObjectMgr->GetGOQuestInvolvedRelationBounds(questgiver->GetEntry());
1597 break;
1598 }
1599 case TYPEID_UNIT:
1600 {
1601 QuestGiverStatus questStatus = QuestGiverStatus(sScriptMgr->GetDialogStatus(this, questgiver->ToCreature()));
1602 if (questStatus != DIALOG_STATUS_SCRIPTED_NO_STATUS)
1603 return questStatus;
1604 qr = sObjectMgr->GetCreatureQuestRelationBounds(questgiver->GetEntry());
1605 qir = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(questgiver->GetEntry());
1606 break;
1607 }
1608 default:
1609 // it's impossible, but check
1610 //LOG_ERROR("entities.player.quest", "GetQuestDialogStatus called for unexpected type {}", questgiver->GetTypeId());
1611 return DIALOG_STATUS_NONE;
1612 }
1613
1615
1616 for (QuestRelations::const_iterator i = qir.first; i != qir.second; ++i)
1617 {
1619 uint32 questId = i->second;
1620 Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
1621 if (!quest)
1622 continue;
1623
1624 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_AVAILABLE, quest->GetQuestId());
1625 if (!sConditionMgr->IsObjectMeetToConditions(this, conditions))
1626 continue;
1627
1628 QuestStatus status = GetQuestStatus(questId);
1629 if (status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus(questId))
1630 {
1631 result2 = DIALOG_STATUS_REWARD;
1632 }
1633 else if (status == QUEST_STATUS_INCOMPLETE)
1634 {
1635 result2 = DIALOG_STATUS_INCOMPLETE;
1636 }
1637
1638 if (quest->IsAutoComplete() && CanTakeQuest(quest, false) && quest->IsRepeatable() && !quest->IsDailyOrWeekly())
1639 {
1640 result2 = DIALOG_STATUS_REWARD_REP;
1641 }
1642
1643 if (result2 > result)
1644 {
1645 result = result2;
1646 }
1647 }
1648
1649 for (QuestRelations::const_iterator i = qr.first; i != qr.second; ++i)
1650 {
1652 uint32 questId = i->second;
1653 Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
1654 if (!quest)
1655 continue;
1656
1657 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_AVAILABLE, quest->GetQuestId());
1658 if (!sConditionMgr->IsObjectMeetToConditions(this, conditions))
1659 continue;
1660
1661 QuestStatus status = GetQuestStatus(questId);
1662 if (status == QUEST_STATUS_NONE)
1663 {
1664 if (CanSeeStartQuest(quest))
1665 {
1666 if (SatisfyQuestLevel(quest, false))
1667 {
1668 bool isNotLowLevelQuest = GetLevel() <= (GetQuestLevel(quest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF));
1669
1670 if (quest->IsRepeatable())
1671 {
1672 if (quest->IsDaily())
1673 {
1674 if (isNotLowLevelQuest)
1675 {
1677 }
1678 else
1679 {
1681 }
1682 }
1683 else if (quest->IsWeekly() || quest->IsMonthly())
1684 {
1685 if (isNotLowLevelQuest)
1686 {
1687 result2 = DIALOG_STATUS_AVAILABLE;
1688 }
1689 else
1690 {
1692 }
1693 }
1694 else if (quest->IsAutoComplete())
1695 {
1696 if (isNotLowLevelQuest)
1697 {
1698 result2 = DIALOG_STATUS_REWARD_REP;
1699 }
1700 else
1701 {
1703 }
1704 }
1705 else
1706 {
1707 if (isNotLowLevelQuest)
1708 {
1709 result2 = DIALOG_STATUS_REWARD_REP;
1710 }
1711 else
1712 {
1714 }
1715 }
1716 }
1717 else
1718 {
1719 result2 = isNotLowLevelQuest ? DIALOG_STATUS_AVAILABLE : DIALOG_STATUS_LOW_LEVEL_AVAILABLE;
1720 }
1721 }
1722 else
1723 {
1724 result2 = DIALOG_STATUS_UNAVAILABLE;
1725 }
1726 }
1727 }
1728
1729 if (result2 > result)
1730 result = result2;
1731 }
1732
1733 return result;
1734}
@ CONDITION_SOURCE_TYPE_QUEST_AVAILABLE
Definition: ConditionMgr.h:141
QuestGiverStatus
Definition: QuestDef.h:111
@ DIALOG_STATUS_UNAVAILABLE
Definition: QuestDef.h:113
@ DIALOG_STATUS_NONE
Definition: QuestDef.h:112
@ DIALOG_STATUS_AVAILABLE
Definition: QuestDef.h:120
@ DIALOG_STATUS_SCRIPTED_NO_STATUS
Definition: QuestDef.h:125
@ DIALOG_STATUS_LOW_LEVEL_REWARD_REP
Definition: QuestDef.h:115
@ DIALOG_STATUS_REWARD
Definition: QuestDef.h:122
@ DIALOG_STATUS_LOW_LEVEL_AVAILABLE
Definition: QuestDef.h:114
@ DIALOG_STATUS_REWARD_REP
Definition: QuestDef.h:118
@ DIALOG_STATUS_INCOMPLETE
Definition: QuestDef.h:117
@ DIALOG_STATUS_LOW_LEVEL_AVAILABLE_REP
Definition: QuestDef.h:116
@ DIALOG_STATUS_AVAILABLE_REP
Definition: QuestDef.h:119
@ CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF
Definition: IWorld.h:287
int32 GetQuestLevel(Quest const *quest) const
Definition: Player.h:1403
bool CanSeeStartQuest(Quest const *quest)
Definition: PlayerQuest.cpp:237
uint32 GetQuestId() const
Definition: QuestDef.h:225
bool IsDaily() const
Definition: QuestDef.h:284
bool IsWeekly() const
Definition: QuestDef.h:285
bool IsDailyOrWeekly() const
Definition: QuestDef.h:288
bool IsMonthly() const
Definition: QuestDef.h:286

References CanSeeStartQuest(), CanTakeQuest(), CONDITION_SOURCE_TYPE_QUEST_AVAILABLE, CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF, DIALOG_STATUS_AVAILABLE, DIALOG_STATUS_AVAILABLE_REP, DIALOG_STATUS_INCOMPLETE, DIALOG_STATUS_LOW_LEVEL_AVAILABLE, DIALOG_STATUS_LOW_LEVEL_AVAILABLE_REP, DIALOG_STATUS_LOW_LEVEL_REWARD_REP, DIALOG_STATUS_NONE, DIALOG_STATUS_REWARD, DIALOG_STATUS_REWARD_REP, DIALOG_STATUS_SCRIPTED_NO_STATUS, DIALOG_STATUS_UNAVAILABLE, Object::GetEntry(), Unit::GetLevel(), Quest::GetQuestId(), GetQuestLevel(), GetQuestRewardStatus(), GetQuestStatus(), Object::GetTypeId(), Quest::IsAutoComplete(), Quest::IsDaily(), Quest::IsDailyOrWeekly(), Quest::IsMonthly(), Quest::IsRepeatable(), Quest::IsWeekly(), QUEST_STATUS_COMPLETE, QUEST_STATUS_INCOMPLETE, QUEST_STATUS_NONE, SatisfyQuestLevel(), sConditionMgr, sObjectMgr, sScriptMgr, sWorld, Object::ToCreature(), Object::ToGameObject(), TYPEID_GAMEOBJECT, and TYPEID_UNIT.

Referenced by GameObject::ActivateToQuest(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverStatusQueryOpcode(), and SendQuestGiverStatusMultiple().

◆ GetQuestLevel()

int32 Player::GetQuestLevel ( Quest const *  quest) const
inline

◆ GetQuestRate()

float Player::GetQuestRate ( bool  isDFQuest = false)
16166{
16167 float result = isDFQuest ? sWorld->getRate(RATE_XP_QUEST_DF) : sWorld->getRate(RATE_XP_QUEST);
16168
16169 sScriptMgr->OnGetQuestRate(this, result);
16170
16171 return result;
16172}
@ RATE_XP_QUEST_DF
Definition: IWorld.h:472
@ RATE_XP_QUEST
Definition: IWorld.h:471

References RATE_XP_QUEST, RATE_XP_QUEST_DF, sScriptMgr, and sWorld.

Referenced by RewardQuest(), PlayerMenu::SendQuestGiverOfferReward(), and PlayerMenu::SendQuestGiverQuestDetails().

◆ GetQuestRewardStatus()

◆ GetQuestSlotCounter()

uint16 Player::GetQuestSlotCounter ( uint16  slot,
uint8  counter 
) const
inline
1463{ return (uint16)(GetUInt64Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET) >> (counter * 16)); }
@ PLAYER_QUEST_LOG_1_1
Definition: UpdateFields.h:186
@ QUEST_COUNTS_OFFSET
Definition: Player.h:625
#define MAX_QUEST_OFFSET
Definition: Player.h:629

References Object::GetUInt64Value(), MAX_QUEST_OFFSET, PLAYER_QUEST_LOG_1_1, and QUEST_COUNTS_OFFSET.

Referenced by SendQuestUpdateAddCreatureOrGo(), and SendQuestUpdateAddPlayer().

◆ GetQuestSlotQuestId()

◆ GetQuestSlotState()

uint32 Player::GetQuestSlotState ( uint16  slot) const
inline

◆ GetQuestSlotTime()

uint32 Player::GetQuestSlotTime ( uint16  slot) const
inline

◆ GetQuestStatus()

QuestStatus Player::GetQuestStatus ( uint32  quest_id) const
1417{
1418 if (quest_id)
1419 {
1420 QuestStatusMap::const_iterator itr = m_QuestStatus.find(quest_id);
1421
1422 if (itr != m_QuestStatus.end())
1423 {
1424 return itr->second.Status;
1425 }
1426
1427 if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id))
1428 {
1429 if (qInfo->IsSeasonal())
1430 {
1432 }
1433
1434 if (!qInfo->IsRepeatable() && IsQuestRewarded(quest_id))
1435 {
1436 return QUEST_STATUS_REWARDED;
1437 }
1438 }
1439 }
1440
1441 return QUEST_STATUS_NONE;
1442}
@ QUEST_STATUS_REWARDED
Definition: QuestDef.h:106

References IsQuestRewarded(), m_QuestStatus, QUEST_STATUS_NONE, QUEST_STATUS_REWARDED, SatisfyQuestSeasonal(), and sObjectMgr.

Referenced by GameObject::ActivateToQuest(), LootItem::AllowedForPlayer(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::AttackStart(), npc_greatfather_aldrimus::npc_greatfather_aldrimusAI::CanBeSeen(), CanRewardQuest(), npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI::CheckEventFail(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::CheckEventFail(), spell_item_demon_broiled_surprise::CheckRequirement(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::CreditPlayer(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), DuelComplete(), Spell::EffectQuestClear(), Spell::EffectScriptEffect(), SmartAI::EndPath(), FailQuest(), npc_wg_quest_giver::GetDialogStatus(), GetQuestDialogStatus(), go_gilded_brazier::go_gilded_brazierAI::GossipHello(), go_tadpole_cage::go_tadpole_cageAI::GossipHello(), WorldSession::HandleAreaTriggerOpcode(), spell_midsummer_torch_catch::HandleDummy(), spell_q12014_steady_as_a_rock::HandleFinish(), spell_sindragosa_frost_breath::spell_sindragosa_frost_breath_SpellScript::HandleInfusion(), lookup_commandscript::HandleLookupQuestCommand(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverCompleteQuest(), WorldSession::HandleQuestgiverRequestRewardOpcode(), spell_q11322_q11317_the_cleansing::if(), SpellArea::IsFitToRequirements(), npc_kservant::npc_kservantAI::IsSummonedBy(), npc_clintar_spirit::npc_clintar_spiritAI::JustDied(), npc_nerubar_victim::npc_nerubar_victimAI::JustDied(), boss_alar::boss_alarAI::JustDied(), boss_devourer_of_souls::boss_devourer_of_soulsAI::JustEngagedWith(), npc_a_special_surprise::npc_a_special_surpriseAI::MeetQuestCondition(), npc_the_scourge_cauldron::npc_the_scourge_cauldronAI::MoveInLineOfSight(), npc_brewfest_bark_trigger::MoveInLineOfSight(), npc_tooga::npc_toogaAI::MoveInLineOfSight(), npc_twiggy_flathead::npc_twiggy_flatheadAI::MoveInLineOfSight(), npc_black_knight_graveyard::npc_black_knight_graveyardAI::MoveInLineOfSight(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::MoveInLineOfSight(), npc_creditmarker_visit_with_ancestors::npc_creditmarker_visit_with_ancestorsAI::MoveInLineOfSight(), npc_death_knight_initiate::OnGossipHello(), npc_highlord_darion_mograine::OnGossipHello(), npc_parqual_fintallas::OnGossipHello(), npc_varian_wrynn::OnGossipHello(), npc_thrall_bfu::OnGossipHello(), npc_rizzle_sprysprocket::OnGossipHello(), npc_bunthen_plainswind::OnGossipHello(), npc_great_bear_spirit::OnGossipHello(), npc_silva_filnaveth::OnGossipHello(), npc_thrall_warchief::OnGossipHello(), npc_braug_dimspirit::OnGossipHello(), npc_steward_of_time::OnGossipHello(), npc_stone_watcher_of_norgannon::OnGossipHello(), npc_plucky::OnGossipHello(), npc_hor_leader::OnGossipHello(), npc_iruk::OnGossipHello(), npc_shandy_dalaran::OnGossipHello(), npc_razael_and_lyana::OnGossipHello(), npc_mcmanus::OnGossipHello(), npc_vekjik::OnGossipHello(), npc_avatar_of_freya::OnGossipHello(), npc_adventurous_dwarf::OnGossipHello(), npc_wg_quest_giver::OnGossipHello(), npc_finklestein::OnGossipHello(), npc_captain_saeed::OnGossipHello(), npcs_flanis_swiftwing_and_kagrosh::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_artorius::OnGossipHello(), npc_simone::OnGossipHello(), npc_nelson::OnGossipHello(), npc_franklin::OnGossipHello(), npc_taxi::OnGossipHello(), go_inconspicuous_mine_car::OnGossipHello(), go_seer_of_zebhalak::OnGossipHello(), go_jump_a_tron::OnGossipHello(), go_tele_to_violet_stand::OnGossipHello(), go_ravager_cage::OnGossipHello(), go_bristlelimb_cage::OnGossipHello(), go_scourge_enclosure::OnGossipHello(), go_warmaul_prison::OnGossipHello(), go_skull_pile::OnGossipHello(), go_tablet_of_the_seven::OnGossipHello(), go_arcane_prison::OnGossipHello(), go_table_theka::OnGossipHello(), go_dragonflayer_cage::OnGossipHello(), go_amberpine_outhouse::OnGossipHello(), go_veil_skith_cage::OnGossipHello(), npc_great_bear_spirit::OnGossipSelect(), at_ancient_leaf::OnTrigger(), AreaTrigger_at_celestial_planetarium_enterance::OnTrigger(), AreaTrigger_at_stormwright_shelf::OnTrigger(), AreaTrigger_at_scent_larkorwi::OnTrigger(), AreaTrigger_at_nats_landing::OnTrigger(), AreaTrigger_at_sentry_point::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), AreaTrigger_at_last_rites::OnTrigger(), AreaTrigger_at_sholazar_waygate::OnTrigger(), at_malfurion_stormrage::OnTrigger(), at_commander_dawnforge::OnTrigger(), item_captured_frog::OnUse(), npc_doctor::npc_doctorAI::PatientDied(), npc_doctor::npc_doctorAI::PatientSaved(), PrepareQuestMenu(), NPCStaveQuestAI::QuestIncomplete(), npc_shenthul::npc_shenthulAI::ReceiveEmote(), npc_chicken_cluck::npc_chicken_cluckAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), SatisfyQuestExclusiveGroup(), SatisfyQuestNextChain(), SatisfyQuestPreviousQuest(), SatisfyQuestStatus(), instance_the_black_morass::instance_the_black_morass_InstanceMapScript::SetBossState(), npc_costumed_orphan_matron::sGossipHello(), npc_sinkhole_kill_credit::npc_sinkhole_kill_creditAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), npc_drakuru_shackles::npc_drakuru_shacklesAI::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), npc_greengill_slave::npc_greengill_slaveAI::SpellHit(), Battleground::SpiritofCompetitionEvent(), npc_clintar_spirit::npc_clintar_spiritAI::StartEvent(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), and GameObject::Use().

◆ getQuestStatusMap()

◆ GetQuestStatusSaveMap()

QuestStatusSaveMap & Player::GetQuestStatusSaveMap ( )
inline
1599{ return m_QuestStatusSave; }

References m_QuestStatusSave.

◆ GetRaidDifficulty()

◆ GetRandomWinner()

bool Player::GetRandomWinner ( )
inline

◆ GetRank()

uint8 Player::GetRank ( ) const
inline

◆ GetRatingBonusValue()

◆ GetRatingMultiplier()

float Player::GetRatingMultiplier ( CombatRating  cr) const
5098{
5099 uint8 level = GetLevel();
5100
5101 if (level > GT_MAX_LEVEL)
5102 level = GT_MAX_LEVEL;
5103
5104 GtCombatRatingsEntry const* Rating = sGtCombatRatingsStore.LookupEntry(cr * GT_MAX_LEVEL + level - 1);
5105 // gtOCTClassCombatRatingScalarStore.dbc starts with 1, CombatRating with zero, so cr+1
5106 GtOCTClassCombatRatingScalarEntry const* classRating = sGtOCTClassCombatRatingScalarStore.LookupEntry((getClass() - 1) * GT_MAX_RATING + cr + 1);
5107 if (!Rating || !classRating)
5108 return 1.0f; // By default use minimum coefficient (not must be called)
5109
5110 return classRating->ratio / Rating->ratio;
5111}
DBCStorage< GtCombatRatingsEntry > sGtCombatRatingsStore(GtCombatRatingsfmt)
DBCStorage< GtOCTClassCombatRatingScalarEntry > sGtOCTClassCombatRatingScalarStore(GtOCTClassCombatRatingScalarfmt)
#define GT_MAX_RATING
Definition: DBCStructure.h:1030
Definition: DBCStructure.h:1038
float ratio
Definition: DBCStructure.h:1039
Definition: DBCStructure.h:1068
float ratio
Definition: DBCStructure.h:1069

References Unit::getClass(), Unit::GetLevel(), GT_MAX_LEVEL, GT_MAX_RATING, GtCombatRatingsEntry::ratio, GtOCTClassCombatRatingScalarEntry::ratio, sGtCombatRatingsStore, and sGtOCTClassCombatRatingScalarStore.

Referenced by ApplyRatingMod(), and GetRatingBonusValue().

◆ GetRealDodge()

float Player::GetRealDodge ( ) const
inline
2571{ return m_realDodge; }

References m_realDodge.

Referenced by Unit::GetUnitDodgeChance().

◆ GetRealParry()

float Player::GetRealParry ( ) const
inline
2570{ return m_realParry; }

References m_realParry.

◆ GetReputation()

uint32 Player::GetReputation ( uint32  factionentry) const
15258{
15259 return GetReputationMgr().GetReputation(sFactionStore.LookupEntry(factionentry));
15260}
int32 GetReputation(uint32 faction_id) const
Definition: ReputationMgr.cpp:78

References ReputationMgr::GetReputation(), GetReputationMgr(), and sFactionStore.

Referenced by CanCompleteQuest(), ReputationChanged(), ReputationChanged2(), and SatisfyQuestReputation().

◆ GetReputationMgr() [1/2]

◆ GetReputationMgr() [2/2]

ReputationMgr const & Player::GetReputationMgr ( ) const
inline
2090{ return *m_reputationMgr; }

References m_reputationMgr.

◆ GetReputationPriceDiscount() [1/2]

◆ GetReputationPriceDiscount() [2/2]

float Player::GetReputationPriceDiscount ( FactionTemplateEntry const *  factionTemplate) const
12263{
12264 if (!factionTemplate || !factionTemplate->faction)
12265 {
12266 return 1.0f;
12267 }
12268
12269 ReputationRank rank = GetReputationRank(factionTemplate->faction);
12270 if (rank <= REP_NEUTRAL)
12271 {
12272 return 1.0f;
12273 }
12274
12275 return 1.0f - 0.05f * (rank - REP_NEUTRAL);
12276}
ReputationRank
Definition: SharedDefines.h:179
@ REP_NEUTRAL
Definition: SharedDefines.h:183

References FactionTemplateEntry::faction, GetReputationRank(), and REP_NEUTRAL.

◆ GetReputationRank()

◆ GetReqKillOrCastCurrentCount()

uint16 Player::GetReqKillOrCastCurrentCount ( uint32  quest_id,
int32  entry 
)
1738{
1739 Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id);
1740 if (!qInfo)
1741 return 0;
1742
1743 for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
1744 if (qInfo->RequiredNpcOrGo[j] == entry)
1745 return m_QuestStatus[quest_id].CreatureOrGOCount[j];
1746
1747 return 0;
1748}

References m_QuestStatus, QUEST_OBJECTIVES_COUNT, Quest::RequiredNpcOrGo, and sObjectMgr.

Referenced by npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), npc_creditmarker_visit_with_ancestors::npc_creditmarker_visit_with_ancestorsAI::MoveInLineOfSight(), and npc_razael_and_lyana::OnGossipHello().

◆ GetRestBonus()

float Player::GetRestBonus ( ) const
inline
1182{ return _restBonus; }

References _restBonus.

Referenced by GetXPRestBonus(), LoadFromDB(), and Update().

◆ GetResurrectionSpellId()

uint32 Player::GetResurrectionSpellId ( )
12526{
12527 // search priceless resurrection possibilities
12528 uint32 prio = 0;
12529 uint32 spell_id = 0;
12531 for (AuraEffectList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr)
12532 {
12533 // Soulstone Resurrection // prio: 3 (max, non death persistent)
12534 if (prio < 2 && (*itr)->GetSpellInfo()->SpellVisual[0] == 99 && (*itr)->GetSpellInfo()->SpellIconID == 92)
12535 {
12536 switch ((*itr)->GetId())
12537 {
12538 case 20707:
12539 spell_id = 3026;
12540 break; // rank 1
12541 case 20762:
12542 spell_id = 20758;
12543 break; // rank 2
12544 case 20763:
12545 spell_id = 20759;
12546 break; // rank 3
12547 case 20764:
12548 spell_id = 20760;
12549 break; // rank 4
12550 case 20765:
12551 spell_id = 20761;
12552 break; // rank 5
12553 case 27239:
12554 spell_id = 27240;
12555 break; // rank 6
12556 case 47883:
12557 spell_id = 47882;
12558 break; // rank 7
12559 default:
12560 LOG_ERROR("entities.player", "Unhandled spell {}: S.Resurrection", (*itr)->GetId());
12561 continue;
12562 }
12563
12564 prio = 3;
12565 }
12566 // Twisting Nether // prio: 2 (max)
12567 else if ((*itr)->GetId() == 23701 && roll_chance_i(10))
12568 {
12569 prio = 2;
12570 spell_id = 23700;
12571 }
12572 }
12573
12574 // Reincarnation (passive spell) // prio: 1 // Glyph of Renewed Life
12575 if (prio < 1 && HasSpell(20608) && !HasSpellCooldown(21169) && (HasAura(58059) || HasItemCount(17030)))
12576 spell_id = 21169;
12577
12578 return spell_id;
12579}
bool roll_chance_i(int chance)
Definition: Random.h:59
@ SPELL_AURA_DUMMY
Definition: SpellAuraDefines.h:67

References Unit::GetAuraEffectsByType(), Unit::HasAura(), HasItemCount(), HasSpell(), HasSpellCooldown(), LOG_ERROR, roll_chance_i(), and SPELL_AURA_DUMMY.

Referenced by Unit::Kill(), and setDeathState().

◆ GetRewardedQuestCount()

size_t Player::GetRewardedQuestCount ( ) const
inline
1601{ return m_RewardedQuests.size(); }

References m_RewardedQuests.

Referenced by WorldSession::HandleQueryQuestsCompleted().

◆ getRewardedQuests()

RewardedQuestSet const & Player::getRewardedQuests ( ) const
inline

◆ GetRuneBaseCooldown()

uint32 Player::GetRuneBaseCooldown ( uint8  index,
bool  skipGrace 
)
13286{
13287 uint8 rune = GetBaseRune(index);
13288 uint32 cooldown = RUNE_BASE_COOLDOWN;
13289 if (!skipGrace)
13290 cooldown -= GetGracePeriod(index) < 250 ? 0 : GetGracePeriod(index) - 250; // xinef: reduce by grace period, treat first 250ms as instant use of rune
13291
13293 for (AuraEffectList::const_iterator i = regenAura.begin(); i != regenAura.end(); ++i)
13294 {
13295 if ((*i)->GetMiscValue() == POWER_RUNE && (*i)->GetMiscValueB() == rune)
13296 cooldown = cooldown * (100 - (*i)->GetAmount()) / 100;
13297 }
13298
13299 return cooldown;
13300}
@ RUNE_BASE_COOLDOWN
Definition: Player.h:403
@ SPELL_AURA_MOD_POWER_REGEN_PERCENT
Definition: SpellAuraDefines.h:173
uint32 GetGracePeriod(uint8 index) const
Definition: Player.h:2472
RuneType GetBaseRune(uint8 index) const
Definition: Player.h:2469

References Unit::GetAuraEffectsByType(), GetBaseRune(), GetGracePeriod(), POWER_RUNE, RUNE_BASE_COOLDOWN, and SPELL_AURA_MOD_POWER_REGEN_PERCENT.

Referenced by Spell::TakeRunePower(), and UpdateRuneRegen().

◆ GetRuneCooldown()

uint32 Player::GetRuneCooldown ( uint8  index) const
inline

◆ GetRunesState()

uint8 Player::GetRunesState ( ) const
inline
2468{ return m_runes->runeState; }
uint8 runeState
Definition: Player.h:429

References m_runes, and Runes::runeState.

Referenced by Spell::EffectActivateRune(), and Spell::TakeRunePower().

◆ getRuneWeaponGUID()

ObjectGuid Player::getRuneWeaponGUID ( )
inline
2556{ return m_drwGUID; };
ObjectGuid m_drwGUID
Definition: Player.h:2557

References m_drwGUID.

◆ GetSaveTimer()

uint32 Player::GetSaveTimer ( ) const
inline
2317{ return m_nextSave; }

References m_nextSave.

Referenced by misc_commandscript::HandleSaveCommand().

◆ GetSelectedPlayer()

Player * Player::GetSelectedPlayer ( ) const
11463{
11464 if (ObjectGuid selectionGUID = GetGuidValue(UNIT_FIELD_TARGET))
11465 return ObjectAccessor::GetPlayer(*this, selectionGUID);
11466
11467 return nullptr;
11468}
@ UNIT_FIELD_TARGET
Definition: UpdateFields.h:92
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:223

References Object::GetGuidValue(), ObjectAccessor::GetPlayer(), and UNIT_FIELD_TARGET.

Referenced by Acore::ChatCommands::PlayerIdentifier::FromTarget().

◆ GetSelectedUnit()

◆ GetSemaphoreTeleportFar()

time_t Player::GetSemaphoreTeleportFar ( ) const
inline
2060{ return mSemaphoreTeleport_Far; }

References mSemaphoreTeleport_Far.

◆ GetSemaphoreTeleportNear()

time_t Player::GetSemaphoreTeleportNear ( ) const
inline
2059{ return mSemaphoreTeleport_Near; }

References mSemaphoreTeleport_Near.

◆ GetSession()

WorldSession * Player::GetSession ( ) const
inline
1961{ return m_session; }

References m_session.

Referenced by _addSpell(), _LoadHomeBind(), _LoadInventory(), Pet::_LoadSpellCooldowns(), _SaveCharacter(), _SaveInstanceTimeRestrictions(), _StoreOrEquipNewItem(), ActivateSpec(), ActivateTaxiPathTo(), AddEnchantmentDuration(), AddItem(), Guild::AddMember(), InstanceMap::AddPlayerToMap(), AddRunePower(), addSpell(), Channel::Announce(), ApplyEquipCooldown(), TotemAI::AttackStart(), AutoUnequipOffhandIfNeed(), BanMgr::BanCharacter(), BindToInstance(), Group::BroadcastPacket(), Group::BroadcastReadyCheck(), SocialMgr::BroadcastToFriendListers(), AuctionHouseObject::BuildListAuctionItems(), BuildPlayerRepop(), GameObject::BuildValuesUpdate(), Unit::BuildValuesUpdate(), BuyItemFromVendorSlot(), WorldSession::CanOpenMailBox(), CanSpeak(), CharacterActionIpLogger::CharacterIPLogAction(), CharmSpellInitialize(), Spell::CheckCast(), CheckDuelDistance(), Spell::CheckEffectTarget(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::CheckRequiredBosses(), AchievementMgr::CompletedAchievement(), ContinueTaxiFlight(), ConvertRune(), Create(), Guild::Create(), ArenaTeam::DelMember(), Object::DestroyForPlayer(), Group::Disband(), InstanceScript::DoSendNotifyToInstance(), DuelComplete(), DurabilityRepair(), Spell::EffectApplyGlyph(), Spell::EffectDiscoverTaxi(), Spell::EffectDuel(), Spell::EffectPlaySound(), Spell::EffectSummonPlayer(), Spell::EffectSummonRaFFriend(), EquipItem(), AuctionListItemsDelayEvent::Execute(), BGQueueInviteEvent::Execute(), SendEncounterUnit::Execute(), lfg::LFGMgr::FinishDungeon(), Channel::FlagsNotify(), GetAurasForTarget(), ChannelMgr::GetChannel(), SocialMgr::GetFriendInfo(), getMaxTimer(), GetsRecruitAFriendBonus(), GiveLevel(), WorldSession::HandleAcceptGrantLevel(), WorldSession::HandleAcceptTradeOpcode(), account_commandscript::HandleAccountSetAddonCommand(), account_commandscript::HandleAccountSetGmLevelCommand(), WorldSession::HandleAddFriendOpcode(), misc_commandscript::HandleAddItemCommand(), BattlegroundAB::HandleAreaTrigger(), BattlegroundAV::HandleAreaTrigger(), WorldSession::HandleArenaTeamInviteOpcode(), AuraEffect::HandleAuraOpenStable(), AuraEffect::HandleAuraSetVehicle(), Aura::HandleAuraSpecificMods(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::HandleBattlemasterJoinArena(), WorldSession::HandleBattlemasterJoinOpcode(), WorldSession::HandleBeginTradeOpcode(), character_commandscript::HandleCharacterLevel(), WorldSession::HandleChatIgnoredOpcode(), debug_commandscript::HandleDebugSendOpcodeCommand(), spell_gen_spirit_healer_res::HandleDummy(), cheat_commandscript::HandleExploreCheatCommand(), ticket_commandscript::HandleGMTicketUnAssignCommand(), WorldSession::HandleGrantLevel(), WorldSession::HandleGroupDeclineOpcode(), WorldSession::HandleGroupInviteOpcode(), misc_commandscript::HandleGroupSummonCommand(), WorldSession::HandleInitiateTradeOpcode(), Guild::HandleInviteMember(), lookup_commandscript::HandleLookupPlayerIpCommand(), WorldSession::HandleMailTakeItem(), WorldSession::HandleMessagechatOpcode(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyGenderCommand(), modify_commandscript::HandleModifyHPCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyMoneyCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), modify_commandscript::HandleModifySpellCommand(), WorldSession::HandleMovementOpcodes(), misc_commandscript::HandleMuteCommand(), WorldSession::HandleOfferPetitionOpcode(), misc_commandscript::HandlePInfoCommand(), Battlefield::HandlePlayerLeaveZone(), OutdoorPvP::HandlePlayerLeaveZone(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginOpcode(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleRaidReadyCheckOpcode(), reset_commandscript::HandleResetSpellsCommand(), reset_commandscript::HandleResetTalentsCommand(), spell_pvp_trinket_wotf_shared_cd::HandleScript(), WorldSession::HandleSendMail(), send_commandscript::HandleSendMessageCommand(), WorldSession::HandleSetRaidDifficultyOpcode(), misc_commandscript::HandleSkirmishCommand(), cheat_commandscript::HandleTaxiCheatCommand(), tele_commandscript::HandleTeleGroupCommand(), misc_commandscript::HandleUnmuteCommand(), WorldSession::HandleWhoisOpcode(), WorldSession::HandleWhoOpcode(), ChatHandler::HasLowerSecurity(), hasSpanishClient(), lfg::LFGMgr::InitializeLockedDungeons(), InitTalentForLevel(), BattlegroundQueue::InviteGroupToBG(), Battlefield::InvitePlayerToQueue(), Battlefield::InvitePlayerToWar(), isBeingLoaded(), IsNeverVisible(), IsPetNeedBeTemporaryUnsummoned(), ObjectMgr::IsVendorItemValid(), IsVisibleGloballyFor(), Channel::JoinChannel(), lfg::LFGMgr::JoinLfg(), Channel::JoinNotify(), Unit::JumpTo(), Channel::KickOrBan(), Unit::KnockbackFrom(), Channel::LeaveNotify(), Channel::List(), LoadFromDB(), Pet::LoadPetFromDB(), GameObject::ModifyHealth(), ModifySpellCooldown(), go_tele_to_dalaran_crystal::OnGossipHello(), go_ulduar_pure_saronite_deposit::OnGossipHello(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_lokhtos_darkbargainer::OnGossipSelect(), npc_augustus_the_touched::OnGossipSelect(), npc_rivern_frostwind::OnGossipSelect(), npc_roxi_ramrocket::OnGossipSelect(), npc_wg_demolisher_engineer::OnGossipSelect(), npc_wg_quest_giver::OnGossipSelect(), npc_drake_dealer_hurlunk::OnGossipSelect(), npc_shattrathflaskvendors::OnGossipSelect(), npc_slim::OnGossipSelect(), npc_innkeeper::OnGossipSelect(), npc_prof_leather::OnGossipSelect(), npc_icc_buff_switcher::OnGossipSelect(), go_amberpine_outhouse::OnGossipSelect(), OnGossipSelect(), ServerMailReward::OnLogin(), lfg::LFGPlayerScript::OnLogout(), lfg::LFGPlayerScript::OnMapChanged(), BattlefieldWG::OnPlayerLeaveWar(), Acore::LocalizedPacketDo< Builder >::operator()(), Acore::LocalizedPacketListDo< Builder >::operator()(), CreatureTextLocalizer< Builder >::operator()(), Channel::Password(), InstanceMap::PermBindAllPlayers(), PetSpellInitialize(), Player(), Battlefield::PlayerAcceptInviteToQueue(), Battlefield::PlayerAcceptInviteToWar(), Battleground::PlayerAddedToBGCheckIfBGIsRunning(), InstanceSaveMgr::PlayerBindToInstance(), MapMgr::PlayerCannotEnter(), InstanceSaveMgr::PlayerUnbindInstance(), InstanceSaveMgr::PlayerUnbindInstanceNotExtended(), PossessSpellInitialize(), PrepareGossipMenu(), PrettyPrintRequirementsAchievementsList(), PrettyPrintRequirementsItemsList(), PrettyPrintRequirementsQuestList(), ProhibitSpellSchool(), Battleground::ReadyMarkerClicked(), RefundItem(), Group::RemoveMember(), RemovePet(), RemovePetitionsAndSigns(), Battleground::RemovePlayerAtLeave(), RepopAtGraveyard(), Group::ResetMaxEnchantingLevel(), ResurrectPlayer(), ResyncRunes(), RewardHonor(), Satisfy(), SatisfyQuestLog(), SaveToDB(), SendActionButtons(), npc_prof_alchemy::SendActionMenu(), npc_prof_blacksmith::SendActionMenu(), npc_prof_tailor::SendActionMenu(), AchievementMgr::SendAllAchievementData(), BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(), Battlefield::SendAreaSpiritHealerQueryOpcode(), SendAttackSwingBadFacingAttack(), SendAttackSwingCancelAttack(), SendAttackSwingCantAttack(), SendAttackSwingDeadTarget(), SendAttackSwingNotInRange(), AuctionHouseMgr::SendAuctionExpiredMail(), AuctionHouseMgr::SendAuctionOutbiddedMail(), AuctionHouseMgr::SendAuctionSuccessfulMail(), AuctionHouseMgr::SendAuctionWonMail(), SendBuyError(), SendCanTakeQuestResponse(), Spell::SendCastResult(), SendCorpseReclaimDelay(), SendDuelCountdown(), SendDungeonDifficulty(), SendEnchantmentDurations(), SendEquipError(), SendEquipmentSetList(), SendExplorationExperience(), SocialMgr::SendFriendStatus(), SendInitialPacketsAfterAddToMap(), SendInitialPacketsBeforeAddToMap(), SendInitialSpells(), Map::SendInitTransports(), SendInitWorldStates(), BattlefieldWG::SendInitWorldStatesTo(), SendInstanceResetWarning(), BattlegroundQueue::SendJoinMessageArenaQueue(), SendLearnPacket(), SendLogXPGain(), Group::SendLootAllPassed(), Group::SendLootRoll(), Group::SendLootRollWon(), Group::SendLootStartRoll(), Group::SendLootStartRollToPlayer(), SendMailResult(), MailDraft::SendMailTo(), BattlegroundQueue::SendMessageBGQueue(), SendMessageToSetInRange(), SendMessageToSetInRange_OwnTeam(), SendNewItem(), SendNewMail(), CreatureTextMgr::SendNonChatPacket(), SendNotifyLootItemRemoved(), SendNotifyLootMoneyRemoved(), Acore::MessageDistDeliverer::SendPacket(), Acore::MessageDistDelivererToHostile::SendPacket(), Unit::SendPetActionFeedback(), Unit::SendPetAIReaction(), Spell::SendPetCastResult(), Unit::SendPetTalk(), WorldObject::SendPlayMusic(), SendPreparedQuest(), SendProficiency(), SendPushToPartyResponse(), SendQuestComplete(), SendQuestConfirmAccept(), SendQuestFailed(), SendQuestGiverStatusMultiple(), SendQuestReward(), SendQuestTimerFailed(), SendQuestUpdateAddCreatureOrGo(), SendQuestUpdateAddItem(), SendQuestUpdateAddPlayer(), lfg::LFGMgr::SendRaidBrowserCachedList(), lfg::LFGMgr::SendRaidBrowserJoinedPacket(), SendRaidDifficulty(), SendRaidInfo(), SendRefundInfo(), SendRemoveControlBar(), Map::SendRemoveTransports(), SendResetFailedNotify(), SendResetInstanceFailed(), SendResetInstanceSuccess(), AchievementMgr::SendRespondInspectAchievements(), Spell::SendResurrectRequest(), SendSavedInstances(), SendSellError(), PlayerSocial::SendSocialList(), SendSystemMessage(), SendTalentsInfoData(), SendTalentWipeConfirm(), SendTeleportAckPacket(), Item::SendTimeUpdate(), Acore::VisibleNotifier::SendToSelf(), SendTransferAborted(), BattlegroundSA::SendTransportInit(), BattlegroundSA::SendTransportsRemove(), Item::SendUpdateSockets(), Group::SendUpdateToPlayer(), Object::SendUpdateToPlayer(), ReputationMgr::SendVisible(), TradeData::SetAccepted(), SetBindPoint(), SetClientControl(), Item::SetEnchantment(), SetEquipmentSet(), SetGameMaster(), SetGMVisible(), Channel::SetMode(), TradeData::SetMoney(), SetMovement(), Channel::SetOwner(), SetRestBonus(), Unit::SetStandState(), Guild::Member::SetStats(), SetTitle(), Channel::ShouldAnnouncePlayer(), SortAuction(), SpawnCorpseBones(), SummonPet(), lfg::LFGMgr::TeleportPlayer(), TeleportTo(), Channel::ToggleModeration(), TradeCancel(), Channel::UnBan(), TradeData::Update(), Map::Update(), Pet::Update(), GameObject::Update(), Update(), PetAI::UpdateAI(), UpdateForQuestWorldObjects(), UpdateHomebindTime(), UpdateLocalChannels(), Group::UpdatePlayerOutOfRange(), UpdatePosition(), UpdateSpeakTime(), UpdateTriggerVisibility(), GameObject::Use(), VehicleSpellInitialize(), Whisper(), and Unit::Whisper().

◆ GetShield()

Item * Player::GetShield ( bool  useable = false) const
552{
553 Item* item = nullptr;
554 if (useable)
556 else
558 if (!item || item->GetTemplate()->Class != ITEM_CLASS_ARMOR)
559 return nullptr;
560
561 if (!useable)
562 return item;
563
564 if (item->IsBroken())
565 return nullptr;
566
567 return item;
568}
Item * GetUseableItemByPos(uint8 bag, uint8 slot) const
Definition: Player.h:1232

References ItemTemplate::Class, EQUIPMENT_SLOT_OFFHAND, GetItemByPos(), Item::GetTemplate(), GetUseableItemByPos(), INVENTORY_SLOT_BAG_0, Item::IsBroken(), and ITEM_CLASS_ARMOR.

Referenced by AuraEffect::CalculateAmount().

◆ GetShieldBlockValue()

uint32 Player::GetShieldBlockValue ( ) const
overridevirtual

Implements Unit.

5002{
5004
5005 value = (value < 0) ? 0 : value;
5006
5007 return uint32(value);
5008}

References FLAT_MOD, Unit::GetStat(), m_auraBaseMod, PCT_MOD, SHIELD_BLOCK_VALUE, and STAT_STRENGTH.

Referenced by UpdateShieldBlockValue().

◆ GetSightRange()

float Player::GetSightRange ( WorldObject const *  target = nullptr) const
overridevirtual

Reimplemented from WorldObject.

16204{
16205 float sightRange = WorldObject::GetSightRange(target);
16207 {
16208 sightRange += *_farSightDistance;
16209 }
16210
16211 return sightRange;
16212}
virtual float GetSightRange(WorldObject const *target=nullptr) const
Definition: Object.cpp:1672

References _farSightDistance, and WorldObject::GetSightRange().

Referenced by Group::UpdatePlayerOutOfRange(), and UpdateVisibilityForPlayer().

◆ GetSkillPermBonusValue()

int16 Player::GetSkillPermBonusValue ( uint32  skill) const
5445{
5446 if (!skill)
5447 return 0;
5448
5449 SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
5450 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
5451 return 0;
5452
5454}

References Object::GetUInt32Value(), mSkillStatus, PLAYER_SKILL_BONUS_INDEX, SKILL_DELETED, and SKILL_PERM_BONUS.

Referenced by lookup_commandscript::HandleLookupSkillCommand().

◆ GetSkillStep()

uint16 Player::GetSkillStep ( uint16  skill) const
5356{
5357 if (!skill)
5358 return 0;
5359
5360 SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
5361 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
5362 return 0;
5363
5364 return PAIR32_HIPART(GetUInt32Value(PLAYER_SKILL_INDEX(itr->second.pos)));
5365}
uint16 PAIR32_HIPART(uint32 x)
Definition: ObjectDefines.h:92

References Object::GetUInt32Value(), mSkillStatus, PAIR32_HIPART(), PLAYER_SKILL_INDEX, and SKILL_DELETED.

Referenced by learn_commandscript::HandleLearnAllRecipesCommand(), and misc_commandscript::HandleSetSkillCommand().

◆ GetSkillTempBonusValue()

int16 Player::GetSkillTempBonusValue ( uint32  skill) const
5457{
5458 if (!skill)
5459 return 0;
5460
5461 SkillStatusMap::const_iterator itr = mSkillStatus.find(skill);
5462 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
5463 return 0;
5464
5466}

References Object::GetUInt32Value(), mSkillStatus, PLAYER_SKILL_BONUS_INDEX, SKILL_DELETED, and SKILL_TEMP_BONUS.

Referenced by lookup_commandscript::HandleLookupSkillCommand().

◆ GetSkillValue()

◆ GetSocial()

◆ GetSpec()

uint32 Player::GetSpec ( int8  spec = -1)
15930{
15931 uint32 mostTalentTabId = 0;
15932 uint32 mostTalentCount = 0;
15933 uint32 specIdx = 0;
15934
15935 if (m_specsCount) // not all instances of Player have a spec for some reason
15936 {
15937 if (spec < 0)
15938 specIdx = m_activeSpec;
15939 else
15940 specIdx = spec;
15941 // find class talent tabs (all players have 3 talent tabs)
15942 uint32 const* talentTabIds = GetTalentTabPages(getClass());
15943
15944 for (uint8 i = 0; i < MAX_TALENT_TABS; ++i)
15945 {
15946 uint32 talentCount = 0;
15947 uint32 talentTabId = talentTabIds[i];
15948 for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
15949 {
15950 TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
15951 if (!talentInfo)
15952 continue;
15953
15954 // skip another tab talents
15955 if (talentInfo->TalentTab != talentTabId)
15956 continue;
15957
15958 // find max talent rank (0~4)
15959 int8 curtalent_maxrank = -1;
15960 for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank)
15961 {
15962 if (talentInfo->RankID[rank] && HasTalent(talentInfo->RankID[rank], specIdx))
15963 {
15964 curtalent_maxrank = rank;
15965 break;
15966 }
15967 }
15968
15969 // not learned talent
15970 if (curtalent_maxrank < 0)
15971 continue;
15972
15973 talentCount += curtalent_maxrank + 1;
15974 }
15975
15976 if (mostTalentCount < talentCount)
15977 {
15978 mostTalentCount = talentCount;
15979 mostTalentTabId = talentTabId;
15980 }
15981 }
15982 }
15983 return mostTalentTabId;
15984}
uint32 const * GetTalentTabPages(uint8 cls)
Definition: DBCStores.cpp:820
#define MAX_TALENT_TABS
Definition: DBCStructure.h:1921

References Unit::getClass(), GetTalentTabPages(), HasTalent(), m_activeSpec, m_specsCount, MAX_TALENT_RANK, MAX_TALENT_TABS, TalentEntry::RankID, sTalentStore, and TalentEntry::TalentTab.

Referenced by HasCasterSpec(), HasHealSpec(), HasMeleeSpec(), and HasTankSpec().

◆ GetSpecsCount()

uint8 Player::GetSpecsCount ( ) const
inline

◆ GetSpellByProto()

uint32 Player::GetSpellByProto ( ItemTemplate proto)

◆ GetSpellCooldownDelay()

uint32 Player::GetSpellCooldownDelay ( uint32  spell_id) const
16264{
16265 SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
16266 return uint32(itr != m_spellCooldowns.end() && itr->second.end > getMSTime() ? itr->second.end - getMSTime() : 0);
16267}
uint32 getMSTime()
Definition: Timer.h:103

References getMSTime(), and m_spellCooldowns.

Referenced by Aura::HandleAuraSpecificMods(), npc_brewfest_keg_reciver::MoveInLineOfSight(), and ProhibitSpellSchool().

◆ GetSpellCooldownMap() [1/2]

SpellCooldowns & Player::GetSpellCooldownMap ( )
inline
1743{ return m_spellCooldowns; }

References m_spellCooldowns.

◆ GetSpellCooldownMap() [2/2]

◆ GetSpellCooldowns()

SpellCooldowns Player::GetSpellCooldowns ( ) const
inline
2132{ return m_spellCooldowns; }

References m_spellCooldowns.

Referenced by Unit::HandleDummyAuraProc().

◆ GetSpellCritFromIntellect()

float Player::GetSpellCritFromIntellect ( )
5081{
5082 uint8 level = GetLevel();
5083 uint32 pclass = getClass();
5084
5085 if (level > GT_MAX_LEVEL)
5086 level = GT_MAX_LEVEL;
5087
5088 GtChanceToSpellCritBaseEntry const* critBase = sGtChanceToSpellCritBaseStore.LookupEntry(pclass - 1);
5089 GtChanceToSpellCritEntry const* critRatio = sGtChanceToSpellCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
5090 if (!critBase || !critRatio)
5091 return 0.0f;
5092
5093 float crit = critBase->base + GetStat(STAT_INTELLECT) * critRatio->ratio;
5094 return crit * 100.0f;
5095}
DBCStorage< GtChanceToSpellCritBaseEntry > sGtChanceToSpellCritBaseStore(GtChanceToSpellCritBasefmt)
DBCStorage< GtChanceToSpellCritEntry > sGtChanceToSpellCritStore(GtChanceToSpellCritfmt)
Definition: DBCStructure.h:1053
float base
Definition: DBCStructure.h:1054
Definition: DBCStructure.h:1063
float ratio
Definition: DBCStructure.h:1064

References GtChanceToSpellCritBaseEntry::base, Unit::getClass(), Unit::GetLevel(), Unit::GetStat(), GT_MAX_LEVEL, GtChanceToSpellCritEntry::ratio, sGtChanceToSpellCritBaseStore, sGtChanceToSpellCritStore, and STAT_INTELLECT.

Referenced by UpdateSpellCritChance().

◆ GetSpellMap() [1/2]

PlayerSpellMap & Player::GetSpellMap ( )
inline
1740{ return m_spells; }

References m_spells.

◆ GetSpellMap() [2/2]

◆ GetSpellModList()

SpellModList const & Player::GetSpellModList ( uint32  type) const
inline
2575{ return m_spellMods[type]; }

References m_spellMods.

Referenced by WorldSession::HandlePlayerLoginToCharInWorld().

◆ GetSpellPenetrationItemMod()

int32 Player::GetSpellPenetrationItemMod ( ) const
inline

◆ GetsRecruitAFriendBonus()

bool Player::GetsRecruitAFriendBonus ( bool  forXP)
12605{
12606 bool recruitAFriend = false;
12607 if (GetLevel() <= sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL) || !forXP)
12608 {
12609 if (Group* group = this->GetGroup())
12610 {
12611 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
12612 {
12613 Player* player = itr->GetSource();
12614 if (!player || !player->IsInMap(this))
12615 continue;
12616
12617 if (!player->IsAtRecruitAFriendDistance(this))
12618 continue; // member (alive or dead) or his corpse at req. distance
12619
12620 if (forXP)
12621 {
12622 // level must be allowed to get RaF bonus
12623 if (player->GetLevel() > sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL))
12624 continue;
12625
12626 // level difference must be small enough to get RaF bonus, UNLESS we are lower level
12627 if (player->GetLevel() < GetLevel())
12629 continue;
12630 }
12631
12632 bool ARecruitedB = (player->GetSession()->GetRecruiterId() == GetSession()->GetAccountId());
12633 bool BRecruitedA = (GetSession()->GetRecruiterId() == player->GetSession()->GetAccountId());
12634 if (ARecruitedB || BRecruitedA)
12635 {
12636 recruitAFriend = true;
12637 break;
12638 }
12639 }
12640 }
12641 }
12642 return recruitAFriend;
12643}
@ CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL
Definition: IWorld.h:247
@ CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE
Definition: IWorld.h:248
bool IsInMap(WorldObject const *obj) const
Definition: Object.cpp:1285
bool IsAtRecruitAFriendDistance(WorldObject const *pOther) const
Definition: Player.cpp:12714
uint32 GetRecruiterId() const
Definition: WorldSession.h:527
uint32 GetAccountId() const
Definition: WorldSession.h:363

References CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL, CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE, WorldSession::GetAccountId(), GetGroup(), Unit::GetLevel(), WorldSession::GetRecruiterId(), GetSession(), IsAtRecruitAFriendDistance(), WorldObject::IsInMap(), GroupReference::next(), and sWorld.

Referenced by CalculateReputationGain(), GiveXP(), and SetRestBonus().

◆ GetStartPosition()

WorldLocation Player::GetStartPosition ( ) const
11319{
11320 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass());
11321 uint32 mapId = info->mapId;
11322 if (getClass() == CLASS_DEATH_KNIGHT && HasSpell(50977))
11323 return WorldLocation(0, 2352.0f, -5709.0f, 154.5f, 0.0f);
11324 return WorldLocation(mapId, info->positionX, info->positionY, info->positionZ, 0);
11325}

References CLASS_DEATH_KNIGHT, Unit::getClass(), Unit::getRace(), HasSpell(), PlayerInfo::mapId, PlayerInfo::positionX, PlayerInfo::positionY, PlayerInfo::positionZ, and sObjectMgr.

Referenced by misc_commandscript::HandleUnstuckCommand().

◆ GetStoredRaidDifficulty()

Difficulty Player::GetStoredRaidDifficulty ( ) const
inline
1886{ return m_raidMapDifficulty; } // only for use in difficulty packet after exiting to raid map

References m_raidMapDifficulty.

Referenced by SendInitialPacketsAfterAddToMap().

◆ GetSubGroup()

uint8 Player::GetSubGroup ( ) const
inline

◆ GetSummonExpireTimer()

time_t Player::GetSummonExpireTimer ( ) const
inline
1093{ return m_summon_expire; }

References m_summon_expire.

Referenced by Spell::CheckCast().

◆ GetTalentMap()

◆ GetTalentTreePoints()

void Player::GetTalentTreePoints ( uint8(&)  specPoints[3]) const
15201{
15202 const PlayerTalentMap& talentMap = GetTalentMap();
15203 for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr)
15204 if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(GetActiveSpec()))
15205 if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(itr->second->talentID))
15206 if (TalentTabEntry const* tab = sTalentTabStore.LookupEntry(talentInfo->TalentTab))
15207 if (tab->tabpage < 3)
15208 {
15209 // find current talent rank
15210 uint8 currentTalentRank = 0;
15211 for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank)
15212 if (talentInfo->RankID[rank] && itr->first == talentInfo->RankID[rank])
15213 {
15214 currentTalentRank = rank + 1;
15215 break;
15216 }
15217 specPoints[tab->tabpage] += currentTalentRank;
15218 }
15219}

References GetActiveSpec(), GetTalentMap(), MAX_TALENT_RANK, PLAYERSPELL_REMOVED, sTalentStore, and sTalentTabStore.

Referenced by lfg::LFGMgr::UpdateRaidBrowser().

◆ GetTeamId()

TeamId Player::GetTeamId ( bool  original = false) const
inline
2072{ return original ? TeamIdForRace(getRace(true)) : m_team; };
static TeamId TeamIdForRace(uint8 race)
Definition: Player.cpp:5745

References Unit::getRace(), m_team, and TeamIdForRace().

Referenced by ActivateTaxiPathTo(), GameObject::ActivateToQuest(), BattlegroundQueue::AddGroup(), Battlefield::AddOrSetPlayerToCorrectBfGroup(), Arena::AddPlayer(), BattlegroundIC::AddPlayer(), npc_love_in_air_snivel::AllowAction(), BattlegroundSA::AllowDefenseOfTheAncients(), LootItem::AllowedForPlayer(), Battlefield::AskToLeaveQueue(), SocialMgr::BroadcastToFriendListers(), Corpse::BuildValuesUpdate(), BuyItemFromVendorSlot(), npc_steam_powered_auctioneer::npc_steam_powered_auctioneerAI::CanBeSeen(), npc_mei_francis_mount::npc_mei_francis_mountAI::CanBeSeen(), Group::CanJoinBattlegroundQueue(), OPvPCapturePointZM_GraveYard::CanTalkTo(), CanUseItem(), BattlegroundSA::CaptureGraveyard(), ContinueTaxiFlight(), BattlegroundSA::DefendersPortalTeleport(), BattlegroundIC::DoAction(), DuelComplete(), Spell::EffectTeleportUnits(), BattlegroundAV::EventPlayerAssaultsPoint(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundWS::EventPlayerClickedOnFlag(), BattlegroundIC::EventPlayerClickedOnFlag(), BattlegroundAB::EventPlayerClickedOnFlag(), BattlegroundAV::EventPlayerDefendsPoint(), BattlegroundEY::EventPlayerDroppedFlag(), BattlegroundWS::EventPlayerDroppedFlag(), BattlegroundSA::EventPlayerUsedGO(), GetBgTeamId(), Battlefield::GetClosestGraveyard(), BattlegroundAB::GetClosestGraveyard(), BattlegroundAV::GetClosestGraveyard(), BattlegroundEY::GetClosestGraveyard(), BattlegroundIC::GetClosestGraveyard(), BattlegroundSA::GetClosestGraveyard(), BattlegroundWS::GetClosestGraveyard(), SocialMgr::GetFriendInfo(), Battleground::GetRealRepFactionForPlayer(), Guild::HandleAcceptMember(), BattlegroundAB::HandleAreaTrigger(), BattlegroundAV::HandleAreaTrigger(), BattlegroundEY::HandleAreaTrigger(), BattlegroundIC::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), WorldSession::HandleAreaTriggerOpcode(), WorldSession::HandleArenaTeamAcceptOpcode(), WorldSession::HandleArenaTeamInviteOpcode(), WorldSession::HandleCalendarEventInvite(), OutdoorPvPSI::HandleDropFlag(), spell_item_brewfest_mount_transformation::HandleDummy(), spell_item_teach_language::HandleDummy(), spell_q6124_6129_apply_salve::HandleDummy(), WorldSession::HandleGrantLevel(), WorldSession::HandleGroupInviteOpcode(), WorldSession::HandleInitiateTradeOpcode(), Guild::HandleInviteMember(), BattlefieldWG::HandleKill(), OutdoorPvPHP::HandleKillImpl(), OutdoorPvPNA::HandleKillImpl(), OutdoorPvPZM::HandleKillImpl(), BattlegroundAV::HandleKillPlayer(), BattlegroundIC::HandleKillPlayer(), BattlegroundAV::HandleKillUnit(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandleMovementOpcodes(), WorldSession::HandleOfferPetitionOpcode(), BfCapturePoint::HandlePlayerEnter(), OPvPCapturePoint::HandlePlayerEnter(), Battlefield::HandlePlayerEnterZone(), OutdoorPvP::HandlePlayerEnterZone(), OutdoorPvPEP::HandlePlayerEnterZone(), OutdoorPvPHP::HandlePlayerEnterZone(), OutdoorPvPNA::HandlePlayerEnterZone(), OutdoorPvPSI::HandlePlayerEnterZone(), OutdoorPvPTF::HandlePlayerEnterZone(), OutdoorPvPZM::HandlePlayerEnterZone(), BfCapturePoint::HandlePlayerLeave(), OPvPCapturePoint::HandlePlayerLeave(), Battlefield::HandlePlayerLeaveZone(), OutdoorPvP::HandlePlayerLeaveZone(), OutdoorPvPEP::HandlePlayerLeaveZone(), OutdoorPvPHP::HandlePlayerLeaveZone(), BattlegroundIC::HandlePlayerResurrect(), BattlegroundAV::HandleQuestComplete(), spell_pvp_trinket_wotf_shared_cd::HandleScript(), spell_wintergrasp_portal::spell_wintergrasp_portal_SpellScript::HandleScript(), spell_item_dimensional_ripper_area52::HandleScript(), WorldSession::HandleSendMail(), WorldSession::HandleWhoOpcode(), Battlefield::HasPlayer(), OutdoorPvP::HasPlayer(), lfg::LFGMgr::InitializeLockedDungeons(), Channel::Invite(), Battlefield::InvitePlayerToQueue(), Battlefield::InvitePlayerToWar(), SpellArea::IsFitToRequirements(), IsGroupVisibleFor(), BfCapturePoint::IsInsideObjective(), OPvPCapturePoint::IsInsideObjective(), lfg::LFGMgr::JoinRaidBrowser(), boss_devourer_of_souls::boss_devourer_of_soulsAI::JustEngagedWith(), Unit::Kill(), lfg::LFGMgr::LfrSearchAdd(), lfg::LFGMgr::LfrSearchRemove(), lfg::LFGMgr::LfrSetComment(), LoadFromDB(), AchievementCriteriaData::Meets(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_love_in_air_snivel::MoveInLineOfSight(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), npc_guardian_pavilion::npc_guardian_pavilionAI::MoveInLineOfSight(), achievement_resilient_victory::OnCheck(), achievement_bg_control_all_nodes::OnCheck(), achievement_bg_ic_resource_glut::OnCheck(), achievement_everything_counts::OnCheck(), achievement_bg_av_perfection::OnCheck(), achievement_not_even_a_scratch::OnCheck(), BattlefieldWG::OnCreatureCreate(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npcs_riverbreeze_and_silversky::OnGossipHello(), npc_bunthen_plainswind::OnGossipHello(), npc_silva_filnaveth::OnGossipHello(), npc_shandy_dalaran::OnGossipHello(), npc_wg_spirit_guide::OnGossipHello(), npc_wg_spirit_guide::OnGossipSelect(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_bunthen_plainswind::OnGossipSelect(), npc_silva_filnaveth::OnGossipSelect(), npc_wg_demolisher_engineer::OnGossipSelect(), lfg::LFGPlayerScript::OnLogin(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnPlayerEnter(), instance_shattered_halls::instance_shattered_halls_InstanceMapScript::OnPlayerEnter(), instance_utgarde_keep::instance_utgarde_keep_InstanceMapScript::OnPlayerEnter(), BattlefieldWG::OnPlayerEnterZone(), BattlefieldWG::OnPlayerJoinWar(), npc_lurgglbr::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_apothecary_hanes::OnQuestAccept(), AreaTrigger_at_legion_teleporter::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::PassengerBoarded(), Battlefield::PlayerAcceptInviteToQueue(), Battlefield::PlayerAcceptInviteToWar(), RepopAtGraveyard(), ReportedAfkBy(), RewardHonor(), RewardReputation(), Satisfy(), AchievementMgr::SendAchievementEarned(), WorldSession::SendListInventory(), SendLoot(), Acore::MessageDistDeliverer::SendPacket(), lfg::LFGMgr::SendRaidBrowserCachedList(), lfg::LFGMgr::SendRaidBrowserJoinedPacket(), ObjectMgr::SendServerMail(), WorldSession::SendSpiritResurrect(), SendTaxiNodeStatusMultiple(), WorldSession::SendTaxiStatus(), Creature::SendZoneUnderAttackMessage(), spell_item_recall::SetDest(), SetEntryPoint(), SetFactionForRace(), Channel::SetMode(), Channel::SetOwner(), npc_chesspiece::sGossipHello(), npc_midsummer_torch_target::SpellHit(), BattlegroundSA::TeleportToEntrancePosition(), OPvPCapturePoint::Update(), UpdateArea(), UpdateLocalChannels(), UpdateZone(), and npc_isla_starmane::npc_isla_starmaneAI::WaypointReached().

◆ GetTeleportDest()

◆ GetTemporaryUnsummonedPetNumber()

uint32 Player::GetTemporaryUnsummonedPetNumber ( ) const
inline

◆ GetTotalBaseModValue()

float Player::GetTotalBaseModValue ( BaseModGroup  modGroup) const
4988{
4989 if (modGroup >= BASEMOD_END)
4990 {
4991 LOG_ERROR("entities.player", "wrong BaseModGroup in GetTotalBaseModValue()!");
4992 return 0.0f;
4993 }
4994
4995 if (m_auraBaseMod[modGroup][PCT_MOD] <= 0.0f)
4996 return 0.0f;
4997
4998 return m_auraBaseMod[modGroup][FLAT_MOD] * m_auraBaseMod[modGroup][PCT_MOD];
4999}

References BASEMOD_END, FLAT_MOD, LOG_ERROR, m_auraBaseMod, and PCT_MOD.

◆ GetTotalPercentageModValue()

float Player::GetTotalPercentageModValue ( BaseModGroup  modGroup) const
inline
2158{ return m_auraBaseMod[modGroup][FLAT_MOD] + m_auraBaseMod[modGroup][PCT_MOD]; }

References FLAT_MOD, m_auraBaseMod, and PCT_MOD.

Referenced by UpdateCritPercentage().

◆ GetTotalPlayedTime()

◆ GetTradeData()

◆ GetTrader()

Player * Player::GetTrader ( ) const
inline
1355{ return m_trade ? m_trade->GetTrader() : nullptr; }
Player * GetTrader() const
Definition: TradeData.h:41

References TradeData::GetTrader(), and m_trade.

Referenced by WorldSession::moveItems(), and UpdatePosition().

◆ GetTrainerSpellState()

TrainerSpellState Player::GetTrainerSpellState ( TrainerSpell const *  trainer_spell) const
3850{
3851 if (!trainer_spell)
3852 return TRAINER_SPELL_RED;
3853
3854 bool hasSpell = true;
3855 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3856 {
3857 if (!trainer_spell->learnedSpell[i])
3858 continue;
3859
3860 if (!HasSpell(trainer_spell->learnedSpell[i]))
3861 {
3862 hasSpell = false;
3863 break;
3864 }
3865 }
3866 // known spell
3867 if (hasSpell)
3868 return TRAINER_SPELL_GRAY;
3869
3870 // check skill requirement
3871 if (trainer_spell->reqSkill && GetBaseSkillValue(trainer_spell->reqSkill) < trainer_spell->reqSkillValue)
3872 return TRAINER_SPELL_RED;
3873
3874 // check level requirement
3875 if (GetLevel() < trainer_spell->reqLevel)
3876 return TRAINER_SPELL_RED;
3877
3878 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3879 {
3880 if (!trainer_spell->learnedSpell[i])
3881 continue;
3882
3883 // check race/class requirement
3884 if (!IsSpellFitByClassAndRace(trainer_spell->learnedSpell[i]))
3885 return TRAINER_SPELL_RED;
3886
3887 if (uint32 prevSpell = sSpellMgr->GetPrevSpellInChain(trainer_spell->learnedSpell[i]))
3888 {
3889 // check prev.rank requirement
3890 if (prevSpell && !HasSpell(prevSpell))
3891 return TRAINER_SPELL_RED;
3892 }
3893
3894 SpellsRequiringSpellMapBounds spellsRequired = sSpellMgr->GetSpellsRequiredForSpellBounds(trainer_spell->learnedSpell[i]);
3895 for (SpellsRequiringSpellMap::const_iterator itr = spellsRequired.first; itr != spellsRequired.second; ++itr)
3896 {
3897 // check additional spell requirement
3898 if (!HasSpell(itr->second))
3899 return TRAINER_SPELL_RED;
3900 }
3901 }
3902
3903 // check primary prof. limit
3904 // first rank of primary profession spell when there are no proffesions avalible is disabled
3905 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3906 {
3907 if (!trainer_spell->learnedSpell[i])
3908 continue;
3909 SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainer_spell->learnedSpell[i]);
3910 if (learnedSpellInfo && learnedSpellInfo->IsPrimaryProfessionFirstRank() && (GetFreePrimaryProfessionPoints() == 0))
3912 }
3913
3914 return TRAINER_SPELL_GREEN;
3915}
@ TRAINER_SPELL_GREEN
Definition: Player.h:214
@ TRAINER_SPELL_GRAY
Definition: Player.h:216
@ TRAINER_SPELL_GREEN_DISABLED
Definition: Player.h:217
@ TRAINER_SPELL_RED
Definition: Player.h:215
std::pair< SpellsRequiringSpellMap::const_iterator, SpellsRequiringSpellMap::const_iterator > SpellsRequiringSpellMapBounds
Definition: SpellMgr.h:570
bool IsSpellFitByClassAndRace(uint32 spell_id) const
Definition: Player.cpp:12278

References GetBaseSkillValue(), GetFreePrimaryProfessionPoints(), Unit::GetLevel(), HasSpell(), SpellInfo::IsPrimaryProfessionFirstRank(), IsSpellFitByClassAndRace(), TrainerSpell::learnedSpell, MAX_SPELL_EFFECTS, TrainerSpell::reqLevel, TrainerSpell::reqSkill, TrainerSpell::reqSkillValue, sSpellMgr, TRAINER_SPELL_GRAY, TRAINER_SPELL_GREEN, TRAINER_SPELL_GREEN_DISABLED, and TRAINER_SPELL_RED.

Referenced by WorldSession::HandleTrainerBuySpellOpcode(), and WorldSession::SendTrainerList().

◆ GetUseableItemByPos()

Item * Player::GetUseableItemByPos ( uint8  bag,
uint8  slot 
) const
inline

◆ GetViewpoint()

WorldObject * Player::GetViewpoint ( ) const
13129{
13131 return static_cast<WorldObject*>(ObjectAccessor::GetObjectByTypeMask(*this, guid, TYPEMASK_SEER));
13132 return nullptr;
13133}
@ TYPEMASK_SEER
Definition: ObjectGuid.h:56
Object * GetObjectByTypeMask(WorldObject const &, ObjectGuid const guid, uint32 typemask)
Definition: ObjectAccessor.cpp:144
Definition: Object.h:393

References Object::GetGuidValue(), ObjectAccessor::GetObjectByTypeMask(), PLAYER_FARSIGHT, and TYPEMASK_SEER.

Referenced by CinematicMgr::EndCinematic(), WorldSession::HandleFarSightOpcode(), ArenaSpectator::HandleSpectatorWatchCommand(), RemoveFromWorld(), StopCastingBindSight(), and Map::Update().

◆ GetWeaponForAttack()

Item * Player::GetWeaponForAttack ( WeaponAttackType  attackType,
bool  useable = false 
) const

◆ GetWeaponProficiency()

uint32 Player::GetWeaponProficiency ( ) const
inline
1340{ return m_WeaponProficiency; }

References m_WeaponProficiency.

Referenced by Spell::EffectProficiency().

◆ GetXPRestBonus()

uint32 Player::GetXPRestBonus ( uint32  xp)
8772{
8773 uint32 rested_bonus = (uint32)GetRestBonus(); // xp for each rested bonus
8774
8775 if (rested_bonus > xp) // max rested_bonus == xp or (r+x) = 200% xp
8776 rested_bonus = xp;
8777
8778 SetRestBonus(GetRestBonus() - rested_bonus);
8779
8780 LOG_DEBUG("entities.player", "Player gain {} xp (+ {} Rested Bonus). Rested points={}", xp + rested_bonus, rested_bonus, GetRestBonus());
8781 return rested_bonus;
8782}
void SetRestBonus(float rest_bonus_new)
Definition: Player.cpp:10118
float GetRestBonus() const
Definition: Player.h:1182

References GetRestBonus(), LOG_DEBUG, and SetRestBonus().

Referenced by GiveXP().

◆ GetZoneIdFromDB()

uint32 Player::GetZoneIdFromDB ( ObjectGuid  guid)
static
6233{
6234 ObjectGuid::LowType guidLow = guid.GetCounter();
6235
6237 stmt->SetData(0, guidLow);
6238 PreparedQueryResult result = CharacterDatabase.Query(stmt);
6239
6240 if (!result)
6241 return 0;
6242
6243 Field* fields = result->Fetch();
6244 uint32 zone = fields[0].Get<uint16>();
6245
6246 if (!zone)
6247 {
6248 // stored zone is zero, use generic and slow zone detection
6249 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_POSITION_XYZ);
6250 stmt->SetData(0, guidLow);
6251 PreparedQueryResult posResult = CharacterDatabase.Query(stmt);
6252
6253 if (!posResult)
6254 {
6255 return 0;
6256 }
6257
6258 fields = posResult->Fetch();
6259 uint32 map = fields[0].Get<uint16>();
6260 float posx = fields[1].Get<float>();
6261 float posy = fields[2].Get<float>();
6262 float posz = fields[3].Get<float>();
6263
6264 if (!sMapStore.LookupEntry(map))
6265 return 0;
6266
6267 zone = sMapMgr->GetZoneId(PHASEMASK_NORMAL, map, posx, posy, posz);
6268
6269 if (zone > 0)
6270 {
6271 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ZONE);
6272
6273 stmt->SetData(0, uint16(zone));
6274 stmt->SetData(1, guidLow);
6275
6276 CharacterDatabase.Execute(stmt);
6277 }
6278 }
6279
6280 return zone;
6281}
@ CHAR_SEL_CHAR_POSITION_XYZ
Definition: CharacterDatabase.h:53
@ CHAR_UPD_ZONE
Definition: CharacterDatabase.h:294
@ CHAR_SEL_CHAR_ZONE
Definition: CharacterDatabase.h:51

References CHAR_SEL_CHAR_POSITION_XYZ, CHAR_SEL_CHAR_ZONE, CHAR_UPD_ZONE, CharacterDatabase, Field::Get(), ObjectGuid::GetCounter(), PHASEMASK_NORMAL, PreparedStatementBase::SetData(), sMapMgr, and sMapStore.

Referenced by Guild::Member::LoadFromDB().

◆ GiveLevel()

void Player::GiveLevel ( uint8  level)
Todo:
find some better solution
2432{
2433 uint8 oldLevel = GetLevel();
2434 if (level == oldLevel)
2435 return;
2436
2437 if (Guild* guild = GetGuild())
2438 guild->UpdateMemberData(this, GUILD_MEMBER_DATA_LEVEL, level);
2439
2440 PlayerLevelInfo info;
2441 sObjectMgr->GetPlayerLevelInfo(getRace(true), getClass(), level, &info);
2442
2443 PlayerClassLevelInfo classInfo;
2444 sObjectMgr->GetPlayerClassLevelInfo(getClass(), level, &classInfo);
2445
2447 packet.Level = level;
2448 packet.HealthDelta = int32(classInfo.basehealth) - int32(GetCreateHealth());
2449
2451 // for (int i = 0; i < MAX_POWERS; ++i)
2452 packet.PowerDelta[0] = int32(classInfo.basemana) - int32(GetCreateMana());
2453 packet.PowerDelta[1] = 0;
2454 packet.PowerDelta[2] = 0;
2455 packet.PowerDelta[3] = 0;
2456 packet.PowerDelta[4] = 0;
2457 packet.PowerDelta[5] = 0;
2458
2459 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
2460 packet.StatDelta[i] = int32(info.stats[i]) - GetCreateStat(Stats(i));
2461
2462 SendDirectMessage(packet.Write());
2463
2464 SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr->GetXPForLevel(level));
2465
2466 //update level, max level of skills
2467 m_Played_time[PLAYED_TIME_LEVEL] = 0; // Level Played Time reset
2468
2470
2471 SetLevel(level);
2472
2474
2475 // save base values (bonuses already included in stored stats
2476 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
2477 SetCreateStat(Stats(i), info.stats[i]);
2478
2479 SetCreateHealth(classInfo.basehealth);
2480 SetCreateMana(classInfo.basemana);
2481
2485
2487
2488 if (sWorld->getBoolConfig(CONFIG_ALWAYS_MAXSKILL)) // Max weapon skill when leveling up
2490
2492
2493 // set current level health and mana/energy to maximum after applying all mods.
2494 SetFullHealth();
2501
2502 // update level to hunter/summon pet
2503 if (Pet* pet = GetPet())
2504 pet->SynchronizeLevelWithOwner();
2505
2506 MailLevelReward const* mailReward = sObjectMgr->GetMailLevelReward(level, getRaceMask());
2507 if (mailReward && sScriptMgr->CanGiveMailRewardAtGiveLevel(this, level))
2508 {
2509 //- TODO: Poor design of mail system
2510 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
2511 MailDraft(mailReward->mailTemplateId).SendMailTo(trans, this, MailSender(MAIL_CREATURE, mailReward->senderEntry));
2512 CharacterDatabase.CommitTransaction(trans);
2513 }
2514
2516
2517 // Refer-A-Friend
2518 if (GetSession()->GetRecruiterId())
2519 if (level < sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL))
2520 if (level % 2 == 0)
2521 {
2523
2524 if (!HasByteFlag(PLAYER_FIELD_BYTES, 1, 0x01))
2526 }
2527
2529
2530 sScriptMgr->OnPlayerLevelChanged(this, oldLevel);
2531}
@ PLAYER_NEXT_LEVEL_XP
Definition: UpdateFields.h:340
@ GUILD_MEMBER_DATA_LEVEL
Definition: Guild.h:62
@ CONFIG_ALWAYS_MAXSKILL
Definition: IWorld.h:133
@ ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL
Definition: DBCEnums.h:132
@ POWER_RAGE
Definition: SharedDefines.h:270
@ POWER_HAPPINESS
Definition: SharedDefines.h:273
@ POWER_ENERGY
Definition: SharedDefines.h:272
@ POWER_FOCUS
Definition: SharedDefines.h:271
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
Definition: Object.cpp:949
Definition: Player.h:290
uint32 basehealth
Definition: Player.h:292
uint32 basemana
Definition: Player.h:293
Definition: Player.h:304
std::array< uint32, MAX_STATS > stats
Definition: Player.h:310
void _ApplyAllLevelScaleItemMods(bool apply)
Definition: Player.cpp:7524
void UpdateSkillsToMaxSkillsForLevel()
Definition: PlayerUpdates.cpp:1089
Guild * GetGuild() const
Definition: Player.cpp:15923
void UpdateSkillsForLevel()
Definition: PlayerUpdates.cpp:1038
void SendQuestGiverStatusMultiple()
Definition: Player.cpp:7601
void SetCreateStat(Stats stat, float val)
Definition: Unit.h:2051
void SetCreateHealth(uint32 val)
Definition: Unit.h:2052
void SetCreateMana(uint32 val)
Definition: Unit.h:2054
void SetLevel(uint8 lvl, bool showLevelChange=true)
Definition: Unit.cpp:15446
uint32 GetCreateHealth() const
Definition: Unit.h:2053
uint32 GetCreateMana() const
Definition: Unit.h:2055
Definition: ObjectMgr.h:537
uint32 senderEntry
Definition: ObjectMgr.h:543
uint32 mailTemplateId
Definition: ObjectMgr.h:542
Definition: MiscPackets.h:45
uint32 Level
Definition: MiscPackets.h:51
std::array< uint32, MAX_STATS > StatDelta
Definition: MiscPackets.h:54
std::array< uint32, MAX_POWERS > PowerDelta
Definition: MiscPackets.h:53
uint32 HealthDelta
Definition: MiscPackets.h:52
WorldPacket const * Write() override
Definition: MiscPackets.cpp:34

References _ApplyAllLevelScaleItemMods(), ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL, PlayerClassLevelInfo::basehealth, PlayerClassLevelInfo::basemana, CharacterDatabase, CONFIG_ALWAYS_MAXSKILL, CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL, Unit::getClass(), Unit::GetCreateHealth(), Unit::GetCreateMana(), Unit::GetCreateStat(), GetGuild(), Unit::GetLevel(), Unit::GetMaxPower(), GetPet(), Unit::GetPower(), Unit::getRace(), Unit::getRaceMask(), GetSession(), GUILD_MEMBER_DATA_LEVEL, Object::HasByteFlag(), WorldPackets::Misc::LevelUpInfo::HealthDelta, InitGlyphsForLevel(), InitTalentForLevel(), InitTaxiNodesForLevel(), WorldPackets::Misc::LevelUpInfo::Level, m_grantableLevels, m_Played_time, MAIL_CREATURE, MailLevelReward::mailTemplateId, MAX_STATS, PLAYED_TIME_LEVEL, PLAYER_FIELD_BYTES, PLAYER_NEXT_LEVEL_XP, POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_MANA, POWER_RAGE, WorldPackets::Misc::LevelUpInfo::PowerDelta, SendDirectMessage(), MailLevelReward::senderEntry, MailDraft::SendMailTo(), SendQuestGiverStatusMultiple(), Object::SetByteFlag(), Unit::SetCreateHealth(), Unit::SetCreateMana(), Unit::SetCreateStat(), Unit::SetFullHealth(), Unit::SetLevel(), Unit::SetPower(), Object::SetUInt32Value(), sObjectMgr, sScriptMgr, STAT_STRENGTH, WorldPackets::Misc::LevelUpInfo::StatDelta, PlayerLevelInfo::stats, sWorld, UpdateAchievementCriteria(), UpdateAllStats(), UpdateSkillsForLevel(), UpdateSkillsToMaxSkillsForLevel(), and WorldPackets::Misc::LevelUpInfo::Write().

Referenced by GiveXP(), WorldSession::HandleAcceptGrantLevel(), and character_commandscript::HandleCharacterLevel().

◆ GiveQuestSourceItem()

bool Player::GiveQuestSourceItem ( Quest const *  quest)
1335{
1336 uint32 srcitem = quest->GetSrcItemId();
1337 if (srcitem > 0)
1338 {
1339 uint32 count = quest->GetSrcItemCount();
1340 if (count <= 0)
1341 count = 1;
1342
1343 ItemPosCountVec dest;
1344 InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, srcitem, count);
1345 if (msg == EQUIP_ERR_OK)
1346 {
1347 Item* item = StoreNewItem(dest, srcitem, true);
1348 SendNewItem(item, count, true, false);
1349 return true;
1350 }
1351 // player already have max amount required item, just report success
1352 else if (msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS)
1353 return true;
1354 else
1355 SendEquipError(msg, nullptr, nullptr, srcitem);
1356 return false;
1357 }
1358
1359 return true;
1360}

References CanStoreNewItem(), EQUIP_ERR_CANT_CARRY_MORE_OF_THIS, EQUIP_ERR_OK, Quest::GetSrcItemCount(), Quest::GetSrcItemId(), NULL_BAG, NULL_SLOT, SendEquipError(), SendNewItem(), and StoreNewItem().

Referenced by AddQuest().

◆ GiveXP()

void Player::GiveXP ( uint32  xp,
Unit victim,
float  group_rate = 1.0f,
bool  isLFGReward = false 
)
2357{
2358 if (xp < 1)
2359 {
2360 return;
2361 }
2362
2363 if (!IsAlive() && !GetBattlegroundId() && !isLFGReward)
2364 {
2365 return;
2366 }
2367
2369 {
2370 return;
2371 }
2372
2373 if (victim && victim->GetTypeId() == TYPEID_UNIT && !victim->ToCreature()->hasLootRecipient())
2374 {
2375 return;
2376 }
2377
2378 uint8 level = GetLevel();
2379
2380 // Favored experience increase START
2381 uint32 zone = GetZoneId();
2382 float favored_exp_mult = 0;
2383 if ((zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714) && (HasAura(32096) || HasAura(32098)))
2384 favored_exp_mult = 0.05f; // Thrallmar's Favor and Honor Hold's Favor
2385
2386 xp = uint32(xp * (1 + favored_exp_mult));
2387 // Favored experience increase END
2388
2389 // XP to money conversion processed in Player::RewardQuest
2390 if (level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
2391 return;
2392
2393 uint32 bonus_xp = 0;
2394 bool recruitAFriend = GetsRecruitAFriendBonus(true);
2395
2396 // RaF does NOT stack with rested experience
2397 if (recruitAFriend)
2398 bonus_xp = 2 * xp; // xp + bonus_xp must add up to 3 * xp for RaF; calculation for quests done client-side
2399 else
2400 bonus_xp = victim ? GetXPRestBonus(xp) : 0; // XP resting bonus
2401
2402 // hooks and multipliers can modify the xp with a zero or negative value
2403 // check again before sending invalid xp to the client
2404 if (xp < 1)
2405 {
2406 return;
2407 }
2408
2409 SendLogXPGain(xp, victim, bonus_xp, recruitAFriend, group_rate);
2410
2413 uint32 newXP = curXP + xp + bonus_xp;
2414
2415 while (newXP >= nextLvlXP && level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
2416 {
2417 newXP -= nextLvlXP;
2418
2419 if (level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
2420 GiveLevel(level + 1);
2421
2422 level = GetLevel();
2424 }
2425
2426 SetUInt32Value(PLAYER_XP, newXP);
2427}
@ PLAYER_FLAGS_NO_XP_GAIN
Definition: Player.h:500
bool hasLootRecipient() const
Definition: Creature.h:225
void GiveLevel(uint8 level)
Definition: Player.cpp:2431
uint32 GetXPRestBonus(uint32 xp)
Definition: Player.cpp:8771
void SendLogXPGain(uint32 GivenXP, Unit *victim, uint32 BonusXP, bool recruitAFriend=false, float group_rate=1.0f)
Definition: Player.cpp:2337

References CONFIG_MAX_PLAYER_LEVEL, GetBattlegroundId(), Unit::GetLevel(), GetsRecruitAFriendBonus(), Object::GetTypeId(), Object::GetUInt32Value(), GetXPRestBonus(), WorldObject::GetZoneId(), GiveLevel(), Unit::HasAura(), Creature::hasLootRecipient(), HasPlayerFlag(), Unit::IsAlive(), PLAYER_FLAGS_NO_XP_GAIN, PLAYER_NEXT_LEVEL_XP, PLAYER_XP, SendLogXPGain(), Object::SetUInt32Value(), sWorld, Object::ToCreature(), and TYPEID_UNIT.

Referenced by KillRewarder::_RewardXP(), CheckAreaExploreAndOutdoor(), RewardHonor(), and RewardQuest().

◆ GroupEventHappens()

void Player::GroupEventHappens ( uint32  questId,
WorldObject const *  pEventObject 
)
1805{
1806 if (Group* group = GetGroup())
1807 {
1808 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
1809 {
1810 Player* player = itr->GetSource();
1811
1812 // for any leave or dead (with not released body) group member at appropriate distance
1813 if (player && player->IsAtGroupRewardDistance(pEventObject) && !player->GetCorpse())
1814 player->AreaExploredOrEventHappens(questId);
1815 }
1816 }
1817 else
1819}
bool IsAtGroupRewardDistance(WorldObject const *pRewardSource) const
Definition: Player.cpp:12678
void AreaExploredOrEventHappens(uint32 questId)
Definition: PlayerQuest.cpp:1777

References AreaExploredOrEventHappens(), GetCorpse(), GetGroup(), IsAtGroupRewardDistance(), and GroupReference::next().

Referenced by SmartAI::EndPath(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), spell_image_of_drakuru_reagent_check::HandleDummyEffect(), npc_tooga::npc_toogaAI::MoveInLineOfSight(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), Map::ScriptsProcess(), SmartAI::StopFollow(), npc_crusade_persuaded::npc_crusade_persuadedAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_elder_kekek::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::WaypointReached(), npc_ranger_lilatha::WaypointReached(), npc_rinji::npc_rinjiAI::WaypointReached(), npc_corporal_keeshan::npc_corporal_keeshanAI::WaypointReached(), npc_deathstalker_erland::npc_deathstalker_erlandAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_kaya_flathoof::npc_kaya_flathoofAI::WaypointReached(), npc_gilthares::npc_giltharesAI::WaypointReached(), npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached(), npc_bonker_togglevolt::npc_bonker_togglevoltAI::WaypointReached(), npc_emily::npc_emilyAI::WaypointReached(), npc_apothecary_hanes::npc_Apothecary_HanesAI::WaypointReached(), npc_engineer_helice::npc_engineer_heliceAI::WaypointReached(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::WaypointReached(), npc_bessy::npc_bessyAI::WaypointReached(), npc_kservant::npc_kservantAI::WaypointReached(), and npc_isla_starmane::npc_isla_starmaneAI::WaypointReached().

◆ HandleBaseModValue()

void Player::HandleBaseModValue ( BaseModGroup  modGroup,
BaseModType  modType,
float  amount,
bool  apply 
)
4934{
4935 if (modGroup >= BASEMOD_END)
4936 {
4937 LOG_ERROR("entities.player", "ERROR in HandleBaseModValue(): non existed BaseModGroup!");
4938 return;
4939 }
4940
4941 switch (modType)
4942 {
4943 case FLAT_MOD:
4944 m_auraBaseMod[modGroup][modType] += apply ? amount : -amount;
4945 break;
4946 case PCT_MOD:
4947 ApplyPercentModFloatVar(m_auraBaseMod[modGroup][modType], amount, apply);
4948 break;
4949 }
4950
4951 if (!CanModifyStats())
4952 return;
4953
4954 switch (modGroup)
4955 {
4956 case CRIT_PERCENTAGE:
4958 break;
4961 break;
4964 break;
4965 case SHIELD_BLOCK_VALUE:
4967 break;
4968 default:
4969 break;
4970 }
4971}
void ApplyPercentModFloatVar(float &var, float val, bool apply)
Definition: Util.h:50
void UpdateShieldBlockValue()
Definition: StatSystem.cpp:529
void UpdateCritPercentage(WeaponAttackType attType)
Definition: StatSystem.cpp:648

References ApplyPercentModFloatVar(), BASE_ATTACK, BASEMOD_END, Unit::CanModifyStats(), CRIT_PERCENTAGE, FLAT_MOD, LOG_ERROR, m_auraBaseMod, OFF_ATTACK, OFFHAND_CRIT_PERCENTAGE, PCT_MOD, RANGED_ATTACK, RANGED_CRIT_PERCENTAGE, SHIELD_BLOCK_VALUE, UpdateCritPercentage(), and UpdateShieldBlockValue().

Referenced by _ApplyItemBonuses(), _ApplyWeaponDependentAuraCritMod(), ApplyEnchantment(), AuraEffect::HandleAuraModCritPct(), AuraEffect::HandleAuraModWeaponCritPercent(), and AuraEffect::HandleShieldBlockValue().

◆ HandleDrowning()

void Player::HandleDrowning ( uint32  time_diff)
protected
Todo:
: Check this formula
Todo:
: Check this formula
836{
838 return;
839
840 // In water
842 {
843 // Breath timer not activated - activate it
845 {
848 }
849 else // If activated - do tick
850 {
851 m_MirrorTimer[BREATH_TIMER] -= time_diff;
852 // Timer limit - need deal damage
854 {
856 // Calculate and deal damage
858 uint32 damage = GetMaxHealth() / 5 + urand(0, GetLevel() - 1);
860 }
861 else if (!(m_MirrorTimerFlagsLast & UNDERWATER_INWATER)) // Update time in client if need
863 }
864 }
865 else if (m_MirrorTimer[BREATH_TIMER] != DISABLED_MIRROR_TIMER) // Regen timer
866 {
867 int32 UnderWaterTime = getMaxTimer(BREATH_TIMER);
868 // Need breath regen
869 m_MirrorTimer[BREATH_TIMER] += 10 * time_diff;
870 if (m_MirrorTimer[BREATH_TIMER] >= UnderWaterTime || !IsAlive())
874 }
875
876 // In dark water
878 {
879 // Fatigue timer not activated - activate it
881 {
884 }
885 else
886 {
887 m_MirrorTimer[FATIGUE_TIMER] -= time_diff;
888 // Timer limit - need deal damage or teleport ghost to graveyard
890 {
892 if (IsAlive()) // Calculate and deal damage
893 {
894 uint32 damage = GetMaxHealth() / 5 + urand(0, GetLevel() - 1);
896 }
897 else if (HasPlayerFlag(PLAYER_FLAGS_GHOST)) // Teleport ghost to graveyard
899 }
902 }
903 }
904 else if (m_MirrorTimer[FATIGUE_TIMER] != DISABLED_MIRROR_TIMER) // Regen timer
905 {
906 int32 DarkWaterTime = getMaxTimer(FATIGUE_TIMER);
907 m_MirrorTimer[FATIGUE_TIMER] += 10 * time_diff;
908 if (m_MirrorTimer[FATIGUE_TIMER] >= DarkWaterTime || !IsAlive())
912 }
913
914 if (m_MirrorTimerFlags & (UNDERWATER_INLAVA /*| UNDERWATER_INSLIME*/) && !(_lastLiquid && _lastLiquid->SpellId))
915 {
916 // Breath timer not activated - activate it
919 else
920 {
921 m_MirrorTimer[FIRE_TIMER] -= time_diff;
922 if (m_MirrorTimer[FIRE_TIMER] < 0)
923 {
924 m_MirrorTimer[FIRE_TIMER] += 2020;
925 // Calculate and deal damage
927 uint32 damage = urand(600, 700);
930 // need to skip Slime damage in Undercity,
931 // maybe someone can find better way to handle environmental damage
932 //else if (m_zoneUpdateId != 1497)
933 // EnvironmentalDamage(DAMAGE_SLIME, damage);
934 }
935 }
936 }
937 else
939
940 // Recheck timers flag
941 m_MirrorTimerFlags &= ~UNDERWATER_EXIST_TIMERS;
942 for (uint8 i = 0; i < MAX_TIMERS; ++i)
944 {
946 break;
947 }
949}
@ DAMAGE_DROWNING
Definition: Player.h:828
@ DAMAGE_EXHAUSTED
Definition: Player.h:827
@ UNDERWATER_INDARKWATER
Definition: Player.h:105
@ UNDERWATER_EXIST_TIMERS
Definition: Player.h:107
@ UNDERWATER_INWATER
Definition: Player.h:102
@ UNDERWATER_INLAVA
Definition: Player.h:103
void SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen)
Definition: Player.cpp:732
uint32 EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
Definition: Player.cpp:755
void RepopAtGraveyard()
Definition: Player.cpp:4834
int32 getMaxTimer(MirrorTimerType timer)
Definition: Player.cpp:808
void StopMirrorTimer(MirrorTimerType Type)
Definition: Player.cpp:743
LiquidTypeEntry const * _lastLiquid
Definition: Unit.h:2552
uint32 SpellId
Definition: DBCStructure.h:1287

References Unit::_lastLiquid, BREATH_TIMER, DAMAGE_DROWNING, DAMAGE_EXHAUSTED, DAMAGE_LAVA, DISABLED_MIRROR_TIMER, EnvironmentalDamage(), FATIGUE_TIMER, FIRE_TIMER, Unit::GetLevel(), Unit::GetMaxHealth(), getMaxTimer(), HasPlayerFlag(), IN_MILLISECONDS, Unit::IsAlive(), m_MirrorTimer, m_MirrorTimerFlags, m_MirrorTimerFlagsLast, MAX_TIMERS, PLAYER_FLAGS_GHOST, RepopAtGraveyard(), SendMirrorTimer(), LiquidTypeEntry::SpellId, StopMirrorTimer(), UNDERWATER_EXIST_TIMERS, UNDERWATER_INDARKWATER, UNDERWATER_INLAVA, UNDERWATER_INWATER, and urand().

Referenced by Update().

◆ HandleFall()

void Player::HandleFall ( MovementInfo const &  movementInfo)
13764{
13765 // calculate total z distance of the fall
13766 float z_diff = m_lastFallZ - movementInfo.pos.GetPositionZ();
13767
13768 //Players with low fall distance, Feather Fall or physical immunity (charges used) are ignored
13769 // 14.57 can be calculated by resolving damageperc formula below to 0
13770 if (z_diff >= 14.57f && !isDead() && !IsGameMaster() && !GetCommandStatus(CHEAT_GOD) &&
13773 {
13774 //Safe fall, fall height reduction
13776
13777 float damageperc = 0.018f * (z_diff - safe_fall) - 0.2426f;
13778 uint32 original_health = GetHealth(), final_damage = 0;
13779
13781 {
13782 uint32 damage = (uint32)(damageperc * GetMaxHealth() * sWorld->getRate(RATE_DAMAGE_FALL));
13783
13784 //float height = movementInfo.pos.m_positionZ;
13785 //UpdateGroundPositionZ(movementInfo.pos.m_positionX, movementInfo.pos.m_positionY, height);
13786
13787 if (damage > 0)
13788 {
13789 //Prevent fall damage from being more than the player maximum health
13790 if (damage > GetMaxHealth())
13791 damage = GetMaxHealth();
13792
13793 // Gust of Wind
13794 if (HasAura(43621))
13795 damage = GetMaxHealth() / 2;
13796
13797 // Divine Protection
13798 if (HasAura(498))
13799 {
13800 damage /= 2;
13801 }
13802
13803 final_damage = EnvironmentalDamage(DAMAGE_FALL, damage);
13804 }
13805
13806 //Z given by moveinfo, LastZ, FallTime, WaterZ, MapZ, Damage, Safefall reduction
13807 LOG_DEBUG("entities.player", "FALLDAMAGE mZ={} z={} fallTime={} damage={} SF={}", movementInfo.pos.GetPositionZ(), GetPositionZ(), movementInfo.fallTime, damage, safe_fall);
13808 }
13809
13810 // recheck alive, might have died of EnvironmentalDamage, avoid cases when player die in fact like Spirit of Redemption case
13811 if (IsAlive() && final_damage < original_health)
13813 }
13814}
@ CHEAT_GOD
Definition: Player.h:991
@ SPELL_AURA_FLY
Definition: SpellAuraDefines.h:264
@ SPELL_AURA_SAFE_FALL
Definition: SpellAuraDefines.h:207
@ RATE_DAMAGE_FALL
Definition: IWorld.h:500
@ ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING
Definition: DBCEnums.h:147
bool GetCommandStatus(uint32 command) const
Definition: Player.h:1166
bool IsImmunedToDamageOrSchool(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:12895
bool isDead() const
Definition: Unit.h:1824

References ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING, CHEAT_GOD, DAMAGE_FALL, EnvironmentalDamage(), MovementInfo::fallTime, GetCommandStatus(), Unit::GetHealth(), Unit::GetMaxHealth(), Position::GetPositionZ(), Unit::GetTotalAuraModifier(), Unit::HasAura(), Unit::HasAuraType(), Unit::IsAlive(), Unit::isDead(), IsGameMaster(), Unit::IsImmunedToDamageOrSchool(), LOG_DEBUG, m_lastFallZ, MovementInfo::pos, RATE_DAMAGE_FALL, SPELL_AURA_FEATHER_FALL, SPELL_AURA_FLY, SPELL_AURA_HOVER, SPELL_AURA_SAFE_FALL, SPELL_SCHOOL_MASK_NORMAL, sWorld, and UpdateAchievementCriteria().

Referenced by WorldSession::HandleMovementOpcodes().

◆ HandleSobering()

void Player::HandleSobering ( )
protected

The player sobers by 1% every 9 seconds.

953{
954 m_drunkTimer = 0;
955
956 uint8 currentDrunkValue = GetDrunkValue();
957 uint8 drunk = currentDrunkValue ? --currentDrunkValue : 0;
958 SetDrunkValue(drunk);
959}
void SetDrunkValue(uint8 newDrunkValue, uint32 itemId=0)
Definition: Player.cpp:972

References GetDrunkValue(), m_drunkTimer, and SetDrunkValue().

Referenced by Update().

◆ Has310Flyer()

bool Player::Has310Flyer ( bool  checkAllSpells,
uint32  excludeSpellId = 0 
)
3438{
3439 if (!checkAllSpells)
3441 else
3442 {
3443 SetHas310Flyer(false);
3444 SpellInfo const* spellInfo;
3445 for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
3446 {
3447 // pussywizard:
3448 if (itr->second->State == PLAYERSPELL_REMOVED)
3449 continue;
3450
3451 if (itr->first == excludeSpellId)
3452 continue;
3453
3454 SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(itr->first);
3455 for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
3456 {
3457 if (_spell_idx->second->SkillLine != SKILL_MOUNTS)
3458 break; // We can break because mount spells belong only to one skillline (at least 310 flyers do)
3459
3460 spellInfo = sSpellMgr->AssertSpellInfo(itr->first);
3461 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3462 if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
3463 spellInfo->Effects[i].CalcValue() == 310)
3464 {
3465 SetHas310Flyer(true);
3466 return true;
3467 }
3468 }
3469 }
3470 }
3471
3472 return false;
3473}
@ PLAYER_EXTRA_HAS_310_FLYER
Definition: Player.h:591

References SpellInfo::Effects, m_ExtraFlags, m_spells, MAX_SPELL_EFFECTS, PLAYER_EXTRA_HAS_310_FLYER, PLAYERSPELL_REMOVED, SetHas310Flyer(), SKILL_MOUNTS, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, and sSpellMgr.

Referenced by _addSpell(), and removeSpell().

◆ HasAchieved()

bool Player::HasAchieved ( uint32  achievementId) const
13832{
13833 return m_achievementMgr->HasAchieved(achievementId);
13834}
bool HasAchieved(uint32 achievementId) const
Definition: AchievementMgr.cpp:2391

References AchievementMgr::HasAchieved(), and m_achievementMgr.

Referenced by _LoadBrewOfTheMonth(), spell_gen_on_tournament_mount::GetPennatSpellId(), BattlegroundIC::HandleAreaTrigger(), lfg::LFGMgr::InitializeLockedDungeons(), and Satisfy().

◆ HasActiveSpell()

bool Player::HasActiveSpell ( uint32  spell) const
3844{
3845 PlayerSpellMap::const_iterator itr = m_spells.find(spell);
3846 return (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->Active && itr->second->IsInSpec(m_activeSpec));
3847}

References m_activeSpec, m_spells, and PLAYERSPELL_REMOVED.

Referenced by _AddSpellCooldown(), ActivateSpec(), spell_dk_dancing_rune_weapon::CheckProc(), WorldSession::HandleCastSpellOpcode(), and learnSpell().

◆ HasAtLoginFlag()

◆ HasCasterSpec()

bool Player::HasCasterSpec ( )
16028{
16029 switch (GetSpec(GetActiveSpec()))
16030 {
16043 return true;
16044 default:
16045 break;
16046 }
16047 return false;
16048}
@ TALENT_TREE_HUNTER_SURVIVAL
Definition: Player.h:154
@ TALENT_TREE_MAGE_FIRE
Definition: Player.h:168
@ TALENT_TREE_PRIEST_SHADOW
Definition: Player.h:160
@ TALENT_TREE_SHAMAN_ELEMENTAL
Definition: Player.h:164
@ TALENT_TREE_HUNTER_BEAST_MASTERY
Definition: Player.h:152
@ TALENT_TREE_WARLOCK_DEMONOLOGY
Definition: Player.h:171
@ TALENT_TREE_WARLOCK_DESTRUCTION
Definition: Player.h:172
@ TALENT_TREE_WARLOCK_AFFLICTION
Definition: Player.h:170
@ TALENT_TREE_MAGE_ARCANE
Definition: Player.h:167
@ TALENT_TREE_MAGE_FROST
Definition: Player.h:169
@ TALENT_TREE_DRUID_BALANCE
Definition: Player.h:173
@ TALENT_TREE_HUNTER_MARKSMANSHIP
Definition: Player.h:153
uint32 GetSpec(int8 spec=-1)
Definition: Player.cpp:15929

References GetActiveSpec(), GetSpec(), TALENT_TREE_DRUID_BALANCE, TALENT_TREE_HUNTER_BEAST_MASTERY, TALENT_TREE_HUNTER_MARKSMANSHIP, TALENT_TREE_HUNTER_SURVIVAL, TALENT_TREE_MAGE_ARCANE, TALENT_TREE_MAGE_FIRE, TALENT_TREE_MAGE_FROST, TALENT_TREE_PRIEST_SHADOW, TALENT_TREE_SHAMAN_ELEMENTAL, TALENT_TREE_WARLOCK_AFFLICTION, TALENT_TREE_WARLOCK_DEMONOLOGY, and TALENT_TREE_WARLOCK_DESTRUCTION.

◆ HasCorpse()

◆ HasDelayedTeleport()

bool Player::HasDelayedTeleport ( ) const
inlineprivate
2896{ return m_bHasDelayedTeleport; }

References m_bHasDelayedTeleport.

Referenced by Update().

◆ HasEnoughMoney() [1/2]

bool Player::HasEnoughMoney ( int32  amount) const
inline
1584 {
1585 if (amount > 0)
1586 return (GetMoney() >= (uint32) amount);
1587 return true;
1588 }

References GetMoney().

◆ HasEnoughMoney() [2/2]

◆ HasFreeBattlegroundQueueId()

bool Player::HasFreeBattlegroundQueueId ( ) const

◆ HasHealSpec()

bool Player::HasHealSpec ( )
16051{
16052 switch (GetSpec(GetActiveSpec()))
16053 {
16059 return true;
16060 default:
16061 break;
16062 }
16063 return false;
16064}
@ TALENT_TREE_DRUID_RESTORATION
Definition: Player.h:175
@ TALENT_TREE_SHAMAN_RESTORATION
Definition: Player.h:166
@ TALENT_TREE_PRIEST_HOLY
Definition: Player.h:159
@ TALENT_TREE_PALADIN_HOLY
Definition: Player.h:149
@ TALENT_TREE_PRIEST_DISCIPLINE
Definition: Player.h:158

References GetActiveSpec(), GetSpec(), TALENT_TREE_DRUID_RESTORATION, TALENT_TREE_PALADIN_HOLY, TALENT_TREE_PRIEST_DISCIPLINE, TALENT_TREE_PRIEST_HOLY, and TALENT_TREE_SHAMAN_RESTORATION.

◆ HasItemCount()

bool Player::HasItemCount ( uint32  item,
uint32  count = 1,
bool  inBankAlso = false 
) const
684{
685 uint32 tempcount = 0;
687 {
689 if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade())
690 {
691 tempcount += pItem->GetCount();
692 if (tempcount >= count)
693 return true;
694 }
695 }
697 {
699 if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade())
700 {
701 tempcount += pItem->GetCount();
702 if (tempcount >= count)
703 return true;
704 }
705 }
707 {
708 if (Bag* pBag = GetBagByPos(i))
709 {
710 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
711 {
712 Item* pItem = GetItemByPos(i, j);
713 if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade())
714 {
715 tempcount += pItem->GetCount();
716 if (tempcount >= count)
717 return true;
718 }
719 }
720 }
721 }
722
723 if (inBankAlso)
724 {
726 {
728 if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade())
729 {
730 tempcount += pItem->GetCount();
731 if (tempcount >= count)
732 return true;
733 }
734 }
736 {
737 if (Bag* pBag = GetBagByPos(i))
738 {
739 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
740 {
741 Item* pItem = GetItemByPos(i, j);
742 if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade())
743 {
744 tempcount += pItem->GetCount();
745 if (tempcount >= count)
746 return true;
747 }
748 }
749 }
750 }
751 }
752
753 return false;
754}

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_END, BANK_SLOT_ITEM_START, CURRENCYTOKEN_SLOT_END, EQUIPMENT_SLOT_START, GetBagByPos(), Item::GetCount(), Object::GetEntry(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, Item::IsInTrade(), and KEYRING_SLOT_START.

Referenced by BuyItemFromVendorSlot(), CanCompleteRepeatableQuest(), Spell::CheckItems(), spell_dk_raise_dead::CheckReagents(), Spell::EffectCreateItem2(), GetResurrectionSpellId(), go_soulwell::go_soulwellAI::GossipHello(), go_celestial_planetarium_access::go_celestial_planetarium_accessAI::GossipHello(), misc_commandscript::HandleAddItemCommand(), lfg::LFGMgr::InitializeLockedDungeons(), npc_brewfest_keg_thrower::MoveInLineOfSight(), npc_brewfest_keg_reciver::MoveInLineOfSight(), npc_lokhtos_darkbargainer::OnGossipHello(), npc_tyrande_whisperwind::OnGossipHello(), npc_oculus_drakegiver::OnGossipHello(), npcs_flanis_swiftwing_and_kagrosh::OnGossipHello(), npc_artorius::OnGossipHello(), npc_simone::OnGossipHello(), npc_nelson::OnGossipHello(), npc_franklin::OnGossipHello(), npc_taxi::OnGossipHello(), npc_locksmith::OnGossipHello(), npc_oculus_drakegiver::OnGossipSelect(), npc_cos_chromie_start::OnGossipSelect(), go_apexis_relic::OnGossipSelect(), AreaTrigger_at_voltarus_middle::OnTrigger(), near_scarshield_infiltrator::OnTrigger(), at_scarshield_infiltrator::OnTrigger(), at_twilight_grove::OnTrigger(), NPCStaveQuestAI::QuestIncomplete(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), Satisfy(), npc_aquementas::npc_aquementasAI::SendItem(), npc_maredis_firestar::npc_maredis_firestarAI::sGossipHello(), and Spell::WriteCastResultInfo().

◆ HasItemFitToSpellRequirements()

bool Player::HasItemFitToSpellRequirements ( SpellInfo const *  spellInfo,
Item const *  ignoreItem = nullptr 
) const
12432{
12433 if (spellInfo->EquippedItemClass < 0)
12434 return true;
12435
12436 // scan other equipped items for same requirements (mostly 2 daggers/etc)
12437 // for optimize check 2 used cases only
12438 switch (spellInfo->EquippedItemClass)
12439 {
12440 case ITEM_CLASS_WEAPON:
12441 {
12444 if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
12445 return true;
12446 break;
12447 }
12448 case ITEM_CLASS_ARMOR:
12449 {
12450 // tabard not have dependent spells
12453 if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
12454 return true;
12455
12456 // shields can be equipped to offhand slot
12458 if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
12459 return true;
12460
12461 // ranged slot can have some armor subclasses
12463 if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
12464 return true;
12465
12466 break;
12467 }
12468 default:
12469 LOG_ERROR("entities.player", "HasItemFitToSpellRequirements: Not handled spell requirement for item class {}", spellInfo->EquippedItemClass);
12470 break;
12471 }
12472
12473 return false;
12474}

References EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, EQUIPMENT_SLOT_START, EQUIPMENT_SLOT_TABARD, SpellInfo::EquippedItemClass, GetUseableItemByPos(), INVENTORY_SLOT_BAG_0, Item::IsFitToSpellRequirements(), ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON, and LOG_ERROR.

Referenced by Unit::CalcArmorReducedDamage(), Spell::CheckItems(), and RemoveItemDependentAurasAndCasts().

◆ HasItemOrGemWithIdEquipped()

bool Player::HasItemOrGemWithIdEquipped ( uint32  item,
uint32  count,
uint8  except_slot = NULL_SLOT 
) const
757{
758 uint32 tempcount = 0;
760 {
761 if (i == except_slot)
762 continue;
763
765 if (pItem && pItem->GetEntry() == item)
766 {
767 tempcount += pItem->GetCount();
768 if (tempcount >= count)
769 return true;
770 }
771 }
772
773 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
774 if (pProto && pProto->GemProperties)
775 {
777 {
778 if (i == except_slot)
779 continue;
780
782 if (pItem && pItem->GetTemplate()->Socket[0].Color)
783 {
784 tempcount += pItem->GetGemCountWithID(item);
785 if (tempcount >= count)
786 return true;
787 }
788 }
789 }
790
791 return false;
792}
uint8 GetGemCountWithID(uint32 GemID) const
Definition: Item.cpp:1015

References _Socket::Color, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, ItemTemplate::GemProperties, Item::GetCount(), Object::GetEntry(), Item::GetGemCountWithID(), GetItemByPos(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, sObjectMgr, and ItemTemplate::Socket.

Referenced by npc_eris_hevenfire::npc_eris_hevenfireAI::CanBeSeen(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::CanBeSeen(), CanEquipUniqueItem(), achievement_pb_pilgrims_peril::OnCheck(), and achievement_pb_terokkar_turkey_time::OnCheck().

◆ HasItemOrGemWithLimitCategoryEquipped()

bool Player::HasItemOrGemWithLimitCategoryEquipped ( uint32  limitCategory,
uint32  count,
uint8  except_slot = NULL_SLOT 
) const
795{
796 uint32 tempcount = 0;
798 {
799 if (i == except_slot)
800 continue;
801
803 if (!pItem)
804 continue;
805
806 ItemTemplate const* pProto = pItem->GetTemplate();
807 if (!pProto)
808 continue;
809
810 if (pProto->ItemLimitCategory == limitCategory)
811 {
812 tempcount += pItem->GetCount();
813 if (tempcount >= count)
814 return true;
815 }
816
818 {
819 tempcount += pItem->GetGemCountWithLimitCategory(limitCategory);
820 if (tempcount >= count)
821 return true;
822 }
823 }
824
825 return false;
826}

References _Socket::Color, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, Item::GetCount(), Item::GetEnchantmentId(), Item::GetGemCountWithLimitCategory(), GetItemByPos(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, ItemTemplate::ItemLimitCategory, PRISMATIC_ENCHANTMENT_SLOT, and ItemTemplate::Socket.

Referenced by CanEquipUniqueItem().

◆ HasItemTotemCategory()

bool Player::HasItemTotemCategory ( uint32  TotemCategory) const
880{
881 Item* pItem;
883 {
886 return true;
887 }
889 {
892 return true;
893 }
895 {
896 if (Bag* pBag = GetBagByPos(i))
897 {
898 for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
899 {
900 pItem = GetItemByPos(i, j);
902 return true;
903 }
904 }
905 }
906 return false;
907}
TotemCategory
Definition: SharedDefines.h:3083
bool IsTotemCategoryCompatiableWith(ItemTemplate const *pProto, uint32 requiredTotemCategoryId) const
Definition: PlayerStorage.cpp:909

References CURRENCYTOKEN_SLOT_END, EQUIPMENT_SLOT_START, GetBagByPos(), GetItemByPos(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, IsTotemCategoryCompatiableWith(), and KEYRING_SLOT_START.

Referenced by Spell::CheckItems().

◆ HasMeleeSpec()

bool Player::HasMeleeSpec ( )
16005{
16006 switch (GetSpec(GetActiveSpec()))
16007 {
16017 return true;
16019 if (GetShapeshiftForm() == FORM_CAT)
16020 return true;
16021 default:
16022 break;
16023 }
16024 return false;
16025}
@ TALENT_TREE_DEATH_KNIGHT_FROST
Definition: Player.h:162
@ TALENT_TREE_DRUID_FERAL_COMBAT
Definition: Player.h:174
@ TALENT_TREE_WARRIOR_FURY
Definition: Player.h:147
@ TALENT_TREE_ROGUE_ASSASSINATION
Definition: Player.h:155
@ TALENT_TREE_DEATH_KNIGHT_UNHOLY
Definition: Player.h:163
@ TALENT_TREE_SHAMAN_ENHANCEMENT
Definition: Player.h:165
@ TALENT_TREE_WARRIOR_ARMS
Definition: Player.h:146
@ TALENT_TREE_ROGUE_COMBAT
Definition: Player.h:156
@ TALENT_TREE_PALADIN_RETRIBUTION
Definition: Player.h:151
@ TALENT_TREE_ROGUE_SUBTLETY
Definition: Player.h:157
@ FORM_CAT
Definition: Unit.h:91

References FORM_CAT, GetActiveSpec(), Unit::GetShapeshiftForm(), GetSpec(), TALENT_TREE_DEATH_KNIGHT_FROST, TALENT_TREE_DEATH_KNIGHT_UNHOLY, TALENT_TREE_DRUID_FERAL_COMBAT, TALENT_TREE_PALADIN_RETRIBUTION, TALENT_TREE_ROGUE_ASSASSINATION, TALENT_TREE_ROGUE_COMBAT, TALENT_TREE_ROGUE_SUBTLETY, TALENT_TREE_SHAMAN_ENHANCEMENT, TALENT_TREE_WARRIOR_ARMS, and TALENT_TREE_WARRIOR_FURY.

◆ HasPendingBind()

◆ HasPendingSpectatorForBG()

bool Player::HasPendingSpectatorForBG ( uint32  bgInstanceId) const
inline
2543{ return m_pendingSpectatorForBG == bgInstanceId; }

References m_pendingSpectatorForBG.

Referenced by WorldSession::HandleMoveWorldportAck(), and TeleportTo().

◆ HasPlayerFlag()

◆ HasPvPForcingQuest()

bool Player::HasPvPForcingQuest ( ) const
2482{
2483 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
2484 {
2485 uint32 questId = GetQuestSlotQuestId(i);
2486 if (questId == 0)
2487 continue;
2488
2489 Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
2490 if (!quest)
2491 continue;
2492
2493 if (quest->HasFlag(QUEST_FLAGS_FLAGS_PVP))
2494 return true;
2495 }
2496
2497 return false;
2498}

References GetQuestSlotQuestId(), Quest::HasFlag(), MAX_QUEST_LOG_SIZE, QUEST_FLAGS_FLAGS_PVP, and sObjectMgr.

Referenced by Spell::EffectQuestClear(), WorldSession::HandleQuestLogRemoveQuest(), RewardQuest(), and UpdateZone().

◆ HasQuest()

bool Player::HasQuest ( uint32  questId) const
102{
103 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
104 {
105 uint32 questid = GetQuestSlotQuestId(i);
106 if (questid == questId)
107 {
108 return true;
109 }
110 }
111
112 return false;
113}

References GetQuestSlotQuestId(), and MAX_QUEST_LOG_SIZE.

◆ HasQuestForGO()

bool Player::HasQuestForGO ( int32  GOId) const
12304{
12305 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
12306 {
12307 uint32 questid = GetQuestSlotQuestId(i);
12308 if (questid == 0)
12309 continue;
12310
12311 QuestStatusMap::const_iterator qs_itr = m_QuestStatus.find(questid);
12312 if (qs_itr == m_QuestStatus.end())
12313 continue;
12314
12315 QuestStatusData const& qs = qs_itr->second;
12316
12318 {
12319 Quest const* qinfo = sObjectMgr->GetQuestTemplate(questid);
12320 if (!qinfo)
12321 continue;
12322
12323 if (GetGroup() && GetGroup()->isRaidGroup() && !qinfo->IsAllowedInRaid(GetMap()->GetDifficulty()))
12324 continue;
12325
12326 for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
12327 {
12328 if (qinfo->RequiredNpcOrGo[j] >= 0) //skip non GO case
12329 continue;
12330
12331 if ((-1)*GOId == qinfo->RequiredNpcOrGo[j] && qs.CreatureOrGOCount[j] < qinfo->RequiredNpcOrGoCount[j])
12332 return true;
12333 }
12334 }
12335 }
12336 return false;
12337}
Difficulty GetDifficulty(bool isRaid) const
Definition: Player.h:1883
bool IsAllowedInRaid(Difficulty difficulty) const
Definition: QuestDef.cpp:293

References QuestStatusData::CreatureOrGOCount, GetDifficulty(), GetGroup(), WorldObject::GetMap(), GetQuestSlotQuestId(), Quest::IsAllowedInRaid(), m_QuestStatus, MAX_QUEST_LOG_SIZE, QUEST_OBJECTIVES_COUNT, QUEST_STATUS_INCOMPLETE, Quest::RequiredNpcOrGo, Quest::RequiredNpcOrGoCount, sObjectMgr, and QuestStatusData::Status.

Referenced by GameObject::ActivateToQuest().

◆ HasQuestForItem()

bool Player::HasQuestForItem ( uint32  itemId,
uint32  excludeQuestId = 0,
bool  turnIn = false,
bool *  showInLoot = nullptr 
) const
2251{
2252 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
2253 {
2254 uint32 questid = GetQuestSlotQuestId(i);
2255 if (questid == 0 || questid == excludeQuestId)
2256 continue;
2257
2258 QuestStatusMap::const_iterator qs_itr = m_QuestStatus.find(questid);
2259 if (qs_itr == m_QuestStatus.end())
2260 continue;
2261
2262 QuestStatusData const& q_status = qs_itr->second;
2263
2264 if ((q_status.Status == QUEST_STATUS_INCOMPLETE) || (turnIn && q_status.Status == QUEST_STATUS_COMPLETE))
2265 {
2266 Quest const* qinfo = sObjectMgr->GetQuestTemplate(questid);
2267 if (!qinfo)
2268 continue;
2269
2270 // hide quest if player is in raid-group and quest is no raid quest
2271 if (GetGroup() && GetGroup()->isRaidGroup() && !qinfo->IsAllowedInRaid(GetMap()->GetDifficulty()))
2272 {
2273 if (!InBattleground() && !GetGroup()->isBFGroup()) //there are two ways.. we can make every bg-quest a raidquest, or add this code here.. i don't know if this can be exploited by other quests, but i think all other quests depend on a specific area.. but keep this in mind, if something strange happens later
2274 {
2275 continue;
2276 }
2277 }
2278
2279 // There should be no mixed ReqItem/ReqSource drop
2280 // This part for ReqItem drop
2281 for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
2282 {
2283 if (itemid == qinfo->RequiredItemId[j] && q_status.ItemCount[j] < qinfo->RequiredItemCount[j])
2284 {
2285 if (showInLoot)
2286 {
2287 if (GetItemCount(itemid, true) < qinfo->RequiredItemCount[j])
2288 {
2289 return true;
2290 }
2291
2292 *showInLoot = false;
2293 }
2294 else
2295 {
2296 return true;
2297 }
2298 }
2299
2300 if (turnIn && q_status.ItemCount[j] >= qinfo->RequiredItemCount[j])
2301 {
2302 return true;
2303 }
2304 }
2305 // This part - for ReqSource
2306 for (uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j)
2307 {
2308 // examined item is a source item
2309 if (qinfo->ItemDrop[j] == itemid)
2310 {
2311 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid);
2312 uint32 ownedCount = GetItemCount(itemid, true);
2313 // 'unique' item
2314 if ((pProto->MaxCount && int32(ownedCount) < pProto->MaxCount) || (turnIn && int32(ownedCount) >= pProto->MaxCount))
2315 return true;
2316
2317 // allows custom amount drop when not 0
2318 if (qinfo->ItemDropQuantity[j])
2319 {
2320 if ((ownedCount < qinfo->ItemDropQuantity[j]) || (turnIn && ownedCount >= qinfo->ItemDropQuantity[j]))
2321 return true;
2322 }
2323 else if (ownedCount < pProto->GetMaxStackSize())
2324 return true;
2325 }
2326 }
2327 }
2328 }
2329 return false;
2330}
uint32 ItemDropQuantity[QUEST_SOURCE_ITEM_IDS_COUNT]
Definition: QuestDef.h:300
uint32 ItemDrop[QUEST_SOURCE_ITEM_IDS_COUNT]
Definition: QuestDef.h:299
uint32 RequiredItemId[QUEST_ITEM_OBJECTIVES_COUNT]
Definition: QuestDef.h:297

References GetDifficulty(), GetGroup(), GetItemCount(), WorldObject::GetMap(), GetQuestSlotQuestId(), InBattleground(), Quest::IsAllowedInRaid(), QuestStatusData::ItemCount, Quest::ItemDrop, Quest::ItemDropQuantity, m_QuestStatus, MAX_QUEST_LOG_SIZE, ItemTemplate::MaxCount, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SOURCE_ITEM_IDS_COUNT, QUEST_STATUS_COMPLETE, QUEST_STATUS_INCOMPLETE, Quest::RequiredItemCount, Quest::RequiredItemId, sObjectMgr, and QuestStatusData::Status.

Referenced by LootItem::AllowedForPlayer(), LootTemplate::HasQuestDropForPlayer(), LootTemplate::LootGroup::HasQuestDropForPlayer(), at_twilight_grove::OnTrigger(), and RewardQuest().

◆ HasReceivedSpectatorResetFor()

bool Player::HasReceivedSpectatorResetFor ( ObjectGuid  guid)
inline

◆ HasRestFlag()

bool Player::HasRestFlag ( RestFlag  restFlag) const
inline
1185{ return (_restFlagMask & restFlag) != 0; }

References _restFlagMask.

Referenced by Update().

◆ HasSkill()

◆ hasSpanishClient()

bool Player::hasSpanishClient ( )
inline
1078 {
1080 }
@ LOCALE_esES
Definition: Common.h:74
@ LOCALE_esMX
Definition: Common.h:75
LocaleConstant GetSessionDbLocaleIndex() const
Definition: WorldSession.h:500

References GetSession(), WorldSession::GetSessionDbLocaleIndex(), LOCALE_esES, and LOCALE_esMX.

◆ HasSpell()

bool Player::HasSpell ( uint32  spell) const
overridevirtual

Reimplemented from Unit.

3832{
3833 PlayerSpellMap::const_iterator itr = m_spells.find(spell);
3834 return (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(m_activeSpec));
3835}

References m_activeSpec, m_spells, and PLAYERSPELL_REMOVED.

Referenced by ActivateSpec(), AddSpellAndCategoryCooldowns(), LootItem::AllowedForPlayer(), AuctionHouseObject::BuildListAuctionItems(), canCreateExtraItems(), CanCreatePerfectItem(), canFlyInZone(), Group::CanJoinBattlegroundQueue(), npc_engineering_tele_trinket::CanLearn(), CanResummonPet(), CanRollForItemInLFG(), CanUseItem(), Spell::EffectCastButtons(), GetExplicitDiscoverySpell(), GetResurrectionSpellId(), GetSkillDiscoverySpell(), GetStartPosition(), GetTrainerSpellState(), WorldSession::HandleBattlemasterJoinOpcode(), Acore::PlayerCommand::HandleLearnSpellCommand(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupSpellIdCommand(), WorldSession::HandleTrainerBuySpellOpcode(), Acore::PlayerCommand::HandleUnlearnSpellCommand(), npc_prof_alchemy::HasAlchemySpell(), HasDiscoveredAllSpells(), npc_prof_leather::HasLeatherSpecialty(), go_evil_book_for_dummies::HasLeatherSpecialty(), npc_prof_tailor::HasTailorSpell(), npc_prof_blacksmith::HasWeaponSub(), IsActionButtonDataValid(), Creature::IsValidTrainerForPlayer(), learnQuestRewardedSpells(), boss_gloomrel::OnGossipHello(), npc_roxi_ramrocket::OnGossipHello(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), go_evil_book_for_dummies::OnGossipHello(), ProcessCastaction(), resetTalents(), WorldSession::SendTrainerList(), and TeleportTo().

◆ HasSpellCooldown()

◆ HasSpellItemCooldown()

bool Player::HasSpellItemCooldown ( uint32  spell_id,
uint32  itemid 
) const
overridevirtual

Reimplemented from Unit.

16258{
16259 SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
16260 return itr != m_spellCooldowns.end() && itr->second.end > getMSTime() && itr->second.itemid == itemid;
16261}

References getMSTime(), and m_spellCooldowns.

◆ HasSpellMod()

bool Player::HasSpellMod ( SpellModifier mod,
Spell spell 
)
9624{
9625 if (!mod || !spell)
9626 return false;
9627
9628 return spell->m_appliedMods.find(mod->ownerAura) != spell->m_appliedMods.end();
9629}

References Spell::m_appliedMods, and SpellModifier::ownerAura.

Referenced by ApplySpellMod().

◆ HasTalent()

bool Player::HasTalent ( uint32  spell_id,
uint8  spec 
) const
3838{
3839 PlayerTalentMap::const_iterator itr = m_talents.find(spell);
3840 return (itr != m_talents.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(m_activeSpec));
3841}

References m_activeSpec, m_talents, and PLAYERSPELL_REMOVED.

Referenced by ActivateSpec(), GetSpec(), AuraEffect::HandleShapeshiftBoosts(), and LearnTalent().

◆ HasTankSpec()

bool Player::HasTankSpec ( )
15987{
15988 switch (GetSpec())
15989 {
15993 return true;
15996 return true;
15997 break;
15998 default:
15999 break;
16000 }
16001 return false;
16002}
@ TALENT_TREE_DEATH_KNIGHT_BLOOD
Definition: Player.h:161
@ TALENT_TREE_PALADIN_PROTECTION
Definition: Player.h:150
@ TALENT_TREE_WARRIOR_PROTECTION
Definition: Player.h:148
@ FORM_DIREBEAR
Definition: Unit.h:98
@ FORM_BEAR
Definition: Unit.h:95

References FORM_BEAR, FORM_DIREBEAR, Unit::GetShapeshiftForm(), GetSpec(), TALENT_TREE_DEATH_KNIGHT_BLOOD, TALENT_TREE_DRUID_FERAL_COMBAT, TALENT_TREE_PALADIN_PROTECTION, and TALENT_TREE_WARRIOR_PROTECTION.

◆ HasTitle() [1/2]

bool Player::HasTitle ( CharTitlesEntry const *  title) const
inline
2505{ return HasTitle(title->bit_index); }
bool HasTitle(uint32 bitIndex) const
Definition: Player.cpp:13241

References CharTitlesEntry::bit_index, and HasTitle().

Referenced by HasTitle().

◆ HasTitle() [2/2]

bool Player::HasTitle ( uint32  bitIndex) const
13242{
13243 if (bitIndex > MAX_TITLE_INDEX)
13244 return false;
13245
13246 uint32 fieldIndexOffset = bitIndex / 32;
13247 uint32 flag = 1 << (bitIndex % 32);
13248 return HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
13249}
#define MAX_TITLE_INDEX
Definition: Player.h:555

References Object::HasFlag(), MAX_TITLE_INDEX, and PLAYER__FIELD_KNOWN_TITLES.

Referenced by character_commandscript::HandleCharacterTitlesCommand(), lookup_commandscript::HandleLookupTitleCommand(), titles_commandscript::HandleTitlesRemoveCommand(), titles_commandscript::HandleTitlesSetMaskCommand(), LoadFromDB(), and AchievementCriteriaData::Meets().

◆ HaveAtClient() [1/2]

bool Player::HaveAtClient ( ObjectGuid  guid) const
11347{
11348 if (guid == GetGUID())
11349 {
11350 return true;
11351 }
11352
11353 return m_clientGUIDs.find(guid) != m_clientGUIDs.end();
11354}
GuidUnorderedSet m_clientGUIDs
Definition: Player.h:2344

References Object::GetGUID(), and m_clientGUIDs.

◆ HaveAtClient() [2/2]

bool Player::HaveAtClient ( WorldObject const *  u) const
11328{
11329 if (u == this)
11330 {
11331 return true;
11332 }
11333
11334 // Motion Transports are always present in player's client
11335 if (GameObject const* gameobject = u->ToGameObject())
11336 {
11337 if (gameobject->IsMotionTransport())
11338 {
11339 return true;
11340 }
11341 }
11342
11343 return m_clientGUIDs.find(u->GetGUID()) != m_clientGUIDs.end();
11344}

References Object::GetGUID(), m_clientGUIDs, and Object::ToGameObject().

Referenced by Group::AddMember(), WorldObjectChangeAccumulator::BuildPacket(), WorldObject::DestroyForNearbyPlayers(), ArenaSpectator::HandleSpectatorWatchCommand(), Map::SendInitSelf(), Acore::MessageDistDeliverer::SendPacket(), Acore::MessageDistDelivererToHostile::SendPacket(), Unit::SetOwnerGUID(), and UpdateVisibilityOf().

◆ InArena()

bool Player::InArena ( ) const
12219{
12221 if (!bg || !bg->isArena())
12222 return false;
12223
12224 return true;
12225}
bool isArena() const
Definition: Battleground.h:396

References GetBattleground(), and Battleground::isArena().

Referenced by CreateCorpse(), WorldSession::HandleReclaimCorpseOpcode(), WorldSession::HandleUseItemOpcode(), achievement_arena_by_type::OnCheck(), RewardHonor(), and AuraEffect::UpdatePeriodic().

◆ InBattleground()

◆ InBattlegroundQueue()

bool Player::InBattlegroundQueue ( bool  ignoreArena = false) const

◆ InBattlegroundQueueForBattlegroundQueueType()

bool Player::InBattlegroundQueueForBattlegroundQueueType ( BattlegroundQueueTypeId  bgQueueTypeId) const
12161{
12163}
uint32 GetBattlegroundQueueIndex(BattlegroundQueueTypeId bgQueueTypeId) const
Definition: Player.cpp:12142

References GetBattlegroundQueueIndex(), and PLAYER_MAX_BATTLEGROUND_QUEUES.

Referenced by Group::CanJoinBattlegroundQueue(), and WorldSession::HandleBattlemasterJoinOpcode().

◆ IncompleteQuest()

◆ InitDataForForm()

void Player::InitDataForForm ( bool  reapplyMods = false)
10489{
10491
10492 SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(form);
10493 if (ssEntry && ssEntry->attackSpeed)
10494 {
10498 }
10499 else
10501
10502 switch (form)
10503 {
10504 case FORM_GHOUL:
10505 case FORM_CAT:
10506 {
10507 if (getPowerType() != POWER_ENERGY)
10509 break;
10510 }
10511 case FORM_BEAR:
10512 case FORM_DIREBEAR:
10513 {
10514 if (getPowerType() != POWER_RAGE)
10516 break;
10517 }
10518 default: // 0, for example
10519 {
10520 ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(getClass());
10521 if (cEntry && cEntry->powerType < MAX_POWERS && uint32(getPowerType()) != cEntry->powerType)
10522 setPowerType(Powers(cEntry->powerType));
10523 break;
10524 }
10525 }
10526
10527 // update auras at form change, ignore this at mods reapply (.reset stats/etc) when form not change.
10528 if (!reapplyMods)
10530
10533}
DBCStorage< SpellShapeshiftEntry > sSpellShapeshiftStore(SpellShapeshiftfmt)
ShapeshiftForm
Definition: Unit.h:89
@ FORM_GHOUL
Definition: Unit.h:97
void SetRegularAttackTime()
Definition: Player.cpp:5208
void UpdateEquipSpellsAtFormChange()
Definition: PlayerUpdates.cpp:1313
void setPowerType(Powers power)
Definition: Unit.cpp:9987
Definition: DBCStructure.h:1817
uint32 attackSpeed
Definition: DBCStructure.h:1825

References SpellShapeshiftEntry::attackSpeed, BASE_ATTACK, BASE_ATTACK_TIME, FORM_BEAR, FORM_CAT, FORM_DIREBEAR, FORM_GHOUL, Unit::getClass(), Unit::getPowerType(), Unit::GetShapeshiftForm(), MAX_POWERS, OFF_ATTACK, POWER_ENERGY, POWER_RAGE, ChrClassesEntry::powerType, RANGED_ATTACK, sChrClassesStore, Unit::SetAttackTime(), Unit::setPowerType(), SetRegularAttackTime(), sSpellShapeshiftStore, UpdateAttackPowerAndDamage(), and UpdateEquipSpellsAtFormChange().

Referenced by AuraEffect::HandleAuraModShapeshift(), and InitStatsForLevel().

◆ InitDisplayIds()

void Player::InitDisplayIds ( )
10536{
10537 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass());
10538 if (!info)
10539 {
10540 LOG_ERROR("entities.player", "Player {} has incorrect race/class pair. Can't init display ids.", GetGUID().ToString());
10541 return;
10542 }
10543
10544 uint8 gender = getGender();
10545 switch (gender)
10546 {
10547 case GENDER_FEMALE:
10550 break;
10551 case GENDER_MALE:
10554 break;
10555 default:
10556 LOG_ERROR("entities.player", "Invalid gender {} for player", gender);
10557 return;
10558 }
10559}
@ GENDER_MALE
Definition: SharedDefines.h:61
@ GENDER_FEMALE
Definition: SharedDefines.h:62
uint16 displayId_m
Definition: Player.h:346
uint16 displayId_f
Definition: Player.h:347
uint8 getGender() const
Definition: Unit.h:1440
void SetNativeDisplayId(uint32 modelId)
Definition: Unit.h:2186
virtual void SetDisplayId(uint32 modelId)
Definition: Unit.cpp:17030

References PlayerInfo::displayId_f, PlayerInfo::displayId_m, GENDER_FEMALE, GENDER_MALE, Unit::getClass(), Unit::getGender(), Object::GetGUID(), Unit::getRace(), LOG_ERROR, Unit::SetDisplayId(), Unit::SetNativeDisplayId(), sObjectMgr, and Position::ToString().

Referenced by Create(), modify_commandscript::HandleModifyGenderCommand(), reset_commandscript::HandleResetStatsOrLevelHelper(), and LoadFromDB().

◆ InitGlyphsForLevel()

void Player::InitGlyphsForLevel ( )
13203{
13204 for (uint32 i = 0; i < sGlyphSlotStore.GetNumRows(); ++i)
13205 if (GlyphSlotEntry const* gs = sGlyphSlotStore.LookupEntry(i))
13206 if (gs->Order)
13207 SetGlyphSlot(gs->Order - 1, gs->Id);
13208
13209 uint8 level = GetLevel();
13210 uint32 value = 0;
13211
13212 // 0x3F = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 for 80 level
13213 if (level >= 15)
13214 value |= (0x01 | 0x02);
13215 if (level >= 30)
13216 value |= 0x08;
13217 if (level >= 50)
13218 value |= 0x04;
13219 if (level >= 70)
13220 value |= 0x10;
13221 if (level >= 80)
13222 value |= 0x20;
13223
13225}
@ PLAYER_GLYPHS_ENABLED
Definition: UpdateFields.h:390
void SetGlyphSlot(uint8 slot, uint32 slottype)
Definition: Player.h:1723

References Unit::GetLevel(), PLAYER_GLYPHS_ENABLED, SetGlyphSlot(), Object::SetUInt32Value(), and sGlyphSlotStore.

Referenced by Create(), GiveLevel(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetStatsCommand(), and LoadFromDB().

◆ Initialize()

void Player::Initialize ( ObjectGuid::LowType  guid)
4801{
4802 Object::_Create(guid, 0, HighGuid::Player);
4803}

References Object::_Create().

◆ InitPrimaryProfessions()

void Player::InitPrimaryProfessions ( )
11426{
11428}
@ CONFIG_MAX_PRIMARY_TRADE_SKILL
Definition: IWorld.h:252

References CONFIG_MAX_PRIMARY_TRADE_SKILL, SetFreePrimaryProfessions(), and sWorld.

Referenced by Create(), and LoadFromDB().

◆ InitRunes()

void Player::InitRunes ( )
13373{
13375 return;
13376
13377 m_runes = new Runes;
13378
13379 m_runes->runeState = 0;
13381
13382 for (uint8 i = 0; i < MAX_RUNES; ++i)
13383 {
13384 SetBaseRune(i, runeSlotTypes[i]); // init base types
13385 SetCurrentRune(i, runeSlotTypes[i]); // init current types
13386 SetRuneCooldown(i, 0); // reset cooldowns
13387 SetGracePeriod(i, 0); // xinef: reset grace period
13388 SetRuneConvertAura(i, nullptr);
13390 }
13391
13392 for (uint8 i = 0; i < NUM_RUNE_TYPES; ++i)
13394}
@ PLAYER_RUNE_REGEN_1
Definition: UpdateFields.h:386
static RuneType runeSlotTypes[MAX_RUNES]
Definition: Player.cpp:13362
@ NUM_RUNE_TYPES
Definition: Player.h:414
@ RUNE_BLOOD
Definition: Player.h:410
#define MAX_RUNES
Definition: Player.h:399
Definition: Player.h:427
void SetRuneState(uint8 index, bool set=true)
Definition: Player.h:432
void SetRuneCooldown(uint8 index, uint32 cooldown)
Definition: Player.h:2479
void SetBaseRune(uint8 index, RuneType baseRune)
Definition: Player.h:2477
void SetGracePeriod(uint8 index, uint32 period)
Definition: Player.h:2480

References CLASS_DEATH_KNIGHT, Unit::getClass(), Runes::lastUsedRune, m_runes, MAX_RUNES, NUM_RUNE_TYPES, PLAYER_RUNE_REGEN_1, RUNE_BLOOD, runeSlotTypes, Runes::runeState, SetBaseRune(), SetCurrentRune(), Object::SetFloatValue(), SetGracePeriod(), SetRuneConvertAura(), SetRuneCooldown(), and Runes::SetRuneState().

Referenced by Create(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetStatsCommand(), and LoadFromDB().

◆ InitStatsForLevel()

void Player::InitStatsForLevel ( bool  reapplyMods = false)
2549{
2550 if (reapplyMods) //reapply stats values only on .reset stats (level) command
2552
2553 PlayerClassLevelInfo classInfo;
2554 sObjectMgr->GetPlayerClassLevelInfo(getClass(), GetLevel(), &classInfo);
2555
2556 PlayerLevelInfo info;
2557 sObjectMgr->GetPlayerLevelInfo(getRace(true), getClass(), GetLevel(), &info);
2558
2559 uint32 maxPlayerLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
2560 sScriptMgr->OnSetMaxLevel(this, maxPlayerLevel);
2561 SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, maxPlayerLevel);
2563
2564 // reset before any aura state sources (health set/aura apply)
2566
2568
2569 // set default cast time multiplier
2571
2572 // reset size before reapply auras
2573 SetObjectScale(1.0f);
2574
2575 // save base values (bonuses already included in stored stats
2576 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
2577 SetCreateStat(Stats(i), info.stats[i]);
2578
2579 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
2580 SetStat(Stats(i), info.stats[i]);
2581
2582 SetCreateHealth(classInfo.basehealth);
2583
2584 //set create powers
2585 SetCreateMana(classInfo.basemana);
2586
2588
2590
2591 //reset rating fields values
2593 SetUInt32Value(index, 0);
2594
2596 for (uint8 i = 0; i < 7; ++i)
2597 {
2601 }
2602
2603 //reset attack power, damage and attack speed fields
2605 SetFloatValue(UNIT_FIELD_BASEATTACKTIME + 1, 2000.0f); // offhand attack time
2607
2614
2621
2622 // Base crit values (will be recalculated in UpdateAllStats() at loading and in _ApplyAllStatBonuses() at reset
2626
2627 // Init spell schools (will be recalculated in UpdateAllStats() at loading and in _ApplyAllStatBonuses() at reset
2628 for (uint8 i = 0; i < 7; ++i)
2630
2634
2635 // Dodge percentage
2637
2638 // set armor (resistance 0) to original value (create_agility*2)
2640 SetResistanceBuffMods(SpellSchools(0), true, 0.0f);
2641 SetResistanceBuffMods(SpellSchools(0), false, 0.0f);
2642 // set other resistance to original value (0)
2643 for (uint8 i = 1; i < MAX_SPELL_SCHOOL; ++i)
2644 {
2646 SetResistanceBuffMods(SpellSchools(i), true, 0.0f);
2647 SetResistanceBuffMods(SpellSchools(i), false, 0.0f);
2648 }
2649
2652 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
2653 {
2656 }
2657 // Reset no reagent cost field
2658 for (uint8 i = 0; i < 3; ++i)
2660 // Init data for form but skip reapply item mods for form
2661 InitDataForForm(reapplyMods);
2662
2663 // save new stats
2664 for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
2666
2667 SetMaxHealth(classInfo.basehealth); // stamina bonus will applied later
2668
2669 // cleanup mounted state (it will set correctly at aura loading if player saved at mount.
2671
2672 // cleanup unit flags (will be re-applied if need at aura load).
2680 SetImmuneToAll(false);
2682
2684
2685 // cleanup player flags (will be re-applied if need at aura load), to avoid have ghost flag without ghost aura, for example.
2687
2688 RemoveStandFlags(UNIT_STAND_FLAGS_ALL); // one form stealth modified bytes
2690 {
2692 sScriptMgr->OnFfaPvpStateUpdate(this, false);
2693
2694 }
2695 // restore if need some important flags
2696 SetUInt32Value(PLAYER_FIELD_BYTES2, 0); // flags empty by default
2697
2698 if (reapplyMods) // reapply stats values only on .reset stats (level) command
2700
2701 // set current level health and mana/energy to maximum after applying all mods.
2702 SetFullHealth();
2710
2711 // update level to hunter/summon pet
2712 if (Pet* pet = GetPet())
2713 pet->SynchronizeLevelWithOwner();
2714}
@ UNIT_FIELD_MINDAMAGE
Definition: UpdateFields.h:127
@ UNIT_FIELD_POWER_COST_MODIFIER
Definition: UpdateFields.h:170
@ UNIT_FIELD_RANGEDATTACKTIME
Definition: UpdateFields.h:121
@ UNIT_FIELD_ATTACK_POWER_MODS
Definition: UpdateFields.h:163
@ PLAYER_OFFHAND_CRIT_PERCENTAGE
Definition: UpdateFields.h:353
@ PLAYER_SHIELD_BLOCK
Definition: UpdateFields.h:355
@ UNIT_FIELD_MAXDAMAGE
Definition: UpdateFields.h:128
@ UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER
Definition: UpdateFields.h:167
@ UNIT_FIELD_MAXOFFHANDDAMAGE
Definition: UpdateFields.h:130
@ PLAYER_FIELD_BYTES2
Definition: UpdateFields.h:378
@ UNIT_FIELD_AURASTATE
Definition: UpdateFields.h:119
@ UNIT_FIELD_MOUNTDISPLAYID
Definition: UpdateFields.h:126
@ UNIT_FIELD_MAXRANGEDDAMAGE
Definition: UpdateFields.h:169
@ UNIT_FIELD_ATTACK_POWER_MULTIPLIER
Definition: UpdateFields.h:164
@ UNIT_FIELD_MINRANGEDDAMAGE
Definition: UpdateFields.h:168
@ UNIT_FIELD_FLAGS
Definition: UpdateFields.h:117
@ UNIT_FIELD_RANGED_ATTACK_POWER_MODS
Definition: UpdateFields.h:166
@ PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
Definition: UpdateFields.h:362
@ UNIT_FIELD_POWER_COST_MULTIPLIER
Definition: UpdateFields.h:171
@ UNIT_FIELD_MINOFFHANDDAMAGE
Definition: UpdateFields.h:129
@ PLAYER_FIELD_MAX_LEVEL
Definition: UpdateFields.h:384
@ UNIT_FIELD_BASEATTACKTIME
Definition: UpdateFields.h:120
@ PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE
Definition: UpdateFields.h:367
@ PLAYER_ALLOW_ONLY_ABILITY
Definition: Player.h:498
@ PLAYER_FLAGS_DND
Definition: Player.h:477
@ PLAYER_FLAGS_AFK
Definition: Player.h:476
@ PLAYER_FLAGS_GM
Definition: Player.h:478
@ UNIT_STAND_FLAGS_ALL
Definition: Unit.h:73
@ UNIT_BYTE2_FLAG_FFA_PVP
Definition: Unit.h:138
@ UNIT_BYTE2_FLAG_SANCTUARY
Definition: Unit.h:139
@ UNIT_FLAG_STUNNED
Definition: Unit.h:466
@ UNIT_FLAG_NON_ATTACKABLE
Definition: Unit.h:449
@ UNIT_FLAG_IN_COMBAT
Definition: Unit.h:467
@ UNIT_FLAG_DISARMED
Definition: Unit.h:469
@ UNIT_FLAG_PACIFIED
Definition: Unit.h:465
@ UNIT_FLAG_CONFUSED
Definition: Unit.h:470
@ UNIT_FLAG_FLEEING
Definition: Unit.h:471
@ UNIT_FLAG_NOT_SELECTABLE
Definition: Unit.h:473
@ UNIT_FLAG_LOOTING
Definition: Unit.h:458
@ UNIT_FLAG_NOT_ATTACKABLE_1
Definition: Unit.h:455
@ UNIT_FLAG_SILENCED
Definition: Unit.h:461
@ UNIT_FLAG_MOUNT
Definition: Unit.h:475
@ UNIT_FLAG_PET_IN_COMBAT
Definition: Unit.h:459
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition: Object.cpp:930
void _ApplyAllStatBonuses()
Definition: StatSystem.cpp:986
void InitDataForForm(bool reapplyMods=false)
Definition: Player.cpp:10488
void _RemoveAllStatBonuses()
Definition: StatSystem.cpp:998
uint32 GetCreatePowers(Powers power) const
Definition: Unit.cpp:15646
void SetStat(Stats stat, int32 val)
Definition: Unit.h:1445
void SetResistanceBuffMods(SpellSchools school, bool positive, float val)
Definition: Unit.h:2040
float m_createStats[MAX_STATS]
Definition: Unit.h:2499
void SetResistance(SpellSchools school, int32 val)
Definition: Unit.h:1451
void RemoveStandFlags(uint8 flags)
Definition: Unit.h:1554
void SetArmor(int32 val)
Definition: Unit.h:1447
void SetMaxHealth(uint32 val)
Definition: Unit.cpp:15514
void InitStatBuffMods()
Definition: Unit.h:2043
void SetImmuneToAll(bool apply, bool keepCombat=false)
Definition: Unit.h:1692

References _ApplyAllStatBonuses(), _RemoveAllStatBonuses(), PlayerClassLevelInfo::basehealth, PlayerClassLevelInfo::basemana, CONFIG_MAX_PLAYER_LEVEL, Unit::getClass(), Unit::GetCreatePowers(), Unit::GetLevel(), Unit::GetMaxPower(), GetPet(), Unit::GetPower(), Unit::getRace(), Object::HasByteFlag(), InitDataForForm(), Unit::InitStatBuffMods(), Unit::m_createStats, MAX_COMBAT_RATING, MAX_POWERS, MAX_SPELL_SCHOOL, MAX_STATS, PLAYER_ALLOW_ONLY_ABILITY, PLAYER_BLOCK_PERCENTAGE, PLAYER_CRIT_PERCENTAGE, PLAYER_DODGE_PERCENTAGE, PLAYER_FIELD_BYTES2, PLAYER_FIELD_COMBAT_RATING_1, PLAYER_FIELD_MAX_LEVEL, PLAYER_FIELD_MOD_DAMAGE_DONE_NEG, PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, PLAYER_FIELD_MOD_DAMAGE_DONE_POS, PLAYER_FIELD_MOD_HEALING_DONE_POS, PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE, PLAYER_FIELD_MOD_TARGET_RESISTANCE, PLAYER_FLAGS_AFK, PLAYER_FLAGS_DND, PLAYER_FLAGS_GHOST, PLAYER_FLAGS_GM, PLAYER_NEXT_LEVEL_XP, PLAYER_NO_REAGENT_COST_1, PLAYER_OFFHAND_CRIT_PERCENTAGE, PLAYER_PARRY_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, PLAYER_SHIELD_BLOCK, PLAYER_SPELL_CRIT_PERCENTAGE1, POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, Object::RemoveByteFlag(), Object::RemoveFlag(), RemovePlayerFlag(), Unit::RemoveStandFlags(), Unit::SetArmor(), Unit::SetCreateHealth(), Unit::SetCreateMana(), Unit::SetCreateStat(), Object::SetFloatValue(), Unit::SetFullHealth(), Unit::SetImmuneToAll(), Object::SetInt32Value(), Unit::SetMaxHealth(), Unit::SetMaxPower(), SetObjectScale(), Unit::SetPower(), Unit::SetResistance(), Unit::SetResistanceBuffMods(), Unit::SetStat(), Object::SetUInt32Value(), Unit::SetUnitFlag(), Unit::SetUnitFlag2(), sObjectMgr, sScriptMgr, STAT_AGILITY, STAT_STRENGTH, PlayerLevelInfo::stats, sWorld, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_BYTE2_FLAG_SANCTUARY, UNIT_FIELD_ATTACK_POWER, UNIT_FIELD_ATTACK_POWER_MODS, UNIT_FIELD_ATTACK_POWER_MULTIPLIER, UNIT_FIELD_AURASTATE, UNIT_FIELD_BASEATTACKTIME, UNIT_FIELD_BYTES_2, UNIT_FIELD_FLAGS, UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MAXRANGEDDAMAGE, UNIT_FIELD_MINDAMAGE, UNIT_FIELD_MINOFFHANDDAMAGE, UNIT_FIELD_MINRANGEDDAMAGE, UNIT_FIELD_MOUNTDISPLAYID, UNIT_FIELD_POWER_COST_MODIFIER, UNIT_FIELD_POWER_COST_MULTIPLIER, UNIT_FIELD_RANGED_ATTACK_POWER, UNIT_FIELD_RANGED_ATTACK_POWER_MODS, UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER, UNIT_FIELD_RANGEDATTACKTIME, UNIT_FLAG2_REGENERATE_POWER, UNIT_FLAG_CONFUSED, UNIT_FLAG_DISABLE_MOVE, UNIT_FLAG_DISARMED, UNIT_FLAG_FLEEING, UNIT_FLAG_IN_COMBAT, UNIT_FLAG_LOOTING, UNIT_FLAG_MOUNT, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_ATTACKABLE_1, UNIT_FLAG_NOT_SELECTABLE, UNIT_FLAG_PACIFIED, UNIT_FLAG_PET_IN_COMBAT, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_FLAG_SILENCED, UNIT_FLAG_SKINNABLE, UNIT_FLAG_STUNNED, UNIT_FLAG_TAXI_FLIGHT, UNIT_MOD_CAST_SPEED, UNIT_STAND_FLAGS_ALL, and UpdateSkillsForLevel().

Referenced by Create(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetStatsCommand(), and LoadFromDB().

◆ InitTalentForLevel()

void Player::InitTalentForLevel ( )
2534{
2535 uint32 talentPointsForLevel = CalculateTalentsPoints();
2536
2537 // xinef: more talent points that we have are used, reset
2538 if (m_usedTalentCount > talentPointsForLevel)
2539 resetTalents(true);
2540 // xinef: else, recalculate free talent points count
2541 else
2542 SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount);
2543
2544 if (!GetSession()->PlayerLoading())
2545 SendTalentsInfoData(false); // update at client
2546}
void SendTalentsInfoData(bool pet)
Definition: Player.cpp:14338
bool resetTalents(bool noResetCost=false)
Definition: Player.cpp:3656
void SetFreeTalentPoints(uint32 points)
Definition: Player.cpp:3751
uint32 CalculateTalentsPoints() const
Definition: Player.cpp:13535

References CalculateTalentsPoints(), GetSession(), m_usedTalentCount, resetTalents(), SendTalentsInfoData(), and SetFreeTalentPoints().

Referenced by ActivateSpec(), Create(), GiveLevel(), character_commandscript::HandleCharacterLevel(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetStatsCommand(), LoadFromDB(), and RewardQuest().

◆ InitTaxiNodesForLevel()

void Player::InitTaxiNodesForLevel ( )
inline

◆ inRandomLfgDungeon()

bool Player::inRandomLfgDungeon ( )
12990{
12991 if (sLFGMgr->selectedRandomLfgDungeon(GetGUID()))
12992 {
12993 Map const* map = GetMap();
12994 return sLFGMgr->inLfgDungeonMap(GetGUID(), map->GetId(), map->GetDifficulty());
12995 }
12996
12997 return false;
12998}

References Map::GetDifficulty(), Object::GetGUID(), Map::GetId(), WorldObject::GetMap(), and sLFGMgr.

◆ isAcceptWhispers()

bool Player::isAcceptWhispers ( ) const
inline

◆ IsActionButtonDataValid()

bool Player::IsActionButtonDataValid ( uint8  button,
uint32  action,
uint8  type 
)
5497{
5498 if (button >= MAX_ACTION_BUTTONS)
5499 {
5500 LOG_ERROR("entities.player", "Action {} not added into button {} for player {}: button must be < {}", action, button, GetName(), MAX_ACTION_BUTTONS);
5501 return false;
5502 }
5503
5504 if (action >= MAX_ACTION_BUTTON_ACTION_VALUE)
5505 {
5506 LOG_ERROR("entities.player", "Action {} not added into button {} for player {}: action must be < {}", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE);
5507 return false;
5508 }
5509
5510 switch (type)
5511 {
5513 if (!sSpellMgr->GetSpellInfo(action))
5514 {
5515 LOG_ERROR("entities.player", "Spell action {} not added into button {} for player {}: spell not exist", action, button, GetName());
5516 return false;
5517 }
5518
5519 if (!HasSpell(action))
5520 {
5521 LOG_DEBUG("entities.player.loading", "Player::IsActionButtonDataValid Spell action {} not added into button {} for player {}: player don't known this spell", action, button, GetName());
5522 return false;
5523 }
5524 break;
5525 case ACTION_BUTTON_ITEM:
5526 if (!sObjectMgr->GetItemTemplate(action))
5527 {
5528 LOG_ERROR("entities.player", "Item action {} not added into button {} for player {}: item not exist", action, button, GetName());
5529 return false;
5530 }
5531 break;
5532 default:
5533 break; // other cases not checked at this moment
5534 }
5535
5536 return true;
5537}
@ ACTION_BUTTON_ITEM
Definition: Player.h:235
@ ACTION_BUTTON_SPELL
Definition: Player.h:230
#define MAX_ACTION_BUTTONS
Definition: Player.h:275
#define MAX_ACTION_BUTTON_ACTION_VALUE
Definition: Player.h:251

References ACTION_BUTTON_ITEM, ACTION_BUTTON_SPELL, WorldObject::GetName(), HasSpell(), LOG_DEBUG, LOG_ERROR, MAX_ACTION_BUTTON_ACTION_VALUE, MAX_ACTION_BUTTONS, sObjectMgr, and sSpellMgr.

Referenced by addActionButton().

◆ IsActiveQuest()

bool Player::IsActiveQuest ( uint32  quest_id) const
203{
204 return m_QuestStatus.find(quest_id) != m_QuestStatus.end();
205}

References m_QuestStatus.

◆ IsAffectedBySpellmod()

bool Player::IsAffectedBySpellmod ( SpellInfo const *  spellInfo,
SpellModifier mod,
Spell spell = nullptr 
)
9632{
9633 if (!mod || !spellInfo)
9634 return false;
9635
9636 // Mod out of charges
9637 if (spell && mod->charges == -1 && spell->m_appliedMods.find(mod->ownerAura) == spell->m_appliedMods.end())
9638 return false;
9639
9640 // +duration to infinite duration spells making them limited
9641 if (mod->op == SPELLMOD_DURATION && spellInfo->GetDuration() == -1)
9642 return false;
9643
9644 return spellInfo->IsAffectedBySpellMod(mod);
9645}

References SpellModifier::charges, SpellInfo::GetDuration(), SpellInfo::IsAffectedBySpellMod(), Spell::m_appliedMods, SpellModifier::op, SpellModifier::ownerAura, and SPELLMOD_DURATION.

Referenced by ApplySpellMod().

◆ isAFK()

◆ isAllowedToLoot()

bool Player::isAllowedToLoot ( Creature const *  creature)
5643{
5644 if (!creature->isDead() || !creature->IsDamageEnoughForLootingAndReward())
5645 return false;
5646
5647 if (HasPendingBind())
5648 return false;
5649
5650 const Loot* loot = &creature->loot;
5651 if (loot->isLooted()) // nothing to loot or everything looted.
5652 return false;
5653
5654 if (!loot->hasItemForAll() && !loot->hasItemFor(this)) // no loot in creature for this player
5655 return false;
5656
5657 if (loot->loot_type == LOOT_SKINNING)
5658 return creature->GetLootRecipientGUID() == GetGUID();
5659
5660 Group* thisGroup = GetGroup();
5661 if (!thisGroup)
5662 return this == creature->GetLootRecipient();
5663 else if (thisGroup != creature->GetLootRecipientGroup())
5664 return false;
5665
5666 switch (thisGroup->GetLootMethod())
5667 {
5668 case MASTER_LOOT:
5669 case FREE_FOR_ALL:
5670 return true;
5671 case ROUND_ROBIN:
5672 // may only loot if the player is the loot roundrobin player
5673 // or if there are free/quest/conditional item for the player
5674 if (!loot->roundRobinPlayer || loot->roundRobinPlayer == GetGUID())
5675 return true;
5676
5677 return loot->hasItemFor(this);
5678 case GROUP_LOOT:
5679 case NEED_BEFORE_GREED:
5680 // may only loot if the player is the loot roundrobin player
5681 // or item over threshold (so roll(s) can be launched)
5682 // or if there are free/quest/conditional item for the player
5683 if (!loot->roundRobinPlayer || loot->roundRobinPlayer == GetGUID())
5684 return true;
5685
5686 if (loot->hasOverThresholdItem())
5687 return true;
5688
5689 return loot->hasItemFor(this);
5690 }
5691
5692 return false;
5693}
@ NEED_BEFORE_GREED
Definition: LootMgr.h:63
@ GROUP_LOOT
Definition: LootMgr.h:62
@ MASTER_LOOT
Definition: LootMgr.h:61
@ ROUND_ROBIN
Definition: LootMgr.h:60
@ FREE_FOR_ALL
Definition: LootMgr.h:59
@ LOOT_SKINNING
Definition: LootMgr.h:86
bool HasPendingBind() const
Definition: Player.h:2402
LootMethod GetLootMethod() const
Definition: Group.cpp:2255
bool hasItemFor(Player *player) const
Definition: LootMgr.cpp:917
bool isLooted() const
Definition: LootMgr.h:368
bool hasOverThresholdItem() const
Definition: LootMgr.cpp:962
ObjectGuid roundRobinPlayer
Definition: LootMgr.h:324
bool hasItemForAll() const
Definition: LootMgr.cpp:902
LootType loot_type
Definition: LootMgr.h:326

References FREE_FOR_ALL, GetGroup(), Object::GetGUID(), Group::GetLootMethod(), Creature::GetLootRecipient(), Creature::GetLootRecipientGroup(), Creature::GetLootRecipientGUID(), GROUP_LOOT, Loot::hasItemFor(), Loot::hasItemForAll(), Loot::hasOverThresholdItem(), HasPendingBind(), Creature::IsDamageEnoughForLootingAndReward(), Unit::isDead(), Loot::isLooted(), Creature::loot, LOOT_SKINNING, Loot::loot_type, MASTER_LOOT, NEED_BEFORE_GREED, ROUND_ROBIN, and Loot::roundRobinPlayer.

Referenced by Unit::BuildValuesUpdate().

◆ IsAlwaysDetectableFor()

bool Player::IsAlwaysDetectableFor ( WorldObject const *  seer) const
overrideprotectedvirtual

Reimplemented from WorldObject.

11381{
11383 return true;
11384
11385 if (duel && duel->State != DUEL_STATE_CHALLENGED && duel->Opponent == seer)
11386 {
11387 return false;
11388 }
11389
11390 if (Player const* seerPlayer = seer->ToPlayer())
11391 {
11392 if (IsGroupVisibleFor(seerPlayer))
11393 {
11394 return true;
11395 }
11396 }
11397
11398 return false;
11399}
@ DUEL_STATE_CHALLENGED
Definition: Player.h:371
bool IsGroupVisibleFor(Player const *p) const
Definition: Player.cpp:2280
bool IsAlwaysDetectableFor(WorldObject const *seer) const override
Definition: Unit.cpp:14202

References duel, DUEL_STATE_CHALLENGED, Unit::IsAlwaysDetectableFor(), IsGroupVisibleFor(), and Object::ToPlayer().

◆ IsAtGroupRewardDistance()

bool Player::IsAtGroupRewardDistance ( WorldObject const *  pRewardSource) const
12679{
12680 WorldObject const* player = GetCorpse();
12681 if (!player || IsAlive())
12682 {
12683 player = this;
12684 }
12685
12686 if (!pRewardSource || !player->IsInMap(pRewardSource))
12687 {
12688 return false;
12689 }
12690
12691 if (pRewardSource->GetMap()->IsDungeon())
12692 {
12693 return true;
12694 }
12695
12696 return pRewardSource->GetDistance(player) <= sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE);
12697}
@ CONFIG_GROUP_XP_DISTANCE
Definition: IWorld.h:192
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1245

References CONFIG_GROUP_XP_DISTANCE, GetCorpse(), WorldObject::GetDistance(), WorldObject::GetMap(), Unit::IsAlive(), Map::IsDungeon(), WorldObject::IsInMap(), and sWorld.

Referenced by KillRewarder::_InitGroupData(), KillRewarder::_RewardGroup(), SmartAI::EndPath(), GroupEventHappens(), OutdoorPvP::HandleKill(), Battleground::HandleKillPlayer(), WorldSession::HandleQuestConfirmAccept(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), IsAtLootRewardDistance(), and RewardPlayerAndGroupAtEvent().

◆ IsAtLootRewardDistance()

bool Player::IsAtLootRewardDistance ( WorldObject const *  pRewardSource) const
12700{
12701 if (!IsAtGroupRewardDistance(pRewardSource))
12702 {
12703 return false;
12704 }
12705
12706 if (HasPendingBind())
12707 {
12708 return false;
12709 }
12710
12711 return pRewardSource->HasAllowedLooter(GetGUID());
12712}

References Object::GetGUID(), WorldObject::HasAllowedLooter(), HasPendingBind(), and IsAtGroupRewardDistance().

Referenced by Loot::FillLoot(), Group::GroupLoot(), WorldSession::HandleLootMoneyOpcode(), Group::MasterLoot(), Group::NeedBeforeGreed(), and Group::UpdateLooterGuid().

◆ IsAtRecruitAFriendDistance()

bool Player::IsAtRecruitAFriendDistance ( WorldObject const *  pOther) const
12715{
12716 if (!pOther)
12717 return false;
12718 WorldObject const* player = GetCorpse();
12719 if (!player || IsAlive())
12720 player = this;
12721
12722 if (player->GetMapId() != pOther->GetMapId() || player->GetInstanceId() != pOther->GetInstanceId())
12723 return false;
12724
12725 return pOther->GetDistance(player) <= sWorld->getFloatConfig(CONFIG_MAX_RECRUIT_A_FRIEND_DISTANCE);
12726}
@ CONFIG_MAX_RECRUIT_A_FRIEND_DISTANCE
Definition: IWorld.h:193

References CONFIG_MAX_RECRUIT_A_FRIEND_DISTANCE, GetCorpse(), WorldObject::GetDistance(), WorldObject::GetInstanceId(), WorldLocation::GetMapId(), Unit::IsAlive(), and sWorld.

Referenced by GetsRecruitAFriendBonus().

◆ IsBagPos()

bool Player::IsBagPos ( uint16  pos)
static

◆ IsBankPos() [1/2]

◆ IsBankPos() [2/2]

bool Player::IsBankPos ( uint8  bag,
uint8  slot 
)
static
608{
609 if (bag == INVENTORY_SLOT_BAG_0 && (slot >= BANK_SLOT_ITEM_START && slot < BANK_SLOT_ITEM_END))
610 return true;
611 if (bag == INVENTORY_SLOT_BAG_0 && (slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END))
612 return true;
613 if (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END)
614 return true;
615 return false;
616}

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_END, BANK_SLOT_ITEM_START, and INVENTORY_SLOT_BAG_0.

◆ IsBaseRuneSlotsOnCooldown()

bool Player::IsBaseRuneSlotsOnCooldown ( RuneType  runeType) const
13397{
13398 for (uint8 i = 0; i < MAX_RUNES; ++i)
13399 if (GetBaseRune(i) == runeType && GetRuneCooldown(i) == 0)
13400 return false;
13401
13402 return true;
13403}
uint32 GetRuneCooldown(uint8 index) const
Definition: Player.h:2471

References GetBaseRune(), GetRuneCooldown(), and MAX_RUNES.

Referenced by Unit::HandleProcTriggerSpell().

◆ isBeingLoaded()

bool Player::isBeingLoaded ( ) const
overridevirtual

Reimplemented from Unit.

4935{
4936 return GetSession()->PlayerLoading();
4937}
bool PlayerLoading() const
Definition: WorldSession.h:337

References GetSession(), and WorldSession::PlayerLoading().

Referenced by _addSpell(), addTalent(), MapInstanced::CreateInstanceForPlayer(), SendInitialPacketsAfterAddToMap(), SetHonorPoints(), SetMover(), and UpdateObjectVisibility().

◆ IsBeingTeleported()

◆ IsBeingTeleportedFar()

bool Player::IsBeingTeleportedFar ( ) const
inline

◆ IsBeingTeleportedNear()

bool Player::IsBeingTeleportedNear ( ) const
inline

◆ IsCommentator()

bool Player::IsCommentator ( ) const
inline
@ PLAYER_FLAGS_COMMENTATOR2
Definition: Player.h:497

References HasPlayerFlag(), and PLAYER_FLAGS_COMMENTATOR2.

Referenced by GetChatTag(), and misc_commandscript::HandleCommentatorCommand().

◆ IsCurrentBattlegroundRandom()

bool Player::IsCurrentBattlegroundRandom ( ) const
inline
2220{ return m_bgData.bgIsRandom; }
bool bgIsRandom
Definition: Player.h:1032

References BGData::bgIsRandom, and m_bgData.

◆ IsDailyQuestDone()

bool Player::IsDailyQuestDone ( uint32  quest_id)
12038{
12039 if (sObjectMgr->GetQuestTemplate(quest_id))
12040 {
12041 for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
12042 {
12043 if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx) == quest_id)
12044 {
12045 return true;
12046 }
12047 }
12048 }
12049
12050 return false;
12051}

References Object::GetUInt32Value(), PLAYER_FIELD_DAILY_QUESTS_1, PLAYER_MAX_DAILY_QUESTS, and sObjectMgr.

◆ IsDeserter()

bool Player::IsDeserter ( ) const
inline
2226{ return HasAura(26013); }

References Unit::HasAura().

◆ IsDeveloper()

bool Player::IsDeveloper ( ) const
inline
@ PLAYER_FLAGS_DEVELOPER
Definition: Player.h:490

References HasPlayerFlag(), and PLAYER_FLAGS_DEVELOPER.

Referenced by GetChatTag(), and misc_commandscript::HandleDevCommand().

◆ isDND()

◆ IsEquipmentPos() [1/2]

◆ IsEquipmentPos() [2/2]

bool Player::IsEquipmentPos ( uint8  bag,
uint8  slot 
)
static
599{
600 if (bag == INVENTORY_SLOT_BAG_0 && (slot < EQUIPMENT_SLOT_END))
601 return true;
603 return true;
604 return false;
605}

References EQUIPMENT_SLOT_END, INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, and INVENTORY_SLOT_BAG_START.

◆ IsExistPet()

bool Player::IsExistPet ( )
9109{
9110 PetStable* const petStable = GetPetStable();
9111 return petStable && (petStable->CurrentPet || petStable->GetUnslottedHunterPet());
9112}

References PetStable::CurrentPet, GetPetStable(), and PetStable::GetUnslottedHunterPet().

Referenced by CreatePet(), npc_commandscript::HandleNpcTameCommand(), and pet_commandscript::HandlePetCreateCommand().

◆ IsFalling()

bool Player::IsFalling ( ) const
2145{
2146 // Xinef: Added !IsInFlight check
2147 return GetPositionZ() < m_lastFallZ && !IsInFlight();
2148}

References Position::GetPositionZ(), Unit::IsInFlight(), and m_lastFallZ.

Referenced by lfg::LFGMgr::TeleportPlayer().

◆ IsFFAPvP()

bool Player::IsFFAPvP ( )
16139{
16140 bool result = Unit::IsFFAPvP();
16141
16142 sScriptMgr->OnIsFFAPvP(this, result);
16143
16144 return result;
16145}
bool IsFFAPvP() const
Definition: Unit.h:1532

References Unit::IsFFAPvP(), and sScriptMgr.

Referenced by WorldSession::BuildPartyMemberStatsChangedPacket(), WorldSession::HandleRequestPartyMemberStatsOpcode(), RewardHonor(), UpdateFFAPvPFlag(), and UpdateFFAPvPState().

◆ IsGameMaster()

bool Player::IsGameMaster ( ) const
inline
1148{ return m_ExtraFlags & PLAYER_EXTRA_GM_ON; }
@ PLAYER_EXTRA_GM_ON
Definition: Player.h:586

References m_ExtraFlags, and PLAYER_EXTRA_GM_ON.

Referenced by ThreatMgr::_addThreat(), Group::_homebindIfInstance(), Unit::_IsValidAssistTarget(), Unit::_IsValidAttackTarget(), Unit::Attack(), GameObject::BuildValuesUpdate(), Unit::BuildValuesUpdate(), BuyItemFromVendorSlot(), npc_coren_direbrew::CanBeSeen(), go_loosely_turned_soil::go_loosely_turned_soilAI::CanBeSeen(), Group::CanJoinBattlegroundQueue(), InstanceMap::CannotEnter(), CanTameExoticPets(), Spell::CheckCast(), CheckInstanceLoginValid(), SpellInfo::CheckTarget(), AchievementMgr::CompletedAchievement(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), spell_class_call_polymorph::FilterTargets(), GetPhaseMaskForSpawn(), misc_commandscript::HandleAppearCommand(), WorldSession::HandleBattlemasterJoinOpcode(), HandleFall(), WorldSession::HandleGroupInviteOpcode(), WorldSession::HandleInspectOpcode(), WorldSession::HandleMessagechatOpcode(), mmaps_commandscript::HandleMmapPathCommand(), misc_commandscript::HandlePInfoCommand(), Battlefield::HandlePlayerEnterZone(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), tele_commandscript::HandleTeleCommand(), IsValidCombatTarget(), ThreatCalcHelper::isValidProcess(), WorldSession::LogoutPlayer(), MailSender::MailSender(), npc_ouro_spawner::MoveInLineOfSight(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::MoveInLineOfSight(), npc_barnes::OnGossipHello(), npc_jaina_proudmoore::OnGossipHello(), npc_thrall::OnGossipHello(), go_ahune_ice_stone::OnGossipHello(), go_ulduar_pure_saronite_deposit::OnGossipHello(), go_ahune_ice_stone::OnGossipSelect(), at_trigger_the_beast_movement::OnTrigger(), at_the_beast_room::OnTrigger(), at_ancient_leaf::OnTrigger(), at_lady_deathwhisper_entrance::OnTrigger(), at_icc_gauntlet_event::OnTrigger(), at_icc_putricide_trap::OnTrigger(), at_hor_shadow_throne::OnTrigger(), Acore::PlayerAtMinimumRangeAway::operator()(), Acore::AnyPlayerInObjectRangeCheck::operator()(), MapMgr::PlayerCannotEnter(), Unit::ProcessTerrainStatusUpdate(), Battleground::RemovePlayerAtLeave(), AchievementMgr::ResetAchievementCriteria(), Satisfy(), WorldSession::SendListInventory(), Spell::SendLoot(), SetIsSpectator(), Unit::TauntApply(), Unit::TauntFadeOut(), TeleportTo(), ToggleAFK(), AchievementMgr::UpdateAchievementCriteria(), boss_nefarian::UpdateAI(), UpdateFFAPvPState(), UpdateHomebindTime(), and Whisper().

◆ isGMChat()

bool Player::isGMChat ( ) const
inline
@ PLAYER_EXTRA_GM_CHAT
Definition: Player.h:590

References m_ExtraFlags, and PLAYER_EXTRA_GM_CHAT.

Referenced by GetChatTag().

◆ isGMVisible()

bool Player::isGMVisible ( ) const
inline
@ PLAYER_EXTRA_GM_INVISIBLE
Definition: Player.h:589

References m_ExtraFlags, and PLAYER_EXTRA_GM_INVISIBLE.

Referenced by gm_commandscript::HandleGMVisibleCommand(), and Channel::Invite().

◆ IsGroupVisibleFor()

bool Player::IsGroupVisibleFor ( Player const *  p) const
2281{
2282 switch (sWorld->getIntConfig(CONFIG_GROUP_VISIBILITY))
2283 {
2284 default:
2285 return IsInSameGroupWith(p);
2286 case 1:
2287 return IsInSameRaidWith(p);
2288 case 2:
2289 return GetTeamId() == p->GetTeamId();
2290 }
2291}
@ CONFIG_GROUP_VISIBILITY
Definition: IWorld.h:262
bool IsInSameRaidWith(Player const *p) const
Definition: Player.h:1849
bool IsInSameGroupWith(Player const *p) const
Definition: Player.cpp:2293

References CONFIG_GROUP_VISIBILITY, GetTeamId(), IsInSameGroupWith(), IsInSameRaidWith(), and sWorld.

Referenced by IsAlwaysDetectableFor().

◆ isHonorOrXPTarget()

bool Player::isHonorOrXPTarget ( Unit victim) const
12583{
12584 uint8 v_level = victim->GetLevel();
12586
12587 // Victim level less gray level
12588 if (v_level <= k_grey)
12589 {
12590 return false;
12591 }
12592
12593 if (victim->GetTypeId() == TYPEID_UNIT)
12594 {
12595 if (victim->IsTotem() || victim->IsCritter() || victim->IsPet() || (victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP))
12596 {
12597 return false;
12598 }
12599 }
12600
12601 return true;
12602}
@ CREATURE_FLAG_EXTRA_NO_XP
Definition: CreatureData.h:55
uint32 flags_extra
Definition: CreatureData.h:239
bool IsCritter() const
Definition: Unit.h:1688
bool IsTotem() const
Definition: Unit.h:1427

References CREATURE_FLAG_EXTRA_NO_XP, CreatureTemplate::flags_extra, Creature::GetCreatureTemplate(), Acore::XP::GetGrayLevel(), Unit::GetLevel(), Object::GetTypeId(), Unit::IsCritter(), Unit::IsPet(), Unit::IsTotem(), Object::ToCreature(), and TYPEID_UNIT.

Referenced by spell_warl_drain_soul::HandleTick(), Unit::IsTriggeredAtSpellProcEvent(), achievement_killed_exp_or_honor_target::OnCheck(), RaiseDeadCheck::operator()(), spell_warl_drain_soul::RemoveEffect(), and spell_warl_shadowburn::RemoveEffect().

◆ IsImmuneToEnvironmentalDamage()

bool Player::IsImmuneToEnvironmentalDamage ( )
750{
751 // check for GM and death state included in isAttackableByAOE
752 return (!isTargetableForAttack(false, nullptr)) || isTotalImmune();
753}
bool isTargetableForAttack(bool checkFakeDeath=true, Unit const *byWho=nullptr) const
Definition: Unit.cpp:13842

References Unit::isTargetableForAttack(), and isTotalImmune().

Referenced by EnvironmentalDamage().

◆ IsInAreaTriggerRadius()

bool Player::IsInAreaTriggerRadius ( AreaTrigger const *  trigger,
float  delta = 0.f 
) const
2169{
2170 if (!trigger || GetMapId() != trigger->map)
2171 return false;
2172
2173 if (trigger->radius > 0)
2174 {
2175 // if we have radius check it
2176 float dist = GetDistance(trigger->x, trigger->y, trigger->z);
2177 if (dist > trigger->radius + delta)
2178 return false;
2179 }
2180 else
2181 {
2182 Position center(trigger->x, trigger->y, trigger->z, trigger->orientation);
2183 if (!IsWithinBox(center, trigger->length / 2 + delta, trigger->width / 2 + delta, trigger->height / 2 + delta))
2184 return false;
2185 }
2186
2187 return true;
2188}
Definition: Position.h:28
bool IsWithinBox(const Position &center, float xradius, float yradius, float zradius) const
Definition: Position.cpp:110

References WorldObject::GetDistance(), WorldLocation::GetMapId(), AreaTrigger::height, Position::IsWithinBox(), AreaTrigger::length, AreaTrigger::map, AreaTrigger::orientation, AreaTrigger::radius, AreaTrigger::width, AreaTrigger::x, AreaTrigger::y, and AreaTrigger::z.

Referenced by WorldSession::HandleAreaTriggerOpcode(), and Update().

◆ IsInSameGroupWith()

bool Player::IsInSameGroupWith ( Player const *  p) const
2294{
2295 return p == this || (GetGroup() &&
2296 GetGroup() == p->GetGroup() &&
2297 GetGroup()->SameSubGroup(this, p));
2298}
bool SameSubGroup(ObjectGuid guid1, ObjectGuid guid2) const
Definition: Group.cpp:2302

References GetGroup(), and Group::SameSubGroup().

Referenced by IsGroupVisibleFor(), and Unit::IsInPartyWith().

◆ IsInSameRaidWith()

bool Player::IsInSameRaidWith ( Player const *  p) const
inline

◆ IsInventoryPos() [1/2]

◆ IsInventoryPos() [2/2]

bool Player::IsInventoryPos ( uint8  bag,
uint8  slot 
)
static
586{
587 if (bag == INVENTORY_SLOT_BAG_0 && slot == NULL_SLOT)
588 return true;
590 return true;
592 return true;
593 if (bag == INVENTORY_SLOT_BAG_0 && (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END))
594 return true;
595 return false;
596}

References CURRENCYTOKEN_SLOT_END, INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, KEYRING_SLOT_START, and NULL_SLOT.

◆ IsInvitedForBattlegroundInstance() [1/2]

bool Player::IsInvitedForBattlegroundInstance ( ) const
inline
2219{ return m_bgData.isInvited; }
bool isInvited
Definition: Player.h:1031

References BGData::isInvited, and m_bgData.

Referenced by WorldSession::HandleMoveWorldportAck(), and WorldSession::LogoutPlayer().

◆ IsInvitedForBattlegroundInstance() [2/2]

bool Player::IsInvitedForBattlegroundInstance ( uint32  instanceId) const
12210{
12211 for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
12212 if (_BgBattlegroundQueueID[i].invitedToInstance == instanceId)
12213 return true;
12214
12215 return false;
12216}

References _BgBattlegroundQueueID, and PLAYER_MAX_BATTLEGROUND_QUEUES.

◆ IsInvitedForBattlegroundQueueType()

bool Player::IsInvitedForBattlegroundQueueType ( BattlegroundQueueTypeId  bgQueueTypeId) const
12152{
12153 for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
12154 if (_BgBattlegroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
12155 return _BgBattlegroundQueueID[i].invitedToInstance != 0;
12156
12157 return false;
12158}

References _BgBattlegroundQueueID, and PLAYER_MAX_BATTLEGROUND_QUEUES.

Referenced by WorldSession::HandleBattleFieldPortOpcode().

◆ IsInWater()

bool Player::IsInWater ( ) const
inlineoverridevirtual

Reimplemented from Unit.

1109{ return m_isInWater; }

References m_isInWater.

Referenced by WorldSession::HandleMovementOpcodes().

◆ IsInWhisperWhiteList()

bool Player::IsInWhisperWhiteList ( ObjectGuid  guid)
15809{
15810 for (auto const& itr : WhisperList)
15811 {
15812 if (itr == guid)
15813 {
15814 return true;
15815 }
15816 }
15817
15818 return false;
15819}

References WhisperList.

Referenced by WorldSession::HandleMessagechatOpcode().

◆ IsMirrorTimerActive()

bool Player::IsMirrorTimerActive ( MirrorTimerType  type)
inline
2025{ return m_MirrorTimer[type] == getMaxTimer(type); }

References getMaxTimer(), and m_MirrorTimer.

Referenced by lfg::LFGMgr::TeleportPlayer().

◆ IsNeedCastPassiveSpellAtLearn()

bool Player::IsNeedCastPassiveSpellAtLearn ( SpellInfo const *  spellInfo) const
3235{
3236 // note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
3237 // talent dependent passives activated at form apply have proper stance data
3239 return (!spellInfo->Stances || (form && (spellInfo->Stances & (1 << (form - 1)))) ||
3240 (!form && spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED)));
3241}
@ SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED
Definition: SharedDefines.h:475

References Unit::GetShapeshiftForm(), SpellInfo::HasAttribute(), SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED, and SpellInfo::Stances.

Referenced by _addSpell(), and _addTalentAurasAndSpells().

◆ IsNeverVisible()

bool Player::IsNeverVisible ( ) const
overridevirtual

Reimplemented from WorldObject.

11357{
11359 return true;
11360
11361 if (GetSession()->PlayerLogout() || GetSession()->PlayerLoading())
11362 return true;
11363
11364 return false;
11365}
virtual bool IsNeverVisible() const
Definition: Object.h:648

References GetSession(), and WorldObject::IsNeverVisible().

◆ IsOutdoorPvPActive()

bool Player::IsOutdoorPvPActive ( )

◆ IsPetNeedBeTemporaryUnsummoned()

bool Player::IsPetNeedBeTemporaryUnsummoned ( ) const
inline

◆ IsPvP()

bool Player::IsPvP ( )
16148{
16149 bool result = Unit::IsPvP();
16150
16151 sScriptMgr->OnIsPvP(this, result);
16152
16153 return result;
16154}
bool IsPvP() const
Definition: Unit.h:1531

References Unit::IsPvP(), and sScriptMgr.

Referenced by WorldSession::BuildPartyMemberStatsChangedPacket(), DuelComplete(), WorldSession::HandleMoveTeleportAck(), WorldSession::HandleRequestPartyMemberStatsOpcode(), IsOutdoorPvPActive(), UpdatePvPFlag(), and UpdatePvPState().

◆ IsQuestRewarded()

bool Player::IsQuestRewarded ( uint32  quest_id) const
inline

◆ isResurrectRequested()

bool Player::isResurrectRequested ( ) const
inline

◆ isResurrectRequestedBy()

bool Player::isResurrectRequestedBy ( ObjectGuid  guid) const
inline
1790{ return m_resurrectGUID && m_resurrectGUID == guid; }

References m_resurrectGUID.

◆ IsSpectator()

◆ IsSpellFitByClassAndRace()

bool Player::IsSpellFitByClassAndRace ( uint32  spell_id) const
12279{
12280 uint32 racemask = getRaceMask();
12281 uint32 classmask = getClassMask();
12282
12283 SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spell_id);
12284 if (bounds.first == bounds.second)
12285 return true;
12286
12287 for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
12288 {
12289 // skip wrong race skills
12290 if (_spell_idx->second->RaceMask && (_spell_idx->second->RaceMask & racemask) == 0)
12291 continue;
12292
12293 // skip wrong class skills
12294 if (_spell_idx->second->ClassMask && (_spell_idx->second->ClassMask & classmask) == 0)
12295 continue;
12296
12297 return true;
12298 }
12299
12300 return false;
12301}

References Unit::getClassMask(), Unit::getRaceMask(), and sSpellMgr.

Referenced by GetTrainerSpellState(), learn_commandscript::HandleLearnAllMySpellsCommand(), and WorldSession::SendTrainerList().

◆ IsSummonAsSpectator()

bool Player::IsSummonAsSpectator ( ) const

◆ isTaxiCheater()

bool Player::isTaxiCheater ( ) const
inline

◆ isTotalImmune()

bool Player::isTotalImmune ( ) const
13228{
13230
13231 uint32 immuneMask = 0;
13232 for (AuraEffectList::const_iterator itr = immune.begin(); itr != immune.end(); ++itr)
13233 {
13234 immuneMask |= (*itr)->GetMiscValue();
13235 if (immuneMask & SPELL_SCHOOL_MASK_ALL) // total immunity
13236 return true;
13237 }
13238 return false;
13239}
@ SPELL_AURA_SCHOOL_IMMUNITY
Definition: SpellAuraDefines.h:102
@ SPELL_SCHOOL_MASK_ALL
Definition: SharedDefines.h:315

References Unit::GetAuraEffectsByType(), SPELL_AURA_SCHOOL_IMMUNITY, and SPELL_SCHOOL_MASK_ALL.

Referenced by CanUseBattlegroundObject(), and IsImmuneToEnvironmentalDamage().

◆ IsTotemCategoryCompatiableWith()

bool Player::IsTotemCategoryCompatiableWith ( ItemTemplate const *  pProto,
uint32  requiredTotemCategoryId 
) const
910{
911 if (requiredTotemCategoryId == 0)
912 return true;
913 if (pProto->TotemCategory == 0)
914 return false;
915
916 TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(pProto->TotemCategory);
917 if (!itemEntry)
918 return false;
919 TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId);
920 if (!reqEntry)
921 return false;
922
923 if (itemEntry->categoryType != reqEntry->categoryType)
924 return false;
925
926 if ((itemEntry->categoryMask & reqEntry->categoryMask) != reqEntry->categoryMask)
927 return false;
928
929 // xinef: check skill requirements, needed for enchants!
930 if (pProto->RequiredSkill)
931 if (this->GetSkillValue(pProto->RequiredSkill) < pProto->RequiredSkillRank)
932 return false;
933
934 return true;
935}
DBCStorage< TotemCategoryEntry > sTotemCategoryStore(TotemCategoryEntryfmt)
Definition: DBCStructure.h:1995
uint32 categoryType
Definition: DBCStructure.h:1999
uint32 categoryMask
Definition: DBCStructure.h:2000

References TotemCategoryEntry::categoryMask, TotemCategoryEntry::categoryType, GetSkillValue(), ItemTemplate::RequiredSkill, ItemTemplate::RequiredSkillRank, sTotemCategoryStore, and ItemTemplate::TotemCategory.

Referenced by HasItemTotemCategory().

◆ IsTwoHandUsed()

◆ isUsingLfg()

bool Player::isUsingLfg ( )
12985{
12986 return sLFGMgr->GetState(GetGUID()) != lfg::LFG_STATE_NONE;
12987}
@ LFG_STATE_NONE
Definition: LFG.h:71

References Object::GetGUID(), lfg::LFG_STATE_NONE, and sLFGMgr.

Referenced by misc_commandscript::HandleSkirmishCommand(), and ArenaSpectator::HandleSpectatorSpectateCommand().

◆ IsValidGender()

static bool Player::IsValidGender ( uint8  Gender)
inlinestatic
1548{ return Gender <= GENDER_FEMALE; }
Gender
Definition: SharedDefines.h:60

References GENDER_FEMALE.

Referenced by BuildEnumData(), Create(), ConditionMgr::isConditionTypeValid(), and LoadFromDB().

◆ IsValidPos() [1/2]

bool Player::IsValidPos ( uint16  pos,
bool  explicit_pos 
)
inline
1249{ return IsValidPos(pos >> 8, pos & 255, explicit_pos); }
bool IsValidPos(uint16 pos, bool explicit_pos)
Definition: Player.h:1249

References IsValidPos().

Referenced by WorldSession::HandleAutoStoreBagItemOpcode(), item_commandscript::HandleItemMoveCommand(), WorldSession::HandleSplitItemOpcode(), WorldSession::HandleSwapInvItemOpcode(), WorldSession::HandleSwapItem(), and IsValidPos().

◆ IsValidPos() [2/2]

bool Player::IsValidPos ( uint8  bag,
uint8  slot,
bool  explicit_pos 
)
630{
631 // post selected
632 if (bag == NULL_BAG && !explicit_pos)
633 return true;
634
635 if (bag == INVENTORY_SLOT_BAG_0)
636 {
637 // any post selected
638 if (slot == NULL_SLOT && !explicit_pos)
639 return true;
640
641 // equipment
642 if (slot < EQUIPMENT_SLOT_END)
643 return true;
644
645 // bag equip slots
647 return true;
648
649 // backpack slots
651 return true;
652
653 // keyring slots
654 if (slot >= KEYRING_SLOT_START && slot < KEYRING_SLOT_END)
655 return true;
656
657 // bank main slots
658 if (slot >= BANK_SLOT_ITEM_START && slot < BANK_SLOT_ITEM_END)
659 return true;
660
661 // bank bag slots
662 if (slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END)
663 return true;
664
665 return false;
666 }
667
668 // bag content slots
669 // bank bag content slots
670 if (Bag* pBag = GetBagByPos(bag))
671 {
672 // any post selected
673 if (slot == NULL_SLOT && !explicit_pos)
674 return true;
675
676 return slot < pBag->GetBagSize();
677 }
678
679 // where this?
680 return false;
681}

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_END, BANK_SLOT_ITEM_START, EQUIPMENT_SLOT_END, GetBagByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, KEYRING_SLOT_END, KEYRING_SLOT_START, NULL_BAG, and NULL_SLOT.

◆ IsVisibleGloballyFor()

bool Player::IsVisibleGloballyFor ( Player const *  player) const
11402{
11403 if (!u)
11404 return false;
11405
11406 // Always can see self
11407 if (u == this)
11408 return true;
11409
11410 // Visible units, always are visible for all players
11411 if (IsVisible())
11412 return true;
11413
11414 // GMs are visible for higher gms (or players are visible for gms)
11415 if (!AccountMgr::IsPlayerAccount(u->GetSession()->GetSecurity()))
11416 return GetSession()->GetSecurity() <= u->GetSession()->GetSecurity();
11417
11418 if (!sScriptMgr->NotVisibleGloballyFor(const_cast<Player*>(this), u))
11419 return true;
11420
11421 // non faction visibility non-breakable for non-GMs
11422 return false;
11423}
bool IsVisible() const
Definition: Unit.h:2141
AccountTypes GetSecurity() const
Definition: WorldSession.h:361

References WorldSession::GetSecurity(), GetSession(), AccountMgr::IsPlayerAccount(), Unit::IsVisible(), and sScriptMgr.

Referenced by SocialMgr::BroadcastToFriendListers(), SocialMgr::GetFriendInfo(), WorldSession::HandleAddFriendOpcode(), and ChatHandler::needReportToTarget().

◆ ItemAddedQuestCheck()

void Player::ItemAddedQuestCheck ( uint32  entry,
uint32  count 
)
1822{
1823 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
1824 {
1825 uint32 questid = GetQuestSlotQuestId(i);
1826 if (questid == 0)
1827 continue;
1828
1829 QuestStatusData& q_status = m_QuestStatus[questid];
1830
1831 if (q_status.Status != QUEST_STATUS_INCOMPLETE)
1832 continue;
1833
1834 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
1835 if (!qInfo || !qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
1836 continue;
1837
1838 for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
1839 {
1840 uint32 reqitem = qInfo->RequiredItemId[j];
1841 if (reqitem == entry)
1842 {
1843 uint32 reqitemcount = qInfo->RequiredItemCount[j];
1844 uint16 curitemcount = q_status.ItemCount[j];
1845 if (curitemcount < reqitemcount)
1846 {
1847 q_status.ItemCount[j] = std::min<uint16>(q_status.ItemCount[j] + count, reqitemcount);
1848 m_QuestStatusSave[questid] = true;
1849 }
1850 if (CanCompleteQuest(questid))
1851 CompleteQuest(questid);
1852 else
1854 }
1855 }
1856 }
1858}

References ADDITIONAL_SAVING_INVENTORY_AND_GOLD, ADDITIONAL_SAVING_QUEST_STATUS, AdditionalSavingAddMask(), CanCompleteQuest(), CompleteQuest(), GetQuestSlotQuestId(), Quest::HasSpecialFlag(), QuestStatusData::ItemCount, m_QuestStatus, m_QuestStatusSave, MAX_QUEST_LOG_SIZE, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_DELIVER, QUEST_STATUS_INCOMPLETE, Quest::RequiredItemCount, Quest::RequiredItemId, sObjectMgr, QuestStatusData::Status, and UpdateForQuestWorldObjects().

Referenced by Spell::EffectSummonChangeItem(), EquipNewItem(), WorldSession::HandleAutoStoreBankItemOpcode(), WorldSession::HandleBuybackItem(), MoveItemToInventory(), StoreNewItem(), and SwapItem().

◆ ItemRemovedQuestCheck()

void Player::ItemRemovedQuestCheck ( uint32  entry,
uint32  count 
)
1861{
1862 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
1863 {
1864 uint32 questid = GetQuestSlotQuestId(i);
1865 if (!questid)
1866 continue;
1867
1868 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
1869 if (!qInfo)
1870 continue;
1871
1873 continue;
1874
1875 for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
1876 {
1877 uint32 reqitem = qInfo->RequiredItemId[j];
1878 if (reqitem == entry)
1879 {
1880 QuestStatusData& q_status = m_QuestStatus[questid];
1881 uint32 reqitemcount = qInfo->RequiredItemCount[j];
1882 uint16 curitemcount = q_status.ItemCount[j];
1883
1884 if (q_status.ItemCount[j] >= reqitemcount) // we may have more than what the status shows
1885 curitemcount = GetItemCount(entry, false);
1886
1887 uint16 newItemCount = (count > curitemcount) ? 0 : curitemcount - count;
1888 newItemCount = std::min<uint16>(newItemCount, reqitemcount);
1889 if (newItemCount != q_status.ItemCount[j])
1890 {
1891 q_status.ItemCount[j] = newItemCount;
1892 m_QuestStatusSave[questid] = true;
1893 IncompleteQuest(questid);
1894 }
1895 }
1896 }
1897 }
1899}
void IncompleteQuest(uint32 quest_id)
Definition: PlayerQuest.cpp:641

References GetItemCount(), GetQuestSlotQuestId(), Quest::HasSpecialFlag(), IncompleteQuest(), QuestStatusData::ItemCount, m_QuestStatus, m_QuestStatusSave, MAX_QUEST_LOG_SIZE, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_DELIVER, Quest::RequiredItemCount, Quest::RequiredItemId, sObjectMgr, and UpdateForQuestWorldObjects().

Referenced by DestroyItem(), DestroyItemCount(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleAutoBankItemOpcode(), WorldSession::HandleAutoStoreBankItemOpcode(), WorldSession::HandleSellItemOpcode(), MoveItemFromInventory(), and SwapItem().

◆ JoinedChannel()

void Player::JoinedChannel ( Channel c)
4908{
4909 m_channels.push_back(c);
4910}

References m_channels.

Referenced by Channel::JoinChannel().

◆ KillCreditGO()

void Player::KillCreditGO ( uint32  entry,
ObjectGuid  guid = ObjectGuid::Empty 
)
2043{
2044 uint16 addCastCount = 1;
2045 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
2046 {
2047 uint32 questid = GetQuestSlotQuestId(i);
2048 if (!questid)
2049 continue;
2050
2051 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
2052 if (!qInfo)
2053 continue;
2054
2055 QuestStatusData& q_status = m_QuestStatus[questid];
2056
2057 if (q_status.Status == QUEST_STATUS_INCOMPLETE)
2058 {
2059 if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_CAST) /*&& !qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_KILL)*/)
2060 {
2061 for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
2062 {
2063 uint32 reqTarget = 0;
2064
2065 // GO activate objective
2066 if (qInfo->RequiredNpcOrGo[j] < 0)
2067 // checked at quest_template loading
2068 reqTarget = - qInfo->RequiredNpcOrGo[j];
2069
2070 // other not this creature/GO related objectives
2071 if (reqTarget != entry)
2072 continue;
2073
2074 uint32 reqCastCount = qInfo->RequiredNpcOrGoCount[j];
2075 uint16 curCastCount = q_status.CreatureOrGOCount[j];
2076 if (curCastCount < reqCastCount)
2077 {
2078 q_status.CreatureOrGOCount[j] = curCastCount + addCastCount;
2079
2080 m_QuestStatusSave[questid] = true;
2081
2082 SendQuestUpdateAddCreatureOrGo(qInfo, guid, j, curCastCount, addCastCount);
2083 }
2084
2085 if (CanCompleteQuest(questid))
2086 CompleteQuest(questid);
2087 else
2089
2090 // same objective target can be in many active quests, but not in 2 objectives for single quest (code optimization).
2091 break;
2092 }
2093 }
2094 }
2095 }
2096}
void SendQuestUpdateAddCreatureOrGo(Quest const *quest, ObjectGuid guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count)
Definition: PlayerQuest.cpp:2442

References ADDITIONAL_SAVING_QUEST_STATUS, AdditionalSavingAddMask(), CanCompleteQuest(), CompleteQuest(), QuestStatusData::CreatureOrGOCount, GetQuestSlotQuestId(), Quest::HasSpecialFlag(), m_QuestStatus, m_QuestStatusSave, MAX_QUEST_LOG_SIZE, QUEST_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_CAST, QUEST_STATUS_INCOMPLETE, Quest::RequiredNpcOrGo, Quest::RequiredNpcOrGoCount, SendQuestUpdateAddCreatureOrGo(), sObjectMgr, and QuestStatusData::Status.

Referenced by GameObject::Use().

◆ KilledMonster()

void Player::KilledMonster ( CreatureTemplate const *  cInfo,
ObjectGuid  guid 
)
1902{
1903 ASSERT(cInfo);
1904
1905 if (cInfo->Entry)
1906 KilledMonsterCredit(cInfo->Entry, guid);
1907
1908 for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)
1909 if (cInfo->KillCredit[i])
1910 KilledMonsterCredit(cInfo->KillCredit[i]);
1911}
#define MAX_KILL_CREDIT
Definition: CreatureData.h:34
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition: PlayerQuest.cpp:1913

References ASSERT, CreatureTemplate::Entry, CreatureTemplate::KillCredit, KilledMonsterCredit(), and MAX_KILL_CREDIT.

Referenced by KillRewarder::_RewardKillCredit(), and npc_drakuru_shackles::npc_drakuru_shacklesAI::SpellHit().

◆ KilledMonsterCredit()

void Player::KilledMonsterCredit ( uint32  entry,
ObjectGuid  guid = ObjectGuid::Empty 
)
1914{
1915 uint16 addkillcount = 1;
1916 uint32 real_entry = entry;
1917 if (guid)
1918 {
1919 Creature* killed = GetMap()->GetCreature(guid);
1920 if (killed && killed->GetEntry())
1921 real_entry = killed->GetEntry();
1922 }
1923
1924 StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_CREATURE, real_entry); // MUST BE CALLED FIRST
1925 UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, real_entry, addkillcount, guid ? GetMap()->GetCreature(guid) : nullptr);
1926
1927 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
1928 {
1929 uint32 questid = GetQuestSlotQuestId(i);
1930 if (!questid)
1931 continue;
1932
1933 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
1934 if (!qInfo)
1935 continue;
1936 // just if !ingroup || !noraidgroup || raidgroup
1937 // xinef: or is pvp quest, and player in BG/BF group
1938 QuestStatusData& q_status = m_QuestStatus[questid];
1939 if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid(GetMap()->GetDifficulty()) ||
1940 (qInfo->IsPVPQuest() && (GetGroup()->isBFGroup() || GetGroup()->isBGGroup()))))
1941 {
1942 if (!sScriptMgr->PassedQuestKilledMonsterCredit(this, qInfo, entry, real_entry, guid))
1943 continue;
1944
1945 if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_KILL) /*&& !qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_CAST)*/)
1946 {
1947 for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
1948 {
1949 // skip GO activate objective or none
1950 if (qInfo->RequiredNpcOrGo[j] <= 0)
1951 continue;
1952
1953 uint32 reqkill = qInfo->RequiredNpcOrGo[j];
1954
1955 if (reqkill == real_entry)
1956 {
1957 uint32 reqkillcount = qInfo->RequiredNpcOrGoCount[j];
1958 uint16 curkillcount = q_status.CreatureOrGOCount[j];
1959 if (curkillcount < reqkillcount)
1960 {
1961 q_status.CreatureOrGOCount[j] = curkillcount + addkillcount;
1962
1963 m_QuestStatusSave[questid] = true;
1964
1965 SendQuestUpdateAddCreatureOrGo(qInfo, guid, j, curkillcount, addkillcount);
1966 }
1967 if (CanCompleteQuest(questid))
1968 CompleteQuest(questid);
1969 else
1971
1972 // same objective target can be in many active quests, but not in 2 objectives for single quest (code optimization).
1973 break;
1974 }
1975 }
1976 }
1977 }
1978 }
1979}
@ ACHIEVEMENT_TIMED_TYPE_CREATURE
Definition: DBCEnums.h:122
@ ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE
Definition: DBCEnums.h:130
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:213
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3307
bool IsPVPQuest() const
Definition: QuestDef.h:292

References ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEVEMENT_TIMED_TYPE_CREATURE, ADDITIONAL_SAVING_QUEST_STATUS, AdditionalSavingAddMask(), CanCompleteQuest(), CompleteQuest(), QuestStatusData::CreatureOrGOCount, Map::GetCreature(), GetDifficulty(), Object::GetEntry(), GetGroup(), WorldObject::GetMap(), GetQuestSlotQuestId(), Quest::HasSpecialFlag(), Quest::IsAllowedInRaid(), Quest::IsPVPQuest(), m_QuestStatus, m_QuestStatusSave, MAX_QUEST_LOG_SIZE, QUEST_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_KILL, QUEST_STATUS_INCOMPLETE, Quest::RequiredNpcOrGo, Quest::RequiredNpcOrGoCount, SendQuestUpdateAddCreatureOrGo(), sObjectMgr, sScriptMgr, StartTimedAchievement(), QuestStatusData::Status, and UpdateAchievementCriteria().

Referenced by npc_dragonmaw_peon::npc_dragonmaw_peonAI::CreditPlayer(), BattlegroundAV::EventPlayerAssaultsPoint(), BattlegroundAB::EventPlayerClickedOnFlag(), go_tadpole_cage::go_tadpole_cageAI::GossipHello(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraDummy(), spell_q10714_on_spirits_wings::HandleDummy(), spell_q6124_6129_apply_salve::HandleDummy(), spell_q12937_relief_for_the_fallen::HandleDummy(), spell_q12659_ahunaes_knife::HandleDummy(), spell_q9874_liquid_fire::HandleDummy(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), OutdoorPvPNA::HandleKillImpl(), BattlegroundAV::HandleKillUnit(), spell_q12805_lifeblood_dummy::HandleScript(), spell_q10612_10613_the_fel_and_the_furious::spell_q10612_10613_the_fel_and_the_furious_SpellScript::HandleScriptEffect(), spell_q11065_wrangle_some_aether_rays_aura::if(), spell_gen_have_item_auras::if(), npc_nerubar_victim::npc_nerubar_victimAI::JustDied(), KilledMonster(), npc_brewfest_keg_reciver::MoveInLineOfSight(), npc_brewfest_bark_trigger::MoveInLineOfSight(), npc_creditmarker_visit_with_ancestors::npc_creditmarker_visit_with_ancestorsAI::MoveInLineOfSight(), go_scourge_enclosure::OnGossipHello(), go_warmaul_prison::OnGossipHello(), go_scourge_cage::OnGossipHello(), go_jotunheim_cage::OnGossipHello(), go_dragonflayer_cage::OnGossipHello(), go_veil_skith_cage::OnGossipHello(), npc_captain_saeed::OnGossipSelect(), RewardPlayerAndGroupAtEvent(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), npc_hallows_end_train_fire::SpellHit(), npc_jungle_punch_target::npc_jungle_punch_targetAI::SpellHit(), and npc_iron_watcher::npc_iron_watcherAI::SpellHit().

◆ KilledPlayerCredit()

void Player::KilledPlayerCredit ( uint16  count = 1)
1982{
1983 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
1984 {
1985 uint32 questid = GetQuestSlotQuestId(i);
1986 if (!questid)
1987 {
1988 continue;
1989 }
1990
1991 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
1992 if (!qInfo)
1993 {
1994 continue;
1995 }
1996
1997 // just if !ingroup || !noraidgroup || raidgroup
1998 QuestStatusData& q_status = m_QuestStatus[questid];
1999 if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid(GetMap()->GetDifficulty())))
2000 {
2001 // Xinef: PvP Killing quest require player to be in same zone as quest zone (only 2 quests so no doubt, can be extended to conditions in cata ;s)
2002 if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_PLAYER_KILL) && (qInfo->GetZoneOrSort() >= 0 && GetZoneId() == uint32(qInfo->GetZoneOrSort())))
2003 {
2004 KilledPlayerCreditForQuest(count, qInfo);
2005 break; // there is only one quest per zone
2006 }
2007 }
2008 }
2009}
void KilledPlayerCreditForQuest(uint16 count, Quest const *quest)
Definition: PlayerQuest.cpp:2011
int32 GetZoneOrSort() const
Definition: QuestDef.h:227

References GetDifficulty(), GetGroup(), WorldObject::GetMap(), GetQuestSlotQuestId(), WorldObject::GetZoneId(), Quest::GetZoneOrSort(), Quest::HasSpecialFlag(), Quest::IsAllowedInRaid(), KilledPlayerCreditForQuest(), m_QuestStatus, MAX_QUEST_LOG_SIZE, QUEST_SPECIAL_FLAGS_PLAYER_KILL, QUEST_STATUS_INCOMPLETE, sObjectMgr, and QuestStatusData::Status.

Referenced by KillRewarder::_RewardPlayer().

◆ KilledPlayerCreditForQuest()

void Player::KilledPlayerCreditForQuest ( uint16  count,
Quest const *  quest 
)
2012{
2013 uint32 const questId = quest->GetQuestId();
2014
2015 auto it = m_QuestStatus.find(questId);
2016 if (it == m_QuestStatus.end())
2017 {
2018 return;
2019 }
2020
2021 QuestStatusData& questStatus = it->second;
2022
2023 uint16 curKill = questStatus.PlayerCount;
2024 uint32 reqKill = quest->GetPlayersSlain();
2025
2026 if (curKill < reqKill)
2027 {
2028 count = std::min<uint16>(reqKill - curKill, count);
2029 questStatus.PlayerCount = curKill + count;
2030
2031 m_QuestStatusSave[quest->GetQuestId()] = true;
2032
2033 SendQuestUpdateAddPlayer(quest, curKill, count);
2034 }
2035
2036 if (CanCompleteQuest(questId))
2037 {
2038 CompleteQuest(questId);
2039 }
2040}
void SendQuestUpdateAddPlayer(Quest const *quest, uint16 old_count, uint16 add_count)
Definition: PlayerQuest.cpp:2465

References CanCompleteQuest(), CompleteQuest(), Quest::GetPlayersSlain(), Quest::GetQuestId(), m_QuestStatus, m_QuestStatusSave, QuestStatusData::PlayerCount, and SendQuestUpdateAddPlayer().

Referenced by KilledPlayerCredit().

◆ KillPlayer()

void Player::KillPlayer ( )
4466{
4467 if (IsFlying() && !GetTransport())
4469
4471
4472 StopMirrorTimers(); //disable timers(bars)
4473
4474 setDeathState(DeathState::Corpse);
4475 //SetUnitFlag(UNIT_FLAG_NOT_IN_PVP);
4476
4479
4480 // 6 minutes until repop at graveyard
4482
4483 UpdateCorpseReclaimDelay(); // dependent at use SetDeathPvP() call before kill
4484
4485 int32 corpseReclaimDelay = CalculateCorpseReclaimDelay();
4486
4487 if (corpseReclaimDelay >= 0)
4488 SendCorpseReclaimDelay(corpseReclaimDelay);
4489
4490 // don't create corpse at this moment, player might be falling
4491
4492 // update visibility
4493 //UpdateObjectVisibility(); // pussywizard: not needed
4494}
@ PLAYER_FIELD_BYTE_RELEASE_TIMER
Definition: Player.h:561
@ MOVE_ROOT
Definition: Player.h:457
@ SPELL_AURA_PREVENT_RESURRECTION
Definition: SpellAuraDefines.h:377
@ UNIT_DYNFLAG_NONE
Definition: SharedDefines.h:3120
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
Definition: Object.cpp:899
void UpdateCorpseReclaimDelay()
Definition: PlayerUpdates.cpp:1883
void setDeathState(DeathState s, bool despawn=false) override
Definition: Player.cpp:1007
void ReplaceAllDynamicFlags(uint32 flag) override
Definition: Unit.h:1338
MotionMaster * GetMotionMaster()
Definition: Unit.h:2276
bool IsFlying() const
Definition: Unit.h:2399
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
Definition: MotionMaster.cpp:587

References Object::ApplyModFlag(), CalculateCorpseReclaimDelay(), WorldLocation::GetMapId(), Unit::GetMotionMaster(), WorldObject::GetTransport(), Unit::HasAuraType(), IN_MILLISECONDS, Unit::IsFlying(), m_deathTimer, MINUTE, MOVE_ROOT, MotionMaster::MoveFall(), PLAYER_FIELD_BYTE_RELEASE_TIMER, PLAYER_FIELD_BYTES, Unit::ReplaceAllDynamicFlags(), SendCorpseReclaimDelay(), setDeathState(), SetMovement(), sMapStore, SPELL_AURA_PREVENT_RESURRECTION, StopMirrorTimers(), UNIT_DYNFLAG_NONE, and UpdateCorpseReclaimDelay().

Referenced by WorldSession::HandleMovementOpcodes(), WorldSession::HandleRepopRequestOpcode(), WorldSession::LogoutPlayer(), and Update().

◆ LearnCustomSpells()

void Player::LearnCustomSpells ( )
11753{
11754 if (!sWorld->getBoolConfig(CONFIG_START_CUSTOM_SPELLS))
11755 {
11756 return;
11757 }
11758
11759 // learn default race/class spells
11760 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
11761 ASSERT(info);
11762 for (PlayerCreateInfoSpells::const_iterator itr = info->customSpells.begin(); itr != info->customSpells.end(); ++itr)
11763 {
11764 uint32 tspell = *itr;
11765 LOG_DEBUG("entities.player.loading", "Player::LearnCustomSpells: Player '{}' ({}, Class: {} Race: {}): Adding initial spell (SpellID: {})",
11766 GetName(), GetGUID().ToString(), uint32(getClass()), uint32(getRace()), tspell);
11767 if (!IsInWorld()) // will send in INITIAL_SPELLS in list anyway at map add
11768 {
11769 addSpell(tspell, SPEC_MASK_ALL, true);
11770 }
11771 else // but send in normal spell in game learn case
11772 {
11773 learnSpell(tspell);
11774 }
11775 }
11776}
@ CONFIG_START_CUSTOM_SPELLS
Definition: IWorld.h:130
PlayerCreateInfoSpells customSpells
Definition: Player.h:349

References addSpell(), ASSERT, CONFIG_START_CUSTOM_SPELLS, PlayerInfo::customSpells, Unit::getClass(), Object::GetGUID(), WorldObject::GetName(), Unit::getRace(), Object::IsInWorld(), learnSpell(), LOG_DEBUG, sObjectMgr, SPEC_MASK_ALL, sWorld, and Position::ToString().

Referenced by Create(), learn_commandscript::HandleLearnAllDefaultCommand(), LoadFromDB(), and resetSpells().

◆ LearnDefaultSkill()

void Player::LearnDefaultSkill ( uint32  skillId,
uint16  rank 
)
11793{
11794 SkillRaceClassInfoEntry const* rcInfo = GetSkillRaceClassInfo(skillId, getRace(), getClass());
11795 if (!rcInfo)
11796 return;
11797
11798 LOG_DEBUG("entities.player.loading", "PLAYER (Class: {} Race: {}): Adding initial skill, id = {}", uint32(getClass()), uint32(getRace()), skillId);
11799 switch (GetSkillRangeType(rcInfo))
11800 {
11802 SetSkill(skillId, 0, 300, 300);
11803 break;
11804 case SKILL_RANGE_LEVEL:
11805 {
11806 uint16 skillValue = 1;
11807 uint16 maxValue = GetMaxSkillValueForLevel();
11808 if (sWorld->getBoolConfig(CONFIG_ALWAYS_MAXSKILL) && !IsProfessionOrRidingSkill(skillId))
11809 {
11810 skillValue = maxValue;
11811 }
11812 else if (rcInfo->Flags & SKILL_FLAG_ALWAYS_MAX_VALUE)
11813 {
11814 skillValue = maxValue;
11815 }
11816 else if (getClass() == CLASS_DEATH_KNIGHT)
11817 {
11818 skillValue = std::min(std::max<uint16>({ 1, uint16((GetLevel() - 1) * 5) }), maxValue);
11819 }
11820 else if (skillId == SKILL_FIST_WEAPONS)
11821 {
11822 skillValue = std::max<uint16>(1, GetSkillValue(SKILL_UNARMED));
11823 }
11824 else if (skillId == SKILL_LOCKPICKING)
11825 {
11826 skillValue = std::max<uint16>(1, GetSkillValue(SKILL_LOCKPICKING));
11827 }
11828
11829 SetSkill(skillId, 0, skillValue, maxValue);
11830 break;
11831 }
11832 case SKILL_RANGE_MONO:
11833 SetSkill(skillId, 0, 1, 1);
11834 break;
11835 case SKILL_RANGE_RANK:
11836 {
11837 if (!rank)
11838 {
11839 break;
11840 }
11841
11842 SkillTiersEntry const* tier = sSkillTiersStore.LookupEntry(rcInfo->SkillTierID);
11843 uint16 maxValue = tier->Value[std::max<int32>(rank - 1, 0)];
11844 uint16 skillValue = 1;
11845 if (rcInfo->Flags & SKILL_FLAG_ALWAYS_MAX_VALUE)
11846 {
11847 skillValue = maxValue;
11848 }
11849 else if (getClass() == CLASS_DEATH_KNIGHT)
11850 {
11851 skillValue = std::min(std::max<uint16>({ uint16(1), uint16((GetLevel() - 1) * 5) }), maxValue);
11852 }
11853
11854 SetSkill(skillId, rank, skillValue, maxValue);
11855 break;
11856 }
11857 default:
11858 break;
11859 }
11860}
@ SKILL_RANGE_RANK
Definition: ObjectMgr.h:682
bool IsProfessionOrRidingSkill(uint32 skill)
Definition: SpellMgr.h:623
@ SKILL_FLAG_ALWAYS_MAX_VALUE
Definition: DBCEnums.h:394
uint32 SkillTierID
Definition: DBCStructure.h:1574
uint32 Flags
Definition: DBCStructure.h:1572
uint32 Value[MAX_SKILL_STEP]
Definition: DBCStructure.h:1616

References CLASS_DEATH_KNIGHT, CONFIG_ALWAYS_MAXSKILL, SkillRaceClassInfoEntry::Flags, Unit::getClass(), Unit::GetLevel(), GetMaxSkillValueForLevel(), Unit::getRace(), GetSkillRaceClassInfo(), GetSkillRangeType(), GetSkillValue(), IsProfessionOrRidingSkill(), LOG_DEBUG, SetSkill(), SKILL_FIST_WEAPONS, SKILL_FLAG_ALWAYS_MAX_VALUE, SKILL_LOCKPICKING, SKILL_RANGE_LANGUAGE, SKILL_RANGE_LEVEL, SKILL_RANGE_MONO, SKILL_RANGE_RANK, SKILL_UNARMED, SkillRaceClassInfoEntry::SkillTierID, sSkillTiersStore, sWorld, and SkillTiersEntry::Value.

Referenced by _addSpell(), and LearnDefaultSkills().

◆ LearnDefaultSkills()

void Player::LearnDefaultSkills ( )
11779{
11780 // learn default race/class skills
11781 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
11782 for (PlayerCreateInfoSkills::const_iterator itr = info->skills.begin(); itr != info->skills.end(); ++itr)
11783 {
11784 uint32 skillId = itr->SkillId;
11785 if (HasSkill(skillId))
11786 continue;
11787
11788 LearnDefaultSkill(skillId, itr->Rank);
11789 }
11790}
PlayerCreateInfoSkills skills
Definition: Player.h:352

References Unit::getClass(), Unit::getRace(), HasSkill(), LearnDefaultSkill(), PlayerInfo::skills, and sObjectMgr.

Referenced by Create(), learn_commandscript::HandleLearnAllDefaultCommand(), LoadFromDB(), and resetSpells().

◆ LearnPetTalent()

void Player::LearnPetTalent ( ObjectGuid  petGuid,
uint32  talentId,
uint32  talentRank 
)
13993{
13994 Pet* pet = GetPet();
13995
13996 if (!pet)
13997 return;
13998
13999 if (petGuid != pet->GetGUID())
14000 return;
14001
14002 uint32 CurTalentPoints = pet->GetFreeTalentPoints();
14003
14004 if (CurTalentPoints == 0)
14005 return;
14006
14007 if (talentRank >= MAX_PET_TALENT_RANK)
14008 return;
14009
14010 TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
14011
14012 if (!talentInfo)
14013 return;
14014
14015 TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
14016
14017 if (!talentTabInfo)
14018 return;
14019
14020 CreatureTemplate const* ci = pet->GetCreatureTemplate();
14021
14022 if (!ci)
14023 return;
14024
14025 CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->family);
14026
14027 if (!pet_family)
14028 return;
14029
14030 if (pet_family->petTalentType < 0) // not hunter pet
14031 return;
14032
14033 // prevent learn talent for different family (cheating)
14034 if (!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask))
14035 return;
14036
14037 // find current max talent rank (0~5)
14038 uint8 curtalent_maxrank = 0; // 0 = not learned any rank
14039 for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank)
14040 {
14041 if (talentInfo->RankID[rank] && pet->HasSpell(talentInfo->RankID[rank]))
14042 {
14043 curtalent_maxrank = (rank + 1);
14044 break;
14045 }
14046 }
14047
14048 // we already have same or higher talent rank learned
14049 if (curtalent_maxrank >= (talentRank + 1))
14050 return;
14051
14052 // check if we have enough talent points
14053 if (CurTalentPoints < (talentRank - curtalent_maxrank + 1))
14054 return;
14055
14056 // Check if it requires another talent
14057 if (talentInfo->DependsOn > 0)
14058 {
14059 if (TalentEntry const* depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn))
14060 {
14061 bool hasEnoughRank = false;
14062 for (uint8 rank = talentInfo->DependsOnRank; rank < MAX_TALENT_RANK; rank++)
14063 {
14064 if (depTalentInfo->RankID[rank] != 0)
14065 if (pet->HasSpell(depTalentInfo->RankID[rank]))
14066 hasEnoughRank = true;
14067 }
14068 if (!hasEnoughRank)
14069 return;
14070 }
14071 }
14072
14073 // Find out how many points we have in this field
14074 uint32 spentPoints = 0;
14075
14076 uint32 tTab = talentInfo->TalentTab;
14077 if (talentInfo->Row > 0)
14078 {
14079 uint32 numRows = sTalentStore.GetNumRows();
14080 for (uint32 i = 0; i < numRows; ++i) // Loop through all talents.
14081 {
14082 // Someday, someone needs to revamp
14083 const TalentEntry* tmpTalent = sTalentStore.LookupEntry(i);
14084 if (tmpTalent) // the way talents are tracked
14085 {
14086 if (tmpTalent->TalentTab == tTab)
14087 {
14088 for (uint8 rank = 0; rank < MAX_TALENT_RANK; rank++)
14089 {
14090 if (tmpTalent->RankID[rank] != 0)
14091 {
14092 if (pet->HasSpell(tmpTalent->RankID[rank]))
14093 {
14094 spentPoints += (rank + 1);
14095 }
14096 }
14097 }
14098 }
14099 }
14100 }
14101 }
14102
14103 // not have required min points spent in talent tree
14104 if (spentPoints < (talentInfo->Row * MAX_PET_TALENT_RANK))
14105 return;
14106
14107 // spell not set in talent.dbc
14108 uint32 spellid = talentInfo->RankID[talentRank];
14109 if (spellid == 0)
14110 {
14111 LOG_ERROR("entities.player", "Talent.dbc have for talent: {} Rank: {} spell id = 0", talentId, talentRank);
14112 return;
14113 }
14114
14115 // already known
14116 if (pet->HasSpell(spellid))
14117 return;
14118
14119 // learn! (other talent ranks will unlearned at learning)
14120 pet->learnSpell(spellid);
14121 LOG_DEBUG("entities.player", "PetTalentID: {} Rank: {} Spell: {}\n", talentId, talentRank, spellid);
14122
14123 // update free talent points
14124 pet->SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1));
14125}
#define MAX_PET_TALENT_RANK
Definition: DBCStructure.h:1920
void SetFreeTalentPoints(uint8 points)
Definition: Pet.h:131
bool learnSpell(uint32 spell_id)
Definition: Pet.cpp:1903
uint32 Row
Definition: DBCStructure.h:1927
uint32 DependsOnRank
Definition: DBCStructure.h:1933
uint32 DependsOn
Definition: DBCStructure.h:1931

References TalentEntry::DependsOn, TalentEntry::DependsOnRank, CreatureTemplate::family, Creature::GetCreatureTemplate(), Pet::GetFreeTalentPoints(), Object::GetGUID(), GetPet(), Pet::HasSpell(), Pet::learnSpell(), LOG_DEBUG, LOG_ERROR, MAX_PET_TALENT_RANK, MAX_TALENT_RANK, TalentTabEntry::petTalentMask, CreatureFamilyEntry::petTalentType, TalentEntry::RankID, TalentEntry::Row, sCreatureFamilyStore, Pet::SetFreeTalentPoints(), sTalentStore, sTalentTabStore, and TalentEntry::TalentTab.

Referenced by WorldSession::HandleLearnPreviewTalentsPet(), and WorldSession::HandlePetLearnTalent().

◆ learnQuestRewardedSpells() [1/2]

void Player::learnQuestRewardedSpells ( )
11895{
11896 // learn spells received from quest completing
11897 for (RewardedQuestSet::const_iterator itr = m_RewardedQuests.begin(); itr != m_RewardedQuests.end(); ++itr)
11898 {
11899 Quest const* quest = sObjectMgr->GetQuestTemplate(*itr);
11900 if (!quest)
11901 continue;
11902
11904 }
11905}

References learnQuestRewardedSpells(), m_RewardedQuests, and sObjectMgr.

Referenced by _LoadQuestStatusRewarded(), learn_commandscript::HandleLearnAllDefaultCommand(), learnQuestRewardedSpells(), and resetSpells().

◆ learnQuestRewardedSpells() [2/2]

void Player::learnQuestRewardedSpells ( Quest const *  quest)
11863{
11864 // xinef: quest does not learn anything
11865 int32 spellId = quest->GetRewSpellCast();
11866 if (!spellId)
11867 return;
11868
11869 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
11870 if (!spellInfo)
11871 return;
11872
11873 // xinef: find effect with learn spell and check if we have this spell
11874 bool found = false;
11875 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
11876 if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL && spellInfo->Effects[i].TriggerSpell && !HasSpell(spellInfo->Effects[i].TriggerSpell))
11877 {
11878 // pusywizard: don't re-add profession specialties!
11879 if (SpellInfo const* triggeredInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell))
11880 if (triggeredInfo->Effects[0].Effect == SPELL_EFFECT_TRADE_SKILL)
11881 break; // pussywizard: break and not cast the spell (found is false)
11882
11883 found = true;
11884 break;
11885 }
11886
11887 // xinef: we know the spell, return
11888 if (!found)
11889 return;
11890
11891 CastSpell(this, spellId, true);
11892}
@ SPELL_EFFECT_TRADE_SKILL
Definition: SharedDefines.h:825

References Unit::CastSpell(), SpellInfo::Effects, Quest::GetRewSpellCast(), HasSpell(), MAX_SPELL_EFFECTS, SPELL_EFFECT_LEARN_SPELL, SPELL_EFFECT_TRADE_SKILL, and sSpellMgr.

◆ learnSkillRewardedSpells()

void Player::learnSkillRewardedSpells ( uint32  id,
uint32  value 
)
11908{
11909 uint32 raceMask = getRaceMask();
11910 uint32 classMask = getClassMask();
11911 for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j)
11912 {
11913 SkillLineAbilityEntry const* pAbility = sSkillLineAbilityStore.LookupEntry(j);
11914 if (!pAbility || pAbility->SkillLine != skill_id)
11915 {
11916 continue;
11917 }
11918
11919 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pAbility->Spell);
11920 if (!spellInfo)
11921 {
11922 continue;
11923 }
11924
11926 {
11927 continue;
11928 }
11929
11930 // Check race if set
11931 if (pAbility->RaceMask && !(pAbility->RaceMask & raceMask))
11932 {
11933 continue;
11934 }
11935
11936 // Check class if set
11937 if (pAbility->ClassMask && !(pAbility->ClassMask & classMask))
11938 {
11939 continue;
11940 }
11941
11942 // need unlearn spell
11943 if (skill_value < pAbility->MinSkillLineRank && pAbility->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE)
11944 {
11945 removeSpell(pAbility->Spell, GetActiveSpec(), true);
11946 }
11947 // need learn
11948 else
11949 {
11950 //used to avoid double Seal of Righteousness on paladins, it's the only player spell which has both spell and forward spell in auto learn
11952 {
11953 bool skipCurrent = false;
11954 auto bounds = sSpellMgr->GetSkillLineAbilityMapBounds(pAbility->SupercededBySpell);
11955 for (auto itr = bounds.first; itr != bounds.second; ++itr)
11956 {
11957 if (itr->second->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN && skill_value >= itr->second->MinSkillLineRank)
11958 {
11959 skipCurrent = true;
11960 break;
11961 }
11962 }
11963 if (skipCurrent)
11964 {
11965 continue;
11966 }
11967 }
11968
11969 if (!IsInWorld())
11970 {
11971 addSpell(pAbility->Spell, SPEC_MASK_ALL, true, true);
11972 }
11973 else
11974 {
11975 learnSpell(pAbility->Spell, true, true);
11976 }
11977 }
11978 }
11979}
DBCStorage< SkillLineAbilityEntry > sSkillLineAbilityStore(SkillLineAbilityfmt)
@ SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE
Definition: DBCEnums.h:368
Definition: DBCStructure.h:1596
uint32 SkillLine
Definition: DBCStructure.h:1598
uint32 SupercededBySpell
Definition: DBCStructure.h:1605
uint32 Spell
Definition: DBCStructure.h:1599
uint32 AcquireMethod
Definition: DBCStructure.h:1606
uint32 ClassMask
Definition: DBCStructure.h:1601
uint32 RaceMask
Definition: DBCStructure.h:1600

References SkillLineAbilityEntry::AcquireMethod, addSpell(), SkillLineAbilityEntry::ClassMask, GetActiveSpec(), Unit::getClassMask(), Unit::getRaceMask(), Object::IsInWorld(), learnSpell(), SkillLineAbilityEntry::RaceMask, removeSpell(), SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN, SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE, SkillLineAbilityEntry::SkillLine, SPEC_MASK_ALL, SkillLineAbilityEntry::Spell, sSkillLineAbilityStore, sSpellMgr, and SkillLineAbilityEntry::SupercededBySpell.

Referenced by _LoadSkills(), SetSkill(), and UpdateSkillPro().

◆ learnSpell()

void Player::learnSpell ( uint32  spellId,
bool  temporary = false,
bool  learnFromSkill = false 
)
3244{
3245 // Xinef: don't allow to learn active spell once more
3246 if (HasActiveSpell(spellId))
3247 {
3248 LOG_DEBUG("entities.player", "Player ({}) tries to learn already active spell: {}", GetGUID().ToString(), spellId);
3249 return;
3250 }
3251
3252 uint32 firstRankSpellId = sSpellMgr->GetFirstSpellInChain(spellId);
3253 bool thisSpec = GetTalentSpellCost(firstRankSpellId) > 0 || sSpellMgr->IsAdditionalTalentSpell(firstRankSpellId);
3254 bool added = addSpell(spellId, thisSpec ? GetActiveSpecMask() : SPEC_MASK_ALL, true, temporary, learnFromSkill);
3255 if (added)
3256 {
3257 sScriptMgr->OnPlayerLearnSpell(this, spellId);
3258
3259 // pussywizard: a system message "you have learnt spell X (rank Y)"
3260 if (IsInWorld())
3261 SendLearnPacket(spellId, true);
3262 }
3263
3264 // pussywizard: rank stuff at the end!
3265 if (uint32 nextSpell = sSpellMgr->GetNextSpellInChain(spellId))
3266 {
3267 // pussywizard: lookup next rank in m_spells (the only talents on m_spella are for example pyroblast, that have all ranks restored upon learning rank 1)
3268 // pussywizard: next ranks must not be in current spec (otherwise no need to learn already learnt)
3269 PlayerSpellMap::iterator itr = m_spells.find(nextSpell);
3270 if (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && !itr->second->IsInSpec(m_activeSpec))
3271 learnSpell(nextSpell, temporary);
3272 }
3273
3274 // xinef: if we learn new spell, check all spells requiring this spell, if we have such a spell, and it is not in current spec - learn it
3275 SpellsRequiringSpellMapBounds spellsRequiringSpell = sSpellMgr->GetSpellsRequiringSpellBounds(spellId);
3276 for (SpellsRequiringSpellMap::const_iterator itr = spellsRequiringSpell.first; itr != spellsRequiringSpell.second; ++itr)
3277 {
3278 PlayerSpellMap::iterator itr2 = m_spells.find(itr->second);
3279 if (itr2 != m_spells.end() && itr2->second->State != PLAYERSPELL_REMOVED && !itr2->second->IsInSpec(m_activeSpec))
3280 learnSpell(itr2->first, temporary);
3281 }
3282}
uint32 GetTalentSpellCost(uint32 spellId)
Definition: DBCStores.cpp:682

References addSpell(), GetActiveSpecMask(), Object::GetGUID(), GetTalentSpellCost(), HasActiveSpell(), Object::IsInWorld(), learnSpell(), LOG_DEBUG, m_activeSpec, m_spells, PLAYERSPELL_REMOVED, SendLearnPacket(), SPEC_MASK_ALL, sScriptMgr, sSpellMgr, and Position::ToString().

Referenced by _addSpell(), Spell::EffectLearnSpell(), learn_commandscript::HandleLearnAllGMCommand(), learn_commandscript::HandleLearnAllLangCommand(), learn_commandscript::HandleLearnAllMySpellsCommand(), learn_commandscript::HandleLearnSkillRecipesHelper(), Acore::PlayerCommand::HandleLearnSpellCommand(), spell_gen_profession_research::HandleScript(), spell_item_book_of_glyph_mastery::HandleScript(), WorldSession::HandleTrainerBuySpellOpcode(), LearnCustomSpells(), learnSkillRewardedSpells(), learnSpell(), learnSpellHighRank(), LearnTalent(), and UpdateCraftSkill().

◆ learnSpellHighRank()

void Player::learnSpellHighRank ( uint32  spellid)
13580{
13581 learnSpell(spellid);
13582
13583 if (uint32 next = sSpellMgr->GetNextSpellInChain(spellid))
13584 learnSpellHighRank(next);
13585}
void learnSpellHighRank(uint32 spellid)
Definition: Player.cpp:13579

References learnSpell(), learnSpellHighRank(), and sSpellMgr.

Referenced by learnSpellHighRank().

◆ LearnTalent()

void Player::LearnTalent ( uint32  talentId,
uint32  talentRank,
bool  command = false 
)
13857{
13858 uint32 CurTalentPoints = GetFreeTalentPoints();
13859
13860 if (!command)
13861 {
13862 // xinef: check basic data
13863 if (!CurTalentPoints)
13864 {
13865 return;
13866 }
13867
13868 if (talentRank >= MAX_TALENT_RANK)
13869 {
13870 return;
13871 }
13872 }
13873
13874 TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
13875 if (!talentInfo)
13876 return;
13877
13878 TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
13879 if (!talentTabInfo)
13880 return;
13881
13882 // xinef: prevent learn talent for different class (cheating)
13883 if ((getClassMask() & talentTabInfo->ClassMask) == 0)
13884 return;
13885
13886 // xinef: find current talent rank
13887 uint32 currentTalentRank = 0;
13888 for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank)
13889 {
13890 if (talentInfo->RankID[rank] && HasTalent(talentInfo->RankID[rank], GetActiveSpec()))
13891 {
13892 currentTalentRank = rank + 1;
13893 break;
13894 }
13895 }
13896
13897 // xinef: we already have same or higher rank talent learned
13898 if (currentTalentRank >= talentRank + 1)
13899 return;
13900
13901 uint32 talentPointsChange = (talentRank - currentTalentRank + 1);
13902 if (!command)
13903 {
13904 // xinef: check if we have enough free talent points
13905 if (CurTalentPoints < talentPointsChange)
13906 {
13907 return;
13908 }
13909 }
13910
13911 // xinef: check if talent deponds on another talent
13912 if (talentInfo->DependsOn > 0)
13913 if (TalentEntry const* depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn))
13914 {
13915 bool hasEnoughRank = false;
13916 for (uint8 rank = talentInfo->DependsOnRank; rank < MAX_TALENT_RANK; rank++)
13917 {
13918 if (depTalentInfo->RankID[rank] != 0)
13919 if (HasTalent(depTalentInfo->RankID[rank], GetActiveSpec()))
13920 {
13921 hasEnoughRank = true;
13922 break;
13923 }
13924 }
13925
13926 // xinef: does not have enough talent points spend in required talent
13927 if (!hasEnoughRank)
13928 return;
13929 }
13930
13931 if (!command)
13932 {
13933 // xinef: check amount of points spent in current talent tree
13934 // xinef: be smart and quick
13935 uint32 spentPoints = 0;
13936 if (talentInfo->Row > 0)
13937 {
13938 const PlayerTalentMap& talentMap = GetTalentMap();
13939 for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr)
13940 if (TalentSpellPos const* talentPos = GetTalentSpellPos(itr->first))
13941 if (TalentEntry const* itrTalentInfo = sTalentStore.LookupEntry(talentPos->talent_id))
13942 if (itrTalentInfo->TalentTab == talentInfo->TalentTab)
13943 if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(GetActiveSpec())) // pussywizard
13944 spentPoints += talentPos->rank + 1;
13945 }
13946
13947 // xinef: we do not have enough talent points to add talent of this tier
13948 if (spentPoints < (talentInfo->Row * MAX_TALENT_RANK))
13949 return;
13950 }
13951
13952 // xinef: hacking attempt, tries to learn unknown rank
13953 uint32 spellId = talentInfo->RankID[talentRank];
13954 if (spellId == 0)
13955 return;
13956
13957 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
13958 if (!spellInfo)
13959 return;
13960
13961 bool learned = false;
13962
13963 // xinef: if talent info has special marker in dbc - add to spell book
13964 if (talentInfo->addToSpellBook)
13965 if (!spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
13966 {
13967 learnSpell(spellId);
13968 learned = true;
13969 }
13970
13971 if (!learned)
13972 SendLearnPacket(spellId, true);
13973
13974 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
13975 if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL)
13976 if (sSpellMgr->IsAdditionalTalentSpell(spellInfo->Effects[i].TriggerSpell))
13977 learnSpell(spellInfo->Effects[i].TriggerSpell);
13978
13979 addTalent(spellId, GetActiveSpecMask(), currentTalentRank);
13980
13981 // xinef: update free talent points count
13982 m_usedTalentCount += talentPointsChange;
13983
13984 if (!command)
13985 {
13986 SetFreeTalentPoints(CurTalentPoints - talentPointsChange);
13987 }
13988
13989 sScriptMgr->OnPlayerLearnTalents(this, talentId, talentRank, spellId);
13990}
uint32 ClassMask
Definition: DBCStructure.h:1947

References addTalent(), TalentEntry::addToSpellBook, TalentTabEntry::ClassMask, TalentEntry::DependsOn, TalentEntry::DependsOnRank, SpellInfo::Effects, GetActiveSpec(), GetActiveSpecMask(), Unit::getClassMask(), GetFreeTalentPoints(), GetTalentMap(), GetTalentSpellPos(), SpellInfo::HasAttribute(), SpellInfo::HasEffect(), HasTalent(), learnSpell(), m_usedTalentCount, MAX_SPELL_EFFECTS, MAX_TALENT_RANK, PLAYERSPELL_REMOVED, TalentEntry::RankID, TalentEntry::Row, SendLearnPacket(), SetFreeTalentPoints(), SPELL_ATTR0_PASSIVE, SPELL_EFFECT_LEARN_SPELL, sScriptMgr, sSpellMgr, sTalentStore, sTalentTabStore, and TalentEntry::TalentTab.

Referenced by learn_commandscript::HandleLearnAllMyTalentsCommand(), WorldSession::HandleLearnPreviewTalents(), and WorldSession::HandleLearnTalentOpcode().

◆ LeaveAllArenaTeams()

void Player::LeaveAllArenaTeams ( ObjectGuid  guid)
static
10096{
10097 // xinef: sync query
10099 stmt->SetData(0, guid.GetCounter());
10100 PreparedQueryResult result = CharacterDatabase.Query(stmt);
10101
10102 if (!result)
10103 return;
10104
10105 do
10106 {
10107 Field* fields = result->Fetch();
10108 uint32 arenaTeamId = fields[0].Get<uint32>();
10109 if (arenaTeamId != 0)
10110 {
10111 ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
10112 if (arenaTeam)
10113 arenaTeam->DelMember(guid, true);
10114 }
10115 } while (result->NextRow());
10116}
@ CHAR_SEL_PLAYER_ARENA_TEAMS
Definition: CharacterDatabase.h:231
void DelMember(ObjectGuid guid, bool cleanDb)
Definition: ArenaTeam.cpp:324

References CHAR_SEL_PLAYER_ARENA_TEAMS, CharacterDatabase, ArenaTeam::DelMember(), Field::Get(), ObjectGuid::GetCounter(), sArenaTeamMgr, and PreparedStatementBase::SetData().

Referenced by DeleteFromDB(), and WorldSession::HandleCharFactionOrRaceChangeCallback().

◆ LeaveBattleground()

void Player::LeaveBattleground ( Battleground bg = nullptr)
11238{
11239 if (!bg)
11240 bg = GetBattleground();
11241
11242 if (!bg)
11243 return;
11244
11245 // Deserter tracker - leave BG
11246 if (bg->isBattleground() && (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
11247 {
11248 if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS))
11249 {
11251 stmt->SetData(0, GetGUID().GetCounter());
11253 CharacterDatabase.Execute(stmt);
11254 }
11255 sScriptMgr->OnBattlegroundDesertion(this, BG_DESERTION_TYPE_LEAVE_BG);
11256 }
11257
11258 bg->RemovePlayerAtLeave(this);
11259
11260 // xinef: reset corpse reclaim time
11262
11263 // Remove all dots
11267
11268 // pussywizard: clear movement, because after porting player will move to arena cords
11270 StopMoving();
11272}
@ CHAR_INS_DESERTER_TRACK
Definition: CharacterDatabase.h:496
@ BG_DESERTION_TYPE_LEAVE_BG
Definition: Battleground.h:50
@ STATUS_WAIT_JOIN
Definition: Battleground.h:196
@ SPELL_AURA_PERIODIC_DAMAGE
Definition: SpellAuraDefines.h:66
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
Definition: SpellAuraDefines.h:152
@ SPELL_AURA_PERIODIC_LEECH
Definition: SpellAuraDefines.h:116
@ CONFIG_BATTLEGROUND_TRACK_DESERTERS
Definition: IWorld.h:121
virtual void RemovePlayerAtLeave(Player *player)
Definition: Battleground.cpp:974
bool isBattleground() const
Definition: Battleground.h:397
BattlegroundStatus GetStatus() const
Definition: Battleground.h:327
bool TeleportToEntryPoint()
Definition: Player.cpp:1584
void StopMoving()
Definition: Unit.cpp:16918
void MovementExpired(bool reset=true)
Definition: MotionMaster.h:178

References BG_DESERTION_TYPE_LEAVE_BG, CHAR_INS_DESERTER_TRACK, CharacterDatabase, CONFIG_BATTLEGROUND_TRACK_DESERTERS, GetBattleground(), GameTime::GetGameTime(), Object::GetGUID(), Unit::GetMotionMaster(), Battleground::GetStatus(), Battleground::isBattleground(), m_deathExpireTime, MotionMaster::MovementExpired(), Unit::RemoveAurasByType(), Battleground::RemovePlayerAtLeave(), PreparedStatementBase::SetData(), SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_AURA_PERIODIC_LEECH, sScriptMgr, STATUS_IN_PROGRESS, STATUS_WAIT_JOIN, Unit::StopMoving(), sWorld, and TeleportToEntryPoint().

Referenced by BattlegroundAB::HandleAreaTrigger(), BattlegroundAV::HandleAreaTrigger(), AuraEffect::HandleAuraDummy(), WorldSession::HandleBattlefieldLeaveOpcode(), WorldSession::LogoutPlayer(), and ToggleAFK().

◆ LeftChannel()

void Player::LeftChannel ( Channel c)
4913{
4914 m_channels.remove(c);
4915}

References m_channels.

Referenced by Channel::KickOrBan(), Channel::LeaveChannel(), and UpdateLocalChannels().

◆ LoadActions()

void Player::LoadActions ( PreparedQueryResult  result)
15193{
15194 if (result)
15195 _LoadActions(result);
15196
15198}
void _LoadActions(PreparedQueryResult result)
Definition: PlayerStorage.cpp:5695

References _LoadActions(), and SendActionButtons().

◆ LoadCorpse()

void Player::LoadCorpse ( PreparedQueryResult  result)
5837{
5839 SpawnCorpseBones(false);
5840
5841 if (!IsAlive())
5842 {
5843 if (result && !HasAtLoginFlag(AT_LOGIN_RESURRECT))
5844 {
5845 Field* fields = result->Fetch();
5846 _corpseLocation.WorldRelocate(fields[0].Get<uint16>(), fields[1].Get<float>(), fields[2].Get<float>(), fields[3].Get<float>(), fields[4].Get<float>());
5848 }
5849 else
5850 ResurrectPlayer(0.5f);
5851 }
5852
5854}
void RemoveAtLoginFlag(AtLoginFlags flags, bool persist=false)
Definition: Player.cpp:14553
bool HasAtLoginFlag(AtLoginFlags f) const
Definition: Player.h:2365
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition: Player.cpp:4388

References _corpseLocation, Object::ApplyModFlag(), AT_LOGIN_RESURRECT, WorldLocation::GetMapId(), HasAtLoginFlag(), Unit::IsAlive(), PLAYER_FIELD_BYTE_RELEASE_TIMER, PLAYER_FIELD_BYTES, RemoveAtLoginFlag(), ResurrectPlayer(), sMapStore, SpawnCorpseBones(), and WorldLocation::WorldRelocate().

Referenced by WorldSession::HandlePlayerLoginFromDB().

◆ LoadFromDB()

bool Player::LoadFromDB ( ObjectGuid  guid,
CharacterDatabaseQueryHolder const &  holder 
)
4940{
4942 //QueryResult* result = CharacterDatabase.Query("SELECT guid, account, name, race, class, gender, level, xp, money, skin, face, hairStyle, hairColor, facialStyle, bankSlots, restState, playerFlags, "
4943 // 17 18 19 20 21 22 23 24 25 26 27 28 29
4944 //"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, "
4945 // 30 31 32 33 34 35 36 37 38 39 40 41 42 43
4946 //"resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, instance_mode_mask, "
4947 // 44 45 46 47 48 49 50 51 52 53 54
4948 //"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, "
4949 // 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
4950 //"health, power1, power2, power3, power4, power5, power6, power7, instance_id, talentGroupsCount, activeTalentGroup, exploredZones, equipmentCache, ammoId, knownTitles,
4951 // 70 71 72 73 74
4952 //"actionBars, grantableLevels, innTriggerId, extraBonusTalentCount, UNIX_TIMESTAMP(creation_date) FROM characters WHERE guid = '{}'", guid);
4953 PreparedQueryResult result = holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_FROM);
4954
4955 if (!result)
4956 {
4957 LOG_ERROR("entities.player", "Player ({}) not found in table `characters`, can't load. ", playerGuid.ToString());
4958 return false;
4959 }
4960
4961 Field* fields = result->Fetch();
4962
4963 uint32 dbAccountId = fields[1].Get<uint32>();
4964
4965 // check if the character's account in the db and the logged in account match.
4966 // player should be able to load/delete character only with correct account!
4967 if (dbAccountId != GetSession()->GetAccountId())
4968 {
4969 LOG_ERROR("entities.player", "Player ({}) loading from wrong account (is: {}, should be: {})", playerGuid.ToString(), GetSession()->GetAccountId(), dbAccountId);
4970 return false;
4971 }
4972
4973 if (holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BANNED))
4974 {
4975 LOG_ERROR("entities.player", "Player ({}) is banned, can't load.", playerGuid.ToString());
4976 return false;
4977 }
4978
4979 ObjectGuid::LowType guid = playerGuid.GetCounter();
4980
4981 Object::_Create(guid, 0, HighGuid::Player);
4982
4983 m_name = fields[2].Get<std::string>();
4984
4985 // check name limitations
4987 (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && (sObjectMgr->IsReservedName(m_name) || sObjectMgr->IsProfanityName(m_name))))
4988 {
4990 stmt->SetData(0, uint16(AT_LOGIN_RENAME));
4991 stmt->SetData(1, guid);
4992 CharacterDatabase.Execute(stmt);
4993 return false;
4994 }
4995
4996 uint8 Gender = fields[5].Get<uint8>();
4997 if (!IsValidGender(Gender))
4998 {
4999 LOG_ERROR("entities.player", "Player (GUID: {}) has wrong gender ({}), can't be loaded.", guid, Gender);
5000 return false;
5001 }
5002
5003 // overwrite some data fields
5004 uint32 bytes0 = 0;
5005 bytes0 |= fields[3].Get<uint8>(); // race
5006 bytes0 |= fields[4].Get<uint8>() << 8; // class
5007 bytes0 |= Gender << 16; // gender
5009
5010 m_realRace = fields[3].Get<uint8>(); // set real race
5011 m_race = fields[3].Get<uint8>(); // set real race
5012
5013 SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].Get<uint8>());
5014 SetUInt32Value(PLAYER_XP, fields[7].Get<uint32>());
5015
5016 if (!_LoadIntoDataField(fields[66].Get<std::string>(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE))
5017 {
5018 LOG_WARN("entities.player.loading", "Player::LoadFromDB: Player ({}) has invalid exploredzones data ({}). Forcing partial load.", guid, fields[66].Get<std::string_view>());
5019 }
5020
5021 if (!_LoadIntoDataField(fields[69].Get<std::string>(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE * 2))
5022 {
5023 LOG_WARN("entities.player.loading", "Player::LoadFromDB: Player ({}) has invalid knowntitles mask ({}). Forcing partial load.", guid, fields[69].Get<std::string_view>());
5024 }
5025
5026 SetObjectScale(1.0f);
5028
5029 // load character creation date, relevant for achievements of type average
5030 SetCreationTime(fields[74].Get<Seconds>());
5031
5032 // load achievements before anything else to prevent multiple gains for the same achievement/criteria on every loading (as loading does call UpdateAchievementCriteria)
5034
5035 uint32 money = fields[8].Get<uint32>();
5036 if (money > MAX_MONEY_AMOUNT)
5037 money = MAX_MONEY_AMOUNT;
5038 SetMoney(money);
5039
5040 SetByteValue(PLAYER_BYTES, 0, fields[9].Get<uint8>());
5041 SetByteValue(PLAYER_BYTES, 1, fields[10].Get<uint8>());
5042 SetByteValue(PLAYER_BYTES, 2, fields[11].Get<uint8>());
5043 SetByteValue(PLAYER_BYTES, 3, fields[12].Get<uint8>());
5044 SetByteValue(PLAYER_BYTES_2, 0, fields[13].Get<uint8>());
5045 SetByteValue(PLAYER_BYTES_2, 2, fields[14].Get<uint8>());
5046 SetByteValue(PLAYER_BYTES_2, 3, fields[15].Get<uint8>());
5047 SetByteValue(PLAYER_BYTES_3, 0, fields[5].Get<uint8>());
5048 SetByteValue(PLAYER_BYTES_3, 1, fields[54].Get<uint8>());
5049 ReplaceAllPlayerFlags((PlayerFlags)fields[16].Get<uint32>());
5050 SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[53].Get<uint32>());
5051
5052 SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[52].Get<uint64>());
5053
5054 SetUInt32Value(PLAYER_AMMO_ID, fields[68].Get<uint32>());
5055
5056 // set which actionbars the client has active - DO NOT REMOVE EVER AGAIN (can be changed though, if it does change fieldwise)
5057 SetByteValue(PLAYER_FIELD_BYTES, 2, fields[70].Get<uint8>());
5058
5060
5061 // cleanup inventory related item value fields (its will be filled correctly in _LoadInventory)
5062 for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
5063 {
5065 SetVisibleItemSlot(slot, nullptr);
5066
5067 delete m_items[slot];
5068 m_items[slot] = nullptr;
5069 }
5070
5071 LOG_DEBUG("entities.player.loading", "Load Basic value of player {} is: ", m_name);
5073
5074 //Need to call it to initialize m_team (m_team can be calculated from race)
5075 //Other way is to saves m_team into characters table.
5077
5078 // pussywizard: create empty instance bind containers if necessary
5079 sInstanceSaveMgr->PlayerCreateBoundInstancesMaps(playerGuid);
5080
5081 // load home bind and check in same time class/race pair, it used later for restore broken positions
5082 if (!_LoadHomeBind(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_HOME_BIND)))
5083 return false;
5084
5085 InitPrimaryProfessions(); // to max set before any spell loaded
5086
5087 // init saved position, and fix it later if problematic
5088 int32 transLowGUID = fields[35].Get<int32>();
5089 Relocate(fields[17].Get<float>(), fields[18].Get<float>(), fields[19].Get<float>(), fields[21].Get<float>());
5090 uint32 mapId = fields[20].Get<uint16>();
5091 uint32 instanceId = fields[63].Get<uint32>();
5092
5093 uint32 dungeonDiff = fields[43].Get<uint8>() & 0x0F;
5094 if (dungeonDiff >= MAX_DUNGEON_DIFFICULTY)
5095 dungeonDiff = DUNGEON_DIFFICULTY_NORMAL;
5096 uint32 raidDiff = (fields[43].Get<uint8>() >> 4) & 0x0F;
5097 if (raidDiff >= MAX_RAID_DIFFICULTY)
5099 SetDungeonDifficulty(Difficulty(dungeonDiff)); // may be changed in _LoadGroup
5100 SetRaidDifficulty(Difficulty(raidDiff)); // may be changed in _LoadGroup
5101
5102 std::string taxi_nodes = fields[42].Get<std::string>();
5103
5104 auto RelocateToHomebind = [this, &mapId, &instanceId]() { mapId = m_homebindMapId; instanceId = 0; Relocate(m_homebindX, m_homebindY, m_homebindZ, m_homebindO); };
5105
5106 _LoadGroup();
5107
5109
5110 SetArenaPoints(fields[44].Get<uint32>());
5111
5112 SetHonorPoints(fields[45].Get<uint32>());
5113 SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, fields[46].Get<uint32>());
5114 SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, fields[47].Get<uint32>());
5115 SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, fields[48].Get<uint32>());
5116 SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[49].Get<uint16>());
5117 SetUInt16Value(PLAYER_FIELD_KILLS, 1, fields[50].Get<uint16>());
5118
5121
5122 GetSession()->SetPlayer(this);
5123 MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
5124
5125 Map* map = nullptr;
5126
5127 // pussywizard: group changed difficulty when player was offline, teleport to the enterance of new difficulty
5128 if (mapEntry && ((mapEntry->IsNonRaidDungeon() && dungeonDiff != GetDungeonDifficulty()) || (mapEntry->IsRaid() && raidDiff != GetRaidDifficulty())))
5129 {
5130 bool fixed = false;
5131 if (uint32 destInstId = sInstanceSaveMgr->PlayerGetDestinationInstanceId(this, mapId, GetDifficulty(mapEntry->IsRaid())))
5132 {
5133 instanceId = destInstId;
5134 if (AreaTriggerTeleport const* at = sObjectMgr->GetMapEntranceTrigger(mapId))
5135 {
5136 Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation);
5137 fixed = true;
5138 }
5139 }
5140 if (!fixed)
5141 {
5142 RelocateToHomebind();
5143 mapEntry = sMapStore.LookupEntry(mapId);
5144 }
5145 }
5146
5147 if (!mapEntry || !IsPositionValid())
5148 {
5149 LOG_ERROR("entities.player", "Player (guidlow {}) have invalid coordinates (MapId: {} X: {} Y: {} Z: {} O: {}). Teleport to default race/class locations.", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
5150 RelocateToHomebind();
5151 }
5152 // Player was saved in Arena or Bg
5153 else if (mapEntry->IsBattlegroundOrArena())
5154 {
5155 // xinef: resurrect player, cant log in dead without corpse
5156 {
5159 if (!IsAlive())
5160 ResurrectPlayer(1.0f);
5161 }
5162
5163 const WorldLocation& _loc = GetEntryPoint();
5164 mapId = _loc.GetMapId();
5165 instanceId = 0;
5166
5167 if (mapId == MAPID_INVALID)
5168 {
5169 RelocateToHomebind();
5170 }
5171 else
5172 {
5173 Relocate(&_loc);
5174
5175 // xinef: restore taxi flight from entry point data
5177 {
5181 }
5182 }
5183 }
5184 // currently we do not support transport in bg
5185 else if (transLowGUID != 0)
5186 {
5187 // transLowGUID > 0 ---> motion transport guid
5188 // transLowGUID < 0 ---> static transport spawn id
5189 Transport* transGO = nullptr;
5190 if (transLowGUID > 0)
5191 {
5192 ObjectGuid transGUID = ObjectGuid::Create<HighGuid::Mo_Transport>(transLowGUID);
5193 transGO = HashMapHolder<MotionTransport>::Find(transGUID);
5194 }
5195 else
5196 {
5197 map = sMapMgr->CreateMap(mapId, this);
5198 if (map)
5199 {
5200 auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(std::abs(transLowGUID));
5201 if (bounds.first != bounds.second)
5202 transGO = bounds.first->second->ToTransport();
5203 }
5204 }
5205
5206 // pussywizard: must be on map, for one world tick transport is not in map and has old GetMapId(), player would be added to old map and to the transport, multithreading crashfix
5207 if (transGO && transGO->IsInWorld() && transGO->FindMap())
5208 m_transport = transGO;
5209
5210 if (m_transport)
5211 {
5212 float x = fields[31].Get<float>(), y = fields[32].Get<float>(), z = fields[33].Get<float>(), o = fields[34].Get<float>();
5216
5217 if (!Acore::IsValidMapCoord(x, y, z, o) || std::fabs(m_movementInfo.transport.pos.GetPositionX()) > 75.0f || std::fabs(m_movementInfo.transport.pos.GetPositionY()) > 75.0f || std::fabs(m_movementInfo.transport.pos.GetPositionZ()) > 75.0f)
5218 {
5219 m_transport = nullptr;
5222 RelocateToHomebind();
5223 }
5224 else
5225 {
5226 Relocate(x, y, z, o);
5227 mapId = m_transport->GetMapId();
5230 }
5231 }
5232 else
5233 {
5234 bool fixed = false;
5235 if (mapEntry->Instanceable())
5236 if (AreaTriggerTeleport const* at = sObjectMgr->GetMapEntranceTrigger(mapId))
5237 {
5238 fixed = true;
5239 Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation);
5240 }
5241 if (!fixed)
5242 RelocateToHomebind();
5243 }
5244 }
5245 // currently we do not support taxi in instance
5246 else if (!taxi_nodes.empty())
5247 {
5248 instanceId = 0;
5249 if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes, GetTeamId(true)))
5250 {
5251 // xinef: could no load valid data for taxi, relocate to homebind and clear
5253 RelocateToHomebind();
5254 }
5255 }
5256
5257 // Map could be changed before
5258 mapEntry = sMapStore.LookupEntry(mapId);
5259 // client without expansion support
5260 if (mapEntry)
5261 {
5262 if (GetSession()->Expansion() < mapEntry->Expansion())
5263 {
5264 LOG_DEBUG("entities.player.loading", "Player {} using client without required expansion tried login at non accessible map {}", GetName(), mapId);
5265 RelocateToHomebind();
5266 }
5267
5268 // check whether player was unbound or is bound to another instance
5269 if (instanceId)
5270 {
5271 InstanceSave* save = sInstanceSaveMgr->PlayerGetInstanceSave(GetGUID(), mapId, GetDifficulty(mapEntry->IsRaid()));
5272 if (!save || save->GetInstanceId() != instanceId)
5273 instanceId = 0;
5274 }
5275 }
5276
5277 // if the player is in an instance and it has been reset in the meantime teleport him to the entrance
5278 if ((instanceId && !sInstanceSaveMgr->GetInstanceSave(instanceId) && !mapEntry->IsBattlegroundOrArena()) || (!instanceId && mapEntry->IsDungeon()))
5279 {
5280 AreaTriggerTeleport const* at = sObjectMgr->GetMapEntranceTrigger(mapId);
5281 if (at)
5283 else
5284 RelocateToHomebind();
5285 }
5286
5287 // NOW player must have valid map
5288 // load the player's map here if it's not already loaded
5289 if (!map)
5290 map = sMapMgr->CreateMap(mapId, this);
5291
5292 if (!map)
5293 {
5294 instanceId = 0;
5295 AreaTriggerTeleport const* at = sObjectMgr->GetGoBackTrigger(mapId);
5296 if (at)
5297 {
5298 LOG_ERROR("entities.player", "Player (guidlow {}) is teleported to gobacktrigger (Map: {} X: {} Y: {} Z: {} O: {}).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
5300 mapId = at->target_mapId;
5301 }
5302 else
5303 {
5304 LOG_ERROR("entities.player", "Player (guidlow {}) is teleported to home (Map: {} X: {} Y: {} Z: {} O: {}).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
5305 RelocateToHomebind();
5306 }
5307
5308 map = sMapMgr->CreateMap(mapId, this);
5309 if (!map)
5310 {
5311 PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass());
5312 mapId = info->mapId;
5313 Relocate(info->positionX, info->positionY, info->positionZ, 0.0f);
5314 LOG_ERROR("entities.player", "Player (guidlow {}) have invalid coordinates (X: {} Y: {} Z: {} O: {}). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
5315 map = sMapMgr->CreateMap(mapId, this);
5316 if (!map)
5317 {
5318 LOG_ERROR("entities.player", "Player (guidlow {}) has invalid default map coordinates (X: {} Y: {} Z: {} O: {}). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
5319 return false;
5320 }
5321 }
5322 }
5323
5324 SetMap(map);
5326
5328
5330
5331 time_t now = GameTime::GetGameTime().count();
5332 time_t logoutTime = time_t(fields[27].Get<uint32>());
5333
5334 // since last logout (in seconds)
5335 uint32 time_diff = uint32(now - logoutTime); //uint64 is excessive for a time_diff in seconds.. uint32 allows for 136~ year difference.
5336
5337 // randomize first save time in range [CONFIG_INTERVAL_SAVE] around [CONFIG_INTERVAL_SAVE]
5338 // this must help in case next save after mass player load after server startup
5339 m_nextSave = urand(m_nextSave / 2, m_nextSave * 3 / 2);
5340
5341 // set value, including drunk invisibility detection
5342 // calculate sobering. after 15 minutes logged out, the player will be sober again
5343 uint8 newDrunkValue = 0;
5344 if (time_diff < uint32(GetDrunkValue()) * 9)
5345 newDrunkValue = GetDrunkValue() - time_diff / 9;
5346
5347 SetDrunkValue(newDrunkValue);
5348
5349 m_cinematic = fields[23].Get<uint8>();
5350 m_Played_time[PLAYED_TIME_TOTAL] = fields[24].Get<uint32>();
5351 m_Played_time[PLAYED_TIME_LEVEL] = fields[25].Get<uint32>();
5352
5353 m_resetTalentsCost = fields[29].Get<uint32>();
5354 m_resetTalentsTime = time_t(fields[30].Get<uint32>());
5355
5356 m_taxi.LoadTaxiMask(fields[22].Get<std::string_view>()); // must be before InitTaxiNodesForLevel
5357
5358 uint32 extraflags = fields[36].Get<uint16>();
5359
5360 _LoadPetStable(fields[37].Get<uint8>(), holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_PET_SLOTS));
5361
5362 m_atLoginFlags = fields[38].Get<uint16>();
5363
5365 {
5366 LOG_ERROR("entities.player", "Player {} tried to login while forced to rename, can't load.'", GetGUID().ToString());
5367 return false;
5368 }
5369
5370 // Honor system
5371 // Update Honor kills data
5372 m_lastHonorUpdateTime = logoutTime;
5374
5375 m_deathExpireTime = time_t(fields[41].Get<uint32>());
5376
5379
5380 // clear channel spell data (if saved at channel spell casting)
5383
5384 // clear charm/summon related fields
5391
5393
5394 // reset some aura modifiers before aura apply
5397
5398 // make sure the unit is considered not in duel for proper loading
5401
5402 // reset stats before loading any modifiers
5406 InitRunes();
5407
5408 sScriptMgr->OnPlayerLoadFromDB(this);
5409
5410 // make sure the unit is considered out of combat for proper loading
5411 ClearInCombat();
5412
5413 // rest bonus can only be calculated after InitStatsForLevel()
5414 _restBonus = fields[26].Get<float>();
5415
5416 if (time_diff > 0)
5417 {
5418 //speed collect rest bonus in offline, in logout, far from tavern, city (section/in hour)
5419 float bubble0 = 0.031f;
5420 //speed collect rest bonus in offline, in logout, in tavern, city (section/in hour)
5421 float bubble1 = 0.125f;
5422 float bubble = fields[28].Get<uint8>() > 0
5423 ? bubble1 * sWorld->getRate(RATE_REST_OFFLINE_IN_TAVERN_OR_CITY)
5424 : bubble0 * sWorld->getRate(RATE_REST_OFFLINE_IN_WILDERNESS);
5425
5426 // Client automatically doubles the value sent so we have to divide it by 2
5427 SetRestBonus(GetRestBonus() + time_diff * ((float)GetUInt32Value(PLAYER_NEXT_LEVEL_XP) / 144000)*bubble);
5428 }
5429
5430 uint32 innTriggerId = fields[72].Get<uint32>();
5431 if (innTriggerId)
5432 {
5433 SetRestFlag(REST_FLAG_IN_TAVERN, innTriggerId);
5434 }
5435
5436 // load skills after InitStatsForLevel because it triggering aura apply also
5437 _LoadSkills(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SKILLS));
5438 UpdateSkillsForLevel(); //update skills after load, to make sure they are correctly update at player load
5439
5440 // apply original stats mods before spell loading or item equipment that call before equip _RemoveStatsMods()
5441
5442 m_specsCount = fields[64].Get<uint8>();
5443 m_activeSpec = fields[65].Get<uint8>();
5444
5447
5448 _LoadSpells(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SPELLS));
5449 _LoadTalents(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_TALENTS));
5450
5451 _LoadGlyphs(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_GLYPHS));
5453 _LoadAuras(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_AURAS), time_diff);
5454 // add ghost flag (must be after aura load: PLAYER_FLAGS_GHOST set in aura)
5456 {
5457 m_deathState = DeathState::Dead;
5459 }
5460
5461 // pussywizard: remove auras that are removed at map change (after _LoadAuras)
5463
5464 // after spell load, learn rewarded spell if need also
5465 _LoadQuestStatus(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS));
5471 _LoadRandomBGStatus(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG));
5472
5473 // Extra Bonus Talent Points
5474 m_extraBonusTalentCount = fields[73].Get<uint8>();
5475
5476 // after spell, bonus talents, and quest load
5478
5479 // must be before inventory (some items required reputation check)
5481
5482 // xinef: load mails before inventory, so problematic items can be added to already loaded mails
5483 _LoadMail(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAILS), holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS));
5484
5485 _LoadInventory(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_INVENTORY), time_diff);
5486
5487 // update items with duration and realtime
5488 UpdateItemDuration(time_diff, true);
5489
5490 _LoadActions(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ACTIONS));
5491
5492 m_social = sSocialMgr->LoadFromDB(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST), GetGUID());
5493
5494 // check PLAYER_CHOSEN_TITLE compatibility with PLAYER__FIELD_KNOWN_TITLES
5495 // note: PLAYER__FIELD_KNOWN_TITLES updated at quest status loaded
5496 uint32 curTitle = fields[51].Get<uint32>();
5497 if (curTitle && !HasTitle(curTitle))
5498 curTitle = 0;
5499
5501
5502 // has to be called after last Relocate() in Player::LoadFromDB
5504
5506
5507 // Spell code allow apply any auras to dead character in load time in aura/spell/item loading
5508 // Do now before stats re-calculation cleanup for ghost state unexpected auras
5509 if (!IsAlive())
5511 else
5513
5514 //apply all stat bonuses from items and auras
5515 SetCanModifyStats(true);
5517
5518 // restore remembered power/health values (but not more max values)
5519 uint32 savedHealth = fields[55].Get<uint32>();
5520 SetHealth(savedHealth > GetMaxHealth() ? GetMaxHealth() : savedHealth);
5521 for (uint8 i = 0; i < MAX_POWERS; ++i)
5522 {
5523 uint32 savedPower = fields[56 + i].Get<uint32>();
5524 SetPower(Powers(i), savedPower > GetMaxPower(Powers(i)) ? GetMaxPower(Powers(i)) : savedPower);
5525 }
5526
5527 LOG_DEBUG("entities.player.loading", "The value of player {} after load item and aura is: ", m_name);
5529
5530 // GM state
5532 {
5533 switch (sWorld->getIntConfig(CONFIG_GM_LOGIN_STATE))
5534 {
5535 default:
5536 case 0:
5537 break; // disable
5538 case 1:
5539 SetGameMaster(true);
5540 break; // enable
5541 case 2: // save state
5542 if (extraflags & PLAYER_EXTRA_GM_ON)
5543 SetGameMaster(true);
5544 break;
5545 }
5546
5547 switch (sWorld->getIntConfig(CONFIG_GM_VISIBLE_STATE))
5548 {
5549 default:
5550 case 0:
5551 SetGMVisible(false);
5552 break; // invisible
5553 case 1:
5554 break; // visible
5555 case 2: // save state
5556 if (extraflags & PLAYER_EXTRA_GM_INVISIBLE)
5557 SetGMVisible(false);
5558 break;
5559 }
5560
5561 switch (sWorld->getIntConfig(CONFIG_GM_CHAT))
5562 {
5563 default:
5564 case 0:
5565 break; // disable
5566 case 1:
5567 SetGMChat(true);
5568 break; // enable
5569 case 2: // save state
5570 if (extraflags & PLAYER_EXTRA_GM_CHAT)
5571 SetGMChat(true);
5572 break;
5573 }
5574
5575 switch (sWorld->getIntConfig(CONFIG_GM_WHISPERING_TO))
5576 {
5577 default:
5578 case 0:
5579 break; // disable
5580 case 1:
5581 SetAcceptWhispers(true);
5582 break; // enable
5583 case 2: // save state
5584 if (extraflags & PLAYER_EXTRA_ACCEPT_WHISPERS)
5585 SetAcceptWhispers(true);
5586 break;
5587 }
5588 }
5589
5590 // RaF stuff.
5591 m_grantableLevels = fields[71].Get<uint8>();
5592 if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0))
5594
5595 if (m_grantableLevels > 0)
5597
5599
5600 //m_achievementMgr->CheckAllAchievementCriteria(); // pussywizard: disabled this
5601
5603
5605
5607
5608 // Players are immune to taunt
5611
5612 // Init charm info
5614
5615 // Fix aurastate auras, depending on health!
5616 // Set aurastate manualy, prevents aura switching
5617 if (HealthBelowPct(20))
5619 if (HealthBelowPct(35))
5621 if (HealthAbovePct(75))
5623
5624 // unapply aura stats if dont meet requirements
5625 AuraApplicationMap const& Auras = GetAppliedAuras();
5626 for (AuraApplicationMap::const_iterator itr = Auras.begin(); itr != Auras.end(); ++itr)
5627 {
5628 // we assume that all auras are applied now, aurastate was modfied MANUALY preventing any apply/unapply state switching
5629 Aura* aura = itr->second->GetBase();
5630 SpellInfo const* m_spellInfo = aura->GetSpellInfo();
5634 continue;
5635
5636 if (!HasAuraState((AuraStateType)m_spellInfo->CasterAuraState))
5637 aura->HandleAllEffects(itr->second, AURA_EFFECT_HANDLE_REAL, false);
5638 }
5639 return true;
5640}
@ CHAR_UPD_ADD_AT_LOGIN_FLAG
Definition: CharacterDatabase.h:274
@ UNIT_FIELD_CHANNEL_OBJECT
Definition: UpdateFields.h:93
@ UNIT_FIELD_SUMMON
Definition: UpdateFields.h:87
@ UNIT_FIELD_CHARMEDBY
Definition: UpdateFields.h:89
@ UNIT_FIELD_CHARM
Definition: UpdateFields.h:86
@ PLAYER_TRACK_CREATURES
Definition: UpdateFields.h:344
@ PLAYER_TRACK_RESOURCES
Definition: UpdateFields.h:345
@ UNIT_CHANNEL_SPELL
Definition: UpdateFields.h:94
@ REST_FLAG_IN_TAVERN
Definition: Player.h:807
@ PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS
Definition: Player.h:869
@ PLAYER_LOGIN_QUERY_LOAD_GLYPHS
Definition: Player.h:875
@ PLAYER_LOGIN_QUERY_LOAD_DECLINED_NAMES
Definition: Player.h:870
@ PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_REW
Definition: Player.h:882
@ PLAYER_LOGIN_QUERY_LOAD_DAILY_QUEST_STATUS
Definition: Player.h:861
@ PLAYER_LOGIN_QUERY_LOAD_CHARACTER_SETTINGS
Definition: Player.h:888
@ PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES
Definition: Player.h:883
@ PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS
Definition: Player.h:884
@ PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST
Definition: Player.h:867
@ PLAYER_LOGIN_QUERY_LOAD_ACTIONS
Definition: Player.h:864
@ PLAYER_LOGIN_QUERY_LOAD_SKILLS
Definition: Player.h:878
@ PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS
Definition: Player.h:866
@ PLAYER_LOGIN_QUERY_LOAD_PET_SLOTS
Definition: Player.h:889
@ PLAYER_LOGIN_QUERY_LOAD_INVENTORY
Definition: Player.h:863
@ PLAYER_LOGIN_QUERY_LOAD_REPUTATION
Definition: Player.h:862
@ PLAYER_LOGIN_QUERY_LOAD_BREW_OF_THE_MONTH
Definition: Player.h:886
@ PLAYER_LOGIN_QUERY_LOAD_FROM
Definition: Player.h:857
@ PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS
Definition: Player.h:860
@ PLAYER_LOGIN_QUERY_LOAD_ENTRY_POINT
Definition: Player.h:874
@ PLAYER_LOGIN_QUERY_LOAD_WEEKLY_QUEST_STATUS
Definition: Player.h:879
@ PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS
Definition: Player.h:885
@ PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS
Definition: Player.h:873
@ PLAYER_LOGIN_QUERY_LOAD_MAILS
Definition: Player.h:865
@ PLAYER_LOGIN_QUERY_LOAD_AURAS
Definition: Player.h:858
@ PLAYER_LOGIN_QUERY_LOAD_TALENTS
Definition: Player.h:876
@ PLAYER_LOGIN_QUERY_LOAD_BANNED
Definition: Player.h:881
@ PLAYER_LOGIN_QUERY_LOAD_CRITERIA_PROGRESS
Definition: Player.h:872
@ PLAYER_LOGIN_QUERY_LOAD_HOME_BIND
Definition: Player.h:868
@ PLAYER_LOGIN_QUERY_LOAD_SPELLS
Definition: Player.h:859
@ PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG
Definition: Player.h:880
@ PLAYER_LOGIN_QUERY_LOAD_ACHIEVEMENTS
Definition: Player.h:871
@ MOVEMENTFLAG_ONTRANSPORT
Definition: Unit.h:561
@ UNIT_FLAG2_FORCE_MOVEMENT
Definition: Unit.h:494
@ UNIT_STATE_ISOLATED
Definition: Unit.h:338
@ SPELL_AURA_SPIRIT_OF_REDEMPTION
Definition: SpellAuraDefines.h:239
@ SPELL_AURA_MOD_TAUNT
Definition: SpellAuraDefines.h:74
@ AURA_INTERRUPT_FLAG_CHANGE_MAP
Definition: SpellDefines.h:63
@ CONFIG_GM_CHAT
Definition: IWorld.h:257
@ CONFIG_GM_WHISPERING_TO
Definition: IWorld.h:258
@ CONFIG_GM_LOGIN_STATE
Definition: IWorld.h:254
@ CONFIG_GM_VISIBLE_STATE
Definition: IWorld.h:255
@ RATE_REST_OFFLINE_IN_WILDERNESS
Definition: IWorld.h:499
@ RATE_REST_OFFLINE_IN_TAVERN_OR_CITY
Definition: IWorld.h:498
#define MAX_RAID_DIFFICULTY
Definition: DBCEnums.h:290
#define MAX_DUNGEON_DIFFICULTY
Definition: DBCEnums.h:289
@ SPELL_EFFECT_ATTACK_ME
Definition: SharedDefines.h:892
@ CHAR_NAME_SUCCESS
Definition: SharedDefines.h:3419
@ UNIT_DYNFLAG_REFER_A_FRIEND
Definition: SharedDefines.h:3127
@ IMMUNITY_STATE
Definition: SharedDefines.h:1395
@ IMMUNITY_EFFECT
Definition: SharedDefines.h:1394
bool IsValidMapCoord(float c)
Definition: GridDefines.h:216
void LoadFromDB(PreparedQueryResult achievementResult, PreparedQueryResult criteriaResult)
Definition: AchievementMgr.cpp:612
Transport * ToTransport()
Definition: GameObject.h:325
virtual void SetDynamicFlag(uint32 flag)
Definition: Object.h:117
bool _LoadIntoDataField(std::string const &data, uint32 startOffset, uint32 count)
Definition: Object.cpp:612
void RemoveMovementFlag(uint32 flag)
Definition: Object.h:321
struct MovementInfo::TransportInfo transport
void Reset()
Definition: Object.h:275
ObjectGuid guid
Definition: Object.h:284
Position pos
Definition: Object.h:285
Transport * m_transport
Definition: Object.h:640
bool IsPositionValid() const
Definition: Position.cpp:175
void ClearTaxiPath()
Definition: Player.h:1051
bool HasTaxiPath() const
Definition: Player.h:1052
void _LoadDeclinedNames(PreparedQueryResult result)
Definition: PlayerStorage.cpp:4805
void _LoadGlyphs(PreparedQueryResult result)
Definition: Player.cpp:14873
void SetRestFlag(RestFlag restFlag, uint32 triggerId=0)
Definition: Player.cpp:16068
void SetCreationTime(Seconds creationTime)
Definition: Player.h:2501
void SetGameMaster(bool on)
Definition: Player.cpp:2190
void _LoadQuestStatusRewarded(PreparedQueryResult result)
Definition: PlayerStorage.cpp:6336
void _LoadAuras(PreparedQueryResult result, uint32 timediff)
Definition: PlayerStorage.cpp:5721
void _LoadSeasonalQuestStatus(PreparedQueryResult result)
Definition: PlayerStorage.cpp:6444
void _LoadGroup()
Definition: PlayerStorage.cpp:6502
void _LoadCharacterSettings(PreparedQueryResult result)
Definition: PlayerSettings.cpp:26
void _LoadTalents(PreparedQueryResult result)
Definition: Player.cpp:14922
void SetFallInformation(uint32 time, float z)
Definition: Player.h:2298
void _LoadPetStable(uint8 petStableSlots, PreparedQueryResult result)
Definition: Player.cpp:15737
void _LoadBrewOfTheMonth(PreparedQueryResult result)
Definition: Player.cpp:15700
WorldLocation const & GetEntryPoint() const
Definition: Player.h:2340
void outDebugValues() const
Definition: PlayerStorage.cpp:7805
void _LoadRandomBGStatus(PreparedQueryResult result)
Definition: Player.cpp:15635
void SaveRecallPosition()
Definition: Player.cpp:5577
void _LoadQuestStatus(PreparedQueryResult result)
Definition: PlayerStorage.cpp:6249
void _LoadMonthlyQuestStatus(PreparedQueryResult result)
Definition: PlayerStorage.cpp:6467
void SetGMChat(bool on)
Definition: Player.h:1151
void _LoadArenaTeamInfo()
Definition: PlayerStorage.cpp:4816
bool _LoadHomeBind(PreparedQueryResult result)
Definition: PlayerStorage.cpp:7009
void UpdateItemDuration(uint32 time, bool realtimeonly=false)
Definition: PlayerStorage.cpp:4167
void _LoadSpells(PreparedQueryResult result)
Definition: PlayerStorage.cpp:6489
void _LoadSkills(PreparedQueryResult result)
Definition: Player.cpp:13587
void _LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mailItemsResult)
Definition: PlayerStorage.cpp:6176
void _LoadWeeklyQuestStatus(PreparedQueryResult result)
Definition: PlayerStorage.cpp:6422
void SetGMVisible(bool on)
Definition: Player.cpp:2259
void PrepareCharmAISpells()
Definition: Player.cpp:15331
void _LoadGlyphAuras()
Definition: PlayerStorage.cpp:5804
void ReplaceAllPlayerFlags(PlayerFlags flags)
Definition: Player.h:1103
void _LoadEquipmentSets(PreparedQueryResult result)
Definition: PlayerStorage.cpp:4847
void _LoadEntryPointData(PreparedQueryResult result)
Definition: PlayerStorage.cpp:4878
void _LoadInstanceTimeRestrictions(PreparedQueryResult result)
Definition: Player.cpp:15688
void StoreRaidMapDifficulty()
Definition: Player.h:1889
void _LoadInventory(PreparedQueryResult result, uint32 timeDiff)
Definition: PlayerStorage.cpp:5856
void UpdateHonorFields()
Definition: PlayerUpdates.cpp:1141
void _LoadSpellCooldowns(PreparedQueryResult result)
Definition: Player.cpp:3539
void SetMoney(uint32 value)
Definition: Player.h:1590
void _LoadDailyQuestStatus(PreparedQueryResult result)
Definition: PlayerStorage.cpp:6371
bool LoadTaxiMask(std::string_view data)
Definition: PlayerTaxi.cpp:89
bool LoadTaxiDestinationsFromString(std::string const &values, TeamId teamId)
Definition: PlayerTaxi.cpp:130
virtual void AddPassenger(WorldObject *passenger, bool withAll=false)=0
void CalculatePassengerPosition(float &x, float &y, float &z, float *o=nullptr) const override
This method transforms supplied transport offsets into global coordinates.
Definition: Transport.h:32
bool HealthAbovePct(int32 pct) const
Definition: Unit.h:1460
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition: Unit.cpp:13383
void RemoveAllAurasRequiringDeadTarget()
Definition: Unit.cpp:5312
DeathState m_deathState
Definition: Unit.h:2504
void RemoveAllAurasOnDeath()
Definition: Unit.cpp:5289
void AddUnitState(uint32 f)
Definition: Unit.h:1409
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:1458
void AddUnitMovementFlag(uint32 f)
Definition: Unit.h:2286
void RemoveUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:1502
void SetOwnerGUID(ObjectGuid owner)
Definition: Unit.cpp:10572
void ClearInCombat()
Definition: Unit.cpp:13797
void SetCreatorGUID(ObjectGuid creator)
Definition: Unit.h:1831
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition: Unit.cpp:5116
static T * Find(ObjectGuid guid)
Definition: ObjectAccessor.cpp:56
Definition: ObjectMgr.h:412
float target_Z
Definition: ObjectMgr.h:416
float target_X
Definition: ObjectMgr.h:414
float target_Orientation
Definition: ObjectMgr.h:417
float target_Y
Definition: ObjectMgr.h:415
uint32 target_mapId
Definition: ObjectMgr.h:413
static uint8 CheckPlayerName(std::string_view name, bool create=false)
Definition: ObjectMgr.cpp:8362
uint32 GetInstanceId() const
Definition: InstanceSaveMgr.h:61
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition: Map.h:522
void LoadFromDB(PreparedQueryResult result)
Definition: ReputationMgr.cpp:561
void SetPlayer(Player *player)
Definition: WorldSession.cpp:1283
bool IsARecruiter() const
Definition: WorldSession.h:528
uint32 CasterAuraState
Definition: SpellInfo.h:337
bool IsNonRaidDungeon() const
Definition: DBCStructure.h:1350
uint32 Expansion() const
Definition: DBCStructure.h:1347
bool IsBattlegroundOrArena() const
Definition: DBCStructure.h:1355
bool IsDungeon() const
Definition: DBCStructure.h:1349
bool IsRaid() const
Definition: DBCStructure.h:1352
bool Instanceable() const
Definition: DBCStructure.h:1351

References Object::_Create(), _LoadActions(), _LoadArenaTeamInfo(), _LoadAuras(), _LoadBrewOfTheMonth(), _LoadCharacterSettings(), _LoadDailyQuestStatus(), _LoadDeclinedNames(), _LoadEntryPointData(), _LoadEquipmentSets(), _LoadGlyphAuras(), _LoadGlyphs(), _LoadGroup(), _LoadHomeBind(), _LoadInstanceTimeRestrictions(), Object::_LoadIntoDataField(), _LoadInventory(), _LoadMail(), _LoadMonthlyQuestStatus(), _LoadPetStable(), _LoadQuestStatus(), _LoadQuestStatusRewarded(), _LoadRandomBGStatus(), _LoadSeasonalQuestStatus(), _LoadSkills(), _LoadSpellCooldowns(), _LoadSpells(), _LoadTalents(), _LoadWeeklyQuestStatus(), _restBonus, Transport::AddPassenger(), PlayerTaxi::AddTaxiDestination(), Unit::AddUnitMovementFlag(), Unit::AddUnitState(), Unit::ApplySpellImmune(), AT_LOGIN_RENAME, AURA_EFFECT_HANDLE_REAL, AURA_INTERRUPT_FLAG_CHANGE_MAP, AURA_STATE_HEALTH_ABOVE_75_PERCENT, AURA_STATE_HEALTHLESS_20_PERCENT, AURA_STATE_HEALTHLESS_35_PERCENT, Transport::CalculatePassengerPosition(), SpellInfo::CasterAuraState, CHAR_NAME_SUCCESS, CHAR_UPD_ADD_AT_LOGIN_FLAG, CharacterDatabase, ObjectMgr::CheckPlayerName(), Unit::ClearInCombat(), PlayerTaxi::ClearTaxiDestinations(), EntryPointData::ClearTaxiPath(), CONFIG_GM_CHAT, CONFIG_GM_LOGIN_STATE, CONFIG_GM_VISIBLE_STATE, CONFIG_GM_WHISPERING_TO, DEATH_EXPIRE_STEP, DUNGEON_DIFFICULTY_NORMAL, ObjectGuid::Empty, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, MapEntry::Expansion(), HashMapHolder< T >::Find(), WorldObject::FindMap(), Field::Get(), WorldSession::GetAccountId(), Unit::GetAppliedAuras(), Unit::getClass(), ObjectGuid::GetCounter(), GetDifficulty(), GetDrunkValue(), GetDungeonDifficulty(), GetEntryPoint(), Map::GetGameObjectBySpawnIdStore(), GameTime::GetGameTime(), Object::GetGUID(), InstanceSave::GetInstanceId(), WorldLocation::GetMapId(), Unit::GetMaxHealth(), Unit::GetMaxPower(), WorldObject::GetName(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), SQLQueryHolderBase::GetPreparedResult(), Unit::getRace(), GetRaidDifficulty(), WorldSession::GetRecruiterId(), GetRestBonus(), GetSession(), Aura::GetSpellInfo(), GetTeamId(), Object::GetUInt32Value(), MovementInfo::TransportInfo::guid, Aura::HandleAllEffects(), HasAtLoginFlag(), Unit::HasAuraState(), Unit::HasAuraType(), HasPlayerFlag(), EntryPointData::HasTaxiPath(), HasTitle(), Unit::HealthAbovePct(), Unit::HealthBelowPct(), IMMUNITY_EFFECT, IMMUNITY_STATE, InitDisplayIds(), InitGlyphsForLevel(), InitPrimaryProfessions(), InitRunes(), InitStatsForLevel(), InitTalentForLevel(), InitTaxiNodesForLevel(), MapEntry::Instanceable(), Unit::IsAlive(), WorldSession::IsARecruiter(), MapEntry::IsBattlegroundOrArena(), MapEntry::IsDungeon(), Object::IsInWorld(), MapEntry::IsNonRaidDungeon(), AccountMgr::IsPlayerAccount(), Position::IsPositionValid(), MapEntry::IsRaid(), IsValidGender(), Acore::IsValidMapCoord(), KNOWN_TITLES_SIZE, LearnCustomSpells(), LearnDefaultSkills(), AchievementMgr::LoadFromDB(), ReputationMgr::LoadFromDB(), PlayerTaxi::LoadTaxiDestinationsFromString(), PlayerTaxi::LoadTaxiMask(), LOG_DEBUG, LOG_ERROR, LOG_WARN, m_achievementMgr, m_activeSpec, m_atLoginFlags, m_cinematic, m_deathExpireTime, Unit::m_deathState, m_entryPointData, m_extraBonusTalentCount, m_grantableLevels, m_homebindMapId, m_homebindO, m_homebindX, m_homebindY, m_homebindZ, m_items, m_lastHonorUpdateTime, WorldObject::m_movementInfo, WorldObject::m_name, m_nextSave, m_Played_time, Unit::m_race, Unit::m_realRace, m_reputationMgr, m_resetTalentsCost, m_resetTalentsTime, m_social, m_specsCount, m_taxi, WorldObject::m_transport, PlayerInfo::mapId, MAPID_INVALID, MAX_DEATH_COUNT, MAX_DUNGEON_DIFFICULTY, MAX_MONEY_AMOUNT, MAX_POWERS, MAX_RAID_DIFFICULTY, MOVEMENTFLAG_ONTRANSPORT, outDebugValues(), PLAYED_TIME_LEVEL, PLAYED_TIME_TOTAL, PLAYER__FIELD_KNOWN_TITLES, PLAYER_AMMO_ID, PLAYER_BYTES, PLAYER_BYTES_2, PLAYER_BYTES_3, PLAYER_CHOSEN_TITLE, PLAYER_DUEL_ARBITER, PLAYER_DUEL_TEAM, PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE, PLAYER_EXTRA_ACCEPT_WHISPERS, PLAYER_EXTRA_GM_CHAT, PLAYER_EXTRA_GM_INVISIBLE, PLAYER_EXTRA_GM_ON, PLAYER_FARSIGHT, PLAYER_FIELD_BYTES, PLAYER_FIELD_INV_SLOT_HEAD, PLAYER_FIELD_KILLS, PLAYER_FIELD_KNOWN_CURRENCIES, PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, PLAYER_FIELD_TODAY_CONTRIBUTION, PLAYER_FIELD_WATCHED_FACTION_INDEX, PLAYER_FIELD_YESTERDAY_CONTRIBUTION, PLAYER_FLAGS_GHOST, PLAYER_LOGIN_QUERY_LOAD_ACHIEVEMENTS, PLAYER_LOGIN_QUERY_LOAD_ACTIONS, PLAYER_LOGIN_QUERY_LOAD_AURAS, PLAYER_LOGIN_QUERY_LOAD_BANNED, PLAYER_LOGIN_QUERY_LOAD_BREW_OF_THE_MONTH, PLAYER_LOGIN_QUERY_LOAD_CHARACTER_SETTINGS, PLAYER_LOGIN_QUERY_LOAD_CRITERIA_PROGRESS, PLAYER_LOGIN_QUERY_LOAD_DAILY_QUEST_STATUS, PLAYER_LOGIN_QUERY_LOAD_DECLINED_NAMES, PLAYER_LOGIN_QUERY_LOAD_ENTRY_POINT, PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS, PLAYER_LOGIN_QUERY_LOAD_FROM, PLAYER_LOGIN_QUERY_LOAD_GLYPHS, PLAYER_LOGIN_QUERY_LOAD_HOME_BIND, PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES, PLAYER_LOGIN_QUERY_LOAD_INVENTORY, PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS, PLAYER_LOGIN_QUERY_LOAD_MAILS, PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS, PLAYER_LOGIN_QUERY_LOAD_PET_SLOTS, PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS, PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_REW, PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG, PLAYER_LOGIN_QUERY_LOAD_REPUTATION, PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS, PLAYER_LOGIN_QUERY_LOAD_SKILLS, PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST, PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS, PLAYER_LOGIN_QUERY_LOAD_SPELLS, PLAYER_LOGIN_QUERY_LOAD_TALENTS, PLAYER_LOGIN_QUERY_LOAD_WEEKLY_QUEST_STATUS, PLAYER_NEXT_LEVEL_XP, PLAYER_TRACK_CREATURES, PLAYER_TRACK_RESOURCES, PLAYER_XP, MovementInfo::TransportInfo::pos, PlayerInfo::positionX, PlayerInfo::positionY, PlayerInfo::positionZ, PrepareCharmAISpells(), RAID_DIFFICULTY_10MAN_NORMAL, RATE_REST_OFFLINE_IN_TAVERN_OR_CITY, RATE_REST_OFFLINE_IN_WILDERNESS, Position::Relocate(), Unit::RemoveAllAurasOnDeath(), Unit::RemoveAllAurasRequiringDeadTarget(), Unit::RemoveAurasByType(), Unit::RemoveAurasWithInterruptFlags(), MovementInfo::RemoveMovementFlag(), Unit::RemoveUnitFlag2(), ReplaceAllPlayerFlags(), MovementInfo::TransportInfo::Reset(), REST_FLAG_IN_TAVERN, ResurrectPlayer(), SaveRecallPosition(), SetAcceptWhispers(), SetArenaPoints(), Object::SetByteValue(), Unit::SetCanModifyStats(), SetCreationTime(), Unit::SetCreatorGUID(), PreparedStatementBase::SetData(), SetDrunkValue(), SetDungeonDifficulty(), Object::SetDynamicFlag(), SetFactionForRace(), SetFallInformation(), Object::SetFlag(), Object::SetFloatValue(), SetGameMaster(), SetGMChat(), SetGMVisible(), Object::SetGuidValue(), Unit::SetHealth(), SetHonorPoints(), Object::SetInt32Value(), SetMap(), SetMoney(), SetObjectScale(), Unit::SetOwnerGUID(), WorldSession::SetPlayer(), Unit::SetPower(), SetRaidDifficulty(), SetRestBonus(), SetRestFlag(), Object::SetUInt16Value(), Object::SetUInt32Value(), Object::SetUInt64Value(), SetVisibleItemSlot(), sInstanceSaveMgr, sMapMgr, sMapStore, sObjectMgr, SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOD_TAUNT, SPELL_AURA_SPIRIT_OF_REDEMPTION, SPELL_EFFECT_ATTACK_ME, sScriptMgr, sSocialMgr, StoreRaidMapDifficulty(), sWorld, AreaTriggerTeleport::target_mapId, AreaTriggerTeleport::target_Orientation, AreaTriggerTeleport::target_X, AreaTriggerTeleport::target_Y, AreaTriggerTeleport::target_Z, EntryPointData::taxiPath, ObjectGuid::ToString(), Position::ToString(), GameObject::ToTransport(), MovementInfo::transport, UNIT_CHANNEL_SPELL, UNIT_DYNFLAG_REFER_A_FRIEND, UNIT_FIELD_AURASTATE, UNIT_FIELD_BYTES_0, UNIT_FIELD_CHANNEL_OBJECT, UNIT_FIELD_CHARM, UNIT_FIELD_CHARMEDBY, UNIT_FIELD_HOVERHEIGHT, UNIT_FIELD_LEVEL, UNIT_FIELD_SUMMON, UNIT_FLAG2_FORCE_MOVEMENT, UNIT_STATE_ISOLATED, UpdateAllStats(), UpdateHonorFields(), UpdateItemDuration(), WorldObject::UpdatePositionData(), UpdateSkillsForLevel(), and urand().

Referenced by WorldSession::HandlePlayerLoginFromDB().

◆ LoadPet()

void Player::LoadPet ( )
6238{
6239 //fixme: the pet should still be loaded if the player is not in world
6240 // just not added to the map
6241 if (m_petStable && IsInWorld())
6242 {
6243 Pet* pet = new Pet(this);
6244 if (!pet->LoadPetFromDB(this, 0, 0, true))
6245 delete pet;
6246 }
6247}
bool LoadPetFromDB(Player *owner, uint32 petEntry, uint32 petnumber, bool current, uint32 healthPct=0)
Definition: Pet.cpp:206

References Object::IsInWorld(), Pet::LoadPetFromDB(), and m_petStable.

Referenced by WorldSession::HandlePlayerLoginFromDB().

◆ LoadPositionFromDB()

bool Player::LoadPositionFromDB ( uint32 mapid,
float &  x,
float &  y,
float &  z,
float &  o,
bool &  in_flight,
ObjectGuid::LowType  guid 
)
static
4896{
4898 stmt->SetData(0, guid);
4899 PreparedQueryResult result = CharacterDatabase.Query(stmt);
4900
4901 if (!result)
4902 return false;
4903
4904 Field* fields = result->Fetch();
4905
4906 x = fields[0].Get<float>();
4907 y = fields[1].Get<float>();
4908 z = fields[2].Get<float>();
4909 o = fields[3].Get<float>();
4910 mapid = fields[4].Get<uint16>();
4911 in_flight = !fields[5].Get<std::string>().empty();
4912
4913 return true;
4914}
@ CHAR_SEL_CHAR_POSITION
Definition: CharacterDatabase.h:54

References CHAR_SEL_CHAR_POSITION, CharacterDatabase, Field::Get(), and PreparedStatementBase::SetData().

Referenced by misc_commandscript::HandleAppearCommand().

◆ ModifyArenaPoints()

void Player::ModifyArenaPoints ( int32  value,
CharacterDatabaseTransaction  trans = CharacterDatabaseTransaction(nullptr) 
)

If trans is specified, honor save query will be added to trans.

6203{
6204 int32 newValue = int32(GetArenaPoints()) + value;
6205 if (newValue < 0)
6206 newValue = 0;
6207 SetArenaPoints(uint32(newValue));
6208
6209 if (trans)
6210 {
6212 stmt->SetData(0, newValue);
6213 stmt->SetData(1, GetGUID().GetCounter());
6214 trans->Append(stmt);
6215 }
6216}
@ CHAR_UDP_CHAR_ARENA_POINTS
Definition: CharacterDatabase.h:422

References CHAR_UDP_CHAR_ARENA_POINTS, CharacterDatabase, GetArenaPoints(), Object::GetGUID(), SetArenaPoints(), and PreparedStatementBase::SetData().

Referenced by _StoreOrEquipNewItem(), modify_commandscript::HandleModifyArenaCommand(), RefundItem(), and RewardQuest().

◆ ModifyHonorPoints()

void Player::ModifyHonorPoints ( int32  value,
CharacterDatabaseTransaction  trans = CharacterDatabaseTransaction(nullptr) 
)
6187{
6188 int32 newValue = int32(GetHonorPoints()) + value;
6189 if (newValue < 0)
6190 newValue = 0;
6191 SetHonorPoints(uint32(newValue));
6192
6193 if (trans)
6194 {
6196 stmt->SetData(0, newValue);
6197 stmt->SetData(1, GetGUID().GetCounter());
6198 trans->Append(stmt);
6199 }
6200}
@ CHAR_UDP_CHAR_HONOR_POINTS
Definition: CharacterDatabase.h:420

References CHAR_UDP_CHAR_HONOR_POINTS, CharacterDatabase, Object::GetGUID(), GetHonorPoints(), PreparedStatementBase::SetData(), and SetHonorPoints().

Referenced by _StoreOrEquipNewItem(), modify_commandscript::HandleModifyHonorCommand(), RefundItem(), and RewardHonor().

◆ ModifyMoney()

bool Player::ModifyMoney ( int32  amount,
bool  sendError = true 
)
11431{
11432 if (!amount)
11433 return true;
11434
11435 sScriptMgr->OnPlayerMoneyChanged(this, amount);
11436
11437 if (amount < 0)
11438 SetMoney (GetMoney() > uint32(-amount) ? GetMoney() + amount : 0);
11439 else
11440 {
11441 if (GetMoney() < uint32(MAX_MONEY_AMOUNT - amount))
11442 SetMoney(GetMoney() + amount);
11443 else
11444 {
11445 if (sendError)
11446 SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, nullptr, nullptr);
11447 return false;
11448 }
11449 }
11450
11451 return true;
11452}
@ EQUIP_ERR_TOO_MUCH_GOLD
Definition: Item.h:117

References EQUIP_ERR_TOO_MUCH_GOLD, GetMoney(), MAX_MONEY_AMOUNT, SendEquipError(), SetMoney(), and sScriptMgr.

Referenced by _StoreOrEquipNewItem(), ActivateTaxiPathTo(), FlightPathMovementGenerator::DoUpdate(), DurabilityRepair(), WorldSession::HandleAcceptTradeOpcode(), WorldSession::HandleAlterAppearance(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleBuybackItem(), WorldSession::HandleBuyBankSlotOpcode(), Guild::HandleBuyBankTab(), WorldSession::HandleBuyStableSlot(), WorldSession::HandleLootMoneyOpcode(), WorldSession::HandleMailTakeItem(), WorldSession::HandleMailTakeMoney(), Guild::HandleMemberDepositMoney(), Guild::HandleMemberWithdrawMoney(), modify_commandscript::HandleModifyMoneyCommand(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSendMail(), Guild::HandleSetEmblem(), WorldSession::HandleTrainerBuySpellOpcode(), npc_experience::OnGossipSelect(), OnGossipSelect(), QuestApprenticeAnglerPlayerScript::OnPlayerCompleteQuest(), ProcessCastaction(), ProcessUnlearnAction(), RefundItem(), resetTalents(), RewardQuest(), and SetHonorPoints().

◆ ModifySkillBonus()

void Player::ModifySkillBonus ( uint32  skillid,
int32  val,
bool  talent 
)
5225{
5226 SkillStatusMap::const_iterator itr = mSkillStatus.find(skillid);
5227 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
5228 return;
5229
5230 uint32 bonusIndex = PLAYER_SKILL_BONUS_INDEX(itr->second.pos);
5231
5232 uint32 bonus_val = GetUInt32Value(bonusIndex);
5233 int16 temp_bonus = SKILL_TEMP_BONUS(bonus_val);
5234 int16 perm_bonus = SKILL_PERM_BONUS(bonus_val);
5235
5236 if (talent) // permanent bonus stored in high part
5237 SetUInt32Value(bonusIndex, MAKE_SKILL_BONUS(temp_bonus, perm_bonus + val));
5238 else // temporary/item bonus stored in low part
5239 SetUInt32Value(bonusIndex, MAKE_SKILL_BONUS(temp_bonus + val, perm_bonus));
5240}
#define MAKE_SKILL_BONUS(t, p)
Definition: Player.h:89

References Object::GetUInt32Value(), MAKE_SKILL_BONUS, mSkillStatus, PLAYER_SKILL_BONUS_INDEX, Object::SetUInt32Value(), SKILL_DELETED, SKILL_PERM_BONUS, and SKILL_TEMP_BONUS.

Referenced by AuraEffect::HandleAuraModSkill().

◆ ModifySpellCooldown()

void Player::ModifySpellCooldown ( uint32  spellId,
int32  cooldown 
)
11010{
11011 SpellCooldowns::iterator itr = m_spellCooldowns.find(spellId);
11012 if (itr == m_spellCooldowns.end())
11013 return;
11014
11015 itr->second.end += cooldown;
11016
11017 WorldPacket data(SMSG_MODIFY_COOLDOWN, 4 + 8 + 4);
11018 data << uint32(spellId); // Spell ID
11019 data << GetGUID(); // Player GUID
11020 data << int32(cooldown); // Cooldown mod in milliseconds
11021 GetSession()->SendPacket(&data);
11022}
@ SMSG_MODIFY_COOLDOWN
Definition: Opcodes.h:1199

References Object::GetGUID(), GetSession(), m_spellCooldowns, WorldSession::SendPacket(), and SMSG_MODIFY_COOLDOWN.

◆ MoneyChanged()

void Player::MoneyChanged ( uint32  value)
2158{
2159 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
2160 {
2161 uint32 questid = GetQuestSlotQuestId(i);
2162 if (!questid)
2163 continue;
2164
2165 if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid))
2166 {
2167 int32 rewOrReqMoney = qInfo->GetRewOrReqMoney();
2168 if (rewOrReqMoney < 0)
2169 {
2170 QuestStatusData& q_status = m_QuestStatus[questid];
2171
2172 if (q_status.Status == QUEST_STATUS_INCOMPLETE)
2173 {
2174 if (int32(count) >= -rewOrReqMoney)
2175 {
2176 if (CanCompleteQuest(questid))
2177 {
2178 CompleteQuest(questid);
2179 }
2180 }
2181 }
2182 else if (q_status.Status == QUEST_STATUS_COMPLETE)
2183 {
2184 if (int32(count) < -rewOrReqMoney)
2185 {
2186 IncompleteQuest(questid);
2187 }
2188 }
2189 }
2190 }
2191 }
2192}

References CanCompleteQuest(), CompleteQuest(), GetQuestSlotQuestId(), IncompleteQuest(), m_QuestStatus, MAX_QUEST_LOG_SIZE, QUEST_STATUS_COMPLETE, QUEST_STATUS_INCOMPLETE, sObjectMgr, and QuestStatusData::Status.

Referenced by SetMoney().

◆ MoveItemFromInventory()

void Player::MoveItemFromInventory ( uint8  bag,
uint8  slot,
bool  update 
)
3001{
3002 if (Item* it = GetItemByPos(bag, slot))
3003 {
3004 ItemRemovedQuestCheck(it->GetEntry(), it->GetCount());
3005 RemoveItem(bag, slot, update);
3007 it->SetNotRefundable(this, false);
3008 it->RemoveFromUpdateQueueOf(this);
3009 if (it->IsInWorld())
3010 {
3011 it->RemoveFromWorld();
3012 it->DestroyForPlayer(this);
3013 }
3014
3015 sScriptMgr->OnAfterPlayerMoveItemFromInventory(this, it, bag, slot, update);
3016 }
3017}

References GetItemByPos(), ItemRemovedQuestCheck(), RemoveItem(), sScriptMgr, and UpdateTitansGrip().

Referenced by AutoUnequipOffhandIfNeed(), WorldSession::HandleAcceptTradeOpcode(), WorldSession::HandleAuctionSellItem(), and WorldSession::HandleSendMail().

◆ MoveItemToInventory()

void Player::MoveItemToInventory ( ItemPosCountVec const &  dest,
Item pItem,
bool  update,
bool  in_characterInventoryDB = false 
)
3021{
3022 // update quest counters
3023 ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount());
3025
3026 // store item
3027 Item* pLastItem = StoreItem(dest, pItem, update);
3028
3029 // only set if not merged to existed stack (pItem can be deleted already but we can compare pointers any way)
3030 if (pLastItem == pItem)
3031 {
3032 // update owner for last item (this can be original item with wrong owner
3033 if (pLastItem->GetOwnerGUID() != GetGUID())
3034 pLastItem->SetOwnerGUID(GetGUID());
3035
3036 // if this original item then it need create record in inventory
3037 // in case trade we already have item in other player inventory
3038 pLastItem->SetState(in_characterInventoryDB ? ITEM_CHANGED : ITEM_NEW, this);
3039
3041 AddTradeableItem(pLastItem);
3042 }
3043}
ObjectGuid GetOwnerGUID() const
Definition: Item.h:225

References ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, AddTradeableItem(), Item::GetCount(), Object::GetEntry(), Object::GetGUID(), Item::GetOwnerGUID(), Object::HasFlag(), ITEM_CHANGED, ITEM_FIELD_FLAG_BOP_TRADEABLE, ITEM_FIELD_FLAGS, ITEM_NEW, ItemAddedQuestCheck(), Item::SetOwnerGUID(), Item::SetState(), StoreItem(), and UpdateAchievementCriteria().

Referenced by WorldSession::HandleMailTakeItem(), and WorldSession::moveItems().

◆ MustDelayTeleport()

bool Player::MustDelayTeleport ( ) const
inlineprivate
2894{ return m_bMustDelayTeleport; } // pussywizard: must delay teleports during player update to the very end

References m_bMustDelayTeleport.

Referenced by TeleportTo().

◆ NeedSendSpectatorData()

bool Player::NeedSendSpectatorData ( ) const
15320{
15321 if (FindMap() && FindMap()->IsBattleArena() && !IsSpectator())
15322 {
15323 Battleground* bg = ((BattlegroundMap*)FindMap())->GetBG();
15324 if (bg && bg->HaveSpectators() && bg->GetStatus() == STATUS_IN_PROGRESS && !bg->GetPlayers().empty())
15325 if (bg->GetPlayers().find(GetGUID()) != bg->GetPlayers().end())
15326 return true;
15327 }
15328 return false;
15329}
bool HaveSpectators()
Definition: Battleground.h:390
BattlegroundPlayerMap const & GetPlayers() const
Definition: Battleground.h:401
bool IsSpectator() const
Definition: Player.h:2539
Definition: Map.h:852

References WorldObject::FindMap(), Object::GetGUID(), Battleground::GetPlayers(), Battleground::GetStatus(), Battleground::HaveSpectators(), IsSpectator(), and STATUS_IN_PROGRESS.

Referenced by _AddSpellCooldown(), Spell::cancel(), RemovePet(), Spell::SendChannelStart(), SendClearCooldown(), Spell::SendSpellStart(), setDeathState(), Unit::SetHealth(), Unit::SetMaxHealth(), Unit::SetMaxPower(), Unit::SetPower(), SetSelection(), and SummonPet().

◆ NeedToSaveGlyphs()

bool Player::NeedToSaveGlyphs ( )
inline
2564{ return m_NeedToSaveGlyphs; }

References m_NeedToSaveGlyphs.

Referenced by _SaveGlyphs().

◆ OCTRegenHPPerSpirit()

float Player::OCTRegenHPPerSpirit ( )
5133{
5134 uint8 level = GetLevel();
5135 uint32 pclass = getClass();
5136
5137 if (level > GT_MAX_LEVEL)
5138 level = GT_MAX_LEVEL;
5139
5140 GtOCTRegenHPEntry const* baseRatio = sGtOCTRegenHPStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
5141 GtRegenHPPerSptEntry const* moreRatio = sGtRegenHPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
5142 if (!baseRatio || !moreRatio)
5143 return 0.0f;
5144
5145 // Formula from PaperDollFrame script
5146 float spirit = GetStat(STAT_SPIRIT);
5147 float baseSpirit = spirit;
5148 if (baseSpirit > 50)
5149 baseSpirit = 50;
5150 float moreSpirit = spirit - baseSpirit;
5151 float regen = (baseSpirit * baseRatio->ratio + moreSpirit * moreRatio->ratio) * 2;
5152 return regen;
5153}
DBCStorage< GtRegenHPPerSptEntry > sGtRegenHPPerSptStore(GtRegenHPPerSptfmt)
DBCStorage< GtOCTRegenHPEntry > sGtOCTRegenHPStore(GtOCTRegenHPfmt)
Definition: DBCStructure.h:1073
float ratio
Definition: DBCStructure.h:1074
Definition: DBCStructure.h:1083
float ratio
Definition: DBCStructure.h:1084

References Unit::getClass(), Unit::GetLevel(), Unit::GetStat(), GT_MAX_LEVEL, GtOCTRegenHPEntry::ratio, GtRegenHPPerSptEntry::ratio, sGtOCTRegenHPStore, sGtRegenHPPerSptStore, and STAT_SPIRIT.

Referenced by RegenerateHealth().

◆ OCTRegenMPPerSpirit()

float Player::OCTRegenMPPerSpirit ( )
5156{
5157 uint8 level = GetLevel();
5158 uint32 pclass = getClass();
5159
5160 if (level > GT_MAX_LEVEL)
5161 level = GT_MAX_LEVEL;
5162
5163 // GtOCTRegenMPEntry const* baseRatio = sGtOCTRegenMPStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1);
5164 GtRegenMPPerSptEntry const* moreRatio = sGtRegenMPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
5165 if (!moreRatio)
5166 return 0.0f;
5167
5168 // Formula get from PaperDollFrame script
5169 float spirit = GetStat(STAT_SPIRIT);
5170 float regen = spirit * moreRatio->ratio;
5171 return regen;
5172}
DBCStorage< GtRegenMPPerSptEntry > sGtRegenMPPerSptStore(GtRegenMPPerSptfmt)
Definition: DBCStructure.h:1088
float ratio
Definition: DBCStructure.h:1089

References Unit::getClass(), Unit::GetLevel(), Unit::GetStat(), GT_MAX_LEVEL, GtRegenMPPerSptEntry::ratio, sGtRegenMPPerSptStore, and STAT_SPIRIT.

Referenced by UpdateManaRegen().

◆ OfflineResurrect()

◆ OnGossipSelect()

void Player::OnGossipSelect ( WorldObject source,
uint32  gossipListId,
uint32  menuId 
)
244{
246
247 // if not same, then something funky is going on
248 if (menuId != gossipMenu.GetMenuId())
249 return;
250
251 GossipMenuItem const* item = gossipMenu.GetItem(gossipListId);
252 if (!item)
253 return;
254
255 uint32 gossipOptionId = item->OptionType;
256 ObjectGuid guid = source->GetGUID();
257
258 if (sWorld->getIntConfig(CONFIG_INSTANT_TAXI) == 2 && source->GetTypeId() == TYPEID_UNIT)
259 {
261 {
263
266 else
268
270 return;
271 }
272 }
273
274 if (source->GetTypeId() == TYPEID_GAMEOBJECT)
275 {
276 if (gossipOptionId > GOSSIP_OPTION_QUESTGIVER)
277 {
278 LOG_ERROR("entities.player", "Player guid {} request invalid gossip option for GameObject entry {}", GetGUID().ToString(), source->GetEntry());
279 return;
280 }
281 }
282
283 GossipMenuItemData const* menuItemData = gossipMenu.GetItemData(gossipListId);
284 if (!menuItemData)
285 return;
286
287 int32 cost = int32(item->BoxMoney);
288 if (!HasEnoughMoney(cost))
289 {
292 return;
293 }
294
295 switch (gossipOptionId)
296 {
299 {
300 if (menuItemData->GossipActionPoi)
302
303 if (menuItemData->GossipActionMenuId)
304 {
305 PrepareGossipMenu(source, menuItemData->GossipActionMenuId);
306 SendPreparedGossip(source);
307 }
308
309 break;
310 }
312 sOutdoorPvPMgr->HandleGossipOption(this, source->ToCreature(), gossipListId);
313 break;
315 if (isDead())
316 source->ToCreature()->CastSpell(source->ToCreature(), 17251, true, nullptr, nullptr, GetGUID());
317 break;
319 PrepareQuestMenu(guid);
320 SendPreparedQuest(guid);
321 break;
324 GetSession()->SendListInventory(guid, menuItemData->GossipActionMenuId);
325 break;
327 GetSession()->SendStablePet(guid);
328 break;
331 break;
333 if (GetSpecsCount() == 1 && GetLevel() >= sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))
334 {
335 // Cast spells that teach dual spec
336 // Both are also ImplicitTarget self and must be cast by player
337 CastSpell(this, 63680, true, nullptr, nullptr, GetGUID());
338 CastSpell(this, 63624, true, nullptr, nullptr, GetGUID());
339
340 PrepareGossipMenu(source, menuItemData->GossipActionMenuId);
341 SendPreparedGossip(source);
342 }
343 break;
347 break;
351 break;
353 GetSession()->SendTaxiMenu(source->ToCreature());
354 break;
357 SetBindPoint(guid);
358 break;
360 GetSession()->SendShowBank(guid);
361 break;
365 break;
369 break;
371 GetSession()->SendAuctionHello(guid, source->ToCreature());
372 break;
374 PrepareGossipMenu(source);
375 SendPreparedGossip(source);
376 break;
378 {
379 BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(source->GetEntry());
380
381 if (bgTypeId == BATTLEGROUND_TYPE_NONE)
382 {
383 LOG_ERROR("entities.player", "A user ({}) requested battlegroundlist from a npc who is no battlemaster", GetGUID().ToString());
384 return;
385 }
386
387 GetSession()->SendBattleGroundList(guid, bgTypeId);
388 break;
389 }
390 }
391
392 ModifyMoney(-cost);
393}
@ GOSSIP_OPTION_AUCTIONEER
Definition: GossipDef.h:47
@ GOSSIP_OPTION_UNLEARNTALENTS
Definition: GossipDef.h:50
@ GOSSIP_OPTION_TRAINER
Definition: GossipDef.h:39
@ GOSSIP_OPTION_ARMORER
Definition: GossipDef.h:49
@ GOSSIP_OPTION_UNLEARNPETTALENTS
Definition: GossipDef.h:51
@ GOSSIP_OPTION_VENDOR
Definition: GossipDef.h:37
@ GOSSIP_OPTION_OUTDOORPVP
Definition: GossipDef.h:53
@ GOSSIP_OPTION_BATTLEFIELD
Definition: GossipDef.h:46
@ GOSSIP_OPTION_TABARDDESIGNER
Definition: GossipDef.h:45
@ GOSSIP_OPTION_TAXIVENDOR
Definition: GossipDef.h:38
@ GOSSIP_OPTION_QUESTGIVER
Definition: GossipDef.h:36
@ GOSSIP_OPTION_LEARNDUALSPEC
Definition: GossipDef.h:52
@ GOSSIP_OPTION_INNKEEPER
Definition: GossipDef.h:42
@ GOSSIP_OPTION_SPIRITGUIDE
Definition: GossipDef.h:41
@ GOSSIP_OPTION_DUALSPEC_INFO
Definition: GossipDef.h:54
@ GOSSIP_OPTION_PETITIONER
Definition: GossipDef.h:44
@ GOSSIP_OPTION_BANKER
Definition: GossipDef.h:43
@ GOSSIP_OPTION_GOSSIP
Definition: GossipDef.h:35
@ GOSSIP_OPTION_SPIRITHEALER
Definition: GossipDef.h:40
@ GOSSIP_OPTION_STABLEPET
Definition: GossipDef.h:48
@ GOSSIP_ACTION_TOGGLE_INSTANT_FLIGHT
Definition: Player.h:1010
@ UNIT_NPC_FLAG_FLIGHTMASTER
Definition: Unit.h:529
@ LANG_INSTANT_FLIGHT_OFF
Definition: Language.h:1329
@ LANG_INSTANT_FLIGHT_ON
Definition: Language.h:1328
@ CONFIG_MIN_DUALSPEC_LEVEL
Definition: IWorld.h:237
BattlegroundTypeId
Definition: SharedDefines.h:3479
@ BATTLEGROUND_TYPE_NONE
Definition: SharedDefines.h:3480
Definition: GossipDef.h:131
uint32 OptionType
Definition: GossipDef.h:136
uint32 BoxMoney
Definition: GossipDef.h:138
Definition: GossipDef.h:145
uint32 GossipActionMenuId
Definition: GossipDef.h:146
uint32 GossipActionPoi
Definition: GossipDef.h:147
Definition: GossipDef.h:162
GossipMenuItem const * GetItem(uint32 id) const
Definition: GossipDef.h:187
uint32 GetMenuId() const
Definition: GossipDef.h:171
GossipMenuItemData const * GetItemData(uint32 indexId) const
Definition: GossipDef.h:196
void SendCloseGossip()
Definition: GossipDef.cpp:241
void SendPointOfInterest(uint32 poiId) const
Definition: GossipDef.cpp:249
GossipMenu & GetGossipMenu()
Definition: GossipDef.h:263
Unit * ToUnit()
Definition: Object.h:200
void SendTalentWipeConfirm(ObjectGuid guid)
Definition: Player.cpp:8791
void SendPreparedGossip(WorldObject *source)
Definition: PlayerGossip.cpp:208
void SendPreparedQuest(ObjectGuid guid)
Definition: PlayerQuest.cpp:115
void ToggleInstantFlight()
Definition: PlayerGossip.cpp:436
void ResetPetTalents()
Definition: Player.cpp:8800
void PrepareQuestMenu(ObjectGuid guid)
Definition: PlayerQuest.cpp:39
void SetBindPoint(ObjectGuid guid)
Definition: Player.cpp:8784
void PrepareGossipMenu(WorldObject *source, uint32 menuId=0, bool showQuests=false)
Definition: PlayerGossip.cpp:31
NPCFlags GetNpcFlags() const
Definition: Unit.h:1659
void SendAuctionHello(ObjectGuid guid, Creature *unit)
Definition: AuctionHouseHandler.cpp:54
void SendPetitionShowList(ObjectGuid guid)
Definition: PetitionsHandler.cpp:824
void SendNotification(const char *format,...) ATTR_PRINTF(2
Definition: WorldSession.cpp:785
void SendTaxiMenu(Creature *unit)
Definition: TaxiHandler.cpp:85
void SendListInventory(ObjectGuid guid, uint32 vendorEntry=0)
Definition: ItemHandler.cpp:1035
void SendTrainerList(ObjectGuid guid)
Definition: NPCHandler.cpp:87
void SendShowBank(ObjectGuid guid)
Definition: BankHandler.cpp:189
void SendStablePet(ObjectGuid guid)
Definition: NPCHandler.cpp:480
void SendBattleGroundList(ObjectGuid guid, BattlegroundTypeId bgTypeId=BATTLEGROUND_RB)
Definition: BattleGroundHandler.cpp:65
void SendTabardVendorActivate(ObjectGuid guid)
Definition: NPCHandler.cpp:65

References BATTLEGROUND_TYPE_NONE, GossipMenuItem::BoxMoney, BUY_ERR_NOT_ENOUGHT_MONEY, Unit::CastSpell(), CONFIG_INSTANT_TAXI, CONFIG_MIN_DUALSPEC_LEVEL, Object::GetEntry(), PlayerMenu::GetGossipMenu(), Object::GetGUID(), GossipMenu::GetItem(), GossipMenu::GetItemData(), Unit::GetLevel(), GossipMenu::GetMenuId(), Unit::GetNpcFlags(), GetSession(), GetSpecsCount(), Object::GetTypeId(), GOSSIP_ACTION_TOGGLE_INSTANT_FLIGHT, GOSSIP_OPTION_ARMORER, GOSSIP_OPTION_AUCTIONEER, GOSSIP_OPTION_BANKER, GOSSIP_OPTION_BATTLEFIELD, GOSSIP_OPTION_DUALSPEC_INFO, GOSSIP_OPTION_GOSSIP, GOSSIP_OPTION_INNKEEPER, GOSSIP_OPTION_LEARNDUALSPEC, GOSSIP_OPTION_OUTDOORPVP, GOSSIP_OPTION_PETITIONER, GOSSIP_OPTION_QUESTGIVER, GOSSIP_OPTION_SPIRITGUIDE, GOSSIP_OPTION_SPIRITHEALER, GOSSIP_OPTION_STABLEPET, GOSSIP_OPTION_TABARDDESIGNER, GOSSIP_OPTION_TAXIVENDOR, GOSSIP_OPTION_TRAINER, GOSSIP_OPTION_UNLEARNPETTALENTS, GOSSIP_OPTION_UNLEARNTALENTS, GOSSIP_OPTION_VENDOR, GossipMenuItemData::GossipActionMenuId, GossipMenuItemData::GossipActionPoi, HasEnoughMoney(), Unit::isDead(), LANG_INSTANT_FLIGHT_OFF, LANG_INSTANT_FLIGHT_ON, LOG_ERROR, m_isInstantFlightOn, ModifyMoney(), GossipMenuItem::OptionType, PlayerTalkClass, PrepareGossipMenu(), PrepareQuestMenu(), ResetPetTalents(), sBattlegroundMgr, WorldSession::SendAuctionHello(), WorldSession::SendBattleGroundList(), SendBuyError(), PlayerMenu::SendCloseGossip(), WorldSession::SendListInventory(), WorldSession::SendNotification(), WorldSession::SendPetitionShowList(), PlayerMenu::SendPointOfInterest(), SendPreparedGossip(), SendPreparedQuest(), WorldSession::SendShowBank(), WorldSession::SendStablePet(), WorldSession::SendTabardVendorActivate(), SendTalentWipeConfirm(), WorldSession::SendTaxiMenu(), WorldSession::SendTrainerList(), SetBindPoint(), sOutdoorPvPMgr, sWorld, Object::ToCreature(), ToggleInstantFlight(), Position::ToString(), Object::ToUnit(), TYPEID_GAMEOBJECT, TYPEID_UNIT, and UNIT_NPC_FLAG_FLIGHTMASTER.

Referenced by WorldSession::HandleGossipSelectOptionOpcode().

◆ outDebugValues()

void Player::outDebugValues ( ) const
protected
7806{
7807 if (!sLog->ShouldLog("entities.player", LogLevel::LOG_LEVEL_DEBUG)) // optimize disabled debug output
7808 return;
7809
7810 LOG_DEBUG("entities.player", "HP is: \t\t\t{}\t\tMP is: \t\t\t{}", GetMaxHealth(), GetMaxPower(POWER_MANA));
7811 LOG_DEBUG("entities.player", "AGILITY is: \t\t{}\t\tSTRENGTH is: \t\t{}", GetStat(STAT_AGILITY), GetStat(STAT_STRENGTH));
7812 LOG_DEBUG("entities.player", "INTELLECT is: \t\t{}\t\tSPIRIT is: \t\t{}", GetStat(STAT_INTELLECT), GetStat(STAT_SPIRIT));
7813 LOG_DEBUG("entities.player", "STAMINA is: \t\t{}", GetStat(STAT_STAMINA));
7814 LOG_DEBUG("entities.player", "Armor is: \t\t{}\t\tBlock is: \t\t{}", GetArmor(), GetFloatValue(PLAYER_BLOCK_PERCENTAGE));
7815 LOG_DEBUG("entities.player", "HolyRes is: \t\t{}\t\tFireRes is: \t\t{}", GetResistance(SPELL_SCHOOL_HOLY), GetResistance(SPELL_SCHOOL_FIRE));
7816 LOG_DEBUG("entities.player", "NatureRes is: \t\t{}\t\tFrostRes is: \t\t{}", GetResistance(SPELL_SCHOOL_NATURE), GetResistance(SPELL_SCHOOL_FROST));
7817 LOG_DEBUG("entities.player", "ShadowRes is: \t\t{}\t\tArcaneRes is: \t\t{}", GetResistance(SPELL_SCHOOL_SHADOW), GetResistance(SPELL_SCHOOL_ARCANE));
7818 LOG_DEBUG("entities.player", "MIN_DAMAGE is: \t\t{}\tMAX_DAMAGE is: \t\t{}", GetFloatValue(UNIT_FIELD_MINDAMAGE), GetFloatValue(UNIT_FIELD_MAXDAMAGE));
7819 LOG_DEBUG("entities.player", "MIN_OFFHAND_DAMAGE is: \t{}\tMAX_OFFHAND_DAMAGE is: \t{}", GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE), GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE));
7820 LOG_DEBUG("entities.player", "MIN_RANGED_DAMAGE is: \t{}\tMAX_RANGED_DAMAGE is: \t{}", GetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE), GetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE));
7821 LOG_DEBUG("entities.player", "ATTACK_TIME is: \t{}\t\tRANGE_ATTACK_TIME is: \t{}", GetAttackTime(BASE_ATTACK), GetAttackTime(RANGED_ATTACK));
7822}
#define sLog
Definition: Log.h:126
@ SPELL_SCHOOL_SHADOW
Definition: SharedDefines.h:288
@ SPELL_SCHOOL_NATURE
Definition: SharedDefines.h:286
@ SPELL_SCHOOL_FROST
Definition: SharedDefines.h:287
@ SPELL_SCHOOL_ARCANE
Definition: SharedDefines.h:289
@ SPELL_SCHOOL_FIRE
Definition: SharedDefines.h:285
uint32 GetArmor() const
Definition: Unit.h:1446

References BASE_ATTACK, Unit::GetArmor(), Unit::GetAttackTime(), Object::GetFloatValue(), Unit::GetMaxHealth(), Unit::GetMaxPower(), Unit::GetResistance(), Unit::GetStat(), LOG_DEBUG, PLAYER_BLOCK_PERCENTAGE, POWER_MANA, RANGED_ATTACK, sLog, SPELL_SCHOOL_ARCANE, SPELL_SCHOOL_FIRE, SPELL_SCHOOL_FROST, SPELL_SCHOOL_HOLY, SPELL_SCHOOL_NATURE, SPELL_SCHOOL_SHADOW, STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STAMINA, STAT_STRENGTH, UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MAXRANGEDDAMAGE, UNIT_FIELD_MINDAMAGE, UNIT_FIELD_MINOFFHANDDAMAGE, and UNIT_FIELD_MINRANGEDDAMAGE.

Referenced by LoadFromDB(), and SaveToDB().

◆ PetSpellInitialize()

void Player::PetSpellInitialize ( )
9388{
9389 Pet* pet = GetPet();
9390
9391 if (!pet)
9392 return;
9393
9394 LOG_DEBUG("entities.pet", "Pet Spells Groups");
9395
9396 CharmInfo* charmInfo = pet->GetCharmInfo();
9397
9398 WorldPacket data(SMSG_PET_SPELLS, 8 + 2 + 4 + 4 + 4 * MAX_UNIT_ACTION_BAR_INDEX + 1 + 1);
9399 data << pet->GetGUID();
9400 data << uint16(pet->GetCreatureTemplate()->family); // creature family (required for pet talents)
9401 data << uint32(pet->GetDuration().count());
9402 data << uint8(pet->GetReactState());
9403 data << uint8(charmInfo->GetCommandState());
9404 data << uint16(0); // Flags, mostly unknown
9405
9406 // action bar loop
9407 charmInfo->BuildActionBar(&data);
9408
9409 size_t spellsCountPos = data.wpos();
9410
9411 // spells count
9412 uint8 addlist = 0;
9413 data << uint8(addlist); // placeholder
9414
9415 if (pet->IsPermanentPetFor(this))
9416 {
9417 // spells loop
9418 for (PetSpellMap::iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr)
9419 {
9420 if (itr->second.state == PETSPELL_REMOVED)
9421 continue;
9422
9423 data << uint32(MAKE_UNIT_ACTION_BUTTON(itr->first, itr->second.active));
9424 ++addlist;
9425 }
9426 }
9427
9428 data.put<uint8>(spellsCountPos, addlist);
9429
9430 uint8 cooldownsCount = pet->m_CreatureSpellCooldowns.size();
9431 data << uint8(cooldownsCount);
9432
9433 uint32 curTime = GameTime::GetGameTimeMS().count();
9435
9436 for (CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureSpellCooldowns.begin(); itr != pet->m_CreatureSpellCooldowns.end(); ++itr)
9437 {
9438 uint16 category = itr->second.category;
9439 uint32 cooldown = (itr->second.end > curTime) ? itr->second.end - curTime : 0;
9440
9441 data << uint32(itr->first); // spellid
9442 data << uint16(itr->second.category); // spell category
9443
9444 // send infinity cooldown in special format
9445 if (itr->second.end >= infTime)
9446 {
9447 data << uint32(1); // cooldown
9448 data << uint32(0x80000000); // category cooldown
9449 continue;
9450 }
9451
9452 data << uint32(category ? 0 : cooldown); // cooldown
9453 data << uint32(category ? cooldown : 0); // category cooldown
9454 }
9455
9456 GetSession()->SendPacket(&data);
9457}
@ PETSPELL_REMOVED
Definition: PetDefines.h:60
#define MAKE_UNIT_ACTION_BUTTON(A, T)
Definition: Unit.h:1050
CreatureSpellCooldowns m_CreatureSpellCooldowns
Definition: Creature.h:245
bool IsPermanentPetFor(Player *owner) const
Definition: Pet.cpp:2289
Milliseconds GetDuration() const
Definition: Pet.h:90
PetSpellMap m_spells
Definition: Pet.h:120

References CharmInfo::BuildActionBar(), CreatureTemplate::family, Unit::GetCharmInfo(), CharmInfo::GetCommandState(), Creature::GetCreatureTemplate(), Pet::GetDuration(), GameTime::GetGameTimeMS(), Object::GetGUID(), GetPet(), Creature::GetReactState(), GetSession(), infinityCooldownDelayCheck, Pet::IsPermanentPetFor(), LOG_DEBUG, Creature::m_CreatureSpellCooldowns, Pet::m_spells, MAKE_UNIT_ACTION_BUTTON, MAX_UNIT_ACTION_BAR_INDEX, PETSPELL_REMOVED, ByteBuffer::put(), WorldSession::SendPacket(), SMSG_PET_SPELLS, and ByteBuffer::wpos().

Referenced by CreatePet(), Spell::EffectCreateTamedPet(), Spell::EffectLearnPetSpell(), Spell::EffectSummonPet(), Spell::EffectTameCreature(), AuraEffect::HandleModPossessPet(), WorldSession::HandlePlayerLoginToCharInWorld(), WorldSession::HandleRequestPetInfo(), Pet::learnSpell(), Pet::LoadPetFromDB(), Pet::resetTalents(), Unit::SetMinion(), and SummonPet().

◆ PossessSpellInitialize()

void Player::PossessSpellInitialize ( )
9460{
9461 Unit* charm = GetCharm();
9462 if (!charm)
9463 return;
9464
9465 CharmInfo* charmInfo = charm->GetCharmInfo();
9466
9467 if (!charmInfo)
9468 {
9469 LOG_ERROR("entities.player", "Player::PossessSpellInitialize(): charm ({}) has no charminfo!", charm->GetGUID().ToString());
9470 return;
9471 }
9472
9473 WorldPacket data(SMSG_PET_SPELLS, 8 + 2 + 4 + 4 + 4 * MAX_UNIT_ACTION_BAR_INDEX + 1 + 1);
9474 data << charm->GetGUID();
9475 data << uint16(0);
9476 data << uint32(0);
9477 data << uint32(0);
9478
9479 charmInfo->BuildActionBar(&data);
9480
9481 data << uint8(0); // spells count
9482 data << uint8(0); // cooldowns count
9483
9484 GetSession()->SendPacket(&data);
9485}
Unit * GetCharm() const
Definition: Unit.cpp:10665

References CharmInfo::BuildActionBar(), Unit::GetCharm(), Unit::GetCharmInfo(), Object::GetGUID(), GetSession(), LOG_ERROR, MAX_UNIT_ACTION_BAR_INDEX, WorldSession::SendPacket(), SMSG_PET_SPELLS, and ObjectGuid::ToString().

Referenced by Unit::SetCharmedBy().

◆ PrepareCharmAISpells()

void Player::PrepareCharmAISpells ( )
15332{
15333 for (int i = 0; i < NUM_CAI_SPELLS; ++i)
15334 m_charmAISpells[i] = 0;
15335
15336 uint32 damage_type[4] = {0, 0, 0, 0};
15337 uint32 periodic_damage = 0;
15338
15339 for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
15340 {
15341 if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->Active || !itr->second->IsInSpec(GetActiveSpec()))
15342 continue;
15343
15344 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
15345 if (!spellInfo)
15346 continue;
15347
15348 if (!spellInfo->SpellFamilyName || spellInfo->IsPassive() || spellInfo->NeedsComboPoints() || (spellInfo->Stances && !spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED)))
15349 continue;
15350
15351 float cast = spellInfo->CalcCastTime() / 1000.0f;
15352 if (cast > 3.0f)
15353 continue;
15354
15355 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
15356 {
15357 if (spellInfo->Effects[i].Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
15358 {
15359 int32 dmg = CalculateSpellDamage(this, spellInfo, i);
15360 uint8 offset = 0;
15361 if (cast)
15362 {
15363 dmg = dmg / cast;
15364 offset = 2;
15365 }
15366
15367 if ((int32)damage_type[offset] < dmg)
15368 {
15369 if (!m_charmAISpells[SPELL_INSTANT_DAMAGE + offset] || !spellInfo->IsHighRankOf(sSpellMgr->GetSpellInfo(m_charmAISpells[SPELL_INSTANT_DAMAGE + offset])) || urand(0, 1))
15370 if (damage_type[1 + offset] < damage_type[offset])
15371 {
15373 damage_type[1 + offset] = damage_type[offset];
15374 }
15375
15376 m_charmAISpells[SPELL_INSTANT_DAMAGE + offset] = spellInfo->Id;
15377 damage_type[offset] = dmg;
15378 }
15379 else if ((int32)damage_type[1 + offset] < dmg)
15380 {
15381 if (m_charmAISpells[SPELL_INSTANT_DAMAGE + offset] && sSpellMgr->GetSpellInfo(m_charmAISpells[SPELL_INSTANT_DAMAGE + offset])->IsHighRankOf(spellInfo) && urand(0, 1))
15382 continue;
15383
15384 m_charmAISpells[SPELL_INSTANT_DAMAGE2 + offset] = spellInfo->Id;
15385 damage_type[1 + offset] = dmg;
15386 }
15387 break;
15388 }
15390 {
15391 m_charmAISpells[SPELL_T_CHARGE] = spellInfo->Id;
15392 break;
15393 }
15394 else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_SPEED)
15395 {
15396 m_charmAISpells[SPELL_FAST_RUN] = spellInfo->Id;
15397 break;
15398 }
15399 else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_SCHOOL_IMMUNITY)
15400 {
15401 m_charmAISpells[SPELL_IMMUNITY] = spellInfo->Id;
15402 break;
15403 }
15404 else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE)
15405 {
15406 if( (int32)periodic_damage < CalculateSpellDamage(this, spellInfo, i) )
15407 {
15408 m_charmAISpells[SPELL_DOT_DAMAGE] = spellInfo->Id;
15409 break;
15410 }
15411 }
15412 else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_STUN)
15413 {
15414 m_charmAISpells[SPELL_T_STUN] = spellInfo->Id;
15415 break;
15416 }
15417 else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_ROOT || spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_FEAR)
15418 {
15420 break;
15421 }
15422 }
15423 }
15424}
@ SPELL_ROOT_OR_FEAR
Definition: Player.h:908
@ SPELL_INSTANT_DAMAGE2
Definition: Player.h:910
@ SPELL_INSTANT_DAMAGE
Definition: Player.h:909
@ SPELL_T_CHARGE
Definition: Player.h:914
@ SPELL_DOT_DAMAGE
Definition: Player.h:913
@ SPELL_FAST_RUN
Definition: Player.h:916
@ SPELL_T_STUN
Definition: Player.h:907
@ SPELL_IMMUNITY
Definition: Player.h:915
@ SPELL_AURA_MOD_INCREASE_SPEED
Definition: SpellAuraDefines.h:94
@ SPELL_AURA_MOD_FEAR
Definition: SpellAuraDefines.h:70
@ SPELL_AURA_MOD_ROOT
Definition: SpellAuraDefines.h:89
@ SPELL_AURA_MOD_STUN
Definition: SpellAuraDefines.h:75
@ SPELL_ATTR7_ATTACK_ON_CHARGE_TO_UNIT
Definition: SharedDefines.h:659
@ SPELL_EFFECT_SCHOOL_DAMAGE
Definition: SharedDefines.h:780
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
Definition: Unit.cpp:14837
bool IsHighRankOf(SpellInfo const *spellInfo) const
Definition: SpellInfo.cpp:2567
bool NeedsComboPoints() const
Definition: SpellInfo.cpp:1253
uint32 CalcCastTime(Unit *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:2338

References SpellInfo::CalcCastTime(), Unit::CalculateSpellDamage(), SpellInfo::Effects, GetActiveSpec(), SpellInfo::HasAttribute(), SpellInfo::Id, SpellInfo::IsHighRankOf(), SpellInfo::IsPassive(), m_charmAISpells, m_spells, MAX_SPELL_EFFECTS, SpellInfo::NeedsComboPoints(), NUM_CAI_SPELLS, PLAYERSPELL_REMOVED, SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED, SPELL_ATTR7_ATTACK_ON_CHARGE_TO_UNIT, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_INCREASE_SPEED, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_SCHOOL_IMMUNITY, SPELL_DOT_DAMAGE, SPELL_EFFECT_SCHOOL_DAMAGE, SPELL_FAST_RUN, SPELL_IMMUNITY, SPELL_INSTANT_DAMAGE, SPELL_INSTANT_DAMAGE2, SPELL_ROOT_OR_FEAR, SPELL_T_CHARGE, SPELL_T_STUN, SpellInfo::SpellFamilyName, sSpellMgr, SpellInfo::Stances, and urand().

Referenced by LoadFromDB().

◆ PrepareGossipMenu()

void Player::PrepareGossipMenu ( WorldObject source,
uint32  menuId = 0,
bool  showQuests = false 
)

Find localizations from database.

Find localizations from database.

32{
34 menu->ClearMenus();
35
36 menu->GetGossipMenu().SetMenuId(menuId);
37
38 GossipMenuItemsMapBounds menuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(menuId);
39
40 // if default menuId and no menu options exist for this, use options from default options
41 if (menuItemBounds.first == menuItemBounds.second && menuId == GetDefaultGossipMenuForSource(source))
42 menuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(0);
43
44 uint32 npcflags = 0;
45
46 if (source->GetTypeId() == TYPEID_UNIT)
47 {
48 npcflags = source->ToUnit()->GetNpcFlags();
49 if (showQuests && npcflags & UNIT_NPC_FLAG_QUESTGIVER)
50 PrepareQuestMenu(source->GetGUID());
51 }
52 else if (source->GetTypeId() == TYPEID_GAMEOBJECT)
53 if (showQuests && source->ToGameObject()->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER)
54 PrepareQuestMenu(source->GetGUID());
55
56 for (GossipMenuItemsContainer::const_iterator itr = menuItemBounds.first; itr != menuItemBounds.second; ++itr)
57 {
58 bool canTalk = true;
59 if (!sConditionMgr->IsObjectMeetToConditions(this, source, itr->second.Conditions))
60 continue;
61
62 if (Creature* creature = source->ToCreature())
63 {
64 if (!(itr->second.OptionNpcFlag & npcflags))
65 continue;
66
67 switch (itr->second.OptionType)
68 {
70 canTalk = false; // added in special mode
71 break;
73 if (!isDead())
74 canTalk = false;
75 break;
77 {
78 if (!creature->isVendorWithIconSpeak())
79 {
80 VendorItemData const* vendorItems = itr->second.ActionMenuID ? sObjectMgr->GetNpcVendorItemList(itr->second.ActionMenuID) : creature->GetVendorItems();
81 if (!vendorItems || vendorItems->Empty())
82 {
83 LOG_ERROR("sql.sql", "Creature {} have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUID().ToString());
84 canTalk = false;
85 }
86 break;
87 }
88 break;
89 }
92 if (!(GetSpecsCount() == 1 && creature->isCanTrainingAndResetTalentsOf(this) && !(GetLevel() < sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))))
93 canTalk = false;
94 break;
96 if (!creature->isCanTrainingAndResetTalentsOf(this))
97 canTalk = false;
98 break;
100 if (!GetPet() || GetPet()->getPetType() != HUNTER_PET || GetPet()->m_spells.size() <= 1 || creature->GetCreatureTemplate()->trainer_type != TRAINER_TYPE_PETS || creature->GetCreatureTemplate()->trainer_class != CLASS_HUNTER)
101 canTalk = false;
102 break;
104 if (GetSession()->SendLearnNewTaxiNode(creature))
105 return;
106 break;
108 if (!creature->isCanInteractWithBattleMaster(this, false))
109 canTalk = false;
110 break;
112 if (getClass() != CLASS_HUNTER)
113 canTalk = false;
114 break;
116 canTalk = false;
117 break;
119 if (!creature->IsValidTrainerForPlayer(this))
120 {
121 canTalk = false;
122 }
123 break;
125 if (creature->isVendorWithIconSpeak())
126 {
127 VendorItemData const* vendorItems = creature->GetVendorItems();
128 if (!vendorItems || vendorItems->Empty())
129 {
130 canTalk = false;
131 }
132 }
133 break;
140 break; // no checks
142 if (!sOutdoorPvPMgr->CanTalkTo(this, creature, itr->second))
143 canTalk = false;
144 break;
145 default:
146 LOG_ERROR("sql.sql", "Creature entry {} has unknown OptionType {} for menu {}", creature->GetEntry(), itr->second.OptionType, itr->second.MenuID);
147 canTalk = false;
148 break;
149 }
150 }
151 else if (GameObject* go = source->ToGameObject())
152 {
153 switch (itr->second.OptionType)
154 {
156 if (go->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER && go->GetGoType() != GAMEOBJECT_TYPE_GOOBER)
157 canTalk = false;
158 break;
159 default:
160 canTalk = false;
161 break;
162 }
163 }
164
165 if (canTalk)
166 {
167 // using gossip_menu_option texts by default
168 std::string strOptionText = itr->second.OptionText;
169 std::string strBoxText = itr->second.BoxText;
170 // search in broadcast_text and broadcast_text_locale
171 BroadcastText const* optionBroadcastText = sObjectMgr->GetBroadcastText(itr->second.OptionBroadcastTextID);
172 BroadcastText const* boxBroadcastText = sObjectMgr->GetBroadcastText(itr->second.BoxBroadcastTextID);
174
175 if (optionBroadcastText)
176 ObjectMgr::GetLocaleString(getGender() == GENDER_MALE ? optionBroadcastText->MaleText : optionBroadcastText->FemaleText, locale, strOptionText);
177
178 if (boxBroadcastText)
179 ObjectMgr::GetLocaleString(getGender() == GENDER_MALE ? boxBroadcastText->MaleText : boxBroadcastText->FemaleText, locale, strBoxText);
180
181 // if the language is not default and the texts weren't found, maybe they're in gossip_menu_option_locale table
182 if (locale != DEFAULT_LOCALE)
183 {
184 if (!optionBroadcastText)
185 {
187 if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, itr->second.OptionID)))
188 ObjectMgr::GetLocaleString(gossipMenuLocale->OptionText, locale, strOptionText);
189 }
190
191 if (!boxBroadcastText)
192 {
194 if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, itr->second.OptionID)))
195 ObjectMgr::GetLocaleString(gossipMenuLocale->BoxText, locale, strBoxText);
196 }
197 }
198
199 menu->GetGossipMenu().AddMenuItem(itr->second.OptionID, itr->second.OptionIcon, strOptionText, 0, itr->second.OptionType, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded);
200 menu->GetGossipMenu().AddGossipMenuItemData(itr->second.OptionID, itr->second.ActionMenuID, itr->second.ActionPoiID);
201 }
202 }
203
204 if (sWorld->getIntConfig(CONFIG_INSTANT_TAXI) == 2 && npcflags & UNIT_NPC_FLAG_FLIGHTMASTER)
206}
LocaleConstant
Definition: Common.h:67
#define DEFAULT_LOCALE
Definition: Common.h:81
@ GOSSIP_ICON_INTERACT_1
Definition: GossipDef.h:64
@ HUNTER_PET
Definition: PetDefines.h:32
std::pair< GossipMenuItemsContainer::const_iterator, GossipMenuItemsContainer::const_iterator > GossipMenuItemsMapBounds
Definition: ObjectMgr.h:639
@ LANG_TOGGLE_INSTANT_FLIGHT
Definition: Language.h:1327
@ GAMEOBJECT_TYPE_GOOBER
Definition: SharedDefines.h:1570
@ TRAINER_TYPE_PETS
Definition: SharedDefines.h:2620
AC_GAME_API char const * GetAcoreString(ChatHandler const *handler, AcoreStrings which)
Definition: ChatCommandHelpers.cpp:28
Definition: CreatureData.h:338
void SetMenuId(uint32 menu_id)
Definition: GossipDef.h:170
void AddMenuItem(int32 menuItemId, uint8 icon, std::string const &message, uint32 sender, uint32 action, std::string const &boxMessage, uint32 boxMoney, bool coded=false)
Definition: GossipDef.cpp:41
void AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi)
Definition: GossipDef.cpp:136
void ClearMenus()
Definition: GossipDef.cpp:187
GameobjectTypes GetGoType() const
Definition: GameObject.h:205
Definition: ObjectMgr.h:435
std::vector< std::string > FemaleText
Definition: ObjectMgr.h:445
std::vector< std::string > MaleText
Definition: ObjectMgr.h:444
static std::string_view GetLocaleString(std::vector< std::string > const &data, size_t locale)
Definition: ObjectMgr.h:1416

References GossipMenu::AddGossipMenuItemData(), GossipMenu::AddMenuItem(), CLASS_HUNTER, PlayerMenu::ClearMenus(), CONFIG_INSTANT_TAXI, CONFIG_MIN_DUALSPEC_LEVEL, DEFAULT_LOCALE, VendorItemData::Empty(), BroadcastText::FemaleText, GAMEOBJECT_TYPE_GOOBER, GAMEOBJECT_TYPE_QUESTGIVER, GENDER_MALE, Unit::getClass(), GetDefaultGossipMenuForSource(), Unit::getGender(), PlayerMenu::GetGossipMenu(), GameObject::GetGoType(), Object::GetGUID(), Unit::GetLevel(), ObjectMgr::GetLocaleString(), Unit::GetNpcFlags(), GetPet(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), GetSpecsCount(), Object::GetTypeId(), GOSSIP_ACTION_TOGGLE_INSTANT_FLIGHT, GOSSIP_ICON_INTERACT_1, GOSSIP_OPTION_ARMORER, GOSSIP_OPTION_AUCTIONEER, GOSSIP_OPTION_BANKER, GOSSIP_OPTION_BATTLEFIELD, GOSSIP_OPTION_DUALSPEC_INFO, GOSSIP_OPTION_GOSSIP, GOSSIP_OPTION_INNKEEPER, GOSSIP_OPTION_LEARNDUALSPEC, GOSSIP_OPTION_OUTDOORPVP, GOSSIP_OPTION_PETITIONER, GOSSIP_OPTION_QUESTGIVER, GOSSIP_OPTION_SPIRITGUIDE, GOSSIP_OPTION_SPIRITHEALER, GOSSIP_OPTION_STABLEPET, GOSSIP_OPTION_TABARDDESIGNER, GOSSIP_OPTION_TAXIVENDOR, GOSSIP_OPTION_TRAINER, GOSSIP_OPTION_UNLEARNPETTALENTS, GOSSIP_OPTION_UNLEARNTALENTS, GOSSIP_OPTION_VENDOR, HUNTER_PET, Unit::isDead(), LANG_TOGGLE_INSTANT_FLIGHT, LOG_ERROR, m_spells, MAKE_PAIR32(), BroadcastText::MaleText, PlayerTalkClass, PrepareQuestMenu(), sConditionMgr, GossipMenu::SetMenuId(), sObjectMgr, sOutdoorPvPMgr, sWorld, Object::ToCreature(), Object::ToGameObject(), Object::ToUnit(), TRAINER_TYPE_PETS, TYPEID_GAMEOBJECT, TYPEID_UNIT, UNIT_NPC_FLAG_FLIGHTMASTER, and UNIT_NPC_FLAG_QUESTGIVER.

Referenced by WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), npc_thrall_old_hillsbrad::OnGossipHello(), brann_bronzebeard::OnGossipHello(), go_apexis_relic::OnGossipHello(), OnGossipSelect(), Spell::SendLoot(), npc_maredis_firestar::npc_maredis_firestarAI::sGossipHello(), and GameObject::Use().

◆ PrepareQuestMenu()

void Player::PrepareQuestMenu ( ObjectGuid  guid)
40{
41 QuestRelationBounds objectQR;
42 QuestRelationBounds objectQIR;
43
44 // pets also can have quests
46 if (creature)
47 {
48 objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
49 objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
50 }
51 else
52 {
53 //we should obtain map pointer from GetMap() in 99% of cases. Special case
54 //only for quests which cast teleport spells on player
56 ASSERT(_map);
57 GameObject* pGameObject = _map->GetGameObject(guid);
58 if (pGameObject)
59 {
60 objectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry());
61 objectQIR = sObjectMgr->GetGOQuestInvolvedRelationBounds(pGameObject->GetEntry());
62 }
63 else
64 return;
65 }
66
68 qm.ClearMenu();
69
70 for (QuestRelations::const_iterator i = objectQIR.first; i != objectQIR.second; ++i)
71 {
72 uint32 quest_id = i->second;
73 QuestStatus status = GetQuestStatus(quest_id);
74 if (status == QUEST_STATUS_COMPLETE)
75 qm.AddMenuItem(quest_id, 4);
76 else if (status == QUEST_STATUS_INCOMPLETE)
77 qm.AddMenuItem(quest_id, 4);
78 //else if (status == QUEST_STATUS_AVAILABLE)
79 // qm.AddMenuItem(quest_id, 2);
80 }
81
82 for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i)
83 {
84 uint32 quest_id = i->second;
85 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
86 if (!quest)
87 continue;
88
89 if (!CanTakeQuest(quest, false))
90 continue;
91
92 if (quest->IsAutoComplete() && (!quest->IsRepeatable() || quest->IsDaily() || quest->IsWeekly() || quest->IsMonthly()))
93 qm.AddMenuItem(quest_id, 0);
94 else if (quest->IsAutoComplete())
95 qm.AddMenuItem(quest_id, 4);
96 else if (GetQuestStatus(quest_id) == QUEST_STATUS_NONE)
97 qm.AddMenuItem(quest_id, 2);
98 }
99}
Definition: GossipDef.h:228
void ClearMenu()
Definition: GossipDef.cpp:312
void AddMenuItem(uint32 QuestId, uint8 Icon)
Definition: GossipDef.cpp:288
QuestMenu & GetQuestMenu()
Definition: GossipDef.h:264

References QuestMenu::AddMenuItem(), ASSERT, CanTakeQuest(), QuestMenu::ClearMenu(), ObjectAccessor::GetCreatureOrPetOrVehicle(), Object::GetEntry(), Map::GetGameObject(), WorldObject::GetInstanceId(), WorldObject::GetMap(), WorldLocation::GetMapId(), PlayerMenu::GetQuestMenu(), GetQuestStatus(), Quest::IsAutoComplete(), Quest::IsDaily(), Object::IsInWorld(), Quest::IsMonthly(), Quest::IsRepeatable(), Quest::IsWeekly(), PlayerTalkClass, QUEST_STATUS_COMPLETE, QUEST_STATUS_INCOMPLETE, QUEST_STATUS_NONE, sMapMgr, and sObjectMgr.

Referenced by npc_lokhtos_darkbargainer::OnGossipHello(), npc_highlord_darion_mograine::OnGossipHello(), npc_augustus_the_touched::OnGossipHello(), npc_parqual_fintallas::OnGossipHello(), npc_varian_wrynn::OnGossipHello(), npc_thrall_bfu::OnGossipHello(), npc_cos_chromie_middle::OnGossipHello(), npcs_riverbreeze_and_silversky::OnGossipHello(), npc_thrall_warchief::OnGossipHello(), npc_braug_dimspirit::OnGossipHello(), npc_steward_of_time::OnGossipHello(), npc_stone_watcher_of_norgannon::OnGossipHello(), npc_rivern_frostwind::OnGossipHello(), npc_fos_leader::OnGossipHello(), npc_hor_leader::OnGossipHello(), npc_oculus_drakegiver::OnGossipHello(), npc_shandy_dalaran::OnGossipHello(), npc_razael_and_lyana::OnGossipHello(), npc_mcmanus::OnGossipHello(), npc_vekjik::OnGossipHello(), npc_avatar_of_freya::OnGossipHello(), npc_roxi_ramrocket::OnGossipHello(), npc_wg_demolisher_engineer::OnGossipHello(), npc_wg_spirit_guide::OnGossipHello(), npc_wg_queue::OnGossipHello(), npc_wg_quest_giver::OnGossipHello(), npc_finklestein::OnGossipHello(), npc_captain_saeed::OnGossipHello(), npc_innkeeper::OnGossipHello(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), npc_taxi::OnGossipHello(), npc_riggle_bassbait::OnGossipHello(), npc_sayge::OnGossipHello(), go_fel_crystalforge::OnGossipHello(), go_bashir_crystalforge::OnGossipHello(), OnGossipSelect(), PrepareGossipMenu(), and npc_maredis_firestar::npc_maredis_firestarAI::sGossipSelect().

◆ PrettyPrintRequirementsAchievementsList()

void Player::PrettyPrintRequirementsAchievementsList ( const std::vector< const ProgressionRequirement * > &  missingAchievements) const
6657{
6659 for (const ProgressionRequirement* missingReq : missingAchievements)
6660 {
6661 AchievementEntry const* achievementEntry = sAchievementStore.LookupEntry(missingReq->id);
6662 if (!achievementEntry)
6663 {
6664 continue;
6665 }
6666
6667 std::string name = achievementEntry->name[sObjectMgr->GetDBCLocaleIndex()];
6668
6669 std::stringstream stream;
6670 stream << "|cffff7c0a|Hachievement:";
6671 stream << missingReq->id;
6672 stream << ":";
6673 stream << GetGUID().ToString();
6674 stream << ":0:0:0:0:0:0:0:0|h[";
6675 stream << name;
6676 stream << "]|h|r";
6677
6678 if (missingReq->note.empty())
6679 {
6680 ChatHandler(GetSession()).PSendSysMessage(" - %s", stream.str().c_str());
6681 }
6682 else
6683 {
6684 ChatHandler(GetSession()).PSendSysMessage(" - %s %s %s", stream.str().c_str(), sObjectMgr->GetAcoreString(LANG_ACCESS_REQUIREMENT_NOTE, loc_idx), missingReq->note.c_str());
6685 }
6686 }
6687}
DBCStorage< AchievementEntry > sAchievementStore(Achievementfmt)
@ LANG_ACCESS_REQUIREMENT_NOTE
Definition: Language.h:828
Definition: Player.h:925
Definition: DBCStructure.h:40
std::array< char const *, 16 > name
Definition: DBCStructure.h:45

References Object::GetGUID(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), LANG_ACCESS_REQUIREMENT_NOTE, AchievementEntry::name, ChatHandler::PSendSysMessage(), sAchievementStore, sObjectMgr, and ObjectGuid::ToString().

Referenced by Satisfy().

◆ PrettyPrintRequirementsItemsList()

void Player::PrettyPrintRequirementsItemsList ( const std::vector< const ProgressionRequirement * > &  missingItems) const
6690{
6692 for (const ProgressionRequirement* missingReq : missingItems)
6693 {
6694 ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(missingReq->id);
6695 if (!itemTemplate)
6696 {
6697 continue;
6698 }
6699
6700 //Get the localised name
6701 std::string name = itemTemplate->Name1;
6702 if (ItemLocale const* il = sObjectMgr->GetItemLocale(itemTemplate->ItemId))
6703 {
6704 ObjectMgr::GetLocaleString(il->Name, loc_idx, name);
6705 }
6706
6707 std::stringstream stream;
6708 stream << "|c";
6709 stream << std::hex << ItemQualityColors[itemTemplate->Quality] << std::dec;
6710 stream << "|Hitem:";
6711 stream << itemTemplate->ItemId;
6712 stream << ":0:0:0:0:0:0:0:0:0|h[";
6713 stream << name;
6714 stream << "]|h|r";
6715
6716 if (missingReq->note.empty())
6717 {
6718 ChatHandler(GetSession()).PSendSysMessage(" - %s", stream.str().c_str());
6719 }
6720 else
6721 {
6722 ChatHandler(GetSession()).PSendSysMessage(" - %s %s %s", stream.str().c_str(), sObjectMgr->GetAcoreString(LANG_ACCESS_REQUIREMENT_NOTE, loc_idx), missingReq->note.c_str());
6723 }
6724 }
6725}
const uint32 ItemQualityColors[MAX_ITEM_QUALITY]
Definition: SharedDefines.h:353
std::string Name1
Definition: ItemTemplate.h:633
Definition: ItemTemplate.h:843

References ObjectMgr::GetLocaleString(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), ItemTemplate::ItemId, ItemQualityColors, LANG_ACCESS_REQUIREMENT_NOTE, ItemTemplate::Name1, ChatHandler::PSendSysMessage(), ItemTemplate::Quality, and sObjectMgr.

Referenced by Satisfy().

◆ PrettyPrintRequirementsQuestList()

void Player::PrettyPrintRequirementsQuestList ( const std::vector< const ProgressionRequirement * > &  missingQuests) const
6620{
6622 for (const ProgressionRequirement* missingReq : missingQuests)
6623 {
6624 Quest const* questTemplate = sObjectMgr->GetQuestTemplate(missingReq->id);
6625 if (!questTemplate)
6626 {
6627 continue;
6628 }
6629
6630 std::string questTitle = questTemplate->GetTitle();
6631 if (QuestLocale const* questLocale = sObjectMgr->GetQuestLocale(questTemplate->GetQuestId()))
6632 {
6633 ObjectMgr::GetLocaleString(questLocale->Title, loc_idx, questTitle);
6634 }
6635
6636 std::stringstream stream;
6637 stream << "|cffff7c0a|Hquest:";
6638 stream << questTemplate->GetQuestId();
6639 stream << ":";
6640 stream << questTemplate->GetQuestLevel();
6641 stream << "|h[";
6642 stream << questTitle;
6643 stream << "]|h|r";
6644
6645 if (missingReq->note.empty())
6646 {
6647 ChatHandler(GetSession()).PSendSysMessage(" - %s", stream.str().c_str());
6648 }
6649 else
6650 {
6651 ChatHandler(GetSession()).PSendSysMessage(" - %s %s %s", stream.str().c_str(), sObjectMgr->GetAcoreString(LANG_ACCESS_REQUIREMENT_NOTE, loc_idx), missingReq->note.c_str());
6652 }
6653 }
6654}
Definition: QuestDef.h:180
int32 GetQuestLevel() const
Definition: QuestDef.h:230
std::string const & GetTitle() const
Definition: QuestDef.h:258

References ObjectMgr::GetLocaleString(), Quest::GetQuestId(), Quest::GetQuestLevel(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), Quest::GetTitle(), LANG_ACCESS_REQUIREMENT_NOTE, ChatHandler::PSendSysMessage(), and sObjectMgr.

Referenced by Satisfy().

◆ ProcessDelayedOperations()

void Player::ProcessDelayedOperations ( )
1602{
1603 if (m_DelayedOperations == 0)
1604 return;
1605
1607 {
1608 ResurrectPlayer(0.0f, false);
1609
1612 else
1613 SetFullHealth();
1614
1617 else
1619
1620 SetPower(POWER_RAGE, 0);
1622
1624 }
1625
1627 SaveToDB(false, false);
1628
1630 {
1631 Aura* aura = GetAura(26013);
1632 if (!aura || aura->GetDuration() <= 900000)
1633 CastSpell(this, 26013, true);
1634 }
1635
1637 {
1639 {
1640 // xinef: remove shapeshift auras
1642 {
1644 }
1647 }
1648 }
1649
1651 {
1653 {
1658 }
1659 }
1660
1662 {
1663 if (Group* g = GetGroup())
1664 g->SendUpdateToPlayer(GetGUID());
1665 }
1666
1668 {
1669 if (Vehicle* vehicle = GetVehicle())
1670 {
1671 SeatMap::iterator itr = vehicle->GetSeatIteratorForPassenger(this);
1672 if (itr != vehicle->Seats.end())
1673 if (Unit* base = vehicle->GetBase())
1674 {
1675 ExitVehicle();
1676 base->HandleSpellClick(this, itr->first);
1677 }
1678 }
1679 }
1680
1681 //we have executed ALL delayed ops, so clear the flag
1683}
@ DELAYED_BG_GROUP_RESTORE
Flag to restore group state after teleport from BG.
Definition: Player.h:900
@ DELAYED_SAVE_PLAYER
Definition: Player.h:895
@ DELAYED_BG_MOUNT_RESTORE
Flag to restore mount state after teleport from BG.
Definition: Player.h:898
@ DELAYED_VEHICLE_TELEPORT
Definition: Player.h:901
@ DELAYED_BG_TAXI_RESTORE
Flag to restore taxi state after teleport from BG.
Definition: Player.h:899
@ DELAYED_SPELL_CAST_DESERTER
Definition: Player.h:897
@ DELAYED_RESURRECT_PLAYER
Definition: Player.h:896
void SaveToDB(bool create, bool logout)
Definition: PlayerStorage.cpp:7073
uint32 m_resurrectMana
Definition: Player.h:2793
void ContinueTaxiFlight()
Definition: Player.cpp:10360
uint32 m_resurrectHealth
Definition: Player.h:2793
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:19127
Definition: Vehicle.h:30

References Unit::AddAura(), PlayerTaxi::AddTaxiDestination(), Unit::CastSpell(), EntryPointData::ClearTaxiPath(), ContinueTaxiFlight(), DELAYED_BG_GROUP_RESTORE, DELAYED_BG_MOUNT_RESTORE, DELAYED_BG_TAXI_RESTORE, DELAYED_RESURRECT_PLAYER, DELAYED_SAVE_PLAYER, DELAYED_SPELL_CAST_DESERTER, DELAYED_VEHICLE_TELEPORT, Unit::ExitVehicle(), Unit::GetAura(), Aura::GetDuration(), GetGroup(), Object::GetGUID(), Unit::GetMaxHealth(), Unit::GetMaxPower(), Unit::GetVehicle(), EntryPointData::HasTaxiPath(), Unit::IsInDisallowedMountForm(), m_DelayedOperations, m_entryPointData, m_resurrectHealth, m_resurrectMana, m_taxi, EntryPointData::mountSpell, POWER_ENERGY, POWER_MANA, POWER_RAGE, Unit::RemoveAurasByType(), ResurrectPlayer(), SaveToDB(), Unit::SetFullHealth(), Unit::SetHealth(), Unit::SetPower(), SpawnCorpseBones(), SPELL_AURA_MOD_SHAPESHIFT, and EntryPointData::taxiPath.

Referenced by WorldSession::HandleMoveTeleportAck(), and WorldSession::HandleMoveWorldportAck().

◆ ProcessTerrainStatusUpdate()

void Player::ProcessTerrainStatusUpdate ( )
overridevirtual

Reimplemented from Unit.

2206{
2207 // process liquid auras using generic unit code
2209
2210 LiquidData const& liquidData = GetLiquidData();
2211
2212 // player specific logic for mirror timers
2213 if (liquidData.Status != LIQUID_MAP_NO_WATER)
2214 {
2215 // Breath bar state (under water in any liquid type)
2216 if ((liquidData.Flags & MAP_ALL_LIQUIDS) != 0)
2217 {
2218 if ((liquidData.Status & LIQUID_MAP_UNDER_WATER) != 0)
2220 else
2221 m_MirrorTimerFlags &= ~UNDERWATER_INWATER;
2222 }
2223
2224 // Fatigue bar state (if not on flight path or transport)
2225 if ((liquidData.Flags & MAP_LIQUID_TYPE_DARK_WATER) && !IsInFlight() && !GetTransport())
2226 {
2227 // Exclude also uncontrollable vehicles
2228 Vehicle* vehicle = GetVehicle();
2229 VehicleSeatEntry const* vehicleSeat = vehicle ? vehicle->GetSeatForPassenger(this) : nullptr;
2230 if (!vehicleSeat || vehicleSeat->CanControl())
2232 else
2233 m_MirrorTimerFlags &= ~UNDERWATER_INDARKWATER;
2234 }
2235 else
2236 m_MirrorTimerFlags &= ~UNDERWATER_INDARKWATER;
2237
2238 // Lava state (any contact)
2239 if (liquidData.Flags & MAP_LIQUID_TYPE_MAGMA)
2240 {
2241 if (liquidData.Status & MAP_LIQUID_STATUS_IN_CONTACT)
2243 else
2244 m_MirrorTimerFlags &= ~UNDERWATER_INLAVA;
2245 }
2246
2247 // Slime state (any contact)
2248 if (liquidData.Flags & MAP_LIQUID_TYPE_SLIME)
2249 {
2250 if (liquidData.Status & MAP_LIQUID_STATUS_IN_CONTACT)
2252 else
2253 m_MirrorTimerFlags &= ~UNDERWATER_INSLIME;
2254 }
2255 }
2256 else
2258}
@ UNDERWATER_INSLIME
Definition: Player.h:104
#define MAP_LIQUID_TYPE_MAGMA
Definition: Map.h:157
@ LIQUID_MAP_UNDER_WATER
Definition: Map.h:148
@ LIQUID_MAP_NO_WATER
Definition: Map.h:144
#define MAP_LIQUID_STATUS_IN_CONTACT
Definition: Map.h:152
#define MAP_LIQUID_TYPE_DARK_WATER
Definition: Map.h:162
#define MAP_LIQUID_TYPE_SLIME
Definition: Map.h:158
#define MAP_ALL_LIQUIDS
Definition: Map.h:160
LiquidData const & GetLiquidData() const
Definition: Object.cpp:3133
virtual void ProcessTerrainStatusUpdate()
Definition: Unit.cpp:4212
VehicleSeatEntry const * GetSeatForPassenger(Unit const *passenger)
Definition: Vehicle.cpp:582
Definition: Map.h:171
uint32 Flags
Definition: Map.h:175
LiquidStatus Status
Definition: Map.h:178
Definition: DBCStructure.h:2065
bool CanControl() const
Definition: DBCStructure.h:2128

References VehicleSeatEntry::CanControl(), LiquidData::Flags, WorldObject::GetLiquidData(), Vehicle::GetSeatForPassenger(), WorldObject::GetTransport(), Unit::GetVehicle(), Unit::IsInFlight(), LIQUID_MAP_NO_WATER, LIQUID_MAP_UNDER_WATER, m_MirrorTimerFlags, MAP_ALL_LIQUIDS, MAP_LIQUID_STATUS_IN_CONTACT, MAP_LIQUID_TYPE_DARK_WATER, MAP_LIQUID_TYPE_MAGMA, MAP_LIQUID_TYPE_SLIME, Unit::ProcessTerrainStatusUpdate(), LiquidData::Status, UNDERWATER_INDARKWATER, UNDERWATER_INLAVA, UNDERWATER_INSLIME, and UNDERWATER_INWATER.

◆ ProhibitSpellSchool()

void Player::ProhibitSpellSchool ( SpellSchoolMask  idSchoolMask,
uint32  unTimeMs 
)
overridevirtual

Reimplemented from Unit.

10456{
10457 PacketCooldowns cooldowns;
10458 WorldPacket data;
10459
10460 for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
10461 {
10462 if (itr->second->State == PLAYERSPELL_REMOVED)
10463 continue;
10464 uint32 unSpellId = itr->first;
10465 SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(unSpellId);
10466
10467 // Not send cooldown for this spells
10468 if (spellInfo->IsCooldownStartedOnEvent())
10469 continue;
10470
10472 continue;
10473
10474 if ((idSchoolMask & spellInfo->GetSchoolMask()) && GetSpellCooldownDelay(unSpellId) < unTimeMs)
10475 {
10476 cooldowns[unSpellId] = unTimeMs;
10477 AddSpellCooldown(unSpellId, 0, unTimeMs, true);
10478 }
10479 }
10480
10481 if (!cooldowns.empty())
10482 {
10484 GetSession()->SendPacket(&data);
10485 }
10486}
@ SPELL_PREVENTION_TYPE_SILENCE
Definition: SharedDefines.h:1554
uint32 GetSpellCooldownDelay(uint32 spell_id) const
Definition: Player.cpp:16263
uint32 PreventionType
Definition: SpellInfo.h:388
bool IsCooldownStartedOnEvent() const
Definition: SpellInfo.cpp:1199
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:1974

References AddSpellCooldown(), Unit::BuildCooldownPacket(), SpellInfo::GetSchoolMask(), GetSession(), GetSpellCooldownDelay(), SpellInfo::IsCooldownStartedOnEvent(), m_spells, PLAYERSPELL_REMOVED, SpellInfo::PreventionType, WorldSession::SendPacket(), SPELL_COOLDOWN_FLAG_NONE, SPELL_PREVENTION_TYPE_SILENCE, and sSpellMgr.

◆ QuickEquipItem()

void Player::QuickEquipItem ( uint16  pos,
Item pItem 
)
2858{
2859 if (pItem)
2860 {
2862 AddItemDurations(pItem);
2863
2864 uint8 slot = pos & 255;
2865 VisualizeItem(slot, pItem);
2866
2867 if (IsInWorld())
2868 {
2869 pItem->AddToWorld();
2870 pItem->SendUpdateToPlayer(this);
2871 }
2872
2875
2876 sScriptMgr->OnEquip(this, pItem, (pos >> 8), slot, true);
2877 }
2878}

References ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, AddEnchantmentDurations(), AddItemDurations(), Object::AddToWorld(), Object::GetEntry(), Object::IsInWorld(), Object::SendUpdateToPlayer(), sScriptMgr, UpdateAchievementCriteria(), and VisualizeItem().

Referenced by _LoadInventory().

◆ RecalculateRating()

void Player::RecalculateRating ( CombatRating  cr)
inline
1925{ ApplyRatingMod(cr, 0, true);}

References ApplyRatingMod().

Referenced by DestroyItem(), EquipItem(), RemoveItem(), and UpdateAllStats().

◆ RefundItem()

void Player::RefundItem ( Item item)
private

Already checked before

15510{
15512 {
15513 LOG_DEBUG("entities.player.items", "Item refund: item not refundable!");
15514 return;
15515 }
15516
15517 if (item->IsRefundExpired()) // item refund has expired
15518 {
15519 item->SetNotRefundable(this);
15521 data << item->GetGUID(); // Guid
15522 data << uint32(10); // Error!
15523 GetSession()->SendPacket(&data);
15524 return;
15525 }
15526
15527 if (GetGUID().GetCounter() != item->GetRefundRecipient()) // Formerly refundable item got traded
15528 {
15529 LOG_DEBUG("entities.player.items", "Item refund: item was traded!");
15530 item->SetNotRefundable(this);
15531 return;
15532 }
15533
15534 ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(item->GetPaidExtendedCost());
15535 if (!iece)
15536 {
15537 LOG_DEBUG("entities.player.items", "Item refund: cannot find extendedcost data.");
15538 return;
15539 }
15540
15541 bool store_error = false;
15542 for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i)
15543 {
15544 uint32 count = iece->reqitemcount[i];
15545 uint32 itemid = iece->reqitem[i];
15546
15547 if (count && itemid)
15548 {
15549 ItemPosCountVec dest;
15550 InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count);
15551 if (msg != EQUIP_ERR_OK)
15552 {
15553 store_error = true;
15554 break;
15555 }
15556 }
15557 }
15558
15559 if (store_error)
15560 {
15562 data << item->GetGUID(); // Guid
15563 data << uint32(10); // Error!
15564 GetSession()->SendPacket(&data);
15565 return;
15566 }
15567
15568 WorldPacket data(SMSG_ITEM_REFUND_RESULT, 8 + 4 + 4 + 4 + 4 + 4 * 4 + 4 * 4);
15569 data << item->GetGUID(); // item guid
15570 data << uint32(0); // 0, or error code
15571 data << uint32(item->GetPaidMoney()); // money cost
15572 data << uint32(iece->reqhonorpoints); // honor point cost
15573 data << uint32(iece->reqarenapoints); // arena point cost
15574 for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
15575 {
15576 data << uint32(iece->reqitem[i]);
15577 data << uint32(iece->reqitemcount[i]);
15578 }
15579 GetSession()->SendPacket(&data);
15580
15581 uint32 moneyRefund = item->GetPaidMoney(); // item-> will be invalidated in DestroyItem
15582
15583 // Save all relevant data to DB to prevent desynchronisation exploits
15584 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
15585
15586 // Delete any references to the refund data
15587 item->SetNotRefundable(this, true, &trans);
15588
15589 // Destroy item
15590 DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
15591
15592 // Grant back extendedcost items
15593 for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i)
15594 {
15595 uint32 count = iece->reqitemcount[i];
15596 uint32 itemid = iece->reqitem[i];
15597 if (count && itemid)
15598 {
15599 ItemPosCountVec dest;
15600 InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count);
15601 ASSERT(msg == EQUIP_ERR_OK);
15602 Item* it = StoreNewItem(dest, itemid, true);
15603 SendNewItem(it, count, true, false, true);
15604 }
15605 }
15606
15607 // Grant back money
15608 if (moneyRefund)
15609 ModifyMoney(moneyRefund); // Saved in SaveInventoryAndGoldToDB
15610
15611 // Grant back Honor points
15612 if (uint32 honorRefund = iece->reqhonorpoints)
15613 ModifyHonorPoints(honorRefund, trans);
15614
15615 // Grant back Arena points
15616 if (uint32 arenaRefund = iece->reqarenapoints)
15617 ModifyArenaPoints(arenaRefund, trans);
15618
15620
15621 CharacterDatabase.CommitTransaction(trans);
15622}
@ SMSG_ITEM_REFUND_RESULT
Definition: Opcodes.h:1235
uint32 GetPaidExtendedCost()
Definition: Item.h:340
uint32 GetPaidMoney()
Definition: Item.h:339
ObjectGuid::LowType GetRefundRecipient()
Definition: Item.h:338
bool IsRefundExpired()
Definition: Item.cpp:1254
void SaveInventoryAndGoldToDB(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7144

References ASSERT, CanStoreNewItem(), CharacterDatabase, DestroyItem(), EQUIP_ERR_OK, Item::GetBagSlot(), Object::GetGUID(), Item::GetPaidExtendedCost(), Item::GetPaidMoney(), Item::GetRefundRecipient(), GetSession(), Item::GetSlot(), Object::HasFlag(), Item::IsRefundExpired(), ITEM_FIELD_FLAG_REFUNDABLE, ITEM_FIELD_FLAGS, LOG_DEBUG, MAX_ITEM_EXTENDED_COST_REQUIREMENTS, ModifyArenaPoints(), ModifyHonorPoints(), ModifyMoney(), NULL_BAG, NULL_SLOT, ItemExtendedCostEntry::reqarenapoints, ItemExtendedCostEntry::reqhonorpoints, ItemExtendedCostEntry::reqitem, ItemExtendedCostEntry::reqitemcount, SaveInventoryAndGoldToDB(), SendNewItem(), WorldSession::SendPacket(), Item::SetNotRefundable(), sItemExtendedCostStore, SMSG_ITEM_REFUND_RESULT, and StoreNewItem().

Referenced by WorldSession::HandleItemRefund().

◆ Regenerate()

void Player::Regenerate ( Powers  power)
Todo:
: possible use of miscvalueb instead of amount
1823{
1824 uint32 maxValue = GetMaxPower(power);
1825 if (!maxValue)
1826 return;
1827
1828 //If .cheat power is on always have the max power
1830 {
1831 if (m_regenTimerCount >= 2000)
1832 {
1833 //Set the value to 0 first then set it to max to force resend of packet as for range clients keeps removing rage
1834 if (power == POWER_RAGE || power == POWER_RUNIC_POWER)
1835 {
1836 UpdateUInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power, 0);
1837 }
1838
1839 SetPower(power, maxValue);
1840 return;
1841 }
1842 }
1843
1844 uint32 curValue = GetPower(power);
1845
1848 return;
1849
1850 float addvalue = 0.0f;
1851
1852 switch (power)
1853 {
1854 case POWER_MANA:
1855 {
1856 bool recentCast = IsUnderLastManaUseEffect();
1857 float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA);
1858
1859 if (sWorld->getBoolConfig(CONFIG_LOW_LEVEL_REGEN_BOOST) && GetLevel() < 15)
1860 ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA) * (2.066f - (GetLevel() * 0.066f));
1861
1862 if (recentCast) // Trinity Updates Mana in intervals of 2s, which is correct
1863 addvalue += GetFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER) * ManaIncreaseRate * 0.001f * m_regenTimer;
1864 else
1865 addvalue += GetFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER) * ManaIncreaseRate * 0.001f * m_regenTimer;
1866 }
1867 break;
1868 case POWER_RAGE: // Regenerate rage
1869 {
1871 {
1872 float RageDecreaseRate = sWorld->getRate(RATE_POWER_RAGE_LOSS);
1873 addvalue += -20 * RageDecreaseRate; // 2 rage by tick (= 2 seconds => 1 rage/sec)
1874 }
1875 }
1876 break;
1877 case POWER_ENERGY: // Regenerate energy (rogue)
1878 addvalue += 0.01f * m_regenTimer * sWorld->getRate(RATE_POWER_ENERGY);
1879 break;
1880 case POWER_RUNIC_POWER:
1881 {
1883 {
1884 float RunicPowerDecreaseRate = sWorld->getRate(RATE_POWER_RUNICPOWER_LOSS);
1885 addvalue += -30 * RunicPowerDecreaseRate; // 3 RunicPower by tick
1886 }
1887 }
1888 break;
1889 case POWER_RUNE:
1890 case POWER_FOCUS:
1891 case POWER_HAPPINESS:
1892 break;
1893 case POWER_HEALTH:
1894 return;
1895 default:
1896 break;
1897 }
1898
1899 // Mana regen calculated in Player::UpdateManaRegen()
1900 if (power != POWER_MANA)
1901 {
1903 for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
1904 if (Powers((*i)->GetMiscValue()) == power)
1905 AddPct(addvalue, (*i)->GetAmount());
1906
1907 // Butchery requires combat for this effect
1908 if (power != POWER_RUNIC_POWER || IsInCombat())
1910 }
1911
1912 if (addvalue < 0.0f)
1913 {
1914 if (curValue == 0)
1915 return;
1916 }
1917 else if (addvalue > 0.0f)
1918 {
1919 if (curValue == maxValue)
1920 return;
1921 }
1922 else
1923 return;
1924
1925 addvalue += m_powerFraction[power];
1926 uint32 integerValue = uint32(std::fabs(addvalue));
1927
1928 bool forcedUpdate = false;
1929 if (addvalue < 0.0f)
1930 {
1931 if (curValue > integerValue)
1932 {
1933 curValue -= integerValue;
1934 m_powerFraction[power] = addvalue + integerValue;
1935 }
1936 else
1937 {
1938 curValue = 0;
1939 m_powerFraction[power] = 0;
1940 forcedUpdate = true;
1941 }
1942 }
1943 else
1944 {
1945 curValue += integerValue;
1946
1947 if (curValue >= maxValue)
1948 {
1949 curValue = maxValue;
1950 m_powerFraction[power] = 0;
1951 forcedUpdate = true;
1952 }
1953 else
1954 {
1955 m_powerFraction[power] = addvalue - integerValue;
1956 }
1957 }
1958
1959 if (m_regenTimerCount >= 2000 || forcedUpdate)
1960 {
1961 SetPower(power, curValue, true, true);
1962 }
1963 else
1964 {
1965 UpdateUInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power, curValue);
1966 }
1967}
@ UNIT_FIELD_POWER1
Definition: UpdateFields.h:97
@ UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER
Definition: UpdateFields.h:113
@ UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER
Definition: UpdateFields.h:112
@ CHEAT_POWER
Definition: Player.h:994
@ SPELL_AURA_INTERRUPT_REGEN
Definition: SpellAuraDefines.h:157
@ SPELL_AURA_MOD_POWER_REGEN
Definition: SpellAuraDefines.h:148
@ SPELL_AURA_PREVENT_REGENERATE_POWER
Definition: SpellAuraDefines.h:357
@ CONFIG_LOW_LEVEL_REGEN_BOOST
Definition: IWorld.h:182
@ RATE_POWER_RAGE_LOSS
Definition: IWorld.h:430
@ RATE_POWER_RUNICPOWER_LOSS
Definition: IWorld.h:432
@ RATE_POWER_ENERGY
Definition: IWorld.h:434
@ RATE_POWER_MANA
Definition: IWorld.h:428
@ POWER_HEALTH
Definition: SharedDefines.h:278
void UpdateUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:663
bool IsUnderLastManaUseEffect() const
Definition: Unit.cpp:17508
bool HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const
Definition: Unit.cpp:5667

References AddPct(), CHEAT_POWER, CONFIG_LOW_LEVEL_REGEN_BOOST, Unit::GetAuraEffectsByType(), GetCommandStatus(), Object::GetFloatValue(), Unit::GetLevel(), Unit::GetMaxPower(), Unit::GetPower(), Unit::GetTotalAuraModifierByMiscValue(), Unit::HasAuraType(), Unit::HasAuraTypeWithMiscvalue(), IN_MILLISECONDS, Unit::IsInCombat(), Unit::IsUnderLastManaUseEffect(), m_powerFraction, Unit::m_regenTimer, m_regenTimerCount, POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_HEALTH, POWER_MANA, POWER_RAGE, POWER_RUNE, POWER_RUNIC_POWER, RATE_POWER_ENERGY, RATE_POWER_MANA, RATE_POWER_RAGE_LOSS, RATE_POWER_RUNICPOWER_LOSS, Unit::SetPower(), SPELL_AURA_INTERRUPT_REGEN, SPELL_AURA_MOD_POWER_REGEN, SPELL_AURA_MOD_POWER_REGEN_PERCENT, SPELL_AURA_PREVENT_REGENERATE_POWER, sWorld, UNIT_FIELD_POWER1, UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, and Object::UpdateUInt32Value().

Referenced by RegenerateAll().

◆ RegenerateAll()

void Player::RegenerateAll ( )
1740{
1741 //if (m_regenTimer <= 500)
1742 // return;
1743
1746
1748
1750
1751 // Runes act as cooldowns, and they don't need to send any data
1753 for (uint8 i = 0; i < MAX_RUNES; ++i)
1754 {
1755 // xinef: implement grace
1756 if (int32 cd = GetRuneCooldown(i))
1757 {
1758 SetRuneCooldown(i, (cd > m_regenTimer) ? cd - m_regenTimer : 0);
1759 // start grace counter, player must be in combat and rune has to go off cooldown
1760 if (IsInCombat() && cd <= m_regenTimer)
1761 SetGracePeriod(i, m_regenTimer - cd + 1); // added 1 because m_regenTimer-cd can be equal 0
1762 }
1763 // xinef: if grace is started, increase it but no more than cap
1764 else if (uint32 grace = GetGracePeriod(i))
1765 {
1766 if (grace < RUNE_GRACE_PERIOD)
1767 SetGracePeriod(i, std::min<uint32>(grace + m_regenTimer, RUNE_GRACE_PERIOD));
1768 }
1769 }
1770
1771 if (m_regenTimerCount >= 2000)
1772 {
1773 // Not in combat or they have regeneration
1777 {
1779 }
1780
1784
1785 m_regenTimerCount -= 2000;
1786 }
1787
1788 m_regenTimer = 0;
1789
1790 // Handles the emotes for drinking and eating.
1791 // According to sniffs there is a background timer going on that repeats independed from the time window where the aura applies.
1792 // That's why we dont need to reset the timer on apply. In sniffs I have seen that the first call for the spell visual is totally random, then after
1793 // 5 seconds over and over again which confirms my theory that we have a independed timer.
1794 if (m_foodEmoteTimerCount >= 5000)
1795 {
1796 std::vector<AuraEffect*> auraList;
1799
1800 auraList.reserve(ModRegenAuras.size() + ModPowerRegenAuras.size());
1801 auraList.insert(auraList.end(), ModRegenAuras.begin(), ModRegenAuras.end());
1802 auraList.insert(auraList.end(), ModPowerRegenAuras.begin(), ModPowerRegenAuras.end());
1803
1804 for (auto itr = auraList.begin(); itr != auraList.end(); ++itr)
1805 {
1806 // Food emote comes above drinking emote if we have to decide (mage regen food for example)
1807 if ((*itr)->GetBase()->HasEffectType(SPELL_AURA_MOD_REGEN) && (*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
1808 {
1810 break;
1811 }
1812 else if ((*itr)->GetBase()->HasEffectType(SPELL_AURA_MOD_POWER_REGEN) && (*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
1813 {
1815 break;
1816 }
1817 }
1818 m_foodEmoteTimerCount -= 5000;
1819 }
1820}
@ RUNE_GRACE_PERIOD
Definition: Player.h:404
@ SPELL_AURA_MOD_REGEN_DURING_COMBAT
Definition: SpellAuraDefines.h:179
@ SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT
Definition: SpellAuraDefines.h:224
@ SPELL_AURA_MOD_REGEN
Definition: SpellAuraDefines.h:147
@ AURA_INTERRUPT_FLAG_NOT_SEATED
Definition: SpellDefines.h:62
@ SPELL_VISUAL_KIT_DRINK
Definition: SharedDefines.h:350
@ SPELL_VISUAL_KIT_FOOD
Definition: SharedDefines.h:349
void Regenerate(Powers power)
Definition: Player.cpp:1822
void RegenerateHealth()
Definition: Player.cpp:1969
bool IsPolymorphed() const
Definition: Unit.cpp:17009
void SendPlaySpellVisual(uint32 id)
Definition: Unit.cpp:19175

References AURA_INTERRUPT_FLAG_NOT_SEATED, CLASS_DEATH_KNIGHT, Unit::GetAuraEffectsByType(), Unit::getClass(), GetGracePeriod(), GetRuneCooldown(), Unit::HasAuraType(), Unit::IsInCombat(), Unit::IsPolymorphed(), m_baseHealthRegen, m_foodEmoteTimerCount, Unit::m_regenTimer, m_regenTimerCount, MAX_RUNES, POWER_ENERGY, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, Regenerate(), RegenerateHealth(), RUNE_GRACE_PERIOD, Unit::SendPlaySpellVisual(), SetGracePeriod(), SetRuneCooldown(), SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT, SPELL_AURA_MOD_POWER_REGEN, SPELL_AURA_MOD_REGEN, SPELL_AURA_MOD_REGEN_DURING_COMBAT, SPELL_VISUAL_KIT_DRINK, and SPELL_VISUAL_KIT_FOOD.

Referenced by Update().

◆ RegenerateHealth()

void Player::RegenerateHealth ( )
1970{
1971 uint32 curValue = GetHealth();
1972 uint32 maxValue = GetMaxHealth();
1973
1974 if (curValue >= maxValue)
1975 return;
1976
1977 float HealthIncreaseRate = sWorld->getRate(RATE_HEALTH);
1978
1979 if (sWorld->getBoolConfig(CONFIG_LOW_LEVEL_REGEN_BOOST) && GetLevel() < 15)
1980 HealthIncreaseRate = sWorld->getRate(RATE_HEALTH) * (2.066f - (GetLevel() * 0.066f));
1981
1982 float addvalue = 0.0f;
1983
1984 // polymorphed case
1985 if (IsPolymorphed())
1986 addvalue = (float)GetMaxHealth() / 3;
1987 // normal regen case (maybe partly in combat case)
1989 {
1990 addvalue = OCTRegenHPPerSpirit() * HealthIncreaseRate;
1991
1992 if (!IsStandState())
1993 {
1994 addvalue *= 1.33f;
1995 }
1996
1998 for (AuraEffectList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i)
1999 {
2000 AddPct(addvalue, (*i)->GetAmount());
2001 }
2002
2003 if (!IsInCombat())
2004 {
2006 }
2008 {
2010 }
2011 }
2012
2013 // always regeneration bonus (including combat)
2015 addvalue += m_baseHealthRegen / 2.5f;
2016
2017 if (addvalue < 0)
2018 addvalue = 0;
2019
2020 ModifyHealth(int32(addvalue));
2021}
T ApplyPct(T &base, U pct)
Definition: Util.h:73
@ SPELL_AURA_MOD_HEALTH_REGEN_PERCENT
Definition: SpellAuraDefines.h:151
@ RATE_HEALTH
Definition: IWorld.h:427
float OCTRegenHPPerSpirit()
Definition: Player.cpp:5132
int32 ModifyHealth(int32 val)
Definition: Unit.cpp:14079
bool IsStandState() const
Definition: Unit.cpp:16988

References AddPct(), ApplyPct(), CONFIG_LOW_LEVEL_REGEN_BOOST, Unit::GetAuraEffectsByType(), Unit::GetHealth(), Unit::GetLevel(), Unit::GetMaxHealth(), Unit::GetTotalAuraModifier(), Unit::HasAuraType(), IN_MILLISECONDS, Unit::IsInCombat(), Unit::IsPolymorphed(), Unit::IsStandState(), m_baseHealthRegen, Unit::ModifyHealth(), OCTRegenHPPerSpirit(), RATE_HEALTH, SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT, SPELL_AURA_MOD_HEALTH_REGEN_PERCENT, SPELL_AURA_MOD_REGEN, SPELL_AURA_MOD_REGEN_DURING_COMBAT, and sWorld.

Referenced by RegenerateAll().

◆ removeActionButton()

void Player::removeActionButton ( uint8  button)
5555{
5556 ActionButtonList::iterator buttonItr = m_actionButtons.find(button);
5557 if (buttonItr == m_actionButtons.end() || buttonItr->second.uState == ACTIONBUTTON_DELETED)
5558 return;
5559
5560 if (buttonItr->second.uState == ACTIONBUTTON_NEW)
5561 m_actionButtons.erase(buttonItr); // new and not saved
5562 else
5563 buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save
5564
5565 LOG_DEBUG("entities.player", "Action Button {} Removed from Player {}", button, GetGUID().ToString());
5566}

References ACTIONBUTTON_DELETED, ACTIONBUTTON_NEW, Object::GetGUID(), LOG_DEBUG, m_actionButtons, and Position::ToString().

Referenced by WorldSession::HandleSetActionButtonOpcode().

◆ RemoveActiveQuest()

void Player::RemoveActiveQuest ( uint32  questId,
bool  update = true 
)
1482{
1483 QuestStatusMap::iterator itr = m_QuestStatus.find(questId);
1484 if (itr != m_QuestStatus.end())
1485 {
1486 m_QuestStatus.erase(itr);
1487 m_QuestStatusSave[questId] = false;
1488 }
1489
1490 if (update)
1491 SendQuestUpdate(questId);
1492
1493 // Xinef: area auras may change on quest remove!
1497}

References ADDITIONAL_SAVING_QUEST_STATUS, AdditionalSavingAddMask(), WorldObject::GetAreaId(), WorldObject::GetZoneId(), m_QuestStatus, m_QuestStatusSave, SendQuestUpdate(), UpdateAreaDependentAuras(), and UpdateZoneDependentAuras().

Referenced by Spell::EffectQuestClear(), WorldSession::HandleQuestLogRemoveQuest(), and RewardQuest().

◆ RemoveAllSpellCooldown()

void Player::RemoveAllSpellCooldown ( )
3527{
3529 if (!m_spellCooldowns.empty())
3530 {
3531 for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr)
3532 if (itr->second.end < infTime)
3533 SendClearCooldown(itr->first, this);
3534
3535 m_spellCooldowns.clear();
3536 }
3537}
void SendClearCooldown(uint32 spell_id, Unit *target)
Definition: Player.cpp:14568

References GameTime::GetGameTimeMS(), infinityCooldownDelayCheck, m_spellCooldowns, and SendClearCooldown().

Referenced by misc_commandscript::HandleCooldownCommand().

◆ RemoveAmmo()

◆ RemoveArenaEnchantments()

void Player::RemoveArenaEnchantments ( EnchantmentSlot  slot)
4248{
4249 // remove enchantments from equipped items first to clean up the m_enchantDuration list
4250 for (EnchantDurationList::iterator itr = m_enchantDuration.begin(), next; itr != m_enchantDuration.end(); itr = next)
4251 {
4252 next = itr;
4253 if (itr->slot == slot)
4254 {
4255 if (itr->item && itr->item->GetEnchantmentId(slot))
4256 {
4257 // Poisons and DK runes are enchants which are allowed on arenas
4258 if (sSpellMgr->IsArenaAllowedEnchancment(itr->item->GetEnchantmentId(slot)))
4259 {
4260 ++next;
4261 continue;
4262 }
4263 // remove from stats
4264 ApplyEnchantment(itr->item, slot, false, false);
4265 // remove visual
4266 itr->item->ClearEnchantment(slot);
4267 }
4268 // remove from update list
4269 next = m_enchantDuration.erase(itr);
4270 }
4271 else
4272 ++next;
4273 }
4274
4275 // Xinef: check arena allowed enchantments :)
4276 // remove enchants from inventory items
4277 // NOTE: no need to remove these from stats, since these aren't equipped
4278 // in inventory
4280 if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
4281 if (uint32 enchId = pItem->GetEnchantmentId(slot))
4282 if (!sSpellMgr->IsArenaAllowedEnchancment(enchId))
4283 pItem->ClearEnchantment(slot);
4284
4285 // in inventory bags
4287 if (Bag* pBag = GetBagByPos(i))
4288 for (uint32 j = 0; j < pBag->GetBagSize(); j++)
4289 if (Item* pItem = pBag->GetItemByPos(j))
4290 if (uint32 enchId = pItem->GetEnchantmentId(slot))
4291 if (!sSpellMgr->IsArenaAllowedEnchancment(enchId))
4292 pItem->ClearEnchantment(slot);
4293}

References ApplyEnchantment(), GetBagByPos(), GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, INVENTORY_SLOT_ITEM_START, m_enchantDuration, and sSpellMgr.

Referenced by Battleground::AddPlayer().

◆ RemoveArenaSpellCooldowns()

void Player::RemoveArenaSpellCooldowns ( bool  removeActivePetCooldowns = false)
3492{
3493 // remove cooldowns on spells that have < 10 min CD
3495 SpellCooldowns::iterator itr, next;
3496 for (itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); itr = next)
3497 {
3498 next = itr;
3499 ++next;
3500 SpellInfo const* spellInfo = sSpellMgr->CheckSpellInfo(itr->first);
3501 if (!spellInfo)
3502 {
3503 continue;
3504 }
3505
3507 RemoveSpellCooldown(itr->first, true);
3508 else if (spellInfo->RecoveryTime < 10 * MINUTE * IN_MILLISECONDS && spellInfo->CategoryRecoveryTime < 10 * MINUTE * IN_MILLISECONDS && itr->second.end < infTime// xinef: dont remove active cooldowns - bugz
3509 && itr->second.maxduration < 10 * MINUTE * IN_MILLISECONDS) // xinef: dont clear cooldowns that have maxduration > 10 minutes (eg item cooldowns with no spell.dbc cooldown info)
3510 RemoveSpellCooldown(itr->first, true);
3511 }
3512
3513 // pet cooldowns
3514 if (removeActivePetCooldowns)
3515 if (Pet* pet = GetPet())
3516 {
3517 // notify player
3518 for (CreatureSpellCooldowns::const_iterator itr2 = pet->m_CreatureSpellCooldowns.begin(); itr2 != pet->m_CreatureSpellCooldowns.end(); ++itr2)
3519 SendClearCooldown(itr2->first, pet);
3520
3521 // actually clear cooldowns
3522 pet->m_CreatureSpellCooldowns.clear();
3523 }
3524}
@ SPELL_ATTR4_IGNORE_DEFAULT_ARENA_RESTRICTIONS
Definition: SharedDefines.h:547
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition: Player.cpp:3475

References SpellInfo::CategoryRecoveryTime, GameTime::GetGameTimeMS(), GetPet(), SpellInfo::HasAttribute(), IN_MILLISECONDS, infinityCooldownDelayCheck, m_spellCooldowns, MINUTE, SpellInfo::RecoveryTime, RemoveSpellCooldown(), SendClearCooldown(), SPELL_ATTR4_IGNORE_DEFAULT_ARENA_RESTRICTIONS, and sSpellMgr.

Referenced by TeleportTo().

◆ RemoveAtLoginFlag()

void Player::RemoveAtLoginFlag ( AtLoginFlags  flags,
bool  persist = false 
)
14554{
14555 m_atLoginFlags &= ~flags;
14556
14557 if (persist)
14558 {
14560
14561 stmt->SetData(0, uint16(flags));
14562 stmt->SetData(1, GetGUID().GetCounter());
14563
14564 CharacterDatabase.Execute(stmt);
14565 }
14566}
@ CHAR_UPD_REM_AT_LOGIN_FLAG
Definition: CharacterDatabase.h:275

References CHAR_UPD_REM_AT_LOGIN_FLAG, CharacterDatabase, Object::GetGUID(), m_atLoginFlags, and PreparedStatementBase::SetData().

Referenced by WorldSession::HandlePlayerLoginFromDB(), LoadCorpse(), resetSpells(), Pet::resetTalents(), resetTalents(), and Pet::resetTalentsForAllPetsOf().

◆ RemoveBattlegroundQueueId()

void Player::RemoveBattlegroundQueueId ( BattlegroundQueueTypeId  val)
12190{
12191 for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
12192 {
12193 if (_BgBattlegroundQueueID[i].bgQueueTypeId == val)
12194 {
12196 _BgBattlegroundQueueID[i].invitedToInstance = 0;
12197 return;
12198 }
12199 }
12200}

References _BgBattlegroundQueueID, BATTLEGROUND_QUEUE_NONE, and PLAYER_MAX_BATTLEGROUND_QUEUES.

Referenced by BGQueueRemoveEvent::Execute(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::LogoutPlayer(), and Battleground::RemovePlayerAtLeave().

◆ RemoveCategoryCooldown()

void Player::RemoveCategoryCooldown ( uint32  cat)
3484{
3485 SpellCategoryStore::const_iterator i_scstore = sSpellsByCategoryStore.find(cat);
3486 if (i_scstore != sSpellsByCategoryStore.end())
3487 for (SpellCategorySet::const_iterator i_scset = i_scstore->second.begin(); i_scset != i_scstore->second.end(); ++i_scset)
3488 RemoveSpellCooldown(i_scset->second, true);
3489}

References RemoveSpellCooldown(), and sSpellsByCategoryStore.

Referenced by spell_hun_readiness::HandleDummy(), spell_item_refocus::HandleDummy(), and Unit::HandleProcTriggerSpell().

◆ RemoveCorpse()

void Player::RemoveCorpse ( )
4587{
4588 if (GetCorpse())
4589 {
4591 }
4592
4593 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
4594 Corpse::DeleteFromDB(GetGUID(), trans);
4595 CharacterDatabase.CommitTransaction(trans);
4596
4598}
void RemoveFromWorld() override
Definition: Corpse.cpp:53

References _corpseLocation, CharacterDatabase, Corpse::DeleteFromDB(), GetCorpse(), Object::GetGUID(), Corpse::RemoveFromWorld(), and WorldLocation::WorldRelocate().

Referenced by WorldSession::HandleMoveWorldportAck().

◆ RemovedInsignia()

void Player::RemovedInsignia ( Player looterPlr)
7648{
7649 // Xinef: If player is not in battleground and not in wintergrasp
7651 return;
7652
7653 // If not released spirit, do it !
7654 if (m_deathTimer > 0)
7655 {
7656 m_deathTimer = 0;
7659 }
7660
7662
7663 // We have to convert player corpse to bones, not to be able to resurrect there
7664 // SpawnCorpseBones isn't handy, 'cos it saves player while he in BG
7665 Corpse* bones = GetMap()->ConvertCorpseToBones(GetGUID(), true);
7666 if (!bones)
7667 return;
7668
7669 // Now we must make bones lootable, and send player loot
7671
7672 // We store the level of our player in the gold field
7673 // We retrieve this information at Player::SendLoot()
7674 bones->loot.gold = GetLevel();
7675 bones->lootRecipient = looterPlr;
7676 looterPlr->SendLoot(bones->GetGUID(), LOOT_INSIGNIA);
7677}
@ AREA_WINTERGRASP
Definition: BattlefieldWG.h:125
@ CORPSE_FIELD_DYNAMIC_FLAGS
Definition: UpdateFields.h:428
@ LOOT_INSIGNIA
Definition: LootMgr.h:91
@ CORPSE_DYNFLAG_LOOTABLE
Definition: SharedDefines.h:3133
Player * lootRecipient
Definition: Corpse.h:78
Loot loot
Definition: Corpse.h:77
void SendLoot(ObjectGuid guid, LootType loot_type)
Definition: Player.cpp:7686
void BuildPlayerRepop()
Definition: Player.cpp:4339
uint32 gold
Definition: LootMgr.h:322
Corpse * ConvertCorpseToBones(ObjectGuid const ownerGuid, bool insignia=false)
Definition: Map.cpp:3621

References _corpseLocation, AREA_WINTERGRASP, BuildPlayerRepop(), Map::ConvertCorpseToBones(), CORPSE_DYNFLAG_LOOTABLE, CORPSE_FIELD_DYNAMIC_FLAGS, GetBattlegroundId(), Object::GetGUID(), Unit::GetLevel(), WorldObject::GetMap(), WorldObject::GetZoneId(), Loot::gold, Corpse::loot, LOOT_INSIGNIA, Corpse::lootRecipient, m_deathTimer, RepopAtGraveyard(), SendLoot(), Object::SetFlag(), and WorldLocation::WorldRelocate().

Referenced by Spell::EffectSkinPlayerCorpse().

◆ RemoveEnchantmentDurations()

void Player::RemoveEnchantmentDurations ( Item item)
4222{
4223 for (EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end();)
4224 {
4225 if (itr->item == item)
4226 {
4227 // save duration in item
4228 item->SetEnchantmentDuration(EnchantmentSlot(itr->slot), itr->leftduration, this);
4229 itr = m_enchantDuration.erase(itr);
4230 }
4231 else
4232 ++itr;
4233 }
4234}
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player *owner)
Definition: Item.cpp:942

References m_enchantDuration, and Item::SetEnchantmentDuration().

Referenced by _StoreItem(), DestroyItem(), EquipItem(), and RemoveItem().

◆ RemoveEnchantmentDurationsReferences()

void Player::RemoveEnchantmentDurationsReferences ( Item item)
4237{
4238 for (EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end();)
4239 {
4240 if (itr->item == item)
4241 itr = m_enchantDuration.erase(itr);
4242 else
4243 ++itr;
4244 }
4245}

References m_enchantDuration.

Referenced by _SaveInventory().

◆ RemoveFromBattlegroundOrBattlefieldRaid()

void Player::RemoveFromBattlegroundOrBattlefieldRaid ( )
13017{
13018 //remove existing reference
13019 m_group.unlink();
13020 if (Group* group = GetOriginalGroup())
13021 {
13022 m_group.link(group, this);
13024 }
13025 SetOriginalGroup(nullptr);
13026}
void unlink()
Definition: Reference.h:62
void link(TO *toObj, FROM *fromObj)
Definition: Reference.h:45
void SetOriginalGroup(Group *group, int8 subgroup=-1)
Definition: Player.cpp:13028
Group * GetOriginalGroup()
Definition: Player.h:2446
uint8 GetOriginalSubGroup() const
Definition: Player.h:2448
void setSubGroup(uint8 pSubGroup)
Definition: GroupReference.h:39

References GetOriginalGroup(), GetOriginalSubGroup(), Reference< TO, FROM >::link(), m_group, SetOriginalGroup(), GroupReference::setSubGroup(), and Reference< TO, FROM >::unlink().

Referenced by Group::Disband(), and Group::RemoveMember().

◆ RemoveFromGroup() [1/2]

void Player::RemoveFromGroup ( Group group,
ObjectGuid  guid,
RemoveMethod  method = GROUP_REMOVEMETHOD_DEFAULT,
ObjectGuid  kicker = ObjectGuid::Empty,
const char *  reason = nullptr 
)
static
2329{
2330 if (group)
2331 {
2332 group->RemoveMember(guid, method, kicker, reason);
2333 group = nullptr;
2334 }
2335}
bool RemoveMember(ObjectGuid guid, const RemoveMethod &method=GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker=ObjectGuid::Empty, const char *reason=nullptr)
Definition: Group.cpp:546

References Group::RemoveMember().

Referenced by DeleteFromDB(), WorldSession::HandleGroupDisbandOpcode(), WorldSession::HandleGroupUninviteGuidOpcode(), WorldSession::HandleGroupUninviteOpcode(), WorldSession::LogoutPlayer(), and lfg::LFGMgr::UpdateBoot().

◆ RemoveFromGroup() [2/2]

void Player::RemoveFromGroup ( RemoveMethod  method = GROUP_REMOVEMETHOD_DEFAULT)
inline
1852{ RemoveFromGroup(GetGroup(), GetGUID(), method); }

References GetGroup(), Object::GetGUID(), and RemoveFromGroup().

Referenced by RemoveFromGroup().

◆ RemoveFromWhisperWhiteList()

void Player::RemoveFromWhisperWhiteList ( ObjectGuid  guid)
inline
2524{ WhisperList.remove(guid); }

References WhisperList.

Referenced by message_commandscript::HandleWhispersCommand().

◆ RemoveFromWorld()

void Player::RemoveFromWorld ( )
overridevirtual
  • Release charmed creatures, unsummon totems and remove pets/guardians
  • Do not add/remove the player from the object storage
  • It will crash when updating the ObjectAccessor
  • The player should only be removed when logging out

Reimplemented from WorldObject.

1698{
1699 // cleanup
1700 if (IsInWorld())
1701 {
1706 ClearComboPoints(); // pussywizard: crashfix
1707 ClearComboPointHolders(); // pussywizard: crashfix
1708 if (ObjectGuid lguid = GetLootGUID()) // pussywizard: crashfix
1709 m_session->DoLootRelease(lguid);
1710 sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
1711 sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
1712 }
1713
1714 // Remove items from world before self - player must be found in Item::RemoveFromObjectUpdate
1715 for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
1716 {
1717 if (m_items[i])
1719 }
1720
1721 for (ItemMap::iterator iter = mMitems.begin(); iter != mMitems.end(); ++iter)
1722 iter->second->RemoveFromWorld();
1723
1728
1729 if (m_uint32Values)
1730 {
1731 if (WorldObject* viewpoint = GetViewpoint())
1732 {
1733 LOG_FATAL("entities.player", "Player {} has viewpoint {} {} when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId());
1734 SetViewpoint(viewpoint, false);
1735 }
1736 }
1737}
#define LOG_FATAL(filterType__,...)
Definition: Log.h:153
void SetViewpoint(WorldObject *target, bool apply)
Definition: Player.cpp:13085
void UnsummonPetTemporaryIfAny()
Definition: Player.cpp:14133
WorldObject * GetViewpoint() const
Definition: Player.cpp:13128
void ClearComboPointHolders()
Definition: Unit.cpp:17184
void RemoveFromWorld() override
Definition: Unit.cpp:15682
void DoLootRelease(ObjectGuid lguid)
Definition: LootHandler.cpp:270

References Unit::ClearComboPointHolders(), Unit::ClearComboPoints(), WorldSession::DoLootRelease(), GetLootGUID(), WorldObject::GetName(), GetViewpoint(), Object::IsInWorld(), LOG_FATAL, m_items, m_session, Object::m_uint32Values, m_zoneUpdateId, mMitems, PLAYER_SLOT_END, PLAYER_SLOT_START, Object::RemoveFromWorld(), Unit::RemoveFromWorld(), sBattlefieldMgr, SetViewpoint(), sOutdoorPvPMgr, StopCastingBindSight(), StopCastingCharm(), and UnsummonPetTemporaryIfAny().

Referenced by Map::RemovePlayerFromMap().

◆ RemoveItem()

void Player::RemoveItem ( uint8  bag,
uint8  slot,
bool  update,
bool  swap = false 
)
2922{
2923 // note: removeitem does not actually change the item
2924 // it only takes the item out of storage temporarily
2925 // note2: if removeitem is to be used for delinking
2926 // the item must be removed from the player's updatequeue
2927
2928 Item* pItem = GetItemByPos(bag, slot);
2929 if (pItem)
2930 {
2931 LOG_DEBUG("entities.player.items", "STORAGE: RemoveItem bag = {}, slot = {}, item = {}", bag, slot, pItem->GetEntry());
2932
2934 RemoveItemDurations(pItem);
2935 RemoveTradeableItem(pItem);
2936
2937 if (bag == INVENTORY_SLOT_BAG_0)
2938 {
2939 if (slot < INVENTORY_SLOT_BAG_END)
2940 {
2941 ItemTemplate const* pProto = pItem->GetTemplate();
2942 // item set bonuses applied only at equip and removed at unequip, and still active for broken items
2943
2944 if (pProto && pProto->ItemSet)
2945 RemoveItemsSetItem(this, pProto);
2946
2947 _ApplyItemMods(pItem, slot, false);
2948 }
2949
2950 m_items[slot] = nullptr;
2951
2952 // remove item dependent auras and casts (only weapon and armor slots)
2953 if (slot < INVENTORY_SLOT_BAG_END && slot < EQUIPMENT_SLOT_END)
2954 {
2955 // Xinef: Ensure that this function is called for places with swap=true
2956 if (!swap)
2957 {
2959 }
2960
2961 // remove held enchantments, update expertise
2962 if (slot == EQUIPMENT_SLOT_MAINHAND)
2963 {
2965 }
2966 else if (slot == EQUIPMENT_SLOT_OFFHAND)
2967 {
2969 }
2970
2971 // update armor penetration - passive auras may need it
2972 switch (slot)
2973 {
2978 default:
2979 break;
2980 }
2981 }
2982
2984
2985 if (slot < EQUIPMENT_SLOT_END)
2986 SetVisibleItemSlot(slot, nullptr);
2987 }
2988 else if (Bag* pBag = GetBagByPos(bag))
2989 pBag->RemoveItem(slot, update);
2990
2992 // pItem->SetGuidValue(ITEM_FIELD_OWNER, ObjectGuid::Empty); not clear owner at remove (it will be set at store). This used in mail and auction code
2993 pItem->SetSlot(NULL_SLOT);
2994 if (IsInWorld() && update)
2995 pItem->SendUpdateToPlayer(this);
2996 }
2997}

References _ApplyItemMods(), BASE_ATTACK, CR_ARMOR_PENETRATION, ObjectGuid::Empty, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, GetBagByPos(), Object::GetEntry(), GetItemByPos(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, Object::IsInWorld(), ITEM_FIELD_CONTAINED, ItemTemplate::ItemSet, LOG_DEBUG, m_items, NULL_SLOT, OFF_ATTACK, PLAYER_FIELD_INV_SLOT_HEAD, RecalculateRating(), RemoveEnchantmentDurations(), RemoveItemDependentAurasAndCasts(), RemoveItemDurations(), RemoveItemsSetItem(), RemoveTradeableItem(), Object::SendUpdateToPlayer(), Object::SetGuidValue(), Item::SetSlot(), SetVisibleItemSlot(), and UpdateExpertise().

Referenced by AutoUnequipOffhandIfNeed(), Create(), WorldSession::HandleAutoBankItemOpcode(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleAutoStoreBagItemOpcode(), WorldSession::HandleAutoStoreBankItemOpcode(), WorldSession::HandleEquipmentSetUse(), WorldSession::HandleSellItemOpcode(), MoveItemFromInventory(), and SwapItem().

◆ RemoveItemDependentAurasAndCasts()

void Player::RemoveItemDependentAurasAndCasts ( Item pItem)
12494{
12495 for (AuraMap::iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end();)
12496 {
12497 Aura* aura = itr->second;
12498
12499 // skip passive (passive item dependent spells work in another way) and not self applied auras
12500 SpellInfo const* spellInfo = aura->GetSpellInfo();
12501 if (aura->IsPassive() || aura->GetCasterGUID() != GetGUID())
12502 {
12503 ++itr;
12504 continue;
12505 }
12506
12507 // skip if not item dependent or have alternative item
12508 if (HasItemFitToSpellRequirements(spellInfo, pItem))
12509 {
12510 ++itr;
12511 continue;
12512 }
12513
12514 // no alt item, remove aura, restart check
12515 RemoveOwnedAura(itr);
12516 }
12517
12518 // currently casted spells can be dependent from item
12519 for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
12520 if (Spell* spell = GetCurrentSpell(CurrentSpellTypes(i)))
12521 if (spell->getState() != SPELL_STATE_DELAYED && !HasItemFitToSpellRequirements(spell->m_spellInfo, pItem))
12523}
#define CURRENT_MAX_SPELL
Definition: Unit.h:997
CurrentSpellTypes
Definition: Unit.h:989
@ SPELL_STATE_DELAYED
Definition: Spell.h:228
bool HasItemFitToSpellRequirements(SpellInfo const *spellInfo, Item const *ignoreItem=nullptr) const
Definition: Player.cpp:12431

References CURRENT_MAX_SPELL, Aura::GetCasterGUID(), Unit::GetCurrentSpell(), Object::GetGUID(), Aura::GetSpellInfo(), HasItemFitToSpellRequirements(), Unit::InterruptSpell(), Aura::IsPassive(), Unit::m_ownedAuras, Unit::RemoveOwnedAura(), and SPELL_STATE_DELAYED.

Referenced by DestroyItem(), WorldSession::HandleAutoEquipItemOpcode(), RemoveItem(), and SwapItem().

◆ RemoveItemDurations()

void Player::RemoveItemDurations ( Item item)
12364{
12365 for (ItemDurationList::iterator itr = m_itemDuration.begin(); itr != m_itemDuration.end(); ++itr)
12366 {
12367 if (*itr == item)
12368 {
12369 m_itemDuration.erase(itr);
12370 break;
12371 }
12372 }
12373}

References m_itemDuration.

Referenced by _SaveInventory(), _StoreItem(), DestroyItem(), EquipItem(), and RemoveItem().

◆ RemoveItemFromBuyBackSlot()

void Player::RemoveItemFromBuyBackSlot ( uint32  slot,
bool  del 
)
4018{
4019 LOG_DEBUG("entities.player.items", "STORAGE: RemoveItemFromBuyBackSlot slot = {}", slot);
4020 if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END)
4021 {
4022 Item* pItem = m_items[slot];
4023 if (pItem)
4024 {
4025 pItem->RemoveFromWorld();
4026 if (del)
4027 pItem->SetState(ITEM_REMOVED, this);
4028 }
4029
4030 m_items[slot] = nullptr;
4031
4032 uint32 eslot = slot - BUYBACK_SLOT_START;
4036
4037 // if current backslot is filled set to now free slot
4039 m_currentBuybackSlot = slot;
4040 }
4041}

References BUYBACK_SLOT_END, BUYBACK_SLOT_START, ObjectGuid::Empty, ITEM_REMOVED, LOG_DEBUG, m_currentBuybackSlot, m_items, PLAYER_FIELD_BUYBACK_PRICE_1, PLAYER_FIELD_BUYBACK_TIMESTAMP_1, PLAYER_FIELD_VENDORBUYBACK_SLOT_1, Object::RemoveFromWorld(), Object::SetGuidValue(), Item::SetState(), and Object::SetUInt32Value().

Referenced by AddItemToBuyBackSlot(), and WorldSession::HandleBuybackItem().

◆ RemoveMail()

void Player::RemoveMail ( uint32  id)
2813{
2814 for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
2815 {
2816 if ((*itr)->messageID == id)
2817 {
2818 //do not delete item, because Player::removeMail() is called when returning mail to sender.
2819 m_mail.erase(itr);
2820 return;
2821 }
2822 }
2823}

References m_mail.

Referenced by WorldSession::HandleMailReturnToSender().

◆ RemoveMItem()

bool Player::RemoveMItem ( ObjectGuid::LowType  itemLowGuid)
inline
1653 {
1654 return !!mMitems.erase(itemLowGuid);
1655 }

References mMitems.

Referenced by WorldSession::HandleMailReturnToSender(), and WorldSession::HandleMailTakeItem().

◆ RemovePet()

void Player::RemovePet ( Pet pet,
PetSaveMode  mode,
bool  returnreagent = false 
)
8971{
8972 if (!pet)
8973 pet = GetPet();
8974
8975 if (pet)
8976 {
8977 // xinef: dont save dead pet as current, save him not in slot
8978 if (!pet->IsAlive() && mode == PET_SAVE_AS_CURRENT && pet->getPetType() == HUNTER_PET)
8979 {
8980 mode = PET_SAVE_NOT_IN_SLOT;
8982 }
8983
8984 LOG_DEBUG("entities.pet", "RemovePet {}, {}, {}", pet->GetEntry(), mode, returnreagent);
8985 if (pet->m_removed)
8986 return;
8987 }
8988
8989 if (returnreagent && (pet || (m_temporaryUnsummonedPetNumber && (!m_session || !m_session->PlayerLogout()))) && !InBattleground())
8990 {
8991 //returning of reagents only for players, so best done here
8993 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
8994
8995 if (spellInfo)
8996 {
8997 for (uint32 i = 0; i < MAX_SPELL_REAGENTS; ++i)
8998 {
8999 if (spellInfo->Reagent[i] > 0)
9000 {
9001 ItemPosCountVec dest; //for succubus, voidwalker, felhunter and felguard credit soulshard when despawn reason other than death (out of range, logout)
9002 InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, spellInfo->Reagent[i], spellInfo->ReagentCount[i]);
9003 if (msg == EQUIP_ERR_OK)
9004 {
9005 Item* item = StoreNewItem(dest, spellInfo->Reagent[i], true);
9006 if (IsInWorld())
9007 SendNewItem(item, spellInfo->ReagentCount[i], true, false);
9008 }
9009 }
9010 }
9011 }
9013 }
9014
9015 if (!pet)
9016 {
9017 if (mode == PET_SAVE_NOT_IN_SLOT && m_petStable && m_petStable->CurrentPet)
9018 {
9019 // Handle removing pet while it is in "temporarily unsummoned" state, for example on mount
9021 stmt->SetData(0, PET_SAVE_NOT_IN_SLOT);
9022 stmt->SetData(1, GetGUID().GetCounter());
9023 stmt->SetData(2, m_petStable->CurrentPet->PetNumber);
9024 CharacterDatabase.Execute(stmt);
9025
9026 m_petStable->UnslottedPets.push_back(std::move(*m_petStable->CurrentPet));
9027 m_petStable->CurrentPet.reset();
9028 }
9029
9030 return;
9031 }
9032 else
9033 {
9034 pet->CombatStop();
9035
9036 // only if current pet in slot
9037 pet->SavePetToDB(mode);
9038
9039 if (m_petStable->CurrentPet && m_petStable->CurrentPet->PetNumber == pet->GetCharmInfo()->GetPetNumber())
9040 {
9041 if (mode == PET_SAVE_NOT_IN_SLOT)
9042 {
9043 m_petStable->UnslottedPets.push_back(std::move(*m_petStable->CurrentPet));
9044 m_petStable->CurrentPet.reset();
9045 }
9046 else if (mode == PET_SAVE_AS_DELETED)
9047 m_petStable->CurrentPet.reset();
9048 // else if (stable slots) handled in opcode handlers due to required swaps
9049 // else (current pet) doesnt need to do anything
9050 }
9051
9052 SetMinion(pet, false);
9053
9054 pet->AddObjectToRemoveList();
9055 pet->m_removed = true;
9056
9057 if (pet->isControlled())
9058 {
9060 data << uint64(0);
9061 GetSession()->SendPacket(&data);
9062
9063 if (GetGroup())
9065 }
9066
9068 {
9071 }
9072 }
9073}
@ CHAR_UPD_CHAR_PET_SLOT_BY_ID
Definition: CharacterDatabase.h:480
@ UNIT_CREATED_BY_SPELL
Definition: UpdateFields.h:138
@ PET_SAVE_AS_DELETED
Definition: PetDefines.h:41
@ GROUP_UPDATE_PET
Definition: Group.h:120
#define MAX_SPELL_REAGENTS
Definition: DBCStructure.h:1637
void SendCommand_UInt32Value(T *o, ObjectGuid targetGUID, const char *prefix, uint32 t)
Definition: ArenaSpectator.h:62
void AddObjectToRemoveList()
Definition: Object.cpp:2140
PetType getPetType() const
Definition: Pet.h:51
bool isControlled() const
Definition: Pet.h:53
bool m_removed
Definition: Pet.h:141
void SetGroupUpdateFlag(uint32 flag)
Definition: Player.h:2437
uint32 GetPetNumber() const
Definition: Unit.h:1111
std::array< int32, MAX_SPELL_REAGENTS > Reagent
Definition: SpellInfo.h:371
std::array< uint32, MAX_SPELL_REAGENTS > ReagentCount
Definition: SpellInfo.h:372

References WorldObject::AddObjectToRemoveList(), CanStoreNewItem(), CHAR_UPD_CHAR_PET_SLOT_BY_ID, CharacterDatabase, Unit::CombatStop(), EQUIP_ERR_OK, CreatureTemplate::family, WorldObject::FindMap(), Unit::GetCharmInfo(), Creature::GetCreatureTemplate(), Object::GetEntry(), GetGroup(), Object::GetGUID(), GetPet(), CharmInfo::GetPetNumber(), Pet::getPetType(), GetSession(), Object::GetUInt32Value(), GROUP_UPDATE_PET, HUNTER_PET, InBattleground(), Unit::IsAlive(), Pet::isControlled(), Object::IsInWorld(), LOG_DEBUG, m_oldpetspell, m_petStable, Pet::m_removed, m_session, m_temporaryUnsummonedPetNumber, MAX_SPELL_REAGENTS, NeedSendSpectatorData(), NULL_BAG, NULL_SLOT, PET_SAVE_AS_CURRENT, PET_SAVE_AS_DELETED, PET_SAVE_NOT_IN_SLOT, WorldSession::PlayerLogout(), SpellInfo::Reagent, SpellInfo::ReagentCount, Pet::SavePetToDB(), ArenaSpectator::SendCommand_UInt32Value(), SendNewItem(), WorldSession::SendPacket(), PreparedStatementBase::SetData(), SetGroupUpdateFlag(), Unit::SetMinion(), SMSG_PET_SPELLS, sSpellMgr, StoreNewItem(), and UNIT_CREATED_BY_SPELL.

Referenced by Spell::_cast(), ActivateSpec(), Spell::EffectSummonPet(), WorldSession::HandlePetAbandon(), WorldSession::HandlePetActionHelper(), WorldSession::HandleRepopRequestOpcode(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), WorldSession::HandleUnstablePet(), Pet::LoadPetFromDB(), WorldSession::LogoutPlayer(), Pet::Remove(), resetTalents(), setDeathState(), SummonPet(), UnsummonPetTemporaryIfAny(), and Update().

◆ RemovePetitionsAndSigns()

void Player::RemovePetitionsAndSigns ( ObjectGuid  guid,
uint32  type 
)
static
10028{
10029 SignatureContainer* signatureStore = sPetitionMgr->GetSignatureStore();
10030 for (SignatureContainer::iterator itr = signatureStore->begin(); itr != signatureStore->end(); ++itr)
10031 {
10032 SignatureMap::iterator signItr = itr->second.signatureMap.find(guid);
10033 if (signItr != itr->second.signatureMap.end())
10034 {
10035 Petition const* petition = sPetitionMgr->GetPetition(itr->first);
10036 if (!petition || (type != 10 && type != petition->petitionType))
10037 continue;
10038
10039 // erase this
10040 itr->second.signatureMap.erase(signItr);
10041
10042 // send update if charter owner in game
10044 if (owner)
10045 owner->GetSession()->SendPetitionQueryOpcode(petition->petitionGuid);
10046 }
10047 }
10048
10049 if (type == 10)
10050 {
10052 stmt->SetData(0, guid.GetCounter());
10053 CharacterDatabase.Execute(stmt);
10054 }
10055 else
10056 {
10058 stmt->SetData(0, guid.GetCounter());
10059 stmt->SetData(1, uint8(type));
10060 CharacterDatabase.Execute(stmt);
10061 }
10062
10063 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
10064 if (type == 10)
10065 {
10067 stmt->SetData(0, guid.GetCounter());
10068 trans->Append(stmt);
10069
10070 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER);
10071 stmt->SetData(0, guid.GetCounter());
10072 trans->Append(stmt);
10073
10074 // xinef: clear petition store
10075 sPetitionMgr->RemovePetitionByOwnerAndType(guid, 0);
10076 }
10077 else
10078 {
10080 stmt->SetData(0, guid.GetCounter());
10081 stmt->SetData(1, uint8(type));
10082 trans->Append(stmt);
10083
10085 stmt->SetData(0, guid.GetCounter());
10086 stmt->SetData(1, uint8(type));
10087 trans->Append(stmt);
10088
10089 // xinef: clear petition store
10090 sPetitionMgr->RemovePetitionByOwnerAndType(guid, uint8(type));
10091 }
10092 CharacterDatabase.CommitTransaction(trans);
10093}
@ CHAR_DEL_PETITION_SIGNATURE
Definition: CharacterDatabase.h:235
@ CHAR_DEL_PETITION_SIGNATURE_BY_OWNER
Definition: CharacterDatabase.h:448
@ CHAR_DEL_ALL_PETITION_SIGNATURES
Definition: CharacterDatabase.h:234
@ CHAR_DEL_PETITION_SIGNATURE_BY_OWNER_AND_TYPE
Definition: CharacterDatabase.h:450
@ CHAR_DEL_PETITION_BY_OWNER
Definition: CharacterDatabase.h:447
@ CHAR_DEL_PETITION_BY_OWNER_AND_TYPE
Definition: CharacterDatabase.h:449
#define sPetitionMgr
Definition: PetitionMgr.h:88
std::map< ObjectGuid, Signatures > SignatureContainer
Definition: PetitionMgr.h:53
Definition: PetitionMgr.h:40
ObjectGuid petitionGuid
Definition: PetitionMgr.h:41
ObjectGuid ownerGuid
Definition: PetitionMgr.h:42
uint8 petitionType
Definition: PetitionMgr.h:43
void SendPetitionQueryOpcode(ObjectGuid petitionguid)
Definition: PetitionsHandler.cpp:278

References CHAR_DEL_ALL_PETITION_SIGNATURES, CHAR_DEL_PETITION_BY_OWNER, CHAR_DEL_PETITION_BY_OWNER_AND_TYPE, CHAR_DEL_PETITION_SIGNATURE, CHAR_DEL_PETITION_SIGNATURE_BY_OWNER, CHAR_DEL_PETITION_SIGNATURE_BY_OWNER_AND_TYPE, CharacterDatabase, ObjectAccessor::FindConnectedPlayer(), ObjectGuid::GetCounter(), GetSession(), Petition::ownerGuid, Petition::petitionGuid, Petition::petitionType, WorldSession::SendPetitionQueryOpcode(), PreparedStatementBase::SetData(), and sPetitionMgr.

Referenced by Guild::AddMember(), ArenaTeam::AddMember(), and DeleteFromDB().

◆ RemovePlayerFlag()

◆ RemoveQuestSlotState()

void Player::RemoveQuestSlotState ( uint16  slot,
uint32  state 
)
inline

◆ RemoveReceivedSpectatorResetFor()

void Player::RemoveReceivedSpectatorResetFor ( ObjectGuid  guid)
inline
2549{ m_receivedSpectatorResetFor.erase(guid); }

References m_receivedSpectatorResetFor.

◆ RemoveRestFlag()

void Player::RemoveRestFlag ( RestFlag  restFlag)
16084{
16085 uint32 oldRestMask = _restFlagMask;
16086 _restFlagMask &= ~restFlag;
16087
16088 if (oldRestMask && !_restFlagMask) // only remove flag/time on the last rest state remove
16089 {
16090 _restTime = 0;
16092 }
16093}

References _restFlagMask, _restTime, PLAYER_FLAGS_RESTING, and RemovePlayerFlag().

Referenced by Update(), UpdateArea(), and UpdateZone().

◆ RemoveRestState()

void Player::RemoveRestState ( )

◆ RemoveRewardedQuest()

void Player::RemoveRewardedQuest ( uint32  questId,
bool  update = true 
)
1500{
1501 RewardedQuestSet::iterator rewItr = m_RewardedQuests.find(questId);
1502 if (rewItr != m_RewardedQuests.end())
1503 {
1504 m_RewardedQuests.erase(rewItr);
1505 m_RewardedQuestsSave[questId] = false;
1506 }
1507
1508 if (update)
1509 SendQuestUpdate(questId);
1510}

References m_RewardedQuests, m_RewardedQuestsSave, and SendQuestUpdate().

Referenced by Spell::EffectQuestClear().

◆ RemoveRunesByAuraEffect()

void Player::RemoveRunesByAuraEffect ( AuraEffect const *  aura)
13303{
13304 for (uint8 i = 0; i < MAX_RUNES; ++i)
13305 {
13306 if (m_runes->runes[i].ConvertAura == aura)
13307 {
13308 ConvertRune(i, GetBaseRune(i));
13309 SetRuneConvertAura(i, nullptr);
13310 }
13311 }
13312}
AuraEffect const * ConvertAura
Definition: Player.h:423

References RuneInfo::ConvertAura, ConvertRune(), GetBaseRune(), m_runes, MAX_RUNES, Runes::runes, and SetRuneConvertAura().

Referenced by AuraEffect::HandleAuraConvertRune(), Aura::HandleAuraSpecificMods(), and AuraEffect::HandlePeriodicDummyAuraTick().

◆ removeSpell()

void Player::removeSpell ( uint32  spellId,
uint8  removeSpecMask,
bool  onlyTemporary 
)
3285{
3286 PlayerSpellMap::iterator itr = m_spells.find(spell_id);
3287 if (itr == m_spells.end())
3288 return;
3289
3290 // pussywizard: nothing to do if already removed or not in specs of removeSpecMask
3291 if (itr->second->State == PLAYERSPELL_REMOVED || (itr->second->specMask & removeSpecMask) == 0)
3292 return;
3293
3294 // pussywizard: avoid any possible bugs
3295 if (onlyTemporary && itr->second->State != PLAYERSPELL_TEMPORARY)
3296 return;
3297
3298 // pussywizard: remove non-talent higher ranks (recursive)
3299 // pussywizard: do this at the beginning, not in the middle of removing!
3300 if (uint32 nextSpell = sSpellMgr->GetNextSpellInChain(spell_id))
3301 if (!GetTalentSpellPos(nextSpell))
3302 removeSpell(nextSpell, removeSpecMask, onlyTemporary);
3303
3304 // xinef: if current spell has talentcost, remove spells requiring this spell
3305 uint32 firstRankSpellId = sSpellMgr->GetFirstSpellInChain(spell_id);
3306 if (GetTalentSpellCost(firstRankSpellId))
3307 {
3308 SpellsRequiringSpellMapBounds spellsRequiringSpell = sSpellMgr->GetSpellsRequiringSpellBounds(firstRankSpellId);
3309 for (auto spellsItr = spellsRequiringSpell.first; spellsItr != spellsRequiringSpell.second; ++spellsItr)
3310 {
3311 removeSpell(spellsItr->second, removeSpecMask, onlyTemporary);
3312 }
3313 }
3314
3315 // pussywizard: re-search, it can be corrupted in prev loop
3316 itr = m_spells.find(spell_id);
3317 if (itr == m_spells.end())
3318 return;
3319
3320 itr->second->specMask = (((uint8)itr->second->specMask) & ~removeSpecMask); // pussywizard: update specMask in map
3321
3322 // pussywizard: some more conditions needed for spells like pyroblast (shouldn't be fully removed when not available in any spec, should stay in db with specMask = 0)
3323 if (GetTalentSpellCost(firstRankSpellId) == 0 && !sSpellMgr->IsAdditionalTalentSpell(firstRankSpellId) && itr->second->specMask == 0)
3324 {
3325 if (itr->second->State == PLAYERSPELL_NEW || itr->second->State == PLAYERSPELL_TEMPORARY)
3326 {
3327 delete itr->second;
3328 m_spells.erase(itr);
3329 }
3330 else
3331 itr->second->State = PLAYERSPELL_REMOVED;
3332 }
3333 else if (itr->second->State != PLAYERSPELL_NEW && itr->second->State != PLAYERSPELL_TEMPORARY)
3334 itr->second->State = PLAYERSPELL_CHANGED;
3335
3336 // xinef: this is used for talents and they are not removed in removeSpell function...
3337 // xinef: however ill leave this here just in case
3338 // pussywizard: remove owned aura obtained from currently removed spell
3339 RemoveOwnedAura(spell_id);
3340
3341 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
3342 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3343 {
3344 // pussywizard: remove pet auras
3345 if (PetAura const* petSpell = sSpellMgr->GetPetAura(spell_id, i))
3346 RemovePetAura(petSpell);
3347
3348 // pussywizard: remove all triggered auras
3349 if (spellInfo->Effects[i].TriggerSpell > 0)
3350 RemoveAurasDueToSpell(spellInfo->Effects[i].TriggerSpell);
3351 }
3352
3353 // pussywizard: update free primary prof points
3354 if (spellInfo->IsPrimaryProfessionFirstRank())
3355 {
3356 uint32 freeProfs = GetFreePrimaryProfessionPoints() + 1;
3357 if (freeProfs <= sWorld->getIntConfig(CONFIG_MAX_PRIMARY_TRADE_SKILL))
3358 SetFreePrimaryProfessions(freeProfs);
3359 }
3360
3361 // pussywizard: update 310 flyer
3362 if (Has310Flyer(false))
3363 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3364 if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED && spellInfo->Effects[i].CalcValue() == 310)
3365 Has310Flyer(true, spell_id);
3366
3367 // pussywizard: remove dependent skill
3368 SpellLearnSkillNode const* spellLearnSkill = sSpellMgr->GetSpellLearnSkill(spell_id);
3369 if (spellLearnSkill)
3370 {
3371 uint32 prev_spell = sSpellMgr->GetPrevSpellInChain(spell_id);
3372
3373 if (!prev_spell) // pussywizard: first rank, remove skill
3374 SetSkill(spellLearnSkill->skill, 0, 0, 0);
3375 else // pussywizard: search previous ranks
3376 {
3377 SpellLearnSkillNode const* prevSkill = sSpellMgr->GetSpellLearnSkill(prev_spell);
3378 while (!prevSkill && prev_spell)
3379 {
3380 prev_spell = sSpellMgr->GetPrevSpellInChain(prev_spell);
3381 prevSkill = sSpellMgr->GetSpellLearnSkill(sSpellMgr->GetFirstSpellInChain(prev_spell));
3382 }
3383
3384 if (!prevSkill) // pussywizard: not found prev skill setting, remove skill
3385 SetSkill(spellLearnSkill->skill, 0, 0, 0);
3386 else // pussywizard: set to prev skill setting values
3387 {
3388 uint32 skill_value = GetPureSkillValue(prevSkill->skill);
3389 uint32 skill_max_value = GetPureMaxSkillValue(prevSkill->skill);
3390 uint32 new_skill_max_value = prevSkill->maxvalue == 0 ? GetMaxSkillValueForLevel() : prevSkill->maxvalue;
3391
3392 if (skill_value > prevSkill->value)
3393 skill_value = prevSkill->value;
3394 if (skill_max_value > new_skill_max_value)
3395 skill_max_value = new_skill_max_value;
3396
3397 SetSkill(prevSkill->skill, prevSkill->step, skill_value, skill_max_value);
3398 }
3399 }
3400 }
3401 else
3402 {
3403 SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spell_id);
3404 // most likely will never be used, haven't heard of cases where players unlearn a mount
3405 if (Has310Flyer(false) && spellInfo)
3406 {
3407 for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
3408 {
3409 SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->SkillLine);
3410 if (!pSkill)
3411 continue;
3412
3413 if (_spell_idx->second->SkillLine == SKILL_MOUNTS)
3414 {
3415 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3416 {
3417 if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
3418 spellInfo->Effects[i].CalcValue() == 310)
3419 {
3420 Has310Flyer(true, spell_id); // with true as first argument its also used to set/remove the flag
3421 break;
3422 }
3423 }
3424 }
3425 }
3426 }
3427 }
3428
3429 // pussywizard: remove from spell book (can't be replaced by previous rank, because such spells can't be unlearnt)
3430 if (!onlyTemporary || ((!spellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE | SPELL_ATTR0_DO_NOT_DISPLAY)) || !spellInfo->HasAnyAura()) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)))
3431 {
3432 sScriptMgr->OnPlayerForgotSpell(this, spell_id);
3433 SendLearnPacket(spell_id, false);
3434 }
3435}

References CONFIG_MAX_PRIMARY_TRADE_SKILL, SpellInfo::Effects, GetFreePrimaryProfessionPoints(), GetMaxSkillValueForLevel(), GetPureMaxSkillValue(), GetPureSkillValue(), GetTalentSpellCost(), GetTalentSpellPos(), Has310Flyer(), SpellInfo::HasAnyAura(), SpellInfo::HasAttribute(), SpellInfo::HasEffect(), SpellInfo::IsPrimaryProfessionFirstRank(), m_spells, MAX_SPELL_EFFECTS, SpellLearnSkillNode::maxvalue, PLAYERSPELL_CHANGED, PLAYERSPELL_NEW, PLAYERSPELL_REMOVED, PLAYERSPELL_TEMPORARY, Unit::RemoveAurasDueToSpell(), Unit::RemoveOwnedAura(), Unit::RemovePetAura(), removeSpell(), SendLearnPacket(), SetFreePrimaryProfessions(), SetSkill(), SpellLearnSkillNode::skill, SKILL_MOUNTS, SPELL_ATTR0_DO_NOT_DISPLAY, SPELL_ATTR0_PASSIVE, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_EFFECT_LEARN_SPELL, sScriptMgr, sSkillLineStore, sSpellMgr, SpellLearnSkillNode::step, and SpellLearnSkillNode::value.

Referenced by _removeTalentAurasAndSpells(), Spell::EffectUnlearnSpecialization(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraOverrideSpells(), Acore::PlayerCommand::HandleUnlearnSpellCommand(), learnSkillRewardedSpells(), ProfessionUnlearnSpells(), removeSpell(), resetSpells(), resetTalents(), and SetSkill().

◆ RemoveSpellCooldown()

◆ RemoveSpellMods()

void Player::RemoveSpellMods ( Spell spell)
9929{
9930 if (!spell)
9931 return;
9932
9933 if (spell->m_appliedMods.empty())
9934 return;
9935
9936 SpellInfo const* const spellInfo = spell->m_spellInfo;
9937
9938 for (uint8 i = 0; i < MAX_SPELLMOD; ++i)
9939 {
9940 for (SpellModList::const_iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end();)
9941 {
9942 SpellModifier* mod = *itr;
9943 ++itr;
9944
9945 // don't handle spells with proc_event entry defined
9946 // this is a temporary workaround, because all spellmods should be handled like that
9947 if (sSpellMgr->GetSpellProcEvent(mod->spellId))
9948 {
9949 continue;
9950 }
9951
9952 // spellmods without aura set cannot be charged
9953 if (!mod->ownerAura || !mod->ownerAura->IsUsingCharges())
9954 continue;
9955
9956 // check if mod affected this spell
9957 Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(mod->ownerAura);
9958 if (iterMod == spell->m_appliedMods.end())
9959 continue;
9960
9961 // remove from list
9962 // leave this here, if spell have two mods it will remove 2 charges - wrong
9963 spell->m_appliedMods.erase(iterMod);
9964
9965 // MAGE T8P4 BONUS
9966 if( spellInfo->SpellFamilyName == SPELLFAMILY_MAGE )
9967 {
9968 SpellInfo const* sp = mod->ownerAura->GetSpellInfo();
9969 // Missile Barrage, Hot Streak, Brain Freeze (trigger spell - Fireball!)
9970 if( sp->SpellIconID == 3261 || sp->SpellIconID == 2999 || sp->SpellIconID == 2938 )
9971 if( AuraEffect* aurEff = GetAuraEffectDummy(64869) )
9972 if( roll_chance_i(aurEff->GetAmount()) )
9973 {
9974 mod->charges = 1;
9975 continue;
9976 }
9977 }
9978
9980 itr = m_spellMods[i].begin();
9981 }
9982 }
9983}
@ AURA_REMOVE_BY_EXPIRE
Definition: SpellAuraDefines.h:395
#define MAX_SPELLMOD
Definition: SpellDefines.h:110
@ SPELLFAMILY_MAGE
Definition: SharedDefines.h:3531
AuraEffect * GetAuraEffectDummy(uint32 spellid) const
Definition: Unit.cpp:5488
bool IsUsingCharges() const
Definition: SpellAuras.h:200
bool DropCharge(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: SpellAuras.h:146
SpellInfo const *const m_spellInfo
Definition: Spell.h:520
uint32 SpellIconID
Definition: SpellInfo.h:378

References AURA_REMOVE_BY_EXPIRE, SpellModifier::charges, Aura::DropCharge(), Unit::GetAuraEffectDummy(), Aura::GetSpellInfo(), Aura::IsUsingCharges(), Spell::m_appliedMods, Spell::m_spellInfo, m_spellMods, MAX_SPELLMOD, SpellModifier::ownerAura, roll_chance_i(), SPELLFAMILY_MAGE, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, SpellModifier::spellId, and sSpellMgr.

Referenced by Spell::_cast().

◆ RemoveTimedAchievement()

void Player::RemoveTimedAchievement ( AchievementCriteriaTimedTypes  type,
uint32  entry 
)
13842{
13844}
void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition: AchievementMgr.cpp:2206

References m_achievementMgr, and AchievementMgr::RemoveTimedAchievement().

Referenced by InstanceScript::DoStopTimedAchievement(), and WorldSession::HandleQuestLogRemoveQuest().

◆ RemoveTimedQuest()

void Player::RemoveTimedQuest ( uint32  quest_id)
inline
1533{ m_timedquests.erase(quest_id); }

References m_timedquests.

Referenced by FailQuest(), WorldSession::HandleQuestLogRemoveQuest(), and RewardQuest().

◆ RemoveTradeableItem()

◆ ReplaceAllPlayerFlags()

void Player::ReplaceAllPlayerFlags ( PlayerFlags  flags)
inline
1103{ SetUInt32Value(PLAYER_FLAGS, flags); }

References PLAYER_FLAGS, and Object::SetUInt32Value().

Referenced by LoadFromDB().

◆ RepopAtGraveyard()

void Player::RepopAtGraveyard ( )
4835{
4836 // note: this can be called also when the player is alive
4837 // for example from WorldSession::HandleMovementOpcodes
4838
4839 AreaTableEntry const* zone = sAreaTableStore.LookupEntry(GetAreaId());
4840
4841 if (!sScriptMgr->CanRepopAtGraveyard(this))
4842 return;
4843
4844 // Such zones are considered unreachable as a ghost and the player must be automatically revived
4845 // Xinef: Get Transport Check is not needed
4846 if ((!IsAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) /*|| GetTransport()*/ || GetPositionZ() < GetMap()->GetMinHeight(GetPositionX(), GetPositionY()))
4847 {
4848 ResurrectPlayer(0.5f);
4850 }
4851
4852 GraveyardStruct const* ClosestGrave = nullptr;
4853
4854 // Special handle for battleground maps
4855 if (Battleground* bg = GetBattleground())
4856 ClosestGrave = bg->GetClosestGraveyard(this);
4857 else
4858 {
4859 if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
4860 ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveyard(this);
4861 else
4862 ClosestGrave = sGraveyard->GetClosestGraveyard(this, GetTeamId());
4863 }
4864
4865 // stop countdown until repop
4866 m_deathTimer = 0;
4867
4868 // if no grave found, stay at the current location
4869 // and don't show spirit healer location
4870 if (ClosestGrave)
4871 {
4872 TeleportTo(ClosestGrave->Map, ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, GetOrientation());
4873 if (isDead()) // not send if alive, because it used in TeleportTo()
4874 {
4875 WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4 * 4); // show spirit healer position on minimap
4876 data << ClosestGrave->Map;
4877 data << ClosestGrave->x;
4878 data << ClosestGrave->y;
4879 data << ClosestGrave->z;
4880 GetSession()->SendPacket(&data);
4881 }
4882 }
4883 else if (GetPositionZ() < GetMap()->GetMinHeight(GetPositionX(), GetPositionY()))
4885
4887}
@ PLAYER_FLAGS_IS_OUT_OF_BOUNDS
Definition: Player.h:489
#define sGraveyard
Definition: GameGraveyard.h:75
@ AREA_FLAG_NEED_FLY
Definition: DBCEnums.h:254
@ SMSG_DEATH_RELEASE_LOC
Definition: Opcodes.h:918
Definition: GameGraveyard.h:28
float z
Definition: GameGraveyard.h:33
float x
Definition: GameGraveyard.h:31
float y
Definition: GameGraveyard.h:32
uint32 Map
Definition: GameGraveyard.h:30

References AREA_FLAG_NEED_FLY, AreaTableEntry::flags, WorldObject::GetAreaId(), GetBattleground(), WorldObject::GetMap(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetSession(), GetTeamId(), WorldObject::GetZoneId(), Unit::IsAlive(), Unit::isDead(), m_deathTimer, m_homebindMapId, m_homebindO, m_homebindX, m_homebindY, m_homebindZ, GraveyardStruct::Map, PLAYER_FLAGS_IS_OUT_OF_BOUNDS, RemovePlayerFlag(), ResurrectPlayer(), sAreaTableStore, sBattlefieldMgr, WorldSession::SendPacket(), sGraveyard, SMSG_DEATH_RELEASE_LOC, SpawnCorpseBones(), sScriptMgr, TeleportTo(), GraveyardStruct::x, GraveyardStruct::y, and GraveyardStruct::z.

Referenced by Spell::EffectStuck(), HandleDrowning(), WorldSession::HandleInstanceLockResponse(), WorldSession::HandleRepopRequestOpcode(), misc_commandscript::HandleUnstuckCommand(), WorldSession::LogoutPlayer(), RemovedInsignia(), TeleportTo(), Update(), and UpdateHomebindTime().

◆ ReportedAfkBy()

void Player::ReportedAfkBy ( Player reporter)

This player has been blamed to be inactive in a battleground.

11294{
11296 // Battleground also must be in progress!
11297 if (!bg || bg != reporter->GetBattleground() || GetTeamId() != reporter->GetTeamId() || bg->GetStatus() != STATUS_IN_PROGRESS)
11298 return;
11299
11300 // Xinef: 2 minutes startup + 2 minute of match
11302 return;
11303
11304 // check if player has 'Idle' or 'Inactive' debuff
11305 if (m_bgData.bgAfkReporter.find(reporter->GetGUID()) == m_bgData.bgAfkReporter.end() && !HasAura(43680) && !HasAura(43681) && reporter->CanReportAfkDueToLimit())
11306 {
11307 m_bgData.bgAfkReporter.insert(reporter->GetGUID());
11308 // by default 3 players have to complain to apply debuff
11309 if (m_bgData.bgAfkReporter.size() >= sWorld->getIntConfig(CONFIG_BATTLEGROUND_REPORT_AFK))
11310 {
11311 // cast 'Idle' spell
11312 CastSpell(this, 43680, true);
11313 m_bgData.bgAfkReporter.clear();
11314 }
11315 }
11316}
@ CONFIG_BATTLEGROUND_REPORT_AFK_TIMER
Definition: IWorld.h:312
@ CONFIG_BATTLEGROUND_REPORT_AFK
Definition: IWorld.h:313
uint32 GetStartTime() const
Definition: Battleground.h:329
bool CanReportAfkDueToLimit()
Definition: Player.cpp:11283

References BGData::bgAfkReporter, CanReportAfkDueToLimit(), Unit::CastSpell(), CONFIG_BATTLEGROUND_REPORT_AFK, CONFIG_BATTLEGROUND_REPORT_AFK_TIMER, GetBattleground(), Object::GetGUID(), Battleground::GetStartTime(), Battleground::GetStatus(), GetTeamId(), Unit::HasAura(), IN_MILLISECONDS, m_bgData, MINUTE, STATUS_IN_PROGRESS, and sWorld.

Referenced by WorldSession::HandleReportPvPAFK().

◆ ReputationChanged()

void Player::ReputationChanged ( FactionEntry const *  factionEntry)
2195{
2196 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
2197 {
2198 if (uint32 questid = GetQuestSlotQuestId(i))
2199 {
2200 if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid))
2201 {
2202 if (qInfo->GetRepObjectiveFaction() == factionEntry->ID)
2203 {
2204 QuestStatusData& q_status = m_QuestStatus[questid];
2205 if (q_status.Status == QUEST_STATUS_INCOMPLETE)
2206 {
2207 if (GetReputationMgr().GetReputation(factionEntry) >= qInfo->GetRepObjectiveValue())
2208 if (CanCompleteQuest(questid))
2209 CompleteQuest(questid);
2210 }
2211 else if (q_status.Status == QUEST_STATUS_COMPLETE)
2212 {
2213 if (GetReputationMgr().GetReputation(factionEntry) < qInfo->GetRepObjectiveValue())
2214 IncompleteQuest(questid);
2215 }
2216 }
2217 }
2218 }
2219 }
2220}

References CanCompleteQuest(), CompleteQuest(), GetQuestSlotQuestId(), GetReputation(), GetReputationMgr(), FactionEntry::ID, IncompleteQuest(), m_QuestStatus, MAX_QUEST_LOG_SIZE, QUEST_STATUS_COMPLETE, QUEST_STATUS_INCOMPLETE, sObjectMgr, and QuestStatusData::Status.

Referenced by ReputationMgr::SetOneFactionReputation().

◆ ReputationChanged2()

void Player::ReputationChanged2 ( FactionEntry const *  factionEntry)
2223{
2224 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
2225 {
2226 if (uint32 questid = GetQuestSlotQuestId(i))
2227 {
2228 if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid))
2229 {
2230 if (qInfo->GetRepObjectiveFaction2() == factionEntry->ID)
2231 {
2232 QuestStatusData& q_status = m_QuestStatus[questid];
2233 if (q_status.Status == QUEST_STATUS_INCOMPLETE)
2234 {
2235 if (GetReputationMgr().GetReputation(factionEntry) >= qInfo->GetRepObjectiveValue2())
2236 if (CanCompleteQuest(questid))
2237 CompleteQuest(questid);
2238 }
2239 else if (q_status.Status == QUEST_STATUS_COMPLETE)
2240 {
2241 if (GetReputationMgr().GetReputation(factionEntry) < qInfo->GetRepObjectiveValue2())
2242 IncompleteQuest(questid);
2243 }
2244 }
2245 }
2246 }
2247 }
2248}

References CanCompleteQuest(), CompleteQuest(), GetQuestSlotQuestId(), GetReputation(), GetReputationMgr(), FactionEntry::ID, IncompleteQuest(), m_QuestStatus, MAX_QUEST_LOG_SIZE, QUEST_STATUS_COMPLETE, QUEST_STATUS_INCOMPLETE, sObjectMgr, and QuestStatusData::Status.

◆ ResetAchievementCriteria()

void Player::ResetAchievementCriteria ( AchievementCriteriaCondition  condition,
uint32  value,
bool  evenIfCriteriaComplete = false 
)
13847{
13848 m_achievementMgr->ResetAchievementCriteria(condition, value, evenIfCriteriaComplete);
13849}
void ResetAchievementCriteria(AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete=false)
Definition: AchievementMgr.cpp:514

References m_achievementMgr, and AchievementMgr::ResetAchievementCriteria().

Referenced by Battleground::AddPlayer(), spell_algalon_supermassive_fail::spell_algalon_supermassive_fail_SpellScript::RecalculateDamage(), Battleground::RemovePlayerAtLeave(), and setDeathState().

◆ ResetAchievements()

void Player::ResetAchievements ( )
13822{
13824}
void Reset()
Definition: AchievementMgr.cpp:490

References m_achievementMgr, and AchievementMgr::Reset().

Referenced by reset_commandscript::HandleResetAchievementsCommand().

◆ ResetAllPowers()

void Player::ResetAllPowers ( )
2024{
2026 switch (getPowerType())
2027 {
2028 case POWER_MANA:
2030 break;
2031 case POWER_RAGE:
2032 SetPower(POWER_RAGE, 0);
2033 break;
2034 case POWER_ENERGY:
2036 break;
2037 case POWER_RUNIC_POWER:
2039 break;
2040 default:
2041 break;
2042 }
2043}

References Unit::GetMaxHealth(), Unit::GetMaxPower(), Unit::getPowerType(), POWER_ENERGY, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, Unit::SetHealth(), and Unit::SetPower().

Referenced by Battleground::AddPlayer().

◆ ResetContestedPvP()

void Player::ResetContestedPvP ( )
inline
1834 {
1838 }
@ PLAYER_FLAGS_CONTESTED_PVP
Definition: Player.h:483
@ UNIT_STATE_ATTACK_PLAYER
Definition: Unit.h:339
void ClearUnitState(uint32 f)
Definition: Unit.h:1411

References Unit::ClearUnitState(), m_contestedPvPTimer, PLAYER_FLAGS_CONTESTED_PVP, RemovePlayerFlag(), and UNIT_STATE_ATTACK_PLAYER.

Referenced by SetGameMaster(), SetIsSpectator(), and UpdateContestedPvP().

◆ ResetDailyQuestStatus()

void Player::ResetDailyQuestStatus ( )
12076{
12077 for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
12078 SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, 0);
12079
12080 m_DFQuests.clear(); // Dungeon Finder Quests.
12081
12082 // DB data deleted in caller
12083 m_DailyQuestChanged = false;
12085}

References m_DailyQuestChanged, m_DFQuests, m_lastDailyQuestTime, PLAYER_FIELD_DAILY_QUESTS_1, PLAYER_MAX_DAILY_QUESTS, and Object::SetUInt32Value().

◆ ResetFarSightDistance()

void Player::ResetFarSightDistance ( )
16194{
16195 _farSightDistance.reset();
16196}

References _farSightDistance.

Referenced by AuraEffect::HandleFarSight().

◆ ResetInstances()

void Player::ResetInstances ( ObjectGuid  guid,
uint8  method,
bool  isRaid 
)
static

Reset all solo instances and optionally send a message on success for each.

196{
197 switch (method)
198 {
200 {
202 if (!p || p->GetDifficulty(false) != DUNGEON_DIFFICULTY_NORMAL)
203 break;
204 std::vector<InstanceSave*> toUnbind;
205 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(p->GetGUID(), Difficulty(DUNGEON_DIFFICULTY_NORMAL));
206 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
207 {
208 InstanceSave* instanceSave = itr->second.save;
209 MapEntry const* entry = sMapStore.LookupEntry(itr->first);
210 if (!entry || entry->IsRaid() || !instanceSave->CanReset())
211 {
212 continue;
213 }
214
215 Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
216 if (!map || map->ToInstanceMap()->Reset(method))
217 {
218 p->SendResetInstanceSuccess(instanceSave->GetMapId());
219 toUnbind.push_back(instanceSave);
220 }
221 else
222 {
223 p->SendResetInstanceFailed(0, instanceSave->GetMapId());
224 }
225
226 sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId());
227 }
228 for (std::vector<InstanceSave*>::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr)
229 {
230 sInstanceSaveMgr->UnbindAllFor(*itr);
231 }
232 }
233 break;
235 {
237 if (!p)
238 break;
239 std::vector<InstanceSave*> toUnbind;
240 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(p->GetGUID(), p->GetDifficulty(isRaid));
241 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
242 {
243 InstanceSave* instanceSave = itr->second.save;
244 MapEntry const* entry = sMapStore.LookupEntry(itr->first);
245 if (!entry || entry->IsRaid() != isRaid || !instanceSave->CanReset())
246 {
247 continue;
248 }
249
250 Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
251 if (!map || map->ToInstanceMap()->Reset(method))
252 {
253 p->SendResetInstanceSuccess(instanceSave->GetMapId());
254 toUnbind.push_back(instanceSave);
255 }
256 else
257 {
258 p->SendResetInstanceFailed(0, instanceSave->GetMapId());
259 }
260
261 sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId());
262 }
263 for (std::vector<InstanceSave*>::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr)
264 sInstanceSaveMgr->UnbindAllFor(*itr);
265 }
266 break;
268 {
270 if (!p)
271 break;
272 for (uint8 d = 0; d < MAX_DIFFICULTY; ++d)
273 {
274 std::vector<InstanceSave*> toUnbind;
275 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(p->GetGUID(), Difficulty(d));
276 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
277 {
278 if (itr->second.perm)
279 continue;
280 InstanceSave* instanceSave = itr->second.save;
281 Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
282 if (!map || p->FindMap() != map)
283 {
284 //p->SendResetInstanceSuccess(instanceSave->GetMapId());
285 toUnbind.push_back(instanceSave);
286 }
287 //else
288 // p->SendResetInstanceFailed(0, instanceSave->GetMapId());
289
290 sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId());
291 }
292 for (std::vector<InstanceSave*>::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr)
293 sInstanceSaveMgr->PlayerUnbindInstance(p->GetGUID(), (*itr)->GetMapId(), (*itr)->GetDifficulty(), true, p);
294 }
295 }
296 break;
298 {
300 for (uint8 d = 0; d < MAX_DIFFICULTY; ++d)
301 {
302 std::vector<InstanceSave*> toUnbind;
303 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(guid, Difficulty(d));
304 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
305 {
306 if (itr->second.perm)
307 continue;
308 InstanceSave* instanceSave = itr->second.save;
309 Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
310 if (!p || !map || p->FindMap() != map)
311 {
312 //p->SendResetInstanceSuccess(instanceSave->GetMapId());
313 toUnbind.push_back(instanceSave);
314 }
315 //else
316 // p->SendResetInstanceFailed(0, instanceSave->GetMapId());
317 }
318 for (std::vector<InstanceSave*>::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr)
319 sInstanceSaveMgr->PlayerUnbindInstance(guid, (*itr)->GetMapId(), (*itr)->GetDifficulty(), true, p);
320 }
321 }
322 break;
323 }
324}
std::unordered_map< uint32, InstancePlayerBind > BoundInstancesMap
Definition: InstanceSaveMgr.h:46
@ INSTANCE_RESET_GROUP_JOIN
Definition: Map.h:813
@ INSTANCE_RESET_CHANGE_DIFFICULTY
Definition: Map.h:811
@ INSTANCE_RESET_GROUP_LEAVE
Definition: Map.h:814
@ INSTANCE_RESET_ALL
Definition: Map.h:810
#define MAX_DIFFICULTY
Definition: DBCEnums.h:291
void SendResetInstanceSuccess(uint32 MapId)
Definition: PlayerMisc.cpp:326
void SendResetInstanceFailed(uint32 reason, uint32 MapId)
Definition: PlayerMisc.cpp:333
uint32 GetMapId() const
Definition: InstanceSaveMgr.h:62
bool CanReset() const
Definition: InstanceSaveMgr.h:81
InstanceMap * ToInstanceMap()
Definition: Map.h:545
bool Reset(uint8 method, GuidList *globalSkipList=nullptr)
Definition: Map.cpp:3098

References InstanceSave::CanReset(), DUNGEON_DIFFICULTY_NORMAL, ObjectAccessor::FindConnectedPlayer(), WorldObject::FindMap(), GetDifficulty(), Object::GetGUID(), InstanceSave::GetInstanceId(), InstanceSave::GetMapId(), INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_JOIN, INSTANCE_RESET_GROUP_LEAVE, MapEntry::IsRaid(), MAX_DIFFICULTY, InstanceMap::Reset(), SendResetInstanceFailed(), SendResetInstanceSuccess(), sInstanceSaveMgr, sMapMgr, sMapStore, and Map::ToInstanceMap().

Referenced by Group::AddMember(), Group::Disband(), WorldSession::HandleResetInstancesOpcode(), WorldSession::HandleSetDungeonDifficultyOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), and Group::RemoveMember().

◆ ResetMap()

void Player::ResetMap ( )
overridevirtual

Reimplemented from WorldObject.

14580{
14581 // this may be called during Map::Update
14582 // after decrement+unlink, ++m_mapRefIter will continue correctly
14583 // when the first element of the list is being removed
14584 // nocheck_prev will return the padding element of the RefMgr
14585 // instead of nullptr in the case of prev
14586 GetMap()->UpdateIteratorBack(this);
14588 GetMapRef().unlink();
14589}
virtual void ResetMap()
Definition: Object.cpp:2122
MapReference & GetMapRef()
Definition: Player.h:2454
void UpdateIteratorBack(Player *player)
Definition: Map.cpp:3336

References WorldObject::GetMap(), GetMapRef(), WorldObject::ResetMap(), Reference< TO, FROM >::unlink(), and Map::UpdateIteratorBack().

Referenced by WorldSession::HandleMoveWorldportAck(), and WorldSession::HandleSetRaidDifficultyOpcode().

◆ ResetMonthlyQuestStatus()

void Player::ResetMonthlyQuestStatus ( )
12108{
12109 if (m_monthlyquests.empty())
12110 return;
12111
12112 m_monthlyquests.clear();
12113 // DB data deleted in caller
12114 m_MonthlyQuestChanged = false;
12115}

References m_MonthlyQuestChanged, and m_monthlyquests.

◆ ResetPetTalents()

void Player::ResetPetTalents ( )
8801{
8802 // This needs another gossip option + NPC text as a confirmation.
8803 // The confirmation gossip listid has the text: "Yes, please do."
8804 Pet* pet = GetPet();
8805
8806 if (!pet || pet->getPetType() != HUNTER_PET || pet->m_usedTalentCount == 0)
8807 return;
8808
8809 CharmInfo* charmInfo = pet->GetCharmInfo();
8810 if (!charmInfo)
8811 {
8812 LOG_ERROR("entities.player", "Object ({}) is considered pet-like but doesn't have a charminfo!", pet->GetGUID().ToString());
8813 return;
8814 }
8815 pet->resetTalents();
8816 SendTalentsInfoData(true);
8817}
uint32 m_usedTalentCount
Definition: Pet.h:133
bool resetTalents()
Definition: Pet.cpp:2051

References Unit::GetCharmInfo(), Object::GetGUID(), GetPet(), Pet::getPetType(), HUNTER_PET, LOG_ERROR, Pet::m_usedTalentCount, Pet::resetTalents(), SendTalentsInfoData(), and ObjectGuid::ToString().

Referenced by OnGossipSelect(), and npc_pet_trainer::npc_pet_trainerAI::sGossipSelect().

◆ ResetSeasonalQuestStatus()

void Player::ResetSeasonalQuestStatus ( uint16  event_id)
12098{
12099 if (m_seasonalquests.empty() || m_seasonalquests[event_id].empty())
12100 return;
12101
12102 m_seasonalquests.erase(event_id);
12103 // DB data deleted in caller
12104 m_SeasonalQuestChanged = false;
12105}

References m_SeasonalQuestChanged, and m_seasonalquests.

◆ resetSpells()

void Player::resetSpells ( )
11735{
11736 // not need after this call
11739
11740 // make full copy of map (spells removed and marked as deleted at another spell remove
11741 // and we can't use original map for safe iterative with visit each spell at loop end
11742 PlayerSpellMap spellMap = GetSpellMap();
11743
11744 for (PlayerSpellMap::const_iterator iter = spellMap.begin(); iter != spellMap.end(); ++iter)
11745 removeSpell(iter->first, SPEC_MASK_ALL, false);
11746
11750}
std::unordered_map< uint32, PlayerSpell * > PlayerSpellMap
Definition: Player.h:194
@ AT_LOGIN_RESET_SPELLS
Definition: Player.h:602
PlayerSpellMap const & GetSpellMap() const
Definition: Player.h:1739

References AT_LOGIN_RESET_SPELLS, GetSpellMap(), HasAtLoginFlag(), LearnCustomSpells(), LearnDefaultSkills(), learnQuestRewardedSpells(), RemoveAtLoginFlag(), removeSpell(), and SPEC_MASK_ALL.

Referenced by WorldSession::HandlePlayerLoginFromDB(), and reset_commandscript::HandleResetSpellsCommand().

◆ resetTalents()

bool Player::resetTalents ( bool  noResetCost = false)
3657{
3658 sScriptMgr->OnPlayerTalentsReset(this, noResetCost);
3659
3660 // xinef: remove at login flag upon talents reset
3663
3664 // xinef: get max available talent points amount
3665 uint32 talentPointsForLevel = CalculateTalentsPoints();
3666
3667 // xinef: no talent points are used, return
3668 if (m_usedTalentCount == 0)
3669 return false;
3671
3672 // xinef: check if we have enough money
3673 uint32 resetCost = 0;
3674 if (!noResetCost && !sWorld->getBoolConfig(CONFIG_NO_RESET_TALENT_COST))
3675 {
3676 resetCost = resetTalentsCost();
3677 if (!HasEnoughMoney(resetCost))
3678 {
3680 return false;
3681 }
3682 }
3683
3684 RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
3685
3686 // xinef: reset talents
3687 for (PlayerTalentMap::iterator iter = m_talents.begin(); iter != m_talents.end(); )
3688 {
3689 PlayerTalentMap::iterator itr = iter++;
3690
3691 if (itr->second->State == PLAYERSPELL_REMOVED)
3692 continue;
3693
3694 // xinef: talent not in current spec
3695 if (!(itr->second->specMask & GetActiveSpecMask()))
3696 continue;
3697
3698 // xinef: remove talent auras
3699 _removeTalentAurasAndSpells(itr->first);
3700
3701 // xinef: check if talent learns spell to spell book
3702 TalentEntry const* talentInfo = sTalentStore.LookupEntry(itr->second->talentID);
3703 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
3704
3705 bool removed = false;
3706 if (talentInfo->addToSpellBook)
3707 if (!spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
3708 {
3709 removeSpell(itr->first, GetActiveSpecMask(), false);
3710 removed = true;
3711 }
3712
3713 // Xinef: send unlearn spell packet at talent remove
3714 if (!removed)
3715 SendLearnPacket(itr->first, false);
3716
3717 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3718 if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL)
3719 if (sSpellMgr->IsAdditionalTalentSpell(spellInfo->Effects[i].TriggerSpell))
3720 removeSpell(spellInfo->Effects[i].TriggerSpell, GetActiveSpecMask(), false);
3721
3722 // xinef: remove talent modifies m_talents, move itr to map begin
3724 }
3725
3726 // xinef: remove titan grip if player had it set
3727 if (m_canTitanGrip)
3728 SetCanTitanGrip(false);
3729 // xinef: remove dual wield if player does not have dual wield spell (shamans)
3730 if (!HasSpell(674) && m_canDualWield)
3731 SetCanDualWield(false);
3732
3734
3735 // pussywizard: removed saving to db, nothing important happens and saving only spells and talents may cause data integrity problems (eg. with skills saved to db)
3736 SetFreeTalentPoints(talentPointsForLevel);
3737
3738 if (!noResetCost)
3739 {
3740 ModifyMoney(-(int32)resetCost);
3743
3744 m_resetTalentsCost = resetCost;
3746 }
3747
3748 return true;
3749}
@ AT_LOGIN_RESET_TALENTS
Definition: Player.h:603
@ CONFIG_NO_RESET_TALENT_COST
Definition: IWorld.h:135
@ ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS
Definition: DBCEnums.h:181
@ ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS
Definition: DBCEnums.h:182
uint32 resetTalentsCost() const
Definition: Player.cpp:3623

References _removeTalent(), _removeTalentAurasAndSpells(), ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS, ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS, TalentEntry::addToSpellBook, AT_LOGIN_RESET_TALENTS, AutoUnequipOffhandIfNeed(), BUY_ERR_NOT_ENOUGHT_MONEY, CalculateTalentsPoints(), CONFIG_NO_RESET_TALENT_COST, SpellInfo::Effects, GetActiveSpecMask(), GameTime::GetGameTime(), HasAtLoginFlag(), SpellInfo::HasAttribute(), SpellInfo::HasEffect(), HasEnoughMoney(), HasSpell(), Unit::m_canDualWield, m_canTitanGrip, m_resetTalentsCost, m_resetTalentsTime, m_talents, m_usedTalentCount, MAX_SPELL_EFFECTS, ModifyMoney(), PET_SAVE_NOT_IN_SLOT, PLAYERSPELL_REMOVED, RemoveAtLoginFlag(), RemovePet(), removeSpell(), resetTalentsCost(), SendBuyError(), SendLearnPacket(), Unit::SetCanDualWield(), SetCanTitanGrip(), SetFreeTalentPoints(), SPELL_ATTR0_PASSIVE, SPELL_EFFECT_LEARN_SPELL, sScriptMgr, sSpellMgr, sTalentStore, sWorld, and UpdateAchievementCriteria().

Referenced by WorldSession::HandlePlayerLoginFromDB(), reset_commandscript::HandleResetTalentsCommand(), WorldSession::HandleTalentWipeConfirmOpcode(), and InitTalentForLevel().

◆ resetTalentsCost()

uint32 Player::resetTalentsCost ( ) const
3624{
3625 // The first time reset costs 1 gold
3626 if (m_resetTalentsCost < 1 * GOLD)
3627 return 1 * GOLD;
3628 // then 5 gold
3629 else if (m_resetTalentsCost < 5 * GOLD)
3630 return 5 * GOLD;
3631 // After that it increases in increments of 5 gold
3632 else if (m_resetTalentsCost < 10 * GOLD)
3633 return 10 * GOLD;
3634 else
3635 {
3636 uint64 months = (GameTime::GetGameTime().count() - m_resetTalentsTime) / MONTH;
3637 if (months > 0)
3638 {
3639 // This cost will be reduced by a rate of 5 gold per month
3640 int32 new_cost = int32(m_resetTalentsCost - 5 * GOLD * months);
3641 // to a minimum of 10 gold.
3642 return (new_cost < 10 * GOLD ? 10 * GOLD : new_cost);
3643 }
3644 else
3645 {
3646 // After that it increases in increments of 5 gold
3647 int32 new_cost = m_resetTalentsCost + 5 * GOLD;
3648 // until it hits a cap of 50 gold.
3649 if (new_cost > 50 * GOLD)
3650 new_cost = 50 * GOLD;
3651 return new_cost;
3652 }
3653 }
3654}
constexpr auto MONTH
Definition: Common.h:53
@ GOLD
Definition: SharedDefines.h:253

References GameTime::GetGameTime(), GOLD, m_resetTalentsCost, m_resetTalentsTime, and MONTH.

Referenced by resetTalents(), and SendTalentWipeConfirm().

◆ ResetWeeklyQuestStatus()

void Player::ResetWeeklyQuestStatus ( )
12088{
12089 if (m_weeklyquests.empty())
12090 return;
12091
12092 m_weeklyquests.clear();
12093 // DB data deleted in caller
12094 m_WeeklyQuestChanged = false;
12095}

References m_WeeklyQuestChanged, and m_weeklyquests.

◆ RestoreAllSpellMods()

void Player::RestoreAllSpellMods ( uint32  ownerAuraId = 0,
Aura aura = nullptr 
)
9922{
9923 for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
9924 if (m_currentSpells[i])
9925 RestoreSpellMods(m_currentSpells[i], ownerAuraId, aura);
9926}
void RestoreSpellMods(Spell *spell, uint32 ownerAuraId=0, Aura *aura=nullptr)
Definition: Player.cpp:9854
Spell * m_currentSpells[CURRENT_MAX_SPELL]
Definition: Unit.h:2515

References CURRENT_MAX_SPELL, Unit::m_currentSpells, and RestoreSpellMods().

◆ RestoreBaseRune()

void Player::RestoreBaseRune ( uint8  index)
13315{
13316 AuraEffect const* aura = m_runes->runes[index].ConvertAura;
13317 // If rune was converted by a non-pasive aura that still active we should keep it converted
13318 if (aura && !aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_PASSIVE))
13319 return;
13320 ConvertRune(index, GetBaseRune(index));
13321 SetRuneConvertAura(index, nullptr);
13322 // Don't drop passive talents providing rune convertion
13323 if (!aura || aura->GetAuraType() != SPELL_AURA_CONVERT_RUNE)
13324 return;
13325 for (uint8 i = 0; i < MAX_RUNES; ++i)
13326 {
13327 if (aura == m_runes->runes[i].ConvertAura)
13328 return;
13329 }
13330 aura->GetBase()->Remove();
13331}
@ SPELL_AURA_CONVERT_RUNE
Definition: SpellAuraDefines.h:312
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:54
AuraType GetAuraType() const
Definition: SpellAuraEffects.cpp:447
Aura * GetBase() const
Definition: SpellAuraEffects.h:49

References RuneInfo::ConvertAura, ConvertRune(), AuraEffect::GetAuraType(), AuraEffect::GetBase(), GetBaseRune(), AuraEffect::GetSpellInfo(), SpellInfo::HasAttribute(), m_runes, MAX_RUNES, Aura::Remove(), Runes::runes, SetRuneConvertAura(), SPELL_ATTR0_PASSIVE, and SPELL_AURA_CONVERT_RUNE.

Referenced by Spell::TakeRunePower().

◆ RestoreHealthAfterDuel()

void Player::RestoreHealthAfterDuel ( )
inline
uint32 healthBeforeDuel
Definition: Player.h:2943

References healthBeforeDuel, and Unit::SetHealth().

◆ RestoreManaAfterDuel()

void Player::RestoreManaAfterDuel ( )
inline
uint32 manaBeforeDuel
Definition: Player.h:2944

References manaBeforeDuel, POWER_MANA, and Unit::SetPower().

◆ RestoreSpellMods()

void Player::RestoreSpellMods ( Spell spell,
uint32  ownerAuraId = 0,
Aura aura = nullptr 
)
Todo:
track these changes correctly
9855{
9856 if (!spell || spell->m_appliedMods.empty())
9857 return;
9858
9859 std::list<Aura*> aurasQueue;
9860
9861 for (uint8 i = 0; i < MAX_SPELLMOD; ++i)
9862 {
9863 for (SpellModList::iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end(); ++itr)
9864 {
9865 SpellModifier* mod = *itr;
9866
9867 // Spellmods without aura set cannot be charged
9868 if (!mod->ownerAura || !mod->ownerAura->IsUsingCharges())
9869 continue;
9870
9871 // Restore only specific owner aura mods
9872 if (ownerAuraId && (ownerAuraId != mod->ownerAura->GetSpellInfo()->Id))
9873 continue;
9874
9875 if (aura && mod->ownerAura != aura)
9876 continue;
9877
9878 // Check if mod affected this spell
9879 // First, check if the mod aura applied at least one spellmod to this spell
9880 Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(mod->ownerAura);
9881 if (iterMod == spell->m_appliedMods.end())
9882 continue;
9883 // Second, check if the current mod is one of those applied by the mod aura
9884 if (!(mod->mask & spell->m_spellInfo->SpellFamilyFlags))
9885 continue;
9886
9887 // remove from list - This will be done after all mods have been gone through
9888 // to ensure we iterate over all mods of an aura before removing said aura
9889 // from applied mods (Else, an aura with two mods on the current spell would
9890 // only see the first of its modifier restored)
9891 aurasQueue.push_back(mod->ownerAura);
9892
9893 // add mod charges back to mod
9894 if (mod->charges == -1)
9895 mod->charges = 1;
9896 else
9897 mod->charges++;
9898
9899 // Do not set more spellmods than available
9900 if (mod->ownerAura->GetCharges() < mod->charges)
9901 mod->charges = mod->ownerAura->GetCharges();
9902
9903 // Skip this check for now - aura charges may change due to various reason
9905 //ASSERT (mod->ownerAura->GetCharges() <= mod->charges);
9906 }
9907 }
9908
9909 for (std::list<Aura*>::iterator itr = aurasQueue.begin(); itr != aurasQueue.end(); ++itr)
9910 {
9911 Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(*itr);
9912 if (iterMod != spell->m_appliedMods.end())
9913 spell->m_appliedMods.erase(iterMod);
9914 }
9915
9916 // Xinef: clear the list just do be sure
9917 if (!ownerAuraId && !aura)
9918 spell->m_appliedMods.clear();
9919}
uint8 GetCharges() const
Definition: SpellAuras.h:141
flag96 SpellFamilyFlags
Definition: SpellInfo.h:386

References SpellModifier::charges, Aura::GetCharges(), Aura::GetSpellInfo(), SpellInfo::Id, Aura::IsUsingCharges(), Spell::m_appliedMods, Spell::m_spellInfo, m_spellMods, SpellModifier::mask, MAX_SPELLMOD, SpellModifier::ownerAura, and SpellInfo::SpellFamilyFlags.

Referenced by Spell::DoAllEffectOnTarget(), Spell::finish(), Unit::HandleDummyAuraProc(), and RestoreAllSpellMods().

◆ ResummonPetTemporaryUnSummonedIfAny()

void Player::ResummonPetTemporaryUnSummonedIfAny ( )
14149{
14151 return;
14152
14153 // not resummon in not appropriate state
14155 return;
14156
14157 if (GetPetGUID())
14158 return;
14159
14161 return;
14162
14163 Pet* newPet = new Pet(this);
14164 if (!newPet->LoadPetFromDB(this, 0, m_temporaryUnsummonedPetNumber, true))
14165 delete newPet;
14166
14168}
bool IsPetNeedBeTemporaryUnsummoned() const
Definition: Player.h:2380
uint32 GetLastPetSpell() const
Definition: Player.h:2422
bool CanResummonPet(uint32 spellid)
Definition: Player.cpp:14170

References CanResummonPet(), GetLastPetSpell(), Unit::GetPetGUID(), IsPetNeedBeTemporaryUnsummoned(), IsSpectator(), Pet::LoadPetFromDB(), and m_temporaryUnsummonedPetNumber.

Referenced by Unit::_ExitVehicle(), WorldSession::HandleMoveTeleportAck(), and WorldSession::HandleMoveWorldportAck().

◆ ResurectUsingRequestData()

void Player::ResurectUsingRequestData ( )

Teleport before resurrecting by player, otherwise the player might get attacked from creatures near his corpse

12742{
12745
12746 if (IsBeingTeleported())
12747 {
12749 return;
12750 }
12751
12752 ResurrectPlayer(0.0f, false);
12753
12756 else
12757 SetFullHealth();
12758
12761 else
12763
12764 SetPower(POWER_RAGE, 0);
12765
12767
12769}
void ScheduleDelayedOperation(uint32 operation)
Definition: Player.h:2063
float m_resurrectZ
Definition: Player.h:2792
uint32 m_resurrectMap
Definition: Player.h:2791
float m_resurrectX
Definition: Player.h:2792
float m_resurrectY
Definition: Player.h:2792

References DELAYED_RESURRECT_PLAYER, Unit::GetMaxHealth(), Unit::GetMaxPower(), Position::GetOrientation(), IsBeingTeleported(), m_resurrectHealth, m_resurrectMana, m_resurrectMap, m_resurrectX, m_resurrectY, m_resurrectZ, POWER_ENERGY, POWER_MANA, POWER_RAGE, ResurrectPlayer(), ScheduleDelayedOperation(), Unit::SetFullHealth(), Unit::SetHealth(), Unit::SetPower(), SpawnCorpseBones(), and TeleportTo().

Referenced by WorldSession::HandleResurrectResponseOpcode().

◆ ResurrectPlayer()

void Player::ResurrectPlayer ( float  restore_percent,
bool  applySickness = false 
)
4389{
4390 WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4 * 4); // remove spirit healer position
4391 data << uint32(-1);
4392 data << float(0);
4393 data << float(0);
4394 data << float(0);
4395 GetSession()->SendPacket(&data);
4396
4397 // speed change, land walk
4398
4399 // remove death flag + set aura
4401 RemoveAurasDueToSpell(20584); // speed bonuses
4402 RemoveAurasDueToSpell(8326); // SPELL_AURA_GHOST
4403
4404 if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0))
4406
4407 setDeathState(DeathState::Alive);
4410 SetWaterWalking(false);
4411 m_deathTimer = 0;
4412
4413 // set health/powers (0- will be set in caller)
4414 if (restore_percent > 0.0f)
4415 {
4416 SetHealth(uint32(GetMaxHealth()*restore_percent));
4417 SetPower(POWER_MANA, uint32(GetMaxPower(POWER_MANA)*restore_percent));
4418 SetPower(POWER_RAGE, 0);
4420 }
4421
4422 // trigger update zone for alive state zone updates
4423 uint32 newzone, newarea;
4424 GetZoneAndAreaId(newzone, newarea);
4425 UpdateZone(newzone, newarea);
4426 sOutdoorPvPMgr->HandlePlayerResurrects(this, newzone);
4427
4428 if (Battleground* bg = GetBattleground())
4429 bg->HandlePlayerResurrect(this);
4430
4431 // update visibility
4433
4434 sScriptMgr->OnPlayerResurrect(this, restore_percent, applySickness);
4435
4436 if (!applySickness)
4437 {
4438 return;
4439 }
4440
4441 //Characters from level 1-10 are not affected by resurrection sickness.
4442 //Characters from level 11-19 will suffer from one minute of sickness
4443 //for each level they are above 10.
4444 //Characters level 20 and up suffer from ten minutes of sickness.
4445 int32 startLevel = sWorld->getIntConfig(CONFIG_DEATH_SICKNESS_LEVEL);
4446
4447 if (int32(GetLevel()) >= startLevel)
4448 {
4449 // set resurrection sickness
4450 CastSpell(this, 15007, true);
4451
4452 // not full duration
4453 if (int32(GetLevel()) < startLevel + 9)
4454 {
4455 int32 delta = (int32(GetLevel()) - startLevel + 1) * MINUTE;
4456
4457 if (Aura* aur = GetAura(15007, GetGUID()))
4458 {
4459 aur->SetDuration(delta * IN_MILLISECONDS);
4460 }
4461 }
4462 }
4463}
@ MOVE_LAND_WALK
Definition: Player.h:460
@ UNIT_BYTE1_FLAG_GROUND
Definition: Unit.h:79
@ CONFIG_DEATH_SICKNESS_LEVEL
Definition: IWorld.h:305
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition: Object.cpp:3116
void UpdateZone(uint32 newZone, uint32 newArea)
Definition: PlayerUpdates.cpp:1211
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition: PlayerUpdates.cpp:1571

References Unit::CastSpell(), CONFIG_DEATH_SICKNESS_LEVEL, Unit::GetAura(), GetBattleground(), Object::GetGUID(), Unit::GetLevel(), Unit::GetMaxHealth(), Unit::GetMaxPower(), GetSession(), WorldObject::GetZoneAndAreaId(), IN_MILLISECONDS, m_deathTimer, MINUTE, MOVE_LAND_WALK, MOVE_UNROOT, POWER_ENERGY, POWER_MANA, POWER_RAGE, Unit::RemoveAurasDueToSpell(), WorldSession::SendPacket(), Object::SetByteValue(), setDeathState(), Object::SetDynamicFlag(), Unit::SetHealth(), SetMovement(), Unit::SetPower(), SetWaterWalking(), SMSG_DEATH_RELEASE_LOC, sOutdoorPvPMgr, sScriptMgr, sWorld, UNIT_BYTE1_FLAG_GROUND, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_DYNFLAG_REFER_A_FRIEND, UNIT_FIELD_BYTES_1, UpdateObjectVisibility(), and UpdateZone().

Referenced by Battleground::_ProcessResurrect(), Spell::EffectSelfResurrect(), WorldSession::HandleAreaTriggerOpcode(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::HandleHearthAndResurrect(), WorldSession::HandleMoveWorldportAck(), WorldSession::HandleReclaimCorpseOpcode(), LoadCorpse(), LoadFromDB(), ProcessDelayedOperations(), Battleground::RemovePlayerAtLeave(), RepopAtGraveyard(), ResurectUsingRequestData(), BfGraveyard::Resurrect(), and WorldSession::SendSpiritResurrect().

◆ ResyncRunes()

void Player::ResyncRunes ( uint8  count)
13344{
13345 WorldPacket data(SMSG_RESYNC_RUNES, 4 + count * 2);
13346 data << uint32(count);
13347 for (uint32 i = 0; i < count; ++i)
13348 {
13349 data << uint8(GetCurrentRune(i)); // rune type
13350 data << uint8(255 - (GetRuneCooldown(i) * 51)); // passed cooldown time (0-255)
13351 }
13352 GetSession()->SendPacket(&data);
13353}
@ SMSG_RESYNC_RUNES
Definition: Opcodes.h:1189
RuneType GetCurrentRune(uint8 index) const
Definition: Player.h:2470

References GetCurrentRune(), GetRuneCooldown(), GetSession(), WorldSession::SendPacket(), and SMSG_RESYNC_RUNES.

◆ RewardExtraBonusTalentPoints()

void Player::RewardExtraBonusTalentPoints ( uint32  bonusTalentPoints)

A talent point boost. Usage: 1). Hot update situation (occurred when character is online, like PlayerScript:OnAchiComplete): Right after calling this function, character can reward talent points by calling function player->InitTalentForLevel().

2). Data initing situation (like PlayerScript:OnLoadFromDB)

5969{
5970 if (bonusTalentPoints)
5971 {
5972 m_extraBonusTalentCount += bonusTalentPoints;
5973 }
5974}

References m_extraBonusTalentCount.

◆ RewardHonor()

bool Player::RewardHonor ( Unit uVictim,
uint32  groupsize,
int32  honor = -1,
bool  awardXP = true 
)

Calculate the amount of honor gained based on the victim and the size of the group for which the honor is divided An exact honor value can also be given (overriding the calcs)

5980{
5981 // do not reward honor in arenas, but enable onkill spellproc
5982 if (InArena())
5983 {
5984 if (!uVictim || uVictim == this || uVictim->GetTypeId() != TYPEID_PLAYER)
5985 return false;
5986
5987 if (GetBgTeamId() == uVictim->ToPlayer()->GetBgTeamId())
5988 return false;
5989
5990 return true;
5991 }
5992
5993 // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
5995 return false;
5996
5997 /* check if player has same IP
5998 if (uVictim && uVictim->GetTypeId() == TYPEID_PLAYER)
5999 {
6000 if (GetSession()->GetRemoteAddress() == uVictim->ToPlayer()->GetSession()->GetRemoteAddress())
6001 return false;
6002 }
6003 */
6004
6005 ObjectGuid victim_guid;
6006 uint32 victim_rank = 0;
6007
6008 // need call before fields update to have chance move yesterday data to appropriate fields before today data change.
6010
6011 // do not reward honor in arenas, but return true to enable onkill spellproc
6012 if (InArena())
6013 return true;
6014
6015 // Promote to float for calculations
6016 float honor_f = (float)honor;
6017
6018 if (honor_f <= 0)
6019 {
6020 if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
6021 return false;
6022
6023 victim_guid = uVictim->GetGUID();
6024
6025 if (uVictim->GetTypeId() == TYPEID_PLAYER)
6026 {
6027 Player* victim = uVictim->ToPlayer();
6028
6029 if (GetTeamId() == victim->GetTeamId() && !sWorld->IsFFAPvPRealm())
6030 return false;
6031
6032 uint8 k_level = GetLevel();
6033 uint8 k_grey = Acore::XP::GetGrayLevel(k_level);
6034 uint8 v_level = victim->GetLevel();
6035
6036 if (v_level <= k_grey)
6037 return false;
6038
6039 // PLAYER_CHOSEN_TITLE VALUES DESCRIPTION
6040 // [0] Just name
6041 // [1..14] Alliance honor titles and player name
6042 // [15..28] Horde honor titles and player name
6043 // [29..38] Other title and player name
6044 // [39+] Nothing
6045 uint32 victim_title = victim->GetUInt32Value(PLAYER_CHOSEN_TITLE);
6046 uint32 killer_title = 0;
6047 sScriptMgr->OnVictimRewardBefore(this, victim, killer_title, victim_title);
6048 // Get Killer titles, CharTitlesEntry::bit_index
6049 // Ranks:
6050 // title[1..14] -> rank[5..18]
6051 // title[15..28] -> rank[5..18]
6052 // title[other] -> 0
6053 if (victim_title == 0)
6054 victim_guid.Clear(); // Don't show HK: <rank> message, only log.
6055 else if (victim_title < 15)
6056 victim_rank = victim_title + 4;
6057 else if (victim_title < 29)
6058 victim_rank = victim_title - 14 + 4;
6059 else
6060 victim_guid.Clear(); // Don't show HK: <rank> message, only log.
6061
6062 honor_f = std::ceil(Acore::Honor::hk_honor_at_level_f(k_level) * (v_level - k_grey) / (k_level - k_grey));
6063
6064 // count the number of playerkills in one day
6066 // and those in a lifetime
6074 sScriptMgr->OnVictimRewardAfter(this, victim, killer_title, victim_rank, honor_f);
6075 }
6076 else
6077 {
6078 if (!uVictim->ToCreature()->IsRacialLeader())
6079 return false;
6080
6081 honor_f = 100.0f; // ??? need more info
6082 victim_rank = 19; // HK: Leader
6083 }
6084 }
6085
6086 if (uVictim)
6087 {
6088 if (groupsize > 1)
6089 honor_f /= groupsize;
6090
6091 // apply honor multiplier from aura (not stacking-get highest)
6093 }
6094
6095 honor_f *= sWorld->getRate(RATE_HONOR);
6096 // Back to int now
6097 honor = int32(honor_f);
6098 // honor - for show honor points in log
6099 // victim_guid - for show victim name in log
6100 // victim_rank [1..4] HK: <dishonored rank>
6101 // victim_rank [5..19] HK: <alliance\horde rank>
6102 // victim_rank [0, 20+] HK: <>
6103 WorldPacket data(SMSG_PVP_CREDIT, 4 + 8 + 4);
6104 data << honor;
6105 data << victim_guid;
6106 data << victim_rank;
6107
6108 // Xinef: non quest case, quest honor obtain is send in quest reward packet
6109 if (uVictim || groupsize > 0)
6110 GetSession()->SendPacket(&data);
6111
6112 // add honor points
6113 ModifyHonorPoints(honor);
6114
6116
6117 // Xinef: Battleground experience
6118 if (awardXP)
6119 if (Battleground* bg = GetBattleground())
6120 {
6121 bg->UpdatePlayerScore(this, SCORE_BONUS_HONOR, honor, false); //false: prevent looping
6122 // Xinef: Only for BG activities
6123 if (!uVictim)
6124 {
6125 uint32 xp = uint32(honor * (3 + GetLevel() * 0.30f));
6126 sScriptMgr->OnGivePlayerXP(this, xp, nullptr, PlayerXPSource::XPSOURCE_BATTLEGROUND);
6127 GiveXP(xp, nullptr);
6128 }
6129 }
6130
6131 if (sWorld->getBoolConfig(CONFIG_PVP_TOKEN_ENABLE))
6132 {
6133 if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
6134 return true;
6135
6136 if (uVictim->GetTypeId() == TYPEID_PLAYER)
6137 {
6138 // Check if allowed to receive it in current map
6140 if ((MapType == 1 && !InBattleground() && !IsFFAPvP())
6141 || (MapType == 2 && !IsFFAPvP())
6142 || (MapType == 3 && !InBattleground()))
6143 return true;
6144
6145 uint32 itemID = sWorld->getIntConfig(CONFIG_PVP_TOKEN_ID);
6146 int32 count = sWorld->getIntConfig(CONFIG_PVP_TOKEN_COUNT);
6147
6148 if (AddItem(itemID, count))
6149 ChatHandler(GetSession()).PSendSysMessage("You have been awarded a token for slaying another player.");
6150 }
6151 }
6152
6153 return true;
6154}
@ SPELL_AURA_PLAYER_INACTIVE
Definition: Battleground.h:140
@ SCORE_BONUS_HONOR
Definition: BattlegroundScore.h:32
@ SPELL_AURA_MOD_HONOR_GAIN_PCT
Definition: SpellAuraDefines.h:344
@ SPELL_AURA_NO_PVP_CREDIT
Definition: SpellAuraDefines.h:222
@ CONFIG_PVP_TOKEN_MAP_TYPE
Definition: IWorld.h:334
@ CONFIG_PVP_TOKEN_ID
Definition: IWorld.h:335
@ CONFIG_PVP_TOKEN_COUNT
Definition: IWorld.h:336
@ CONFIG_PVP_TOKEN_ENABLE
Definition: IWorld.h:134
@ RATE_HONOR
Definition: IWorld.h:504
@ ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL
Definition: DBCEnums.h:227
@ ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL
Definition: DBCEnums.h:157
@ ACHIEVEMENT_CRITERIA_TYPE_HK_RACE
Definition: DBCEnums.h:175
@ ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA
Definition: DBCEnums.h:153
@ ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL
Definition: DBCEnums.h:190
@ ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS
Definition: DBCEnums.h:174
@ SMSG_PVP_CREDIT
Definition: Opcodes.h:682
std::unordered_map< std::string, Player * > MapType
Definition: ObjectAccessor.cpp:88
float hk_honor_at_level_f(uint8 level, float multiplier=1.0f)
Definition: Formulas.h:31
bool IsRacialLeader() const
Definition: Creature.h:75
void Clear()
Definition: ObjectGuid.h:140
bool AddItem(uint32 itemId, uint32 count)
Definition: Player.cpp:15478
bool IsFFAPvP()
Definition: Player.cpp:16138
TeamId GetBgTeamId() const
Definition: Player.h:2240
int32 GetMaxPositiveAuraModifier(AuraType auratype)
Definition: Unit.cpp:5873

References ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL, ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS, ACHIEVEMENT_CRITERIA_TYPE_HK_RACE, ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA, ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, AddItem(), AddPct(), Object::ApplyModUInt32Value(), ObjectGuid::Clear(), CONFIG_PVP_TOKEN_COUNT, CONFIG_PVP_TOKEN_ENABLE, CONFIG_PVP_TOKEN_ID, CONFIG_PVP_TOKEN_MAP_TYPE, WorldObject::GetAreaId(), GetBattleground(), GetBgTeamId(), Unit::getClass(), Acore::XP::GetGrayLevel(), Object::GetGUID(), Unit::GetLevel(), Unit::GetMaxPositiveAuraModifier(), Unit::getRace(), GetSession(), GetTeamId(), Object::GetTypeId(), Object::GetUInt32Value(), GiveXP(), Unit::HasAura(), Unit::HasAuraType(), Acore::Honor::hk_honor_at_level_f(), InArena(), InBattleground(), IsFFAPvP(), Creature::IsRacialLeader(), ModifyHonorPoints(), PLAYER_CHOSEN_TITLE, PLAYER_FIELD_KILLS, PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, PLAYER_FIELD_TODAY_CONTRIBUTION, ChatHandler::PSendSysMessage(), RATE_HONOR, SCORE_BONUS_HONOR, WorldSession::SendPacket(), SMSG_PVP_CREDIT, SPELL_AURA_MOD_HONOR_GAIN_PCT, SPELL_AURA_NO_PVP_CREDIT, SPELL_AURA_PLAYER_INACTIVE, sScriptMgr, sWorld, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, UpdateAchievementCriteria(), and UpdateHonorFields().

Referenced by KillRewarder::_RewardHonor(), DuelComplete(), Spell::EffectAddHonor(), OutdoorPvPSI::HandleAreaTrigger(), honor_commandscript::HandleHonorAddCommand(), honor_commandscript::HandleHonorAddKillCommand(), RewardQuest(), and Battleground::UpdatePlayerScore().

◆ RewardPlayerAndGroupAtEvent()

void Player::RewardPlayerAndGroupAtEvent ( uint32  creature_id,
WorldObject pRewardSource 
)
12651{
12652 if (!pRewardSource)
12653 return;
12654
12655 ObjectGuid creature_guid = (pRewardSource->GetTypeId() == TYPEID_UNIT) ? pRewardSource->GetGUID() : ObjectGuid::Empty;
12656
12657 // prepare data for near group iteration
12658 if (Group* group = GetGroup())
12659 {
12660 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
12661 {
12662 Player* player = itr->GetSource();
12663 if (!player)
12664 continue;
12665
12666 if (!player->IsAtGroupRewardDistance(pRewardSource))
12667 continue; // member (alive or dead) or his corpse at req. distance
12668
12669 // quest objectives updated only for alive group member or dead but with not released body
12670 if (player->IsAlive() || !player->GetCorpse())
12671 player->KilledMonsterCredit(creature_id, creature_guid);
12672 }
12673 }
12674 else // if (!group)
12675 KilledMonsterCredit(creature_id, creature_guid);
12676}

References ObjectGuid::Empty, GetCorpse(), GetGroup(), Object::GetGUID(), Object::GetTypeId(), Unit::IsAlive(), IsAtGroupRewardDistance(), KilledMonsterCredit(), GroupReference::next(), and TYPEID_UNIT.

Referenced by Spell::EffectKillCredit(), spell_inoculate_nestlewood_owlkin::HandleEffectRemove(), SmartScript::ProcessAction(), and SmartAI::StopFollow().

◆ RewardPlayerAndGroupAtKill()

void Player::RewardPlayerAndGroupAtKill ( Unit victim,
bool  isBattleGround 
)
12646{
12647 KillRewarder(this, victim, isBattleGround).Reward();
12648}
Definition: KillRewarder.h:28
void Reward()
Definition: KillRewarder.cpp:267

References KillRewarder::Reward().

Referenced by Unit::Kill(), and Battleground::RewardXPAtKill().

◆ RewardQuest()

void Player::RewardQuest ( Quest const *  quest,
uint32  reward,
Object questGiver,
bool  announce = true,
bool  isLFGReward = false 
)
659{
660 //this THING should be here to protect code from quest, which cast on player far teleport as a reward
661 //should work fine, cause far teleport will be executed in Player::Update()
663
664 uint32 quest_id = quest->GetQuestId();
665
666 for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
667 {
668 if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
669 {
670 if (quest->RequiredItemCount[i] > 0 && itemTemplate->Bonding == BIND_QUEST_ITEM && !quest->IsRepeatable() && !HasQuestForItem(quest->RequiredItemId[i], quest_id, true))
671 DestroyItemCount(quest->RequiredItemId[i], 9999, true);
672 else
673 DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true);
674 }
675 }
676 for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
677 {
678 if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->ItemDrop[i]))
679 {
680 if (quest->ItemDropQuantity[i] > 0 && itemTemplate->Bonding == BIND_QUEST_ITEM && !quest->IsRepeatable() && !HasQuestForItem(quest->ItemDrop[i], quest_id))
681 DestroyItemCount(quest->ItemDrop[i], 9999, true);
682 else
683 DestroyItemCount(quest->ItemDrop[i], quest->ItemDropQuantity[i], true);
684 }
685 }
686
687 RemoveTimedQuest(quest_id);
688
689 std::vector<std::pair<uint32, uint32>> problematicItems;
690
691 if (quest->GetRewChoiceItemsCount())
692 {
693 if (uint32 itemId = quest->RewardChoiceItemId[reward])
694 {
695 ItemPosCountVec dest;
696 if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewardChoiceItemCount[reward]) == EQUIP_ERR_OK)
697 {
698 Item* item = StoreNewItem(dest, itemId, true);
699 SendNewItem(item, quest->RewardChoiceItemCount[reward], true, false, false, false);
700
701 sScriptMgr->OnQuestRewardItem(this, item, quest->RewardChoiceItemCount[reward]);
702 }
703 else
704 {
705 problematicItems.emplace_back(itemId, quest->RewardChoiceItemCount[reward]);
706 }
707 }
708 }
709
710 if (quest->GetRewItemsCount())
711 {
712 for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i)
713 {
714 if (uint32 itemId = quest->RewardItemId[i])
715 {
716 ItemPosCountVec dest;
717 if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewardItemIdCount[i]) == EQUIP_ERR_OK)
718 {
719 Item* item = StoreNewItem(dest, itemId, true);
720 SendNewItem(item, quest->RewardItemIdCount[i], true, false, false, false);
721
722 sScriptMgr->OnQuestRewardItem(this, item, quest->RewardItemIdCount[i]);
723 }
724 else
725 problematicItems.emplace_back(itemId, quest->RewardItemIdCount[i]);
726 }
727 }
728 }
729
730 // Xinef: send items that couldn't be added properly by mail
731 if (!problematicItems.empty())
732 {
733 SendItemRetrievalMail(problematicItems);
734 }
735
736 RewardReputation(quest);
737
738 uint16 log_slot = FindQuestSlot(quest_id);
739 if (log_slot < MAX_QUEST_LOG_SIZE)
740 SetQuestSlot(log_slot, 0);
741
742 bool rewarded = IsQuestRewarded(quest_id) && !quest->IsDFQuest();
743
744 // Not give XP in case already completed once repeatable quest
745 uint32 XP = rewarded ? 0 : uint32(quest->XPValue(GetLevel()) * GetQuestRate(quest->IsDFQuest()));
746
747 // handle SPELL_AURA_MOD_XP_QUEST_PCT auras
749 for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
750 AddPct(XP, (*i)->GetAmount());
751
752 sScriptMgr->OnQuestComputeXP(this, quest, XP);
753 int32 moneyRew = 0;
754 if (GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(this))
755 {
756 moneyRew = quest->GetRewMoneyMaxLevel();
757 }
758 else
759 {
760 sScriptMgr->OnGivePlayerXP(this, XP, nullptr, isLFGReward ? PlayerXPSource::XPSOURCE_QUEST_DF : PlayerXPSource::XPSOURCE_QUEST);
761 GiveXP(XP, nullptr, isLFGReward);
762 }
763
764 // Give player extra money if GetRewOrReqMoney > 0 and get ReqMoney if negative
765 if (int32 rewOrReqMoney = quest->GetRewOrReqMoney(GetLevel()))
766 {
767 moneyRew += rewOrReqMoney;
768 }
769
770 if (moneyRew)
771 {
772 ModifyMoney(moneyRew);
773
774 if (moneyRew > 0)
776 }
777
778 // honor reward
779 if (uint32 honor = quest->CalculateHonorGain(GetLevel()))
780 RewardHonor(nullptr, 0, honor);
781
782 // title reward
783 if (quest->GetCharTitleId())
784 {
785 if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(quest->GetCharTitleId()))
786 SetTitle(titleEntry);
787 }
788
789 if (quest->GetBonusTalents())
790 {
791 m_questRewardTalentCount += quest->GetBonusTalents();
793 }
794
795 if (quest->GetRewArenaPoints())
796 ModifyArenaPoints(quest->GetRewArenaPoints());
797
798 // Send reward mail
799 if (uint32 mail_template_id = quest->GetRewMailTemplateId())
800 {
801 //- TODO: Poor design of mail system
802 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
803 if (quest->GetRewMailSenderEntry() != 0)
804 MailDraft(mail_template_id).SendMailTo(trans, this, quest->GetRewMailSenderEntry(), MAIL_CHECK_MASK_HAS_BODY, quest->GetRewMailDelaySecs());
805 else
806 MailDraft(mail_template_id).SendMailTo(trans, this, questGiver, MAIL_CHECK_MASK_HAS_BODY, quest->GetRewMailDelaySecs());
807 CharacterDatabase.CommitTransaction(trans);
808 }
809
810 if (quest->IsDaily() || quest->IsDFQuest())
811 {
812 SetDailyQuestStatus(quest_id);
813 if (quest->IsDaily())
814 {
817 }
818 }
819 else if (quest->IsWeekly())
820 SetWeeklyQuestStatus(quest_id);
821 else if (quest->IsMonthly())
822 SetMonthlyQuestStatus(quest_id);
823 else if (quest->IsSeasonal())
824 SetSeasonalQuestStatus(quest_id);
825
826 RemoveActiveQuest(quest_id, false);
827 m_RewardedQuests.insert(quest_id);
828 m_RewardedQuestsSave[quest_id] = true;
829
830 if (announce)
831 SendQuestReward(quest, XP);
832
833 // cast spells after mark quest complete (some spells have quest completed state requirements in spell_area data)
834 if (quest->GetRewSpellCast() > 0)
835 {
836 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(quest->GetRewSpellCast());
837 if (questGiver->isType(TYPEMASK_UNIT) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL) && !spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM) && !spellInfo->IsSelfCast())
838 {
839 if (Creature* creature = GetMap()->GetCreature(questGiver->GetGUID()))
840 creature->CastSpell(this, quest->GetRewSpellCast(), true);
841 }
842 else
843 CastSpell(this, quest->GetRewSpellCast(), true);
844 }
845 else if (quest->GetRewSpell() > 0)
846 {
847 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(quest->GetRewSpell());
848 if (questGiver->isType(TYPEMASK_UNIT) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL) && !spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM) && !spellInfo->IsSelfCast())
849 {
850 if (Creature* creature = GetMap()->GetCreature(questGiver->GetGUID()))
851 creature->CastSpell(this, quest->GetRewSpell(), true);
852 }
853 else
854 CastSpell(this, quest->GetRewSpell(), true);
855 }
856
857 if (quest->GetZoneOrSort() > 0)
861
862 // pussywizard: replaced partial save with full save
863 SaveToDB(false, false);
864
865 if (quest->HasFlag(QUEST_FLAGS_FLAGS_PVP))
866 {
869 }
870
871 SendQuestUpdate(quest_id);
872
874
875 //lets remove flag for delayed teleports
877
878 // Xinef: area auras may change on quest completion!
881
882 sScriptMgr->OnPlayerCompleteQuest(this, quest);
883}
@ TYPEMASK_UNIT
Definition: ObjectGuid.h:51
@ MAIL_CHECK_MASK_HAS_BODY
Definition: Mail.h:52
@ SPELL_AURA_MOD_XP_QUEST_PCT
Definition: SpellAuraDefines.h:354
@ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE
Definition: DBCEnums.h:137
@ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY
Definition: DBCEnums.h:136
@ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT
Definition: DBCEnums.h:135
@ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST
Definition: DBCEnums.h:139
@ ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD
Definition: DBCEnums.h:183
@ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST
Definition: DBCEnums.h:149
@ SPELL_EFFECT_CREATE_ITEM
Definition: SharedDefines.h:802
bool isType(uint16 mask) const
Definition: Object.h:122
bool IsInHostileArea
Definition: Player.h:362
bool HasPvPForcingQuest() const
Definition: PlayerQuest.cpp:2481
bool HasQuestForItem(uint32 itemId, uint32 excludeQuestId=0, bool turnIn=false, bool *showInLoot=nullptr) const
Definition: PlayerQuest.cpp:2250
void SetMonthlyQuestStatus(uint32 quest_id)
Definition: Player.cpp:12069
void SetSeasonalQuestStatus(uint32 quest_id)
Definition: Player.cpp:12059
void SendItemRetrievalMail(uint32 itemEntry, uint32 count)
Definition: PlayerMisc.cpp:439
void SendQuestReward(Quest const *quest, uint32 XP)
Definition: PlayerQuest.cpp:2343
void SetDailyQuestStatus(uint32 quest_id)
Definition: Player.cpp:12011
void RewardReputation(Unit *victim)
Definition: Player.cpp:5864
float GetQuestRate(bool isDFQuest=false)
Definition: Player.cpp:16165
void SetWeeklyQuestStatus(uint32 quest_id)
Definition: Player.cpp:12053
void RemoveActiveQuest(uint32 questId, bool update=true)
Definition: PlayerQuest.cpp:1481
void SetMustDelayTeleport(bool setting)
Definition: Player.h:2895
bool IsSelfCast() const
Definition: SpellInfo.cpp:1077

References ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST, ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY, ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST, ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT, ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE, ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD, AddPct(), BIND_QUEST_ITEM, Quest::CalculateHonorGain(), CanStoreNewItem(), Unit::CastSpell(), CharacterDatabase, CONFIG_MAX_PLAYER_LEVEL, DestroyItemCount(), EQUIP_ERR_OK, FindQuestSlot(), WorldObject::GetAreaId(), Unit::GetAuraEffectsByType(), Quest::GetBonusTalents(), Quest::GetCharTitleId(), Object::GetGUID(), Unit::GetLevel(), WorldObject::GetMap(), Quest::GetQuestId(), GetQuestRate(), Quest::GetRewArenaPoints(), Quest::GetRewChoiceItemsCount(), Quest::GetRewItemsCount(), Quest::GetRewMailDelaySecs(), Quest::GetRewMailSenderEntry(), Quest::GetRewMailTemplateId(), Quest::GetRewMoneyMaxLevel(), Quest::GetRewOrReqMoney(), Quest::GetRewSpell(), Quest::GetRewSpellCast(), WorldObject::GetZoneId(), Quest::GetZoneOrSort(), GiveXP(), SpellInfo::HasEffect(), Quest::HasFlag(), HasPvPForcingQuest(), HasQuestForItem(), InitTalentForLevel(), Quest::IsDaily(), Quest::IsDFQuest(), PvPInfo::IsHostile, PvPInfo::IsInHostileArea, Quest::IsMonthly(), IsQuestRewarded(), Quest::IsRepeatable(), Quest::IsSeasonal(), SpellInfo::IsSelfCast(), Object::isType(), Quest::IsWeekly(), Quest::ItemDrop, Quest::ItemDropQuantity, m_questRewardTalentCount, m_RewardedQuests, m_RewardedQuestsSave, MAIL_CHECK_MASK_HAS_BODY, MAX_QUEST_LOG_SIZE, ModifyArenaPoints(), ModifyMoney(), NULL_BAG, NULL_SLOT, pvpInfo, QUEST_FLAGS_FLAGS_PVP, QUEST_ITEM_OBJECTIVES_COUNT, QUEST_SOURCE_ITEM_IDS_COUNT, RemoveActiveQuest(), RemoveTimedQuest(), Quest::RequiredItemCount, Quest::RequiredItemId, Quest::RewardChoiceItemCount, Quest::RewardChoiceItemId, RewardHonor(), Quest::RewardItemId, Quest::RewardItemIdCount, RewardReputation(), SaveToDB(), sCharTitlesStore, SendItemRetrievalMail(), MailDraft::SendMailTo(), SendNewItem(), SendQuestGiverStatusMultiple(), SendQuestReward(), SendQuestUpdate(), SetDailyQuestStatus(), SetMonthlyQuestStatus(), SetMustDelayTeleport(), SetQuestSlot(), SetSeasonalQuestStatus(), SetTitle(), SetWeeklyQuestStatus(), sObjectMgr, SPELL_AURA_MOD_XP_QUEST_PCT, SPELL_EFFECT_CREATE_ITEM, SPELL_EFFECT_LEARN_SPELL, sScriptMgr, sSpellMgr, StoreNewItem(), sWorld, TYPEMASK_UNIT, UpdateAchievementCriteria(), UpdateAreaDependentAuras(), UpdatePvPState(), UpdateZoneDependentAuras(), and Quest::XPValue().

Referenced by CompleteQuest(), lfg::LFGMgr::FinishDungeon(), and WorldSession::HandleQuestgiverChooseRewardOpcode().

◆ RewardReputation() [1/2]

void Player::RewardReputation ( Quest const *  quest)
5915{
5916 for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
5917 {
5918 if (!quest->RewardFactionId[i])
5919 continue;
5920
5921 float rep = 0.f;
5922
5923 if (quest->RewardFactionValueIdOverride[i])
5924 {
5925 rep = quest->RewardFactionValueIdOverride[i] / 100.f;
5926 }
5927 else
5928 {
5929 uint32 row = ((quest->RewardFactionValueId[i] < 0) ? 1 : 0) + 1;
5930 if (QuestFactionRewEntry const* questFactionRewEntry = sQuestFactionRewardStore.LookupEntry(row))
5931 {
5932 uint32 field = std::abs(quest->RewardFactionValueId[i]);
5933 rep = static_cast<float>(questFactionRewEntry->QuestRewFactionValue[field]);
5934 }
5935 }
5936
5937 if (rep == 0.f)
5938 continue;
5939
5940 if (quest->IsDaily())
5941 {
5942 rep = CalculateReputationGain(REPUTATION_SOURCE_DAILY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
5943 }
5944 else if (quest->IsWeekly())
5945 {
5946 rep = CalculateReputationGain(REPUTATION_SOURCE_WEEKLY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
5947 }
5948 else if (quest->IsMonthly())
5949 {
5950 rep = CalculateReputationGain(REPUTATION_SOURCE_MONTHLY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
5951 }
5952 else if (quest->IsRepeatable())
5953 {
5954 rep = CalculateReputationGain(REPUTATION_SOURCE_REPEATABLE_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
5955 }
5956 else
5957 {
5958 rep = CalculateReputationGain(REPUTATION_SOURCE_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
5959 }
5960
5961 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i]))
5962 {
5963 GetReputationMgr().ModifyReputation(factionEntry, rep, quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER));
5964 }
5965 }
5966}
DBCStorage< QuestFactionRewEntry > sQuestFactionRewardStore(QuestFactionRewardfmt)
#define QUEST_REPUTATIONS_COUNT
Definition: QuestDef.h:41
@ QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER
Definition: QuestDef.h:166
float CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, float rep, int32 faction, bool noQuestBonus=false)
Definition: Player.cpp:5784
bool ModifyReputation(FactionEntry const *factionEntry, float standing, bool noSpillOver=false, Optional< ReputationRank > repMaxCap={})
Definition: ReputationMgr.h:118
Definition: DBCStructure.h:1456

References CalculateReputationGain(), GetQuestLevel(), GetReputationMgr(), Quest::HasSpecialFlag(), Quest::IsDaily(), Quest::IsMonthly(), Quest::IsRepeatable(), Quest::IsWeekly(), ReputationMgr::ModifyReputation(), QUEST_REPUTATIONS_COUNT, QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER, REPUTATION_SOURCE_DAILY_QUEST, REPUTATION_SOURCE_MONTHLY_QUEST, REPUTATION_SOURCE_QUEST, REPUTATION_SOURCE_REPEATABLE_QUEST, REPUTATION_SOURCE_WEEKLY_QUEST, Quest::RewardFactionId, Quest::RewardFactionValueId, Quest::RewardFactionValueIdOverride, sFactionStore, and sQuestFactionRewardStore.

◆ RewardReputation() [2/2]

void Player::RewardReputation ( Unit victim)
5865{
5866 if (!victim || victim->GetTypeId() == TYPEID_PLAYER)
5867 return;
5868
5869 if (victim->ToCreature()->IsReputationGainDisabled())
5870 return;
5871
5872 ReputationOnKillEntry const* Rep = sObjectMgr->GetReputationOnKilEntry(victim->ToCreature()->GetCreatureTemplate()->Entry);
5873 if (!Rep)
5874 return;
5875
5876 uint32 ChampioningFaction = 0;
5877
5879 {
5880 // support for: Championing - http://www.wowwiki.com/Championing
5881 Map const* map = GetMap();
5882 if (map->IsNonRaidDungeon())
5883 if (LFGDungeonEntry const* dungeon = GetLFGDungeon(map->GetId(), map->GetDifficulty()))
5884 if (dungeon->TargetLevel == 80)
5885 ChampioningFaction = GetChampioningFaction();
5886 }
5887
5888 TeamId teamId = GetTeamId(true); // Always check player original reputation when rewarding
5889
5890 if (Rep->RepFaction1 && (!Rep->TeamDependent || teamId == TEAM_ALLIANCE))
5891 {
5892 float donerep1 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->GetLevel(), static_cast<float>(Rep->RepValue1), ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
5893
5894 FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
5895 if (factionEntry1)
5896 {
5897 GetReputationMgr().ModifyReputation(factionEntry1, donerep1, false, static_cast<ReputationRank>(Rep->ReputationMaxCap1));
5898 }
5899 }
5900
5901 if (Rep->RepFaction2 && (!Rep->TeamDependent || teamId == TEAM_HORDE))
5902 {
5903 float donerep2 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->GetLevel(), static_cast<float>(Rep->RepValue2), ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
5904
5905 FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
5906 if (factionEntry2)
5907 {
5908 GetReputationMgr().ModifyReputation(factionEntry2, donerep2, false, static_cast<ReputationRank>(Rep->ReputationMaxCap2));
5909 }
5910 }
5911}
LFGDungeonEntry const * GetLFGDungeon(uint32 mapId, Difficulty difficulty)
Returns LFGDungeonEntry for a specific map and difficulty. Will return first found entry if multiple ...
Definition: DBCStores.cpp:848
TeamId
Definition: SharedDefines.h:759
bool IsReputationGainDisabled() const
Definition: Creature.h:354
uint32 Entry
Definition: CreatureData.h:177
uint32 GetChampioningFaction() const
Definition: Player.h:2513
Definition: ObjectMgr.h:562
uint32 ReputationMaxCap1
Definition: ObjectMgr.h:565
float RepValue1
Definition: ObjectMgr.h:566
uint32 RepFaction1
Definition: ObjectMgr.h:563
uint32 RepFaction2
Definition: ObjectMgr.h:564
bool TeamDependent
Definition: ObjectMgr.h:571
float RepValue2
Definition: ObjectMgr.h:568
uint32 ReputationMaxCap2
Definition: ObjectMgr.h:567
bool IsNonRaidDungeon() const
Definition: Map.h:449
Definition: DBCStructure.h:1236

References CalculateReputationGain(), CreatureTemplate::Entry, GetChampioningFaction(), Creature::GetCreatureTemplate(), Map::GetDifficulty(), Map::GetId(), Unit::GetLevel(), GetLFGDungeon(), WorldObject::GetMap(), GetReputationMgr(), GetTeamId(), Object::GetTypeId(), Map::IsNonRaidDungeon(), Creature::IsReputationGainDisabled(), ReputationMgr::ModifyReputation(), ReputationOnKillEntry::RepFaction1, ReputationOnKillEntry::RepFaction2, REPUTATION_SOURCE_KILL, ReputationOnKillEntry::ReputationMaxCap1, ReputationOnKillEntry::ReputationMaxCap2, ReputationOnKillEntry::RepValue1, ReputationOnKillEntry::RepValue2, sFactionStore, sObjectMgr, TEAM_ALLIANCE, TEAM_HORDE, ReputationOnKillEntry::TeamDependent, Object::ToCreature(), and TYPEID_PLAYER.

Referenced by KillRewarder::_RewardReputation(), and RewardQuest().

◆ Satisfy()

bool Player::Satisfy ( DungeonProgressionRequirements const *  ar,
uint32  target_map,
bool  report = false 
)
6728{
6729 if (!IsGameMaster() && ar)
6730 {
6731 uint8 LevelMin = 0;
6732 uint8 LevelMax = 0;
6733
6734 MapEntry const* mapEntry = sMapStore.LookupEntry(target_map);
6735 if (!mapEntry)
6736 return false;
6737
6738 if (!sWorld->getBoolConfig(CONFIG_INSTANCE_IGNORE_LEVEL))
6739 {
6740 if (ar->levelMin && GetLevel() < ar->levelMin)
6741 LevelMin = ar->levelMin;
6742 if (ar->levelMax && GetLevel() > ar->levelMax)
6743 LevelMax = ar->levelMax;
6744 }
6745
6746 if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, target_map, this))
6747 {
6749 return false;
6750 }
6751
6752 Player* partyLeader = this;
6753 std::string leaderName = m_session->GetAcoreString(LANG_YOU);
6754 {
6755 ObjectGuid leaderGuid = GetGroup() ? GetGroup()->GetLeaderGUID() : GetGUID();
6756 Player* tempLeader = HashMapHolder<Player>::Find(leaderGuid);
6757 if (leaderGuid != GetGUID())
6758 {
6759 if (tempLeader != nullptr)
6760 {
6761 partyLeader = tempLeader;
6762 }
6763 leaderName = GetGroup()->GetLeaderName();
6764 }
6765 }
6766
6767 //Check all items
6768 std::vector<const ProgressionRequirement*> missingPlayerItems;
6769 std::vector<const ProgressionRequirement*> missingLeaderItems;
6770 for (const ProgressionRequirement* itemRequirement : ar->items)
6771 {
6772 Player* checkPlayer = this;
6773 std::vector<const ProgressionRequirement*>* missingItems = &missingPlayerItems;
6774 if (itemRequirement->checkLeaderOnly)
6775 {
6776 checkPlayer = partyLeader;
6777 missingItems = &missingLeaderItems;
6778 }
6779
6780 if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == checkPlayer->GetTeamId(true))
6781 {
6782 if (!checkPlayer->HasItemCount(itemRequirement->id, 1))
6783 {
6784 missingItems->push_back(itemRequirement);
6785 }
6786 }
6787 }
6788
6789 //Check all achievements
6790 std::vector<const ProgressionRequirement*> missingPlayerAchievements;
6791 std::vector<const ProgressionRequirement*> missingLeaderAchievements;
6792 for (const ProgressionRequirement* achievementRequirement : ar->achievements)
6793 {
6794 Player* checkPlayer = this;
6795 std::vector<const ProgressionRequirement*>* missingAchievements = &missingPlayerAchievements;
6796 if (achievementRequirement->checkLeaderOnly)
6797 {
6798 checkPlayer = partyLeader;
6799 missingAchievements = &missingLeaderAchievements;
6800 }
6801
6802 if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == GetTeamId(true))
6803 {
6804 if (!checkPlayer || !checkPlayer->HasAchieved(achievementRequirement->id))
6805 {
6806 missingAchievements->push_back(achievementRequirement);
6807 }
6808 }
6809 }
6810
6811 //Check all quests
6812 std::vector<const ProgressionRequirement*> missingPlayerQuests;
6813 std::vector<const ProgressionRequirement*> missingLeaderQuests;
6814 for (const ProgressionRequirement* questRequirement : ar->quests)
6815 {
6816 Player* checkPlayer = this;
6817 std::vector<const ProgressionRequirement*>* missingQuests = &missingPlayerQuests;
6818 if (questRequirement->checkLeaderOnly)
6819 {
6820 checkPlayer = partyLeader;
6821 missingQuests = &missingLeaderQuests;
6822 }
6823
6824 if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == checkPlayer->GetTeamId(true))
6825 {
6826 if (!checkPlayer->GetQuestRewardStatus(questRequirement->id))
6827 {
6828 missingQuests->push_back(questRequirement);
6829 }
6830 }
6831 }
6832
6833 //Check if avg ILVL requirement is allowed
6834 bool ilvlRequirementNotMet = false;
6836 {
6837 const int32 currentIlvl = (int32)GetAverageItemLevelForDF();
6838 if (ar->reqItemLevel > currentIlvl)
6839 {
6840 ilvlRequirementNotMet = true;
6841 }
6842 }
6843
6844 Difficulty target_difficulty = GetDifficulty(mapEntry->IsRaid());
6845 MapDifficulty const* mapDiff = GetDownscaledMapDifficultyData(target_map, target_difficulty);
6846 if (LevelMin || LevelMax || ilvlRequirementNotMet
6847 || missingPlayerItems.size() || missingPlayerQuests.size() || missingPlayerAchievements.size()
6848 || missingLeaderItems.size() || missingLeaderQuests.size() || missingLeaderAchievements.size())
6849 {
6850 if (!sScriptMgr->NotAvoidSatisfy(partyLeader, ar, target_map, report))
6851 return true;
6852
6853 if (report)
6854 {
6855 uint8 requirementPrintMode = sWorld->getIntConfig(CONFIG_DUNGEON_ACCESS_REQUIREMENTS_PRINT_MODE);
6856
6857 if (requirementPrintMode == 0)
6858 {
6859 //Just print out the requirements are not met
6861 }
6862 else if (requirementPrintMode == 1)
6863 {
6864 //Blizzlike method of printing out the requirements
6865 if (missingPlayerQuests.size() && !missingPlayerQuests[0]->note.empty())
6866 {
6867 ChatHandler(GetSession()).PSendSysMessage("%s", missingPlayerQuests[0]->note.c_str());
6868 }
6869 else if (missingLeaderQuests.size() && !missingLeaderQuests[0]->note.empty())
6870 {
6871 ChatHandler(GetSession()).PSendSysMessage("%s", missingLeaderQuests[0]->note.c_str());
6872 }
6873 else if (mapDiff->hasErrorMessage)
6874 {
6875 // if (missingAchievement) covered by this case
6876 SendTransferAborted(target_map, TRANSFER_ABORT_DIFFICULTY, target_difficulty);
6877 }
6878 else if (missingPlayerItems.size())
6879 {
6881 std::string name = sObjectMgr->GetItemTemplate(missingPlayerItems[0]->id)->Name1;
6882 if (ItemLocale const* il = sObjectMgr->GetItemLocale(missingPlayerItems[0]->id))
6883 {
6884 ObjectMgr::GetLocaleString(il->Name, loc_idx, name);
6885 }
6887 }
6888 else if (LevelMin)
6889 {
6891 }
6892 else if (ilvlRequirementNotMet)
6893 {
6895 }
6896 }
6897 else
6898 {
6899 bool errorAlreadyPrinted = false;
6900 //Pretty way of printing out requirements
6901 if (missingPlayerQuests.size())
6902 {
6904 PrettyPrintRequirementsQuestList(missingPlayerQuests);
6905 errorAlreadyPrinted = true;
6906 }
6907 if (missingLeaderQuests.size())
6908 {
6910 PrettyPrintRequirementsQuestList(missingLeaderQuests);
6911 errorAlreadyPrinted = true;
6912 }
6913
6914 if (missingPlayerAchievements.size())
6915 {
6917 PrettyPrintRequirementsAchievementsList(missingPlayerAchievements);
6918 errorAlreadyPrinted = true;
6919 }
6920 if (missingLeaderAchievements.size())
6921 {
6923 PrettyPrintRequirementsAchievementsList(missingLeaderAchievements);
6924 errorAlreadyPrinted = true;
6925 }
6926
6927 if (missingPlayerItems.size())
6928 {
6930 PrettyPrintRequirementsItemsList(missingPlayerItems);
6931 errorAlreadyPrinted = true;
6932 }
6933
6934 if (missingLeaderItems.size())
6935 {
6937 PrettyPrintRequirementsItemsList(missingLeaderItems);
6938 errorAlreadyPrinted = true;
6939 }
6940
6941 if (ilvlRequirementNotMet)
6942 {
6944 }
6945
6946 if (LevelMin)
6947 {
6949 }
6950 else if (LevelMax)
6951 {
6953 }
6954 else if (mapDiff->hasErrorMessage && !errorAlreadyPrinted)
6955 {
6956 SendTransferAborted(target_map, TRANSFER_ABORT_DIFFICULTY, target_difficulty);
6957 }
6958 }
6959
6960 //Print the extra string
6962 if (optionalStringID > 0)
6963 {
6964 ChatHandler(GetSession()).SendSysMessage(optionalStringID);
6965 }
6966 }
6967 return false;
6968 }
6969 }
6970 return true;
6971}
@ DISABLE_TYPE_MAP
Definition: DisableMgr.h:31
MapDifficulty const * GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
Definition: DBCStores.cpp:763
@ TRANSFER_ABORT_DIFFICULTY
Definition: Player.h:783
@ LANG_INSTANCE_CLOSED
Definition: Language.h:1070
@ LANG_ACCESS_REQUIREMENT_LEADER_OBTAIN_ITEMS
Definition: Language.h:834
@ LANG_YOU
Definition: Language.h:76
@ LANG_ACCESS_REQUIREMENT_AVERAGE_ILVL_NOT_MET
Definition: Language.h:830
@ LANG_ACCESS_REQUIREMENT_OBTAIN_ITEMS
Definition: Language.h:827
@ LANG_ACCESS_REQUIREMENT_COMPLETE_QUESTS
Definition: Language.h:825
@ LANG_ACCESS_REQUIREMENT_NOT_MET
Definition: Language.h:829
@ LANG_LEVEL_MINREQUIRED_AND_ITEM
Definition: Language.h:82
@ LANG_ACCESS_REQUIREMENT_MAX_LEVEL
Definition: Language.h:831
@ LANG_ACCESS_REQUIREMENT_COMPLETE_ACHIEVEMENTS
Definition: Language.h:826
@ LANG_ACCESS_REQUIREMENT_LEADER_COMPLETE_QUESTS
Definition: Language.h:832
@ LANG_LEVEL_MINREQUIRED
Definition: Language.h:81
@ LANG_ACCESS_REQUIREMENT_LEADER_COMPLETE_ACHIEVEMENTS
Definition: Language.h:833
@ CONFIG_DUNGEON_ACCESS_REQUIREMENTS_OPTIONAL_STRING_ID
Definition: IWorld.h:401
@ CONFIG_DUNGEON_ACCESS_REQUIREMENTS_PRINT_MODE
Definition: IWorld.h:400
@ CONFIG_DUNGEON_ACCESS_REQUIREMENTS_PORTAL_CHECK_ILVL
Definition: IWorld.h:169
@ CONFIG_INSTANCE_IGNORE_LEVEL
Definition: IWorld.h:89
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:101
TeamId faction
Definition: Player.h:927
uint32 id
Definition: Player.h:926
bool checkLeaderOnly
Definition: Player.h:930
float GetAverageItemLevelForDF()
Definition: Player.cpp:15662
void PrettyPrintRequirementsQuestList(const std::vector< const ProgressionRequirement * > &missingQuests) const
Definition: PlayerStorage.cpp:6619
void PrettyPrintRequirementsItemsList(const std::vector< const ProgressionRequirement * > &missingItems) const
Definition: PlayerStorage.cpp:6689
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg=0)
Definition: Player.cpp:11632
void PrettyPrintRequirementsAchievementsList(const std::vector< const ProgressionRequirement * > &missingAchievements) const
Definition: PlayerStorage.cpp:6656
const char * GetLeaderName() const
Definition: Group.cpp:2250
ObjectGuid GetLeaderGUID() const
Definition: Group.cpp:2235
void SendAreaTriggerMessage(const char *Text,...) ATTR_PRINTF(2
Definition: MiscHandler.cpp:691
Definition: DBCStructure.h:2220
bool hasErrorMessage
Definition: DBCStructure.h:2226

References DungeonProgressionRequirements::achievements, ProgressionRequirement::checkLeaderOnly, CONFIG_DUNGEON_ACCESS_REQUIREMENTS_OPTIONAL_STRING_ID, CONFIG_DUNGEON_ACCESS_REQUIREMENTS_PORTAL_CHECK_ILVL, CONFIG_DUNGEON_ACCESS_REQUIREMENTS_PRINT_MODE, CONFIG_INSTANCE_IGNORE_LEVEL, DISABLE_TYPE_MAP, ProgressionRequirement::faction, HashMapHolder< T >::Find(), WorldSession::GetAcoreString(), GetAverageItemLevelForDF(), GetDifficulty(), GetDownscaledMapDifficultyData(), GetGroup(), Object::GetGUID(), Group::GetLeaderGUID(), Group::GetLeaderName(), Unit::GetLevel(), ObjectMgr::GetLocaleString(), GetQuestRewardStatus(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), GetTeamId(), HasAchieved(), MapDifficulty::hasErrorMessage, HasItemCount(), ProgressionRequirement::id, DisableMgr::IsDisabledFor(), IsGameMaster(), MapEntry::IsRaid(), DungeonProgressionRequirements::items, LANG_ACCESS_REQUIREMENT_AVERAGE_ILVL_NOT_MET, LANG_ACCESS_REQUIREMENT_COMPLETE_ACHIEVEMENTS, LANG_ACCESS_REQUIREMENT_COMPLETE_QUESTS, LANG_ACCESS_REQUIREMENT_LEADER_COMPLETE_ACHIEVEMENTS, LANG_ACCESS_REQUIREMENT_LEADER_COMPLETE_QUESTS, LANG_ACCESS_REQUIREMENT_LEADER_OBTAIN_ITEMS, LANG_ACCESS_REQUIREMENT_MAX_LEVEL, LANG_ACCESS_REQUIREMENT_NOT_MET, LANG_ACCESS_REQUIREMENT_OBTAIN_ITEMS, LANG_INSTANCE_CLOSED, LANG_LEVEL_MINREQUIRED, LANG_LEVEL_MINREQUIRED_AND_ITEM, LANG_YOU, DungeonProgressionRequirements::levelMax, DungeonProgressionRequirements::levelMin, m_session, PrettyPrintRequirementsAchievementsList(), PrettyPrintRequirementsItemsList(), PrettyPrintRequirementsQuestList(), ChatHandler::PSendSysMessage(), DungeonProgressionRequirements::quests, DungeonProgressionRequirements::reqItemLevel, WorldSession::SendAreaTriggerMessage(), ChatHandler::SendSysMessage(), SendTransferAborted(), sMapStore, sObjectMgr, sScriptMgr, sWorld, TEAM_NEUTRAL, and TRANSFER_ABORT_DIFFICULTY.

Referenced by Spell::CheckCast(), WorldSession::HandleSetRaidDifficultyOpcode(), and MapMgr::PlayerCannotEnter().

◆ SatisfyQuestClass()

bool Player::SatisfyQuestClass ( Quest const *  qInfo,
bool  msg 
) const
1085{
1086 uint32 reqClass = qInfo->GetRequiredClasses();
1087
1088 if (reqClass == 0)
1089 return true;
1090
1091 if ((reqClass & getClassMask()) == 0)
1092 {
1093 if (msg)
1095
1096 return false;
1097 }
1098
1099 return true;
1100}
@ INVALIDREASON_DONT_HAVE_REQ
Definition: QuestDef.h:48
void SendCanTakeQuestResponse(uint32 msg) const
Definition: PlayerQuest.cpp:2391

References Unit::getClassMask(), Quest::GetRequiredClasses(), INVALIDREASON_DONT_HAVE_REQ, and SendCanTakeQuestResponse().

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestConditions()

bool Player::SatisfyQuestConditions ( Quest const *  qInfo,
bool  msg 
)
1159{
1160 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_AVAILABLE, qInfo->GetQuestId());
1161 if (!sConditionMgr->IsObjectMeetToConditions(this, conditions))
1162 {
1163 if (msg)
1165 LOG_DEBUG("condition", "Player::SatisfyQuestConditions: conditions not met for quest {}", qInfo->GetQuestId());
1166 return false;
1167 }
1168 return true;
1169}

References CONDITION_SOURCE_TYPE_QUEST_AVAILABLE, Quest::GetQuestId(), INVALIDREASON_DONT_HAVE_REQ, LOG_DEBUG, sConditionMgr, and SendCanTakeQuestResponse().

Referenced by CanTakeQuest().

◆ SatisfyQuestDay()

bool Player::SatisfyQuestDay ( Quest const *  qInfo,
bool  msg 
) const
1268{
1269 if (!qInfo->IsDaily() && !qInfo->IsDFQuest())
1270 return true;
1271
1272 if (qInfo->IsDFQuest())
1273 {
1274 if (!m_DFQuests.empty())
1275 return false;
1276
1277 return true;
1278 }
1279
1280 bool have_slot = false;
1281 for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
1282 {
1283 uint32 id = GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx);
1284 if (qInfo->GetQuestId() == id)
1285 return false;
1286
1287 if (!id)
1288 have_slot = true;
1289 }
1290
1291 if (!have_slot)
1292 {
1293 if (msg)
1295 return false;
1296 }
1297
1298 return true;
1299}
@ INVALIDREASON_DAILY_QUESTS_REMAINING
Definition: QuestDef.h:58

References Quest::GetQuestId(), Object::GetUInt32Value(), INVALIDREASON_DAILY_QUESTS_REMAINING, Quest::IsDaily(), Quest::IsDFQuest(), m_DFQuests, PLAYER_FIELD_DAILY_QUESTS_1, PLAYER_MAX_DAILY_QUESTS, and SendCanTakeQuestResponse().

Referenced by CanRewardQuest(), CanSeeStartQuest(), CanTakeQuest(), and SatisfyQuestExclusiveGroup().

◆ SatisfyQuestExclusiveGroup()

bool Player::SatisfyQuestExclusiveGroup ( Quest const *  qInfo,
bool  msg 
) const
1183{
1184 // non positive exclusive group, if > 0 then can be start if any other quest in exclusive group already started/completed
1185 if (qInfo->GetExclusiveGroup() <= 0)
1186 return true;
1187
1188 ObjectMgr::ExclusiveQuestGroupsBounds range(sObjectMgr->mExclusiveQuestGroups.equal_range(qInfo->GetExclusiveGroup()));
1189
1190 for (; range.first != range.second; ++range.first)
1191 {
1192 uint32 exclude_Id = range.first->second;
1193
1194 // skip checked quest id, only state of other quests in group is interesting
1195 if (exclude_Id == qInfo->GetQuestId())
1196 continue;
1197
1198 // not allow have daily quest if daily quest from exclusive group already recently completed
1199 Quest const* Nquest = sObjectMgr->GetQuestTemplate(exclude_Id);
1200 if (!SatisfyQuestDay(Nquest, false) || !SatisfyQuestWeek(Nquest, false) || !SatisfyQuestSeasonal(Nquest, false))
1201 {
1202 if (msg)
1204
1205 return false;
1206 }
1207
1208 // alternative quest already started or completed - but don't check rewarded states if both are repeatable
1209 if (GetQuestStatus(exclude_Id) != QUEST_STATUS_NONE || (!(qInfo->IsRepeatable() && Nquest->IsRepeatable()) && !Nquest->IsSeasonal() && IsQuestRewarded(exclude_Id))) // pussywizard: added !Nquest->IsSeasonal() because seasonal quests are considered rewarded only if finished this year, this is checked above in SatisfyQuestSeasonal
1210 {
1211 if (msg)
1213 return false;
1214 }
1215 }
1216 return true;
1217}
std::pair< ExclusiveQuestGroups::const_iterator, ExclusiveQuestGroups::const_iterator > ExclusiveQuestGroupsBounds
Definition: ObjectMgr.h:1135

References Quest::GetExclusiveGroup(), Quest::GetQuestId(), GetQuestStatus(), INVALIDREASON_DONT_HAVE_REQ, IsQuestRewarded(), Quest::IsRepeatable(), Quest::IsSeasonal(), QUEST_STATUS_NONE, SatisfyQuestDay(), SatisfyQuestSeasonal(), SatisfyQuestWeek(), SendCanTakeQuestResponse(), and sObjectMgr.

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestLevel()

bool Player::SatisfyQuestLevel ( Quest const *  qInfo,
bool  msg 
) const
967{
968 if (GetLevel() < qInfo->GetMinLevel())
969 {
970 if (msg)
972 return false;
973 }
974 else if (qInfo->GetMaxLevel() > 0 && GetLevel() > qInfo->GetMaxLevel())
975 {
976 if (msg)
977 SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); // There doesn't seem to be a specific response for too high player level
978 return false;
979 }
980 return true;
981}
@ INVALIDREASON_QUEST_FAILED_LOW_LEVEL
Definition: QuestDef.h:49

References Unit::GetLevel(), Quest::GetMaxLevel(), Quest::GetMinLevel(), INVALIDREASON_DONT_HAVE_REQ, INVALIDREASON_QUEST_FAILED_LOW_LEVEL, and SendCanTakeQuestResponse().

Referenced by CanTakeQuest(), npc_wg_quest_giver::GetDialogStatus(), and GetQuestDialogStatus().

◆ SatisfyQuestLog()

bool Player::SatisfyQuestLog ( bool  msg)
984{
985 // exist free slot
987 return true;
988
989 if (msg)
990 {
992 GetSession()->SendPacket(&data);
993 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTLOG_FULL");
994 }
995 return false;
996}
@ SMSG_QUESTLOG_FULL
Definition: Opcodes.h:435

References FindQuestSlot(), GetSession(), LOG_DEBUG, MAX_QUEST_LOG_SIZE, WorldSession::SendPacket(), and SMSG_QUESTLOG_FULL.

Referenced by CanAddQuest(), and WorldSession::HandlePushQuestToParty().

◆ SatisfyQuestMonth()

bool Player::SatisfyQuestMonth ( Quest const *  qInfo,
bool  msg 
) const
1326{
1327 if (!qInfo->IsMonthly() || m_monthlyquests.empty())
1328 return true;
1329
1330 // if not found in cooldown list
1331 return m_monthlyquests.find(qInfo->GetQuestId()) == m_monthlyquests.end();
1332}

References Quest::GetQuestId(), Quest::IsMonthly(), and m_monthlyquests.

Referenced by CanRewardQuest(), CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestNextChain()

bool Player::SatisfyQuestNextChain ( Quest const *  qInfo,
bool  msg 
) const
1220{
1221 uint32 nextQuest = qInfo->GetNextQuestInChain();
1222 if (!nextQuest)
1223 return true;
1224
1225 // next quest in chain already started or completed
1226 if (GetQuestStatus(nextQuest) != QUEST_STATUS_NONE) // GetQuestStatus returns QUEST_STATUS_COMPLETED for rewarded quests
1227 {
1228 if (msg)
1230 return false;
1231 }
1232
1233 // check for all quests further up the chain
1234 // only necessary if there are quest chains with more than one quest that can be skipped
1235 //return SatisfyQuestNextChain(qInfo->GetNextQuestInChain(), msg);
1236 return true;
1237}

References Quest::GetNextQuestInChain(), GetQuestStatus(), INVALIDREASON_DONT_HAVE_REQ, QUEST_STATUS_NONE, and SendCanTakeQuestResponse().

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestPrevChain()

bool Player::SatisfyQuestPrevChain ( Quest const *  qInfo,
bool  msg 
) const
1240{
1241 // No previous quest in chain
1242 if (qInfo->prevChainQuests.empty())
1243 return true;
1244
1245 for (Quest::PrevChainQuests::const_iterator iter = qInfo->prevChainQuests.begin(); iter != qInfo->prevChainQuests.end(); ++iter)
1246 {
1247 QuestStatusMap::const_iterator itr = m_QuestStatus.find(*iter);
1248
1249 // If any of the previous quests in chain active, return false
1250 if (itr != m_QuestStatus.end() && itr->second.Status != QUEST_STATUS_NONE)
1251 {
1252 if (msg)
1254 return false;
1255 }
1256
1257 // check for all quests further down the chain
1258 // only necessary if there are quest chains with more than one quest that can be skipped
1259 //if (!SatisfyQuestPrevChain(prevId, msg))
1260 // return false;
1261 }
1262
1263 // No previous quest in chain active
1264 return true;
1265}

References INVALIDREASON_DONT_HAVE_REQ, m_QuestStatus, Quest::prevChainQuests, QUEST_STATUS_NONE, and SendCanTakeQuestResponse().

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestPreviousQuest()

bool Player::SatisfyQuestPreviousQuest ( Quest const *  qInfo,
bool  msg 
) const
999{
1000 // No previous quest (might be first quest in a series)
1001 if (qInfo->prevQuests.empty())
1002 return true;
1003
1004 for (Quest::PrevQuests::const_iterator iter = qInfo->prevQuests.begin(); iter != qInfo->prevQuests.end(); ++iter)
1005 {
1006 uint32 prevId = std::abs(*iter);
1007
1008 Quest const* qPrevInfo = sObjectMgr->GetQuestTemplate(prevId);
1009
1010 if (qPrevInfo)
1011 {
1012 // If any of the positive previous quests completed, return true
1013 if (*iter > 0 && IsQuestRewarded(prevId) && (!qPrevInfo->IsSeasonal() || !SatisfyQuestSeasonal(qPrevInfo, false)))
1014 {
1015 // skip one-from-all exclusive group
1016 if (qPrevInfo->GetExclusiveGroup() >= 0)
1017 return true;
1018
1019 // each-from-all exclusive group (< 0)
1020 // can be start if only all quests in prev quest exclusive group completed and rewarded
1021 ObjectMgr::ExclusiveQuestGroupsBounds range(sObjectMgr->mExclusiveQuestGroups.equal_range(qPrevInfo->GetExclusiveGroup()));
1022
1023 for (; range.first != range.second; ++range.first)
1024 {
1025 uint32 exclude_Id = range.first->second;
1026
1027 // skip checked quest id, only state of other quests in group is interesting
1028 if (exclude_Id == prevId)
1029 continue;
1030
1031 // alternative quest from group also must be completed and rewarded(reported)
1032
1033 Quest const* qExcludeInfo = sObjectMgr->GetQuestTemplate(exclude_Id);
1034 if (!IsQuestRewarded(exclude_Id) || (qExcludeInfo->IsSeasonal() && SatisfyQuestSeasonal(qExcludeInfo, false)))
1035 {
1036 if (msg)
1038 return false;
1039 }
1040 }
1041 return true;
1042 }
1043
1044 // If any of the negative previous quests active, return true
1045 if (*iter < 0 && GetQuestStatus(prevId) != QUEST_STATUS_NONE)
1046 {
1047 // skip one-from-all exclusive group
1048 if (qPrevInfo->GetExclusiveGroup() >= 0)
1049 return true;
1050
1051 // each-from-all exclusive group (< 0)
1052 // can be start if only all quests in prev quest exclusive group active
1053 ObjectMgr::ExclusiveQuestGroupsBounds range(sObjectMgr->mExclusiveQuestGroups.equal_range(qPrevInfo->GetExclusiveGroup()));
1054
1055 for (; range.first != range.second; ++range.first)
1056 {
1057 uint32 exclude_Id = range.first->second;
1058
1059 // skip checked quest id, only state of other quests in group is interesting
1060 if (exclude_Id == prevId)
1061 continue;
1062
1063 // alternative quest from group also must be active
1064 if (GetQuestStatus(exclude_Id) != QUEST_STATUS_NONE)
1065 {
1066 if (msg)
1068 return false;
1069 }
1070 }
1071 return true;
1072 }
1073 }
1074 }
1075
1076 // Has only positive prev. quests in non-rewarded state
1077 // and negative prev. quests in non-active state
1078 if (msg)
1080
1081 return false;
1082}
int32 GetExclusiveGroup() const
Definition: QuestDef.h:248

References Quest::GetExclusiveGroup(), GetQuestStatus(), INVALIDREASON_DONT_HAVE_REQ, IsQuestRewarded(), Quest::IsSeasonal(), Quest::prevQuests, QUEST_STATUS_NONE, SatisfyQuestSeasonal(), SendCanTakeQuestResponse(), and sObjectMgr.

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestRace()

bool Player::SatisfyQuestRace ( Quest const *  qInfo,
bool  msg 
) const
1103{
1104 uint32 reqraces = qInfo->GetAllowableRaces();
1105 if (reqraces == 0)
1106 return true;
1107 if ((reqraces & getRaceMask()) == 0)
1108 {
1109 if (msg)
1111 return false;
1112 }
1113 return true;
1114}
@ INVALIDREASON_QUEST_FAILED_WRONG_RACE
Definition: QuestDef.h:50

References Quest::GetAllowableRaces(), Unit::getRaceMask(), INVALIDREASON_QUEST_FAILED_WRONG_RACE, and SendCanTakeQuestResponse().

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestReputation()

bool Player::SatisfyQuestReputation ( Quest const *  qInfo,
bool  msg 
) const
1117{
1118 uint32 fIdMin = qInfo->GetRequiredMinRepFaction(); //Min required rep
1119 if (fIdMin && GetReputationMgr().GetReputation(fIdMin) < qInfo->GetRequiredMinRepValue())
1120 {
1121 if (msg)
1123 return false;
1124 }
1125
1126 uint32 fIdMax = qInfo->GetRequiredMaxRepFaction(); //Max required rep
1127 if (fIdMax && GetReputationMgr().GetReputation(fIdMax) >= qInfo->GetRequiredMaxRepValue())
1128 {
1129 if (msg)
1131 return false;
1132 }
1133
1134 // ReputationObjective2 does not seem to be an objective requirement but a requirement
1135 // to be able to accept the quest
1136 uint32 fIdObj = qInfo->GetRepObjectiveFaction2();
1137 if (fIdObj && GetReputationMgr().GetReputation(fIdObj) >= qInfo->GetRepObjectiveValue2())
1138 {
1139 if (msg)
1141 return false;
1142 }
1143
1144 return true;
1145}

References Quest::GetRepObjectiveFaction2(), Quest::GetRepObjectiveValue2(), GetReputation(), GetReputationMgr(), Quest::GetRequiredMaxRepFaction(), Quest::GetRequiredMaxRepValue(), Quest::GetRequiredMinRepFaction(), Quest::GetRequiredMinRepValue(), INVALIDREASON_DONT_HAVE_REQ, and SendCanTakeQuestResponse().

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestSeasonal()

bool Player::SatisfyQuestSeasonal ( Quest const *  qInfo,
bool  msg 
) const
1311{
1312 if (!qInfo->IsSeasonal() || m_seasonalquests.empty())
1313 return true;
1314
1315 // cppcheck-suppress mismatchingContainers
1316 Player::SeasonalEventQuestMap::iterator itr = ((Player*)this)->m_seasonalquests.find(qInfo->GetEventIdForQuest());
1317
1318 if (itr == m_seasonalquests.end() || itr->second.empty())
1319 return true;
1320
1321 // if not found in cooldown list
1322 return itr->second.find(qInfo->GetQuestId()) == itr->second.end();
1323}

References Quest::GetEventIdForQuest(), Quest::GetQuestId(), Quest::IsSeasonal(), and m_seasonalquests.

Referenced by CanRewardQuest(), CanSeeStartQuest(), CanTakeQuest(), GetQuestRewardStatus(), GetQuestStatus(), SatisfyQuestExclusiveGroup(), and SatisfyQuestPreviousQuest().

◆ SatisfyQuestSkill()

bool Player::SatisfyQuestSkill ( Quest const *  qInfo,
bool  msg 
) const
947{
948 uint32 skill = qInfo->GetRequiredSkill();
949
950 // skip 0 case RequiredSkill
951 if (skill == 0)
952 return true;
953
954 // check skill value
955 if (GetBaseSkillValue(skill) < qInfo->GetRequiredSkillValue())
956 {
957 if (msg)
959
960 return false;
961 }
962
963 return true;
964}

References GetBaseSkillValue(), Quest::GetRequiredSkill(), Quest::GetRequiredSkillValue(), INVALIDREASON_DONT_HAVE_REQ, and SendCanTakeQuestResponse().

Referenced by CanSeeStartQuest(), and CanTakeQuest().

◆ SatisfyQuestStatus()

bool Player::SatisfyQuestStatus ( Quest const *  qInfo,
bool  msg 
) const
1148{
1149 if (GetQuestStatus(qInfo->GetQuestId()) != QUEST_STATUS_NONE)
1150 {
1151 if (msg)
1153 return false;
1154 }
1155 return true;
1156}
@ INVALIDREASON_QUEST_ALREADY_ON
Definition: QuestDef.h:53

References Quest::GetQuestId(), GetQuestStatus(), INVALIDREASON_QUEST_ALREADY_ON, QUEST_STATUS_NONE, and SendCanTakeQuestResponse().

Referenced by CanTakeQuest(), and WorldSession::HandlePushQuestToParty().

◆ SatisfyQuestTimed()

bool Player::SatisfyQuestTimed ( Quest const *  qInfo,
bool  msg 
) const
1172{
1173 if (!m_timedquests.empty() && qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED))
1174 {
1175 if (msg)
1177 return false;
1178 }
1179 return true;
1180}
@ INVALIDREASON_QUEST_ONLY_ONE_TIMED
Definition: QuestDef.h:52

References Quest::HasSpecialFlag(), INVALIDREASON_QUEST_ONLY_ONE_TIMED, m_timedquests, QUEST_SPECIAL_FLAGS_TIMED, and SendCanTakeQuestResponse().

Referenced by CanTakeQuest().

◆ SatisfyQuestWeek()

bool Player::SatisfyQuestWeek ( Quest const *  qInfo,
bool  msg 
) const
1302{
1303 if (!qInfo->IsWeekly() || m_weeklyquests.empty())
1304 return true;
1305
1306 // if not found in cooldown list
1307 return m_weeklyquests.find(qInfo->GetQuestId()) == m_weeklyquests.end();
1308}

References Quest::GetQuestId(), Quest::IsWeekly(), and m_weeklyquests.

Referenced by CanRewardQuest(), CanSeeStartQuest(), CanTakeQuest(), and SatisfyQuestExclusiveGroup().

◆ SaveGoldToDB()

void Player::SaveGoldToDB ( CharacterDatabaseTransaction  trans)
7151{
7153 stmt->SetData(0, GetMoney());
7154 stmt->SetData(1, GetGUID().GetCounter());
7155 trans->Append(stmt);
7156}
@ CHAR_UDP_CHAR_MONEY
Definition: CharacterDatabase.h:424

References CHAR_UDP_CHAR_MONEY, CharacterDatabase, Object::GetGUID(), GetMoney(), and PreparedStatementBase::SetData().

Referenced by WorldSession::HandleMailTakeMoney(), Guild::HandleMemberDepositMoney(), Guild::HandleMemberWithdrawMoney(), and SaveInventoryAndGoldToDB().

◆ SaveHealthBeforeDuel()

void Player::SaveHealthBeforeDuel ( )
inline

◆ SaveInventoryAndGoldToDB()

void Player::SaveInventoryAndGoldToDB ( CharacterDatabaseTransaction  trans)
7145{
7146 _SaveInventory(trans);
7147 SaveGoldToDB(trans);
7148}
void SaveGoldToDB(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7150
void _SaveInventory(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7264

References _SaveInventory(), and SaveGoldToDB().

Referenced by WorldSession::HandleAcceptTradeOpcode(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleMailTakeItem(), WorldSession::HandleOpenWrappedItemCallback(), WorldSession::HandleSendMail(), WorldSession::HandleWrapItemOpcode(), and RefundItem().

◆ SaveManaBeforeDuel()

void Player::SaveManaBeforeDuel ( )
inline

◆ SavePositionInDB() [1/2]

void Player::SavePositionInDB ( uint32  mapid,
float  x,
float  y,
float  z,
float  o,
uint32  zone,
ObjectGuid  guid 
)
static
85{
87
88 stmt->SetData(0, x);
89 stmt->SetData(1, y);
90 stmt->SetData(2, z);
91 stmt->SetData(3, o);
92 stmt->SetData(4, uint16(mapid));
93 stmt->SetData(5, uint16(zone));
94 stmt->SetData(6, guid.GetCounter());
95
96 CharacterDatabase.Execute(stmt);
97}
@ CHAR_UPD_CHARACTER_POSITION
Definition: CharacterDatabase.h:322

References CHAR_UPD_CHARACTER_POSITION, CharacterDatabase, ObjectGuid::GetCounter(), and PreparedStatementBase::SetData().

Referenced by tele_commandscript::DoNameTeleport(), WorldSession::HandleCharFactionOrRaceChangeCallback(), misc_commandscript::HandleSummonCommand(), and tele_commandscript::HandleTeleNameCommand().

◆ SavePositionInDB() [2/2]

void Player::SavePositionInDB ( WorldLocation const &  loc,
uint16  zoneId,
ObjectGuid  guid,
CharacterDatabaseTransaction  trans 
)
static
100{
102
103 stmt->SetData(0, loc.GetPositionX());
104 stmt->SetData(1, loc.GetPositionY());
105 stmt->SetData(2, loc.GetPositionZ());
106 stmt->SetData(3, loc.GetOrientation());
107 stmt->SetData(4, uint16(loc.GetMapId()));
108 stmt->SetData(5, zoneId);
109 stmt->SetData(6, guid.GetCounter());
110
111 CharacterDatabase.ExecuteOrAppend(trans, stmt);
112}

References CHAR_UPD_CHARACTER_POSITION, CharacterDatabase, ObjectGuid::GetCounter(), WorldLocation::GetMapId(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and PreparedStatementBase::SetData().

◆ SaveRecallPosition()

◆ SaveToDB() [1/2]

void Player::SaveToDB ( bool  create,
bool  logout 
)

◆ SaveToDB() [2/2]

void Player::SaveToDB ( CharacterDatabaseTransaction  trans,
bool  create,
bool  logout 
)
7083{
7084 // delay auto save at any saves (manual, in code, or autosave)
7085 m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
7086
7087 //lets allow only players in world to be saved
7089 {
7091 return;
7092 }
7093
7094 // pussywizard: full save now, so clear partial additional saves
7097
7098 // first save/honor gain after midnight will also update the player's honor fields
7100
7101 LOG_DEBUG("entities.unit", "The value of player {} at save: ", m_name);
7103
7104 if (!create)
7105 sScriptMgr->OnPlayerSave(this);
7106
7107 _SaveCharacter(create, trans);
7108
7109 if (m_mailsUpdated) //save mails only when needed
7110 _SaveMail(trans);
7111
7112 _SaveEntryPoint(trans);
7113 _SaveInventory(trans);
7114 _SaveQuestStatus(trans);
7115 _SaveDailyQuestStatus(trans);
7119 _SaveTalents(trans);
7120 _SaveSpells(trans);
7121 _SaveSpellCooldowns(trans, logout);
7122 _SaveActions(trans);
7123 _SaveAuras(trans, logout);
7124 _SaveSkills(trans);
7125 m_achievementMgr->SaveToDB(trans);
7126 m_reputationMgr->SaveToDB(trans);
7127 _SaveEquipmentSets(trans);
7128 GetSession()->SaveTutorialsData(trans); // changed only while character in game
7129 _SaveGlyphs(trans);
7131 _SavePlayerSettings(trans);
7132
7133 // check if stats should only be saved on logout
7134 // save stats can be out of transaction
7136 _SaveStats(trans);
7137
7138 // save pet (hunter pet level and experience and all type pets health/mana).
7139 if (Pet* pet = GetPet())
7140 pet->SavePetToDB(PET_SAVE_AS_CURRENT);
7141}
@ CONFIG_STATS_SAVE_ONLY_ON_LOGOUT
Definition: IWorld.h:75
void SaveToDB(CharacterDatabaseTransaction trans)
Definition: AchievementMgr.cpp:556
bool IsBeingTeleportedFar() const
Definition: Player.h:2056
void _SaveMonthlyQuestStatus(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7639
void _SaveTalents(CharacterDatabaseTransaction trans)
Definition: Player.cpp:14943
void _SaveDailyQuestStatus(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7544
void _SaveSpells(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7717
void _SaveCharacter(bool create, CharacterDatabaseTransaction trans)
Definition: Player.cpp:14597
void _SaveSkills(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7661
void _SaveEquipmentSets(CharacterDatabaseTransaction trans)
Definition: Player.cpp:14463
void _SaveGlyphs(CharacterDatabaseTransaction trans)
Definition: Player.cpp:14896
void _SaveMail(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7402
void _SaveQuestStatus(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7477
void _SaveAuras(CharacterDatabaseTransaction trans, bool logout)
Definition: PlayerStorage.cpp:7206
void _SaveSeasonalQuestStatus(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7605
void _SaveInstanceTimeRestrictions(CharacterDatabaseTransaction trans)
Definition: Player.cpp:15789
void _SavePlayerSettings(CharacterDatabaseTransaction trans)
Definition: PlayerSettings.cpp:91
void _SaveWeeklyQuestStatus(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7582
void _SaveSpellCooldowns(CharacterDatabaseTransaction trans, bool logout)
Definition: Player.cpp:3575
void _SaveEntryPoint(CharacterDatabaseTransaction trans)
Definition: Player.cpp:14514
void _SaveStats(CharacterDatabaseTransaction trans)
Definition: PlayerStorage.cpp:7764
void SaveToDB(CharacterDatabaseTransaction trans)
Definition: ReputationMgr.cpp:625
bool isLogingOut() const
Is the user engaged in a log out process?
Definition: WorldSession.h:387
void SaveTutorialsData(CharacterDatabaseTransaction trans)
Definition: WorldSession.cpp:962

References _SaveActions(), _SaveAuras(), _SaveCharacter(), _SaveDailyQuestStatus(), _SaveEntryPoint(), _SaveEquipmentSets(), _SaveGlyphs(), _SaveInstanceTimeRestrictions(), _SaveInventory(), _SaveMail(), _SaveMonthlyQuestStatus(), _SavePlayerSettings(), _SaveQuestStatus(), _SaveSeasonalQuestStatus(), _SaveSkills(), _SaveSpellCooldowns(), _SaveSpells(), _SaveStats(), _SaveTalents(), _SaveWeeklyQuestStatus(), CONFIG_INTERVAL_SAVE, CONFIG_STATS_SAVE_ONLY_ON_LOGOUT, DELAYED_SAVE_PLAYER, GetPet(), GetSession(), IsBeingTeleportedFar(), WorldSession::isLogingOut(), LOG_DEBUG, m_achievementMgr, m_additionalSaveMask, m_additionalSaveTimer, m_mailsUpdated, WorldObject::m_name, m_nextSave, m_reputationMgr, m_session, outDebugValues(), PET_SAVE_AS_CURRENT, AchievementMgr::SaveToDB(), ReputationMgr::SaveToDB(), WorldSession::SaveTutorialsData(), ScheduleDelayedOperation(), sScriptMgr, sWorld, and UpdateHonorFields().

◆ Say() [1/2]

void Player::Say ( std::string_view  text,
Language  language,
WorldObject const *  = nullptr 
)
overridevirtual

Handles said message in regular chat based on declared language and in config pre-defined Range.

Reimplemented from Unit.

9252{
9253 std::string _text(text);
9254 if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_SAY, language, _text))
9255 {
9256 return;
9257 }
9258
9259 sScriptMgr->OnPlayerChat(this, CHAT_MSG_SAY, language, _text);
9260
9261 WorldPacket data;
9262 ChatHandler::BuildChatPacket(data, CHAT_MSG_SAY, language, this, this, _text);
9263 SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), true);
9264}
@ CONFIG_LISTEN_RANGE_SAY
Definition: IWorld.h:195
@ CHAT_MSG_SAY
Definition: SharedDefines.h:3153
static size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="")
Definition: Chat.cpp:201
void SendMessageToSetInRange(WorldPacket const *data, float dist, bool self, bool includeMargin=false, Player const *skipped_rcvr=nullptr) const override
Definition: Player.cpp:5586

References ChatHandler::BuildChatPacket(), CHAT_MSG_SAY, CONFIG_LISTEN_RANGE_SAY, SendMessageToSetInRange(), sScriptMgr, and sWorld.

Referenced by Unit::HandleDummyAuraProc(), WorldSession::HandleMessagechatOpcode(), npc_brewfest_bark_trigger::MoveInLineOfSight(), npc_jungle_punch_target::npc_jungle_punch_targetAI::SpellHit(), and boss_headless_horseman::UpdateAI().

◆ Say() [2/2]

void Player::Say ( uint32  textId,
WorldObject const *  target = nullptr 
)
overridevirtual

Reimplemented from Unit.

9267{
9268 Talk(textId, CHAT_MSG_SAY, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), target);
9269}
Talk
Definition: boss_fathomlord_karathress.cpp:25

References CHAT_MSG_SAY, CONFIG_LISTEN_RANGE_SAY, and sWorld.

◆ ScheduleDelayedOperation()

void Player::ScheduleDelayedOperation ( uint32  operation)
inline
2064 {
2065 if (operation < DELAYED_END)
2066 m_DelayedOperations |= operation;
2067 }
@ DELAYED_END
Definition: Player.h:902

References DELAYED_END, and m_DelayedOperations.

Referenced by Battleground::RemovePlayerAtLeave(), ResurectUsingRequestData(), SaveToDB(), and TeleportToEntryPoint().

◆ SendActionButtons()

void Player::SendActionButtons ( uint32  state) const
5469{
5470 LOG_DEBUG("entities.player", "Sending Action Buttons for {} spec {}", GetGUID().ToString(), m_activeSpec);
5471
5473 data << uint8(state);
5474 /*
5475 state can be 0, 1, 2
5476 0 - Looks to be sent when initial action buttons get sent, however on Trinity we use 1 since 0 had some difficulties
5477 1 - Used in any SMSG_ACTION_BUTTONS packet with button data on Trinity. Only used after spec swaps on retail.
5478 2 - Clears the action bars client sided. This is sent during spec swap before unlearning and before sending the new buttons
5479 */
5480 if (state != 2)
5481 {
5482 for (uint8 button = 0; button < MAX_ACTION_BUTTONS; ++button)
5483 {
5484 ActionButtonList::const_iterator itr = m_actionButtons.find(button);
5485 if (itr != m_actionButtons.end() && itr->second.uState != ACTIONBUTTON_DELETED)
5486 data << uint32(itr->second.packedData);
5487 else
5488 data << uint32(0);
5489 }
5490 }
5491
5492 GetSession()->SendPacket(&data);
5493 LOG_DEBUG("entities.player", "Action Buttons for {} spec {} Sent", GetGUID().ToString(), m_activeSpec);
5494}
@ SMSG_ACTION_BUTTONS
Definition: Opcodes.h:327

References ACTIONBUTTON_DELETED, Object::GetGUID(), GetSession(), LOG_DEBUG, m_actionButtons, m_activeSpec, MAX_ACTION_BUTTONS, WorldSession::SendPacket(), SMSG_ACTION_BUTTONS, and Position::ToString().

Referenced by ActivateSpec(), WorldSession::HandleLoadActionsSwitchSpec(), LoadActions(), and SendInitialActionButtons().

◆ SendAttackSwingBadFacingAttack()

void Player::SendAttackSwingBadFacingAttack ( )
147{
149 GetSession()->SendPacket(&data);
150}
@ SMSG_ATTACKSWING_BADFACING
Definition: Opcodes.h:356

References GetSession(), WorldSession::SendPacket(), and SMSG_ATTACKSWING_BADFACING.

Referenced by Update().

◆ SendAttackSwingCancelAttack()

◆ SendAttackSwingCantAttack()

void Player::SendAttackSwingCantAttack ( )
135{
137 GetSession()->SendPacket(&data);
138}
@ SMSG_ATTACKSWING_CANT_ATTACK
Definition: Opcodes.h:359

References GetSession(), WorldSession::SendPacket(), and SMSG_ATTACKSWING_CANT_ATTACK.

◆ SendAttackSwingDeadTarget()

void Player::SendAttackSwingDeadTarget ( )
129{
131 GetSession()->SendPacket(&data);
132}
@ SMSG_ATTACKSWING_DEADTARGET
Definition: Opcodes.h:358

References GetSession(), WorldSession::SendPacket(), and SMSG_ATTACKSWING_DEADTARGET.

◆ SendAttackSwingNotInRange()

void Player::SendAttackSwingNotInRange ( )
79{
81 GetSession()->SendPacket(&data);
82}
@ SMSG_ATTACKSWING_NOTINRANGE
Definition: Opcodes.h:355

References GetSession(), WorldSession::SendPacket(), and SMSG_ATTACKSWING_NOTINRANGE.

Referenced by Update().

◆ SendAutoRepeatCancel()

void Player::SendAutoRepeatCancel ( Unit target)
153{
155 data << target->GetPackGUID(); // may be it's target guid
156 SendMessageToSet(&data, true);
157}
@ SMSG_CANCEL_AUTO_REPEAT
Definition: Opcodes.h:698
std::size_t size() const
Definition: ObjectGuid.h:276

References Object::GetPackGUID(), SendMessageToSet(), PackedGuid::size(), and SMSG_CANCEL_AUTO_REPEAT.

Referenced by AuraEffect::HandleFeignDeath(), AuraEffect::HandleModStealth(), and Unit::InterruptSpell().

◆ SendBattlefieldWorldStates()

void Player::SendBattlefieldWorldStates ( )

Send misc stuff that needs to be sent on every login, like the battle timers.

8754{
8756 if (sWorld->getIntConfig(CONFIG_WINTERGRASP_ENABLE) == 1)
8757 {
8758 if (BattlefieldWG* wg = (BattlefieldWG*)sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
8759 {
8762 SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, wg->IsWarTime() ? 0 : 1); // Note: cleanup these two, their names look awkward
8764
8765 for (uint32 i = 0; i < 2; ++i)
8766 SendUpdateWorldState(ClockWorldState[i], uint32(GameTime::GetGameTime().count() + (wg->GetTimer() / 1000)));
8767 }
8768 }
8769}
const uint32 ClockWorldState[2]
Definition: BattlefieldWG.h:42
@ BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE
Definition: BattlefieldWG.h:112
@ BATTLEFIELD_WG_WORLD_STATE_ACTIVE
Definition: BattlefieldWG.h:109
@ BATTLEFIELD_WG_WORLD_STATE_DEFENDER
Definition: BattlefieldWG.h:110
@ BATTLEFIELD_WG_WORLD_STATE_ATTACKER
Definition: BattlefieldWG.h:111
@ CONFIG_WINTERGRASP_ENABLE
Definition: IWorld.h:321
Definition: BattlefieldWG.h:277
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition: PlayerUpdates.cpp:2197

References BATTLEFIELD_BATTLEID_WG, BATTLEFIELD_WG_WORLD_STATE_ACTIVE, BATTLEFIELD_WG_WORLD_STATE_ATTACKER, BATTLEFIELD_WG_WORLD_STATE_DEFENDER, BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE, ClockWorldState, CONFIG_WINTERGRASP_ENABLE, GameTime::GetGameTime(), sBattlefieldMgr, SendUpdateWorldState(), and sWorld.

Referenced by SendInitWorldStates().

◆ SendBGWeekendWorldStates()

void Player::SendBGWeekendWorldStates ( )
8739{
8740 for (uint32 i = 1; i < sBattlemasterListStore.GetNumRows(); ++i)
8741 {
8742 BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(i);
8743 if (bl && bl->HolidayWorldStateId)
8744 {
8747 else
8749 }
8750 }
8751}
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListEntryfmt)
static bool IsBGWeekend(BattlegroundTypeId bgTypeId)
Definition: BattlegroundMgr.cpp:896
Definition: DBCStructure.h:604
uint32 HolidayWorldStateId
Definition: DBCStructure.h:612
uint32 id
Definition: DBCStructure.h:605

References BattlemasterListEntry::HolidayWorldStateId, BattlemasterListEntry::id, BattlegroundMgr::IsBGWeekend(), sBattlemasterListStore, and SendUpdateWorldState().

Referenced by SendInitWorldStates().

◆ SendBuyError()

void Player::SendBuyError ( BuyResult  msg,
Creature creature,
uint32  item,
uint32  param 
)
4087{
4088 LOG_DEBUG("network", "WORLD: Sent SMSG_BUY_FAILED");
4089 WorldPacket data(SMSG_BUY_FAILED, (8 + 4 + 4 + 1));
4090 data << (creature ? creature->GetGUID() : ObjectGuid::Empty);
4091 data << uint32(item);
4092 if (param > 0)
4093 data << uint32(param);
4094 data << uint8(msg);
4095 GetSession()->SendPacket(&data);
4096}
@ SMSG_BUY_FAILED
Definition: Opcodes.h:451

References ObjectGuid::Empty, Object::GetGUID(), GetSession(), LOG_DEBUG, WorldSession::SendPacket(), and SMSG_BUY_FAILED.

Referenced by BuyItemFromVendorSlot(), WorldSession::HandleBuybackItem(), debug_commandscript::HandleDebugSendBuyErrorCommand(), WorldSession::HandlePetitionBuyOpcode(), npc_experience::OnGossipSelect(), OnGossipSelect(), ProcessCastaction(), ProcessUnlearnAction(), and resetTalents().

◆ SendCanTakeQuestResponse()

◆ SendCinematicStart()

void Player::SendCinematicStart ( uint32  CinematicSequenceId) const
5613{
5615 data << uint32(CinematicSequenceId);
5616 SendDirectMessage(&data);
5617 if (CinematicSequencesEntry const* sequence = sCinematicSequencesStore.LookupEntry(CinematicSequenceId))
5618 {
5619 _cinematicMgr->SetActiveCinematicCamera(sequence->cinematicCamera);
5620 }
5621}
DBCStorage< CinematicSequencesEntry > sCinematicSequencesStore(CinematicSequencesEntryfmt)
@ SMSG_TRIGGER_CINEMATIC
Definition: Opcodes.h:280
void SetActiveCinematicCamera(uint32 cinematicCameraId=0)
Definition: CinematicMgr.h:39
Definition: DBCStructure.h:713

References _cinematicMgr, sCinematicSequencesStore, SendDirectMessage(), CinematicMgr::SetActiveCinematicCamera(), and SMSG_TRIGGER_CINEMATIC.

Referenced by debug_commandscript::HandleDebugPlayCinematicCommand(), WorldSession::HandlePlayerLoginFromDB(), and GameObject::Use().

◆ SendClearCooldown()

void Player::SendClearCooldown ( uint32  spell_id,
Unit target 
)

◆ SendCooldownEvent()

void Player::SendCooldownEvent ( SpellInfo const *  spellInfo,
uint32  itemId = 0,
Spell spell = nullptr,
bool  setCooldown = true 
)
11025{
11026 // start cooldowns at server side, if any
11027 if (setCooldown)
11028 AddSpellAndCategoryCooldowns(spellInfo, itemId, spell);
11029
11030 // Send activate cooldown timer (possible 0) at client side
11031 WorldPacket data(SMSG_COOLDOWN_EVENT, 4 + 8);
11032 data << uint32(spellInfo->Id);
11033 data << GetGUID();
11034 SendDirectMessage(&data);
11035}
@ SMSG_COOLDOWN_EVENT
Definition: Opcodes.h:339
void AddSpellAndCategoryCooldowns(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool infinityCooldown=false)
Definition: Player.cpp:10826

References AddSpellAndCategoryCooldowns(), Object::GetGUID(), SpellInfo::Id, SendDirectMessage(), and SMSG_COOLDOWN_EVENT.

Referenced by Spell::_handle_finish_phase(), Aura::_UnapplyForTarget(), Spell::finish(), Unit::RemoveGameObject(), Unit::SetMinion(), and UpdatePotionCooldown().

◆ SendCorpseReclaimDelay()

void Player::SendCorpseReclaimDelay ( uint32  delay)
12894{
12896 data << uint32(delay);
12897 GetSession()->SendPacket(&data);
12898}
@ SMSG_CORPSE_RECLAIM_DELAY
Definition: Opcodes.h:647

References GetSession(), WorldSession::SendPacket(), and SMSG_CORPSE_RECLAIM_DELAY.

Referenced by BuildPlayerRepop(), and KillPlayer().

◆ SendDirectMessage()

void Player::SendDirectMessage ( WorldPacket const *  data) const
5608{
5609 m_session->SendPacket(data);
5610}

References m_session, and WorldSession::SendPacket().

Referenced by Guild::_SendBankList(), Group::AddMember(), AddSpellAndCategoryCooldowns(), Creature::AddSpellCooldown(), AddSpellMod(), DoRandomRoll(), DuelComplete(), Spell::EffectBind(), Spell::EffectPlayMusic(), BGQueueRemoveEvent::Execute(), GiveLevel(), Aura::HandleAuraSpecificMods(), Guild::HandleInviteMember(), npc_spiritual_insight::npc_spiritual_insightAI::IsSummonedBy(), Unit::Kill(), Pet::learnSpell(), QuestApprenticeAnglerPlayerScript::OnPlayerCompleteQuest(), Acore::LocalizedPacketDo< Builder >::operator()(), Acore::LocalizedPacketListDo< Builder >::operator()(), CreatureTextLocalizer< Builder >::operator()(), WorldObject::PlayDirectMusic(), WorldObject::PlayDirectSound(), WorldObject::PlayDistanceSound(), AchievementMgr::RemoveCriteriaProgress(), AchievementMgr::Reset(), CalendarMgr::SendCalendarEvent(), CalendarMgr::SendCalendarEventInvite(), SendCinematicStart(), SendClearCooldown(), Unit::SendComboPoints(), SendCooldownEvent(), AchievementMgr::SendCriteriaUpdate(), SendDurabilityLoss(), WeatherMgr::SendFineWeatherUpdateToPlayer(), ReputationMgr::SendForceReactions(), ReputationMgr::SendInitialReputations(), Map::SendInitSelf(), SendLoot(), SendLootError(), SendLootRelease(), Unit::SendMeleeAttackStart(), SendMirrorTimer(), Unit::SendMovementFeatherFall(), Unit::SendMovementHover(), Unit::SendMovementWaterWalking(), SendMovieStart(), World::SendServerMessage(), Unit::SendSpellNonMeleeReflectLog(), ReputationMgr::SendState(), Unit::SendTameFailure(), SendTaxiNodeStatusMultiple(), SendUpdateWorldState(), ReputationMgr::SendVisible(), Weather::SendWeatherUpdateToPlayer(), Map::SendZoneDynamicInfo(), SetCanFly(), Creature::SetCanFly(), Creature::SetDisableGravity(), SetDisableGravity(), SetFeatherFall(), Creature::SetFeatherFall(), SetHover(), Unit::SetOwnerGUID(), Unit::SetRooted(), SetWaterWalking(), Creature::SetWaterWalking(), StopMirrorTimer(), Pet::unlearnSpell(), Unit::Whisper(), and Whisper().

◆ SendDuelCountdown()

void Player::SendDuelCountdown ( uint32  counter)
15268{
15270 data << uint32(counter); // seconds
15271 GetSession()->SendPacket(&data);
15272}
@ SMSG_DUEL_COUNTDOWN
Definition: Opcodes.h:725

References GetSession(), WorldSession::SendPacket(), and SMSG_DUEL_COUNTDOWN.

Referenced by WorldSession::HandleDuelAcceptedOpcode().

◆ SendDungeonDifficulty()

void Player::SendDungeonDifficulty ( bool  IsInGroup)

◆ SendDurabilityLoss()

void Player::SendDurabilityLoss ( )

◆ SendEnchantmentDurations()

void Player::SendEnchantmentDurations ( )
4747{
4748 for (EnchantDurationList::const_iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr)
4749 {
4750 GetSession()->SendItemEnchantTimeUpdate(GetGUID(), itr->item->GetGUID(), itr->slot, uint32(itr->leftduration) / 1000);
4751 }
4752}

References Object::GetGUID(), GetSession(), m_enchantDuration, and WorldSession::SendItemEnchantTimeUpdate().

Referenced by SendInitialPacketsAfterAddToMap().

◆ SendEquipError()

void Player::SendEquipError ( InventoryResult  msg,
Item pItem,
Item pItem2 = nullptr,
uint32  itemid = 0 
)
4044{
4045 LOG_DEBUG("network", "WORLD: Sent SMSG_INVENTORY_CHANGE_FAILURE ({})", msg);
4047 data << uint8(msg);
4048
4049 if (msg != EQUIP_ERR_OK)
4050 {
4051 data << (pItem ? pItem->GetGUID() : ObjectGuid::Empty);
4052 data << (pItem2 ? pItem2->GetGUID() : ObjectGuid::Empty);
4053 data << uint8(0); // bag type subclass, used with EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM and EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG2
4054
4055 switch (msg)
4056 {
4059 {
4060 ItemTemplate const* proto = pItem ? pItem->GetTemplate() : sObjectMgr->GetItemTemplate(itemid);
4061 data << uint32(proto ? proto->RequiredLevel : 0);
4062 break;
4063 }
4064 case EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM: // no idea about this one...
4065 {
4066 data << ObjectGuid::Empty; // item guid
4067 data << uint32(0); // slot
4068 data << ObjectGuid::Empty; // container
4069 break;
4070 }
4074 {
4075 ItemTemplate const* proto = pItem ? pItem->GetTemplate() : sObjectMgr->GetItemTemplate(itemid);
4076 data << uint32(proto ? proto->ItemLimitCategory : 0);
4077 break;
4078 }
4079 default:
4080 break;
4081 }
4082 }
4083 GetSession()->SendPacket(&data);
4084}
@ EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_SOCKETED_EXCEEDED
Definition: Item.h:125
@ EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM
Definition: Item.h:121
@ EQUIP_ERR_PURCHASE_LEVEL_TOO_LOW
Definition: Item.h:127
@ SMSG_INVENTORY_CHANGE_FAILURE
Definition: Opcodes.h:304
uint32 RequiredLevel
Definition: ItemTemplate.h:645

References ObjectGuid::Empty, EQUIP_ERR_CANT_EQUIP_LEVEL_I, EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM, EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED, EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED, EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_SOCKETED_EXCEEDED, EQUIP_ERR_OK, EQUIP_ERR_PURCHASE_LEVEL_TOO_LOW, Object::GetGUID(), GetSession(), Item::GetTemplate(), ItemTemplate::ItemLimitCategory, LOG_DEBUG, ItemTemplate::RequiredLevel, WorldSession::SendPacket(), SMSG_INVENTORY_CHANGE_FAILURE, and sObjectMgr.

Referenced by _StoreOrEquipNewItem(), AutoStoreLoot(), BuyItemFromVendorSlot(), CanAddQuest(), CanRewardQuest(), CastItemUseSpell(), Spell::CheckItems(), Group::CountTheRoll(), Spell::DoCreateItem(), Spell::EffectRechargeManaGem(), GiveQuestSourceItem(), WorldSession::HandleAcceptTradeOpcode(), misc_commandscript::HandleAddItemSetCommand(), WorldSession::HandleAutoBankItemOpcode(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleAutoStoreBagItemOpcode(), WorldSession::HandleAutoStoreBankItemOpcode(), WorldSession::HandleBuybackItem(), AuraEffect::HandleChannelDeathItem(), debug_commandscript::HandleDebugSendEquipErrorCommand(), WorldSession::HandleDestroyItemOpcode(), WorldSession::HandleEquipmentSetUse(), WorldSession::HandleGuildBankSwapItems(), WorldSession::HandleOpenItemOpcode(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandleReadItem(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSetAmmoOpcode(), WorldSession::HandleSocketOpcode(), WorldSession::HandleSplitItemOpcode(), WorldSession::HandleSwapInvItemOpcode(), WorldSession::HandleSwapItem(), WorldSession::HandleUseItemOpcode(), WorldSession::HandleWrapItemOpcode(), ModifyMoney(), item_petrov_cluster_bombs::OnUse(), item_only_for_flight::OnUse(), item_incendiary_explosives::OnUse(), item_captured_frog::OnUse(), item_gor_dreks_ointment::OnUse(), ProcessUnlearnAction(), SetAmmo(), SplitItem(), StoreLootItem(), SwapItem(), and TakeQuestSourceItem().

◆ SendEquipmentSetList()

void Player::SendEquipmentSetList ( )
14393{
14394 uint32 count = 0;
14396 size_t count_pos = data.wpos();
14397 data << uint32(count); // count placeholder
14398 for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
14399 {
14400 if (itr->second.state == EQUIPMENT_SET_DELETED)
14401 continue;
14402
14403 data.appendPackGUID(itr->second.Guid);
14404 data << uint32(itr->first);
14405 data << itr->second.Name;
14406 data << itr->second.IconName;
14407 for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
14408 {
14409 // ignored slots stored in IgnoreMask, client wants "1" as raw GUID, so no HighGuid::Item
14410 if (itr->second.IgnoreMask & (1 << i))
14411 data.appendPackGUID(uint64(1));
14412 else // xinef: send proper data (do not append 0 with high guid)
14413 data.appendPackGUID(itr->second.Items[i] ? itr->second.Items[i].GetRawValue() : uint64(0));
14414 }
14415
14416 ++count; // client have limit but it checked at loading and set
14417 }
14418 data.put<uint32>(count_pos, count);
14419 GetSession()->SendPacket(&data);
14420}
@ SMSG_EQUIPMENT_SET_LIST
Definition: Opcodes.h:1242

References ByteBuffer::appendPackGUID(), EQUIPMENT_SET_DELETED, EQUIPMENT_SLOT_END, GetSession(), m_EquipmentSets, ByteBuffer::put(), WorldSession::SendPacket(), SMSG_EQUIPMENT_SET_LIST, and ByteBuffer::wpos().

Referenced by SendInitialPacketsBeforeAddToMap().

◆ SendExplorationExperience()

void Player::SendExplorationExperience ( uint32  Area,
uint32  Experience 
)
160{
162 data << uint32(Area);
163 data << uint32(Experience);
164 GetSession()->SendPacket(&data);
165}
@ SMSG_EXPLORATION_EXPERIENCE
Definition: Opcodes.h:534

References GetSession(), WorldSession::SendPacket(), and SMSG_EXPLORATION_EXPERIENCE.

Referenced by CheckAreaExploreAndOutdoor().

◆ SendInitialActionButtons()

void Player::SendInitialActionButtons ( ) const
inline

◆ SendInitialPacketsAfterAddToMap()

void Player::SendInitialPacketsAfterAddToMap ( )
11551{
11553
11556
11557 CastSpell(this, 836, true); // LOGINEFFECT
11558
11559 // set some aura effects that send packet to player client after add player to map
11560 // SendMessageToSet not send it to player not it map, only for aura that not changed anything at re-apply
11561 // same auras state lost at far teleport, send it one more time in this case also
11562 static const AuraType auratypes[] =
11563 {
11567 };
11568 for (AuraType const* itr = &auratypes[0]; itr && itr[0] != SPELL_AURA_NONE; ++itr)
11569 {
11570 Unit::AuraEffectList const& auraList = GetAuraEffectsByType(*itr);
11571 if (!auraList.empty())
11572 auraList.front()->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
11573 }
11574
11575 // Fix mount, update block gets messed somewhere
11576 {
11578 {
11579 AddAura(GetMountBlockId(), this);
11580 SetMountBlockId(0);
11581 }
11582 }
11583
11584 // update zone
11585 uint32 newzone, newarea;
11586 GetZoneAndAreaId(newzone, newarea);
11587 UpdateZone(newzone, newarea); // also call SendInitWorldStates();
11588
11591
11592 // manual send package (have code in HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); that must not be re-applied.
11594 {
11596 data2 << GetPackGUID();
11597 data2 << (uint32)2;
11598 SendMessageToSet(&data2, true);
11599 }
11600
11601 SendEnchantmentDurations(); // must be after add to map
11602 SendItemDurations(); // must be after add to map
11605
11606 // raid downscaling - send difficulty to player
11607 if (GetMap()->IsRaid())
11608 {
11610 {
11613 }
11614 }
11616 SendRaidDifficulty(GetGroup() != nullptr);
11617}
AuraType
Definition: SpellAuraDefines.h:62
@ SPELL_AURA_TRANSFORM
Definition: SpellAuraDefines.h:119
@ SPELL_AURA_NONE
Definition: SpellAuraDefines.h:63
@ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT
Definition: SpellAuraDefines.h:43
@ SMSG_FORCE_MOVE_ROOT
Definition: Opcodes.h:262
void UpdateVisibilityForPlayer(bool mapChange=false)
Definition: PlayerUpdates.cpp:1546
uint32 GetMountBlockId()
Definition: Player.h:2567
void SendTaxiNodeStatusMultiple()
Definition: Player.cpp:10422
Difficulty GetStoredRaidDifficulty() const
Definition: Player.h:1886
void SendEnchantmentDurations()
Definition: PlayerStorage.cpp:4746
void SendItemDurations()
Definition: PlayerStorage.cpp:4762
void SendRaidDifficulty(bool IsInGroup, int32 forcedDifficulty=-1)
Definition: PlayerMisc.cpp:177
void SendTimeSync()
Definition: WorldSession.cpp:1642
void ResetTimeSync()
Definition: WorldSession.cpp:1636

References Unit::AddAura(), AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, Unit::CastSpell(), Unit::GetAuraEffectsByType(), GetDifficulty(), GetGroup(), WorldObject::GetMap(), GetMountBlockId(), Object::GetPackGUID(), GetRaidDifficulty(), GetSession(), GetStoredRaidDifficulty(), WorldObject::GetZoneAndAreaId(), Unit::HasAuraType(), isBeingLoaded(), MOVE_ROOT, WorldSession::ResetTimeSync(), SendEnchantmentDurations(), SendItemDurations(), SendMessageToSet(), SendQuestGiverStatusMultiple(), SendRaidDifficulty(), SendTaxiNodeStatusMultiple(), WorldSession::SendTimeSync(), SetMountBlockId(), SetMovement(), SMSG_FORCE_MOVE_ROOT, SPELL_AURA_FEATHER_FALL, SPELL_AURA_FLY, SPELL_AURA_HOVER, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_MOUNTED, SPELL_AURA_NONE, SPELL_AURA_SAFE_FALL, SPELL_AURA_TRANSFORM, SPELL_AURA_WATER_WALK, StoreRaidMapDifficulty(), UpdateVisibilityForPlayer(), and UpdateZone().

Referenced by WorldSession::HandleMoveWorldportAck(), WorldSession::HandlePlayerLoginFromDB(), and WorldSession::HandlePlayerLoginToCharInWorld().

◆ SendInitialPacketsBeforeAddToMap()

void Player::SendInitialPacketsBeforeAddToMap ( )

Pass 'this' as argument because we're not stored in ObjectAccessor yet

11494{
11497
11498 // guild bank list?
11499
11500 // Homebind
11501 WorldPacket data(SMSG_BINDPOINTUPDATE, 5 * 4);
11502 data << m_homebindX << m_homebindY << m_homebindZ;
11503 data << (uint32) m_homebindMapId;
11504 data << (uint32) m_homebindAreaId;
11505 GetSession()->SendPacket(&data);
11506
11507 // SMSG_SET_PROFICIENCY
11508 // SMSG_SET_PCT_SPELL_MODIFIER
11509 // SMSG_SET_FLAT_SPELL_MODIFIER
11510 // SMSG_UPDATE_AURA_DURATION
11511
11512 SendTalentsInfoData(false);
11513
11514 // SMSG_INSTANCE_DIFFICULTY
11515 data.Initialize(SMSG_INSTANCE_DIFFICULTY, 4 + 4);
11516 data << uint32(GetMap()->GetDifficulty());
11517 data << uint32(GetMap()->GetEntry()->IsDynamicDifficultyMap() && GetMap()->IsHeroic()); // Raid dynamic difficulty
11518 GetSession()->SendPacket(&data);
11519
11521
11522 data.Initialize(SMSG_SEND_UNLEARN_SPELLS, 4);
11523 data << uint32(0); // count, for (count) uint32;
11524 GetSession()->SendPacket(&data);
11525
11529
11531
11532 data.Initialize(SMSG_LOGIN_SETTIMESPEED, 4 + 4 + 4);
11533 data.AppendPackedTime(GameTime::GetGameTime().count());
11534 data << float(0.01666667f); // game speed
11535 data << uint32(0); // added in 3.1.2
11536 GetSession()->SendPacket(&data);
11537
11538 GetReputationMgr().SendForceReactions(); // SMSG_SET_FORCED_REACTIONS
11539
11540 // SMSG_TALENTS_INFO x 2 for pet (unspent points and talents in separate packets...)
11541 // SMSG_PET_GUIDS
11542 // SMSG_UPDATE_WORLD_STATE
11543 // SMSG_POWER_UPDATE
11544
11545 SetMover(this);
11546
11547 sScriptMgr->OnSendInitialPacketsBeforeAddToMap(this, data);
11548}
@ SMSG_INSTANCE_DIFFICULTY
Definition: Opcodes.h:857
@ SMSG_BINDPOINTUPDATE
Definition: Opcodes.h:371
@ SMSG_LOGIN_SETTIMESPEED
Definition: Opcodes.h:96
@ SMSG_SEND_UNLEARN_SPELLS
Definition: Opcodes.h:1084
void SendAllAchievementData() const
Definition: AchievementMgr.cpp:2339
void SendInitialSpells()
Definition: Player.cpp:2716
PlayerSocial * GetSocial()
Definition: Player.h:1131
void SendInitialActionButtons() const
Definition: Player.h:1806
void SendEquipmentSetList()
Definition: Player.cpp:14392
void SetMover(Unit *target)
Definition: Player.cpp:12812
void SendSocialList(Player *player, uint32 flags)
Definition: SocialMgr.cpp:124
void SendInitialReputations()
Definition: ReputationMgr.cpp:211
void SendForceReactions()
Definition: ReputationMgr.cpp:165

References ByteBuffer::AppendPackedTime(), GetDifficulty(), Object::GetEntry(), GameTime::GetGameTime(), WorldObject::GetMap(), GetReputationMgr(), GetSession(), GetSocial(), WorldPacket::Initialize(), m_achievementMgr, m_homebindAreaId, m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, m_reputationMgr, AchievementMgr::SendAllAchievementData(), SendEquipmentSetList(), ReputationMgr::SendForceReactions(), SendInitialActionButtons(), ReputationMgr::SendInitialReputations(), SendInitialSpells(), WorldSession::SendPacket(), PlayerSocial::SendSocialList(), SendTalentsInfoData(), SetMover(), SMSG_BINDPOINTUPDATE, SMSG_INSTANCE_DIFFICULTY, SMSG_LOGIN_SETTIMESPEED, SMSG_SEND_UNLEARN_SPELLS, SOCIAL_FLAG_ALL, and sScriptMgr.

Referenced by WorldSession::HandleMoveWorldportAck(), WorldSession::HandlePlayerLoginFromDB(), and WorldSession::HandlePlayerLoginToCharInWorld().

◆ SendInitialSpells()

void Player::SendInitialSpells ( )
2717{
2718 uint32 curTime = GameTime::GetGameTimeMS().count();
2720
2721 uint16 spellCount = 0;
2722
2723 WorldPacket data(SMSG_INITIAL_SPELLS, (1 + 2 + 4 * m_spells.size() + 2 + m_spellCooldowns.size() * (4 + 2 + 2 + 4 + 4)));
2724 data << uint8(0);
2725
2726 size_t countPos = data.wpos();
2727 data << uint16(spellCount); // spell count placeholder
2728
2729 for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
2730 {
2731 if (itr->second->State == PLAYERSPELL_REMOVED)
2732 continue;
2733
2734 if (!itr->second->Active || !itr->second->IsInSpec(GetActiveSpec()))
2735 continue;
2736
2737 data << uint32(itr->first);
2738 data << uint16(0); // it's not slot id
2739
2740 ++spellCount;
2741 }
2742
2743 // Added spells from glyphs too (needed by spell tooltips)
2744 for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
2745 {
2746 if (uint32 glyph = GetGlyph(i))
2747 {
2748 if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyph))
2749 {
2750 data << uint32(glyphEntry->SpellId);
2751 data << uint16(0); // it's not slot id
2752
2753 ++spellCount;
2754 }
2755 }
2756 }
2757
2758 // xinef: we have to send talents, but not those on m_spells list
2759 for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr)
2760 {
2761 if (itr->second->State == PLAYERSPELL_REMOVED)
2762 continue;
2763
2764 // xinef: remove all active talent auras
2765 if (!(itr->second->specMask & GetActiveSpecMask()))
2766 continue;
2767
2768 // xinef: already sent from m_spells
2769 if (itr->second->inSpellBook)
2770 continue;
2771
2772 data << uint32(itr->first);
2773 data << uint16(0); // it's not slot id
2774
2775 ++spellCount;
2776 }
2777
2778 data.put<uint16>(countPos, spellCount); // write real count value
2779
2780 uint16 spellCooldowns = m_spellCooldowns.size();
2781 data << uint16(spellCooldowns);
2782 for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr)
2783 {
2784 if (!itr->second.needSendToClient)
2785 continue;
2786
2787 SpellInfo const* sEntry = sSpellMgr->GetSpellInfo(itr->first);
2788 if (!sEntry)
2789 continue;
2790
2791 data << uint32(itr->first);
2792
2793 data << uint16(itr->second.itemid); // cast item id
2794 data << uint16(itr->second.category); // spell category
2795
2796 // send infinity cooldown in special format
2797 if (itr->second.end >= infTime)
2798 {
2799 data << uint32(1); // cooldown
2800 data << uint32(0x80000000); // category cooldown
2801 continue;
2802 }
2803
2804 uint32 cooldown = itr->second.end > curTime ? itr->second.end - curTime : 0;
2805 data << uint32(itr->second.category ? 0 : cooldown); // cooldown
2806 data << uint32(itr->second.category ? cooldown : 0); // category cooldown
2807 }
2808
2809 GetSession()->SendPacket(&data);
2810}
@ SMSG_INITIAL_SPELLS
Definition: Opcodes.h:328

References GetActiveSpec(), GetActiveSpecMask(), GameTime::GetGameTimeMS(), GetGlyph(), GetSession(), infinityCooldownDelayCheck, m_spellCooldowns, m_spells, m_talents, MAX_GLYPH_SLOT_INDEX, PLAYERSPELL_REMOVED, ByteBuffer::put(), WorldSession::SendPacket(), sGlyphPropertiesStore, SMSG_INITIAL_SPELLS, sSpellMgr, and ByteBuffer::wpos().

Referenced by SendInitialPacketsBeforeAddToMap().

◆ SendInitWorldStates()

void Player::SendInitWorldStates ( uint32  zone,
uint32  area 
)
8100{
8101 // data depends on zoneid/mapid...
8103 uint32 mapid = GetMapId();
8104 OutdoorPvP* pvp = sOutdoorPvPMgr->GetOutdoorPvPToZoneId(zoneid);
8105 InstanceScript* instance = GetInstanceScript();
8106 Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(zoneid);
8107
8108 LOG_DEBUG("network", "Sending SMSG_INIT_WORLD_STATES to Map: {}, Zone: {}", mapid, zoneid);
8109
8110 WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (12 * 8)));
8111 data << uint32(mapid); // mapid
8112 data << uint32(zoneid); // zone id
8113 data << uint32(areaid); // area id, new 2.1.0
8114 size_t countPos = data.wpos();
8115 data << uint16(0); // count of uint64 blocks
8116 data << uint32(0x8d8) << uint32(0x0); // 1
8117 data << uint32(0x8d7) << uint32(0x0); // 2
8118 data << uint32(0x8d6) << uint32(0x0); // 3
8119 data << uint32(0x8d5) << uint32(0x0); // 4
8120 data << uint32(0x8d4) << uint32(0x0); // 5
8121 data << uint32(0x8d3) << uint32(0x0); // 6
8122 // 7 1 - Arena season in progress, 0 - end of season
8123 data << uint32(0xC77) << uint32(sWorld->getBoolConfig(CONFIG_ARENA_SEASON_IN_PROGRESS));
8124 // 8 Arena season id
8125 data << uint32(0xF3D) << uint32(sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID));
8126
8127 if (mapid == 530) // Outland
8128 {
8129 data << uint32(0x9bf) << uint32(0x0); // 7
8130 data << uint32(0x9bd) << uint32(0xF); // 8
8131 data << uint32(0x9bb) << uint32(0xF); // 9
8132 }
8133
8135 {
8136 Player::bgZoneIdToFillWorldStates[zoneid](bg, data);
8137 }
8138 else
8139 {
8140 // insert <field> <value>
8141 switch (zoneid)
8142 {
8143 case 1: // Dun Morogh
8144 case 11: // Wetlands
8145 case 12: // Elwynn Forest
8146 case 38: // Loch Modan
8147 case 40: // Westfall
8148 case 51: // Searing Gorge
8149 case 1519: // Stormwind City
8150 case 1537: // Ironforge
8151 case 2257: // Deeprun Tram
8152 case 3703: // Shattrath City
8153 break;
8154 case 139: // Eastern Plaguelands
8155 if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_EP)
8156 pvp->FillInitialWorldStates(data);
8157 else
8158 {
8159 data << uint32(0x97a) << uint32(0x0); // 10 2426
8160 data << uint32(0x917) << uint32(0x0); // 11 2327
8161 data << uint32(0x918) << uint32(0x0); // 12 2328
8162 data << uint32(0x97b) << uint32(0x32); // 13 2427
8163 data << uint32(0x97c) << uint32(0x32); // 14 2428
8164 data << uint32(0x933) << uint32(0x1); // 15 2355
8165 data << uint32(0x946) << uint32(0x0); // 16 2374
8166 data << uint32(0x947) << uint32(0x0); // 17 2375
8167 data << uint32(0x948) << uint32(0x0); // 18 2376
8168 data << uint32(0x949) << uint32(0x0); // 19 2377
8169 data << uint32(0x94a) << uint32(0x0); // 20 2378
8170 data << uint32(0x94b) << uint32(0x0); // 21 2379
8171 data << uint32(0x932) << uint32(0x0); // 22 2354
8172 data << uint32(0x934) << uint32(0x0); // 23 2356
8173 data << uint32(0x935) << uint32(0x0); // 24 2357
8174 data << uint32(0x936) << uint32(0x0); // 25 2358
8175 data << uint32(0x937) << uint32(0x0); // 26 2359
8176 data << uint32(0x938) << uint32(0x0); // 27 2360
8177 data << uint32(0x939) << uint32(0x1); // 28 2361
8178 data << uint32(0x930) << uint32(0x1); // 29 2352
8179 data << uint32(0x93a) << uint32(0x0); // 30 2362
8180 data << uint32(0x93b) << uint32(0x0); // 31 2363
8181 data << uint32(0x93c) << uint32(0x0); // 32 2364
8182 data << uint32(0x93d) << uint32(0x0); // 33 2365
8183 data << uint32(0x944) << uint32(0x0); // 34 2372
8184 data << uint32(0x945) << uint32(0x0); // 35 2373
8185 data << uint32(0x931) << uint32(0x1); // 36 2353
8186 data << uint32(0x93e) << uint32(0x0); // 37 2366
8187 data << uint32(0x931) << uint32(0x1); // 38 2367 ?? grey horde not in dbc! send for consistency's sake, and to match field count
8188 data << uint32(0x940) << uint32(0x0); // 39 2368
8189 data << uint32(0x941) << uint32(0x0); // 7 2369
8190 data << uint32(0x942) << uint32(0x0); // 8 2370
8191 data << uint32(0x943) << uint32(0x0); // 9 2371
8192 }
8193 break;
8194 case 1377: // Silithus
8195 if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_SI)
8196 pvp->FillInitialWorldStates(data);
8197 else
8198 {
8199 // states are always shown
8200 data << uint32(2313) << uint32(0x0); // 7 ally silityst gathered
8201 data << uint32(2314) << uint32(0x0); // 8 horde silityst gathered
8202 data << uint32(2317) << uint32(0x0); // 9 max silithyst
8203 }
8204 // dunno about these... aq opening event maybe?
8205 data << uint32(2322) << uint32(0x0); // 10 sandworm N
8206 data << uint32(2323) << uint32(0x0); // 11 sandworm S
8207 data << uint32(2324) << uint32(0x0); // 12 sandworm SW
8208 data << uint32(2325) << uint32(0x0); // 13 sandworm E
8209 break;
8210 case 2597: // Alterac Valley
8211 if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_AV)
8212 bg->FillInitialWorldStates(data);
8213 else
8214 {
8215 data << uint32(0x7ae) << uint32(0x1); // 7 snowfall n
8216 data << uint32(0x532) << uint32(0x1); // 8 frostwolfhut hc
8217 data << uint32(0x531) << uint32(0x0); // 9 frostwolfhut ac
8218 data << uint32(0x52e) << uint32(0x0); // 10 stormpike firstaid a_a
8219 data << uint32(0x571) << uint32(0x0); // 11 east frostwolf tower horde assaulted -unused
8220 data << uint32(0x570) << uint32(0x0); // 12 west frostwolf tower horde assaulted - unused
8221 data << uint32(0x567) << uint32(0x1); // 13 frostwolfe c
8222 data << uint32(0x566) << uint32(0x1); // 14 frostwolfw c
8223 data << uint32(0x550) << uint32(0x1); // 15 irondeep (N) ally
8224 data << uint32(0x544) << uint32(0x0); // 16 ice grave a_a
8225 data << uint32(0x536) << uint32(0x0); // 17 stormpike grave h_c
8226 data << uint32(0x535) << uint32(0x1); // 18 stormpike grave a_c
8227 data << uint32(0x518) << uint32(0x0); // 19 stoneheart grave a_a
8228 data << uint32(0x517) << uint32(0x0); // 20 stoneheart grave h_a
8229 data << uint32(0x574) << uint32(0x0); // 21 1396 unk
8230 data << uint32(0x573) << uint32(0x0); // 22 iceblood tower horde assaulted -unused
8231 data << uint32(0x572) << uint32(0x0); // 23 towerpoint horde assaulted - unused
8232 data << uint32(0x56f) << uint32(0x0); // 24 1391 unk
8233 data << uint32(0x56e) << uint32(0x0); // 25 iceblood a
8234 data << uint32(0x56d) << uint32(0x0); // 26 towerp a
8235 data << uint32(0x56c) << uint32(0x0); // 27 frostwolfe a
8236 data << uint32(0x56b) << uint32(0x0); // 28 froswolfw a
8237 data << uint32(0x56a) << uint32(0x1); // 29 1386 unk
8238 data << uint32(0x569) << uint32(0x1); // 30 iceblood c
8239 data << uint32(0x568) << uint32(0x1); // 31 towerp c
8240 data << uint32(0x565) << uint32(0x0); // 32 stoneh tower a
8241 data << uint32(0x564) << uint32(0x0); // 33 icewing tower a
8242 data << uint32(0x563) << uint32(0x0); // 34 dunn a
8243 data << uint32(0x562) << uint32(0x0); // 35 duns a
8244 data << uint32(0x561) << uint32(0x0); // 36 stoneheart bunker alliance assaulted - unused
8245 data << uint32(0x560) << uint32(0x0); // 37 icewing bunker alliance assaulted - unused
8246 data << uint32(0x55f) << uint32(0x0); // 38 dunbaldar south alliance assaulted - unused
8247 data << uint32(0x55e) << uint32(0x0); // 39 dunbaldar north alliance assaulted - unused
8248 data << uint32(0x55d) << uint32(0x0); // 40 stone tower d
8249 data << uint32(0x3c6) << uint32(0x0); // 41 966 unk
8250 data << uint32(0x3c4) << uint32(0x0); // 42 964 unk
8251 data << uint32(0x3c2) << uint32(0x0); // 43 962 unk
8252 data << uint32(0x516) << uint32(0x1); // 44 stoneheart grave a_c
8253 data << uint32(0x515) << uint32(0x0); // 45 stonheart grave h_c
8254 data << uint32(0x3b6) << uint32(0x0); // 46 950 unk
8255 data << uint32(0x55c) << uint32(0x0); // 47 icewing tower d
8256 data << uint32(0x55b) << uint32(0x0); // 48 dunn d
8257 data << uint32(0x55a) << uint32(0x0); // 49 duns d
8258 data << uint32(0x559) << uint32(0x0); // 50 1369 unk
8259 data << uint32(0x558) << uint32(0x0); // 51 iceblood d
8260 data << uint32(0x557) << uint32(0x0); // 52 towerp d
8261 data << uint32(0x556) << uint32(0x0); // 53 frostwolfe d
8262 data << uint32(0x555) << uint32(0x0); // 54 frostwolfw d
8263 data << uint32(0x554) << uint32(0x1); // 55 stoneh tower c
8264 data << uint32(0x553) << uint32(0x1); // 56 icewing tower c
8265 data << uint32(0x552) << uint32(0x1); // 57 dunn c
8266 data << uint32(0x551) << uint32(0x1); // 58 duns c
8267 data << uint32(0x54f) << uint32(0x0); // 59 irondeep (N) horde
8268 data << uint32(0x54e) << uint32(0x0); // 60 irondeep (N) ally
8269 data << uint32(0x54d) << uint32(0x1); // 61 mine (S) neutral
8270 data << uint32(0x54c) << uint32(0x0); // 62 mine (S) horde
8271 data << uint32(0x54b) << uint32(0x0); // 63 mine (S) ally
8272 data << uint32(0x545) << uint32(0x0); // 64 iceblood h_a
8273 data << uint32(0x543) << uint32(0x1); // 65 iceblod h_c
8274 data << uint32(0x542) << uint32(0x0); // 66 iceblood a_c
8275 data << uint32(0x540) << uint32(0x0); // 67 snowfall h_a
8276 data << uint32(0x53f) << uint32(0x0); // 68 snowfall a_a
8277 data << uint32(0x53e) << uint32(0x0); // 69 snowfall h_c
8278 data << uint32(0x53d) << uint32(0x0); // 70 snowfall a_c
8279 data << uint32(0x53c) << uint32(0x0); // 71 frostwolf g h_a
8280 data << uint32(0x53b) << uint32(0x0); // 72 frostwolf g a_a
8281 data << uint32(0x53a) << uint32(0x1); // 73 frostwolf g h_c
8282 data << uint32(0x539) << uint32(0x0); // 74 frostwolf g a_c
8283 data << uint32(0x538) << uint32(0x0); // 75 stormpike grave h_a
8284 data << uint32(0x537) << uint32(0x0); // 76 stormpike grave a_a
8285 data << uint32(0x534) << uint32(0x0); // 77 frostwolf hut h_a
8286 data << uint32(0x533) << uint32(0x0); // 78 frostwolf hut a_a
8287 data << uint32(0x530) << uint32(0x0); // 79 stormpike first aid h_a
8288 data << uint32(0x52f) << uint32(0x0); // 80 stormpike first aid h_c
8289 data << uint32(0x52d) << uint32(0x1); // 81 stormpike first aid a_c
8290 }
8291 break;
8292 case 3277: // Warsong Gulch
8293 if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_WS)
8294 bg->FillInitialWorldStates(data);
8295 else
8296 {
8297 data << uint32(0x62d) << uint32(0x0); // 7 1581 alliance flag captures
8298 data << uint32(0x62e) << uint32(0x0); // 8 1582 horde flag captures
8299 data << uint32(0x609) << uint32(0x0); // 9 1545 unk, set to 1 on alliance flag pickup...
8300 data << uint32(0x60a) << uint32(0x0); // 10 1546 unk, set to 1 on horde flag pickup, after drop it's -1
8301 data << uint32(0x60b) << uint32(0x2); // 11 1547 unk
8302 data << uint32(0x641) << uint32(0x3); // 12 1601 unk (max flag captures?)
8303 data << uint32(0x922) << uint32(0x1); // 13 2338 horde (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing)
8304 data << uint32(0x923) << uint32(0x1); // 14 2339 alliance (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing)
8305 }
8306 break;
8307 case 3358: // Arathi Basin
8308 if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_AB)
8309 bg->FillInitialWorldStates(data);
8310 else
8311 {
8312 data << uint32(0x6e7) << uint32(0x0); // 7 1767 stables alliance
8313 data << uint32(0x6e8) << uint32(0x0); // 8 1768 stables horde
8314 data << uint32(0x6e9) << uint32(0x0); // 9 1769 unk, ST?
8315 data << uint32(0x6ea) << uint32(0x0); // 10 1770 stables (show/hide)
8316 data << uint32(0x6ec) << uint32(0x0); // 11 1772 farm (0 - horde controlled, 1 - alliance controlled)
8317 data << uint32(0x6ed) << uint32(0x0); // 12 1773 farm (show/hide)
8318 data << uint32(0x6ee) << uint32(0x0); // 13 1774 farm color
8319 data << uint32(0x6ef) << uint32(0x0); // 14 1775 gold mine color, may be FM?
8320 data << uint32(0x6f0) << uint32(0x0); // 15 1776 alliance resources
8321 data << uint32(0x6f1) << uint32(0x0); // 16 1777 horde resources
8322 data << uint32(0x6f2) << uint32(0x0); // 17 1778 horde bases
8323 data << uint32(0x6f3) << uint32(0x0); // 18 1779 alliance bases
8324 data << uint32(0x6f4) << uint32(0x640); // 19 1780 max resources (1600)
8325 data << uint32(0x6f6) << uint32(0x0); // 20 1782 blacksmith color
8326 data << uint32(0x6f7) << uint32(0x0); // 21 1783 blacksmith (show/hide)
8327 data << uint32(0x6f8) << uint32(0x0); // 22 1784 unk, bs?
8328 data << uint32(0x6f9) << uint32(0x0); // 23 1785 unk, bs?
8329 data << uint32(0x6fb) << uint32(0x0); // 24 1787 gold mine (0 - horde contr, 1 - alliance contr)
8330 data << uint32(0x6fc) << uint32(0x0); // 25 1788 gold mine (0 - conflict, 1 - horde)
8331 data << uint32(0x6fd) << uint32(0x0); // 26 1789 gold mine (1 - show/0 - hide)
8332 data << uint32(0x6fe) << uint32(0x0); // 27 1790 gold mine color
8333 data << uint32(0x700) << uint32(0x0); // 28 1792 gold mine color, may be LM?
8334 data << uint32(0x701) << uint32(0x0); // 29 1793 lumber mill color (0 - conflict, 1 - horde contr)
8335 data << uint32(0x702) << uint32(0x0); // 30 1794 lumber mill (show/hide)
8336 data << uint32(0x703) << uint32(0x0); // 31 1795 lumber mill color color
8337 data << uint32(0x732) << uint32(0x1); // 32 1842 stables (1 - uncontrolled)
8338 data << uint32(0x733) << uint32(0x1); // 33 1843 gold mine (1 - uncontrolled)
8339 data << uint32(0x734) << uint32(0x1); // 34 1844 lumber mill (1 - uncontrolled)
8340 data << uint32(0x735) << uint32(0x1); // 35 1845 farm (1 - uncontrolled)
8341 data << uint32(0x736) << uint32(0x1); // 36 1846 blacksmith (1 - uncontrolled)
8342 data << uint32(0x745) << uint32(0x2); // 37 1861 unk
8343 data << uint32(0x7a3) << uint32(0x578); // 38 1955 warning limit (1400)
8344 }
8345 break;
8346 case 3820: // Eye of the Storm
8347 if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_EY)
8348 bg->FillInitialWorldStates(data);
8349 else
8350 {
8351 data << uint32(0xac1) << uint32(0x0); // 7 2753 Horde Bases
8352 data << uint32(0xac0) << uint32(0x0); // 8 2752 Alliance Bases
8353 data << uint32(0xab6) << uint32(0x0); // 9 2742 Mage Tower - Horde conflict
8354 data << uint32(0xab5) << uint32(0x0); // 10 2741 Mage Tower - Alliance conflict
8355 data << uint32(0xab4) << uint32(0x0); // 11 2740 Fel Reaver - Horde conflict
8356 data << uint32(0xab3) << uint32(0x0); // 12 2739 Fel Reaver - Alliance conflict
8357 data << uint32(0xab2) << uint32(0x0); // 13 2738 Draenei - Alliance conflict
8358 data << uint32(0xab1) << uint32(0x0); // 14 2737 Draenei - Horde conflict
8359 data << uint32(0xab0) << uint32(0x0); // 15 2736 unk // 0 at start
8360 data << uint32(0xaaf) << uint32(0x0); // 16 2735 unk // 0 at start
8361 data << uint32(0xaad) << uint32(0x0); // 17 2733 Draenei - Horde control
8362 data << uint32(0xaac) << uint32(0x0); // 18 2732 Draenei - Alliance control
8363 data << uint32(0xaab) << uint32(0x1); // 19 2731 Draenei uncontrolled (1 - yes, 0 - no)
8364 data << uint32(0xaaa) << uint32(0x0); // 20 2730 Mage Tower - Alliance control
8365 data << uint32(0xaa9) << uint32(0x0); // 21 2729 Mage Tower - Horde control
8366 data << uint32(0xaa8) << uint32(0x1); // 22 2728 Mage Tower uncontrolled (1 - yes, 0 - no)
8367 data << uint32(0xaa7) << uint32(0x0); // 23 2727 Fel Reaver - Horde control
8368 data << uint32(0xaa6) << uint32(0x0); // 24 2726 Fel Reaver - Alliance control
8369 data << uint32(0xaa5) << uint32(0x1); // 25 2725 Fel Reaver uncontrolled (1 - yes, 0 - no)
8370 data << uint32(0xaa4) << uint32(0x0); // 26 2724 Boold Elf - Horde control
8371 data << uint32(0xaa3) << uint32(0x0); // 27 2723 Boold Elf - Alliance control
8372 data << uint32(0xaa2) << uint32(0x1); // 28 2722 Boold Elf uncontrolled (1 - yes, 0 - no)
8373 data << uint32(0xac5) << uint32(0x1); // 29 2757 Flag (1 - show, 0 - hide) - doesn't work exactly this way!
8374 data << uint32(0xad2) << uint32(0x1); // 30 2770 Horde top-stats (1 - show, 0 - hide) // 02 -> horde picked up the flag
8375 data << uint32(0xad1) << uint32(0x1); // 31 2769 Alliance top-stats (1 - show, 0 - hide) // 02 -> alliance picked up the flag
8376 data << uint32(0xabe) << uint32(0x0); // 32 2750 Horde resources
8377 data << uint32(0xabd) << uint32(0x0); // 33 2749 Alliance resources
8378 data << uint32(0xa05) << uint32(0x8e); // 34 2565 unk, constant?
8379 data << uint32(0xaa0) << uint32(0x0); // 35 2720 Capturing progress-bar (100 -> empty (only grey), 0 -> blue|red (no grey), default 0)
8380 data << uint32(0xa9f) << uint32(0x0); // 36 2719 Capturing progress-bar (0 - left, 100 - right)
8381 data << uint32(0xa9e) << uint32(0x0); // 37 2718 Capturing progress-bar (1 - show, 0 - hide)
8382 data << uint32(0xc0d) << uint32(0x17b); // 38 3085 unk
8383 // and some more ... unknown
8384 }
8385 break;
8386 // any of these needs change! the client remembers the prev setting!
8387 // ON EVERY ZONE LEAVE, RESET THE OLD ZONE'S WORLD STATE, BUT AT LEAST THE UI STUFF!
8388 case 3483: // Hellfire Peninsula
8389 if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_HP)
8390 pvp->FillInitialWorldStates(data);
8391 else
8392 {
8393 data << uint32(0x9ba) << uint32(0x1); // 10 // add ally tower main gui icon // maybe should be sent only on login?
8394 data << uint32(0x9b9) << uint32(0x1); // 11 // add horde tower main gui icon // maybe should be sent only on login?
8395 data << uint32(0x9b5) << uint32(0x0); // 12 // show neutral broken hill icon // 2485
8396 data << uint32(0x9b4) << uint32(0x1); // 13 // show icon above broken hill // 2484
8397 data << uint32(0x9b3) << uint32(0x0); // 14 // show ally broken hill icon // 2483
8398 data << uint32(0x9b2) << uint32(0x0); // 15 // show neutral overlook icon // 2482
8399 data << uint32(0x9b1) << uint32(0x1); // 16 // show the overlook arrow // 2481
8400 data << uint32(0x9b0) << uint32(0x0); // 17 // show ally overlook icon // 2480
8401 data << uint32(0x9ae) << uint32(0x0); // 18 // horde pvp objectives captured // 2478
8402 data << uint32(0x9ac) << uint32(0x0); // 19 // ally pvp objectives captured // 2476
8403 data << uint32(2475) << uint32(100); //: ally / horde slider grey area // show only in direct vicinity!
8404 data << uint32(2474) << uint32(50); //: ally / horde slider percentage, 100 for ally, 0 for horde // show only in direct vicinity!
8405 data << uint32(2473) << uint32(0); //: ally / horde slider display // show only in direct vicinity!
8406 data << uint32(0x9a8) << uint32(0x0); // 20 // show the neutral stadium icon // 2472
8407 data << uint32(0x9a7) << uint32(0x0); // 21 // show the ally stadium icon // 2471
8408 data << uint32(0x9a6) << uint32(0x1); // 22 // show the horde stadium icon // 2470
8409 }
8410 break;
8411 case 3518: // Nagrand
8412 if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_NA)
8413 pvp->FillInitialWorldStates(data);
8414 else
8415 {
8416 data << uint32(2503) << uint32(0x0); // 10
8417 data << uint32(2502) << uint32(0x0); // 11
8418 data << uint32(2493) << uint32(0x0); // 12
8419 data << uint32(2491) << uint32(0x0); // 13
8420
8421 data << uint32(2495) << uint32(0x0); // 14
8422 data << uint32(2494) << uint32(0x0); // 15
8423 data << uint32(2497) << uint32(0x0); // 16
8424
8425 data << uint32(2762) << uint32(0x0); // 17
8426 data << uint32(2662) << uint32(0x0); // 18
8427 data << uint32(2663) << uint32(0x0); // 19
8428 data << uint32(2664) << uint32(0x0); // 20
8429
8430 data << uint32(2760) << uint32(0x0); // 21
8431 data << uint32(2670) << uint32(0x0); // 22
8432 data << uint32(2668) << uint32(0x0); // 23
8433 data << uint32(2669) << uint32(0x0); // 24
8434
8435 data << uint32(2761) << uint32(0x0); // 25
8436 data << uint32(2667) << uint32(0x0); // 26
8437 data << uint32(2665) << uint32(0x0); // 27
8438 data << uint32(2666) << uint32(0x0); // 28
8439
8440 data << uint32(2763) << uint32(0x0); // 29
8441 data << uint32(2659) << uint32(0x0); // 30
8442 data << uint32(2660) << uint32(0x0); // 31
8443 data << uint32(2661) << uint32(0x0); // 32
8444
8445 data << uint32(2671) << uint32(0x0); // 33
8446 data << uint32(2676) << uint32(0x0); // 34
8447 data << uint32(2677) << uint32(0x0); // 35
8448 data << uint32(2672) << uint32(0x0); // 36
8449 data << uint32(2673) << uint32(0x0); // 37
8450 }
8451 break;
8452 case 3519: // Terokkar Forest
8453 if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_TF)
8454 pvp->FillInitialWorldStates(data);
8455 else
8456 {
8457 data << uint32(0xa41) << uint32(0x0); // 10 // 2625 capture bar pos
8458 data << uint32(0xa40) << uint32(0x14); // 11 // 2624 capture bar neutral
8459 data << uint32(0xa3f) << uint32(0x0); // 12 // 2623 show capture bar
8460 data << uint32(0xa3e) << uint32(0x0); // 13 // 2622 horde towers controlled
8461 data << uint32(0xa3d) << uint32(0x5); // 14 // 2621 ally towers controlled
8462 data << uint32(0xa3c) << uint32(0x0); // 15 // 2620 show towers controlled
8463 data << uint32(0xa88) << uint32(0x0); // 16 // 2696 SE Neu
8464 data << uint32(0xa87) << uint32(0x0); // 17 // SE Horde
8465 data << uint32(0xa86) << uint32(0x0); // 18 // SE Ally
8466 data << uint32(0xa85) << uint32(0x0); // 19 //S Neu
8467 data << uint32(0xa84) << uint32(0x0); // 20 S Horde
8468 data << uint32(0xa83) << uint32(0x0); // 21 S Ally
8469 data << uint32(0xa82) << uint32(0x0); // 22 NE Neu
8470 data << uint32(0xa81) << uint32(0x0); // 23 NE Horde
8471 data << uint32(0xa80) << uint32(0x0); // 24 NE Ally
8472 data << uint32(0xa7e) << uint32(0x0); // 25 // 2686 N Neu
8473 data << uint32(0xa7d) << uint32(0x0); // 26 N Horde
8474 data << uint32(0xa7c) << uint32(0x0); // 27 N Ally
8475 data << uint32(0xa7b) << uint32(0x0); // 28 NW Ally
8476 data << uint32(0xa7a) << uint32(0x0); // 29 NW Horde
8477 data << uint32(0xa79) << uint32(0x0); // 30 NW Neutral
8478 data << uint32(0x9d0) << uint32(0x5); // 31 // 2512 locked time remaining seconds first digit
8479 data << uint32(0x9ce) << uint32(0x0); // 32 // 2510 locked time remaining seconds second digit
8480 data << uint32(0x9cd) << uint32(0x0); // 33 // 2509 locked time remaining minutes
8481 data << uint32(0x9cc) << uint32(0x0); // 34 // 2508 neutral locked time show
8482 data << uint32(0xad0) << uint32(0x0); // 35 // 2768 horde locked time show
8483 data << uint32(0xacf) << uint32(0x1); // 36 // 2767 ally locked time show
8484 }
8485 break;
8486 case 3521: // Zangarmarsh
8487 if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_ZM)
8488 pvp->FillInitialWorldStates(data);
8489 else
8490 {
8491 data << uint32(0x9e1) << uint32(0x0); // 10 //2529
8492 data << uint32(0x9e0) << uint32(0x0); // 11
8493 data << uint32(0x9df) << uint32(0x0); // 12
8494 data << uint32(0xa5d) << uint32(0x1); // 13 //2653
8495 data << uint32(0xa5c) << uint32(0x0); // 14 //2652 east beacon neutral
8496 data << uint32(0xa5b) << uint32(0x1); // 15 horde
8497 data << uint32(0xa5a) << uint32(0x0); // 16 ally
8498 data << uint32(0xa59) << uint32(0x1); // 17 // 2649 Twin spire graveyard horde 12???
8499 data << uint32(0xa58) << uint32(0x0); // 18 ally 14 ???
8500 data << uint32(0xa57) << uint32(0x0); // 19 neutral 7???
8501 data << uint32(0xa56) << uint32(0x0); // 20 // 2646 west beacon neutral
8502 data << uint32(0xa55) << uint32(0x1); // 21 horde
8503 data << uint32(0xa54) << uint32(0x0); // 22 ally
8504 data << uint32(0x9e7) << uint32(0x0); // 23 // 2535
8505 data << uint32(0x9e6) << uint32(0x0); // 24
8506 data << uint32(0x9e5) << uint32(0x0); // 25
8507 data << uint32(0xa00) << uint32(0x0); // 26 // 2560
8508 data << uint32(0x9ff) << uint32(0x1); // 27
8509 data << uint32(0x9fe) << uint32(0x0); // 28
8510 data << uint32(0x9fd) << uint32(0x0); // 29
8511 data << uint32(0x9fc) << uint32(0x1); // 30
8512 data << uint32(0x9fb) << uint32(0x0); // 31
8513 data << uint32(0xa62) << uint32(0x0); // 32 // 2658
8514 data << uint32(0xa61) << uint32(0x1); // 33
8515 data << uint32(0xa60) << uint32(0x1); // 34
8516 data << uint32(0xa5f) << uint32(0x0); // 35
8517 }
8518 break;
8519 case 3698: // Nagrand Arena
8520 if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_NA)
8521 bg->FillInitialWorldStates(data);
8522 else
8523 {
8524 data << uint32(0xa0f) << uint32(0x0); // 7
8525 data << uint32(0xa10) << uint32(0x0); // 8
8526 data << uint32(0xa11) << uint32(0x0); // 9 show
8527 }
8528 break;
8529 case 3702: // Blade's Edge Arena
8530 if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_BE)
8531 bg->FillInitialWorldStates(data);
8532 else
8533 {
8534 data << uint32(0x9f0) << uint32(0x0); // 7 gold
8535 data << uint32(0x9f1) << uint32(0x0); // 8 green
8536 data << uint32(0x9f3) << uint32(0x0); // 9 show
8537 }
8538 break;
8539 case 3968: // Ruins of Lordaeron
8540 if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_RL)
8541 bg->FillInitialWorldStates(data);
8542 else
8543 {
8544 data << uint32(0xbb8) << uint32(0x0); // 7 gold
8545 data << uint32(0xbb9) << uint32(0x0); // 8 green
8546 data << uint32(0xbba) << uint32(0x0); // 9 show
8547 }
8548 break;
8549 case 4378: // Dalaran Sewers
8550 if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_DS)
8551 bg->FillInitialWorldStates(data);
8552 else
8553 {
8554 data << uint32(3601) << uint32(0x0); // 7 gold
8555 data << uint32(3600) << uint32(0x0); // 8 green
8556 data << uint32(3610) << uint32(0x0); // 9 show
8557 }
8558 break;
8559 case 4384: // Strand of the Ancients
8560 if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_SA)
8561 bg->FillInitialWorldStates(data);
8562 else
8563 {
8564 // 1-3 A defend, 4-6 H defend, 7-9 unk defend, 1 - ok, 2 - half destroyed, 3 - destroyed
8565 data << uint32(0xf09) << uint32(0x0); // 7 3849 Gate of Temple
8566 data << uint32(0xe36) << uint32(0x0); // 8 3638 Gate of Yellow Moon
8567 data << uint32(0xe27) << uint32(0x0); // 9 3623 Gate of Green Emerald
8568 data << uint32(0xe24) << uint32(0x0); // 10 3620 Gate of Blue Sapphire
8569 data << uint32(0xe21) << uint32(0x0); // 11 3617 Gate of Red Sun
8570 data << uint32(0xe1e) << uint32(0x0); // 12 3614 Gate of Purple Ametyst
8571
8572 data << uint32(0xdf3) << uint32(0x0); // 13 3571 bonus timer (1 - on, 0 - off)
8573 data << uint32(0xded) << uint32(0x0); // 14 3565 Horde Attacker
8574 data << uint32(0xdec) << uint32(0x0); // 15 3564 Alliance Attacker
8575 // End Round (timer), better explain this by example, eg. ends in 19:59 -> A:BC
8576 data << uint32(0xde9) << uint32(0x0); // 16 3561 C
8577 data << uint32(0xde8) << uint32(0x0); // 17 3560 B
8578 data << uint32(0xde7) << uint32(0x0); // 18 3559 A
8579 data << uint32(0xe35) << uint32(0x0); // 19 3637 East g - Horde control
8580 data << uint32(0xe34) << uint32(0x0); // 20 3636 West g - Horde control
8581 data << uint32(0xe33) << uint32(0x0); // 21 3635 South g - Horde control
8582 data << uint32(0xe32) << uint32(0x0); // 22 3634 East g - Alliance control
8583 data << uint32(0xe31) << uint32(0x0); // 23 3633 West g - Alliance control
8584 data << uint32(0xe30) << uint32(0x0); // 24 3632 South g - Alliance control
8585 data << uint32(0xe2f) << uint32(0x0); // 25 3631 Chamber of Ancients - Horde control
8586 data << uint32(0xe2e) << uint32(0x0); // 26 3630 Chamber of Ancients - Alliance control
8587 data << uint32(0xe2d) << uint32(0x0); // 27 3629 Beach1 - Horde control
8588 data << uint32(0xe2c) << uint32(0x0); // 28 3628 Beach2 - Horde control
8589 data << uint32(0xe2b) << uint32(0x0); // 29 3627 Beach1 - Alliance control
8590 data << uint32(0xe2a) << uint32(0x0); // 30 3626 Beach2 - Alliance control
8591 // and many unks...
8592 }
8593 break;
8594 case 4406: // Ring of Valor
8595 if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_RV)
8596 bg->FillInitialWorldStates(data);
8597 else
8598 {
8599 data << uint32(0xe10) << uint32(0x0); // 7 gold
8600 data << uint32(0xe11) << uint32(0x0); // 8 green
8601 data << uint32(0xe1a) << uint32(0x0); // 9 show
8602 }
8603 break;
8604 case 4710: // Isle of Conquest
8605 if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_IC)
8606 bg->FillInitialWorldStates(data);
8607 else
8608 {
8609 data << uint32(4221) << uint32(1); // 7 BG_IC_ALLIANCE_RENFORT_SET
8610 data << uint32(4222) << uint32(1); // 8 BG_IC_HORDE_RENFORT_SET
8611 data << uint32(4226) << uint32(300); // 9 BG_IC_ALLIANCE_RENFORT
8612 data << uint32(4227) << uint32(300); // 10 BG_IC_HORDE_RENFORT
8613 data << uint32(4322) << uint32(1); // 11 BG_IC_GATE_FRONT_H_WS_OPEN
8614 data << uint32(4321) << uint32(1); // 12 BG_IC_GATE_WEST_H_WS_OPEN
8615 data << uint32(4320) << uint32(1); // 13 BG_IC_GATE_EAST_H_WS_OPEN
8616 data << uint32(4323) << uint32(1); // 14 BG_IC_GATE_FRONT_A_WS_OPEN
8617 data << uint32(4324) << uint32(1); // 15 BG_IC_GATE_WEST_A_WS_OPEN
8618 data << uint32(4325) << uint32(1); // 16 BG_IC_GATE_EAST_A_WS_OPEN
8619 data << uint32(4317) << uint32(1); // 17 unknown
8620
8621 data << uint32(4301) << uint32(1); // 18 BG_IC_DOCKS_UNCONTROLLED
8622 data << uint32(4296) << uint32(1); // 19 BG_IC_HANGAR_UNCONTROLLED
8623 data << uint32(4306) << uint32(1); // 20 BG_IC_QUARRY_UNCONTROLLED
8624 data << uint32(4311) << uint32(1); // 21 BG_IC_REFINERY_UNCONTROLLED
8625 data << uint32(4294) << uint32(1); // 22 BG_IC_WORKSHOP_UNCONTROLLED
8626 data << uint32(4243) << uint32(1); // 23 unknown
8627 data << uint32(4345) << uint32(1); // 24 unknown
8628 }
8629 break;
8630 // The Ruby Sanctum
8631 case 4987:
8632 if (instance && mapid == 724)
8633 instance->FillInitialWorldStates(data);
8634 else
8635 {
8636 data << uint32(5049) << uint32(50); // 9 WORLDSTATE_CORPOREALITY_MATERIAL
8637 data << uint32(5050) << uint32(50); // 10 WORLDSTATE_CORPOREALITY_TWILIGHT
8638 data << uint32(5051) << uint32(0); // 11 WORLDSTATE_CORPOREALITY_TOGGLE
8639 }
8640 break;
8641 // Icecrown Citadel
8642 case 4812:
8643 if (instance && mapid == 631)
8644 instance->FillInitialWorldStates(data);
8645 else
8646 {
8647 data << uint32(4903) << uint32(0); // 9 WORLDSTATE_SHOW_TIMER (Blood Quickening weekly)
8648 data << uint32(4904) << uint32(30); // 10 WORLDSTATE_EXECUTION_TIME
8649 data << uint32(4940) << uint32(0); // 11 WORLDSTATE_SHOW_ATTEMPTS
8650 data << uint32(4941) << uint32(50); // 12 WORLDSTATE_ATTEMPTS_REMAINING
8651 data << uint32(4942) << uint32(50); // 13 WORLDSTATE_ATTEMPTS_MAX
8652 }
8653 break;
8654 // The Culling of Stratholme
8655 case 4100:
8656 if (instance && mapid == 595)
8657 instance->FillInitialWorldStates(data);
8658 else
8659 {
8660 data << uint32(3479) << uint32(0); // 9 WORLDSTATE_SHOW_CRATES
8661 data << uint32(3480) << uint32(0); // 10 WORLDSTATE_CRATES_REVEALED
8662 data << uint32(3504) << uint32(0); // 11 WORLDSTATE_WAVE_COUNT
8663 data << uint32(3931) << uint32(25); // 12 WORLDSTATE_TIME_GUARDIAN
8664 data << uint32(3932) << uint32(0); // 13 WORLDSTATE_TIME_GUARDIAN_SHOW
8665 }
8666 break;
8667 // The Oculus
8668 case 4228:
8669 if (instance && mapid == 578)
8670 instance->FillInitialWorldStates(data);
8671 else
8672 {
8673 data << uint32(3524) << uint32(0); // 9 WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW
8674 data << uint32(3486) << uint32(0); // 10 WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT
8675 }
8676 break;
8677 // Ulduar
8678 case 4273:
8679 if (instance && mapid == 603)
8680 instance->FillInitialWorldStates(data);
8681 else
8682 {
8683 data << uint32(4132) << uint32(0); // 9 WORLDSTATE_ALGALON_TIMER_ENABLED
8684 data << uint32(4131) << uint32(0); // 10 WORLDSTATE_ALGALON_DESPAWN_TIMER
8685 }
8686 break;
8687 // Halls of Refection
8688 case 4820:
8689 if (instance && mapid == 668)
8690 instance->FillInitialWorldStates(data);
8691 else
8692 {
8693 data << uint32(4884) << uint32(0); // 9 WORLD_STATE_HOR_WAVES_ENABLED
8694 data << uint32(4882) << uint32(0); // 10 WORLD_STATE_HOR_WAVE_COUNT
8695 }
8696 break;
8697 // Scarlet Enclave (DK starting zone)
8698 case 4298:
8699 // Get Mograine, GUID and ENTRY should NEVER change
8700 if (Creature* mograine = ObjectAccessor::GetCreature(*this, ObjectGuid::Create<HighGuid::Unit>(29173, 130956)))
8701 {
8702 if (CreatureAI* mograineAI = mograine->AI())
8703 {
8704 data << uint32(3590) << uint32(mograineAI->GetData(3590));
8705 data << uint32(3591) << uint32(mograineAI->GetData(3591));
8706 data << uint32(3592) << uint32(mograineAI->GetData(3592));
8707 data << uint32(3603) << uint32(mograineAI->GetData(3603));
8708 data << uint32(3604) << uint32(mograineAI->GetData(3604));
8709 data << uint32(3605) << uint32(mograineAI->GetData(3605));
8710 }
8711 }
8712 break;
8713 // Wintergrasp
8714 case 4197:
8715 if (bf && bf->GetTypeId() == BATTLEFIELD_WG)
8716 {
8717 bf->FillInitialWorldStates(data);
8718 break;
8719 }
8720 [[fallthrough]];
8721 default:
8722 data << uint32(0x914) << uint32(0x0); // 7
8723 data << uint32(0x913) << uint32(0x0); // 8
8724 data << uint32(0x912) << uint32(0x0); // 9
8725 data << uint32(0x915) << uint32(0x0); // 10
8726 break;
8727 }
8728 }
8729
8730 uint16 length = (data.wpos() - countPos) / 8;
8731 data.put<uint16>(countPos, length);
8732
8733 GetSession()->SendPacket(&data);
8736}
@ BATTLEFIELD_WG
Definition: Battlefield.h:31
@ OUTDOOR_PVP_SI
Definition: OutdoorPvP.h:34
@ OUTDOOR_PVP_TF
Definition: OutdoorPvP.h:32
@ OUTDOOR_PVP_ZM
Definition: OutdoorPvP.h:33
@ OUTDOOR_PVP_EP
Definition: OutdoorPvP.h:35
@ OUTDOOR_PVP_NA
Definition: OutdoorPvP.h:31
@ OUTDOOR_PVP_HP
Definition: OutdoorPvP.h:30
@ CONFIG_ARENA_SEASON_ID
Definition: IWorld.h:327
@ CONFIG_ARENA_SEASON_IN_PROGRESS
Definition: IWorld.h:124
@ BATTLEGROUND_IC
Definition: SharedDefines.h:3492
@ BATTLEGROUND_WS
Definition: SharedDefines.h:3482
@ BATTLEGROUND_EY
Definition: SharedDefines.h:3487
@ BATTLEGROUND_AV
Definition: SharedDefines.h:3481
@ BATTLEGROUND_BE
Definition: SharedDefines.h:3485
@ BATTLEGROUND_RV
Definition: SharedDefines.h:3491
@ BATTLEGROUND_NA
Definition: SharedDefines.h:3484
@ BATTLEGROUND_DS
Definition: SharedDefines.h:3490
@ BATTLEGROUND_SA
Definition: SharedDefines.h:3489
@ BATTLEGROUND_AB
Definition: SharedDefines.h:3483
@ BATTLEGROUND_RL
Definition: SharedDefines.h:3488
@ SMSG_INIT_WORLD_STATES
Definition: Opcodes.h:736
Definition: CreatureAI.h:71
virtual void FillInitialWorldStates(WorldPacket &)=0
uint32 GetTypeId()
Definition: Battlefield.h:243
virtual void FillInitialWorldStates(WorldPacket &)
Definition: Battleground.h:443
BattlegroundTypeId GetBgTypeID(bool GetRandom=false) const
Definition: Battleground.h:324
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
void SendBGWeekendWorldStates()
Definition: Player.cpp:8738
void SendBattlefieldWorldStates()
Definition: Player.cpp:8753
static std::unordered_map< int, bgZoneRef > bgZoneIdToFillWorldStates
Definition: Player.h:2580
Definition: InstanceScript.h:141
virtual void FillInitialWorldStates(WorldPacket &)
Definition: InstanceScript.h:253
Definition: OutdoorPvP.h:186
virtual void FillInitialWorldStates(WorldPacket &)
Definition: OutdoorPvP.h:203
uint32 GetTypeId() const
Definition: OutdoorPvP.h:238

References BATTLEFIELD_WG, BATTLEGROUND_AB, BATTLEGROUND_AV, BATTLEGROUND_BE, BATTLEGROUND_DS, BATTLEGROUND_EY, BATTLEGROUND_IC, BATTLEGROUND_NA, BATTLEGROUND_RL, BATTLEGROUND_RV, BATTLEGROUND_SA, BATTLEGROUND_WS, bgZoneIdToFillWorldStates, CONFIG_ARENA_SEASON_ID, CONFIG_ARENA_SEASON_IN_PROGRESS, Battleground::FillInitialWorldStates(), InstanceScript::FillInitialWorldStates(), OutdoorPvP::FillInitialWorldStates(), Battlefield::FillInitialWorldStates(), GetBattleground(), Battleground::GetBgTypeID(), ObjectAccessor::GetCreature(), WorldObject::GetInstanceScript(), WorldLocation::GetMapId(), GetSession(), Battlefield::GetTypeId(), OutdoorPvP::GetTypeId(), LOG_DEBUG, OUTDOOR_PVP_EP, OUTDOOR_PVP_HP, OUTDOOR_PVP_NA, OUTDOOR_PVP_SI, OUTDOOR_PVP_TF, OUTDOOR_PVP_ZM, ByteBuffer::put(), sBattlefieldMgr, SendBattlefieldWorldStates(), SendBGWeekendWorldStates(), WorldSession::SendPacket(), SMSG_INIT_WORLD_STATES, sOutdoorPvPMgr, sWorld, and ByteBuffer::wpos().

Referenced by WorldSession::HandlePlayerLoginToCharInWorld(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnPlayerAreaUpdate(), and UpdateZone().

◆ SendInstanceResetWarning()

void Player::SendInstanceResetWarning ( uint32  mapid,
Difficulty  difficulty,
uint32  time,
bool  onEnterMap 
)
11652{
11653 // pussywizard:
11654 InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(GetGUID(), mapid, difficulty);
11655 if (bind && bind->extended)
11656 {
11657 if (!onEnterMap) // extended id player shouldn't be warned about lock expiration
11658 return;
11659 time += (bind->save->GetExtendedResetTime() - bind->save->GetResetTime()); // add lockout period to the time left
11660 }
11661
11662 // type of warning, based on the time remaining until reset
11663 uint32 type;
11664 if (time > 3600)
11665 type = RAID_INSTANCE_WELCOME;
11666 else if (time > 900)
11668 else if (time > 300)
11670 else
11672
11673 WorldPacket data(SMSG_RAID_INSTANCE_MESSAGE, 4 + 4 + 4 + 4);
11674 data << uint32(type);
11675 data << uint32(mapid);
11676 data << uint32(difficulty); // difficulty
11677 data << uint32(time);
11678 if (type == RAID_INSTANCE_WELCOME)
11679 {
11680 data << uint8(bind && bind->perm); // is locked
11681 data << uint8(bind && bind->extended); // is extended, ignored if prev field is 0
11682 }
11683 GetSession()->SendPacket(&data);
11684}
@ RAID_INSTANCE_WARNING_MIN
Definition: Player.h:797
@ RAID_INSTANCE_WARNING_MIN_SOON
Definition: Player.h:798
@ RAID_INSTANCE_WARNING_HOURS
Definition: Player.h:796
@ RAID_INSTANCE_WELCOME
Definition: Player.h:799
@ SMSG_RAID_INSTANCE_MESSAGE
Definition: Opcodes.h:792
Definition: InstanceSaveMgr.h:39
InstanceSave * save
Definition: InstanceSaveMgr.h:40
bool extended
Definition: InstanceSaveMgr.h:42
bool perm
Definition: InstanceSaveMgr.h:41
time_t GetExtendedResetTime() const
Definition: InstanceSaveMgr.h:76
time_t GetResetTime() const
Definition: InstanceSaveMgr.h:75

References InstancePlayerBind::extended, InstanceSave::GetExtendedResetTime(), Object::GetGUID(), InstanceSave::GetResetTime(), GetSession(), InstancePlayerBind::perm, RAID_INSTANCE_WARNING_HOURS, RAID_INSTANCE_WARNING_MIN, RAID_INSTANCE_WARNING_MIN_SOON, RAID_INSTANCE_WELCOME, InstancePlayerBind::save, WorldSession::SendPacket(), sInstanceSaveMgr, and SMSG_RAID_INSTANCE_MESSAGE.

Referenced by WorldSession::HandleMoveWorldportAck(), WorldSession::HandlePlayerLoginFromDB(), and WorldSession::HandlePlayerLoginToCharInWorld().

◆ SendItemDurations()

void Player::SendItemDurations ( )
4763{
4764 for (ItemDurationList::const_iterator itr = m_itemDuration.begin(); itr != m_itemDuration.end(); ++itr)
4765 {
4766 (*itr)->SendTimeUpdate(this);
4767 }
4768}

References m_itemDuration.

Referenced by SendInitialPacketsAfterAddToMap().

◆ SendItemRetrievalMail() [1/2]

void Player::SendItemRetrievalMail ( std::vector< std::pair< uint32, uint32 > >  mailItems)
445{
446 if (mailItems.empty())
447 {
448 // Skip send if empty items
449 LOG_ERROR("entities.player.items", "> SendItemRetrievalMail: Attempt to send almost with items without items. Player {}", GetGUID().ToString());
450 return;
451 }
452
453 using SendMailTempateVector = std::vector<std::pair<uint32, uint32>>;
454
455 std::vector<SendMailTempateVector> allItems;
456
457 auto AddMailItem = [&allItems](uint32 itemEntry, uint32 itemCount)
458 {
459 SendMailTempateVector toSendItems;
460
461 ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemEntry);
462 if (!itemTemplate)
463 {
464 LOG_ERROR("entities.player.items", "> SendItemRetrievalMail: Item id {} is invalid", itemEntry);
465 return;
466 }
467
468 if (itemCount < 1 || (itemTemplate->MaxCount > 0 && itemCount > static_cast<uint32>(itemTemplate->MaxCount)))
469 {
470 LOG_ERROR("entities.player.items", "> SendItemRetrievalMail: Incorrect item count ({}) for item id {}", itemEntry, itemCount);
471 return;
472 }
473
474 while (itemCount > itemTemplate->GetMaxStackSize())
475 {
476 if (toSendItems.size() <= MAX_MAIL_ITEMS)
477 {
478 toSendItems.emplace_back(itemEntry, itemTemplate->GetMaxStackSize());
479 itemCount -= itemTemplate->GetMaxStackSize();
480 }
481 else
482 {
483 allItems.emplace_back(toSendItems);
484 toSendItems.clear();
485 }
486 }
487
488 toSendItems.emplace_back(itemEntry, itemCount);
489 allItems.emplace_back(toSendItems);
490 };
491
492 for (auto& [itemEntry, itemCount] : mailItems)
493 {
494 AddMailItem(itemEntry, itemCount);
495 }
496
497 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
498
499 for (auto const& items : allItems)
500 {
501 MailSender sender(MAIL_CREATURE, 34337 /* The Postmaster */);
502 MailDraft draft("Recovered Item", "We recovered a lost item in the twisting nether and noted that it was yours.$B$BPlease find said object enclosed."); // This is the text used in Cataclysm, it probably wasn't changed.
503
504 for (auto const& [itemEntry, itemCount] : items)
505 {
506 if (Item* mailItem = Item::CreateItem(itemEntry, itemCount))
507 {
508 mailItem->SaveToDB(trans);
509 draft.AddItem(mailItem);
510 }
511 }
512
513 draft.SendMailTo(trans, MailReceiver(this, GetGUID().GetCounter()), sender);
514 }
515
516 CharacterDatabase.CommitTransaction(trans);
517}

References MailDraft::AddItem(), CharacterDatabase, Item::CreateItem(), Object::GetGUID(), ItemTemplate::GetMaxStackSize(), LOG_ERROR, MAIL_CREATURE, MAX_MAIL_ITEMS, ItemTemplate::MaxCount, MailDraft::SendMailTo(), sObjectMgr, and Position::ToString().

◆ SendItemRetrievalMail() [2/2]

void Player::SendItemRetrievalMail ( uint32  itemEntry,
uint32  count 
)

◆ SendLearnPacket()

void Player::SendLearnPacket ( uint32  spellId,
bool  learn 
)
2992{
2993 if (learn)
2994 {
2996 data << uint32(spellId);
2997 data << uint16(0);
2998 GetSession()->SendPacket(&data);
2999 }
3000 else
3001 {
3003 data << uint32(spellId);
3004 GetSession()->SendPacket(&data);
3005 }
3006}
@ SMSG_REMOVED_SPELL
Definition: Opcodes.h:545
@ SMSG_LEARNED_SPELL
Definition: Opcodes.h:329

References GetSession(), WorldSession::SendPacket(), SMSG_LEARNED_SPELL, and SMSG_REMOVED_SPELL.

Referenced by _addSpell(), ActivateSpec(), addTalent(), Spell::EffectApplyGlyph(), WorldSession::HandleRemoveGlyph(), learnSpell(), LearnTalent(), removeSpell(), and resetTalents().

◆ SendLogXPGain()

void Player::SendLogXPGain ( uint32  GivenXP,
Unit victim,
uint32  BonusXP,
bool  recruitAFriend = false,
float  group_rate = 1.0f 
)
2338{
2339 WorldPacket data(SMSG_LOG_XPGAIN, 22); // guess size?
2340 data << (victim ? victim->GetGUID() : ObjectGuid::Empty); // guid
2341 data << uint32(GivenXP + BonusXP); // given experience
2342 data << uint8(victim ? 0 : 1); // 00-kill_xp type, 01-non_kill_xp type
2343
2344 if (victim)
2345 {
2346 data << uint32(GivenXP); // experience without bonus
2347
2348 // should use group_rate here but can't figure out how
2349 data << float(1); // 1 - none 0 - 100% group bonus output
2350 }
2351
2352 data << uint8(recruitAFriend ? 1 : 0); // does the GivenXP include a RaF bonus?
2353 GetSession()->SendPacket(&data);
2354}
@ SMSG_LOG_XPGAIN
Definition: Opcodes.h:494

References ObjectGuid::Empty, Object::GetGUID(), GetSession(), WorldSession::SendPacket(), and SMSG_LOG_XPGAIN.

Referenced by GiveXP().

◆ SendLoot()

void Player::SendLoot ( ObjectGuid  guid,
LootType  loot_type 
)
7687{
7688 if (ObjectGuid lguid = GetLootGUID())
7689 m_session->DoLootRelease(lguid);
7690
7691 Loot* loot = 0;
7692 PermissionTypes permission = ALL_PERMISSION;
7693
7694 LOG_DEBUG("loot", "Player::SendLoot");
7695
7696 // remove FD and invisibility at all loots
7697 constexpr std::array<AuraType, 2> toRemove = {SPELL_AURA_MOD_INVISIBILITY, SPELL_AURA_FEIGN_DEATH};
7698 for (const auto& aura : toRemove)
7699 {
7700 RemoveAurasByType(aura);
7701 }
7702 // remove stealth only if looting a corpse
7703 if (loot_type == LOOT_CORPSE && !guid.IsItem())
7704 {
7706 }
7707
7708 if (guid.IsGameObject())
7709 {
7710 LOG_DEBUG("loot", "guid.IsGameObject");
7711 GameObject* go = GetMap()->GetGameObject(guid);
7712
7713 // not check distance for GO in case owned GO (fishing bobber case, for example)
7714 // And permit out of range GO with no owner in case fishing hole
7715 if (!go || (loot_type != LOOT_FISHINGHOLE && ((loot_type != LOOT_FISHING && loot_type != LOOT_FISHING_JUNK) || go->GetOwnerGUID() != GetGUID()) && !go->IsWithinDistInMap(this)) || (loot_type == LOOT_CORPSE && go->GetRespawnTime() && go->isSpawnedByDefault()))
7716 {
7718 SendLootRelease(guid);
7719 return;
7720 }
7721
7722 loot = &go->loot;
7723
7724 // Xinef: loot was generated and respawntime has passed since then, allow to recreate loot
7725 // Xinef: to avoid bugs, this rule covers spawned gameobjects only
7726 if (go->isSpawnedByDefault() && go->getLootState() == GO_ACTIVATED && !go->loot.isLooted() && go->GetLootGenerationTime() + go->GetRespawnDelay() < GameTime::GetGameTime().count())
7728
7729 if (go->getLootState() == GO_READY)
7730 {
7731 uint32 lootid = go->GetGOInfo()->GetLootId();
7732
7733 //TODO: fix this big hack
7735 if (Battleground* bg = GetBattleground())
7736 if (bg->GetBgTypeID(true) == BATTLEGROUND_AV)
7737 if (!bg->ToBattlegroundAV()->PlayerCanDoMineQuest(go->GetEntry(), GetTeamId()))
7738 {
7740 SendLootRelease(guid);
7741 return;
7742 }
7743
7744 if (lootid)
7745 {
7746 loot->clear();
7747
7748 Group* group = GetGroup();
7749 bool groupRules = (group && go->GetGOInfo()->type == GAMEOBJECT_TYPE_CHEST && go->GetGOInfo()->chest.groupLootRules);
7750
7751 // check current RR player and get next if necessary
7752 if (groupRules)
7753 group->UpdateLooterGuid(go, true);
7754
7755 loot->FillLoot(lootid, LootTemplates_Gameobject, this, !groupRules, false, go->GetLootMode(), go);
7757
7758 // get next RR player (for next loot)
7759 if (groupRules && !go->loot.empty())
7760 group->UpdateLooterGuid(go);
7761 }
7762 if (GameObjectTemplateAddon const* addon = go->GetTemplateAddon())
7763 loot->generateMoneyLoot(addon->mingold, addon->maxgold);
7764
7765 if (loot_type == LOOT_FISHING)
7766 go->GetFishLoot(loot, this);
7767 else if (loot_type == LOOT_FISHING_JUNK)
7768 go->GetFishLootJunk(loot, this);
7769
7771 {
7772 if (Group* group = GetGroup())
7773 {
7774 switch (group->GetLootMethod())
7775 {
7776 case GROUP_LOOT:
7777 // GroupLoot: rolls items over threshold. Items with quality < threshold, round robin
7778 group->GroupLoot(loot, go);
7779 break;
7780 case NEED_BEFORE_GREED:
7781 group->NeedBeforeGreed(loot, go);
7782 break;
7783 case MASTER_LOOT:
7784 group->MasterLoot(loot, go);
7785 break;
7786 default:
7787 break;
7788 }
7789 }
7790 }
7791
7792 go->SetLootState(GO_ACTIVATED, this);
7793 }
7794
7795 if (go->getLootState() == GO_ACTIVATED)
7796 {
7797 if (Group* group = GetGroup())
7798 {
7799 switch (group->GetLootMethod())
7800 {
7801 case MASTER_LOOT:
7803 break;
7804 case FREE_FOR_ALL:
7805 permission = ALL_PERMISSION;
7806 break;
7807 case ROUND_ROBIN:
7808 permission = ROUND_ROBIN_PERMISSION;
7809 break;
7810 default:
7811 permission = GROUP_PERMISSION;
7812 break;
7813 }
7814 }
7815 else
7816 permission = ALL_PERMISSION;
7817 }
7818 }
7819 else if (guid.IsItem())
7820 {
7821 Item* item = GetItemByGuid(guid);
7822
7823 if (!item)
7824 {
7825 SendLootRelease(guid);
7826 return;
7827 }
7828
7829 permission = OWNER_PERMISSION;
7830
7831 loot = &item->loot;
7832
7833 // Xinef: Store container id
7834 loot->containerGUID = item->GetGUID();
7835
7836 if (!item->m_lootGenerated && !sLootItemStorage->LoadStoredLoot(item, this))
7837 {
7838 item->m_lootGenerated = true;
7839 loot->clear();
7840
7841 switch (loot_type)
7842 {
7843 case LOOT_DISENCHANTING:
7844 loot->FillLoot(item->GetTemplate()->DisenchantID, LootTemplates_Disenchant, this, true);
7845 break;
7846 case LOOT_PROSPECTING:
7847 loot->FillLoot(item->GetEntry(), LootTemplates_Prospecting, this, true);
7848 break;
7849 case LOOT_MILLING:
7850 loot->FillLoot(item->GetEntry(), LootTemplates_Milling, this, true);
7851 break;
7852 default:
7854 loot->FillLoot(item->GetEntry(), LootTemplates_Item, this, true, loot->gold != 0);
7855
7856 // Xinef: Add to storage
7857 if (loot->gold > 0 || loot->unlootedCount > 0)
7858 sLootItemStorage->AddNewStoredLoot(loot, this);
7859
7860 break;
7861 }
7862 }
7863 }
7864 else if (guid.IsCorpse()) // remove insignia
7865 {
7866 Corpse* bones = ObjectAccessor::GetCorpse(*this, guid);
7867
7868 if (!bones || !(loot_type == LOOT_CORPSE || loot_type == LOOT_INSIGNIA) || bones->GetType() != CORPSE_BONES || !bones->HasFlag(CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_DYNFLAG_LOOTABLE))
7869 {
7870 SendLootRelease(guid);
7871 return;
7872 }
7873
7874 loot = &bones->loot;
7875
7876 if (loot->loot_type == LOOT_NONE)
7877 {
7878 uint32 pLevel = bones->loot.gold;
7879 bones->loot.clear();
7880
7881 loot->FillLoot(GetTeamId(), LootTemplates_Player, this, true);
7882
7883 // It may need a better formula
7884 // Now it works like this: lvl10: ~6copper, lvl70: ~9silver
7885 bones->loot.gold = uint32(urand(50, 150) * 0.016f * pow(float(pLevel) / 5.76f, 2.5f) * sWorld->getRate(RATE_DROP_MONEY));
7886 }
7887
7888 if (bones->lootRecipient != this)
7889 permission = NONE_PERMISSION;
7890 else
7891 permission = OWNER_PERMISSION;
7892 }
7893 else
7894 {
7895 Creature* creature = GetMap()->GetCreature(guid);
7896
7897 // must be in range and creature must be alive for pickpocket and must be dead for another loot
7898 if (!creature || creature->IsAlive() != (loot_type == LOOT_PICKPOCKETING) || !creature->IsWithinDistInMap(this, INTERACTION_DISTANCE))
7899 {
7900 SendLootRelease(guid);
7901 return;
7902 }
7903
7904 if (loot_type == LOOT_PICKPOCKETING && IsFriendlyTo(creature))
7905 {
7906 SendLootRelease(guid);
7907 return;
7908 }
7909
7910 loot = &creature->loot;
7911
7912 if (loot_type == LOOT_PICKPOCKETING)
7913 {
7914 if (!loot || loot->loot_type != LOOT_PICKPOCKETING)
7915 {
7916 if (creature->CanGeneratePickPocketLoot())
7917 {
7918 creature->SetPickPocketLootTime();
7919 loot->clear();
7920
7921 if (uint32 lootid = creature->GetCreatureTemplate()->pickpocketLootId)
7922 loot->FillLoot(lootid, LootTemplates_Pickpocketing, this, true);
7923
7924 // Generate extra money for pick pocket loot
7925 const uint32 a = urand(0, creature->GetLevel() / 2);
7926 const uint32 b = urand(0, GetLevel() / 2);
7927 loot->gold = uint32(10 * (a + b) * sWorld->getRate(RATE_DROP_MONEY));
7928 permission = OWNER_PERMISSION;
7929 }
7930 else
7931 {
7932 permission = NONE_PERMISSION;
7934 return;
7935 }
7936 }
7937 }
7938 else
7939 {
7940 // Xinef: Exploit fix
7941 if (!creature->HasDynamicFlag(UNIT_DYNFLAG_LOOTABLE))
7942 {
7944 return;
7945 }
7946
7947 // the player whose group may loot the corpse
7948 Player* recipient = creature->GetLootRecipient();
7949 Group* recipientGroup = creature->GetLootRecipientGroup();
7950 if (!recipient && !recipientGroup)
7951 return;
7952
7953 if (loot->loot_type == LOOT_NONE)
7954 {
7955 // for creature, loot is filled when creature is killed.
7956 if (recipientGroup)
7957 {
7958 switch (recipientGroup->GetLootMethod())
7959 {
7960 case GROUP_LOOT:
7961 // GroupLoot: rolls items over threshold. Items with quality < threshold, round robin
7962 recipientGroup->GroupLoot(loot, creature);
7963 break;
7964 case NEED_BEFORE_GREED:
7965 recipientGroup->NeedBeforeGreed(loot, creature);
7966 break;
7967 case MASTER_LOOT:
7968 recipientGroup->MasterLoot(loot, creature);
7969 break;
7970 default:
7971 break;
7972 }
7973 }
7974 }
7975
7976 // if loot is already skinning loot then don't do anything else
7977 if (loot->loot_type == LOOT_SKINNING)
7978 {
7979 loot_type = LOOT_SKINNING;
7980 permission = creature->GetLootRecipientGUID() == GetGUID() ? OWNER_PERMISSION : NONE_PERMISSION;
7981 }
7982 else if (loot_type == LOOT_SKINNING)
7983 {
7984 loot->clear();
7985 loot->FillLoot(creature->GetCreatureTemplate()->SkinLootId, LootTemplates_Skinning, this, true);
7986 permission = OWNER_PERMISSION;
7987
7988 //Inform instance if creature is skinned.
7989 if (InstanceScript* mapInstance = creature->GetInstanceScript())
7990 {
7991 mapInstance->CreatureLooted(creature, LOOT_SKINNING);
7992 }
7993
7994 // Xinef: Set new loot recipient
7995 creature->SetLootRecipient(this, false);
7996 }
7997 // set group rights only for loot_type != LOOT_SKINNING
7998 else
7999 {
8000 if (recipientGroup)
8001 {
8002 if (GetGroup() == recipientGroup)
8003 {
8004 switch (recipientGroup->GetLootMethod())
8005 {
8006 case MASTER_LOOT:
8007 permission = recipientGroup->GetMasterLooterGuid() == GetGUID() ? MASTER_PERMISSION : RESTRICTED_PERMISSION;
8008 break;
8009 case FREE_FOR_ALL:
8010 permission = ALL_PERMISSION;
8011 break;
8012 case ROUND_ROBIN:
8013 permission = ROUND_ROBIN_PERMISSION;
8014 break;
8015 default:
8016 permission = GROUP_PERMISSION;
8017 break;
8018 }
8019 }
8020 else
8021 permission = NONE_PERMISSION;
8022 }
8023 else if (recipient == this)
8024 permission = OWNER_PERMISSION;
8025 else
8026 permission = NONE_PERMISSION;
8027 }
8028 }
8029 }
8030
8031 // LOOT_INSIGNIA and LOOT_FISHINGHOLE unsupported by client
8032 switch (loot_type)
8033 {
8034 case LOOT_INSIGNIA:
8035 loot_type = LOOT_SKINNING;
8036 break;
8037 case LOOT_FISHINGHOLE:
8038 loot_type = LOOT_FISHING;
8039 break;
8040 case LOOT_FISHING_JUNK:
8041 loot_type = LOOT_FISHING;
8042 break;
8043 default:
8044 break;
8045 }
8046
8047 // need know merged fishing/corpse loot type for achievements
8048 loot->loot_type = loot_type;
8049
8050 if (!sScriptMgr->OnAllowedToLootContainerCheck(this, guid))
8051 {
8053 return;
8054 }
8055
8056 if (permission != NONE_PERMISSION)
8057 {
8058 SetLootGUID(guid);
8059
8060 WorldPacket data(SMSG_LOOT_RESPONSE, (9 + 50)); // we guess size
8061 data << guid;
8062 data << uint8(loot_type);
8063 data << LootView(*loot, this, permission);
8064
8065 SendDirectMessage(&data);
8066
8067 // add 'this' player as one of the players that are looting 'loot'
8068 loot->AddLooter(GetGUID());
8069
8070 if (loot_type == LOOT_CORPSE && !guid.IsItem())
8072 }
8073 else
8075}
@ BG_AV_OBJECTID_MINE_N
Definition: BattlegroundAV.h:160
@ BG_AV_OBJECTID_MINE_S
Definition: BattlegroundAV.h:161
@ CORPSE_BONES
Definition: Corpse.h:28
@ GO_ACTIVATED
Definition: GameObject.h:114
@ GO_READY
Definition: GameObject.h:113
@ GAMEOBJECT_BYTES_1
Definition: UpdateFields.h:404
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true)
LootStore LootTemplates_Gameobject("gameobject_loot_template", "gameobject entry", true)
LootStore LootTemplates_Item("item_loot_template", "item entry", true)
LootStore LootTemplates_Milling("milling_loot_template", "item entry (herb)", true)
LootStore LootTemplates_Disenchant("disenchant_loot_template", "item disenchant id", true)
LootStore LootTemplates_Prospecting("prospecting_loot_template", "item entry (ore)", true)
LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template", "creature pickpocket lootid", true)
LootStore LootTemplates_Player("player_loot_template", "team id", true)
PermissionTypes
Definition: LootMgr.h:67
@ OWNER_PERMISSION
Definition: LootMgr.h:73
@ ALL_PERMISSION
Definition: LootMgr.h:68
@ RESTRICTED_PERMISSION
Definition: LootMgr.h:71
@ NONE_PERMISSION
Definition: LootMgr.h:74
@ ROUND_ROBIN_PERMISSION
Definition: LootMgr.h:72
@ MASTER_PERMISSION
Definition: LootMgr.h:70
@ GROUP_PERMISSION
Definition: LootMgr.h:69
@ LOOT_ERROR_DIDNT_KILL
Definition: LootMgr.h:97
@ LOOT_ERROR_ALREADY_PICKPOCKETED
Definition: LootMgr.h:108
@ LOOT_PICKPOCKETING
Definition: LootMgr.h:82
@ LOOT_MILLING
Definition: LootMgr.h:88
@ LOOT_FISHING_JUNK
Definition: LootMgr.h:92
@ LOOT_CORPSE
Definition: LootMgr.h:81
@ LOOT_FISHING
Definition: LootMgr.h:83
@ LOOT_DISENCHANTING
Definition: LootMgr.h:84
@ LOOT_FISHINGHOLE
Definition: LootMgr.h:90
@ LOOT_NONE
Definition: LootMgr.h:79
@ LOOT_PROSPECTING
Definition: LootMgr.h:87
@ SPELL_AURA_MOD_INVISIBILITY
Definition: SpellAuraDefines.h:81
@ SPELL_AURA_FEIGN_DEATH
Definition: SpellAuraDefines.h:129
@ SPELL_AURA_MOD_STEALTH
Definition: SpellAuraDefines.h:79
@ RATE_DROP_MONEY
Definition: IWorld.h:462
@ GAMEOBJECT_TYPE_CHEST
Definition: SharedDefines.h:1563
@ UNIT_DYNFLAG_LOOTABLE
Definition: SharedDefines.h:3121
@ SMSG_LOOT_RESPONSE
Definition: Opcodes.h:382
Corpse * GetCorpse(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:182
Loot loot
Definition: Creature.h:220
void SetLootRecipient(Unit *unit, bool withGroup=true)
Definition: Creature.cpp:1258
ObjectGuid GetLootRecipientGUID() const
Definition: Creature.h:221
void SetPickPocketLootTime()
Definition: Creature.cpp:3665
Player * GetLootRecipient() const
Definition: Creature.cpp:1244
bool CanGeneratePickPocketLoot() const
Definition: Creature.cpp:3670
Group * GetLootRecipientGroup() const
Definition: Creature.cpp:1251
uint32 SkinLootId
Definition: CreatureData.h:219
uint32 pickpocketLootId
Definition: CreatureData.h:218
uint32 GetRespawnDelay() const
Definition: GameObject.h:199
bool IsWithinDistInMap(Player const *player) const
Definition: GameObject.cpp:3058
Loot loot
Definition: GameObject.h:249
LootState getLootState() const
Definition: GameObject.h:226
bool isSpawnedByDefault() const
Definition: GameObject.h:197
time_t GetRespawnTime() const
Definition: GameObject.h:185
uint32 GetLootGenerationTime() const
Definition: GameObject.h:260
void SetLootState(LootState s, Unit *unit=nullptr)
Definition: GameObject.cpp:2442
void GetFishLootJunk(Loot *loot, Player *loot_owner)
Definition: GameObject.cpp:1019
ObjectGuid GetOwnerGUID() const
Definition: GameObject.h:175
void GetFishLoot(Loot *loot, Player *loot_owner)
Definition: GameObject.cpp:999
GameObjectTemplateAddon const * GetTemplateAddon() const
Definition: GameObject.cpp:909
void SetLootGenerationTime()
Definition: GameObject.cpp:2987
uint16 GetLootMode() const
Definition: GameObject.h:230
uint32 type
Definition: GameObjectData.h:34
struct GameObjectTemplate::@223::@228 chest
uint32 groupLootRules
Definition: GameObjectData.h:99
uint32 GetLootId() const
Definition: GameObjectData.h:540
Definition: GameObjectData.h:665
Loot loot
Definition: Item.h:311
uint32 DisenchantID
Definition: ItemTemplate.h:699
uint32 MinMoneyLoot
Definition: ItemTemplate.h:701
uint32 MaxMoneyLoot
Definition: ItemTemplate.h:702
bool HasDynamicFlag(uint32 flag) const
Definition: Object.h:116
void ForceValuesUpdateAtIndex(uint32)
Definition: Object.cpp:2067
bool IsCorpse() const
Definition: ObjectGuid.h:175
bool IsItem() const
Definition: ObjectGuid.h:172
bool IsGameObject() const
Definition: ObjectGuid.h:173
void SendLootRelease(ObjectGuid guid)
Definition: Player.cpp:7679
void SetLootGUID(ObjectGuid guid)
Definition: Player.h:1957
void SendLootError(ObjectGuid guid, LootError error)
Definition: Player.cpp:8077
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:10249
void NeedBeforeGreed(Loot *loot, WorldObject *pLootedObject)
Definition: Group.cpp:1137
ObjectGuid GetMasterLooterGuid() const
Definition: Group.cpp:2265
void GroupLoot(Loot *loot, WorldObject *pLootedObject)
Definition: Group.cpp:987
void UpdateLooterGuid(WorldObject *pLootedObject, bool ifneed=false)
Definition: Group.cpp:1836
void MasterLoot(Loot *loot, WorldObject *pLootedObject)
Definition: Group.cpp:1279
void AddLooter(ObjectGuid GUID)
Definition: LootMgr.h:373
ObjectGuid containerGUID
Definition: LootMgr.h:329
bool empty() const
Definition: LootMgr.h:367
void clear()
Definition: LootMgr.h:343
uint8 unlootedCount
Definition: LootMgr.h:323
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
Definition: LootMgr.cpp:818
Definition: LootMgr.h:405

References Loot::AddLooter(), ALL_PERMISSION, BATTLEGROUND_AV, BG_AV_OBJECTID_MINE_N, BG_AV_OBJECTID_MINE_S, Creature::CanGeneratePickPocketLoot(), GameObjectTemplate::chest, Loot::clear(), Loot::containerGUID, CORPSE_BONES, CORPSE_DYNFLAG_LOOTABLE, CORPSE_FIELD_DYNAMIC_FLAGS, ItemTemplate::DisenchantID, WorldSession::DoLootRelease(), Loot::empty(), Loot::FillLoot(), Object::ForceValuesUpdateAtIndex(), FREE_FOR_ALL, GAMEOBJECT_BYTES_1, GAMEOBJECT_TYPE_CHEST, Loot::generateMoneyLoot(), GetBattleground(), ObjectAccessor::GetCorpse(), Map::GetCreature(), Creature::GetCreatureTemplate(), Object::GetEntry(), GameObject::GetFishLoot(), GameObject::GetFishLootJunk(), Map::GetGameObject(), GameTime::GetGameTime(), GameObject::GetGOInfo(), GetGroup(), Object::GetGUID(), WorldObject::GetInstanceScript(), GetItemByGuid(), Unit::GetLevel(), GameObject::GetLootGenerationTime(), GetLootGUID(), GameObjectTemplate::GetLootId(), Group::GetLootMethod(), GameObject::GetLootMode(), Creature::GetLootRecipient(), Creature::GetLootRecipientGroup(), Creature::GetLootRecipientGUID(), GameObject::getLootState(), WorldObject::GetMap(), Group::GetMasterLooterGuid(), GameObject::GetOwnerGUID(), GameObject::GetRespawnDelay(), GameObject::GetRespawnTime(), GetTeamId(), Item::GetTemplate(), GameObject::GetTemplateAddon(), Corpse::GetType(), GO_ACTIVATED, GO_READY, Loot::gold, GROUP_LOOT, GROUP_PERMISSION, Group::GroupLoot(), GameObjectTemplate::groupLootRules, Object::HasDynamicFlag(), Object::HasFlag(), INTERACTION_DISTANCE, Unit::IsAlive(), ObjectGuid::IsCorpse(), Unit::IsFriendlyTo(), ObjectGuid::IsGameObject(), ObjectGuid::IsItem(), Loot::isLooted(), GameObject::isSpawnedByDefault(), GameObject::IsWithinDistInMap(), WorldObject::IsWithinDistInMap(), LOG_DEBUG, Corpse::loot, Creature::loot, GameObject::loot, Item::loot, LOOT_CORPSE, LOOT_DISENCHANTING, LOOT_ERROR_ALREADY_PICKPOCKETED, LOOT_ERROR_DIDNT_KILL, LOOT_FISHING, LOOT_FISHING_JUNK, LOOT_FISHINGHOLE, LOOT_INSIGNIA, LOOT_MILLING, LOOT_NONE, LOOT_PICKPOCKETING, LOOT_PROSPECTING, LOOT_SKINNING, Loot::loot_type, Corpse::lootRecipient, LootTemplates_Disenchant, LootTemplates_Gameobject, LootTemplates_Item, LootTemplates_Milling, LootTemplates_Pickpocketing, LootTemplates_Player, LootTemplates_Prospecting, LootTemplates_Skinning, Item::m_lootGenerated, m_session, MASTER_LOOT, MASTER_PERMISSION, Group::MasterLoot(), ItemTemplate::MaxMoneyLoot, ItemTemplate::MinMoneyLoot, NEED_BEFORE_GREED, Group::NeedBeforeGreed(), NONE_PERMISSION, OWNER_PERMISSION, CreatureTemplate::pickpocketLootId, RATE_DROP_MONEY, Unit::RemoveAurasByType(), RESTRICTED_PERMISSION, ROUND_ROBIN, ROUND_ROBIN_PERMISSION, SendDirectMessage(), SendLootError(), SendLootRelease(), GameObject::SetLootGenerationTime(), SetLootGUID(), Creature::SetLootRecipient(), GameObject::SetLootState(), Creature::SetPickPocketLootTime(), Unit::SetUnitFlag(), CreatureTemplate::SkinLootId, sLootItemStorage, SMSG_LOOT_RESPONSE, SPELL_AURA_FEIGN_DEATH, SPELL_AURA_MOD_INVISIBILITY, SPELL_AURA_MOD_STEALTH, sScriptMgr, sWorld, GameObjectTemplate::type, UNIT_DYNFLAG_LOOTABLE, UNIT_FLAG_LOOTING, Loot::unlootedCount, Group::UpdateLooterGuid(), and urand().

Referenced by Spell::EffectMilling(), Spell::EffectPickPocket(), Spell::EffectProspecting(), Spell::EffectSkinning(), WorldSession::HandleLootOpcode(), WorldSession::HandleOpenItemOpcode(), go_hive_pod::OnGossipHello(), RemovedInsignia(), Spell::SendLoot(), and GameObject::Use().

◆ SendLootError()

void Player::SendLootError ( ObjectGuid  guid,
LootError  error 
)

◆ SendLootRelease()

void Player::SendLootRelease ( ObjectGuid  guid)
7680{
7682 data << guid << uint8(1);
7683 SendDirectMessage(&data);
7684}
@ SMSG_LOOT_RELEASE_RESPONSE
Definition: Opcodes.h:383

References SendDirectMessage(), and SMSG_LOOT_RELEASE_RESPONSE.

Referenced by WorldSession::DoLootRelease(), WorldSession::HandleAutostoreLootItemOpcode(), SendLoot(), and StoreLootItem().

◆ SendMailResult()

void Player::SendMailResult ( uint32  mailId,
MailResponseType  mailAction,
MailResponseResult  mailError,
uint32  equipError = 0,
ObjectGuid::LowType  item_guid = 0,
uint32  item_count = 0 
)
2826{
2827 WorldPacket data(SMSG_SEND_MAIL_RESULT, (4 + 4 + 4 + (mailError == MAIL_ERR_EQUIP_ERROR ? 4 : (mailAction == MAIL_ITEM_TAKEN ? 4 + 4 : 0))));
2828 data << (uint32) mailId;
2829 data << (uint32) mailAction;
2830 data << (uint32) mailError;
2831 if (mailError == MAIL_ERR_EQUIP_ERROR)
2832 data << (uint32) equipError;
2833 else if (mailAction == MAIL_ITEM_TAKEN)
2834 {
2835 data << (uint32) item_guid; // item guid low?
2836 data << (uint32) item_count; // item count?
2837 }
2838 GetSession()->SendPacket(&data);
2839}
@ MAIL_ITEM_TAKEN
Definition: SharedDefines.h:3502
@ MAIL_ERR_EQUIP_ERROR
Definition: SharedDefines.h:3511
@ SMSG_SEND_MAIL_RESULT
Definition: Opcodes.h:599

References GetSession(), MAIL_ERR_EQUIP_ERROR, MAIL_ITEM_TAKEN, WorldSession::SendPacket(), and SMSG_SEND_MAIL_RESULT.

Referenced by WorldSession::HandleMailCreateTextItem(), WorldSession::HandleMailDelete(), WorldSession::HandleMailReturnToSender(), WorldSession::HandleMailTakeItem(), WorldSession::HandleMailTakeMoney(), and WorldSession::HandleSendMail().

◆ SendMessageToSet() [1/2]

◆ SendMessageToSet() [2/2]

void Player::SendMessageToSet ( WorldPacket const *  data,
Player const *  skipped_rcvr 
) const
inlineoverridevirtual

Reimplemented from WorldObject.

1992{ SendMessageToSetInRange(data, GetVisibilityRange(), skipped_rcvr != this, true, skipped_rcvr); } // pussywizard!

References WorldObject::GetVisibilityRange(), and SendMessageToSetInRange().

◆ SendMessageToSetInRange()

void Player::SendMessageToSetInRange ( WorldPacket const *  data,
float  dist,
bool  self,
bool  includeMargin = false,
Player const *  skipped_rcvr = nullptr 
) const
overridevirtual

Reimplemented from WorldObject.

5587{
5588 if (self)
5589 GetSession()->SendPacket(data);
5590
5591 dist += GetObjectSize();
5592 if (includeMargin)
5593 dist += VISIBILITY_COMPENSATION; // pussywizard: to ensure everyone receives all important packets
5594 Acore::MessageDistDeliverer notifier(this, data, dist, false, skipped_rcvr);
5595 Cell::VisitWorldObjects(this, notifier, dist);
5596}
#define VISIBILITY_COMPENSATION
Definition: ObjectDefines.h:26
float GetObjectSize() const
Definition: Object.cpp:2759
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:193
Definition: GridNotifiers.h:98

References WorldObject::GetObjectSize(), GetSession(), WorldSession::SendPacket(), VISIBILITY_COMPENSATION, and Cell::VisitWorldObjects().

Referenced by Say(), AchievementMgr::SendAchievementEarned(), SendMessageToSet(), TextEmote(), and Yell().

◆ SendMessageToSetInRange_OwnTeam()

void Player::SendMessageToSetInRange_OwnTeam ( WorldPacket const *  data,
float  dist,
bool  self 
) const
5599{
5600 if (self)
5601 GetSession()->SendPacket(data);
5602
5603 Acore::MessageDistDeliverer notifier(this, data, dist, true);
5604 Cell::VisitWorldObjects(this, notifier, dist);
5605}

References GetSession(), WorldSession::SendPacket(), and Cell::VisitWorldObjects().

Referenced by TextEmote().

◆ SendMirrorTimer()

void Player::SendMirrorTimer ( MirrorTimerType  Type,
uint32  MaxValue,
uint32  CurrentValue,
int32  Regen 
)
protected
733{
734 if (int(MaxValue) == DISABLED_MIRROR_TIMER)
735 {
736 if (int(CurrentValue) != DISABLED_MIRROR_TIMER)
737 StopMirrorTimer(Type);
738 return;
739 }
740 SendDirectMessage(WorldPackets::Misc::StartMirrorTimer(Type, CurrentValue, MaxValue, Regen, 0, 0).Write());
741}
Definition: MiscPackets.h:121

References DISABLED_MIRROR_TIMER, SendDirectMessage(), and StopMirrorTimer().

Referenced by HandleDrowning().

◆ SendMovieStart()

void Player::SendMovieStart ( uint32  MovieId)
5624{
5626 data << uint32(MovieId);
5627 SendDirectMessage(&data);
5628}
@ SMSG_TRIGGER_MOVIE
Definition: Opcodes.h:1154

References SendDirectMessage(), and SMSG_TRIGGER_MOVIE.

Referenced by debug_commandscript::HandleDebugPlayMovieCommand().

◆ SendNewItem()

void Player::SendNewItem ( Item item,
uint32  count,
bool  received,
bool  created,
bool  broadcast = false,
bool  sendChatMessage = true 
)
4771{
4772 if (!item) // prevent crash
4773 return;
4774
4775 // last check 2.0.10
4776 WorldPacket data(SMSG_ITEM_PUSH_RESULT, (8 + 4 + 4 + 4 + 1 + 4 + 4 + 4 + 4 + 4));
4777 data << GetGUID(); // player GUID
4778 data << uint32(received); // 0=looted, 1=from npc
4779 data << uint32(created); // 0=received, 1=created
4780 data << uint32(sendChatMessage); // bool print message to chat
4781 data << uint8(item->GetBagSlot()); // bagslot
4782 // item slot, but when added to stack: 0xFFFFFFFF
4783 data << uint32((item->GetCount() == count) ? item->GetSlot() : -1);
4784 data << uint32(item->GetEntry()); // item id
4785 data << uint32(item->GetItemSuffixFactor()); // SuffixFactor
4786 data << int32(item->GetItemRandomPropertyId()); // random item property id
4787 data << uint32(count); // count of items
4788 data << uint32(GetItemCount(item->GetEntry())); // count of items in inventory
4789
4790 if (broadcast && GetGroup())
4791 GetGroup()->BroadcastPacket(&data, true);
4792 else
4793 GetSession()->SendPacket(&data);
4794}
@ SMSG_ITEM_PUSH_RESULT
Definition: Opcodes.h:388
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignore=ObjectGuid::Empty)
Definition: Group.cpp:1725

References Group::BroadcastPacket(), Item::GetBagSlot(), Item::GetCount(), Object::GetEntry(), GetGroup(), Object::GetGUID(), GetItemCount(), Item::GetItemRandomPropertyId(), Item::GetItemSuffixFactor(), GetSession(), Item::GetSlot(), WorldSession::SendPacket(), and SMSG_ITEM_PUSH_RESULT.

Referenced by _StoreOrEquipNewItem(), AddItem(), AutoStoreLoot(), Spell::DoCreateItem(), GiveQuestSourceItem(), misc_commandscript::HandleAddItemCommand(), misc_commandscript::HandleAddItemSetCommand(), AuraEffect::HandleChannelDeathItem(), OPvPCapturePointNA::HandleCustomSpell(), WorldSession::HandleLootMasterGiveOpcode(), WorldSession::HandlePetitionBuyOpcode(), npc_tyrande_whisperwind::OnGossipSelect(), RefundItem(), RemovePet(), RewardQuest(), npc_oculus_drakegiver::StoreEssence(), and StoreLootItem().

◆ SendNewMail()

void Player::SendNewMail ( )
2842{
2843 // deliver undelivered mail
2845 data << (uint32) 0;
2846 GetSession()->SendPacket(&data);
2847}
@ SMSG_RECEIVED_MAIL
Definition: Opcodes.h:675

References GetSession(), WorldSession::SendPacket(), and SMSG_RECEIVED_MAIL.

Referenced by AddNewMailDeliverTime(), and Update().

◆ SendNotifyLootItemRemoved()

void Player::SendNotifyLootItemRemoved ( uint8  lootSlot)
8093{
8095 data << uint8(lootSlot);
8096 GetSession()->SendPacket(&data);
8097}
@ SMSG_LOOT_REMOVED
Definition: Opcodes.h:384

References GetSession(), WorldSession::SendPacket(), and SMSG_LOOT_REMOVED.

Referenced by Loot::NotifyItemRemoved(), Loot::NotifyQuestItemRemoved(), and StoreLootItem().

◆ SendNotifyLootMoneyRemoved()

void Player::SendNotifyLootMoneyRemoved ( )
8087{
8089 GetSession()->SendPacket(&data);
8090}
@ SMSG_LOOT_CLEAR_MONEY
Definition: Opcodes.h:387

References GetSession(), WorldSession::SendPacket(), and SMSG_LOOT_CLEAR_MONEY.

Referenced by Loot::NotifyMoneyRemoved().

◆ SendPreparedGossip()

void Player::SendPreparedGossip ( WorldObject source)
209{
210 if (!source)
211 return;
212
213 if (source->GetTypeId() == TYPEID_UNIT)
214 {
215 // in case no gossip flag and quest menu not empty, open quest menu (client expect gossip menu with this flag)
217 {
218 SendPreparedQuest(source->GetGUID());
219 return;
220 }
221 }
222 else if (source->GetTypeId() == TYPEID_GAMEOBJECT)
223 {
224 // probably need to find a better way here
226 {
227 SendPreparedQuest(source->GetGUID());
228 return;
229 }
230 }
231
232 // in case non empty gossip menu (that not included quests list size) show it
233 // (quest entries from quest menu will be included in list)
234
235 uint32 textId = GetGossipTextId(source);
236
238 textId = GetGossipTextId(menuId, source);
239
240 PlayerTalkClass->SendGossipMenu(textId, source->GetGUID());
241}
@ UNIT_NPC_FLAG_GOSSIP
Definition: Unit.h:516
bool Empty() const
Definition: GossipDef.h:241
void SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID)
Definition: GossipDef.cpp:193

References QuestMenu::Empty(), PlayerMenu::GetGossipMenu(), GetGossipTextId(), Object::GetGUID(), GossipMenu::GetMenuId(), PlayerMenu::GetQuestMenu(), Object::GetTypeId(), Unit::HasNpcFlag(), PlayerTalkClass, PlayerMenu::SendGossipMenu(), SendPreparedQuest(), Object::ToCreature(), TYPEID_GAMEOBJECT, TYPEID_UNIT, and UNIT_NPC_FLAG_GOSSIP.

Referenced by WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), npc_thrall_old_hillsbrad::OnGossipHello(), go_apexis_relic::OnGossipHello(), OnGossipSelect(), Spell::SendLoot(), npc_maredis_firestar::npc_maredis_firestarAI::sGossipHello(), and GameObject::Use().

◆ SendPreparedQuest()

void Player::SendPreparedQuest ( ObjectGuid  guid)
Todo:
verify if check for !quest->IsDaily() is really correct (possibly not)
116{
117 QuestMenu& questMenu = PlayerTalkClass->GetQuestMenu();
118 if (questMenu.Empty())
119 return;
120
121 // single element case
122 if (questMenu.GetMenuItemCount() == 1)
123 {
124 QuestMenuItem const& qmi0 = questMenu.GetItem(0);
125 uint32 questId = qmi0.QuestId;
126
127 // Auto open -- maybe also should verify there is no greeting
128 if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
129 {
130 if (qmi0.QuestIcon == 4)
131 PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, CanRewardQuest(quest, false), true);
132 // Send completable on repeatable and autoCompletable quest if player don't have quest
134 else
135 {
137 if (!object || (!object->hasQuest(questId) && !object->hasInvolvedQuest(questId)))
138 {
140 return;
141 }
142
143 if (quest->IsAutoAccept() && CanAddQuest(quest, true) && CanTakeQuest(quest, true))
144 AddQuestAndCheckCompletion(quest, object);
145
146 if (quest->IsAutoComplete() || !quest->GetQuestMethod())
148 else
150 }
151 }
152 }
153 // multiple entries
154 else
155 {
156 QEmote qe;
157 qe._Delay = 0;
158 qe._Emote = 0;
159 std::string title = "";
160
161 // need pet case for some quests
163 if (creature)
164 {
165 uint32 textid = GetGossipTextId(creature);
166 GossipText const* gossiptext = sObjectMgr->GetGossipText(textid);
167 if (!gossiptext)
168 {
169 qe._Delay = 0; //TEXTEMOTE_MESSAGE; //zyg: player emote
170 qe._Emote = 0; //TEXTEMOTE_HELLO; //zyg: NPC emote
171 title = "";
172 }
173 else
174 {
175 qe = gossiptext->Options[0].Emotes[0];
176
177 if (!gossiptext->Options[0].Text_0.empty())
178 {
179 title = gossiptext->Options[0].Text_0;
180
181 int loc_idx = GetSession()->GetSessionDbLocaleIndex();
182 if (loc_idx >= 0)
183 if (NpcTextLocale const* npcTextLocale = sObjectMgr->GetNpcTextLocale(textid))
184 ObjectMgr::GetLocaleString(npcTextLocale->Text_0[0], loc_idx, title);
185 }
186 else
187 {
188 title = gossiptext->Options[0].Text_1;
189
190 int loc_idx = GetSession()->GetSessionDbLocaleIndex();
191 if (loc_idx >= 0)
192 if (NpcTextLocale const* npcTextLocale = sObjectMgr->GetNpcTextLocale(textid))
193 ObjectMgr::GetLocaleString(npcTextLocale->Text_1[0], loc_idx, title);
194 }
195 }
196 }
197
199 }
200}
@ TYPEMASK_ITEM
Definition: ObjectGuid.h:49
@ TYPEMASK_GAMEOBJECT
Definition: ObjectGuid.h:53
Definition: GossipDef.h:154
uint32 QuestId
Definition: GossipDef.h:155
uint8 QuestIcon
Definition: GossipDef.h:156
QuestMenuItem const & GetItem(uint16 index) const
Definition: GossipDef.h:248
uint8 GetMenuItemCount() const
Definition: GossipDef.h:236
void SendQuestGiverQuestList(QEmote const &eEmote, std::string const &Title, ObjectGuid guid)
Definition: GossipDef.cpp:317
void SendQuestGiverQuestDetails(Quest const *quest, ObjectGuid npcGUID, bool activateAccept) const
Definition: GossipDef.cpp:386
void SendQuestGiverRequestItems(Quest const *quest, ObjectGuid npcGUID, bool canComplete, bool closeOnCancel) const
Definition: GossipDef.cpp:752
Definition: Object.h:97
virtual bool hasQuest(uint32) const
Definition: Object.h:183
virtual bool hasInvolvedQuest(uint32) const
Definition: Object.h:184
bool CanAddQuest(Quest const *quest, bool msg)
Definition: PlayerQuest.cpp:264
void AddQuestAndCheckCompletion(Quest const *quest, Object *questGiver)
Definition: PlayerQuest.cpp:420
bool CanCompleteRepeatableQuest(Quest const *quest)
Definition: PlayerQuest.cpp:365
Definition: NPCHandler.h:25
uint32 _Emote
Definition: NPCHandler.h:26
uint32 _Delay
Definition: NPCHandler.h:27
std::string Text_0
Definition: NPCHandler.h:34
QEmote Emotes[MAX_GOSSIP_TEXT_EMOTES]
Definition: NPCHandler.h:39
std::string Text_1
Definition: NPCHandler.h:35
Definition: NPCHandler.h:45
GossipTextOption Options[MAX_GOSSIP_TEXT_OPTIONS]
Definition: NPCHandler.h:46
Definition: NPCHandler.h:55

References QEmote::_Delay, QEmote::_Emote, AddQuestAndCheckCompletion(), CanAddQuest(), CanCompleteRepeatableQuest(), CanRewardQuest(), CanTakeQuest(), GossipTextOption::Emotes, QuestMenu::Empty(), ObjectAccessor::GetCreatureOrPetOrVehicle(), GetGossipTextId(), QuestMenu::GetItem(), ObjectMgr::GetLocaleString(), QuestMenu::GetMenuItemCount(), ObjectAccessor::GetObjectByTypeMask(), PlayerMenu::GetQuestMenu(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), Object::hasInvolvedQuest(), Object::hasQuest(), GossipText::Options, PlayerTalkClass, QuestMenuItem::QuestIcon, QuestMenuItem::QuestId, PlayerMenu::SendCloseGossip(), PlayerMenu::SendQuestGiverQuestDetails(), PlayerMenu::SendQuestGiverQuestList(), PlayerMenu::SendQuestGiverRequestItems(), sObjectMgr, GossipTextOption::Text_0, GossipTextOption::Text_1, TYPEMASK_GAMEOBJECT, TYPEMASK_ITEM, and TYPEMASK_UNIT.

Referenced by npc_cos_chromie_middle::OnGossipHello(), OnGossipSelect(), SendPreparedGossip(), npc_costumed_orphan_matron::sGossipHello(), and npc_maredis_firestar::npc_maredis_firestarAI::sGossipSelect().

◆ SendProficiency()

void Player::SendProficiency ( ItemClass  itemClass,
uint32  itemSubclassMask 
)
10021{
10022 WorldPacket data(SMSG_SET_PROFICIENCY, 1 + 4);
10023 data << uint8(itemClass) << uint32(itemSubclassMask);
10024 GetSession()->SendPacket(&data);
10025}
@ SMSG_SET_PROFICIENCY
Definition: Opcodes.h:325

References GetSession(), WorldSession::SendPacket(), and SMSG_SET_PROFICIENCY.

Referenced by Spell::EffectProficiency().

◆ SendPushToPartyResponse()

void Player::SendPushToPartyResponse ( Player const *  player,
uint8  msg 
) const
2422{
2423 if (player)
2424 {
2425 WorldPacket data(MSG_QUEST_PUSH_RESULT, (8 + 1));
2426 data << player->GetGUID();
2427 data << uint8(msg); // valid values: 0-8
2428 GetSession()->SendPacket(&data);
2429 LOG_DEBUG("network", "WORLD: Sent MSG_QUEST_PUSH_RESULT");
2430 }
2431}
@ MSG_QUEST_PUSH_RESULT
Definition: Opcodes.h:660

References Object::GetGUID(), GetSession(), LOG_DEBUG, MSG_QUEST_PUSH_RESULT, and WorldSession::SendPacket().

Referenced by CanShareQuest(), debug_commandscript::HandleDebugSendQuestPartyMsgCommand(), WorldSession::HandlePushQuestToParty(), and WorldSession::HandleQuestgiverAcceptQuestOpcode().

◆ SendQuestComplete()

void Player::SendQuestComplete ( uint32  quest_id)
2333{
2334 if (quest_id)
2335 {
2337 data << uint32(quest_id);
2338 GetSession()->SendPacket(&data);
2339 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_COMPLETE quest = {}", quest_id);
2340 }
2341}
@ SMSG_QUESTUPDATE_COMPLETE
Definition: Opcodes.h:438

References GetSession(), LOG_DEBUG, WorldSession::SendPacket(), and SMSG_QUESTUPDATE_COMPLETE.

Referenced by AreaExploredOrEventHappens().

◆ SendQuestConfirmAccept()

void Player::SendQuestConfirmAccept ( Quest const *  quest,
Player pReceiver 
)
2400{
2401 if (pReceiver)
2402 {
2403 //load locale from db
2404 std::string strTitle = quest->GetTitle();
2405
2406 int loc_idx = pReceiver->GetSession()->GetSessionDbLocaleIndex();
2407 if (loc_idx >= 0)
2408 if (const QuestLocale* pLocale = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
2409 ObjectMgr::GetLocaleString(pLocale->Title, loc_idx, strTitle);
2410
2411 WorldPacket data(SMSG_QUEST_CONFIRM_ACCEPT, (4 + quest->GetTitle().size() + 8));
2412 data << uint32(quest->GetQuestId());
2413 data << quest->GetTitle();
2414 data << GetGUID();
2415 pReceiver->GetSession()->SendPacket(&data);
2416
2417 LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_CONFIRM_ACCEPT");
2418 }
2419}
@ SMSG_QUEST_CONFIRM_ACCEPT
Definition: Opcodes.h:442

References Object::GetGUID(), ObjectMgr::GetLocaleString(), Quest::GetQuestId(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), Quest::GetTitle(), LOG_DEBUG, WorldSession::SendPacket(), SMSG_QUEST_CONFIRM_ACCEPT, and sObjectMgr.

Referenced by WorldSession::HandleQuestgiverAcceptQuestOpcode().

◆ SendQuestFailed()

void Player::SendQuestFailed ( uint32  questId,
InventoryResult  reason = EQUIP_ERR_OK 
)
2369{
2370 if (questId)
2371 {
2373 data << uint32(questId);
2374 data << uint32(reason); // failed reason (valid reasons: 4, 16, 50, 17, 74, other values show default message)
2375 GetSession()->SendPacket(&data);
2376 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_FAILED");
2377 }
2378}
@ SMSG_QUESTGIVER_QUEST_FAILED
Definition: Opcodes.h:432

References GetSession(), LOG_DEBUG, WorldSession::SendPacket(), and SMSG_QUESTGIVER_QUEST_FAILED.

Referenced by FailQuest().

◆ SendQuestGiverStatusMultiple()

void Player::SendQuestGiverStatusMultiple ( )
protected
7602{
7603 uint32 count = 0;
7604
7606 data << uint32(count); // placeholder
7607
7608 for (GuidUnorderedSet::const_iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
7609 {
7610 uint32 questStatus = DIALOG_STATUS_NONE;
7611
7612 if ((*itr).IsAnyTypeCreature())
7613 {
7614 // need also pet quests case support
7615 Creature* questgiver = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, *itr);
7616 if (!questgiver || questgiver->IsHostileTo(this))
7617 continue;
7618 if (!questgiver->HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER))
7619 continue;
7620
7621 questStatus = GetQuestDialogStatus(questgiver);
7622
7623 data << questgiver->GetGUID();
7624 data << uint8(questStatus);
7625 ++count;
7626 }
7627 else if ((*itr).IsGameObject())
7628 {
7629 GameObject* questgiver = GetMap()->GetGameObject(*itr);
7630 if (!questgiver || questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
7631 continue;
7632
7633 questStatus = GetQuestDialogStatus(questgiver);
7634
7635 data << questgiver->GetGUID();
7636 data << uint8(questStatus);
7637 ++count;
7638 }
7639 }
7640
7641 data.put<uint32>(0, count); // write real count
7642 GetSession()->SendPacket(&data);
7643}
@ SMSG_QUESTGIVER_STATUS_MULTIPLE
Definition: Opcodes.h:1078
QuestGiverStatus GetQuestDialogStatus(Object *questGiver)
Definition: PlayerQuest.cpp:1581

References DIALOG_STATUS_NONE, GAMEOBJECT_TYPE_QUESTGIVER, ObjectAccessor::GetCreatureOrPetOrVehicle(), Map::GetGameObject(), GameObject::GetGoType(), Object::GetGUID(), WorldObject::GetMap(), GetQuestDialogStatus(), GetSession(), Unit::HasNpcFlag(), Unit::IsHostileTo(), m_clientGUIDs, ByteBuffer::put(), WorldSession::SendPacket(), SMSG_QUESTGIVER_STATUS_MULTIPLE, and UNIT_NPC_FLAG_QUESTGIVER.

Referenced by GiveLevel(), WorldSession::HandleDestroyItemOpcode(), WorldSession::HandleQuestgiverStatusMultipleQuery(), RewardQuest(), and SendInitialPacketsAfterAddToMap().

◆ SendQuestReward()

void Player::SendQuestReward ( Quest const *  quest,
uint32  XP 
)
2344{
2345 uint32 questid = quest->GetQuestId();
2346 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_COMPLETE quest = {}", questid);
2347 sGameEventMgr->HandleQuestComplete(questid);
2348 WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4 + 4 + 4 + 4 + 4));
2349 data << uint32(questid);
2350
2351 if (GetLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
2352 {
2353 data << uint32(XP);
2354 data << uint32(quest->GetRewOrReqMoney(GetLevel()));
2355 }
2356 else
2357 {
2358 data << uint32(0);
2359 data << uint32(quest->GetRewOrReqMoney(GetLevel()) + quest->GetRewMoneyMaxLevel());
2360 }
2361
2362 data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest)));
2363 data << uint32(quest->GetBonusTalents()); // bonus talents
2364 data << uint32(quest->GetRewArenaPoints());
2365 GetSession()->SendPacket(&data);
2366}
@ SMSG_QUESTGIVER_QUEST_COMPLETE
Definition: Opcodes.h:431

References Quest::CalculateHonorGain(), CONFIG_MAX_PLAYER_LEVEL, Quest::GetBonusTalents(), Unit::GetLevel(), Quest::GetQuestId(), GetQuestLevel(), Quest::GetRewArenaPoints(), Quest::GetRewMoneyMaxLevel(), Quest::GetRewOrReqMoney(), GetSession(), LOG_DEBUG, WorldSession::SendPacket(), sGameEventMgr, SMSG_QUESTGIVER_QUEST_COMPLETE, and sWorld.

Referenced by RewardQuest().

◆ SendQuestTimerFailed()

void Player::SendQuestTimerFailed ( uint32  quest_id)
2381{
2382 if (quest_id)
2383 {
2385 data << uint32(quest_id);
2386 GetSession()->SendPacket(&data);
2387 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_FAILEDTIMER");
2388 }
2389}
@ SMSG_QUESTUPDATE_FAILEDTIMER
Definition: Opcodes.h:437

References GetSession(), LOG_DEBUG, WorldSession::SendPacket(), and SMSG_QUESTUPDATE_FAILEDTIMER.

Referenced by FailQuest().

◆ SendQuestUpdate()

void Player::SendQuestUpdate ( uint32  questId)
1513{
1514 uint32 zone = 0, area = 0;
1515 // xinef: fixup
1516 uint32 oldSpellId = 0;
1517
1518 SpellAreaForQuestMapBounds saBounds = sSpellMgr->GetSpellAreaForQuestMapBounds(questId);
1519 if (saBounds.first != saBounds.second)
1520 {
1521 GetZoneAndAreaId(zone, area);
1522
1523 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
1524 {
1525 // xinef: spell was already casted, skip different areas with same spell
1526 if (itr->second->spellId == oldSpellId)
1527 continue;
1528 if (itr->second->autocast && itr->second->IsFitToRequirements(this, zone, area))
1529 if (!HasAura(itr->second->spellId))
1530 {
1531 CastSpell(this, itr->second->spellId, true);
1532 oldSpellId = itr->second->spellId;
1533 }
1534 }
1535 }
1536
1537 saBounds = sSpellMgr->GetSpellAreaForQuestEndMapBounds(questId);
1538
1539 // xinef: fixup
1540 uint32 skipSpellId = 0;
1541 oldSpellId = 0;
1542 if (saBounds.first != saBounds.second)
1543 {
1544 if (!zone || !area)
1545 GetZoneAndAreaId(zone, area);
1546
1547 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
1548 {
1549 // xinef: skip spell for which condition is already fulfilled
1550 if (itr->second->spellId == skipSpellId)
1551 continue;
1552 skipSpellId = 0;
1553
1554 // xinef: spells are sorted, if no condition is fulfilled remove aura
1555 if (oldSpellId && oldSpellId != itr->second->spellId)
1556 {
1557 RemoveAurasDueToSpell(oldSpellId);
1558 oldSpellId = 0;
1559 }
1560
1561 if (!itr->second->IsFitToRequirements(this, zone, area))
1562 {
1563 //RemoveAurasDueToSpell(itr->second->spellId);
1564 oldSpellId = itr->second->spellId;
1565 }
1566 else
1567 {
1568 skipSpellId = itr->second->spellId;
1569 oldSpellId = 0;
1570 }
1571 }
1572
1573 // xinef: check if we have something to remove yet
1574 if (oldSpellId)
1575 RemoveAurasDueToSpell(oldSpellId);
1576 }
1577
1579}
std::pair< SpellAreaForQuestMap::const_iterator, SpellAreaForQuestMap::const_iterator > SpellAreaForQuestMapBounds
Definition: SpellMgr.h:548

References Unit::CastSpell(), WorldObject::GetZoneAndAreaId(), Unit::HasAura(), Unit::RemoveAurasDueToSpell(), sSpellMgr, and UpdateForQuestWorldObjects().

Referenced by AddQuest(), RemoveActiveQuest(), RemoveRewardedQuest(), RewardQuest(), and SetQuestStatus().

◆ SendQuestUpdateAddCreatureOrGo()

void Player::SendQuestUpdateAddCreatureOrGo ( Quest const *  quest,
ObjectGuid  guid,
uint32  creatureOrGO_idx,
uint16  old_count,
uint16  add_count 
)
2443{
2444 ASSERT(old_count + add_count < 65536 && "mob/GO count store in 16 bits 2^16 = 65536 (0..65536)");
2445
2446 int32 entry = quest->RequiredNpcOrGo[ creatureOrGO_idx ];
2447 if (entry < 0)
2448 // client expected gameobject template id in form (id|0x80000000)
2449 entry = (-entry) | 0x80000000;
2450
2451 WorldPacket data(SMSG_QUESTUPDATE_ADD_KILL, (4 * 4 + 8));
2452 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_ADD_KILL");
2453 data << uint32(quest->GetQuestId());
2454 data << uint32(entry);
2455 data << uint32(old_count + add_count);
2456 data << uint32(quest->RequiredNpcOrGoCount[ creatureOrGO_idx ]);
2457 data << guid;
2458 GetSession()->SendPacket(&data);
2459
2460 uint16 log_slot = FindQuestSlot(quest->GetQuestId());
2461 if (log_slot < MAX_QUEST_LOG_SIZE)
2462 SetQuestSlotCounter(log_slot, creatureOrGO_idx, GetQuestSlotCounter(log_slot, creatureOrGO_idx) + add_count);
2463}
@ SMSG_QUESTUPDATE_ADD_KILL
Definition: Opcodes.h:439
uint16 GetQuestSlotCounter(uint16 slot, uint8 counter) const
Definition: Player.h:1463

References ASSERT, FindQuestSlot(), Quest::GetQuestId(), GetQuestSlotCounter(), GetSession(), LOG_DEBUG, MAX_QUEST_LOG_SIZE, Quest::RequiredNpcOrGo, Quest::RequiredNpcOrGoCount, WorldSession::SendPacket(), SetQuestSlotCounter(), and SMSG_QUESTUPDATE_ADD_KILL.

Referenced by KillCreditGO(), KilledMonsterCredit(), and TalkedToCreature().

◆ SendQuestUpdateAddItem()

void Player::SendQuestUpdateAddItem ( Quest const *  quest,
uint32  item_idx,
uint16  count 
)
2434{
2436 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_ADD_ITEM");
2437 //data << quest->RequiredItemId[item_idx];
2438 //data << count;
2439 GetSession()->SendPacket(&data);
2440}
@ SMSG_QUESTUPDATE_ADD_ITEM
Definition: Opcodes.h:440

References GetSession(), LOG_DEBUG, WorldSession::SendPacket(), and SMSG_QUESTUPDATE_ADD_ITEM.

◆ SendQuestUpdateAddPlayer()

void Player::SendQuestUpdateAddPlayer ( Quest const *  quest,
uint16  old_count,
uint16  add_count 
)
2466{
2467 ASSERT(old_count + add_count < 65536 && "player count store in 16 bits");
2468
2470 LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_ADD_PVP_KILL");
2471 data << uint32(quest->GetQuestId());
2472 data << uint32(old_count + add_count);
2473 data << uint32(quest->GetPlayersSlain());
2474 GetSession()->SendPacket(&data);
2475
2476 uint16 log_slot = FindQuestSlot(quest->GetQuestId());
2477 if (log_slot < MAX_QUEST_LOG_SIZE)
2479}
@ SMSG_QUESTUPDATE_ADD_PVP_KILL
Definition: Opcodes.h:1165

References ASSERT, FindQuestSlot(), Quest::GetPlayersSlain(), Quest::GetQuestId(), GetQuestSlotCounter(), GetSession(), LOG_DEBUG, MAX_QUEST_LOG_SIZE, QUEST_PVP_KILL_SLOT, WorldSession::SendPacket(), SetQuestSlotCounter(), and SMSG_QUESTUPDATE_ADD_PVP_KILL.

Referenced by KilledPlayerCreditForQuest().

◆ SendRaidDifficulty()

void Player::SendRaidDifficulty ( bool  IsInGroup,
int32  forcedDifficulty = -1 
)
178{
179 uint8 val = 0x00000001;
181 data << uint32(forcedDifficulty == -1 ? GetRaidDifficulty() : forcedDifficulty);
182 data << uint32(val);
183 data << uint32(IsInGroup);
184 GetSession()->SendPacket(&data);
185}
@ MSG_SET_RAID_DIFFICULTY
Definition: Opcodes.h:1289

References GetRaidDifficulty(), GetSession(), MSG_SET_RAID_DIFFICULTY, and WorldSession::SendPacket().

Referenced by Group::AddMember(), WorldSession::HandleSetRaidDifficultyOpcode(), SendInitialPacketsAfterAddToMap(), and Group::SetRaidDifficulty().

◆ SendRaidInfo()

void Player::SendRaidInfo ( )
6542{
6543 uint32 counter = 0;
6544
6546
6547 size_t p_counter = data.wpos();
6548 data << uint32(counter); // placeholder
6549
6550 time_t now = GameTime::GetGameTime().count();
6551
6552 for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
6553 {
6554 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(GetGUID(), Difficulty(i));
6555 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
6556 {
6557 if (itr->second.perm)
6558 {
6559 InstanceSave* save = itr->second.save;
6560 time_t resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime();
6561 data << uint32(save->GetMapId()); // map id
6562 data << uint32(save->GetDifficulty()); // difficulty
6563 data << ObjectGuid::Create<HighGuid::Instance>(save->GetInstanceId()); // instance id
6564 data << uint8(1); // expired = 0
6565 data << uint8(itr->second.extended ? 1 : 0);// extended = 1
6566 data << uint32(resetTime >= now ? resetTime - now : 0); // reset time
6567 ++counter;
6568 }
6569 }
6570 }
6571 data.put<uint32>(p_counter, counter);
6572 GetSession()->SendPacket(&data);
6573}
@ SMSG_RAID_INSTANCE_INFO
Definition: Opcodes.h:746
Difficulty GetDifficulty() const
Definition: InstanceSaveMgr.h:63

References InstanceSave::GetDifficulty(), InstanceSave::GetExtendedResetTime(), GameTime::GetGameTime(), Object::GetGUID(), InstanceSave::GetInstanceId(), InstanceSave::GetMapId(), InstanceSave::GetResetTime(), GetSession(), MAX_DIFFICULTY, ByteBuffer::put(), WorldSession::SendPacket(), sInstanceSaveMgr, SMSG_RAID_INSTANCE_INFO, and ByteBuffer::wpos().

Referenced by WorldSession::HandleRequestRaidInfoOpcode().

◆ SendRefundInfo()

void Player::SendRefundInfo ( Item item)
private
15439{
15440 // This function call unsets ITEM_FLAGS_REFUNDABLE if played time is over 2 hours.
15441 item->UpdatePlayedTime(this);
15442
15444 {
15445 LOG_DEBUG("entities.player.items", "Item refund: item not refundable!");
15446 return;
15447 }
15448
15449 if (GetGUID().GetCounter() != item->GetRefundRecipient()) // Formerly refundable item got traded
15450 {
15451 LOG_DEBUG("entities.player.items", "Item refund: item was traded!");
15452 item->SetNotRefundable(this);
15453 return;
15454 }
15455
15456 ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(item->GetPaidExtendedCost());
15457 if (!iece)
15458 {
15459 LOG_DEBUG("entities.player.items", "Item refund: cannot find extendedcost data.");
15460 return;
15461 }
15462
15463 WorldPacket data(SMSG_ITEM_REFUND_INFO_RESPONSE, 8 + 4 + 4 + 4 + 4 * 4 + 4 * 4 + 4 + 4);
15464 data << item->GetGUID(); // item guid
15465 data << uint32(item->GetPaidMoney()); // money cost
15466 data << uint32(iece->reqhonorpoints); // honor point cost
15467 data << uint32(iece->reqarenapoints); // arena point cost
15468 for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
15469 {
15470 data << uint32(iece->reqitem[i]);
15471 data << uint32(iece->reqitemcount[i]);
15472 }
15473 data << uint32(0);
15474 data << uint32(GetTotalPlayedTime() - item->GetPlayedTime());
15475 GetSession()->SendPacket(&data);
15476}
@ SMSG_ITEM_REFUND_INFO_RESPONSE
Definition: Opcodes.h:1232
uint32 GetTotalPlayedTime()
Definition: Player.h:1174

References Object::GetGUID(), Item::GetPaidExtendedCost(), Item::GetPaidMoney(), Item::GetPlayedTime(), Item::GetRefundRecipient(), GetSession(), GetTotalPlayedTime(), Object::HasFlag(), ITEM_FIELD_FLAG_REFUNDABLE, ITEM_FIELD_FLAGS, LOG_DEBUG, MAX_ITEM_EXTENDED_COST_REQUIREMENTS, ItemExtendedCostEntry::reqarenapoints, ItemExtendedCostEntry::reqhonorpoints, ItemExtendedCostEntry::reqitem, ItemExtendedCostEntry::reqitemcount, WorldSession::SendPacket(), Item::SetNotRefundable(), sItemExtendedCostStore, SMSG_ITEM_REFUND_INFO_RESPONSE, and Item::UpdatePlayedTime().

Referenced by WorldSession::HandleItemRefundInfoRequest(), and SwapItem().

◆ SendRemoveControlBar()

void Player::SendRemoveControlBar ( )
9617{
9619 data << uint64(0);
9620 GetSession()->SendPacket(&data);
9621}

References GetSession(), WorldSession::SendPacket(), and SMSG_PET_SPELLS.

Referenced by Unit::RemoveCharmedBy(), and Unit::SetMinion().

◆ SendResetFailedNotify()

void Player::SendResetFailedNotify ( uint32  mapid)
188{
190 data << uint32(mapid);
191 GetSession()->SendPacket(&data);
192}
@ SMSG_RESET_FAILED_NOTIFY
Definition: Opcodes.h:948

References GetSession(), WorldSession::SendPacket(), and SMSG_RESET_FAILED_NOTIFY.

◆ SendResetInstanceFailed()

void Player::SendResetInstanceFailed ( uint32  reason,
uint32  MapId 
)
334{
335 /*reasons for instance reset failure:
336 // 0: There are players inside the instance.
337 // 1: There are players offline in your party.
338 // 2>: There are players in your party attempting to zone into an instance.
339 */
341 data << uint32(reason);
342 data << uint32(MapId);
343 GetSession()->SendPacket(&data);
344}
@ SMSG_INSTANCE_RESET_FAILED
Definition: Opcodes.h:829

References GetSession(), WorldSession::SendPacket(), and SMSG_INSTANCE_RESET_FAILED.

Referenced by ResetInstances(), and Group::ResetInstances().

◆ SendResetInstanceSuccess()

void Player::SendResetInstanceSuccess ( uint32  MapId)
327{
329 data << uint32(MapId);
330 GetSession()->SendPacket(&data);
331}
@ SMSG_INSTANCE_RESET
Definition: Opcodes.h:828

References GetSession(), WorldSession::SendPacket(), and SMSG_INSTANCE_RESET.

Referenced by ResetInstances(), and Group::ResetInstances().

◆ SendRespondInspectAchievements()

void Player::SendRespondInspectAchievements ( Player player) const
13827{
13829}
void SendRespondInspectAchievements(Player *player) const
Definition: AchievementMgr.cpp:2346

References m_achievementMgr, and AchievementMgr::SendRespondInspectAchievements().

Referenced by WorldSession::HandleQueryInspectAchievements().

◆ SendSavedInstances()

void Player::SendSavedInstances ( )
6579{
6580 bool hasBeenSaved = false;
6581 WorldPacket data;
6582
6583 for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
6584 {
6585 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(GetGUID(), Difficulty(i));
6586 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
6587 {
6588 if (itr->second.perm) // only permanent binds are sent
6589 {
6590 hasBeenSaved = true;
6591 break;
6592 }
6593 }
6594 }
6595
6596 //Send opcode 811. true or false means, whether you have current raid/heroic instances
6598 data << uint32(hasBeenSaved);
6599 GetSession()->SendPacket(&data);
6600
6601 if (!hasBeenSaved)
6602 return;
6603
6604 for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
6605 {
6606 BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(GetGUID(), Difficulty(i));
6607 for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
6608 {
6609 if (itr->second.perm)
6610 {
6612 data << uint32(itr->second.save->GetMapId());
6613 GetSession()->SendPacket(&data);
6614 }
6615 }
6616 }
6617}
@ SMSG_UPDATE_INSTANCE_OWNERSHIP
Definition: Opcodes.h:841
@ SMSG_UPDATE_LAST_INSTANCE
Definition: Opcodes.h:830
void Initialize(uint16 opcode, size_t newres=200)
Definition: WorldPacket.h:69

References Object::GetGUID(), GetSession(), WorldPacket::Initialize(), MAX_DIFFICULTY, WorldSession::SendPacket(), sInstanceSaveMgr, SMSG_UPDATE_INSTANCE_OWNERSHIP, and SMSG_UPDATE_LAST_INSTANCE.

Referenced by TeleportTo().

◆ SendSellError()

void Player::SendSellError ( SellResult  msg,
Creature creature,
ObjectGuid  guid,
uint32  param 
)
4099{
4100 LOG_DEBUG("network", "WORLD: Sent SMSG_SELL_ITEM");
4101 WorldPacket data(SMSG_SELL_ITEM, (8 + 8 + (param ? 4 : 0) + 1)); // last check 2.0.10
4102 data << (creature ? creature->GetGUID() : ObjectGuid::Empty);
4103 data << guid;
4104 if (param > 0)
4105 data << uint32(param);
4106 data << uint8(msg);
4107 GetSession()->SendPacket(&data);
4108}
@ SMSG_SELL_ITEM
Definition: Opcodes.h:447

References ObjectGuid::Empty, Object::GetGUID(), GetSession(), LOG_DEBUG, WorldSession::SendPacket(), and SMSG_SELL_ITEM.

Referenced by WorldSession::HandleBuybackItem(), debug_commandscript::HandleDebugSendSellErrorCommand(), WorldSession::HandleSellItemOpcode(), and WorldSession::SendListInventory().

◆ SendSystemMessage()

void Player::SendSystemMessage ( std::string_view  msg,
bool  escapeCharacters = false 
)
16277{
16278 ChatHandler(GetSession()).SendSysMessage(msg, escapeCharacters);
16279}

References GetSession(), and ChatHandler::SendSysMessage().

◆ SendTalentsInfoData()

◆ SendTalentWipeConfirm()

void Player::SendTalentWipeConfirm ( ObjectGuid  guid)
8792{
8793 WorldPacket data(MSG_TALENT_WIPE_CONFIRM, (8 + 4));
8794 data << guid;
8795 uint32 cost = sWorld->getBoolConfig(CONFIG_NO_RESET_TALENT_COST) ? 0 : resetTalentsCost();
8796 data << cost;
8797 GetSession()->SendPacket(&data);
8798}
@ MSG_TALENT_WIPE_CONFIRM
Definition: Opcodes.h:712

References CONFIG_NO_RESET_TALENT_COST, GetSession(), MSG_TALENT_WIPE_CONFIRM, resetTalentsCost(), WorldSession::SendPacket(), and sWorld.

Referenced by Spell::EffectUntrainTalents(), and OnGossipSelect().

◆ SendTaxiNodeStatusMultiple()

void Player::SendTaxiNodeStatusMultiple ( )
10423{
10424 for (auto itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
10425 {
10426 if (!itr->IsCreature())
10427 {
10428 continue;
10429 }
10430
10431 Creature* creature = ObjectAccessor::GetCreature(*this, *itr);
10432 if (!creature || creature->IsHostileTo(this))
10433 {
10434 continue;
10435 }
10436
10437 if (!creature->HasNpcFlag(UNIT_NPC_FLAG_FLIGHTMASTER))
10438 {
10439 continue;
10440 }
10441
10442 uint32 nearestNode = sObjectMgr->GetNearestTaxiNode(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetMapId(), GetTeamId());
10443 if (!nearestNode)
10444 {
10445 continue;
10446 }
10447
10449 data << *itr;
10450 data << uint8(m_taxi.IsTaximaskNodeKnown(nearestNode) ? 1 : 0);
10451 SendDirectMessage(&data);
10452 }
10453}
@ SMSG_TAXINODE_STATUS
Definition: Opcodes.h:457
bool IsTaximaskNodeKnown(uint32 nodeidx) const
Definition: PlayerTaxi.h:36

References ObjectAccessor::GetCreature(), WorldLocation::GetMapId(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetTeamId(), Unit::HasNpcFlag(), Unit::IsHostileTo(), PlayerTaxi::IsTaximaskNodeKnown(), m_clientGUIDs, m_taxi, SendDirectMessage(), SMSG_TAXINODE_STATUS, sObjectMgr, and UNIT_NPC_FLAG_FLIGHTMASTER.

Referenced by SendInitialPacketsAfterAddToMap().

◆ SendTeleportAckPacket()

void Player::SendTeleportAckPacket ( )
1306{
1308 data << GetPackGUID();
1309 data << uint32(0); // this value increments every time
1310 BuildMovementPacket(&data);
1311 GetSession()->SendPacket(&data);
1312}
@ MSG_MOVE_TELEPORT_ACK
Definition: Opcodes.h:229
void BuildMovementPacket(ByteBuffer *data) const
Definition: Unit.cpp:20171

References Unit::BuildMovementPacket(), Object::GetPackGUID(), GetSession(), MSG_MOVE_TELEPORT_ACK, and WorldSession::SendPacket().

Referenced by TeleportTo().

◆ SendTransferAborted()

void Player::SendTransferAborted ( uint32  mapid,
TransferAbortReason  reason,
uint8  arg = 0 
)
11633{
11635 data << uint32(mapid);
11636 data << uint8(reason); // transfer abort reason
11637 switch (reason)
11638 {
11642 // these are the ONLY cases that have an extra argument in the packet!!!
11643 data << uint8(arg);
11644 break;
11645 default:
11646 break;
11647 }
11648 GetSession()->SendPacket(&data);
11649}
@ TRANSFER_ABORT_UNIQUE_MESSAGE
Definition: Player.h:784
@ TRANSFER_ABORT_INSUF_EXPAN_LVL
Definition: Player.h:782
@ SMSG_TRANSFER_ABORTED
Definition: Opcodes.h:94

References GetSession(), WorldSession::SendPacket(), SMSG_TRANSFER_ABORTED, TRANSFER_ABORT_DIFFICULTY, TRANSFER_ABORT_INSUF_EXPAN_LVL, and TRANSFER_ABORT_UNIQUE_MESSAGE.

Referenced by InstanceMap::CannotEnter(), MapMgr::PlayerCannotEnter(), Satisfy(), and TeleportTo().

◆ SendUpdateToOutOfRangeGroupMembers()

void Player::SendUpdateToOutOfRangeGroupMembers ( )
11620{
11622 return;
11623 if (Group* group = GetGroup())
11624 group->UpdatePlayerOutOfRange(this);
11625
11628 if (Pet* pet = GetPet())
11629 pet->ResetAuraUpdateMaskForRaid();
11630}
@ GROUP_UPDATE_FLAG_NONE
Definition: Group.h:99

References GetGroup(), GetPet(), GROUP_UPDATE_FLAG_NONE, m_auraRaidUpdateMask, and m_groupUpdateMask.

Referenced by Update().

◆ SendUpdateWorldState()

void Player::SendUpdateWorldState ( uint32  variable,
uint32  value 
) const
2198{
2200 worldstate.VariableID = variable;
2201 worldstate.Value = value;
2202 SendDirectMessage(worldstate.Write());
2203}
Definition: WorldStatePackets.h:50
int32 Value
Definition: WorldStatePackets.h:57
WorldPacket const * Write() override
Definition: WorldStatePackets.cpp:40
int32 VariableID
Definition: WorldStatePackets.h:56

References SendDirectMessage(), WorldPackets::WorldState::UpdateWorldState::Value, WorldPackets::WorldState::UpdateWorldState::VariableID, and WorldPackets::WorldState::UpdateWorldState::Write().

Referenced by debug_commandscript::HandleDebugUpdateWorldStateCommand(), BfCapturePoint::HandlePlayerEnter(), OPvPCapturePoint::HandlePlayerEnter(), OPvPCapturePointEP_EWT::HandlePlayerEnter(), OPvPCapturePointEP_NPT::HandlePlayerEnter(), OPvPCapturePointEP_CGT::HandlePlayerEnter(), OPvPCapturePointEP_PWT::HandlePlayerEnter(), OPvPCapturePointGH::HandlePlayerEnter(), OPvPCapturePointHP::HandlePlayerEnter(), OPvPCapturePointNA::HandlePlayerEnter(), OPvPCapturePointTF::HandlePlayerEnter(), OPvPCapturePointZM_Beacon::HandlePlayerEnter(), BfCapturePoint::HandlePlayerLeave(), OPvPCapturePoint::HandlePlayerLeave(), OPvPCapturePointEP_EWT::HandlePlayerLeave(), OPvPCapturePointEP_NPT::HandlePlayerLeave(), OPvPCapturePointEP_CGT::HandlePlayerLeave(), OPvPCapturePointEP_PWT::HandlePlayerLeave(), OPvPCapturePointGH::HandlePlayerLeave(), OPvPCapturePointHP::HandlePlayerLeave(), OPvPCapturePointNA::HandlePlayerLeave(), OPvPCapturePointTF::HandlePlayerLeave(), OPvPCapturePointZM_Beacon::HandlePlayerLeave(), npc_wg_queue::OnGossipHello(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnPlayerAreaUpdate(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::OnPlayerEnter(), instance_the_black_morass::instance_the_black_morass_InstanceMapScript::OnPlayerEnter(), instance_oculus::instance_oculus_InstanceMapScript::OnPlayerEnter(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::OnPlayerEnter(), instance_violet_hold::instance_violet_hold_InstanceMapScript::OnPlayerEnter(), SendBattlefieldWorldStates(), SendBGWeekendWorldStates(), OutdoorPvPEP::SendRemoveWorldStates(), OutdoorPvPGH::SendRemoveWorldStates(), OutdoorPvPHP::SendRemoveWorldStates(), OutdoorPvPNA::SendRemoveWorldStates(), OutdoorPvPSI::SendRemoveWorldStates(), OutdoorPvPTF::SendRemoveWorldStates(), OutdoorPvPZM::SendRemoveWorldStates(), and GameEventMgr::SendWorldStateUpdate().

◆ SetAcceptWhispers()

void Player::SetAcceptWhispers ( bool  on)
inline

◆ SetActiveSpec()

void Player::SetActiveSpec ( uint8  spec)
inline
1709{ m_activeSpec = spec; }

References m_activeSpec.

Referenced by ActivateSpec().

◆ SetAmmo()

void Player::SetAmmo ( uint32  item)
2515{
2516 if (!item)
2517 return;
2518
2519 // already set
2520 if (GetUInt32Value(PLAYER_AMMO_ID) == item)
2521 return;
2522
2523 // check ammo
2524 InventoryResult msg = CanUseAmmo(item);
2525 if (msg != EQUIP_ERR_OK)
2526 {
2527 SendEquipError(msg, nullptr, nullptr, item);
2528 return;
2529 }
2530
2532
2534}

References _ApplyAmmoBonuses(), CanUseAmmo(), EQUIP_ERR_OK, Object::GetUInt32Value(), PLAYER_AMMO_ID, SendEquipError(), and Object::SetUInt32Value().

Referenced by Create(), and WorldSession::HandleSetAmmoOpcode().

◆ SetArenaPoints()

void Player::SetArenaPoints ( uint32  value)
6178{
6179 if (value > sWorld->getIntConfig(CONFIG_MAX_ARENA_POINTS))
6180 value = sWorld->getIntConfig(CONFIG_MAX_ARENA_POINTS);
6182 if (value)
6184}
@ ITEM_ARENA_POINTS_ID
Definition: Player.h:953
@ CONFIG_MAX_ARENA_POINTS
Definition: IWorld.h:245

References AddKnownCurrency(), CONFIG_MAX_ARENA_POINTS, ITEM_ARENA_POINTS_ID, PLAYER_FIELD_ARENA_CURRENCY, Object::SetUInt32Value(), and sWorld.

Referenced by Create(), LoadFromDB(), and ModifyArenaPoints().

◆ SetArenaTeamIdInvited()

void Player::SetArenaTeamIdInvited ( uint32  ArenaTeamId)
inline

◆ SetArenaTeamInfoField()

◆ SetAtLoginFlag()

void Player::SetAtLoginFlag ( AtLoginFlags  f)
inline
2366{ m_atLoginFlags |= f; }

References m_atLoginFlags.

◆ SetAuraUpdateMaskForRaid()

void Player::SetAuraUpdateMaskForRaid ( uint8  slot)
inline
2439{ m_auraRaidUpdateMask |= (uint64(1) << slot); }

References m_auraRaidUpdateMask.

◆ SetBankBagSlotCount()

void Player::SetBankBagSlotCount ( uint8  count)
inline

◆ SetBaseModValue()

void Player::SetBaseModValue ( BaseModGroup  modGroup,
BaseModType  modType,
float  value 
)
inline
2154{ m_auraBaseMod[modGroup][modType] = value; }

References m_auraBaseMod.

Referenced by UpdateAllCritPercentages().

◆ SetBaseRune()

void Player::SetBaseRune ( uint8  index,
RuneType  baseRune 
)
inline
2477{ m_runes->runes[index].BaseRune = baseRune; }

References RuneInfo::BaseRune, m_runes, and Runes::runes.

Referenced by InitRunes().

◆ SetBattlegroundId()

◆ SetBattlegroundOrBattlefieldRaid()

void Player::SetBattlegroundOrBattlefieldRaid ( Group group,
int8  subgroup = -1 
)
13001{
13002 //we must move references from m_group to m_originalGroup
13003 if (GetGroup() && (GetGroup()->isBGGroup() || GetGroup()->isBFGroup()))
13004 {
13005 LOG_INFO("misc", "Player::SetBattlegroundOrBattlefieldRaid - current group is {} group!", (GetGroup()->isBGGroup() ? "BG" : "BF"));
13006 //ABORT(); // pussywizard: origanal group can never be bf/bg group
13007 }
13008
13010
13011 m_group.unlink();
13012 m_group.link(group, this);
13013 m_group.setSubGroup((uint8)subgroup);
13014}
uint8 GetSubGroup() const
Definition: Player.h:2435

References GetGroup(), GetSubGroup(), Reference< TO, FROM >::link(), LOG_INFO, m_group, SetOriginalGroup(), GroupReference::setSubGroup(), and Reference< TO, FROM >::unlink().

Referenced by Group::AddMember(), Battlefield::AddOrSetPlayerToCorrectBfGroup(), and Battleground::AddOrSetPlayerToCorrectBgGroup().

◆ SetBGData()

void Player::SetBGData ( BGData bgdata)
inline
2222{ m_bgData = bgdata; }

References m_bgData.

◆ SetBindPoint()

void Player::SetBindPoint ( ObjectGuid  guid)
8785{
8787 data << guid;
8788 GetSession()->SendPacket(&data);
8789}
@ SMSG_BINDER_CONFIRM
Definition: Opcodes.h:777

References GetSession(), WorldSession::SendPacket(), and SMSG_BINDER_CONFIRM.

Referenced by npc_innkeeper::OnGossipSelect(), and OnGossipSelect().

◆ SetCanBlock()

void Player::SetCanBlock ( bool  value)
13051{
13052 if (m_canBlock == value)
13053 return;
13054
13055 m_canBlock = value;
13057}
void UpdateBlockPercentage()
Definition: StatSystem.cpp:623

References m_canBlock, and UpdateBlockPercentage().

Referenced by Spell::EffectBlock().

◆ SetCanFly()

bool Player::SetCanFly ( bool  apply,
bool  packetOnly = false 
)
overridevirtual

movement counter

Reimplemented from Unit.

15839{
15840 sScriptMgr->AnticheatSetCanFlybyServer(this, apply);
15841
15842 if (!packetOnly && !Unit::SetCanFly(apply))
15843 return false;
15844
15845 if (!apply)
15847
15849 data << GetPackGUID();
15850 data << uint32(0);
15851 SendDirectMessage(&data);
15852
15853 data.Initialize(MSG_MOVE_UPDATE_CAN_FLY, 64);
15854 data << GetPackGUID();
15855 BuildMovementPacket(&data);
15856 SendMessageToSet(&data, false);
15857 return true;
15858}
@ MSG_MOVE_UPDATE_CAN_FLY
Definition: Opcodes.h:971
@ SMSG_MOVE_SET_CAN_FLY
Definition: Opcodes.h:865
@ SMSG_MOVE_UNSET_CAN_FLY
Definition: Opcodes.h:866
virtual bool SetCanFly(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20958

References Unit::BuildMovementPacket(), GameTime::GetGameTime(), Object::GetPackGUID(), Position::GetPositionZ(), WorldPacket::Initialize(), MSG_MOVE_UPDATE_CAN_FLY, SendDirectMessage(), SendMessageToSet(), Unit::SetCanFly(), SetFallInformation(), SMSG_MOVE_SET_CAN_FLY, SMSG_MOVE_UNSET_CAN_FLY, and sScriptMgr.

Referenced by Unit::KnockbackFrom().

◆ SetCanKnockback()

void Player::SetCanKnockback ( bool  value)
inline
2463{ m_canKnockback = value; }

References m_canKnockback.

Referenced by Unit::KnockbackFrom().

◆ SetCanParry()

void Player::SetCanParry ( bool  value)
13042{
13043 if (m_canParry == value)
13044 return;
13045
13046 m_canParry = value;
13048}
void UpdateParryPercentage()
Definition: StatSystem.cpp:742

References m_canParry, and UpdateParryPercentage().

Referenced by Spell::EffectParry(), and AuraEffect::HandleAuraModParryPercent().

◆ SetCanTeleport()

◆ SetCanTitanGrip()

void Player::SetCanTitanGrip ( bool  value)
13060{
13061 m_canTitanGrip = value;
13062}

References m_canTitanGrip.

Referenced by ActivateSpec(), Spell::EffectTitanGrip(), and resetTalents().

◆ SetChampioningFaction()

void Player::SetChampioningFaction ( uint32  faction)
inline
2514{ m_ChampioningFaction = faction; }

References m_ChampioningFaction.

Referenced by AuraEffect::HandleAuraDummy().

◆ setCinematic()

void Player::setCinematic ( uint8  cine)
inline
1799 {
1800 m_cinematic = cine;
1801 }

References m_cinematic.

Referenced by WorldSession::HandlePlayerLoginFromDB().

◆ SetClientControl()

void Player::SetClientControl ( Unit target,
bool  allowMove,
bool  packetOnly = false 
)
12772{
12774 data << target->GetPackGUID();
12775 data << uint8((allowMove && !target->HasUnitState(UNIT_STATE_FLEEING | UNIT_STATE_CONFUSED)) ? 1 : 0);
12776 GetSession()->SendPacket(&data);
12777
12778 // We want to set the packet only
12779 if (packetOnly)
12780 return;
12781
12782 if (this != target)
12783 SetViewpoint(target, allowMove);
12784
12785 if (allowMove)
12786 SetMover(target);
12787
12788 // Xinef: disable moving if target has disable move flag
12789 if (target->GetTypeId() != TYPEID_UNIT)
12790 return;
12791
12792 if (allowMove && target->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
12793 {
12795 target->SetControlled(true, UNIT_STATE_ROOT);
12796 }
12797 else if (!allowMove && target->HasUnitState(UNIT_STATE_ROOT) && !target->HasUnitTypeMask(UNIT_MASK_ACCESSORY))
12798 {
12800 {
12801 // Xinef: restore original orientation, important for shooting vehicles!
12803 target->SetOrientation(pos.GetOrientation());
12804 target->SetFacingTo(pos.GetOrientation());
12805 target->DisableSpline();
12806 }
12807 else
12808 target->SetControlled(false, UNIT_STATE_ROOT);
12809 }
12810}
@ UNIT_MASK_ACCESSORY
Definition: Unit.h:684
@ UNIT_STATE_CONFUSED
Definition: Unit.h:336
@ UNIT_STATE_FLEEING
Definition: Unit.h:332
@ SMSG_CLIENT_CONTROL_UPDATE
Definition: Opcodes.h:375
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:332
void GetTransportHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:337
bool IsMOTransport() const
Definition: ObjectGuid.h:177
void SetOrientation(float orientation)
Definition: Position.h:112
void SetFacingTo(float ori)
Definition: Unit.cpp:20884
void DisableSpline()
Definition: Unit.cpp:655
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:18288
ObjectGuid GetTransGUID() const override
Definition: Unit.cpp:19020
uint32 HasUnitTypeMask(uint32 mask) const
Definition: Unit.h:1419

References Unit::ClearUnitState(), Unit::DisableSpline(), Creature::GetHomePosition(), Position::GetOrientation(), Object::GetPackGUID(), GetSession(), Unit::GetTransGUID(), Creature::GetTransportHomePosition(), Object::GetTypeId(), Unit::HasUnitFlag(), Unit::HasUnitMovementFlag(), Unit::HasUnitState(), Unit::HasUnitTypeMask(), ObjectGuid::IsMOTransport(), MOVEMENTFLAG_ONTRANSPORT, WorldSession::SendPacket(), Unit::SetControlled(), Unit::SetFacingTo(), SetMover(), Position::SetOrientation(), SetViewpoint(), PackedGuid::size(), SMSG_CLIENT_CONTROL_UPDATE, Object::ToCreature(), TYPEID_UNIT, UNIT_FLAG_DISABLE_MOVE, UNIT_MASK_ACCESSORY, UNIT_STATE_CONFUSED, UNIT_STATE_FLEEING, and UNIT_STATE_ROOT.

Referenced by Battleground::BlockMovement(), WorldSession::HandleMoveTeleportAck(), npc_pilgrims_bounty_chair::PassengerBoarded(), Unit::RemoveCharmedBy(), Unit::SetCharmedBy(), Unit::SetConfused(), and Unit::SetFeared().

◆ SetCommandStatusOff()

◆ SetCommandStatusOn()

◆ SetCommentator()

void Player::SetCommentator ( bool  on)
inline

◆ SetContestedPvPTimer()

void Player::SetContestedPvPTimer ( uint32  newTime)
inline
1832{m_contestedPvPTimer = newTime;}

References m_contestedPvPTimer.

Referenced by Unit::SetContestedPvP().

◆ SetCreationTime()

void Player::SetCreationTime ( Seconds  creationTime)
inline
2501{ m_creationTime = creationTime; }

References m_creationTime.

Referenced by LoadFromDB().

◆ SetCurrentRune()

void Player::SetCurrentRune ( uint8  index,
RuneType  currentRune 
)
inline
2478{ m_runes->runes[index].CurrentRune = currentRune; }

References RuneInfo::CurrentRune, m_runes, and Runes::runes.

Referenced by ConvertRune(), and InitRunes().

◆ SetCurrentTitle()

void Player::SetCurrentTitle ( CharTitlesEntry const *  title,
bool  clear = false 
)
inline
2507{ SetUInt32Value(PLAYER_CHOSEN_TITLE, clear ? 0 : title->bit_index); };

References CharTitlesEntry::bit_index, PLAYER_CHOSEN_TITLE, and Object::SetUInt32Value().

Referenced by SetTitle().

◆ SetDailyQuestStatus()

void Player::SetDailyQuestStatus ( uint32  quest_id)
12012{
12013 if (Quest const* qQuest = sObjectMgr->GetQuestTemplate(quest_id))
12014 {
12015 if (!qQuest->IsDFQuest())
12016 {
12017 for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
12018 {
12019 if (!GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx))
12020 {
12021 SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, quest_id);
12022 m_lastDailyQuestTime = GameTime::GetGameTime().count(); // last daily quest time
12023 m_DailyQuestChanged = true;
12024 break;
12025 }
12026 }
12027 }
12028 else
12029 {
12030 m_DFQuests.insert(quest_id);
12032 m_DailyQuestChanged = true;
12033 }
12034 }
12035}

References GameTime::GetGameTime(), Object::GetUInt32Value(), m_DailyQuestChanged, m_DFQuests, m_lastDailyQuestTime, PLAYER_FIELD_DAILY_QUESTS_1, PLAYER_MAX_DAILY_QUESTS, Object::SetUInt32Value(), and sObjectMgr.

Referenced by RewardQuest().

◆ setDeathState()

void Player::setDeathState ( DeathState  s,
bool  despawn = false 
)
overridevirtual

Reimplemented from Unit.

1008{
1009 uint32 ressSpellId = 0;
1010
1011 bool cur = IsAlive();
1012
1013 if (s == DeathState::JustDied)
1014 {
1015 if (!cur)
1016 {
1017 LOG_ERROR("entities.player", "setDeathState: attempt to kill a dead player {} ({})", GetName(), GetGUID().ToString());
1018 return;
1019 }
1020
1021 // drunken state is cleared on death
1022 SetDrunkValue(0);
1023 // lost combo points at any target (targeted combo points clear in Unit::setDeathState)
1025
1027
1028 //FIXME: is pet dismissed at dying or releasing spirit? if second, add setDeathState(DeathState::Dead) to HandleRepopRequestOpcode and define pet unsummon here with (s == DEAD)
1029 RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
1030
1031 // save value before aura remove in Unit::setDeathState
1033
1034 // xinef: disable passive area auras!
1036
1037 // passive spell
1038 if (!ressSpellId)
1039 ressSpellId = GetResurrectionSpellId();
1043
1044 // Xinef: reset all death criterias
1046 }
1047 // xinef: enable passive area auras!
1048 else if (s == DeathState::Alive)
1050
1052
1055
1056 // restore resurrection spell id for player after aura remove
1057 if (s == DeathState::JustDied && cur && ressSpellId)
1059
1060 if (IsAlive() && !cur)
1061 //clear aura case after resurrection by another way (spells will be applied before next death)
1063}
@ PLAYER_SELF_RES_SPELL
Definition: UpdateFields.h:370
@ ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH
Definition: DBCEnums.h:96
@ ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP
Definition: DBCEnums.h:141
@ ACHIEVEMENT_CRITERIA_TYPE_DEATH
Definition: DBCEnums.h:142
@ ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON
Definition: DBCEnums.h:143
uint32 GetResurrectionSpellId()
Definition: Player.cpp:12525
void ResetAchievementCriteria(AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete=false)
Definition: Player.cpp:13846
virtual void setDeathState(DeathState s, bool despawn=false)
Definition: Unit.cpp:14538

References ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH, ACHIEVEMENT_CRITERIA_TYPE_DEATH, ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP, ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON, Unit::AddUnitState(), Unit::ClearComboPoints(), clearResurrectRequestData(), Unit::ClearUnitState(), WorldObject::FindMap(), Object::GetGUID(), WorldObject::GetName(), GetResurrectionSpellId(), Object::GetUInt32Value(), Unit::IsAlive(), LOG_ERROR, NeedSendSpectatorData(), PET_SAVE_NOT_IN_SLOT, PLAYER_SELF_RES_SPELL, RemovePet(), ResetAchievementCriteria(), ArenaSpectator::SendCommand_UInt32Value(), Unit::setDeathState(), SetDrunkValue(), Object::SetUInt32Value(), Position::ToString(), UNIT_STATE_ISOLATED, and UpdateAchievementCriteria().

Referenced by KillPlayer(), and ResurrectPlayer().

◆ SetDeveloper()

void Player::SetDeveloper ( bool  on)
inline

◆ SetDisableGravity()

bool Player::SetDisableGravity ( bool  disable,
bool  packetOnly = false,
bool  updateAnimationTier = true 
)
overridevirtual

movement counter

Reimplemented from Unit.

15822{
15823 if (!packetOnly && !Unit::SetDisableGravity(disable))
15824 return false;
15825
15827 data << GetPackGUID();
15828 data << uint32(0);
15829 SendDirectMessage(&data);
15830
15831 data.Initialize(MSG_MOVE_GRAVITY_CHNG, 64);
15832 data << GetPackGUID();
15833 BuildMovementPacket(&data);
15834 SendMessageToSet(&data, false);
15835 return true;
15836}
@ SMSG_MOVE_GRAVITY_DISABLE
Definition: Opcodes.h:1260
@ SMSG_MOVE_GRAVITY_ENABLE
Definition: Opcodes.h:1262
@ MSG_MOVE_GRAVITY_CHNG
Definition: Opcodes.h:1264
virtual bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20921

References Unit::BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), MSG_MOVE_GRAVITY_CHNG, SendDirectMessage(), SendMessageToSet(), Unit::SetDisableGravity(), SMSG_MOVE_GRAVITY_DISABLE, and SMSG_MOVE_GRAVITY_ENABLE.

Referenced by npc_vortex_ride::npc_vortex_rideAI::PassengerBoarded().

◆ SetDivider()

◆ SetDrunkValue()

void Player::SetDrunkValue ( uint8  newDrunkValue,
uint32  itemId = 0 
)
973{
974 bool isSobering = newDrunkValue < GetDrunkValue();
976 if (newDrunkValue > 100)
977 newDrunkValue = 100;
978
979 // select drunk percent or total SPELL_AURA_MOD_FAKE_INEBRIATE amount, whichever is higher for visibility updates
980 int32 drunkPercent = std::max<int32>(newDrunkValue, GetTotalAuraModifier(SPELL_AURA_MOD_FAKE_INEBRIATE));
981 if (drunkPercent)
982 {
985 }
986 else if (!HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE) && !newDrunkValue)
988
989 uint32 newDrunkenState = Player::GetDrunkenstateByValue(newDrunkValue);
990 SetByteValue(PLAYER_BYTES_3, 1, newDrunkValue);
992
993 if (!isSobering)
994 m_drunkTimer = 0; // reset sobering timer
995
996 if (newDrunkenState == oldDrunkenState)
997 return;
998
1000 data.Guid = GetGUID();
1001 data.Threshold = newDrunkenState;
1002 data.ItemID = itemId;
1003
1004 SendMessageToSet(data.Write(), true);
1005}
@ SPELL_AURA_MOD_FAKE_INEBRIATE
Definition: SpellAuraDefines.h:367
@ INVISIBILITY_DRUNK
Definition: SharedDefines.h:1261
void AddFlag(FLAG_TYPE flag)
Definition: Object.h:356
void DelFlag(FLAG_TYPE flag)
Definition: Object.h:357
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:360
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition: Object.h:507
static DrunkenState GetDrunkenstateByValue(uint8 value)
Definition: Player.cpp:961
WorldPacket const * Write() override
Definition: MiscPackets.cpp:113
ObjectGuid Guid
Definition: MiscPackets.h:175
uint32 Threshold
Definition: MiscPackets.h:176
uint32 ItemID
Definition: MiscPackets.h:177

References FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::AddFlag(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::DelFlag(), GetDrunkenstateByValue(), GetDrunkValue(), Object::GetGUID(), Unit::GetTotalAuraModifier(), WorldPackets::Misc::CrossedInebriationThreshold::Guid, Unit::HasAuraType(), INVISIBILITY_DRUNK, WorldPackets::Misc::CrossedInebriationThreshold::ItemID, m_drunkTimer, WorldObject::m_invisibilityDetect, PLAYER_BYTES_3, SendMessageToSet(), Object::SetByteValue(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), SPELL_AURA_MOD_FAKE_INEBRIATE, WorldPackets::Misc::CrossedInebriationThreshold::Threshold, UpdateObjectVisibility(), and WorldPackets::Misc::CrossedInebriationThreshold::Write().

Referenced by Spell::EffectInebriate(), HandleSobering(), LoadFromDB(), and setDeathState().

◆ SetDungeonDifficulty()

void Player::SetDungeonDifficulty ( Difficulty  dungeon_difficulty)
inline

◆ SetEntryPoint()

void Player::SetEntryPoint ( )
11201{
11204
11205 if (!m_taxi.empty())
11206 {
11209
11212 }
11213 else
11214 {
11215 if (IsMounted())
11216 {
11218 if (!auras.empty())
11219 m_entryPointData.mountSpell = (*auras.begin())->GetId();
11220 }
11221 else
11223
11224 if (GetMap()->IsDungeon())
11225 {
11226 if (const GraveyardStruct* entry = sGraveyard->GetClosestGraveyard(this, GetTeamId()))
11227 m_entryPointData.joinPos = WorldLocation(entry->Map, entry->x, entry->y, entry->z, 0.0f);
11228 }
11229 else if (!GetMap()->IsBattlegroundOrArena())
11231 }
11232
11235}
uint32 m_mapId
Definition: Position.h:319
bool empty() const
Definition: PlayerTaxi.h:74
uint32 GetTaxiDestination() const
Definition: PlayerTaxi.h:65
bool IsDungeon() const
Definition: Map.h:448
bool IsBattlegroundOrArena() const
Definition: Map.h:456

References EntryPointData::ClearTaxiPath(), PlayerTaxi::empty(), Unit::GetAuraEffectsByType(), WorldObject::GetMap(), WorldLocation::GetMapId(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), PlayerTaxi::GetTaxiDestination(), PlayerTaxi::GetTaxiSource(), GetTeamId(), Map::IsBattlegroundOrArena(), Map::IsDungeon(), Unit::IsMounted(), EntryPointData::joinPos, m_entryPointData, m_homebindMapId, m_homebindO, m_homebindX, m_homebindY, m_homebindZ, WorldLocation::m_mapId, m_taxi, MAPID_INVALID, EntryPointData::mountSpell, sGraveyard, SPELL_AURA_MOUNTED, and EntryPointData::taxiPath.

Referenced by misc_commandscript::HandleAppearCommand(), WorldSession::HandleBattleFieldPortOpcode(), misc_commandscript::HandleSkirmishCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), and lfg::LFGMgr::TeleportPlayer().

◆ SetEquipmentSet()

void Player::SetEquipmentSet ( uint32  index,
EquipmentSet  eqset 
)
14423{
14424 if (eqset.Guid != 0)
14425 {
14426 bool found = false;
14427
14428 for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
14429 {
14430 if ((itr->second.Guid == eqset.Guid) && (itr->first == index))
14431 {
14432 found = true;
14433 break;
14434 }
14435 }
14436
14437 if (!found) // something wrong...
14438 {
14439 LOG_ERROR("entities.player", "Player {} tried to save equipment set {} (index {}), but that equipment set not found!", GetName(), eqset.Guid, index);
14440 return;
14441 }
14442 }
14443
14444 EquipmentSet& eqslot = m_EquipmentSets[index];
14445
14446 EquipmentSetUpdateState old_state = eqslot.state;
14447
14448 eqslot = eqset;
14449
14450 if (eqset.Guid == 0)
14451 {
14452 eqslot.Guid = sObjectMgr->GenerateEquipmentSetGuid();
14453
14455 data << uint32(index);
14456 data.appendPackGUID(eqslot.Guid);
14457 GetSession()->SendPacket(&data);
14458 }
14459
14461}
EquipmentSetUpdateState
Definition: Player.h:742
@ SMSG_EQUIPMENT_SET_SAVED
Definition: Opcodes.h:341

References ByteBuffer::appendPackGUID(), EQUIPMENT_SET_CHANGED, EQUIPMENT_SET_NEW, WorldObject::GetName(), GetSession(), EquipmentSet::Guid, LOG_ERROR, m_EquipmentSets, WorldSession::SendPacket(), SMSG_EQUIPMENT_SET_SAVED, sObjectMgr, and EquipmentSet::state.

Referenced by WorldSession::HandleEquipmentSetSave().

◆ SetFactionForRace()

void Player::SetFactionForRace ( uint8  race)
5765{
5766 m_team = TeamIdForRace(race);
5767
5768 sScriptMgr->OnPlayerUpdateFaction(this);
5769
5770 if (GetTeamId(true) != GetTeamId())
5771 return;
5772
5773 ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race);
5774 SetFaction(rEntry ? rEntry->FactionID : 0);
5775}
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesEntryfmt)
void SetFaction(uint32 faction)
Definition: Unit.cpp:10064
Definition: DBCStructure.h:679
uint32 FactionID
Definition: DBCStructure.h:682

References ChrRacesEntry::FactionID, GetTeamId(), m_team, sChrRacesStore, Unit::SetFaction(), sScriptMgr, and TeamIdForRace().

Referenced by Create(), reset_commandscript::HandleResetStatsOrLevelHelper(), LoadFromDB(), Unit::RestoreFaction(), and SetGameMaster().

◆ SetFallInformation()

◆ SetFarSightDistance()

void Player::SetFarSightDistance ( float  radius)
16189{
16190 _farSightDistance = radius;
16191}

References _farSightDistance.

Referenced by AuraEffect::HandleFarSight().

◆ SetFeatherFall()

bool Player::SetFeatherFall ( bool  apply,
bool  packetOnly = false 
)
overridevirtual

movement counter

Reimplemented from Unit.

15903{
15904 // Xinef: moved inside, flag can be removed on landing and wont send appropriate packet to client when aura is removed
15905 if (!packetOnly/* && !Unit::SetFeatherFall(apply)*/)
15906 {
15907 Unit::SetFeatherFall(apply);
15908 //return false;
15909 }
15910
15912 data << GetPackGUID();
15913 data << uint32(0);
15914 SendDirectMessage(&data);
15915
15916 data.Initialize(MSG_MOVE_FEATHER_FALL, 64);
15917 data << GetPackGUID();
15918 BuildMovementPacket(&data);
15919 SendMessageToSet(&data, false);
15920 return true;
15921}
@ SMSG_MOVE_FEATHER_FALL
Definition: Opcodes.h:272
@ SMSG_MOVE_NORMAL_FALL
Definition: Opcodes.h:273
@ MSG_MOVE_FEATHER_FALL
Definition: Opcodes.h:718
virtual bool SetFeatherFall(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20998

References Unit::BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), MSG_MOVE_FEATHER_FALL, SendDirectMessage(), SendMessageToSet(), Unit::SetFeatherFall(), SMSG_MOVE_FEATHER_FALL, and SMSG_MOVE_NORMAL_FALL.

◆ SetFreePrimaryProfessions()

void Player::SetFreePrimaryProfessions ( uint16  profs)
inline

◆ SetFreeTalentPoints()

void Player::SetFreeTalentPoints ( uint32  points)

◆ SetGameMaster()

void Player::SetGameMaster ( bool  on)
2191{
2192 if (on)
2193 {
2195 if (GetSession()->IsGMAccount())
2199
2200 if (Pet* pet = GetPet())
2201 {
2202 if (GetSession()->IsGMAccount())
2203 pet->SetFaction(FACTION_FRIENDLY);
2204 pet->getHostileRefMgr().setOnlineOfflineState(false);
2205 }
2207 {
2209 sScriptMgr->OnFfaPvpStateUpdate(this, false);
2210 }
2212
2215
2216 SetPhaseMask(uint32(PHASEMASK_ANYWHERE), false); // see and visible in all phases
2218 }
2219 else
2220 {
2221 // restore phase
2222 uint32 newPhase = GetPhaseByAuras();
2223
2224 if (!newPhase)
2225 newPhase = PHASEMASK_NORMAL;
2226
2227 SetPhaseMask(newPhase, false);
2228
2229 m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON;
2233
2234 if (Pet* pet = GetPet())
2235 {
2236 pet->SetFaction(GetFaction());
2237 pet->getHostileRefMgr().setOnlineOfflineState(true);
2238 }
2239
2240 // restore FFA PvP Server state
2241 if (sWorld->IsFFAPvPRealm())
2242 {
2244 {
2246 sScriptMgr->OnFfaPvpStateUpdate(this, true);
2247 }
2248 }
2249 // restore FFA PvP area state, remove not allowed for GM mounts
2251
2254 }
2255
2257}
@ SEC_PLAYER
Definition: Common.h:59
@ PHASEMASK_ANYWHERE
Definition: Object.h:57
@ UNIT_FLAG2_ALLOW_CHEAT_SPELLS
Definition: Unit.h:505
@ SERVERSIDE_VISIBILITY_GM
Definition: SharedDefines.h:1273
@ FACTION_FRIENDLY
Definition: SharedDefines.h:201
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition: Object.h:510
void ResetContestedPvP()
Definition: Player.h:1833
void UpdateArea(uint32 newArea)
Definition: PlayerUpdates.cpp:1174
uint32 GetFaction() const
Definition: Unit.h:1509
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition: Unit.cpp:19313
void CombatStopWithPets(bool includingCast=false)
Definition: Unit.cpp:10456

References Unit::CombatStopWithPets(), FACTION_FRIENDLY, Unit::GetFaction(), Unit::getHostileRefMgr(), GetPet(), Unit::GetPhaseByAuras(), Unit::getRace(), GetSession(), Object::HasByteFlag(), m_areaUpdateId, m_ExtraFlags, WorldObject::m_serverSideVisibilityDetect, PHASEMASK_ANYWHERE, PHASEMASK_NORMAL, PLAYER_EXTRA_GM_ON, PLAYER_FLAGS_GM, Object::RemoveByteFlag(), RemovePlayerFlag(), Unit::RemoveUnitFlag2(), ResetContestedPvP(), SEC_PLAYER, SERVERSIDE_VISIBILITY_GM, Object::SetByteFlag(), Unit::SetFaction(), SetFactionForRace(), HostileRefMgr::setOnlineOfflineState(), Unit::SetPhaseMask(), SetPlayerFlag(), Unit::SetUnitFlag2(), FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), sScriptMgr, sWorld, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_FIELD_BYTES_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS, UpdateArea(), and UpdateObjectVisibility().

Referenced by gm_commandscript::HandleGMOffCommand(), gm_commandscript::HandleGMOnCommand(), and LoadFromDB().

◆ SetGlyph()

void Player::SetGlyph ( uint8  slot,
uint32  glyph,
bool  save 
)
inline
1726 {
1727 m_Glyphs[m_activeSpec][slot] = glyph;
1729
1730 if (save)
1731 SetNeedToSaveGlyphs(true);
1732 }
@ PLAYER_FIELD_GLYPHS_1
Definition: UpdateFields.h:389

References m_activeSpec, m_Glyphs, PLAYER_FIELD_GLYPHS_1, SetNeedToSaveGlyphs(), and Object::SetUInt32Value().

Referenced by _LoadGlyphAuras(), ActivateSpec(), Spell::EffectApplyGlyph(), and WorldSession::HandleRemoveGlyph().

◆ SetGlyphSlot()

void Player::SetGlyphSlot ( uint8  slot,
uint32  slottype 
)
inline

◆ SetGMChat()

void Player::SetGMChat ( bool  on)
inline
1151{ if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_CHAT; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_CHAT; }

References m_ExtraFlags, and PLAYER_EXTRA_GM_CHAT.

Referenced by LoadFromDB().

◆ SetGMVisible()

void Player::SetGMVisible ( bool  on)
2260{
2261 const uint32 VISUAL_AURA = 37800;
2262
2263 if (on)
2264 {
2265 RemoveAurasDueToSpell(VISUAL_AURA);
2266 m_ExtraFlags &= ~PLAYER_EXTRA_GM_INVISIBLE;
2268
2271 }
2272 else
2273 {
2274 AddAura(VISUAL_AURA, this);
2277 }
2278}
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:509

References Unit::AddAura(), Unit::CombatStopWithPets(), Unit::getHostileRefMgr(), GetSession(), m_ExtraFlags, WorldObject::m_serverSideVisibility, PLAYER_EXTRA_GM_INVISIBLE, Unit::RemoveAurasDueToSpell(), SEC_PLAYER, SERVERSIDE_VISIBILITY_GM, HostileRefMgr::setOnlineOfflineState(), and FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue().

Referenced by gm_commandscript::HandleGMVisibleCommand(), and LoadFromDB().

◆ SetGracePeriod()

void Player::SetGracePeriod ( uint8  index,
uint32  period 
)
inline

◆ SetGrantableLevels()

void Player::SetGrantableLevels ( uint8  val)
inline

◆ SetGroup()

void Player::SetGroup ( Group group,
int8  subgroup = -1 
)
11479{
11480 if (!group)
11481 m_group.unlink();
11482 else
11483 {
11484 // never use SetGroup without a subgroup unless you specify nullptr for group
11485 ASSERT(subgroup >= 0);
11486 m_group.link(group, this);
11487 m_group.setSubGroup((uint8)subgroup);
11488 }
11489
11491}

References ASSERT, Reference< TO, FROM >::link(), m_group, GroupReference::setSubGroup(), Reference< TO, FROM >::unlink(), and UpdateObjectVisibility().

Referenced by _LoadGroup(), Group::AddMember(), Group::Disband(), and Group::RemoveMember().

◆ SetGroupInvite()

void Player::SetGroupInvite ( Group group)
inline

◆ SetGroupUpdateFlag()

◆ SetGuildIdInvited()

void Player::SetGuildIdInvited ( uint32  GuildId)
inline

◆ SetHas310Flyer()

void Player::SetHas310Flyer ( bool  on)
inline
1157{ if (on) m_ExtraFlags |= PLAYER_EXTRA_HAS_310_FLYER; else m_ExtraFlags &= ~PLAYER_EXTRA_HAS_310_FLYER; }

References m_ExtraFlags, and PLAYER_EXTRA_HAS_310_FLYER.

Referenced by _addSpell(), and Has310Flyer().

◆ SetHasDelayedTeleport()

void Player::SetHasDelayedTeleport ( bool  setting)
inlineprivate
2897{ m_bHasDelayedTeleport = setting; }

References m_bHasDelayedTeleport.

Referenced by TeleportTo(), and Update().

◆ SetHomebind()

void Player::SetHomebind ( WorldLocation const &  loc,
uint32  areaId 
)
4917{
4918 loc.GetPosition(m_homebindX, m_homebindY, m_homebindZ, m_homebindO);
4919 m_homebindMapId = loc.GetMapId();
4920 m_homebindAreaId = areaId;
4921
4922 // update sql homebind
4924 stmt->SetData(0, m_homebindMapId);
4925 stmt->SetData(1, m_homebindAreaId);
4926 stmt->SetData(2, m_homebindX);
4927 stmt->SetData(3, m_homebindY);
4928 stmt->SetData(4, m_homebindZ);
4929 stmt->SetData(5, m_homebindO);
4930 stmt->SetData(6, GetGUID().GetCounter());
4931 CharacterDatabase.Execute(stmt);
4932}
@ CHAR_UPD_PLAYER_HOMEBIND
Definition: CharacterDatabase.h:241

References CHAR_UPD_PLAYER_HOMEBIND, CharacterDatabase, Object::GetGUID(), WorldLocation::GetMapId(), Position::GetPosition(), m_homebindAreaId, m_homebindMapId, m_homebindO, m_homebindX, m_homebindY, m_homebindZ, and PreparedStatementBase::SetData().

Referenced by Spell::EffectBind().

◆ SetHonorPoints()

void Player::SetHonorPoints ( uint32  value)
6157{
6158 if (value > sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS))
6159 {
6160 if (int32 copperPerPoint = sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS_MONEY_PER_POINT))
6161 {
6162 // Only convert points on login, not when awarded honor points.
6163 if (isBeingLoaded())
6164 {
6165 int32 excessPoints = value - sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS);
6166 ModifyMoney(excessPoints * copperPerPoint);
6167 }
6168 }
6169
6170 value = sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS);
6171 }
6173 if (value)
6175}
@ ITEM_HONOR_POINTS_ID
Definition: Player.h:952
@ CONFIG_MAX_HONOR_POINTS
Definition: IWorld.h:242
@ CONFIG_MAX_HONOR_POINTS_MONEY_PER_POINT
Definition: IWorld.h:243

References AddKnownCurrency(), CONFIG_MAX_HONOR_POINTS, CONFIG_MAX_HONOR_POINTS_MONEY_PER_POINT, isBeingLoaded(), ITEM_HONOR_POINTS_ID, ModifyMoney(), PLAYER_FIELD_HONOR_CURRENCY, Object::SetUInt32Value(), and sWorld.

Referenced by Create(), reset_commandscript::HandleResetHonorCommand(), LoadFromDB(), and ModifyHonorPoints().

◆ SetHover()

bool Player::SetHover ( bool  enable,
bool  packetOnly = false,
bool  updateAnimationTier = true 
)
overridevirtual

movement counter

Reimplemented from Unit.

15861{
15862 // moved inside, flag can be removed on landing and wont send appropriate packet to client when aura is removed
15863 if (!packetOnly /* && !Unit::SetHover(apply)*/)
15864 {
15865 Unit::SetHover(apply);
15866 // return false;
15867 }
15868
15870 data << GetPackGUID();
15871 data << uint32(0);
15872 SendDirectMessage(&data);
15873
15874 data.Initialize(MSG_MOVE_HOVER, 64);
15875 data << GetPackGUID();
15876 BuildMovementPacket(&data);
15877 SendMessageToSet(&data, false);
15878 return true;
15879}
@ MSG_MOVE_HOVER
Definition: Opcodes.h:277
@ SMSG_MOVE_SET_HOVER
Definition: Opcodes.h:274
@ SMSG_MOVE_UNSET_HOVER
Definition: Opcodes.h:275
virtual bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:21020

References Unit::BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), MSG_MOVE_HOVER, SendDirectMessage(), SendMessageToSet(), Unit::SetHover(), SMSG_MOVE_SET_HOVER, and SMSG_MOVE_UNSET_HOVER.

◆ SetInArenaTeam()

void Player::SetInArenaTeam ( uint32  ArenaTeamId,
uint8  slot,
uint8  type 
)
inline
1871 {
1872 SetArenaTeamInfoField(slot, ARENA_TEAM_ID, ArenaTeamId);
1874 }

References ARENA_TEAM_ID, ARENA_TEAM_TYPE, and SetArenaTeamInfoField().

Referenced by ArenaTeam::AddMember().

◆ SetInGameTime()

void Player::SetInGameTime ( uint32  time)
inline

◆ SetInGuild()

void Player::SetInGuild ( uint32  GuildId)
inline

◆ SetInviteForBattlegroundQueueType()

void Player::SetInviteForBattlegroundQueueType ( BattlegroundQueueTypeId  bgQueueTypeId,
uint32  instanceId 
)
12203{
12204 for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
12205 if (_BgBattlegroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
12206 _BgBattlegroundQueueID[i].invitedToInstance = instanceId;
12207}

References _BgBattlegroundQueueID, and PLAYER_MAX_BATTLEGROUND_QUEUES.

Referenced by BattlegroundQueue::InviteGroupToBG().

◆ SetInWater()

void Player::SetInWater ( bool  apply)
2151{
2152 if (m_isInWater == apply)
2153 return;
2154
2155 //define player in water by opcodes
2156 //move player's guid into HateOfflineList of those mobs
2157 //which can't swim and move guid back into ThreatList when
2158 //on surface.
2159 //TODO: exist also swimming mobs, and function must be symmetric to enter/leave water
2161
2162 // remove auras that need water/land
2164
2166}
@ AURA_INTERRUPT_FLAG_NOT_ABOVEWATER
Definition: SpellDefines.h:51
@ AURA_INTERRUPT_FLAG_NOT_UNDERWATER
Definition: SpellDefines.h:52
void updateThreatTables()
Definition: HostileRefMgr.cpp:111

References AURA_INTERRUPT_FLAG_NOT_ABOVEWATER, AURA_INTERRUPT_FLAG_NOT_UNDERWATER, Unit::getHostileRefMgr(), m_isInWater, Unit::RemoveAurasWithInterruptFlags(), and HostileRefMgr::updateThreatTables().

Referenced by WorldSession::HandleMovementOpcodes().

◆ SetIsSpectator()

void Player::SetIsSpectator ( bool  on)
15275{
15276 if (on)
15277 {
15281 //SetFaction(1100);
15284 {
15286 sScriptMgr->OnFfaPvpStateUpdate(this, false);
15287 }
15289 SetDisplayId(23691);
15290 }
15291 else
15292 {
15294 if (IsSpectator())
15296 m_ExtraFlags &= ~PLAYER_EXTRA_SPECTATOR_ON;
15299
15300 if (!IsGameMaster())
15301 {
15302 //SetFactionForRace(getRace());
15303
15304 // restore FFA PvP Server state
15305 // Xinef: it will be removed if necessery in UpdateArea called in WorldPortOpcode
15306 if (sWorld->IsFFAPvPRealm())
15307 {
15309 {
15311 sScriptMgr->OnFfaPvpStateUpdate(this, true);
15312
15313 }
15314 }
15315 }
15316 }
15317}
#define SPECTATOR_SPELL_SPEED
Definition: ArenaSpectator.h:39
void RestoreDisplayId()
Definition: Unit.cpp:17040

References Unit::AddAura(), Unit::AddUnitState(), Unit::ClearUnitState(), Object::HasByteFlag(), IsGameMaster(), IsSpectator(), m_ExtraFlags, PLAYER_EXTRA_SPECTATOR_ON, Unit::RemoveAurasDueToSpell(), Object::RemoveByteFlag(), Unit::RemoveUnitFlag(), ResetContestedPvP(), Unit::RestoreDisplayId(), Object::SetByteFlag(), Unit::SetDisplayId(), Unit::SetUnitFlag(), SPECTATOR_SPELL_SPEED, sScriptMgr, sWorld, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_FIELD_BYTES_2, UNIT_FLAG_NON_ATTACKABLE, and UNIT_STATE_ISOLATED.

Referenced by WorldSession::HandleMoveWorldportAck(), and WorldSession::HandlePlayerLoginFromDB().

◆ SetLastPetNumber()

void Player::SetLastPetNumber ( uint32  petnumber)
inline
2421{ m_lastpetnumber = petnumber; }

References m_lastpetnumber.

Referenced by Pet::LoadPetFromDB().

◆ SetLastPetSpell()

void Player::SetLastPetSpell ( uint32  petspell)
inline
2423{ m_oldpetspell = petspell; }

References m_oldpetspell.

Referenced by UnsummonPetTemporaryIfAny().

◆ SetLastPotionId()

void Player::SetLastPotionId ( uint32  item_id)
inline
1776{ m_lastPotionId = item_id; }

References m_lastPotionId.

Referenced by Spell::SendSpellCooldown(), and UpdatePotionCooldown().

◆ SetLastUsedRune()

void Player::SetLastUsedRune ( RuneType  type)
inline
2476{ m_runes->lastUsedRune = type; }

References Runes::lastUsedRune, and m_runes.

Referenced by Spell::TakeRunePower().

◆ SetLootGUID()

void Player::SetLootGUID ( ObjectGuid  guid)
inline
1957{ m_lootGuid = guid; }

References m_lootGuid.

Referenced by WorldSession::DoLootRelease(), and SendLoot().

◆ SetMap()

void Player::SetMap ( Map map)
overridevirtual

Reimplemented from WorldObject.

14592{
14593 Unit::SetMap(map);
14594 m_mapRef.link(map, this);
14595}
virtual void SetMap(Map *map)
Definition: Object.cpp:2096

References Reference< TO, FROM >::link(), m_mapRef, and WorldObject::SetMap().

Referenced by Map::AddPlayerToMap(), Create(), WorldSession::HandleMoveWorldportAck(), WorldSession::HandleSetRaidDifficultyOpcode(), and LoadFromDB().

◆ SetMoney()

void Player::SetMoney ( uint32  value)
inline

◆ SetMonthlyQuestStatus()

void Player::SetMonthlyQuestStatus ( uint32  quest_id)
12070{
12071 m_monthlyquests.insert(quest_id);
12072 m_MonthlyQuestChanged = true;
12073}

References m_MonthlyQuestChanged, and m_monthlyquests.

Referenced by RewardQuest().

◆ SetMountBlockId()

void Player::SetMountBlockId ( uint32  mount)
inline

◆ SetMovement()

void Player::SetMovement ( PlayerMovementType  pType)
4310{
4311 WorldPacket data;
4312 switch (pType)
4313 {
4314 case MOVE_ROOT:
4315 data.Initialize(SMSG_FORCE_MOVE_ROOT, GetPackGUID().size() + 4);
4316 break;
4317 case MOVE_UNROOT:
4318 data.Initialize(SMSG_FORCE_MOVE_UNROOT, GetPackGUID().size() + 4);
4319 break;
4320 case MOVE_WATER_WALK:
4321 data.Initialize(SMSG_MOVE_WATER_WALK, GetPackGUID().size() + 4);
4322 break;
4323 case MOVE_LAND_WALK:
4324 data.Initialize(SMSG_MOVE_LAND_WALK, GetPackGUID().size() + 4);
4325 break;
4326 default:
4327 LOG_ERROR("entities.player", "Player::SetMovement: Unsupported move type ({}), data not sent to client.", pType);
4328 return;
4329 }
4330 data << GetPackGUID();
4331 data << uint32(0);
4332 GetSession()->SendPacket(&data);
4333}
@ SMSG_MOVE_LAND_WALK
Definition: Opcodes.h:253
@ SMSG_MOVE_WATER_WALK
Definition: Opcodes.h:252
@ SMSG_FORCE_MOVE_UNROOT
Definition: Opcodes.h:264

References Object::GetPackGUID(), GetSession(), WorldPacket::Initialize(), LOG_ERROR, MOVE_LAND_WALK, MOVE_ROOT, MOVE_UNROOT, MOVE_WATER_WALK, WorldSession::SendPacket(), SMSG_FORCE_MOVE_ROOT, SMSG_FORCE_MOVE_UNROOT, SMSG_MOVE_LAND_WALK, and SMSG_MOVE_WATER_WALK.

Referenced by BuildPlayerRepop(), WorldSession::HandlePlayerLoginFromDB(), cheat_commandscript::HandleWaterWalkCheatCommand(), KillPlayer(), ResurrectPlayer(), and SendInitialPacketsAfterAddToMap().

◆ SetMover()

void Player::SetMover ( Unit target)
12813{
12814 if (this != target && target->m_movedByPlayer && target->m_movedByPlayer != target && target->m_movedByPlayer != this)
12815 {
12816 LOG_INFO("misc", "Player::SetMover (A1) - {}, {}, {}, {}, {}, {}, {}, {}", GetGUID().ToString(), GetMapId(), GetInstanceId(), FindMap()->GetId(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0);
12817 LOG_INFO("misc", "Player::SetMover (A2) - {}, {}, {}, {}, {}, {}, {}, {}", target->GetGUID().ToString(), target->GetMapId(), target->GetInstanceId(), target->FindMap()->GetId(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0);
12818 LOG_INFO("misc", "Player::SetMover (A3) - {}, {}, {}, {}, {}, {}, {}, {}", target->m_movedByPlayer->GetGUID().ToString(), target->m_movedByPlayer->GetMapId(), target->m_movedByPlayer->GetInstanceId(), target->m_movedByPlayer->FindMap()->GetId(), target->m_movedByPlayer->IsInWorld() ? 1 : 0, target->m_movedByPlayer->IsDuringRemoveFromWorld() ? 1 : 0, target->m_movedByPlayer->ToPlayer()->IsBeingTeleported() ? 1 : 0, target->m_movedByPlayer->isBeingLoaded() ? 1 : 0);
12819 }
12820 if (this != target && (!target->IsInWorld() || target->IsDuringRemoveFromWorld() || GetMapId() != target->GetMapId() || GetInstanceId() != target->GetInstanceId()))
12821 {
12822 LOG_INFO("misc", "Player::SetMover (B1) - {}, {}, {}, {}, {}, {}, {}, {}", GetGUID().ToString(), GetMapId(), GetInstanceId(), FindMap()->GetId(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0);
12823 LOG_INFO("misc", "Player::SetMover (B2) - {}, {}, {}, {}, {}, {}, {}, {}", target->GetGUID().ToString(), target->GetMapId(), target->GetInstanceId(), target->FindMap()->GetId(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0);
12824 }
12825 m_mover->m_movedByPlayer = nullptr;
12826 if (m_mover->GetTypeId() == TYPEID_UNIT)
12828
12829 m_mover = target;
12830 m_mover->m_movedByPlayer = this;
12831 if (m_mover->GetTypeId() == TYPEID_UNIT)
12833}
virtual bool isBeingLoaded() const
Definition: Unit.h:2409
bool IsDuringRemoveFromWorld() const
Definition: Unit.h:2410
void Initialize()
Definition: MotionMaster.cpp:73

References WorldObject::FindMap(), Object::GetGUID(), Map::GetId(), WorldObject::GetInstanceId(), WorldLocation::GetMapId(), Unit::GetMotionMaster(), Object::GetTypeId(), MotionMaster::Initialize(), Unit::isBeingLoaded(), isBeingLoaded(), IsBeingTeleported(), Unit::IsDuringRemoveFromWorld(), Object::IsInWorld(), LOG_INFO, Unit::m_movedByPlayer, m_mover, Object::ToPlayer(), ObjectGuid::ToString(), Position::ToString(), and TYPEID_UNIT.

Referenced by SendInitialPacketsBeforeAddToMap(), and SetClientControl().

◆ SetMustDelayTeleport()

void Player::SetMustDelayTeleport ( bool  setting)
inlineprivate
2895{ m_bMustDelayTeleport = setting; }

References m_bMustDelayTeleport.

Referenced by RewardQuest(), and Update().

◆ SetNeedToSaveGlyphs()

void Player::SetNeedToSaveGlyphs ( bool  val)
inline
2565{ m_NeedToSaveGlyphs = val; }

References m_NeedToSaveGlyphs.

Referenced by _SaveGlyphs(), and SetGlyph().

◆ SetNeedZoneUpdate()

void Player::SetNeedZoneUpdate ( bool  needUpdate)
inline
1823{ m_needZoneUpdate = needUpdate; }

References m_needZoneUpdate.

Referenced by WorldSession::HandleZoneUpdateOpcode().

◆ SetObjectScale()

void Player::SetObjectScale ( float  scale)
inlineoverridevirtual

Reimplemented from Object.

1071 {
1072 Unit::SetObjectScale(scale);
1075 }
#define DEFAULT_WORLD_OBJECT_SIZE
Definition: ObjectDefines.h:45
#define DEFAULT_COMBAT_REACH
Definition: ObjectDefines.h:46
@ UNIT_FIELD_COMBATREACH
Definition: UpdateFields.h:123
@ UNIT_FIELD_BOUNDINGRADIUS
Definition: UpdateFields.h:122
virtual void SetObjectScale(float scale)
Definition: Object.h:113

References DEFAULT_COMBAT_REACH, DEFAULT_WORLD_OBJECT_SIZE, Object::SetFloatValue(), Object::SetObjectScale(), UNIT_FIELD_BOUNDINGRADIUS, and UNIT_FIELD_COMBATREACH.

Referenced by Create(), InitStatsForLevel(), and LoadFromDB().

◆ SetOriginalGroup()

void Player::SetOriginalGroup ( Group group,
int8  subgroup = -1 
)
13029{
13030 if (!group)
13032 else
13033 {
13034 // never use SetOriginalGroup without a subgroup unless you specify nullptr for group
13035 ASSERT(subgroup >= 0);
13036 m_originalGroup.link(group, this);
13038 }
13039}

References ASSERT, Reference< TO, FROM >::link(), m_originalGroup, GroupReference::setSubGroup(), and Reference< TO, FROM >::unlink().

Referenced by Group::AddMember(), Group::Disband(), RemoveFromBattlegroundOrBattlefieldRaid(), Group::RemoveMember(), and SetBattlegroundOrBattlefieldRaid().

◆ SetPassOnGroupLoot()

void Player::SetPassOnGroupLoot ( bool  bPassOnGroupLoot)
inline
2451{ m_bPassOnGroupLoot = bPassOnGroupLoot; }

References m_bPassOnGroupLoot.

Referenced by WorldSession::HandleOptOutOfLootOpcode().

◆ SetPendingBind()

void Player::SetPendingBind ( uint32  instanceId,
uint32  bindTimer 
)
inline

◆ SetPendingSpectatorForBG()

void Player::SetPendingSpectatorForBG ( uint32  bgInstanceId)
inline

◆ SetPendingSpectatorInviteInstanceId()

void Player::SetPendingSpectatorInviteInstanceId ( uint32  bgInstanceId)
inline

◆ SetPlayerFlag()

◆ SetPvP()

void Player::SetPvP ( bool  state)
inline
1814 {
1815 Unit::SetPvP(state);
1816 if (!m_Controlled.empty())
1817 for (auto& itr : m_Controlled)
1818 itr->SetPvP(state);
1819 }
ControlSet m_Controlled
Definition: Unit.h:1881
void SetPvP(bool state)
Definition: Unit.h:1533

References Unit::m_Controlled, and Unit::SetPvP().

Referenced by UpdatePvP().

◆ SetPvPDeath()

void Player::SetPvPDeath ( bool  on)
inline
1158{ if (on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }

References m_ExtraFlags, and PLAYER_EXTRA_PVP_DEATH.

Referenced by CreateCorpse().

◆ SetQuestSlot()

◆ SetQuestSlotCounter()

void Player::SetQuestSlotCounter ( uint16  slot,
uint8  counter,
uint16  count 
)
inline

◆ SetQuestSlotState()

void Player::SetQuestSlotState ( uint16  slot,
uint32  state 
)
inline

◆ SetQuestSlotTimer()

void Player::SetQuestSlotTimer ( uint16  slot,
uint32  timer 
)
inline

◆ SetQuestStatus()

void Player::SetQuestStatus ( uint32  questId,
QuestStatus  status,
bool  update = true 
)
1466{
1467 if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
1468 {
1469 m_QuestStatus[questId].Status = status;
1470
1471 if (quest->GetQuestMethod() && !quest->IsAutoComplete())
1472 {
1473 m_QuestStatusSave[questId] = true;
1474 }
1475 }
1476
1477 if (update)
1478 SendQuestUpdate(questId);
1479}

References m_QuestStatus, m_QuestStatusSave, SendQuestUpdate(), and sObjectMgr.

Referenced by CompleteQuest(), FailQuest(), IncompleteQuest(), and npc_finklestein::npc_finklesteinAI::RightClickCauldron().

◆ SetRaidDifficulty()

void Player::SetRaidDifficulty ( Difficulty  raid_difficulty)
inline

◆ SetRandomWinner()

void Player::SetRandomWinner ( bool  isWinner)
15625{
15626 m_IsBGRandomWinner = isWinner;
15628 {
15630 stmt->SetData(0, GetGUID().GetCounter());
15631 CharacterDatabase.Execute(stmt);
15632 }
15633}
@ CHAR_INS_BATTLEGROUND_RANDOM
Definition: CharacterDatabase.h:64

References CHAR_INS_BATTLEGROUND_RANDOM, CharacterDatabase, Object::GetGUID(), m_IsBGRandomWinner, and PreparedStatementBase::SetData().

◆ SetRank()

void Player::SetRank ( uint8  rankId)
inline

◆ setRegenTimerCount()

void Player::setRegenTimerCount ( uint32  time)
inline
1577{m_regenTimerCount = time;}

References m_regenTimerCount.

Referenced by AuraEffect::HandleAuraTransform().

◆ SetRegularAttackTime()

void Player::SetRegularAttackTime ( )
5209{
5210 for (uint8 i = 0; i < MAX_ATTACK; ++i)
5211 {
5212 Item* tmpitem = GetWeaponForAttack(WeaponAttackType(i), true);
5213 if (tmpitem && !tmpitem->IsBroken())
5214 {
5215 ItemTemplate const* proto = tmpitem->GetTemplate();
5216 if (proto->Delay)
5218 }
5219 else
5220 SetAttackTime(WeaponAttackType(i), BASE_ATTACK_TIME); // If there is no weapon reset attack time to base (might have been changed from forms)
5221 }
5222}

References BASE_ATTACK_TIME, ItemTemplate::Delay, Item::GetTemplate(), GetWeaponForAttack(), Item::IsBroken(), MAX_ATTACK, and Unit::SetAttackTime().

Referenced by InitDataForForm().

◆ SetReputation()

void Player::SetReputation ( uint32  factionentry,
float  value 
)
15253{
15254 GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry), value);
15255}
bool SetReputation(FactionEntry const *factionEntry, float standing)
Definition: ReputationMgr.h:114

References GetReputationMgr(), ReputationMgr::SetReputation(), and sFactionStore.

◆ SetRestBonus()

void Player::SetRestBonus ( float  rest_bonus_new)
10119{
10120 // Prevent resting on max level
10121 if (GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
10122 rest_bonus_new = 0;
10123
10124 if (rest_bonus_new < 0)
10125 rest_bonus_new = 0;
10126
10127 float rest_bonus_max = (float)GetUInt32Value(PLAYER_NEXT_LEVEL_XP) * 1.5f / 2;
10128
10129 if (rest_bonus_new > rest_bonus_max)
10130 _restBonus = rest_bonus_max;
10131 else
10132 _restBonus = rest_bonus_new;
10133
10134 // update data for client
10135 if ((GetsRecruitAFriendBonus(true) && (GetSession()->IsARecruiter() || GetSession()->GetRecruiterId() != 0)))
10137 else
10138 {
10139 if (_restBonus > 10)
10141 else if (_restBonus <= 1)
10143 }
10144
10145 //RestTickUpdate
10147}
@ PLAYER_REST_STATE_EXPERIENCE
Definition: UpdateFields.h:358
@ REST_STATE_RESTED
Definition: Player.h:976

References _restBonus, CONFIG_MAX_PLAYER_LEVEL, Unit::GetLevel(), GetSession(), GetsRecruitAFriendBonus(), Object::GetUInt32Value(), PLAYER_BYTES_2, PLAYER_NEXT_LEVEL_XP, PLAYER_REST_STATE_EXPERIENCE, REST_STATE_NOT_RAF_LINKED, REST_STATE_RAF_LINKED, REST_STATE_RESTED, Object::SetByteValue(), Object::SetUInt32Value(), and sWorld.

Referenced by GetXPRestBonus(), LoadFromDB(), and Update().

◆ SetRestFlag()

void Player::SetRestFlag ( RestFlag  restFlag,
uint32  triggerId = 0 
)
16069{
16070 uint32 oldRestMask = _restFlagMask;
16071 _restFlagMask |= restFlag;
16072
16073 if (!oldRestMask && _restFlagMask) // only set flag/time on the first rest state
16074 {
16075 _restTime = GameTime::GetGameTime().count();
16077 }
16078
16079 if (triggerId)
16080 _innTriggerId = triggerId;
16081}

References _innTriggerId, _restFlagMask, _restTime, GameTime::GetGameTime(), PLAYER_FLAGS_RESTING, and SetPlayerFlag().

Referenced by WorldSession::HandleAreaTriggerOpcode(), LoadFromDB(), UpdateArea(), and UpdateZone().

◆ SetRestState()

void Player::SetRestState ( uint32  triggerId)

◆ setResurrectRequestData()

void Player::setResurrectRequestData ( ObjectGuid  guid,
uint32  mapId,
float  X,
float  Y,
float  Z,
uint32  health,
uint32  mana 
)
inline

◆ SetRuneConvertAura()

void Player::SetRuneConvertAura ( uint8  index,
AuraEffect const *  aura 
)
inline

◆ SetRuneCooldown()

void Player::SetRuneCooldown ( uint8  index,
uint32  cooldown 
)
inline

◆ setRuneWeaponGUID()

void Player::setRuneWeaponGUID ( ObjectGuid  guid)
inline
2555{ m_drwGUID = guid; };

References m_drwGUID.

◆ SetSaveTimer()

void Player::SetSaveTimer ( uint32  timer)
inline
2318{ m_nextSave = timer; }

References m_nextSave.

◆ SetSeasonalQuestStatus()

void Player::SetSeasonalQuestStatus ( uint32  quest_id)
12060{
12061 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
12062 if (!quest)
12063 return;
12064
12065 m_seasonalquests[quest->GetEventIdForQuest()].insert(quest_id);
12067}
uint16 GetEventIdForQuest() const
Definition: QuestDef.h:329

References Quest::GetEventIdForQuest(), m_SeasonalQuestChanged, m_seasonalquests, and sObjectMgr.

Referenced by RewardQuest().

◆ SetSeer()

void Player::SetSeer ( WorldObject target)
inline
2311{ m_seer = target; }

References m_seer.

Referenced by WorldSession::HandleFarSightOpcode(), and SetViewpoint().

◆ SetSelection()

void Player::SetSelection ( ObjectGuid  guid)

Used for serverside target changes, does not apply to players.

11471{
11473
11476}
void SendCommand_GUID(T *o, ObjectGuid targetGUID, const char *prefix, ObjectGuid t)
Definition: ArenaSpectator.h:71

References WorldObject::FindMap(), Object::GetGUID(), NeedSendSpectatorData(), ArenaSpectator::SendCommand_GUID(), Object::SetGuidValue(), and UNIT_FIELD_TARGET.

Referenced by WorldSession::HandleSetSelectionOpcode(), and TeleportTo().

◆ SetSemaphoreTeleportFar()

void Player::SetSemaphoreTeleportFar ( time_t  tm)
inline

◆ SetSemaphoreTeleportNear()

void Player::SetSemaphoreTeleportNear ( time_t  tm)
inline

◆ SetServerSideVisibility()

void Player::SetServerSideVisibility ( ServerSideVisibilityType  type,
AccountTypes  sec 
)
16175{
16176 sScriptMgr->OnSetServerSideVisibility(this, type, sec);
16177
16179}

References WorldObject::m_serverSideVisibility, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), and sScriptMgr.

◆ SetServerSideVisibilityDetect()

void Player::SetServerSideVisibilityDetect ( ServerSideVisibilityType  type,
AccountTypes  sec 
)
16182{
16183 sScriptMgr->OnSetServerSideVisibilityDetect(this, type, sec);
16184
16186}

References WorldObject::m_serverSideVisibilityDetect, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), and sScriptMgr.

◆ SetSession()

void Player::SetSession ( WorldSession sess)
inline
1962{ m_session = sess; }

References m_session.

Referenced by WorldSession::HandlePlayerLoginOpcode().

◆ SetSheath()

void Player::SetSheath ( SheathState  sheathed)
overridevirtual

Reimplemented from Unit.

107{
108 switch (sheathed)
109 {
110 case SHEATH_STATE_UNARMED: // no prepared weapon
111 SetVirtualItemSlot(0, nullptr);
112 SetVirtualItemSlot(1, nullptr);
113 SetVirtualItemSlot(2, nullptr);
114 break;
115 case SHEATH_STATE_MELEE: // prepared melee weapon
118 SetVirtualItemSlot(2, nullptr);
119 break;
120 case SHEATH_STATE_RANGED: // prepared ranged weapon
121 SetVirtualItemSlot(0, nullptr);
122 SetVirtualItemSlot(1, nullptr);
124 break;
125 default:
126 SetVirtualItemSlot(0, nullptr);
127 SetVirtualItemSlot(1, nullptr);
128 SetVirtualItemSlot(2, nullptr);
129 break;
130 }
131 Unit::SetSheath(sheathed); // this must visualize Sheath changing for other players...
132}
@ SHEATH_STATE_UNARMED
Definition: Unit.h:126
@ SHEATH_STATE_MELEE
Definition: Unit.h:127
@ SHEATH_STATE_RANGED
Definition: Unit.h:128
void SetVirtualItemSlot(uint8 i, Item *item)
Definition: PlayerStorage.cpp:86
virtual void SetSheath(SheathState sheathed)
Definition: Unit.h:1506

References BASE_ATTACK, GetWeaponForAttack(), OFF_ATTACK, RANGED_ATTACK, Unit::SetSheath(), SetVirtualItemSlot(), SHEATH_STATE_MELEE, SHEATH_STATE_RANGED, and SHEATH_STATE_UNARMED.

Referenced by WorldSession::HandleSetSheathedOpcode().

◆ SetShowDKPet()

void Player::SetShowDKPet ( bool  on)
inline

◆ SetSkill()

void Player::SetSkill ( uint16  id,
uint16  step,
uint16  currVal,
uint16  maxVal 
)
5245{
5246 if (!id)
5247 return;
5248
5249 uint16 currVal;
5250 SkillStatusMap::iterator itr = mSkillStatus.find(id);
5251
5252 //has skill
5253 if (itr != mSkillStatus.end() && itr->second.uState != SKILL_DELETED)
5254 {
5255 currVal = SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos)));
5256 if (newVal)
5257 {
5258 // if skill value is going down, update enchantments before setting the new value
5259 if (newVal < currVal)
5260 UpdateSkillEnchantments(id, currVal, newVal);
5261 // update step
5262 SetUInt32Value(PLAYER_SKILL_INDEX(itr->second.pos), MAKE_PAIR32(id, step));
5263 // update value
5264 SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos), MAKE_SKILL_VALUE(newVal, maxVal));
5265 if (itr->second.uState != SKILL_NEW)
5266 itr->second.uState = SKILL_CHANGED;
5267 learnSkillRewardedSpells(id, newVal);
5268 // if skill value is going up, update enchantments after setting the new value
5269 if (newVal > currVal)
5270 UpdateSkillEnchantments(id, currVal, newVal);
5273 }
5274 else //remove
5275 {
5276 //remove enchantments needing this skill
5277 UpdateSkillEnchantments(id, currVal, 0);
5278 // clear skill fields
5279 SetUInt32Value(PLAYER_SKILL_INDEX(itr->second.pos), 0);
5280 SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos), 0);
5281 SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos), 0);
5282
5283 // mark as deleted or simply remove from map if not saved yet
5284 if (itr->second.uState != SKILL_NEW)
5285 itr->second.uState = SKILL_DELETED;
5286 else
5287 mSkillStatus.erase(itr);
5288
5289 // remove all spells that related to this skill
5290 for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j)
5291 if (SkillLineAbilityEntry const* pAbility = sSkillLineAbilityStore.LookupEntry(j))
5292 if (pAbility->SkillLine == id)
5293 removeSpell(sSpellMgr->GetFirstSpellInChain(pAbility->Spell), SPEC_MASK_ALL, false);
5294 }
5295 }
5296 else if (newVal) //add
5297 {
5298 currVal = 0;
5299 for (int i = 0; i < PLAYER_MAX_SKILLS; ++i)
5301 {
5302 SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id);
5303 if (!pSkill)
5304 {
5305 LOG_ERROR("entities.player", "Skill not found in SkillLineStore: skill #{}", id);
5306 return;
5307 }
5308
5311 UpdateSkillEnchantments(id, currVal, newVal);
5312
5313 // insert new entry or update if not deleted old entry yet
5314 if (itr != mSkillStatus.end())
5315 {
5316 itr->second.pos = i;
5317 itr->second.uState = SKILL_CHANGED;
5318 }
5319 else
5320 mSkillStatus.insert(SkillStatusMap::value_type(id, SkillStatusData(i, SKILL_NEW)));
5321
5322 // apply skill bonuses
5324
5325 // temporary bonuses
5327 for (AuraEffectList::const_iterator j = mModSkill.begin(); j != mModSkill.end(); ++j)
5328 if ((*j)->GetMiscValue() == int32(id))
5329 (*j)->HandleEffect(this, AURA_EFFECT_HANDLE_SKILL, true);
5330
5331 // permanent bonuses
5333 for (AuraEffectList::const_iterator j = mModSkillTalent.begin(); j != mModSkillTalent.end(); ++j)
5334 if ((*j)->GetMiscValue() == int32(id))
5335 (*j)->HandleEffect(this, AURA_EFFECT_HANDLE_SKILL, true);
5336
5337 // Learn all spells for skill
5338 learnSkillRewardedSpells(id, newVal);
5341 return;
5342 }
5343 }
5344}
@ SPELL_AURA_MOD_SKILL
Definition: SpellAuraDefines.h:93
@ SPELL_AURA_MOD_SKILL_TALENT
Definition: SpellAuraDefines.h:161
@ AURA_EFFECT_HANDLE_SKILL
Definition: SpellAuraDefines.h:47
@ ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL
Definition: DBCEnums.h:133
@ ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL
Definition: DBCEnums.h:162
void UpdateSkillEnchantments(uint16 skill_id, uint16 curr_value, uint16 new_value)
Definition: PlayerStorage.cpp:4701

References ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL, ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, AURA_EFFECT_HANDLE_SKILL, Unit::GetAuraEffectsByType(), Object::GetUInt32Value(), learnSkillRewardedSpells(), LOG_ERROR, MAKE_PAIR32(), MAKE_SKILL_VALUE, mSkillStatus, PLAYER_MAX_SKILLS, PLAYER_SKILL_BONUS_INDEX, PLAYER_SKILL_INDEX, PLAYER_SKILL_VALUE_INDEX, removeSpell(), Object::SetUInt32Value(), SKILL_CHANGED, SKILL_DELETED, SKILL_NEW, SKILL_VALUE, SPEC_MASK_ALL, SPELL_AURA_MOD_SKILL, SPELL_AURA_MOD_SKILL_TALENT, sSkillLineAbilityStore, sSkillLineStore, sSpellMgr, UpdateAchievementCriteria(), and UpdateSkillEnchantments().

Referenced by _addSpell(), Spell::EffectLearnSkill(), learn_commandscript::HandleLearnAllLangCommand(), learn_commandscript::HandleLearnAllRecipesCommand(), misc_commandscript::HandleSetSkillCommand(), WorldSession::HandleUnlearnSkillOpcode(), LearnDefaultSkill(), and removeSpell().

◆ SetSpecsCount()

void Player::SetSpecsCount ( uint8  count)
inline
1711{ m_specsCount = count; }

References m_specsCount.

Referenced by UpdateSpecCount().

◆ SetSpellModTakingSpell()

void Player::SetSpellModTakingSpell ( Spell spell,
bool  apply 
)
9997{
9998 if (apply && m_spellModTakingSpell)
9999 {
10000 LOG_INFO("misc", "Player::SetSpellModTakingSpell (A1) - {}, {}", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id);
10001 return;
10002 //ASSERT(m_spellModTakingSpell == nullptr);
10003 }
10004 else if (!apply)
10005 {
10007 LOG_INFO("misc", "Player::SetSpellModTakingSpell (B1) - {}", spell->m_spellInfo->Id);
10008 else if (m_spellModTakingSpell != spell)
10009 {
10010 LOG_INFO("misc", "Player::SetSpellModTakingSpell (C1) - {}, {}", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id);
10011 return;
10012 }
10013 //ASSERT(m_spellModTakingSpell && m_spellModTakingSpell == spell);
10014 }
10015
10016 m_spellModTakingSpell = apply ? spell : nullptr;
10017}

References SpellInfo::Id, LOG_INFO, Spell::m_spellInfo, and m_spellModTakingSpell.

Referenced by Spell::_cast(), Spell::cast(), Spell::handle_delayed(), Unit::HandleDummyAuraProc(), and Aura::UpdateOwner().

◆ SetSummonAsSpectator()

void Player::SetSummonAsSpectator ( bool  on)
inline

◆ SetSummonPoint()

void Player::SetSummonPoint ( uint32  mapid,
float  x,
float  y,
float  z,
uint32  delay = 0,
bool  asSpectator = false 
)
16237{
16238 m_summon_expire = GameTime::GetGameTime().count() + (delay ? delay : MAX_PLAYER_SUMMON_DELAY);
16239 m_summon_mapid = mapid;
16240 m_summon_x = x;
16241 m_summon_y = y;
16242 m_summon_z = z;
16243 m_summon_asSpectator = asSpectator;
16244}
#define MAX_PLAYER_SUMMON_DELAY
Definition: Player.h:921

References GameTime::GetGameTime(), m_summon_asSpectator, m_summon_expire, m_summon_mapid, m_summon_x, m_summon_y, m_summon_z, and MAX_PLAYER_SUMMON_DELAY.

Referenced by Spell::EffectSummonPlayer(), and Spell::EffectSummonRaFFriend().

◆ SetTarget()

void Player::SetTarget ( ObjectGuid  = ObjectGuid::Empty)
inlineoverridevirtual

Implements Unit.

1610{ }

◆ SetTaxiCheater()

void Player::SetTaxiCheater ( bool  on)
inline

◆ setTeamId()

void Player::setTeamId ( TeamId  teamid)
inline
2074{ m_team = teamid; };

References m_team.

◆ SetTemporaryUnsummonedPetNumber()

void Player::SetTemporaryUnsummonedPetNumber ( uint32  petnumber)
inline

◆ SetTitle()

void Player::SetTitle ( CharTitlesEntry const *  title,
bool  lost = false 
)
13252{
13253 uint32 fieldIndexOffset = title->bit_index / 32;
13254 uint32 flag = 1 << (title->bit_index % 32);
13255
13256 if (lost)
13257 {
13258 if (!HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag))
13259 return;
13260
13261 // Clear the current title if it is the one being removed.
13262 if (title->bit_index == GetUInt32Value(PLAYER_CHOSEN_TITLE))
13263 {
13264 SetCurrentTitle(nullptr, true);
13265 }
13266
13267 RemoveFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
13268 }
13269 else
13270 {
13271 if (HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag))
13272 return;
13273
13274 SetFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
13275 }
13276
13277 WorldPacket data(SMSG_TITLE_EARNED, 4 + 4);
13278 data << uint32(title->bit_index);
13279 data << uint32(lost ? 0 : 1); // 1 - earned, 0 - lost
13280 GetSession()->SendPacket(&data);
13281
13283}
@ ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK
Definition: DBCEnums.h:166
@ SMSG_TITLE_EARNED
Definition: Opcodes.h:913
void SetCurrentTitle(CharTitlesEntry const *title, bool clear=false)
Definition: Player.h:2507

References ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK, CharTitlesEntry::bit_index, GetSession(), Object::GetUInt32Value(), Object::HasFlag(), PLAYER__FIELD_KNOWN_TITLES, PLAYER_CHOSEN_TITLE, Object::RemoveFlag(), WorldSession::SendPacket(), SetCurrentTitle(), Object::SetFlag(), SMSG_TITLE_EARNED, and UpdateAchievementCriteria().

Referenced by _LoadQuestStatusRewarded(), AchievementMgr::CompletedAchievement(), titles_commandscript::HandleTitlesAddCommand(), titles_commandscript::HandleTitlesCurrentCommand(), titles_commandscript::HandleTitlesRemoveCommand(), AchievementMgr::LoadFromDB(), and RewardQuest().

◆ SetViewpoint()

void Player::SetViewpoint ( WorldObject target,
bool  apply 
)
13086{
13087 if (apply)
13088 {
13089 LOG_DEBUG("maps", "Player::CreateViewpoint: Player {} create seer {} (TypeId: {}).", GetName(), target->GetEntry(), target->GetTypeId());
13090
13091 if (!AddGuidValue(PLAYER_FARSIGHT, target->GetGUID()))
13092 {
13093 LOG_DEBUG("entities.player", "Player::CreateViewpoint: Player {} cannot add new viewpoint!", GetName());
13094 return;
13095 }
13096
13097 // farsight dynobj or puppet may be very far away
13098 UpdateVisibilityOf(target);
13099
13100 if (target->isType(TYPEMASK_UNIT) && !GetVehicle())
13101 ((Unit*)target)->AddPlayerToVision(this);
13102 SetSeer(target);
13103 }
13104 else
13105 {
13106 //must immediately set seer back otherwise may crash
13107 m_seer = this;
13108
13109 LOG_DEBUG("maps", "Player::CreateViewpoint: Player {} remove seer", GetName());
13110
13111 if (!RemoveGuidValue(PLAYER_FARSIGHT, target->GetGUID()))
13112 {
13113 LOG_DEBUG("entities.player", "Player::CreateViewpoint: Player {} cannot remove current viewpoint!", GetName());
13114 return;
13115 }
13116
13117 if (target->isType(TYPEMASK_UNIT) && !GetVehicle())
13118 static_cast<Unit*>(target)->RemovePlayerFromVision(this);
13119
13120 // must immediately set seer back otherwise may crash
13121 SetSeer(this);
13122
13123 //WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0);
13124 //GetSession()->SendPacket(&data);
13125 }
13126}
bool AddGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:686
bool RemoveGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:704
void SetSeer(WorldObject *target)
Definition: Player.h:2311
void UpdateVisibilityOf(WorldObject *target)
Definition: PlayerUpdates.cpp:1671

References Object::AddGuidValue(), Object::GetEntry(), Object::GetGUID(), WorldObject::GetName(), Object::GetTypeId(), Unit::GetVehicle(), Object::isType(), LOG_DEBUG, m_seer, PLAYER_FARSIGHT, Object::RemoveGuidValue(), Unit::RemovePlayerFromVision(), SetSeer(), TYPEMASK_UNIT, and UpdateVisibilityOf().

Referenced by CinematicMgr::BeginCinematic(), CinematicMgr::EndCinematic(), AuraEffect::HandleBindSight(), WorldSession::HandleFarSightOpcode(), RemoveFromWorld(), and SetClientControl().

◆ SetVirtualItemSlot()

void Player::SetVirtualItemSlot ( uint8  i,
Item item 
)
Todo:
: this import is not necessary for compilation and marked as unused by the IDE
87{
88 ASSERT(i < 3);
89 if (i < 2 && item)
90 {
92 return;
94 if (charges == 0)
95 return;
96 if (charges > 1)
98 else if (charges <= 1)
99 {
102 }
103 }
104}

References ApplyEnchantment(), ASSERT, Item::ClearEnchantment(), Item::GetEnchantmentCharges(), Item::GetEnchantmentId(), Item::SetEnchantmentCharges(), and TEMP_ENCHANTMENT_SLOT.

Referenced by SetSheath().

◆ SetVisibleItemSlot()

void Player::SetVisibleItemSlot ( uint8  slot,
Item pItem 
)

◆ SetWaterWalking()

bool Player::SetWaterWalking ( bool  apply,
bool  packetOnly = false 
)
overridevirtual

movement counter

Reimplemented from Unit.

15882{
15883 // moved inside, flag can be removed on landing and wont send appropriate packet to client when aura is removed
15884 if (!packetOnly /* && !Unit::SetWaterWalking(apply)*/)
15885 {
15886 Unit::SetWaterWalking(apply);
15887 // return false;
15888 }
15889
15891 data << GetPackGUID();
15892 data << uint32(0);
15893 SendDirectMessage(&data);
15894
15895 data.Initialize(MSG_MOVE_WATER_WALK, 64);
15896 data << GetPackGUID();
15897 BuildMovementPacket(&data);
15898 SendMessageToSet(&data, false);
15899 return true;
15900}
@ MSG_MOVE_WATER_WALK
Definition: Opcodes.h:719
virtual bool SetWaterWalking(bool enable, bool packetOnly=false)
Definition: Unit.cpp:20976

References Unit::BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), MSG_MOVE_WATER_WALK, SendDirectMessage(), SendMessageToSet(), Unit::SetWaterWalking(), SMSG_MOVE_LAND_WALK, and SMSG_MOVE_WATER_WALK.

Referenced by BuildPlayerRepop(), and ResurrectPlayer().

◆ setWeaponChangeTimer()

void Player::setWeaponChangeTimer ( uint32  time)
inline
1578{m_weaponChangeTimer = time;}

References m_weaponChangeTimer.

◆ SetWeeklyQuestStatus()

void Player::SetWeeklyQuestStatus ( uint32  quest_id)
12054{
12055 m_weeklyquests.insert(quest_id);
12056 m_WeeklyQuestChanged = true;
12057}

References m_WeeklyQuestChanged, and m_weeklyquests.

Referenced by RewardQuest().

◆ SpawnCorpseBones()

void Player::SpawnCorpseBones ( bool  triggerSave = true)
4601{
4603 if (GetMap()->ConvertCorpseToBones(GetGUID()))
4604 if (triggerSave && !GetSession()->PlayerLogoutWithSave()) // at logout we will already store the player
4605 {
4606 // prevent loading as ghost without corpse
4607 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
4608
4609 // pussywizard: update only ghost flag instead of whole character table entry! data integrity is crucial
4611 stmt->SetData(0, GetGUID().GetCounter());
4612 trans->Append(stmt);
4613
4614 _SaveAuras(trans, false);
4615
4616 CharacterDatabase.CommitTransaction(trans);
4617 }
4618}
@ CHAR_UPD_CHAR_REMOVE_GHOST
Definition: CharacterDatabase.h:426

References _corpseLocation, _SaveAuras(), CHAR_UPD_CHAR_REMOVE_GHOST, CharacterDatabase, Object::GetGUID(), WorldObject::GetMap(), GetSession(), PreparedStatementBase::SetData(), and WorldLocation::WorldRelocate().

Referenced by Battleground::_ProcessResurrect(), CreateCorpse(), Spell::EffectSelfResurrect(), WorldSession::HandleAreaTriggerOpcode(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::HandleHearthAndResurrect(), WorldSession::HandleMoveWorldportAck(), WorldSession::HandleReclaimCorpseOpcode(), LoadCorpse(), ProcessDelayedOperations(), Battleground::RemovePlayerAtLeave(), RepopAtGraveyard(), ResurectUsingRequestData(), BfGraveyard::Resurrect(), and WorldSession::SendSpiritResurrect().

◆ SplitItem()

void Player::SplitItem ( uint16  src,
uint16  dst,
uint32  count 
)

If trading

If current item is in trade window (only possible with packet spoofing - silent return)

3444{
3445 uint8 srcbag = src >> 8;
3446 uint8 srcslot = src & 255;
3447
3448 uint8 dstbag = dst >> 8;
3449 uint8 dstslot = dst & 255;
3450
3451 Item* pSrcItem = GetItemByPos(srcbag, srcslot);
3452 if (!pSrcItem)
3453 {
3454 SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, nullptr);
3455 return;
3456 }
3457
3458 if (pSrcItem->m_lootGenerated) // prevent split looting item (item
3459 {
3460 //best error message found for attempting to split while looting
3462 return;
3463 }
3464
3465 // not let split all items (can be only at cheating)
3466 if (pSrcItem->GetCount() == count)
3467 {
3469 return;
3470 }
3471
3472 // not let split more existed items (can be only at cheating)
3473 if (pSrcItem->GetCount() < count)
3474 {
3476 return;
3477 }
3478
3480 if (TradeData* tradeData = GetTradeData())
3481 {
3483 if (tradeData->GetTradeSlotForItem(pSrcItem->GetGUID()) != TRADE_SLOT_INVALID)
3484 return;
3485 }
3486
3487 LOG_DEBUG("entities.player.items", "STORAGE: SplitItem bag = {}, slot = {}, item = {}, count = {}", dstbag, dstslot, pSrcItem->GetEntry(), count);
3488 Item* pNewItem = pSrcItem->CloneItem(count, this);
3489 if (!pNewItem)
3490 {
3491 SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, nullptr);
3492 return;
3493 }
3494
3495 if (IsInventoryPos(dst))
3496 {
3497 // change item amount before check (for unique max count check)
3498 pSrcItem->SetCount(pSrcItem->GetCount() - count);
3499
3500 ItemPosCountVec dest;
3501 InventoryResult msg = CanStoreItem(dstbag, dstslot, dest, pNewItem, false);
3502 if (msg != EQUIP_ERR_OK)
3503 {
3504 delete pNewItem;
3505 pSrcItem->SetCount(pSrcItem->GetCount() + count);
3506 SendEquipError(msg, pSrcItem, nullptr);
3507 return;
3508 }
3509
3510 if (IsInWorld())
3511 pSrcItem->SendUpdateToPlayer(this);
3512 pSrcItem->SetState(ITEM_CHANGED, this);
3513 StoreItem(dest, pNewItem, true);
3514 }
3515 else if (IsBankPos(dst))
3516 {
3517 // change item amount before check (for unique max count check)
3518 pSrcItem->SetCount(pSrcItem->GetCount() - count);
3519
3520 ItemPosCountVec dest;
3521 InventoryResult msg = CanBankItem(dstbag, dstslot, dest, pNewItem, false);
3522 if (msg != EQUIP_ERR_OK)
3523 {
3524 delete pNewItem;
3525 pSrcItem->SetCount(pSrcItem->GetCount() + count);
3526 SendEquipError(msg, pSrcItem, nullptr);
3527 return;
3528 }
3529
3530 if (IsInWorld())
3531 pSrcItem->SendUpdateToPlayer(this);
3532 pSrcItem->SetState(ITEM_CHANGED, this);
3533 BankItem(dest, pNewItem, true);
3534 }
3535 else if (IsEquipmentPos(dst))
3536 {
3537 // change item amount before check (for unique max count check), provide space for splitted items
3538 pSrcItem->SetCount(pSrcItem->GetCount() - count);
3539
3540 uint16 dest;
3541 InventoryResult msg = CanEquipItem(dstslot, dest, pNewItem, false);
3542 if (msg != EQUIP_ERR_OK)
3543 {
3544 delete pNewItem;
3545 pSrcItem->SetCount(pSrcItem->GetCount() + count);
3546 SendEquipError(msg, pSrcItem, nullptr);
3547 return;
3548 }
3549
3550 if (IsInWorld())
3551 pSrcItem->SendUpdateToPlayer(this);
3552 pSrcItem->SetState(ITEM_CHANGED, this);
3553 EquipItem(dest, pNewItem, true);
3555 }
3556}
@ EQUIP_ERR_COULDNT_SPLIT_ITEMS
Definition: Item.h:68
@ EQUIP_ERR_TRIED_TO_SPLIT_MORE_THAN_COUNT
Definition: Item.h:67
@ TRADE_SLOT_INVALID
Definition: TradeData.h:32
TradeData * GetTradeData() const
Definition: Player.h:1356
Definition: TradeData.h:36

References AutoUnequipOffhandIfNeed(), BankItem(), CanBankItem(), CanEquipItem(), CanStoreItem(), Item::CloneItem(), EQUIP_ERR_COULDNT_SPLIT_ITEMS, EQUIP_ERR_ITEM_NOT_FOUND, EQUIP_ERR_OK, EQUIP_ERR_TRIED_TO_SPLIT_MORE_THAN_COUNT, EquipItem(), Item::GetCount(), Object::GetEntry(), Object::GetGUID(), GetItemByPos(), GetTradeData(), IsBankPos(), IsEquipmentPos(), IsInventoryPos(), Object::IsInWorld(), ITEM_CHANGED, LOG_DEBUG, Item::m_lootGenerated, SendEquipError(), Object::SendUpdateToPlayer(), Item::SetCount(), Item::SetState(), StoreItem(), and TRADE_SLOT_INVALID.

Referenced by WorldSession::HandleSplitItemOpcode().

◆ StartTimedAchievement()

void Player::StartTimedAchievement ( AchievementCriteriaTimedTypes  type,
uint32  entry,
uint32  timeLost = 0 
)
13837{
13838 m_achievementMgr->StartTimedAchievement(type, entry, timeLost);
13839}
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost=0)
Definition: AchievementMgr.cpp:2183

References m_achievementMgr, and AchievementMgr::StartTimedAchievement().

Referenced by Spell::_cast(), AddQuest(), Spell::DoSpellHitOnUnit(), InstanceScript::DoStartTimedAchievement(), BattlegroundWS::EventPlayerClickedOnFlag(), and KilledMonsterCredit().

◆ StopCastingBindSight()

void Player::StopCastingBindSight ( Aura except = nullptr)
13073{
13074 if (WorldObject* target = GetViewpoint())
13075 {
13076 if (target->isType(TYPEMASK_UNIT))
13077 {
13078 ((Unit*)target)->RemoveAurasByType(SPELL_AURA_BIND_SIGHT, GetGUID(), except);
13079 ((Unit*)target)->RemoveAurasByType(SPELL_AURA_MOD_POSSESS, GetGUID(), except);
13080 ((Unit*)target)->RemoveAurasByType(SPELL_AURA_MOD_POSSESS_PET, GetGUID(), except);
13081 }
13082 }
13083}
@ SPELL_AURA_MOD_POSSESS_PET
Definition: SpellAuraDefines.h:191
@ SPELL_AURA_MOD_POSSESS
Definition: SpellAuraDefines.h:65
@ SPELL_AURA_BIND_SIGHT
Definition: SpellAuraDefines.h:64

References Object::GetGUID(), GetViewpoint(), SPELL_AURA_BIND_SIGHT, SPELL_AURA_MOD_POSSESS, SPELL_AURA_MOD_POSSESS_PET, and TYPEMASK_UNIT.

Referenced by ActivateTaxiPathTo(), misc_commandscript::HandleUnbindSightCommand(), RemoveFromWorld(), and Unit::SetCharmedBy().

◆ StopCastingCharm()

void Player::StopCastingCharm ( Aura except = nullptr)
9208{
9209 Unit* charm = GetCharm();
9210 if (!charm)
9211 {
9212 return;
9213 }
9214
9215 if (charm->GetTypeId() == TYPEID_UNIT)
9216 {
9218 {
9219 ((Puppet*)charm)->UnSummon();
9220 }
9221 else if (charm->IsVehicle())
9222 {
9223 ExitVehicle();
9224 }
9225 }
9226
9227 if (GetCharmGUID())
9228 {
9233 }
9234
9235 if (GetCharmGUID())
9236 {
9237 LOG_FATAL("entities.player", "Player {} ({} is not able to uncharm unit ({})", GetName(), GetGUID().ToString(), GetCharmGUID().ToString());
9238
9239 if (charm->GetCharmerGUID())
9240 {
9241 LOG_FATAL("entities.player", "Charmed unit has charmer {}", charm->GetCharmerGUID().ToString());
9242 ABORT();
9243 }
9244 else
9245 {
9246 SetCharm(charm, false);
9247 }
9248 }
9249}
#define ABORT
Definition: Errors.h:76
@ UNIT_MASK_PUPPET
Definition: Unit.h:681
@ SPELL_AURA_MOD_CHARM
Definition: SpellAuraDefines.h:69
@ SPELL_AURA_AOE_CHARM
Definition: SpellAuraDefines.h:240
Definition: TemporarySummon.h:114
bool IsVehicle() const
Definition: Unit.h:1428
void SetCharm(Unit *target, bool apply)
Definition: Unit.cpp:10870
ObjectGuid GetCharmGUID() const
Definition: Unit.h:1836

References ABORT, ObjectGuid::Empty, Unit::ExitVehicle(), Unit::GetCharm(), Unit::GetCharmerGUID(), Unit::GetCharmGUID(), Object::GetGUID(), WorldObject::GetName(), Object::GetTypeId(), Unit::HasUnitTypeMask(), Unit::IsVehicle(), LOG_FATAL, Unit::RemoveAurasByType(), Unit::SetCharm(), SPELL_AURA_AOE_CHARM, SPELL_AURA_MOD_CHARM, SPELL_AURA_MOD_POSSESS, SPELL_AURA_MOD_POSSESS_PET, Object::ToCreature(), ObjectGuid::ToString(), Position::ToString(), TYPEID_UNIT, and UNIT_MASK_PUPPET.

Referenced by ActivateTaxiPathTo(), WorldSession::HandlePetAbandon(), WorldSession::HandlePetActionHelper(), Unit::RemoveAllControlled(), RemoveFromWorld(), Unit::SetCharmedBy(), and npc_chesspiece::sGossipSelect().

◆ StopMirrorTimer()

void Player::StopMirrorTimer ( MirrorTimerType  Type)
protected

◆ StopMirrorTimers()

◆ StoreItem()

Item * Player::StoreItem ( ItemPosCountVec const &  pos,
Item pItem,
bool  update 
)
2597{
2598 if (!pItem)
2599 return nullptr;
2600
2601 Item* lastItem = pItem;
2602 ItemTemplate const* proto = pItem->GetTemplate();
2603
2604 for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end();)
2605 {
2606 uint16 pos = itr->pos;
2607 uint32 count = itr->count;
2608
2609 ++itr;
2610
2611 if (itr == dest.end())
2612 {
2613 lastItem = _StoreItem(pos, pItem, count, false, update);
2614 break;
2615 }
2616
2617 lastItem = _StoreItem(pos, pItem, count, true, update);
2618 }
2619
2620 // cast after item storing - some checks in checkcast requires item to be present!!
2621 if (lastItem)
2622 for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
2623 if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger
2624 if (!HasAura(proto->Spells[i].SpellId))
2625 CastSpell(this, proto->Spells[i].SpellId, true, lastItem);
2626
2627 return lastItem;
2628}
Item * _StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool update)
Definition: PlayerStorage.cpp:2631

References _StoreItem(), Unit::CastSpell(), Item::GetTemplate(), Unit::HasAura(), ITEM_SPELLTRIGGER_ON_NO_DELAY_USE, MAX_ITEM_PROTO_SPELLS, _Spell::SpellId, ItemTemplate::Spells, and _Spell::SpellTrigger.

Referenced by _LoadInventory(), AutoUnequipOffhandIfNeed(), BankItem(), Create(), Spell::EffectSummonChangeItem(), WorldSession::HandleAutoEquipItemOpcode(), WorldSession::HandleAutoStoreBagItemOpcode(), WorldSession::HandleAutoStoreBankItemOpcode(), WorldSession::HandleBuybackItem(), WorldSession::HandleEquipmentSetUse(), WorldSession::HandleMailCreateTextItem(), MoveItemToInventory(), SplitItem(), StoreNewItem(), and SwapItem().

◆ StoreLootItem()

LootItem * Player::StoreLootItem ( uint8  lootSlot,
Loot loot,
InventoryResult msg 
)
13433{
13434 QuestItem* qitem = nullptr;
13435 QuestItem* ffaitem = nullptr;
13436 QuestItem* conditem = nullptr;
13437
13438 msg = EQUIP_ERR_OK;
13439
13440 LootItem* item = loot->LootItemInSlot(lootSlot, this, &qitem, &ffaitem, &conditem);
13441 if (!item || item->is_looted)
13442 {
13443 if (!sScriptMgr->CanSendErrorAlreadyLooted(this))
13444 {
13445 SendEquipError(EQUIP_ERR_ALREADY_LOOTED, nullptr, nullptr);
13446 }
13447 return nullptr;
13448 }
13449
13450 // Xinef: exploit protection, dont allow to loot normal items if player is not master loot and not below loot threshold
13451 // Xinef: only quest, ffa and conditioned items
13452 if (!item->is_underthreshold && loot->roundRobinPlayer && !GetLootGUID().IsItem() && GetGroup() && GetGroup()->GetLootMethod() == MASTER_LOOT && GetGUID() != GetGroup()->GetMasterLooterGuid())
13453 if (!qitem && !ffaitem && !conditem)
13454 {
13456 return nullptr;
13457 }
13458
13459 if (!item->AllowedForPlayer(this, loot->sourceWorldObjectGUID))
13460 {
13462 return nullptr;
13463 }
13464
13465 // questitems use the blocked field for other purposes
13466 if (!qitem && item->is_blocked)
13467 {
13469 return nullptr;
13470 }
13471
13472 // xinef: dont allow protected item to be looted by someone else
13473 if (item->rollWinnerGUID && item->rollWinnerGUID != GetGUID())
13474 {
13476 return nullptr;
13477 }
13478
13479 ItemPosCountVec dest;
13480 msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item->itemid, item->count);
13481 if (msg == EQUIP_ERR_OK)
13482 {
13483 AllowedLooterSet looters = item->GetAllowedLooters();
13484 Item* newitem = StoreNewItem(dest, item->itemid, true, item->randomPropertyId, looters);
13485
13486 if (qitem)
13487 {
13488 qitem->is_looted = true;
13489 //freeforall is 1 if everyone's supposed to get the quest item.
13490 if (item->freeforall || loot->GetPlayerQuestItems().size() == 1)
13491 SendNotifyLootItemRemoved(lootSlot);
13492 else
13493 loot->NotifyQuestItemRemoved(qitem->index);
13494 }
13495 else
13496 {
13497 if (ffaitem)
13498 {
13499 //freeforall case, notify only one player of the removal
13500 ffaitem->is_looted = true;
13501 SendNotifyLootItemRemoved(lootSlot);
13502 }
13503 else
13504 {
13505 //not freeforall, notify everyone
13506 if (conditem)
13507 conditem->is_looted = true;
13508 loot->NotifyItemRemoved(lootSlot);
13509 }
13510 }
13511
13512 //if only one person is supposed to loot the item, then set it to looted
13513 if (!item->freeforall)
13514 item->is_looted = true;
13515
13516 --loot->unlootedCount;
13517
13518 SendNewItem(newitem, uint32(item->count), false, false, true);
13519 UpdateLootAchievements(item, loot);
13520
13521 // LootItem is being removed (looted) from the container, delete it from the DB.
13522 if (loot->containerGUID)
13523 sLootItemStorage->RemoveStoredLootItem(loot->containerGUID, item->itemid, item->count, loot, item->itemIndex);
13524
13525 sScriptMgr->OnLootItem(this, newitem, item->count, this->GetLootGUID());
13526 }
13527 else
13528 {
13529 SendEquipError(msg, nullptr, nullptr, item->itemid);
13530 }
13531
13532 return item;
13533}
void UpdateLootAchievements(LootItem *item, Loot *loot)
Definition: PlayerUpdates.cpp:2121
void SendNotifyLootItemRemoved(uint8 lootSlot)
Definition: Player.cpp:8092
bool is_blocked
Definition: LootMgr.h:165
ObjectGuid rollWinnerGUID
Definition: LootMgr.h:162
bool is_underthreshold
Definition: LootMgr.h:167
bool AllowedForPlayer(Player const *player, ObjectGuid source) const
Definition: LootMgr.cpp:410
uint32 itemIndex
Definition: LootMgr.h:157
bool is_looted
Definition: LootMgr.h:164
const AllowedLooterSet & GetAllowedLooters() const
Definition: LootMgr.h:182
bool freeforall
Definition: LootMgr.h:166
Definition: LootMgr.h:186
uint8 index
Definition: LootMgr.h:187
bool is_looted
Definition: LootMgr.h:188
ObjectGuid sourceWorldObjectGUID
Definition: LootMgr.h:330
void NotifyQuestItemRemoved(uint8 questIndex)
Definition: LootMgr.cpp:784
QuestItemMap const & GetPlayerQuestItems() const
Definition: LootMgr.h:316
void NotifyItemRemoved(uint8 lootIndex)
Definition: LootMgr.cpp:753

References LootItem::AllowedForPlayer(), CanStoreNewItem(), Loot::containerGUID, LootItem::count, EQUIP_ERR_ALREADY_LOOTED, EQUIP_ERR_OK, LootItem::freeforall, LootItem::GetAllowedLooters(), GetGroup(), Object::GetGUID(), GetLootGUID(), Loot::GetPlayerQuestItems(), QuestItem::index, LootItem::is_blocked, LootItem::is_looted, QuestItem::is_looted, LootItem::is_underthreshold, LootItem::itemid, LootItem::itemIndex, Loot::LootItemInSlot(), MASTER_LOOT, Loot::NotifyItemRemoved(), Loot::NotifyQuestItemRemoved(), NULL_BAG, NULL_SLOT, LootItem::randomPropertyId, LootItem::rollWinnerGUID, Loot::roundRobinPlayer, SendEquipError(), SendLootRelease(), SendNewItem(), SendNotifyLootItemRemoved(), sLootItemStorage, Loot::sourceWorldObjectGUID, sScriptMgr, StoreNewItem(), Loot::unlootedCount, and UpdateLootAchievements().

Referenced by Loot::FillNotNormalLootFor(), and WorldSession::HandleAutostoreLootItemOpcode().

◆ StoreNewItem() [1/2]

Item * Player::StoreNewItem ( ItemPosCountVec const &  pos,
uint32  item,
bool  update,
int32  randomPropertyId,
AllowedLooterSet allowedLooters 
)
2554{
2555 uint32 count = 0;
2556 for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
2557 count += itr->count;
2558
2559 Item* pItem = Item::CreateItem(item, count, this, false, randomPropertyId);
2560 if (pItem)
2561 {
2562 // pussywizard: obtaining blue or better items saves to db
2563 if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item))
2564 if (pProto->Quality >= ITEM_QUALITY_RARE)
2566
2567 ItemAddedQuestCheck(item, count);
2570 pItem = StoreItem(dest, pItem, update);
2571
2572 if (allowedLooters.size() > 1 && pItem->GetTemplate()->GetMaxStackSize() == 1 && pItem->IsSoulBound() && sWorld->getBoolConfig(CONFIG_SET_BOP_ITEM_TRADEABLE))
2573 {
2574 pItem->SetSoulboundTradeable(allowedLooters);
2576 AddTradeableItem(pItem);
2577
2578 // save data
2579 std::ostringstream ss;
2580 AllowedLooterSet::const_iterator itr = allowedLooters.begin();
2581 ss << (*itr).GetCounter();
2582 for (++itr; itr != allowedLooters.end(); ++itr)
2583 ss << ' ' << (*itr).GetCounter();
2584
2586 stmt->SetData(0, pItem->GetGUID().GetCounter());
2587 stmt->SetData(1, ss.str());
2588 CharacterDatabase.Execute(stmt);
2589 }
2590
2591 sScriptMgr->OnStoreNewItem(this, pItem, count);
2592 }
2593 return pItem;
2594}
@ CHAR_INS_ITEM_BOP_TRADE
Definition: CharacterDatabase.h:122
@ ITEM_FIELD_CREATE_PLAYED_TIME
Definition: UpdateFields.h:71
@ CONFIG_SET_BOP_ITEM_TRADEABLE
Definition: IWorld.h:172
@ ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM
Definition: DBCEnums.h:158

References ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, ADDITIONAL_SAVING_INVENTORY_AND_GOLD, AdditionalSavingAddMask(), AddTradeableItem(), CHAR_INS_ITEM_BOP_TRADE, CharacterDatabase, CONFIG_SET_BOP_ITEM_TRADEABLE, Item::CreateItem(), ObjectGuid::GetCounter(), Object::GetGUID(), ItemTemplate::GetMaxStackSize(), Item::GetTemplate(), GetTotalPlayedTime(), Item::IsSoulBound(), ITEM_FIELD_CREATE_PLAYED_TIME, ITEM_QUALITY_RARE, ItemAddedQuestCheck(), PreparedStatementBase::SetData(), Item::SetSoulboundTradeable(), Object::SetUInt32Value(), sObjectMgr, sScriptMgr, StoreItem(), sWorld, and UpdateAchievementCriteria().

◆ StoreNewItem() [2/2]

◆ StoreNewItemInBestSlots()

bool Player::StoreNewItemInBestSlots ( uint32  item_id,
uint32  item_count 
)
698{
699 LOG_DEBUG("entities.player.items", "STORAGE: Creating initial item, itemId = {}, count = {}", titem_id, titem_amount);
700
701 // attempt equip by one
702 while (titem_amount > 0)
703 {
704 uint16 eDest;
705 InventoryResult msg = CanEquipNewItem(NULL_SLOT, eDest, titem_id, false);
706 if (msg != EQUIP_ERR_OK)
707 break;
708
709 EquipNewItem(eDest, titem_id, true);
711 --titem_amount;
712 }
713
714 if (titem_amount == 0)
715 return true; // equipped
716
717 // attempt store
718 ItemPosCountVec sDest;
719 // store in main bag to simplify second pass (special bags can be not equipped yet at this moment)
720 InventoryResult msg = CanStoreNewItem(INVENTORY_SLOT_BAG_0, NULL_SLOT, sDest, titem_id, titem_amount);
721 if (msg == EQUIP_ERR_OK)
722 {
723 StoreNewItem(sDest, titem_id, true);
724 return true; // stored
725 }
726
727 // item can't be added
728 LOG_ERROR("entities.player", "STORAGE: Can't equip or store initial item {} for race {} class {}, error msg = {}", titem_id, getRace(true), getClass(), msg);
729 return false;
730}

References AutoUnequipOffhandIfNeed(), CanEquipNewItem(), CanStoreNewItem(), EQUIP_ERR_OK, EquipNewItem(), Unit::getClass(), Unit::getRace(), INVENTORY_SLOT_BAG_0, LOG_DEBUG, LOG_ERROR, NULL_SLOT, and StoreNewItem().

Referenced by Create().

◆ StoreRaidMapDifficulty()

void Player::StoreRaidMapDifficulty ( )
inline

◆ SummonIfPossible()

void Player::SummonIfPossible ( bool  agree,
ObjectGuid  summoner_guid 
)
12340{
12341 if (!agree)
12342 {
12343 m_summon_expire = 0;
12344 return;
12345 }
12346
12347 // expire and auto declined
12348 if (m_summon_expire < GameTime::GetGameTime().count())
12349 return;
12350
12351 // drop flag at summon
12352 // this code can be reached only when GM is summoning player who carries flag, because player should be immune to summoning spells when he carries flag
12353 if (Battleground* bg = GetBattleground())
12354 bg->EventPlayerDroppedFlag(this);
12355
12356 m_summon_expire = 0;
12357
12359
12361}
@ ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS
Definition: DBCEnums.h:228
Player * FindPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:248

References ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS, ObjectAccessor::FindPlayer(), GetBattleground(), GameTime::GetGameTime(), Position::GetOrientation(), m_summon_expire, m_summon_mapid, m_summon_x, m_summon_y, m_summon_z, TeleportTo(), and UpdateAchievementCriteria().

Referenced by WorldSession::HandleSummonResponseOpcode().

◆ SummonPet()

Pet * Player::SummonPet ( uint32  entry,
float  x,
float  y,
float  z,
float  ang,
PetType  petType,
Milliseconds  duration = 0s,
uint32  healthPct = 0 
)
8843{
8844 PetStable& petStable = GetOrInitPetStable();
8845
8846 Pet* pet = new Pet(this, petType);
8847
8848 if (petType == SUMMON_PET && pet->LoadPetFromDB(this, entry, 0, false, healthPct))
8849 {
8850 // Remove Demonic Sacrifice auras (known pet)
8852 for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();)
8853 {
8854 if ((*itr)->GetMiscValue() == 2228)
8855 {
8856 RemoveAurasDueToSpell((*itr)->GetId());
8857 itr = auraClassScripts.begin();
8858 }
8859 else
8860 ++itr;
8861 }
8862
8863 if (duration > 0s)
8864 pet->SetDuration(duration);
8865
8866 // Generate a new name for the newly summoned ghoul
8867 if (pet->IsPetGhoul())
8868 {
8869 std::string new_name = sObjectMgr->GeneratePetNameLocale(entry, GetSession()->GetSessionDbLocaleIndex());
8870 if (!new_name.empty())
8871 pet->SetName(new_name);
8872 }
8873
8874 return nullptr;
8875 }
8876
8877 // petentry == 0 for hunter "call pet" (current pet summoned if any)
8878 if (!entry)
8879 {
8880 delete pet;
8881 return nullptr;
8882 }
8883
8884 pet->Relocate(x, y, z, ang);
8885 if (!pet->IsPositionValid())
8886 {
8887 LOG_ERROR("misc", "Player::SummonPet: Pet ({}, Entry: {}) not summoned. Suggested coordinates aren't valid (X: {} Y: {})", pet->GetGUID().ToString(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY());
8888 delete pet;
8889 return nullptr;
8890 }
8891
8892 Map* map = GetMap();
8893 uint32 pet_number = sObjectMgr->GeneratePetNumber();
8894 if (!pet->Create(map->GenerateLowGuid<HighGuid::Pet>(), map, GetPhaseMask(), entry, pet_number))
8895 {
8896 LOG_ERROR("misc", "Player::SummonPet: No such creature entry {}", entry);
8897 delete pet;
8898 return nullptr;
8899 }
8900
8901 if (petType == SUMMON_PET && petStable.CurrentPet)
8903
8904 pet->SetCreatorGUID(GetGUID());
8905 pet->SetFaction(GetFaction());
8910
8911 SetMinion(pet, true);
8912
8913 if (petType == SUMMON_PET)
8914 {
8916 {
8917 pet->GetCharmInfo()->SetPetNumber(pet_number, true); // Show pet details tab (Shift+P) only for demons & undead
8918 }
8919 else
8920 {
8921 pet->GetCharmInfo()->SetPetNumber(pet_number, false);
8922 }
8923
8927 pet->SetFullHealth();
8929 pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime().count())); // cast can't be helped in this case
8930 }
8931
8932 map->AddToMap(pet->ToCreature(), true);
8933
8934 ASSERT(!petStable.CurrentPet && (petType != HUNTER_PET || !petStable.GetUnslottedHunterPet()));
8935 pet->FillPetInfo(&petStable.CurrentPet.emplace());
8936
8937 if (petType == SUMMON_PET)
8938 {
8939 pet->InitPetCreateSpells();
8940 pet->InitTalentForLevel();
8943
8944 // Remove Demonic Sacrifice auras (known pet)
8946 for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();)
8947 {
8948 if ((*itr)->GetMiscValue() == 2228)
8949 {
8950 RemoveAurasDueToSpell((*itr)->GetId());
8951 itr = auraClassScripts.begin();
8952 }
8953 else
8954 ++itr;
8955 }
8956 }
8957
8958 if (duration > 0s)
8959 pet->SetDuration(duration);
8960
8962 {
8965 }
8966
8967 return pet;
8968}
@ UNIT_FIELD_PETEXPERIENCE
Definition: UpdateFields.h:134
@ UNIT_FIELD_PET_NAME_TIMESTAMP
Definition: UpdateFields.h:133
@ UNIT_FIELD_PETNEXTLEVELEXP
Definition: UpdateFields.h:135
@ SUMMON_PET
Definition: PetDefines.h:31
@ UNIT_NPC_FLAG_NONE
Definition: Unit.h:515
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
Definition: SpellAuraDefines.h:175
@ CREATURE_TYPE_UNDEAD
Definition: SharedDefines.h:2633
@ CREATURE_TYPE_DEMON
Definition: SharedDefines.h:2630
uint32 type
Definition: CreatureData.h:215
bool IsPetGhoul() const
Definition: TemporarySummon.h:84
bool InitStatsForLevel(uint8 level)
Definition: Pet.cpp:1012
void SetName(std::string const &newname)
Definition: Object.h:447
void FillPetInfo(PetStable::PetInfo *petInfo) const
Definition: Pet.cpp:2468
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 pet_number)
Definition: Pet.cpp:2312
void SetDuration(Milliseconds dur)
Definition: Pet.h:89
void InitPetCreateSpells()
Definition: Pet.cpp:2040
PetStable & GetOrInitPetStable()
Definition: Player.cpp:15501
void SetPetNumber(uint32 petnumber, bool statwindow)
Definition: Unit.cpp:16034
float GetHealthPct() const
Definition: Unit.h:1462
void ReplaceAllNpcFlags(NPCFlags flags)
Definition: Unit.h:1663
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:637

References Map::AddToMap(), ASSERT, Pet::Create(), CREATURE_TYPE_DEMON, CREATURE_TYPE_UNDEAD, PetStable::CurrentPet, CreatureTemplate::family, Pet::FillPetInfo(), WorldObject::FindMap(), Map::GenerateLowGuid(), Unit::GetAuraEffectsByType(), Unit::GetCharmInfo(), Creature::GetCreatureTemplate(), Object::GetEntry(), Unit::GetFaction(), GameTime::GetGameTime(), Object::GetGUID(), Unit::GetHealthPct(), Unit::GetLevel(), WorldObject::GetMap(), Unit::GetMaxPower(), GetOrInitPetStable(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), GetSession(), PetStable::GetUnslottedHunterPet(), HUNTER_PET, Pet::InitPetCreateSpells(), Guardian::InitStatsForLevel(), Pet::InitTalentForLevel(), Minion::IsPetGhoul(), Position::IsPositionValid(), Pet::LoadPetFromDB(), LOG_ERROR, NeedSendSpectatorData(), PET_SAVE_AS_CURRENT, PET_SAVE_NOT_IN_SLOT, PetSpellInitialize(), POWER_MANA, Position::Relocate(), Unit::RemoveAurasDueToSpell(), RemovePet(), Unit::ReplaceAllNpcFlags(), Pet::SavePetToDB(), ArenaSpectator::SendCommand_UInt32Value(), Unit::SetCreatorGUID(), Pet::SetDuration(), Unit::SetFaction(), Unit::SetFullHealth(), Unit::SetMinion(), WorldObject::SetName(), CharmInfo::SetPetNumber(), Unit::SetPower(), Unit::setPowerType(), Object::SetUInt32Value(), sObjectMgr, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SUMMON_PET, Object::ToCreature(), ObjectGuid::ToString(), CreatureTemplate::type, UNIT_FIELD_BYTES_0, UNIT_FIELD_BYTES_1, UNIT_FIELD_PET_NAME_TIMESTAMP, UNIT_FIELD_PETEXPERIENCE, UNIT_FIELD_PETNEXTLEVELEXP, and UNIT_NPC_FLAG_NONE.

Referenced by Spell::EffectResurrectPet(), and Spell::EffectSummonPet().

◆ SwapItem()

void Player::SwapItem ( uint16  src,
uint16  dst 
)
3559{
3560 uint8 srcbag = src >> 8;
3561 uint8 srcslot = src & 255;
3562
3563 uint8 dstbag = dst >> 8;
3564 uint8 dstslot = dst & 255;
3565
3566 Item* pSrcItem = GetItemByPos(srcbag, srcslot);
3567 Item* pDstItem = GetItemByPos(dstbag, dstslot);
3568
3569 if (!pSrcItem)
3570 return;
3571
3572 LOG_DEBUG("entities.player.items", "STORAGE: SwapItem bag = {}, slot = {}, item = {}", dstbag, dstslot, pSrcItem->GetEntry());
3573
3574 if (!IsAlive())
3575 {
3576 SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, pSrcItem, pDstItem);
3577 return;
3578 }
3579
3580 // SRC checks
3581
3582 if (GetLootGUID() == pSrcItem->GetGUID()) // prevent swap looting item
3583 {
3584 //best error message found for attempting to swap while looting
3585 SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pSrcItem, nullptr);
3586 return;
3587 }
3588
3589 // check unequip potability for equipped items and bank bags
3590 if (IsEquipmentPos(src) || IsBagPos(src))
3591 {
3592 // bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later)
3593 InventoryResult msg = CanUnequipItem(src, !IsBagPos(src) || IsBagPos(dst) || (pDstItem && pDstItem->ToBag() && pDstItem->ToBag()->IsEmpty()));
3594 if (msg != EQUIP_ERR_OK)
3595 {
3596 SendEquipError(msg, pSrcItem, pDstItem);
3597 return;
3598 }
3599 }
3600
3601 // anti-wpe
3602 if (pSrcItem->IsBag() && pSrcItem->IsNotEmptyBag() && !IsBagPos(dst))
3603 {
3605 return;
3606 }
3607
3608 // prevent put equipped/bank bag in self
3609 if (IsBagPos(src) && srcslot == dstbag)
3610 {
3612 return;
3613 }
3614
3615 // prevent equipping bag in the same slot from its inside
3616 if (IsBagPos(dst) && srcbag == dstslot)
3617 {
3619 return;
3620 }
3621
3622 // DST checks
3623
3624 if (pDstItem)
3625 {
3626 // Xinef: Removed next loot generated check
3627 if (pDstItem->GetGUID() == GetLootGUID()) // prevent swap looting item
3628 {
3629 //best error message found for attempting to swap while looting
3630 SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pDstItem, nullptr);
3631 return;
3632 }
3633
3634 // check unequip potability for equipped items and bank bags
3635 if (IsEquipmentPos(dst) || IsBagPos(dst))
3636 {
3637 // bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later)
3638 InventoryResult msg = CanUnequipItem(dst, !IsBagPos(dst) || IsBagPos(src) || (pSrcItem->ToBag() && pSrcItem->ToBag()->IsEmpty()));
3639 if (msg != EQUIP_ERR_OK)
3640 {
3641 SendEquipError(msg, pSrcItem, pDstItem);
3642 return;
3643 }
3644 }
3645 }
3646
3647 // NOW this is or item move (swap with empty), or swap with another item (including bags in bag possitions)
3648 // or swap empty bag with another empty or not empty bag (with items exchange)
3649
3650 // Move case
3651 if (!pDstItem)
3652 {
3653 if (IsInventoryPos(dst))
3654 {
3655 ItemPosCountVec dest;
3656 InventoryResult msg = CanStoreItem(dstbag, dstslot, dest, pSrcItem, false);
3657 if (msg != EQUIP_ERR_OK)
3658 {
3659 SendEquipError(msg, pSrcItem, nullptr);
3660 return;
3661 }
3662
3663 RemoveItem(srcbag, srcslot, true);
3664 StoreItem(dest, pSrcItem, true);
3666 if (IsBankPos(src))
3667 ItemAddedQuestCheck(pSrcItem->GetEntry(), pSrcItem->GetCount());
3668 }
3669 else if (IsBankPos(dst))
3670 {
3671 ItemPosCountVec dest;
3672 InventoryResult msg = CanBankItem(dstbag, dstslot, dest, pSrcItem, false);
3673 if (msg != EQUIP_ERR_OK)
3674 {
3675 SendEquipError(msg, pSrcItem, nullptr);
3676 return;
3677 }
3678
3679 RemoveItem(srcbag, srcslot, true);
3680 BankItem(dest, pSrcItem, true);
3682 ItemRemovedQuestCheck(pSrcItem->GetEntry(), pSrcItem->GetCount());
3683 }
3684 else if (IsEquipmentPos(dst))
3685 {
3686 uint16 dest;
3687 InventoryResult msg = CanEquipItem(dstslot, dest, pSrcItem, false);
3688 if (msg != EQUIP_ERR_OK)
3689 {
3690 SendEquipError(msg, pSrcItem, nullptr);
3691 return;
3692 }
3693
3694 RemoveItem(srcbag, srcslot, true);
3695 EquipItem(dest, pSrcItem, true);
3697 }
3698
3699 return;
3700 }
3701
3702 // attempt merge to / fill target item
3703 if (!pSrcItem->IsBag() && !pDstItem->IsBag())
3704 {
3705 InventoryResult msg;
3706 ItemPosCountVec sDest;
3707 uint16 eDest = 0;
3708 if (IsInventoryPos(dst))
3709 msg = CanStoreItem(dstbag, dstslot, sDest, pSrcItem, false);
3710 else if (IsBankPos(dst))
3711 msg = CanBankItem(dstbag, dstslot, sDest, pSrcItem, false);
3712 else if (IsEquipmentPos(dst))
3713 msg = CanEquipItem(dstslot, eDest, pSrcItem, false);
3714 else
3715 return;
3716
3717 // can be merge/fill
3718 if (msg == EQUIP_ERR_OK)
3719 {
3720 if (pSrcItem->GetCount() + pDstItem->GetCount() <= pSrcItem->GetTemplate()->GetMaxStackSize())
3721 {
3722 RemoveItem(srcbag, srcslot, true);
3723
3724 if (IsInventoryPos(dst))
3725 StoreItem(sDest, pSrcItem, true);
3726 else if (IsBankPos(dst))
3727 BankItem(sDest, pSrcItem, true);
3728 else if (IsEquipmentPos(dst))
3729 {
3730 EquipItem(eDest, pSrcItem, true);
3732 }
3733 }
3734 else
3735 {
3736 pSrcItem->SetCount(pSrcItem->GetCount() + pDstItem->GetCount() - pSrcItem->GetTemplate()->GetMaxStackSize());
3737 pDstItem->SetCount(pSrcItem->GetTemplate()->GetMaxStackSize());
3738 pSrcItem->SetState(ITEM_CHANGED, this);
3739 pDstItem->SetState(ITEM_CHANGED, this);
3740 if (IsInWorld())
3741 {
3742 pSrcItem->SendUpdateToPlayer(this);
3743 pDstItem->SendUpdateToPlayer(this);
3744 }
3745 }
3746 SendRefundInfo(pDstItem);
3747 return;
3748 }
3749 }
3750
3751 // Remove item enchantments for now and restore it later
3752 // Needed for swap sanity checks
3753 ApplyEnchantment(pSrcItem, false);
3754 if (pDstItem)
3755 {
3756 ApplyEnchantment(pDstItem, false);
3757 }
3758
3759 // impossible merge/fill, do real swap
3761
3762 // check src->dest move possibility
3763 ItemPosCountVec sDest;
3764 uint16 eDest = 0;
3765 if (IsInventoryPos(dst))
3766 msg = CanStoreItem(dstbag, dstslot, sDest, pSrcItem, true);
3767 else if (IsBankPos(dst))
3768 msg = CanBankItem(dstbag, dstslot, sDest, pSrcItem, true);
3769 else if (IsEquipmentPos(dst))
3770 {
3771 msg = CanEquipItem(dstslot, eDest, pSrcItem, true);
3772 if (msg == EQUIP_ERR_OK)
3773 msg = CanUnequipItem(eDest, true);
3774 }
3775
3776 if (msg != EQUIP_ERR_OK)
3777 {
3778 // Restore enchantments
3779 ApplyEnchantment(pSrcItem, true);
3780 if (pDstItem)
3781 {
3782 ApplyEnchantment(pDstItem, true);
3783 }
3784
3785 SendEquipError(msg, pSrcItem, pDstItem);
3786 return;
3787 }
3788
3789 // check dest->src move possibility
3790 ItemPosCountVec sDest2;
3791 uint16 eDest2 = 0;
3792 if (IsInventoryPos(src))
3793 msg = CanStoreItem(srcbag, srcslot, sDest2, pDstItem, true);
3794 else if (IsBankPos(src))
3795 msg = CanBankItem(srcbag, srcslot, sDest2, pDstItem, true);
3796 else if (IsEquipmentPos(src))
3797 {
3798 msg = CanEquipItem(srcslot, eDest2, pDstItem, true);
3799 if (msg == EQUIP_ERR_OK)
3800 msg = CanUnequipItem(eDest2, true);
3801 }
3802
3803 if (msg != EQUIP_ERR_OK)
3804 {
3805 // Restore enchantments
3806 ApplyEnchantment(pSrcItem, true);
3807 if (pDstItem)
3808 {
3809 ApplyEnchantment(pDstItem, true);
3810 }
3811
3812 SendEquipError(msg, pDstItem, pSrcItem);
3813 return;
3814 }
3815
3816 // Restore enchantments
3817 ApplyEnchantment(pSrcItem, true);
3818 if (pDstItem)
3819 {
3820 ApplyEnchantment(pDstItem, true);
3821 }
3822
3823 // Check bag swap with item exchange (one from empty in not bag possition (equipped (not possible in fact) or store)
3824 if (Bag* srcBag = pSrcItem->ToBag())
3825 {
3826 if (Bag* dstBag = pDstItem->ToBag())
3827 {
3828 Bag* emptyBag = nullptr;
3829 Bag* fullBag = nullptr;
3830 if (srcBag->IsEmpty() && !IsBagPos(src))
3831 {
3832 emptyBag = srcBag;
3833 fullBag = dstBag;
3834 }
3835 else if (dstBag->IsEmpty() && !IsBagPos(dst))
3836 {
3837 emptyBag = dstBag;
3838 fullBag = srcBag;
3839 }
3840
3841 // bag swap (with items exchange) case
3842 if (emptyBag && fullBag)
3843 {
3844 ItemTemplate const* emptyProto = emptyBag->GetTemplate();
3845
3846 uint32 count = 0;
3847
3848 for (uint32 i = 0; i < fullBag->GetBagSize(); ++i)
3849 {
3850 Item* bagItem = fullBag->GetItemByPos(i);
3851 if (!bagItem)
3852 continue;
3853
3854 ItemTemplate const* bagItemProto = bagItem->GetTemplate();
3855 if (!bagItemProto || !ItemCanGoIntoBag(bagItemProto, emptyProto))
3856 {
3857 // one from items not go to empty target bag
3859 return;
3860 }
3861
3862 ++count;
3863 }
3864
3865 if (count > emptyBag->GetBagSize())
3866 {
3867 // too small targeted bag
3869 return;
3870 }
3871
3872 // Items swap
3873 count = 0; // will pos in new bag
3874 for (uint32 i = 0; i < fullBag->GetBagSize(); ++i)
3875 {
3876 Item* bagItem = fullBag->GetItemByPos(i);
3877 if (!bagItem)
3878 continue;
3879
3880 fullBag->RemoveItem(i, true);
3881 emptyBag->StoreItem(count, bagItem, true);
3882 bagItem->SetState(ITEM_CHANGED, this);
3883
3884 ++count;
3885 }
3886 }
3887 }
3888 }
3889
3890 // now do moves, remove...
3891 RemoveItem(dstbag, dstslot, false, true);
3892 RemoveItem(srcbag, srcslot, false, true);
3893
3894 // add to dest
3895 if (IsInventoryPos(dst))
3896 StoreItem(sDest, pSrcItem, true);
3897 else if (IsBankPos(dst))
3898 BankItem(sDest, pSrcItem, true);
3899 else if (IsEquipmentPos(dst))
3900 EquipItem(eDest, pSrcItem, true);
3901
3902 // add to src
3903 if (IsInventoryPos(src))
3904 StoreItem(sDest2, pDstItem, true);
3905 else if (IsBankPos(src))
3906 BankItem(sDest2, pDstItem, true);
3907 else if (IsEquipmentPos(src))
3908 EquipItem(eDest2, pDstItem, true);
3909
3910 // Xinef: Call this here after all needed items are equipped
3912
3913 // if player is moving bags and is looting an item inside this bag
3914 // release the loot
3915 if (GetLootGUID())
3916 {
3917 bool released = false;
3918 if (IsBagPos(src))
3919 {
3920 Bag* bag = pSrcItem->ToBag();
3921 for (uint32 i = 0; i < bag->GetBagSize(); ++i)
3922 {
3923 if (Item* bagItem = bag->GetItemByPos(i))
3924 {
3925 // Xinef: Removed next loot generated check
3926 if (bagItem->GetGUID() == GetLootGUID())
3927 {
3929 released = true; // so we don't need to look at dstBag
3930 break;
3931 }
3932 }
3933 }
3934 }
3935
3936 if (!released && IsBagPos(dst))
3937 {
3938 Bag* bag = pDstItem->ToBag();
3939 for (uint32 i = 0; i < bag->GetBagSize(); ++i)
3940 {
3941 if (Item* bagItem = bag->GetItemByPos(i))
3942 {
3943 // Xinef: Removed next loot generated check
3944 if (bagItem->GetGUID() == GetLootGUID())
3945 {
3947 released = true; // not realy needed here
3948 break;
3949 }
3950 }
3951 }
3952 }
3953 }
3954
3956}
bool IsEmpty() const
Definition: Bag.cpp:179
Item * GetItemByPos(uint8 slot) const
Definition: Bag.cpp:235
void RemoveItem(uint8 slot, bool update)
Definition: Bag.cpp:143
void SendRefundInfo(Item *item)
Definition: Player.cpp:15438

References ApplyEnchantment(), AutoUnequipOffhandIfNeed(), BankItem(), CanBankItem(), CanEquipItem(), CanStoreItem(), CanUnequipItem(), WorldSession::DoLootRelease(), EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS, EQUIP_ERR_CANT_DO_RIGHT_NOW, EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG, EQUIP_ERR_OK, EQUIP_ERR_YOU_ARE_DEAD, EquipItem(), Bag::GetBagSize(), Item::GetCount(), Object::GetEntry(), Object::GetGUID(), GetItemByPos(), Bag::GetItemByPos(), GetLootGUID(), ItemTemplate::GetMaxStackSize(), Item::GetTemplate(), Unit::IsAlive(), Item::IsBag(), IsBagPos(), IsBankPos(), Bag::IsEmpty(), IsEquipmentPos(), IsInventoryPos(), Object::IsInWorld(), Item::IsNotEmptyBag(), ITEM_CHANGED, ItemAddedQuestCheck(), ItemCanGoIntoBag(), ItemRemovedQuestCheck(), LOG_DEBUG, m_session, RemoveItem(), Bag::RemoveItem(), RemoveItemDependentAurasAndCasts(), SendEquipError(), SendRefundInfo(), Object::SendUpdateToPlayer(), Item::SetCount(), Item::SetState(), StoreItem(), Bag::StoreItem(), Item::ToBag(), and UpdateTitansGrip().

Referenced by WorldSession::HandleAutoEquipItemSlotOpcode(), WorldSession::HandleEquipmentSetUse(), item_commandscript::HandleItemMoveCommand(), WorldSession::HandleSwapInvItemOpcode(), and WorldSession::HandleSwapItem().

◆ SwapQuestSlot()

void Player::SwapQuestSlot ( uint16  slot1,
uint16  slot2 
)
inline

◆ TakeQuestSourceItem()

bool Player::TakeQuestSourceItem ( uint32  questId,
bool  msg 
)
1363{
1364 Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
1365 if (quest)
1366 {
1367 uint32 srcItemId = quest->GetSrcItemId();
1368 ItemTemplate const* item = sObjectMgr->GetItemTemplate(srcItemId);
1369
1370 if (srcItemId > 0)
1371 {
1372 uint32 count = quest->GetSrcItemCount();
1373 if (count <= 0)
1374 count = 1;
1375
1376 // exist two cases when destroy source quest item not possible:
1377 // a) non un-equippable item (equipped non-empty bag, for example)
1378 // b) when quest is started from an item and item also is needed in
1379 // the end as RequiredItemId
1380 InventoryResult res = CanUnequipItems(srcItemId, count);
1381 if (res != EQUIP_ERR_OK)
1382 {
1383 if (msg)
1384 SendEquipError(res, nullptr, nullptr, srcItemId);
1385 return false;
1386 }
1387
1388 bool destroyItem = true;
1389 for (uint8 n = 0; n < QUEST_ITEM_OBJECTIVES_COUNT; ++n)
1390 if (item->StartQuest == questId && srcItemId == quest->RequiredItemId[n])
1391 destroyItem = false;
1392
1393 if (destroyItem)
1394 DestroyItemCount(srcItemId, count, true, true);
1395 }
1396 }
1397
1398 return true;
1399}
uint32 StartQuest
Definition: ItemTemplate.h:677
InventoryResult CanUnequipItems(uint32 item, uint32 count) const
Definition: PlayerStorage.cpp:301
uint32 GetSrcItemCount() const
Definition: QuestDef.h:256
uint32 GetSrcItemId() const
Definition: QuestDef.h:255

References CanUnequipItems(), DestroyItemCount(), EQUIP_ERR_OK, Quest::GetSrcItemCount(), Quest::GetSrcItemId(), QUEST_ITEM_OBJECTIVES_COUNT, Quest::RequiredItemId, SendEquipError(), sObjectMgr, and ItemTemplate::StartQuest.

Referenced by Spell::EffectQuestClear(), and WorldSession::HandleQuestLogRemoveQuest().

◆ TalkedToCreature()

void Player::TalkedToCreature ( uint32  entry,
ObjectGuid  guid 
)
2099{
2100 uint16 addTalkCount = 1;
2101 for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
2102 {
2103 uint32 questid = GetQuestSlotQuestId(i);
2104 if (!questid)
2105 continue;
2106
2107 Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
2108 if (!qInfo)
2109 continue;
2110
2111 QuestStatusData& q_status = m_QuestStatus[questid];
2112
2113 if (q_status.Status == QUEST_STATUS_INCOMPLETE)
2114 {
2116 {
2117 for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
2118 {
2119 // skip Gameobject objectives
2120 if (qInfo->RequiredNpcOrGo[j] < 0)
2121 continue;
2122
2123 uint32 reqTarget = 0;
2124
2125 if (qInfo->RequiredNpcOrGo[j] > 0) // creature activate objectives
2126 // checked at quest_template loading
2127 reqTarget = qInfo->RequiredNpcOrGo[j];
2128 else
2129 continue;
2130
2131 if (reqTarget == entry)
2132 {
2133 uint32 reqTalkCount = qInfo->RequiredNpcOrGoCount[j];
2134 uint16 curTalkCount = q_status.CreatureOrGOCount[j];
2135 if (curTalkCount < reqTalkCount)
2136 {
2137 q_status.CreatureOrGOCount[j] = curTalkCount + addTalkCount;
2138
2139 m_QuestStatusSave[questid] = true;
2140
2141 SendQuestUpdateAddCreatureOrGo(qInfo, guid, j, curTalkCount, addTalkCount);
2142 }
2143 if (CanCompleteQuest(questid))
2144 CompleteQuest(questid);
2145 else
2147
2148 // same objective target can be in many active quests, but not in 2 objectives for single quest (code optimization).
2149 continue;
2150 }
2151 }
2152 }
2153 }
2154 }
2155}

References ADDITIONAL_SAVING_QUEST_STATUS, AdditionalSavingAddMask(), CanCompleteQuest(), CompleteQuest(), QuestStatusData::CreatureOrGOCount, GetQuestSlotQuestId(), Quest::HasSpecialFlag(), m_QuestStatus, m_QuestStatusSave, MAX_QUEST_LOG_SIZE, QUEST_OBJECTIVES_COUNT, QUEST_SPECIAL_FLAGS_CAST, QUEST_SPECIAL_FLAGS_KILL, QUEST_SPECIAL_FLAGS_SPEAKTO, QUEST_STATUS_INCOMPLETE, Quest::RequiredNpcOrGo, Quest::RequiredNpcOrGoCount, SendQuestUpdateAddCreatureOrGo(), sObjectMgr, and QuestStatusData::Status.

Referenced by npc_aged_dying_ancient_kodo::OnGossipHello(), brann_bronzebeard::OnGossipHello(), npc_innkeeper::OnGossipHello(), npc_razael_and_lyana::OnGossipSelect(), and npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI().

◆ TeamIdForRace()

TeamId Player::TeamIdForRace ( uint8  race)
static
5746{
5747 if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race))
5748 {
5749 switch (rEntry->TeamID)
5750 {
5751 case 1:
5752 return TEAM_HORDE;
5753 case 7:
5754 return TEAM_ALLIANCE;
5755 }
5756 LOG_ERROR("entities.player", "Race ({}) has wrong teamid ({}) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID);
5757 }
5758 else
5759 LOG_ERROR("entities.player", "Race ({}) not found in DBC: wrong DBC files?", uint32(race));
5760
5761 return TEAM_ALLIANCE;
5762}

References LOG_ERROR, sChrRacesStore, TEAM_ALLIANCE, and TEAM_HORDE.

Referenced by CharacterCache::GetCharacterTeamByGuid(), Unit::GetModelForForm(), GetTeamId(), WorldSession::HandleAddFriendOpcode(), WorldSession::HandleCalendarEventInvite(), WorldSession::HandleCharCreateOpcode(), WorldSession::HandleCharFactionOrRaceChangeCallback(), WorldSession::HandleSendMail(), misc_commandscript::HandleSkirmishCommand(), PlayerTaxi::InitTaxiNodesForLevel(), Channel::KickOrBan(), AchievementMgr::LoadFromDB(), and SetFactionForRace().

◆ TeleportTo() [1/2]

bool Player::TeleportTo ( uint32  mapid,
float  x,
float  y,
float  z,
float  orientation,
uint32  options = 0,
Unit target = nullptr,
bool  newInstance = false 
)
1315{
1316 // for except kick by antispeedhack
1317 sScriptMgr->AnticheatSetSkipOnePacketForASH(this, true);
1318
1319 if (!MapMgr::IsValidMapCoord(mapid, x, y, z, orientation))
1320 {
1321 LOG_ERROR("entities.player", "TeleportTo: invalid map ({}) or invalid coordinates (X: {}, Y: {}, Z: {}, O: {}) given when teleporting player ({}, name: {}, map: {}, X: {}, Y: {}, Z: {}, O: {}).",
1322 mapid, x, y, z, orientation, GetGUID().ToString(), GetName(), GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
1323 return false;
1324 }
1325
1327 {
1328 LOG_ERROR("entities.player", "Player ({}, name: {}) tried to enter a forbidden map {}", GetGUID().ToString(), GetName(), mapid);
1330 return false;
1331 }
1332
1333 // preparing unsummon pet if lost (we must get pet before teleportation or will not find it later)
1334 Pet* pet = GetPet();
1335
1336 MapEntry const* mEntry = sMapStore.LookupEntry(mapid);
1337
1338 // don't let enter battlegrounds without assigned battleground id (for example through areatrigger)...
1339 if (!InBattleground() && mEntry->IsBattlegroundOrArena())
1340 return false;
1341
1342 // pussywizard: arena spectator, prevent teleporting from arena to instance/etc
1343 if (GetMapId() != mapid && IsSpectator() && mEntry->Instanceable())
1344 {
1346 return false;
1347 }
1348
1349 // client without expansion support
1350 if (GetSession()->Expansion() < mEntry->Expansion())
1351 {
1352 LOG_DEBUG("maps", "Player {} using client without required expansion tried teleport to non accessible map {}", GetName(), mapid);
1353
1354 if (GetTransport())
1355 {
1357 m_transport = nullptr;
1360 RepopAtGraveyard(); // teleport to near graveyard if on transport, looks blizz like :)
1361 }
1362
1364
1365 return false; // normal client can't teleport to this map...
1366 }
1367 else
1368 LOG_DEBUG("maps", "Player {} is being teleported to map {}", GetName(), mapid);
1369
1370 // xinef: do this here in case teleport failed in above checks
1371 if (!(options & TELE_TO_NOT_LEAVE_TAXI) && IsInFlight())
1372 {
1375 }
1376
1377 if (!(options & TELE_TO_NOT_LEAVE_VEHICLE) && m_vehicle)
1378 ExitVehicle();
1379
1380 // reset movement flags at teleport, because player will continue move with these flags after teleport
1382 DisableSpline();
1383
1384 // Xinef: Remove all movement imparing effects auras, skip small teleport like blink
1385 if (mapid != GetMapId() || GetDistance2d(x, y) > 100)
1386 {
1391 // remove auras that should be removed when being teleported
1393 }
1394
1395 if (m_transport)
1396 {
1397 if (options & TELE_TO_NOT_LEAVE_TRANSPORT)
1399 else
1400 {
1402 m_transport = nullptr;
1405 }
1406 }
1407
1408 // The player was ported to another map and loses the duel immediately.
1409 // We have to perform this check before the teleport, otherwise the
1410 // ObjectAccessor won't find the flag.
1413
1414 if (!sScriptMgr->OnBeforePlayerTeleport(this, mapid, x, y, z, orientation, options, target))
1415 return false;
1416
1417 if (GetMapId() == mapid && !newInstance)
1418 {
1419 //lets reset far teleport flag if it wasn't reset during chained teleports
1421
1422 SetHasDelayedTeleport(false); // pussywizard: current teleport cancels stored one
1423 //if teleport spell is casted in Unit::Update() func
1424 //then we need to delay it until update process will be finished
1425 if (MustDelayTeleport())
1426 {
1429 //lets save teleport destination for player
1430 teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
1431 teleportStore_options = options;
1432 return true;
1433 }
1434
1435 if (options & TELE_TO_WITH_PET)
1437
1438 if (!(options & TELE_TO_NOT_UNSUMMON_PET))
1439 {
1440 //same map, only remove pet if out of range for new position
1441 if (pet && !pet->IsWithinDist3d(x, y, z, GetMap()->GetVisibilityRange()))
1443 }
1444
1445 if (!(options & TELE_TO_NOT_LEAVE_COMBAT))
1446 CombatStop();
1447
1448 // this will be used instead of the current location in SaveToDB
1449 teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
1451
1452 // code for finish transfer called in WorldSession::HandleMovementOpcodes()
1453 // at client packet MSG_MOVE_TELEPORT_ACK
1455 // near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing
1456 if (!GetSession()->PlayerLogout())
1457 {
1458 SetCanTeleport(true);
1459 Position oldPos = GetPosition();
1460 Relocate(x, y, z, orientation);
1462 SendTeleportPacket(oldPos); // this automatically relocates to oldPos in order to broadcast the packet in the right place
1463 }
1464 }
1465 else
1466 {
1467 if (getClass() == CLASS_DEATH_KNIGHT && GetMapId() == 609 && !IsGameMaster() && !HasSpell(50977))
1468 {
1470 return false;
1471 }
1472
1473 // far teleport to another map
1474 Map* oldmap = IsInWorld() ? GetMap() : nullptr;
1475 // check if we can enter before stopping combat / removing pet / totems / interrupting spells
1476
1477 // Check enter rights before map getting to avoid creating instance copy for player
1478 // this check not dependent from map instance copy and same for all instance copies of selected map
1479 if (!(options & TELE_TO_GM_MODE) && sMapMgr->PlayerCannotEnter(mapid, this, false))
1480 return false;
1481
1482 // if PlayerCannotEnter -> CanEnter: checked above
1483 {
1484 //lets reset near teleport flag if it wasn't reset during chained teleports
1486
1487 SetHasDelayedTeleport(false); // pussywizard: current teleport cancels stored one
1488 //if teleport spell is casted in Unit::Update() func
1489 //then we need to delay it until update process will be finished
1490 if (MustDelayTeleport())
1491 {
1494 //lets save teleport destination for player
1495 teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
1496 teleportStore_options = options;
1497 return true;
1498 }
1499
1501
1502 CombatStop();
1503
1504 // remove arena spell coldowns/buffs now to also remove pet's cooldowns before it's temporarily unsummoned
1506 {
1507 // KEEP THIS ORDER!
1509 if (pet)
1510 pet->RemoveArenaAuras();
1511
1513 }
1514
1515 // remove pet on map change
1516 if (pet)
1518
1519 // remove all dyn objects
1521
1522 // stop spellcasting
1523 // not attempt interrupt teleportation spell at caster teleport
1524 if (!(options & TELE_TO_SPELL))
1525 if (IsNonMeleeSpellCast(true))
1527
1528 //remove auras before removing from map...
1530
1531 if (!GetSession()->PlayerLogout())
1532 {
1533 // send transfer packets
1534 WorldPacket data(SMSG_TRANSFER_PENDING, 4 + 4 + 4);
1535 data << uint32(mapid);
1536 if (m_transport)
1537 data << m_transport->GetEntry() << GetMapId();
1538
1539 GetSession()->SendPacket(&data);
1540 }
1541
1542 // remove from old map now
1543 if (oldmap)
1544 oldmap->RemovePlayerFromMap(this, false);
1545
1546 // xinef: do this before setting fall information!
1547 if (IsMounted() && (!GetMap()->GetEntry()->IsDungeon() && !GetMap()->GetEntry()->IsBattlegroundOrArena()) && !m_transport)
1548 {
1550 if (!auras.empty())
1551 {
1552 SetMountBlockId((*auras.begin())->GetId());
1554 }
1555 }
1556
1557 teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
1559 // if the player is saved before worldportack (at logout for example)
1560 // this will be used instead of the current location in SaveToDB
1561
1562 if (!GetSession()->PlayerLogout())
1563 {
1564 SetCanTeleport(true);
1565 WorldPacket data(SMSG_NEW_WORLD, 4 + 4 + 4 + 4 + 4);
1566 data << uint32(mapid);
1567 if (m_transport)
1569 else
1571
1572 GetSession()->SendPacket(&data);
1574 }
1575
1576 // move packet sent by client always after far teleport
1577 // code for finish transfer to new map called in WorldSession::HandleMoveWorldportAckOpcode at client packet
1579 }
1580 }
1581 return true;
1582}
@ TELE_TO_WITH_PET
Definition: Player.h:820
@ TELE_TO_NOT_LEAVE_TAXI
Definition: Player.h:821
@ TELE_TO_NOT_LEAVE_VEHICLE
Definition: Player.h:819
@ TELE_TO_SPELL
Definition: Player.h:818
@ TELE_TO_NOT_LEAVE_COMBAT
Definition: Player.h:816
@ TELE_TO_NOT_UNSUMMON_PET
Definition: Player.h:817
@ TELE_TO_GM_MODE
Definition: Player.h:814
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition: Player.h:815
@ TRANSFER_ABORT_MAP_NOT_ALLOWED
Definition: Player.h:791
@ MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE
Movement flags that have change status opcodes associated for players.
Definition: Unit.h:601
@ SPELL_AURA_MOD_CONFUSE
Definition: SpellAuraDefines.h:68
@ AURA_INTERRUPT_FLAG_TELEPORTED
Definition: SpellDefines.h:66
@ AURA_INTERRUPT_FLAG_MOVE
Definition: SpellDefines.h:47
@ AURA_INTERRUPT_FLAG_TURNING
Definition: SpellDefines.h:48
@ SMSG_NEW_WORLD
Definition: Opcodes.h:92
@ SMSG_TRANSFER_PENDING
Definition: Opcodes.h:93
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition: Object.cpp:1295
float GetDistance2d(WorldObject const *obj) const
Definition: Object.cpp:1263
Position GetPosition() const
Definition: Position.h:143
Position::PositionXYZOStreamer PositionXYZOStream()
Definition: Position.h:150
bool HasPendingSpectatorForBG(uint32 bgInstanceId) const
Definition: Player.h:2543
void SendTeleportAckPacket()
Definition: Player.cpp:1305
void SetSelection(ObjectGuid guid)
Used for serverside target changes, does not apply to players.
Definition: Player.cpp:11470
void SendSavedInstances()
Definition: PlayerStorage.cpp:6578
void SetSemaphoreTeleportNear(time_t tm)
Definition: Player.h:2057
void SetHasDelayedTeleport(bool setting)
Definition: Player.h:2897
void SetSemaphoreTeleportFar(time_t tm)
Definition: Player.h:2058
bool MustDelayTeleport() const
Definition: Player.h:2894
void CleanupAfterTaxiFlight()
Definition: Player.cpp:10346
void RemoveArenaSpellCooldowns(bool removeActivePetCooldowns=false)
Definition: Player.cpp:3491
virtual void RemovePassenger(WorldObject *passenger, bool withAll=false)=0
uint32 GetUnitMovementFlags() const
Definition: Unit.h:2289
Vehicle * m_vehicle
Definition: Unit.h:2548
void SendTeleportPacket(Position &pos)
Definition: Unit.cpp:20277
void SetUnitMovementFlags(uint32 f)
Definition: Unit.h:2290
void RemoveAllDynObjects()
Definition: Unit.cpp:6101
void RemoveArenaAuras()
Definition: Unit.cpp:5275
virtual void RemovePlayerFromMap(Player *, bool)
Definition: Map.cpp:914
bool IsBattleArena() const
Definition: DBCStructure.h:1354

References Unit::AddUnitMovementFlag(), AURA_INTERRUPT_FLAG_CHANGE_MAP, AURA_INTERRUPT_FLAG_MOVE, AURA_INTERRUPT_FLAG_TELEPORTED, AURA_INTERRUPT_FLAG_TURNING, CLASS_DEATH_KNIGHT, CleanupAfterTaxiFlight(), Unit::CombatStop(), DISABLE_TYPE_MAP, Unit::DisableSpline(), duel, DUEL_FLED, DuelComplete(), ObjectGuid::Empty, Unit::ExitVehicle(), MapEntry::Expansion(), Unit::GetAuraEffectsByType(), GetBattlegroundId(), Unit::getClass(), WorldObject::GetDistance2d(), Object::GetEntry(), Unit::GetGameObject(), GameTime::GetGameTime(), Object::GetGUID(), Object::GetGuidValue(), WorldObject::GetMap(), WorldLocation::GetMapId(), Unit::GetMotionMaster(), WorldObject::GetName(), Position::GetOrientation(), GetPet(), Position::GetPosition(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetSession(), WorldObject::GetTransport(), Unit::GetUnitMovementFlags(), WorldObject::GetVisibilityRange(), HasPendingSpectatorForBG(), HasSpell(), InBattleground(), MapEntry::Instanceable(), Unit::InterruptNonMeleeSpells(), MapEntry::IsBattleArena(), MapEntry::IsBattlegroundOrArena(), DisableMgr::IsDisabledFor(), IsGameMaster(), Unit::IsInFlight(), Object::IsInWorld(), Unit::IsMounted(), Unit::IsNonMeleeSpellCast(), AccountMgr::IsPlayerAccount(), IsSpectator(), MapMgr::IsValidMapCoord(), WorldObject::IsWithinDist3d(), LOG_DEBUG, LOG_ERROR, WorldObject::m_movementInfo, WorldObject::m_transport, Unit::m_vehicle, MotionMaster::MovementExpired(), MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE, MOVEMENTFLAG_ONTRANSPORT, MustDelayTeleport(), PLAYER_DUEL_ARBITER, MovementInfo::TransportInfo::pos, Position::PositionXYZOStream(), Position::Relocate(), Unit::RemoveAllDynObjects(), Unit::RemoveArenaAuras(), RemoveArenaSpellCooldowns(), Unit::RemoveAurasByType(), Unit::RemoveAurasWithInterruptFlags(), MovementInfo::RemoveMovementFlag(), Transport::RemovePassenger(), Map::RemovePlayerFromMap(), RepopAtGraveyard(), MovementInfo::TransportInfo::Reset(), WorldSession::SendPacket(), SendSavedInstances(), SendTeleportAckPacket(), Unit::SendTeleportPacket(), SendTransferAborted(), SetCanTeleport(), SetFallInformation(), SetHasDelayedTeleport(), SetMountBlockId(), SetSelection(), SetSemaphoreTeleportFar(), SetSemaphoreTeleportNear(), Unit::SetUnitMovementFlags(), sMapMgr, sMapStore, SMSG_NEW_WORLD, SMSG_TRANSFER_PENDING, SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_MOUNTED, sScriptMgr, TELE_TO_GM_MODE, TELE_TO_NOT_LEAVE_COMBAT, TELE_TO_NOT_LEAVE_TAXI, TELE_TO_NOT_LEAVE_TRANSPORT, TELE_TO_NOT_LEAVE_VEHICLE, TELE_TO_NOT_UNSUMMON_PET, TELE_TO_SPELL, TELE_TO_WITH_PET, teleportStore_dest, teleportStore_options, Position::ToString(), TRANSFER_ABORT_INSUF_EXPAN_LVL, TRANSFER_ABORT_MAP_NOT_ALLOWED, TRANSFER_ABORT_UNIQUE_MESSAGE, MovementInfo::transport, and UnsummonPetTemporaryIfAny().

Referenced by ActivateTaxiPathTo(), BattlegroundSA::CaptureGraveyard(), BattlegroundSA::DefendersPortalTeleport(), MotionTransport::DelayedTeleportTransport(), BattlegroundIC::DoAction(), go_commandscript::DoTeleport(), Spell::EffectTeleportUnits(), misc_commandscript::HandleAppearCommand(), WorldSession::HandleAreaTriggerOpcode(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoZoneXYCommand(), misc_commandscript::HandleGroupSummonCommand(), WorldSession::HandleHearthAndResurrect(), WorldSession::HandleMovementOpcodes(), WorldSession::HandleMoveSplineDoneOpcode(), WorldSession::HandleMoveWorldportAck(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandleSetRaidDifficultyOpcode(), ArenaSpectator::HandleSpectatorSpectateCommand(), tele_commandscript::HandleTeleCommand(), tele_commandscript::HandleTeleGroupCommand(), misc_commandscript::HandleUnstuckCommand(), WorldSession::HandleWorldTeleportOpcode(), Unit::NearTeleportTo(), npc_wg_spirit_guide::OnGossipSelect(), lfg::LFGPlayerScript::OnMapChanged(), BattlefieldWG::OnPlayerJoinWar(), at_orb_of_command::OnTrigger(), at_icc_saurfang_portal::OnTrigger(), at_naxxramas_hub_portal::OnTrigger(), AreaTrigger_at_voltarus_middle::OnTrigger(), AreaTrigger_at_last_rites::OnTrigger(), BfGraveyard::RelocateDeadPlayers(), Battleground::RelocateDeadPlayers(), Map::RemoveAllPlayers(), RepopAtGraveyard(), ResurectUsingRequestData(), WorldSession::SendSpiritResurrect(), BattlegroundMgr::SendToBattleground(), SummonIfPossible(), lfg::LFGMgr::TeleportPlayer(), GmTicket::TeleportTo(), TeleportTo(), BattlegroundSA::TeleportToEntrancePosition(), TeleportToEntryPoint(), Update(), and GameObject::Use().

◆ TeleportTo() [2/2]

bool Player::TeleportTo ( WorldLocation const &  loc,
uint32  options = 0,
Unit target = nullptr 
)
inline
1084 {
1085 return TeleportTo(loc.GetMapId(), loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ(), loc.GetOrientation(), options, target);
1086 }

References WorldLocation::GetMapId(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and TeleportTo().

◆ TeleportToEntryPoint()

◆ TextEmote() [1/2]

void Player::TextEmote ( std::string_view  text,
WorldObject const *  = nullptr,
bool  = false 
)
overridevirtual

Outputs an universal text which is supposed to be an action.

Reimplemented from Unit.

9293{
9294 std::string _text(text);
9295
9296 if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text))
9297 {
9298 return;
9299 }
9300
9301 sScriptMgr->OnPlayerChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text);
9302
9303 WorldPacket data;
9305
9307 {
9308 SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true);
9309 }
9310 else
9311 {
9313 }
9314}
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_EMOTE
Definition: IWorld.h:163
@ CONFIG_LISTEN_RANGE_TEXTEMOTE
Definition: IWorld.h:196
@ CHAT_MSG_EMOTE
Definition: SharedDefines.h:3162
@ LANG_UNIVERSAL
Definition: SharedDefines.h:735
void SendMessageToSetInRange_OwnTeam(WorldPacket const *data, float dist, bool self) const
Definition: Player.cpp:5598

References ChatHandler::BuildChatPacket(), CHAT_MSG_EMOTE, CONFIG_ALLOW_TWO_SIDE_INTERACTION_EMOTE, CONFIG_LISTEN_RANGE_TEXTEMOTE, LANG_UNIVERSAL, SendMessageToSetInRange(), SendMessageToSetInRange_OwnTeam(), sScriptMgr, and sWorld.

Referenced by WorldSession::HandleMessagechatOpcode().

◆ TextEmote() [2/2]

void Player::TextEmote ( uint32  textId,
WorldObject const *  target = nullptr,
bool  isBossEmote = false 
)
overridevirtual

Reimplemented from Unit.

9317{
9318 Talk(textId, CHAT_MSG_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
9319}

References CHAT_MSG_EMOTE, CONFIG_LISTEN_RANGE_TEXTEMOTE, and sWorld.

◆ ToggleAFK()

void Player::ToggleAFK ( )
1274{
1276
1277 // afk player not allowed in battleground
1278 if (!IsGameMaster() && isAFK() && InBattleground())
1280}
void ToggleFlag(uint16 index, uint32 flag)
Definition: Object.cpp:877
void LeaveBattleground(Battleground *bg=nullptr)
Definition: Player.cpp:11237

References InBattleground(), isAFK(), IsGameMaster(), LeaveBattleground(), PLAYER_FLAGS, PLAYER_FLAGS_AFK, and Object::ToggleFlag().

Referenced by Battleground::AddPlayer(), WorldSession::HandleMessagechatOpcode(), Battlefield::PlayerAcceptInviteToWar(), and Unit::SetCharmedBy().

◆ ToggleDND()

void Player::ToggleDND ( )

◆ ToggleInstantFlight()

void Player::ToggleInstantFlight ( )

References m_isInstantFlightOn.

Referenced by OnGossipSelect().

◆ ToggleMetaGemsActive()

void Player::ToggleMetaGemsActive ( uint8  exceptslot,
bool  apply 
)
11168{
11169 //cycle all equipped items
11170 for (int slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
11171 {
11172 //enchants for the slot being socketed are handled by WorldSession::HandleSocketOpcode(WorldPacket& recvData)
11173 if (slot == exceptslot)
11174 continue;
11175
11176 Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
11177
11178 if (!pItem || !pItem->GetTemplate()->Socket[0].Color) //if item has no sockets or no item is equipped go to next item
11179 continue;
11180
11181 //cycle all (gem)enchants
11182 for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + 3; ++enchant_slot)
11183 {
11184 uint32 enchant_id = pItem->GetEnchantmentId(EnchantmentSlot(enchant_slot));
11185 if (!enchant_id) //if no enchant go to next enchant(slot)
11186 continue;
11187
11188 SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
11189 if (!enchantEntry)
11190 continue;
11191
11192 //only metagems to be (de)activated, so only enchants with condition
11193 uint32 condition = enchantEntry->EnchantmentCondition;
11194 if (condition)
11195 ApplyEnchantment(pItem, EnchantmentSlot(enchant_slot), apply);
11196 }
11197 }
11198}

References ApplyEnchantment(), _Socket::Color, SpellItemEnchantmentEntry::EnchantmentCondition, EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, Item::GetEnchantmentId(), GetItemByPos(), Item::GetTemplate(), INVENTORY_SLOT_BAG_0, SOCK_ENCHANTMENT_SLOT, ItemTemplate::Socket, and sSpellItemEnchantmentStore.

Referenced by WorldSession::HandleSocketOpcode().

◆ TradeCancel()

void Player::TradeCancel ( bool  sendback)
4111{
4112 if (m_trade)
4113 {
4114 Player* trader = m_trade->GetTrader();
4115
4116 // send yellow "Trade canceled" message to both traders
4117 if (sendback)
4119
4120 trader->GetSession()->SendCancelTrade();
4121
4122 // cleanup
4123 delete m_trade;
4124 m_trade = nullptr;
4125 delete trader->m_trade;
4126 trader->m_trade = nullptr;
4127 }
4128}
void SendCancelTrade()
Definition: TradeHandler.cpp:528

References GetSession(), TradeData::GetTrader(), m_trade, and WorldSession::SendCancelTrade().

Referenced by ActivateTaxiPathTo(), CleanupsBeforeDelete(), WorldSession::HandleCancelTradeOpcode(), and WorldSession::HandleSocketClosed().

◆ UninviteFromGroup()

void Player::UninviteFromGroup ( )
  • If the player is invited, remove him. If the group if then only 1 person, disband the group.
2302{
2303 Group* group = GetGroupInvite();
2304 if (!group)
2305 return;
2306
2307 group->RemoveInvite(this);
2308
2309 if (group->IsCreated())
2310 {
2311 if (group->GetMembersCount() <= 1) // group has just 1 member => disband
2312 {
2313 group->Disband(true);
2314 group = nullptr; // gets deleted in disband
2315 }
2316 }
2317 else
2318 {
2319 if (group->GetInviteeCount() <= 1)
2320 {
2321 group->RemoveAllInvites();
2322 delete group;
2323 group = nullptr;
2324 }
2325 }
2326}
Group * GetGroupInvite()
Definition: Player.h:2429
bool IsCreated() const
Definition: Group.cpp:2225
void RemoveAllInvites()
Definition: Group.cpp:361
void Disband(bool hideDestroy=false)
Definition: Group.cpp:753
void RemoveInvite(Player *player)
Definition: Group.cpp:351
uint32 GetInviteeCount() const
Definition: Group.h:246

References Group::Disband(), GetGroupInvite(), Group::GetInviteeCount(), Group::GetMembersCount(), Group::IsCreated(), Group::RemoveAllInvites(), and Group::RemoveInvite().

Referenced by WorldSession::HandleGroupDeclineOpcode(), and WorldSession::LogoutPlayer().

◆ UnsummonPetTemporaryIfAny()

void Player::UnsummonPetTemporaryIfAny ( )

◆ Update()

void Player::Update ( uint32  time)
overridevirtual
Todo:
add weapon, skill check

Reimplemented from WorldObject.

53{
54 if (!IsInWorld())
55 return;
56
57 sScriptMgr->OnBeforePlayerUpdate(this, p_time);
58
59 // undelivered mail
61 {
64
65 // It will be recalculate at mailbox open (for unReadMails important
66 // non-0 until mailbox open, it also will be recalculated)
67 m_nextMailDelivereTime = time_t(0);
68 }
69
70 // Update cinematic location, if 500ms have passed and we're doing a
71 // cinematic now.
74 {
77 }
78
79 // used to implement delayed far teleports
81 Unit::Update(p_time);
83
84 time_t now = GameTime::GetGameTime().count();
85
86 UpdatePvPFlag(now);
88
89 UpdateContestedPvP(p_time);
90
91 UpdateDuelFlag(now);
92
94
95 UpdateAfkReport(now);
96
97 // Xinef: update charm AI only if we are controlled by creature or
98 // non-posses player charm
100 {
101 m_charmUpdateTimer += p_time;
102 if (m_charmUpdateTimer >= 1000)
103 {
105 if (Unit* charmer = GetCharmer())
106 if (charmer->IsAlive())
108 }
109 }
110
111 time_t lastTick = m_Last_tick;
112 if (now > m_Last_tick)
113 {
114 // Update items that have just a limited lifetime
116
117 // check every minute, less chance to crash and wont break anything.
119
120 // Played time
121 uint32 elapsed = uint32(now - m_Last_tick);
122 m_Played_time[PLAYED_TIME_TOTAL] += elapsed; // Total played time
123 m_Played_time[PLAYED_TIME_LEVEL] += elapsed; // Level played time
124 GetSession()->SetTotalTime(GetSession()->GetTotalTime() + elapsed);
125 m_Last_tick = now;
126 }
127
128 // If mute expired, remove it from the DB
129 if (GetSession()->m_muteTime && GetSession()->m_muteTime < now)
130 {
131 GetSession()->m_muteTime = 0;
133 LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
134 stmt->SetData(0, 0); // Set the mute time to 0
135 stmt->SetData(1, "");
136 stmt->SetData(2, "");
137 stmt->SetData(3, GetSession()->GetAccountId());
138 LoginDatabase.Execute(stmt);
139 }
140
141 if (!m_timedquests.empty())
142 {
143 QuestSet::iterator iter = m_timedquests.begin();
144 while (iter != m_timedquests.end())
145 {
146 QuestStatusData& q_status = m_QuestStatus[*iter];
147 if (q_status.Timer <= p_time)
148 {
149 uint32 quest_id = *iter;
150 ++iter; // current iter will be removed in FailQuest
151 FailQuest(quest_id);
152 }
153 else
154 {
155 q_status.Timer -= p_time;
156 m_QuestStatusSave[*iter] = true;
157 ++iter;
158 }
159 }
160 }
161
163
165 {
166 if (Unit* victim = GetVictim())
167 {
168 // default combat reach 10
170
172 {
173 if (!IsWithinMeleeRange(victim))
174 {
176 if (m_swingErrorMsg != 1) // send single time (client auto repeat)
177 {
179 m_swingErrorMsg = 1;
180 }
181 }
182 // 120 degrees of radiant range
183 else if (!HasInArc(2 * M_PI / 3, victim))
184 {
186 if (m_swingErrorMsg != 2) // send single time (client auto repeat)
187 {
189 m_swingErrorMsg = 2;
190 }
191 }
192 else
193 {
194 m_swingErrorMsg = 0; // reset swing error state
195
196 // prevent base and off attack in same time, delay attack at
197 // 0.2 sec
198 if (haveOffhandWeapon())
201
202 // do attack
205 }
206 }
207
209 {
210 if (!IsWithinMeleeRange(victim))
212 else if (!HasInArc(2 * M_PI / 3, victim))
214 else
215 {
216 // prevent base and off attack in same time, delay attack at
217 // 0.2 sec
220
221 // do attack
224 }
225 }
226
227 /*Unit* owner = victim->GetOwner();
228 Unit* u = owner ? owner : victim;
229 if (u->IsPvP() && (!duel || duel->opponent != u))
230 {
231 UpdatePvP(true);
232 RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
233 }*/
234 }
235 }
236
238 {
239 if (now > lastTick && _restTime > 0) // freeze update
240 {
241 time_t currTime = GameTime::GetGameTime().count();
242 time_t timeDiff = currTime - _restTime;
243 if (timeDiff >= 10) // freeze update
244 {
245 _restTime = currTime;
246
247 float bubble = 0.125f * sWorld->getRate(RATE_REST_INGAME);
248 float extraPerSec =
249 ((float) GetUInt32Value(PLAYER_NEXT_LEVEL_XP) / 72000.0f) *
250 bubble;
251
252 // speed collect rest bonus (section/in hour)
253 SetRestBonus(GetRestBonus() + timeDiff * extraPerSec);
254 }
255 }
256 }
257
258 if (m_weaponChangeTimer > 0)
259 {
260 if (p_time >= m_weaponChangeTimer)
262 else
263 m_weaponChangeTimer -= p_time;
264 }
265
266 if (!IsPositionValid()) // pussywizard: will crash below at eg. GetZoneAndAreaId
267 {
268 LOG_INFO("misc", "Player::Update - invalid position ({0:.1f}, {0:.1f}, {0:.1f})! Map: {}, MapId: {}, {}",
270 GetSession()->KickPlayer("Invalid position");
271 return;
272 }
273
274 if (m_zoneUpdateTimer > 0)
275 {
276 if (p_time >= m_zoneUpdateTimer)
277 {
278 // On zone update tick check if we are still in an inn if we are
279 // supposed to be in one
281 {
282 AreaTrigger const* atEntry = sObjectMgr->GetAreaTrigger(GetInnTriggerId());
283 if (!atEntry || !IsInAreaTriggerRadius(atEntry, 5.f))
284 {
286 }
287 }
288
289 uint32 newzone, newarea;
290 GetZoneAndAreaId(newzone, newarea);
291
292 if (m_zoneUpdateId != newzone)
293 UpdateZone(newzone, newarea); // also update area
294 else
295 {
296 // use area updates as well
297 // needed for free far all arenas for example
298 if (m_areaUpdateId != newarea)
299 UpdateArea(newarea);
300 }
301
303 }
304 else
305 m_zoneUpdateTimer -= p_time;
306 }
307
308 sScriptMgr->OnPlayerUpdate(this, p_time);
309
310 if (IsAlive())
311 {
312 m_regenTimer += p_time;
314 }
315
316 if (m_deathState == DeathState::JustDied)
317 KillPlayer();
318
319 if (m_nextSave)
320 {
321 if (p_time >= m_nextSave)
322 {
323 // m_nextSave reset in SaveToDB call
324 SaveToDB(false, false);
325 LOG_DEBUG("entities.player", "Player::Update: Player '{}' ({}) saved", GetName(), GetGUID().ToString());
326 }
327 else
328 {
329 m_nextSave -= p_time;
330 }
331 }
332
333 // Handle Water/drowning
334 HandleDrowning(p_time);
335
336 if (GetDrunkValue())
337 {
338 m_drunkTimer += p_time;
341 }
342
343 if (HasPendingBind())
344 {
345 if (_pendingBindTimer <= p_time)
346 {
347 // Player left the instance
350 SetPendingBind(0, 0);
351 }
352 else
353 _pendingBindTimer -= p_time;
354 }
355
356 // not auto-free ghost from body in instances
357 if (m_deathTimer > 0 && !GetMap()->Instanceable() &&
359 {
360 if (p_time >= m_deathTimer)
361 {
362 m_deathTimer = 0;
365 }
366 else
367 m_deathTimer -= p_time;
368 }
369
370 UpdateEnchantTime(p_time);
371 UpdateHomebindTime(p_time);
372
373 if (!_instanceResetTimes.empty())
374 {
375 for (InstanceTimeMap::iterator itr = _instanceResetTimes.begin();
376 itr != _instanceResetTimes.end();)
377 {
378 if (itr->second < now)
379 _instanceResetTimes.erase(itr++);
380 else
381 ++itr;
382 }
383 }
384
385 // group update
387
388 Pet* pet = GetPet();
389 if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityRange()) &&
390 !pet->isPossessed())
391 // if (pet && !pet->IsWithinDistInMap(this,
392 // GetMap()->GetVisibilityDistance()) && (GetCharmGUID() &&
393 // (pet->GetGUID()
394 // != GetCharmGUID())))
396
397 // pussywizard:
398 if (m_hostileReferenceCheckTimer <= p_time)
399 {
401 if (!GetMap()->IsDungeon())
404 }
405 else
407
408 // we should execute delayed teleports only for alive(!) players
409 // because we don't want player's ghost teleported from graveyard
410 // xinef: so we store it to the end of the world and teleport out of the ass
411 // after resurrection?
412 if (HasDelayedTeleport() /* && IsAlive()*/)
413 {
416 }
417
419 {
421 UpdateObjectVisibility(true, true);
424 }
425}
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:131
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
@ LOGIN_UPD_MUTE_TIME
Definition: LoginDatabase.h:71
@ NOTIFY_VISIBILITY_CHANGED
Definition: Object.h:64
constexpr auto CINEMATIC_UPDATEDIFF
Definition: CinematicMgr.h:24
constexpr auto ZONE_UPDATE_INTERVAL
Definition: PlayerUpdates.cpp:50
#define ATTACK_DISPLAY_DELAY
Definition: Unit.h:1250
@ UNIT_STATE_CHARGING
Definition: Unit.h:342
@ UNIT_STATE_CASTING
Definition: Unit.h:340
@ UNIT_FLAG_POSSESSED
Definition: Unit.h:472
@ RATE_REST_INGAME
Definition: IWorld.h:497
void UpdateTimedAchievements(uint32 timeDiff)
Definition: AchievementMgr.cpp:2161
void deleteReferencesOutOfRange(float range)
Definition: HostileRefMgr.cpp:199
void RemoveFromNotify(uint16 f)
Definition: Object.h:553
bool HasInArc(float arcangle, const Position *pos, float targetRadius=0.0f) const
Definition: Position.cpp:140
std::vector< FlyByCamera > const * m_cinematicCamera
Definition: CinematicMgr.h:54
uint32 m_cinematicDiff
Definition: CinematicMgr.h:50
uint32 m_lastCinematicCheck
Definition: CinematicMgr.h:51
uint32 m_activeCinematicCameraId
Definition: CinematicMgr.h:52
void UpdateCinematicLocation(uint32 diff)
Definition: CinematicMgr.cpp:92
void UpdateEnchantTime(uint32 time)
Definition: PlayerStorage.cpp:4184
uint32 GetInnTriggerId() const
Definition: Player.h:1188
void UpdateContestedPvP(uint32 currTime)
Definition: PlayerMisc.cpp:360
void SendAttackSwingBadFacingAttack()
Definition: PlayerMisc.cpp:146
void SendUpdateToOutOfRangeGroupMembers()
Definition: Player.cpp:11619
void KillPlayer()
Definition: Player.cpp:4465
void UpdateDuelFlag(time_t currTime)
Definition: PlayerMisc.cpp:423
bool HasRestFlag(RestFlag restFlag) const
Definition: Player.h:1185
bool HasDelayedTeleport() const
Definition: Player.h:2896
void SendAttackSwingNotInRange()
Definition: PlayerMisc.cpp:78
void UpdateSoulboundTradeItems()
Definition: PlayerStorage.cpp:4130
void RemoveRestFlag(RestFlag restFlag)
Definition: Player.cpp:16083
void CheckDuelDistance(time_t currTime)
Definition: Player.cpp:6284
void UpdatePvPFlag(time_t currTime)
Definition: PlayerMisc.cpp:372
void HandleSobering()
The player sobers by 1% every 9 seconds.
Definition: Player.cpp:952
void UpdateFFAPvPFlag(time_t currTime)
Definition: PlayerMisc.cpp:391
void BindToInstance()
Definition: PlayerStorage.cpp:6529
void FailQuest(uint32 quest_id)
Definition: PlayerQuest.cpp:885
void HandleDrowning(uint32 time_diff)
Definition: Player.cpp:835
void UpdateCharmedAI()
Definition: PlayerUpdates.cpp:1908
void UpdateHomebindTime(uint32 time)
Definition: PlayerUpdates.cpp:1351
bool IsInAreaTriggerRadius(AreaTrigger const *trigger, float delta=0.f) const
Definition: Player.cpp:2168
void RegenerateAll()
Definition: Player.cpp:1739
void UpdateAfkReport(time_t currTime)
checks the 15 afk reports per 5 minutes limit
Definition: PlayerMisc.cpp:351
bool IsCharmed() const
Definition: Unit.h:1885
Unit * GetCharmer() const
Definition: Unit.cpp:10607
bool haveOffhandWeapon() const
Definition: Unit.cpp:540
void setAttackTimer(WeaponAttackType type, int32 time)
Definition: Unit.h:1352
bool IsWithinMeleeRange(Unit const *obj, float dist=0.f) const
Definition: Unit.cpp:683
bool bRequestForcedVisibilityUpdate
Definition: Unit.h:2427
bool isPossessed() const
Definition: Unit.h:1886
void AttackerStateUpdate(Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
Definition: Unit.cpp:2537
void Update(uint32 time) override
Definition: Unit.cpp:403
int32 getAttackTimer(WeaponAttackType type) const
Definition: Unit.h:1354
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition: Unit.h:1355
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition: Unit.cpp:661
uint16 m_delayed_unit_relocation_timer
Definition: Unit.h:2425
Definition: ObjectMgr.h:421
void SetTotalTime(uint32 TotalTime)
Definition: WorldSession.h:377
void KickPlayer(bool setKicked=true)
Definition: WorldSession.h:402

References _cinematicMgr, _instanceResetTimes, _pendingBindId, _pendingBindTimer, _restTime, ATTACK_DISPLAY_DELAY, Unit::AttackerStateUpdate(), BASE_ATTACK, BindToInstance(), Unit::bRequestForcedVisibilityUpdate, BuildPlayerRepop(), CheckDuelDistance(), CINEMATIC_UPDATEDIFF, HostileRefMgr::deleteReferencesOutOfRange(), FailQuest(), WorldObject::FindMap(), Unit::getAttackTimer(), Unit::GetCharmer(), GetDrunkValue(), GameTime::GetGameTime(), Object::GetGUID(), Unit::getHostileRefMgr(), GetInnTriggerId(), WorldObject::GetInstanceId(), WorldObject::GetMap(), WorldLocation::GetMapId(), getMSTime(), GetMSTimeDiffToNow(), WorldObject::GetName(), GetPet(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetRestBonus(), GetSession(), Object::GetUInt32Value(), Unit::GetVictim(), WorldObject::GetVisibilityRange(), WorldObject::GetZoneAndAreaId(), HandleDrowning(), HandleSobering(), Unit::HasAuraType(), HasDelayedTeleport(), Position::HasInArc(), HasPendingBind(), HasPlayerFlag(), HasRestFlag(), Unit::HasUnitFlag(), Unit::HasUnitState(), Unit::haveOffhandWeapon(), IN_MILLISECONDS, Unit::IsAlive(), Unit::isAttackReady(), IsBeingTeleported(), Unit::IsCharmed(), IsInAreaTriggerRadius(), Object::IsInWorld(), Position::IsPositionValid(), Unit::isPossessed(), WorldObject::IsWithinDistInMap(), Unit::IsWithinMeleeRange(), WorldSession::KickPlayer(), KillPlayer(), LOG_DEBUG, LOG_INFO, LOGIN_UPD_MUTE_TIME, LoginDatabase, m_achievementMgr, CinematicMgr::m_activeCinematicCameraId, m_areaUpdateId, m_charmUpdateTimer, CinematicMgr::m_cinematicCamera, CinematicMgr::m_cinematicDiff, Unit::m_deathState, m_deathTimer, Unit::m_delayed_unit_relocation_timer, m_drunkTimer, m_hostileReferenceCheckTimer, m_Last_tick, CinematicMgr::m_lastCinematicCheck, WorldSession::m_muteTime, m_nextMailDelivereTime, m_nextSave, m_Played_time, m_QuestStatus, m_QuestStatusSave, Unit::m_regenTimer, m_swingErrorMsg, m_timedquests, m_weaponChangeTimer, m_zoneUpdateId, m_zoneUpdateTimer, NOTIFY_VISIBILITY_CHANGED, OFF_ATTACK, PET_SAVE_NOT_IN_SLOT, PLAYED_TIME_LEVEL, PLAYED_TIME_TOTAL, PLAYER_FLAGS_RESTING, PLAYER_NEXT_LEVEL_XP, RATE_REST_INGAME, RegenerateAll(), WorldObject::RemoveFromNotify(), RemovePet(), RemoveRestFlag(), RepopAtGraveyard(), Unit::resetAttackTimer(), REST_FLAG_IN_TAVERN, SaveToDB(), SendAttackSwingBadFacingAttack(), SendAttackSwingNotInRange(), SendNewMail(), SendUpdateToOutOfRangeGroupMembers(), Unit::setAttackTimer(), PreparedStatementBase::SetData(), SetHasDelayedTeleport(), SetMustDelayTeleport(), SetPendingBind(), SetRestBonus(), WorldSession::SetTotalTime(), sObjectMgr, SPELL_AURA_PREVENT_RESURRECTION, sScriptMgr, sWorld, teleportStore_dest, teleportStore_options, TeleportTo(), QuestStatusData::Timer, Position::ToString(), UNIT_FLAG_POSSESSED, UNIT_STATE_CASTING, UNIT_STATE_CHARGING, UNIT_STATE_MELEE_ATTACKING, unReadMails, Unit::Update(), UpdateAfkReport(), UpdateArea(), UpdateCharmedAI(), CinematicMgr::UpdateCinematicLocation(), UpdateContestedPvP(), UpdateDuelFlag(), UpdateEnchantTime(), UpdateFFAPvPFlag(), UpdateHomebindTime(), UpdateItemDuration(), UpdateObjectVisibility(), UpdatePvPFlag(), UpdateSoulboundTradeItems(), AchievementMgr::UpdateTimedAchievements(), UpdateZone(), and ZONE_UPDATE_INTERVAL.

Referenced by Map::Update().

◆ UpdateAchievementCriteria()

void Player::UpdateAchievementCriteria ( AchievementCriteriaTypes  type,
uint32  miscValue1 = 0,
uint32  miscValue2 = 0,
Unit unit = nullptr 
)
2135{
2136 m_achievementMgr->UpdateAchievementCriteria(type, miscValue1, miscValue2,
2137 unit);
2138}
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition: AchievementMgr.cpp:795

References m_achievementMgr, and AchievementMgr::UpdateAchievementCriteria().

Referenced by _addSpell(), Spell::_cast(), KillRewarder::_RewardKillCredit(), ActivateTaxiPathTo(), CheckAreaExploreAndOutdoor(), Group::CountTheRoll(), Unit::DealDamage(), Spell::DoSpellHitOnUnit(), FlightPathMovementGenerator::DoUpdate(), InstanceScript::DoUpdateAchievementCriteria(), DuelComplete(), EnvironmentalDamage(), EquipItem(), EquipNewItem(), lfg::LFGMgr::FinishDungeon(), GiveLevel(), WorldSession::HandleAlterAppearance(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleBuyBankSlotOpcode(), HandleFall(), WorldSession::HandleGameobjectReportUse(), WorldSession::HandleLootMoneyOpcode(), WorldSession::HandleLootRoll(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandleQuestLogRemoveQuest(), reset_commandscript::HandleResetHonorCommand(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSendMail(), WorldSession::HandleTextEmoteOpcode(), boss_ahune::JustDied(), Unit::Kill(), KilledMonsterCredit(), ArenaTeamMember::ModifyPersonalRating(), MoveItemToInventory(), QuestApprenticeAnglerPlayerScript::OnPlayerCompleteQuest(), InstanceSaveMgr::PlayerBindToInstance(), QuickEquipItem(), resetTalents(), RewardHonor(), RewardQuest(), AuctionHouseMgr::SendAuctionSuccessfulMail(), AuctionHouseMgr::SendAuctionWonMail(), setDeathState(), SetMoney(), ReputationMgr::SetOneFactionReputation(), SetSkill(), SetTitle(), StoreNewItem(), SummonIfPossible(), UpdateLootAchievements(), BattlegroundAB::UpdatePlayerScore(), BattlegroundAV::UpdatePlayerScore(), BattlegroundEY::UpdatePlayerScore(), BattlegroundIC::UpdatePlayerScore(), BattlegroundWS::UpdatePlayerScore(), UpdateSkill(), UpdateSkillPro(), and GameObject::Use().

◆ UpdateAfkReport()

void Player::UpdateAfkReport ( time_t  currTime)

checks the 15 afk reports per 5 minutes limit

352{
353 if (m_bgData.bgAfkReportedTimer <= currTime)
354 {
356 m_bgData.bgAfkReportedTimer = currTime + 5 * MINUTE;
357 }
358}
time_t bgAfkReportedTimer
Definition: Player.h:1036

References BGData::bgAfkReportedCount, BGData::bgAfkReportedTimer, m_bgData, and MINUTE.

Referenced by Update().

◆ UpdateAllCritPercentages()

void Player::UpdateAllCritPercentages ( )

◆ UpdateAllRatings()

void Player::UpdateAllRatings ( )
668{
669 for (int cr = 0; cr < MAX_COMBAT_RATING; ++cr)
671}
CombatRating
Definition: Unit.h:403

References MAX_COMBAT_RATING, and UpdateRating().

Referenced by UpdateAllStats().

◆ UpdateAllSpellCritChances()

void Player::UpdateAllSpellCritChances ( )
879{
880 for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
882}
@ SPELL_SCHOOL_NORMAL
Definition: SharedDefines.h:283
void UpdateSpellCritChance(uint32 school)
Definition: StatSystem.cpp:829

References MAX_SPELL_SCHOOL, SPELL_SCHOOL_NORMAL, and UpdateSpellCritChance().

Referenced by AuraEffect::HandleAuraModCritPct(), AuraEffect::HandleModSpellCritChance(), UpdateAllStats(), UpdateRating(), and UpdateStats().

◆ UpdateAllStats()

bool Player::UpdateAllStats ( )
overridevirtual

Implements Unit.

189{
190 for (int8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
191 {
192 float value = GetTotalStatValue(Stats(i));
193 SetStat(Stats(i), int32(value));
194 }
195
196 UpdateArmor();
197 // calls UpdateAttackPowerAndDamage() in UpdateArmor for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
200
201 for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
203
215
216 return true;
217}
void UpdateAllSpellCritChances()
Definition: StatSystem.cpp:878
void UpdateArmor() override
Definition: StatSystem.cpp:252
void UpdateSpellDamageAndHealingBonus()
Definition: StatSystem.cpp:177
void UpdateAllRatings()
Definition: PlayerUpdates.cpp:667
void UpdateAllCritPercentages()
Definition: StatSystem.cpp:687
void UpdateDefenseBonusesMod()
Definition: StatSystem.cpp:616
virtual void UpdateAllResistances()
Definition: StatSystem.cpp:54
float GetTotalStatValue(Stats stat, float additionalValue=0.0f) const
Definition: Unit.cpp:15288

References BASE_ATTACK, CR_ARMOR_PENETRATION, Unit::GetTotalStatValue(), MAX_POWERS, MAX_STATS, OFF_ATTACK, POWER_MANA, RecalculateRating(), Unit::SetStat(), STAT_STRENGTH, UpdateAllCritPercentages(), UpdateAllRatings(), Unit::UpdateAllResistances(), UpdateAllSpellCritChances(), UpdateArmor(), UpdateAttackPowerAndDamage(), UpdateDefenseBonusesMod(), UpdateExpertise(), UpdateManaRegen(), UpdateMaxHealth(), UpdateMaxPower(), UpdateShieldBlockValue(), and UpdateSpellDamageAndHealingBonus().

Referenced by _ApplyAllStatBonuses(), _RemoveAllStatBonuses(), GiveLevel(), and LoadFromDB().

◆ UpdateArea()

void Player::UpdateArea ( uint32  newArea)
1175{
1176 // pussywizard: inform instance, needed for Icecrown Citadel
1177 if (InstanceScript* instance = GetInstanceScript())
1178 instance->OnPlayerAreaUpdate(this, m_areaUpdateId, newArea);
1179
1180 sScriptMgr->OnPlayerUpdateArea(this, m_areaUpdateId, newArea);
1181
1182 // FFA_PVP flags are area and not zone id dependent
1183 // so apply them accordingly
1184 m_areaUpdateId = newArea;
1185
1186 AreaTableEntry const* area = sAreaTableStore.LookupEntry(newArea);
1187 pvpInfo.IsInFFAPvPArea = area && (area->flags & AREA_FLAG_ARENA);
1188 UpdateFFAPvPState(false);
1189
1190 UpdateAreaDependentAuras(newArea);
1191
1192 pvpInfo.IsInNoPvPArea = false;
1193 if (area && area->IsSanctuary())
1194 {
1196 pvpInfo.IsInNoPvPArea = true;
1198 }
1199 else
1201
1202 uint32 const areaRestFlag = (GetTeamId(true) == TEAM_ALLIANCE)
1205 if (area && area->flags & areaRestFlag)
1207 else
1209}
@ REST_FLAG_IN_FACTION_AREA
Definition: Player.h:809
@ AREA_FLAG_ARENA
Definition: DBCEnums.h:249
@ AREA_FLAG_REST_ZONE_HORDE
Definition: DBCEnums.h:264
@ AREA_FLAG_REST_ZONE_ALLIANCE
Definition: DBCEnums.h:265
bool IsInNoPvPArea
‍Marks if player is in an area which forces PvP flag
Definition: Player.h:363
bool IsInFFAPvPArea
‍Marks if player is in a sanctuary or friendly capital city
Definition: Player.h:364
void UpdateFFAPvPState(bool reset=true)
Definition: PlayerUpdates.cpp:1411
bool IsSanctuary() const
Definition: DBCStructure.h:533

References AREA_FLAG_ARENA, AREA_FLAG_REST_ZONE_ALLIANCE, AREA_FLAG_REST_ZONE_HORDE, Unit::CombatStopWithPets(), AreaTableEntry::flags, WorldObject::GetInstanceScript(), GetTeamId(), PvPInfo::IsInFFAPvPArea, PvPInfo::IsInNoPvPArea, AreaTableEntry::IsSanctuary(), m_areaUpdateId, pvpInfo, Object::RemoveByteFlag(), RemoveRestFlag(), REST_FLAG_IN_FACTION_AREA, sAreaTableStore, Object::SetByteFlag(), SetRestFlag(), sScriptMgr, TEAM_ALLIANCE, UNIT_BYTE2_FLAG_SANCTUARY, UNIT_FIELD_BYTES_2, UpdateAreaDependentAuras(), and UpdateFFAPvPState().

Referenced by SetGameMaster(), Update(), and UpdateZone().

◆ UpdateAreaDependentAuras()

void Player::UpdateAreaDependentAuras ( uint32  area_id)
1822{
1823 // remove auras from spells with area limitations
1824 for (AuraMap::iterator iter = m_ownedAuras.begin();
1825 iter != m_ownedAuras.end();)
1826 {
1827 // use m_zoneUpdateId for speed: UpdateArea called from UpdateZone or
1828 // instead UpdateZone in both cases m_zoneUpdateId up-to-date
1829 if (iter->second->GetSpellInfo()->CheckLocation(
1830 GetMapId(), m_zoneUpdateId, newArea, this, false) !=
1832 RemoveOwnedAura(iter);
1833 else
1834 ++iter;
1835 }
1836
1837 // Xinef: check controlled auras
1838 if (!m_Controlled.empty())
1839 for (ControlSet::iterator itr = m_Controlled.begin();
1840 itr != m_Controlled.end();)
1841 {
1842 Unit* controlled = *itr;
1843 ++itr;
1844 if (controlled && !controlled->IsPet())
1845 {
1846 Unit::AuraMap& tAuras = controlled->GetOwnedAuras();
1847 for (Unit::AuraMap::iterator auraIter = tAuras.begin();
1848 auraIter != tAuras.end();)
1849 {
1850 if (auraIter->second->GetSpellInfo()->CheckLocation(
1851 GetMapId(), m_zoneUpdateId, newArea, nullptr) !=
1853 controlled->RemoveOwnedAura(auraIter);
1854 else
1855 ++auraIter;
1856 }
1857 }
1858 }
1859
1860 // some auras applied at subzone enter
1861 SpellAreaForAreaMapBounds saBounds =
1862 sSpellMgr->GetSpellAreaForAreaMapBounds(newArea);
1863 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first;
1864 itr != saBounds.second; ++itr)
1865 if (itr->second->autocast &&
1866 itr->second->IsFitToRequirements(this, m_zoneUpdateId, newArea))
1867 if (!HasAura(itr->second->spellId))
1868 CastSpell(this, itr->second->spellId, true);
1869
1870 if (newArea == 4273 && GetVehicle() && GetPositionX() > 400) // Ulduar
1871 {
1872 switch (GetVehicleBase()->GetEntry())
1873 {
1874 case 33062:
1875 case 33109:
1876 case 33060:
1877 GetVehicle()->Dismiss();
1878 break;
1879 }
1880 }
1881}
std::pair< SpellAreaForAreaMap::const_iterator, SpellAreaForAreaMap::const_iterator > SpellAreaForAreaMapBounds
Definition: SpellMgr.h:550
Unit * GetVehicleBase() const
Definition: Unit.cpp:19006
std::multimap< uint32, Aura * > AuraMap
Definition: Unit.h:1307
AuraMap & GetOwnedAuras()
Definition: Unit.h:1928
void Dismiss()
Definition: Vehicle.cpp:523

References Unit::CastSpell(), Vehicle::Dismiss(), Object::GetEntry(), WorldLocation::GetMapId(), Unit::GetOwnedAuras(), Position::GetPositionX(), Unit::GetVehicle(), Unit::GetVehicleBase(), Unit::HasAura(), Unit::IsPet(), Unit::m_Controlled, Unit::m_ownedAuras, m_zoneUpdateId, Unit::RemoveOwnedAura(), SPELL_CAST_OK, and sSpellMgr.

Referenced by AddQuest(), CompleteQuest(), WorldSession::HandlePlayerLoginFromDB(), IncompleteQuest(), RemoveActiveQuest(), RewardQuest(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetData(), and UpdateArea().

◆ UpdateArmor()

void Player::UpdateArmor ( )
overridevirtual

Implements Unit.

253{
254 UnitMods unitMod = UNIT_MOD_ARMOR;
255
256 float value = GetModifierValue(unitMod, BASE_VALUE); // base armor (from items)
257 value *= GetModifierValue(unitMod, BASE_PCT); // armor percent from items
258 value += GetStat(STAT_AGILITY) * 2.0f; // armor bonus from stats
259 value += GetModifierValue(unitMod, TOTAL_VALUE);
260
261 //add dynamic flat mods
263 for (AuraEffectList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
264 {
265 if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
266 value += CalculatePct(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount());
267 }
268
269 value *= GetModifierValue(unitMod, TOTAL_PCT);
270
271 SetArmor(int32(value));
272
273 UpdateAttackPowerAndDamage(); // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
274}
@ SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT
Definition: SpellAuraDefines.h:245

References BASE_PCT, BASE_VALUE, CalculatePct(), Unit::GetAuraEffectsByType(), Unit::GetModifierValue(), Unit::GetStat(), Unit::SetArmor(), SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT, SPELL_SCHOOL_MASK_NORMAL, STAT_AGILITY, TOTAL_PCT, TOTAL_VALUE, UNIT_MOD_ARMOR, and UpdateAttackPowerAndDamage().

Referenced by UpdateAllStats(), UpdateResistances(), and UpdateStats().

◆ UpdateArmorPenetration()

void Player::UpdateArmorPenetration ( int32  amount)
855{
856 // Store Rating Value
858}

References CR_ARMOR_PENETRATION, PLAYER_FIELD_COMBAT_RATING_1, and Object::SetUInt32Value().

Referenced by UpdateRating().

◆ UpdateAttackPowerAndDamage()

void Player::UpdateAttackPowerAndDamage ( bool  ranged = false)
overridevirtual

Implements Unit.

331{
332 float val2 = 0.0f;
333 float level = float(GetLevel());
334
335 sScriptMgr->OnBeforeUpdateAttackPowerAndDamage(this, level, val2, ranged);
336
338
342
343 if (ranged)
344 {
348
349 switch (getClass())
350 {
351 case CLASS_HUNTER:
352 val2 = level * 2.0f + GetStat(STAT_AGILITY) - 10.0f;
353 break;
354 case CLASS_ROGUE:
355 case CLASS_WARRIOR:
356 val2 = level + GetStat(STAT_AGILITY) - 10.0f;
357 break;
358 case CLASS_DRUID:
359 switch (GetShapeshiftForm())
360 {
361 case FORM_CAT:
362 case FORM_BEAR:
363 case FORM_DIREBEAR:
364 val2 = 0.0f;
365 break;
366 default:
367 val2 = GetStat(STAT_AGILITY) - 10.0f;
368 break;
369 }
370 break;
371 default:
372 val2 = GetStat(STAT_AGILITY) - 10.0f;
373 break;
374 }
375 }
376 else
377 {
378 switch (getClass())
379 {
380 case CLASS_PALADIN:
382 case CLASS_WARRIOR:
383 val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f;
384 break;
385 case CLASS_HUNTER:
386 case CLASS_SHAMAN:
387 case CLASS_ROGUE:
388 val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f;
389 break;
390 case CLASS_DRUID:
391 {
392 // Check if Predatory Strikes is skilled
393 float mLevelMult = 0.0f;
394 float weapon_bonus = 0.0f;
395 if (IsInFeralForm())
396 {
398 for (Unit::AuraEffectList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
399 {
400 AuraEffect* aurEff = *itr;
401 if (aurEff->GetSpellInfo()->SpellIconID == 1563)
402 {
403 switch (aurEff->GetEffIndex())
404 {
405 case 0: // Predatory Strikes (effect 0)
406 mLevelMult = CalculatePct(1.0f, aurEff->GetAmount());
407 break;
408 case 1: // Predatory Strikes (effect 1)
409 if (Item* mainHand = m_items[EQUIPMENT_SLOT_MAINHAND])
410 {
411 // also gains % attack power from equipped weapon
412 ItemTemplate const* proto = mainHand->GetTemplate();
413 if (!proto)
414 continue;
415
416 uint32 ap = proto->getFeralBonus();
417 // Get AP Bonuses from weapon
418 for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
419 {
420 if (i >= proto->StatsCount)
421 break;
422
424 ap += proto->ItemStat[i].ItemStatValue;
425 }
426
427 // Get AP Bonuses from weapon spells
428 for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
429 {
430 // no spell
431 if (!proto->Spells[i].SpellId || proto->Spells[i].SpellTrigger != ITEM_SPELLTRIGGER_ON_EQUIP)
432 continue;
433
434 // check if it is valid spell
435 SpellInfo const* spellproto = sSpellMgr->GetSpellInfo(proto->Spells[i].SpellId);
436 if (!spellproto)
437 continue;
438
439 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
440 if (spellproto->Effects[j].ApplyAuraName == SPELL_AURA_MOD_ATTACK_POWER)
441 ap += spellproto->Effects[j].CalcValue();
442 }
443
444 weapon_bonus = CalculatePct(float(ap), aurEff->GetAmount());
445 }
446 break;
447 default:
448 break;
449 }
450 }
451 }
452 }
453
454 switch (GetShapeshiftForm())
455 {
456 case FORM_CAT:
457 val2 = (GetLevel() * mLevelMult) + GetStat(STAT_STRENGTH) * 2.0f + GetStat(STAT_AGILITY) - 20.0f + weapon_bonus + m_baseFeralAP;
458 break;
459 case FORM_BEAR:
460 case FORM_DIREBEAR:
461 val2 = (GetLevel() * mLevelMult) + GetStat(STAT_STRENGTH) * 2.0f - 20.0f + weapon_bonus + m_baseFeralAP;
462 break;
463 case FORM_MOONKIN:
464 val2 = (GetLevel() * mLevelMult) + GetStat(STAT_STRENGTH) * 2.0f - 20.0f + m_baseFeralAP;
465 break;
466 default:
467 val2 = GetStat(STAT_STRENGTH) * 2.0f - 20.0f;
468 break;
469 }
470 break;
471 }
472 case CLASS_MAGE:
473 case CLASS_PRIEST:
474 case CLASS_WARLOCK:
475 val2 = GetStat(STAT_STRENGTH) - 10.0f;
476 break;
477 }
478 }
479
480 SetModifierValue(unitMod, BASE_VALUE, val2);
481
482 float base_attPower = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);
483 float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE);
484
485 //add dynamic flat mods
486 if (ranged)
487 {
488 if ((getClassMask() & CLASSMASK_WAND_USERS) == 0)
489 {
491 for (AuraEffectList::const_iterator i = mRAPbyStat.begin(); i != mRAPbyStat.end(); ++i)
492 attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
493 }
494 }
495 else
496 {
498 for (AuraEffectList::const_iterator i = mAPbyStat.begin(); i != mAPbyStat.end(); ++i)
499 attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
500
502 for (AuraEffectList::const_iterator iter = mAPbyArmor.begin(); iter != mAPbyArmor.end(); ++iter)
503 // always: ((*i)->GetModifier()->m_miscvalue == 1 == SPELL_SCHOOL_MASK_NORMAL)
504 attPowerMod += int32(GetArmor() / (*iter)->GetAmount());
505 }
506
507 float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
508
509 sScriptMgr->OnAfterUpdateAttackPowerAndDamage(this, level, base_attPower, attPowerMod, attPowerMultiplier, ranged);
510 SetInt32Value(index, (uint32)base_attPower); //UNIT_FIELD_(RANGED)_ATTACK_POWER field
511 SetInt32Value(index_mod, (uint32)attPowerMod); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field
512 SetFloatValue(index_mult, attPowerMultiplier); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field
513
514 //automatically update weapon damage after attack power modification
515 if (ranged)
516 {
518 }
519 else
520 {
522 if (CanDualWield() && haveOffhandWeapon()) //allow update offhand damage only if player knows DualWield Spec and has equipped offhand weapon
524 if (getClass() == CLASS_SHAMAN || getClass() == CLASS_PALADIN) // mental quickness
526 }
527}
@ FORM_MOONKIN
Definition: Unit.h:119
@ SPELL_AURA_MOD_ATTACK_POWER
Definition: SpellAuraDefines.h:162
@ SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT
Definition: SpellAuraDefines.h:275
@ SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
Definition: SpellAuraDefines.h:348
@ SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT
Definition: SpellAuraDefines.h:331
int32 ItemStatValue
Definition: ItemTemplate.h:596
uint32 ItemStatType
Definition: ItemTemplate.h:595
_ItemStat ItemStat[MAX_ITEM_PROTO_STATS]
Definition: ItemTemplate.h:657
int32 getFeralBonus(int32 extraDPS=0) const
Definition: ItemTemplate.h:753
uint32 StatsCount
Definition: ItemTemplate.h:656
void SetModifierValue(UnitMods unitMod, UnitModifierType modifierType, float value)
Definition: Unit.h:2112
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:56
int32 GetAmount() const
Definition: SpellAuraEffects.h:64

References BASE_ATTACK, BASE_PCT, BASE_VALUE, CalculatePct(), Unit::CanDualWield(), CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_HUNTER, CLASS_MAGE, CLASS_PALADIN, CLASS_PRIEST, CLASS_ROGUE, CLASS_SHAMAN, CLASS_WARLOCK, CLASS_WARRIOR, CLASSMASK_WAND_USERS, SpellInfo::Effects, EQUIPMENT_SLOT_MAINHAND, FORM_BEAR, FORM_CAT, FORM_DIREBEAR, FORM_MOONKIN, AuraEffect::GetAmount(), Unit::GetArmor(), Unit::GetAuraEffectsByType(), Unit::getClass(), Unit::getClassMask(), AuraEffect::GetEffIndex(), ItemTemplate::getFeralBonus(), Unit::GetLevel(), Unit::GetModifierValue(), Unit::GetShapeshiftForm(), AuraEffect::GetSpellInfo(), Unit::GetStat(), Unit::haveOffhandWeapon(), Unit::IsInFeralForm(), ITEM_MOD_ATTACK_POWER, ITEM_SPELLTRIGGER_ON_EQUIP, ItemTemplate::ItemStat, _ItemStat::ItemStatType, _ItemStat::ItemStatValue, m_baseFeralAP, m_items, MAX_ITEM_PROTO_SPELLS, MAX_ITEM_PROTO_STATS, MAX_SPELL_EFFECTS, OFF_ATTACK, RANGED_ATTACK, Object::SetFloatValue(), Object::SetInt32Value(), Unit::SetModifierValue(), SPELL_AURA_DUMMY, SPELL_AURA_MOD_ATTACK_POWER, SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR, SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT, SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT, SpellInfo::SpellIconID, _Spell::SpellId, ItemTemplate::Spells, _Spell::SpellTrigger, sScriptMgr, sSpellMgr, STAT_AGILITY, STAT_STRENGTH, ItemTemplate::StatsCount, TOTAL_PCT, TOTAL_VALUE, UNIT_FIELD_ATTACK_POWER, UNIT_FIELD_ATTACK_POWER_MODS, UNIT_FIELD_ATTACK_POWER_MULTIPLIER, UNIT_FIELD_RANGED_ATTACK_POWER, UNIT_FIELD_RANGED_ATTACK_POWER_MODS, UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER, UNIT_MOD_ATTACK_POWER, UNIT_MOD_ATTACK_POWER_RANGED, Unit::UpdateDamagePhysical(), and UpdateSpellDamageAndHealingBonus().

Referenced by ApplyFeralAPBonus(), AuraEffect::HandleAuraModAttackPowerOfArmor(), AuraEffect::HandleAuraModRangedAttackPowerOfStatPercent(), InitDataForForm(), UpdateAllStats(), UpdateArmor(), and UpdateStats().

◆ UpdateBlockPercentage()

void Player::UpdateBlockPercentage ( )
624{
625 // No block
626 float value = 0.0f;
627 if (CanBlock())
628 {
629 // Base value
630 value = 5.0f;
631 // Modify value from defense skill
632 value += (int32(GetDefenseSkillValue()) - int32(GetMaxSkillValueForLevel())) * 0.04f;
633 // Increase from SPELL_AURA_MOD_BLOCK_PERCENT aura
635 // Increase from rating
637
638 if (sConfigMgr->GetOption<bool>("Stats.Limits.Enable", false))
639 {
640 value = value > sConfigMgr->GetOption<float>("Stats.Limits.Block", 95.0f) ? sConfigMgr->GetOption<float>("Stats.Limits.Block", 95.0f) : value;
641 }
642
643 value = value < 0.0f ? 0.0f : value;
644 }
646}
#define sConfigMgr
Definition: Config.h:95
@ SPELL_AURA_MOD_BLOCK_PERCENT
Definition: SpellAuraDefines.h:114
void SetStatFloatValue(uint16 index, float value)
Definition: Object.cpp:790
bool CanBlock() const
Definition: Player.h:2147
uint32 GetDefenseSkillValue(Unit const *target=nullptr) const
Definition: Unit.cpp:3588

References CanBlock(), CR_BLOCK, Unit::GetDefenseSkillValue(), GetMaxSkillValueForLevel(), GetRatingBonusValue(), Unit::GetTotalAuraModifier(), PLAYER_BLOCK_PERCENTAGE, sConfigMgr, Object::SetStatFloatValue(), and SPELL_AURA_MOD_BLOCK_PERCENT.

Referenced by AuraEffect::HandleAuraModBlockPercent(), SetCanBlock(), UpdateDefenseBonusesMod(), and UpdateRating().

◆ UpdateCharmedAI()

void Player::UpdateCharmedAI ( )
private
1909{
1910 // Xinef: maybe passed as argument?
1911 Unit* charmer = GetCharmer();
1912 CharmInfo* charmInfo = GetCharmInfo();
1913
1914 // Xinef: needs more thinking, maybe kill player?
1915 if (!charmer || !charmInfo)
1916 return;
1917
1918 // Xinef: we should be killed if caster enters evade mode and charm is
1919 // infinite
1920 if (charmer->GetTypeId() == TYPEID_UNIT &&
1921 charmer->ToCreature()->IsInEvadeMode())
1922 {
1923 AuraEffectList const& auras =
1925 for (AuraEffectList::const_iterator iter = auras.begin();
1926 iter != auras.end(); ++iter)
1927 if ((*iter)->GetCasterGUID() == charmer->GetGUID() &&
1928 (*iter)->GetBase()->IsPermanent())
1929 {
1930 Unit::DealDamage(charmer, this, GetHealth(), nullptr,
1932 nullptr, false);
1933 return;
1934 }
1935 }
1936
1937 Unit* target = GetVictim();
1938 if (target)
1939 {
1940 SetInFront(target);
1942 }
1943
1945 return;
1946
1947 bool Mages =
1948 getClassMask() & (1 << (CLASS_MAGE - 1) | 1 << (CLASS_WARLOCK - 1) |
1949 1 << (CLASS_DRUID - 1) | 1 << (CLASS_HUNTER - 1) |
1950 1 << (CLASS_PRIEST - 1));
1951
1952 // Xinef: charmer type specific actions
1953 if (charmer->GetTypeId() == TYPEID_PLAYER)
1954 {
1955 bool follow = false;
1956 if (!target)
1957 {
1958 if (charmInfo->GetPlayerReactState() == REACT_PASSIVE)
1959 follow = true;
1960 else if (charmInfo->GetPlayerReactState() == REACT_DEFENSIVE)
1961 {
1962 if (charmer->GetVictim())
1963 target = charmer->GetVictim();
1964 else
1965 follow = true;
1966 }
1967
1968 if (follow)
1969 {
1973 return;
1974 }
1975 }
1976 else if (target &&
1979 GetMotionMaster()->MoveChase(target, Mages ? 15 : 4);
1980 }
1981
1982 if (!target || !IsValidAttackTarget(target))
1983 {
1984 target = SelectNearbyTarget(nullptr, GetMap()->IsDungeon() ? 100.f : 30.f);
1985 if (!target)
1986 {
1990
1991 return;
1992 }
1993
1994 GetMotionMaster()->MoveChase(target, Mages ? 15 : 4);
1995 Attack(target, true);
1996 }
1997 else
1998 {
1999 float Distance = GetDistance(target);
2000 uint8 rnd = urand(0, 1);
2001
2002 if (Mages)
2003 {
2004 if ((GetPower(POWER_MANA) * 100 / GetMaxPower(POWER_MANA)) < 10)
2005 {
2006 GetMotionMaster()->MoveChase(target, 4);
2007 return;
2008 }
2009
2010 if (Distance <= 3)
2011 {
2012 if (urand(0, 1))
2013 {
2016 CastSpell(target, m_charmAISpells[SPELL_T_STUN], false);
2021 false);
2022 else if (m_charmAISpells[SPELL_IMMUNITY] &&
2025 }
2026 else
2027 {
2028 switch (urand(0, 1))
2029 {
2030 case 0:
2034 CastSpell(
2035 target,
2037 false);
2038 break;
2039 case 1:
2044 false);
2045 break;
2046 }
2047 }
2048 }
2049 else
2050 {
2051 switch (urand(0, 2))
2052 {
2053 case 0:
2057 CastSpell(target,
2059 false);
2060 break;
2061 case 1:
2065 CastSpell(target,
2067 false);
2068 break;
2069 case 2:
2073 false);
2074 break;
2075 }
2076 }
2077 }
2078 else
2079 {
2080 if (Distance > 10)
2081 {
2082 GetMotionMaster()->MoveChase(target, 2.0f);
2085 CastSpell(target, m_charmAISpells[SPELL_T_CHARGE], false);
2086 else if (m_charmAISpells[SPELL_FAST_RUN] &&
2089 }
2090
2092 return;
2093
2094 switch (urand(0, 2))
2095 {
2096 case 0:
2100 CastSpell(target,
2102 false);
2103 break;
2104 case 1:
2109 false);
2110 break;
2111 case 2:
2115 break;
2116 }
2117 }
2118 }
2119}
#define PET_FOLLOW_ANGLE
Definition: PetDefines.h:199
#define PET_FOLLOW_DIST
Definition: PetDefines.h:198
@ SPELL_HIGH_DAMAGE1
Definition: Player.h:911
@ REACT_DEFENSIVE
Definition: Unit.h:1036
@ REACT_PASSIVE
Definition: Unit.h:1035
@ UNIT_STATE_FOLLOW
Definition: Unit.h:334
@ CHASE_MOTION_TYPE
Definition: MotionMaster.h:43
bool IsInEvadeMode() const
Definition: Creature.h:130
ReactStates GetPlayerReactState() const
Definition: Unit.h:1163
Unit * SelectNearbyTarget(Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
Definition: Unit.cpp:17249
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:10280
void SendMovementFlagUpdate(bool self=false)
Definition: Unit.cpp:16972
bool IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell=nullptr) const
Definition: Unit.cpp:13859
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:20878
void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Definition: MotionMaster.cpp:300
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition: MotionMaster.cpp:859
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
Definition: MotionMaster.cpp:394

References Unit::Attack(), Unit::CastSpell(), CHASE_MOTION_TYPE, CLASS_DRUID, CLASS_HUNTER, CLASS_MAGE, CLASS_PRIEST, CLASS_WARLOCK, Unit::DealDamage(), DIRECT_DAMAGE, Unit::GetAuraEffectsByType(), Unit::GetCharmer(), Unit::GetCharmInfo(), Unit::getClassMask(), MotionMaster::GetCurrentMovementGeneratorType(), WorldObject::GetDistance(), Object::GetGUID(), Unit::GetHealth(), WorldObject::GetMap(), Unit::GetMaxPower(), Unit::GetMotionMaster(), CharmInfo::GetPlayerReactState(), Unit::GetPower(), Object::GetTypeId(), Unit::GetVictim(), HasSpellCooldown(), Unit::HasUnitState(), Creature::IsInEvadeMode(), Unit::IsValidAttackTarget(), m_charmAISpells, MotionMaster::MoveChase(), MotionMaster::MoveFollow(), PET_FOLLOW_ANGLE, PET_FOLLOW_DIST, POWER_MANA, REACT_DEFENSIVE, REACT_PASSIVE, Unit::SelectNearbyTarget(), Unit::SendMovementFlagUpdate(), Unit::SetInFront(), SPELL_AURA_MOD_CHARM, SPELL_DOT_DAMAGE, SPELL_FAST_RUN, SPELL_HIGH_DAMAGE1, SPELL_IMMUNITY, SPELL_INSTANT_DAMAGE, SPELL_ROOT_OR_FEAR, SPELL_SCHOOL_MASK_NORMAL, SPELL_T_CHARGE, SPELL_T_STUN, Object::ToCreature(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_STATE_CASTING, UNIT_STATE_FOLLOW, and urand().

Referenced by Update().

◆ UpdateCombatSkills()

void Player::UpdateCombatSkills ( Unit victim,
WeaponAttackType  attType,
bool  defence,
Item item = nullptr 
)
985{
986 uint8 playerLevel = GetLevel();
987 uint16 currentSkillValue = defence ? GetBaseDefenseSkillValue() : GetBaseWeaponSkillValue(attType);
988 uint16 currentSkillMax = 5 * playerLevel;
989 int32 skillDiff = currentSkillMax - currentSkillValue;
990
991 // Max skill reached for level.
992 // Can in some cases be less than 0: having max skill and then .level -1 as example.
993 if (skillDiff <= 0)
994 {
995 return;
996 }
997
998 uint8 greylevel = Acore::XP::GetGrayLevel(playerLevel);
999 uint8 moblevel = defence ? victim->getLevelForTarget(this) : victim->GetLevel(); // if defense than victim == attacker
1000 /*if (moblevel < greylevel)
1001 return;*/
1002 // Patch 3.0.8 (2009-01-20): You can no longer skill up weapons on mobs that are immune to damage.
1003
1004 if (moblevel > playerLevel + 5)
1005 {
1006 moblevel = playerLevel + 5;
1007 }
1008
1009 int16 lvldif = moblevel - greylevel;
1010 if (lvldif < 3)
1011 {
1012 lvldif = 3;
1013 }
1014
1015 float chance = float(3 * lvldif * skillDiff) / playerLevel;
1016 if (!defence)
1017 {
1018 chance += chance * 0.02f * GetStat(STAT_INTELLECT);
1019 }
1020
1021 chance = chance < 1.0f ? 1.0f : chance; // minimum chance to increase skill is 1%
1022
1023 LOG_DEBUG("entities.player", "Player::UpdateCombatSkills(defence:{}, playerLevel:{}, moblevel:{}) -> ({}/{}) chance to increase skill is {}%", defence, playerLevel, moblevel, currentSkillValue, currentSkillMax, chance);
1024
1025 if (roll_chance_f(chance))
1026 {
1027 if (defence)
1028 {
1029 UpdateDefense();
1030 }
1031 else
1032 {
1033 UpdateWeaponSkill(victim, attType, item);
1034 }
1035 }
1036}
uint32 GetBaseDefenseSkillValue() const
Definition: Player.h:1898
uint32 GetBaseWeaponSkillValue(WeaponAttackType attType) const
Definition: Player.cpp:12728
void UpdateDefense()
Definition: PlayerUpdates.cpp:568
void UpdateWeaponSkill(Unit *victim, WeaponAttackType attType, Item *item=nullptr)
Definition: PlayerUpdates.cpp:938
uint8 getLevelForTarget(WorldObject const *) const override
Definition: Unit.h:1433

References GetBaseDefenseSkillValue(), GetBaseWeaponSkillValue(), Acore::XP::GetGrayLevel(), Unit::GetLevel(), Unit::getLevelForTarget(), Unit::GetStat(), LOG_DEBUG, roll_chance_f(), STAT_INTELLECT, UpdateDefense(), and UpdateWeaponSkill().

Referenced by Unit::ProcDamageAndSpellFor().

◆ UpdateContestedPvP()

void Player::UpdateContestedPvP ( uint32  currTime)
361{
363 return;
364 if (m_contestedPvPTimer <= diff)
365 {
367 }
368 else
369 m_contestedPvPTimer -= diff;
370}

References Unit::IsInCombat(), m_contestedPvPTimer, and ResetContestedPvP().

Referenced by Update().

◆ UpdateCorpseReclaimDelay()

void Player::UpdateCorpseReclaimDelay ( )
1884{
1886
1887 if ((pvp &&
1889 (!pvp && !sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE)))
1890 return;
1891
1892 time_t now = GameTime::GetGameTime().count();
1893
1894 if (now < m_deathExpireTime)
1895 {
1896 // full and partly periods 1..3
1897 uint64 count = (m_deathExpireTime - now) / DEATH_EXPIRE_STEP + 1;
1898
1899 if (count < MAX_DEATH_COUNT)
1900 m_deathExpireTime = now + (count + 1) * DEATH_EXPIRE_STEP;
1901 else
1903 }
1904 else
1906}

References CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP, DEATH_EXPIRE_STEP, GameTime::GetGameTime(), m_deathExpireTime, m_ExtraFlags, MAX_DEATH_COUNT, PLAYER_EXTRA_PVP_DEATH, and sWorld.

Referenced by KillPlayer().

◆ UpdateCraftSkill()

bool Player::UpdateCraftSkill ( uint32  spellid)
786{
787 LOG_DEBUG("entities.player.skills", "UpdateCraftSkill spellid {}", spellid);
788
789 SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellid);
790
791 for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first;
792 _spell_idx != bounds.second; ++_spell_idx)
793 {
794 if (_spell_idx->second->SkillLine)
795 {
796 uint32 SkillValue =
797 GetPureSkillValue(_spell_idx->second->SkillLine);
798
799 // Alchemy Discoveries here
800 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
801 if (spellInfo && spellInfo->Mechanic == MECHANIC_DISCOVERY)
802 {
803 if (uint32 discoveredSpell = GetSkillDiscoverySpell(
804 _spell_idx->second->SkillLine, spellid, this))
805 learnSpell(discoveredSpell);
806 }
807
808 uint32 craft_skill_gain =
809 sWorld->getIntConfig(CONFIG_SKILL_GAIN_CRAFTING);
810 sScriptMgr->OnUpdateCraftingSkill(this, _spell_idx->second, SkillValue, craft_skill_gain);
811
812 return UpdateSkillPro(
813 _spell_idx->second->SkillLine,
814 SkillGainChance(SkillValue,
815 _spell_idx->second->TrivialSkillLineRankHigh,
816 (_spell_idx->second->TrivialSkillLineRankHigh +
817 _spell_idx->second->TrivialSkillLineRankLow) /
818 2,
819 _spell_idx->second->TrivialSkillLineRankLow),
820 craft_skill_gain);
821 }
822 }
823 return false;
824}
int SkillGainChance(uint32 SkillValue, uint32 GrayLevel, uint32 GreenLevel, uint32 YellowLevel)
Definition: PlayerUpdates.cpp:711
uint32 GetSkillDiscoverySpell(uint32 skillId, uint32 spellId, Player *player)
Definition: SkillDiscovery.cpp:213
@ CONFIG_SKILL_GAIN_CRAFTING
Definition: IWorld.h:271
@ MECHANIC_DISCOVERY
Definition: SharedDefines.h:1353
bool UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
Definition: PlayerUpdates.cpp:874
uint32 Mechanic
Definition: SpellInfo.h:321

References CONFIG_SKILL_GAIN_CRAFTING, GetPureSkillValue(), GetSkillDiscoverySpell(), learnSpell(), LOG_DEBUG, SpellInfo::Mechanic, MECHANIC_DISCOVERY, SkillGainChance(), sScriptMgr, sSpellMgr, sWorld, and UpdateSkillPro().

Referenced by Spell::DoCreateItem(), Spell::EffectEnchantItemPerm(), and spell_gen_profession_research::HandleScript().

◆ UpdateCritPercentage()

void Player::UpdateCritPercentage ( WeaponAttackType  attType)
649{
650 BaseModGroup modGroup;
651 uint16 index;
652 CombatRating cr;
653
654 switch (attType)
655 {
656 case OFF_ATTACK:
657 modGroup = OFFHAND_CRIT_PERCENTAGE;
659 cr = CR_CRIT_MELEE;
660 break;
661 case RANGED_ATTACK:
662 modGroup = RANGED_CRIT_PERCENTAGE;
664 cr = CR_CRIT_RANGED;
665 break;
666 case BASE_ATTACK:
667 default:
668 modGroup = CRIT_PERCENTAGE;
670 cr = CR_CRIT_MELEE;
671 break;
672 }
673
674 float value = GetTotalPercentageModValue(modGroup) + GetRatingBonusValue(cr);
675 // Modify crit from weapon skill and maximized defense skill of same level victim difference
676 value += (int32(GetWeaponSkillValue(attType)) - int32(GetMaxSkillValueForLevel())) * 0.04f;
677
678 if (sConfigMgr->GetOption<bool>("Stats.Limits.Enable", false))
679 {
680 value = value > sConfigMgr->GetOption<float>("Stats.Limits.Crit", 95.0f) ? sConfigMgr->GetOption<float>("Stats.Limits.Crit", 95.0f) : value;
681 }
682
683 value = value < 0.0f ? 0.0f : value;
684 SetStatFloatValue(index, value);
685}
float GetTotalPercentageModValue(BaseModGroup modGroup) const
Definition: Player.h:2158
uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const *target=nullptr) const
Definition: Unit.cpp:3753

References BASE_ATTACK, CR_CRIT_MELEE, CR_CRIT_RANGED, CRIT_PERCENTAGE, GetMaxSkillValueForLevel(), GetRatingBonusValue(), GetTotalPercentageModValue(), Unit::GetWeaponSkillValue(), OFF_ATTACK, OFFHAND_CRIT_PERCENTAGE, PLAYER_CRIT_PERCENTAGE, PLAYER_OFFHAND_CRIT_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, RANGED_ATTACK, RANGED_CRIT_PERCENTAGE, sConfigMgr, and Object::SetStatFloatValue().

Referenced by HandleBaseModValue(), UpdateAllCritPercentages(), and UpdateRating().

◆ UpdateDefense()

void Player::UpdateDefense ( )
569{
571 sWorld->getIntConfig(CONFIG_SKILL_GAIN_DEFENSE)))
572 UpdateDefenseBonusesMod(); // update dependent from defense skill part
573}
@ CONFIG_SKILL_GAIN_DEFENSE
Definition: IWorld.h:272
bool UpdateSkill(uint32 skill_id, uint32 step)
Definition: PlayerUpdates.cpp:674

References CONFIG_SKILL_GAIN_DEFENSE, SKILL_DEFENSE, sWorld, UpdateDefenseBonusesMod(), and UpdateSkill().

Referenced by UpdateCombatSkills().

◆ UpdateDefenseBonusesMod()

void Player::UpdateDefenseBonusesMod ( )

◆ UpdateDodgePercentage()

void Player::UpdateDodgePercentage ( )
789{
790 const float dodge_cap[MAX_CLASSES] =
791 {
792 88.129021f, // Warrior
793 88.129021f, // Paladin
794 145.560408f, // Hunter
795 145.560408f, // Rogue
796 150.375940f, // Priest
797 88.129021f, // DK
798 145.560408f, // Shaman
799 150.375940f, // Mage
800 150.375940f, // Warlock
801 0.0f, // ??
802 116.890707f // Druid
803 };
804
805 float diminishing = 0.0f, nondiminishing = 0.0f;
806 GetDodgeFromAgility(diminishing, nondiminishing);
807 // Modify value from defense skill (only bonus from defense rating diminishes)
808 nondiminishing += (GetSkillValue(SKILL_DEFENSE) - GetMaxSkillValueForLevel()) * 0.04f;
809 diminishing += (int32(GetRatingBonusValue(CR_DEFENSE_SKILL))) * 0.04f;
810 // Dodge from SPELL_AURA_MOD_DODGE_PERCENT aura
812 // Dodge from rating
813 diminishing += GetRatingBonusValue(CR_DODGE);
814 // apply diminishing formula to diminishing dodge chance
815 uint32 pclass = getClass() - 1;
816 m_realDodge = nondiminishing + (diminishing * dodge_cap[pclass] / (diminishing + dodge_cap[pclass] * m_diminishing_k[pclass]));
817
818 m_realDodge = m_realDodge < 0.0f ? 0.0f : m_realDodge;
819 float value = std::max(diminishing + nondiminishing, 0.0f);
820
821 if (sConfigMgr->GetOption<bool>("Stats.Limits.Enable", false))
822 {
823 value = value > sConfigMgr->GetOption<float>("Stats.Limits.Dodge", 95.0f) ? sConfigMgr->GetOption<float>("Stats.Limits.Dodge", 95.0f) : value;
824 }
825
827}
@ SPELL_AURA_MOD_DODGE_PERCENT
Definition: SpellAuraDefines.h:112
void GetDodgeFromAgility(float &diminishing, float &nondiminishing)
Definition: Player.cpp:5027

References CR_DEFENSE_SKILL, CR_DODGE, Unit::getClass(), GetDodgeFromAgility(), GetMaxSkillValueForLevel(), GetRatingBonusValue(), GetSkillValue(), Unit::GetTotalAuraModifier(), m_diminishing_k, m_realDodge, MAX_CLASSES, PLAYER_DODGE_PERCENTAGE, sConfigMgr, Object::SetStatFloatValue(), SKILL_DEFENSE, and SPELL_AURA_MOD_DODGE_PERCENT.

Referenced by AuraEffect::HandleAuraModDodgePercent(), UpdateDefenseBonusesMod(), UpdateRating(), and UpdateStats().

◆ UpdateDuelFlag()

void Player::UpdateDuelFlag ( time_t  currTime)
424{
425 if (duel && duel->State == DUEL_STATE_COUNTDOWN && duel->StartTime <= currTime)
426 {
427 sScriptMgr->OnPlayerDuelStart(this, duel->Opponent);
428
430 duel->Opponent->SetUInt32Value(PLAYER_DUEL_TEAM, 2);
431
433 duel->Opponent->duel->State = DUEL_STATE_IN_PROGRESS;
434 }
435}
@ DUEL_STATE_COUNTDOWN
Definition: Player.h:372
@ DUEL_STATE_IN_PROGRESS
Definition: Player.h:373

References duel, DUEL_STATE_COUNTDOWN, DUEL_STATE_IN_PROGRESS, PLAYER_DUEL_TEAM, Object::SetUInt32Value(), and sScriptMgr.

Referenced by Update().

◆ UpdateEnchantmentDurations()

void Player::UpdateEnchantmentDurations ( )
4755{
4756 for (EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr)
4757 {
4758 itr->item->SetEnchantmentDuration(itr->slot, itr->leftduration, this);
4759 }
4760}

References m_enchantDuration.

Referenced by Spell::EffectSummonChangeItem().

◆ UpdateEnchantTime()

void Player::UpdateEnchantTime ( uint32  time)
4185{
4186 for (EnchantDurationList::iterator itr = m_enchantDuration.begin(), next; itr != m_enchantDuration.end(); itr = next)
4187 {
4188 ASSERT(itr->item);
4189 next = itr;
4190 if (!itr->item->GetEnchantmentId(itr->slot))
4191 {
4192 next = m_enchantDuration.erase(itr);
4193 }
4194 else if (itr->leftduration <= time)
4195 {
4196 ApplyEnchantment(itr->item, itr->slot, false, false);
4197 itr->item->ClearEnchantment(itr->slot);
4198 next = m_enchantDuration.erase(itr);
4199 }
4200 else if (itr->leftduration > time)
4201 {
4202 itr->leftduration -= time;
4203 ++next;
4204 }
4205 }
4206}

References ApplyEnchantment(), ASSERT, and m_enchantDuration.

Referenced by Update().

◆ UpdateEquipSpellsAtFormChange()

void Player::UpdateEquipSpellsAtFormChange ( )
1314{
1315 for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
1316 {
1317 if (m_items[i] && !m_items[i]->IsBroken() &&
1319 {
1320 ApplyItemEquipSpell(m_items[i], false,
1321 true); // remove spells that not fit to form
1323 m_items[i], true,
1324 true); // add spells that fit form but not active
1325 }
1326 }
1327
1328 // item set bonuses not dependent from item broken state
1329 for (size_t setindex = 0; setindex < ItemSetEff.size(); ++setindex)
1330 {
1331 ItemSetEffect* eff = ItemSetEff[setindex];
1332 if (!eff)
1333 continue;
1334
1335 for (uint32 y = 0; y < MAX_ITEM_SET_SPELLS; ++y)
1336 {
1337 SpellInfo const* spellInfo = eff->spells[y];
1338 if (!spellInfo)
1339 continue;
1340
1341 ApplyEquipSpell(spellInfo, nullptr, false,
1342 true); // remove spells that not fit to form
1343 if (!sScriptMgr->CanApplyEquipSpellsItemSet(this, eff))
1344 break;
1345 ApplyEquipSpell(spellInfo, nullptr, true,
1346 true); // add spells that fit form but not active
1347 }
1348 }
1349}
#define MAX_ITEM_SET_SPELLS
Definition: DBCStructure.h:1220
Definition: Item.h:32
SpellInfo const * spells[8]
Definition: Item.h:35

References ApplyEquipSpell(), ApplyItemEquipSpell(), Unit::CanUseAttackType(), GetAttackBySlot(), INVENTORY_SLOT_BAG_END, ItemSetEff, m_items, MAX_ITEM_SET_SPELLS, ItemSetEffect::spells, and sScriptMgr.

Referenced by InitDataForForm().

◆ UpdateExpertise()

void Player::UpdateExpertise ( WeaponAttackType  attType)
885{
886 if (attack == RANGED_ATTACK)
887 return;
888
890
891 Item* weapon = GetWeaponForAttack(attack, true);
892
894 for (AuraEffectList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr)
895 {
896 // item neutral spell
897 if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)
898 expertise += (*itr)->GetAmount();
899 // item dependent spell
900 else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellInfo()))
901 expertise += (*itr)->GetAmount();
902 }
903
904 if (expertise < 0)
905 expertise = 0;
906
907 switch (attack)
908 {
909 case BASE_ATTACK:
911 break;
912 case OFF_ATTACK:
914 break;
915 default:
916 break;
917 }
918}
@ SPELL_AURA_MOD_EXPERTISE
Definition: SpellAuraDefines.h:303

References BASE_ATTACK, CR_EXPERTISE, Unit::GetAuraEffectsByType(), GetRatingBonusValue(), GetWeaponForAttack(), Item::IsFitToSpellRequirements(), OFF_ATTACK, PLAYER_EXPERTISE, PLAYER_OFFHAND_EXPERTISE, RANGED_ATTACK, Object::SetUInt32Value(), and SPELL_AURA_MOD_EXPERTISE.

Referenced by DestroyItem(), EquipItem(), AuraEffect::HandleAuraModExpertise(), RemoveItem(), UpdateAllStats(), and UpdateRating().

◆ UpdateFallInformationIfNeed()

void Player::UpdateFallInformationIfNeed ( MovementInfo const &  minfo,
uint16  opcode 
)
2142{
2143 if (m_lastFallTime >= minfo.fallTime ||
2144 m_lastFallZ <= minfo.pos.GetPositionZ() || opcode == MSG_MOVE_FALL_LAND)
2145 SetFallInformation(minfo.fallTime, minfo.pos.GetPositionZ());
2146}
@ MSG_MOVE_FALL_LAND
Definition: Opcodes.h:231

References MovementInfo::fallTime, Position::GetPositionZ(), m_lastFallTime, m_lastFallZ, MSG_MOVE_FALL_LAND, MovementInfo::pos, and SetFallInformation().

Referenced by WorldSession::HandleMovementOpcodes().

◆ UpdateFFAPvPFlag()

void Player::UpdateFFAPvPFlag ( time_t  currTime)
392{
393 if (!IsFFAPvP() || sWorld->IsFFAPvPRealm() || !pvpInfo.FFAPvPEndTimer || currTime < pvpInfo.FFAPvPEndTimer + 30)
394 {
395 return;
396 }
397
398 pvpInfo.FFAPvPEndTimer = time_t(0);
400 {
402 sScriptMgr->OnFfaPvpStateUpdate(this, false);
403 }
404 for (ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
405 (*itr)->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
406
407 // xinef: iterate attackers
408 AttackerSet toRemove;
409 AttackerSet const& attackers = getAttackers();
410 for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end(); ++itr)
411 if (!(*itr)->IsValidAttackTarget(this))
412 toRemove.insert(*itr);
413
414 for (AttackerSet::const_iterator itr = toRemove.begin(); itr != toRemove.end(); ++itr)
415 (*itr)->AttackStop();
416
417 // xinef: remove our own victim
418 if (Unit* victim = GetVictim())
419 if (!IsValidAttackTarget(victim))
420 AttackStop();
421}
time_t FFAPvPEndTimer
‍Time when player unflags himself for PvP (flag removed after 5 minutes)
Definition: Player.h:366
std::unordered_set< Unit * > AttackerSet
Definition: Unit.h:1304
AttackerSet const & getAttackers() const
Definition: Unit.h:1395

References Unit::AttackStop(), PvPInfo::FFAPvPEndTimer, Unit::getAttackers(), Unit::GetVictim(), Object::HasByteFlag(), IsFFAPvP(), Unit::IsValidAttackTarget(), Unit::m_Controlled, pvpInfo, Object::RemoveByteFlag(), sScriptMgr, sWorld, UNIT_BYTE2_FLAG_FFA_PVP, and UNIT_FIELD_BYTES_2.

Referenced by Update().

◆ UpdateFFAPvPState()

void Player::UpdateFFAPvPState ( bool  reset = true)
Todo:
: should we always synchronize UNIT_FIELD_BYTES_2, 1 of controller
1412{
1414 // and controlled? no, we shouldn't, those are checked for affecting player
1415 // by client
1416 if (!pvpInfo.IsInNoPvPArea && !IsGameMaster() &&
1417 (pvpInfo.IsInFFAPvPArea || sWorld->IsFFAPvPRealm()))
1418 {
1419 if (!IsFFAPvP())
1420 {
1421 sScriptMgr->OnFfaPvpStateUpdate(this, true);
1423 for (ControlSet::iterator itr = m_Controlled.begin();
1424 itr != m_Controlled.end(); ++itr)
1425 (*itr)->SetByteValue(UNIT_FIELD_BYTES_2, 1,
1427 }
1428
1430 {
1431 pvpInfo.FFAPvPEndTimer = time_t(0);
1432 }
1433 }
1434 else if (IsFFAPvP())
1435 {
1436 if ((pvpInfo.IsInNoPvPArea || IsGameMaster()) || reset ||
1438 {
1439 pvpInfo.FFAPvPEndTimer = time_t(0);
1441 {
1443 sScriptMgr->OnFfaPvpStateUpdate(this, false);
1444 }
1445 for (ControlSet::iterator itr = m_Controlled.begin();
1446 itr != m_Controlled.end(); ++itr)
1447 (*itr)->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1,
1449
1450 // xinef: iterate attackers
1451 AttackerSet toRemove;
1452 AttackerSet const& attackers = getAttackers();
1453 for (AttackerSet::const_iterator itr = attackers.begin();
1454 itr != attackers.end(); ++itr)
1455 if (!(*itr)->IsValidAttackTarget(this))
1456 toRemove.insert(*itr);
1457
1458 for (AttackerSet::const_iterator itr = toRemove.begin();
1459 itr != toRemove.end(); ++itr)
1460 (*itr)->AttackStop();
1461
1462 // xinef: remove our own victim
1463 if (Unit* victim = GetVictim())
1464 if (!IsValidAttackTarget(victim))
1465 AttackStop();
1466 }
1467 else
1468 {
1469 // Not in FFA PvP Area
1470 // Not FFA PvP realm
1471 // Not FFA PvP timer already set
1472 // Being recently in PvP combat
1473 if (!pvpInfo.IsInFFAPvPArea && !sWorld->IsFFAPvPRealm() &&
1475 {
1477 GameTime::GetGameTime().count() +
1478 sWorld->getIntConfig(CONFIG_FFA_PVP_TIMER);
1479 }
1480 }
1481 }
1482}
@ CONFIG_FFA_PVP_TIMER
Definition: IWorld.h:413
time_t EndTimer
‍Marks if player is in an FFAPvP area (such as Gurubashi Arena)
Definition: Player.h:365

References Unit::AttackStop(), CONFIG_FFA_PVP_TIMER, PvPInfo::EndTimer, PvPInfo::FFAPvPEndTimer, Unit::getAttackers(), GameTime::GetGameTime(), Unit::GetVictim(), Object::HasByteFlag(), IsFFAPvP(), IsGameMaster(), PvPInfo::IsInFFAPvPArea, PvPInfo::IsInNoPvPArea, Unit::IsValidAttackTarget(), Unit::m_Controlled, pvpInfo, Object::RemoveByteFlag(), Object::SetByteFlag(), sScriptMgr, sWorld, UNIT_BYTE2_FLAG_FFA_PVP, and UNIT_FIELD_BYTES_2.

Referenced by UpdateArea(), and UpdatePvPState().

◆ UpdateFishingSkill()

bool Player::UpdateFishingSkill ( )
848{
849 LOG_DEBUG("entities.player.skills", "UpdateFishingSkill");
850
852
853 if (SkillValue >= GetMaxSkillValue(SKILL_FISHING))
854 {
855 return false;
856 }
857
858 /* Whenever the player clicks on the fishing gameobject the
859 * core will decide based on a probability if the skill raises or not.
860 */
861 return UpdateSkillPro(
863 static_cast<int32>(getProbabilityOfLevelUp(SkillValue)) * 10,
864 sWorld->getIntConfig(CONFIG_SKILL_GAIN_GATHERING));
865}
float getProbabilityOfLevelUp(uint32 SkillValue)
Definition: PlayerUpdates.cpp:826
@ CONFIG_SKILL_GAIN_GATHERING
Definition: IWorld.h:273
uint16 GetMaxSkillValue(uint32 skill) const
Definition: Player.cpp:5384

References CONFIG_SKILL_GAIN_GATHERING, GetMaxSkillValue(), getProbabilityOfLevelUp(), GetPureSkillValue(), LOG_DEBUG, SKILL_FISHING, sWorld, and UpdateSkillPro().

Referenced by GameObject::Use().

◆ UpdateForQuestWorldObjects()

void Player::UpdateForQuestWorldObjects ( )

This code doesn't look right, but it was logically converted to condition system to do the exact same thing it did before. It definitely needs to be overlooked for intended functionality.

1747{
1748 if (m_clientGUIDs.empty())
1749 return;
1750
1751 UpdateData udata;
1752 WorldPacket packet;
1753 for (GuidUnorderedSet::iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
1754 {
1755 if ((*itr).IsGameObject())
1756 {
1757 if (GameObject* obj = ObjectAccessor::GetGameObject(*this, *itr))
1758 obj->BuildValuesUpdateBlockForPlayer(&udata, this);
1759 }
1760 else if ((*itr).IsCreatureOrVehicle())
1761 {
1763 if (!obj)
1764 continue;
1765
1766 // check if this unit requires quest specific flags
1768 {
1769 SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(obj->GetEntry());
1770 for (SpellClickInfoContainer::const_iterator _itr = clickPair.first; _itr != clickPair.second; ++_itr)
1771 {
1774 ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(obj->GetEntry(), _itr->second.spellId);
1775 bool buildUpdateBlock = false;
1776 for (ConditionList::const_iterator jtr = conds.begin(); jtr != conds.end() && !buildUpdateBlock; ++jtr)
1777 if ((*jtr)->ConditionType == CONDITION_QUESTREWARDED || (*jtr)->ConditionType == CONDITION_QUESTTAKEN)
1778 buildUpdateBlock = true;
1779
1780 if (buildUpdateBlock)
1781 {
1782 obj->BuildValuesUpdateBlockForPlayer(&udata, this);
1783 break;
1784 }
1785 }
1786 }
1788 {
1789 obj->BuildValuesUpdateBlockForPlayer(&udata, this);
1790 }
1791 }
1792 }
1793
1794 udata.BuildPacket(&packet);
1795 GetSession()->SendPacket(&packet);
1796}
@ CONDITION_QUESTREWARDED
Definition: ConditionMgr.h:43
@ CONDITION_QUESTTAKEN
Definition: ConditionMgr.h:44
@ UNIT_NPC_FLAG_VENDOR_MASK
Definition: Unit.h:544
GameObject * GetGameObject(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:187
void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const
Definition: Object.cpp:257
Definition: UpdateData.h:52
bool BuildPacket(WorldPacket *packet)
Definition: UpdateData.cpp:105

References UpdateData::BuildPacket(), Object::BuildValuesUpdateBlockForPlayer(), CONDITION_QUESTREWARDED, CONDITION_QUESTTAKEN, ObjectAccessor::GetCreatureOrPetOrVehicle(), Object::GetEntry(), ObjectAccessor::GetGameObject(), GetSession(), Unit::HasNpcFlag(), m_clientGUIDs, sConditionMgr, WorldSession::SendPacket(), sObjectMgr, UNIT_NPC_FLAG_SPELLCLICK, UNIT_NPC_FLAG_TRAINER, and UNIT_NPC_FLAG_VENDOR_MASK.

Referenced by Group::AddMember(), Group::Disband(), EquipItem(), ItemAddedQuestCheck(), ItemRemovedQuestCheck(), Group::RemoveMember(), and SendQuestUpdate().

◆ UpdateGatherSkill()

bool Player::UpdateGatherSkill ( uint32  SkillId,
uint32  SkillValue,
uint32  RedLevel,
uint32  Multiplicator = 1 
)
725{
726 LOG_DEBUG("entities.player.skills",
727 "UpdateGatherSkill(SkillId {} SkillLevel {} RedLevel {})",
728 SkillId, SkillValue, RedLevel);
729
730 uint32 gathering_skill_gain =
731 sWorld->getIntConfig(CONFIG_SKILL_GAIN_GATHERING);
732 sScriptMgr->OnUpdateGatheringSkill(this, SkillId, SkillValue, RedLevel + 100, RedLevel + 50, RedLevel + 25, gathering_skill_gain);
733
734 // For skinning and Mining chance decrease with level. 1-74 - no decrease,
735 // 75-149 - 2 times, 225-299 - 8 times
736 switch (SkillId)
737 {
738 case SKILL_HERBALISM:
742 return UpdateSkillPro(SkillId,
743 SkillGainChance(SkillValue, RedLevel + 100,
744 RedLevel + 50, RedLevel + 25) *
745 Multiplicator,
746 gathering_skill_gain);
747 case SKILL_SKINNING:
748 if (sWorld->getIntConfig(CONFIG_SKILL_CHANCE_SKINNING_STEPS) == 0)
749 return UpdateSkillPro(SkillId,
750 SkillGainChance(SkillValue, RedLevel + 100,
751 RedLevel + 50,
752 RedLevel + 25) *
753 Multiplicator,
754 gathering_skill_gain);
755 else
756 return UpdateSkillPro(
757 SkillId,
758 (SkillGainChance(SkillValue, RedLevel + 100, RedLevel + 50,
759 RedLevel + 25) *
760 Multiplicator) >>
761 (SkillValue /
763 gathering_skill_gain);
764 case SKILL_MINING:
765 if (sWorld->getIntConfig(CONFIG_SKILL_CHANCE_MINING_STEPS) == 0)
766 return UpdateSkillPro(SkillId,
767 SkillGainChance(SkillValue, RedLevel + 100,
768 RedLevel + 50,
769 RedLevel + 25) *
770 Multiplicator,
771 gathering_skill_gain);
772 else
773 return UpdateSkillPro(
774 SkillId,
775 (SkillGainChance(SkillValue, RedLevel + 100, RedLevel + 50,
776 RedLevel + 25) *
777 Multiplicator) >>
778 (SkillValue /
780 gathering_skill_gain);
781 }
782 return false;
783}
@ CONFIG_SKILL_CHANCE_SKINNING_STEPS
Definition: IWorld.h:270
@ CONFIG_SKILL_CHANCE_MINING_STEPS
Definition: IWorld.h:269
@ SKILL_INSCRIPTION
Definition: SharedDefines.h:3002
@ SKILL_MINING
Definition: SharedDefines.h:2919
@ SKILL_SKINNING
Definition: SharedDefines.h:2961
@ SKILL_JEWELCRAFTING
Definition: SharedDefines.h:2985
@ SKILL_HERBALISM
Definition: SharedDefines.h:2915

References CONFIG_SKILL_CHANCE_MINING_STEPS, CONFIG_SKILL_CHANCE_SKINNING_STEPS, CONFIG_SKILL_GAIN_GATHERING, LOG_DEBUG, SKILL_HERBALISM, SKILL_INSCRIPTION, SKILL_JEWELCRAFTING, SKILL_LOCKPICKING, SKILL_MINING, SKILL_SKINNING, SkillGainChance(), sScriptMgr, sWorld, and UpdateSkillPro().

Referenced by Spell::EffectMilling(), Spell::EffectOpenLock(), Spell::EffectProspecting(), Spell::EffectSkinning(), and GetExplicitDiscoverySpell().

◆ UpdateHomebindTime()

void Player::UpdateHomebindTime ( uint32  time)
1352{
1353 // GMs never get homebind timer online
1355 {
1356 if (m_HomebindTimer) // instance valid, but timer not reset
1357 {
1358 // hide reminder
1359 WorldPacket data(SMSG_RAID_GROUP_ONLY, 4 + 4);
1360 data << uint32(0);
1361 data << uint32(0);
1362 GetSession()->SendPacket(&data);
1363 }
1364 // instance is valid, reset homebind timer
1365 m_HomebindTimer = 0;
1366 }
1367 else if (m_HomebindTimer > 0)
1368 {
1369 if (time >= m_HomebindTimer)
1370 {
1371 // teleport to nearest graveyard
1373 }
1374 else
1375 m_HomebindTimer -= time;
1376 }
1377 else
1378 {
1379 // instance is invalid, start homebind timer
1380 m_HomebindTimer = 60000;
1381 // send message to player
1382 WorldPacket data(SMSG_RAID_GROUP_ONLY, 4 + 4);
1383 data << uint32(m_HomebindTimer);
1384 data << uint32(1);
1385 GetSession()->SendPacket(&data);
1386 LOG_DEBUG(
1387 "maps",
1388 "PLAYER: Player '{}' ({}) will be teleported to homebind in 60 "
1389 "seconds",
1390 GetName(), GetGUID().ToString());
1391 }
1392}
@ SMSG_RAID_GROUP_ONLY
Definition: Opcodes.h:676

References Object::GetGUID(), WorldObject::GetName(), GetSession(), IsGameMaster(), LOG_DEBUG, m_HomebindTimer, m_InstanceValid, RepopAtGraveyard(), WorldSession::SendPacket(), SMSG_RAID_GROUP_ONLY, and Position::ToString().

Referenced by Update().

◆ UpdateHonorFields()

void Player::UpdateHonorFields ( )

called when rewarding honor and at each save

1142{
1144 time_t now = time_t(GameTime::GetGameTime().count());
1145 time_t today = time_t(GameTime::GetGameTime().count() / DAY) * DAY;
1146
1147 if (m_lastHonorUpdateTime < today)
1148 {
1149 time_t yesterday = today - DAY;
1150
1152
1153 // update yesterday's contribution
1154 if (m_lastHonorUpdateTime >= yesterday)
1155 {
1158
1159 // this is the first update today, reset today's contribution
1162 }
1163 else
1164 {
1165 // no honor/kills yesterday or today, reset
1168 }
1169 }
1170
1172}
uint16 PAIR32_LOPART(uint32 x)
Definition: ObjectDefines.h:97

References DAY, GameTime::GetGameTime(), Object::GetUInt32Value(), m_lastHonorUpdateTime, MAKE_PAIR32(), PAIR32_LOPART(), PLAYER_FIELD_KILLS, PLAYER_FIELD_TODAY_CONTRIBUTION, PLAYER_FIELD_YESTERDAY_CONTRIBUTION, and Object::SetUInt32Value().

Referenced by honor_commandscript::HandleHonorUpdateCommand(), LoadFromDB(), RewardHonor(), and SaveToDB().

◆ UpdateItemDuration()

void Player::UpdateItemDuration ( uint32  time,
bool  realtimeonly = false 
)
4168{
4169 if (m_itemDuration.empty())
4170 return;
4171
4172 LOG_DEBUG("entities.player.items", "Player::UpdateItemDuration({}, {})", time, realtimeonly);
4173
4174 for (ItemDurationList::const_iterator itr = m_itemDuration.begin(); itr != m_itemDuration.end();)
4175 {
4176 Item* item = *itr;
4177 ++itr; // current element can be erased in UpdateDuration
4178
4179 if (!realtimeonly || item->GetTemplate()->FlagsCu & ITEM_FLAGS_CU_DURATION_REAL_TIME)
4180 item->UpdateDuration(this, time);
4181 }
4182}
@ ITEM_FLAGS_CU_DURATION_REAL_TIME
Definition: ItemTemplate.h:228
void UpdateDuration(Player *owner, uint32 diff)
Definition: Item.cpp:319
uint32 FlagsCu
Definition: ItemTemplate.h:703

References ItemTemplate::FlagsCu, Item::GetTemplate(), ITEM_FLAGS_CU_DURATION_REAL_TIME, LOG_DEBUG, m_itemDuration, and Item::UpdateDuration().

Referenced by LoadFromDB(), and Update().

◆ UpdateLocalChannels()

void Player::UpdateLocalChannels ( uint32  newZone)
467{
468 // pussywizard: mutex needed (tc changed opcode to THREAD UNSAFE)
469 static std::mutex channelsLock;
470 std::lock_guard<std::mutex> guard(channelsLock);
471
472 if (GetSession()->PlayerLoading() && !IsBeingTeleportedFar())
473 return; // The client handles it automatically after loading, but not
474 // after teleporting
475
476 AreaTableEntry const* current_zone = sAreaTableStore.LookupEntry(newZone);
477 if (!current_zone)
478 return;
479
481 if (!cMgr)
482 return;
483
484 std::string current_zone_name =
485 current_zone->area_name[GetSession()->GetSessionDbcLocale()];
486
487 for (uint32 i = 0; i < sChatChannelsStore.GetNumRows(); ++i)
488 {
489 if (ChatChannelsEntry const* channel =
490 sChatChannelsStore.LookupEntry(i))
491 {
492 Channel* usedChannel = nullptr;
493
494 for (Channel* channel : m_channels)
495 {
496 if (channel && channel->GetChannelId() == i)
497 {
498 usedChannel = channel;
499 break;
500 }
501 }
502
503 Channel* removeChannel = nullptr;
504 Channel* joinChannel = nullptr;
505 bool sendRemove = true;
506
507 if (CanJoinConstantChannelInZone(channel, current_zone))
508 {
509 if (!(channel->flags & CHANNEL_DBC_FLAG_GLOBAL))
510 {
511 if (channel->flags & CHANNEL_DBC_FLAG_CITY_ONLY &&
512 usedChannel)
513 continue; // Already on the channel, as city channel
514 // names are not changing
515
516 char new_channel_name_buf[100];
517 char const* currentNameExt;
518
519 if (channel->flags & CHANNEL_DBC_FLAG_CITY_ONLY)
520 currentNameExt = sObjectMgr->GetAcoreStringForDBCLocale(
522 else
523 currentNameExt = current_zone_name.c_str();
524
525 snprintf(new_channel_name_buf, 100,
526 channel->pattern[m_session->GetSessionDbcLocale()],
527 currentNameExt);
528
529 joinChannel = cMgr->GetJoinChannel(new_channel_name_buf,
530 channel->ChannelID);
531 if (usedChannel)
532 {
533 if (joinChannel != usedChannel)
534 {
535 removeChannel = usedChannel;
536 sendRemove = false; // Do not send leave channel, it
537 // already replaced at client
538 }
539 else
540 joinChannel = nullptr;
541 }
542 }
543 else
544 joinChannel = cMgr->GetJoinChannel(
545 channel->pattern[m_session->GetSessionDbcLocale()],
546 channel->ChannelID);
547 }
548 else
549 removeChannel = usedChannel;
550
551 if (joinChannel)
552 joinChannel->JoinChannel(
553 this, ""); // Changed Channel: ... or Joined Channel: ...
554
555 if (removeChannel)
556 {
557 removeChannel->LeaveChannel(this,
558 sendRemove); // Leave old channel
559 std::string name =
560 removeChannel
561 ->GetName(); // Store name, (*i)erase in LeftChannel
562 LeftChannel(removeChannel); // Remove from player's channel list
563 }
564 }
565 }
566}
@ CHANNEL_DBC_FLAG_GLOBAL
Definition: Channel.h:99
DBCStorage< ChatChannelsEntry > sChatChannelsStore(ChatChannelsEntryfmt)
@ LANG_CHANNEL_CITY
Definition: Language.h:741
void JoinChannel(Player *player, std::string const &pass)
Definition: Channel.cpp:157
std::string const & GetName() const
Definition: Channel.h:183
Definition: ChannelMgr.h:30
static ChannelMgr * forTeam(TeamId teamId)
Definition: ChannelMgr.cpp:33
Channel * GetJoinChannel(std::string const &name, uint32 channel_id)
Definition: ChannelMgr.cpp:121
void LeftChannel(Channel *c)
Definition: Player.cpp:4912
bool CanJoinConstantChannelInZone(ChatChannelsEntry const *channel, AreaTableEntry const *zone)
Definition: Player.cpp:4889
LocaleConstant GetSessionDbcLocale() const
Definition: WorldSession.h:499
char const * area_name[16]
Definition: DBCStructure.h:527
Definition: DBCStructure.h:643

References AreaTableEntry::area_name, CanJoinConstantChannelInZone(), CHANNEL_DBC_FLAG_CITY_ONLY, CHANNEL_DBC_FLAG_GLOBAL, ChannelMgr::forTeam(), ChannelMgr::GetJoinChannel(), Channel::GetName(), GetSession(), WorldSession::GetSessionDbcLocale(), GetTeamId(), IsBeingTeleportedFar(), Channel::JoinChannel(), LANG_CHANNEL_CITY, Channel::LeaveChannel(), LeftChannel(), m_channels, m_session, sAreaTableStore, sChatChannelsStore, and sObjectMgr.

Referenced by UpdateZone().

◆ UpdateLootAchievements()

void Player::UpdateLootAchievements ( LootItem item,
Loot loot 
)

◆ UpdateManaRegen()

void Player::UpdateManaRegen ( )
932{
934 {
937 return;
938 }
939
940 float Intellect = GetStat(STAT_INTELLECT);
941 // Mana regen from spirit and intellect
942 float power_regen = std::sqrt(Intellect) * OCTRegenMPPerSpirit();
943 // Apply PCT bonus from SPELL_AURA_MOD_POWER_REGEN_PERCENT aura on spirit base regen
945
946 // Mana regen from SPELL_AURA_MOD_POWER_REGEN aura
948
949 // Get bonus from SPELL_AURA_MOD_MANA_REGEN_FROM_STAT aura
951 for (AuraEffectList::const_iterator i = regenAura.begin(); i != regenAura.end(); ++i)
952 {
953 power_regen_mp5 += GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 500.0f;
954 }
955
956 // Set regen rate in cast state apply only on spirit based regen
958 if (modManaRegenInterrupt > 100)
959 modManaRegenInterrupt = 100;
960 SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, power_regen_mp5 + CalculatePct(power_regen, modManaRegenInterrupt));
961
962 SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, power_regen_mp5 + power_regen);
963}
@ SPELL_AURA_MOD_MANA_REGEN_INTERRUPT
Definition: SpellAuraDefines.h:197
@ SPELL_AURA_MOD_MANA_REGEN_FROM_STAT
Definition: SpellAuraDefines.h:282
float OCTRegenMPPerSpirit()
Definition: Player.cpp:5155
float GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const
Definition: Unit.cpp:5964

References CalculatePct(), Unit::GetAuraEffectsByType(), Unit::GetStat(), Unit::GetTotalAuraModifier(), Unit::GetTotalAuraModifierByMiscValue(), Unit::GetTotalAuraMultiplierByMiscValue(), Unit::HasAuraTypeWithMiscvalue(), m_baseManaRegen, OCTRegenMPPerSpirit(), POWER_MANA, Object::SetStatFloatValue(), SPELL_AURA_MOD_MANA_REGEN_FROM_STAT, SPELL_AURA_MOD_MANA_REGEN_INTERRUPT, SPELL_AURA_MOD_POWER_REGEN, SPELL_AURA_MOD_POWER_REGEN_PERCENT, SPELL_AURA_PREVENT_REGENERATE_POWER, STAT_INTELLECT, UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, and UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER.

Referenced by ApplyManaRegenBonus(), AuraEffect::HandleModManaRegen(), AuraEffect::HandleModPowerRegen(), UpdateAllStats(), and UpdateStats().

◆ UpdateMaxHealth()

void Player::UpdateMaxHealth ( )
overridevirtual

Implements Unit.

297{
298 UnitMods unitMod = UNIT_MOD_HEALTH;
299
300 float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreateHealth();
301 value *= GetModifierValue(unitMod, BASE_PCT);
303 value *= GetModifierValue(unitMod, TOTAL_PCT);
304
305 sScriptMgr->OnAfterUpdateMaxHealth(this, value);
306 SetMaxHealth((uint32)value);
307}
float GetHealthBonusFromStamina()
Definition: StatSystem.cpp:276

References BASE_PCT, BASE_VALUE, Unit::GetCreateHealth(), GetHealthBonusFromStamina(), Unit::GetModifierValue(), Unit::SetMaxHealth(), sScriptMgr, TOTAL_PCT, TOTAL_VALUE, and UNIT_MOD_HEALTH.

Referenced by Create(), UpdateAllStats(), and UpdateStats().

◆ UpdateMaxPower()

void Player::UpdateMaxPower ( Powers  power)
overridevirtual

Implements Unit.

310{
311 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_POWER_START) + power);
312
313 float bonusPower = (power == POWER_MANA && GetCreatePowers(power) > 0) ? GetManaBonusFromIntellect() : 0;
314
315 float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power);
316 value *= GetModifierValue(unitMod, BASE_PCT);
317 value += GetModifierValue(unitMod, TOTAL_VALUE) + bonusPower;
318 value *= GetModifierValue(unitMod, TOTAL_PCT);
319
320 sScriptMgr->OnAfterUpdateMaxPower(this, power, value);
321 SetMaxPower(power, uint32(value));
322}
@ UNIT_MOD_POWER_START
Definition: Unit.h:293
float GetManaBonusFromIntellect()
Definition: StatSystem.cpp:286

References BASE_PCT, BASE_VALUE, Unit::GetCreatePowers(), GetManaBonusFromIntellect(), Unit::GetModifierValue(), POWER_MANA, Unit::SetMaxPower(), sScriptMgr, TOTAL_PCT, TOTAL_VALUE, and UNIT_MOD_POWER_START.

Referenced by Create(), UpdateAllStats(), and UpdateStats().

◆ UpdateMeleeHitChances()

void Player::UpdateMeleeHitChances ( )

◆ UpdateMirrorTimers()

void Player::UpdateMirrorTimers ( )
428{
429 // Desync flags for update on next HandleDrowning
431 m_MirrorTimerFlagsLast = ~m_MirrorTimerFlags;
432}

References m_MirrorTimerFlags, and m_MirrorTimerFlagsLast.

Referenced by AuraEffect::HandleWaterBreathing().

◆ UpdateNextMailTimeAndUnreads()

void Player::UpdateNextMailTimeAndUnreads ( )
435{
436 // Update the next delivery time and unread mails
437 time_t cTime = GameTime::GetGameTime().count();
438 // Get the next delivery time
439 CharacterDatabasePreparedStatement* stmtNextDeliveryTime =
441 stmtNextDeliveryTime->SetData(0, GetGUID().GetCounter());
442 stmtNextDeliveryTime->SetData(1, uint32(cTime));
443 PreparedQueryResult resultNextDeliveryTime =
444 CharacterDatabase.Query(stmtNextDeliveryTime);
445 if (resultNextDeliveryTime)
446 {
447 Field* fields = resultNextDeliveryTime->Fetch();
448 m_nextMailDelivereTime = time_t(fields[0].Get<uint32>());
449 }
450
451 // Get unread mails count
452 CharacterDatabasePreparedStatement* stmtUnreadAmount =
453 CharacterDatabase.GetPreparedStatement(
455 stmtUnreadAmount->SetData(0, GetGUID().GetCounter());
456 stmtUnreadAmount->SetData(1, uint32(cTime));
457 PreparedQueryResult resultUnreadAmount =
458 CharacterDatabase.Query(stmtUnreadAmount);
459 if (resultUnreadAmount)
460 {
461 Field* fields = resultUnreadAmount->Fetch();
462 unReadMails = uint8(fields[0].Get<uint64>());
463 }
464}
@ CHAR_SEL_CHARACTER_MAILCOUNT_UNREAD_SYNCH
Definition: CharacterDatabase.h:83
@ CHAR_SEL_NEXT_MAIL_DELIVERYTIME
Definition: CharacterDatabase.h:352

References CHAR_SEL_CHARACTER_MAILCOUNT_UNREAD_SYNCH, CHAR_SEL_NEXT_MAIL_DELIVERYTIME, CharacterDatabase, GameTime::GetGameTime(), Object::GetGUID(), m_nextMailDelivereTime, PreparedStatementBase::SetData(), and unReadMails.

Referenced by _LoadMail(), and WorldSession::HandleGetMailList().

◆ UpdateObjectVisibility()

void Player::UpdateObjectVisibility ( bool  forced = true,
bool  fromUpdate = false 
)
overridevirtual

Reimplemented from WorldObject.

1572{
1573 // Prevent updating visibility if player is not in world (example: LoadFromDB sets drunkstate which updates invisibility while player is not in map)
1574 if (!IsInWorld())
1575 return;
1576
1577 if (!forced)
1579 else if (!isBeingLoaded())
1580 {
1581 if (!fromUpdate) // pussywizard:
1582 {
1584 return;
1585 }
1588 }
1589}
void AddToNotify(uint16 f)
Definition: Object.cpp:2932
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition: Unit.cpp:19394

References WorldObject::AddToNotify(), Unit::bRequestForcedVisibilityUpdate, isBeingLoaded(), Object::IsInWorld(), NOTIFY_VISIBILITY_CHANGED, Unit::UpdateObjectVisibility(), and UpdateVisibilityForPlayer().

Referenced by Map::AddPlayerToMap(), gm_commandscript::HandleGMVisibleCommand(), WorldSession::HandlePlayerLoginToCharInWorld(), Map::PlayerRelocation(), ResurrectPlayer(), SetDrunkValue(), SetGameMaster(), SetGroup(), and Update().

◆ UpdateParryPercentage()

void Player::UpdateParryPercentage ( )
743{
744 const float parry_cap[MAX_CLASSES] =
745 {
746 47.003525f, // Warrior
747 47.003525f, // Paladin
748 145.560408f, // Hunter
749 145.560408f, // Rogue
750 0.0f, // Priest
751 47.003525f, // DK
752 145.560408f, // Shaman
753 0.0f, // Mage
754 0.0f, // Warlock
755 0.0f, // ??
756 0.0f // Druid
757 };
758
759 // No parry
760 float value = 0.0f;
761 m_realParry = 0.0f;
762 uint32 pclass = getClass() - 1;
763 if (CanParry() && parry_cap[pclass] > 0.0f)
764 {
765 float nondiminishing = 5.0f;
766 // Parry from rating
767 float diminishing = GetRatingBonusValue(CR_PARRY);
768 // Modify value from defense skill (only bonus from defense rating diminishes)
769 nondiminishing += (GetSkillValue(SKILL_DEFENSE) - GetMaxSkillValueForLevel()) * 0.04f;
770 diminishing += (int32(GetRatingBonusValue(CR_DEFENSE_SKILL))) * 0.04f;
771 // Parry from SPELL_AURA_MOD_PARRY_PERCENT aura
773 // apply diminishing formula to diminishing parry chance
774 m_realParry = nondiminishing + diminishing * parry_cap[pclass] / (diminishing + parry_cap[pclass] * m_diminishing_k[pclass]);
775 m_realParry = m_realParry < 0.0f ? 0.0f : m_realParry;
776
777 value = std::max(diminishing + nondiminishing, 0.0f);
778
779 if (sConfigMgr->GetOption<bool>("Stats.Limits.Enable", false))
780 {
781 value = value > sConfigMgr->GetOption<float>("Stats.Limits.Parry", 95.0f) ? sConfigMgr->GetOption<float>("Stats.Limits.Parry", 95.0f) : value;
782 }
783 }
784
786}
@ SPELL_AURA_MOD_PARRY_PERCENT
Definition: SpellAuraDefines.h:110
bool CanParry() const
Definition: Player.h:2145

References CanParry(), CR_DEFENSE_SKILL, CR_PARRY, Unit::getClass(), GetMaxSkillValueForLevel(), GetRatingBonusValue(), GetSkillValue(), Unit::GetTotalAuraModifier(), m_diminishing_k, m_realParry, MAX_CLASSES, PLAYER_PARRY_PERCENTAGE, sConfigMgr, Object::SetStatFloatValue(), SKILL_DEFENSE, and SPELL_AURA_MOD_PARRY_PERCENT.

Referenced by AuraEffect::HandleAuraModParryPercent(), SetCanParry(), UpdateDefenseBonusesMod(), and UpdateRating().

◆ UpdatePlayerSetting()

void Player::UpdatePlayerSetting ( std::string  source,
uint8  index,
uint32  value 
)
116{
117 auto itr = m_charSettingsMap.find(source);
118 uint8 size = index + 1;
119
120 if (itr == m_charSettingsMap.end())
121 {
122 // Settings not found, initialize a new entry.
123 PlayerSettingVector setting;
124 setting.resize(size);
125
126 for (uint32 itr = 0; itr <= index; ++itr)
127 {
128 PlayerSetting set;
129 set.value = itr == index ? value : 0;
130
131 setting[itr] = set;
132 }
133
134 m_charSettingsMap[source] = setting;
135 }
136 else
137 {
138 if (size > itr->second.size())
139 {
140 itr->second.resize(size);
141 }
142 itr->second[index].value = value;
143 }
144}

References m_charSettingsMap, and PlayerSetting::value.

Referenced by GetPlayerSetting(), and player_settings_commandscript::HandleSettingsAnnouncerFlags().

◆ UpdatePosition() [1/2]

bool Player::UpdatePosition ( const Position pos,
bool  teleport = false 
)
inline
1985{ return UpdatePosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }
bool UpdatePosition(float x, float y, float z, float orientation, bool teleport=false) override
Definition: PlayerUpdates.cpp:1115

References Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and UpdatePosition().

Referenced by UpdatePosition().

◆ UpdatePosition() [2/2]

bool Player::UpdatePosition ( float  x,
float  y,
float  z,
float  orientation,
bool  teleport = false 
)
overridevirtual

Reimplemented from Unit.

1117{
1118 if (!Unit::UpdatePosition(x, y, z, orientation, teleport))
1119 return false;
1120
1121 // Update player zone if needed
1122 if (m_needZoneUpdate)
1123 {
1124 uint32 newZone, newArea;
1125 GetZoneAndAreaId(newZone, newArea);
1126 UpdateZone(newZone, newArea);
1127 m_needZoneUpdate = false;
1128 }
1129
1130 if (GetGroup())
1132
1135
1137
1138 return true;
1139}
@ GROUP_UPDATE_FLAG_POSITION
Definition: Group.h:108
void CheckAreaExploreAndOutdoor()
Definition: Player.cpp:5630
Player * GetTrader() const
Definition: Player.h:1355
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition: Unit.cpp:20296

References CheckAreaExploreAndOutdoor(), GetGroup(), GetSession(), GetTrader(), WorldObject::GetZoneAndAreaId(), GROUP_UPDATE_FLAG_POSITION, INTERACTION_DISTANCE, WorldObject::IsWithinDistInMap(), m_needZoneUpdate, WorldSession::SendCancelTrade(), SetGroupUpdateFlag(), Unit::UpdatePosition(), and UpdateZone().

Referenced by spell_rog_killing_spree::spell_rog_killing_spree_AuraScript::HandleEffectPeriodic(), and WorldSession::HandleMoveTeleportAck().

◆ UpdatePotionCooldown()

void Player::UpdatePotionCooldown ( Spell spell = nullptr)
1502{
1503 // no potion used i combat or still in combat
1504 if (!GetLastPotionId() || IsInCombat())
1505 return;
1506
1507 // Call not from spell cast, send cooldown event for item spells if no in
1508 // combat
1509 if (!spell)
1510 {
1511 // spell/item pair let set proper cooldown (except not existed charged
1512 // spell cooldown spellmods for potions)
1513 if (ItemTemplate const* proto =
1514 sObjectMgr->GetItemTemplate(GetLastPotionId()))
1515 for (uint8 idx = 0; idx < MAX_ITEM_SPELLS; ++idx)
1516 if (proto->Spells[idx].SpellId &&
1517 proto->Spells[idx].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE)
1518 if (SpellInfo const* spellInfo =
1519 sSpellMgr->GetSpellInfo(proto->Spells[idx].SpellId))
1520 SendCooldownEvent(spellInfo, GetLastPotionId());
1521 }
1522 // from spell cases (m_lastPotionId set in Spell::SendSpellCooldown)
1523 else
1524 {
1525 if (spell->IsIgnoringCooldowns())
1526 return;
1527
1529 }
1530
1531 SetLastPotionId(0);
1532}
void SetLastPotionId(uint32 item_id)
Definition: Player.h:1776
uint32 GetLastPotionId()
Definition: Player.h:1775
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool setCooldown=true)
Definition: Player.cpp:11024
bool IsIgnoringCooldowns() const
Definition: Spell.cpp:8032

References GetLastPotionId(), Spell::IsIgnoringCooldowns(), Unit::IsInCombat(), ITEM_SPELLTRIGGER_ON_USE, m_lastPotionId, Spell::m_spellInfo, MAX_ITEM_SPELLS, SendCooldownEvent(), SetLastPotionId(), sObjectMgr, and sSpellMgr.

Referenced by Spell::finish().

◆ UpdatePvP()

void Player::UpdatePvP ( bool  state,
bool  _override = false 
)

◆ UpdatePvPFlag()

void Player::UpdatePvPFlag ( time_t  currTime)
373{
374 if (!IsPvP())
375 return;
376
377 if (pvpInfo.EndTimer == 0 || pvpInfo.IsHostile)
378 return;
379
380 if (currTime < (pvpInfo.EndTimer + 300 + 5))
381 {
382 if (currTime > (pvpInfo.EndTimer + 4) && !HasPlayerFlag(PLAYER_FLAGS_PVP_TIMER))
384
385 return;
386 }
387
388 UpdatePvP(false);
389}
void UpdatePvP(bool state, bool _override=false)
Definition: PlayerUpdates.cpp:1484

References PvPInfo::EndTimer, HasPlayerFlag(), PvPInfo::IsHostile, IsPvP(), PLAYER_FLAGS_PVP_TIMER, pvpInfo, SetPlayerFlag(), and UpdatePvP().

Referenced by Update().

◆ UpdatePvPState()

void Player::UpdatePvPState ( )
1395{
1397
1398 if (pvpInfo.IsHostile) // in hostile area
1399 {
1400 if (!IsPvP() || pvpInfo.EndTimer != 0)
1401 UpdatePvP(true, true);
1402 }
1403 else // in friendly area
1404 {
1406 pvpInfo.EndTimer == 0)
1407 pvpInfo.EndTimer = GameTime::GetGameTime().count(); // start toggle-off
1408 }
1409}
@ PLAYER_FLAGS_IN_PVP
Definition: Player.h:484

References PvPInfo::EndTimer, GameTime::GetGameTime(), HasPlayerFlag(), PvPInfo::IsHostile, IsPvP(), PLAYER_FLAGS_IN_PVP, pvpInfo, UpdateFFAPvPState(), and UpdatePvP().

Referenced by AddQuest(), Spell::EffectQuestClear(), WorldSession::HandleQuestLogRemoveQuest(), RewardQuest(), Unit::SetCharm(), and UpdateZone().

◆ UpdateRangedHitChances()

◆ UpdateRating()

void Player::UpdateRating ( CombatRating  cr)
576{
577 int32 amount = m_baseRatingValue[cr];
578 // Apply bonus from SPELL_AURA_MOD_RATING_FROM_STAT
579 // stat used stored in miscValueB for this aura
580 AuraEffectList const& modRatingFromStat =
582 for (AuraEffectList::const_iterator i = modRatingFromStat.begin();
583 i != modRatingFromStat.end(); ++i)
584 if ((*i)->GetMiscValue() & (1 << cr))
585 amount += int32(CalculatePct(GetStat(Stats((*i)->GetMiscValueB())),
586 (*i)->GetAmount()));
587 if (amount < 0)
588 amount = 0;
589 SetUInt32Value(static_cast<uint16>(PLAYER_FIELD_COMBAT_RATING_1) + static_cast<uint16>(cr), uint32(amount));
590
591 bool affectStats = CanModifyStats();
592
593 switch (cr)
594 {
595 case CR_WEAPON_SKILL: // Implemented in Unit::RollMeleeOutcomeAgainst
596 case CR_DEFENSE_SKILL:
598 break;
599 case CR_DODGE:
601 break;
602 case CR_PARRY:
604 break;
605 case CR_BLOCK:
607 break;
608 case CR_HIT_MELEE:
610 break;
611 case CR_HIT_RANGED:
613 break;
614 case CR_HIT_SPELL:
616 break;
617 case CR_CRIT_MELEE:
618 if (affectStats)
619 {
622 }
623 break;
624 case CR_CRIT_RANGED:
625 if (affectStats)
627 break;
628 case CR_CRIT_SPELL:
629 if (affectStats)
631 break;
632 case CR_HIT_TAKEN_MELEE: // Implemented in Unit::MeleeMissChanceCalc
634 break;
635 case CR_HIT_TAKEN_SPELL: // Implemented in Unit::MagicSpellHitResult
636 break;
637 case CR_CRIT_TAKEN_MELEE: // Implemented in Unit::RollMeleeOutcomeAgainst
638 // (only for chance to crit)
640 break;
641 case CR_CRIT_TAKEN_SPELL: // Implemented in Unit::SpellCriticalBonus (only
642 // for chance to crit)
643 break;
644 case CR_HASTE_MELEE: // Implemented in Player::ApplyRatingMod
645 case CR_HASTE_RANGED:
646 case CR_HASTE_SPELL:
647 break;
648 case CR_WEAPON_SKILL_MAINHAND: // Implemented in
649 // Unit::RollMeleeOutcomeAgainst
652 break;
653 case CR_EXPERTISE:
654 if (affectStats)
655 {
658 }
659 break;
661 if (affectStats)
663 break;
664 }
665}
@ CR_WEAPON_SKILL_RANGED
Definition: Unit.h:426
@ CR_WEAPON_SKILL
Definition: Unit.h:404
@ CR_WEAPON_SKILL_OFFHAND
Definition: Unit.h:425
@ CR_WEAPON_SKILL_MAINHAND
Definition: Unit.h:424
@ SPELL_AURA_MOD_RATING_FROM_STAT
Definition: SpellAuraDefines.h:283
void UpdateArmorPenetration(int32 amount)
Definition: StatSystem.cpp:854
void UpdateSpellHitChances()
Definition: StatSystem.cpp:872
void UpdateMeleeHitChances()
Definition: StatSystem.cpp:860
void UpdateRangedHitChances()
Definition: StatSystem.cpp:866

References BASE_ATTACK, CalculatePct(), Unit::CanModifyStats(), CR_ARMOR_PENETRATION, CR_BLOCK, CR_CRIT_MELEE, CR_CRIT_RANGED, CR_CRIT_SPELL, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, CR_DEFENSE_SKILL, CR_DODGE, CR_EXPERTISE, CR_HASTE_MELEE, CR_HASTE_RANGED, CR_HASTE_SPELL, CR_HIT_MELEE, CR_HIT_RANGED, CR_HIT_SPELL, CR_HIT_TAKEN_MELEE, CR_HIT_TAKEN_RANGED, CR_HIT_TAKEN_SPELL, CR_PARRY, CR_WEAPON_SKILL, CR_WEAPON_SKILL_MAINHAND, CR_WEAPON_SKILL_OFFHAND, CR_WEAPON_SKILL_RANGED, Unit::GetAuraEffectsByType(), Unit::GetStat(), m_baseRatingValue, OFF_ATTACK, PLAYER_FIELD_COMBAT_RATING_1, RANGED_ATTACK, Object::SetUInt32Value(), SPELL_AURA_MOD_RATING_FROM_STAT, UpdateAllSpellCritChances(), UpdateArmorPenetration(), UpdateBlockPercentage(), UpdateCritPercentage(), UpdateDefenseBonusesMod(), UpdateDodgePercentage(), UpdateExpertise(), UpdateMeleeHitChances(), UpdateParryPercentage(), UpdateRangedHitChances(), and UpdateSpellHitChances().

Referenced by ApplyRatingMod(), and UpdateAllRatings().

◆ UpdateResistances()

void Player::UpdateResistances ( uint32  school)
overridevirtual

Implements Unit.

226{
227 if (school > SPELL_SCHOOL_NORMAL)
228 {
229 // cant use GetTotalAuraModValue because of total pct multiplier :P
230 float value = 0.0f;
231 UnitMods unitMod = UnitMods(UNIT_MOD_RESISTANCE_START + school);
232
233 value = GetModifierValue(unitMod, BASE_VALUE);
234 value *= GetModifierValue(unitMod, BASE_PCT);
235 value += GetModifierValue(unitMod, TOTAL_VALUE);
236
238 for(AuraEffectList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
239 {
240 if((*i)->GetMiscValue() & (1 << (school - 1)) )
241 value += int32(GetStat(Stats((*i)->GetMiscValueB())) * (*i)->GetAmount() / 100.0f);
242 }
243
244 value *= GetModifierValue(unitMod, TOTAL_PCT);
245
246 SetResistance(SpellSchools(school), int32(value));
247 }
248 else
249 UpdateArmor();
250}

References BASE_PCT, BASE_VALUE, Unit::GetAuraEffectsByType(), Unit::GetModifierValue(), Unit::GetStat(), Unit::SetResistance(), SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT, SPELL_SCHOOL_NORMAL, TOTAL_PCT, TOTAL_VALUE, UNIT_MOD_RESISTANCE_START, and UpdateArmor().

◆ UpdateRuneRegen()

void Player::UpdateRuneRegen ( RuneType  rune)
966{
967 if (rune >= NUM_RUNE_TYPES)
968 return;
969
970 uint32 cooldown = 0;
971
972 for (uint32 i = 0; i < MAX_RUNES; ++i)
973 if (GetBaseRune(i) == rune)
974 {
975 cooldown = GetRuneBaseCooldown(i, true);
976 break;
977 }
978
979 if (cooldown <= 0)
980 return;
981
982 float regen = float(1 * IN_MILLISECONDS) / float(cooldown);
984}
uint32 GetRuneBaseCooldown(uint8 index, bool skipGrace)
Definition: Player.cpp:13285

References GetBaseRune(), GetRuneBaseCooldown(), IN_MILLISECONDS, MAX_RUNES, NUM_RUNE_TYPES, PLAYER_RUNE_REGEN_1, and Object::SetFloatValue().

Referenced by AuraEffect::HandleModPowerRegen().

◆ UpdateShieldBlockValue()

void Player::UpdateShieldBlockValue ( )
530{
532}
uint32 GetShieldBlockValue() const override
Definition: Player.cpp:5001

References GetShieldBlockValue(), PLAYER_SHIELD_BLOCK, and Object::SetUInt32Value().

Referenced by HandleBaseModValue(), UpdateAllStats(), and UpdateStats().

◆ UpdateSkill()

bool Player::UpdateSkill ( uint32  skill_id,
uint32  step 
)
675{
676 if (!skill_id)
677 return false;
678
679 SkillStatusMap::iterator itr = mSkillStatus.find(skill_id);
680 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
681 return false;
682
683 uint32 valueIndex = PLAYER_SKILL_VALUE_INDEX(itr->second.pos);
684 uint32 data = GetUInt32Value(valueIndex);
685 uint32 value = SKILL_VALUE(data);
686 uint32 max = SKILL_MAX(data);
687
688 if ((!max) || (!value) || (value >= max))
689 return false;
690
691 if (value < max)
692 {
693 uint32 new_value = value + step;
694 if (new_value > max)
695 new_value = max;
696
697 SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(new_value, max));
698 if (itr->second.uState != SKILL_NEW)
699 itr->second.uState = SKILL_CHANGED;
700
701 UpdateSkillEnchantments(skill_id, value, new_value);
703 skill_id);
704 return true;
705 }
706
707 return false;
708}

References ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, Object::GetUInt32Value(), MAKE_SKILL_VALUE, mSkillStatus, PLAYER_SKILL_VALUE_INDEX, Object::SetUInt32Value(), SKILL_CHANGED, SKILL_DELETED, SKILL_MAX, SKILL_NEW, SKILL_VALUE, UpdateAchievementCriteria(), and UpdateSkillEnchantments().

Referenced by UpdateDefense(), and UpdateWeaponSkill().

◆ UpdateSkillEnchantments()

void Player::UpdateSkillEnchantments ( uint16  skill_id,
uint16  curr_value,
uint16  new_value 
)
4702{
4703 for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
4704 {
4705 if (m_items[i])
4706 {
4707 for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
4708 {
4709 uint32 ench_id = m_items[i]->GetEnchantmentId(EnchantmentSlot(slot));
4710 if (!ench_id)
4711 continue;
4712
4713 SpellItemEnchantmentEntry const* Enchant = sSpellItemEnchantmentStore.LookupEntry(ench_id);
4714 if (!Enchant)
4715 return;
4716
4717 if (Enchant->requiredSkill == skill_id)
4718 {
4719 // Checks if the enchantment needs to be applied or removed
4720 if (curr_value < Enchant->requiredSkillValue && new_value >= Enchant->requiredSkillValue)
4721 ApplyEnchantment(m_items[i], EnchantmentSlot(slot), true);
4722 else if (new_value < Enchant->requiredSkillValue && curr_value >= Enchant->requiredSkillValue)
4723 ApplyEnchantment(m_items[i], EnchantmentSlot(slot), false);
4724 }
4725
4726 // If we're dealing with a gem inside a prismatic socket we need to check the prismatic socket requirements
4727 // rather than the gem requirements itself. If the socket has no color it is a prismatic socket.
4729 && !m_items[i]->GetTemplate()->Socket[slot - SOCK_ENCHANTMENT_SLOT].Color)
4730 {
4731 SpellItemEnchantmentEntry const* pPrismaticEnchant = sSpellItemEnchantmentStore.LookupEntry(m_items[i]->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT));
4732
4733 if (pPrismaticEnchant && pPrismaticEnchant->requiredSkill == skill_id)
4734 {
4735 if (curr_value < pPrismaticEnchant->requiredSkillValue && new_value >= pPrismaticEnchant->requiredSkillValue)
4736 ApplyEnchantment(m_items[i], EnchantmentSlot(slot), true);
4737 else if (new_value < pPrismaticEnchant->requiredSkillValue && curr_value >= pPrismaticEnchant->requiredSkillValue)
4738 ApplyEnchantment(m_items[i], EnchantmentSlot(slot), false);
4739 }
4740 }
4741 }
4742 }
4743 }
4744}
Definition: Socket.h:39

References ApplyEnchantment(), Item::GetEnchantmentId(), INVENTORY_SLOT_BAG_END, m_items, MAX_ENCHANTMENT_SLOT, PRISMATIC_ENCHANTMENT_SLOT, SpellItemEnchantmentEntry::requiredSkill, SpellItemEnchantmentEntry::requiredSkillValue, SOCK_ENCHANTMENT_SLOT, SOCK_ENCHANTMENT_SLOT_2, SOCK_ENCHANTMENT_SLOT_3, and sSpellItemEnchantmentStore.

Referenced by SetSkill(), UpdateSkill(), and UpdateSkillPro().

◆ UpdateSkillPro()

bool Player::UpdateSkillPro ( uint16  SkillId,
int32  Chance,
uint32  step 
)
875{
876 LOG_DEBUG("entities.player.skills",
877 "UpdateSkillPro(SkillId {}, Chance {:3.1f}%)", SkillId,
878 Chance / 10.0f);
879 if (!SkillId)
880 return false;
881
882 if (Chance <= 0) // speedup in 0 chance case
883 {
884 LOG_DEBUG("entities.player.skills",
885 "Player::UpdateSkillPro Chance={:3.1f}% missed",
886 Chance / 10.0f);
887 return false;
888 }
889
890 SkillStatusMap::iterator itr = mSkillStatus.find(SkillId);
891 if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED)
892 return false;
893
894 uint32 valueIndex = PLAYER_SKILL_VALUE_INDEX(itr->second.pos);
895
896 uint32 data = GetUInt32Value(valueIndex);
897 uint16 SkillValue = SKILL_VALUE(data);
898 uint16 MaxValue = SKILL_MAX(data);
899
900 if (!MaxValue || !SkillValue || SkillValue >= MaxValue)
901 return false;
902
903 int32 Roll = irand(1, 1000);
904
905 if (Roll <= Chance)
906 {
907 uint32 new_value = SkillValue + step;
908 if (new_value > MaxValue)
909 new_value = MaxValue;
910
911 SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(new_value, MaxValue));
912 if (itr->second.uState != SKILL_NEW)
913 itr->second.uState = SKILL_CHANGED;
914
915 for (size_t i = 0; i < bonusSkillLevelsSize; ++i)
916 {
917 uint32 bsl = bonusSkillLevels[i];
918 if (SkillValue < bsl && new_value >= bsl)
919 {
920 learnSkillRewardedSpells(SkillId, new_value);
921 break;
922 }
923 }
924 UpdateSkillEnchantments(SkillId, SkillValue, new_value);
926 SkillId);
927 LOG_DEBUG("entities.player.skills",
928 "Player::UpdateSkillPro Chance={:3.1f}% taken",
929 Chance / 10.0f);
930 return true;
931 }
932
933 LOG_DEBUG("entities.player.skills",
934 "Player::UpdateSkillPro Chance={:3.1f}% missed", Chance / 10.0f);
935 return false;
936}
int32 irand(int32 min, int32 max)
Definition: Random.cpp:37
static const size_t bonusSkillLevelsSize
Definition: PlayerUpdates.cpp:871
static uint32 bonusSkillLevels[]
Definition: PlayerUpdates.cpp:870
Definition: Group.h:143

References ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, bonusSkillLevels, bonusSkillLevelsSize, Object::GetUInt32Value(), irand(), learnSkillRewardedSpells(), LOG_DEBUG, MAKE_SKILL_VALUE, mSkillStatus, PLAYER_SKILL_VALUE_INDEX, Object::SetUInt32Value(), SKILL_CHANGED, SKILL_DELETED, SKILL_MAX, SKILL_NEW, SKILL_VALUE, UpdateAchievementCriteria(), and UpdateSkillEnchantments().

Referenced by UpdateCraftSkill(), UpdateFishingSkill(), and UpdateGatherSkill().

◆ UpdateSkillsForLevel()

void Player::UpdateSkillsForLevel ( )

update only level dependent max skill values

maximize skill always

update max skill value if current max skill not maximized

1039{
1040 uint16 maxconfskill = sWorld->GetConfigMaxSkillValue();
1041 uint32 maxSkill = GetMaxSkillValueForLevel();
1042
1043 bool alwaysMaxSkill =
1045
1046 for (SkillStatusMap::iterator itr = mSkillStatus.begin();
1047 itr != mSkillStatus.end(); ++itr)
1048 {
1049 if (itr->second.uState == SKILL_DELETED)
1050 continue;
1051
1052 uint32 pskill = itr->first;
1053 SkillRaceClassInfoEntry const* rcEntry =
1055 if (!rcEntry)
1056 continue;
1057
1058 if (GetSkillRangeType(rcEntry) != SKILL_RANGE_LEVEL)
1059 continue;
1060
1061 uint32 valueIndex = PLAYER_SKILL_VALUE_INDEX(itr->second.pos);
1062 uint32 data = GetUInt32Value(valueIndex);
1063 uint32 max = SKILL_MAX(data);
1064 uint32 val = SKILL_VALUE(data);
1065
1067 if (max != 1)
1068 {
1070 if (alwaysMaxSkill ||
1072 {
1073 SetUInt32Value(valueIndex,
1074 MAKE_SKILL_VALUE(maxSkill, maxSkill));
1075 if (itr->second.uState != SKILL_NEW)
1076 itr->second.uState = SKILL_CHANGED;
1077 }
1078 else if (max != maxconfskill)
1080 {
1081 SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(val, maxSkill));
1082 if (itr->second.uState != SKILL_NEW)
1083 itr->second.uState = SKILL_CHANGED;
1084 }
1085 }
1086 }
1087}
@ CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL
Definition: IWorld.h:100

References CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL, SkillRaceClassInfoEntry::Flags, Unit::getClass(), GetMaxSkillValueForLevel(), Unit::getRace(), GetSkillRaceClassInfo(), GetSkillRangeType(), Object::GetUInt32Value(), MAKE_SKILL_VALUE, mSkillStatus, PLAYER_SKILL_VALUE_INDEX, Object::SetUInt32Value(), SKILL_CHANGED, SKILL_DELETED, SKILL_FLAG_ALWAYS_MAX_VALUE, SKILL_MAX, SKILL_NEW, SKILL_RANGE_LEVEL, SKILL_VALUE, and sWorld.

Referenced by GiveLevel(), InitStatsForLevel(), and LoadFromDB().

◆ UpdateSkillsToMaxSkillsForLevel()

void Player::UpdateSkillsToMaxSkillsForLevel ( )
1090{
1091 for (SkillStatusMap::iterator itr = mSkillStatus.begin();
1092 itr != mSkillStatus.end(); ++itr)
1093 {
1094 if (itr->second.uState == SKILL_DELETED)
1095 continue;
1096
1097 uint32 pskill = itr->first;
1098 if (IsProfessionOrRidingSkill(pskill))
1099 continue;
1100 uint32 valueIndex = PLAYER_SKILL_VALUE_INDEX(itr->second.pos);
1101 uint32 data = GetUInt32Value(valueIndex);
1102 uint32 max = SKILL_MAX(data);
1103
1104 if (max > 1)
1105 {
1106 SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(max, max));
1107 if (itr->second.uState != SKILL_NEW)
1108 itr->second.uState = SKILL_CHANGED;
1109 }
1110 if (pskill == SKILL_DEFENSE)
1112 }
1113}

References Object::GetUInt32Value(), IsProfessionOrRidingSkill(), MAKE_SKILL_VALUE, mSkillStatus, PLAYER_SKILL_VALUE_INDEX, Object::SetUInt32Value(), SKILL_CHANGED, SKILL_DEFENSE, SKILL_DELETED, SKILL_MAX, SKILL_NEW, and UpdateDefenseBonusesMod().

Referenced by GiveLevel(), and misc_commandscript::HandleMaxSkillCommand().

◆ UpdateSoulboundTradeItems()

void Player::UpdateSoulboundTradeItems ( )
4131{
4132 std::lock_guard<std::mutex> guard(m_soulboundTradableLock);
4133 if (m_itemSoulboundTradeable.empty())
4134 return;
4135
4136 // also checks for garbage data
4137 for (ItemDurationList::iterator itr = m_itemSoulboundTradeable.begin(); itr != m_itemSoulboundTradeable.end();)
4138 {
4139 ASSERT(*itr);
4140 if ((*itr)->GetOwnerGUID() != GetGUID())
4141 {
4142 m_itemSoulboundTradeable.erase(itr++);
4143 continue;
4144 }
4145 if ((*itr)->CheckSoulboundTradeExpire())
4146 {
4147 m_itemSoulboundTradeable.erase(itr++);
4148 continue;
4149 }
4150 ++itr;
4151 }
4152}

References ASSERT, Object::GetGUID(), m_itemSoulboundTradeable, and m_soulboundTradableLock.

Referenced by Update().

◆ UpdateSpeakTime()

void Player::UpdateSpeakTime ( ChatFloodThrottle::Index  index)
30{
31 // ignore chat spam protection for GMs in any mode
33 return;
34
35 uint32 limit, delay;
36 switch (index)
37 {
39 limit = sWorld->getIntConfig(CONFIG_CHATFLOOD_ADDON_MESSAGE_COUNT);
40 delay = sWorld->getIntConfig(CONFIG_CHATFLOOD_ADDON_MESSAGE_DELAY);
41 break;
43 limit = sWorld->getIntConfig(CONFIG_CHATFLOOD_MESSAGE_COUNT);
44 delay = sWorld->getIntConfig(CONFIG_CHATFLOOD_MESSAGE_DELAY);
45 [[fallthrough]];
46 default:
47 return;
48 }
49 time_t current = GameTime::GetGameTime().count();
50 if (m_chatFloodData[index].Time > current)
51 {
52 ++m_chatFloodData[index].Count;
53 if (m_chatFloodData[index].Count >= limit)
54 {
55 // prevent overwrite mute time, if message send just before mutes set, for example.
56 time_t new_mute = current + sWorld->getIntConfig(CONFIG_CHATFLOOD_MUTE_TIME);
57 if (GetSession()->m_muteTime < new_mute)
58 GetSession()->m_muteTime = new_mute;
59
60 m_chatFloodData[index].Count = 0;
61 }
62 }
63 else
64 m_chatFloodData[index].Count = 1;
65
66 m_chatFloodData[index].Time = current + delay;
67}
@ CONFIG_CHATFLOOD_MUTE_TIME
Definition: IWorld.h:281
@ CONFIG_CHATFLOOD_ADDON_MESSAGE_COUNT
Definition: IWorld.h:279
@ CONFIG_CHATFLOOD_MESSAGE_DELAY
Definition: IWorld.h:278
@ CONFIG_CHATFLOOD_MESSAGE_COUNT
Definition: IWorld.h:277
@ CONFIG_CHATFLOOD_ADDON_MESSAGE_DELAY
Definition: IWorld.h:280
std::array< ChatFloodThrottle, ChatFloodThrottle::MAX > m_chatFloodData
Definition: Player.h:2732
@ ADDON
Definition: Player.h:2280
@ REGULAR
Definition: Player.h:2279

References Player::ChatFloodThrottle::ADDON, CONFIG_CHATFLOOD_ADDON_MESSAGE_COUNT, CONFIG_CHATFLOOD_ADDON_MESSAGE_DELAY, CONFIG_CHATFLOOD_MESSAGE_COUNT, CONFIG_CHATFLOOD_MESSAGE_DELAY, CONFIG_CHATFLOOD_MUTE_TIME, GameTime::GetGameTime(), GetSession(), AccountMgr::IsPlayerAccount(), m_chatFloodData, WorldSession::m_muteTime, Player::ChatFloodThrottle::REGULAR, and sWorld.

Referenced by WorldSession::HandleMessagechatOpcode(), and WorldSession::HandleTextEmoteOpcode().

◆ UpdateSpecCount()

void Player::UpdateSpecCount ( uint8  count)
2149{
2150 uint32 curCount = GetSpecsCount();
2151 if (curCount == count)
2152 return;
2153
2154 if (m_activeSpec >= count)
2155 ActivateSpec(0);
2156
2157 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
2158 CharacterDatabasePreparedStatement* stmt = nullptr;
2159
2160 // Copy spec data
2161 if (count > curCount)
2162 {
2163 _SaveActions(trans); // make sure the button list is cleaned up
2164 for (ActionButtonList::iterator itr = m_actionButtons.begin();
2165 itr != m_actionButtons.end(); ++itr)
2166 {
2167 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACTION);
2168 stmt->SetData(0, GetGUID().GetCounter());
2169 stmt->SetData(1, 1);
2170 stmt->SetData(2, itr->first);
2171 stmt->SetData(3, itr->second.GetAction());
2172 stmt->SetData(4, uint8(itr->second.GetType()));
2173 trans->Append(stmt);
2174 }
2175 }
2176 // Delete spec data for removed spec.
2177 else if (count < curCount)
2178 {
2179 _SaveActions(trans);
2180
2181 stmt = CharacterDatabase.GetPreparedStatement(
2183 stmt->SetData(0, m_activeSpec);
2184 stmt->SetData(1, GetGUID().GetCounter());
2185 trans->Append(stmt);
2186
2187 m_activeSpec = 0;
2188 }
2189
2190 CharacterDatabase.CommitTransaction(trans);
2191
2192 SetSpecsCount(count);
2193
2194 SendTalentsInfoData(false);
2195}
@ CHAR_DEL_CHAR_ACTION_EXCEPT_SPEC
Definition: CharacterDatabase.h:454
void ActivateSpec(uint8 spec)
Definition: Player.cpp:14988
void SetSpecsCount(uint8 count)
Definition: Player.h:1711

References _SaveActions(), ActivateSpec(), CHAR_DEL_CHAR_ACTION_EXCEPT_SPEC, CHAR_INS_CHAR_ACTION, CharacterDatabase, Object::GetGUID(), GetSpecsCount(), m_actionButtons, m_activeSpec, SendTalentsInfoData(), PreparedStatementBase::SetData(), and SetSpecsCount().

◆ UpdateSpellCritChance()

void Player::UpdateSpellCritChance ( uint32  school)
830{
831 // For normal school set zero crit chance
832 if (school == SPELL_SCHOOL_NORMAL)
833 {
835 return;
836 }
837 // For others recalculate it from:
838 float crit = 0.0f;
839 // Crit from Intellect
841 // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
843 // Increase crit from SPELL_AURA_MOD_CRIT_PCT
845 // Increase crit by school from SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
847 // Increase crit from spell crit ratings
849
850 // Store crit value
852}
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
Definition: SpellAuraDefines.h:134
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE
Definition: SpellAuraDefines.h:120
@ SPELL_AURA_MOD_CRIT_PCT
Definition: SpellAuraDefines.h:353
float GetSpellCritFromIntellect()
Definition: Player.cpp:5080
int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition: Unit.cpp:5899
int32 GetTotalAuraModifierAreaExclusive(AuraType auratype) const
Definition: Unit.cpp:5828

References CR_CRIT_SPELL, GetRatingBonusValue(), GetSpellCritFromIntellect(), Unit::GetTotalAuraModifier(), Unit::GetTotalAuraModifierAreaExclusive(), Unit::GetTotalAuraModifierByMiscMask(), PLAYER_SPELL_CRIT_PERCENTAGE1, Object::SetFloatValue(), SPELL_AURA_MOD_CRIT_PCT, SPELL_AURA_MOD_SPELL_CRIT_CHANCE, SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, and SPELL_SCHOOL_NORMAL.

Referenced by AuraEffect::HandleModSpellCritChanceShool(), and UpdateAllSpellCritChances().

◆ UpdateSpellDamageAndHealingBonus()

void Player::UpdateSpellDamageAndHealingBonus ( )
178{
179 // Magic damage modifiers implemented in Unit::SpellDamageBonusDone
180 // This information for client side use only
181 // Get healing bonus for all schools
183 // Get damage bonus for all schools
184 for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
186}
void SetStatInt32Value(uint16 index, int32 value)
Definition: Object.cpp:798
int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask)
Definition: Unit.cpp:12696
int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
Definition: Unit.cpp:11931

References MAX_SPELL_SCHOOL, PLAYER_FIELD_MOD_DAMAGE_DONE_POS, PLAYER_FIELD_MOD_HEALING_DONE_POS, Object::SetStatInt32Value(), SPELL_SCHOOL_HOLY, SPELL_SCHOOL_MASK_ALL, Unit::SpellBaseDamageBonusDone(), and Unit::SpellBaseHealingBonusDone().

Referenced by AuraEffect::HandleModHealingDone(), AuraEffect::HandleModSpellDamagePercentFromAttackPower(), AuraEffect::HandleModSpellDamagePercentFromStat(), AuraEffect::HandleModSpellHealingPercentFromAttackPower(), AuraEffect::HandleModSpellHealingPercentFromStat(), UpdateAllStats(), UpdateAttackPowerAndDamage(), and UpdateStats().

◆ UpdateSpellHitChances()

void Player::UpdateSpellHitChances ( )

◆ UpdateStats()

bool Player::UpdateStats ( Stats  stat)
overridevirtual

Implements Unit.

98{
99 if (stat > STAT_SPIRIT)
100 return false;
101
102 // value = ((base_value * base_pct) + total_value) * total_pct
103 float value = GetTotalStatValue(stat);
104
105 SetStat(stat, int32(value));
106
107 switch (stat)
108 {
109 case STAT_STRENGTH:
111 break;
112 case STAT_AGILITY:
113 UpdateArmor();
116 break;
117 case STAT_STAMINA:
119 break;
120 case STAT_INTELLECT:
123 UpdateArmor(); //SPELL_AURA_MOD_RESISTANCE_OF_INTELLECT_PERCENT, only armor currently
124 break;
125 default:
126 break;
127 }
128
129 if (stat == STAT_STRENGTH)
130 {
134 }
135 else if (stat == STAT_AGILITY)
136 {
139 }
140 else
141 {
142 // Need update (exist AP from stat auras)
147 }
148
151
152 // Update ratings in exist SPELL_AURA_MOD_RATING_FROM_STAT and only depends from stat
153 uint32 mask = 0;
155 for (AuraEffectList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i)
156 if (Stats((*i)->GetMiscValueB()) == stat)
157 mask |= (*i)->GetMiscValue();
158 if (mask)
159 {
160 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
161 if (mask & (1 << rating))
162 ApplyRatingMod(CombatRating(rating), 0, true);
163 }
164 return true;
165}

References ApplyRatingMod(), Unit::GetAuraEffectsByType(), Unit::GetTotalStatValue(), Unit::HasAuraTypeWithMiscvalue(), MAX_COMBAT_RATING, POWER_MANA, Unit::SetStat(), SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT, SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT, SPELL_AURA_MOD_RATING_FROM_STAT, STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STAMINA, STAT_STRENGTH, UpdateAllCritPercentages(), UpdateAllSpellCritChances(), UpdateArmor(), UpdateAttackPowerAndDamage(), UpdateDodgePercentage(), UpdateManaRegen(), UpdateMaxHealth(), UpdateMaxPower(), UpdateShieldBlockValue(), and UpdateSpellDamageAndHealingBonus().

◆ UpdateTitansGrip()

void Player::UpdateTitansGrip ( )

◆ UpdateTriggerVisibility()

void Player::UpdateTriggerVisibility ( )
1701{
1702 if (m_clientGUIDs.empty())
1703 return;
1704
1705 if (!IsInWorld())
1706 return;
1707
1708 UpdateData udata;
1709 WorldPacket packet;
1710 for (GuidUnorderedSet::iterator itr = m_clientGUIDs.begin();
1711 itr != m_clientGUIDs.end(); ++itr)
1712 {
1713 if ((*itr).IsCreatureOrVehicle())
1714 {
1715 Creature* creature = GetMap()->GetCreature(*itr);
1716 // Update fields of triggers, transformed units or unselectable
1717 // units (values dependent on GM state)
1718 if (!creature || (!creature->IsTrigger() &&
1719 !creature->HasAuraType(SPELL_AURA_TRANSFORM) &&
1721 continue;
1722
1724 creature->BuildValuesUpdateBlockForPlayer(&udata, this);
1726 }
1727 else if ((*itr).IsGameObject())
1728 {
1729 GameObject* go = GetMap()->GetGameObject(*itr);
1730 if (!go)
1731 continue;
1732
1734 go->BuildValuesUpdateBlockForPlayer(&udata, this);
1736 }
1737 }
1738
1739 if (!udata.HasData())
1740 return;
1741
1742 udata.BuildPacket(&packet);
1743 GetSession()->SendPacket(&packet);
1744}
@ UF_FLAG_PUBLIC
Definition: UpdateFieldFlags.h:27
bool IsTrigger() const
Definition: Creature.h:77
void RemoveFieldNotifyFlag(uint16 flag)
Definition: Object.h:189
void SetFieldNotifyFlag(uint16 flag)
Definition: Object.h:188
bool HasData() const
Definition: UpdateData.h:60

References UpdateData::BuildPacket(), Object::BuildValuesUpdateBlockForPlayer(), Map::GetCreature(), Map::GetGameObject(), WorldObject::GetMap(), GetSession(), Unit::HasAuraType(), UpdateData::HasData(), Unit::HasUnitFlag(), Object::IsInWorld(), Creature::IsTrigger(), m_clientGUIDs, Object::RemoveFieldNotifyFlag(), WorldSession::SendPacket(), Object::SetFieldNotifyFlag(), SPELL_AURA_TRANSFORM, UF_FLAG_PUBLIC, and UNIT_FLAG_NOT_SELECTABLE.

Referenced by gm_commandscript::HandleGMOffCommand(), and gm_commandscript::HandleGMOnCommand().

◆ UpdateVisibilityForPlayer()

void Player::UpdateVisibilityForPlayer ( bool  mapChange = false)
1547{
1548 // After added to map seer must be a player - there is no possibility to
1549 // still have different seer (all charm auras must be already removed)
1550 if (mapChange && m_seer != this)
1551 {
1552 m_seer = this;
1553 }
1554
1555 Acore::VisibleNotifier notifierNoLarge(
1556 *this, mapChange,
1557 false); // visit only objects which are not large; default distance
1558 Cell::VisitAllObjects(m_seer, notifierNoLarge,
1560 notifierNoLarge.SendToSelf();
1561
1562 Acore::VisibleNotifier notifierLarge(
1563 *this, mapChange, true); // visit only large objects; maximum distance
1564 Cell::VisitAllObjects(m_seer, notifierLarge, GetSightRange());
1565 notifierLarge.SendToSelf();
1566
1567 if (mapChange)
1568 m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
1569}
#define VISIBILITY_INC_FOR_GOBJECTS
Definition: ObjectDefines.h:28
float GetSightRange(WorldObject const *target=nullptr) const override
Definition: Player.cpp:16203
Position m_last_notify_position
Definition: Unit.h:2423
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:207
Definition: GridNotifiers.h:42

References GetSightRange(), Unit::m_last_notify_position, m_seer, Position::Relocate(), Acore::VisibleNotifier::SendToSelf(), VISIBILITY_INC_FOR_GOBJECTS, and Cell::VisitAllObjects().

Referenced by WorldSession::HandleFarSightOpcode(), SendInitialPacketsAfterAddToMap(), and UpdateObjectVisibility().

◆ UpdateVisibilityOf() [1/2]

template<class T >
void Player::UpdateVisibilityOf ( T *  target,
UpdateData data,
std::vector< Unit * > &  visibleNow 
)
1639{
1640 if (HaveAtClient(target))
1641 {
1642 if (!CanSeeOrDetect(target, false, true))
1643 {
1644 BeforeVisibilityDestroy<T>(target, this);
1645
1646 target->BuildOutOfRangeUpdateBlock(&data);
1647 m_clientGUIDs.erase(target->GetGUID());
1648 }
1649 }
1650 else
1651 {
1652 if (CanSeeOrDetect(target, false, true))
1653 {
1654 target->BuildCreateUpdateBlockForPlayer(&data, this);
1655 UpdateVisibilityOf_helper(m_clientGUIDs, target, visibleNow);
1656 }
1657 }
1658}
void UpdateVisibilityOf_helper(GuidUnorderedSet &s64, T *target, std::vector< Unit * > &)
Definition: PlayerUpdates.cpp:1592
bool CanSeeOrDetect(WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
Definition: Object.cpp:1726
bool HaveAtClient(WorldObject const *u) const
Definition: Player.cpp:11327

References WorldObject::CanSeeOrDetect(), HaveAtClient(), m_clientGUIDs, and UpdateVisibilityOf_helper().

◆ UpdateVisibilityOf() [2/2]

void Player::UpdateVisibilityOf ( WorldObject target)
1672{
1673 if (HaveAtClient(target))
1674 {
1675 if (!CanSeeOrDetect(target, false, true))
1676 {
1677 if (target->GetTypeId() == TYPEID_UNIT)
1679
1680 target->DestroyForPlayer(this);
1681 m_clientGUIDs.erase(target->GetGUID());
1682 }
1683 }
1684 else
1685 {
1686 if (CanSeeOrDetect(target, false, true))
1687 {
1688 target->SendUpdateToPlayer(this);
1689 m_clientGUIDs.insert(target->GetGUID());
1690
1691 // target aura duration for caster show only if target exist at
1692 // caster client send data at target visibility change (adding to
1693 // client)
1694 if (target->isType(TYPEMASK_UNIT))
1695 GetInitialVisiblePackets((Unit*) target);
1696 }
1697 }
1698}
void BeforeVisibilityDestroy< Creature >(Creature *t, Player *p)
Definition: PlayerUpdates.cpp:1630
void GetInitialVisiblePackets(Unit *target)
Definition: PlayerUpdates.cpp:1660

References BeforeVisibilityDestroy< Creature >(), WorldObject::CanSeeOrDetect(), Object::DestroyForPlayer(), Object::GetGUID(), GetInitialVisiblePackets(), Object::GetTypeId(), HaveAtClient(), Object::isType(), m_clientGUIDs, Object::SendUpdateToPlayer(), Object::ToCreature(), TYPEID_UNIT, and TYPEMASK_UNIT.

Referenced by instance_ulduar::instance_ulduar_InstanceMapScript::OnPlayerEnter(), Acore::VisibleNotifier::SendToSelf(), SetViewpoint(), Acore::VisibleNotifier::Visit(), Acore::PlayerRelocationNotifier::Visit(), and Acore::CreatureRelocationNotifier::Visit().

◆ UpdateWeaponSkill()

void Player::UpdateWeaponSkill ( Unit victim,
WeaponAttackType  attType,
Item item = nullptr 
)
939{
940 if (IsInFeralForm())
941 return; // always maximized SKILL_FERAL_COMBAT in fact
942
944 return; // use weapon but not skill up
945
946 if (victim->GetTypeId() == TYPEID_UNIT &&
949 return;
950
951 uint32 weapon_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_WEAPON);
952
953 Item* tmpitem = GetWeaponForAttack(attType, true);
954 if (item && item != tmpitem && !item->IsBroken())
955 {
956 tmpitem = item;
957 }
958
959 if (!tmpitem && attType == BASE_ATTACK)
960 {
961 // Keep unarmed & fist weapon skills in sync
962 UpdateSkill(SKILL_UNARMED, weapon_skill_gain);
963 UpdateSkill(SKILL_FIST_WEAPONS, weapon_skill_gain);
964 }
965 else if (tmpitem && tmpitem->GetTemplate()->SubClass !=
967 {
968 switch (tmpitem->GetTemplate()->SubClass)
969 {
971 break;
973 UpdateSkill(SKILL_UNARMED, weapon_skill_gain);
974 [[fallthrough]];
975 default:
976 UpdateSkill(tmpitem->GetSkill(), weapon_skill_gain);
977 break;
978 }
979 }
980
982}
@ CREATURE_FLAG_EXTRA_NO_SKILL_GAINS
Definition: CreatureData.h:67
@ ITEM_SUBCLASS_WEAPON_FIST
Definition: ItemTemplate.h:366
@ FORM_TREE
Definition: Unit.h:92
@ CONFIG_SKILL_GAIN_WEAPON
Definition: IWorld.h:274

References BASE_ATTACK, CONFIG_SKILL_GAIN_WEAPON, CREATURE_FLAG_EXTRA_NO_SKILL_GAINS, CreatureTemplate::flags_extra, FORM_TREE, Creature::GetCreatureTemplate(), Unit::GetShapeshiftForm(), Item::GetSkill(), Item::GetTemplate(), Object::GetTypeId(), GetWeaponForAttack(), Item::IsBroken(), Unit::IsInFeralForm(), ITEM_SUBCLASS_WEAPON_FISHING_POLE, ITEM_SUBCLASS_WEAPON_FIST, SKILL_FIST_WEAPONS, SKILL_UNARMED, ItemTemplate::SubClass, sWorld, Object::ToCreature(), TYPEID_UNIT, UpdateAllCritPercentages(), and UpdateSkill().

Referenced by UpdateCombatSkills().

◆ UpdateZone()

void Player::UpdateZone ( uint32  newZone,
uint32  newArea 
)
1212{
1213 if (!newZone)
1214 {
1215 return;
1216 }
1217
1218 if (m_zoneUpdateId != newZone)
1219 {
1220 sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
1221 sOutdoorPvPMgr->HandlePlayerEnterZone(this, newZone);
1222 sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
1223 sBattlefieldMgr->HandlePlayerEnterZone(this, newZone);
1224 SendInitWorldStates(newZone,
1225 newArea); // only if really enters to new zone, not
1226 // just area change, works strange...
1227 if (Guild* guild = GetGuild())
1228 guild->UpdateMemberData(this, GUILD_MEMBER_DATA_ZONEID, newZone);
1229 }
1230
1231 // group update
1232 if (GetGroup())
1234
1235 m_zoneUpdateId = newZone;
1237
1238 // zone changed, so area changed as well, update it
1239 UpdateArea(newArea);
1240
1241 AreaTableEntry const* zone = sAreaTableStore.LookupEntry(newZone);
1242 if (!zone)
1243 return;
1244
1245 if (sWorld->getBoolConfig(CONFIG_WEATHER))
1246 {
1247 if (Weather* weather = WeatherMgr::FindWeather(zone->ID))
1248 weather->SendWeatherUpdateToPlayer(this);
1249 else if (!WeatherMgr::AddWeather(zone->ID))
1250 // send fine weather packet to remove old zone's weather
1252 }
1253
1254 sScriptMgr->OnPlayerUpdateZone(this, newZone, newArea);
1255
1256 // in PvP, any not controlled zone (except zone->team == 6, default case)
1257 // in PvE, only opposition team capital
1258 switch (zone->team)
1259 {
1260 case AREATEAM_ALLY:
1262 GetTeamId(true) != TEAM_ALLIANCE &&
1263 (sWorld->IsPvPRealm() || zone->flags & AREA_FLAG_CAPITAL);
1264 break;
1265 case AREATEAM_HORDE:
1267 GetTeamId(true) != TEAM_HORDE &&
1268 (sWorld->IsPvPRealm() || zone->flags & AREA_FLAG_CAPITAL);
1269 break;
1270 case AREATEAM_NONE:
1271 // overwrite for battlegrounds, maybe batter some zone flags but current
1272 // known not 100% fit to this
1273 pvpInfo.IsInHostileArea = sWorld->IsPvPRealm() || InBattleground() ||
1275 break;
1276 default: // 6 in fact
1277 pvpInfo.IsInHostileArea = false;
1278 break;
1279 }
1280
1281 // Treat players having a quest flagging for PvP as always in hostile area
1283
1284 if (zone->flags & AREA_FLAG_CAPITAL) // Is in a capital city
1285 {
1286 if (!pvpInfo.IsHostile || zone->IsSanctuary())
1288
1289 pvpInfo.IsInNoPvPArea = true;
1290 }
1291 else
1292 RemoveRestFlag(REST_FLAG_IN_CITY); // Recently left a capital city
1293
1295
1296 // remove items with area/map limitations (delete only for alive player to
1297 // allow back in ghost mode) if player resurrected at teleport this will be
1298 // applied in resurrect code
1299 if (IsAlive())
1300 DestroyZoneLimitedItem(true, newZone);
1301
1302 // check some item equip limitations (in result lost CanTitanGrip at talent
1303 // reset, for example)
1305
1306 // recent client version not send leave/join channel packets for built-in
1307 // local channels
1308 UpdateLocalChannels(newZone);
1309
1310 UpdateZoneDependentAuras(newZone);
1311}
@ REST_FLAG_IN_CITY
Definition: Player.h:808
@ GROUP_UPDATE_FULL
Definition: Group.h:121
@ GUILD_MEMBER_DATA_ZONEID
Definition: Guild.h:61
@ CONFIG_WEATHER
Definition: IWorld.h:99
@ AREATEAM_HORDE
Definition: DBCEnums.h:66
@ AREATEAM_NONE
Definition: DBCEnums.h:64
@ AREATEAM_ALLY
Definition: DBCEnums.h:65
@ AREA_FLAG_CAPITAL
Definition: DBCEnums.h:250
@ AREA_FLAG_WINTERGRASP
Definition: DBCEnums.h:266
Weather * AddWeather(uint32 zone_id)
Add a Weather object to the list.
Definition: WeatherMgr.cpp:67
void SendFineWeatherUpdateToPlayer(Player *player)
Definition: WeatherMgr.cpp:145
Weather * FindWeather(uint32 id)
Find a Weather object by the given zoneid.
Definition: WeatherMgr.cpp:50
void UpdateLocalChannels(uint32 newZone)
Definition: PlayerUpdates.cpp:466
void SendInitWorldStates(uint32 zone, uint32 area)
Definition: Player.cpp:8099
void DestroyZoneLimitedItem(bool update, uint32 new_zone)
Definition: PlayerStorage.cpp:3334
Weather for one zone.
Definition: Weather.h:65
uint32 ID
Definition: DBCStructure.h:520
uint32 team
Definition: DBCStructure.h:529

References WeatherMgr::AddWeather(), AREA_FLAG_CAPITAL, AREA_FLAG_WINTERGRASP, AREATEAM_ALLY, AREATEAM_HORDE, AREATEAM_NONE, AutoUnequipOffhandIfNeed(), CONFIG_WEATHER, DestroyZoneLimitedItem(), WeatherMgr::FindWeather(), AreaTableEntry::flags, GetGroup(), GetGuild(), GetTeamId(), GROUP_UPDATE_FULL, GUILD_MEMBER_DATA_ZONEID, HasPvPForcingQuest(), AreaTableEntry::ID, InBattleground(), Unit::IsAlive(), PvPInfo::IsHostile, PvPInfo::IsInHostileArea, PvPInfo::IsInNoPvPArea, AreaTableEntry::IsSanctuary(), m_zoneUpdateId, m_zoneUpdateTimer, pvpInfo, RemoveRestFlag(), REST_FLAG_IN_CITY, sAreaTableStore, sBattlefieldMgr, WeatherMgr::SendFineWeatherUpdateToPlayer(), SendInitWorldStates(), SetGroupUpdateFlag(), SetRestFlag(), sOutdoorPvPMgr, sScriptMgr, sWorld, AreaTableEntry::team, TEAM_ALLIANCE, TEAM_HORDE, UpdateArea(), UpdateLocalChannels(), UpdatePvPState(), UpdateZoneDependentAuras(), and ZONE_UPDATE_INTERVAL.

Referenced by WorldSession::HandleMoveTeleportAck(), WorldSession::HandleMoveWorldportAck(), ResurrectPlayer(), SendInitialPacketsAfterAddToMap(), Update(), and UpdatePosition().

◆ UpdateZoneDependentAuras()

void Player::UpdateZoneDependentAuras ( uint32  zone_id)
1808{
1809 // Some spells applied at enter into zone (with subzones), aura removed in
1810 // UpdateAreaDependentAuras that called always at zone->area update
1811 SpellAreaForAreaMapBounds saBounds =
1812 sSpellMgr->GetSpellAreaForAreaMapBounds(newZone);
1813 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first;
1814 itr != saBounds.second; ++itr)
1815 if (itr->second->autocast &&
1816 itr->second->IsFitToRequirements(this, newZone, 0))
1817 if (!HasAura(itr->second->spellId))
1818 CastSpell(this, itr->second->spellId, true);
1819}

References Unit::CastSpell(), Unit::HasAura(), and sSpellMgr.

Referenced by AddQuest(), CompleteQuest(), WorldSession::HandlePlayerLoginFromDB(), IncompleteQuest(), RemoveActiveQuest(), RewardQuest(), and UpdateZone().

◆ VehicleSpellInitialize()

void Player::VehicleSpellInitialize ( )
9488{
9489 Creature* vehicle = GetVehicleCreatureBase();
9490 if (!vehicle)
9491 return;
9492
9493 uint8 cooldownCount = vehicle->m_CreatureSpellCooldowns.size();
9494
9495 WorldPacket data(SMSG_PET_SPELLS, 8 + 2 + 4 + 4 + 4 * 10 + 1 + 1 + cooldownCount * (4 + 2 + 4 + 4));
9496 data << vehicle->GetGUID(); // Guid
9497 data << uint16(0); // Pet Family (0 for all vehicles)
9498 data << uint32(vehicle->IsSummon() ? vehicle->ToTempSummon()->GetTimer() : 0); // Duration
9499 // The following three segments are read by the client as one uint32
9500 data << uint8(vehicle->GetReactState()); // React State
9501 data << uint8(0); // Command State
9502 data << uint16(0x800); // DisableActions (set for all vehicles)
9503
9504 for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
9505 {
9506 uint32 spellId = vehicle->m_spells[i];
9507 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
9508 if (!spellInfo)
9509 {
9510 data << uint16(0) << uint8(0) << uint8(i + 8);
9511 continue;
9512 }
9513
9514 ConditionList conditions = sConditionMgr->GetConditionsForVehicleSpell(vehicle->GetEntry(), spellId);
9515 if (!sConditionMgr->IsObjectMeetToConditions(this, vehicle, conditions))
9516 {
9517 LOG_DEBUG("condition", "VehicleSpellInitialize: conditions not met for Vehicle entry {} spell {}", vehicle->ToCreature()->GetEntry(), spellId);
9518 data << uint16(0) << uint8(0) << uint8(i + 8);
9519 continue;
9520 }
9521
9522 if (spellInfo->IsPassive())
9523 vehicle->CastSpell(vehicle, spellId, true);
9524
9525 data << uint32(MAKE_UNIT_ACTION_BUTTON(spellId, i + 8));
9526 }
9527
9529 data << uint32(0);
9530
9531 data << uint8(0); // Auras?
9532
9533 // Cooldowns
9534 data << uint8(cooldownCount);
9535
9536 uint32 curTime = GameTime::GetGameTimeMS().count();
9538
9539 for (CreatureSpellCooldowns::const_iterator itr = vehicle->m_CreatureSpellCooldowns.begin(); itr != vehicle->m_CreatureSpellCooldowns.end(); ++itr)
9540 {
9541 uint16 category = itr->second.category;
9542 uint32 cooldown = (itr->second.end > curTime) ? itr->second.end - curTime : 0;
9543
9544 data << uint32(itr->first); // spellid
9545 data << uint16(itr->second.category); // spell category
9546
9547 // send infinity cooldown in special format
9548 if (itr->second.end >= infTime)
9549 {
9550 data << uint32(1); // cooldown
9551 data << uint32(0x80000000); // category cooldown
9552 continue;
9553 }
9554
9555 data << uint32(category ? 0 : cooldown); // cooldown
9556 data << uint32(category ? cooldown : 0); // category cooldown
9557 }
9558
9559 GetSession()->SendPacket(&data);
9560}
static constexpr uint32 MAX_CREATURE_SPELLS
Definition: Unit.h:153
#define MAX_SPELL_CONTROL_BAR
Definition: Unit.h:160
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition: Creature.h:244
uint32 GetTimer()
Definition: TemporarySummon.h:57
Creature * GetVehicleCreatureBase() const
Definition: Unit.cpp:19011
TempSummon * ToTempSummon()
Definition: Unit.h:2414
bool IsSummon() const
Definition: Unit.h:1422

References Unit::CastSpell(), Object::GetEntry(), GameTime::GetGameTimeMS(), Object::GetGUID(), Creature::GetReactState(), GetSession(), TempSummon::GetTimer(), Unit::GetVehicleCreatureBase(), infinityCooldownDelayCheck, SpellInfo::IsPassive(), Unit::IsSummon(), LOG_DEBUG, Creature::m_CreatureSpellCooldowns, Creature::m_spells, MAKE_UNIT_ACTION_BUTTON, MAX_CREATURE_SPELLS, MAX_SPELL_CONTROL_BAR, sConditionMgr, WorldSession::SendPacket(), SMSG_PET_SPELLS, sSpellMgr, Object::ToCreature(), and Unit::ToTempSummon().

Referenced by Unit::SetCharmedBy().

◆ VisualizeItem()

void Player::VisualizeItem ( uint8  slot,
Item pItem 
)
2898{
2899 if (!pItem)
2900 return;
2901
2902 // check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory)
2904 pItem->SetBinding(true);
2905
2906 LOG_DEBUG("entities.player.items", "STORAGE: EquipItem slot = {}, item = {}", slot, pItem->GetEntry());
2907
2908 m_items[slot] = pItem;
2909 SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID());
2912 pItem->SetSlot(slot);
2913 pItem->SetContainer(nullptr);
2914
2915 if (slot < EQUIPMENT_SLOT_END)
2916 SetVisibleItemSlot(slot, pItem);
2917
2918 pItem->SetState(ITEM_CHANGED, this);
2919}

References BIND_QUEST_ITEM, BIND_WHEN_EQUIPED, BIND_WHEN_PICKED_UP, ItemTemplate::Bonding, EQUIPMENT_SLOT_END, Object::GetEntry(), Object::GetGUID(), Item::GetTemplate(), ITEM_CHANGED, ITEM_FIELD_CONTAINED, ITEM_FIELD_OWNER, LOG_DEBUG, m_items, PLAYER_FIELD_INV_SLOT_HEAD, Item::SetBinding(), Item::SetContainer(), Object::SetGuidValue(), Item::SetSlot(), Item::SetState(), and SetVisibleItemSlot().

Referenced by EquipItem(), and QuickEquipItem().

◆ Whisper() [1/2]

void Player::Whisper ( std::string_view  text,
Language  language,
Player receiver,
bool  = false 
)
overridevirtual

Handles whispers from Addons and players based on sender, receiver's guid and language.

Reimplemented from Unit.

9322{
9323 ASSERT(target);
9324
9325 bool isAddonMessage = language == LANG_ADDON;
9326
9327 if (!isAddonMessage) // if not addon data
9328 language = LANG_UNIVERSAL; // whispers should always be readable
9329
9330 std::string _text(text);
9331
9332 if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_WHISPER, language, _text, target))
9333 {
9334 return;
9335 }
9336
9337 sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, target);
9338
9339 WorldPacket data;
9340 ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, language, this, this, _text);
9341 target->GetSession()->SendPacket(&data);
9342
9343 // rest stuff shouldn't happen in case of addon message
9344 if (isAddonMessage)
9345 return;
9346
9347 ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER_INFORM, Language(language), target, target, _text);
9348 GetSession()->SendPacket(&data);
9349
9350 if (!isAcceptWhispers() && !IsGameMaster() && !target->IsGameMaster())
9351 {
9352 SetAcceptWhispers(true);
9354 }
9355
9356 // announce afk or dnd message
9357 if (target->isAFK())
9358 {
9359 ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_AFK, target->GetName().c_str(), target->autoReplyMsg.c_str());
9360 }
9361 else if (target->isDND())
9362 {
9363 ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_DND, target->GetName().c_str(), target->autoReplyMsg.c_str());
9364 }
9365}
@ LANG_PLAYER_DND
Definition: Language.h:655
@ LANG_PLAYER_AFK
Definition: Language.h:656
@ LANG_COMMAND_WHISPERON
Definition: Language.h:330
@ CHAT_MSG_WHISPER_INFORM
Definition: SharedDefines.h:3161
@ CHAT_MSG_WHISPER
Definition: SharedDefines.h:3159
Language
Definition: SharedDefines.h:734
@ LANG_ADDON
Definition: SharedDefines.h:753
bool isAcceptWhispers() const
Definition: Player.h:1146

References ASSERT, autoReplyMsg, ChatHandler::BuildChatPacket(), CHAT_MSG_WHISPER, CHAT_MSG_WHISPER_INFORM, WorldObject::GetName(), GetSession(), isAcceptWhispers(), isAFK(), isDND(), IsGameMaster(), LANG_ADDON, LANG_COMMAND_WHISPERON, LANG_PLAYER_AFK, LANG_PLAYER_DND, LANG_UNIVERSAL, ChatHandler::PSendSysMessage(), WorldSession::SendPacket(), ChatHandler::SendSysMessage(), SetAcceptWhispers(), and sScriptMgr.

Referenced by WorldSession::HandleMessagechatOpcode().

◆ Whisper() [2/2]

void Player::Whisper ( uint32  textId,
Player target,
bool  isBossWhisper = false 
)
overridevirtual

Reimplemented from Unit.

9368{
9369 if (!target)
9370 {
9371 return;
9372 }
9373
9374 BroadcastText const* bct = sObjectMgr->GetBroadcastText(textId);
9375 if (!bct)
9376 {
9377 LOG_ERROR("entities.unit", "Player::Whisper: `broadcast_text` was not {} found", textId);
9378 return;
9379 }
9380
9382 WorldPacket data;
9383 ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, LANG_UNIVERSAL, this, target, bct->GetText(locale, getGender()), 0, "", locale);
9384 target->SendDirectMessage(&data);
9385}
std::string const & GetText(LocaleConstant locale=DEFAULT_LOCALE, uint8 gender=GENDER_MALE, bool forceGender=false) const
Definition: ObjectMgr.h:457

References ChatHandler::BuildChatPacket(), CHAT_MSG_WHISPER, Unit::getGender(), GetSession(), WorldSession::GetSessionDbLocaleIndex(), BroadcastText::GetText(), LANG_UNIVERSAL, LOG_ERROR, SendDirectMessage(), and sObjectMgr.

◆ Yell() [1/2]

void Player::Yell ( std::string_view  text,
Language  language,
WorldObject const *  = nullptr 
)
overridevirtual

Handles yelled message in regular chat based on declared language and in config pre-defined Range.

Reimplemented from Unit.

9272{
9273 std::string _text(text);
9274
9275 if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_YELL, language, _text))
9276 {
9277 return;
9278 }
9279
9280 sScriptMgr->OnPlayerChat(this, CHAT_MSG_YELL, language, _text);
9281
9282 WorldPacket data;
9283 ChatHandler::BuildChatPacket(data, CHAT_MSG_YELL, language, this, this, _text);
9284 SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), true);
9285}
@ CONFIG_LISTEN_RANGE_YELL
Definition: IWorld.h:197
@ CHAT_MSG_YELL
Definition: SharedDefines.h:3158

References ChatHandler::BuildChatPacket(), CHAT_MSG_YELL, CONFIG_LISTEN_RANGE_YELL, SendMessageToSetInRange(), sScriptMgr, and sWorld.

Referenced by WorldSession::HandleMessagechatOpcode().

◆ Yell() [2/2]

void Player::Yell ( uint32  textId,
WorldObject const *  target = nullptr 
)
overridevirtual

Reimplemented from Unit.

9288{
9289 Talk(textId, CHAT_MSG_YELL, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), target);
9290}

References CHAT_MSG_YELL, CONFIG_LISTEN_RANGE_YELL, and sWorld.

Friends And Related Function Documentation

◆ CinematicMgr

friend class CinematicMgr
friend

Referenced by Player().

◆ Item::AddToUpdateQueueOf

void Item::AddToUpdateQueueOf ( Player player)
friend

◆ Item::RemoveFromUpdateQueueOf

void Item::RemoveFromUpdateQueueOf ( Player player)
friend

◆ WorldSession

friend class WorldSession
friend

Member Data Documentation

◆ _activeCheats

uint32 Player::_activeCheats
private

◆ _BgBattlegroundQueueID

◆ _cinematicMgr

CinematicMgr* Player::_cinematicMgr
private

◆ _corpseLocation

◆ _farSightDistance

Optional<float> Player::_farSightDistance = { }
private

◆ _innTriggerId

uint32 Player::_innTriggerId
protected

◆ _instanceResetTimes

◆ _pendingBindId

uint32 Player::_pendingBindId
private

◆ _pendingBindTimer

uint32 Player::_pendingBindTimer
private

Referenced by SetPendingBind(), and Update().

◆ _restBonus

float Player::_restBonus
protected

◆ _restFlagMask

uint32 Player::_restFlagMask
protected

◆ _restTime

time_t Player::_restTime
protected

◆ _wasOutdoor

bool Player::_wasOutdoor
private

◆ autoReplyMsg

std::string Player::autoReplyMsg

◆ bgZoneIdToFillWorldStates

std::unordered_map< int, bgZoneRef > Player::bgZoneIdToFillWorldStates = {}
static

Referenced by SendInitWorldStates().

◆ duel

◆ healthBeforeDuel

uint32 Player::healthBeforeDuel
private

◆ isDebugAreaTriggers

◆ ItemSetEff

std::vector<ItemSetEffect*> Player::ItemSetEff

◆ m_achievementMgr

◆ m_actionButtons

◆ m_activeSpec

◆ m_additionalSaveMask

uint8 Player::m_additionalSaveMask
protected

◆ m_additionalSaveTimer

uint16 Player::m_additionalSaveTimer
protected

◆ m_ammoDPS

float Player::m_ammoDPS
protected

◆ m_AreaID

uint32 Player::m_AreaID
protected

◆ m_areaUpdateId

uint32 Player::m_areaUpdateId
protected

◆ m_ArenaTeamIdInvited

uint32 Player::m_ArenaTeamIdInvited
protected

◆ m_ArmorProficiency

uint32 Player::m_ArmorProficiency
protected

◆ m_atLoginFlags

uint32 Player::m_atLoginFlags
protected

◆ m_auraBaseMod

◆ m_auraRaidUpdateMask

◆ m_baseFeralAP

uint32 Player::m_baseFeralAP
protected

◆ m_baseHealthRegen

uint32 Player::m_baseHealthRegen
protected

◆ m_baseManaRegen

uint32 Player::m_baseManaRegen
protected

◆ m_baseRatingValue

int32 Player::m_baseRatingValue[MAX_COMBAT_RATING]
protected

◆ m_baseSpellPower

uint32 Player::m_baseSpellPower
protected

◆ m_bgData

◆ m_bHasDelayedTeleport

bool Player::m_bHasDelayedTeleport
private

◆ m_bMustDelayTeleport

bool Player::m_bMustDelayTeleport
private

◆ m_bPassOnGroupLoot

bool Player::m_bPassOnGroupLoot
protected

◆ m_canBlock

bool Player::m_canBlock
protected

Referenced by CanBlock(), Player(), and SetCanBlock().

◆ m_canKnockback

bool Player::m_canKnockback
private

◆ m_canParry

bool Player::m_canParry
protected

Referenced by CanParry(), Player(), and SetCanParry().

◆ m_canTeleport

bool Player::m_canTeleport
private

Referenced by CanTeleport(), Player(), and SetCanTeleport().

◆ m_canTitanGrip

bool Player::m_canTitanGrip
protected

◆ m_ChampioningFaction

uint32 Player::m_ChampioningFaction
private

◆ m_channels

◆ m_charmAISpells

uint32 Player::m_charmAISpells[NUM_CAI_SPELLS]
protected

◆ m_charmUpdateTimer

uint32 Player::m_charmUpdateTimer

Referenced by Player(), and Update().

◆ m_charSettingsMap

◆ m_chatFloodData

std::array<ChatFloodThrottle, ChatFloodThrottle::MAX> Player::m_chatFloodData
protected

Referenced by UpdateSpeakTime().

◆ m_cinematic

uint8 Player::m_cinematic
protected

◆ m_clientGUIDs

◆ m_contestedPvPTimer

uint32 Player::m_contestedPvPTimer
protected

◆ m_creationTime

Seconds Player::m_creationTime
private

◆ m_currentBuybackSlot

uint32 Player::m_currentBuybackSlot
protected

◆ m_DailyQuestChanged

bool Player::m_DailyQuestChanged
protected

◆ m_deathExpireTime

◆ m_deathTimer

◆ m_declinedname

DeclinedName* Player::m_declinedname
protected

◆ m_DelayedOperations

uint32 Player::m_DelayedOperations
private

◆ m_DFQuests

◆ m_divider

ObjectGuid Player::m_divider
protected

Referenced by GetDivider(), and SetDivider().

◆ m_drunkTimer

uint32 Player::m_drunkTimer
protected

◆ m_drwGUID

ObjectGuid Player::m_drwGUID

◆ m_dungeonDifficulty

Difficulty Player::m_dungeonDifficulty
protected

◆ m_enchantDuration

◆ m_entryPointData

◆ m_EquipmentSets

◆ m_extraBonusTalentCount

uint32 Player::m_extraBonusTalentCount
protected

◆ m_ExtraFlags

◆ m_flightSpellActivated

uint32 Player::m_flightSpellActivated
private

◆ m_foodEmoteTimerCount

uint32 Player::m_foodEmoteTimerCount
protected

Referenced by Player(), and RegenerateAll().

◆ m_forced_speed_changes

uint8 Player::m_forced_speed_changes[MAX_MOVE_TYPE]

◆ m_GlobalCooldownMgr

GlobalCooldownMgr Player::m_GlobalCooldownMgr
protected

Referenced by GetGlobalCooldownMgr().

◆ m_Glyphs

◆ m_grantableLevels

uint8 Player::m_grantableLevels
protected

◆ m_group

◆ m_groupInvite

Group* Player::m_groupInvite
protected

Referenced by GetGroupInvite(), and SetGroupInvite().

◆ m_groupUpdateMask

uint32 Player::m_groupUpdateMask
protected

◆ m_GuildIdInvited

uint32 Player::m_GuildIdInvited
protected

◆ m_homebindAreaId

uint16 Player::m_homebindAreaId

◆ m_homebindMapId

◆ m_homebindO

◆ m_HomebindTimer

uint32 Player::m_HomebindTimer

Referenced by Player(), and UpdateHomebindTime().

◆ m_homebindX

◆ m_homebindY

◆ m_homebindZ

◆ m_hostileReferenceCheckTimer

uint16 Player::m_hostileReferenceCheckTimer
protected

Referenced by Player(), and Update().

◆ m_ingametime

uint32 Player::m_ingametime
protected

◆ m_InstanceValid

◆ m_IsBGRandomWinner

bool Player::m_IsBGRandomWinner
protected

◆ m_isInSharedVisionOf

std::set<Unit*> Player::m_isInSharedVisionOf

◆ m_isInstantFlightOn

bool Player::m_isInstantFlightOn
private

◆ m_isInWater

bool Player::m_isInWater
private

Referenced by IsInWater(), Player(), and SetInWater().

◆ m_itemDuration

◆ m_items

◆ m_itemSoulboundTradeable

ItemDurationList Player::m_itemSoulboundTradeable
protected

◆ m_itemUpdateQueue

std::vector<Item*> Player::m_itemUpdateQueue
protected

◆ m_itemUpdateQueueBlocked

bool Player::m_itemUpdateQueueBlocked
protected

◆ m_Last_tick

time_t Player::m_Last_tick

Referenced by Create(), Player(), and Update().

◆ m_lastDailyQuestTime

time_t Player::m_lastDailyQuestTime
protected

◆ m_lastFallTime

uint32 Player::m_lastFallTime
private

◆ m_lastFallZ

float Player::m_lastFallZ
private

◆ m_lastHonorUpdateTime

time_t Player::m_lastHonorUpdateTime
protected

◆ m_lastpetnumber

uint32 Player::m_lastpetnumber
protected

◆ m_lastPotionId

uint32 Player::m_lastPotionId
protected

◆ m_logintime

time_t Player::m_logintime

Referenced by AddItemToBuyBackSlot(), and Player().

◆ m_lootGuid

ObjectGuid Player::m_lootGuid
protected

Referenced by GetLootGUID(), and SetLootGUID().

◆ m_mail

◆ m_mailsUpdated

◆ m_mapRef

MapReference Player::m_mapRef
private

Referenced by GetMapRef(), and SetMap().

◆ m_MirrorTimer

int32 Player::m_MirrorTimer[MAX_TIMERS]
private

◆ m_MirrorTimerFlags

uint8 Player::m_MirrorTimerFlags
private

◆ m_MirrorTimerFlagsLast

uint8 Player::m_MirrorTimerFlagsLast
private

◆ m_MonthlyQuestChanged

bool Player::m_MonthlyQuestChanged
protected

◆ m_monthlyquests

◆ m_MountBlockId

uint32 Player::m_MountBlockId
protected

◆ m_mover

◆ m_NeedToSaveGlyphs

bool Player::m_NeedToSaveGlyphs
protected

◆ m_needZoneUpdate

bool Player::m_needZoneUpdate
protected

◆ m_newVisible

std::vector<Unit*> Player::m_newVisible

◆ m_nextMailDelivereTime

time_t Player::m_nextMailDelivereTime

◆ m_nextSave

uint32 Player::m_nextSave
protected

◆ m_oldpetspell

uint32 Player::m_oldpetspell
private

◆ m_originalGroup

GroupReference Player::m_originalGroup
protected

◆ m_pendingSpectatorForBG

uint32 Player::m_pendingSpectatorForBG

◆ m_pendingSpectatorInviteInstanceId

uint32 Player::m_pendingSpectatorInviteInstanceId

◆ m_petStable

std::unique_ptr<PetStable> Player::m_petStable
private

◆ m_Played_time

◆ m_powerFraction

float Player::m_powerFraction[MAX_POWERS]
protected

Referenced by Player(), and Regenerate().

◆ m_questRewardTalentCount

uint32 Player::m_questRewardTalentCount
protected

◆ m_QuestStatus

◆ m_QuestStatusSave

◆ m_raidDifficulty

Difficulty Player::m_raidDifficulty
protected

◆ m_raidMapDifficulty

Difficulty Player::m_raidMapDifficulty
protected

◆ m_realDodge

float Player::m_realDodge
protected

◆ m_realParry

float Player::m_realParry
protected

◆ m_recallMap

uint32 Player::m_recallMap

Referenced by Player(), and SaveRecallPosition().

◆ m_recallO

float Player::m_recallO

Referenced by Player(), and SaveRecallPosition().

◆ m_recallX

float Player::m_recallX

Referenced by Player(), and SaveRecallPosition().

◆ m_recallY

float Player::m_recallY

Referenced by Player(), and SaveRecallPosition().

◆ m_recallZ

float Player::m_recallZ

Referenced by Player(), and SaveRecallPosition().

◆ m_receivedSpectatorResetFor

◆ m_refundableItems

RefundableItemsSet Player::m_refundableItems
private

◆ m_regenTimerCount

uint32 Player::m_regenTimerCount
protected

◆ m_reputationMgr

◆ m_resetTalentsCost

uint32 Player::m_resetTalentsCost
protected

◆ m_resetTalentsTime

time_t Player::m_resetTalentsTime
protected

◆ m_resurrectGUID

ObjectGuid Player::m_resurrectGUID
protected

◆ m_resurrectHealth

uint32 Player::m_resurrectHealth
protected

◆ m_resurrectMana

uint32 Player::m_resurrectMana
protected

◆ m_resurrectMap

uint32 Player::m_resurrectMap
protected

◆ m_resurrectX

float Player::m_resurrectX
protected

◆ m_resurrectY

float Player::m_resurrectY
protected

◆ m_resurrectZ

float Player::m_resurrectZ
protected

◆ m_RewardedQuests

◆ m_RewardedQuestsSave

QuestStatusSaveMap Player::m_RewardedQuestsSave
protected

◆ m_runes

◆ m_SeasonalQuestChanged

bool Player::m_SeasonalQuestChanged
protected

◆ m_seasonalquests

◆ m_seer

◆ m_session

◆ m_social

PlayerSocial* Player::m_social
protected

Referenced by GetSocial(), LoadFromDB(), and Player().

◆ m_soulboundTradableLock

std::mutex Player::m_soulboundTradableLock
protected

◆ m_specsCount

◆ m_spellCooldowns

◆ m_spellMods

◆ m_spellModTakingSpell

◆ m_spellPenetrationItemMod

int32 Player::m_spellPenetrationItemMod
protected

◆ m_spells

◆ m_summon_asSpectator

bool Player::m_summon_asSpectator
protected

◆ m_summon_expire

time_t Player::m_summon_expire
protected

◆ m_summon_mapid

uint32 Player::m_summon_mapid
protected

◆ m_summon_x

float Player::m_summon_x
protected

◆ m_summon_y

float Player::m_summon_y
protected

◆ m_summon_z

float Player::m_summon_z
protected

◆ m_swingErrorMsg

uint8 Player::m_swingErrorMsg
protected

Referenced by Player(), and Update().

◆ m_talents

◆ m_taxi

◆ m_team

TeamId Player::m_team
protected

◆ m_temporaryUnsummonedPetNumber

◆ m_timedquests

QuestSet Player::m_timedquests
protected

◆ m_trade

◆ m_usedTalentCount

uint32 Player::m_usedTalentCount
protected

◆ m_weaponChangeTimer

uint32 Player::m_weaponChangeTimer
protected

◆ m_WeaponProficiency

uint32 Player::m_WeaponProficiency
protected

◆ m_WeeklyQuestChanged

bool Player::m_WeeklyQuestChanged
protected

◆ m_weeklyquests

◆ m_zoneUpdateId

uint32 Player::m_zoneUpdateId
protected

◆ m_zoneUpdateTimer

uint32 Player::m_zoneUpdateTimer
protected

Referenced by Player(), Update(), and UpdateZone().

◆ manaBeforeDuel

uint32 Player::manaBeforeDuel
private

◆ mMitems

ItemMap Player::mMitems

◆ mSemaphoreTeleport_Far

time_t Player::mSemaphoreTeleport_Far
private

◆ mSemaphoreTeleport_Near

time_t Player::mSemaphoreTeleport_Near
private

◆ mSkillStatus

◆ PlayerTalkClass

PlayerMenu* Player::PlayerTalkClass

Referenced by AddGossipItemFor(), ClearGossipMenuFor(), CloseGossipMenuFor(), Spell::EffectQuestStart(), go_wind_stone::go_wind_stoneAI::GossipSelect(), OPvPCapturePointZM_GraveYard::HandleGossipOption(), WorldSession::HandleGossipSelectOptionOpcode(), WorldSession::HandlePlayerLoginOpcode(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), WorldSession::HandleQuestgiverCancel(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverCompleteQuest(), WorldSession::HandleQuestgiverQueryQuestOpcode(), WorldSession::HandleQuestgiverRequestRewardOpcode(), WorldSession::HandleQuestgiverStatusQueryOpcode(), WorldSession::HandleQuestQueryOpcode(), npc_wg_quest_giver::OnGossipHello(), npc_elder_clearwater::OnGossipHello(), npc_experience::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), npc_cos_chromie_start::OnGossipSelect(), npc_cos_chromie_middle::OnGossipSelect(), npc_thrall_old_hillsbrad::OnGossipSelect(), npc_icc_buff_switcher::OnGossipSelect(), OnGossipSelect(), Player(), PrepareGossipMenu(), PrepareQuestMenu(), WorldSession::SendBindPoint(), SendGossipMenuFor(), SendPreparedGossip(), SendPreparedQuest(), npc_costumed_orphan_matron::sGossipHello(), npc_pet_trainer::npc_pet_trainerAI::sGossipSelect(), npc_stable_master::npc_stable_masterAI::sGossipSelect(), npc_echo_of_medivh::sGossipSelect(), npc_chesspiece::sGossipSelect(), npc_sergeant_bly::npc_sergeant_blyAI::sGossipSelect(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::sGossipSelect(), npc_zafod_boombox::npc_zafod_boomboxAI::sGossipSelect(), and ~Player().

◆ pvpInfo

◆ teleportStore_dest

WorldLocation Player::teleportStore_dest
private

Referenced by GetTeleportDest(), TeleportTo(), and Update().

◆ teleportStore_options

uint32 Player::teleportStore_options
private

Referenced by Player(), TeleportTo(), and Update().

◆ unReadMails

◆ WhisperList