From 91daa6cb7813f5f9edf1dab2d3104b432a29e792 Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Sun, 25 Sep 2022 15:44:33 +0200 Subject: [PATCH] =?UTF-8?q?fix(Scripts/Spells):=20Prevent=20from=20stackin?= =?UTF-8?q?g=20basic=20campfires=20on=20each=20ot=E2=80=A6=20(#13037)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(Scripts/Spells): Prevent from stacking basic campfires on each other. Fixes #9369 --- .../rev_1663405794661340300.sql | 4 ++++ src/server/scripts/Spells/spell_generic.cpp | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1663405794661340300.sql diff --git a/data/sql/updates/pending_db_world/rev_1663405794661340300.sql b/data/sql/updates/pending_db_world/rev_1663405794661340300.sql new file mode 100644 index 000000000..ad5b5e402 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1663405794661340300.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_script_names` WHERE `spell_id`=818; +INSERT INTO `spell_script_names` VALUES +(818,'spell_gen_basic_campfire'); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 280fd2c60..ea4028627 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -4571,6 +4571,29 @@ private: uint32 _aura; }; +// 818 Basic Campfire +class spell_gen_basic_campfire : public SpellScript +{ + PrepareSpellScript(spell_gen_basic_campfire); + + void ModDest(SpellDestination& dest) + { + if (Unit* caster = GetCaster()) + { + if (caster->GetMap()->GetGameObjectFloor(caster->GetPhaseMask(), caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ()) == -G3D::finf()) + { + float ground = caster->GetMap()->GetHeight(dest._position.GetPositionX(), dest._position.GetPositionY(), dest._position.GetPositionZ() + caster->GetCollisionHeight() * 0.5f); + dest._position.m_positionZ = ground; + } + } + } + + void Register() override + { + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_gen_basic_campfire::ModDest, EFFECT_0, TARGET_DEST_CASTER_SUMMON); + } +}; + void AddSC_generic_spell_scripts() { RegisterSpellScript(spell_silithyst); @@ -4708,4 +4731,5 @@ void AddSC_generic_spell_scripts() RegisterSpellScriptWithArgs(spell_gen_consume, "spell_consume_aq20", SPELL_CONSUME_LEECH_AQ20, SPELL_CONSUME_LEECH_HEAL_AQ20); RegisterSpellScriptWithArgs(spell_gen_apply_aura_after_expiration, "spell_itch_aq20", SPELL_HIVEZARA_CATALYST, EFFECT_0, SPELL_AURA_DUMMY); RegisterSpellScriptWithArgs(spell_gen_apply_aura_after_expiration, "spell_itch_aq40", SPELL_VEKNISS_CATALYST, EFFECT_0, SPELL_AURA_DUMMY); + RegisterSpellScript(spell_gen_basic_campfire); }