diff --git a/sql/updates/world/custom/custom_2019_06_05_02_world.sql b/sql/updates/world/custom/custom_2019_06_05_02_world.sql new file mode 100644 index 00000000000..59c418154fd --- /dev/null +++ b/sql/updates/world/custom/custom_2019_06_05_02_world.sql @@ -0,0 +1,5 @@ +UPDATE `spell_area` SET `quest_start`= 14320 WHERE `spell`= 14375 AND `area`= 4714; + +DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_gilneas_worgen_intro_completion'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(68638, 'spell_gilneas_worgen_intro_completion'); diff --git a/src/server/scripts/EasternKingdoms/Gilneas/chapter2.cpp b/src/server/scripts/EasternKingdoms/Gilneas/chapter2.cpp index a5fdb23f6b0..3f060bab3ce 100644 --- a/src/server/scripts/EasternKingdoms/Gilneas/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/Gilneas/chapter2.cpp @@ -743,6 +743,45 @@ class spell_gilneas_forcecast_cataclysm_1 : public SpellScriptLoader } }; +class SummonerTargetSelector +{ +public: + SummonerTargetSelector(Unit* caster) : _caster(caster) { } + + bool operator() (WorldObject* target) + { + if (target->GetTypeId() != TYPEID_UNIT) + return true; + + if (TempSummon* summon = target->ToUnit()->ToTempSummon()) + if (summon->GetSummoner() == _caster) + return false; + + return true; + } + +private: + Unit* _caster; +}; + +class spell_gilneas_worgen_intro_completion : public SpellScript +{ + PrepareSpellScript(spell_gilneas_worgen_intro_completion); + + void FilterTargets(std::list& targets) + { + if (targets.empty()) + return; + + targets.remove_if(SummonerTargetSelector(GetCaster())); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gilneas_worgen_intro_completion::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY); + } +}; + void AddSC_gilneas_c2() { new go_gilneas_invasion_camera(); @@ -757,4 +796,5 @@ void AddSC_gilneas_c2() new spell_gilneas_fiery_boulder(); new spell_gilneas_call_attack_mastiff(); new spell_gilneas_forcecast_cataclysm_1(); + RegisterSpellScript(spell_gilneas_worgen_intro_completion); }