From 5356aa8b373c6e2382ccff4762e1f5b5d693824c Mon Sep 17 00:00:00 2001 From: oftheshire Date: Sat, 4 Apr 2026 13:08:18 +0000 Subject: [PATCH] Dungeon is now accessible in POH --- .../global/skill/construction/HouseZone.java | 27 +++++++++++++++++-- .../skill/construction/HousingStyle.java | 26 ++++++++++++++++++ .../global/skill/construction/Room.java | 5 ++-- 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/Server/src/main/content/global/skill/construction/HouseZone.java b/Server/src/main/content/global/skill/construction/HouseZone.java index 64165f49f..4a6cb6464 100644 --- a/Server/src/main/content/global/skill/construction/HouseZone.java +++ b/Server/src/main/content/global/skill/construction/HouseZone.java @@ -2,6 +2,7 @@ package content.global.skill.construction; import core.api.Container; +import core.game.world.map.Location; import org.rs09.consts.Items; import core.game.node.entity.Entity; import core.game.node.entity.player.Player; @@ -93,6 +94,28 @@ public final class HouseZone extends MapZone { public boolean leave(Entity e, boolean logout) { if (e instanceof Player) { Player p = (Player) e; + + // if the player is moving between the dungeon and main house, don't trigger the leave sequence + if (!logout) { + // current loc + Location dest = p.getProperties().getTeleportLocation(); + int currentRegionId = p.getLocation().getRegionId(); + int houseId = house.getHouseRegion().getId(); + int dungeonId = (house.getDungeonRegion() != null) ? house.getDungeonRegion().getId() : -1; + + // check if still in house + boolean currentlyInHouse = (currentRegionId == houseId || currentRegionId == dungeonId); + + // check if moving between house regions + int destRegionId = (dest != null) ? dest.getRegionId() : -1; + boolean movingToHouse = (destRegionId == houseId || destRegionId == dungeonId); + + // if yes, return true and stop the leave sequence + if (currentlyInHouse || movingToHouse) { + return true; + } + } + remove_items(p); // The below tears down the house if the owner was the one who left if (house == p.getHouseManager()) { @@ -105,11 +128,11 @@ public final class HouseZone extends MapZone { Region dr = dungRemove != -1 ? RegionManager.forId(dungRemove) : null; RegionManager.removeRegion(toRemove); unregisterRegion(toRemove); - r.setActive(false); + r.flagInactive(); if (dungRemove != -1) { RegionManager.removeRegion(dungRemove); unregisterRegion(dungRemove); - dr.setActive(false); + dr.flagInactive(); } return true; } diff --git a/Server/src/main/content/global/skill/construction/HousingStyle.java b/Server/src/main/content/global/skill/construction/HousingStyle.java index e4d59b90d..eace0e7bb 100644 --- a/Server/src/main/content/global/skill/construction/HousingStyle.java +++ b/Server/src/main/content/global/skill/construction/HousingStyle.java @@ -3,12 +3,16 @@ package content.global.skill.construction; import core.game.node.entity.player.Player; import core.game.node.entity.skill.Skills; +import java.util.Arrays; + /** * The styles of houses. * @author Emperor * */ public enum HousingStyle { + + // open door ids are doorId + 1 BASIC_WOOD (1, 5000, 7503, 0, 13100, 13101, 13098, Decoration.BASIC_WOOD_WINDOW), BASIC_STONE (10, 5000, 7503, 1, 13094, 13096, 1902, Decoration.BASIC_STONE_WINDOW), @@ -16,6 +20,28 @@ public enum HousingStyle { FREMENNIK_STYLE_WOOD(30, 10000, 7503, 3, 13109, 13107, 13111, Decoration.FREMENNIK_WINDOW), TROPICAL_WOOD (40, 15000, 7759, 0, 13016, 13015, 13011, Decoration.TROPICAL_WOOD_WINDOW), FANCY_STONE (50, 25000, 7759, 1, 13119, 13118, 13116, Decoration.FANCY_STONE_WINDOW); + + /** + * Array of all Dungeon Wall IDs. + * From Region 7503, Location.create(1898, 5084, 0) + */ + private static final int[] DUNGEON_WALL_IDS = { + 13019, 13020, 13021, 13022, 13023, 13024, 13025, 13026, 13027, 13028, + 13029, 13030, 13031, 13032, 13033, 13034, 13035, 13036, 13037, 13046, + 13048, 13049, 13050, 13051, 13055, 13056, 13058, 13059, 13060, 13061, + 13062, 13063, 13065, 13066, 13067, 13068, 13069, 13070, 13072, 13073, + 13074, 13075, 13076, 13077, 13079, 13080, 13081, 13082, 13083, 13084, + 13086, 13087, 13088, 13089 + }; + + /** + * Checks if the provided ID is a dungeon wall. + * @param id The object ID. + * @return {@code true} if it's a dungeon wall. + */ + public static boolean isDungeonWall(int id) { + return Arrays.binarySearch(DUNGEON_WALL_IDS, id) >= 0; + } /** * The level required. diff --git a/Server/src/main/content/global/skill/construction/Room.java b/Server/src/main/content/global/skill/construction/Room.java index 883a4776c..ac7b56cec 100644 --- a/Server/src/main/content/global/skill/construction/Room.java +++ b/Server/src/main/content/global/skill/construction/Room.java @@ -176,9 +176,10 @@ public final class Room { for (int i = 0; i < BuildRegionChunk.ARRAY_SIZE; i++) { Scenery object = chunk.get(x, y, i); if (object != null) { + int id = object.getId(); boolean isBuilt = object instanceof Constructed; - boolean isWall = object.getId() == 13065 || object.getId() == house.getStyle().getWallId(); - boolean isDoor = object.getId() == house.getStyle().getDoorId() || object.getId() == house.getStyle().getSecondDoorId(); + boolean isWall = HousingStyle.isDungeonWall(id) || id == house.getStyle().getWallId(); + boolean isDoor = id == house.getStyle().getDoorId() || id == house.getStyle().getSecondDoorId(); if (!isBuilt && !isWall && !isDoor) { SceneryBuilder.remove(object); chunk.remove(object);