🆕 Infostand Background

This commit is contained in:
DuckieTM 2025-04-17 19:16:50 +02:00
parent 603a2d6e33
commit 450cddfbf1
8 changed files with 83 additions and 28 deletions

View File

@ -25,6 +25,9 @@ public class RoomUserPetComposer extends MessageComposer {
this.response.appendInt(this.habbo.getHabboInfo().getId()); this.response.appendInt(this.habbo.getHabboInfo().getId());
this.response.appendString(this.habbo.getHabboInfo().getUsername()); this.response.appendString(this.habbo.getHabboInfo().getUsername());
this.response.appendString(""); this.response.appendString("");
this.response.appendInt(0);
this.response.appendInt(0);
this.response.appendInt(0);
this.response.appendString(this.petType + " " + this.race + " " + this.color + " 2 2 -1 0 3 -1 0"); this.response.appendString(this.petType + " " + this.race + " " + this.color + " 2 2 -1 0 3 -1 0");
this.response.appendInt(this.habbo.getRoomUnit().getId()); this.response.appendInt(this.habbo.getRoomUnit().getId());
this.response.appendInt(this.habbo.getRoomUnit().getX()); this.response.appendInt(this.habbo.getRoomUnit().getX());

View File

@ -42,6 +42,9 @@ public class HabboInfo implements Runnable {
private int lastOnline; private int lastOnline;
private int homeRoom; private int homeRoom;
private boolean online; private boolean online;
private int InfostandBg;
private int InfostandStand;
private int InfostandOverlay;
private int loadingRoom; private int loadingRoom;
private Room currentRoom; private Room currentRoom;
private int roomQueueId; private int roomQueueId;
@ -72,8 +75,8 @@ public class HabboInfo implements Runnable {
this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(set.getInt("rank")); this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(set.getInt("rank"));
if (this.rank == null) { if (this.rank == null) {
LOGGER.error("No existing rank found with id {}. Make sure an entry in the permissions table exists.", set.getInt("rank")); LOGGER.error("No existing rank found with id " + set.getInt("rank") + ". Make sure an entry in the permissions table exists.");
LOGGER.warn("{} has an invalid rank with id {}. Make sure an entry in the permissions table exists.", this.username, set.getInt("rank")); LOGGER.warn(this.username + " has an invalid rank with id " + set.getInt("rank") + ". Make sure an entry in the permissions table exists.");
this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(1); this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(1);
} }
@ -83,6 +86,9 @@ public class HabboInfo implements Runnable {
this.lastOnline = set.getInt("last_online"); this.lastOnline = set.getInt("last_online");
this.machineID = set.getString("machine_id"); this.machineID = set.getString("machine_id");
this.online = false; this.online = false;
this.InfostandBg = set.getInt("background_id");
this.InfostandStand = set.getInt("background_stand_id");
this.InfostandOverlay = set.getInt("background_overlay_id");
this.currentRoom = null; this.currentRoom = null;
} catch (SQLException e) { } catch (SQLException e) {
LOGGER.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);
@ -270,6 +276,29 @@ public class HabboInfo implements Runnable {
this.motto = motto; this.motto = motto;
} }
public int getInfostandBg() {
return InfostandBg;
}
public void setInfostandBg(int infostandBg) {
InfostandBg = infostandBg;
}
public int getInfostandStand() {
return InfostandStand;
}
public void setInfostandStand(int infostandStand) {
InfostandStand = infostandStand;
}
public int getInfostandOverlay() {
return InfostandOverlay;
}
public void setInfostandOverlay(int infostandOverlay) {
InfostandOverlay = infostandOverlay;
}
public Rank getRank() { public Rank getRank() {
return this.rank; return this.rank;
} }
@ -537,7 +566,7 @@ public class HabboInfo implements Runnable {
public void run() { public void run() {
this.saveCurrencies(); this.saveCurrencies();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users SET motto = ?, online = ?, look = ?, gender = ?, credits = ?, last_login = ?, last_online = ?, home_room = ?, ip_current = ?, `rank` = ?, machine_id = ?, username = ? WHERE id = ?")) { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users SET motto = ?, online = ?, look = ?, gender = ?, credits = ?, last_login = ?, last_online = ?, home_room = ?, ip_current = ?, `rank` = ?, machine_id = ?, username = ?, background_id = ?, background_stand_id = ?, background_overlay_id = ? WHERE id = ?")) {
statement.setString(1, this.motto); statement.setString(1, this.motto);
statement.setString(2, this.online ? "1" : "0"); statement.setString(2, this.online ? "1" : "0");
statement.setString(3, this.look); statement.setString(3, this.look);
@ -550,7 +579,10 @@ public class HabboInfo implements Runnable {
statement.setInt(10, this.rank != null ? this.rank.getId() : 1); statement.setInt(10, this.rank != null ? this.rank.getId() : 1);
statement.setString(11, this.machineID); statement.setString(11, this.machineID);
statement.setString(12, this.username); statement.setString(12, this.username);
statement.setInt(13, this.id); statement.setInt(13, this.InfostandBg);
statement.setInt(14, this.InfostandStand);
statement.setInt(15, this.InfostandOverlay);
statement.setInt(16, this.id);
statement.executeUpdate(); statement.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
LOGGER.error("Caught SQL exception", e); LOGGER.error("Caught SQL exception", e);

View File

@ -320,6 +320,7 @@ public class PacketManager {
this.registerHandler(Incoming.ChangeNameCheckUsernameEvent, ChangeNameCheckUsernameEvent.class); this.registerHandler(Incoming.ChangeNameCheckUsernameEvent, ChangeNameCheckUsernameEvent.class);
this.registerHandler(Incoming.ConfirmChangeNameEvent, ConfirmChangeNameEvent.class); this.registerHandler(Incoming.ConfirmChangeNameEvent, ConfirmChangeNameEvent.class);
this.registerHandler(Incoming.ChangeChatBubbleEvent, ChangeChatBubbleEvent.class); this.registerHandler(Incoming.ChangeChatBubbleEvent, ChangeChatBubbleEvent.class);
this.registerHandler(Incoming.ChangeInfostandBgEvent, ChangeInfostandBgEvent.class);
this.registerHandler(Incoming.UpdateUIFlagsEvent, UpdateUIFlagsEvent.class); this.registerHandler(Incoming.UpdateUIFlagsEvent, UpdateUIFlagsEvent.class);
} }

View File

@ -353,6 +353,7 @@ public class Incoming {
public static final int TradeCancelEvent = 2341; public static final int TradeCancelEvent = 2341;
public static final int ChangeChatBubbleEvent = 1030; public static final int ChangeChatBubbleEvent = 1030;
public static final int ChangeInfostandBgEvent = 1031;
public static final int LoveLockStartConfirmEvent = 3775; public static final int LoveLockStartConfirmEvent = 3775;
public static final int HotelViewRequestLTDAvailabilityEvent = 410; public static final int HotelViewRequestLTDAvailabilityEvent = 410;

View File

@ -0,0 +1,24 @@
package com.eu.habbo.messages.incoming.users;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer;
public class ChangeInfostandBgEvent extends MessageHandler {
@Override
public void handle() throws Exception {
int backgroundImage = this.packet.readInt();
int backgroundStand = this.packet.readInt();
int backgroundOverlay = this.packet.readInt();
this.client.getHabbo().getHabboInfo().setInfostandBg(backgroundImage);
this.client.getHabbo().getHabboInfo().setInfostandStand(backgroundStand);
this.client.getHabbo().getHabboInfo().setInfostandOverlay(backgroundOverlay);
this.client.getHabbo().getHabboInfo().run();
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != null) {
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserDataComposer(this.client.getHabbo()).compose());
} else {
this.client.sendResponse(new RoomUserDataComposer(this.client.getHabbo()));
}
}
}

View File

@ -33,6 +33,9 @@ public class RoomPetComposer extends MessageComposer implements TIntObjectProced
this.response.appendInt(pet.getId()); this.response.appendInt(pet.getId());
this.response.appendString(pet.getName()); this.response.appendString(pet.getName());
this.response.appendString(""); this.response.appendString("");
this.response.appendInt(0);
this.response.appendInt(0);
this.response.appendInt(0);
if (pet instanceof IPetLook) { if (pet instanceof IPetLook) {
this.response.appendString(((IPetLook) pet).getLook()); this.response.appendString(((IPetLook) pet).getLook());
} else { } else {
@ -59,8 +62,4 @@ public class RoomPetComposer extends MessageComposer implements TIntObjectProced
return true; return true;
} }
public TIntObjectMap<Pet> getPets() {
return pets;
}
} }

View File

@ -20,10 +20,9 @@ public class RoomUserDataComposer extends MessageComposer {
this.response.appendString(this.habbo.getHabboInfo().getGender().name() + ""); this.response.appendString(this.habbo.getHabboInfo().getGender().name() + "");
this.response.appendString(this.habbo.getHabboInfo().getMotto()); this.response.appendString(this.habbo.getHabboInfo().getMotto());
this.response.appendInt(this.habbo.getHabboStats().getAchievementScore()); this.response.appendInt(this.habbo.getHabboStats().getAchievementScore());
this.response.appendInt(this.habbo.getHabboInfo().getInfostandBg());
this.response.appendInt(this.habbo.getHabboInfo().getInfostandStand());
this.response.appendInt(this.habbo.getHabboInfo().getInfostandOverlay());
return this.response; return this.response;
} }
public Habbo getHabbo() {
return habbo;
}
} }

View File

@ -40,6 +40,9 @@ public class RoomUsersComposer extends MessageComposer {
this.response.appendInt(this.habbo.getHabboInfo().getId()); this.response.appendInt(this.habbo.getHabboInfo().getId());
this.response.appendString(this.habbo.getHabboInfo().getUsername()); this.response.appendString(this.habbo.getHabboInfo().getUsername());
this.response.appendString(this.habbo.getHabboInfo().getMotto()); this.response.appendString(this.habbo.getHabboInfo().getMotto());
this.response.appendInt(this.habbo.getHabboInfo().getInfostandBg());
this.response.appendInt(this.habbo.getHabboInfo().getInfostandStand());
this.response.appendInt(this.habbo.getHabboInfo().getInfostandOverlay());
this.response.appendString(this.habbo.getHabboInfo().getLook()); this.response.appendString(this.habbo.getHabboInfo().getLook());
this.response.appendInt(this.habbo.getRoomUnit().getId()); //Room Unit ID this.response.appendInt(this.habbo.getRoomUnit().getId()); //Room Unit ID
this.response.appendInt(this.habbo.getRoomUnit().getX()); this.response.appendInt(this.habbo.getRoomUnit().getX());
@ -70,6 +73,9 @@ public class RoomUsersComposer extends MessageComposer {
this.response.appendInt(habbo.getHabboInfo().getId()); this.response.appendInt(habbo.getHabboInfo().getId());
this.response.appendString(habbo.getHabboInfo().getUsername()); this.response.appendString(habbo.getHabboInfo().getUsername());
this.response.appendString(habbo.getHabboInfo().getMotto()); this.response.appendString(habbo.getHabboInfo().getMotto());
this.response.appendInt(habbo.getHabboInfo().getInfostandBg());
this.response.appendInt(habbo.getHabboInfo().getInfostandStand());
this.response.appendInt(habbo.getHabboInfo().getInfostandOverlay());
this.response.appendString(habbo.getHabboInfo().getLook()); this.response.appendString(habbo.getHabboInfo().getLook());
this.response.appendInt(habbo.getRoomUnit().getId()); //Room Unit ID this.response.appendInt(habbo.getRoomUnit().getId()); //Room Unit ID
this.response.appendInt(habbo.getRoomUnit().getX()); this.response.appendInt(habbo.getRoomUnit().getX());
@ -98,6 +104,9 @@ public class RoomUsersComposer extends MessageComposer {
this.response.appendInt(0 - this.bot.getId()); this.response.appendInt(0 - this.bot.getId());
this.response.appendString(this.bot.getName()); this.response.appendString(this.bot.getName());
this.response.appendString(this.bot.getMotto()); this.response.appendString(this.bot.getMotto());
this.response.appendInt(0);
this.response.appendInt(0);
this.response.appendInt(0);
this.response.appendString(this.bot.getFigure()); this.response.appendString(this.bot.getFigure());
this.response.appendInt(this.bot.getRoomUnit().getId()); this.response.appendInt(this.bot.getRoomUnit().getId());
this.response.appendInt(this.bot.getRoomUnit().getX()); this.response.appendInt(this.bot.getRoomUnit().getX());
@ -125,6 +134,9 @@ public class RoomUsersComposer extends MessageComposer {
this.response.appendInt(0 - bot.getId()); this.response.appendInt(0 - bot.getId());
this.response.appendString(bot.getName()); this.response.appendString(bot.getName());
this.response.appendString(bot.getMotto()); this.response.appendString(bot.getMotto());
this.response.appendInt(0);
this.response.appendInt(0);
this.response.appendInt(0);
this.response.appendString(bot.getFigure()); this.response.appendString(bot.getFigure());
this.response.appendInt(bot.getRoomUnit().getId()); this.response.appendInt(bot.getRoomUnit().getId());
this.response.appendInt(bot.getRoomUnit().getX()); this.response.appendInt(bot.getRoomUnit().getX());
@ -150,20 +162,4 @@ public class RoomUsersComposer extends MessageComposer {
} }
return this.response; return this.response;
} }
public Habbo getHabbo() {
return habbo;
}
public Collection<Habbo> getHabbos() {
return habbos;
}
public Bot getBot() {
return bot;
}
public Collection<Bot> getBots() {
return bots;
}
} }