Skip to content

Commit

Permalink
refactor(Core/Unit): Add naming for all ShapeshiftFlags (azerothcore#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sogladev authored Dec 22, 2024
1 parent dc79f26 commit f011cbb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21276,7 +21276,7 @@ bool Unit::IsInDisallowedMountForm() const
return true;
}

if (!(shapeshift->flags1 & 0x1))
if (!(shapeshift->flags1 & SHAPESHIFT_FLAG_STANCE))
{
return true;
}
Expand Down
21 changes: 21 additions & 0 deletions src/server/game/Entities/Unit/UnitDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Spells/SpellInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit f011cbb

Please sign in to comment.