mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 13:16:23 +00:00
fix(Core/Movement): Send proper movement animation visuals. (#10843)
Fixed #10812 Fixed #10814
This commit is contained in:
@@ -204,7 +204,7 @@ bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
Creature::Creature(bool isWorldObject): Unit(isWorldObject), MovableMapObject(), m_groupLootTimer(0), lootingGroupLowGUID(0), m_PlayerDamageReq(0), m_lootRecipientGroup(0),
|
||||
m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_wanderDistance(0.0f),
|
||||
m_transportCheckTimer(1000), lootPickPocketRestoreTime(0), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE),
|
||||
m_spawnId(0), m_equipmentId(0), m_originalEquipmentId(0), m_originalAnimTier(UNIT_BYTE1_FLAG_GROUND), m_AlreadyCallAssistance(false),
|
||||
m_spawnId(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false),
|
||||
m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), m_originalEntry(0), m_moveInLineOfSightDisabled(false), m_moveInLineOfSightStrictlyDisabled(false),
|
||||
m_homePosition(), m_transportHomePosition(), m_creatureInfo(nullptr), m_creatureData(nullptr), m_detectionDistance(20.0f), m_waypointID(0), m_path_id(0), m_formation(nullptr), _lastDamagedTime(nullptr), m_cannotReachTarget(false), m_cannotReachTimer(0),
|
||||
_isMissingSwimmingFlagOutOfCombat(false), m_assistanceTimer(0)
|
||||
@@ -1856,8 +1856,8 @@ void Creature::setDeathState(DeathState s, bool despawn)
|
||||
m_formation->FormationReset(true, false);
|
||||
|
||||
bool needsFalling = !despawn && (IsFlying() || IsHovering()) && !IsUnderWater();
|
||||
SetHover(false);
|
||||
SetDisableGravity(false);
|
||||
SetHover(false, false, false);
|
||||
SetDisableGravity(false, false, false);
|
||||
|
||||
if (needsFalling)
|
||||
GetMotionMaster()->MoveFall(0, true);
|
||||
@@ -2536,8 +2536,7 @@ bool Creature::LoadCreaturesAddon(bool reload)
|
||||
//SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_PET_TALENTS, uint8((cainfo->bytes1 >> 8) & 0xFF));
|
||||
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_PET_TALENTS, 0);
|
||||
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_VIS_FLAG, uint8((cainfo->bytes1 >> 16) & 0xFF));
|
||||
m_originalAnimTier = uint8((cainfo->bytes1 >> 24) & 0xFF);
|
||||
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, m_originalAnimTier);
|
||||
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, uint8((cainfo->bytes1 >> 24) & 0xFF));
|
||||
|
||||
//! 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)
|
||||
@@ -2973,7 +2972,7 @@ bool Creature::SetWalk(bool enable)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Creature::SetDisableGravity(bool disable, bool packetOnly/*=false*/)
|
||||
bool Creature::SetDisableGravity(bool disable, bool packetOnly /*= false*/, bool updateAnimationTier /*= true*/)
|
||||
{
|
||||
//! It's possible only a packet is sent but moveflags are not updated
|
||||
//! Need more research on this
|
||||
@@ -2994,8 +2993,15 @@ bool Creature::SetDisableGravity(bool disable, bool packetOnly/*=false*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!movespline->Initialized())
|
||||
return true;
|
||||
if (updateAnimationTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !GetMovementTemplate().IsRooted())
|
||||
{
|
||||
if (IsLevitating())
|
||||
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_FLY);
|
||||
else if (IsHovering())
|
||||
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_HOVER);
|
||||
else
|
||||
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_GROUND);
|
||||
}
|
||||
|
||||
WorldPacket data(disable ? SMSG_SPLINE_MOVE_GRAVITY_DISABLE : SMSG_SPLINE_MOVE_GRAVITY_ENABLE, 9);
|
||||
data << GetPackGUID();
|
||||
@@ -3008,9 +3014,6 @@ bool Creature::SetSwim(bool enable)
|
||||
if (!Unit::SetSwim(enable))
|
||||
return false;
|
||||
|
||||
if (!movespline->Initialized())
|
||||
return true;
|
||||
|
||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_START_SWIM : SMSG_SPLINE_MOVE_STOP_SWIM);
|
||||
data << GetPackGUID();
|
||||
SendMessageToSet(&data, true);
|
||||
@@ -3078,9 +3081,6 @@ bool Creature::SetCanFly(bool enable, bool /*packetOnly*/ /* = false */)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!movespline->Initialized())
|
||||
return true;
|
||||
|
||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_FLYING : SMSG_SPLINE_MOVE_UNSET_FLYING, 9);
|
||||
data << GetPackGUID();
|
||||
SendMessageToSet(&data, false);
|
||||
@@ -3106,9 +3106,6 @@ bool Creature::SetWaterWalking(bool enable, bool packetOnly /* = false */)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!movespline->Initialized())
|
||||
return true;
|
||||
|
||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_WATER_WALK : SMSG_SPLINE_MOVE_LAND_WALK, 9);
|
||||
data << GetPackGUID();
|
||||
SendMessageToSet(&data, true);
|
||||
@@ -3134,24 +3131,27 @@ bool Creature::SetFeatherFall(bool enable, bool packetOnly /* = false */)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!movespline->Initialized())
|
||||
return true;
|
||||
|
||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_FEATHER_FALL : SMSG_SPLINE_MOVE_NORMAL_FALL, 9);
|
||||
data << GetPackGUID();
|
||||
SendMessageToSet(&data, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Creature::SetHover(bool enable, bool packetOnly /*= false*/)
|
||||
bool Creature::SetHover(bool enable, bool packetOnly /*= false*/, bool updateAnimationTier /*= true*/)
|
||||
{
|
||||
if (!packetOnly && !Unit::SetHover(enable))
|
||||
return false;
|
||||
|
||||
if (!movespline->Initialized())
|
||||
return true;
|
||||
if (updateAnimationTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !GetMovementTemplate().IsRooted())
|
||||
{
|
||||
if (IsLevitating())
|
||||
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_FLY);
|
||||
else if (IsHovering())
|
||||
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_HOVER);
|
||||
else
|
||||
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_GROUND);
|
||||
}
|
||||
|
||||
//! Not always a packet is sent
|
||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_HOVER : SMSG_SPLINE_MOVE_UNSET_HOVER, 9);
|
||||
data << GetPackGUID();
|
||||
SendMessageToSet(&data, false);
|
||||
|
||||
@@ -133,12 +133,12 @@ public:
|
||||
[[nodiscard]] CreatureAI* AI() const { return (CreatureAI*)i_AI; }
|
||||
|
||||
bool SetWalk(bool enable) override;
|
||||
bool SetDisableGravity(bool disable, bool packetOnly = false) override;
|
||||
bool SetDisableGravity(bool disable, bool packetOnly = false, bool updateAnimationTier = true) override;
|
||||
bool SetSwim(bool enable) override;
|
||||
bool SetCanFly(bool enable, bool packetOnly = false) override;
|
||||
bool SetWaterWalking(bool enable, bool packetOnly = false) override;
|
||||
bool SetFeatherFall(bool enable, bool packetOnly = false) override;
|
||||
bool SetHover(bool enable, bool packetOnly = false) override;
|
||||
bool SetHover(bool enable, bool packetOnly = false, bool updateAnimationTier = true) override;
|
||||
bool HasSpellFocus(Spell const* focusSpell = nullptr) const;
|
||||
|
||||
struct
|
||||
@@ -412,8 +412,6 @@ protected:
|
||||
uint8 m_equipmentId;
|
||||
int8 m_originalEquipmentId; // can be -1
|
||||
|
||||
uint8 m_originalAnimTier;
|
||||
|
||||
bool m_AlreadyCallAssistance;
|
||||
bool m_AlreadySearchedAssistance;
|
||||
bool m_regenHealth;
|
||||
|
||||
@@ -15397,7 +15397,7 @@ bool Player::IsInWhisperWhiteList(ObjectGuid guid)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Player::SetDisableGravity(bool disable, bool packetOnly /*= false*/)
|
||||
bool Player::SetDisableGravity(bool disable, bool packetOnly /*= false*/, bool /*updateAnimationTier = true*/)
|
||||
{
|
||||
if (!packetOnly && !Unit::SetDisableGravity(disable))
|
||||
return false;
|
||||
@@ -15436,7 +15436,7 @@ bool Player::SetCanFly(bool apply, bool packetOnly /*= false*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Player::SetHover(bool apply, bool packetOnly /*= false*/)
|
||||
bool Player::SetHover(bool apply, bool packetOnly /*= false*/, bool /*updateAnimationTier = true*/)
|
||||
{
|
||||
// moved inside, flag can be removed on landing and wont send appropriate packet to client when aura is removed
|
||||
if (!packetOnly /* && !Unit::SetHover(apply)*/)
|
||||
|
||||
@@ -2505,11 +2505,11 @@ public:
|
||||
bool IsInWhisperWhiteList(ObjectGuid guid);
|
||||
void RemoveFromWhisperWhiteList(ObjectGuid guid) { WhisperList.remove(guid); }
|
||||
|
||||
bool SetDisableGravity(bool disable, bool packetOnly /* = false */) override;
|
||||
bool SetDisableGravity(bool disable, bool packetOnly = false, bool updateAnimationTier = true) override;
|
||||
bool SetCanFly(bool apply, bool packetOnly = false) override;
|
||||
bool SetWaterWalking(bool apply, bool packetOnly = false) override;
|
||||
bool SetFeatherFall(bool apply, bool packetOnly = false) override;
|
||||
bool SetHover(bool enable, bool packetOnly = false) override;
|
||||
bool SetHover(bool enable, bool packetOnly = false, bool updateAnimationTier = true) override;
|
||||
|
||||
[[nodiscard]] bool CanFly() const override { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY); }
|
||||
[[nodiscard]] bool CanEnterWater() const override { return true; }
|
||||
|
||||
@@ -19900,7 +19900,7 @@ bool Unit::SetWalk(bool enable)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Unit::SetDisableGravity(bool disable, bool /*packetOnly = false*/)
|
||||
bool Unit::SetDisableGravity(bool disable, bool /*packetOnly = false*/, bool /*updateAnimationTier = true*/)
|
||||
{
|
||||
if (disable == IsLevitating())
|
||||
return false;
|
||||
@@ -19999,7 +19999,7 @@ void Unit::SendMovementFeatherFall(Player* sendTo)
|
||||
sendTo->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
bool Unit::SetHover(bool enable, bool /*packetOnly = false*/)
|
||||
bool Unit::SetHover(bool enable, bool /*packetOnly = false*/, bool /*updateAnimationTier = true*/)
|
||||
{
|
||||
if (enable == HasUnitMovementFlag(MOVEMENTFLAG_HOVER))
|
||||
return false;
|
||||
|
||||
@@ -1698,12 +1698,12 @@ public:
|
||||
void SendMovementFlagUpdate(bool self = false);
|
||||
|
||||
virtual bool SetWalk(bool enable);
|
||||
virtual bool SetDisableGravity(bool disable, bool packetOnly = false);
|
||||
virtual bool SetDisableGravity(bool disable, bool packetOnly = false, bool updateAnimationTier = true);
|
||||
virtual bool SetSwim(bool enable);
|
||||
virtual bool SetCanFly(bool enable, bool packetOnly = false);
|
||||
virtual bool SetWaterWalking(bool enable, bool packetOnly = false);
|
||||
virtual bool SetFeatherFall(bool enable, bool packetOnly = false);
|
||||
virtual bool SetHover(bool enable, bool packetOnly = false);
|
||||
virtual bool SetHover(bool enable, bool packetOnly = false, bool updateAnimationTier = true);
|
||||
|
||||
// pussywizard:
|
||||
void SendMovementWaterWalking(Player* sendTo);
|
||||
|
||||
Reference in New Issue
Block a user