From be8e18450e86f1e480ef98642e56641c36797def Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 20 Jun 2022 22:48:42 -0400 Subject: [PATCH] Core/Transports: Fixed stoppable elevator position calculation when going from first floor to third or higher Port From (https://github.com/TrinityCore/TrinityCore/commit/d85379faa6d5d33f755e17cb0204f243345db938) --- Source/Framework/Constants/SharedConst.cs | 1 - Source/Game/Entities/GameObject/GameObject.cs | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Framework/Constants/SharedConst.cs b/Source/Framework/Constants/SharedConst.cs index 451c63d1b..bd91a89a8 100644 --- a/Source/Framework/Constants/SharedConst.cs +++ b/Source/Framework/Constants/SharedConst.cs @@ -305,7 +305,6 @@ namespace Framework.Constants 29, 30, 31, -1, 11, 12, 13, 14 }; - public static ulong RaceMaskAllPlayable = (ulong)(GetMaskForRace(Race.Human) | GetMaskForRace(Race.Orc) | GetMaskForRace(Race.Dwarf) | GetMaskForRace(Race.NightElf) | GetMaskForRace(Race.Undead) | GetMaskForRace(Race.Tauren) | GetMaskForRace(Race.Gnome) | GetMaskForRace(Race.Troll) | GetMaskForRace(Race.BloodElf) | GetMaskForRace(Race.Draenei) | GetMaskForRace(Race.Goblin) | GetMaskForRace(Race.Worgen) | GetMaskForRace(Race.PandarenNeutral) | GetMaskForRace(Race.PandarenAlliance) | GetMaskForRace(Race.PandarenHorde) diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs index bea138f1e..d82b1e5b0 100644 --- a/Source/Game/Entities/GameObject/GameObject.cs +++ b/Source/Game/Entities/GameObject/GameObject.cs @@ -3823,7 +3823,12 @@ namespace Game.Entities if (oldToNewStateDelta < 0) oldToNewStateDelta += pauseTimesCount + 1; - if (oldToNewStateDelta < newToOldStateDelta) + // this additional check is neccessary because client doesn't check dynamic flags on progress update + // instead it multiplies progress from dynamicflags field by -1 and then compares that against 0 + // when calculating path progress while we simply check the flag if (!_owner.HasDynamicFlag(GO_DYNFLAG_LO_INVERTED_MOVEMENT)) + bool isAtStartOfPath = _stateChangeProgress == 0; + + if (oldToNewStateDelta < newToOldStateDelta && !isAtStartOfPath) _owner.SetDynamicFlag(GameObjectDynamicLowFlags.InvertedMovement); else _owner.RemoveDynamicFlag(GameObjectDynamicLowFlags.InvertedMovement);