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.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
import gnu.trove.map.hash.TLongLongHashMap;
@ -128,35 +126,4 @@ public abstract class InteractionWired extends InteractionDefault {
public void addUserExecutionCache(int roomUnitId, long timestamp) {
this.userExecutionCache.put((long)roomUnitId, timestamp);
}
public static WiredSettings readSettings(ClientMessage packet, boolean isEffect)
{
int intParamCount = packet.readInt();
int[] intParams = new int[intParamCount];
for(int i = 0; i < intParamCount; i++)
{
intParams[i] = packet.readInt();
}
String stringParam = packet.readString();
int itemCount = packet.readInt();
int[] itemIds = new int[itemCount];
for(int i = 0; i < itemCount; i++)
{
itemIds[i] = packet.readInt();
}
WiredSettings settings = new WiredSettings(intParams, stringParam, itemIds, -1);
if(isEffect)
{
settings.setDelay(packet.readInt());
}
settings.setStuffTypeSelectionCode(packet.readInt());
return settings;
}
}

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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionOperator;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.outgoing.wired.WiredConditionDataComposer;
import java.sql.ResultSet;
@ -43,7 +43,7 @@ public abstract class InteractionWiredCondition extends InteractionWired {
public abstract WiredConditionType getType();
public abstract boolean saveData(WiredSettings settings);
public abstract boolean saveData(ClientMessage packet);
public WiredConditionOperator operator() {
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.wired.WiredEffectDataComposer;
@ -43,7 +43,7 @@ public abstract class InteractionWiredEffect extends InteractionWired {
}
}
public abstract boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException;
public abstract boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException;
public int getDelay() {
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
@ -45,7 +44,7 @@ public abstract class InteractionWiredTrigger extends InteractionWired {
public abstract WiredTriggerType getType();
public abstract boolean saveData(WiredSettings settings);
public abstract boolean saveData(ClientMessage packet);
protected int getDelay() {
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.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -51,10 +50,10 @@ public class WiredConditionDateRangeActive extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 2) return false;
this.startDate = settings.getIntParams()[0];
this.endDate = settings.getIntParams()[1];
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.startDate = packet.readInt();
this.endDate = packet.readInt();
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.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -137,12 +136,15 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 1) return false;
public boolean saveData(ClientMessage packet) {
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;
this.items.clear();
@ -151,7 +153,7 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
HabboItem item = room.getHabboItem(packet.readInt());
if (item != null)
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
@ -25,6 +24,8 @@ import java.util.stream.Collectors;
public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
public static final WiredConditionType type = WiredConditionType.FURNI_HAVE_HABBO;
protected boolean all;
protected THashSet<HabboItem> items;
public WiredConditionFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
@ -40,6 +41,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
@Override
public void onPickUp() {
this.items.clear();
this.all = false;
}
@Override
@ -65,6 +67,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
public String getWiredData() {
this.refresh();
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
this.all,
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
));
}
@ -76,6 +79,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
if (wiredData.startsWith("{")) {
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
this.all = data.all;
for(int id : data.itemIds) {
HabboItem item = room.getHabboItem(id);
@ -88,14 +92,17 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
String[] data = wiredData.split(":");
if (data.length >= 1) {
this.all = (data[0].equals("1"));
String[] items = data[1].split(";");
if (data.length == 2) {
String[] items = data[1].split(";");
for (String s : items) {
HabboItem item = room.getHabboItem(Integer.parseInt(s));
for (String s : items) {
HabboItem item = room.getHabboItem(Integer.parseInt(s));
if (item != null)
this.items.add(item);
if (item != null)
this.items.add(item);
}
}
}
}
@ -120,7 +127,8 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId());
message.appendString("");
message.appendInt(0);
message.appendInt(1);
message.appendInt(this.all ? 1 : 0);
message.appendInt(0);
message.appendInt(this.getType().code);
message.appendInt(0);
@ -128,9 +136,13 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
int count = settings.getFurniIds().length;
public boolean saveData(ClientMessage packet) {
int count;
packet.readInt();
packet.readString();
count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@ -139,7 +151,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
HabboItem item = room.getHabboItem(packet.readInt());
if (item != null)
this.items.add(item);
@ -170,9 +182,11 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
}
static class JsonData {
boolean all;
List<Integer> itemIds;
public JsonData(List<Integer> itemIds) {
public JsonData(boolean all, List<Integer> itemIds) {
this.all = all;
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.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@ -118,8 +117,11 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
int count = settings.getFurniIds().length;
public boolean saveData(ClientMessage packet) {
packet.readInt();
packet.readString();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@ -128,7 +130,7 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
if (room != null) {
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.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -70,7 +69,7 @@ public class WiredConditionGroupMember extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
public boolean saveData(ClientMessage packet) {
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.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
@ -87,10 +86,11 @@ public class WiredConditionHabboCount extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 2) return false;
this.lowerLimit = settings.getIntParams()[0];
this.upperLimit = settings.getIntParams()[1];
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.lowerLimit = packet.readInt();
this.upperLimit = packet.readInt();
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.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
@ -77,9 +76,10 @@ public class WiredConditionHabboHasEffect extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 1) return false;
this.effectId = settings.getIntParams()[0];
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.effectId = packet.readInt();
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.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
@ -52,9 +51,10 @@ public class WiredConditionHabboHasHandItem extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 1) return false;
this.handItem = settings.getIntParams()[0];
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.handItem = packet.readInt();
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.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -89,8 +88,10 @@ public class WiredConditionHabboWearsBadge extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
this.badge = settings.getStringParam();
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.badge = packet.readString();
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.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
@ -82,9 +81,11 @@ public class WiredConditionLessTimeElapsed extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 1) return false;
this.cycles = settings.getIntParams()[0];
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.cycles = packet.readInt();
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.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -70,24 +69,28 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 3) return false;
this.state = settings.getIntParams()[0] == 1;
this.direction = settings.getIntParams()[1] == 1;
this.position = settings.getIntParams()[2] == 1;
public boolean saveData(ClientMessage packet) {
int count;
packet.readInt();
this.state = packet.readInt() == 1;
this.direction = packet.readInt() == 1;
this.position = packet.readInt() == 1;
packet.readString();
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null)
return true;
int count = settings.getFurniIds().length;
count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.settings.clear();
for (int i = 0; i < count; i++) {
int itemId = settings.getFurniIds()[i];
int itemId = packet.readInt();
HabboItem item = room.getHabboItem(itemId);
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.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
@ -82,9 +81,11 @@ public class WiredConditionMoreTimeElapsed extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 1) return false;
this.cycles = settings.getIntParams()[0];
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.cycles = packet.readInt();
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.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -138,11 +137,14 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 1) return false;
this.all = settings.getIntParams()[0] == 1;
public boolean saveData(ClientMessage packet) {
packet.readInt();
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;
this.items.clear();
@ -151,7 +153,7 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
HabboItem item = room.getHabboItem(packet.readInt());
if (item != null)
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
@ -25,7 +24,8 @@ import java.util.stream.Collectors;
public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
public static final WiredConditionType type = WiredConditionType.NOT_FURNI_HAVE_HABBO;
protected boolean all;
protected THashSet<HabboItem> items;
public WiredConditionNotFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
@ -41,6 +41,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
@Override
public void onPickUp() {
this.items.clear();
this.all = false;
}
@Override
@ -66,6 +67,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
public String getWiredData() {
this.refresh();
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
this.all,
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
));
}
@ -77,6 +79,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
if (wiredData.startsWith("{")) {
WiredConditionFurniHaveHabbo.JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, WiredConditionFurniHaveHabbo.JsonData.class);
this.all = data.all;
for(int id : data.itemIds) {
HabboItem item = room.getHabboItem(id);
@ -89,13 +92,17 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
String[] data = wiredData.split(":");
if (data.length >= 1) {
String[] items = data[1].split(";");
this.all = (data[0].equals("1"));
for (String s : items) {
HabboItem item = room.getHabboItem(Integer.parseInt(s));
if (data.length == 2) {
String[] items = data[1].split(";");
if (item != null)
this.items.add(item);
for (String s : items) {
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.getId());
message.appendString("");
message.appendInt(0);
message.appendInt(1);
message.appendInt(this.all ? 1 : 0);
message.appendInt(0);
message.appendInt(this.getType().code);
message.appendInt(0);
@ -128,8 +136,12 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
int count = settings.getFurniIds().length;
public boolean saveData(ClientMessage packet) {
packet.readInt();
packet.readString();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@ -138,7 +150,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
HabboItem item = room.getHabboItem(packet.readInt());
if (item != null)
this.items.add(item);
@ -169,9 +181,11 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
}
static class JsonData {
boolean all;
List<Integer> itemIds;
public JsonData(List<Integer> itemIds) {
public JsonData(boolean all, List<Integer> itemIds) {
this.all = all;
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.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@ -118,8 +117,11 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
int count = settings.getFurniIds().length;
public boolean saveData(ClientMessage packet) {
packet.readInt();
packet.readString();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@ -128,7 +130,7 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
if (room != null) {
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.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
@ -86,10 +85,11 @@ public class WiredConditionNotHabboCount extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 2) return false;
this.lowerLimit = settings.getIntParams()[0];
this.upperLimit = settings.getIntParams()[1];
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.lowerLimit = packet.readInt();
this.upperLimit = packet.readInt();
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.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredConditionType;
@ -77,9 +76,10 @@ public class WiredConditionNotHabboHasEffect extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 1) return false;
this.effectId = settings.getIntParams()[0];
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.effectId = packet.readInt();
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.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -90,8 +89,10 @@ public class WiredConditionNotHabboWearsBadge extends InteractionWiredCondition
}
@Override
public boolean saveData(WiredSettings settings) {
this.badge = settings.getStringParam();
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.badge = packet.readString();
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.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -70,7 +69,7 @@ public class WiredConditionNotInGroup extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
public boolean saveData(ClientMessage packet) {
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -90,9 +89,10 @@ public class WiredConditionNotInTeam extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 1) return false;
this.teamColor = GameTeamColors.values()[settings.getIntParams()[0]];
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.teamColor = GameTeamColors.values()[packet.readInt()];
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -92,9 +91,10 @@ public class WiredConditionTeamMember extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 1) return false;
this.teamColor = GameTeamColors.values()[settings.getIntParams()[0]];
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.teamColor = GameTeamColors.values()[packet.readInt()];
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.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -119,8 +118,11 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
}
@Override
public boolean saveData(WiredSettings settings) {
int count = settings.getFurniIds().length;
public boolean saveData(ClientMessage packet) {
packet.readInt();
packet.readString();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
@ -129,7 +131,7 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
if (room != null) {
for (int i = 0; i < count; i++) {
HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
HabboItem item = room.getHabboItem(packet.readInt());
if (item != null) {
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.google.gson.Gson;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -48,9 +49,11 @@ public class WiredEffectBotClothes extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
String dataString = settings.getStringParam();
int delay = settings.getDelay();
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
String dataString = packet.readString();
packet.readInt();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import gnu.trove.procedure.TObjectProcedure;
@ -70,18 +70,17 @@ public class WiredEffectBotFollowHabbo extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 1) throw new WiredSaveException("Mode is invalid");
int mode = settings.getIntParams()[0];
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
int mode = packet.readInt();
if(mode != 0 && mode != 1)
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)));
int delay = settings.getDelay();
packet.readInt();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -14,6 +13,7 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
@ -74,17 +74,17 @@ public class WiredEffectBotGiveHandItem extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 1) throw new WiredSaveException("Missing item id");
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
int itemId = settings.getIntParams()[0];
int itemId = packet.readInt();
if(itemId < 0)
itemId = 0;
String botName = settings.getStringParam();
int delay = settings.getDelay();
String botName = packet.readString();
packet.readInt();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
@ -52,14 +52,15 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 1) throw new WiredSaveException("Mode is invalid");
int mode = settings.getIntParams()[0];
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
int mode = packet.readInt();
if(mode != 0 && mode != 1)
throw new WiredSaveException("Mode is invalid");
String dataString = settings.getStringParam();
String dataString = packet.readString();
String splitBy = "\t";
if(!dataString.contains(splitBy))
@ -70,7 +71,8 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
if (data.length != 2)
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))
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import gnu.trove.procedure.TObjectProcedure;
@ -73,14 +73,15 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 1) throw new WiredSaveException("Missing mode");
int mode = settings.getIntParams()[0];
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
int mode = packet.readInt();
if(mode != 0 && mode != 1)
throw new WiredSaveException("Mode is invalid");
String dataString = settings.getStringParam();
String dataString = packet.readString();
String splitBy = "\t";
if(!dataString.contains(splitBy))
throw new WiredSaveException("Malformed data string");
@ -90,7 +91,8 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
if (data.length != 2)
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))
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomTileState;
@ -115,9 +114,10 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
String botName = settings.getStringParam();
int itemsCount = settings.getFurniIds().length;
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
String botName = packet.readString();
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@ -126,7 +126,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>();
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);
if(it == null)
@ -135,7 +135,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
newItems.add(it);
}
int delay = settings.getDelay();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@ -68,9 +67,10 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
String botName = settings.getStringParam();
int itemsCount = settings.getFurniIds().length;
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
String botName = packet.readString();
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@ -79,7 +79,7 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>();
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);
if(it == null)
@ -88,7 +88,7 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
newItems.add(it);
}
int delay = settings.getDelay();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.*;
@ -211,10 +210,9 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 2) throw new WiredSaveException("Invalid data");
int startDirectionInt = settings.getIntParams()[0];
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
int startDirectionInt = packet.readInt();
if(startDirectionInt < 0 || startDirectionInt > 7 || (startDirectionInt % 2) != 0) {
throw new WiredSaveException("Start direction is invalid");
@ -222,13 +220,15 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
RoomUserRotation startDirection = RoomUserRotation.fromValue(startDirectionInt);
int blockedActionInt = settings.getIntParams()[1];
int blockedActionInt = packet.readInt();
if(blockedActionInt < 0 || blockedActionInt > 6) {
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")) {
throw new WiredSaveException("Too many furni selected");
@ -237,7 +237,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
THashMap<HabboItem, WiredChangeDirectionSetting> newItems = new THashMap<>();
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);
if(it == null)
@ -246,7 +246,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
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))
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -68,14 +67,17 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) {
public boolean saveData(ClientMessage packet, GameClient gameClient) {
packet.readInt();
try {
this.amount = Integer.parseInt(settings.getStringParam());
this.amount = Integer.parseInt(packet.readString());
} catch (Exception e) {
return false;
}
this.setDelay(settings.getDelay());
packet.readInt();
this.setDelay(packet.readInt());
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -67,14 +66,16 @@ public class WiredEffectGiveHotelviewHofPoints extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) {
public boolean saveData(ClientMessage packet, GameClient gameClient) {
packet.readInt();
try {
this.amount = Integer.parseInt(settings.getStringParam());
this.amount = Integer.valueOf(packet.readString());
} catch (Exception e) {
return false;
}
this.setDelay(settings.getDelay());
packet.readInt();
this.setDelay(packet.readInt());
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -68,14 +67,17 @@ public class WiredEffectGiveRespect extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) {
public boolean saveData(ClientMessage packet, GameClient gameClient) {
packet.readInt();
try {
this.respects = Integer.parseInt(settings.getStringParam());
this.respects = Integer.valueOf(packet.readString());
} catch (Exception e) {
return false;
}
this.setDelay(settings.getDelay());
packet.readInt();
this.setDelay(packet.readInt());
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@ -16,7 +15,6 @@ import com.eu.habbo.habbohotel.wired.WiredGiveRewardItem;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
import gnu.trove.procedure.TObjectProcedure;
import gnu.trove.set.hash.THashSet;
@ -176,16 +174,16 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
}
@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(settings.getIntParams().length < 4) throw new WiredSaveException("Invalid data");
this.rewardTime = settings.getIntParams()[0];
this.uniqueRewards = settings.getIntParams()[1] == 1;
this.limit = settings.getIntParams()[2];
this.limitationInterval = settings.getIntParams()[3];
int argsLength = packet.readInt();
this.rewardTime = packet.readInt();
this.uniqueRewards = packet.readInt() == 1;
this.limit = packet.readInt();
this.limitationInterval = packet.readInt();
this.given = 0;
String data = settings.getStringParam();
String data = packet.readString();
String[] items = data.split(";");
@ -206,7 +204,8 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
return false;
}
this.setDelay(settings.getDelay());
packet.readInt();
this.setDelay(packet.readInt());
WiredHandler.dropRewards(this.getId());
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -173,20 +172,23 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 2) throw new WiredSaveException("Invalid data");
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
int score = settings.getIntParams()[0];
int score = packet.readInt();
if(score < 1 || score > 100)
throw new WiredSaveException("Score is invalid");
int timesPerGame = settings.getIntParams()[1];
int timesPerGame = packet.readInt();
if(timesPerGame < 1 || timesPerGame > 10)
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))
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
@ -122,25 +121,28 @@ public class WiredEffectGiveScoreToTeam extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 3) throw new WiredSaveException("Invalid data");
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
int points = settings.getIntParams()[0];
int points = packet.readInt();
if(points < 1 || points > 100)
throw new WiredSaveException("Points is invalid");
int timesPerGame = settings.getIntParams()[1];
int timesPerGame = packet.readInt();
if(timesPerGame < 1 || timesPerGame > 10)
throw new WiredSaveException("Times per game is invalid");
int team = settings.getIntParams()[2];
int team = packet.readInt();
if(team < 1 || team > 4)
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))
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -135,15 +134,16 @@ public class WiredEffectJoinTeam extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 1) throw new WiredSaveException("invalid data");
int team = settings.getIntParams()[0];
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
int team = packet.readInt();
if(team < 1 || team > 4)
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))
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
@ -149,9 +148,11 @@ public class WiredEffectKickHabbo extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
String message = settings.getStringParam();
int delay = settings.getDelay();
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
String message = packet.readString();
packet.readInt();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -117,8 +116,11 @@ public class WiredEffectLeaveTeam extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
int delay = settings.getDelay();
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
packet.readString();
packet.readInt();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem;
@ -176,18 +175,21 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 3) throw new WiredSaveException("Invalid data");
boolean setState = settings.getIntParams()[0] == 1;
boolean setDirection = settings.getIntParams()[1] == 1;
boolean setPosition = settings.getIntParams()[2] == 1;
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
boolean setState = packet.readInt() == 1;
boolean setDirection = packet.readInt() == 1;
boolean setPosition = packet.readInt() == 1;
packet.readString();
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null)
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")) {
throw new WiredSaveException("Too many furni selected");
@ -196,7 +198,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
List<WiredMatchFurniSetting> newSettings = new ArrayList<>();
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);
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()));
}
int delay = settings.getDelay();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
@ -179,8 +178,10 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
int itemsCount = settings.getFurniIds().length;
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
packet.readString();
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@ -189,7 +190,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>();
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);
if(it == null)
@ -198,7 +199,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
newItems.add(it);
}
int delay = settings.getDelay();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -13,7 +12,6 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import gnu.trove.set.hash.THashSet;
@ -41,7 +39,7 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect {
}
@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());
if (room == null)
@ -50,16 +48,18 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect {
this.items.clear();
this.indexOffset.clear();
if(settings.getIntParams().length < 2) throw new WiredSaveException("invalid data");
this.direction = settings.getIntParams()[0];
this.spacing = settings.getIntParams()[1];
packet.readInt();
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++) {
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;
}

View File

@ -4,7 +4,6 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
@ -315,8 +314,11 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
int itemsCount = settings.getFurniIds().length;
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
packet.readString();
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@ -325,7 +327,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>();
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);
if(it == null)
@ -334,7 +336,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
newItems.add(it);
}
int delay = settings.getDelay();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import gnu.trove.set.hash.THashSet;
import org.slf4j.Logger;
@ -187,26 +185,28 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement
}
@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());
if (room == null)
return false;
if(settings.getIntParams().length < 2) throw new WiredSaveException("invalid data");
packet.readInt();
this.direction = settings.getIntParams()[0];
this.rotation = settings.getIntParams()[1];
this.direction = packet.readInt();
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;
this.items.clear();
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;
}

View File

@ -4,7 +4,6 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@ -14,7 +13,6 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
import java.sql.ResultSet;
@ -51,13 +49,12 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
if(settings.getIntParams().length < 1) throw new WiredSaveException("invalid data");
this.length = settings.getIntParams()[0];
this.message = settings.getStringParam();
this.setDelay(settings.getDelay());
public boolean saveData(ClientMessage packet, GameClient gameClient) {
packet.readInt();
this.length = packet.readInt();
this.message = packet.readString();
packet.readInt();
this.setDelay(packet.readInt());
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
@ -68,8 +67,13 @@ public class WiredEffectResetTimers extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) {
this.setDelay(settings.getDelay());
public boolean saveData(ClientMessage packet, GameClient gameClient) {
packet.readInt();
packet.readString();
packet.readInt();
this.delay = packet.readInt();
this.setDelay(this.delay);
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomTileState;
@ -131,8 +130,11 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
int itemsCount = settings.getFurniIds().length;
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
packet.readString();
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@ -141,7 +143,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>();
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);
if(it == null)
@ -150,7 +152,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
newItems.add(it);
}
int delay = settings.getDelay();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.InteractionTagPole;
import com.eu.habbo.habbohotel.items.interactions.pets.*;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -143,8 +142,11 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
int itemsCount = settings.getFurniIds().length;
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
packet.readString();
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@ -153,7 +155,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>();
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);
if(it == null)
@ -162,7 +164,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
newItems.add(it);
}
int delay = settings.getDelay();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.InteractionTagPole;
import com.eu.habbo.habbohotel.items.interactions.pets.*;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@ -138,8 +137,11 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
int itemsCount = settings.getFurniIds().length;
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
packet.readString();
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@ -148,7 +150,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>();
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);
if(it == null)
@ -157,7 +159,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
newItems.add(it);
}
int delay = settings.getDelay();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -86,8 +85,11 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
int itemsCount = settings.getFurniIds().length;
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
packet.readString();
int itemsCount = packet.readInt();
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
throw new WiredSaveException("Too many furni selected");
@ -96,7 +98,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
List<HabboItem> newItems = new ArrayList<>();
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);
if(it == null)
@ -105,7 +107,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
newItems.add(it);
}
int delay = settings.getDelay();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredChangeDirectionSetting;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
@ -69,15 +70,19 @@ public class WiredEffectWhisper extends InteractionWiredEffect {
}
@Override
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
String message = settings.getStringParam();
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
packet.readInt();
String message = packet.readString();
if(gameClient.getHabbo() == null || !gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) {
message = Emulator.getGameEnvironment().getWordFilter().filter(message, null);
message = message.substring(0, Math.min(message.length(), Emulator.getConfig().getInt("hotel.wired.message.max_length", 100)));
}
int delay = settings.getDelay();
packet.readInt();
int delay = packet.readInt();
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -111,9 +110,9 @@ public class WiredTriggerAtSetTime extends InteractionWiredTrigger implements Wi
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 1) return false;
this.executeTime = settings.getIntParams()[0] * 500;
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.executeTime = packet.readInt() * 500;
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
@ -110,9 +109,10 @@ public class WiredTriggerAtTimeLong extends InteractionWiredTrigger implements W
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 1) return false;
this.executeTime = settings.getIntParams()[0] * 500;
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.executeTime = packet.readInt() * 500;
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@ -98,15 +97,17 @@ public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger {
}
@Override
public boolean saveData(WiredSettings settings) {
this.botName = settings.getStringParam();
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.botName = packet.readString();
this.items.clear();
int count = settings.getFurniIds().length;
int count = packet.readInt();
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;

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.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredHandler;
@ -49,8 +48,10 @@ public class WiredTriggerBotReachedHabbo extends InteractionWiredTrigger {
}
@Override
public boolean saveData(WiredSettings settings) {
this.botName = settings.getStringParam();
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.botName = packet.readString();
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.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@ -66,7 +65,7 @@ public class WiredTriggerCollision extends InteractionWiredTrigger {
}
@Override
public boolean saveData(WiredSettings settings) {
public boolean saveData(ClientMessage packet) {
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.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -136,13 +135,16 @@ public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger {
}
@Override
public boolean saveData(WiredSettings settings) {
public boolean saveData(ClientMessage packet) {
packet.readInt();
packet.readString();
this.items.clear();
int count = settings.getFurniIds().length;
int count = packet.readInt();
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;

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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
@ -84,7 +83,7 @@ public class WiredTriggerGameEnds extends InteractionWiredTrigger {
}
@Override
public boolean saveData(WiredSettings settings) {
public boolean saveData(ClientMessage packet) {
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.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
@ -84,7 +83,7 @@ public class WiredTriggerGameStarts extends InteractionWiredTrigger {
}
@Override
public boolean saveData(WiredSettings settings) {
public boolean saveData(ClientMessage packet) {
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.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -86,8 +85,9 @@ public class WiredTriggerHabboEntersRoom extends InteractionWiredTrigger {
}
@Override
public boolean saveData(WiredSettings settings) {
this.username = settings.getStringParam();
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.username = packet.readString();
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.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -94,10 +93,10 @@ public class WiredTriggerHabboSaysKeyword extends InteractionWiredTrigger {
}
@Override
public boolean saveData(WiredSettings settings) {
if(settings.getIntParams().length < 1) return false;
this.ownerOnly = settings.getIntParams()[0] == 1;
this.key = settings.getStringParam();
public boolean saveData(ClientMessage packet) {
packet.readInt();
this.ownerOnly = packet.readInt() == 1;
this.key = packet.readString();
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.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
@ -129,13 +128,16 @@ public class WiredTriggerHabboWalkOffFurni extends InteractionWiredTrigger {
}
@Override
public boolean saveData(WiredSettings settings) {
public boolean saveData(ClientMessage packet) {
packet.readInt();
packet.readString();
this.items.clear();
int count = settings.getFurniIds().length;
int count = packet.readInt();
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;

View File

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

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

View File

@ -1,13 +1,10 @@
package com.eu.habbo.messages.incoming.wired;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.interactions.InteractionWired;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
import com.eu.habbo.messages.outgoing.wired.WiredSavedComposer;
public class WiredConditionSaveDataEvent extends MessageHandler {
@ -22,16 +19,12 @@ public class WiredConditionSaveDataEvent extends MessageHandler {
InteractionWiredCondition condition = room.getRoomSpecialTypes().getCondition(itemId);
if (condition != null) {
WiredSettings settings = InteractionWired.readSettings(this.packet, false);
if (condition.saveData(settings)) {
if (condition.saveData(this.packet)) {
this.client.sendResponse(new WiredSavedComposer());
condition.needsUpdate(true);
Emulator.getThreading().run(condition);
} else {
this.client.sendResponse(new UpdateFailedComposer("There was an error while saving that condition"));
}
}
}

View File

@ -1,12 +1,11 @@
package com.eu.habbo.messages.incoming.wired;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.interactions.InteractionWired;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.generic.alerts.GenericErrorMessagesComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
import com.eu.habbo.messages.outgoing.wired.WiredSavedComposer;
@ -25,8 +24,7 @@ public class WiredEffectSaveDataEvent extends MessageHandler {
if (effect == null)
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(settings, this.client)) {
if (effect.saveData(this.packet, this.client)) {
this.client.sendResponse(new WiredSavedComposer());
effect.needsUpdate(true);
Emulator.getThreading().run(effect);

View File

@ -1,13 +1,10 @@
package com.eu.habbo.messages.incoming.wired;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.interactions.InteractionWired;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
import com.eu.habbo.messages.outgoing.wired.WiredSavedComposer;
public class WiredTriggerSaveDataEvent extends MessageHandler {
@ -22,16 +19,12 @@ public class WiredTriggerSaveDataEvent extends MessageHandler {
InteractionWiredTrigger trigger = room.getRoomSpecialTypes().getTrigger(itemId);
if (trigger != null) {
WiredSettings settings = InteractionWired.readSettings(this.packet, false);
if (trigger.saveData(settings)) {
if (trigger.saveData(this.packet)) {
this.client.sendResponse(new WiredSavedComposer());
trigger.needsUpdate(true);
Emulator.getThreading().run(trigger);
} else {
this.client.sendResponse(new UpdateFailedComposer("There was an error while saving that trigger"));
}
}
}