mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 16:37:00 +00:00
[8894] Add missing and avoid redundent Aura::GetCaster calls.
This commit is contained in:
parent
e920c783f3
commit
1e3100d664
2 changed files with 50 additions and 34 deletions
|
|
@ -2209,8 +2209,6 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
if(!Real)
|
if(!Real)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Unit* caster = GetCaster();
|
|
||||||
|
|
||||||
// AT APPLY
|
// AT APPLY
|
||||||
if(apply)
|
if(apply)
|
||||||
{
|
{
|
||||||
|
|
@ -2218,12 +2216,13 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
{
|
{
|
||||||
case 1515: // Tame beast
|
case 1515: // Tame beast
|
||||||
// FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
|
// FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
|
||||||
if( caster && m_target->CanHaveThreatList())
|
if (m_target->CanHaveThreatList())
|
||||||
m_target->AddThreat(caster, 10.0f, false, GetSpellSchoolMask(GetSpellProto()), GetSpellProto());
|
if (Unit* caster = GetCaster())
|
||||||
|
m_target->AddThreat(caster, 10.0f, false, GetSpellSchoolMask(GetSpellProto()), GetSpellProto());
|
||||||
return;
|
return;
|
||||||
case 13139: // net-o-matic
|
case 13139: // net-o-matic
|
||||||
// root to self part of (root_target->charge->root_self sequence
|
// root to self part of (root_target->charge->root_self sequence
|
||||||
if(caster)
|
if (Unit* caster = GetCaster())
|
||||||
caster->CastSpell(caster, 13138, true, NULL, this);
|
caster->CastSpell(caster, 13138, true, NULL, this);
|
||||||
return;
|
return;
|
||||||
case 39850: // Rocket Blast
|
case 39850: // Rocket Blast
|
||||||
|
|
@ -2234,7 +2233,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
m_target->PlayDistanceSound(11965);
|
m_target->PlayDistanceSound(11965);
|
||||||
return;
|
return;
|
||||||
case 46354: // Blood Elf Illusion
|
case 46354: // Blood Elf Illusion
|
||||||
if(caster)
|
if (Unit* caster = GetCaster())
|
||||||
{
|
{
|
||||||
switch(caster->getGender())
|
switch(caster->getGender())
|
||||||
{
|
{
|
||||||
|
|
@ -2256,11 +2255,12 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Earth Shield
|
// Earth Shield
|
||||||
if ( caster && GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x40000000000)))
|
if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x40000000000)))
|
||||||
{
|
{
|
||||||
// prevent double apply bonuses
|
// prevent double apply bonuses
|
||||||
if(m_target->GetTypeId() != TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading())
|
if(m_target->GetTypeId() != TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading())
|
||||||
m_modifier.m_amount = caster->SpellHealingBonus(m_target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE);
|
if (Unit* caster = GetCaster())
|
||||||
|
m_modifier.m_amount = caster->SpellHealingBonus(m_target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2278,8 +2278,12 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (IsQuestTameSpell(GetId())) && caster && caster->isAlive() && m_target->isAlive())
|
if (IsQuestTameSpell(GetId()) && m_target->isAlive())
|
||||||
{
|
{
|
||||||
|
Unit* caster = GetCaster();
|
||||||
|
if (!caster || !caster->isAlive())
|
||||||
|
return;
|
||||||
|
|
||||||
uint32 finalSpelId = 0;
|
uint32 finalSpelId = 0;
|
||||||
switch(GetId())
|
switch(GetId())
|
||||||
{
|
{
|
||||||
|
|
@ -2340,20 +2344,22 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (caster && m_removeMode == AURA_REMOVE_BY_DEATH)
|
if (m_removeMode == AURA_REMOVE_BY_DEATH)
|
||||||
{
|
{
|
||||||
// Stop caster Arcane Missle chanelling on death
|
// Stop caster Arcane Missle chanelling on death
|
||||||
if (m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE &&
|
if (m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE &&
|
||||||
(m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000800)))
|
(m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000800)))
|
||||||
{
|
{
|
||||||
caster->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
if (Unit* caster = GetCaster())
|
||||||
|
caster->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Stop caster Penance chanelling on death
|
// Stop caster Penance chanelling on death
|
||||||
if (m_spellProto->SpellFamilyName == SPELLFAMILY_PRIEST &&
|
if (m_spellProto->SpellFamilyName == SPELLFAMILY_PRIEST &&
|
||||||
(m_spellProto->SpellFamilyFlags2 & UI64LIT(0x00000080)))
|
(m_spellProto->SpellFamilyFlags2 & UI64LIT(0x00000080)))
|
||||||
{
|
{
|
||||||
caster->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
if (Unit* caster = GetCaster())
|
||||||
|
caster->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2376,14 +2382,15 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
case 24658:
|
case 24658:
|
||||||
{
|
{
|
||||||
uint32 spellId = 24659;
|
uint32 spellId = 24659;
|
||||||
if (apply && caster)
|
if (apply)
|
||||||
{
|
{
|
||||||
const SpellEntry *spell = sSpellStore.LookupEntry(spellId);
|
SpellEntry const *spell = sSpellStore.LookupEntry(spellId);
|
||||||
if (!spell)
|
Unit* caster = GetCaster();
|
||||||
|
if (!spell || !caster)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i=0; i < spell->StackAmount; ++i)
|
for (int i=0; i < spell->StackAmount; ++i)
|
||||||
caster->CastSpell(m_target, spell->Id, true, NULL, NULL, GetCasterGUID());
|
caster->CastSpell(m_target, spellId, true, NULL, NULL, GetCasterGUID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_target->RemoveAurasDueToSpell(spellId);
|
m_target->RemoveAurasDueToSpell(spellId);
|
||||||
|
|
@ -2393,10 +2400,11 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
case 24661:
|
case 24661:
|
||||||
{
|
{
|
||||||
uint32 spellId = 24662;
|
uint32 spellId = 24662;
|
||||||
if (apply && caster)
|
if (apply)
|
||||||
{
|
{
|
||||||
const SpellEntry *spell = sSpellStore.LookupEntry(spellId);
|
SpellEntry const* spell = sSpellStore.LookupEntry(spellId);
|
||||||
if (!spell)
|
Unit* caster = GetCaster();
|
||||||
|
if (!spell || !caster)
|
||||||
return;
|
return;
|
||||||
for (int i=0; i < spell->StackAmount; ++i)
|
for (int i=0; i < spell->StackAmount; ++i)
|
||||||
caster->CastSpell(m_target, spell->Id, true, NULL, NULL, GetCasterGUID());
|
caster->CastSpell(m_target, spell->Id, true, NULL, NULL, GetCasterGUID());
|
||||||
|
|
@ -2408,6 +2416,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
//Summon Fire Elemental
|
//Summon Fire Elemental
|
||||||
case 40133:
|
case 40133:
|
||||||
{
|
{
|
||||||
|
Unit* caster = GetCaster();
|
||||||
if (!caster)
|
if (!caster)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -2424,6 +2433,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
//Summon Earth Elemental
|
//Summon Earth Elemental
|
||||||
case 40132 :
|
case 40132 :
|
||||||
{
|
{
|
||||||
|
Unit* caster = GetCaster();
|
||||||
if (!caster)
|
if (!caster)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -2499,7 +2509,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int32 bp0 = m_modifier.m_amount;
|
int32 bp0 = m_modifier.m_amount;
|
||||||
m_target->CastCustomSpell(caster,48210,&bp0,NULL,NULL,true);
|
|
||||||
|
if (Unit* caster = GetCaster())
|
||||||
|
m_target->CastCustomSpell(caster,48210,&bp0,NULL,NULL,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2586,7 +2598,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
{
|
{
|
||||||
if ( apply )
|
if ( apply )
|
||||||
{
|
{
|
||||||
if ( caster )
|
if (Unit* caster = GetCaster())
|
||||||
// prevent double apply bonuses
|
// prevent double apply bonuses
|
||||||
if(m_target->GetTypeId()!=TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading())
|
if(m_target->GetTypeId()!=TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading())
|
||||||
m_modifier.m_amount = caster->SpellHealingBonus(m_target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE);
|
m_modifier.m_amount = caster->SpellHealingBonus(m_target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE);
|
||||||
|
|
@ -2610,7 +2622,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
int32 amount = m_modifier.m_amount / m_stackAmount;
|
int32 amount = m_modifier.m_amount / m_stackAmount;
|
||||||
m_target->CastCustomSpell(m_target, 33778, &amount, NULL, NULL, true, NULL, this, GetCasterGUID());
|
m_target->CastCustomSpell(m_target, 33778, &amount, NULL, NULL, true, NULL, this, GetCasterGUID());
|
||||||
|
|
||||||
if (caster)
|
if (Unit* caster = GetCaster())
|
||||||
{
|
{
|
||||||
int32 returnmana = (GetSpellProto()->ManaCostPercentage * caster->GetCreateMana() / 100) * m_stackAmount / 2;
|
int32 returnmana = (GetSpellProto()->ManaCostPercentage * caster->GetCreateMana() / 100) * m_stackAmount / 2;
|
||||||
caster->CastCustomSpell(caster, 64372, &returnmana, NULL, NULL, true, NULL, this, GetCasterGUID());
|
caster->CastCustomSpell(caster, 64372, &returnmana, NULL, NULL, true, NULL, this, GetCasterGUID());
|
||||||
|
|
@ -3269,9 +3281,7 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real)
|
||||||
{
|
{
|
||||||
if(Real && !apply)
|
if(Real && !apply)
|
||||||
{
|
{
|
||||||
Unit* caster = GetCaster();
|
if(m_removeMode != AURA_REMOVE_BY_DEATH)
|
||||||
Unit* victim = GetTarget();
|
|
||||||
if(!caster || caster->GetTypeId() != TYPEID_PLAYER || !victim || m_removeMode != AURA_REMOVE_BY_DEATH)
|
|
||||||
return;
|
return;
|
||||||
// Item amount
|
// Item amount
|
||||||
if (m_modifier.m_amount <= 0)
|
if (m_modifier.m_amount <= 0)
|
||||||
|
|
@ -3281,6 +3291,11 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real)
|
||||||
if(spellInfo->EffectItemType[m_effIndex] == 0)
|
if(spellInfo->EffectItemType[m_effIndex] == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Unit* victim = GetTarget();
|
||||||
|
Unit* caster = GetCaster();
|
||||||
|
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
return;
|
||||||
|
|
||||||
// Soul Shard only from non-grey units
|
// Soul Shard only from non-grey units
|
||||||
if( spellInfo->EffectItemType[m_effIndex] == 6265 &&
|
if( spellInfo->EffectItemType[m_effIndex] == 6265 &&
|
||||||
(victim->getLevel() <= MaNGOS::XP::GetGrayLevel(caster->getLevel()) ||
|
(victim->getLevel() <= MaNGOS::XP::GetGrayLevel(caster->getLevel()) ||
|
||||||
|
|
@ -4437,20 +4452,21 @@ void Aura::HandlePeriodicEnergize(bool apply, bool Real)
|
||||||
{
|
{
|
||||||
case 54833: // Glyph of Innervate (value%/2 of casters base mana)
|
case 54833: // Glyph of Innervate (value%/2 of casters base mana)
|
||||||
{
|
{
|
||||||
Unit* caster = GetCaster();
|
if (Unit* caster = GetCaster())
|
||||||
m_modifier.m_amount = int32(caster->GetCreateMana() * GetBasePoints() / (200 * m_maxduration / m_periodicTimer));
|
m_modifier.m_amount = int32(caster->GetCreateMana() * GetBasePoints() / (200 * m_maxduration / m_periodicTimer));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
case 29166: // Innervate (value% of casters base mana)
|
case 29166: // Innervate (value% of casters base mana)
|
||||||
{
|
{
|
||||||
Unit* caster = GetCaster();
|
if (Unit* caster = GetCaster())
|
||||||
|
{
|
||||||
|
// Glyph of Innervate
|
||||||
|
if (caster->HasAura(54832))
|
||||||
|
caster->CastSpell(caster,54833,true,NULL,this);
|
||||||
|
|
||||||
// Glyph of Innervate
|
m_modifier.m_amount = int32(caster->GetCreateMana() * GetBasePoints() / (100 * m_maxduration / m_periodicTimer));
|
||||||
if (caster && caster->HasAura(54832))
|
}
|
||||||
caster->CastSpell(caster,54833,true,NULL,this);
|
|
||||||
|
|
||||||
m_modifier.m_amount = int32(caster->GetCreateMana() * GetBasePoints() / (100 * m_maxduration / m_periodicTimer));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 48391: // Owlkin Frenzy 2% base mana
|
case 48391: // Owlkin Frenzy 2% base mana
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8893"
|
#define REVISION_NR "8894"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue