diff options
author | Pitcrawler <pitcrawler@server.fake> | 2013-04-02 01:06:19 +0200 |
---|---|---|
committer | Pitcrawler <pitcrawler@server.fake> | 2013-04-02 01:06:19 +0200 |
commit | 294fac60a03a69d6f618c9d0e163615f379a9d33 (patch) | |
tree | d7653a08cb15bdc91240768e99186bb437d660af | |
parent | d89626f767d1a2fd57f83bb682b866c818c480c2 (diff) |
DB/Quests: Fix It Was The Orcs, Honest! Closes #2037
-rw-r--r-- | sql/updates/world/2013_04_01_00_world_misc.sql | 20 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 50 |
2 files changed, 70 insertions, 0 deletions
diff --git a/sql/updates/world/2013_04_01_00_world_misc.sql b/sql/updates/world/2013_04_01_00_world_misc.sql new file mode 100644 index 00000000000..5cacfc839d8 --- /dev/null +++ b/sql/updates/world/2013_04_01_00_world_misc.sql @@ -0,0 +1,20 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=45759; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(45759,'spell_gen_orc_disguise'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=45742; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(17,0,45742,0,0,1,0,45760,0,0,0,0,'','Spell Plant Warsong Banner can be casted only if player has aura Warsong Orc Disguise (Male)'), +(17,0,45742,0,0,31,1,3,25430,0,0,0,'','Spell Plant Warsong Banner can be casted only on Magmothregar'), +(17,0,45742,0,0,36,1,0,0,0,1,0,'','Spell Plant Warsong Banner can be casted only if target is dead'), +(17,0,45742,0,1,1,0,45762,0,0,0,0,'','Spell Plant Warsong Banner can be casted only if player has aura Warsong Orc Disguise (Female)'), +(17,0,45742,0,1,31,1,3,25430,0,0,0,'','Spell Plant Warsong Banner can be casted only on Magmothregar'), +(17,0,45742,0,1,36,1,0,0,0,1,0,'','Spell Plant Warsong Banner can be casted only if target is dead'); + +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=25430; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=25430; +DELETE FROM `smart_scripts` WHERE `entryorguid`=25430 AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(25430,0,0,0,4,0,100,0,0,0,0,0,11,50413,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Magmothregar - On aggro - Spellcast Magnataur Charge'), +(25430,0,1,0,0,0,100,0,3500,12800,10100,14000,11,50822,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Magmothregar - On update IC - Spellcast Fervor'), +(25430,0,2,0,8,0,100,0,45742,0,0,0,11,45744,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Magmothregar - On spellhit Plant Warsong Banner - Spellcast It Was The Orcs, Honest!: Plant Banner Kill Credit'); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 00b504d2403..8c25fa1e24f 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3513,6 +3513,55 @@ class spell_gen_aura_service_uniform : public SpellScriptLoader } }; +enum OrcDisguiseSpells +{ + SPELL_ORC_DISGUISE_TRIGGER = 45759, + SPELL_ORC_DISGUISE_MALE = 45760, + SPELL_ORC_DISGUISE_FEMALE = 45762, +}; + +class spell_gen_orc_disguise : public SpellScriptLoader +{ + public: + spell_gen_orc_disguise() : SpellScriptLoader("spell_gen_orc_disguise") { } + + class spell_gen_orc_disguise_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_orc_disguise_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_MALE) || + !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_FEMALE)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Player* target = GetHitPlayer()) + { + uint8 gender = target->getGender(); + if (!gender) + caster->CastSpell(target, SPELL_ORC_DISGUISE_MALE, true); + else + caster->CastSpell(target, SPELL_ORC_DISGUISE_FEMALE, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_orc_disguise_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_orc_disguise_SpellScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -3592,4 +3641,5 @@ void AddSC_generic_spell_scripts() new spell_gen_gift_of_naaru(); new spell_gen_replenishment(); new spell_gen_aura_service_uniform(); + new spell_gen_orc_disguise(); } |