Skip to content

Commit

Permalink
Implement missing chair/sit packet handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed May 28, 2024
1 parent 91e3c9b commit a78ca84
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 0 deletions.
32 changes: 32 additions & 0 deletions EOLib/PacketHandlers/Chair/ChairRemoveHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using AutomaticTypeMapper;
using EOLib.Domain.Character;
using EOLib.Domain.Login;
using EOLib.Domain.Map;
using EOLib.PacketHandlers.Sit;
using Moffat.EndlessOnline.SDK.Protocol.Net;
using Moffat.EndlessOnline.SDK.Protocol.Net.Server;

namespace EOLib.PacketHandlers.Chair
{
/// <summary>
/// Handle another player standing up from a chair
/// </summary>
[AutoMappedType]
public class ChairRemoveHandler : PlayerStandHandlerBase<ChairRemoveServerPacket>
{
public override PacketFamily Family => PacketFamily.Chair;

public override PacketAction Action => PacketAction.Remove;

public ChairRemoveHandler(IPlayerInfoProvider playerInfoProvider,
ICharacterRepository characterRepository,
ICurrentMapStateRepository currentMapStateRepository)
: base(playerInfoProvider, characterRepository, currentMapStateRepository) { }

public override bool HandlePacket(ChairRemoveServerPacket packet)
{
Handle(packet.PlayerId, packet.Coords.X, packet.Coords.Y);
return true;
}
}
}
32 changes: 32 additions & 0 deletions EOLib/PacketHandlers/Chair/ChairReplyHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using AutomaticTypeMapper;
using EOLib.Domain.Character;
using EOLib.Domain.Login;
using EOLib.Domain.Map;
using EOLib.PacketHandlers.Sit;
using Moffat.EndlessOnline.SDK.Protocol.Net;
using Moffat.EndlessOnline.SDK.Protocol.Net.Server;

namespace EOLib.PacketHandlers.Chair
{
/// <summary>
/// Handle your player sitting in a chair
/// </summary>
[AutoMappedType]
public class ChairReplyHandler : PlayerSitHandlerBase<ChairReplyServerPacket>
{
public override PacketFamily Family => PacketFamily.Chair;

public override PacketAction Action => PacketAction.Reply;

public ChairReplyHandler(IPlayerInfoProvider playerInfoProvider,
ICharacterRepository characterRepository,
ICurrentMapStateRepository currentMapStateRepository)
: base(playerInfoProvider, characterRepository, currentMapStateRepository) { }

public override bool HandlePacket(ChairReplyServerPacket packet)
{
Handle(packet.PlayerId, packet.Coords.X, packet.Coords.Y, (EODirection)packet.Direction);
return true;
}
}
}
31 changes: 31 additions & 0 deletions EOLib/PacketHandlers/Sit/SitReplyHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using AutomaticTypeMapper;
using EOLib.Domain.Character;
using EOLib.Domain.Login;
using EOLib.Domain.Map;
using Moffat.EndlessOnline.SDK.Protocol.Net;
using Moffat.EndlessOnline.SDK.Protocol.Net.Server;

namespace EOLib.PacketHandlers.Sit
{
/// <summary>
/// Handle your player sitting
/// </summary>
[AutoMappedType]
public class SitReplyHandler : PlayerSitHandlerBase<SitReplyServerPacket>
{
public override PacketFamily Family => PacketFamily.Sit;

public override PacketAction Action => PacketAction.Reply;

public SitReplyHandler(IPlayerInfoProvider playerInfoProvider,
ICharacterRepository characterRepository,
ICurrentMapStateRepository currentMapStateRepository)
: base(playerInfoProvider, characterRepository, currentMapStateRepository) { }

public override bool HandlePacket(SitReplyServerPacket packet)
{
Handle(packet.PlayerId, packet.Coords.X, packet.Coords.Y, (EODirection)packet.Direction);
return true;
}
}
}

0 comments on commit a78ca84

Please sign in to comment.