diff --git a/Database Updates/002_backgounds_border.sql b/Database Updates/002_backgounds_border.sql new file mode 100644 index 00000000..3e542f30 --- /dev/null +++ b/Database Updates/002_backgounds_border.sql @@ -0,0 +1,33 @@ +ALTER TABLE users +ADD COLUMN `background_border_id` INT(11) NOT NULL DEFAULT 0 AFTER `background_id`; + +ALTER TABLE infostand_backgrounds +CHANGE COLUMN `category` `category` ENUM('background', 'stand', 'overlay', 'card', 'border') NOT NULL ; + + +INSERT IGNORE INTO `infostand_backgrounds` (`id`, `category`, `min_rank`, `is_hc_only`, `is_ambassador_only`) VALUES + (1, 'border', 1, 0, 0), + (2, 'border', 1, 0, 0), + (3, 'border', 1, 0, 0), + (4, 'border', 1, 0, 0), + (5, 'border', 1, 0, 0), + (6, 'border', 1, 0, 0), + (7, 'border', 1, 0, 0), + (8, 'border', 1, 0, 0), + (9, 'border', 1, 0, 0), + (10, 'border', 1, 0, 0), + (11, 'border', 1, 0, 0), + (12, 'border', 1, 0, 0), + (13, 'border', 1, 0, 0), + (14, 'border', 1, 0, 0), + (15, 'border', 1, 0, 0), + (16, 'border', 1, 0, 0), + (17, 'border', 1, 0, 0), + (18, 'border', 1, 0, 0), + (19, 'border', 1, 0, 0), + (20, 'border', 1, 0, 0), + (21, 'border', 1, 0, 0), + (22, 'border', 1, 0, 0), + (23, 'border', 1, 0, 0), + (24, 'border', 1, 0, 0), + (25, 'border', 1, 0, 0); \ No newline at end of file diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java index 0bcc8247..373642be 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java @@ -46,6 +46,7 @@ public class HabboInfo implements Runnable { private int InfostandStand; private int InfostandOverlay; private int InfostandCardBg; + private int InfostandBorder; private int loadingRoom; private Room currentRoom; private String roomEntryMethod = "door"; @@ -93,6 +94,11 @@ public class HabboInfo implements Runnable { this.InfostandStand = set.getInt("background_stand_id"); this.InfostandOverlay = set.getInt("background_overlay_id"); this.InfostandCardBg = set.getInt("background_card_id"); + try { + this.InfostandBorder = set.getInt("background_border_id"); + } catch (SQLException ignored) { + this.InfostandBorder = 0; + } this.currentRoom = null; } catch (SQLException e) { LOGGER.error("Caught SQL exception", e); @@ -300,6 +306,15 @@ public class HabboInfo implements Runnable { public void setInfostandCardBg(int infostandCardBg) { InfostandCardBg = infostandCardBg; } + + public int getInfostandBorder() { + return InfostandBorder; + } + + public void setInfostandBorder(int infostandBorder) { + InfostandBorder = infostandBorder; + } + public Rank getRank() { return this.rank; } @@ -587,7 +602,7 @@ public class HabboInfo implements Runnable { try { SqlQueries.update( - "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 = ?, background_card_id = ? WHERE id = ?", + "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 = ?, background_card_id = ?, background_border_id = ? WHERE id = ?", this.motto, this.online ? "1" : "0", this.look, @@ -604,6 +619,7 @@ public class HabboInfo implements Runnable { this.InfostandStand, this.InfostandOverlay, this.InfostandCardBg, + this.InfostandBorder, this.id); } catch (SqlQueries.DataAccessException e) { LOGGER.error("Caught SQL exception", e); diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/users/infostand/InfostandBackgroundManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/users/infostand/InfostandBackgroundManager.java index 60ce0419..8217bbfe 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/users/infostand/InfostandBackgroundManager.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/users/infostand/InfostandBackgroundManager.java @@ -24,7 +24,8 @@ public class InfostandBackgroundManager { BACKGROUND("background"), STAND("stand"), OVERLAY("overlay"), - CARD("card"); + CARD("card"), + BORDER("border"); public final String dbValue; @@ -89,11 +90,12 @@ public class InfostandBackgroundManager { this.enforce = loaded > 0; if (this.enforce) { - LOGGER.info("InfostandBackgroundManager -> Loaded {} backgrounds, {} stands, {} overlays, {} cards from infostand_backgrounds.", + LOGGER.info("InfostandBackgroundManager -> Loaded {} backgrounds, {} stands, {} overlays, {} cards, {} borders from infostand_backgrounds.", this.entries.get(Category.BACKGROUND).size(), this.entries.get(Category.STAND).size(), this.entries.get(Category.OVERLAY).size(), - this.entries.get(Category.CARD).size()); + this.entries.get(Category.CARD).size(), + this.entries.get(Category.BORDER).size()); } else { LOGGER.info("InfostandBackgroundManager -> infostand_backgrounds is empty, server-side validation disabled (only range clamp will apply)."); } diff --git a/Emulator/src/main/java/com/eu/habbo/messages/incoming/users/ChangeInfostandBgEvent.java b/Emulator/src/main/java/com/eu/habbo/messages/incoming/users/ChangeInfostandBgEvent.java index 74485096..8e9c3930 100644 --- a/Emulator/src/main/java/com/eu/habbo/messages/incoming/users/ChangeInfostandBgEvent.java +++ b/Emulator/src/main/java/com/eu/habbo/messages/incoming/users/ChangeInfostandBgEvent.java @@ -37,6 +37,7 @@ public class ChangeInfostandBgEvent extends MessageHandler { int requestedStand = sanitize(this.packet.readInt()); int requestedOverlay = sanitize(this.packet.readInt()); int requestedCard = this.packet.bytesAvailable() >= 4 ? sanitize(this.packet.readInt()) : 0; + int requestedBorder = this.packet.bytesAvailable() >= 4 ? sanitize(this.packet.readInt()) : 0; InfostandBackgroundManager manager = Emulator.getGameEnvironment() != null ? Emulator.getGameEnvironment().getInfostandBackgroundManager() : null; @@ -44,11 +45,13 @@ public class ChangeInfostandBgEvent extends MessageHandler { int backgroundStand = resolve(manager, habbo, Category.STAND, requestedStand, info.getInfostandStand()); int backgroundOverlay = resolve(manager, habbo, Category.OVERLAY, requestedOverlay, info.getInfostandOverlay()); int backgroundCard = resolve(manager, habbo, Category.CARD, requestedCard, info.getInfostandCardBg()); + int backgroundBorder = resolve(manager, habbo, Category.BORDER, requestedBorder, info.getInfostandBorder()); if (info.getInfostandBg() == backgroundImage && info.getInfostandStand() == backgroundStand && info.getInfostandOverlay() == backgroundOverlay - && info.getInfostandCardBg() == backgroundCard) { + && info.getInfostandCardBg() == backgroundCard + && info.getInfostandBorder() == backgroundBorder) { return; } @@ -56,6 +59,7 @@ public class ChangeInfostandBgEvent extends MessageHandler { info.setInfostandStand(backgroundStand); info.setInfostandOverlay(backgroundOverlay); info.setInfostandCardBg(backgroundCard); + info.setInfostandBorder(backgroundBorder); info.run(); if (info.getCurrentRoom() != null) { diff --git a/Emulator/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserDataComposer.java b/Emulator/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserDataComposer.java index 7162dbf0..fd2c8a32 100644 --- a/Emulator/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserDataComposer.java +++ b/Emulator/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserDataComposer.java @@ -33,6 +33,7 @@ public class RoomUserDataComposer extends MessageComposer { this.response.appendString(customizationData.prefixEffect); this.response.appendString(customizationData.prefixFont); this.response.appendString(customizationData.displayOrder); + this.response.appendInt(this.habbo.getHabboInfo().getInfostandBorder()); return this.response; } diff --git a/Emulator/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersComposer.java b/Emulator/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersComposer.java index 796935c2..8b651b48 100644 --- a/Emulator/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersComposer.java +++ b/Emulator/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersComposer.java @@ -78,6 +78,7 @@ public class RoomUsersComposer extends MessageComposer { this.response.appendString(customizationData.displayOrder); this.response.appendString(this.habbo.getHabboInfo().getRoomEntryMethod()); this.response.appendInt(this.habbo.getHabboInfo().getRoomEntryTeleportId()); + this.response.appendInt(this.habbo.getHabboInfo().getInfostandBorder()); } else if (this.habbos != null) { this.response.appendInt(this.habbos.size()); for (Habbo habbo : this.habbos) { @@ -120,6 +121,7 @@ public class RoomUsersComposer extends MessageComposer { this.response.appendString(customizationData.displayOrder); this.response.appendString(habbo.getHabboInfo().getRoomEntryMethod()); this.response.appendInt(habbo.getHabboInfo().getRoomEntryTeleportId()); + this.response.appendInt(habbo.getHabboInfo().getInfostandBorder()); } } } else if (this.bot != null) { @@ -154,6 +156,7 @@ public class RoomUsersComposer extends MessageComposer { this.response.appendShort(9); this.response.appendString("unknown"); this.response.appendInt(0); + this.response.appendInt(0); } else if (this.bots != null) { this.response.appendInt(this.bots.size()); for (Bot bot : this.bots) { @@ -187,6 +190,7 @@ public class RoomUsersComposer extends MessageComposer { this.response.appendShort(9); this.response.appendString("unknown"); this.response.appendInt(0); + this.response.appendInt(0); } } return this.response;