using Fantasy;
using Fantasy.Async;
using Fantasy.Network.Interface;

namespace NB.Game;

public class C2Game_GetItemsRequestHandler : RouteRPC<Player, C2Game_GetItemsRequest, Game2C_GetItemsResponse>
{
    protected override async FTask Run(Player entity, C2Game_GetItemsRequest request, Game2C_GetItemsResponse response,
        Action reply)
    {
        var itemContainer = entity.GetComponent<PlayerItemContainerComponent>();
        response.Items = itemContainer.GetItemInfos();
        response.Rigs = itemContainer.GetRigInfos();
        await FTask.CompletedTask;
    }
}