package net.cobem.grizzly.habbohotel.wired.effects;

import net.cobem.grizzly.communication.EventRequest;
import net.cobem.grizzly.habbohotel.rooms.items.FloorItem;
import net.cobem.grizzly.habbohotel.sessions.Session;
import net.cobem.grizzly.habbohotel.wired.WiredObject;

import java.util.ArrayList;
import java.util.List;

public class TransportUser implements WiredObject {
    @Override
    public void save(Session Session, FloorItem Item, EventRequest Message) {
        int ItemID = Message.readInt();

        Message.readString();

        int ItemCount = Message.readInt();

        List<FloorItem> Items = new ArrayList<>();

        String ArrayString = "";

        for(int i = 0; i < ItemCount; i++) {
            int ID = Message.readInt();

            FloorItem mItem = Session.getActor().CurrentRoom.getItemByID(ID);

            if (mItem == null) {
                //dafuk..
            } else {
                Items.add(mItem);
                ArrayString += mItem.ID + ";";
            }
        }

        Item.ExtraData = ArrayString;

        Item.saveState();
    }
}
