Simplify check in reagent cheking code. Small code cleanups after recent commit.

This commit is contained in:
VladimirMangos 2008-12-16 19:19:31 +03:00
parent f1cc9dc319
commit fc684dc737
5 changed files with 10 additions and 10 deletions

View file

@ -18356,18 +18356,20 @@ bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item cons
return false;
}
bool Player::CanNoReagentCast(SpellEntry const* spellInfo)
bool Player::CanNoReagentCast(SpellEntry const* spellInfo) const
{
// don't take reagents for spells with SPELL_ATTR_EX5_NO_REAGENT_WHILE_PREP
if (spellInfo->AttributesEx5 & SPELL_ATTR_EX5_NO_REAGENT_WHILE_PREP &&
HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION))
return true;
// Check no reagent use mask
uint64 noReagentMask_0_1 = GetUInt64Value(PLAYER_NO_REAGENT_COST_1);
uint32 noReagentMask_2 = GetUInt64Value(PLAYER_NO_REAGENT_COST_1+2);
if (spellInfo->SpellFamilyFlags & noReagentMask_0_1 ||
spellInfo->SpellFamilyFlags2 & noReagentMask_2)
return true;
return false;
}

View file

@ -1102,7 +1102,7 @@ class MANGOS_DLL_SPEC Player : public Unit
bool HasBankBagSlot( uint8 slot ) const;
bool HasItemCount( uint32 item, uint32 count, bool inBankAlso = false ) const;
bool HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item const* ignoreItem = NULL);
bool CanNoReagentCast(SpellEntry const* spellInfo);
bool CanNoReagentCast(SpellEntry const* spellInfo) const;
Item* GetItemOrItemWithGemEquipped( uint32 item ) const;
uint8 CanTakeMoreSimilarItems(Item* pItem) const { return _CanTakeMoreSimilarItems(pItem->GetEntry(),pItem->GetCount(),pItem); }
uint8 CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return _CanTakeMoreSimilarItems(entry,count,NULL); }

View file

@ -4691,11 +4691,7 @@ uint8 Spell::CheckItems()
focusObject = ok; // game object found in range
}
bool needReagentCheck = true;
if (m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->CanNoReagentCast(m_spellInfo))
needReagentCheck = false;
if (needReagentCheck)
if (!p_caster->CanNoReagentCast(m_spellInfo))
{
for(uint32 i=0;i<8;i++)
{

View file

@ -1171,7 +1171,8 @@ void Aura::UpdateSlotCounterAndDuration(bool add)
SetAuraCharges(count);
SendAuraUpdate(false);
}
bool Aura::isAffectedOnSpell(SpellEntry const *spell)
bool Aura::isAffectedOnSpell(SpellEntry const *spell) const
{
// Check family name
if (spell->SpellFamilyName != m_spellProto->SpellFamilyName)
@ -1184,6 +1185,7 @@ bool Aura::isAffectedOnSpell(SpellEntry const *spell)
return true;
return false;
}
/*********************************************************/
/*** BASIC AURA FUNCTION ***/
/*********************************************************/

View file

@ -304,8 +304,8 @@ class MANGOS_DLL_SPEC Aura
void PeriodicTick();
void PeriodicDummyTick();
inline uint32 const *getAuraSpellClassMask() {return m_spellProto->EffectSpellClassMaskA + m_effIndex * 3; }
bool isAffectedOnSpell(SpellEntry const *spell);
uint32 const *getAuraSpellClassMask() const { return m_spellProto->EffectSpellClassMaskA + m_effIndex * 3; }
bool isAffectedOnSpell(SpellEntry const *spell) const;
protected:
Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);