Core/Spells: Updated spell shapeshift form flags enum

This commit is contained in:
Shauren
2021-03-19 23:48:33 +01:00
parent 69e0b9a985
commit 6db27c58b9
5 changed files with 27 additions and 13 deletions

View File

@@ -3171,6 +3171,8 @@ struct SpellShapeshiftFormEntry
uint16 MountTypeID;
uint32 CreatureDisplayID[4];
uint32 PresetSpellID[MAX_SHAPESHIFT_SPELLS];
EnumFlag<SpellShapeshiftFormFlags> GetFlags() const { return static_cast<SpellShapeshiftFormFlags>(Flags); }
};
struct SpellTargetRestrictionsEntry

View File

@@ -1357,19 +1357,29 @@ enum SpellProcsPerMinuteModType
constexpr std::size_t MAX_POWERS_PER_SPELL = 4;
enum SpellShapeshiftFormFlags
enum class SpellShapeshiftFormFlags : int32
{
SHAPESHIFT_FORM_IS_NOT_A_SHAPESHIFT = 0x0001,
SHAPESHIFT_FORM_CANNOT_CANCEL = 0x0002, // player cannot cancel the aura giving this shapeshift
SHAPESHIFT_FORM_CAN_INTERACT = 0x0008, // if the form does not have SHAPESHIFT_FORM_IS_NOT_A_SHAPESHIFT then this flag must be present to allow NPC interaction
SHAPESHIFT_FORM_CAN_EQUIP_ITEMS = 0x0040, // if the form does not have SHAPESHIFT_FORM_IS_NOT_A_SHAPESHIFT then this flag allows equipping items without ITEM_FLAG_USABLE_WHEN_SHAPESHIFTED
SHAPESHIFT_FORM_CAN_USE_ITEMS = 0x0080, // if the form does not have SHAPESHIFT_FORM_IS_NOT_A_SHAPESHIFT then this flag allows using items without ITEM_FLAG_USABLE_WHEN_SHAPESHIFTED
SHAPESHIFT_FORM_CAN_AUTO_UNSHIFT = 0x0100, // clientside
SHAPESHIFT_FORM_PREVENT_LFG_TELEPORT = 0x0200,
SHAPESHIFT_FORM_PREVENT_USING_OWN_SKILLS = 0x0400, // prevents using spells that don't have any shapeshift requirement
SHAPESHIFT_FORM_PREVENT_EMOTE_SOUNDS = 0x1000
Stance = 0x00000001,
NotToggleable = 0x00000002, // player cannot cancel the aura giving this shapeshift
PersistOnDeath = 0x00000004,
CanInteractNPC = 0x00000008, // if the form does not have SHAPESHIFT_FORM_IS_NOT_A_SHAPESHIFT then this flag must be present to allow NPC interaction
DontUseWeapon = 0x00000010,
CanUseEquippedItems = 0x00000040, // if the form does not have SHAPESHIFT_FORM_IS_NOT_A_SHAPESHIFT then this flag allows equipping items without ITEM_FLAG_USABLE_WHEN_SHAPESHIFTED
CanUseItems = 0x00000080, // if the form does not have SHAPESHIFT_FORM_IS_NOT_A_SHAPESHIFT then this flag allows using items without ITEM_FLAG_USABLE_WHEN_SHAPESHIFTED
DontAutoUnshift = 0x00000100, // clientside
ConsideredDead = 0x00000200,
CanOnlyCastShapeshiftSpells = 0x00000400, // prevents using spells that don't have any shapeshift requirement
StanceCancelsAtFlightmaster = 0x00000800,
NoEmoteSounds = 0x00001000,
NoTriggerTeleport = 0x00002000,
CannotChangeEquippedItems = 0x00004000,
CannotUseGameObjects = 0x00010000
};
DEFINE_ENUM_FLAG(SpellShapeshiftFormFlags);
#define TaxiMaskSize 337
typedef std::array<uint8, TaxiMaskSize> TaxiMask;

View File

@@ -9500,7 +9500,7 @@ bool Unit::IsDisallowedMountForm(uint32 spellId, ShapeshiftForm form, uint32 dis
if (!shapeshift)
return true;
if (!(shapeshift->Flags & SHAPESHIFT_FORM_IS_NOT_A_SHAPESHIFT))
if (!shapeshift->GetFlags().HasFlag(SpellShapeshiftFormFlags::Stance))
return true;
}

View File

@@ -142,6 +142,8 @@ enum ShapeshiftForm
FORM_SPIRIT_OWL_FORM_2 = 38,
FORM_WISP_FORM = 39,
FORM_WISP_FORM_2 = 40,
FORM_SOULSHAPE = 41,
FORM_FORGEBORNE_REVERIES = 42
};
enum UnitMoveType

View File

@@ -1887,12 +1887,12 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const
TC_LOG_ERROR("spells", "GetErrorAtShapeshiftedCast: unknown shapeshift %u", form);
return SPELL_CAST_OK;
}
actAsShifted = !(shapeInfo->Flags & SHAPESHIFT_FORM_IS_NOT_A_SHAPESHIFT);
actAsShifted = !shapeInfo->GetFlags().HasFlag(SpellShapeshiftFormFlags::Stance);
}
if (actAsShifted)
{
if (HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFT) || (shapeInfo && shapeInfo->Flags & SHAPESHIFT_FORM_PREVENT_USING_OWN_SKILLS)) // not while shapeshifted
if (HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFT) || (shapeInfo && shapeInfo->GetFlags().HasFlag(SpellShapeshiftFormFlags::CanOnlyCastShapeshiftSpells))) // not while shapeshifted
return SPELL_FAILED_NOT_SHAPESHIFT;
else if (Stances != 0) // needs other shapeshift
return SPELL_FAILED_ONLY_SHAPESHIFT;