Skip to content

Commit

Permalink
refactor(Scripts/Northrend): dungeons Spell Scripts registry macros (#…
Browse files Browse the repository at this point in the history
…19134)

* instance_azjol_nerub spell:spell_azjol_nerub_fixate

* instance_azjol_nerub aura:spell_azjol_nerub_web_wrap_aura

* boss_hadronox aura:spell_hadronox_summon_periodic_aura

* boss_hadronox aura:spell_hadronox_leech_poison_aura

* boss_argent_challenge spell:spell_eadric_radiance

* boss_argent_challenge spell:spell_toc5_light_rain

* boss_argent_challenge aura:spell_reflective_shield_aura

* fixup! boss_argent_challenge aura:spell_reflective_shield_aura

* instance_drak_tharon_keep aura:spell_dtk_raise_dead_aura

* instance_drak_tharon_keep spell:spell_dtk_summon_random_drakkari

* boss_trollgore spell:spell_trollgore_consume

* boss_trollgore aura:spell_trollgore_corpse_explode_aura

* boss_trollgore spell:spell_trollgore_invader_taunt

* boss_novos spell:spell_novos_despawn_crystal_handler

* boss_novos aura:spell_novos_crystal_handler_death_aura

* boss_novos spell:spell_novos_summon_minions

* boss_tharon_ja aura:spell_tharon_ja_curse_of_life_aura

* boss_tharon_ja aura:spell_tharon_ja_dummy_aura

* boss_tharon_ja spell:spell_tharon_ja_clear_gift_of_tharon_ja

* boss_dred aura:spell_dred_grievious_bite_aura

* boss_dred spell:spell_dred_raptor_call

* boss_moorabi aura:spell_moorabi_mojo_frenzy_aura

* boss_slad_ran aura:spell_sladran_grip_of_sladran_aura

* boss_drakkari_colossus spell:spell_drakkari_colossus_emerge

* boss_drakkari_colossus spell:spell_drakkari_colossus_surge

* boss_drakkari_colossus spell:spell_drakkari_colossus_face_me

* boss_gal_darah spell:spell_galdarah_impaling_charge

* boss_gal_darah spell:spell_galdarah_transform

* boss_malygos spell:spell_eoe_ph3_surge_of_power

* oculus aura:spell_oculus_stop_time_aura

* oculus aura:spell_oculus_evasive_maneuvers_aura

* oculus spell:spell_oculus_shock_lance

* oculus aura:spell_oculus_temporal_rift_aura

* oculus spell:spell_oculus_touch_the_nightmare

* oculus aura:spell_oculus_dream_funnel_aura

* oculus spell:spell_oculus_call_ruby_emerald_amber_drake

* oculus aura:spell_oculus_ride_ruby_emerald_amber_drake_que_aura

* oculus aura:spell_oculus_evasive_charges_aura

* oculus aura:spell_oculus_soar_aura

* oculus aura:spell_oculus_rider_aura

* oculus aura:spell_oculus_drake_flag_aura

* boss_magus_telestra aura:spell_boss_magus_telestra_summon_telestra_clones_aura

* boss_magus_telestra spell:spell_boss_magus_telestra_gravity_well

* utgarde_keep aura:spell_ticking_time_bomb_aura

* boss_keleseth aura:spell_frost_tomb_aura

* boss_svala pair:spell_svala_ritual_strike

* boss_moragg aura:spell_optic_link_aura

* violet_hold aura:spell_destroy_door_seal_aura

* forge_of_souls aura:spell_shield_of_bones_aura

* boss_devourer_of_souls aura:spell_wailing_souls_periodic_aura

* boss_bronjahm spell:spell_bronjahm_magic_bane

* boss_bronjahm aura:spell_bronjahm_soulstorm_channel_ooc_aura

* boss_bronjahm aura:spell_bronjahm_soulstorm_visual_aura

* boss_bronjahm spell:spell_bronjahm_soulstorm_targeting

* boss_krickandick aura:spell_krick_explosive_barrage_aura

* boss_krickandick aura:spell_exploding_orb_auto_grow_aura

* pit_of_saron aura:spell_pos_empowered_blizzard_aura

* pit_of_saron spell:spell_pos_slave_trigger_closest

* pit_of_saron spell:spell_pos_rimefang_frost_nova

* pit_of_saron aura:spell_pos_blight_aura

* pit_of_saron aura:spell_pos_glacial_strike_aura

* boss_forgemaster_garfrost spell:spell_garfrost_permafrost

* halls_of_reflection aura:spell_hor_gunship_cannon_fire_aura

* boss_marwyn aura:spell_hor_shared_suffering_aura

* fixup! forge_of_souls aura:spell_shield_of_bones_aura

* fixup! boss_bronjahm aura:spell_bronjahm_soulstorm_channel_ooc_aura

* fixup! boss_bronjahm aura:spell_bronjahm_soulstorm_visual_aura

* fixup! pit_of_saron aura:spell_pos_empowered_blizzard_aura

* fixup! halls_of_reflection aura:spell_hor_gunship_cannon_fire_aura

* fixup! boss_marwyn aura:spell_hor_shared_suffering_aura
  • Loading branch information
sogladev authored Jun 23, 2024
1 parent b055faf commit cd9dff5
Show file tree
Hide file tree
Showing 29 changed files with 1,177 additions and 1,660 deletions.
37 changes: 37 additions & 0 deletions data/sql/updates/pending_db_world/rev_1719137457631116516.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--
UPDATE `spell_script_names` SET `ScriptName`='spell_azjol_nerub_web_wrap_aura' WHERE `spell_id`=52086;
UPDATE `spell_script_names` SET `ScriptName`='spell_hadronox_summon_periodic_crypt_fiend_aura' WHERE `spell_id`=53037;
UPDATE `spell_script_names` SET `ScriptName`='spell_hadronox_leech_poison_aura' WHERE `spell_id` IN (53030,59417);
UPDATE `spell_script_names` SET `ScriptName`='spell_reflective_shield_aura' WHERE `spell_id`=66515;
UPDATE `spell_script_names` SET `ScriptName`='spell_dtk_raise_dead_aura' WHERE `spell_id` IN (48597,48605);
UPDATE `spell_script_names` SET `ScriptName`='spell_trollgore_corpse_explode_aura' WHERE `spell_id` IN (49555,59807);
UPDATE `spell_script_names` SET `ScriptName`='spell_novos_crystal_handler_death_aura' WHERE `spell_id`=47336;
UPDATE `spell_script_names` SET `ScriptName`='spell_tharon_ja_curse_of_life_aura' WHERE `spell_id` IN (49527,59972);
UPDATE `spell_script_names` SET `ScriptName`='spell_tharon_ja_dummy_aura' WHERE `spell_id`=49551;
UPDATE `spell_script_names` SET `ScriptName`='spell_dred_grievious_bite_aura' WHERE `spell_id`=48920;
UPDATE `spell_script_names` SET `ScriptName`='spell_moorabi_mojo_frenzy_aura' WHERE `spell_id`=55163;
UPDATE `spell_script_names` SET `ScriptName`='spell_sladran_grip_of_sladran_aura' WHERE `spell_id`=55093;
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_stop_time_aura' WHERE `spell_id`=49838;
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_evasive_maneuvers_aura' WHERE `spell_id`=50240;
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_temporal_rift_aura' WHERE `spell_id`=49592;
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_dream_funnel_aura' WHERE `spell_id`=50344;
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_ride_ruby_emerald_amber_drake_que_aura' WHERE `spell_id` IN (49427,49459,49463);
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_evasive_charges_aura' WHERE `spell_id`=50241;
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_soar_aura' WHERE `spell_id`=50325;
UPDATE `spell_script_names` SET `ScriptName`='spell_oculus_drake_flag_aura' WHERE `spell_id`=53797;
UPDATE `spell_script_names` SET `ScriptName`='spell_boss_magus_telestra_summon_telestra_clones_aura' WHERE `spell_id`=47710;
UPDATE `spell_script_names` SET `ScriptName`='spell_ticking_time_bomb_aura' WHERE `spell_id`=59686;
UPDATE `spell_script_names` SET `ScriptName`='spell_frost_tomb_aura' WHERE `spell_id`=42672;
UPDATE `spell_script_names` SET `ScriptName`='spell_optic_link_aura' WHERE `spell_id`=54396;
UPDATE `spell_script_names` SET `ScriptName`='spell_destroy_door_seal_aura' WHERE `spell_id`=58040;
UPDATE `spell_script_names` SET `ScriptName`='spell_shield_of_bones_aura' WHERE `spell_id` IN (69069,70207);
UPDATE `spell_script_names` SET `ScriptName`='spell_wailing_souls_periodic_aura' WHERE `spell_id`=68875;
UPDATE `spell_script_names` SET `ScriptName`='spell_bronjahm_soulstorm_channel_ooc_aura' WHERE `spell_id`=69008;
UPDATE `spell_script_names` SET `ScriptName`='spell_bronjahm_soulstorm_visual_aura' WHERE `spell_id`=68870;
UPDATE `spell_script_names` SET `ScriptName`='spell_krick_explosive_barrage_aura' WHERE `spell_id`=69012;
UPDATE `spell_script_names` SET `ScriptName`='spell_exploding_orb_auto_grow_aura' WHERE `spell_id`=69020;
UPDATE `spell_script_names` SET `ScriptName`='spell_pos_empowered_blizzard_aura' WHERE `spell_id`=70132;
UPDATE `spell_script_names` SET `ScriptName`='spell_pos_blight_aura' WHERE `spell_id` IN (69603,69604,70285,70286);
UPDATE `spell_script_names` SET `ScriptName`='spell_pos_glacial_strike_aura' WHERE `spell_id` IN (70292,71316,71317);
UPDATE `spell_script_names` SET `ScriptName`='spell_hor_gunship_cannon_fire_aura' WHERE `spell_id`=70017;
UPDATE `spell_script_names` SET `ScriptName`='spell_hor_shared_suffering_aura' WHERE `spell_id` IN (72368,72369);
103 changes: 44 additions & 59 deletions src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,82 +323,67 @@ class npc_anub_ar_crusher : public CreatureScript
}
};

class spell_hadronox_summon_periodic : public SpellScriptLoader
class spell_hadronox_summon_periodic_aura : public AuraScript
{
PrepareAuraScript(spell_hadronox_summon_periodic_aura);

public:
spell_hadronox_summon_periodic(const char* name, uint32 delay, uint32 spellEntry) : SpellScriptLoader(name), _delay(delay), _spellEntry(spellEntry) { }
spell_hadronox_summon_periodic_aura(uint32 delay, uint32 spellEntry) : _delay(delay), _spellEntry(spellEntry) { }

class spell_hadronox_summon_periodic_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
public:
spell_hadronox_summon_periodic_AuraScript(uint32 delay, uint32 spellEntry) : _delay(delay), _spellEntry(spellEntry) { }
PrepareAuraScript(spell_hadronox_summon_periodic_AuraScript);

void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
Unit* owner = GetUnitOwner();
if (InstanceScript* instance = owner->GetInstanceScript())
if (instance->GetBossState(DATA_HADRONOX_EVENT) != DONE)
{
if (!owner->HasAura(SPELL_WEB_FRONT_DOORS))
owner->CastSpell(owner, _spellEntry, true);
else if (!instance->IsEncounterInProgress())
owner->RemoveAurasDueToSpell(SPELL_WEB_FRONT_DOORS);
}
}

void OnApply(AuraEffect const* auraEffect, AuraEffectHandleModes)
{
GetAura()->GetEffect(auraEffect->GetEffIndex())->SetPeriodicTimer(_delay);
}
return ValidateSpellInfo({ SPELL_WEB_FRONT_DOORS });
}

void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hadronox_summon_periodic_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectApply += AuraEffectApplyFn(spell_hadronox_summon_periodic_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
Unit* owner = GetUnitOwner();
if (InstanceScript* instance = owner->GetInstanceScript())
if (instance->GetBossState(DATA_HADRONOX_EVENT) != DONE)
{
if (!owner->HasAura(SPELL_WEB_FRONT_DOORS))
owner->CastSpell(owner, _spellEntry, true);
else if (!instance->IsEncounterInProgress())
owner->RemoveAurasDueToSpell(SPELL_WEB_FRONT_DOORS);
}
}

private:
uint32 _delay;
uint32 _spellEntry;
};
void OnApply(AuraEffect const* auraEffect, AuraEffectHandleModes)
{
GetAura()->GetEffect(auraEffect->GetEffIndex())->SetPeriodicTimer(_delay);
}

AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_hadronox_summon_periodic_AuraScript(_delay, _spellEntry);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hadronox_summon_periodic_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectApply += AuraEffectApplyFn(spell_hadronox_summon_periodic_aura::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}

private:
uint32 _delay;
uint32 _spellEntry;
};

class spell_hadronox_leech_poison : public SpellScriptLoader
class spell_hadronox_leech_poison_aura : public AuraScript
{
public:
spell_hadronox_leech_poison() : SpellScriptLoader("spell_hadronox_leech_poison") { }
PrepareAuraScript(spell_hadronox_leech_poison_aura);

class spell_hadronox_leech_poison_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_hadronox_leech_poison_AuraScript)

void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_LEECH_POISON_HEAL, true);
}
return ValidateSpellInfo({ SPELL_LEECH_POISON_HEAL });
}

void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_hadronox_leech_poison_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_LEECH, AURA_EFFECT_HANDLE_REAL);
}
};
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_LEECH_POISON_HEAL, true);
}

AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_hadronox_leech_poison_AuraScript();
AfterEffectRemove += AuraEffectRemoveFn(spell_hadronox_leech_poison_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_LEECH, AURA_EFFECT_HANDLE_REAL);
}
};

Expand All @@ -422,10 +407,10 @@ void AddSC_boss_hadronox()
{
new boss_hadronox();
new npc_anub_ar_crusher();
new spell_hadronox_summon_periodic("spell_hadronox_summon_periodic_champion", 15000, SPELL_SUMMON_ANUBAR_CHAMPION);
new spell_hadronox_summon_periodic("spell_hadronox_summon_periodic_necromancer", 10000, SPELL_SUMMON_ANUBAR_NECROMANCER);
new spell_hadronox_summon_periodic("spell_hadronox_summon_periodic_crypt_fiend", 5000, SPELL_SUMMON_ANUBAR_CRYPT_FIEND);
new spell_hadronox_leech_poison();
RegisterSpellScriptWithArgs(spell_hadronox_summon_periodic_aura, "spell_hadronox_summon_periodic_champion", 15000, SPELL_SUMMON_ANUBAR_CHAMPION);
RegisterSpellScriptWithArgs(spell_hadronox_summon_periodic_aura, "spell_hadronox_summon_periodic_necromancer", 10000, SPELL_SUMMON_ANUBAR_NECROMANCER);
RegisterSpellScriptWithArgs(spell_hadronox_summon_periodic_aura, "spell_hadronox_summon_periodic_crypt_fiend", 5000, SPELL_SUMMON_ANUBAR_CRYPT_FIEND);
RegisterSpellScript(spell_hadronox_leech_poison_aura);
new achievement_hadronox_denied();
}

Original file line number Diff line number Diff line change
Expand Up @@ -114,65 +114,48 @@ class instance_azjol_nerub : public InstanceMapScript
}
};

class spell_azjol_nerub_fixate : public SpellScriptLoader
class spell_azjol_nerub_fixate : public SpellScript
{
public:
spell_azjol_nerub_fixate() : SpellScriptLoader("spell_azjol_nerub_fixate") { }
PrepareSpellScript(spell_azjol_nerub_fixate);

class spell_azjol_nerub_fixate_SpellScript : public SpellScript
void HandleScriptEffect(SpellEffIndex effIndex)
{
PrepareSpellScript(spell_azjol_nerub_fixate_SpellScript);

void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), GetEffectValue(), true);
}

void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_azjol_nerub_fixate_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), GetEffectValue(), true);
}

SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_azjol_nerub_fixate_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_azjol_nerub_fixate::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};

class spell_azjol_nerub_web_wrap : public SpellScriptLoader
class spell_azjol_nerub_web_wrap_aura : public AuraScript
{
public:
spell_azjol_nerub_web_wrap() : SpellScriptLoader("spell_azjol_nerub_web_wrap") { }
PrepareAuraScript(spell_azjol_nerub_web_wrap_aura);

class spell_azjol_nerub_web_wrap_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_azjol_nerub_web_wrap_AuraScript);

void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (!target->HasAura(SPELL_WEB_WRAP_TRIGGER))
target->CastSpell(target, SPELL_WEB_WRAP_TRIGGER, true);
}
return ValidateSpellInfo({ SPELL_WEB_WRAP_TRIGGER });
}

void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_azjol_nerub_web_wrap_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_ROOT, AURA_EFFECT_HANDLE_REAL);
}
};
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (!target->HasAura(SPELL_WEB_WRAP_TRIGGER))
target->CastSpell(target, SPELL_WEB_WRAP_TRIGGER, true);
}

AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_azjol_nerub_web_wrap_AuraScript();
OnEffectRemove += AuraEffectRemoveFn(spell_azjol_nerub_web_wrap_aura::OnRemove, EFFECT_0, SPELL_AURA_MOD_ROOT, AURA_EFFECT_HANDLE_REAL);
}
};

void AddSC_instance_azjol_nerub()
{
new instance_azjol_nerub();
new spell_azjol_nerub_fixate();
new spell_azjol_nerub_web_wrap();
RegisterSpellScript(spell_azjol_nerub_fixate);
RegisterSpellScript(spell_azjol_nerub_web_wrap_aura);
}
Loading

2 comments on commit cd9dff5

@icedcolor
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Script named 'spell_hadronox_summon_periodic_crypt_fiend' is not assigned in the database.
Script named 'spell_hadronox_summon_periodic_crypt_fiend_aura' is assigned in the database, but has no code!

@sogladev
Copy link
Member Author

@sogladev sogladev commented on cd9dff5 Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Script named 'spell_hadronox_summon_periodic_crypt_fiend' is not assigned in the database. Script named 'spell_hadronox_summon_periodic_crypt_fiend_aura' is assigned in the database, but has no code!

Oops, found the problem. Should rename script and other spells

before

53035	spell_hadronox_summon_periodic_champion
53036	spell_hadronox_summon_periodic_necromancer
53037	spell_hadronox_summon_periodic_crypt_fiend

Please sign in to comment.