Change GetSpellSpecific() to have SpellEntry argument instead of ID, this saves lookups in spellstore for entries we already have.

--HG--
branch : trunk
This commit is contained in:
thenecromancer
2010-01-20 20:54:32 +01:00
parent bfad15470f
commit 721c926229
4 changed files with 18 additions and 14 deletions
+1 -1
View File
@@ -1209,7 +1209,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
}
break;
case SPELLFAMILY_DEATHKNIGHT:
if (GetSpellSpecific(GetId()) == SPELL_SPECIFIC_PRESENCE)
if (GetSpellSpecific(GetSpellProto()) == SPELL_SPECIFIC_PRESENCE)
{
AuraEffect *bloodPresenceAura=0; // healing by damage done
AuraEffect *frostPresenceAura=0; // increased health
+6 -10
View File
@@ -464,12 +464,8 @@ AuraState GetSpellAuraState(SpellEntry const * spellInfo)
return AURA_STATE_NONE;
}
SpellSpecific GetSpellSpecific(uint32 spellId)
SpellSpecific GetSpellSpecific(SpellEntry const * spellInfo)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
if(!spellInfo)
return SPELL_SPECIFIC_NORMAL;
switch(spellInfo->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
@@ -1013,7 +1009,7 @@ bool IsSingleTargetSpell(SpellEntry const *spellInfo)
if ( spellInfo->AttributesEx5 & SPELL_ATTR_EX5_SINGLE_TARGET_SPELL )
return true;
switch(GetSpellSpecific(spellInfo->Id))
switch(GetSpellSpecific(spellInfo))
{
case SPELL_SPECIFIC_JUDGEMENT:
return true;
@@ -1033,13 +1029,13 @@ bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellI
return true;
// TODO - need found Judgements rule
SpellSpecific spec1 = GetSpellSpecific(spellInfo1->Id);
SpellSpecific spec1 = GetSpellSpecific(spellInfo1);
// spell with single target specific types
switch(spec1)
{
case SPELL_SPECIFIC_JUDGEMENT:
case SPELL_SPECIFIC_MAGE_POLYMORPH:
if(GetSpellSpecific(spellInfo2->Id) == spec1)
if(GetSpellSpecific(spellInfo2) == spec1)
return true;
break;
default:
@@ -3025,8 +3021,8 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
bool SpellMgr::CanAurasStack(SpellEntry const *spellInfo_1, SpellEntry const *spellInfo_2, bool sameCaster) const
{
SpellSpecific spellSpec_1 = GetSpellSpecific(spellInfo_1->Id);
SpellSpecific spellSpec_2 = GetSpellSpecific(spellInfo_2->Id);
SpellSpecific spellSpec_1 = GetSpellSpecific(spellInfo_1);
SpellSpecific spellSpec_2 = GetSpellSpecific(spellInfo_2);
if (spellSpec_1 && spellSpec_2)
if (IsSingleFromSpellSpecificPerTarget(spellSpec_1, spellSpec_2)
|| sameCaster && IsSingleFromSpellSpecificPerCaster(spellSpec_1, spellSpec_2))
+1 -1
View File
@@ -187,7 +187,7 @@ enum SpellLinkedType
SPELL_LINK_REMOVE = 0,
};
SpellSpecific GetSpellSpecific(uint32 spellId);
SpellSpecific GetSpellSpecific(SpellEntry const * spellInfo);
AuraState GetSpellAuraState(SpellEntry const * spellInfo);
// Different spell properties
+10 -2
View File
@@ -6768,7 +6768,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
chance = 15.0f;
}
// Judgement (any)
else if (GetSpellSpecific(procSpell->Id) == SPELL_SPECIFIC_JUDGEMENT)
else if (GetSpellSpecific(procSpell) == SPELL_SPECIFIC_JUDGEMENT)
{
triggered_spell_id = 40472;
chance = 50.0f;
@@ -13828,7 +13828,15 @@ void Unit::SetStandState(uint8 state)
bool Unit::IsPolymorphed() const
{
return GetSpellSpecific(getTransForm())==SPELL_SPECIFIC_MAGE_POLYMORPH;
uint32 transformId = getTransForm();
if (!transformId)
return false;
const SpellEntry *spellInfo=sSpellStore.LookupEntry(transformId);
if (!spellInfo)
return false;
return GetSpellSpecific(spellInfo)==SPELL_SPECIFIC_MAGE_POLYMORPH;
}
void Unit::SetDisplayId(uint32 modelId)