diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 3a3b656197..8e35815e68 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1026,6 +1026,40 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 entry, Posit return true; } +bool Creature::SetDisableGravity(bool disable, bool packetOnly /*= false*/, bool updateAnimationTier /*= true*/) +{ + Unit::SetDisableGravity(disable, packetOnly, updateAnimationTier); + + if (updateAnimationTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !GetMovementTemplate().IsRooted()) + { + if (IsGravityDisabled()) + SetAnimationTier(AnimationTier::Fly); + else if (IsHovering()) + SetAnimationTier(AnimationTier::Hover); + else + SetAnimationTier(AnimationTier::Ground); + } + + return true; +} + +bool Creature::SetHover(bool enable, bool packetOnly /*= false*/, bool updateAnimationTier /*= true*/) +{ + Unit::SetHover(enable, packetOnly, updateAnimationTier); + + if (updateAnimationTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !GetMovementTemplate().IsRooted()) + { + if (IsGravityDisabled()) + SetAnimationTier(AnimationTier::Fly); + else if (IsHovering()) + SetAnimationTier(AnimationTier::Hover); + else + SetAnimationTier(AnimationTier::Ground); + } + + return true; +} + void Creature::InitializeReactState() { if (IsTotem() || IsTrigger() || IsCritter() || IsSpiritService()) diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index b2f9cc107c..bc213423aa 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -96,6 +96,8 @@ class TC_GAME_API Creature : public Unit, public GridObject, public Ma bool CanSwim() const override { return GetMovementTemplate().IsSwimAllowed() || IsPet(); } bool CanFly() const override { return GetMovementTemplate().IsFlightAllowed() || IsFlying(); } bool CanHover() const { return GetMovementTemplate().Ground == CreatureGroundMovementType::Hover || IsHovering(); } + bool SetDisableGravity(bool disable, bool packetOnly = false, bool updateAnimationTier = true) override; + bool SetHover(bool enable, bool packetOnly = false, bool updateAnimationTier = true) override; bool IsDungeonBoss() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS) != 0; } bool IsAffectedByDiminishingReturns() const override { return Unit::IsAffectedByDiminishingReturns() || (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH) != 0; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 41d291065f..01a264e92d 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -4246,9 +4246,6 @@ void Player::BuildPlayerRepop() StopMirrorTimers(); //disable timers(bars) - // set and clear other - SetAnimationTier(AnimationTier::Ground, false); - // OnPlayerRepop hook sScriptMgr->OnPlayerRepop(this); } @@ -4265,7 +4262,6 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness) // speed change, land walk // remove death flag + set aura - SetAnimationTier(AnimationTier::Ground); RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_IS_OUT_OF_BOUNDS); // This must be called always even on Players with race != RACE_NIGHTELF in case of faction change diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 184071387f..6c5a8fe281 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11273,6 +11273,9 @@ bool Unit::IsPolymorphed() const void Unit::SetAnimationTier(AnimationTier tier, bool immediate /* = true */) { + if (!IsCreature()) + return; + SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, static_cast(tier)); if (immediate) @@ -14432,7 +14435,7 @@ bool Unit::SetWalk(bool enable) return true; } -bool Unit::SetDisableGravity(bool disable, bool packetOnly /*= false*/, bool updateAnimationTier /*= true*/) +bool Unit::SetDisableGravity(bool disable, bool packetOnly /*= false*/, bool /*updateAnimationTier = true*/) { if (!packetOnly) { @@ -14458,16 +14461,6 @@ bool Unit::SetDisableGravity(bool disable, bool packetOnly /*= false*/, bool upd else Movement::PacketSender(this, SMSG_SPLINE_MOVE_GRAVITY_ENABLE, SMSG_MOVE_GRAVITY_ENABLE).Send(); - if (updateAnimationTier && IsAlive() && IsCreature()) - { - if (IsGravityDisabled()) - SetAnimationTier(AnimationTier::Fly); - else if (IsHovering()) - SetAnimationTier(AnimationTier::Hover); - else - SetAnimationTier(AnimationTier::Ground); - } - return true; } @@ -14585,7 +14578,7 @@ bool Unit::SetFeatherFall(bool enable, bool packetOnly /*= false */) return true; } -bool Unit::SetHover(bool enable, bool packetOnly /*= false*/, bool updateAnimationTier /*= true*/) +bool Unit::SetHover(bool enable, bool packetOnly /*= false*/, bool /*updateAnimationTier = true*/) { if (!packetOnly) { @@ -14619,16 +14612,6 @@ bool Unit::SetHover(bool enable, bool packetOnly /*= false*/, bool updateAnimati else Movement::PacketSender(this, SMSG_SPLINE_MOVE_UNSET_HOVER, SMSG_MOVE_UNSET_HOVER).Send(); - if (updateAnimationTier && IsAlive() && IsCreature()) - { - if (IsGravityDisabled()) - SetAnimationTier(AnimationTier::Fly); - else if (IsHovering()) - SetAnimationTier(AnimationTier::Hover); - else - SetAnimationTier(AnimationTier::Ground); - } - SendSetPlayHoverAnim(enable); return true; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 0c9f1e9d18..a556dc2bed 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1342,13 +1342,13 @@ class TC_GAME_API Unit : public WorldObject bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING); } bool IsHovering() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_HOVER); } bool SetWalk(bool enable); - bool SetDisableGravity(bool disable, bool packetOnly = false, bool updateAnimationTier = true); + virtual bool SetDisableGravity(bool disable, bool packetOnly = false, bool updateAnimationTier = true); bool SetFall(bool enable); bool SetSwim(bool enable); bool SetCanFly(bool enable, bool packetOnly = false); bool SetWaterWalking(bool enable, bool packetOnly = false); bool SetFeatherFall(bool enable, bool packetOnly = false); - bool SetHover(bool enable, bool packetOnly = false, bool updateAnimationTier = true); + virtual bool SetHover(bool enable, bool packetOnly = false, bool updateAnimationTier = true); void SetInFront(WorldObject const* target); void SetFacingTo(float const ori, bool force = true); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/boss_madness_of_deathwing.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/boss_madness_of_deathwing.cpp index 57ea989583..38a9d7e018 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/boss_madness_of_deathwing.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/boss_madness_of_deathwing.cpp @@ -2179,7 +2179,7 @@ class spell_madness_of_deathwing_concentration : public AuraScript if (creature->IsAIEnabled) creature->AI()->SetGUID(GetTarget()->GetGUID(), DATA_FOCUSED_LIMB); - GetTarget()->SetDisableGravity(true); + GetTarget()->SetAnimationTier(AnimationTier::Fly); for (uint8 i = 0; i < 2; ++i) GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_COSMETIC_TENTACLE); }