From 201fb580a41f36ee317b66b6ee57cec2150b5c7e Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Tue, 30 Nov 2021 00:57:38 +0100 Subject: [PATCH] =?UTF-8?q?fix(Core/Auras):=20Set=20proper=20displayId=20f?= =?UTF-8?q?or=20mounts=20that=20changes=20dependi=E2=80=A6=20(#9342)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(Core/Auras): Set proper displayId for mounts that changes depending on your Riding skill and location with more than one modelId * cherry-pick commit (https://github.com/TrinityCore/TrinityCore/commit/a5b8e167dda0697f88b16ce0892912afda4c3e4b) Co-Authored-By: Gildor <521036+Jildor@users.noreply.github.com> * codestyle Co-authored-by: Gildor <521036+Jildor@users.noreply.github.com> --- .../rev_1637860809744969300.sql | 7 ++++ .../game/Spells/Auras/SpellAuraEffects.cpp | 40 ++++++++++++------- 2 files changed, 32 insertions(+), 15 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1637860809744969300.sql diff --git a/data/sql/updates/pending_db_world/rev_1637860809744969300.sql b/data/sql/updates/pending_db_world/rev_1637860809744969300.sql new file mode 100644 index 000000000..89886ca04 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1637860809744969300.sql @@ -0,0 +1,7 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1637860809744969300'); + +-- Set proper modelid +UPDATE `creature_template` SET `modelid1`=31248, `modelid2`=31007 WHERE `entry`=38545; -- Invincible +UPDATE `creature_template` SET `modelid1`=31957, `modelid2`=31958 WHERE `entry`=40625; -- Celestial Steed +-- Invincible wrong otherGender displayID +UPDATE `creature_model_info` SET `DisplayID_Other_Gender`=0 WHERE `DisplayID` IN (31007,31248); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 3437ec70c..75496f3c6 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2813,6 +2813,8 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo if (apply) { uint32 creatureEntry = GetMiscValue(); + uint32 displayId = 0; + uint32 vehicleId = 0; // Festive Holiday Mount if (target->HasAura(62061)) @@ -2836,23 +2838,31 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo } } - CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(creatureEntry); - if (!ci) + if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry)) { - LOG_ERROR("sql.sql", "AuraMounted: `creature_template`='%u' not found in database (only need its modelid)", GetMiscValue()); - return; + if (GetMiscValueB() > 0) // Choose proper modelid + { + displayId = GetMiscValueB() == 2 && creatureInfo->Modelid2 > 0 ? creatureInfo->Modelid2 : creatureInfo->Modelid1; + } + else // Should we choose random modelid in this case? + { + displayId = ObjectMgr::ChooseDisplayId(creatureInfo); + } + sObjectMgr->GetCreatureModelRandomGender(&displayId); + + vehicleId = creatureInfo->VehicleId; + + //some spell has one aura of mount and one of vehicle + for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + if (GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_SUMMON && GetSpellInfo()->Effects[i].MiscValue == GetMiscValue()) + { + displayId = 0; + } + } + } - - uint32 displayID = ObjectMgr::ChooseDisplayId(ci); - sObjectMgr->GetCreatureModelRandomGender(&displayID); - - //some spell has one aura of mount and one of vehicle - for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_SUMMON - && GetSpellInfo()->Effects[i].MiscValue == GetMiscValue()) - displayID = 0; - - target->Mount(displayID, ci->VehicleId, GetMiscValue()); + target->Mount(displayId, vehicleId, GetMiscValue()); } else {