From 45df49c8263b77e69ae418349e5b7754d64311d6 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 24 Mar 2021 13:16:17 +0100 Subject: [PATCH] Core/Spells: Updated spell shapeshift form flags enum --- src/server/game/DataStores/DBCEnums.h | 23 +++++++++++++++++++++++ src/server/game/DataStores/DBCStructure.h | 2 ++ src/server/game/Entities/Unit/Unit.cpp | 2 +- src/server/game/Spells/SpellInfo.cpp | 6 +++--- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h index 602df8992d..1afe96f149 100644 --- a/src/server/game/DataStores/DBCEnums.h +++ b/src/server/game/DataStores/DBCEnums.h @@ -518,6 +518,29 @@ enum EnchantmentSlotMask #define MAX_PET_TALENT_RANK 3 // use in calculations, expected <= MAX_TALENT_RANK #define MAX_TALENT_TABS 3 +enum class SpellShapeshiftFormFlags : int32 +{ + 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 114 typedef std::array TaxiMask; diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 0cde8c5e96..b84e85dd9f 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -2261,6 +2261,8 @@ struct SpellShapeshiftFormEntry uint32 PresetSpellID[MAX_SHAPESHIFT_SPELLS]; // 11 - 18 spells which appear in the bar after shapeshifting uint32 MountTypeID; // 19 //uint32 ExitSoundEntriesID; // 20 + + EnumFlag GetFlags() const { return static_cast(Flags); } }; // SpellShapeshift.dbc diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index cc67a2825e..8efe6fd72c 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9394,7 +9394,7 @@ bool Unit::IsInDisallowedMountForm() const if (!shapeshift) return true; - if (!(shapeshift->Flags & 0x1)) + if (!shapeshift->GetFlags().HasFlag(SpellShapeshiftFormFlags::Stance)) return true; } diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index f382b0802f..5b7855dd03 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1664,14 +1664,14 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const TC_LOG_ERROR("spells", "GetErrorAtShapeshiftedCast: unknown shapeshift %u", form); return SPELL_CAST_OK; } - actAsShifted = !(shapeInfo->Flags & 1); // shapeshift acts as normal form for spells + actAsShifted = !shapeInfo->GetFlags().HasFlag(SpellShapeshiftFormFlags::Stance); } if (actAsShifted) { - if (HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFT)) // 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 != UI64LIT(0)) // needs other shapeshift + else if (Stances != 0) // needs other shapeshift return SPELL_FAILED_ONLY_SHAPESHIFT; } else