mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-22 23:10:52 +01:00
Merge branch 'dev' into 'master'
fixed master and dev changes See merge request morningstar/Arcturus-Community!579
This commit is contained in:
commit
353a01f563
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.eu.habbo</groupId>
|
||||
<artifactId>Habbo</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<version>3.5.1</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
2
sqlupdates/Update 3_5_0 to 3_5_2.sql
Normal file
2
sqlupdates/Update 3_5_0 to 3_5_2.sql
Normal file
@ -0,0 +1,2 @@
|
||||
-- Trade Currency Setting
|
||||
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('redeem.currency.trade', '1');
|
@ -37,13 +37,13 @@ public final class Emulator {
|
||||
|
||||
public final static int MAJOR = 3;
|
||||
public final static int MINOR = 5;
|
||||
public final static int BUILD = 0;
|
||||
public final static int BUILD = 1;
|
||||
public final static String PREVIEW = "";
|
||||
|
||||
public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + " " + PREVIEW;
|
||||
private static final String logo =
|
||||
"\n" +
|
||||
"███╗ ███╗ ██████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ ███████╗████████╗ █████╗ ██████╗ \n" +
|
||||
"███╗ ███╗ ██████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ ███████╗████████╗ █████╗ ██████╗ \n" +
|
||||
"████╗ ████║██╔═══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ ██╔════╝╚══██╔══╝██╔══██╗██╔══██╗\n" +
|
||||
"██╔████╔██║██║ ██║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗███████╗ ██║ ███████║██████╔╝\n" +
|
||||
"██║╚██╔╝██║██║ ██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║╚════██║ ██║ ██╔══██║██╔══██╗\n" +
|
||||
|
@ -2,8 +2,10 @@ package com.eu.habbo.habbohotel.items.interactions;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
|
||||
import gnu.trove.map.hash.TLongLongHashMap;
|
||||
@ -126,4 +128,35 @@ public abstract class InteractionWired extends InteractionDefault {
|
||||
public void addUserExecutionCache(int roomUnitId, long timestamp) {
|
||||
this.userExecutionCache.put((long)roomUnitId, timestamp);
|
||||
}
|
||||
|
||||
public static WiredSettings readSettings(ClientMessage packet, boolean isEffect)
|
||||
{
|
||||
int intParamCount = packet.readInt();
|
||||
int[] intParams = new int[intParamCount];
|
||||
|
||||
for(int i = 0; i < intParamCount; i++)
|
||||
{
|
||||
intParams[i] = packet.readInt();
|
||||
}
|
||||
|
||||
String stringParam = packet.readString();
|
||||
|
||||
int itemCount = packet.readInt();
|
||||
int[] itemIds = new int[itemCount];
|
||||
|
||||
for(int i = 0; i < itemCount; i++)
|
||||
{
|
||||
itemIds[i] = packet.readInt();
|
||||
}
|
||||
|
||||
WiredSettings settings = new WiredSettings(intParams, stringParam, itemIds, -1);
|
||||
|
||||
if(isEffect)
|
||||
{
|
||||
settings.setDelay(packet.readInt());
|
||||
}
|
||||
|
||||
settings.setStuffTypeSelectionCode(packet.readInt());
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,11 @@ package com.eu.habbo.habbohotel.items.interactions;
|
||||
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredConditionOperator;
|
||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.outgoing.wired.WiredConditionDataComposer;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
@ -43,7 +43,7 @@ public abstract class InteractionWiredCondition extends InteractionWired {
|
||||
|
||||
public abstract WiredConditionType getType();
|
||||
|
||||
public abstract boolean saveData(ClientMessage packet);
|
||||
public abstract boolean saveData(WiredSettings settings);
|
||||
|
||||
public WiredConditionOperator operator() {
|
||||
return WiredConditionOperator.AND;
|
||||
|
@ -2,10 +2,10 @@ package com.eu.habbo.habbohotel.items.interactions;
|
||||
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||
import com.eu.habbo.messages.outgoing.wired.WiredEffectDataComposer;
|
||||
|
||||
@ -43,7 +43,7 @@ public abstract class InteractionWiredEffect extends InteractionWired {
|
||||
}
|
||||
}
|
||||
|
||||
public abstract boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException;
|
||||
public abstract boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException;
|
||||
|
||||
public int getDelay() {
|
||||
return this.delay;
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions;
|
||||
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
@ -44,7 +45,7 @@ public abstract class InteractionWiredTrigger extends InteractionWired {
|
||||
|
||||
public abstract WiredTriggerType getType();
|
||||
|
||||
public abstract boolean saveData(ClientMessage packet);
|
||||
public abstract boolean saveData(WiredSettings settings);
|
||||
|
||||
protected int getDelay() {
|
||||
return this.delay;
|
||||
|
@ -0,0 +1,63 @@
|
||||
package com.eu.habbo.habbohotel.items.interactions.wired;
|
||||
|
||||
public class WiredSettings {
|
||||
private int[] intParams;
|
||||
private String stringParam;
|
||||
private int[] furniIds;
|
||||
private int stuffTypeSelectionCode;
|
||||
private int delay;
|
||||
|
||||
public WiredSettings(int[] intParams, String stringParam, int[] furniIds, int stuffTypeSelectionCode, int delay)
|
||||
{
|
||||
this.furniIds = furniIds;
|
||||
this.intParams = intParams;
|
||||
this.stringParam = stringParam;
|
||||
this.stuffTypeSelectionCode = stuffTypeSelectionCode;
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
public WiredSettings(int[] intParams, String stringParam, int[] furniIds, int stuffTypeSelectionCode)
|
||||
{
|
||||
this(intParams, stringParam, furniIds, stuffTypeSelectionCode, 0);
|
||||
}
|
||||
|
||||
public int getStuffTypeSelectionCode() {
|
||||
return stuffTypeSelectionCode;
|
||||
}
|
||||
|
||||
public void setStuffTypeSelectionCode(int stuffTypeSelectionCode) {
|
||||
this.stuffTypeSelectionCode = stuffTypeSelectionCode;
|
||||
}
|
||||
|
||||
public int[] getFurniIds() {
|
||||
return furniIds;
|
||||
}
|
||||
|
||||
public void setFurniIds(int[] furniIds) {
|
||||
this.furniIds = furniIds;
|
||||
}
|
||||
|
||||
public String getStringParam() {
|
||||
return stringParam;
|
||||
}
|
||||
|
||||
public void setStringParam(String stringParam) {
|
||||
this.stringParam = stringParam;
|
||||
}
|
||||
|
||||
public int[] getIntParams() {
|
||||
return intParams;
|
||||
}
|
||||
|
||||
public void setIntParams(int[] intParams) {
|
||||
this.intParams = intParams;
|
||||
}
|
||||
|
||||
public int getDelay() {
|
||||
return delay;
|
||||
}
|
||||
|
||||
public void setDelay(int delay) {
|
||||
this.delay = delay;
|
||||
}
|
||||
}
|
@ -3,12 +3,13 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@ -50,10 +51,10 @@ public class WiredConditionDateRangeActive extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
this.startDate = packet.readInt();
|
||||
this.endDate = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 2) return false;
|
||||
this.startDate = settings.getIntParams()[0];
|
||||
this.endDate = settings.getIntParams()[1];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
@ -136,15 +137,12 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
int count;
|
||||
packet.readInt();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
|
||||
this.all = packet.readInt() == 1;
|
||||
this.all = settings.getIntParams()[0] == 1;
|
||||
|
||||
packet.readString();
|
||||
|
||||
count = packet.readInt();
|
||||
int count = settings.getFurniIds().length;
|
||||
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
||||
|
||||
this.items.clear();
|
||||
@ -153,7 +151,7 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
|
||||
|
||||
if (room != null) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
HabboItem item = room.getHabboItem(packet.readInt());
|
||||
HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
|
||||
|
||||
if (item != null)
|
||||
this.items.add(item);
|
||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.bots.Bot;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.pets.Pet;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
@ -24,8 +25,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
||||
public static final WiredConditionType type = WiredConditionType.FURNI_HAVE_HABBO;
|
||||
|
||||
protected boolean all;
|
||||
protected THashSet<HabboItem> items;
|
||||
|
||||
public WiredConditionFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
|
||||
@ -41,7 +40,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
||||
@Override
|
||||
public void onPickUp() {
|
||||
this.items.clear();
|
||||
this.all = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -67,7 +65,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
||||
public String getWiredData() {
|
||||
this.refresh();
|
||||
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
||||
this.all,
|
||||
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
|
||||
));
|
||||
}
|
||||
@ -79,7 +76,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
||||
|
||||
if (wiredData.startsWith("{")) {
|
||||
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
||||
this.all = data.all;
|
||||
|
||||
for(int id : data.itemIds) {
|
||||
HabboItem item = room.getHabboItem(id);
|
||||
@ -92,17 +88,14 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
||||
String[] data = wiredData.split(":");
|
||||
|
||||
if (data.length >= 1) {
|
||||
this.all = (data[0].equals("1"));
|
||||
|
||||
if (data.length == 2) {
|
||||
String[] items = data[1].split(";");
|
||||
String[] items = data[1].split(";");
|
||||
|
||||
for (String s : items) {
|
||||
HabboItem item = room.getHabboItem(Integer.parseInt(s));
|
||||
for (String s : items) {
|
||||
HabboItem item = room.getHabboItem(Integer.parseInt(s));
|
||||
|
||||
if (item != null)
|
||||
this.items.add(item);
|
||||
}
|
||||
if (item != null)
|
||||
this.items.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -127,8 +120,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
||||
message.appendInt(this.getBaseItem().getSpriteId());
|
||||
message.appendInt(this.getId());
|
||||
message.appendString("");
|
||||
message.appendInt(1);
|
||||
message.appendInt(this.all ? 1 : 0);
|
||||
message.appendInt(0);
|
||||
message.appendInt(0);
|
||||
message.appendInt(this.getType().code);
|
||||
message.appendInt(0);
|
||||
@ -136,13 +128,9 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
int count;
|
||||
packet.readInt();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
int count = settings.getFurniIds().length;
|
||||
|
||||
packet.readString();
|
||||
|
||||
count = packet.readInt();
|
||||
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
||||
|
||||
this.items.clear();
|
||||
@ -151,7 +139,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
||||
|
||||
if (room != null) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
HabboItem item = room.getHabboItem(packet.readInt());
|
||||
HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
|
||||
|
||||
if (item != null)
|
||||
this.items.add(item);
|
||||
@ -182,11 +170,9 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
boolean all;
|
||||
List<Integer> itemIds;
|
||||
|
||||
public JsonData(boolean all, List<Integer> itemIds) {
|
||||
this.all = all;
|
||||
public JsonData(List<Integer> itemIds) {
|
||||
this.itemIds = itemIds;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -117,11 +118,8 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
|
||||
int count = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
int count = settings.getFurniIds().length;
|
||||
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
||||
|
||||
this.items.clear();
|
||||
@ -130,7 +128,7 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
|
||||
|
||||
if (room != null) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.items.add(room.getHabboItem(packet.readInt()));
|
||||
this.items.add(room.getHabboItem(settings.getFurniIds()[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -69,7 +70,7 @@ public class WiredConditionGroupMember extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||
@ -86,11 +87,10 @@ public class WiredConditionHabboCount extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.lowerLimit = packet.readInt();
|
||||
this.upperLimit = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 2) return false;
|
||||
this.lowerLimit = settings.getIntParams()[0];
|
||||
this.upperLimit = settings.getIntParams()[1];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||
@ -76,10 +77,9 @@ public class WiredConditionHabboHasEffect extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.effectId = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
this.effectId = settings.getIntParams()[0];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||
@ -51,10 +52,9 @@ public class WiredConditionHabboHasHandItem extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.handItem = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
this.handItem = settings.getIntParams()[0];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -88,10 +89,8 @@ public class WiredConditionHabboWearsBadge extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.badge = packet.readString();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
this.badge = settings.getStringParam();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||
@ -81,11 +82,9 @@ public class WiredConditionLessTimeElapsed extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.cycles = packet.readInt();
|
||||
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
this.cycles = settings.getIntParams()[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
@ -69,28 +70,24 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
int count;
|
||||
packet.readInt();
|
||||
|
||||
this.state = packet.readInt() == 1;
|
||||
this.direction = packet.readInt() == 1;
|
||||
this.position = packet.readInt() == 1;
|
||||
|
||||
packet.readString();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 3) return false;
|
||||
this.state = settings.getIntParams()[0] == 1;
|
||||
this.direction = settings.getIntParams()[1] == 1;
|
||||
this.position = settings.getIntParams()[2] == 1;
|
||||
|
||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
|
||||
|
||||
if (room == null)
|
||||
return true;
|
||||
|
||||
count = packet.readInt();
|
||||
int count = settings.getFurniIds().length;
|
||||
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
||||
|
||||
this.settings.clear();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
int itemId = packet.readInt();
|
||||
int itemId = settings.getFurniIds()[i];
|
||||
HabboItem item = room.getHabboItem(itemId);
|
||||
|
||||
if (item != null)
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||
@ -81,11 +82,9 @@ public class WiredConditionMoreTimeElapsed extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.cycles = packet.readInt();
|
||||
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
this.cycles = settings.getIntParams()[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
@ -137,14 +138,11 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
this.all = settings.getIntParams()[0] == 1;
|
||||
|
||||
this.all = packet.readInt() == 1;
|
||||
|
||||
packet.readString();
|
||||
|
||||
int count = packet.readInt();
|
||||
int count = settings.getFurniIds().length;
|
||||
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
||||
|
||||
this.items.clear();
|
||||
@ -153,7 +151,7 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
|
||||
|
||||
if (room != null) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
HabboItem item = room.getHabboItem(packet.readInt());
|
||||
HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
|
||||
|
||||
if (item != null)
|
||||
this.items.add(item);
|
||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.bots.Bot;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.pets.Pet;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
@ -24,8 +25,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
||||
public static final WiredConditionType type = WiredConditionType.NOT_FURNI_HAVE_HABBO;
|
||||
|
||||
protected boolean all;
|
||||
|
||||
protected THashSet<HabboItem> items;
|
||||
|
||||
public WiredConditionNotFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
|
||||
@ -41,7 +41,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
||||
@Override
|
||||
public void onPickUp() {
|
||||
this.items.clear();
|
||||
this.all = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -67,7 +66,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
||||
public String getWiredData() {
|
||||
this.refresh();
|
||||
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
||||
this.all,
|
||||
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
|
||||
));
|
||||
}
|
||||
@ -79,7 +77,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
||||
|
||||
if (wiredData.startsWith("{")) {
|
||||
WiredConditionFurniHaveHabbo.JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, WiredConditionFurniHaveHabbo.JsonData.class);
|
||||
this.all = data.all;
|
||||
|
||||
for(int id : data.itemIds) {
|
||||
HabboItem item = room.getHabboItem(id);
|
||||
@ -92,17 +89,13 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
||||
String[] data = wiredData.split(":");
|
||||
|
||||
if (data.length >= 1) {
|
||||
this.all = (data[0].equals("1"));
|
||||
String[] items = data[1].split(";");
|
||||
|
||||
if (data.length == 2) {
|
||||
String[] items = data[1].split(";");
|
||||
for (String s : items) {
|
||||
HabboItem item = room.getHabboItem(Integer.parseInt(s));
|
||||
|
||||
for (String s : items) {
|
||||
HabboItem item = room.getHabboItem(Integer.parseInt(s));
|
||||
|
||||
if (item != null)
|
||||
this.items.add(item);
|
||||
}
|
||||
if (item != null)
|
||||
this.items.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -127,8 +120,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
||||
message.appendInt(this.getBaseItem().getSpriteId());
|
||||
message.appendInt(this.getId());
|
||||
message.appendString("");
|
||||
message.appendInt(1);
|
||||
message.appendInt(this.all ? 1 : 0);
|
||||
message.appendInt(0);
|
||||
message.appendInt(0);
|
||||
message.appendInt(this.getType().code);
|
||||
message.appendInt(0);
|
||||
@ -136,12 +128,8 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
packet.readString();
|
||||
|
||||
int count = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
int count = settings.getFurniIds().length;
|
||||
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
||||
|
||||
this.items.clear();
|
||||
@ -150,7 +138,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
||||
|
||||
if (room != null) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
HabboItem item = room.getHabboItem(packet.readInt());
|
||||
HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
|
||||
|
||||
if (item != null)
|
||||
this.items.add(item);
|
||||
@ -181,11 +169,9 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
boolean all;
|
||||
List<Integer> itemIds;
|
||||
|
||||
public JsonData(boolean all, List<Integer> itemIds) {
|
||||
this.all = all;
|
||||
public JsonData(List<Integer> itemIds) {
|
||||
this.itemIds = itemIds;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -117,11 +118,8 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
|
||||
int count = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
int count = settings.getFurniIds().length;
|
||||
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
||||
|
||||
this.items.clear();
|
||||
@ -130,7 +128,7 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
|
||||
|
||||
if (room != null) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.items.add(room.getHabboItem(packet.readInt()));
|
||||
this.items.add(room.getHabboItem(settings.getFurniIds()[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||
@ -85,11 +86,10 @@ public class WiredConditionNotHabboCount extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.lowerLimit = packet.readInt();
|
||||
this.upperLimit = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 2) return false;
|
||||
this.lowerLimit = settings.getIntParams()[0];
|
||||
this.upperLimit = settings.getIntParams()[1];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||
@ -76,10 +77,9 @@ public class WiredConditionNotHabboHasEffect extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.effectId = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
this.effectId = settings.getIntParams()[0];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -89,10 +90,8 @@ public class WiredConditionNotHabboWearsBadge extends InteractionWiredCondition
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.badge = packet.readString();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
this.badge = settings.getStringParam();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -69,7 +70,7 @@ public class WiredConditionNotInGroup extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -89,10 +90,9 @@ public class WiredConditionNotInTeam extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.teamColor = GameTeamColors.values()[packet.readInt()];
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
this.teamColor = GameTeamColors.values()[settings.getIntParams()[0]];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -91,10 +92,9 @@ public class WiredConditionTeamMember extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.teamColor = GameTeamColors.values()[packet.readInt()];
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
this.teamColor = GameTeamColors.values()[settings.getIntParams()[0]];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
@ -118,11 +119,8 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
|
||||
int count = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
int count = settings.getFurniIds().length;
|
||||
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
||||
|
||||
this.items.clear();
|
||||
@ -131,7 +129,7 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
|
||||
|
||||
if (room != null) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
HabboItem item = room.getHabboItem(packet.readInt());
|
||||
HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
|
||||
|
||||
if (item != null) {
|
||||
this.items.add(item);
|
||||
|
@ -5,14 +5,13 @@ import com.eu.habbo.habbohotel.bots.Bot;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@ -49,11 +48,9 @@ public class WiredEffectBotClothes extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
String dataString = packet.readString();
|
||||
packet.readInt();
|
||||
int delay = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
String dataString = settings.getStringParam();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -6,12 +6,12 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||
import gnu.trove.procedure.TObjectProcedure;
|
||||
@ -70,17 +70,18 @@ public class WiredEffectBotFollowHabbo extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
int mode = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
if(settings.getIntParams().length < 1) throw new WiredSaveException("Mode is invalid");
|
||||
|
||||
int mode = settings.getIntParams()[0];
|
||||
|
||||
if(mode != 0 && mode != 1)
|
||||
throw new WiredSaveException("Mode is invalid");
|
||||
|
||||
String botName = packet.readString().replace("\t", "");
|
||||
String botName = settings.getStringParam().replace("\t", "");
|
||||
botName = botName.substring(0, Math.min(botName.length(), Emulator.getConfig().getInt("hotel.wired.message.max_length", 100)));
|
||||
packet.readInt();
|
||||
int delay = packet.readInt();
|
||||
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
@ -13,7 +14,6 @@ import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||
import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
|
||||
@ -74,17 +74,17 @@ public class WiredEffectBotGiveHandItem extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
if(settings.getIntParams().length < 1) throw new WiredSaveException("Missing item id");
|
||||
|
||||
int itemId = packet.readInt();
|
||||
int itemId = settings.getIntParams()[0];
|
||||
|
||||
if(itemId < 0)
|
||||
itemId = 0;
|
||||
|
||||
String botName = packet.readString();
|
||||
packet.readInt();
|
||||
int delay = packet.readInt();
|
||||
String botName = settings.getStringParam();
|
||||
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -5,13 +5,13 @@ import com.eu.habbo.habbohotel.bots.Bot;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||
|
||||
@ -52,15 +52,14 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
|
||||
int mode = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
if(settings.getIntParams().length < 1) throw new WiredSaveException("Mode is invalid");
|
||||
int mode = settings.getIntParams()[0];
|
||||
|
||||
if(mode != 0 && mode != 1)
|
||||
throw new WiredSaveException("Mode is invalid");
|
||||
|
||||
String dataString = packet.readString();
|
||||
String dataString = settings.getStringParam();
|
||||
|
||||
String splitBy = "\t";
|
||||
if(!dataString.contains(splitBy))
|
||||
@ -71,8 +70,7 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
|
||||
if (data.length != 2)
|
||||
throw new WiredSaveException("Malformed data string. Invalid data length");
|
||||
|
||||
packet.readInt();
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -6,13 +6,13 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||
import gnu.trove.procedure.TObjectProcedure;
|
||||
@ -73,15 +73,14 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
|
||||
int mode = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
if(settings.getIntParams().length < 1) throw new WiredSaveException("Missing mode");
|
||||
int mode = settings.getIntParams()[0];
|
||||
|
||||
if(mode != 0 && mode != 1)
|
||||
throw new WiredSaveException("Mode is invalid");
|
||||
|
||||
String dataString = packet.readString();
|
||||
String dataString = settings.getStringParam();
|
||||
String splitBy = "\t";
|
||||
if(!dataString.contains(splitBy))
|
||||
throw new WiredSaveException("Malformed data string");
|
||||
@ -91,8 +90,7 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
|
||||
if (data.length != 2)
|
||||
throw new WiredSaveException("Malformed data string. Invalid data length");
|
||||
|
||||
packet.readInt();
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.bots.Bot;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTileState;
|
||||
@ -114,10 +115,9 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
String botName = packet.readString();
|
||||
int itemsCount = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
String botName = settings.getStringParam();
|
||||
int itemsCount = settings.getFurniIds().length;
|
||||
|
||||
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
|
||||
throw new WiredSaveException("Too many furni selected");
|
||||
@ -126,7 +126,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
|
||||
List<HabboItem> newItems = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < itemsCount; i++) {
|
||||
int itemId = packet.readInt();
|
||||
int itemId = settings.getFurniIds()[i];
|
||||
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
|
||||
|
||||
if(it == null)
|
||||
@ -135,7 +135,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
|
||||
newItems.add(it);
|
||||
}
|
||||
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.bots.Bot;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -67,10 +68,9 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
String botName = packet.readString();
|
||||
int itemsCount = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
String botName = settings.getStringParam();
|
||||
int itemsCount = settings.getFurniIds().length;
|
||||
|
||||
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
|
||||
throw new WiredSaveException("Too many furni selected");
|
||||
@ -79,7 +79,7 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
|
||||
List<HabboItem> newItems = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < itemsCount; i++) {
|
||||
int itemId = packet.readInt();
|
||||
int itemId = settings.getFurniIds()[i];
|
||||
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
|
||||
|
||||
if(it == null)
|
||||
@ -88,7 +88,7 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
|
||||
newItems.add(it);
|
||||
}
|
||||
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.*;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.habbohotel.wired.*;
|
||||
@ -210,9 +211,10 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
int startDirectionInt = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
if(settings.getIntParams().length < 2) throw new WiredSaveException("Invalid data");
|
||||
|
||||
int startDirectionInt = settings.getIntParams()[0];
|
||||
|
||||
if(startDirectionInt < 0 || startDirectionInt > 7 || (startDirectionInt % 2) != 0) {
|
||||
throw new WiredSaveException("Start direction is invalid");
|
||||
@ -220,15 +222,13 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
|
||||
|
||||
RoomUserRotation startDirection = RoomUserRotation.fromValue(startDirectionInt);
|
||||
|
||||
int blockedActionInt = packet.readInt();
|
||||
int blockedActionInt = settings.getIntParams()[1];
|
||||
|
||||
if(blockedActionInt < 0 || blockedActionInt > 6) {
|
||||
throw new WiredSaveException("Blocked action is invalid");
|
||||
}
|
||||
|
||||
packet.readString();
|
||||
|
||||
int itemsCount = packet.readInt();
|
||||
int itemsCount = settings.getFurniIds().length;
|
||||
|
||||
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
|
||||
throw new WiredSaveException("Too many furni selected");
|
||||
@ -237,7 +237,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
|
||||
THashMap<HabboItem, WiredChangeDirectionSetting> newItems = new THashMap<>();
|
||||
|
||||
for (int i = 0; i < itemsCount; i++) {
|
||||
int itemId = packet.readInt();
|
||||
int itemId = settings.getFurniIds()[i];
|
||||
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
|
||||
|
||||
if(it == null)
|
||||
@ -246,7 +246,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
|
||||
newItems.put(it, new WiredChangeDirectionSetting(it.getId(), it.getRotation(), startDirection));
|
||||
}
|
||||
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -67,17 +68,14 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) {
|
||||
packet.readInt();
|
||||
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) {
|
||||
try {
|
||||
this.amount = Integer.parseInt(packet.readString());
|
||||
this.amount = Integer.parseInt(settings.getStringParam());
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
packet.readInt();
|
||||
this.setDelay(packet.readInt());
|
||||
this.setDelay(settings.getDelay());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -66,16 +67,14 @@ public class WiredEffectGiveHotelviewHofPoints extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) {
|
||||
packet.readInt();
|
||||
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) {
|
||||
try {
|
||||
this.amount = Integer.valueOf(packet.readString());
|
||||
this.amount = Integer.parseInt(settings.getStringParam());
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
packet.readInt();
|
||||
this.setDelay(packet.readInt());
|
||||
|
||||
this.setDelay(settings.getDelay());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -67,17 +68,14 @@ public class WiredEffectGiveRespect extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) {
|
||||
packet.readInt();
|
||||
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) {
|
||||
try {
|
||||
this.respects = Integer.valueOf(packet.readString());
|
||||
this.respects = Integer.parseInt(settings.getStringParam());
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
packet.readInt();
|
||||
this.setDelay(packet.readInt());
|
||||
this.setDelay(settings.getDelay());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
@ -15,6 +16,7 @@ import com.eu.habbo.habbohotel.wired.WiredGiveRewardItem;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||
import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
|
||||
import gnu.trove.procedure.TObjectProcedure;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
@ -174,16 +176,16 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) {
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
if (gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) {
|
||||
int argsLength = packet.readInt();
|
||||
this.rewardTime = packet.readInt();
|
||||
this.uniqueRewards = packet.readInt() == 1;
|
||||
this.limit = packet.readInt();
|
||||
this.limitationInterval = packet.readInt();
|
||||
if(settings.getIntParams().length < 4) throw new WiredSaveException("Invalid data");
|
||||
this.rewardTime = settings.getIntParams()[0];
|
||||
this.uniqueRewards = settings.getIntParams()[1] == 1;
|
||||
this.limit = settings.getIntParams()[2];
|
||||
this.limitationInterval = settings.getIntParams()[3];
|
||||
this.given = 0;
|
||||
|
||||
String data = packet.readString();
|
||||
String data = settings.getStringParam();
|
||||
|
||||
String[] items = data.split(";");
|
||||
|
||||
@ -204,8 +206,7 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
|
||||
return false;
|
||||
}
|
||||
|
||||
packet.readInt();
|
||||
this.setDelay(packet.readInt());
|
||||
this.setDelay(settings.getDelay());
|
||||
|
||||
WiredHandler.dropRewards(this.getId());
|
||||
return true;
|
||||
|
@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.games.Game;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -172,23 +173,20 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
if(settings.getIntParams().length < 2) throw new WiredSaveException("Invalid data");
|
||||
|
||||
int score = packet.readInt();
|
||||
int score = settings.getIntParams()[0];
|
||||
|
||||
if(score < 1 || score > 100)
|
||||
throw new WiredSaveException("Score is invalid");
|
||||
|
||||
int timesPerGame = packet.readInt();
|
||||
int timesPerGame = settings.getIntParams()[1];
|
||||
|
||||
if(timesPerGame < 1 || timesPerGame > 10)
|
||||
throw new WiredSaveException("Times per game is invalid");
|
||||
|
||||
packet.readString();
|
||||
packet.readInt();
|
||||
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.games.GameTeam;
|
||||
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||
@ -121,28 +122,25 @@ public class WiredEffectGiveScoreToTeam extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
if(settings.getIntParams().length < 3) throw new WiredSaveException("Invalid data");
|
||||
|
||||
int points = packet.readInt();
|
||||
int points = settings.getIntParams()[0];
|
||||
|
||||
if(points < 1 || points > 100)
|
||||
throw new WiredSaveException("Points is invalid");
|
||||
|
||||
int timesPerGame = packet.readInt();
|
||||
int timesPerGame = settings.getIntParams()[1];
|
||||
|
||||
if(timesPerGame < 1 || timesPerGame > 10)
|
||||
throw new WiredSaveException("Times per game is invalid");
|
||||
|
||||
int team = packet.readInt();
|
||||
int team = settings.getIntParams()[2];
|
||||
|
||||
if(team < 1 || team > 4)
|
||||
throw new WiredSaveException("Team is invalid");
|
||||
|
||||
packet.readString();
|
||||
packet.readInt();
|
||||
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.games.wired.WiredGame;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -134,16 +135,15 @@ public class WiredEffectJoinTeam extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
int team = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
if(settings.getIntParams().length < 1) throw new WiredSaveException("invalid data");
|
||||
|
||||
int team = settings.getIntParams()[0];
|
||||
|
||||
if(team < 1 || team > 4)
|
||||
throw new WiredSaveException("Team is invalid");
|
||||
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
|
||||
@ -148,11 +149,9 @@ public class WiredEffectKickHabbo extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
String message = packet.readString();
|
||||
packet.readInt();
|
||||
int delay = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
String message = settings.getStringParam();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.games.wired.WiredGame;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -116,11 +117,8 @@ public class WiredEffectLeaveTeam extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
packet.readInt();
|
||||
int delay = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.*;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -175,21 +176,18 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
|
||||
boolean setState = packet.readInt() == 1;
|
||||
boolean setDirection = packet.readInt() == 1;
|
||||
boolean setPosition = packet.readInt() == 1;
|
||||
|
||||
packet.readString();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
if(settings.getIntParams().length < 3) throw new WiredSaveException("Invalid data");
|
||||
boolean setState = settings.getIntParams()[0] == 1;
|
||||
boolean setDirection = settings.getIntParams()[1] == 1;
|
||||
boolean setPosition = settings.getIntParams()[2] == 1;
|
||||
|
||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
|
||||
|
||||
if (room == null)
|
||||
throw new WiredSaveException("Trying to save wired in unloaded room");
|
||||
|
||||
int itemsCount = packet.readInt();
|
||||
int itemsCount = settings.getFurniIds().length;
|
||||
|
||||
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
|
||||
throw new WiredSaveException("Too many furni selected");
|
||||
@ -198,7 +196,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
|
||||
List<WiredMatchFurniSetting> newSettings = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < itemsCount; i++) {
|
||||
int itemId = packet.readInt();
|
||||
int itemId = settings.getFurniIds()[i];
|
||||
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
|
||||
|
||||
if(it == null)
|
||||
@ -207,7 +205,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
|
||||
newSettings.add(new WiredMatchFurniSetting(it.getId(), this.checkForWiredResetPermission && it.allowWiredResetState() ? it.getExtradata() : " ", it.getRotation(), it.getX(), it.getY()));
|
||||
}
|
||||
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.*;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -178,10 +179,8 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
int itemsCount = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
int itemsCount = settings.getFurniIds().length;
|
||||
|
||||
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
|
||||
throw new WiredSaveException("Too many furni selected");
|
||||
@ -190,7 +189,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
|
||||
List<HabboItem> newItems = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < itemsCount; i++) {
|
||||
int itemId = packet.readInt();
|
||||
int itemId = settings.getFurniIds()[i];
|
||||
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
|
||||
|
||||
if(it == null)
|
||||
@ -199,7 +198,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
|
||||
newItems.add(it);
|
||||
}
|
||||
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
@ -12,6 +13,7 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
|
||||
@ -39,7 +41,7 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) {
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
|
||||
|
||||
if (room == null)
|
||||
@ -48,18 +50,16 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect {
|
||||
this.items.clear();
|
||||
this.indexOffset.clear();
|
||||
|
||||
packet.readInt();
|
||||
if(settings.getIntParams().length < 2) throw new WiredSaveException("invalid data");
|
||||
this.direction = settings.getIntParams()[0];
|
||||
this.spacing = settings.getIntParams()[1];
|
||||
|
||||
this.direction = packet.readInt();
|
||||
this.spacing = packet.readInt();
|
||||
packet.readString();
|
||||
|
||||
int count = packet.readInt();
|
||||
int count = settings.getFurniIds().length;
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.items.add(room.getHabboItem(packet.readInt()));
|
||||
this.items.add(room.getHabboItem(settings.getFurniIds()[i]));
|
||||
}
|
||||
|
||||
this.setDelay(packet.readInt());
|
||||
this.setDelay(settings.getDelay());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.*;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -314,11 +315,8 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
|
||||
int itemsCount = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
int itemsCount = settings.getFurniIds().length;
|
||||
|
||||
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
|
||||
throw new WiredSaveException("Too many furni selected");
|
||||
@ -327,7 +325,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
|
||||
List<HabboItem> newItems = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < itemsCount; i++) {
|
||||
int itemId = packet.readInt();
|
||||
int itemId = settings.getFurniIds()[i];
|
||||
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
|
||||
|
||||
if(it == null)
|
||||
@ -336,7 +334,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
|
||||
newItems.add(it);
|
||||
}
|
||||
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -5,12 +5,14 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.ICycleable;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.*;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
import org.slf4j.Logger;
|
||||
@ -185,28 +187,26 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) {
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
|
||||
|
||||
if (room == null)
|
||||
return false;
|
||||
|
||||
packet.readInt();
|
||||
if(settings.getIntParams().length < 2) throw new WiredSaveException("invalid data");
|
||||
|
||||
this.direction = packet.readInt();
|
||||
this.rotation = packet.readInt();
|
||||
this.direction = settings.getIntParams()[0];
|
||||
this.rotation = settings.getIntParams()[1];
|
||||
|
||||
packet.readString();
|
||||
|
||||
int count = packet.readInt();
|
||||
int count = settings.getFurniIds().length;
|
||||
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count", 5)) return false;
|
||||
|
||||
this.items.clear();
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.items.add(room.getHabboItem(packet.readInt()));
|
||||
this.items.add(room.getHabboItem(settings.getFurniIds()[i]));
|
||||
}
|
||||
|
||||
this.setDelay(packet.readInt());
|
||||
this.setDelay(settings.getDelay());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
@ -13,6 +14,7 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
@ -49,12 +51,13 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) {
|
||||
packet.readInt();
|
||||
this.length = packet.readInt();
|
||||
this.message = packet.readString();
|
||||
packet.readInt();
|
||||
this.setDelay(packet.readInt());
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
if(settings.getIntParams().length < 1) throw new WiredSaveException("invalid data");
|
||||
|
||||
this.length = settings.getIntParams()[0];
|
||||
this.message = settings.getStringParam();
|
||||
|
||||
this.setDelay(settings.getDelay());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||
@ -67,13 +68,8 @@ public class WiredEffectResetTimers extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) {
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
packet.readInt();
|
||||
this.delay = packet.readInt();
|
||||
this.setDelay(this.delay);
|
||||
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) {
|
||||
this.setDelay(settings.getDelay());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTileState;
|
||||
@ -130,11 +131,8 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
|
||||
int itemsCount = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
int itemsCount = settings.getFurniIds().length;
|
||||
|
||||
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
|
||||
throw new WiredSaveException("Too many furni selected");
|
||||
@ -143,7 +141,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
|
||||
List<HabboItem> newItems = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < itemsCount; i++) {
|
||||
int itemId = packet.readInt();
|
||||
int itemId = settings.getFurniIds()[i];
|
||||
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
|
||||
|
||||
if(it == null)
|
||||
@ -152,7 +150,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
|
||||
newItems.add(it);
|
||||
}
|
||||
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -17,6 +17,7 @@ import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreeze
|
||||
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField;
|
||||
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole;
|
||||
import com.eu.habbo.habbohotel.items.interactions.pets.*;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -142,11 +143,8 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
|
||||
int itemsCount = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
int itemsCount = settings.getFurniIds().length;
|
||||
|
||||
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
|
||||
throw new WiredSaveException("Too many furni selected");
|
||||
@ -155,7 +153,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
|
||||
List<HabboItem> newItems = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < itemsCount; i++) {
|
||||
int itemId = packet.readInt();
|
||||
int itemId = settings.getFurniIds()[i];
|
||||
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
|
||||
|
||||
if(it == null)
|
||||
@ -164,7 +162,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
|
||||
newItems.add(it);
|
||||
}
|
||||
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -15,6 +15,7 @@ import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreeze
|
||||
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField;
|
||||
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole;
|
||||
import com.eu.habbo.habbohotel.items.interactions.pets.*;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -137,11 +138,8 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
|
||||
int itemsCount = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
int itemsCount = settings.getFurniIds().length;
|
||||
|
||||
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
|
||||
throw new WiredSaveException("Too many furni selected");
|
||||
@ -150,7 +148,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
|
||||
List<HabboItem> newItems = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < itemsCount; i++) {
|
||||
int itemId = packet.readInt();
|
||||
int itemId = settings.getFurniIds()[i];
|
||||
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
|
||||
|
||||
if(it == null)
|
||||
@ -159,7 +157,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
|
||||
newItems.add(it);
|
||||
}
|
||||
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
@ -85,11 +86,8 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
|
||||
int itemsCount = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
int itemsCount = settings.getFurniIds().length;
|
||||
|
||||
if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) {
|
||||
throw new WiredSaveException("Too many furni selected");
|
||||
@ -98,7 +96,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
|
||||
List<HabboItem> newItems = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < itemsCount; i++) {
|
||||
int itemId = packet.readInt();
|
||||
int itemId = settings.getFurniIds()[i];
|
||||
HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId);
|
||||
|
||||
if(it == null)
|
||||
@ -107,7 +105,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
|
||||
newItems.add(it);
|
||||
}
|
||||
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -5,14 +5,13 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.*;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.wired.WiredChangeDirectionSetting;
|
||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
|
||||
@ -70,19 +69,15 @@ public class WiredEffectWhisper extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException {
|
||||
packet.readInt();
|
||||
|
||||
String message = packet.readString();
|
||||
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||
String message = settings.getStringParam();
|
||||
|
||||
if(gameClient.getHabbo() == null || !gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) {
|
||||
message = Emulator.getGameEnvironment().getWordFilter().filter(message, null);
|
||||
message = message.substring(0, Math.min(message.length(), Emulator.getConfig().getInt("hotel.wired.message.max_length", 100)));
|
||||
}
|
||||
|
||||
packet.readInt();
|
||||
|
||||
int delay = packet.readInt();
|
||||
int delay = settings.getDelay();
|
||||
|
||||
if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20))
|
||||
throw new WiredSaveException("Delay too long");
|
||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
@ -110,9 +111,9 @@ public class WiredTriggerAtSetTime extends InteractionWiredTrigger implements Wi
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
this.executeTime = packet.readInt() * 500;
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
this.executeTime = settings.getIntParams()[0] * 500;
|
||||
|
||||
this.resetTimer();
|
||||
|
||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
@ -109,10 +110,9 @@ public class WiredTriggerAtTimeLong extends InteractionWiredTrigger implements W
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.executeTime = packet.readInt() * 500;
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
this.executeTime = settings.getIntParams()[0] * 500;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.bots.Bot;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -97,17 +98,15 @@ public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.botName = packet.readString();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
this.botName = settings.getStringParam();
|
||||
|
||||
this.items.clear();
|
||||
|
||||
int count = packet.readInt();
|
||||
int count = settings.getFurniIds().length;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
|
||||
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i]));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
import com.eu.habbo.habbohotel.bots.Bot;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
@ -48,10 +49,8 @@ public class WiredTriggerBotReachedHabbo extends InteractionWiredTrigger {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.botName = packet.readString();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
this.botName = settings.getStringParam();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -65,7 +66,7 @@ public class WiredTriggerCollision extends InteractionWiredTrigger {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -135,16 +136,13 @@ public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
this.items.clear();
|
||||
|
||||
int count = packet.readInt();
|
||||
int count = settings.getFurniIds().length;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
|
||||
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i]));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
@ -83,7 +84,7 @@ public class WiredTriggerGameEnds extends InteractionWiredTrigger {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
@ -83,7 +84,7 @@ public class WiredTriggerGameStarts extends InteractionWiredTrigger {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -85,9 +86,8 @@ public class WiredTriggerHabboEntersRoom extends InteractionWiredTrigger {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
this.username = packet.readString();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
this.username = settings.getStringParam();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -93,10 +94,10 @@ public class WiredTriggerHabboSaysKeyword extends InteractionWiredTrigger {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
this.ownerOnly = packet.readInt() == 1;
|
||||
this.key = packet.readString();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
this.ownerOnly = settings.getIntParams()[0] == 1;
|
||||
this.key = settings.getStringParam();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -128,16 +129,13 @@ public class WiredTriggerHabboWalkOffFurni extends InteractionWiredTrigger {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
this.items.clear();
|
||||
|
||||
int count = packet.readInt();
|
||||
int count = settings.getFurniIds().length;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
|
||||
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i]));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -82,16 +83,13 @@ public class WiredTriggerHabboWalkOnFurni extends InteractionWiredTrigger {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
packet.readString();
|
||||
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
this.items.clear();
|
||||
|
||||
int count = packet.readInt();
|
||||
int count = settings.getFurniIds().length;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));
|
||||
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i]));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.ICycleable;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
@ -109,10 +110,9 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICy
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.repeatTime = packet.readInt() * 500;
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
this.repeatTime = settings.getIntParams()[0] * 500;
|
||||
this.counter = 0;
|
||||
|
||||
if (this.repeatTime < 500) {
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.ICycleable;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
@ -107,10 +108,9 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.repeatTime = packet.readInt() * 5000;
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
this.repeatTime = settings.getIntParams()[0] * 5000;
|
||||
this.counter = 0;
|
||||
return true;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
@ -85,9 +86,9 @@ public class WiredTriggerScoreAchieved extends InteractionWiredTrigger {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
this.score = packet.readInt();
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if(settings.getIntParams().length < 1) return false;
|
||||
this.score = settings.getIntParams()[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -328,6 +328,8 @@ public class RoomTrade {
|
||||
}
|
||||
|
||||
public static int getCreditsByItem(HabboItem item) {
|
||||
if (!Emulator.getConfig().getBoolean("redeem.currency.trade")) return 0;
|
||||
|
||||
if (!item.getBaseItem().getName().startsWith("CF_") && !item.getBaseItem().getName().startsWith("CFC_")) return 0;
|
||||
|
||||
try {
|
||||
|
@ -1,12 +1,19 @@
|
||||
package com.eu.habbo.messages.incoming.wired;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWired;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
|
||||
import com.eu.habbo.messages.outgoing.wired.WiredSavedComposer;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
public class WiredConditionSaveDataEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
@ -19,13 +26,35 @@ public class WiredConditionSaveDataEvent extends MessageHandler {
|
||||
InteractionWiredCondition condition = room.getRoomSpecialTypes().getCondition(itemId);
|
||||
|
||||
if (condition != null) {
|
||||
if (condition.saveData(this.packet)) {
|
||||
this.client.sendResponse(new WiredSavedComposer());
|
||||
|
||||
condition.needsUpdate(true);
|
||||
Optional<Method> saveMethod = Arrays.stream(condition.getClass().getMethods()).filter(x -> x.getName().equals("saveData")).findFirst();
|
||||
|
||||
Emulator.getThreading().run(condition);
|
||||
if(saveMethod.isPresent()) {
|
||||
if (saveMethod.get().getParameterTypes()[0] == WiredSettings.class) {
|
||||
WiredSettings settings = InteractionWired.readSettings(this.packet, false);
|
||||
|
||||
if (condition.saveData(settings)) {
|
||||
this.client.sendResponse(new WiredSavedComposer());
|
||||
|
||||
condition.needsUpdate(true);
|
||||
|
||||
Emulator.getThreading().run(condition);
|
||||
} else {
|
||||
this.client.sendResponse(new UpdateFailedComposer("There was an error while saving that condition"));
|
||||
}
|
||||
} else {
|
||||
if ((boolean) saveMethod.get().invoke(condition, this.packet)) {
|
||||
this.client.sendResponse(new WiredSavedComposer());
|
||||
condition.needsUpdate(true);
|
||||
Emulator.getThreading().run(condition);
|
||||
} else {
|
||||
this.client.sendResponse(new UpdateFailedComposer("There was an error while saving that condition"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.client.sendResponse(new UpdateFailedComposer("Save method was not found"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,19 @@
|
||||
package com.eu.habbo.messages.incoming.wired;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWired;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.generic.alerts.GenericErrorMessagesComposer;
|
||||
import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
|
||||
import com.eu.habbo.messages.outgoing.wired.WiredSavedComposer;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
public class WiredEffectSaveDataEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
@ -24,11 +29,29 @@ public class WiredEffectSaveDataEvent extends MessageHandler {
|
||||
if (effect == null)
|
||||
throw new WiredSaveException(String.format("Wired effect with item id %s not found in room", itemId));
|
||||
|
||||
if (effect.saveData(this.packet, this.client)) {
|
||||
this.client.sendResponse(new WiredSavedComposer());
|
||||
effect.needsUpdate(true);
|
||||
Emulator.getThreading().run(effect);
|
||||
Optional<Method> saveMethod = Arrays.stream(effect.getClass().getMethods()).filter(x -> x.getName().equals("saveData")).findFirst();
|
||||
|
||||
if(saveMethod.isPresent()) {
|
||||
if(saveMethod.get().getParameterTypes()[0] == WiredSettings.class) {
|
||||
WiredSettings settings = InteractionWired.readSettings(this.packet, true);
|
||||
if (effect.saveData(settings, this.client)) {
|
||||
this.client.sendResponse(new WiredSavedComposer());
|
||||
effect.needsUpdate(true);
|
||||
Emulator.getThreading().run(effect);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((boolean) saveMethod.get().invoke(effect, this.packet, this.client)) {
|
||||
this.client.sendResponse(new WiredSavedComposer());
|
||||
effect.needsUpdate(true);
|
||||
Emulator.getThreading().run(effect);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.client.sendResponse(new UpdateFailedComposer("Save method was not found"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (WiredSaveException e) {
|
||||
this.client.sendResponse(new UpdateFailedComposer(e.getMessage()));
|
||||
|
@ -1,12 +1,19 @@
|
||||
package com.eu.habbo.messages.incoming.wired;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWired;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
|
||||
import com.eu.habbo.messages.outgoing.wired.WiredSavedComposer;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
public class WiredTriggerSaveDataEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
@ -19,12 +26,34 @@ public class WiredTriggerSaveDataEvent extends MessageHandler {
|
||||
InteractionWiredTrigger trigger = room.getRoomSpecialTypes().getTrigger(itemId);
|
||||
|
||||
if (trigger != null) {
|
||||
if (trigger.saveData(this.packet)) {
|
||||
this.client.sendResponse(new WiredSavedComposer());
|
||||
|
||||
trigger.needsUpdate(true);
|
||||
Optional<Method> saveMethod = Arrays.stream(trigger.getClass().getMethods()).filter(x -> x.getName().equals("saveData")).findFirst();
|
||||
|
||||
Emulator.getThreading().run(trigger);
|
||||
if(saveMethod.isPresent()) {
|
||||
if (saveMethod.get().getParameterTypes()[0] == WiredSettings.class) {
|
||||
WiredSettings settings = InteractionWired.readSettings(this.packet, false);
|
||||
|
||||
if (trigger.saveData(settings)) {
|
||||
this.client.sendResponse(new WiredSavedComposer());
|
||||
|
||||
trigger.needsUpdate(true);
|
||||
|
||||
Emulator.getThreading().run(trigger);
|
||||
} else {
|
||||
this.client.sendResponse(new UpdateFailedComposer("There was an error while saving that trigger"));
|
||||
}
|
||||
} else {
|
||||
if ((boolean) saveMethod.get().invoke(trigger, this.packet)) {
|
||||
this.client.sendResponse(new WiredSavedComposer());
|
||||
trigger.needsUpdate(true);
|
||||
Emulator.getThreading().run(trigger);
|
||||
} else {
|
||||
this.client.sendResponse(new UpdateFailedComposer("There was an error while saving that trigger"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.client.sendResponse(new UpdateFailedComposer("Save method was not found"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user