From f347289139c3a49d20ef4a9f9ca19a40842a3ee1 Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Fri, 3 May 2019 00:30:02 +0100 Subject: [PATCH] Made WiredEffectTeleport keep the previous enable (LIKE HABBO) when the sparkle effect is over. - Credits to Beny --- .../interactions/wired/effects/WiredEffectTeleport.java | 8 +++++++- .../java/com/eu/habbo/habbohotel/rooms/RoomManager.java | 4 +--- .../outgoing/rooms/users/RoomUserEffectComposer.java | 9 ++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java index 43481832..72e24eef 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java @@ -14,7 +14,9 @@ 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.outgoing.rooms.users.RoomUserEffectComposer; import com.eu.habbo.threading.runnables.RoomUnitTeleport; +import com.eu.habbo.threading.runnables.SendRoomUnitEffectComposer; import gnu.trove.procedure.TObjectProcedure; import gnu.trove.set.hash.THashSet; @@ -146,7 +148,10 @@ public class WiredEffectTeleport extends InteractionWiredEffect int currentEffect = roomUnit.getEffectId(); - room.giveEffect(roomUnit, 4, 2); + // makes a temporary effect + room.sendComposer(new RoomUserEffectComposer(roomUnit, 4).compose()); + Emulator.getThreading().run(new SendRoomUnitEffectComposer(room, roomUnit), 2000); + final WiredEffectTeleport teleportWired = this; RoomTile targetTile = room.getLayout().getTile(item.getX(), item.getY()); boolean foundTile = false; @@ -172,6 +177,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect { continue; } + Emulator.getThreading().run(new RoomUnitTeleport(roomUnit, room, targetTile.x, targetTile.y, targetTile.getStackHeight() + (targetTile.state == RoomTileState.SIT ? -0.5 : 0) , currentEffect), WiredHandler.TELEPORT_DELAY); Emulator.getThreading().run(new Runnable() { diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index da244ea2..25adf3d5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -687,9 +687,7 @@ public class RoomManager } habbo.getHabboInfo().setRoomQueueId(0); habbo.getClient().sendResponse(new HideDoorbellComposer("")); - - if (habbo.getRoomUnit() == null) - habbo.setRoomUnit(new RoomUnit()); + habbo.setRoomUnit(new RoomUnit()); habbo.getRoomUnit().clearStatus(); if (habbo.getRoomUnit().getCurrentLocation() == null) diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserEffectComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserEffectComposer.java index 1acc9354..d78a98e6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserEffectComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUserEffectComposer.java @@ -8,10 +8,17 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class RoomUserEffectComposer extends MessageComposer { private final RoomUnit roomUnit; + private final int effectId; public RoomUserEffectComposer(RoomUnit roomUnit) { this.roomUnit = roomUnit; + this.effectId = -1; + } + public RoomUserEffectComposer(RoomUnit roomUnit, int effectId) + { + this.roomUnit = roomUnit; + this.effectId = effectId; } @Override @@ -19,7 +26,7 @@ public class RoomUserEffectComposer extends MessageComposer { this.response.init(Outgoing.RoomUserEffectComposer); this.response.appendInt(this.roomUnit.getId()); - this.response.appendInt(this.roomUnit.getEffectId()); + this.response.appendInt(this.effectId == -1 ? this.roomUnit.getEffectId() : this.effectId); this.response.appendInt(0); return this.response; }