mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 19:37:01 +00:00
Simplify check in reagent cheking code. Small code cleanups after recent commit.
This commit is contained in:
parent
f1cc9dc319
commit
fc684dc737
5 changed files with 10 additions and 10 deletions
|
|
@ -18356,18 +18356,20 @@ bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item cons
|
||||||
return false;
|
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
|
// don't take reagents for spells with SPELL_ATTR_EX5_NO_REAGENT_WHILE_PREP
|
||||||
if (spellInfo->AttributesEx5 & SPELL_ATTR_EX5_NO_REAGENT_WHILE_PREP &&
|
if (spellInfo->AttributesEx5 & SPELL_ATTR_EX5_NO_REAGENT_WHILE_PREP &&
|
||||||
HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION))
|
HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Check no reagent use mask
|
// Check no reagent use mask
|
||||||
uint64 noReagentMask_0_1 = GetUInt64Value(PLAYER_NO_REAGENT_COST_1);
|
uint64 noReagentMask_0_1 = GetUInt64Value(PLAYER_NO_REAGENT_COST_1);
|
||||||
uint32 noReagentMask_2 = GetUInt64Value(PLAYER_NO_REAGENT_COST_1+2);
|
uint32 noReagentMask_2 = GetUInt64Value(PLAYER_NO_REAGENT_COST_1+2);
|
||||||
if (spellInfo->SpellFamilyFlags & noReagentMask_0_1 ||
|
if (spellInfo->SpellFamilyFlags & noReagentMask_0_1 ||
|
||||||
spellInfo->SpellFamilyFlags2 & noReagentMask_2)
|
spellInfo->SpellFamilyFlags2 & noReagentMask_2)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1102,7 +1102,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
bool HasBankBagSlot( uint8 slot ) const;
|
bool HasBankBagSlot( uint8 slot ) const;
|
||||||
bool HasItemCount( uint32 item, uint32 count, bool inBankAlso = false ) const;
|
bool HasItemCount( uint32 item, uint32 count, bool inBankAlso = false ) const;
|
||||||
bool HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item const* ignoreItem = NULL);
|
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;
|
Item* GetItemOrItemWithGemEquipped( uint32 item ) const;
|
||||||
uint8 CanTakeMoreSimilarItems(Item* pItem) const { return _CanTakeMoreSimilarItems(pItem->GetEntry(),pItem->GetCount(),pItem); }
|
uint8 CanTakeMoreSimilarItems(Item* pItem) const { return _CanTakeMoreSimilarItems(pItem->GetEntry(),pItem->GetCount(),pItem); }
|
||||||
uint8 CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return _CanTakeMoreSimilarItems(entry,count,NULL); }
|
uint8 CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return _CanTakeMoreSimilarItems(entry,count,NULL); }
|
||||||
|
|
|
||||||
|
|
@ -4691,11 +4691,7 @@ uint8 Spell::CheckItems()
|
||||||
focusObject = ok; // game object found in range
|
focusObject = ok; // game object found in range
|
||||||
}
|
}
|
||||||
|
|
||||||
bool needReagentCheck = true;
|
if (!p_caster->CanNoReagentCast(m_spellInfo))
|
||||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->CanNoReagentCast(m_spellInfo))
|
|
||||||
needReagentCheck = false;
|
|
||||||
|
|
||||||
if (needReagentCheck)
|
|
||||||
{
|
{
|
||||||
for(uint32 i=0;i<8;i++)
|
for(uint32 i=0;i<8;i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1171,7 +1171,8 @@ void Aura::UpdateSlotCounterAndDuration(bool add)
|
||||||
SetAuraCharges(count);
|
SetAuraCharges(count);
|
||||||
SendAuraUpdate(false);
|
SendAuraUpdate(false);
|
||||||
}
|
}
|
||||||
bool Aura::isAffectedOnSpell(SpellEntry const *spell)
|
|
||||||
|
bool Aura::isAffectedOnSpell(SpellEntry const *spell) const
|
||||||
{
|
{
|
||||||
// Check family name
|
// Check family name
|
||||||
if (spell->SpellFamilyName != m_spellProto->SpellFamilyName)
|
if (spell->SpellFamilyName != m_spellProto->SpellFamilyName)
|
||||||
|
|
@ -1184,6 +1185,7 @@ bool Aura::isAffectedOnSpell(SpellEntry const *spell)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
/*** BASIC AURA FUNCTION ***/
|
/*** BASIC AURA FUNCTION ***/
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
|
|
|
||||||
|
|
@ -304,8 +304,8 @@ class MANGOS_DLL_SPEC Aura
|
||||||
void PeriodicTick();
|
void PeriodicTick();
|
||||||
void PeriodicDummyTick();
|
void PeriodicDummyTick();
|
||||||
|
|
||||||
inline uint32 const *getAuraSpellClassMask() {return m_spellProto->EffectSpellClassMaskA + m_effIndex * 3; }
|
uint32 const *getAuraSpellClassMask() const { return m_spellProto->EffectSpellClassMaskA + m_effIndex * 3; }
|
||||||
bool isAffectedOnSpell(SpellEntry const *spell);
|
bool isAffectedOnSpell(SpellEntry const *spell) const;
|
||||||
protected:
|
protected:
|
||||||
Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
|
Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue