fix(Core/Spells): Fixed players being able to mount with all transfor… (#11767)

…m auras.

Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
UltraNix
2022-05-25 09:56:35 +02:00
committed by GitHub
parent edfd2bba8e
commit b66586c1d7
7 changed files with 126 additions and 15 deletions

View File

@@ -20669,3 +20669,58 @@ bool Unit::CanRestoreMana(SpellInfo const* spellInfo) const
return false;
}
bool Unit::IsInDisallowedMountForm() const
{
if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(getTransForm()))
{
if (transformSpellInfo->HasAttribute(SPELL_ATTR0_ALLOW_WHILE_MOUNTED))
{
return false;
}
}
if (ShapeshiftForm form = GetShapeshiftForm())
{
SpellShapeshiftEntry const* shapeshift = sSpellShapeshiftStore.LookupEntry(form);
if (!shapeshift)
{
return true;
}
if (!(shapeshift->flags1 & 0x1))
{
return true;
}
}
if (GetDisplayId() == GetNativeDisplayId())
{
return false;
}
CreatureDisplayInfoEntry const* display = sCreatureDisplayInfoStore.LookupEntry(GetDisplayId());
if (!display)
{
return true;
}
CreatureDisplayInfoExtraEntry const* displayExtra = sCreatureDisplayInfoExtraStore.LookupEntry(display->ExtendedDisplayInfoID);
if (!displayExtra)
{
return true;
}
CreatureModelDataEntry const* model = sCreatureModelDataStore.LookupEntry(display->ModelId);
ChrRacesEntry const* race = sChrRacesStore.LookupEntry(displayExtra->DisplayRaceID);
if (model && !(model->HasFlag(CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT)))
{
if (race && !(race->HasFlag(CHRRACES_FLAGS_CAN_MOUNT)))
{
return true;
}
}
return false;
}