From 1335b1c874fc1a41ef95f4b6b8e5bea89e34ca87 Mon Sep 17 00:00:00 2001 From: Ethan Moffat Date: Wed, 27 Apr 2022 07:46:08 -0700 Subject: [PATCH] Separate Emote from Attack in CharacterAnimator --- .../Character/CharacterAnimationActions.cs | 10 +++++++-- .../Rendering/Character/CharacterAnimator.cs | 22 ++++--------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/EndlessClient/Rendering/Character/CharacterAnimationActions.cs b/EndlessClient/Rendering/Character/CharacterAnimationActions.cs index d0fbdd7de..9afbd076f 100644 --- a/EndlessClient/Rendering/Character/CharacterAnimationActions.cs +++ b/EndlessClient/Rendering/Character/CharacterAnimationActions.cs @@ -79,7 +79,10 @@ public void StartAttacking(int noteIndex = -1) return; CancelSpellPrep(); - Animator.StartMainCharacterAttackAnimation(isBard: noteIndex >= 0); + + if (noteIndex >= 0) + Animator.Emote(_characterRepository.MainCharacter.ID, EOLib.Domain.Character.Emote.MusicNotes); + Animator.StartMainCharacterAttackAnimation(); ShowWaterSplashiesIfNeeded(CharacterActionState.Attacking, _characterRepository.MainCharacter.ID); PlayWeaponSound(_characterRepository.MainCharacter, noteIndex); @@ -120,7 +123,10 @@ public void StartOtherCharacterAttackAnimation(int characterID, int noteIndex = if (!_hudControlProvider.IsInGame) return; - Animator.StartOtherCharacterAttackAnimation(characterID, noteIndex >= 0); + if (noteIndex >= 0) + Animator.Emote(characterID, EOLib.Domain.Character.Emote.MusicNotes); + + Animator.StartOtherCharacterAttackAnimation(characterID); ShowWaterSplashiesIfNeeded(CharacterActionState.Attacking, characterID); if (_currentMapStateProvider.Characters.ContainsKey(characterID)) diff --git a/EndlessClient/Rendering/Character/CharacterAnimator.cs b/EndlessClient/Rendering/Character/CharacterAnimator.cs index a0832fabf..913013451 100644 --- a/EndlessClient/Rendering/Character/CharacterAnimator.cs +++ b/EndlessClient/Rendering/Character/CharacterAnimator.cs @@ -129,7 +129,7 @@ public void StartMainCharacterWalkAnimation(Option targetCoordina _characterActions.Walk(); } - public void StartMainCharacterAttackAnimation(bool isBard = false) + public void StartMainCharacterAttackAnimation() { if (_otherPlayerStartAttackingTimes.ContainsKey(_characterRepository.MainCharacter.ID)) { @@ -139,13 +139,6 @@ public void StartMainCharacterAttackAnimation(bool isBard = false) var startAttackingTime = new RenderFrameActionTime(_characterRepository.MainCharacter.ID); _otherPlayerStartAttackingTimes.Add(_characterRepository.MainCharacter.ID, startAttackingTime); - - if (isBard) - { - var rp = _characterRepository.MainCharacter.RenderProperties.WithEmote(EOLib.Domain.Character.Emote.MusicNotes); - _characterRepository.MainCharacter = _characterRepository.MainCharacter.WithRenderProperties(rp); - _startEmoteTimes[_characterRepository.MainCharacter.ID] = new RenderFrameActionTime(_characterRepository.MainCharacter.ID); - } } public bool MainCharacterShoutSpellPrep(ESFRecord spellData, ISpellTargetable target) @@ -183,7 +176,7 @@ public void StartOtherCharacterWalkAnimation(int characterID, byte destinationX, _otherPlayerStartWalkingTimes.Add(characterID, startWalkingTimeAndID); } - public void StartOtherCharacterAttackAnimation(int characterID, bool isBard = false) + public void StartOtherCharacterAttackAnimation(int characterID) { if (_otherPlayerStartAttackingTimes.TryGetValue(characterID, out var _)) { @@ -193,13 +186,6 @@ public void StartOtherCharacterAttackAnimation(int characterID, bool isBard = fa var startAttackingTime = new RenderFrameActionTime(characterID); _otherPlayerStartAttackingTimes.Add(characterID, startAttackingTime); - - if (isBard && _currentMapStateRepository.Characters.TryGetValue(characterID, out var otherCharacter)) - { - var rp = otherCharacter.RenderProperties.WithEmote(EOLib.Domain.Character.Emote.MusicNotes); - _currentMapStateRepository.Characters[characterID] = otherCharacter.WithRenderProperties(rp); - _startEmoteTimes[characterID] = new RenderFrameActionTime(characterID); - } } public void StartOtherCharacterSpellCast(int characterID) @@ -561,7 +547,7 @@ public interface ICharacterAnimator : IGameComponent void StartMainCharacterWalkAnimation(Option targetCoordinate); - void StartMainCharacterAttackAnimation(bool isBard = false); + void StartMainCharacterAttackAnimation(); bool MainCharacterShoutSpellPrep(ESFRecord spellData, ISpellTargetable spellTarget); @@ -569,7 +555,7 @@ public interface ICharacterAnimator : IGameComponent void StartOtherCharacterWalkAnimation(int characterID, byte targetX, byte targetY, EODirection direction); - void StartOtherCharacterAttackAnimation(int characterID, bool isBard = false); + void StartOtherCharacterAttackAnimation(int characterID); void StartOtherCharacterSpellCast(int characterID);