Core/Spells: remove PrepareSpellScript and PrepareAuraScript macros and make Hooklist use emplace behaivior (#174)

This commit is contained in:
Warpten authored and GitHub committed 2020-08-28 15:40:26 +02:00
1 parent 677990a1b8
commit 2b2fc5fb8a
252 files changed
+3275 -7394

No files matched your search

@@ -422,8 +422,6 @@ class npc_crystal_shard : public CreatureScript
class spell_corborus_crystal_barrage_targeting : public SpellScript
{
PrepareSpellScript(spell_corborus_crystal_barrage_targeting);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_CRYSTAL_BARRAGE });
@@ -448,15 +446,13 @@ class spell_corborus_crystal_barrage_targeting : public SpellScript
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_corborus_crystal_barrage_targeting::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_corborus_crystal_barrage_targeting::HandleEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnObjectAreaTargetSelect.Register(&spell_corborus_crystal_barrage_targeting::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget.Register(&spell_corborus_crystal_barrage_targeting::HandleEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_corborus_crystal_barrage : public AuraScript
{
PrepareAuraScript(spell_corborus_crystal_barrage);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_CRYSTAL_BARRAGE_SHARD });
@@ -472,7 +468,7 @@ class spell_corborus_crystal_barrage : public AuraScript
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_corborus_crystal_barrage::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove.Register(&spell_corborus_crystal_barrage::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -566,8 +566,6 @@ class npc_azil_seismic_shard : public CreatureScript
class spell_azil_summon_wave_south : public SpellScript
{
PrepareSpellScript(spell_azil_summon_wave_south);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SUMMON_ADD_SOUTH });
@@ -582,14 +580,12 @@ class spell_azil_summon_wave_south : public SpellScript
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_azil_summon_wave_south::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHitTarget.Register(&spell_azil_summon_wave_south::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_azil_summon_wave_west : public SpellScript
{
PrepareSpellScript(spell_azil_summon_wave_west);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SUMMON_ADD_WEST });
@@ -604,14 +600,12 @@ class spell_azil_summon_wave_west : public SpellScript
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_azil_summon_wave_west::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHitTarget.Register(&spell_azil_summon_wave_west::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_azil_summon_follower : public SpellScript
{
PrepareSpellScript(spell_azil_summon_follower);
void SetDestPosition(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
@@ -627,7 +621,7 @@ class spell_azil_summon_follower : public SpellScript
void Register()
{
OnEffectLaunch += SpellEffectFn(spell_azil_summon_follower::SetDestPosition, EFFECT_0, SPELL_EFFECT_SUMMON);
OnEffectLaunch.Register(&spell_azil_summon_follower::SetDestPosition, EFFECT_0, SPELL_EFFECT_SUMMON);
}
};
@@ -645,8 +639,6 @@ public:
class spell_azil_gravity_well_damage_nearby : public SpellScript
{
PrepareSpellScript(spell_azil_gravity_well_damage_nearby);
void SetRadiusMod()
{
GetSpell()->SetSpellValue(SPELLVALUE_RADIUS_MOD, int32(GetCaster()->GetObjectScale() * 10000 * 2 / 3));
@@ -664,16 +656,14 @@ class spell_azil_gravity_well_damage_nearby : public SpellScript
void Register() override
{
BeforeCast += SpellCastFn(spell_azil_gravity_well_damage_nearby::SetRadiusMod);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_azil_gravity_well_damage_nearby::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_azil_gravity_well_damage_nearby::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
BeforeCast.Register(&spell_azil_gravity_well_damage_nearby::SetRadiusMod);
OnObjectAreaTargetSelect.Register(&spell_azil_gravity_well_damage_nearby::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget.Register(&spell_azil_gravity_well_damage_nearby::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_azil_gravity_well_damage : public SpellScript
{
PrepareSpellScript(spell_azil_gravity_well_damage);
void CalculateDamage(SpellEffIndex /*effIndex*/)
{
Unit* target = GetHitUnit();
@@ -690,14 +680,12 @@ class spell_azil_gravity_well_damage : public SpellScript
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_azil_gravity_well_damage::CalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
OnEffectHitTarget.Register(&spell_azil_gravity_well_damage::CalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
class spell_azil_gravity_well_pull : public SpellScript
{
PrepareSpellScript(spell_azil_gravity_well_pull);
void SetRadiusMod()
{
GetSpell()->SetSpellValue(SPELLVALUE_RADIUS_MOD, int32(GetCaster()->GetObjectScale() * 10000 * 2 / 3));
@@ -705,14 +693,12 @@ class spell_azil_gravity_well_pull : public SpellScript
void Register() override
{
BeforeCast += SpellCastFn(spell_azil_gravity_well_pull::SetRadiusMod);
BeforeCast.Register(&spell_azil_gravity_well_pull::SetRadiusMod);
}
};
class spell_azil_seismic_shard_change_seat : public SpellScript
{
PrepareSpellScript(spell_azil_seismic_shard_change_seat);
void ExitVehicle()
{
GetCaster()->ExitVehicle();
@@ -720,14 +706,12 @@ class spell_azil_seismic_shard_change_seat : public SpellScript
void Register() override
{
BeforeCast += SpellCastFn(spell_azil_seismic_shard_change_seat::ExitVehicle);
BeforeCast.Register(&spell_azil_seismic_shard_change_seat::ExitVehicle);
}
};
class spell_azil_seismic_shard : public SpellScript
{
PrepareSpellScript(spell_azil_seismic_shard);
void HandleScript(SpellEffIndex /*effIndex*/)
{
Creature* target = GetHitUnit()->ToCreature();
@@ -741,14 +725,12 @@ class spell_azil_seismic_shard : public SpellScript
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_azil_seismic_shard::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHitTarget.Register(&spell_azil_seismic_shard::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_azil_force_grip : public SpellScript
{
PrepareSpellScript(spell_azil_force_grip);
void HandleScript(SpellEffIndex effIndex)
{
if (Unit* caster = GetCaster())
@@ -763,14 +745,12 @@ class spell_azil_force_grip : public SpellScript
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_azil_force_grip::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHitTarget.Register(&spell_azil_force_grip::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_azil_force_grip_AuraScript : public AuraScript
{
PrepareAuraScript(spell_azil_force_grip_AuraScript);
void OnAuraRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget())
@@ -784,14 +764,12 @@ class spell_azil_force_grip_AuraScript : public AuraScript
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_azil_force_grip_AuraScript::OnAuraRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove.Register(&spell_azil_force_grip_AuraScript::OnAuraRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_azil_force_grip_change_seat : public SpellScript
{
PrepareSpellScript(spell_azil_force_grip_change_seat);
void HandleScript(SpellEffIndex effIndex)
{
if (Unit* caster = GetCaster())
@@ -801,7 +779,7 @@ class spell_azil_force_grip_change_seat : public SpellScript
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_azil_force_grip_change_seat::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHitTarget.Register(&spell_azil_force_grip_change_seat::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -185,8 +185,6 @@ class boss_ozruk : public CreatureScript
class spell_ozruk_rupture : public AuraScript
{
PrepareAuraScript(spell_ozruk_rupture);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_RUPTURE_SUMMON });
@@ -212,14 +210,12 @@ class spell_ozruk_rupture : public AuraScript
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ozruk_rupture::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
OnEffectPeriodic.Register(&spell_ozruk_rupture::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_ozuruk_rupture_summon : public SpellScript
{
PrepareSpellScript(spell_ozuruk_rupture_summon);
void SetDest(SpellDestination& dest)
{
Unit* caster = GetCaster();
@@ -238,14 +234,12 @@ class spell_ozuruk_rupture_summon : public SpellScript
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_ozuruk_rupture_summon::SetDest, EFFECT_0, TARGET_DEST_CASTER_FRONT);
OnDestinationTargetSelect.Register(&spell_ozuruk_rupture_summon::SetDest, EFFECT_0, TARGET_DEST_CASTER_FRONT);
}
};
class spell_ozruk_elementium_spike_shield : public SpellScript
{
PrepareSpellScript(spell_ozruk_elementium_spike_shield);
void HandleBouncerSpikes()
{
Unit* caster = GetCaster();
@@ -260,14 +254,12 @@ class spell_ozruk_elementium_spike_shield : public SpellScript
void Register() override
{
OnCast += SpellCastFn(spell_ozruk_elementium_spike_shield::HandleBouncerSpikes);
OnCast.Register(&spell_ozruk_elementium_spike_shield::HandleBouncerSpikes);
}
};
class spell_ozruk_paralyze : public SpellScript
{
PrepareSpellScript(spell_ozruk_paralyze);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_PARALYZE_STUN });
@@ -281,14 +273,12 @@ class spell_ozruk_paralyze : public SpellScript
void Register() override
{
OnHit += SpellHitFn(spell_ozruk_paralyze::HandleDummy);
OnHit.Register(&spell_ozruk_paralyze::HandleDummy);
}
};
class spell_ozruk_paralyze_stun : public AuraScript
{
PrepareAuraScript(spell_ozruk_paralyze_stun);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_PARALYZE_DAMAGE });
@@ -303,7 +293,7 @@ class spell_ozruk_paralyze_stun : public AuraScript
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_ozruk_paralyze_stun::OnAuraRemove, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove.Register(&spell_ozruk_paralyze_stun::OnAuraRemove, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -348,8 +348,6 @@ private:
class spell_slabhide_stalactite : public SpellScript
{
PrepareSpellScript(spell_slabhide_stalactite);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_STALACTITE_SUMMON_TRIGGER });
@@ -363,14 +361,12 @@ class spell_slabhide_stalactite : public SpellScript
void Register() override
{
OnHit += SpellHitFn(spell_slabhide_stalactite::SummonStalactiteTrigger);
OnHit.Register(&spell_slabhide_stalactite::SummonStalactiteTrigger);
}
};
class spell_slabhide_stalactite_summon : public SpellScript
{
PrepareSpellScript(spell_slabhide_stalactite_summon);
void SetDest(SpellDestination& dest)
{
dest.RelocateOffset({ 0.0f, 0.0f, 55.0f, 0.0f });
@@ -378,14 +374,12 @@ class spell_slabhide_stalactite_summon : public SpellScript
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_slabhide_stalactite_summon::SetDest, EFFECT_0, TARGET_DEST_CASTER_RANDOM);
OnDestinationTargetSelect.Register(&spell_slabhide_stalactite_summon::SetDest, EFFECT_0, TARGET_DEST_CASTER_RANDOM);
}
};
class spell_slabhide_stalactite_dest_relocation : public SpellScript
{
PrepareSpellScript(spell_slabhide_stalactite_dest_relocation);
void SetDest(SpellDestination& dest)
{
if (Unit* caster = GetCaster())
@@ -401,14 +395,12 @@ class spell_slabhide_stalactite_dest_relocation : public SpellScript
void Register()
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_slabhide_stalactite_dest_relocation::SetDest, EFFECT_0, TARGET_DEST_CASTER);
OnDestinationTargetSelect.Register(&spell_slabhide_stalactite_dest_relocation::SetDest, EFFECT_0, TARGET_DEST_CASTER);
}
};
class spell_slabhide_crystal_storm_periodic : public SpellScript
{
PrepareSpellScript(spell_slabhide_crystal_storm_periodic);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_CRYSTAL_STORM });
@@ -422,7 +414,7 @@ class spell_slabhide_crystal_storm_periodic : public SpellScript
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_slabhide_crystal_storm_periodic::HandleDummy, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
OnEffectHitTarget.Register(&spell_slabhide_crystal_storm_periodic::HandleDummy, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
};
@@ -258,8 +258,6 @@ class spell_force_of_earth : public SpellScriptLoader
class spell_force_of_earth_SpellScript : public SpellScript
{
PrepareSpellScript(spell_force_of_earth_SpellScript);
void DummyEffect(SpellEffIndex /*effIndex*/)
{
GetCaster()->SetDisplayId(26693); // can be moved to SAI part, need sniffs to see what this dummy does (note: npc 43552)
@@ -267,7 +265,7 @@ class spell_force_of_earth : public SpellScriptLoader
void Register()
{
OnEffectLaunch += SpellEffectFn(spell_force_of_earth_SpellScript::DummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
OnEffectLaunch.Register(&spell_force_of_earth_SpellScript::DummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -285,9 +283,7 @@ public:
class spell_sc_anchor_here_SpellScript : public SpellScript
{
PrepareSpellScript(spell_sc_anchor_here_SpellScript);
void HandleScript(SpellEffIndex /*effIndex*/)
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Creature* creature = GetHitUnit()->ToCreature())
creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
@@ -295,7 +291,7 @@ public:
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_sc_anchor_here_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHitTarget.Register(&spell_sc_anchor_here_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -313,8 +309,6 @@ class spell_sc_twilight_documents : public SpellScriptLoader
class spell_sc_twilight_documents_SpellScript : public SpellScript
{
PrepareSpellScript(spell_sc_twilight_documents_SpellScript);
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sObjectMgr->GetGameObjectTemplate(GAMEOBJECT_TWILIGHT_DOCUMENTS))
@@ -330,7 +324,7 @@ class spell_sc_twilight_documents : public SpellScriptLoader
void Register() override
{
OnEffectHit += SpellEffectFn(spell_sc_twilight_documents_SpellScript::SpawnGameObject, EFFECT_0, SPELL_EFFECT_DUMMY);
OnEffectHit.Register(&spell_sc_twilight_documents_SpellScript::SpawnGameObject, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -362,8 +356,6 @@ class spell_sc_quake : public SpellScriptLoader
class spell_sc_quake_SpellScript : public SpellScript
{
PrepareSpellScript(spell_sc_quake_SpellScript);
void FilterTargets(std::list<WorldObject*>& unitList)
{
unitList.remove_if(JumpCheck());
@@ -371,7 +363,7 @@ class spell_sc_quake : public SpellScriptLoader
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sc_quake_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect.Register(&spell_sc_quake_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
@@ -383,8 +375,6 @@ class spell_sc_quake : public SpellScriptLoader
class spell_sc_ring_wyrm_knockback : public SpellScript
{
PrepareSpellScript(spell_sc_ring_wyrm_knockback);
void SetDest(SpellDestination& dest)
{
Unit* caster = GetCaster();
@@ -398,7 +388,7 @@ class spell_sc_ring_wyrm_knockback : public SpellScript
void Register()
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_sc_ring_wyrm_knockback::SetDest, EFFECT_0, TARGET_DEST_CASTER_RANDOM);
OnDestinationTargetSelect.Register(&spell_sc_ring_wyrm_knockback::SetDest, EFFECT_0, TARGET_DEST_CASTER_RANDOM);
}
};