diff --git a/Emulator/.idea/misc.xml b/Emulator/.idea/misc.xml index b15a7ef..aacacf5 100644 --- a/Emulator/.idea/misc.xml +++ b/Emulator/.idea/misc.xml @@ -8,5 +8,5 @@ - + \ No newline at end of file diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTeleporter.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTeleporter.java index 98a627f..f57850a 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTeleporter.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTeleporter.java @@ -3,15 +3,19 @@ package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.pets.RideablePet; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; +import com.eu.habbo.habbohotel.rooms.RoomUserRotation; +import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.threading.runnables.BanzaiRandomTeleport; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; public class InteractionBattleBanzaiTeleporter extends HabboItem { public InteractionBattleBanzaiTeleporter(ResultSet set, Item baseItem) throws SQLException { @@ -56,16 +60,43 @@ public class InteractionBattleBanzaiTeleporter extends HabboItem { public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOn(roomUnit, room, objects); - if(objects.length < 3) { + if (objects.length < 3) { HabboItem target = room.getRoomSpecialTypes().getRandomTeleporter(null, this); - if (target == null) return; + + if (target == null) + return; this.setExtradata("1"); room.updateItemState(this); - roomUnit.removeStatus(RoomUnitStatus.MOVE); - roomUnit.setGoalLocation(roomUnit.getCurrentLocation()); roomUnit.setCanWalk(false); - Emulator.getThreading().run(new BanzaiRandomTeleport(this, target, roomUnit, room), 500); + + Habbo habbo = room.getHabbo(roomUnit); + RoomUserRotation rotation = RoomUserRotation.fromValue(Emulator.getRandom().nextInt(8)); + ArrayList roomUnitsToTeleport = new ArrayList<>(); + if (habbo != null) { + RideablePet pet = habbo.getHabboInfo().getRiding(); + if (pet != null) + roomUnitsToTeleport.add(pet.getRoomUnit()); + } + + roomUnitsToTeleport.add(roomUnit); + + Emulator.getThreading().run(() -> { + target.setExtradata("1"); + room.updateItemState(target); + + for (RoomUnit ru : roomUnitsToTeleport) { + ru.removeStatus(RoomUnitStatus.MOVE); + ru.setCanWalk(false); + + Emulator.getThreading().run(() -> { + this.setExtradata("0"); + room.updateItemState(this); + + new BanzaiRandomTeleport(this, target, ru, room, rotation).run(); + }, 500); + } + }, 500); } } diff --git a/Emulator/src/main/java/com/eu/habbo/threading/runnables/BanzaiRandomTeleport.java b/Emulator/src/main/java/com/eu/habbo/threading/runnables/BanzaiRandomTeleport.java index b231ae7..9d96e5b 100644 --- a/Emulator/src/main/java/com/eu/habbo/threading/runnables/BanzaiRandomTeleport.java +++ b/Emulator/src/main/java/com/eu/habbo/threading/runnables/BanzaiRandomTeleport.java @@ -62,7 +62,6 @@ public class BanzaiRandomTeleport implements Runnable { petUnit.setGoalLocation(teleporterTile); // Set the goal location petUnit.setCurrentLocation(teleporterTile); // Force the pet to the teleport tile petUnit.setZ(teleporterTile.getStackHeight()); // Set the correct Z-height - LOGGER.info("Pet {} moved onto teleporter tile at ({}, {})", petUnit.getId(), teleporterTile.x, teleporterTile.y); // Ensure both pet and rider face the same direction roomUnit.setRotation(this.newRotation); @@ -77,11 +76,9 @@ public class BanzaiRandomTeleport implements Runnable { Emulator.getThreading().run(() -> { room.teleportRoomUnitToLocation(petUnit, newLocation.x, newLocation.y, finalPetZ); petUnit.setZ(finalPetZ); - LOGGER.info("Pet {} teleported to ({}, {}), Z = {}", petUnit.getId(), newLocation.x, newLocation.y, finalPetZ); room.teleportRoomUnitToLocation(roomUnit, newLocation.x, newLocation.y, finalRiderZ); roomUnit.setZ(finalRiderZ); - LOGGER.info("Rider {} teleported to ({}, {}), Z = {}", roomUnit.getId(), newLocation.x, newLocation.y, finalRiderZ); // Synchronize rotations after teleportation petUnit.setRotation(roomUnit.getBodyRotation()); @@ -106,6 +103,7 @@ public class BanzaiRandomTeleport implements Runnable { }, 650); // Delay to ensure smooth transition }, 1000); // Increased delay to ensure pet reaches the teleport tile } else { + // If not riding, proceed with teleportation for the rider only roomUnit.setRotation(this.newRotation); @@ -115,7 +113,6 @@ public class BanzaiRandomTeleport implements Runnable { Emulator.getThreading().run(() -> { room.teleportRoomUnitToLocation(roomUnit, newLocation.x, newLocation.y, finalRiderZ); roomUnit.setZ(finalRiderZ); - LOGGER.info("Rider {} teleported to ({}, {}), Z = {}", roomUnit.getId(), newLocation.x, newLocation.y, finalRiderZ); Emulator.getThreading().run(() -> { roomUnit.setCanWalk(true); diff --git a/Latest_Compiled_Version/Habbo-3.6.0-jar-with-dependencies.jar b/Latest_Compiled_Version/Habbo-3.6.0-jar-with-dependencies.jar index f29e380..6b97e79 100644 Binary files a/Latest_Compiled_Version/Habbo-3.6.0-jar-with-dependencies.jar and b/Latest_Compiled_Version/Habbo-3.6.0-jar-with-dependencies.jar differ