Dungeon is now accessible in POH
This commit is contained in:
@@ -2,6 +2,7 @@ package content.global.skill.construction;
|
|||||||
|
|
||||||
|
|
||||||
import core.api.Container;
|
import core.api.Container;
|
||||||
|
import core.game.world.map.Location;
|
||||||
import org.rs09.consts.Items;
|
import org.rs09.consts.Items;
|
||||||
import core.game.node.entity.Entity;
|
import core.game.node.entity.Entity;
|
||||||
import core.game.node.entity.player.Player;
|
import core.game.node.entity.player.Player;
|
||||||
@@ -93,6 +94,28 @@ public final class HouseZone extends MapZone {
|
|||||||
public boolean leave(Entity e, boolean logout) {
|
public boolean leave(Entity e, boolean logout) {
|
||||||
if (e instanceof Player) {
|
if (e instanceof Player) {
|
||||||
Player p = (Player) e;
|
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);
|
remove_items(p);
|
||||||
// The below tears down the house if the owner was the one who left
|
// The below tears down the house if the owner was the one who left
|
||||||
if (house == p.getHouseManager()) {
|
if (house == p.getHouseManager()) {
|
||||||
@@ -105,11 +128,11 @@ public final class HouseZone extends MapZone {
|
|||||||
Region dr = dungRemove != -1 ? RegionManager.forId(dungRemove) : null;
|
Region dr = dungRemove != -1 ? RegionManager.forId(dungRemove) : null;
|
||||||
RegionManager.removeRegion(toRemove);
|
RegionManager.removeRegion(toRemove);
|
||||||
unregisterRegion(toRemove);
|
unregisterRegion(toRemove);
|
||||||
r.setActive(false);
|
r.flagInactive();
|
||||||
if (dungRemove != -1) {
|
if (dungRemove != -1) {
|
||||||
RegionManager.removeRegion(dungRemove);
|
RegionManager.removeRegion(dungRemove);
|
||||||
unregisterRegion(dungRemove);
|
unregisterRegion(dungRemove);
|
||||||
dr.setActive(false);
|
dr.flagInactive();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,16 @@ package content.global.skill.construction;
|
|||||||
import core.game.node.entity.player.Player;
|
import core.game.node.entity.player.Player;
|
||||||
import core.game.node.entity.skill.Skills;
|
import core.game.node.entity.skill.Skills;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The styles of houses.
|
* The styles of houses.
|
||||||
* @author Emperor
|
* @author Emperor
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum HousingStyle {
|
public enum HousingStyle {
|
||||||
|
|
||||||
|
// open door ids are doorId + 1
|
||||||
|
|
||||||
BASIC_WOOD (1, 5000, 7503, 0, 13100, 13101, 13098, Decoration.BASIC_WOOD_WINDOW),
|
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),
|
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),
|
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),
|
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);
|
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.
|
* The level required.
|
||||||
|
|||||||
@@ -176,9 +176,10 @@ public final class Room {
|
|||||||
for (int i = 0; i < BuildRegionChunk.ARRAY_SIZE; i++) {
|
for (int i = 0; i < BuildRegionChunk.ARRAY_SIZE; i++) {
|
||||||
Scenery object = chunk.get(x, y, i);
|
Scenery object = chunk.get(x, y, i);
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
|
int id = object.getId();
|
||||||
boolean isBuilt = object instanceof Constructed;
|
boolean isBuilt = object instanceof Constructed;
|
||||||
boolean isWall = object.getId() == 13065 || object.getId() == house.getStyle().getWallId();
|
boolean isWall = HousingStyle.isDungeonWall(id) || id == house.getStyle().getWallId();
|
||||||
boolean isDoor = object.getId() == house.getStyle().getDoorId() || object.getId() == house.getStyle().getSecondDoorId();
|
boolean isDoor = id == house.getStyle().getDoorId() || id == house.getStyle().getSecondDoorId();
|
||||||
if (!isBuilt && !isWall && !isDoor) {
|
if (!isBuilt && !isWall && !isDoor) {
|
||||||
SceneryBuilder.remove(object);
|
SceneryBuilder.remove(object);
|
||||||
chunk.remove(object);
|
chunk.remove(object);
|
||||||
|
|||||||
Reference in New Issue
Block a user