package net.cobem.grizzly.communication.composers.inventory;

import net.cobem.grizzly.communication.EventResponse;
import net.cobem.grizzly.communication.HeaderLibrary;
import net.cobem.grizzly.habbohotel.users.items.InventoryItem;
import net.cobem.grizzly.habbohotel.users.items.ItemHandler;

public class SendInventoryFloorsComposer {
    public static EventResponse compose(ItemHandler Handler) {
        EventResponse Message = new EventResponse();

        Message.Initialize(HeaderLibrary.SendUserInventoryEvent);
        Message.addString("S");
        Message.addInt(1);
        Message.addInt(1);
        Message.addInt(Handler.getFloors().size());

        for (InventoryItem Item : Handler.getFloors().values()) {
            Message.addInt(Item.ID);
            Message.addString(Item.getBase().Type.toUpperCase());
            Message.addInt(Item.ID);
            Message.addInt(Item.getBase().Sprite);
            Message.addInt(1);
            Message.addInt(0); //has to be 0, no matter what..
            Message.addString("");
            Message.addBool(Item.getBase().Recyclable);
            Message.addBool(Item.getBase().Tradeable);
            Message.addBool(true);
            Message.addBool(Item.getBase().Sellable);
            Message.addInt(-1);
            Message.addString("");
            Message.addInt(0);
        }

        return Message;
    }
}
