Skip to content

Commit

Permalink
Prevent sitting while otherwise acting. Use map warp backoff when a r…
Browse files Browse the repository at this point in the history
…efresh packet is received.
  • Loading branch information
ethanmoffat committed May 4, 2023
1 parent 885c425 commit 0a01c60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions EOLib/PacketHandlers/Refresh/RefreshReplyHandler.cs
Expand Up @@ -52,19 +52,20 @@ public override bool HandlePacket(IPacket packet)
.WithMapY(updatedMainCharacter.RenderProperties.MapY);

var withoutMainCharacter = data.Characters.Where(x => !IDMatches(x));
data = data.WithCharacters(withoutMainCharacter.ToList());

_characterRepository.MainCharacter = _characterRepository.MainCharacter
.WithRenderProperties(updatedRenderProperties);

_currentMapStateRepository.Characters = data.Characters.ToDictionary(k => k.ID, v => v);
_currentMapStateRepository.Characters = withoutMainCharacter.ToDictionary(k => k.ID, v => v);
_currentMapStateRepository.NPCs = new HashSet<DomainNPC>(data.NPCs);
_currentMapStateRepository.MapItems = new HashSet<MapItem>(data.Items);

_currentMapStateRepository.OpenDoors.Clear();
_currentMapStateRepository.PendingDoors.Clear();
_currentMapStateRepository.VisibleSpikeTraps.Clear();

_currentMapStateRepository.MapWarpTime = Optional.Option.Some(System.DateTime.Now.AddMilliseconds(-100));

foreach (var notifier in _mapChangedNotifiers)
notifier.NotifyMapChanged(differentMapID: false, warpAnimation: WarpAnimation.None);

Expand Down
3 changes: 3 additions & 0 deletions EndlessClient/Controllers/FunctionKeyController.cs
Expand Up @@ -93,6 +93,9 @@ public bool SelectSpell(int index, bool isAlternate)

public bool Sit()
{
if (_characterProvider.MainCharacter.RenderProperties.IsActing(CharacterActionState.Walking, CharacterActionState.Attacking, CharacterActionState.SpellCast))
return false;

_characterActions.ToggleSit();
return true;
}
Expand Down

0 comments on commit 0a01c60

Please sign in to comment.