From 5a76a71d21caa7dbe33d844c2c0ad999acd0a8fd Mon Sep 17 00:00:00 2001 From: oftheshire Date: Sun, 19 Apr 2026 10:11:48 +0000 Subject: [PATCH] Fixed removal of POH 1st floor and dungeon rooms --- .../skill/construction/RemovalDialogue.java | 21 +++++-- .../decoration/StaircasePlugin.java | 61 +++++++++++++++---- 2 files changed, 67 insertions(+), 15 deletions(-) diff --git a/Server/src/main/content/global/skill/construction/RemovalDialogue.java b/Server/src/main/content/global/skill/construction/RemovalDialogue.java index 5b2a9f869..3edbc360f 100644 --- a/Server/src/main/content/global/skill/construction/RemovalDialogue.java +++ b/Server/src/main/content/global/skill/construction/RemovalDialogue.java @@ -53,10 +53,23 @@ public final class RemovalDialogue extends DialoguePlugin { @Override public boolean open(Object... args) { pos = (int[]) args[1]; - plane = player.getLocation().getZ(); - if (HouseManager.isInDungeon(player)) { - plane = 3; - } + + if (args.length > 2 && args[2] instanceof Integer) { + plane = (Integer) args[2]; + } else { + plane = player.getLocation().getZ(); + if (HouseManager.isInDungeon(player)) { + plane = 3; + } + } + + // check if room exists + room = player.getHouseManager().getRooms()[plane][pos[0]][pos[1]]; + if (room == null || room.getProperties().isRoof()) { + interpreter.sendPlainMessage(false, "There is no room there to remove."); + return false; + } + room = player.getHouseManager().getRooms()[plane][pos[0]][pos[1]]; player.getDialogueInterpreter().sendOptions("Remove the " + (room != null ? room.getProperties().getName() : "room") + "?", "Yes", "No"); stage = 0; diff --git a/Server/src/main/content/global/skill/construction/decoration/StaircasePlugin.java b/Server/src/main/content/global/skill/construction/decoration/StaircasePlugin.java index a1fe9ed3e..8c22d84ab 100644 --- a/Server/src/main/content/global/skill/construction/decoration/StaircasePlugin.java +++ b/Server/src/main/content/global/skill/construction/decoration/StaircasePlugin.java @@ -29,15 +29,19 @@ public final class StaircasePlugin extends OptionHandler { public Plugin newInstance(Object arg) throws Throwable { ClassScanner.definePlugin(new BuildDialogue()); ClassScanner.definePlugin(new ClimbPohLadder()); - for (int i = 13497; i < 13507; i++) { + // 13497 - 13502 are normal stairs + // 13503 - 13506 are spiral stairs + for (int i = 13497; i <= 13506; i++) { SceneryDefinition.forId(i).getHandlers().put("option:climb", this); SceneryDefinition.forId(i).getHandlers().put("option:climb-up", this); SceneryDefinition.forId(i).getHandlers().put("option:climb-down", this); SceneryDefinition.forId(i).getHandlers().put("option:remove-room", this); } + // 13409 is dungeon entrance SceneryDefinition.forId(13409).getHandlers().put("option:enter", this); SceneryDefinition.forId(13409).getHandlers().put("option:remove-room", this); - for (int id = 13328; id < 13331; id++) { + // 13328 - 13330 are dungeon ladders + for (int id = 13328; id <= 13330; id++) { SceneryDefinition.forId(id).getHandlers().put("option:climb", this); SceneryDefinition.forId(id).getHandlers().put("option:remove-room", this); } @@ -69,13 +73,47 @@ public final class StaircasePlugin extends OptionHandler { SceneryBuilder.replace(object, object.transform(object.getId() - 3)); return true; case "remove-room": - if (player.getLocation().getZ() != 0) { - player.getPacketDispatch().sendMessage("The room below is supporting this room!"); - return true; - } - return false; + + int currentZ = player.getLocation().getZ(); + int chunkX = player.getLocation().getChunkX(); + int chunkY = player.getLocation().getChunkY(); + + // must be in building mode + if(!player.getHouseManager().isBuildingMode()) { + player.getPacketDispatch().sendMessage("You can only do this in building mode."); + return true; + } + + // if you're in the dungeon, try and remove the room at Z = 0 from the house region. + if (HouseManager.isInDungeon(player)) { + player.getDialogueInterpreter().open("con:remove", null, new int[]{chunkX, chunkY}, 0); + + // From ground floor (z=0), stairs could lead to 1st floor (z=1) or the dungeon (z=3) + } else { + // garden dungeon entrance and oubliette ladders don't need a height selection + if(node.getId() == 13409 || node.getId() == 13675 || node.getId() == 13676 || node.getId() == 13677 || node.getId() == 13678 || node.getId() == 13679 || node.getId() == 13680) { + player.getDialogueInterpreter().open("con:remove", null, new int[]{chunkX, chunkY}, 3); + } else { + player.getDialogueInterpreter().sendOptions("Remove which room?", "Room Above", "Room Below", "Cancel"); + player.getDialogueInterpreter().addAction((interId, btn) -> { + if (btn == 2) { // Above + player.getDialogueInterpreter().open("con:remove", null, new int[]{chunkX, chunkY}, currentZ + 1); + } else if (btn == 3) { // Below + if (currentZ - 1 == -1) { + player.getDialogueInterpreter().open("con:remove", null, new int[]{chunkX, chunkY}, 3); + } else { + player.getDialogueInterpreter().open("con:remove", null, new int[]{chunkX, chunkY}, currentZ - 1); + } + + } + }); + } + + } + return true; + case "climb": - if (house.getDungeonRegion() == player.getViewport().getRegion()) { + if (HouseManager.isInDungeon(player)) { climb(player, 1, house, object); return true; } @@ -379,10 +417,11 @@ public final class StaircasePlugin extends OptionHandler { for (Direction d : dirs) { if (d == room.getRotation()) { r.setRotation(d); - Hotspot stairs = room.getStairs(); - int index = stairs != null ? stairs.getDecorationIndex() : -1; + // todo this just puts a default set of stairs in the dungeon. The below code works for skill/quest hall, but not a dungeon entrance. + //Hotspot stairs = room.getStairs(); + //int index = stairs != null ? stairs.getDecorationIndex() : -1; BuildingUtils.buildRoom(player, r, plane, roomX, roomY, r.getExits(), true); - r.getStairs().setDecorationIndex(index); + r.getStairs().setDecorationIndex(/*index*/1); end(); return true; }