AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
ItemTemplate Struct Reference

#include "ItemTemplate.h"

Public Member Functions

bool HasSignature () const
 
bool CanChangeEquipStateInCombat () const
 
bool IsCurrencyToken () const
 
uint32 GetMaxStackSize () const
 
float getDPS () const
 
int32 getFeralBonus (int32 extraDPS=0) const
 
float GetItemLevelIncludingQuality (uint8 pLevel) const
 
uint32 GetSkill () const
 
bool IsPotion () const
 
bool IsWeaponVellum () const
 
bool IsArmorVellum () const
 
bool IsConjuredConsumable () const
 
bool HasStat (ItemModType stat) const
 
bool HasSpellPowerStat () const
 
bool HasFlag (ItemFlags flag) const
 
bool HasFlag2 (ItemFlags2 flag) const
 
bool HasFlagCu (ItemFlagsCustom flag) const
 

Public Attributes

uint32 ItemId
 
uint32 Class
 
uint32 SubClass
 
int32 SoundOverrideSubclass
 
std::string Name1
 
uint32 DisplayInfoID
 
uint32 Quality
 
ItemFlags Flags
 
ItemFlags2 Flags2
 
uint32 BuyCount
 
int32 BuyPrice
 
uint32 SellPrice
 
uint32 InventoryType
 
uint32 AllowableClass
 
uint32 AllowableRace
 
uint32 ItemLevel
 
uint32 RequiredLevel
 
uint32 RequiredSkill
 
uint32 RequiredSkillRank
 
uint32 RequiredSpell
 
uint32 RequiredHonorRank
 
uint32 RequiredCityRank
 
uint32 RequiredReputationFaction
 
uint32 RequiredReputationRank
 
int32 MaxCount
 
int32 Stackable
 
uint32 ContainerSlots
 
uint32 StatsCount
 
_ItemStat ItemStat [MAX_ITEM_PROTO_STATS]
 
uint32 ScalingStatDistribution
 
uint32 ScalingStatValue
 
_Damage Damage [MAX_ITEM_PROTO_DAMAGES]
 
uint32 Armor
 
int32 HolyRes
 
int32 FireRes
 
int32 NatureRes
 
int32 FrostRes
 
int32 ShadowRes
 
int32 ArcaneRes
 
uint32 Delay
 
uint32 AmmoType
 
float RangedModRange
 
_Spell Spells [MAX_ITEM_PROTO_SPELLS]
 
uint32 Bonding
 
std::string Description
 
uint32 PageText
 
uint32 LanguageID
 
uint32 PageMaterial
 
uint32 StartQuest
 
uint32 LockID
 
int32 Material
 
uint32 Sheath
 
int32 RandomProperty
 
int32 RandomSuffix
 
uint32 Block
 
uint32 ItemSet
 
uint32 MaxDurability
 
uint32 Area
 
uint32 Map
 
uint32 BagFamily
 
uint32 TotemCategory
 
_Socket Socket [MAX_ITEM_PROTO_SOCKETS]
 
uint32 socketBonus
 
uint32 GemProperties
 
uint32 RequiredDisenchantSkill
 
float ArmorDamageModifier
 
uint32 Duration
 
uint32 ItemLimitCategory
 
uint32 HolidayId
 
uint32 ScriptId
 
uint32 DisenchantID
 
uint32 FoodType
 
uint32 MinMoneyLoot
 
uint32 MaxMoneyLoot
 
ItemFlagsCustom FlagsCu
 

Detailed Description

Member Function Documentation

◆ CanChangeEquipStateInCombat()

bool ItemTemplate::CanChangeEquipStateInCombat ( ) const
inline
706 {
707 switch (InventoryType)
708 {
709 case INVTYPE_RELIC:
710 case INVTYPE_SHIELD:
711 case INVTYPE_HOLDABLE:
712 return true;
713 }
714
715 switch (Class)
716 {
719 return true;
720 }
721
722 return false;
723 }
InventoryType
Definition ItemTemplate.h:255
@ INVTYPE_HOLDABLE
Definition ItemTemplate.h:279
@ INVTYPE_RELIC
Definition ItemTemplate.h:284
@ INVTYPE_SHIELD
Definition ItemTemplate.h:270
@ ITEM_CLASS_PROJECTILE
Definition ItemTemplate.h:297
@ ITEM_CLASS_WEAPON
Definition ItemTemplate.h:293
uint32 Class
Definition ItemTemplate.h:621

References Class, INVTYPE_HOLDABLE, INVTYPE_RELIC, INVTYPE_SHIELD, ITEM_CLASS_PROJECTILE, and ITEM_CLASS_WEAPON.

Referenced by Player::CanEquipItem(), and Player::CanUnequipItem().

◆ getDPS()

float ItemTemplate::getDPS ( ) const
inline
733 {
734 if (Delay == 0)
735 return 0;
736 float temp = 0;
737 for (auto i : Damage)
738 temp += i.DamageMin + i.DamageMax;
739 return temp * 500 / Delay;
740 }
_Damage Damage[MAX_ITEM_PROTO_DAMAGES]
Definition ItemTemplate.h:651
uint32 Delay
Definition ItemTemplate.h:659

References Damage, and Delay.

Referenced by getFeralBonus().

◆ getFeralBonus()

int32 ItemTemplate::getFeralBonus ( int32  extraDPS = 0) const
inline
743 {
744 constexpr uint32 feralApEnabledInventoryTypeMaks = 1 << INVTYPE_WEAPON | 1 << INVTYPE_2HWEAPON | 1 << INVTYPE_WEAPONMAINHAND | 1 << INVTYPE_WEAPONOFFHAND;
745
746 // 0x02A5F3 - is mask for Melee weapon from ItemSubClassMask.dbc
747 if (Class == ITEM_CLASS_WEAPON && (1 << InventoryType) & feralApEnabledInventoryTypeMaks)
748 {
749 int32 bonus = int32((extraDPS + getDPS()) * 14.0f) - 767;
750 if (bonus < 0)
751 return 0;
752 return bonus;
753 }
754 return 0;
755 }
std::int32_t int32
Definition Define.h:103
std::uint32_t uint32
Definition Define.h:107
@ INVTYPE_WEAPON
Definition ItemTemplate.h:269
@ INVTYPE_WEAPONMAINHAND
Definition ItemTemplate.h:277
@ INVTYPE_WEAPONOFFHAND
Definition ItemTemplate.h:278
@ INVTYPE_2HWEAPON
Definition ItemTemplate.h:273
float getDPS() const
Definition ItemTemplate.h:732

References Class, getDPS(), INVTYPE_2HWEAPON, INVTYPE_WEAPON, INVTYPE_WEAPONMAINHAND, INVTYPE_WEAPONOFFHAND, and ITEM_CLASS_WEAPON.

Referenced by Player::_ApplyItemBonuses(), and Player::UpdateAttackPowerAndDamage().

◆ GetItemLevelIncludingQuality()

float ItemTemplate::GetItemLevelIncludingQuality ( uint8  pLevel) const
inline
758 {
759 auto itemLevel = (float)ItemLevel;
760 switch (Quality)
761 {
765 itemLevel -= 26.0f;
766 break;
768 itemLevel -= 13.0f;
769 break;
771 itemLevel = pLevel * 2.33f;
772 break;
776 default:
777 break;
778 }
779 return std::max<float>(0.f, itemLevel);
780 }
@ ITEM_QUALITY_UNCOMMON
Definition SharedDefines.h:342
@ ITEM_QUALITY_RARE
Definition SharedDefines.h:343
@ ITEM_QUALITY_NORMAL
Definition SharedDefines.h:341
@ ITEM_QUALITY_LEGENDARY
Definition SharedDefines.h:345
@ ITEM_QUALITY_HEIRLOOM
Definition SharedDefines.h:347
@ ITEM_QUALITY_POOR
Definition SharedDefines.h:340
@ ITEM_QUALITY_ARTIFACT
Definition SharedDefines.h:346
@ ITEM_QUALITY_EPIC
Definition SharedDefines.h:344
uint32 Quality
Definition ItemTemplate.h:626
uint32 ItemLevel
Definition ItemTemplate.h:635

References ITEM_QUALITY_ARTIFACT, ITEM_QUALITY_EPIC, ITEM_QUALITY_HEIRLOOM, ITEM_QUALITY_LEGENDARY, ITEM_QUALITY_NORMAL, ITEM_QUALITY_POOR, ITEM_QUALITY_RARE, ITEM_QUALITY_UNCOMMON, ItemLevel, and Quality.

Referenced by Player::GetAverageItemLevel().

◆ GetMaxStackSize()

◆ GetSkill()

uint32 ItemTemplate::GetSkill ( ) const
inline
783 {
784 const static uint32 item_weapon_skills[MAX_ITEM_SUBCLASS_WEAPON] =
785 {
791 };
792
793 const static uint32 item_armor_skills[MAX_ITEM_SUBCLASS_ARMOR] =
794 {
796 };
797
798 switch (Class)
799 {
802 return 0;
803 else
804 return item_weapon_skills[SubClass];
805
806 case ITEM_CLASS_ARMOR:
808 return 0;
809 else
810 return item_armor_skills[SubClass];
811
812 default:
813 return 0;
814 }
815 }
#define MAX_ITEM_SUBCLASS_ARMOR
Definition ItemTemplate.h:403
@ ITEM_CLASS_ARMOR
Definition ItemTemplate.h:295
#define MAX_ITEM_SUBCLASS_WEAPON
Definition ItemTemplate.h:371
@ SKILL_BOWS
Definition SharedDefines.h:3123
@ SKILL_MACES
Definition SharedDefines.h:3127
@ SKILL_PLATE_MAIL
Definition SharedDefines.h:3201
@ SKILL_LEATHER
Definition SharedDefines.h:3213
@ SKILL_WANDS
Definition SharedDefines.h:3191
@ SKILL_GUNS
Definition SharedDefines.h:3124
@ SKILL_SHIELD
Definition SharedDefines.h:3215
@ SKILL_CROSSBOWS
Definition SharedDefines.h:3190
@ SKILL_THROWN
Definition SharedDefines.h:3164
@ SKILL_FISHING
Definition SharedDefines.h:3207
@ SKILL_SWORDS
Definition SharedDefines.h:3121
@ SKILL_DAGGERS
Definition SharedDefines.h:3163
@ SKILL_2H_AXES
Definition SharedDefines.h:3162
@ SKILL_CLOTH
Definition SharedDefines.h:3214
@ SKILL_POLEARMS
Definition SharedDefines.h:3192
@ SKILL_2H_SWORDS
Definition SharedDefines.h:3128
@ SKILL_MAIL
Definition SharedDefines.h:3212
@ SKILL_FIST_WEAPONS
Definition SharedDefines.h:3216
@ SKILL_2H_MACES
Definition SharedDefines.h:3156
@ SKILL_AXES
Definition SharedDefines.h:3122
@ SKILL_STAVES
Definition SharedDefines.h:3144
@ SKILL_ASSASSINATION
Definition SharedDefines.h:3196
uint32 SubClass
Definition ItemTemplate.h:622

References Class, ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON, MAX_ITEM_SUBCLASS_ARMOR, MAX_ITEM_SUBCLASS_WEAPON, SKILL_2H_AXES, SKILL_2H_MACES, SKILL_2H_SWORDS, SKILL_ASSASSINATION, SKILL_AXES, SKILL_BOWS, SKILL_CLOTH, SKILL_CROSSBOWS, SKILL_DAGGERS, SKILL_FISHING, SKILL_FIST_WEAPONS, SKILL_GUNS, SKILL_LEATHER, SKILL_MACES, SKILL_MAIL, SKILL_PLATE_MAIL, SKILL_POLEARMS, SKILL_SHIELD, SKILL_STAVES, SKILL_SWORDS, SKILL_THROWN, SKILL_WANDS, and SubClass.

Referenced by Item::GetSkill(), and AuctionHouseUsablePlayerInfo::PlayerCanUseItem().

◆ HasFlag()

◆ HasFlag2()

bool ItemTemplate::HasFlag2 ( ItemFlags2  flag) const
inline
826{ return (Flags2 & flag) != 0; }
ItemFlags2 Flags2
Definition ItemTemplate.h:628

References Flags2.

Referenced by LootItem::AllowedForPlayer(), Player::BuyItemFromVendorSlot(), Player::CanUseItem(), VendorItem::IsGoldRequired(), and Group::NeedBeforeGreed().

◆ HasFlagCu()

bool ItemTemplate::HasFlagCu ( ItemFlagsCustom  flag) const
inline
827{ return (FlagsCu & flag) != 0; }
ItemFlagsCustom FlagsCu
Definition ItemTemplate.h:694

References FlagsCu.

Referenced by LootItem::AllowedForPlayer(), LootItem::LootItem(), and Player::UpdateItemDuration().

◆ HasSignature()

bool ItemTemplate::HasSignature ( ) const
inline
698 {
699 return GetMaxStackSize() == 1 &&
703 }
@ ITEM_FLAG_NO_CREATOR
Definition ItemTemplate.h:164
@ ITEM_CLASS_QUEST
Definition ItemTemplate.h:303
@ ITEM_CLASS_CONSUMABLE
Definition ItemTemplate.h:291
uint32 GetMaxStackSize() const
Definition ItemTemplate.h:727
bool HasFlag(ItemFlags flag) const
Definition ItemTemplate.h:825

References Class, GetMaxStackSize(), HasFlag(), ITEM_CLASS_CONSUMABLE, ITEM_CLASS_QUEST, and ITEM_FLAG_NO_CREATOR.

Referenced by Spell::DoCreateItem().

◆ HasSpellPowerStat()

bool ItemTemplate::HasSpellPowerStat ( ) const
343{
344 bool invalid = false;
345 for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
346 {
347 _Spell const& spellData = Spells[i];
348 if (!spellData.SpellId)
349 {
350 continue;
351 }
352
353 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
354 if (!spellInfo)
355 {
356 continue;
357 }
358
359 for (uint8 j = EFFECT_0; j <= EFFECT_2; ++j)
360 {
361 switch (spellInfo->Effects[j].ApplyAuraName)
362 {
367 invalid = true;
368 break;
373 if (!(spellInfo->Effects[j].MiscValue & SPELL_SCHOOL_MASK_SPELL))
374 {
375 return false;
376 }
377 invalid = true;
378 break;
379 default:
380 break;
381 }
382 }
383 }
384
385 return invalid;
386}
Spells
Definition BattlegroundIC.h:712
std::uint8_t uint8
Definition Define.h:109
#define MAX_ITEM_PROTO_SPELLS
Definition ItemTemplate.h:615
@ EFFECT_0
Definition SharedDefines.h:31
@ EFFECT_2
Definition SharedDefines.h:33
@ SPELL_SCHOOL_MASK_SPELL
Definition SharedDefines.h:319
@ SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER
Definition SpellAuraDefines.h:300
@ SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT
Definition SpellAuraDefines.h:237
@ SPELL_AURA_MOD_HEALING_DONE
Definition SpellAuraDefines.h:198
@ SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT
Definition SpellAuraDefines.h:238
@ SPELL_AURA_MOD_DAMAGE_TAKEN
Definition SpellAuraDefines.h:77
@ SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER
Definition SpellAuraDefines.h:301
@ SPELL_AURA_MOD_HEALING
Definition SpellAuraDefines.h:178
@ SPELL_AURA_MOD_DAMAGE_DONE
Definition SpellAuraDefines.h:76
#define sSpellMgr
Definition SpellMgr.h:825
Definition SpellInfo.h:316
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:393
Definition ItemTemplate.h:590
int32 SpellId
Definition ItemTemplate.h:591

References EFFECT_0, EFFECT_2, SpellInfo::Effects, MAX_ITEM_PROTO_SPELLS, SPELL_AURA_MOD_DAMAGE_DONE, SPELL_AURA_MOD_DAMAGE_TAKEN, SPELL_AURA_MOD_HEALING, SPELL_AURA_MOD_HEALING_DONE, SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER, SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT, SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER, SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, SPELL_SCHOOL_MASK_SPELL, _Spell::SpellId, and sSpellMgr.

Referenced by Player::CanRollForItemInLFG().

◆ HasStat()

bool ItemTemplate::HasStat ( ItemModType  stat) const
325{
326 for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
327 {
328 if (i >= StatsCount)
329 {
330 break;
331 }
332
333 if (ItemStat[i].ItemStatType == stat)
334 {
335 return true;
336 }
337 }
338
339 return false;
340}
#define MAX_ITEM_PROTO_STATS
Definition ItemTemplate.h:616
_ItemStat ItemStat[MAX_ITEM_PROTO_STATS]
Definition ItemTemplate.h:648
uint32 StatsCount
Definition ItemTemplate.h:647

References ItemStat, MAX_ITEM_PROTO_STATS, and StatsCount.

Referenced by Player::CanRollForItemInLFG().

◆ IsArmorVellum()

bool ItemTemplate::IsArmorVellum ( ) const
inline
@ ITEM_SUBCLASS_ARMOR_ENCHANTMENT
Definition ItemTemplate.h:439
@ ITEM_CLASS_TRADE_GOODS
Definition ItemTemplate.h:298

References Class, ITEM_CLASS_TRADE_GOODS, ITEM_SUBCLASS_ARMOR_ENCHANTMENT, and SubClass.

Referenced by Item::IsArmorVellum(), and Item::IsFitToSpellRequirements().

◆ IsConjuredConsumable()

bool ItemTemplate::IsConjuredConsumable ( ) const
inline
@ ITEM_FLAG_CONJURED
Definition ItemTemplate.h:148

References Class, HasFlag(), ITEM_CLASS_CONSUMABLE, and ITEM_FLAG_CONJURED.

Referenced by Item::IsConjuredConsumable().

◆ IsCurrencyToken()

bool ItemTemplate::IsCurrencyToken ( ) const
inline

◆ IsPotion()

bool ItemTemplate::IsPotion ( ) const
inline
@ ITEM_SUBCLASS_POTION
Definition ItemTemplate.h:315

References Class, ITEM_CLASS_CONSUMABLE, ITEM_SUBCLASS_POTION, and SubClass.

Referenced by Item::IsPotion().

◆ IsWeaponVellum()

bool ItemTemplate::IsWeaponVellum ( ) const
inline

Member Data Documentation

◆ AllowableClass

◆ AllowableRace

◆ AmmoType

uint32 ItemTemplate::AmmoType

◆ ArcaneRes

◆ Area

◆ Armor

◆ ArmorDamageModifier

float ItemTemplate::ArmorDamageModifier

◆ BagFamily

◆ Block

◆ Bonding

◆ BuyCount

◆ BuyPrice

◆ Class

◆ ContainerSlots

◆ Damage

◆ Delay

◆ Description

std::string ItemTemplate::Description

◆ DisenchantID

◆ DisplayInfoID

◆ Duration

◆ FireRes

◆ Flags

◆ Flags2

ItemFlags2 ItemTemplate::Flags2

◆ FlagsCu

ItemFlagsCustom ItemTemplate::FlagsCu

Referenced by HasFlagCu().

◆ FoodType

uint32 ItemTemplate::FoodType

Referenced by Pet::HaveInDiet().

◆ FrostRes

◆ GemProperties

◆ HolidayId

uint32 ItemTemplate::HolidayId

◆ HolyRes

◆ InventoryType

◆ ItemId

◆ ItemLevel

◆ ItemLimitCategory

◆ ItemSet

◆ ItemStat

◆ LanguageID

uint32 ItemTemplate::LanguageID

◆ LockID

◆ Map

◆ Material

int32 ItemTemplate::Material

◆ MaxCount

◆ MaxDurability

◆ MaxMoneyLoot

uint32 ItemTemplate::MaxMoneyLoot

Referenced by Player::SendLoot().

◆ MinMoneyLoot

uint32 ItemTemplate::MinMoneyLoot

Referenced by Player::SendLoot().

◆ Name1

◆ NatureRes

◆ PageMaterial

uint32 ItemTemplate::PageMaterial

◆ PageText

◆ Quality

◆ RandomProperty

◆ RandomSuffix

◆ RangedModRange

float ItemTemplate::RangedModRange

◆ RequiredCityRank

uint32 ItemTemplate::RequiredCityRank

◆ RequiredDisenchantSkill

◆ RequiredHonorRank

uint32 ItemTemplate::RequiredHonorRank

◆ RequiredLevel

◆ RequiredReputationFaction

◆ RequiredReputationRank

◆ RequiredSkill

◆ RequiredSkillRank

◆ RequiredSpell

◆ ScalingStatDistribution

◆ ScalingStatValue

◆ ScriptId

uint32 ItemTemplate::ScriptId

◆ SellPrice

◆ ShadowRes

◆ Sheath

uint32 ItemTemplate::Sheath

◆ Socket

◆ socketBonus

◆ SoundOverrideSubclass

int32 ItemTemplate::SoundOverrideSubclass

◆ Spells

◆ Stackable

◆ StartQuest

◆ StatsCount

◆ SubClass

◆ TotemCategory


The documentation for this struct was generated from the following files: