Skip to content

Commit

Permalink
Implement missing ITEM_AGREE packet handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed May 31, 2024
1 parent 5c797bc commit a4228c1
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions EOLib/PacketHandlers/Items/ItemAgreeHandler.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.Net.Handlers;
using Moffat.EndlessOnline.SDK.Protocol.Net;
using Moffat.EndlessOnline.SDK.Protocol.Net.Server;

namespace EOLib.PacketHandlers.Items
{
[AutoMappedType]
public class ItemAgreeHandler : InGameOnlyPacketHandler<ItemAgreeServerPacket>
{
private readonly ICharacterInventoryRepository _characterInventoryRepository;

public override PacketFamily Family => PacketFamily.Item;

public override PacketAction Action => PacketAction.Agree;

public ItemAgreeHandler(IPlayerInfoProvider playerInfoProvider,
ICharacterInventoryRepository characterInventoryRepository)
: base(playerInfoProvider)
{
_characterInventoryRepository = characterInventoryRepository;
}

public override bool HandlePacket(ItemAgreeServerPacket packet)
{
_characterInventoryRepository.ItemInventory.RemoveWhere(x => x.ItemID == packet.ItemId);
return true;
}
}
}

0 comments on commit a4228c1

Please sign in to comment.