From f011cbb60284109c2a66f042f34caa110cd961f3 Mon Sep 17 00:00:00 2001 From: Jelle Meeus Date: Sun, 22 Dec 2024 08:56:54 +0100 Subject: [PATCH] refactor(Core/Unit): Add naming for all ShapeshiftFlags (#20989) --- src/server/game/Entities/Unit/Unit.cpp | 2 +- src/server/game/Entities/Unit/UnitDefines.h | 21 +++++++++++++++++++++ src/server/game/Spells/Spell.cpp | 2 +- src/server/game/Spells/SpellInfo.cpp | 4 ++-- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index c5cc5b8084deb1..2f7d6275b2a07d 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -21276,7 +21276,7 @@ bool Unit::IsInDisallowedMountForm() const return true; } - if (!(shapeshift->flags1 & 0x1)) + if (!(shapeshift->flags1 & SHAPESHIFT_FLAG_STANCE)) { return true; } diff --git a/src/server/game/Entities/Unit/UnitDefines.h b/src/server/game/Entities/Unit/UnitDefines.h index b694bbcd9b5926..040e2c89f16a05 100644 --- a/src/server/game/Entities/Unit/UnitDefines.h +++ b/src/server/game/Entities/Unit/UnitDefines.h @@ -99,6 +99,27 @@ enum ShapeshiftForm FORM_SPIRITOFREDEMPTION = 0x20 }; +enum ShapeshiftFlags +{ + SHAPESHIFT_FLAG_STANCE = 0x00000001, // Form allows various player activities, which normally cause "You can't X while shapeshifted." errors (npc/go interaction, item use, etc) + SHAPESHIFT_FLAG_NOT_TOGGLEABLE = 0x00000002, // NYI + SHAPESHIFT_FLAG_PERSIST_ON_DEATH = 0x00000004, // NYI + SHAPESHIFT_FLAG_CAN_NPC_INTERACT = 0x00000008, // Form unconditionally allows talking to NPCs while shapeshifted (even if other activities are disabled) + SHAPESHIFT_FLAG_DONT_USE_WEAPON = 0x00000010, // NYI + SHAPESHIFT_FLAG_AGILITY_ATTACK_BONUS = 0x00000020, // Druid Cat form + SHAPESHIFT_FLAG_CAN_USE_EQUIPPED_ITEMS = 0x00000040, // NYI + SHAPESHIFT_FLAG_CAN_USE_ITEMS = 0x00000080, // NYI + SHAPESHIFT_FLAG_DONT_AUTO_UNSHIFT = 0x00000100, // Handled at client side + SHAPESHIFT_FLAG_CONSIDERED_DEAD = 0x00000200, // NYI + SHAPESHIFT_FLAG_CAN_ONLY_CAST_SHAPESHIFT_SPELLS = 0x00000400, // NYI + SHAPESHIFT_FLAG_STANCE_CANCEL_AT_FLIGHTMASTER = 0x00000800, // NYI + SHAPESHIFT_FLAG_NO_EMOTE_SOUNDS = 0x00001000, // NYI + SHAPESHIFT_FLAG_NO_TRIGGER_TELEPORT = 0x00002000, // NYI + SHAPESHIFT_FLAG_CANNOT_CHANGE_EQUIPPED_ITEMS = 0x00004000, // NYI + SHAPESHIFT_FLAG_RESUMMON_PETS_ON_UNSHIFT = 0x00008000, // NYI + SHAPESHIFT_FLAG_CANNOT_USE_GAME_OBJECTS = 0x00010000, // NYI +}; + // low byte (0 from 0..3) of UNIT_FIELD_BYTES_2 enum SheathState { diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 7e70af2be80133..c3d8fac76bd195 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5832,7 +5832,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (effInfo->ApplyAuraName == SPELL_AURA_MOD_SHAPESHIFT) { SpellShapeshiftFormEntry const* shapeShiftEntry = sSpellShapeshiftFormStore.LookupEntry(effInfo->MiscValue); - if (shapeShiftEntry && (shapeShiftEntry->flags1 & 1) == 0) // unk flag + if (shapeShiftEntry && (shapeShiftEntry->flags1 & SHAPESHIFT_FLAG_STANCE) == 0) checkMask |= VEHICLE_SEAT_FLAG_UNCONTROLLED; break; } diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 9716102a5cdf9c..421f96a5d0dc5e 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1457,7 +1457,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const LOG_ERROR("spells", "GetErrorAtShapeshiftedCast: unknown shapeshift {}", form); return SPELL_CAST_OK; } - actAsShifted = !(shapeInfo->flags1 & 1); // shapeshift acts as normal form for spells + actAsShifted = !(shapeInfo->flags1 & SHAPESHIFT_FLAG_STANCE); // shapeshift acts as normal form for spells } if (actAsShifted) @@ -1477,7 +1477,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const // Check if stance disables cast of not-stance spells // Example: cannot cast any other spells in zombie or ghoul form /// @todo: Find a way to disable use of these spells clientside - if (shapeInfo && shapeInfo->flags1 & 0x400) + if (shapeInfo && (shapeInfo->flags1 & SHAPESHIFT_FLAG_CAN_ONLY_CAST_SHAPESHIFT_SPELLS)) { if (!(stanceMask & Stances)) return SPELL_FAILED_ONLY_SHAPESHIFT;