From 59557091a6cab47f0a653ef0ca7c2c8aa7635901 Mon Sep 17 00:00:00 2001 From: Gacko Date: Sun, 14 Oct 2012 17:24:59 +0200 Subject: [PATCH 1/3] Core/DB: Quest 'Distortions in time' --- ...012-10-14-00-world_distortions_in_time.sql | 37 ++++++++++++++ src/server/scripts/Northrend/storm_peaks.cpp | 48 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 sql/updates/world/2012-10-14-00-world_distortions_in_time.sql diff --git a/sql/updates/world/2012-10-14-00-world_distortions_in_time.sql b/sql/updates/world/2012-10-14-00-world_distortions_in_time.sql new file mode 100644 index 00000000000..46d566c092d --- /dev/null +++ b/sql/updates/world/2012-10-14-00-world_distortions_in_time.sql @@ -0,0 +1,37 @@ +-- Area conditions for Plant Chieftains Totem +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=56765; +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceEntry`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ErrorTextId`,`Comment`) VALUES +(17,56765,29,30446,10,64,'Plant Chieftains Totem only useable next to Rift'); + +-- Apply Close Rift to The Chieftain's Totem +DELETE FROM `creature_template_addon` WHERE `entry`=30444; +INSERT INTO `creature_template_addon`(`entry`,`auras`) VALUES +(30444,'56763'); + +-- Assign aura script to Close Rift +DELETE FROM `spell_script_names` WHERE `spell_id`=56763; +INSERT INTO `spell_script_names`(`spell_id`,`ScriptName`) VALUES +(56763,'spell_close_rift'); + +-- Target conditions for spell triggered by Close Rift Periodic +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (56764,61665); +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`Comment`) VALUES +(13,1,56764,31,3,30446,'Close Rift Periodic targets Frostfloe Rift'), +(13,1,61665,31,3,30446,'Despawn Rift targets Frostfloe Rift'); + +-- Assign SmartAI to Frostfloe Rift +UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=30446; + +-- Create SAI for Frostfloe Rift +DELETE FROM `smart_scripts` WHERE `entryorguid`=30446 AND `source_type`=0; +INSERT INTO `smart_scripts`(`entryorguid`,`id`,`link`,`event_type`,`event_param1`,`action_type`,`action_param1`,`action_param2`,`target_type`,`comment`) VALUES +(30446,1,2,8,61665,45,1,1,7,'Frostfloe Rift - On spell hit - Set data of invoker'), +(30446,2,0,61,0,41,0,0,1,'Frostfloe Rift - On spell hit - Despawn'); + +-- Assign SmartAI to Chieftain's Totem +UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=30444; + +-- Create SAI for Chieftain's Totem +DELETE FROM `smart_scripts` WHERE `entryorguid`=30444 AND `source_type`=0; +INSERT INTO `smart_scripts`(`entryorguid`,`event_type`,`event_param1`,`event_param2`,`action_type`,`action_param1`,`target_type`,`comment`) VALUES +(30444,38,1,1,33,30444,23,'Chieftains Totem - On data set - Give quest credit'); diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp index 976a6e5dba5..5c375d84998 100644 --- a/src/server/scripts/Northrend/storm_peaks.cpp +++ b/src/server/scripts/Northrend/storm_peaks.cpp @@ -564,6 +564,53 @@ class npc_hyldsmeet_protodrake : public CreatureScript } }; +enum eCloseRift +{ + SPELL_DESPAWN_RIFT = 61665 +}; + +class spell_close_rift : public SpellScriptLoader +{ + public: + spell_close_rift() : SpellScriptLoader("spell_close_rift") { } + + class spell_close_rift_AuraScript : public AuraScript + { + PrepareAuraScript(spell_close_rift_AuraScript); + + bool Load() + { + counter = 0; + return true; + } + + bool Validate(SpellInfo const* /*spell*/) + { + return (bool) sSpellMgr->GetSpellInfo(SPELL_DESPAWN_RIFT); + } + + void HandlePeriodic(AuraEffect const* /* aurEff */) + { + if (++counter == 5) + GetTarget()->CastSpell((Unit*)NULL, SPELL_DESPAWN_RIFT, true); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_close_rift_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + + private: + uint8 counter; + + }; + + AuraScript* GetAuraScript() const + { + return new spell_close_rift_AuraScript(); + } +}; + void AddSC_storm_peaks() { new npc_agnetta_tyrsdottar(); @@ -574,4 +621,5 @@ void AddSC_storm_peaks() new npc_freed_protodrake(); new npc_icefang(); new npc_hyldsmeet_protodrake(); + new spell_close_rift(); } From 887509b1dede2f9fb4a3a16d025821d9fda99263 Mon Sep 17 00:00:00 2001 From: Gacko Date: Sun, 14 Oct 2012 19:18:41 +0200 Subject: [PATCH 2/3] Core/DB: Quest 'Distortions in time' --- sql/updates/world/2012-10-14-00-world_distortions_in_time.sql | 2 +- src/server/scripts/Northrend/storm_peaks.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/updates/world/2012-10-14-00-world_distortions_in_time.sql b/sql/updates/world/2012-10-14-00-world_distortions_in_time.sql index 46d566c092d..fe74f8a7a80 100644 --- a/sql/updates/world/2012-10-14-00-world_distortions_in_time.sql +++ b/sql/updates/world/2012-10-14-00-world_distortions_in_time.sql @@ -1,7 +1,7 @@ -- Area conditions for Plant Chieftains Totem DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=56765; INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceEntry`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ErrorTextId`,`Comment`) VALUES -(17,56765,29,30446,10,64,'Plant Chieftains Totem only useable next to Rift'); +(17,56765,29,30446,15,64,'Plant Chieftains Totem only useable next to Rift'); -- Apply Close Rift to The Chieftain's Totem DELETE FROM `creature_template_addon` WHERE `entry`=30444; diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp index 5c375d84998..de17fb843d8 100644 --- a/src/server/scripts/Northrend/storm_peaks.cpp +++ b/src/server/scripts/Northrend/storm_peaks.cpp @@ -586,7 +586,7 @@ class spell_close_rift : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) { - return (bool) sSpellMgr->GetSpellInfo(SPELL_DESPAWN_RIFT); + return sSpellMgr->GetSpellInfo(SPELL_DESPAWN_RIFT); } void HandlePeriodic(AuraEffect const* /* aurEff */) From 1da4a8503cef12d51e9d14a86f21e272cdde19ad Mon Sep 17 00:00:00 2001 From: Gacko Date: Tue, 16 Oct 2012 12:01:48 +0200 Subject: [PATCH 3/3] Core: Quest 'Distortion in time' - Codestyle Replace enum name eCloseRift with CloseRift and add underscore to private member counter. --- src/server/scripts/Northrend/storm_peaks.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp index de17fb843d8..fc4f2785990 100644 --- a/src/server/scripts/Northrend/storm_peaks.cpp +++ b/src/server/scripts/Northrend/storm_peaks.cpp @@ -564,7 +564,7 @@ class npc_hyldsmeet_protodrake : public CreatureScript } }; -enum eCloseRift +enum CloseRift { SPELL_DESPAWN_RIFT = 61665 }; @@ -580,7 +580,7 @@ class spell_close_rift : public SpellScriptLoader bool Load() { - counter = 0; + _counter = 0; return true; } @@ -591,7 +591,7 @@ class spell_close_rift : public SpellScriptLoader void HandlePeriodic(AuraEffect const* /* aurEff */) { - if (++counter == 5) + if (++_counter == 5) GetTarget()->CastSpell((Unit*)NULL, SPELL_DESPAWN_RIFT, true); } @@ -601,7 +601,7 @@ class spell_close_rift : public SpellScriptLoader } private: - uint8 counter; + uint8 _counter; };