diff --git a/data/sql/updates/pending_db_world/rev_1681232229972193910.sql b/data/sql/updates/pending_db_world/rev_1681232229972193910.sql new file mode 100644 index 000000000..6ff94cfb7 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1681232229972193910.sql @@ -0,0 +1,5 @@ +-- Add spell script to database for 63471 - Spawn Blood Pool +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_spawn_blood_pool'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(63471, 'spell_spawn_blood_pool'); + diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index ac326f538..e4acbc9a1 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2030,8 +2030,7 @@ class spell_gen_animal_blood : public AuraScript { if (Unit* owner = GetUnitOwner()) { - if (owner->IsInWater()) - owner->CastSpell(owner, SPELL_SPAWN_BLOOD_POOL, true); + owner->CastSpell(owner, SPELL_SPAWN_BLOOD_POOL, true); } } @@ -2042,6 +2041,27 @@ class spell_gen_animal_blood : public AuraScript } }; +// 63471 - Spawn Blood Pool +class spell_spawn_blood_pool : public SpellScript +{ + PrepareSpellScript(spell_spawn_blood_pool); + + void SetDest(SpellDestination &dest) + { + Unit* caster = GetCaster(); + LiquidData liquidStatus = caster->GetMap()->GetLiquidData(caster->GetPhaseMask(), caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), caster->GetCollisionHeight(), MAP_ALL_LIQUIDS); + + float level = liquidStatus.Level > INVALID_HEIGHT ? liquidStatus.Level : caster->GetPositionZ(); + Position pos = Position(caster->GetPositionX(), caster->GetPositionY(), level, caster->GetOrientation()); + dest.Relocate(pos); + } + + void Register() override + { + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_spawn_blood_pool::SetDest, EFFECT_0, TARGET_DEST_CASTER); + } +}; + enum DivineStormSpell { SPELL_DIVINE_STORM = 53385, @@ -4893,6 +4913,7 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_feign_death_no_prevent_emotes); RegisterSpellScript(spell_pvp_trinket_wotf_shared_cd); RegisterSpellScript(spell_gen_animal_blood); + RegisterSpellScript(spell_spawn_blood_pool); RegisterSpellScript(spell_gen_divine_storm_cd_reset); RegisterSpellScript(spell_gen_profession_research); RegisterSpellScript(spell_gen_clone);