Scrips/Spell: Implemented script for spell 26678.

Signed-off-by: Manuel Carrasco <manue.l@live.com.ar>
This commit is contained in:
Manuel Carrasco
2011-02-12 12:04:02 -03:00
parent fcc57b2c95
commit 30916fd9ff
3 changed files with 50 additions and 0 deletions

View File

@@ -2073,6 +2073,7 @@ INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
( 59640, 'spell_item_underbelly_elixir'),
( 71905, 'spell_item_shadowmourne'),
( 67533, 'spell_item_red_rider_air_rifle'),
( 26678,'spell_item_create_heart_candy'),
-- warrior
( 12975, 'spell_warr_last_stand'),
( 59725, 'spell_warr_improved_spell_reflection'),

View File

@@ -0,0 +1,2 @@
DELETE FROM `spell_script_names` WHERE `spell_id`=26678;
INSERT INTO `spell_script_names` VALUES (26678,'spell_item_create_heart_candy');

View File

@@ -804,6 +804,51 @@ enum eGenericData
SPELL_MITHRIL_MECHANICAL_DRAGONLING = 12749,
};
enum CreateHeartCandy
{
ITEM_HEART_CANDY_1 = 21818,
ITEM_HEART_CANDY_2 = 21817,
ITEM_HEART_CANDY_3 = 21821,
ITEM_HEART_CANDY_4 = 21819,
ITEM_HEART_CANDY_5 = 21816,
ITEM_HEART_CANDY_6 = 21823,
ITEM_HEART_CANDY_7 = 21822,
ITEM_HEART_CANDY_8 = 21820,
};
class spell_item_create_heart_candy : public SpellScriptLoader
{
public:
spell_item_create_heart_candy() : SpellScriptLoader("spell_item_create_heart_candy") { }
class spell_item_create_heart_candy_SpellScript : public SpellScript
{
PrepareSpellScript(spell_item_create_heart_candy_SpellScript);
void HandleScript(SpellEffIndex effIndex)
{
if (!GetHitUnit() || !GetHitUnit()->ToPlayer())
return;
Player* target = GetHitUnit()->ToPlayer();
static const uint32 items[] = {ITEM_HEART_CANDY_1,ITEM_HEART_CANDY_2,ITEM_HEART_CANDY_3,ITEM_HEART_CANDY_4,ITEM_HEART_CANDY_5,ITEM_HEART_CANDY_6,ITEM_HEART_CANDY_7,ITEM_HEART_CANDY_8};
target->AddItem(items[urand(0,7)],1);
}
void Register()
{
OnEffect += SpellEffectFn(spell_item_create_heart_candy_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const
{
return new spell_item_create_heart_candy_SpellScript();
}
};
void AddSC_item_spell_scripts()
{
// 23074 Arcanite Dragonling
@@ -827,4 +872,6 @@ void AddSC_item_spell_scripts()
new spell_item_underbelly_elixir();
new spell_item_shadowmourne();
new spell_item_red_rider_air_rifle();
new spell_item_create_heart_candy();
}