aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Examples
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts/Examples')
-rw-r--r--src/server/scripts/Examples/example_spell.cpp100
1 files changed, 83 insertions, 17 deletions
diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp
index 42f10329afd..8d44cb92a4d 100644
--- a/src/server/scripts/Examples/example_spell.cpp
+++ b/src/server/scripts/Examples/example_spell.cpp
@@ -144,7 +144,7 @@ class spell_ex_66244 : public SpellScriptLoader
// checks if script has data required for it to work
bool Validate(SpellEntry const * /*spellEntry*/)
{
- // check if spellid 70522 exists in dbc, we will trigger it later
+ // check if spellid exists in dbc, we will trigger it later
if (!sSpellStore.LookupEntry(SPELL_TRIGGERED))
return false;
return true;
@@ -161,18 +161,18 @@ class spell_ex_66244 : public SpellScriptLoader
return false;
}
- void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp, AuraEffectHandleModes /*mode*/)
+ void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
sLog->outString("Aura Effect is about to be applied on target!");
- Unit * target = aurApp->GetTarget();
+ Unit * target = GetTarget();
// cast spell on target on aura apply
target->CastSpell(target, SPELL_TRIGGERED, true);
}
- void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp, AuraEffectHandleModes /*mode*/)
+ void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
sLog->outString("Aura Effect is just removed on target!");
- Unit * target = aurApp->GetTarget();
+ Unit * target = GetTarget();
Unit * caster = GetCaster();
// caster may be not avalible (logged out for example)
if (!caster)
@@ -181,10 +181,10 @@ class spell_ex_66244 : public SpellScriptLoader
target->CastSpell(caster, SPELL_TRIGGERED, true);
}
- void HandleEffectPeriodic(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp)
+ void HandleEffectPeriodic(AuraEffect const * /*aurEff*/)
{
sLog->outString("Perioidic Aura Effect is does a tick on target!");
- Unit * target = aurApp->GetTarget();
+ Unit * target = GetTarget();
// aura targets damage self on tick
target->DealDamage(target, 100);
}
@@ -199,7 +199,7 @@ class spell_ex_66244 : public SpellScriptLoader
void HandleEffectCalcAmount(AuraEffect const * /*aurEff*/, int32 & amount, bool & canBeRecalculated)
{
sLog->outString("Amount of Aura Effect is being calculated now!");
- // we're setting amount to 0
+ // we're setting amount to 100
amount = 100;
// amount will be never recalculated due to applying passive aura
canBeRecalculated = false;
@@ -213,7 +213,7 @@ class spell_ex_66244 : public SpellScriptLoader
amplitude = 2 * IN_MILLISECONDS;
}
- void HandleEffectCalcSpellMod(AuraEffect * const /*aurEff*/, SpellModifier *& spellMod)
+ void HandleEffectCalcSpellMod(AuraEffect const * /*aurEff*/, SpellModifier *& spellMod)
{
sLog->outString("SpellMod data of Aura Effect is being calculated now!");
// we don't want spellmod for example
@@ -242,10 +242,25 @@ class spell_ex_66244 : public SpellScriptLoader
OnEffectRemove += AuraEffectRemoveFn(spell_ex_66244AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ex_66244AuraScript::HandleEffectPeriodic,EFFECT_0, SPELL_AURA_DUMMY);
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_ex_66244AuraScript::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_DUMMY);
- OnEffectCalcAmount += AuraEffectCalcAmountFn(spell_ex_66244AuraScript::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_DUMMY);
- OnEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_ex_66244AuraScript::HandleEffectCalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
- OnEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_ex_66244AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_ex_66244AuraScript::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_DUMMY);
+ DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_ex_66244AuraScript::HandleEffectCalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
+ DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_ex_66244AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY);
+ /*OnApply += AuraEffectApplyFn();
+ OnRemove += AuraEffectRemoveFn();
+ DoCheckAreaTarget += AuraCheckAreaTargetFn();*/
+ }
+ /*
+ void OnApply()
+ {
+ }
+
+ void OnRemove()
+ {
}
+
+ bool DoCheckAreaTarget(Unit * proposedTarget)
+ {
+ }*/
};
// function which creates AuraScript
@@ -253,6 +268,56 @@ class spell_ex_66244 : public SpellScriptLoader
{
return new spell_ex_66244AuraScript();
}
+
+
+};
+
+class spell_ex_absorb_aura : public SpellScriptLoader
+{
+ public:
+ spell_ex_absorb_aura() : SpellScriptLoader("spell_ex_absorb_aura") { }
+
+ class spell_ex_absorb_auraAuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_ex_absorb_auraAuraScript)
+ enum Spells
+ {
+ SPELL_TRIGGERED = 18282
+ };
+
+ bool Validate(SpellEntry const * /*spellEntry*/)
+ {
+ // check if spellid exists in dbc, we will trigger it later
+ if (!sSpellStore.LookupEntry(SPELL_TRIGGERED))
+ return false;
+ return true;
+ }
+
+ void HandleOnEffectAbsorb(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
+ {
+ sLog->outString("Our aura is now absorbing damage done to us!");
+ // absorb whole damage done to us
+ absorbAmount = dmgInfo.GetDamage();
+ }
+
+ /*void HandleAfterAbsorb(DamageInfo & dmgInfo)
+ {
+ sLog->outString("Our auras have just absorbed damage done to us!");
+ }*/
+
+ // function registering
+ void Register()
+ {
+ OnEffectAbsorb += AuraEffectAbsorbFn(spell_ex_absorb_auraAuraScript::HandleOnEffectAbsorb, EFFECT_0);
+ //AfterAbsorb += AuraAbsorbFn(spell_ex_absorb_auraAuraScript::HandleAfterAbsorb);
+ }
+ };
+
+ // function which creates AuraScript
+ AuraScript *GetAuraScript() const
+ {
+ return new spell_ex_absorb_auraAuraScript();
+ }
};
@@ -261,6 +326,7 @@ void AddSC_example_spell_scripts()
{
new spell_ex_5581;
new spell_ex_66244;
+ new spell_ex_absorb_aura;
}
/* empty script for copypasting
@@ -303,13 +369,13 @@ class spell_ex : public SpellScriptLoader
//bool Load(){return true;}
//void Unload(){}
- //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode) //OnEffectApply += AuraEffectApplyFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
- //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode) //OnEffectRemove += AuraEffectRemoveFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
- //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, AuraApplication const * aurApp) //OnEffectPeriodic += AuraEffectPeriodicFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
+ //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, AuraEffectHandleModes mode) //OnEffectApply += AuraEffectApplyFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
+ //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, AuraEffectHandleModes mode) //OnEffectRemove += AuraEffectRemoveFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
+ //void spell_ex_SpellScript::Function(AuraEffect const * aurEff) //OnEffectPeriodic += AuraEffectPeriodicFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
//void spell_ex_SpellScript::Function(AuraEffect * aurEff) //OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
- //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, int32 & amount, bool & canBeRecalculated) //OnEffectCalcAmount += AuraEffectCalcAmountFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
+ //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, int32 & amount, bool & canBeRecalculated) //DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
//void spell_ex_SpellScript::Function(AuraEffect const * aurEff, bool & isPeriodic, int32 & amplitude) //OnEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
- //void spell_ex_SpellScript::Function(AuraEffect * const aurEff, SpellModifier *& spellMod) //OnEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
+ //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, SpellModifier *& spellMod) //OnEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
void Register()
{
}