Dungeon is now accessible in POH

This commit is contained in:
oftheshire
2026-04-04 13:08:18 +00:00
committed by Ryan
parent fa2f2af00f
commit 5356aa8b37
3 changed files with 54 additions and 4 deletions
@@ -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;
}
@@ -3,6 +3,8 @@ 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
@@ -10,6 +12,8 @@ import core.game.node.entity.skill.Skills;
*/
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),
WHITEWASHED_STONE (20, 7500, 7503, 2, 13006, 13007, 1415, Decoration.WHITEWASHED_STONE_WINDOW),
@@ -17,6 +21,28 @@ public enum HousingStyle {
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.
*/
@@ -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);