fix(Scripts/Spells): Prevent from stacking basic campfires on each ot… (#13037)

fix(Scripts/Spells): Prevent from stacking basic campfires on each other.

Fixes #9369
This commit is contained in:
UltraNix
2022-09-25 15:44:33 +02:00
committed by GitHub
parent 63acc11234
commit 91daa6cb78
2 changed files with 28 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
--
DELETE FROM `spell_script_names` WHERE `spell_id`=818;
INSERT INTO `spell_script_names` VALUES
(818,'spell_gen_basic_campfire');

View File

@@ -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);
}