diff --git a/pom.xml b/pom.xml
index ec802d30..c398cce6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.eu.habbo
Habbo
- 3.5.0
+ 3.5.1
UTF-8
diff --git a/sqlupdates/Update 3_5_0 to 3_5_2.sql b/sqlupdates/Update 3_5_0 to 3_5_2.sql
new file mode 100644
index 00000000..4a5d607b
--- /dev/null
+++ b/sqlupdates/Update 3_5_0 to 3_5_2.sql
@@ -0,0 +1,2 @@
+-- Trade Currency Setting
+INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('redeem.currency.trade', '1');
diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java
index f156150e..9dc80656 100644
--- a/src/main/java/com/eu/habbo/Emulator.java
+++ b/src/main/java/com/eu/habbo/Emulator.java
@@ -37,13 +37,13 @@ public final class Emulator {
public final static int MAJOR = 3;
public final static int MINOR = 5;
- public final static int BUILD = 0;
+ public final static int BUILD = 1;
public final static String PREVIEW = "";
public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + " " + PREVIEW;
private static final String logo =
"\n" +
- "███╗ ███╗ ██████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ ███████╗████████╗ █████╗ ██████╗ \n" +
+ "███╗ ███╗ ██████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ ███████╗████████╗ █████╗ ██████╗ \n" +
"████╗ ████║██╔═══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ ██╔════╝╚══██╔══╝██╔══██╗██╔══██╗\n" +
"██╔████╔██║██║ ██║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗███████╗ ██║ ███████║██████╔╝\n" +
"██║╚██╔╝██║██║ ██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║╚════██║ ██║ ██╔══██║██╔══██╗\n" +
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java
index 8a8f1e7f..166768cb 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java
@@ -2,8 +2,10 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
+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.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
import gnu.trove.map.hash.TLongLongHashMap;
@@ -126,4 +128,35 @@ public abstract class InteractionWired extends InteractionDefault {
public void addUserExecutionCache(int roomUnitId, long timestamp) {
this.userExecutionCache.put((long)roomUnitId, timestamp);
}
+
+ public static WiredSettings readSettings(ClientMessage packet, boolean isEffect)
+ {
+ int intParamCount = packet.readInt();
+ int[] intParams = new int[intParamCount];
+
+ for(int i = 0; i < intParamCount; i++)
+ {
+ intParams[i] = packet.readInt();
+ }
+
+ String stringParam = packet.readString();
+
+ int itemCount = packet.readInt();
+ int[] itemIds = new int[itemCount];
+
+ for(int i = 0; i < itemCount; i++)
+ {
+ itemIds[i] = packet.readInt();
+ }
+
+ WiredSettings settings = new WiredSettings(intParams, stringParam, itemIds, -1);
+
+ if(isEffect)
+ {
+ settings.setDelay(packet.readInt());
+ }
+
+ settings.setStuffTypeSelectionCode(packet.readInt());
+ return settings;
+ }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java
index 7bf21fe1..ef63491f 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java
@@ -2,11 +2,11 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
+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.wired.WiredConditionOperator;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.outgoing.wired.WiredConditionDataComposer;
import java.sql.ResultSet;
@@ -43,7 +43,7 @@ public abstract class InteractionWiredCondition extends InteractionWired {
public abstract WiredConditionType getType();
- public abstract boolean saveData(ClientMessage packet);
+ public abstract boolean saveData(WiredSettings settings);
public WiredConditionOperator operator() {
return WiredConditionOperator.AND;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java
index 59da2b6f..e58e3659 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java
@@ -2,10 +2,10 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
+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.wired.WiredEffectType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.wired.WiredEffectDataComposer;
@@ -43,7 +43,7 @@ public abstract class InteractionWiredEffect extends InteractionWired {
}
}
- public abstract boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException;
+ public abstract boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException;
public int getDelay() {
return this.delay;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java
index c0bbaabb..91fb8c08 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
+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.wired.WiredTriggerType;
@@ -44,7 +45,7 @@ public abstract class InteractionWiredTrigger extends InteractionWired {
public abstract WiredTriggerType getType();
- public abstract boolean saveData(ClientMessage packet);
+ public abstract boolean saveData(WiredSettings settings);
protected int getDelay() {
return this.delay;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/WiredSettings.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/WiredSettings.java
new file mode 100644
index 00000000..b6027a06
--- /dev/null
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/WiredSettings.java
@@ -0,0 +1,63 @@
+package com.eu.habbo.habbohotel.items.interactions.wired;
+
+public class WiredSettings {
+ private int[] intParams;
+ private String stringParam;
+ private int[] furniIds;
+ private int stuffTypeSelectionCode;
+ private int delay;
+
+ public WiredSettings(int[] intParams, String stringParam, int[] furniIds, int stuffTypeSelectionCode, int delay)
+ {
+ this.furniIds = furniIds;
+ this.intParams = intParams;
+ this.stringParam = stringParam;
+ this.stuffTypeSelectionCode = stuffTypeSelectionCode;
+ this.delay = delay;
+ }
+
+ public WiredSettings(int[] intParams, String stringParam, int[] furniIds, int stuffTypeSelectionCode)
+ {
+ this(intParams, stringParam, furniIds, stuffTypeSelectionCode, 0);
+ }
+
+ public int getStuffTypeSelectionCode() {
+ return stuffTypeSelectionCode;
+ }
+
+ public void setStuffTypeSelectionCode(int stuffTypeSelectionCode) {
+ this.stuffTypeSelectionCode = stuffTypeSelectionCode;
+ }
+
+ public int[] getFurniIds() {
+ return furniIds;
+ }
+
+ public void setFurniIds(int[] furniIds) {
+ this.furniIds = furniIds;
+ }
+
+ public String getStringParam() {
+ return stringParam;
+ }
+
+ public void setStringParam(String stringParam) {
+ this.stringParam = stringParam;
+ }
+
+ public int[] getIntParams() {
+ return intParams;
+ }
+
+ public void setIntParams(int[] intParams) {
+ this.intParams = intParams;
+ }
+
+ public int getDelay() {
+ return delay;
+ }
+
+ public void setDelay(int delay) {
+ this.delay = delay;
+ }
+}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java
index d4b92964..11f1276f 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java
@@ -3,12 +3,13 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
+import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -50,10 +51,10 @@ public class WiredConditionDateRangeActive extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- this.startDate = packet.readInt();
- this.endDate = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 2) return false;
+ this.startDate = settings.getIntParams()[0];
+ this.endDate = settings.getIntParams()[1];
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java
index ddce19a5..22ec093a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -136,15 +137,12 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- int count;
- packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
- this.all = packet.readInt() == 1;
+ this.all = settings.getIntParams()[0] == 1;
- packet.readString();
-
- count = packet.readInt();
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@@ -153,7 +151,7 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
- HabboItem item = room.getHabboItem(packet.readInt());
+ HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null)
this.items.add(item);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java
index a0d07087..6a2a70a5 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
@@ -24,8 +25,6 @@ import java.util.stream.Collectors;
public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
public static final WiredConditionType type = WiredConditionType.FURNI_HAVE_HABBO;
-
- protected boolean all;
protected THashSet items;
public WiredConditionFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
@@ -41,7 +40,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
@Override
public void onPickUp() {
this.items.clear();
- this.all = false;
}
@Override
@@ -67,7 +65,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
public String getWiredData() {
this.refresh();
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
- this.all,
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
));
}
@@ -79,7 +76,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
if (wiredData.startsWith("{")) {
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
- this.all = data.all;
for(int id : data.itemIds) {
HabboItem item = room.getHabboItem(id);
@@ -92,17 +88,14 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
String[] data = wiredData.split(":");
if (data.length >= 1) {
- this.all = (data[0].equals("1"));
- if (data.length == 2) {
- String[] items = data[1].split(";");
+ String[] items = data[1].split(";");
- for (String s : items) {
- HabboItem item = room.getHabboItem(Integer.parseInt(s));
+ for (String s : items) {
+ HabboItem item = room.getHabboItem(Integer.parseInt(s));
- if (item != null)
- this.items.add(item);
- }
+ if (item != null)
+ this.items.add(item);
}
}
}
@@ -127,8 +120,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId());
message.appendString("");
- message.appendInt(1);
- message.appendInt(this.all ? 1 : 0);
+ message.appendInt(0);
message.appendInt(0);
message.appendInt(this.getType().code);
message.appendInt(0);
@@ -136,13 +128,9 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- int count;
- packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ int count = settings.getFurniIds().length;
- packet.readString();
-
- count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@@ -151,7 +139,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
- HabboItem item = room.getHabboItem(packet.readInt());
+ HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null)
this.items.add(item);
@@ -182,11 +170,9 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
}
static class JsonData {
- boolean all;
List itemIds;
- public JsonData(boolean all, List itemIds) {
- this.all = all;
+ public JsonData(List itemIds) {
this.itemIds = itemIds;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java
index 47c42d64..9330457c 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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;
@@ -117,11 +118,8 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- packet.readString();
-
- int count = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@@ -130,7 +128,7 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
- this.items.add(room.getHabboItem(packet.readInt()));
+ this.items.add(room.getHabboItem(settings.getFurniIds()[i]));
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java
index cc01ba75..5d4133d2 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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.Habbo;
@@ -69,7 +70,7 @@ public class WiredConditionGroupMember extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
+ public boolean saveData(WiredSettings settings) {
return true;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java
index d5e93e21..df8e2108 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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.wired.WiredConditionType;
@@ -86,11 +87,10 @@ public class WiredConditionHabboCount extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.lowerLimit = packet.readInt();
- this.upperLimit = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 2) return false;
+ this.lowerLimit = settings.getIntParams()[0];
+ this.upperLimit = settings.getIntParams()[1];
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java
index 7e1580f0..5f9f5b1a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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.wired.WiredConditionType;
@@ -76,10 +77,9 @@ public class WiredConditionHabboHasEffect extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.effectId = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.effectId = settings.getIntParams()[0];
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java
index 0d351e98..d60ddede 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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.wired.WiredConditionType;
@@ -51,10 +52,9 @@ public class WiredConditionHabboHasHandItem extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.handItem = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.handItem = settings.getIntParams()[0];
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java
index b4f0df9f..8d2b3dbe 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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.Habbo;
@@ -88,10 +89,8 @@ public class WiredConditionHabboWearsBadge extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.badge = packet.readString();
+ public boolean saveData(WiredSettings settings) {
+ this.badge = settings.getStringParam();
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java
index b40ee5e7..f4db5bba 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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.wired.WiredConditionType;
@@ -81,11 +82,9 @@ public class WiredConditionLessTimeElapsed extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.cycles = packet.readInt();
-
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.cycles = settings.getIntParams()[0];
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java
index 76ece81c..cd185dab 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -69,28 +70,24 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition
}
@Override
- public boolean saveData(ClientMessage packet) {
- int count;
- packet.readInt();
-
- this.state = packet.readInt() == 1;
- this.direction = packet.readInt() == 1;
- this.position = packet.readInt() == 1;
-
- packet.readString();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 3) return false;
+ this.state = settings.getIntParams()[0] == 1;
+ this.direction = settings.getIntParams()[1] == 1;
+ this.position = settings.getIntParams()[2] == 1;
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null)
return true;
- count = packet.readInt();
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.settings.clear();
for (int i = 0; i < count; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem item = room.getHabboItem(itemId);
if (item != null)
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java
index 0be6ba15..83bd3004 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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.wired.WiredConditionType;
@@ -81,11 +82,9 @@ public class WiredConditionMoreTimeElapsed extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.cycles = packet.readInt();
-
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.cycles = settings.getIntParams()[0];
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java
index 279f61bd..b09314c8 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -137,14 +138,11 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.all = settings.getIntParams()[0] == 1;
- this.all = packet.readInt() == 1;
-
- packet.readString();
-
- int count = packet.readInt();
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@@ -153,7 +151,7 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
- HabboItem item = room.getHabboItem(packet.readInt());
+ HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null)
this.items.add(item);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java
index 87f3bc9a..9409ebe8 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
@@ -24,8 +25,7 @@ import java.util.stream.Collectors;
public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
public static final WiredConditionType type = WiredConditionType.NOT_FURNI_HAVE_HABBO;
-
- protected boolean all;
+
protected THashSet items;
public WiredConditionNotFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
@@ -41,7 +41,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
@Override
public void onPickUp() {
this.items.clear();
- this.all = false;
}
@Override
@@ -67,7 +66,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
public String getWiredData() {
this.refresh();
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
- this.all,
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
));
}
@@ -79,7 +77,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
if (wiredData.startsWith("{")) {
WiredConditionFurniHaveHabbo.JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, WiredConditionFurniHaveHabbo.JsonData.class);
- this.all = data.all;
for(int id : data.itemIds) {
HabboItem item = room.getHabboItem(id);
@@ -92,17 +89,13 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
String[] data = wiredData.split(":");
if (data.length >= 1) {
- this.all = (data[0].equals("1"));
+ String[] items = data[1].split(";");
- if (data.length == 2) {
- String[] items = data[1].split(";");
+ for (String s : items) {
+ HabboItem item = room.getHabboItem(Integer.parseInt(s));
- for (String s : items) {
- HabboItem item = room.getHabboItem(Integer.parseInt(s));
-
- if (item != null)
- this.items.add(item);
- }
+ if (item != null)
+ this.items.add(item);
}
}
}
@@ -127,8 +120,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId());
message.appendString("");
- message.appendInt(1);
- message.appendInt(this.all ? 1 : 0);
+ message.appendInt(0);
message.appendInt(0);
message.appendInt(this.getType().code);
message.appendInt(0);
@@ -136,12 +128,8 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- packet.readString();
-
- int count = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@@ -150,7 +138,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
- HabboItem item = room.getHabboItem(packet.readInt());
+ HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null)
this.items.add(item);
@@ -181,11 +169,9 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
}
static class JsonData {
- boolean all;
List itemIds;
- public JsonData(boolean all, List itemIds) {
- this.all = all;
+ public JsonData(List itemIds) {
this.itemIds = itemIds;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java
index 30c9ea51..595eee3e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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;
@@ -117,11 +118,8 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- packet.readString();
-
- int count = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@@ -130,7 +128,7 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
- this.items.add(room.getHabboItem(packet.readInt()));
+ this.items.add(room.getHabboItem(settings.getFurniIds()[i]));
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java
index 3075c4ff..7f1d6cab 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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.wired.WiredConditionType;
@@ -85,11 +86,10 @@ public class WiredConditionNotHabboCount extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.lowerLimit = packet.readInt();
- this.upperLimit = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 2) return false;
+ this.lowerLimit = settings.getIntParams()[0];
+ this.upperLimit = settings.getIntParams()[1];
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java
index ae1c20bb..3f1a733d 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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.wired.WiredConditionType;
@@ -76,10 +77,9 @@ public class WiredConditionNotHabboHasEffect extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.effectId = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.effectId = settings.getIntParams()[0];
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java
index 6df96d6b..cf84c109 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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.Habbo;
@@ -89,10 +90,8 @@ public class WiredConditionNotHabboWearsBadge extends InteractionWiredCondition
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.badge = packet.readString();
+ public boolean saveData(WiredSettings settings) {
+ this.badge = settings.getStringParam();
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java
index 520f28bf..d7dbfbcb 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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.Habbo;
@@ -69,7 +70,7 @@ public class WiredConditionNotInGroup extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
+ public boolean saveData(WiredSettings settings) {
return true;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java
index b805c7b1..0f9d6c95 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.games.GameTeamColors;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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.Habbo;
@@ -89,10 +90,9 @@ public class WiredConditionNotInTeam extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.teamColor = GameTeamColors.values()[packet.readInt()];
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.teamColor = GameTeamColors.values()[settings.getIntParams()[0]];
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java
index 027db810..b8376c01 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.games.GameTeamColors;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+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.Habbo;
@@ -91,10 +92,9 @@ public class WiredConditionTeamMember extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.teamColor = GameTeamColors.values()[packet.readInt()];
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.teamColor = GameTeamColors.values()[settings.getIntParams()[0]];
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java
index 61e3fd70..0afdf18c 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -118,11 +119,8 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- packet.readString();
-
- int count = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@@ -131,7 +129,7 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
- HabboItem item = room.getHabboItem(packet.readInt());
+ HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null) {
this.items.add(item);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java
index f0a5b3f8..24a28885 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java
@@ -5,14 +5,13 @@ import com.eu.habbo.habbohotel.bots.Bot;
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.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
-import com.google.gson.Gson;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -49,11 +48,9 @@ public class WiredEffectBotClothes extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- String dataString = packet.readString();
- packet.readInt();
- int delay = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ String dataString = settings.getStringParam();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java
index ee1b28b1..b46d0417 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java
@@ -6,12 +6,12 @@ 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.InteractionWiredTrigger;
+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.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import gnu.trove.procedure.TObjectProcedure;
@@ -70,17 +70,18 @@ public class WiredEffectBotFollowHabbo extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- int mode = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 1) throw new WiredSaveException("Mode is invalid");
+
+ int mode = settings.getIntParams()[0];
if(mode != 0 && mode != 1)
throw new WiredSaveException("Mode is invalid");
- String botName = packet.readString().replace("\t", "");
+ String botName = settings.getStringParam().replace("\t", "");
botName = botName.substring(0, Math.min(botName.length(), Emulator.getConfig().getInt("hotel.wired.message.max_length", 100)));
- packet.readInt();
- int delay = packet.readInt();
+
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java
index 27fc7888..5b380d3c 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java
@@ -6,6 +6,7 @@ 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.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -13,7 +14,6 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
@@ -74,17 +74,17 @@ public class WiredEffectBotGiveHandItem extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 1) throw new WiredSaveException("Missing item id");
- int itemId = packet.readInt();
+ int itemId = settings.getIntParams()[0];
if(itemId < 0)
itemId = 0;
- String botName = packet.readString();
- packet.readInt();
- int delay = packet.readInt();
+ String botName = settings.getStringParam();
+
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java
index 735b0f39..79fae2ca 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java
@@ -5,13 +5,13 @@ import com.eu.habbo.habbohotel.bots.Bot;
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.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
@@ -52,15 +52,14 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
-
- int mode = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 1) throw new WiredSaveException("Mode is invalid");
+ int mode = settings.getIntParams()[0];
if(mode != 0 && mode != 1)
throw new WiredSaveException("Mode is invalid");
- String dataString = packet.readString();
+ String dataString = settings.getStringParam();
String splitBy = "\t";
if(!dataString.contains(splitBy))
@@ -71,8 +70,7 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
if (data.length != 2)
throw new WiredSaveException("Malformed data string. Invalid data length");
- packet.readInt();
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java
index 8fede69c..ad0c8764 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java
@@ -6,13 +6,13 @@ 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.InteractionWiredTrigger;
+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.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import gnu.trove.procedure.TObjectProcedure;
@@ -73,15 +73,14 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
-
- int mode = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 1) throw new WiredSaveException("Missing mode");
+ int mode = settings.getIntParams()[0];
if(mode != 0 && mode != 1)
throw new WiredSaveException("Mode is invalid");
- String dataString = packet.readString();
+ String dataString = settings.getStringParam();
String splitBy = "\t";
if(!dataString.contains(splitBy))
throw new WiredSaveException("Malformed data string");
@@ -91,8 +90,7 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
if (data.length != 2)
throw new WiredSaveException("Malformed data string. Invalid data length");
- packet.readInt();
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java
index 07bbac6f..822934a6 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.bots.Bot;
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.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomTileState;
@@ -114,10 +115,9 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- String botName = packet.readString();
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ String botName = settings.getStringParam();
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -126,7 +126,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -135,7 +135,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java
index 73906c87..b4b9d262 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.bots.Bot;
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;
@@ -67,10 +68,9 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- String botName = packet.readString();
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ String botName = settings.getStringParam();
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -79,7 +79,7 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -88,7 +88,7 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java
index 0ce892d7..7ee3859c 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
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.*;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.*;
@@ -210,9 +211,10 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- int startDirectionInt = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 2) throw new WiredSaveException("Invalid data");
+
+ int startDirectionInt = settings.getIntParams()[0];
if(startDirectionInt < 0 || startDirectionInt > 7 || (startDirectionInt % 2) != 0) {
throw new WiredSaveException("Start direction is invalid");
@@ -220,15 +222,13 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
RoomUserRotation startDirection = RoomUserRotation.fromValue(startDirectionInt);
- int blockedActionInt = packet.readInt();
+ int blockedActionInt = settings.getIntParams()[1];
if(blockedActionInt < 0 || blockedActionInt > 6) {
throw new WiredSaveException("Blocked action is invalid");
}
- packet.readString();
-
- int itemsCount = packet.readInt();
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -237,7 +237,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
THashMap newItems = new THashMap<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -246,7 +246,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
newItems.put(it, new WiredChangeDirectionSetting(it.getId(), it.getRotation(), startDirection));
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java
index 4d21822b..6dafe838 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java
@@ -5,6 +5,7 @@ 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.InteractionWiredTrigger;
+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.Habbo;
@@ -67,17 +68,14 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
- packet.readInt();
-
+ public boolean saveData(WiredSettings settings, GameClient gameClient) {
try {
- this.amount = Integer.parseInt(packet.readString());
+ this.amount = Integer.parseInt(settings.getStringParam());
} catch (Exception e) {
return false;
}
- packet.readInt();
- this.setDelay(packet.readInt());
+ this.setDelay(settings.getDelay());
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java
index 0bd62164..d228c75e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java
@@ -5,6 +5,7 @@ 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.InteractionWiredTrigger;
+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.Habbo;
@@ -66,16 +67,14 @@ public class WiredEffectGiveHotelviewHofPoints extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
- packet.readInt();
-
+ public boolean saveData(WiredSettings settings, GameClient gameClient) {
try {
- this.amount = Integer.valueOf(packet.readString());
+ this.amount = Integer.parseInt(settings.getStringParam());
} catch (Exception e) {
return false;
}
- packet.readInt();
- this.setDelay(packet.readInt());
+
+ this.setDelay(settings.getDelay());
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java
index 4a3b966f..91b78467 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java
@@ -6,6 +6,7 @@ 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.InteractionWiredTrigger;
+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.Habbo;
@@ -67,17 +68,14 @@ public class WiredEffectGiveRespect extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
- packet.readInt();
-
+ public boolean saveData(WiredSettings settings, GameClient gameClient) {
try {
- this.respects = Integer.valueOf(packet.readString());
+ this.respects = Integer.parseInt(settings.getStringParam());
} catch (Exception e) {
return false;
}
- packet.readInt();
- this.setDelay(packet.readInt());
+ this.setDelay(settings.getDelay());
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
index f4c3a2ba..3c8fb88b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
@@ -5,6 +5,7 @@ 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.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@@ -15,6 +16,7 @@ import com.eu.habbo.habbohotel.wired.WiredGiveRewardItem;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
+import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
@@ -174,16 +176,16 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
if (gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) {
- int argsLength = packet.readInt();
- this.rewardTime = packet.readInt();
- this.uniqueRewards = packet.readInt() == 1;
- this.limit = packet.readInt();
- this.limitationInterval = packet.readInt();
+ if(settings.getIntParams().length < 4) throw new WiredSaveException("Invalid data");
+ this.rewardTime = settings.getIntParams()[0];
+ this.uniqueRewards = settings.getIntParams()[1] == 1;
+ this.limit = settings.getIntParams()[2];
+ this.limitationInterval = settings.getIntParams()[3];
this.given = 0;
- String data = packet.readString();
+ String data = settings.getStringParam();
String[] items = data.split(";");
@@ -204,8 +206,7 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
return false;
}
- packet.readInt();
- this.setDelay(packet.readInt());
+ this.setDelay(settings.getDelay());
WiredHandler.dropRewards(this.getId());
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java
index 6632c2e4..293515cc 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java
@@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.games.Game;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+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.Habbo;
@@ -172,23 +173,20 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 2) throw new WiredSaveException("Invalid data");
- int score = packet.readInt();
+ int score = settings.getIntParams()[0];
if(score < 1 || score > 100)
throw new WiredSaveException("Score is invalid");
- int timesPerGame = packet.readInt();
+ int timesPerGame = settings.getIntParams()[1];
if(timesPerGame < 1 || timesPerGame > 10)
throw new WiredSaveException("Times per game is invalid");
- packet.readString();
- packet.readInt();
-
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java
index dcbc1481..a439a668 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java
@@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.games.GameTeam;
import com.eu.habbo.habbohotel.games.GameTeamColors;
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.wired.WiredEffectType;
@@ -121,28 +122,25 @@ public class WiredEffectGiveScoreToTeam extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 3) throw new WiredSaveException("Invalid data");
- int points = packet.readInt();
+ int points = settings.getIntParams()[0];
if(points < 1 || points > 100)
throw new WiredSaveException("Points is invalid");
- int timesPerGame = packet.readInt();
+ int timesPerGame = settings.getIntParams()[1];
if(timesPerGame < 1 || timesPerGame > 10)
throw new WiredSaveException("Times per game is invalid");
- int team = packet.readInt();
+ int team = settings.getIntParams()[2];
if(team < 1 || team > 4)
throw new WiredSaveException("Team is invalid");
- packet.readString();
- packet.readInt();
-
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java
index 8d367009..28bd7c49 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java
@@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.games.wired.WiredGame;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+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.Habbo;
@@ -134,16 +135,15 @@ public class WiredEffectJoinTeam extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- int team = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 1) throw new WiredSaveException("invalid data");
+
+ int team = settings.getIntParams()[0];
if(team < 1 || team > 4)
throw new WiredSaveException("Team is invalid");
- packet.readInt();
- packet.readString();
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java
index e0f2ecd2..a75f2e3e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java
@@ -5,6 +5,7 @@ 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.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
@@ -148,11 +149,9 @@ public class WiredEffectKickHabbo extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- String message = packet.readString();
- packet.readInt();
- int delay = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ String message = settings.getStringParam();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java
index deff061e..74830cfa 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java
@@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.games.wired.WiredGame;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+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.Habbo;
@@ -116,11 +117,8 @@ public class WiredEffectLeaveTeam extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- packet.readString();
- packet.readInt();
- int delay = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java
index bb615d8d..8d74e312 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
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.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem;
@@ -175,21 +176,18 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
-
- boolean setState = packet.readInt() == 1;
- boolean setDirection = packet.readInt() == 1;
- boolean setPosition = packet.readInt() == 1;
-
- packet.readString();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 3) throw new WiredSaveException("Invalid data");
+ boolean setState = settings.getIntParams()[0] == 1;
+ boolean setDirection = settings.getIntParams()[1] == 1;
+ boolean setPosition = settings.getIntParams()[2] == 1;
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null)
throw new WiredSaveException("Trying to save wired in unloaded room");
- int itemsCount = packet.readInt();
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -198,7 +196,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
List newSettings = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -207,7 +205,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
newSettings.add(new WiredMatchFurniSetting(it.getId(), this.checkForWiredResetPermission && it.allowWiredResetState() ? it.getExtradata() : " ", it.getRotation(), it.getX(), it.getY()));
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java
index 76fe1ed9..9f016a9e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
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.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
@@ -178,10 +179,8 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- packet.readString();
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -190,7 +189,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -199,7 +198,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java
index 3b9367e2..4118fd05 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
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.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -12,6 +13,7 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
+import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import gnu.trove.set.hash.THashSet;
@@ -39,7 +41,7 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null)
@@ -48,18 +50,16 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect {
this.items.clear();
this.indexOffset.clear();
- packet.readInt();
+ if(settings.getIntParams().length < 2) throw new WiredSaveException("invalid data");
+ this.direction = settings.getIntParams()[0];
+ this.spacing = settings.getIntParams()[1];
- this.direction = packet.readInt();
- this.spacing = packet.readInt();
- packet.readString();
-
- int count = packet.readInt();
+ int count = settings.getFurniIds().length;
for (int i = 0; i < count; i++) {
- this.items.add(room.getHabboItem(packet.readInt()));
+ this.items.add(room.getHabboItem(settings.getFurniIds()[i]));
}
- this.setDelay(packet.readInt());
+ this.setDelay(settings.getDelay());
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java
index c069dc93..89f56d3d 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
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.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
@@ -314,11 +315,8 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- packet.readString();
-
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -327,7 +325,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -336,7 +334,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java
index 5928e671..fd24af08 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java
@@ -5,12 +5,14 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.ICycleable;
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.*;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
+import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
@@ -185,28 +187,26 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null)
return false;
- packet.readInt();
+ if(settings.getIntParams().length < 2) throw new WiredSaveException("invalid data");
- this.direction = packet.readInt();
- this.rotation = packet.readInt();
+ this.direction = settings.getIntParams()[0];
+ this.rotation = settings.getIntParams()[1];
- packet.readString();
-
- int count = packet.readInt();
+ int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count", 5)) return false;
this.items.clear();
for (int i = 0; i < count; i++) {
- this.items.add(room.getHabboItem(packet.readInt()));
+ this.items.add(room.getHabboItem(settings.getFurniIds()[i]));
}
- this.setDelay(packet.readInt());
+ this.setDelay(settings.getDelay());
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java
index 39788018..ed3639a8 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
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.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@@ -13,6 +14,7 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
+import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
import java.sql.ResultSet;
@@ -49,12 +51,13 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
- packet.readInt();
- this.length = packet.readInt();
- this.message = packet.readString();
- packet.readInt();
- this.setDelay(packet.readInt());
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ if(settings.getIntParams().length < 1) throw new WiredSaveException("invalid data");
+
+ this.length = settings.getIntParams()[0];
+ this.message = settings.getStringParam();
+
+ this.setDelay(settings.getDelay());
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java
index 583e4f6a..826b8d31 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java
@@ -5,6 +5,7 @@ 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.InteractionWiredTrigger;
+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.wired.WiredEffectType;
@@ -67,13 +68,8 @@ public class WiredEffectResetTimers extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) {
- packet.readInt();
- packet.readString();
- packet.readInt();
- this.delay = packet.readInt();
- this.setDelay(this.delay);
-
+ public boolean saveData(WiredSettings settings, GameClient gameClient) {
+ this.setDelay(settings.getDelay());
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java
index 304703f1..cf6197ad 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java
@@ -5,6 +5,7 @@ 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.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomTileState;
@@ -130,11 +131,8 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- packet.readString();
-
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -143,7 +141,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -152,7 +150,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java
index 05eef1f3..7a3a0e16 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java
@@ -17,6 +17,7 @@ import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreeze
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField;
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole;
import com.eu.habbo.habbohotel.items.interactions.pets.*;
+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.Habbo;
@@ -142,11 +143,8 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- packet.readString();
-
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -155,7 +153,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -164,7 +162,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java
index 4fbd9203..d5e60925 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java
@@ -15,6 +15,7 @@ import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreeze
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField;
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole;
import com.eu.habbo.habbohotel.items.interactions.pets.*;
+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;
@@ -137,11 +138,8 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- packet.readString();
-
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -150,7 +148,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -159,7 +157,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java
index db37872b..4f50f57f 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java
@@ -5,6 +5,7 @@ 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.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -85,11 +86,8 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
- packet.readString();
-
- int itemsCount = packet.readInt();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ int itemsCount = settings.getFurniIds().length;
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@@ -98,7 +96,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
List newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) {
- int itemId = packet.readInt();
+ int itemId = settings.getFurniIds()[i];
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null)
@@ -107,7 +105,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
newItems.add(it);
}
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java
index 56d6f35e..79a7ba53 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java
@@ -5,14 +5,13 @@ 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.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
-import com.eu.habbo.habbohotel.wired.WiredChangeDirectionSetting;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
-import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
@@ -70,19 +69,15 @@ public class WiredEffectWhisper extends InteractionWiredEffect {
}
@Override
- public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
- packet.readInt();
-
- String message = packet.readString();
+ public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
+ String message = settings.getStringParam();
if(gameClient.getHabbo() == null || !gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) {
message = Emulator.getGameEnvironment().getWordFilter().filter(message, null);
message = message.substring(0, Math.min(message.length(), Emulator.getConfig().getInt("hotel.wired.message.max_length", 100)));
}
- packet.readInt();
-
- int delay = packet.readInt();
+ int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long");
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java
index f6364641..60756729 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -110,9 +111,9 @@ public class WiredTriggerAtSetTime extends InteractionWiredTrigger implements Wi
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- this.executeTime = packet.readInt() * 500;
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.executeTime = settings.getIntParams()[0] * 500;
this.resetTimer();
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java
index 751d21c7..7fdf0a2a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java
@@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -109,10 +110,9 @@ public class WiredTriggerAtTimeLong extends InteractionWiredTrigger implements W
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.executeTime = packet.readInt() * 500;
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.executeTime = settings.getIntParams()[0] * 500;
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java
index 596fbc8f..3de2e345 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+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;
@@ -97,17 +98,15 @@ public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.botName = packet.readString();
+ public boolean saveData(WiredSettings settings) {
+ this.botName = settings.getStringParam();
this.items.clear();
- int count = packet.readInt();
+ int count = settings.getFurniIds().length;
for (int i = 0; i < count; i++) {
- this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
+ this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i]));
}
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java
index 0e7b22fd..0023fb6d 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+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.wired.WiredHandler;
@@ -48,10 +49,8 @@ public class WiredTriggerBotReachedHabbo extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.botName = packet.readString();
+ public boolean saveData(WiredSettings settings) {
+ this.botName = settings.getStringParam();
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java
index 4e446609..a40bf2e1 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+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;
@@ -65,7 +66,7 @@ public class WiredTriggerCollision extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
+ public boolean saveData(WiredSettings settings) {
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java
index f97f332f..5d315e52 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+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.Habbo;
@@ -135,16 +136,13 @@ public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- packet.readString();
-
+ public boolean saveData(WiredSettings settings) {
this.items.clear();
- int count = packet.readInt();
+ int count = settings.getFurniIds().length;
for (int i = 0; i < count; i++) {
- this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
+ this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i]));
}
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java
index abb84177..55ff097c 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+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.wired.WiredTriggerType;
@@ -83,7 +84,7 @@ public class WiredTriggerGameEnds extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
+ public boolean saveData(WiredSettings settings) {
return true;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java
index 5631cb46..89c9a657 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+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.wired.WiredTriggerType;
@@ -83,7 +84,7 @@ public class WiredTriggerGameStarts extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
+ public boolean saveData(WiredSettings settings) {
return true;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboEntersRoom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboEntersRoom.java
index 9a1400b2..d93a1ba1 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboEntersRoom.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboEntersRoom.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+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.Habbo;
@@ -85,9 +86,8 @@ public class WiredTriggerHabboEntersRoom extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- this.username = packet.readString();
+ public boolean saveData(WiredSettings settings) {
+ this.username = settings.getStringParam();
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysKeyword.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysKeyword.java
index f3b90ae3..d0bdd637 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysKeyword.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysKeyword.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+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.Habbo;
@@ -93,10 +94,10 @@ public class WiredTriggerHabboSaysKeyword extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- this.ownerOnly = packet.readInt() == 1;
- this.key = packet.readString();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.ownerOnly = settings.getIntParams()[0] == 1;
+ this.key = settings.getStringParam();
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java
index 64e9dae9..10b458b9 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+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;
@@ -128,16 +129,13 @@ public class WiredTriggerHabboWalkOffFurni extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- packet.readString();
-
+ public boolean saveData(WiredSettings settings) {
this.items.clear();
- int count = packet.readInt();
+ int count = settings.getFurniIds().length;
for (int i = 0; i < count; i++) {
- this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
+ this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i]));
}
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java
index 257f23bb..d24be482 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+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;
@@ -82,16 +83,13 @@ public class WiredTriggerHabboWalkOnFurni extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- packet.readString();
-
+ public boolean saveData(WiredSettings settings) {
this.items.clear();
- int count = packet.readInt();
+ int count = settings.getFurniIds().length;
for (int i = 0; i < count; i++) {
- this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
+ this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i]));
}
return true;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java
index 36d48b3e..f43ffac0 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.ICycleable;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -109,10 +110,9 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICy
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.repeatTime = packet.readInt() * 500;
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.repeatTime = settings.getIntParams()[0] * 500;
this.counter = 0;
if (this.repeatTime < 500) {
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java
index ad93a09d..536aca86 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java
@@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.ICycleable;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@@ -107,10 +108,9 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
-
- this.repeatTime = packet.readInt() * 5000;
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.repeatTime = settings.getIntParams()[0] * 5000;
this.counter = 0;
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java
index 1f558d88..463e5ba7 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+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.wired.WiredHandler;
@@ -85,9 +86,9 @@ public class WiredTriggerScoreAchieved extends InteractionWiredTrigger {
}
@Override
- public boolean saveData(ClientMessage packet) {
- packet.readInt();
- this.score = packet.readInt();
+ public boolean saveData(WiredSettings settings) {
+ if(settings.getIntParams().length < 1) return false;
+ this.score = settings.getIntParams()[0];
return true;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java
index f0706c97..3fb4d467 100644
--- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java
+++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java
@@ -328,6 +328,8 @@ public class RoomTrade {
}
public static int getCreditsByItem(HabboItem item) {
+ if (!Emulator.getConfig().getBoolean("redeem.currency.trade")) return 0;
+
if (!item.getBaseItem().getName().startsWith("CF_") && !item.getBaseItem().getName().startsWith("CFC_")) return 0;
try {
diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredConditionSaveDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredConditionSaveDataEvent.java
index 93972ee1..92742f84 100644
--- a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredConditionSaveDataEvent.java
+++ b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredConditionSaveDataEvent.java
@@ -1,12 +1,19 @@
package com.eu.habbo.messages.incoming.wired;
import com.eu.habbo.Emulator;
+import com.eu.habbo.habbohotel.items.interactions.InteractionWired;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.messages.incoming.MessageHandler;
+import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
import com.eu.habbo.messages.outgoing.wired.WiredSavedComposer;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Optional;
+
public class WiredConditionSaveDataEvent extends MessageHandler {
@Override
public void handle() throws Exception {
@@ -19,13 +26,35 @@ public class WiredConditionSaveDataEvent extends MessageHandler {
InteractionWiredCondition condition = room.getRoomSpecialTypes().getCondition(itemId);
if (condition != null) {
- if (condition.saveData(this.packet)) {
- this.client.sendResponse(new WiredSavedComposer());
- condition.needsUpdate(true);
+ Optional saveMethod = Arrays.stream(condition.getClass().getMethods()).filter(x -> x.getName().equals("saveData")).findFirst();
- Emulator.getThreading().run(condition);
+ if(saveMethod.isPresent()) {
+ if (saveMethod.get().getParameterTypes()[0] == WiredSettings.class) {
+ WiredSettings settings = InteractionWired.readSettings(this.packet, false);
+
+ if (condition.saveData(settings)) {
+ this.client.sendResponse(new WiredSavedComposer());
+
+ condition.needsUpdate(true);
+
+ Emulator.getThreading().run(condition);
+ } else {
+ this.client.sendResponse(new UpdateFailedComposer("There was an error while saving that condition"));
+ }
+ } else {
+ if ((boolean) saveMethod.get().invoke(condition, this.packet)) {
+ this.client.sendResponse(new WiredSavedComposer());
+ condition.needsUpdate(true);
+ Emulator.getThreading().run(condition);
+ } else {
+ this.client.sendResponse(new UpdateFailedComposer("There was an error while saving that condition"));
+ }
+ }
+ } else {
+ this.client.sendResponse(new UpdateFailedComposer("Save method was not found"));
}
+
}
}
}
diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredEffectSaveDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredEffectSaveDataEvent.java
index fbf51226..e6e46c9f 100644
--- a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredEffectSaveDataEvent.java
+++ b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredEffectSaveDataEvent.java
@@ -1,14 +1,19 @@
package com.eu.habbo.messages.incoming.wired;
import com.eu.habbo.Emulator;
+import com.eu.habbo.habbohotel.items.interactions.InteractionWired;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.messages.incoming.MessageHandler;
-import com.eu.habbo.messages.outgoing.generic.alerts.GenericErrorMessagesComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
import com.eu.habbo.messages.outgoing.wired.WiredSavedComposer;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Optional;
+
public class WiredEffectSaveDataEvent extends MessageHandler {
@Override
public void handle() throws Exception {
@@ -24,11 +29,29 @@ public class WiredEffectSaveDataEvent extends MessageHandler {
if (effect == null)
throw new WiredSaveException(String.format("Wired effect with item id %s not found in room", itemId));
- if (effect.saveData(this.packet, this.client)) {
- this.client.sendResponse(new WiredSavedComposer());
- effect.needsUpdate(true);
- Emulator.getThreading().run(effect);
+ Optional saveMethod = Arrays.stream(effect.getClass().getMethods()).filter(x -> x.getName().equals("saveData")).findFirst();
+
+ if(saveMethod.isPresent()) {
+ if(saveMethod.get().getParameterTypes()[0] == WiredSettings.class) {
+ WiredSettings settings = InteractionWired.readSettings(this.packet, true);
+ if (effect.saveData(settings, this.client)) {
+ this.client.sendResponse(new WiredSavedComposer());
+ effect.needsUpdate(true);
+ Emulator.getThreading().run(effect);
+ }
+ }
+ else {
+ if ((boolean) saveMethod.get().invoke(effect, this.packet, this.client)) {
+ this.client.sendResponse(new WiredSavedComposer());
+ effect.needsUpdate(true);
+ Emulator.getThreading().run(effect);
+ }
+ }
+ } else {
+ this.client.sendResponse(new UpdateFailedComposer("Save method was not found"));
}
+
+
}
catch (WiredSaveException e) {
this.client.sendResponse(new UpdateFailedComposer(e.getMessage()));
diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredTriggerSaveDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredTriggerSaveDataEvent.java
index 8f62f60e..611de232 100644
--- a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredTriggerSaveDataEvent.java
+++ b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredTriggerSaveDataEvent.java
@@ -1,12 +1,19 @@
package com.eu.habbo.messages.incoming.wired;
import com.eu.habbo.Emulator;
+import com.eu.habbo.habbohotel.items.interactions.InteractionWired;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
+import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.messages.incoming.MessageHandler;
+import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
import com.eu.habbo.messages.outgoing.wired.WiredSavedComposer;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Optional;
+
public class WiredTriggerSaveDataEvent extends MessageHandler {
@Override
public void handle() throws Exception {
@@ -19,12 +26,34 @@ public class WiredTriggerSaveDataEvent extends MessageHandler {
InteractionWiredTrigger trigger = room.getRoomSpecialTypes().getTrigger(itemId);
if (trigger != null) {
- if (trigger.saveData(this.packet)) {
- this.client.sendResponse(new WiredSavedComposer());
- trigger.needsUpdate(true);
+ Optional saveMethod = Arrays.stream(trigger.getClass().getMethods()).filter(x -> x.getName().equals("saveData")).findFirst();
- Emulator.getThreading().run(trigger);
+ if(saveMethod.isPresent()) {
+ if (saveMethod.get().getParameterTypes()[0] == WiredSettings.class) {
+ WiredSettings settings = InteractionWired.readSettings(this.packet, false);
+
+ if (trigger.saveData(settings)) {
+ this.client.sendResponse(new WiredSavedComposer());
+
+ trigger.needsUpdate(true);
+
+ Emulator.getThreading().run(trigger);
+ } else {
+ this.client.sendResponse(new UpdateFailedComposer("There was an error while saving that trigger"));
+ }
+ } else {
+ if ((boolean) saveMethod.get().invoke(trigger, this.packet)) {
+ this.client.sendResponse(new WiredSavedComposer());
+ trigger.needsUpdate(true);
+ Emulator.getThreading().run(trigger);
+ } else {
+ this.client.sendResponse(new UpdateFailedComposer("There was an error while saving that trigger"));
+ }
+ }
+ }
+ else {
+ this.client.sendResponse(new UpdateFailedComposer("Save method was not found"));
}
}
}