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:
@@ -0,0 +1,3 @@
|
|||||||
|
--
|
||||||
|
UPDATE `spell_script_names` SET `ScriptName`='spell_mount_check_aura' WHERE `spell_id`=75420;
|
||||||
|
UPDATE `spell_script_names` SET `ScriptName`='spell_boss_salramm_steal_flesh_aura' WHERE `spell_id`=52708;
|
||||||
@@ -161,41 +161,35 @@ public:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class spell_boss_salramm_steal_flesh : public SpellScriptLoader
|
class spell_boss_salramm_steal_flesh_aura : public AuraScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareAuraScript(spell_boss_salramm_steal_flesh_aura);
|
||||||
spell_boss_salramm_steal_flesh() : SpellScriptLoader("spell_boss_salramm_steal_flesh") { }
|
|
||||||
|
|
||||||
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*/)
|
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
|
|
||||||
{
|
{
|
||||||
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()
|
void AddSC_boss_salramm()
|
||||||
{
|
{
|
||||||
new 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
|
// 10247 - Summon Zul'Farrak Zombies
|
||||||
class spell_zulfarrak_summon_zulfarrak_zombies : public SpellScriptLoader
|
class spell_zulfarrak_summon_zulfarrak_zombies : public SpellScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareSpellScript(spell_zulfarrak_summon_zulfarrak_zombies);
|
||||||
spell_zulfarrak_summon_zulfarrak_zombies() : SpellScriptLoader("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);
|
if (effIndex == EFFECT_0)
|
||||||
|
|
||||||
void HandleSummon(SpellEffIndex effIndex)
|
|
||||||
{
|
{
|
||||||
if (effIndex == EFFECT_0)
|
if (roll_chance_i(30))
|
||||||
{
|
|
||||||
if (roll_chance_i(30))
|
|
||||||
{
|
|
||||||
PreventHitDefaultEffect(effIndex);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (roll_chance_i(40))
|
|
||||||
{
|
{
|
||||||
PreventHitDefaultEffect(effIndex);
|
PreventHitDefaultEffect(effIndex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (roll_chance_i(40))
|
||||||
void Register() override
|
|
||||||
{
|
{
|
||||||
OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies_SpellScript::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON);
|
PreventHitDefaultEffect(effIndex);
|
||||||
OnEffectHit += SpellEffectFn(spell_zulfarrak_summon_zulfarrak_zombies_SpellScript::HandleSummon, EFFECT_1, SPELL_EFFECT_SUMMON);
|
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
|
// 10738 - Unlocking
|
||||||
class spell_zulfarrak_unlocking : public SpellScriptLoader
|
class spell_zulfarrak_unlocking : public SpellScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareSpellScript(spell_zulfarrak_unlocking);
|
||||||
spell_zulfarrak_unlocking() : SpellScriptLoader("spell_zulfarrak_unlocking") { }
|
|
||||||
|
|
||||||
class spell_zulfarrak_unlocking_SpellScript : public SpellScript
|
void HandleOpenLock(SpellEffIndex /*effIndex*/)
|
||||||
{
|
{
|
||||||
PrepareSpellScript(spell_zulfarrak_unlocking_SpellScript);
|
GameObject* cage = GetHitGObj();
|
||||||
|
std::list<WorldObject*> cagesList;
|
||||||
void HandleOpenLock(SpellEffIndex /*effIndex*/)
|
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();
|
if (GameObject* go = (*itr)->ToGameObject())
|
||||||
std::list<WorldObject*> cagesList;
|
if (go->GetDisplayId() == cage->GetDisplayId())
|
||||||
Acore::AllWorldObjectsInRange objects(GetCaster(), 15.0f);
|
go->UseDoorOrButton(0, false, GetCaster());
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Register() override
|
void Register() override
|
||||||
{
|
|
||||||
OnEffectHitTarget += SpellEffectFn(spell_zulfarrak_unlocking_SpellScript::HandleOpenLock, EFFECT_0, SPELL_EFFECT_OPEN_LOCK);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SpellScript* GetSpellScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_zulfarrak_unlocking_SpellScript();
|
OnEffectHitTarget += SpellEffectFn(spell_zulfarrak_unlocking::HandleOpenLock, EFFECT_0, SPELL_EFFECT_OPEN_LOCK);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_instance_zulfarrak()
|
void AddSC_instance_zulfarrak()
|
||||||
{
|
{
|
||||||
new instance_zulfarrak();
|
new instance_zulfarrak();
|
||||||
new spell_zulfarrak_summon_zulfarrak_zombies();
|
RegisterSpellScript(spell_zulfarrak_summon_zulfarrak_zombies);
|
||||||
new spell_zulfarrak_unlocking();
|
RegisterSpellScript(spell_zulfarrak_unlocking);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -361,90 +361,68 @@ public:
|
|||||||
|
|
||||||
typedef npc_troll_volunteer::npc_troll_volunteerAI VolunteerAI;
|
typedef npc_troll_volunteer::npc_troll_volunteerAI VolunteerAI;
|
||||||
|
|
||||||
class spell_mount_check : public SpellScriptLoader
|
class spell_mount_check_aura : public AuraScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareAuraScript(spell_mount_check_aura);
|
||||||
spell_mount_check() : SpellScriptLoader("spell_mount_check") { }
|
|
||||||
|
|
||||||
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
|
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
{
|
||||||
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:
|
PrepareSpellScript(spell_voljin_war_drums);
|
||||||
spell_voljin_war_drums() : SpellScriptLoader("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
|
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
{
|
||||||
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
|
// 17009
|
||||||
class spell_voodoo : public SpellScriptLoader
|
class spell_voodoo : public SpellScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareSpellScript(spell_voodoo);
|
||||||
spell_voodoo() : SpellScriptLoader("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
|
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
{
|
||||||
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_credit();
|
||||||
new npc_tiger_matriarch();
|
new npc_tiger_matriarch();
|
||||||
new npc_troll_volunteer();
|
new npc_troll_volunteer();
|
||||||
new spell_mount_check();
|
RegisterSpellScript(spell_mount_check_aura);
|
||||||
new spell_voljin_war_drums();
|
RegisterSpellScript(spell_voljin_war_drums);
|
||||||
new spell_voodoo();
|
RegisterSpellScript(spell_voodoo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,135 +30,102 @@ enum SpellScripts
|
|||||||
SPELL_ENERGIZED = 42492,
|
SPELL_ENERGIZED = 42492,
|
||||||
};
|
};
|
||||||
|
|
||||||
class spell_ooze_zap : public SpellScriptLoader
|
class spell_ooze_zap : public SpellScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareSpellScript(spell_ooze_zap);
|
||||||
spell_ooze_zap() : SpellScriptLoader("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
|
SpellCastResult CheckRequirement()
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
{
|
||||||
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:
|
PrepareSpellScript(spell_ooze_zap_channel_end);
|
||||||
spell_ooze_zap_channel_end() : SpellScriptLoader("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
|
void HandleDummy(SpellEffIndex effIndex)
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
{
|
||||||
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:
|
PrepareSpellScript(spell_energize_aoe);
|
||||||
spell_energize_aoe() : SpellScriptLoader("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
|
void FilterTargets(std::list<WorldObject*>& targets)
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
{
|
||||||
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()
|
void AddSC_dustwallow_marsh()
|
||||||
{
|
{
|
||||||
new spell_ooze_zap();
|
RegisterSpellScript(spell_ooze_zap);
|
||||||
new spell_ooze_zap_channel_end();
|
RegisterSpellScript(spell_ooze_zap_channel_end);
|
||||||
new spell_energize_aoe();
|
RegisterSpellScript(spell_energize_aoe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,39 +33,28 @@ enum GordunniTrap
|
|||||||
GO_GORDUNNI_DIRT_MOUND = 144064,
|
GO_GORDUNNI_DIRT_MOUND = 144064,
|
||||||
};
|
};
|
||||||
|
|
||||||
class spell_gordunni_trap : public SpellScriptLoader
|
class spell_gordunni_trap : public SpellScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareSpellScript(spell_gordunni_trap);
|
||||||
spell_gordunni_trap() : SpellScriptLoader("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()
|
void Register() override
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
{
|
||||||
return new spell_gordunni_trap_SpellScript();
|
OnCast += SpellCastFn(spell_gordunni_trap::HandleDummy);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_feralas()
|
void AddSC_feralas()
|
||||||
{
|
{
|
||||||
new spell_gordunni_trap();
|
RegisterSpellScript(spell_gordunni_trap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user