diff --git a/EOLib/PacketHandlers/PlayerAttackHandler.cs b/EOLib/PacketHandlers/PlayerAttackHandler.cs index e51358fe9..4fc2915f1 100644 --- a/EOLib/PacketHandlers/PlayerAttackHandler.cs +++ b/EOLib/PacketHandlers/PlayerAttackHandler.cs @@ -42,11 +42,14 @@ public override bool HandlePacket(IPacket packet) } catch (InvalidOperationException) { return false; } - var renderProperties = character.RenderProperties.WithDirection(direction); - var newCharacter = character.WithRenderProperties(renderProperties); + if (character.RenderProperties.Direction != direction) + { + var renderProperties = character.RenderProperties.WithDirection(direction); + var newCharacter = character.WithRenderProperties(renderProperties); - _currentMapStateRepository.Characters.Remove(character); - _currentMapStateRepository.Characters.Add(newCharacter); + _currentMapStateRepository.Characters.Remove(character); + _currentMapStateRepository.Characters.Add(newCharacter); + } foreach (var notifier in _otherCharacterAnimationNotifiers) notifier.StartOtherCharacterAttackAnimation(playerID); diff --git a/EndlessClient/Rendering/Character/CharacterAnimator.cs b/EndlessClient/Rendering/Character/CharacterAnimator.cs index 5908d3ac8..97bc9c8cf 100644 --- a/EndlessClient/Rendering/Character/CharacterAnimator.cs +++ b/EndlessClient/Rendering/Character/CharacterAnimator.cs @@ -12,8 +12,8 @@ namespace EndlessClient.Rendering.Character { public class CharacterAnimator : GameComponent, ICharacterAnimator { - public const int WALK_FRAME_TIME_MS = 480 / (CharacterRenderProperties.MAX_NUMBER_OF_WALK_FRAMES - 1); - public const int ATTACK_FRAME_TIME_MS = 600 / CharacterRenderProperties.MAX_NUMBER_OF_WALK_FRAMES; + public const int WALK_FRAME_TIME_MS = 120; + public const int ATTACK_FRAME_TIME_MS = 100; private readonly ICharacterRepository _characterRepository; private readonly ICurrentMapStateRepository _currentMapStateRepository; @@ -116,14 +116,10 @@ public void StartOtherCharacterWalkAnimation(int characterID, byte destinationX, public void StartOtherCharacterAttackAnimation(int characterID) { - if (_otherPlayerStartWalkingTimes.ContainsKey(characterID) || - _otherPlayerStartSpellCastTimes.ContainsKey(characterID)) - return; - if (_otherPlayerStartAttackingTimes.TryGetValue(characterID, out var _)) { - ResetCharacterAnimationFrames(characterID); - _otherPlayerStartAttackingTimes.Remove(characterID); + _otherPlayerStartAttackingTimes[characterID].Replay = true; + return; } var startAttackingTimeAndID = new RenderFrameActionTime(characterID);