aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruntaught <untaught@trinity.contrib>2013-08-09 12:55:26 +0100
committerNay <dnpd.dd@gmail.com>2013-08-09 12:55:26 +0100
commit92fdb7aed16d1d0869aaa6d93f82a5478a018ffc (patch)
tree7239a9ce46330f7fc2391b49b1dc941d99f47025
parentd39d9f8328d37919475a7b7338a324ef68f4d843 (diff)
DB/SAI: Fix quest Jormuttar is Soo Fat...
Scripts/Spells: Script spell Bear Flank Master Closes #10484
-rw-r--r--sql/updates/world/2013_08_09_05_world_sai.sql29
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp57
2 files changed, 86 insertions, 0 deletions
diff --git a/sql/updates/world/2013_08_09_05_world_sai.sql b/sql/updates/world/2013_08_09_05_world_sai.sql
new file mode 100644
index 00000000000..889a0351181
--- /dev/null
+++ b/sql/updates/world/2013_08_09_05_world_sai.sql
@@ -0,0 +1,29 @@
+SET @DIBear=30292; -- Dead Icemaw Bear
+SET @LJBunny=30366; -- Lure Jormuttar Bunny
+
+-- WTF?! Spell Carve Bear Flank have no triggered spell
+DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=56562;
+-- Set Spell script
+DELETE FROM `spell_script_names` WHERE `spell_id`=56565;
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(56565,'spell_q13011_bear_flank_master');
+-- Update Item's Target requirement
+UPDATE `conditions` SET `ConditionTypeOrReference`=31 ,`ConditionTarget`=1 ,`ConditionValue1` =3,`ConditionValue2`=@DIBear WHERE `SourceTypeOrReferenceId`=17 AND `SourceGroup`=0 AND `SourceEntry`=56562;
+-- Update creature_templates to use SAI
+UPDATE `creature_template` SET `ainame`='SmartAI' WHERE `entry` IN (@DIBear,@LJBunny);
+-- Update Icy Crater phaseMask
+UPDATE `gameobject` SET `phaseMask`=4 WHERE `guid`=99730;
+-- Add Dead Icemaw Bear SAI
+DELETE FROM `smart_scripts` WHERE `entryorguid`=30292 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
+(@DIBear,0,0,1,8,0,100,0,56562,0,0,0,11,56565,0,0,0,0,0,7,0,0,0,0,0,0,0,'Dead Icemaw Bear - On Spell Hit - Cast Bear Flank Master'),
+(@DIBear,0,1,0,61,0,100,0,0,0,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Dead Icemaw Bear - Link With Previous Event - Despawn'),
+(@DIBear,0,2,0,8,0,100,0,56569,0,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Dead Icemaw Bear - On Spell Hit - Despawn');
+-- Add Lure Jormuttar Bunny SAI
+DELETE FROM `smart_scripts` WHERE `entryorguid`=@LJBunny 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
+(@LJBunny,0,0,0,11,0,100,0,0,0,0,0,12,30340,2,120000,0,0,0,1,0,0,0,0,0,0,0,'Lure Jormuttar Bunny - On Spawn - Summon Jormuttar');
+-- Add Dead Icemaw Bear creature_text
+DELETE FROM `creature_text` WHERE `entry`=30292;
+INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES
+(@DIBear,0,0,'This bear\'s flank is frozen solid... try again.',42,0,0,0,0,0,'');
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index 10cc62a8a91..fcf87e9bfac 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -1785,6 +1785,62 @@ class spell_q12847_summon_soul_moveto_bunny : public SpellScriptLoader
}
};
+enum BearFlankMaster
+{
+ SPELL_BEAR_FLANK_MASTER = 56565,
+ SPELL_CREATE_BEAR_FLANK = 56566,
+ SPELL_BEAR_FLANK_FAIL = 56569
+};
+
+class spell_q13011_bear_flank_master : public SpellScriptLoader
+{
+ public:
+ spell_q13011_bear_flank_master() : SpellScriptLoader("spell_q13011_bear_flank_master") { }
+
+ class spell_q13011_bear_flank_master_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q13011_bear_flank_master_SpellScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_BEAR_FLANK_MASTER) || !sSpellMgr->GetSpellInfo(SPELL_CREATE_BEAR_FLANK))
+ return false;
+ return true;
+ }
+
+ bool Load() OVERRIDE
+ {
+ return GetCaster()->GetTypeId() == TYPEID_UNIT;
+ }
+
+ void HandleScript(SpellEffIndex effIndex)
+ {
+ bool failed = RAND(0, 1); // 50% chance
+ Creature* creature = GetCaster()->ToCreature();
+ if (Player* player = GetHitPlayer())
+ {
+ if (failed)
+ {
+ player->CastSpell(creature, SPELL_BEAR_FLANK_FAIL);
+ creature->AI()->Talk(0, player->GetGUID());
+ }
+ else
+ player->CastSpell(player, SPELL_CREATE_BEAR_FLANK);
+ }
+ }
+
+ void Register() OVERRIDE
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_q13011_bear_flank_master_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const OVERRIDE
+ {
+ return new spell_q13011_bear_flank_master_SpellScript();
+ }
+};
+
class spell_q13086_cannons_target : public SpellScriptLoader
{
public:
@@ -1863,5 +1919,6 @@ void AddSC_quest_spell_scripts()
new spell_q13291_q13292_q13239_q13261_frostbrood_skytalon_grab_decoy();
new spell_q13291_q13292_q13239_q13261_armored_decoy_summon_skytalon();
new spell_q12847_summon_soul_moveto_bunny();
+ new spell_q13011_bear_flank_master();
new spell_q13086_cannons_target();
}