fix(Core/Auras): Set proper displayId for mounts that changes dependi… (#9342)

* 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 (a5b8e167dd)

Co-Authored-By: Gildor <521036+Jildor@users.noreply.github.com>

* codestyle

Co-authored-by: Gildor <521036+Jildor@users.noreply.github.com>
This commit is contained in:
Kitzunu
2021-11-30 00:57:38 +01:00
committed by GitHub
parent c36168c604
commit 201fb580a4
2 changed files with 32 additions and 15 deletions

View File

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

View File

@@ -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
{