aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Creature
diff options
context:
space:
mode:
authorOvahlord <dreadkiller@gmx.de>2024-02-29 14:43:37 +0100
committerGitHub <noreply@github.com>2024-02-29 14:43:37 +0100
commitc541eda54d7e0dddeec329a6beac2948e0b0a40b (patch)
tree90bead53d03937a1c55f4c12cd7f370a8ca13d8d /src/server/game/Entities/Creature
parent792a4d6c8bab4a8e874c6f0e583f915d05b8d8b3 (diff)
Core/Creatures: implemented most movement related static flags and migrated existing movement data into static flags (#29541)
* implemented CREATURE_STATIC_FLAG_AQUATIC - creatures cannot leave liquids * implemented CREATURE_STATIC_FLAG_AMPHIBIOUS - creatures can enter and leave liquids but remain on the ocean floor when swimming is not enabled until engaged * implemented CREATURE_STATIC_FLAG_FLOATING - creatures have their gravity on spawn / reset disabled * implemented CREATURE_STATIC_FLAG_SESSILE - creatures are rooted in place * implemented CREATURE_STATIC_FLAG_CAN_SWIM - creature can swim in liquids * implemented CREATURE_STATIC_FLAG_3_CANNOT_SWIM - Amphibious creatures cannot toggle on swimming * implemented CREATURE_STATIC_FLAG_3_CANNOT_TURN - Creatures cannot turn at all * implemented CREATURE_STATIC_FLAG_4_PREVENT_SWIM - Amphibious creatures won't toggle on swimming until their victim starts leaving the ocean floor * partially implemented CREATURE_STATIC_FLAG_3_CANNOT_PENETRATE_WATER * deprecated CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE as this flag was a hackfix to a wrong implementation that is now gone
Diffstat (limited to 'src/server/game/Entities/Creature')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp119
-rw-r--r--src/server/game/Entities/Creature/Creature.h37
-rw-r--r--src/server/game/Entities/Creature/CreatureData.h38
-rw-r--r--src/server/game/Entities/Creature/enuminfo_CreatureData.cpp6
4 files changed, 59 insertions, 141 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 1b31295f5e8..79455004e33 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -55,25 +55,19 @@
#include <G3D/g3dmath.h>
#include <sstream>
-CreatureMovementData::CreatureMovementData() : Ground(CreatureGroundMovementType::Run), Flight(CreatureFlightMovementType::None), Swim(true), Rooted(false), Chase(CreatureChaseMovementType::Run),
+CreatureMovementData::CreatureMovementData() : HoverInitiallyEnabled(false), Chase(CreatureChaseMovementType::Run),
Random(CreatureRandomMovementType::Walk), InteractionPauseTimer(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER)) { }
std::string CreatureMovementData::ToString() const
{
- char const* const GroundStates[] = { "None", "Run", "Hover" };
- char const* const FlightStates[] = { "None", "DisableGravity", "CanFly" };
- char const* const ChaseStates[] = { "Run", "CanWalk", "AlwaysWalk" };
+ char const* const ChaseStates[] = { "Run", "CanWalk", "AlwaysWalk" };
char const* const RandomStates[] = { "Walk", "CanRun", "AlwaysRun" };
std::ostringstream str;
str << std::boolalpha
- << "Ground: " << GroundStates[AsUnderlyingType(Ground)]
- << ", Swim: " << Swim
- << ", Flight: " << FlightStates[AsUnderlyingType(Flight)]
+ << ", HoverInitiallyEnabled: " << HoverInitiallyEnabled
<< ", Chase: " << ChaseStates[AsUnderlyingType(Chase)]
<< ", Random: " << RandomStates[AsUnderlyingType(Random)];
- if (Rooted)
- str << ", Rooted";
str << ", InteractionPauseTimer: " << InteractionPauseTimer;
return str.str();
@@ -314,7 +308,7 @@ Creature::Creature(bool isWorldObject) : Unit(isWorldObject), MapObject(), m_Pla
m_defaultMovementType(IDLE_MOTION_TYPE), m_spawnId(UI64LIT(0)), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_cannotReachTarget(false), m_cannotReachTimer(0),
m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(nullptr), m_creatureData(nullptr), m_creatureDifficulty(nullptr), _waypointPathId(0), _currentWaypointNodeInfo(0, 0),
m_formation(nullptr), m_triggerJustAppeared(true), m_respawnCompatibilityMode(false), _lastDamagedTime(0),
- _regenerateHealth(true), _isMissingCanSwimFlagOutOfCombat(false), _creatureImmunitiesId(0), _gossipMenuId(0), _sparringHealthPct(0)
+ _regenerateHealth(true), _creatureImmunitiesId(0), _gossipMenuId(0), _sparringHealthPct(0)
{
m_regenTimer = CREATURE_REGEN_INTERVAL;
@@ -595,7 +589,7 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/,
uint64 npcFlags;
uint32 unitFlags, unitFlags2, unitFlags3;
- ObjectMgr::ChooseCreatureFlags(cInfo, &npcFlags, &unitFlags, &unitFlags2, &unitFlags3, data);
+ ObjectMgr::ChooseCreatureFlags(cInfo, &npcFlags, &unitFlags, &unitFlags2, &unitFlags3, _staticFlags, data);
if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT)
npcFlags |= sGameEventMgr->GetNPCFlag(this);
@@ -686,7 +680,7 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/,
SetIsCombatDisallowed((cInfo->flags_extra & CREATURE_FLAG_EXTRA_CANNOT_ENTER_COMBAT) != 0);
- InitializeMovementFlags();
+ InitializeMovementCapabilities();
LoadCreaturesAddon();
LoadCreaturesSparringHealth();
@@ -707,7 +701,6 @@ void Creature::ApplyAllStaticFlags(CreatureStaticFlagsHolder const& flags)
_staticFlags = flags;
// Apply all other side effects of flag changes
- SetTemplateRooted(flags.HasFlag(CREATURE_STATIC_FLAG_SESSILE));
m_updateFlag.NoBirthAnim = flags.HasFlag(CREATURE_STATIC_FLAG_4_NO_BIRTH_ANIM);
}
@@ -724,7 +717,7 @@ void Creature::Update(uint32 diff)
AI()->JustAppeared();
}
- UpdateMovementFlags();
+ UpdateMovementCapabilities();
switch (m_deathState)
{
@@ -1993,17 +1986,6 @@ void Creature::SetSpawnHealth()
SetHealth((m_deathState == ALIVE || m_deathState == JUST_RESPAWNED) ? curhealth : 0);
}
-void Creature::LoadTemplateRoot()
-{
- SetTemplateRooted(GetMovementTemplate().IsRooted());
-}
-
-void Creature::SetTemplateRooted(bool rooted)
-{
- _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_SESSILE, rooted);
- SetControlled(rooted, UNIT_STATE_ROOT);
-}
-
bool Creature::hasQuest(uint32 quest_id) const
{
return sObjectMgr->GetCreatureQuestRelations(GetEntry()).HasQuest(quest_id);
@@ -2253,7 +2235,7 @@ void Creature::setDeathState(DeathState s)
if (m_formation && m_formation->GetLeader() == this)
m_formation->FormationReset(true);
- bool needsFalling = (IsFlying() || IsHovering()) && !IsUnderWater();
+ bool needsFalling = (IsFlying() || IsHovering()) && !IsUnderWater() && !HasUnitState(UNIT_STATE_ROOT);
SetHover(false, false);
SetDisableGravity(false, false);
@@ -2273,7 +2255,7 @@ void Creature::setDeathState(DeathState s)
ResetPlayerDamageReq();
SetCannotReachTarget(false);
- UpdateMovementFlags();
+ UpdateMovementCapabilities();
ClearUnitState(UNIT_STATE_ALL_ERASABLE);
@@ -2284,7 +2266,7 @@ void Creature::setDeathState(DeathState s)
uint64 npcFlags;
uint32 unitFlags, unitFlags2, unitFlags3;
- ObjectMgr::ChooseCreatureFlags(cInfo, &npcFlags, &unitFlags, &unitFlags2, &unitFlags3, creatureData);
+ ObjectMgr::ChooseCreatureFlags(cInfo, &npcFlags, &unitFlags, &unitFlags2, &unitFlags3, _staticFlags, creatureData);
if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT)
npcFlags |= sGameEventMgr->GetNPCFlag(this);
@@ -2736,7 +2718,7 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool /*force*/) const
dist += GetCombatReach() + victim->GetCombatReach();
// to prevent creatures in air ignore attacks because distance is already too high...
- if (GetMovementTemplate().IsFlightAllowed())
+ if (CanFly())
return victim->IsInDist2d(&m_homePosition, dist);
else
return victim->IsInDist(&m_homePosition, dist);
@@ -2768,14 +2750,6 @@ bool Creature::LoadCreaturesAddon()
ReplaceAllVisFlags(UnitVisFlags(creatureAddon->visFlags));
SetAnimTier(AnimTier(creatureAddon->animTier), false);
- //! Suspected correlation between UNIT_FIELD_BYTES_1, offset 3, value 0x2:
- //! If no inhabittype_fly (if no MovementFlag_DisableGravity or MovementFlag_CanFly flag found in sniffs)
- //! Check using InhabitType as movement flags are assigned dynamically
- //! basing on whether the creature is in air or not
- //! Set MovementFlag_Hover. Otherwise do nothing.
- if (CanHover())
- AddUnitMovementFlag(MOVEMENTFLAG_HOVER);
-
SetSheath(SheathState(creatureAddon->sheathState));
ReplaceAllPvpFlags(UnitPVPStateFlags(creatureAddon->pvpFlags));
@@ -2920,51 +2894,37 @@ void Creature::GetRespawnPosition(float &x, float &y, float &z, float* ori, floa
}
}
-void Creature::InitializeMovementFlags()
+void Creature::InitializeMovementCapabilities()
{
- LoadTemplateRoot();
- // It does the same, for now
- UpdateMovementFlags();
+ SetHover(GetMovementTemplate().IsHoverInitiallyEnabled());
+ SetDisableGravity(IsFloating());
+ SetControlled(IsSessile(), UNIT_STATE_ROOT);
+
+ // If an amphibious creatures was swimming while engaged, disable swimming again
+ if (IsAmphibious() && !_staticFlags.HasFlag(CREATURE_STATIC_FLAG_CAN_SWIM))
+ RemoveUnitFlag(UNIT_FLAG_CAN_SWIM);
+
+ UpdateMovementCapabilities();
}
-void Creature::UpdateMovementFlags()
+void Creature::UpdateMovementCapabilities()
{
// Do not update movement flags if creature is controlled by a player (charm/vehicle)
if (m_playerMovingMe)
return;
- // Creatures with CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE should control MovementFlags in your own scripts
- if (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE)
- return;
-
// Set the movement flags if the creature is in that mode. (Only fly if actually in air, only swim if in water, etc)
float ground = GetFloorZ();
-
- bool canHover = CanHover();
- bool isInAir = (G3D::fuzzyGt(GetPositionZ(), ground + (canHover ? *m_unitData->HoverHeight : 0.0f) + GROUND_HEIGHT_TOLERANCE) || G3D::fuzzyLt(GetPositionZ(), ground - GROUND_HEIGHT_TOLERANCE)); // Can be underground too, prevent the falling
-
- if (GetMovementTemplate().IsFlightAllowed() && (isInAir || !GetMovementTemplate().IsGroundAllowed()) && !IsFalling())
- {
- if (GetMovementTemplate().Flight == CreatureFlightMovementType::CanFly)
- SetCanFly(true);
- else
- SetDisableGravity(true);
-
- if (!HasAuraType(SPELL_AURA_HOVER) && GetMovementTemplate().Ground != CreatureGroundMovementType::Hover)
- SetHover(false);
- }
- else
- {
- SetCanFly(false);
- SetDisableGravity(false);
- if (IsAlive() && (CanHover() || HasAuraType(SPELL_AURA_HOVER)))
- SetHover(true);
- }
-
+ bool isInAir = (G3D::fuzzyGt(GetPositionZ(), ground + GetHoverOffset() + GROUND_HEIGHT_TOLERANCE) || G3D::fuzzyLt(GetPositionZ(), ground - GROUND_HEIGHT_TOLERANCE)); // Can be underground too, prevent the falling
if (!isInAir)
RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING);
- SetSwim(CanSwim() && IsInWater());
+ // Some Amphibious creatures toggle swimming while engaged
+ if (IsAmphibious() && !HasUnitFlag(UNIT_FLAG_CANT_SWIM) && !HasUnitFlag(UNIT_FLAG_CAN_SWIM))
+ if (!IsSwimPrevented() || (GetVictim() && !GetVictim()->IsOnOceanFloor()))
+ SetUnitFlag(UNIT_FLAG_CAN_SWIM);
+
+ SetSwim(IsInWater() && CanSwim());
}
CreatureMovementData const& Creature::GetMovementTemplate() const
@@ -2986,25 +2946,6 @@ bool Creature::CanSwim() const
return false;
}
-bool Creature::CanEnterWater() const
-{
- if (CanSwim())
- return true;
-
- return GetMovementTemplate().IsSwimAllowed();
-}
-
-void Creature::RefreshCanSwimFlag(bool recheck)
-{
- if (!_isMissingCanSwimFlagOutOfCombat || recheck)
- _isMissingCanSwimFlagOutOfCombat = !HasUnitFlag(UNIT_FLAG_CAN_SWIM);
-
- // Check if the creature has UNIT_FLAG_CAN_SWIM and add it if it's missing
- // Creatures must be able to chase a target in water if they can enter water
- if (_isMissingCanSwimFlagOutOfCombat && CanEnterWater())
- SetUnitFlag(UNIT_FLAG_CAN_SWIM);
-}
-
void Creature::AllLootRemovedFromCorpse()
{
time_t now = GameTime::GetGameTime();
@@ -3633,8 +3574,6 @@ void Creature::AtEngage(Unit* target)
if (!HasFlag(CREATURE_STATIC_FLAG_2_ALLOW_MOUNTED_COMBAT))
Dismount();
- RefreshCanSwimFlag();
-
if (IsPet() || IsGuardian()) // update pets' speed for catchup OOC speed
{
UpdateSpeed(MOVE_RUN);
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index c2d0eda0dfe..156ead57fa6 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -94,9 +94,6 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
void SelectWildBattlePetLevel();
void LoadEquipment(int8 id = 1, bool force = false);
void SetSpawnHealth();
- void LoadTemplateRoot();
- bool IsTemplateRooted() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_SESSILE); }
- void SetTemplateRooted(bool rooted);
ObjectGuid::LowType GetSpawnId() const { return m_spawnId; }
@@ -116,15 +113,29 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
bool IsTrigger() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER) != 0; }
bool IsGuard() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GUARD) != 0; }
- void InitializeMovementFlags();
- void UpdateMovementFlags();
+ void InitializeMovementCapabilities();
+ void UpdateMovementCapabilities();
CreatureMovementData const& GetMovementTemplate() const;
- bool CanWalk() const { return GetMovementTemplate().IsGroundAllowed(); }
+
+ // Returns true if CREATURE_STATIC_FLAG_AQUATIC is set which strictly binds the creature to liquids
+ bool IsAquatic() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_AQUATIC); }
+ // Returns true if CREATURE_STATIC_FLAG_AMPHIBIOUS is set which allows a creature to enter and leave liquids while sticking to the ocean floor. These creatures will become able to swim when engaged
+ bool IsAmphibious() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_AMPHIBIOUS); }
+ // Returns true if CREATURE_STATIC_FLAG_FLOATING is set which is disabling the gravity of the creature on spawn and reset
+ bool IsFloating() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_FLOATING); }
+ // Returns true if CREATURE_STATIC_FLAG_SESSILE is set which permanently roots the creature in place
+ bool IsSessile() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_SESSILE); }
+ // Returns true if CREATURE_STATIC_FLAG_3_CANNOT_PENETRATE_WATER is set which does not allow the creature to go below liquid surfaces
+ bool CannotPenetrateWater() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_3_CANNOT_PENETRATE_WATER); }
+ // Returns true if CREATURE_STATIC_FLAG_3_CANNOT_SWIM is set which prevents 'Amphibious' creatures from swimming when engaged
+ bool IsSwimDisabled() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_3_CANNOT_SWIM); }
+ // Returns true if CREATURE_STATIC_FLAG_4_PREVENT_SWIM is set which prevents 'Amphibious' creatures from swimming when engaged until the victim is no longer on the ocean floor
+ bool IsSwimPrevented() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_4_PREVENT_SWIM); }
+
bool CanSwim() const override;
- bool CanEnterWater() const override;
- bool CanFly() const override { return GetMovementTemplate().IsFlightAllowed() || IsFlying(); }
- bool CanHover() const { return GetMovementTemplate().Ground == CreatureGroundMovementType::Hover || IsHovering(); }
+ bool CanEnterWater() const override { return (CanSwim() || IsAmphibious()); };
+ bool CanFly() const override { return (IsFlying() || HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY)); }
MovementGeneratorType GetDefaultMovementType() const override { return m_defaultMovementType; }
void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
@@ -415,12 +426,6 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
uint32 CalculateDamageForSparring(Unit* attacker, uint32 damage);
bool ShouldFakeDamageFrom(Unit* attacker);
- bool HasCanSwimFlagOutOfCombat() const
- {
- return !_isMissingCanSwimFlagOutOfCombat;
- }
- void RefreshCanSwimFlag(bool recheck = false);
-
std::string GetDebugInfo() const override;
void ExitVehicle(Position const* exitPosition = nullptr) override;
@@ -535,8 +540,6 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
// Regenerate health
bool _regenerateHealth; // Set on creation
- bool _isMissingCanSwimFlagOutOfCombat;
-
Optional<uint32> _defaultMountDisplayIdOverride;
int32 _creatureImmunitiesId;
uint32 _gossipMenuId;
diff --git a/src/server/game/Entities/Creature/CreatureData.h b/src/server/game/Entities/Creature/CreatureData.h
index 8a3d8655069..79cdc6bdb8d 100644
--- a/src/server/game/Entities/Creature/CreatureData.h
+++ b/src/server/game/Entities/Creature/CreatureData.h
@@ -43,7 +43,7 @@ enum CreatureStaticFlags
CREATURE_STATIC_FLAG_IMMUNE_TO_PC = 0x00000020, // UNIT_FLAG_IMMUNE_TO_PC
CREATURE_STATIC_FLAG_IMMUNE_TO_NPC = 0x00000040, // UNIT_FLAG_IMMUNE_TO_NPC
CREATURE_STATIC_FLAG_CAN_WIELD_LOOT = 0x00000080,
- CREATURE_STATIC_FLAG_SESSILE = 0x00000100, // creature_template_movement.Rooted = 1
+ CREATURE_STATIC_FLAG_SESSILE = 0x00000100, // Rooted movementflag, creature is permanently rooted in place
CREATURE_STATIC_FLAG_UNINTERACTIBLE = 0x00000200, // UNIT_FLAG_UNINTERACTIBLE
CREATURE_STATIC_FLAG_NO_AUTOMATIC_REGEN = 0x00000400, // Creatures with that flag uses no UNIT_FLAG2_REGENERATE_POWER
CREATURE_STATIC_FLAG_DESPAWN_INSTANTLY = 0x00000800, // Creature instantly disappear when killed
@@ -54,7 +54,7 @@ enum CreatureStaticFlags
CREATURE_STATIC_FLAG_BOSS_MOB = 0x00010000, // CREATURE_TYPE_FLAG_BOSS_MOB, original description: Raid Boss Mob
CREATURE_STATIC_FLAG_COMBAT_PING = 0x00020000,
CREATURE_STATIC_FLAG_AQUATIC = 0x00040000, // aka Water Only, creature_template_movement.Ground = 0
- CREATURE_STATIC_FLAG_AMPHIBIOUS = 0x00080000, // creature_template_movement.Swim = 1
+ CREATURE_STATIC_FLAG_AMPHIBIOUS = 0x00080000, // Creatures will be able to enter and leave water but can only move on the ocean floor when CREATURE_STATIC_FLAG_CAN_SWIM is not present
CREATURE_STATIC_FLAG_NO_MELEE_FLEE = 0x00100000, // "No Melee (Flee)" Prevents melee (moves as-if feared, does not make creature passive)
CREATURE_STATIC_FLAG_VISIBLE_TO_GHOSTS = 0x00200000, // CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS
CREATURE_STATIC_FLAG_PVP_ENABLING = 0x00400000, // Old UNIT_FLAG_PVP_ENABLING, now UNIT_BYTES_2_OFFSET_PVP_FLAG from UNIT_FIELD_BYTES_2
@@ -64,7 +64,7 @@ enum CreatureStaticFlags
CREATURE_STATIC_FLAG_ONLY_ATTACK_PVP_ENABLING = 0x04000000, // "Only attack targets that are PvP enabling"
CREATURE_STATIC_FLAG_CALLS_GUARDS = 0x08000000, // Creature will summon a guard if player is within its aggro range (even if creature doesn't attack per se)
CREATURE_STATIC_FLAG_CAN_SWIM = 0x10000000, // UnitFlags 0x8000 UNIT_FLAG_CAN_SWIM
- CREATURE_STATIC_FLAG_FLOATING = 0x20000000, // creature_template_movement.Flight = 1
+ CREATURE_STATIC_FLAG_FLOATING = 0x20000000, // sets DisableGravity movementflag on spawn/reset
CREATURE_STATIC_FLAG_MORE_AUDIBLE = 0x40000000, // CREATURE_TYPE_FLAG_MORE_AUDIBLE
CREATURE_STATIC_FLAG_LARGE_AOI = 0x80000000 // UnitFlags2 0x200000
};
@@ -340,7 +340,7 @@ enum CreatureFlagsExtra : uint32
CREATURE_FLAG_EXTRA_NO_XP = 0x00000040, // creature kill does not provide XP
CREATURE_FLAG_EXTRA_TRIGGER = 0x00000080, // trigger creature
CREATURE_FLAG_EXTRA_NO_TAUNT = 0x00000100, // creature is immune to taunt auras and 'attack me' effects
- CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE = 0x00000200, // creature won't update movement flags
+ CREATURE_FLAG_EXTRA_UNUSED_9 = 0x00000200,
CREATURE_FLAG_EXTRA_GHOST_VISIBILITY = 0x00000400, // creature will only be visible to dead players
CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK = 0x00000800, // creature will use offhand attacks
CREATURE_FLAG_EXTRA_NO_SELL_VENDOR = 0x00001000, // players can't sell items to this vendor
@@ -372,24 +372,6 @@ enum CreatureFlagsExtra : uint32
CREATURE_FLAG_EXTRA_DB_ALLOWED = (0xFFFFFFFF & ~(CREATURE_FLAG_EXTRA_UNUSED | CREATURE_FLAG_EXTRA_DUNGEON_BOSS)) // SKIP
};
-enum class CreatureGroundMovementType : uint8
-{
- None,
- Run,
- Hover,
-
- Max
-};
-
-enum class CreatureFlightMovementType : uint8
-{
- None,
- DisableGravity,
- CanFly,
-
- Max
-};
-
enum class CreatureChaseMovementType : uint8
{
Run,
@@ -412,22 +394,16 @@ struct TC_GAME_API CreatureMovementData
{
CreatureMovementData();
- CreatureGroundMovementType Ground;
- CreatureFlightMovementType Flight;
- bool Swim;
- bool Rooted;
+ bool HoverInitiallyEnabled;
CreatureChaseMovementType Chase;
CreatureRandomMovementType Random;
uint32 InteractionPauseTimer;
- bool IsGroundAllowed() const { return Ground != CreatureGroundMovementType::None; }
- bool IsSwimAllowed() const { return Swim; }
- bool IsFlightAllowed() const { return Flight != CreatureFlightMovementType::None; }
- bool IsRooted() const { return Rooted; }
-
CreatureChaseMovementType GetChase() const { return Chase; }
CreatureRandomMovementType GetRandom() const { return Random; }
+ bool IsHoverInitiallyEnabled() const { return HoverInitiallyEnabled; }
+
uint32 GetInteractionPauseTimer() const { return InteractionPauseTimer; }
std::string ToString() const;
diff --git a/src/server/game/Entities/Creature/enuminfo_CreatureData.cpp b/src/server/game/Entities/Creature/enuminfo_CreatureData.cpp
index 86b2bae5d5a..c04e7cedd5b 100644
--- a/src/server/game/Entities/Creature/enuminfo_CreatureData.cpp
+++ b/src/server/game/Entities/Creature/enuminfo_CreatureData.cpp
@@ -40,7 +40,7 @@ TC_API_EXPORT EnumText EnumUtils<CreatureFlagsExtra>::ToString(CreatureFlagsExtr
case CREATURE_FLAG_EXTRA_NO_XP: return { "CREATURE_FLAG_EXTRA_NO_XP", "CREATURE_FLAG_EXTRA_NO_XP", "creature kill does not provide XP" };
case CREATURE_FLAG_EXTRA_TRIGGER: return { "CREATURE_FLAG_EXTRA_TRIGGER", "CREATURE_FLAG_EXTRA_TRIGGER", "trigger creature" };
case CREATURE_FLAG_EXTRA_NO_TAUNT: return { "CREATURE_FLAG_EXTRA_NO_TAUNT", "CREATURE_FLAG_EXTRA_NO_TAUNT", "creature is immune to taunt auras and 'attack me' effects" };
- case CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE: return { "CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE", "CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE", "creature won't update movement flags" };
+ case CREATURE_FLAG_EXTRA_UNUSED_9: return { "CREATURE_FLAG_EXTRA_UNUSED_9", "CREATURE_FLAG_EXTRA_UNUSED_9", "creature won't update movement flags" };
case CREATURE_FLAG_EXTRA_GHOST_VISIBILITY: return { "CREATURE_FLAG_EXTRA_GHOST_VISIBILITY", "CREATURE_FLAG_EXTRA_GHOST_VISIBILITY", "creature will only be visible to dead players" };
case CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK: return { "CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK", "CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK", "creature will use offhand attacks" };
case CREATURE_FLAG_EXTRA_NO_SELL_VENDOR: return { "CREATURE_FLAG_EXTRA_NO_SELL_VENDOR", "CREATURE_FLAG_EXTRA_NO_SELL_VENDOR", "players can't sell items to this vendor" };
@@ -84,7 +84,7 @@ TC_API_EXPORT CreatureFlagsExtra EnumUtils<CreatureFlagsExtra>::FromIndex(size_t
case 6: return CREATURE_FLAG_EXTRA_NO_XP;
case 7: return CREATURE_FLAG_EXTRA_TRIGGER;
case 8: return CREATURE_FLAG_EXTRA_NO_TAUNT;
- case 9: return CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE;
+ case 9: return CREATURE_FLAG_EXTRA_UNUSED_9;
case 10: return CREATURE_FLAG_EXTRA_GHOST_VISIBILITY;
case 11: return CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK;
case 12: return CREATURE_FLAG_EXTRA_NO_SELL_VENDOR;
@@ -125,7 +125,7 @@ TC_API_EXPORT size_t EnumUtils<CreatureFlagsExtra>::ToIndex(CreatureFlagsExtra v
case CREATURE_FLAG_EXTRA_NO_XP: return 6;
case CREATURE_FLAG_EXTRA_TRIGGER: return 7;
case CREATURE_FLAG_EXTRA_NO_TAUNT: return 8;
- case CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE: return 9;
+ case CREATURE_FLAG_EXTRA_UNUSED_9: return 9;
case CREATURE_FLAG_EXTRA_GHOST_VISIBILITY: return 10;
case CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK: return 11;
case CREATURE_FLAG_EXTRA_NO_SELL_VENDOR: return 12;