43 lines
1.4 KiB
Java
Raw Normal View History

2018-07-06 13:30:00 +00:00
package com.eu.habbo.messages.rcon;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.habbohotel.catalog.layouts.RoomBundleLayout;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboManager;
import com.google.gson.Gson;
2019-05-26 21:14:53 +03:00
public class SendRoomBundle extends RCONMessage<SendRoomBundle.JSON> {
public SendRoomBundle() {
2018-07-06 13:30:00 +00:00
super(JSON.class);
}
@Override
2019-05-26 21:14:53 +03:00
public void handle(Gson gson, JSON json) {
if (json.catalog_page > 0 && json.user_id > 0) {
2018-07-06 13:30:00 +00:00
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(json.user_id);
CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().getCatalogPage(json.catalog_page);
2019-05-26 21:14:53 +03:00
if ((page instanceof RoomBundleLayout)) {
if (habbo != null) {
2018-07-06 13:30:00 +00:00
((RoomBundleLayout) page).buyRoom(habbo);
2019-05-26 21:14:53 +03:00
} else {
2018-07-06 13:30:00 +00:00
HabboInfo info = HabboManager.getOfflineHabboInfo(json.user_id);
2019-05-26 21:14:53 +03:00
if (info != null) {
2018-07-06 13:30:00 +00:00
((RoomBundleLayout) page).buyRoom(null, json.user_id, info.getUsername());
}
}
}
}
}
2019-05-26 21:14:53 +03:00
static class JSON {
2018-10-06 22:28:00 +00:00
2018-07-06 13:30:00 +00:00
public int user_id;
2018-10-06 22:28:00 +00:00
2018-07-06 13:30:00 +00:00
public int catalog_page;
}
}