mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-27 00:40:52 +01:00
fix wired condition furni has avatars sending wrong data
This commit is contained in:
parent
dbd40c195b
commit
e3b0c62d5b
@ -25,8 +25,6 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
||||||
public static final WiredConditionType type = WiredConditionType.FURNI_HAVE_HABBO;
|
public static final WiredConditionType type = WiredConditionType.FURNI_HAVE_HABBO;
|
||||||
|
|
||||||
protected boolean all;
|
|
||||||
protected THashSet<HabboItem> items;
|
protected THashSet<HabboItem> items;
|
||||||
|
|
||||||
public WiredConditionFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
|
public WiredConditionFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
|
||||||
@ -42,7 +40,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
@Override
|
@Override
|
||||||
public void onPickUp() {
|
public void onPickUp() {
|
||||||
this.items.clear();
|
this.items.clear();
|
||||||
this.all = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -68,7 +65,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
public String getWiredData() {
|
public String getWiredData() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
||||||
this.all,
|
|
||||||
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
|
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -80,7 +76,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
|
|
||||||
if (wiredData.startsWith("{")) {
|
if (wiredData.startsWith("{")) {
|
||||||
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
||||||
this.all = data.all;
|
|
||||||
|
|
||||||
for(int id : data.itemIds) {
|
for(int id : data.itemIds) {
|
||||||
HabboItem item = room.getHabboItem(id);
|
HabboItem item = room.getHabboItem(id);
|
||||||
@ -93,9 +88,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
String[] data = wiredData.split(":");
|
String[] data = wiredData.split(":");
|
||||||
|
|
||||||
if (data.length >= 1) {
|
if (data.length >= 1) {
|
||||||
this.all = (data[0].equals("1"));
|
|
||||||
|
|
||||||
if (data.length == 2) {
|
|
||||||
String[] items = data[1].split(";");
|
String[] items = data[1].split(";");
|
||||||
|
|
||||||
for (String s : items) {
|
for (String s : items) {
|
||||||
@ -107,7 +100,6 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WiredConditionType getType() {
|
public WiredConditionType getType() {
|
||||||
@ -128,8 +120,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
message.appendInt(this.getBaseItem().getSpriteId());
|
message.appendInt(this.getBaseItem().getSpriteId());
|
||||||
message.appendInt(this.getId());
|
message.appendInt(this.getId());
|
||||||
message.appendString("");
|
message.appendString("");
|
||||||
message.appendInt(1);
|
message.appendInt(0);
|
||||||
message.appendInt(this.all ? 1 : 0);
|
|
||||||
message.appendInt(0);
|
message.appendInt(0);
|
||||||
message.appendInt(this.getType().code);
|
message.appendInt(this.getType().code);
|
||||||
message.appendInt(0);
|
message.appendInt(0);
|
||||||
@ -179,11 +170,9 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static class JsonData {
|
static class JsonData {
|
||||||
boolean all;
|
|
||||||
List<Integer> itemIds;
|
List<Integer> itemIds;
|
||||||
|
|
||||||
public JsonData(boolean all, List<Integer> itemIds) {
|
public JsonData(List<Integer> itemIds) {
|
||||||
this.all = all;
|
|
||||||
this.itemIds = itemIds;
|
this.itemIds = itemIds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ import java.util.stream.Collectors;
|
|||||||
public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
||||||
public static final WiredConditionType type = WiredConditionType.NOT_FURNI_HAVE_HABBO;
|
public static final WiredConditionType type = WiredConditionType.NOT_FURNI_HAVE_HABBO;
|
||||||
|
|
||||||
protected boolean all;
|
|
||||||
protected THashSet<HabboItem> items;
|
protected THashSet<HabboItem> items;
|
||||||
|
|
||||||
public WiredConditionNotFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
|
public WiredConditionNotFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException {
|
||||||
@ -42,7 +41,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
@Override
|
@Override
|
||||||
public void onPickUp() {
|
public void onPickUp() {
|
||||||
this.items.clear();
|
this.items.clear();
|
||||||
this.all = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -68,7 +66,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
public String getWiredData() {
|
public String getWiredData() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
||||||
this.all,
|
|
||||||
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
|
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -80,7 +77,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
|
|
||||||
if (wiredData.startsWith("{")) {
|
if (wiredData.startsWith("{")) {
|
||||||
WiredConditionFurniHaveHabbo.JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, WiredConditionFurniHaveHabbo.JsonData.class);
|
WiredConditionFurniHaveHabbo.JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, WiredConditionFurniHaveHabbo.JsonData.class);
|
||||||
this.all = data.all;
|
|
||||||
|
|
||||||
for(int id : data.itemIds) {
|
for(int id : data.itemIds) {
|
||||||
HabboItem item = room.getHabboItem(id);
|
HabboItem item = room.getHabboItem(id);
|
||||||
@ -93,9 +89,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
String[] data = wiredData.split(":");
|
String[] data = wiredData.split(":");
|
||||||
|
|
||||||
if (data.length >= 1) {
|
if (data.length >= 1) {
|
||||||
this.all = (data[0].equals("1"));
|
|
||||||
|
|
||||||
if (data.length == 2) {
|
|
||||||
String[] items = data[1].split(";");
|
String[] items = data[1].split(";");
|
||||||
|
|
||||||
for (String s : items) {
|
for (String s : items) {
|
||||||
@ -107,7 +100,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WiredConditionType getType() {
|
public WiredConditionType getType() {
|
||||||
@ -128,8 +120,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
message.appendInt(this.getBaseItem().getSpriteId());
|
message.appendInt(this.getBaseItem().getSpriteId());
|
||||||
message.appendInt(this.getId());
|
message.appendInt(this.getId());
|
||||||
message.appendString("");
|
message.appendString("");
|
||||||
message.appendInt(1);
|
message.appendInt(0);
|
||||||
message.appendInt(this.all ? 1 : 0);
|
|
||||||
message.appendInt(0);
|
message.appendInt(0);
|
||||||
message.appendInt(this.getType().code);
|
message.appendInt(this.getType().code);
|
||||||
message.appendInt(0);
|
message.appendInt(0);
|
||||||
@ -178,11 +169,9 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static class JsonData {
|
static class JsonData {
|
||||||
boolean all;
|
|
||||||
List<Integer> itemIds;
|
List<Integer> itemIds;
|
||||||
|
|
||||||
public JsonData(boolean all, List<Integer> itemIds) {
|
public JsonData(List<Integer> itemIds) {
|
||||||
this.all = all;
|
|
||||||
this.itemIds = itemIds;
|
this.itemIds = itemIds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user