Merge branch 'dev' into 'master'

fixed master and dev changes

See merge request morningstar/Arcturus-Community!579
This commit is contained in:
Harmonic 2022-11-16 15:56:06 +00:00
commit 353a01f563
78 changed files with 540 additions and 438 deletions

View File

@ -6,7 +6,7 @@
<groupId>com.eu.habbo</groupId> <groupId>com.eu.habbo</groupId>
<artifactId>Habbo</artifactId> <artifactId>Habbo</artifactId>
<version>3.5.0</version> <version>3.5.1</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -0,0 +1,2 @@
-- Trade Currency Setting
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('redeem.currency.trade', '1');

View File

@ -37,7 +37,7 @@ public final class Emulator {
public final static int MAJOR = 3; public final static int MAJOR = 3;
public final static int MINOR = 5; public final static int MINOR = 5;
public final static int BUILD = 0; public final static int BUILD = 1;
public final static String PREVIEW = ""; public final static String PREVIEW = "";
public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + " " + PREVIEW; public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + " " + PREVIEW;

View File

@ -2,8 +2,10 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer; import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
import gnu.trove.map.hash.TLongLongHashMap; import gnu.trove.map.hash.TLongLongHashMap;
@ -126,4 +128,35 @@ public abstract class InteractionWired extends InteractionDefault {
public void addUserExecutionCache(int roomUnitId, long timestamp) { public void addUserExecutionCache(int roomUnitId, long timestamp) {
this.userExecutionCache.put((long)roomUnitId, 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;
}
} }

View File

@ -2,11 +2,11 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionOperator; import com.eu.habbo.habbohotel.wired.WiredConditionOperator;
import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.outgoing.wired.WiredConditionDataComposer; import com.eu.habbo.messages.outgoing.wired.WiredConditionDataComposer;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -43,7 +43,7 @@ public abstract class InteractionWiredCondition extends InteractionWired {
public abstract WiredConditionType getType(); public abstract WiredConditionType getType();
public abstract boolean saveData(ClientMessage packet); public abstract boolean saveData(WiredSettings settings);
public WiredConditionOperator operator() { public WiredConditionOperator operator() {
return WiredConditionOperator.AND; return WiredConditionOperator.AND;

View File

@ -2,10 +2,10 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType; 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.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.wired.WiredEffectDataComposer; 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() { public int getDelay() {
return this.delay; return this.delay;

View File

@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.habbohotel.wired.WiredTriggerType;
@ -44,7 +45,7 @@ public abstract class InteractionWiredTrigger extends InteractionWired {
public abstract WiredTriggerType getType(); public abstract WiredTriggerType getType();
public abstract boolean saveData(ClientMessage packet); public abstract boolean saveData(WiredSettings settings);
protected int getDelay() { protected int getDelay() {
return this.delay; return this.delay;

View File

@ -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;
}
}

View File

@ -3,12 +3,13 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -50,10 +51,10 @@ public class WiredConditionDateRangeActive extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 2) return false;
this.startDate = packet.readInt(); this.startDate = settings.getIntParams()[0];
this.endDate = packet.readInt(); this.endDate = settings.getIntParams()[1];
return true; return true;
} }

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -136,15 +137,12 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
int count; if(settings.getIntParams().length < 1) return false;
packet.readInt();
this.all = packet.readInt() == 1; this.all = settings.getIntParams()[0] == 1;
packet.readString(); int count = settings.getFurniIds().length;
count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear(); this.items.clear();
@ -153,7 +151,7 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
if (room != null) { if (room != null) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
HabboItem item = room.getHabboItem(packet.readInt()); HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null) if (item != null)
this.items.add(item); this.items.add(item);

View File

@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.pets.Pet;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
@ -24,8 +25,6 @@ import java.util.stream.Collectors;
public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition { public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
public static final WiredConditionType type = WiredConditionType.FURNI_HAVE_HABBO; public static final WiredConditionType type = WiredConditionType.FURNI_HAVE_HABBO;
protected boolean all;
protected THashSet<HabboItem> items; protected THashSet<HabboItem> items;
public WiredConditionFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException { public WiredConditionFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
@ -41,7 +40,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
@Override @Override
public void onPickUp() { public void onPickUp() {
this.items.clear(); this.items.clear();
this.all = false;
} }
@Override @Override
@ -67,7 +65,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
public String getWiredData() { public String getWiredData() {
this.refresh(); this.refresh();
return WiredHandler.getGsonBuilder().create().toJson(new JsonData( return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
this.all,
this.items.stream().map(HabboItem::getId).collect(Collectors.toList()) this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
)); ));
} }
@ -79,7 +76,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
if (wiredData.startsWith("{")) { if (wiredData.startsWith("{")) {
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class); JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
this.all = data.all;
for(int id : data.itemIds) { for(int id : data.itemIds) {
HabboItem item = room.getHabboItem(id); HabboItem item = room.getHabboItem(id);
@ -92,9 +88,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
String[] data = wiredData.split(":"); String[] data = wiredData.split(":");
if (data.length >= 1) { 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) { for (String s : items) {
@ -106,7 +100,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
} }
} }
} }
}
@Override @Override
public WiredConditionType getType() { public WiredConditionType getType() {
@ -127,8 +120,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
message.appendInt(this.getBaseItem().getSpriteId()); message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId()); message.appendInt(this.getId());
message.appendString(""); message.appendString("");
message.appendInt(1); message.appendInt(0);
message.appendInt(this.all ? 1 : 0);
message.appendInt(0); message.appendInt(0);
message.appendInt(this.getType().code); message.appendInt(this.getType().code);
message.appendInt(0); message.appendInt(0);
@ -136,13 +128,9 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
int count; int count = settings.getFurniIds().length;
packet.readInt();
packet.readString();
count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear(); this.items.clear();
@ -151,7 +139,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
if (room != null) { if (room != null) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
HabboItem item = room.getHabboItem(packet.readInt()); HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null) if (item != null)
this.items.add(item); this.items.add(item);
@ -182,11 +170,9 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
} }
static class JsonData { static class JsonData {
boolean all;
List<Integer> itemIds; List<Integer> itemIds;
public JsonData(boolean all, List<Integer> itemIds) { public JsonData(List<Integer> itemIds) {
this.all = all;
this.itemIds = itemIds; this.itemIds = itemIds;
} }
} }

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -117,11 +118,8 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); int count = settings.getFurniIds().length;
packet.readString();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear(); this.items.clear();
@ -130,7 +128,7 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
if (room != null) { if (room != null) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
this.items.add(room.getHabboItem(packet.readInt())); this.items.add(room.getHabboItem(settings.getFurniIds()[i]));
} }
} }

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -69,7 +70,7 @@ public class WiredConditionGroupMember extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
return true; return true;
} }
} }

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredConditionType;
@ -86,11 +87,10 @@ public class WiredConditionHabboCount extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 2) return false;
this.lowerLimit = settings.getIntParams()[0];
this.lowerLimit = packet.readInt(); this.upperLimit = settings.getIntParams()[1];
this.upperLimit = packet.readInt();
return true; return true;
} }

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredConditionType;
@ -76,10 +77,9 @@ public class WiredConditionHabboHasEffect extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 1) return false;
this.effectId = settings.getIntParams()[0];
this.effectId = packet.readInt();
return true; return true;
} }

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredConditionType;
@ -51,10 +52,9 @@ public class WiredConditionHabboHasHandItem extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 1) return false;
this.handItem = settings.getIntParams()[0];
this.handItem = packet.readInt();
return true; return true;
} }

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -88,10 +89,8 @@ public class WiredConditionHabboWearsBadge extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); this.badge = settings.getStringParam();
this.badge = packet.readString();
return true; return true;
} }

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredConditionType;
@ -81,11 +82,9 @@ public class WiredConditionLessTimeElapsed extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 1) return false;
this.cycles = settings.getIntParams()[0];
this.cycles = packet.readInt();
return true; return true;
} }

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -69,28 +70,24 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
int count; if(settings.getIntParams().length < 3) return false;
packet.readInt(); this.state = settings.getIntParams()[0] == 1;
this.direction = settings.getIntParams()[1] == 1;
this.state = packet.readInt() == 1; this.position = settings.getIntParams()[2] == 1;
this.direction = packet.readInt() == 1;
this.position = packet.readInt() == 1;
packet.readString();
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null) if (room == null)
return true; return true;
count = packet.readInt(); int count = settings.getFurniIds().length;
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.settings.clear(); this.settings.clear();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
int itemId = packet.readInt(); int itemId = settings.getFurniIds()[i];
HabboItem item = room.getHabboItem(itemId); HabboItem item = room.getHabboItem(itemId);
if (item != null) if (item != null)

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredConditionType;
@ -81,11 +82,9 @@ public class WiredConditionMoreTimeElapsed extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 1) return false;
this.cycles = settings.getIntParams()[0];
this.cycles = packet.readInt();
return true; return true;
} }

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -137,14 +138,11 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 1) return false;
this.all = settings.getIntParams()[0] == 1;
this.all = packet.readInt() == 1; int count = settings.getFurniIds().length;
packet.readString();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear(); this.items.clear();
@ -153,7 +151,7 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
if (room != null) { if (room != null) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
HabboItem item = room.getHabboItem(packet.readInt()); HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null) if (item != null)
this.items.add(item); this.items.add(item);

View File

@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.pets.Pet;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
@ -25,7 +26,6 @@ import java.util.stream.Collectors;
public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition { public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
public static final WiredConditionType type = WiredConditionType.NOT_FURNI_HAVE_HABBO; public static final WiredConditionType type = WiredConditionType.NOT_FURNI_HAVE_HABBO;
protected boolean all;
protected THashSet<HabboItem> items; protected THashSet<HabboItem> items;
public WiredConditionNotFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException { public WiredConditionNotFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
@ -41,7 +41,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
@Override @Override
public void onPickUp() { public void onPickUp() {
this.items.clear(); this.items.clear();
this.all = false;
} }
@Override @Override
@ -67,7 +66,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
public String getWiredData() { public String getWiredData() {
this.refresh(); this.refresh();
return WiredHandler.getGsonBuilder().create().toJson(new JsonData( return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
this.all,
this.items.stream().map(HabboItem::getId).collect(Collectors.toList()) this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
)); ));
} }
@ -79,7 +77,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
if (wiredData.startsWith("{")) { if (wiredData.startsWith("{")) {
WiredConditionFurniHaveHabbo.JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, WiredConditionFurniHaveHabbo.JsonData.class); WiredConditionFurniHaveHabbo.JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, WiredConditionFurniHaveHabbo.JsonData.class);
this.all = data.all;
for(int id : data.itemIds) { for(int id : data.itemIds) {
HabboItem item = room.getHabboItem(id); HabboItem item = room.getHabboItem(id);
@ -92,9 +89,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
String[] data = wiredData.split(":"); String[] data = wiredData.split(":");
if (data.length >= 1) { 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) { for (String s : items) {
@ -106,7 +100,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
} }
} }
} }
}
@Override @Override
public WiredConditionType getType() { public WiredConditionType getType() {
@ -127,8 +120,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
message.appendInt(this.getBaseItem().getSpriteId()); message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId()); message.appendInt(this.getId());
message.appendString(""); message.appendString("");
message.appendInt(1); message.appendInt(0);
message.appendInt(this.all ? 1 : 0);
message.appendInt(0); message.appendInt(0);
message.appendInt(this.getType().code); message.appendInt(this.getType().code);
message.appendInt(0); message.appendInt(0);
@ -136,12 +128,8 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); int count = settings.getFurniIds().length;
packet.readString();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear(); this.items.clear();
@ -150,7 +138,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
if (room != null) { if (room != null) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
HabboItem item = room.getHabboItem(packet.readInt()); HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null) if (item != null)
this.items.add(item); this.items.add(item);
@ -181,11 +169,9 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
} }
static class JsonData { static class JsonData {
boolean all;
List<Integer> itemIds; List<Integer> itemIds;
public JsonData(boolean all, List<Integer> itemIds) { public JsonData(List<Integer> itemIds) {
this.all = all;
this.itemIds = itemIds; this.itemIds = itemIds;
} }
} }

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -117,11 +118,8 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); int count = settings.getFurniIds().length;
packet.readString();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear(); this.items.clear();
@ -130,7 +128,7 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
if (room != null) { if (room != null) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
this.items.add(room.getHabboItem(packet.readInt())); this.items.add(room.getHabboItem(settings.getFurniIds()[i]));
} }
} }

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredConditionType;
@ -85,11 +86,10 @@ public class WiredConditionNotHabboCount extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 2) return false;
this.lowerLimit = settings.getIntParams()[0];
this.lowerLimit = packet.readInt(); this.upperLimit = settings.getIntParams()[1];
this.upperLimit = packet.readInt();
return true; return true;
} }

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredConditionType;
@ -76,10 +77,9 @@ public class WiredConditionNotHabboHasEffect extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 1) return false;
this.effectId = settings.getIntParams()[0];
this.effectId = packet.readInt();
return true; return true;
} }

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -89,10 +90,8 @@ public class WiredConditionNotHabboWearsBadge extends InteractionWiredCondition
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); this.badge = settings.getStringParam();
this.badge = packet.readString();
return true; return true;
} }

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -69,7 +70,7 @@ public class WiredConditionNotInGroup extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
return true; return true;
} }
} }

View File

@ -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.games.GameTeamColors;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -89,10 +90,9 @@ public class WiredConditionNotInTeam extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 1) return false;
this.teamColor = GameTeamColors.values()[settings.getIntParams()[0]];
this.teamColor = GameTeamColors.values()[packet.readInt()];
return true; return true;
} }

View File

@ -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.games.GameTeamColors;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -91,10 +92,9 @@ public class WiredConditionTeamMember extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 1) return false;
this.teamColor = GameTeamColors.values()[settings.getIntParams()[0]];
this.teamColor = GameTeamColors.values()[packet.readInt()];
return true; return true;
} }

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -118,11 +119,8 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); int count = settings.getFurniIds().length;
packet.readString();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear(); this.items.clear();
@ -131,7 +129,7 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
if (room != null) { if (room != null) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
HabboItem item = room.getHabboItem(packet.readInt()); HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
if (item != null) { if (item != null) {
this.items.add(item); this.items.add(item);

View File

@ -5,14 +5,13 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.google.gson.Gson;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -49,11 +48,9 @@ public class WiredEffectBotClothes extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); String dataString = settings.getStringParam();
String dataString = packet.readString(); int delay = settings.getDelay();
packet.readInt();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -6,12 +6,12 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import gnu.trove.procedure.TObjectProcedure; import gnu.trove.procedure.TObjectProcedure;
@ -70,17 +70,18 @@ public class WiredEffectBotFollowHabbo extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); if(settings.getIntParams().length < 1) throw new WiredSaveException("Mode is invalid");
int mode = packet.readInt();
int mode = settings.getIntParams()[0];
if(mode != 0 && mode != 1) if(mode != 0 && mode != 1)
throw new WiredSaveException("Mode is invalid"); 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))); 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)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit; 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.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem; import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
@ -74,17 +74,17 @@ public class WiredEffectBotGiveHandItem extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); if(settings.getIntParams().length < 1) throw new WiredSaveException("Missing item id");
int itemId = packet.readInt(); int itemId = settings.getIntParams()[0];
if(itemId < 0) if(itemId < 0)
itemId = 0; itemId = 0;
String botName = packet.readString(); String botName = settings.getStringParam();
packet.readInt();
int delay = packet.readInt(); int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -5,13 +5,13 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.messages.incoming.wired.WiredSaveException;
@ -52,15 +52,14 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); if(settings.getIntParams().length < 1) throw new WiredSaveException("Mode is invalid");
int mode = settings.getIntParams()[0];
int mode = packet.readInt();
if(mode != 0 && mode != 1) if(mode != 0 && mode != 1)
throw new WiredSaveException("Mode is invalid"); throw new WiredSaveException("Mode is invalid");
String dataString = packet.readString(); String dataString = settings.getStringParam();
String splitBy = "\t"; String splitBy = "\t";
if(!dataString.contains(splitBy)) if(!dataString.contains(splitBy))
@ -71,8 +70,7 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
if (data.length != 2) if (data.length != 2)
throw new WiredSaveException("Malformed data string. Invalid data length"); throw new WiredSaveException("Malformed data string. Invalid data length");
packet.readInt(); int delay = settings.getDelay();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -6,13 +6,13 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import gnu.trove.procedure.TObjectProcedure; import gnu.trove.procedure.TObjectProcedure;
@ -73,15 +73,14 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); if(settings.getIntParams().length < 1) throw new WiredSaveException("Missing mode");
int mode = settings.getIntParams()[0];
int mode = packet.readInt();
if(mode != 0 && mode != 1) if(mode != 0 && mode != 1)
throw new WiredSaveException("Mode is invalid"); throw new WiredSaveException("Mode is invalid");
String dataString = packet.readString(); String dataString = settings.getStringParam();
String splitBy = "\t"; String splitBy = "\t";
if(!dataString.contains(splitBy)) if(!dataString.contains(splitBy))
throw new WiredSaveException("Malformed data string"); throw new WiredSaveException("Malformed data string");
@ -91,8 +90,7 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
if (data.length != 2) if (data.length != 2)
throw new WiredSaveException("Malformed data string. Invalid data length"); throw new WiredSaveException("Malformed data string. Invalid data length");
packet.readInt(); int delay = settings.getDelay();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.RoomTileState;
@ -114,10 +115,9 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); String botName = settings.getStringParam();
String botName = packet.readString(); int itemsCount = settings.getFurniIds().length;
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected"); throw new WiredSaveException("Too many furni selected");
@ -126,7 +126,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>(); List<HabboItem> newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) { 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); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null) if(it == null)
@ -135,7 +135,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
newItems.add(it); newItems.add(it);
} }
int delay = packet.readInt(); int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -67,10 +68,9 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); String botName = settings.getStringParam();
String botName = packet.readString(); int itemsCount = settings.getFurniIds().length;
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected"); throw new WiredSaveException("Too many furni selected");
@ -79,7 +79,7 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>(); List<HabboItem> newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) { 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); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null) if(it == null)
@ -88,7 +88,7 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
newItems.add(it); newItems.add(it);
} }
int delay = packet.readInt(); int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.*; import com.eu.habbo.habbohotel.wired.*;
@ -210,9 +211,10 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); if(settings.getIntParams().length < 2) throw new WiredSaveException("Invalid data");
int startDirectionInt = packet.readInt();
int startDirectionInt = settings.getIntParams()[0];
if(startDirectionInt < 0 || startDirectionInt > 7 || (startDirectionInt % 2) != 0) { if(startDirectionInt < 0 || startDirectionInt > 7 || (startDirectionInt % 2) != 0) {
throw new WiredSaveException("Start direction is invalid"); throw new WiredSaveException("Start direction is invalid");
@ -220,15 +222,13 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
RoomUserRotation startDirection = RoomUserRotation.fromValue(startDirectionInt); RoomUserRotation startDirection = RoomUserRotation.fromValue(startDirectionInt);
int blockedActionInt = packet.readInt(); int blockedActionInt = settings.getIntParams()[1];
if(blockedActionInt < 0 || blockedActionInt > 6) { if(blockedActionInt < 0 || blockedActionInt > 6) {
throw new WiredSaveException("Blocked action is invalid"); throw new WiredSaveException("Blocked action is invalid");
} }
packet.readString(); int itemsCount = settings.getFurniIds().length;
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected"); throw new WiredSaveException("Too many furni selected");
@ -237,7 +237,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
THashMap<HabboItem, WiredChangeDirectionSetting> newItems = new THashMap<>(); THashMap<HabboItem, WiredChangeDirectionSetting> newItems = new THashMap<>();
for (int i = 0; i < itemsCount; i++) { 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); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null) if(it == null)
@ -246,7 +246,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
newItems.put(it, new WiredChangeDirectionSetting(it.getId(), it.getRotation(), startDirection)); 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)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -67,17 +68,14 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) { public boolean saveData(WiredSettings settings, GameClient gameClient) {
packet.readInt();
try { try {
this.amount = Integer.parseInt(packet.readString()); this.amount = Integer.parseInt(settings.getStringParam());
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} }
packet.readInt(); this.setDelay(settings.getDelay());
this.setDelay(packet.readInt());
return true; return true;
} }

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -66,16 +67,14 @@ public class WiredEffectGiveHotelviewHofPoints extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) { public boolean saveData(WiredSettings settings, GameClient gameClient) {
packet.readInt();
try { try {
this.amount = Integer.valueOf(packet.readString()); this.amount = Integer.parseInt(settings.getStringParam());
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} }
packet.readInt();
this.setDelay(packet.readInt()); this.setDelay(settings.getDelay());
return true; return true;
} }

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -67,17 +68,14 @@ public class WiredEffectGiveRespect extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) { public boolean saveData(WiredSettings settings, GameClient gameClient) {
packet.readInt();
try { try {
this.respects = Integer.valueOf(packet.readString()); this.respects = Integer.parseInt(settings.getStringParam());
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} }
packet.readInt(); this.setDelay(settings.getDelay());
this.setDelay(packet.readInt());
return true; return true;
} }

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; 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.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer; import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
import gnu.trove.procedure.TObjectProcedure; import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
@ -174,16 +176,16 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
if (gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) { if (gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) {
int argsLength = packet.readInt(); if(settings.getIntParams().length < 4) throw new WiredSaveException("Invalid data");
this.rewardTime = packet.readInt(); this.rewardTime = settings.getIntParams()[0];
this.uniqueRewards = packet.readInt() == 1; this.uniqueRewards = settings.getIntParams()[1] == 1;
this.limit = packet.readInt(); this.limit = settings.getIntParams()[2];
this.limitationInterval = packet.readInt(); this.limitationInterval = settings.getIntParams()[3];
this.given = 0; this.given = 0;
String data = packet.readString(); String data = settings.getStringParam();
String[] items = data.split(";"); String[] items = data.split(";");
@ -204,8 +206,7 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
return false; return false;
} }
packet.readInt(); this.setDelay(settings.getDelay());
this.setDelay(packet.readInt());
WiredHandler.dropRewards(this.getId()); WiredHandler.dropRewards(this.getId());
return true; return true;

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.games.Game;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -172,23 +173,20 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); if(settings.getIntParams().length < 2) throw new WiredSaveException("Invalid data");
int score = packet.readInt(); int score = settings.getIntParams()[0];
if(score < 1 || score > 100) if(score < 1 || score > 100)
throw new WiredSaveException("Score is invalid"); throw new WiredSaveException("Score is invalid");
int timesPerGame = packet.readInt(); int timesPerGame = settings.getIntParams()[1];
if(timesPerGame < 1 || timesPerGame > 10) if(timesPerGame < 1 || timesPerGame > 10)
throw new WiredSaveException("Times per game is invalid"); throw new WiredSaveException("Times per game is invalid");
packet.readString(); int delay = settings.getDelay();
packet.readInt();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.games.GameTeam;
import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.games.GameTeamColors;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredEffectType;
@ -121,28 +122,25 @@ public class WiredEffectGiveScoreToTeam extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); if(settings.getIntParams().length < 3) throw new WiredSaveException("Invalid data");
int points = packet.readInt(); int points = settings.getIntParams()[0];
if(points < 1 || points > 100) if(points < 1 || points > 100)
throw new WiredSaveException("Points is invalid"); throw new WiredSaveException("Points is invalid");
int timesPerGame = packet.readInt(); int timesPerGame = settings.getIntParams()[1];
if(timesPerGame < 1 || timesPerGame > 10) if(timesPerGame < 1 || timesPerGame > 10)
throw new WiredSaveException("Times per game is invalid"); throw new WiredSaveException("Times per game is invalid");
int team = packet.readInt(); int team = settings.getIntParams()[2];
if(team < 1 || team > 4) if(team < 1 || team > 4)
throw new WiredSaveException("Team is invalid"); throw new WiredSaveException("Team is invalid");
packet.readString(); int delay = settings.getDelay();
packet.readInt();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -134,16 +135,15 @@ public class WiredEffectJoinTeam extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); if(settings.getIntParams().length < 1) throw new WiredSaveException("invalid data");
int team = packet.readInt();
int team = settings.getIntParams()[0];
if(team < 1 || team > 4) if(team < 1 || team > 4)
throw new WiredSaveException("Team is invalid"); throw new WiredSaveException("Team is invalid");
packet.readInt(); int delay = settings.getDelay();
packet.readString();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
@ -148,11 +149,9 @@ public class WiredEffectKickHabbo extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); String message = settings.getStringParam();
String message = packet.readString(); int delay = settings.getDelay();
packet.readInt();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -116,11 +117,8 @@ public class WiredEffectLeaveTeam extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); int delay = settings.getDelay();
packet.readString();
packet.readInt();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -175,21 +176,18 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); if(settings.getIntParams().length < 3) throw new WiredSaveException("Invalid data");
boolean setState = settings.getIntParams()[0] == 1;
boolean setState = packet.readInt() == 1; boolean setDirection = settings.getIntParams()[1] == 1;
boolean setDirection = packet.readInt() == 1; boolean setPosition = settings.getIntParams()[2] == 1;
boolean setPosition = packet.readInt() == 1;
packet.readString();
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null) if (room == null)
throw new WiredSaveException("Trying to save wired in unloaded room"); 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")) { if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected"); throw new WiredSaveException("Too many furni selected");
@ -198,7 +196,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
List<WiredMatchFurniSetting> newSettings = new ArrayList<>(); List<WiredMatchFurniSetting> newSettings = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) { 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); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null) 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())); 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)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -178,10 +179,8 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); int itemsCount = settings.getFurniIds().length;
packet.readString();
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected"); throw new WiredSaveException("Too many furni selected");
@ -190,7 +189,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>(); List<HabboItem> newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) { 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); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null) if(it == null)
@ -199,7 +198,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
newItems.add(it); newItems.add(it);
} }
int delay = packet.readInt(); int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit; 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.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
@ -39,7 +41,7 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect {
} }
@Override @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()); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null) if (room == null)
@ -48,18 +50,16 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect {
this.items.clear(); this.items.clear();
this.indexOffset.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(); int count = settings.getFurniIds().length;
this.spacing = packet.readInt();
packet.readString();
int count = packet.readInt();
for (int i = 0; i < count; i++) { 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; return true;
} }

View File

@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -314,11 +315,8 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); int itemsCount = settings.getFurniIds().length;
packet.readString();
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected"); throw new WiredSaveException("Too many furni selected");
@ -327,7 +325,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>(); List<HabboItem> newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) { 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); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null) if(it == null)
@ -336,7 +334,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
newItems.add(it); newItems.add(it);
} }
int delay = packet.readInt(); int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -5,12 +5,14 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.ICycleable; import com.eu.habbo.habbohotel.items.ICycleable;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -185,28 +187,26 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement
} }
@Override @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()); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null) if (room == null)
return false; return false;
packet.readInt(); if(settings.getIntParams().length < 2) throw new WiredSaveException("invalid data");
this.direction = packet.readInt(); this.direction = settings.getIntParams()[0];
this.rotation = packet.readInt(); this.rotation = settings.getIntParams()[1];
packet.readString(); int count = settings.getFurniIds().length;
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count", 5)) return false; if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count", 5)) return false;
this.items.clear(); this.items.clear();
for (int i = 0; i < count; i++) { 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; return true;
} }

View File

@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; 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.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -49,12 +51,13 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); if(settings.getIntParams().length < 1) throw new WiredSaveException("invalid data");
this.length = packet.readInt();
this.message = packet.readString(); this.length = settings.getIntParams()[0];
packet.readInt(); this.message = settings.getStringParam();
this.setDelay(packet.readInt());
this.setDelay(settings.getDelay());
return true; return true;
} }

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredEffectType;
@ -67,13 +68,8 @@ public class WiredEffectResetTimers extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) { public boolean saveData(WiredSettings settings, GameClient gameClient) {
packet.readInt(); this.setDelay(settings.getDelay());
packet.readString();
packet.readInt();
this.delay = packet.readInt();
this.setDelay(this.delay);
return true; return true;
} }

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.RoomTileState;
@ -130,11 +131,8 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); int itemsCount = settings.getFurniIds().length;
packet.readString();
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected"); throw new WiredSaveException("Too many furni selected");
@ -143,7 +141,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>(); List<HabboItem> newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) { 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); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null) if(it == null)
@ -152,7 +150,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
newItems.add(it); newItems.add(it);
} }
int delay = packet.readInt(); int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -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.InteractionTagField;
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole; 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.pets.*;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -142,11 +143,8 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); int itemsCount = settings.getFurniIds().length;
packet.readString();
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected"); throw new WiredSaveException("Too many furni selected");
@ -155,7 +153,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>(); List<HabboItem> newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) { 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); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null) if(it == null)
@ -164,7 +162,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
newItems.add(it); newItems.add(it);
} }
int delay = packet.readInt(); int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -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.InteractionTagField;
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole; 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.pets.*;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -137,11 +138,8 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); int itemsCount = settings.getFurniIds().length;
packet.readString();
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected"); throw new WiredSaveException("Too many furni selected");
@ -150,7 +148,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>(); List<HabboItem> newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) { 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); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null) if(it == null)
@ -159,7 +157,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
newItems.add(it); newItems.add(it);
} }
int delay = packet.readInt(); int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -85,11 +86,8 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); int itemsCount = settings.getFurniIds().length;
packet.readString();
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected"); throw new WiredSaveException("Too many furni selected");
@ -98,7 +96,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>(); List<HabboItem> newItems = new ArrayList<>();
for (int i = 0; i < itemsCount; i++) { 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); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
if(it == null) if(it == null)
@ -107,7 +105,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
newItems.add(it); newItems.add(it);
} }
int delay = packet.readInt(); int delay = settings.getDelay();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -5,14 +5,13 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo; 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.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
@ -70,19 +69,15 @@ public class WiredEffectWhisper extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
packet.readInt(); String message = settings.getStringParam();
String message = packet.readString();
if(gameClient.getHabbo() == null || !gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) { if(gameClient.getHabbo() == null || !gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) {
message = Emulator.getGameEnvironment().getWordFilter().filter(message, null); message = Emulator.getGameEnvironment().getWordFilter().filter(message, null);
message = message.substring(0, Math.min(message.length(), Emulator.getConfig().getInt("hotel.wired.message.max_length", 100))); message = message.substring(0, Math.min(message.length(), Emulator.getConfig().getInt("hotel.wired.message.max_length", 100)));
} }
packet.readInt(); int delay = settings.getDelay();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
throw new WiredSaveException("Delay too long"); throw new WiredSaveException("Delay too long");

View File

@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.items.interactions.wired.WiredTriggerReset;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -110,9 +111,9 @@ public class WiredTriggerAtSetTime extends InteractionWiredTrigger implements Wi
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 1) return false;
this.executeTime = packet.readInt() * 500; this.executeTime = settings.getIntParams()[0] * 500;
this.resetTimer(); this.resetTimer();

View File

@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.items.interactions.wired.WiredTriggerReset;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -109,10 +110,9 @@ public class WiredTriggerAtTimeLong extends InteractionWiredTrigger implements W
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 1) return false;
this.executeTime = settings.getIntParams()[0] * 500;
this.executeTime = packet.readInt() * 500;
return true; return true;
} }

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -97,17 +98,15 @@ public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); this.botName = settings.getStringParam();
this.botName = packet.readString();
this.items.clear(); this.items.clear();
int count = packet.readInt(); int count = settings.getFurniIds().length;
for (int i = 0; i < count; i++) { 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; return true;

View File

@ -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.bots.Bot;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredHandler;
@ -48,10 +49,8 @@ public class WiredTriggerBotReachedHabbo extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); this.botName = settings.getStringParam();
this.botName = packet.readString();
return true; return true;
} }

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -65,7 +66,7 @@ public class WiredTriggerCollision extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
return true; return true;
} }

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -135,16 +136,13 @@ public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt();
packet.readString();
this.items.clear(); this.items.clear();
int count = packet.readInt(); int count = settings.getFurniIds().length;
for (int i = 0; i < count; i++) { 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; return true;

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.habbohotel.wired.WiredTriggerType;
@ -83,7 +84,7 @@ public class WiredTriggerGameEnds extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
return true; return true;
} }
} }

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.habbohotel.wired.WiredTriggerType;
@ -83,7 +84,7 @@ public class WiredTriggerGameStarts extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
return true; return true;
} }
} }

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -85,9 +86,8 @@ public class WiredTriggerHabboEntersRoom extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); this.username = settings.getStringParam();
this.username = packet.readString();
return true; return true;
} }

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -93,10 +94,10 @@ public class WiredTriggerHabboSaysKeyword extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 1) return false;
this.ownerOnly = packet.readInt() == 1; this.ownerOnly = settings.getIntParams()[0] == 1;
this.key = packet.readString(); this.key = settings.getStringParam();
return true; return true;
} }

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -128,16 +129,13 @@ public class WiredTriggerHabboWalkOffFurni extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt();
packet.readString();
this.items.clear(); this.items.clear();
int count = packet.readInt(); int count = settings.getFurniIds().length;
for (int i = 0; i < count; i++) { 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; return true;

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -82,16 +83,13 @@ public class WiredTriggerHabboWalkOnFurni extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt();
packet.readString();
this.items.clear(); this.items.clear();
int count = packet.readInt(); int count = settings.getFurniIds().length;
for (int i = 0; i < count; i++) { 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; return true;

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.ICycleable;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.items.interactions.wired.WiredTriggerReset;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -109,10 +110,9 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICy
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 1) return false;
this.repeatTime = settings.getIntParams()[0] * 500;
this.repeatTime = packet.readInt() * 500;
this.counter = 0; this.counter = 0;
if (this.repeatTime < 500) { if (this.repeatTime < 500) {

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.ICycleable;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.items.interactions.wired.WiredTriggerReset;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -107,10 +108,9 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 1) return false;
this.repeatTime = settings.getIntParams()[0] * 5000;
this.repeatTime = packet.readInt() * 5000;
this.counter = 0; this.counter = 0;
return true; return true;
} }

View File

@ -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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredHandler;
@ -85,9 +86,9 @@ public class WiredTriggerScoreAchieved extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(ClientMessage packet) { public boolean saveData(WiredSettings settings) {
packet.readInt(); if(settings.getIntParams().length < 1) return false;
this.score = packet.readInt(); this.score = settings.getIntParams()[0];
return true; return true;
} }

View File

@ -328,6 +328,8 @@ public class RoomTrade {
} }
public static int getCreditsByItem(HabboItem item) { 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; if (!item.getBaseItem().getName().startsWith("CF_") && !item.getBaseItem().getName().startsWith("CFC_")) return 0;
try { try {

View File

@ -1,12 +1,19 @@
package com.eu.habbo.messages.incoming.wired; package com.eu.habbo.messages.incoming.wired;
import com.eu.habbo.Emulator; 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.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.messages.incoming.MessageHandler; 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 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 { public class WiredConditionSaveDataEvent extends MessageHandler {
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
@ -19,13 +26,35 @@ public class WiredConditionSaveDataEvent extends MessageHandler {
InteractionWiredCondition condition = room.getRoomSpecialTypes().getCondition(itemId); InteractionWiredCondition condition = room.getRoomSpecialTypes().getCondition(itemId);
if (condition != null) { if (condition != null) {
if (condition.saveData(this.packet)) {
Optional<Method> saveMethod = Arrays.stream(condition.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, false);
if (condition.saveData(settings)) {
this.client.sendResponse(new WiredSavedComposer()); this.client.sendResponse(new WiredSavedComposer());
condition.needsUpdate(true); condition.needsUpdate(true);
Emulator.getThreading().run(condition); 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"));
}
} }
} }
} }

View File

@ -1,14 +1,19 @@
package com.eu.habbo.messages.incoming.wired; package com.eu.habbo.messages.incoming.wired;
import com.eu.habbo.Emulator; 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.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.messages.incoming.MessageHandler; 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.generic.alerts.UpdateFailedComposer;
import com.eu.habbo.messages.outgoing.wired.WiredSavedComposer; 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 { public class WiredEffectSaveDataEvent extends MessageHandler {
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
@ -24,11 +29,29 @@ public class WiredEffectSaveDataEvent extends MessageHandler {
if (effect == null) if (effect == null)
throw new WiredSaveException(String.format("Wired effect with item id %s not found in room", itemId)); throw new WiredSaveException(String.format("Wired effect with item id %s not found in room", itemId));
if (effect.saveData(this.packet, this.client)) { Optional<Method> 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()); this.client.sendResponse(new WiredSavedComposer());
effect.needsUpdate(true); effect.needsUpdate(true);
Emulator.getThreading().run(effect); 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) { catch (WiredSaveException e) {
this.client.sendResponse(new UpdateFailedComposer(e.getMessage())); this.client.sendResponse(new UpdateFailedComposer(e.getMessage()));

View File

@ -1,12 +1,19 @@
package com.eu.habbo.messages.incoming.wired; package com.eu.habbo.messages.incoming.wired;
import com.eu.habbo.Emulator; 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.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.messages.incoming.MessageHandler; 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 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 { public class WiredTriggerSaveDataEvent extends MessageHandler {
@Override @Override
public void handle() throws Exception { public void handle() throws Exception {
@ -19,12 +26,34 @@ public class WiredTriggerSaveDataEvent extends MessageHandler {
InteractionWiredTrigger trigger = room.getRoomSpecialTypes().getTrigger(itemId); InteractionWiredTrigger trigger = room.getRoomSpecialTypes().getTrigger(itemId);
if (trigger != null) { if (trigger != null) {
if (trigger.saveData(this.packet)) {
Optional<Method> saveMethod = Arrays.stream(trigger.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, false);
if (trigger.saveData(settings)) {
this.client.sendResponse(new WiredSavedComposer()); this.client.sendResponse(new WiredSavedComposer());
trigger.needsUpdate(true); trigger.needsUpdate(true);
Emulator.getThreading().run(trigger); 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"));
} }
} }
} }