Revert "Merge branch 'refactor/wired-saving' into 'dev'"

This reverts merge request !507
This commit is contained in:
Harmonic 2022-04-20 23:55:55 +00:00
parent 8236fba2f7
commit d3762c9b87
74 changed files with 426 additions and 459 deletions

View File

@ -2,10 +2,8 @@ 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;
@ -128,35 +126,4 @@ 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(WiredSettings settings); public abstract boolean saveData(ClientMessage packet);
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(WiredSettings settings, GameClient gameClient) throws WiredSaveException; public abstract boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException;
public int getDelay() { public int getDelay() {
return this.delay; return this.delay;

View File

@ -2,7 +2,6 @@ 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;
@ -45,7 +44,7 @@ public abstract class InteractionWiredTrigger extends InteractionWired {
public abstract WiredTriggerType getType(); public abstract WiredTriggerType getType();
public abstract boolean saveData(WiredSettings settings); public abstract boolean saveData(ClientMessage packet);
protected int getDelay() { protected int getDelay() {
return this.delay; return this.delay;

View File

@ -1,63 +0,0 @@
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,13 +3,12 @@ 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;
@ -51,10 +50,10 @@ public class WiredConditionDateRangeActive extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 2) return false; packet.readInt();
this.startDate = settings.getIntParams()[0]; this.startDate = packet.readInt();
this.endDate = settings.getIntParams()[1]; this.endDate = packet.readInt();
return true; return true;
} }

View File

@ -3,7 +3,6 @@ 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,12 +136,15 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; int count;
packet.readInt();
this.all = settings.getIntParams()[0] == 1; this.all = packet.readInt() == 1;
int count = settings.getFurniIds().length; 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 +153,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(settings.getFurniIds()[i]); HabboItem item = room.getHabboItem(packet.readInt());
if (item != null) if (item != null)
this.items.add(item); this.items.add(item);

View File

@ -4,7 +4,6 @@ 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,6 +24,8 @@ 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 {
@ -40,6 +41,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
@Override @Override
public void onPickUp() { public void onPickUp() {
this.items.clear(); this.items.clear();
this.all = false;
} }
@Override @Override
@ -65,6 +67,7 @@ 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())
)); ));
} }
@ -76,6 +79,7 @@ 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);
@ -88,14 +92,17 @@ 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"));
String[] items = data[1].split(";"); if (data.length == 2) {
String[] items = data[1].split(";");
for (String s : items) { for (String s : items) {
HabboItem item = room.getHabboItem(Integer.parseInt(s)); HabboItem item = room.getHabboItem(Integer.parseInt(s));
if (item != null) if (item != null)
this.items.add(item); this.items.add(item);
}
} }
} }
} }
@ -120,7 +127,8 @@ 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(0); message.appendInt(1);
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);
@ -128,9 +136,13 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
int count = settings.getFurniIds().length; int count;
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();
@ -139,7 +151,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(settings.getFurniIds()[i]); HabboItem item = room.getHabboItem(packet.readInt());
if (item != null) if (item != null)
this.items.add(item); this.items.add(item);
@ -170,9 +182,11 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
} }
static class JsonData { static class JsonData {
boolean all;
List<Integer> itemIds; List<Integer> itemIds;
public JsonData(List<Integer> itemIds) { public JsonData(boolean all, List<Integer> itemIds) {
this.all = all;
this.itemIds = itemIds; this.itemIds = itemIds;
} }
} }

View File

@ -3,7 +3,6 @@ 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;
@ -118,8 +117,11 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
int count = settings.getFurniIds().length; packet.readInt();
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();
@ -128,7 +130,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(settings.getFurniIds()[i])); this.items.add(room.getHabboItem(packet.readInt()));
} }
} }

View File

@ -2,7 +2,6 @@ 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;
@ -70,7 +69,7 @@ public class WiredConditionGroupMember extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
return true; return true;
} }
} }

View File

@ -2,7 +2,6 @@ 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;
@ -87,10 +86,11 @@ public class WiredConditionHabboCount extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 2) return false; packet.readInt();
this.lowerLimit = settings.getIntParams()[0];
this.upperLimit = settings.getIntParams()[1]; this.lowerLimit = packet.readInt();
this.upperLimit = packet.readInt();
return true; return true;
} }

View File

@ -2,7 +2,6 @@ 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;
@ -77,9 +76,10 @@ public class WiredConditionHabboHasEffect extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; packet.readInt();
this.effectId = settings.getIntParams()[0];
this.effectId = packet.readInt();
return true; return true;
} }

View File

@ -2,7 +2,6 @@ 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;
@ -52,9 +51,10 @@ public class WiredConditionHabboHasHandItem extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; packet.readInt();
this.handItem = settings.getIntParams()[0];
this.handItem = packet.readInt();
return true; return true;
} }

View File

@ -2,7 +2,6 @@ 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,8 +88,10 @@ public class WiredConditionHabboWearsBadge extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
this.badge = settings.getStringParam(); packet.readInt();
this.badge = packet.readString();
return true; return true;
} }

View File

@ -3,7 +3,6 @@ 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;
@ -82,9 +81,11 @@ public class WiredConditionLessTimeElapsed extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; packet.readInt();
this.cycles = settings.getIntParams()[0];
this.cycles = packet.readInt();
return true; return true;
} }

View File

@ -3,7 +3,6 @@ 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;
@ -70,24 +69,28 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 3) return false; int count;
this.state = settings.getIntParams()[0] == 1; packet.readInt();
this.direction = settings.getIntParams()[1] == 1;
this.position = settings.getIntParams()[2] == 1; this.state = packet.readInt() == 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;
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.settings.clear(); this.settings.clear();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
int itemId = settings.getFurniIds()[i]; int itemId = packet.readInt();
HabboItem item = room.getHabboItem(itemId); HabboItem item = room.getHabboItem(itemId);
if (item != null) if (item != null)

View File

@ -3,7 +3,6 @@ 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;
@ -82,9 +81,11 @@ public class WiredConditionMoreTimeElapsed extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; packet.readInt();
this.cycles = settings.getIntParams()[0];
this.cycles = packet.readInt();
return true; return true;
} }

View File

@ -3,7 +3,6 @@ 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;
@ -138,11 +137,14 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; packet.readInt();
this.all = settings.getIntParams()[0] == 1;
int count = settings.getFurniIds().length; this.all = packet.readInt() == 1;
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();
@ -151,7 +153,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(settings.getFurniIds()[i]); HabboItem item = room.getHabboItem(packet.readInt());
if (item != null) if (item != null)
this.items.add(item); this.items.add(item);

View File

@ -4,7 +4,6 @@ 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;
@ -26,6 +25,7 @@ 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,6 +41,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
@Override @Override
public void onPickUp() { public void onPickUp() {
this.items.clear(); this.items.clear();
this.all = false;
} }
@Override @Override
@ -66,6 +67,7 @@ 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())
)); ));
} }
@ -77,6 +79,7 @@ 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);
@ -89,13 +92,17 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
String[] data = wiredData.split(":"); String[] data = wiredData.split(":");
if (data.length >= 1) { if (data.length >= 1) {
String[] items = data[1].split(";"); this.all = (data[0].equals("1"));
for (String s : items) { if (data.length == 2) {
HabboItem item = room.getHabboItem(Integer.parseInt(s)); String[] items = data[1].split(";");
if (item != null) for (String s : items) {
this.items.add(item); HabboItem item = room.getHabboItem(Integer.parseInt(s));
if (item != null)
this.items.add(item);
}
} }
} }
} }
@ -120,7 +127,8 @@ 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(0); message.appendInt(1);
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);
@ -128,8 +136,12 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
int count = settings.getFurniIds().length; packet.readInt();
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();
@ -138,7 +150,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(settings.getFurniIds()[i]); HabboItem item = room.getHabboItem(packet.readInt());
if (item != null) if (item != null)
this.items.add(item); this.items.add(item);
@ -169,9 +181,11 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
} }
static class JsonData { static class JsonData {
boolean all;
List<Integer> itemIds; List<Integer> itemIds;
public JsonData(List<Integer> itemIds) { public JsonData(boolean all, List<Integer> itemIds) {
this.all = all;
this.itemIds = itemIds; this.itemIds = itemIds;
} }
} }

View File

@ -3,7 +3,6 @@ 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;
@ -118,8 +117,11 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
int count = settings.getFurniIds().length; packet.readInt();
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();
@ -128,7 +130,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(settings.getFurniIds()[i])); this.items.add(room.getHabboItem(packet.readInt()));
} }
} }

View File

@ -2,7 +2,6 @@ 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,10 +85,11 @@ public class WiredConditionNotHabboCount extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 2) return false; packet.readInt();
this.lowerLimit = settings.getIntParams()[0];
this.upperLimit = settings.getIntParams()[1]; this.lowerLimit = packet.readInt();
this.upperLimit = packet.readInt();
return true; return true;
} }

View File

@ -2,7 +2,6 @@ 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;
@ -77,9 +76,10 @@ public class WiredConditionNotHabboHasEffect extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; packet.readInt();
this.effectId = settings.getIntParams()[0];
this.effectId = packet.readInt();
return true; return true;
} }

View File

@ -2,7 +2,6 @@ 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;
@ -90,8 +89,10 @@ public class WiredConditionNotHabboWearsBadge extends InteractionWiredCondition
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
this.badge = settings.getStringParam(); packet.readInt();
this.badge = packet.readString();
return true; return true;
} }

View File

@ -2,7 +2,6 @@ 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;
@ -70,7 +69,7 @@ public class WiredConditionNotInGroup extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
return true; return true;
} }
} }

View File

@ -3,7 +3,6 @@ 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;
@ -90,9 +89,10 @@ public class WiredConditionNotInTeam extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; packet.readInt();
this.teamColor = GameTeamColors.values()[settings.getIntParams()[0]];
this.teamColor = GameTeamColors.values()[packet.readInt()];
return true; return true;
} }

View File

@ -3,7 +3,6 @@ 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;
@ -92,9 +91,10 @@ public class WiredConditionTeamMember extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; packet.readInt();
this.teamColor = GameTeamColors.values()[settings.getIntParams()[0]];
this.teamColor = GameTeamColors.values()[packet.readInt()];
return true; return true;
} }

View File

@ -3,7 +3,6 @@ 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;
@ -119,8 +118,11 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
int count = settings.getFurniIds().length; packet.readInt();
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();
@ -129,7 +131,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(settings.getFurniIds()[i]); HabboItem item = room.getHabboItem(packet.readInt());
if (item != null) { if (item != null) {
this.items.add(item); this.items.add(item);

View File

@ -5,13 +5,14 @@ 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;
@ -48,9 +49,11 @@ public class WiredEffectBotClothes extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
String dataString = settings.getStringParam(); packet.readInt();
int delay = settings.getDelay(); String dataString = 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

@ -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,18 +70,17 @@ public class WiredEffectBotFollowHabbo extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 1) throw new WiredSaveException("Mode is invalid"); packet.readInt();
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 = settings.getStringParam().replace("\t", ""); String botName = packet.readString().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 = 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,7 +6,6 @@ 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;
@ -14,6 +13,7 @@ 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(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 1) throw new WiredSaveException("Missing item id"); packet.readInt();
int itemId = settings.getIntParams()[0]; int itemId = packet.readInt();
if(itemId < 0) if(itemId < 0)
itemId = 0; itemId = 0;
String botName = settings.getStringParam(); String botName = packet.readString();
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,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,14 +52,15 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 1) throw new WiredSaveException("Mode is invalid"); packet.readInt();
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 = settings.getStringParam(); String dataString = packet.readString();
String splitBy = "\t"; String splitBy = "\t";
if(!dataString.contains(splitBy)) if(!dataString.contains(splitBy))
@ -70,7 +71,8 @@ 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");
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,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,14 +73,15 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 1) throw new WiredSaveException("Missing mode"); packet.readInt();
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 = settings.getStringParam(); String dataString = packet.readString();
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");
@ -90,7 +91,8 @@ 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");
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

@ -5,7 +5,6 @@ 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;
@ -115,9 +114,10 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
String botName = settings.getStringParam(); packet.readInt();
int itemsCount = settings.getFurniIds().length; String botName = 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");
@ -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 = settings.getFurniIds()[i]; int itemId = packet.readInt();
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 = 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,7 +5,6 @@ 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;
@ -68,9 +67,10 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
String botName = settings.getStringParam(); packet.readInt();
int itemsCount = settings.getFurniIds().length; String botName = 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");
@ -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 = settings.getFurniIds()[i]; int itemId = packet.readInt();
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 = 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,7 +4,6 @@ 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.*;
@ -211,10 +210,9 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 2) throw new WiredSaveException("Invalid data"); packet.readInt();
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");
@ -222,13 +220,15 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
RoomUserRotation startDirection = RoomUserRotation.fromValue(startDirectionInt); RoomUserRotation startDirection = RoomUserRotation.fromValue(startDirectionInt);
int blockedActionInt = settings.getIntParams()[1]; int blockedActionInt = packet.readInt();
if(blockedActionInt < 0 || blockedActionInt > 6) { if(blockedActionInt < 0 || blockedActionInt > 6) {
throw new WiredSaveException("Blocked action is invalid"); throw new WiredSaveException("Blocked action is invalid");
} }
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");
@ -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 = settings.getFurniIds()[i]; int itemId = packet.readInt();
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 = 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,7 +5,6 @@ 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;
@ -68,14 +67,17 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) { public boolean saveData(ClientMessage packet, GameClient gameClient) {
packet.readInt();
try { try {
this.amount = Integer.parseInt(settings.getStringParam()); this.amount = Integer.parseInt(packet.readString());
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} }
this.setDelay(settings.getDelay()); packet.readInt();
this.setDelay(packet.readInt());
return true; return true;
} }

View File

@ -5,7 +5,6 @@ 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,14 +66,16 @@ public class WiredEffectGiveHotelviewHofPoints extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) { public boolean saveData(ClientMessage packet, GameClient gameClient) {
packet.readInt();
try { try {
this.amount = Integer.parseInt(settings.getStringParam()); this.amount = Integer.valueOf(packet.readString());
} 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

@ -6,7 +6,6 @@ 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;
@ -68,14 +67,17 @@ public class WiredEffectGiveRespect extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) { public boolean saveData(ClientMessage packet, GameClient gameClient) {
packet.readInt();
try { try {
this.respects = Integer.parseInt(settings.getStringParam()); this.respects = Integer.valueOf(packet.readString());
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} }
this.setDelay(settings.getDelay()); packet.readInt();
this.setDelay(packet.readInt());
return true; return true;
} }

View File

@ -5,7 +5,6 @@ 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;
@ -16,7 +15,6 @@ 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;
@ -176,16 +174,16 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) {
if (gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) { if (gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) {
if(settings.getIntParams().length < 4) throw new WiredSaveException("Invalid data"); int argsLength = packet.readInt();
this.rewardTime = settings.getIntParams()[0]; this.rewardTime = packet.readInt();
this.uniqueRewards = settings.getIntParams()[1] == 1; this.uniqueRewards = packet.readInt() == 1;
this.limit = settings.getIntParams()[2]; this.limit = packet.readInt();
this.limitationInterval = settings.getIntParams()[3]; this.limitationInterval = packet.readInt();
this.given = 0; this.given = 0;
String data = settings.getStringParam(); String data = packet.readString();
String[] items = data.split(";"); String[] items = data.split(";");
@ -206,7 +204,8 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
return false; return false;
} }
this.setDelay(settings.getDelay()); packet.readInt();
this.setDelay(packet.readInt());
WiredHandler.dropRewards(this.getId()); WiredHandler.dropRewards(this.getId());
return true; return true;

View File

@ -6,7 +6,6 @@ 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;
@ -173,20 +172,23 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 2) throw new WiredSaveException("Invalid data"); packet.readInt();
int score = settings.getIntParams()[0]; int score = packet.readInt();
if(score < 1 || score > 100) if(score < 1 || score > 100)
throw new WiredSaveException("Score is invalid"); throw new WiredSaveException("Score is invalid");
int timesPerGame = settings.getIntParams()[1]; int timesPerGame = packet.readInt();
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 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

@ -8,7 +8,6 @@ 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;
@ -122,25 +121,28 @@ public class WiredEffectGiveScoreToTeam extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 3) throw new WiredSaveException("Invalid data"); packet.readInt();
int points = settings.getIntParams()[0]; int points = packet.readInt();
if(points < 1 || points > 100) if(points < 1 || points > 100)
throw new WiredSaveException("Points is invalid"); throw new WiredSaveException("Points is invalid");
int timesPerGame = settings.getIntParams()[1]; int timesPerGame = packet.readInt();
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 = settings.getIntParams()[2]; int team = packet.readInt();
if(team < 1 || team > 4) if(team < 1 || team > 4)
throw new WiredSaveException("Team is invalid"); throw new WiredSaveException("Team is invalid");
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

@ -8,7 +8,6 @@ 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;
@ -135,15 +134,16 @@ public class WiredEffectJoinTeam extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 1) throw new WiredSaveException("invalid data"); packet.readInt();
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");
int delay = settings.getDelay(); packet.readInt();
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,7 +5,6 @@ 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;
@ -149,9 +148,11 @@ public class WiredEffectKickHabbo extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
String message = settings.getStringParam(); packet.readInt();
int delay = settings.getDelay(); String message = 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

@ -7,7 +7,6 @@ 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;
@ -117,8 +116,11 @@ public class WiredEffectLeaveTeam extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
int delay = settings.getDelay(); packet.readInt();
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,7 +4,6 @@ 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;
@ -176,18 +175,21 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 3) throw new WiredSaveException("Invalid data"); packet.readInt();
boolean setState = settings.getIntParams()[0] == 1;
boolean setDirection = settings.getIntParams()[1] == 1; boolean setState = packet.readInt() == 1;
boolean setPosition = settings.getIntParams()[2] == 1; boolean setDirection = packet.readInt() == 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 = 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");
@ -196,7 +198,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 = settings.getFurniIds()[i]; int itemId = packet.readInt();
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)
@ -205,7 +207,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 = 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,7 +4,6 @@ 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;
@ -179,8 +178,10 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
int itemsCount = settings.getFurniIds().length; packet.readInt();
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");
@ -189,7 +190,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 = settings.getFurniIds()[i]; int itemId = packet.readInt();
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)
@ -198,7 +199,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
newItems.add(it); newItems.add(it);
} }
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,7 +4,6 @@ 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;
@ -13,7 +12,6 @@ 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;
@ -41,7 +39,7 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) {
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null) if (room == null)
@ -50,16 +48,18 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect {
this.items.clear(); this.items.clear();
this.indexOffset.clear(); this.indexOffset.clear();
if(settings.getIntParams().length < 2) throw new WiredSaveException("invalid data"); packet.readInt();
this.direction = settings.getIntParams()[0];
this.spacing = settings.getIntParams()[1];
int count = settings.getFurniIds().length; this.direction = packet.readInt();
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(settings.getFurniIds()[i])); this.items.add(room.getHabboItem(packet.readInt()));
} }
this.setDelay(settings.getDelay()); this.setDelay(packet.readInt());
return true; return true;
} }

View File

@ -4,7 +4,6 @@ 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;
@ -315,8 +314,11 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
int itemsCount = settings.getFurniIds().length; packet.readInt();
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");
@ -325,7 +327,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 = settings.getFurniIds()[i]; int itemId = packet.readInt();
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)
@ -334,7 +336,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
newItems.add(it); newItems.add(it);
} }
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,14 +5,12 @@ 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;
@ -187,26 +185,28 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) {
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;
if(settings.getIntParams().length < 2) throw new WiredSaveException("invalid data"); packet.readInt();
this.direction = settings.getIntParams()[0]; this.direction = packet.readInt();
this.rotation = settings.getIntParams()[1]; this.rotation = packet.readInt();
int count = settings.getFurniIds().length; packet.readString();
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(settings.getFurniIds()[i])); this.items.add(room.getHabboItem(packet.readInt()));
} }
this.setDelay(settings.getDelay()); this.setDelay(packet.readInt());
return true; return true;
} }

View File

@ -4,7 +4,6 @@ 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;
@ -14,7 +13,6 @@ 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;
@ -51,13 +49,12 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) {
if(settings.getIntParams().length < 1) throw new WiredSaveException("invalid data"); packet.readInt();
this.length = packet.readInt();
this.length = settings.getIntParams()[0]; this.message = packet.readString();
this.message = settings.getStringParam(); packet.readInt();
this.setDelay(packet.readInt());
this.setDelay(settings.getDelay());
return true; return true;
} }

View File

@ -5,7 +5,6 @@ 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;
@ -68,8 +67,13 @@ public class WiredEffectResetTimers extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) { public boolean saveData(ClientMessage packet, GameClient gameClient) {
this.setDelay(settings.getDelay()); packet.readInt();
packet.readString();
packet.readInt();
this.delay = packet.readInt();
this.setDelay(this.delay);
return true; return true;
} }

View File

@ -5,7 +5,6 @@ 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;
@ -131,8 +130,11 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
int itemsCount = settings.getFurniIds().length; packet.readInt();
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");
@ -141,7 +143,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 = settings.getFurniIds()[i]; int itemId = packet.readInt();
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)
@ -150,7 +152,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
newItems.add(it); newItems.add(it);
} }
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

@ -17,7 +17,6 @@ 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;
@ -143,8 +142,11 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
int itemsCount = settings.getFurniIds().length; packet.readInt();
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");
@ -153,7 +155,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 = settings.getFurniIds()[i]; int itemId = packet.readInt();
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)
@ -162,7 +164,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
newItems.add(it); newItems.add(it);
} }
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

@ -15,7 +15,6 @@ 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;
@ -138,8 +137,11 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
int itemsCount = settings.getFurniIds().length; packet.readInt();
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");
@ -148,7 +150,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 = settings.getFurniIds()[i]; int itemId = packet.readInt();
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)
@ -157,7 +159,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
newItems.add(it); newItems.add(it);
} }
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,7 +5,6 @@ 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;
@ -86,8 +85,11 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
int itemsCount = settings.getFurniIds().length; packet.readInt();
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");
@ -96,7 +98,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 = settings.getFurniIds()[i]; int itemId = packet.readInt();
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)
@ -105,7 +107,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
newItems.add(it); newItems.add(it);
} }
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,13 +5,14 @@ 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;
@ -69,15 +70,19 @@ public class WiredEffectWhisper extends InteractionWiredEffect {
} }
@Override @Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
String message = settings.getStringParam(); packet.readInt();
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)));
} }
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

@ -4,7 +4,6 @@ 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;
@ -111,9 +110,9 @@ public class WiredTriggerAtSetTime extends InteractionWiredTrigger implements Wi
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; packet.readInt();
this.executeTime = settings.getIntParams()[0] * 500; this.executeTime = packet.readInt() * 500;
this.resetTimer(); this.resetTimer();

View File

@ -4,7 +4,6 @@ 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 +109,10 @@ public class WiredTriggerAtTimeLong extends InteractionWiredTrigger implements W
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; packet.readInt();
this.executeTime = settings.getIntParams()[0] * 500;
this.executeTime = packet.readInt() * 500;
return true; return true;
} }

View File

@ -5,7 +5,6 @@ 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;
@ -98,15 +97,17 @@ public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
this.botName = settings.getStringParam(); packet.readInt();
this.botName = packet.readString();
this.items.clear(); this.items.clear();
int count = settings.getFurniIds().length; int count = packet.readInt();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i])); this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
} }
return true; return true;

View File

@ -3,7 +3,6 @@ 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;
@ -49,8 +48,10 @@ public class WiredTriggerBotReachedHabbo extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
this.botName = settings.getStringParam(); packet.readInt();
this.botName = packet.readString();
return true; return true;
} }

View File

@ -2,7 +2,6 @@ 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;
@ -66,7 +65,7 @@ public class WiredTriggerCollision extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
return true; return true;
} }

View File

@ -3,7 +3,6 @@ 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;
@ -136,13 +135,16 @@ public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
packet.readInt();
packet.readString();
this.items.clear(); this.items.clear();
int count = settings.getFurniIds().length; int count = packet.readInt();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i])); this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
} }
return true; return true;

View File

@ -3,7 +3,6 @@ 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;
@ -84,7 +83,7 @@ public class WiredTriggerGameEnds extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
return true; return true;
} }
} }

View File

@ -3,7 +3,6 @@ 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;
@ -84,7 +83,7 @@ public class WiredTriggerGameStarts extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
return true; return true;
} }
} }

View File

@ -2,7 +2,6 @@ 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;
@ -86,8 +85,9 @@ public class WiredTriggerHabboEntersRoom extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
this.username = settings.getStringParam(); packet.readInt();
this.username = packet.readString();
return true; return true;
} }

View File

@ -2,7 +2,6 @@ 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;
@ -94,10 +93,10 @@ public class WiredTriggerHabboSaysKeyword extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; packet.readInt();
this.ownerOnly = settings.getIntParams()[0] == 1; this.ownerOnly = packet.readInt() == 1;
this.key = settings.getStringParam(); this.key = packet.readString();
return true; return true;
} }

View File

@ -3,7 +3,6 @@ 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;
@ -129,13 +128,16 @@ public class WiredTriggerHabboWalkOffFurni extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
packet.readInt();
packet.readString();
this.items.clear(); this.items.clear();
int count = settings.getFurniIds().length; int count = packet.readInt();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i])); this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
} }
return true; return true;

View File

@ -3,7 +3,6 @@ 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;
@ -83,13 +82,16 @@ public class WiredTriggerHabboWalkOnFurni extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
packet.readInt();
packet.readString();
this.items.clear(); this.items.clear();
int count = settings.getFurniIds().length; int count = packet.readInt();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i])); this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
} }
return true; return true;

View File

@ -5,7 +5,6 @@ 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;
@ -110,9 +109,10 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICy
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; packet.readInt();
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,7 +5,6 @@ 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;
@ -108,9 +107,10 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; packet.readInt();
this.repeatTime = settings.getIntParams()[0] * 5000;
this.repeatTime = packet.readInt() * 5000;
this.counter = 0; this.counter = 0;
return true; return true;
} }

View File

@ -2,7 +2,6 @@ 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;
@ -86,9 +85,9 @@ public class WiredTriggerScoreAchieved extends InteractionWiredTrigger {
} }
@Override @Override
public boolean saveData(WiredSettings settings) { public boolean saveData(ClientMessage packet) {
if(settings.getIntParams().length < 1) return false; packet.readInt();
this.score = settings.getIntParams()[0]; this.score = packet.readInt();
return true; return true;
} }

View File

@ -1,13 +1,10 @@
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;
public class WiredConditionSaveDataEvent extends MessageHandler { public class WiredConditionSaveDataEvent extends MessageHandler {
@ -22,16 +19,12 @@ public class WiredConditionSaveDataEvent extends MessageHandler {
InteractionWiredCondition condition = room.getRoomSpecialTypes().getCondition(itemId); InteractionWiredCondition condition = room.getRoomSpecialTypes().getCondition(itemId);
if (condition != null) { if (condition != null) {
WiredSettings settings = InteractionWired.readSettings(this.packet, false); if (condition.saveData(this.packet)) {
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"));
} }
} }
} }

View File

@ -1,12 +1,11 @@
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;
@ -25,8 +24,7 @@ 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));
WiredSettings settings = InteractionWired.readSettings(this.packet, true); if (effect.saveData(this.packet, this.client)) {
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);

View File

@ -1,13 +1,10 @@
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;
public class WiredTriggerSaveDataEvent extends MessageHandler { public class WiredTriggerSaveDataEvent extends MessageHandler {
@ -22,16 +19,12 @@ public class WiredTriggerSaveDataEvent extends MessageHandler {
InteractionWiredTrigger trigger = room.getRoomSpecialTypes().getTrigger(itemId); InteractionWiredTrigger trigger = room.getRoomSpecialTypes().getTrigger(itemId);
if (trigger != null) { if (trigger != null) {
WiredSettings settings = InteractionWired.readSettings(this.packet, false); if (trigger.saveData(this.packet)) {
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"));
} }
} }
} }