Fix unable to use teleport when item blocking

This commit is contained in:
Beny 2020-10-15 06:03:14 +02:00
parent 3c4782ef3d
commit f42959fd4d
3 changed files with 10 additions and 9 deletions

View File

@ -93,7 +93,7 @@ public class InteractionTeleport extends HabboItem {
// set state 1 and walk on item
this.roomUnitID = unit.getId();
this.setExtradata("1");
room.updateItem(this);
room.updateItemState(this);
unit.setGoalLocation(infrontTile);
List<Runnable> onSuccess = new ArrayList<Runnable>();
@ -111,7 +111,7 @@ public class InteractionTeleport extends HabboItem {
walkable = this.getBaseItem().allowWalk();
room.updateTile(currentLocation);
this.setExtradata("0");
room.updateItem(this);
room.updateItemState(this);
this.roomUnitID = -1;
unit.removeOverrideTile(currentLocation);
unit.setCanLeaveRoomByDoor(true);

View File

@ -726,13 +726,12 @@ public class RoomUnit {
if (room.getItemsAt(tile).stream().anyMatch(i -> i.canOverrideTile(this, room, tile)))
return true;
int tileIndex = (room.getLayout().getMapSizeY() * tile.y) + tile.x + 1;
int tileIndex = (tile.x & 0xFF) | (tile.y << 12);
return this.overridableTiles.contains(tileIndex);
}
public void addOverrideTile(RoomTile tile) {
if (!this.canOverrideTile(tile)) { return; } // Test if the Tile is overridable
int tileIndex = (room.getLayout().getMapSizeY() * tile.y) + tile.x + 1;
int tileIndex = (tile.x & 0xFF) | (tile.y << 12);
if (!this.overridableTiles.contains(tileIndex)) {
this.overridableTiles.add(tileIndex);
}
@ -741,7 +740,7 @@ public class RoomUnit {
public void removeOverrideTile(RoomTile tile) {
if (room == null || room.getLayout() == null) return;
int tileIndex = (room.getLayout().getMapSizeY() * tile.y) + tile.x + 1;
int tileIndex = (tile.x & 0xFF) | (tile.y << 12);
this.overridableTiles.remove(tileIndex);
}

View File

@ -54,15 +54,17 @@ class TeleportActionThree implements Runnable {
this.client.getHabbo().getRoomUnit().setLocation(teleportLocation);
this.client.getHabbo().getRoomUnit().getPath().clear();
this.client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
this.client.getHabbo().getRoomUnit().setZ(targetTeleport.getZ());
this.client.getHabbo().getRoomUnit().setPreviousLocationZ(targetTeleport.getZ());
this.client.getHabbo().getRoomUnit().setRotation(RoomUserRotation.values()[targetTeleport.getRotation() % 8]);
this.client.getHabbo().getRoomUnit().setZ(teleportLocation.getStackHeight());
this.client.getHabbo().getRoomUnit().setPreviousLocationZ(teleportLocation.getStackHeight());
if (targetRoom != this.room) {
this.room.removeHabbo(this.client.getHabbo(), false);
Emulator.getGameEnvironment().getRoomManager().enterRoom(this.client.getHabbo(), targetRoom.getId(), "", Emulator.getConfig().getBoolean("hotel.teleport.locked.allowed"), teleportLocation);
}
this.client.getHabbo().getRoomUnit().setRotation(RoomUserRotation.values()[targetTeleport.getRotation() % 8]);
this.client.getHabbo().getRoomUnit().statusUpdate(true);
targetTeleport.setExtradata("2");
targetRoom.updateItem(targetTeleport);
//targetRoom.updateHabbo(this.client.getHabbo());