From 442cb5840a712ddae4d8e49e83ebd5c4205d20ef Mon Sep 17 00:00:00 2001 From: duckietm Date: Wed, 4 Mar 2026 11:20:16 +0100 Subject: [PATCH] =?UTF-8?q?=E2=84=B9=EF=B8=8F=20=20Release=20wired=20:=20w?= =?UTF-8?q?f=5Fslc=5Ffurni=5Farea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit use as interaction type in your items_base : wf_slc_furni_area --- .../habbo/habbohotel/items/ItemManager.java | 3 + .../wired/selector/WiredEffectFurniArea.java | 158 ++++++++++++++++++ .../habbohotel/wired/WiredEffectType.java | 3 +- 3 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/selector/WiredEffectFurniArea.java diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java index c3e038e7..ff31d6b1 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java @@ -51,6 +51,7 @@ import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredBlob; import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredExtraOrEval; import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredExtraRandom; import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredExtraUnseen; +import com.eu.habbo.habbohotel.items.interactions.wired.selector.WiredEffectFurniArea; import com.eu.habbo.habbohotel.items.interactions.wired.triggers.*; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; @@ -275,6 +276,8 @@ public class ItemManager { this.interactionsList.add(new ItemInteraction("wf_cnd_date_rng_active", WiredConditionDateRangeActive.class)); this.interactionsList.add(new ItemInteraction("wf_cnd_valid_moves", WiredConditionMovementValidation.class)); + this.interactionsList.add(new ItemInteraction("wf_slc_furni_area", WiredEffectFurniArea.class)); + this.interactionsList.add(new ItemInteraction("wf_xtra_random", WiredExtraRandom.class)); this.interactionsList.add(new ItemInteraction("wf_xtra_unseen", WiredExtraUnseen.class)); diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/selector/WiredEffectFurniArea.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/selector/WiredEffectFurniArea.java new file mode 100644 index 00000000..02fdfb85 --- /dev/null +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/selector/WiredEffectFurniArea.java @@ -0,0 +1,158 @@ +package com.eu.habbo.habbohotel.items.interactions.wired.selector; + +import com.eu.habbo.habbohotel.gameclients.GameClient; +import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; +import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; +import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.rooms.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboItem; +import com.eu.habbo.habbohotel.wired.WiredEffectType; +import com.eu.habbo.habbohotel.wired.core.WiredContext; +import com.eu.habbo.habbohotel.wired.core.WiredManager; +import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.incoming.wired.WiredSaveException; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + + +public class WiredEffectFurniArea extends InteractionWiredEffect { + + public static final WiredEffectType type = WiredEffectType.FURNI_AREA_SELECTOR; + + private int rootX = 0; + private int rootY = 0; + private int areaWidth = 0; + private int areaHeight = 0; + + public WiredEffectFurniArea(ResultSet set, Item baseItem) throws SQLException { + super(set, baseItem); + } + + public WiredEffectFurniArea(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, userId, item, extradata, limitedStack, limitedSells); + } + + @Override + public void execute(WiredContext ctx) { + Room room = ctx.room(); + if (room == null || areaWidth <= 0 || areaHeight <= 0) return; + + List furniInArea = getFurniInArea(room); + ctx.targets().setItems(furniInArea); + } + + private List getFurniInArea(Room room) { + List result = new ArrayList<>(); + + int maxX = rootX + areaWidth - 1; + int maxY = rootY + areaHeight - 1; + + for (int x = rootX; x <= maxX; x++) { + for (int y = rootY; y <= maxY; y++) { + for (HabboItem item : room.getItemsAt(x, y)) { + if (item != null && !result.contains(item)) { + result.add(item); + } + } + } + } + + return result; + } + + @Override + public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { + int[] params = settings.getIntParams(); + if (params == null || params.length < 4) { + throw new WiredSaveException("wf_slc_furni_area requires 4 int params: rootX, rootY, width, height"); + } + + this.rootX = params[0]; + this.rootY = params[1]; + this.areaWidth = params[2]; + this.areaHeight = params[3]; + this.setDelay(settings.getDelay()); + + return true; + } + + @Override + public WiredEffectType getType() { + return type; + } + + @Override + public String getWiredData() { + return WiredManager.getGson().toJson(new JsonData(rootX, rootY, areaWidth, areaHeight, getDelay())); + } + + @Override + public void loadWiredData(ResultSet set, Room room) throws SQLException { + String wiredData = set.getString("wired_data"); + + if (wiredData != null && wiredData.startsWith("{")) { + JsonData data = WiredManager.getGson().fromJson(wiredData, JsonData.class); + this.rootX = data.rootX; + this.rootY = data.rootY; + this.areaWidth = data.width; + this.areaHeight = data.height; + this.setDelay(data.delay); + } + } + + @Override + public void onPickUp() { + this.rootX = 0; + this.rootY = 0; + this.areaWidth = 0; + this.areaHeight = 0; + this.setDelay(0); + } + + @Override + public void serializeWiredData(ServerMessage message, Room room) { + + message.appendBoolean(false); + message.appendInt(0); + message.appendInt(0); + + message.appendInt(this.getBaseItem().getSpriteId()); + message.appendInt(this.getId()); + message.appendString(""); + message.appendInt(4); + message.appendInt(this.rootX); + message.appendInt(this.rootY); + message.appendInt(this.areaWidth); + message.appendInt(this.areaHeight); + + message.appendInt(0); + message.appendInt(this.getType().code); + message.appendInt(this.getDelay()); + message.appendInt(0); + } + + @Override + public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { + return false; + } + + static class JsonData { + int rootX; + int rootY; + int width; + int height; + int delay; + + JsonData(int rootX, int rootY, int width, int height, int delay) { + this.rootX = rootX; + this.rootY = rootY; + this.width = width; + this.height = height; + this.delay = delay; + } + } +} diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/wired/WiredEffectType.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/wired/WiredEffectType.java index 951e4d0c..c1d506d1 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/wired/WiredEffectType.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/wired/WiredEffectType.java @@ -26,7 +26,8 @@ public enum WiredEffectType { BOT_GIVE_HANDITEM(24), BOT_FOLLOW_AVATAR(25), BOT_CLOTHES(26), - BOT_TALK_TO_AVATAR(27); + BOT_TALK_TO_AVATAR(27), + FURNI_AREA_SELECTOR(28); public final int code;