diff options
author | Teleqraph <nyrdeveloper@gmail.com> | 2022-07-16 15:34:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-16 15:34:23 +0200 |
commit | 8cbc3923a18add49dd483e0e6e9d851f1d4d59f7 (patch) | |
tree | 366d13de337de1d07504f385ecf2ced1a0225101 /src | |
parent | 060d70bb4ac1d1774b907874eb2240f9eaf509cd (diff) |
Core/Creatures: Implement Ground/FlyingMountDisplayID from creature_summoned_data (#28085)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 68c6b6a7c1d..1aa75e40d48 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -4993,6 +4993,45 @@ class spell_gen_anchor_here : public SpellScript } }; +// 147066 - (Serverside/Non-DB2) Generic - Mount Check Aura +class spell_gen_mount_check_aura : public AuraScript +{ + PrepareAuraScript(spell_gen_mount_check_aura); + + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + Unit* target = GetTarget(); + uint32 mountDisplayId = 0; + + TempSummon* tempSummon = target->ToTempSummon(); + if (!tempSummon) + return; + + Player const* summoner = Object::ToPlayer(tempSummon->GetSummoner()); + if (!summoner) + return; + + if (summoner->IsMounted() && (!summoner->IsInCombat() || summoner->IsFlying())) + { + if (CreatureSummonedData const* summonedData = sObjectMgr->GetCreatureSummonedData(tempSummon->GetEntry())) + { + if (summoner->IsFlying() && summonedData->FlyingMountDisplayID) + mountDisplayId = *summonedData->FlyingMountDisplayID; + else if (summonedData->GroundMountDisplayID) + mountDisplayId = *summonedData->GroundMountDisplayID; + } + } + + if (mountDisplayId != target->GetMountDisplayId()) + target->SetMountDisplayId(mountDisplayId); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_mount_check_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } +}; + void AddSC_generic_spell_scripts() { RegisterSpellScript(spell_gen_absorb0_hitlimit1); @@ -5147,4 +5186,5 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_defender_of_azeroth_speak_with_mograine); RegisterSpellScript(spell_summon_battle_pet); RegisterSpellScript(spell_gen_anchor_here); + RegisterSpellScript(spell_gen_mount_check_aura); } |