Skip to content

Commit

Permalink
Handle level up emote. Ensure emote plays unconditionally when Recove…
Browse files Browse the repository at this point in the history
…r_Reply is received (with updated level) to emulate original client behavior.
  • Loading branch information
ethanmoffat committed Mar 30, 2022
1 parent 2bcf1ce commit 4601f70
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion EOLib/PacketHandlers/OtherPlayerLevelUpHandler.cs
@@ -1,4 +1,5 @@
using EOLib.Domain.Character;
using AutomaticTypeMapper;
using EOLib.Domain.Character;
using EOLib.Domain.Login;
using EOLib.Domain.Notifiers;
using EOLib.Net;
Expand All @@ -7,6 +8,7 @@

namespace EOLib.PacketHandlers
{
[AutoMappedType]
public class OtherPlayerLevelUpHandler : InGameOnlyPacketHandler
{
private readonly IEnumerable<IEmoteNotifier> _emoteNotifiers;
Expand Down
9 changes: 5 additions & 4 deletions EOLib/PacketHandlers/RecoverReplyHandler.cs
Expand Up @@ -38,15 +38,16 @@ public override bool HandlePacket(IPacket packet)
.WithNewStat(CharacterStat.Karma, karma);

if (level > 0)
{
stats = stats.WithNewStat(CharacterStat.Level, level);
foreach (var notifier in _emoteNotifiers)
notifier.NotifyEmote((short)_characterRepository.MainCharacter.ID, Emote.LevelUp);
}

if (level > 0 && packet.ReadPosition < packet.Length)
if (packet.ReadPosition < packet.Length)
{
stats = stats.WithNewStat(CharacterStat.StatPoints, packet.ReadShort())
.WithNewStat(CharacterStat.SkillPoints, packet.ReadShort());

foreach (var notifier in _emoteNotifiers)
notifier.NotifyEmote((short)_characterRepository.MainCharacter.ID, Emote.LevelUp);
}

_characterRepository.MainCharacter = _characterRepository.MainCharacter.WithStats(stats);
Expand Down
4 changes: 3 additions & 1 deletion EndlessClient/Rendering/CharacterProperties/FaceRenderer.cs
Expand Up @@ -14,7 +14,9 @@ public class FaceRenderer : BaseCharacterPropertyRenderer
private readonly SkinRenderLocationCalculator _skinRenderLocationCalculator;

public override bool CanRender => _renderProperties.IsActing(CharacterActionState.Emote) &&
_renderProperties.EmoteFrame > 0;
_renderProperties.EmoteFrame > 0 &&
_renderProperties.Emote != Emote.Trade &&
_renderProperties.Emote != Emote.LevelUp;

public FaceRenderer(ICharacterRenderProperties renderProperties,
ISpriteSheet faceSheet,
Expand Down

0 comments on commit 4601f70

Please sign in to comment.