aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Spells
diff options
context:
space:
mode:
authorOvahlord <dreadkiller@gmx.de>2024-04-27 19:04:10 +0200
committerOvahlord <dreadkiller@gmx.de>2024-05-28 16:45:30 +0200
commitcbc6aed4375d4f06cd22a1a86dfe1cd9913cde5e (patch)
tree1722fee4a870da4753cf6e620b17dbb731d51e8f /src/server/scripts/Spells
parent4de67994030ce9248324b1a86effa6bded506f40 (diff)
Core/Auras: Implemented OnHeartbeat AuraScript hook and refactored an aurascript to use it as example (#29945)
* Updated Amalgam's Seventh Spine dummy aura script to use the new AuraScript hook (cherry picked from commit 55ce5b150f716b6d470af80a9c31adf78e4cc198)
Diffstat (limited to 'src/server/scripts/Spells')
-rw-r--r--src/server/scripts/Spells/spell_item.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index f0c1e460815..1bc95391071 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -4326,17 +4326,9 @@ class spell_item_amalgams_seventh_spine : public AuraScript
});
}
- void ForcePeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
+ void UpdateSpecAura()
{
- // simulate heartbeat timer
- isPeriodic = true;
- amplitude = 5000;
- }
-
- void UpdateSpecAura(AuraEffect const* aurEff)
- {
- PreventDefaultAction();
- Player* target = GetTarget()->ToPlayer();
+ Player* target = GetUnitOwner()->ToPlayer();
if (!target)
return;
@@ -4345,7 +4337,7 @@ class spell_item_amalgams_seventh_spine : public AuraScript
if (target->GetPrimarySpecialization() != spec)
target->RemoveAurasDueToSpell(aura);
else if (!target->HasAura(aura))
- target->CastSpell(target, aura, aurEff);
+ target->CastSpell(target, aura, GetEffect(EFFECT_0));
};
switch (target->GetClass())
@@ -4373,8 +4365,7 @@ class spell_item_amalgams_seventh_spine : public AuraScript
void Register() override
{
- DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_item_amalgams_seventh_spine::ForcePeriodic, EFFECT_0, SPELL_AURA_DUMMY);
- OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_amalgams_seventh_spine::UpdateSpecAura, EFFECT_0, SPELL_AURA_DUMMY);
+ OnHeartbeat += AuraHeartbeatFn(spell_item_amalgams_seventh_spine::UpdateSpecAura);
}
};