*Add AuraScript class for scripting aura objects - scripts are registered same way as SpellScripts, bound to SpellScriptNames table. For more details see example_spell.cpp and SpellScript.h

*Rename SpellHandlerScript to SpellScriptLoader, EffectHandlerFn to SpellEffectFn, HitHandlerFn to SpellHitFn, SpellScript::EffectHandlers to SpellScript::OnEffect, these changes were neccesary to prevent namespace collisions, happily you can solve these by simple find and replace
*Make spells 66244 and 5581 example scripts.

--HG--
branch : trunk
This commit is contained in:
QAston
2010-08-24 00:10:49 +02:00
parent e581feb551
commit 07a3a1254b
28 changed files with 1075 additions and 291 deletions
@@ -737,6 +737,8 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellProto());
amount += (int32)DoneActualBenefit;
}
GetBase()->CallScriptEffectCalcAmountHandlers(const_cast<AuraEffect const *>(this), amount, m_canBeRecalculated);
amount *= GetBase()->GetStackAmount();
return amount;
}
@@ -787,6 +789,8 @@ void AuraEffect::CalculatePeriodic(Unit * caster, bool create)
break;
}
GetBase()->CallScriptEffectCalcPeriodicHandlers(const_cast<AuraEffect const *>(this), m_isPeriodic, m_amplitude);
if (!m_isPeriodic)
return;
@@ -907,6 +911,7 @@ void AuraEffect::CalculateSpellMod()
default:
break;
}
GetBase()->CallScriptEffectCalcSpellModHandlers(const_cast<AuraEffect const *>(this), m_spellmod);
}
void AuraEffect::ChangeAmount(int32 newAmount, bool mark)
@@ -946,7 +951,14 @@ void AuraEffect::HandleEffect(AuraApplication const * aurApp, uint8 mode, bool a
if (mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK)
ApplySpellMod(aurApp->GetTarget(), apply);
(*this.*AuraEffectHandler [GetAuraType()])(aurApp, mode, apply);
bool prevented = false;
if (apply)
prevented = GetBase()->CallScriptEffectApplyHandlers(const_cast<AuraEffect const *>(this), aurApp, (AuraEffectHandleModes)mode);
else
prevented = GetBase()->CallScriptEffectRemoveHandlers(const_cast<AuraEffect const *>(this), aurApp, (AuraEffectHandleModes)mode);
if (!prevented)
(*this.*AuraEffectHandler [GetAuraType()])(aurApp, mode, apply);
}
void AuraEffect::HandleEffect(Unit * target, uint8 mode, bool apply)
@@ -1203,6 +1215,7 @@ void AuraEffect::UpdatePeriodic(Unit * caster)
default:
break;
}
GetBase()->CallScriptEffectUpdatePeriodicHandlers(this);
}
bool AuraEffect::IsPeriodicTickCrit(Unit * target, Unit const * caster) const
@@ -1244,6 +1257,10 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
return;
}
bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(const_cast<AuraEffect const *>(this), GetBase()->GetApplicationOfTarget(target->GetGUID()));
if (prevented)
return;
switch(GetAuraType())
{
case SPELL_AURA_PERIODIC_DAMAGE: