Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2023-08-10 13:45:03 +08:00
12 changed files with 124 additions and 32 deletions

View File

@@ -2480,34 +2480,34 @@ Player* Pet::GetOwner() const
float Pet::GetNativeObjectScale() const
{
CreatureFamilyEntry const* creatureFamily = sCreatureFamilyStore.LookupEntry(GetCreatureTemplate()->family);
if (creatureFamily && creatureFamily->minScale > 0.0f && getPetType() == HUNTER_PET)
{
float scale;
if (GetLevel() >= creatureFamily->maxScaleLevel)
scale = creatureFamily->maxScale;
else if (GetLevel() <= creatureFamily->minScaleLevel)
scale = creatureFamily->minScale;
else
scale = creatureFamily->minScale + float(GetLevel() - creatureFamily->minScaleLevel) / creatureFamily->maxScaleLevel * (creatureFamily->maxScale - creatureFamily->minScale);
uint8 ctFamily = GetCreatureTemplate()->family;
if (CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId()))
{
if (displayInfo->scale > 1.f && GetCreatureTemplate()->IsExotic())
{
// Exotic pets have a scale of 1
scale = 1.0f;
}
else
{
scale *= displayInfo->scale;
}
}
// 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)
{
float minScaleLevel = creatureFamily->minScaleLevel;
uint8 level = getLevel();
float minLevelScaleMod = level >= minScaleLevel ? (level / minScaleLevel) : 0.0f;
float maxScaleMod = creatureFamily->maxScaleLevel - minScaleLevel;
if (minLevelScaleMod > maxScaleMod)
minLevelScaleMod = maxScaleMod;
float scaleMod = creatureFamily->maxScaleLevel != minScaleLevel ? minLevelScaleMod / maxScaleMod : 0.f;
float scale = (creatureFamily->maxScale - creatureFamily->minScale) * scaleMod + creatureFamily->minScale;
return scale;
}
// Fallback value if the conditions are not met
return 1.0f;
// take value for non-hunter pets from DB
return Guardian::GetNativeObjectScale();
}
std::string Pet::GenerateActionBarData() const

View File

@@ -4766,6 +4766,14 @@ void Unit::RemoveAura(AuraApplication* aurApp, AuraRemoveMode mode)
{
if (aurApp == iter->second)
{
// Prevent Arena Preparation aura from being removed by player actions
// It's an invisibility spell so any interaction/spell cast etc. removes it.
// Should only be removed by the arena script, once the match starts.
if (aurApp->GetBase()->HasEffectType(SPELL_AURA_ARENA_PREPARATION))
{
return;
}
RemoveAura(iter, mode);
return;
}