package net.cobem.grizzly.communication.events.moderation;

import net.cobem.grizzly.Grizzly;
import net.cobem.grizzly.communication.EventRequest;
import net.cobem.grizzly.communication.EventResponse;
import net.cobem.grizzly.communication.GameEvent;
import net.cobem.grizzly.communication.HeaderLibrary;
import net.cobem.grizzly.habbohotel.rooms.Room;
import net.cobem.grizzly.habbohotel.sessions.Session;

public class ShowRoomInformationEvent implements GameEvent {
    @Override
    public void compose(Session Session, EventRequest Request) {
        EventResponse Message = new EventResponse();

        int ID = Request.readInt();

        Room mRoom;

        boolean RoomWasntLoaded = false;

        if (Grizzly.getHabboHotel().getRooms().getByID(ID) == null) {
            RoomWasntLoaded = true;

            mRoom = new Room(ID);
        } else {
            mRoom = Grizzly.getHabboHotel().getRooms().getByID(ID);

        }

        Message.Initialize(HeaderLibrary.SendModToolsRoomInformationEvent);

        Message.addInt(mRoom.ID);
        Message.addInt(RoomWasntLoaded ? 0 : mRoom.getParty().size());
        Message.addBool(mRoom.Owner == Session.getHabbo().getID());
        Message.addInt(mRoom.Owner);
        Message.addString(mRoom.OwnerByName);
        Message.addBool(false);
        Message.addBool(true);
        Message.addString(mRoom.Title);
        Message.addString(mRoom.Description);
        Message.addInt(0);
        /*
            Tags here..
         */
        Message.addInt(0); // Has Event?
        Message.addInt(0); // Has Event?
        Message.addInt(0); // Has Event?

        Session.sendResponse(Message);
    }
}
