fix(Core/Pets): Correct Pet size for bigger pets 2 (#18867)

* scale displayInfo, cap scale to maxScale

* prevent scaling with displayInfo if scale is already increasing the size
This commit is contained in:
Jelle Meeus
2024-07-04 21:34:14 +02:00
committed by GitHub
parent 2cfe665a53
commit 37431cd7a6

View File

@@ -2499,11 +2499,6 @@ float Pet::GetNativeObjectScale() const
{
uint8 ctFamily = GetCreatureTemplate()->family;
// hackfix: Edge case where DBC scale values for DEVILSAUR pets make them too small.
// Therefore we take data from spirit beast instead.
if (ctFamily && ctFamily == CREATURE_FAMILY_DEVILSAUR)
ctFamily = CREATURE_FAMILY_SPIRIT_BEAST;
CreatureFamilyEntry const* creatureFamily = sCreatureFamilyStore.LookupEntry(ctFamily);
if (creatureFamily && creatureFamily->minScale > 0.0f && getPetType() & HUNTER_PET)
{
@@ -2520,6 +2515,13 @@ float Pet::GetNativeObjectScale() const
float scale = (creatureFamily->maxScale - creatureFamily->minScale) * scaleMod + creatureFamily->minScale;
scale = std::min(scale, creatureFamily->maxScale);
if (CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId()))
{
if (scale < 1.f && displayInfo->scale > 1.f)
scale *= displayInfo->scale;
}
return scale;
}