From 6486f727403c3abe635f5b3816f44922db29c98a Mon Sep 17 00:00:00 2001 From: Grimgravy Date: Sun, 12 Nov 2023 13:52:49 -0300 Subject: [PATCH] fix(Script/Quest): Improve A Spirit Ally? (#16893) * fix(db/Quest): Improve A Spirit Ally? * Update spell_quest.cpp * improvement in position --- .../rev_1691168515464608300.sql | 24 +++++++++++++++++++ src/server/scripts/Spells/spell_quest.cpp | 24 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1691168515464608300.sql diff --git a/data/sql/updates/pending_db_world/rev_1691168515464608300.sql b/data/sql/updates/pending_db_world/rev_1691168515464608300.sql new file mode 100644 index 000000000..1adb5bc02 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1691168515464608300.sql @@ -0,0 +1,24 @@ +-- +DELETE FROM `creature_text` WHERE `CreatureID` = 18185; +INSERT INTO `creature_text` (`CreatureID`,`GroupID`,`ID`,`Text`,`Type`,`Language`,`Probability`,`Emote`,`Duration`,`Sound`,`BroadcastTextId`,`TextRange`,`comment`) VALUES +(18185,0,0,"The %s hisses loudly and prepares to attack.",16,0,100,0,0,0,14853,0,"Feralfen Serpent Spirit"); + +-- Feralfen Totem +UPDATE `creature_template` SET `unit_flags` = 2 WHERE (`entry` = 18186); + +-- Feralfen Serpent Spirit +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 18185; + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 18185); +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`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(18185, 0, 0, 1, 1, 0, 100, 0, 1500, 1500, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Feralfen Serpent Spirit - Out of Combat - Say Line 0'), +(18185, 0, 1, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 21, 80, 0, 0, 0, 0, 0, 0, 0, 'Feralfen Serpent Spirit - Out of Combat - Start Attacking'); + +-- Boha'mu Stairs +DELETE FROM `gameobject` WHERE (`id` = 182176); +INSERT INTO `gameobject` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `ScriptName`, `VerifiedBuild`) VALUES +(99924, 182176, 530, 0, 0, 1, 1, -281.944, 7238.6, 24.7725, 0, 0, 0, 0, 1, 180, 0, 1, '', 0); + +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_q9847_a_spirit_ally'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(32037, 'spell_q9847_a_spirit_ally'); diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 4c87c887a..eeb50a4b1 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -2472,6 +2472,29 @@ class spell_q10651_q10692_book_of_fel_names : public SpellScript } }; +enum Feralfen +{ + NPC_FERALFEN_TOTEM = 18186 +}; + +class spell_q9847_a_spirit_ally : public SpellScript +{ + PrepareSpellScript(spell_q9847_a_spirit_ally); + + void HandleSendEvent(SpellEffIndex /*effIndex*/) + { + float dist = 5.0f; + float angle = GetCaster()->GetOrientation() - 1.25f; + Position pos = GetCaster()->GetNearPosition(dist, angle); + GetCaster()->SummonCreature(NPC_FERALFEN_TOTEM, pos, TEMPSUMMON_TIMED_DESPAWN, 1 * MINUTE * IN_MILLISECONDS); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_q9847_a_spirit_ally::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); + } +}; + void AddSC_quest_spell_scripts() { RegisterSpellAndAuraScriptPair(spell_q11065_wrangle_some_aether_rays, spell_q11065_wrangle_some_aether_rays_aura); @@ -2544,4 +2567,5 @@ void AddSC_quest_spell_scripts() RegisterSpellScript(spell_q5056_summon_shy_rotam); RegisterSpellScript(spell_q4735_collect_rookery_egg); RegisterSpellScript(spell_q10651_q10692_book_of_fel_names); + RegisterSpellScript(spell_q9847_a_spirit_ally); }