mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 02:20:27 +00:00
refactor(Scripts/Kalimdor): Spell Scripts registry macros (#19185)
* zone_dustwallow_marsh spell:spell_ooze_zap * zone_dustwallow_marsh spell:spell_ooze_zap_channel_end * zone_dustwallow_marsh spell:spell_energize_aoe * zone_feralas spell:spell_gordunni_trap * zone_durotar aura:spell_mount_check_aura * zone_durotar spell:spell_voljin_war_drums * zone_durotar spell:spell_voodoo * boss_salramm aura:spell_boss_salramm_steal_flesh_aura * instance_zulfarrak spell:spell_zulfarrak_summon_zulfarrak_zombies * instance_zulfarrak spell:spell_zulfarrak_unlocking
This commit is contained in:
@@ -161,41 +161,35 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
class spell_boss_salramm_steal_flesh : public SpellScriptLoader
|
||||
class spell_boss_salramm_steal_flesh_aura : public AuraScript
|
||||
{
|
||||
public:
|
||||
spell_boss_salramm_steal_flesh() : SpellScriptLoader("spell_boss_salramm_steal_flesh") { }
|
||||
PrepareAuraScript(spell_boss_salramm_steal_flesh_aura);
|
||||
|
||||
class spell_boss_salramm_steal_flesh_AuraScript : public AuraScript
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
PrepareAuraScript(spell_boss_salramm_steal_flesh_AuraScript);
|
||||
return ValidateSpellInfo({ SPELL_STEAL_FLESH_CASTER, SPELL_STEAL_FLESH_TARGET });
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Unit* target = GetUnitOwner();
|
||||
if (caster)
|
||||
{
|
||||
caster->CastSpell(caster, SPELL_STEAL_FLESH_CASTER, true);
|
||||
caster->CastSpell(target, SPELL_STEAL_FLESH_TARGET, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_boss_salramm_steal_flesh_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const override
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
return new spell_boss_salramm_steal_flesh_AuraScript();
|
||||
Unit* caster = GetCaster();
|
||||
Unit* target = GetUnitOwner();
|
||||
if (caster)
|
||||
{
|
||||
caster->CastSpell(caster, SPELL_STEAL_FLESH_CASTER, true);
|
||||
caster->CastSpell(target, SPELL_STEAL_FLESH_TARGET, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_boss_salramm_steal_flesh_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_salramm()
|
||||
{
|
||||
new boss_salramm();
|
||||
new spell_boss_salramm_steal_flesh();
|
||||
RegisterSpellScript(spell_boss_salramm_steal_flesh_aura);
|
||||
}
|
||||
|
||||
|
||||
@@ -457,86 +457,64 @@ public:
|
||||
};
|
||||
|
||||
// 10247 - Summon Zul'Farrak Zombies
|
||||
class spell_zulfarrak_summon_zulfarrak_zombies : public SpellScriptLoader
|
||||
class spell_zulfarrak_summon_zulfarrak_zombies : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_zulfarrak_summon_zulfarrak_zombies() : SpellScriptLoader("spell_zulfarrak_summon_zulfarrak_zombies") { }
|
||||
PrepareSpellScript(spell_zulfarrak_summon_zulfarrak_zombies);
|
||||
|
||||
class spell_zulfarrak_summon_zulfarrak_zombies_SpellScript : public SpellScript
|
||||
void HandleSummon(SpellEffIndex effIndex)
|
||||
{
|
||||
PrepareSpellScript(spell_zulfarrak_summon_zulfarrak_zombies_SpellScript);
|
||||
|
||||
void HandleSummon(SpellEffIndex effIndex)
|
||||
if (effIndex == EFFECT_0)
|
||||
{
|
||||
if (effIndex == EFFECT_0)
|
||||
{
|
||||
if (roll_chance_i(30))
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (roll_chance_i(40))
|
||||
if (roll_chance_i(30))
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
else if (roll_chance_i(40))
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies_SpellScript::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON);
|
||||
OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies_SpellScript::HandleSummon, EFFECT_1, SPELL_EFFECT_SUMMON);
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
return;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
void Register() override
|
||||
{
|
||||
return new spell_zulfarrak_summon_zulfarrak_zombies_SpellScript;
|
||||
OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON);
|
||||
OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies::HandleSummon, EFFECT_1, SPELL_EFFECT_SUMMON);
|
||||
}
|
||||
};
|
||||
|
||||
// 10738 - Unlocking
|
||||
class spell_zulfarrak_unlocking : public SpellScriptLoader
|
||||
class spell_zulfarrak_unlocking : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_zulfarrak_unlocking() : SpellScriptLoader("spell_zulfarrak_unlocking") { }
|
||||
PrepareSpellScript(spell_zulfarrak_unlocking);
|
||||
|
||||
class spell_zulfarrak_unlocking_SpellScript : public SpellScript
|
||||
void HandleOpenLock(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
PrepareSpellScript(spell_zulfarrak_unlocking_SpellScript);
|
||||
|
||||
void HandleOpenLock(SpellEffIndex /*effIndex*/)
|
||||
GameObject* cage = GetHitGObj();
|
||||
std::list<WorldObject*> cagesList;
|
||||
Acore::AllWorldObjectsInRange objects(GetCaster(), 15.0f);
|
||||
Acore::WorldObjectListSearcher<Acore::AllWorldObjectsInRange> searcher(GetCaster(), cagesList, objects);
|
||||
Cell::VisitAllObjects(GetCaster(), searcher, 15.0f);
|
||||
for (std::list<WorldObject*>::const_iterator itr = cagesList.begin(); itr != cagesList.end(); ++itr)
|
||||
{
|
||||
GameObject* cage = GetHitGObj();
|
||||
std::list<WorldObject*> cagesList;
|
||||
Acore::AllWorldObjectsInRange objects(GetCaster(), 15.0f);
|
||||
Acore::WorldObjectListSearcher<Acore::AllWorldObjectsInRange> searcher(GetCaster(), cagesList, objects);
|
||||
Cell::VisitAllObjects(GetCaster(), searcher, 15.0f);
|
||||
for (std::list<WorldObject*>::const_iterator itr = cagesList.begin(); itr != cagesList.end(); ++itr)
|
||||
{
|
||||
if (GameObject* go = (*itr)->ToGameObject())
|
||||
if (go->GetDisplayId() == cage->GetDisplayId())
|
||||
go->UseDoorOrButton(0, false, GetCaster());
|
||||
}
|
||||
if (GameObject* go = (*itr)->ToGameObject())
|
||||
if (go->GetDisplayId() == cage->GetDisplayId())
|
||||
go->UseDoorOrButton(0, false, GetCaster());
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_zulfarrak_unlocking_SpellScript::HandleOpenLock, EFFECT_0, SPELL_EFFECT_OPEN_LOCK);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
void Register() override
|
||||
{
|
||||
return new spell_zulfarrak_unlocking_SpellScript();
|
||||
OnEffectHitTarget += SpellEffectFn(spell_zulfarrak_unlocking::HandleOpenLock, EFFECT_0, SPELL_EFFECT_OPEN_LOCK);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_instance_zulfarrak()
|
||||
{
|
||||
new instance_zulfarrak();
|
||||
new spell_zulfarrak_summon_zulfarrak_zombies();
|
||||
new spell_zulfarrak_unlocking();
|
||||
RegisterSpellScript(spell_zulfarrak_summon_zulfarrak_zombies);
|
||||
RegisterSpellScript(spell_zulfarrak_unlocking);
|
||||
}
|
||||
|
||||
|
||||
@@ -361,90 +361,68 @@ public:
|
||||
|
||||
typedef npc_troll_volunteer::npc_troll_volunteerAI VolunteerAI;
|
||||
|
||||
class spell_mount_check : public SpellScriptLoader
|
||||
class spell_mount_check_aura : public AuraScript
|
||||
{
|
||||
public:
|
||||
spell_mount_check() : SpellScriptLoader("spell_mount_check") { }
|
||||
PrepareAuraScript(spell_mount_check_aura);
|
||||
|
||||
class spell_mount_check_AuraScript : public AuraScript
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
PrepareAuraScript(spell_mount_check_AuraScript)
|
||||
return ValidateSpellInfo({ SPELL_MOUNTING_CHECK });
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_MOUNTING_CHECK });
|
||||
}
|
||||
|
||||
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
Unit* owner = target->GetOwner();
|
||||
|
||||
if (!owner)
|
||||
return;
|
||||
|
||||
if (owner->IsMounted() && !target->IsMounted())
|
||||
{
|
||||
if (VolunteerAI* volunteerAI = CAST_AI(VolunteerAI, target->GetAI()))
|
||||
target->Mount(volunteerAI->GetMountId());
|
||||
}
|
||||
else if (!owner->IsMounted() && target->IsMounted())
|
||||
target->Dismount();
|
||||
|
||||
target->SetSpeed(MOVE_RUN, owner->GetSpeedRate(MOVE_RUN));
|
||||
target->SetSpeed(MOVE_WALK, owner->GetSpeedRate(MOVE_WALK));
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mount_check_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const override
|
||||
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
return new spell_mount_check_AuraScript();
|
||||
Unit* target = GetTarget();
|
||||
Unit* owner = target->GetOwner();
|
||||
|
||||
if (!owner)
|
||||
return;
|
||||
|
||||
if (owner->IsMounted() && !target->IsMounted())
|
||||
{
|
||||
if (VolunteerAI* volunteerAI = CAST_AI(VolunteerAI, target->GetAI()))
|
||||
target->Mount(volunteerAI->GetMountId());
|
||||
}
|
||||
else if (!owner->IsMounted() && target->IsMounted())
|
||||
target->Dismount();
|
||||
|
||||
target->SetSpeed(MOVE_RUN, owner->GetSpeedRate(MOVE_RUN));
|
||||
target->SetSpeed(MOVE_WALK, owner->GetSpeedRate(MOVE_WALK));
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mount_check_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_voljin_war_drums : public SpellScriptLoader
|
||||
class spell_voljin_war_drums : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_voljin_war_drums() : SpellScriptLoader("spell_voljin_war_drums") { }
|
||||
PrepareSpellScript(spell_voljin_war_drums);
|
||||
|
||||
class spell_voljin_war_drums_SpellScript : public SpellScript
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
PrepareSpellScript(spell_voljin_war_drums_SpellScript)
|
||||
return ValidateSpellInfo({ SPELL_MOTIVATE_1, SPELL_MOTIVATE_2 });
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_MOTIVATE_1, SPELL_MOTIVATE_2 });
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
uint32 motivate = 0;
|
||||
if (target->GetEntry() == NPC_CITIZEN_1)
|
||||
motivate = SPELL_MOTIVATE_1;
|
||||
else if (target->GetEntry() == NPC_CITIZEN_2)
|
||||
motivate = SPELL_MOTIVATE_2;
|
||||
if (motivate)
|
||||
caster->CastSpell(target, motivate, false);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_voljin_war_drums_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
return new spell_voljin_war_drums_SpellScript();
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
uint32 motivate = 0;
|
||||
if (target->GetEntry() == NPC_CITIZEN_1)
|
||||
motivate = SPELL_MOTIVATE_1;
|
||||
else if (target->GetEntry() == NPC_CITIZEN_2)
|
||||
motivate = SPELL_MOTIVATE_2;
|
||||
if (motivate)
|
||||
caster->CastSpell(target, motivate, false);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_voljin_war_drums::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -460,45 +438,34 @@ enum VoodooSpells
|
||||
};
|
||||
|
||||
// 17009
|
||||
class spell_voodoo : public SpellScriptLoader
|
||||
class spell_voodoo : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_voodoo() : SpellScriptLoader("spell_voodoo") { }
|
||||
PrepareSpellScript(spell_voodoo);
|
||||
|
||||
class spell_voodoo_SpellScript : public SpellScript
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
PrepareSpellScript(spell_voodoo_SpellScript)
|
||||
return ValidateSpellInfo(
|
||||
{
|
||||
SPELL_BREW,
|
||||
SPELL_GHOSTLY,
|
||||
SPELL_HEX1,
|
||||
SPELL_HEX2,
|
||||
SPELL_HEX3,
|
||||
SPELL_GROW,
|
||||
SPELL_LAUNCH
|
||||
});
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo(
|
||||
{
|
||||
SPELL_BREW,
|
||||
SPELL_GHOSTLY,
|
||||
SPELL_HEX1,
|
||||
SPELL_HEX2,
|
||||
SPELL_HEX3,
|
||||
SPELL_GROW,
|
||||
SPELL_LAUNCH
|
||||
});
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
uint32 spellid = RAND(SPELL_BREW, SPELL_GHOSTLY, RAND(SPELL_HEX1, SPELL_HEX2, SPELL_HEX3), SPELL_GROW, SPELL_LAUNCH);
|
||||
if (Unit* target = GetHitUnit())
|
||||
GetCaster()->CastSpell(target, spellid, false);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_voodoo_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
return new spell_voodoo_SpellScript();
|
||||
uint32 spellid = RAND(SPELL_BREW, SPELL_GHOSTLY, RAND(SPELL_HEX1, SPELL_HEX2, SPELL_HEX3), SPELL_GROW, SPELL_LAUNCH);
|
||||
if (Unit* target = GetHitUnit())
|
||||
GetCaster()->CastSpell(target, spellid, false);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_voodoo::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -507,8 +474,8 @@ void AddSC_durotar()
|
||||
new npc_tiger_matriarch_credit();
|
||||
new npc_tiger_matriarch();
|
||||
new npc_troll_volunteer();
|
||||
new spell_mount_check();
|
||||
new spell_voljin_war_drums();
|
||||
new spell_voodoo();
|
||||
RegisterSpellScript(spell_mount_check_aura);
|
||||
RegisterSpellScript(spell_voljin_war_drums);
|
||||
RegisterSpellScript(spell_voodoo);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,135 +30,102 @@ enum SpellScripts
|
||||
SPELL_ENERGIZED = 42492,
|
||||
};
|
||||
|
||||
class spell_ooze_zap : public SpellScriptLoader
|
||||
class spell_ooze_zap : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_ooze_zap() : SpellScriptLoader("spell_ooze_zap") { }
|
||||
PrepareSpellScript(spell_ooze_zap);
|
||||
|
||||
class spell_ooze_zap_SpellScript : public SpellScript
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
PrepareSpellScript(spell_ooze_zap_SpellScript);
|
||||
return ValidateSpellInfo({ SPELL_OOZE_ZAP });
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_OOZE_ZAP });
|
||||
}
|
||||
|
||||
SpellCastResult CheckRequirement()
|
||||
{
|
||||
if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
|
||||
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct
|
||||
|
||||
if (!GetExplTargetUnit())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
if (GetHitUnit())
|
||||
GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
OnCheckCast += SpellCheckCastFn(spell_ooze_zap_SpellScript::CheckRequirement);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
SpellCastResult CheckRequirement()
|
||||
{
|
||||
return new spell_ooze_zap_SpellScript();
|
||||
if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
|
||||
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct
|
||||
|
||||
if (!GetExplTargetUnit())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
if (GetHitUnit())
|
||||
GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_ooze_zap::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
OnCheckCast += SpellCheckCastFn(spell_ooze_zap::CheckRequirement);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_ooze_zap_channel_end : public SpellScriptLoader
|
||||
class spell_ooze_zap_channel_end : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_ooze_zap_channel_end() : SpellScriptLoader("spell_ooze_zap_channel_end") { }
|
||||
PrepareSpellScript(spell_ooze_zap_channel_end);
|
||||
|
||||
class spell_ooze_zap_channel_end_SpellScript : public SpellScript
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
PrepareSpellScript(spell_ooze_zap_channel_end_SpellScript);
|
||||
return ValidateSpellInfo({ SPELL_OOZE_ZAP_CHANNEL_END });
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_OOZE_ZAP_CHANNEL_END });
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
player->CastSpell(player, SPELL_OOZE_CHANNEL_CREDIT, true);
|
||||
Unit::Kill(GetHitUnit(), GetHitUnit());
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_channel_end_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
return new spell_ooze_zap_channel_end_SpellScript();
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
player->CastSpell(player, SPELL_OOZE_CHANNEL_CREDIT, true);
|
||||
Unit::Kill(GetHitUnit(), GetHitUnit());
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_ooze_zap_channel_end::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_energize_aoe : public SpellScriptLoader
|
||||
class spell_energize_aoe : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_energize_aoe() : SpellScriptLoader("spell_energize_aoe") { }
|
||||
PrepareSpellScript(spell_energize_aoe);
|
||||
|
||||
class spell_energize_aoe_SpellScript : public SpellScript
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
PrepareSpellScript(spell_energize_aoe_SpellScript);
|
||||
return ValidateSpellInfo({ SPELL_ENERGIZED });
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_ENERGIZED });
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
|
||||
{
|
||||
if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
|
||||
++itr;
|
||||
else
|
||||
targets.erase(itr++);
|
||||
}
|
||||
targets.push_back(GetCaster());
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_energize_aoe_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
return new spell_energize_aoe_SpellScript();
|
||||
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
|
||||
{
|
||||
if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
|
||||
++itr;
|
||||
else
|
||||
targets.erase(itr++);
|
||||
}
|
||||
targets.push_back(GetCaster());
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_energize_aoe::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_dustwallow_marsh()
|
||||
{
|
||||
new spell_ooze_zap();
|
||||
new spell_ooze_zap_channel_end();
|
||||
new spell_energize_aoe();
|
||||
RegisterSpellScript(spell_ooze_zap);
|
||||
RegisterSpellScript(spell_ooze_zap_channel_end);
|
||||
RegisterSpellScript(spell_energize_aoe);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,39 +33,28 @@ enum GordunniTrap
|
||||
GO_GORDUNNI_DIRT_MOUND = 144064,
|
||||
};
|
||||
|
||||
class spell_gordunni_trap : public SpellScriptLoader
|
||||
class spell_gordunni_trap : public SpellScript
|
||||
{
|
||||
public:
|
||||
spell_gordunni_trap() : SpellScriptLoader("spell_gordunni_trap") { }
|
||||
PrepareSpellScript(spell_gordunni_trap);
|
||||
|
||||
class spell_gordunni_trap_SpellScript : public SpellScript
|
||||
void HandleDummy()
|
||||
{
|
||||
PrepareSpellScript(spell_gordunni_trap_SpellScript);
|
||||
if (Unit* caster = GetCaster())
|
||||
if (GameObject* chest = caster->SummonGameObject(GO_GORDUNNI_DIRT_MOUND, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0))
|
||||
{
|
||||
chest->SetSpellId(GetSpellInfo()->Id);
|
||||
caster->RemoveGameObject(chest, false);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleDummy()
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (GameObject* chest = caster->SummonGameObject(GO_GORDUNNI_DIRT_MOUND, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0))
|
||||
{
|
||||
chest->SetSpellId(GetSpellInfo()->Id);
|
||||
caster->RemoveGameObject(chest, false);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCast += SpellCastFn(spell_gordunni_trap_SpellScript::HandleDummy);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
void Register() override
|
||||
{
|
||||
return new spell_gordunni_trap_SpellScript();
|
||||
OnCast += SpellCastFn(spell_gordunni_trap::HandleDummy);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_feralas()
|
||||
{
|
||||
new spell_gordunni_trap();
|
||||
RegisterSpellScript(spell_gordunni_trap);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user