From 8725e2f6540f9e481988fa3974587009f02d7642 Mon Sep 17 00:00:00 2001 From: Dank074 Date: Thu, 16 Jan 2020 02:43:32 -0600 Subject: [PATCH 1/4] fixed fxbox getting state changed twice --- .../habbo/habbohotel/items/interactions/InteractionFXBox.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java index 3b579a54..1b90c395 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java @@ -27,8 +27,6 @@ public class InteractionFXBox extends InteractionDefault { @Override public void onClick(GameClient client, Room room, Object[] objects) throws Exception { - super.onClick(client, room, objects); - if (client != null && this.getUserId() == client.getHabbo().getHabboInfo().getId()) { if(this.getExtradata().equals("1")) return; From cfc17e249f5a5456b67548d2cc38a4f248ca1edb Mon Sep 17 00:00:00 2001 From: Dank074 Date: Thu, 16 Jan 2020 02:51:53 -0600 Subject: [PATCH 2/4] fixed NumberFormatException in totem extradata --- .../items/interactions/totems/InteractionTotemHead.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemHead.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemHead.java index 65036015..b0e63eb8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemHead.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemHead.java @@ -22,7 +22,12 @@ public class InteractionTotemHead extends InteractionDefault { } public TotemType getTotemType() { - int extraData = Integer.parseInt(this.getExtradata()); + int extraData; + try { + extraData = Integer.parseInt(this.getExtradata()); + } catch(NumberFormatException ex) { + extraData = 0; + } if(extraData < 3) { return TotemType.fromInt(extraData + 1); } From 506886d7948b1ab0ba452c9618ae93c1692d879e Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Thu, 16 Jan 2020 23:13:16 +0000 Subject: [PATCH 3/4] Fixed effect boxes, credits to Beny and Skeletor. --- .../items/interactions/InteractionFXBox.java | 1 - .../totems/InteractionTotemPlanet.java | 3 +-- .../incoming/handshake/SecureLoginEvent.java | 3 ++- .../inventory/EffectsListAddComposer.java | 7 +++--- .../inventory/UserEffectsListComposer.java | 25 +++++++++++-------- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java index 1b90c395..a645676e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java @@ -52,7 +52,6 @@ public class InteractionFXBox extends InteractionDefault { return; EffectsComponent.HabboEffect effect = client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId, 0); - client.sendResponse(new UserEffectsListComposer(client.getHabbo())); client.getHabbo().getInventory().getEffectsComponent().enableEffect(effectId); this.setExtradata("1"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java index bff2b26c..14d03271 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java @@ -74,8 +74,7 @@ public class InteractionTotemPlanet extends InteractionDefault { return; } - client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId); - client.sendResponse(new UserEffectsListComposer(client.getHabbo())); + EffectsComponent.HabboEffect effect = client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId); client.getHabbo().getInventory().getEffectsComponent().enableEffect(effectId); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java index 6759a1e6..28d985e7 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.navigation.NavigatorSavedSearch; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboManager; +import com.eu.habbo.habbohotel.users.inventory.EffectsComponent; import com.eu.habbo.messages.NoAuthMessage; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.incoming.MessageHandler; @@ -95,7 +96,7 @@ public class SecureLoginEvent extends MessageHandler { messages.add(new SecureLoginOKComposer().compose()); messages.add(new UserHomeRoomComposer(this.client.getHabbo().getHabboInfo().getHomeRoom(), 0).compose()); - messages.add(new UserEffectsListComposer(habbo).compose()); + messages.add(new UserEffectsListComposer(habbo, client.getHabbo().getInventory().getEffectsComponent().effects.values().toArray(new EffectsComponent.HabboEffect[0])).compose()); messages.add(new UserClothesComposer(this.client.getHabbo()).compose()); messages.add(new NewUserIdentityComposer(habbo).compose()); messages.add(new UserPermissionsComposer(this.client.getHabbo()).compose()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListAddComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListAddComposer.java index 8e26067c..dfb76d6b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListAddComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/EffectsListAddComposer.java @@ -8,7 +8,8 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class EffectsListAddComposer extends MessageComposer { public final EffectsComponent.HabboEffect effect; - public EffectsListAddComposer(EffectsComponent.HabboEffect effect) { + public + EffectsListAddComposer(EffectsComponent.HabboEffect effect) { this.effect = effect; } @@ -17,8 +18,8 @@ public class EffectsListAddComposer extends MessageComposer { this.response.init(Outgoing.EffectsListAddComposer); this.response.appendInt(this.effect.effect); //Type this.response.appendInt(0); //Unknown Costume? - this.response.appendInt(this.effect.duration); //Duration - this.response.appendBoolean(this.effect.isActivated()); //Is active + this.response.appendInt(effect.duration > 0 ? effect.duration : Integer.MAX_VALUE); //Duration + this.response.appendBoolean(effect.duration <= 0); //Is active return this.response; } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/UserEffectsListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/UserEffectsListComposer.java index 157c53c9..b1cd6cd6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/UserEffectsListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/UserEffectsListComposer.java @@ -10,38 +10,41 @@ import gnu.trove.procedure.TObjectProcedure; public class UserEffectsListComposer extends MessageComposer { public final Habbo habbo; + public final EffectsComponent.HabboEffect[] effects; - public UserEffectsListComposer(Habbo habbo) { + public UserEffectsListComposer(Habbo habbo, EffectsComponent.HabboEffect[] effects) { this.habbo = habbo; + this.effects = effects; } @Override public ServerMessage compose() { this.response.init(Outgoing.UserEffectsListComposer); + if (this.habbo == null || this.habbo.getInventory() == null || this.habbo.getInventory().getEffectsComponent() == null || this.habbo.getInventory().getEffectsComponent().effects == null) { this.response.appendInt(0); } else { synchronized (this.habbo.getInventory().getEffectsComponent().effects) { - this.response.appendInt(this.habbo.getInventory().getEffectsComponent().effects.size()); - this.habbo.getInventory().getEffectsComponent().effects.forEachValue(effect -> { + this.response.appendInt(this.effects.length); + + for(EffectsComponent.HabboEffect effect : effects) { + UserEffectsListComposer.this.response.appendInt(effect.effect); UserEffectsListComposer.this.response.appendInt(0); - UserEffectsListComposer.this.response.appendInt(effect.duration > 0 ? effect.duration : 1); - UserEffectsListComposer.this.response.appendInt(effect.total - (effect.isActivated() ? 1 : 0)); + UserEffectsListComposer.this.response.appendInt(effect.duration > 0 ? effect.duration : Integer.MAX_VALUE); + UserEffectsListComposer.this.response.appendInt((effect.duration > 0 ? (effect.total - (effect.isActivated() ? 1 : 0)) : 0)); - if(!effect.isActivated()) { + if(!effect.isActivated() && effect.duration > 0) { UserEffectsListComposer.this.response.appendInt(0); } else { - UserEffectsListComposer.this.response.appendInt(effect.duration > 0 ? (Emulator.getIntUnixTimestamp() - effect.activationTimestamp) + effect.duration : -1); + UserEffectsListComposer.this.response.appendInt(effect.duration > 0 ? (Emulator.getIntUnixTimestamp() - effect.activationTimestamp) + effect.duration : 0); } - UserEffectsListComposer.this.response.appendBoolean(effect.duration <= 0); //effect.isActivated()); - return true; - }); + UserEffectsListComposer.this.response.appendBoolean(effect.duration <= 0); // is perm + } } } - return this.response; } } From 353bde440c445c3a074bdc4f38f112fb6aef3ec9 Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Thu, 16 Jan 2020 23:15:01 +0000 Subject: [PATCH 4/4] 2.1.1 to signify a new minor build. --- src/main/java/com/eu/habbo/Emulator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index 24b0d0b8..1f75c11f 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -34,7 +34,7 @@ public final class Emulator { public final static int MINOR = 2; - public final static int BUILD = 0; + public final static int BUILD = 1; public final static String PREVIEW = "Stable";