Core/Spells: Convert some spells from spell_scripts in the db to a generic spellscript.

This commit is contained in:
Kandera
2012-04-25 13:47:26 -04:00
parent b528f70639
commit 13b68af78d
2 changed files with 50 additions and 5 deletions

View File

@@ -0,0 +1,12 @@
select id from spell_scripts where command = 18 order by id asc;
DELETE FROM `spell_scripts` WHERE `id` IN (15998,25952,29435,45980,51592,51910,52267,54420);
DELETE FROM `spell_script_names` WHERE `spell_id` IN (15998,25952,29435,45980,51592,51910,52267,54420);
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(15998, 'spell_gen_despawn_self'),
(25952, 'spell_gen_despawn_self'),
(29435, 'spell_gen_despawn_self'),
(45980, 'spell_gen_despawn_self'),
(51592, 'spell_gen_despawn_self'),
(51910, 'spell_gen_despawn_self'),
(52267, 'spell_gen_despawn_self'),
(54420, 'spell_gen_despawn_self');

View File

@@ -169,7 +169,7 @@ class spell_gen_burn_brutallus : public SpellScriptLoader
}
};
enum eCannibalizeSpells
enum CannibalizeSpells
{
SPELL_CANNIBALIZE_TRIGGERED = 20578,
};
@@ -224,7 +224,7 @@ class spell_gen_cannibalize : public SpellScriptLoader
};
// 45472 Parachute
enum eParachuteSpells
enum ParachuteSpells
{
SPELL_PARACHUTE = 45472,
SPELL_PARACHUTE_BUFF = 44795,
@@ -365,7 +365,7 @@ class spell_gen_remove_flight_auras : public SpellScriptLoader
};
// 66118 Leeching Swarm
enum eLeechingSwarmSpells
enum LeechingSwarmSpells
{
SPELL_LEECHING_SWARM_DMG = 66240,
SPELL_LEECHING_SWARM_HEAL = 66125,
@@ -481,7 +481,7 @@ class spell_gen_elune_candle : public SpellScriptLoader
};
// 24750 Trick
enum eTrickSpells
enum TrickSpells
{
SPELL_PIRATE_COSTUME_MALE = 24708,
SPELL_PIRATE_COSTUME_FEMALE = 24709,
@@ -557,7 +557,7 @@ class spell_gen_trick : public SpellScriptLoader
};
// 24751 Trick or Treat
enum eTrickOrTreatSpells
enum TrickOrTreatSpells
{
SPELL_TRICK = 24714,
SPELL_TREAT = 24715,
@@ -2656,6 +2656,38 @@ class spell_gen_count_pct_from_max_hp : public SpellScriptLoader
int32 _damagePct;
};
class spell_gen_despawn_self : public SpellScriptLoader
{
public:
spell_gen_despawn_self() : SpellScriptLoader("spell_gen_despawn_self") { }
class spell_gen_despawn_self_SpellScript : public SpellScript
{
PrepareSpellScript(spell_gen_despawn_self_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
void HandleDummy(SpellEffIndex effIndex)
{
GetCaster()->ToCreature()->DespawnOrUnsummon();
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_gen_despawn_self_SpellScript::HandleDummy, EFFECT_FIRST_FOUND, SPELL_EFFECT_DUMMY);
OnEffectHitTarget += SpellEffectFn(spell_gen_despawn_self_SpellScript::HandleDummy, EFFECT_FIRST_FOUND, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const
{
return new spell_gen_despawn_self_SpellScript();
}
};
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -2709,4 +2741,5 @@ void AddSC_generic_spell_scripts()
new spell_gen_wg_water();
new spell_gen_count_pct_from_max_hp("spell_gen_default_count_pct_from_max_hp");
new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50);
new spell_gen_despawn_self();
}