🆙 Banzai teleporters now 100%
This commit is contained in:
parent
1d6ef05206
commit
0c4d9ac939
2
Emulator/.idea/misc.xml
generated
2
Emulator/.idea/misc.xml
generated
@ -8,5 +8,5 @@
|
|||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="openjdk-18" project-jdk-type="JavaSDK" />
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK" />
|
||||||
</project>
|
</project>
|
@ -3,15 +3,19 @@ package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
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.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
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.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.threading.runnables.BanzaiRandomTeleport;
|
import com.eu.habbo.threading.runnables.BanzaiRandomTeleport;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class InteractionBattleBanzaiTeleporter extends HabboItem {
|
public class InteractionBattleBanzaiTeleporter extends HabboItem {
|
||||||
public InteractionBattleBanzaiTeleporter(ResultSet set, Item baseItem) throws SQLException {
|
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 {
|
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
super.onWalkOn(roomUnit, room, objects);
|
super.onWalkOn(roomUnit, room, objects);
|
||||||
|
|
||||||
if(objects.length < 3) {
|
if (objects.length < 3) {
|
||||||
HabboItem target = room.getRoomSpecialTypes().getRandomTeleporter(null, this);
|
HabboItem target = room.getRoomSpecialTypes().getRandomTeleporter(null, this);
|
||||||
if (target == null) return;
|
|
||||||
|
if (target == null)
|
||||||
|
return;
|
||||||
|
|
||||||
this.setExtradata("1");
|
this.setExtradata("1");
|
||||||
room.updateItemState(this);
|
room.updateItemState(this);
|
||||||
roomUnit.removeStatus(RoomUnitStatus.MOVE);
|
|
||||||
roomUnit.setGoalLocation(roomUnit.getCurrentLocation());
|
|
||||||
roomUnit.setCanWalk(false);
|
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<RoomUnit> 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,6 @@ public class BanzaiRandomTeleport implements Runnable {
|
|||||||
petUnit.setGoalLocation(teleporterTile); // Set the goal location
|
petUnit.setGoalLocation(teleporterTile); // Set the goal location
|
||||||
petUnit.setCurrentLocation(teleporterTile); // Force the pet to the teleport tile
|
petUnit.setCurrentLocation(teleporterTile); // Force the pet to the teleport tile
|
||||||
petUnit.setZ(teleporterTile.getStackHeight()); // Set the correct Z-height
|
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
|
// Ensure both pet and rider face the same direction
|
||||||
roomUnit.setRotation(this.newRotation);
|
roomUnit.setRotation(this.newRotation);
|
||||||
@ -77,11 +76,9 @@ public class BanzaiRandomTeleport implements Runnable {
|
|||||||
Emulator.getThreading().run(() -> {
|
Emulator.getThreading().run(() -> {
|
||||||
room.teleportRoomUnitToLocation(petUnit, newLocation.x, newLocation.y, finalPetZ);
|
room.teleportRoomUnitToLocation(petUnit, newLocation.x, newLocation.y, finalPetZ);
|
||||||
petUnit.setZ(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);
|
room.teleportRoomUnitToLocation(roomUnit, newLocation.x, newLocation.y, finalRiderZ);
|
||||||
roomUnit.setZ(finalRiderZ);
|
roomUnit.setZ(finalRiderZ);
|
||||||
LOGGER.info("Rider {} teleported to ({}, {}), Z = {}", roomUnit.getId(), newLocation.x, newLocation.y, finalRiderZ);
|
|
||||||
|
|
||||||
// Synchronize rotations after teleportation
|
// Synchronize rotations after teleportation
|
||||||
petUnit.setRotation(roomUnit.getBodyRotation());
|
petUnit.setRotation(roomUnit.getBodyRotation());
|
||||||
@ -106,6 +103,7 @@ public class BanzaiRandomTeleport implements Runnable {
|
|||||||
}, 650); // Delay to ensure smooth transition
|
}, 650); // Delay to ensure smooth transition
|
||||||
}, 1000); // Increased delay to ensure pet reaches the teleport tile
|
}, 1000); // Increased delay to ensure pet reaches the teleport tile
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// If not riding, proceed with teleportation for the rider only
|
// If not riding, proceed with teleportation for the rider only
|
||||||
roomUnit.setRotation(this.newRotation);
|
roomUnit.setRotation(this.newRotation);
|
||||||
|
|
||||||
@ -115,7 +113,6 @@ public class BanzaiRandomTeleport implements Runnable {
|
|||||||
Emulator.getThreading().run(() -> {
|
Emulator.getThreading().run(() -> {
|
||||||
room.teleportRoomUnitToLocation(roomUnit, newLocation.x, newLocation.y, finalRiderZ);
|
room.teleportRoomUnitToLocation(roomUnit, newLocation.x, newLocation.y, finalRiderZ);
|
||||||
roomUnit.setZ(finalRiderZ);
|
roomUnit.setZ(finalRiderZ);
|
||||||
LOGGER.info("Rider {} teleported to ({}, {}), Z = {}", roomUnit.getId(), newLocation.x, newLocation.y, finalRiderZ);
|
|
||||||
|
|
||||||
Emulator.getThreading().run(() -> {
|
Emulator.getThreading().run(() -> {
|
||||||
roomUnit.setCanWalk(true);
|
roomUnit.setCanWalk(true);
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user