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

#include "AuctionHouseSearcher.h"

Public Member Functions

bool PlayerCanUseItem (ItemTemplate const *proto) const
 
uint16 GetSkillValue (uint32 skill) const
 
bool HasSpell (uint32 spell) const
 

Public Attributes

uint32 classMask
 
uint32 raceMask
 
uint8 level
 
AuctionPlayerSkills skills
 
AuctionPlayerSpells spells
 

Detailed Description

Member Function Documentation

◆ GetSkillValue()

uint16 AuctionHouseUsablePlayerInfo::GetSkillValue ( uint32  skill) const
707{
708 if (!skill)
709 return 0;
710
711 AuctionPlayerSkills::const_iterator itr = skills.find(skill);
712 if (itr == skills.end())
713 return 0;
714
715 return itr->second;
716}
AuctionPlayerSkills skills
Definition AuctionHouseSearcher.h:122

References skills.

Referenced by PlayerCanUseItem().

◆ HasSpell()

bool AuctionHouseUsablePlayerInfo::HasSpell ( uint32  spell) const
719{
720 AuctionPlayerSpells::const_iterator itr = spells.find(spell);
721 return (itr != spells.end());
722}
spells
Definition boss_krystallus.cpp:26

Referenced by PlayerCanUseItem().

◆ PlayerCanUseItem()

bool AuctionHouseUsablePlayerInfo::PlayerCanUseItem ( ItemTemplate const *  proto) const
664{
665 uint32 itemSkill = proto->GetSkill();
666 if (itemSkill != 0)
667 {
668 if (GetSkillValue(itemSkill) == 0)
669 return false;
670 }
671
672 if ((proto->AllowableClass & classMask) == 0 || (proto->AllowableRace & raceMask) == 0)
673 return false;
674
675 if (proto->RequiredSkill != 0)
676 {
677 if (GetSkillValue(proto->RequiredSkill) == 0)
678 return false;
679 else if (GetSkillValue(proto->RequiredSkill) < proto->RequiredSkillRank)
680 return false;
681 }
682
683 if (proto->RequiredSpell != 0 && !HasSpell(proto->RequiredSpell))
684 return false;
685
686 if (level < proto->RequiredLevel)
687 return false;
688
689 if (proto->Spells[0].SpellId)
690 {
691 // this check is for vanilla recipies. Spells are learned through individual learning spells instead of spell 483 and 55884
692 SpellEntry const* spellEntry = sSpellStore.LookupEntry(proto->Spells[0].SpellId);
693 if (spellEntry && spellEntry->Effect[0] == SPELL_EFFECT_LEARN_SPELL && spellEntry->EffectTriggerSpell[0])
694 if (HasSpell(spellEntry->EffectTriggerSpell[0]))
695 return false;
696
697 // this check is for tbc/wotlk recipies. Spells are learned through 483 and 55884, the second spell in the item will be the actual spell learned.
698 if (proto->Spells[0].SpellId == 483 || proto->Spells[0].SpellId == 55884)
699 if (HasSpell(proto->Spells[1].SpellId))
700 return false;
701 }
702
703 return true;
704}
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
std::uint32_t uint32
Definition Define.h:107
@ SPELL_EFFECT_LEARN_SPELL
Definition SharedDefines.h:814
bool HasSpell(uint32 spell) const
Definition AuctionHouseSearcher.cpp:718
uint32 classMask
Definition AuctionHouseSearcher.h:119
uint16 GetSkillValue(uint32 skill) const
Definition AuctionHouseSearcher.cpp:706
uint32 raceMask
Definition AuctionHouseSearcher.h:120
Definition DBCStructure.h:1641
std::array< uint32, MAX_SPELL_EFFECTS > EffectTriggerSpell
Definition DBCStructure.h:1711
std::array< uint32, MAX_SPELL_EFFECTS > Effect
Definition DBCStructure.h:1696

References ItemTemplate::AllowableClass, ItemTemplate::AllowableRace, classMask, SpellEntry::Effect, SpellEntry::EffectTriggerSpell, ItemTemplate::GetSkill(), GetSkillValue(), HasSpell(), raceMask, ItemTemplate::RequiredSkill, ItemTemplate::RequiredSkillRank, ItemTemplate::RequiredSpell, SPELL_EFFECT_LEARN_SPELL, _Spell::SpellId, ItemTemplate::Spells, and sSpellStore.

Member Data Documentation

◆ classMask

uint32 AuctionHouseUsablePlayerInfo::classMask

◆ level

uint8 AuctionHouseUsablePlayerInfo::level

◆ raceMask

uint32 AuctionHouseUsablePlayerInfo::raceMask

◆ skills

AuctionPlayerSkills AuctionHouseUsablePlayerInfo::skills

◆ spells

AuctionPlayerSpells AuctionHouseUsablePlayerInfo::spells

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