Skip to content

Commit

Permalink
Separate Emote from Attack in CharacterAnimator
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed Apr 27, 2022
1 parent 512ed1a commit 1335b1c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
10 changes: 8 additions & 2 deletions EndlessClient/Rendering/Character/CharacterAnimationActions.cs
Expand Up @@ -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);
Expand Down Expand Up @@ -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))
Expand Down
22 changes: 4 additions & 18 deletions EndlessClient/Rendering/Character/CharacterAnimator.cs
Expand Up @@ -129,7 +129,7 @@ public void StartMainCharacterWalkAnimation(Option<MapCoordinate> targetCoordina
_characterActions.Walk();
}

public void StartMainCharacterAttackAnimation(bool isBard = false)
public void StartMainCharacterAttackAnimation()
{
if (_otherPlayerStartAttackingTimes.ContainsKey(_characterRepository.MainCharacter.ID))
{
Expand All @@ -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)
Expand Down Expand Up @@ -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 _))
{
Expand All @@ -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)
Expand Down Expand Up @@ -561,15 +547,15 @@ public interface ICharacterAnimator : IGameComponent

void StartMainCharacterWalkAnimation(Option<MapCoordinate> targetCoordinate);

void StartMainCharacterAttackAnimation(bool isBard = false);
void StartMainCharacterAttackAnimation();

bool MainCharacterShoutSpellPrep(ESFRecord spellData, ISpellTargetable spellTarget);

void MainCharacterCancelSpellPrep();

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);

Expand Down

0 comments on commit 1335b1c

Please sign in to comment.