From 36e51cfd1c34fde3d1fd025180b74d9031b671b3 Mon Sep 17 00:00:00 2001 From: ThatGamerBlue Date: Sun, 9 May 2021 04:54:55 +0100 Subject: [PATCH] update wilderness region --- .../com/openosrs/client/util/PvPUtil.java | 9 +++- .../net/runelite/client/util/PvPUtil.java | 48 +------------------ 2 files changed, 10 insertions(+), 47 deletions(-) diff --git a/runelite-client/src/main/java/com/openosrs/client/util/PvPUtil.java b/runelite-client/src/main/java/com/openosrs/client/util/PvPUtil.java index 2db8ff9ec6..2d70773eee 100644 --- a/runelite-client/src/main/java/com/openosrs/client/util/PvPUtil.java +++ b/runelite-client/src/main/java/com/openosrs/client/util/PvPUtil.java @@ -55,7 +55,7 @@ public class PvPUtil ); private static final Cuboid MAIN_WILDERNESS_CUBOID = new Cuboid(2944, 3525, 0, 3391, 4351, 3); private static final Cuboid GOD_WARS_WILDERNESS_CUBOID = new Cuboid(3008, 10112, 0, 3071, 10175, 3); - private static final Cuboid WILDERNESS_UNDERGROUND_CUBOID = new Cuboid(2944, 9920, 0, 3391, 10879, 3); + private static final Cuboid WILDERNESS_UNDERGROUND_CUBOID = new Cuboid(2944, 9920, 0, 3455, 10879, 3); /** * Gets the wilderness level based on a world point @@ -66,6 +66,13 @@ public class PvPUtil */ public static int getWildernessLevelFrom(WorldPoint point) { + int regionID = point.getRegionID(); + if (regionID == 12700 /* soul wars underground ferox */ || + regionID == 12187 /* falador party room museum */) + { + return 0; + } + if (MAIN_WILDERNESS_CUBOID.contains(point)) { if (NOT_WILDERNESS_BLACK_KNIGHTS.contains(point.getX(), point.getY())) diff --git a/runelite-client/src/main/java/net/runelite/client/util/PvPUtil.java b/runelite-client/src/main/java/net/runelite/client/util/PvPUtil.java index 3380cf5a8f..4ec2575c14 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/PvPUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/util/PvPUtil.java @@ -35,19 +35,6 @@ import net.runelite.api.geometry.Cuboid; public class PvPUtil { - private static final Polygon NOT_WILDERNESS_BLACK_KNIGHTS = new Polygon( // this is black knights castle - new int[]{2994, 2995, 2996, 2996, 2994, 2994, 2997, 2998, 2998, 2999, 3000, 3001, 3002, 3003, 3004, 3005, 3005, - 3005, 3019, 3020, 3022, 3023, 3024, 3025, 3026, 3026, 3027, 3027, 3028, 3028, 3029, 3029, 3030, 3030, 3031, - 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3037}, - new int[]{3525, 3526, 3527, 3529, 3529, 3534, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, - 3545, 3545, 3546, 3546, 3545, 3544, 3543, 3543, 3542, 3541, 3540, 3539, 3537, 3536, 3535, 3534, 3533, 3532, - 3531, 3530, 3529, 3528, 3527, 3526, 3526, 3525}, - 43 - ); - private static final Cuboid MAIN_WILDERNESS_CUBOID = new Cuboid(2944, 3525, 0, 3391, 4351, 3); - private static final Cuboid GOD_WARS_WILDERNESS_CUBOID = new Cuboid(3008, 10112, 0, 3071, 10175, 3); - private static final Cuboid WILDERNESS_UNDERGROUND_CUBOID = new Cuboid(2944, 9920, 0, 3391, 10879, 3); - /** * Gets the wilderness level based on a world point * Java reimplementation of clientscript 384 [proc,wilderness_level] @@ -57,24 +44,7 @@ public class PvPUtil */ public static int getWildernessLevelFrom(WorldPoint point) { - if (MAIN_WILDERNESS_CUBOID.contains(point)) - { - if (NOT_WILDERNESS_BLACK_KNIGHTS.contains(point.getX(), point.getY())) - { - return 0; - } - - return ((point.getY() - 3520) / 8) + 1; // calc(((coordz(coord) - (55 * 64)) / 8) + 1) - } - else if (GOD_WARS_WILDERNESS_CUBOID.contains(point)) - { - return ((point.getY() - 9920) / 8) - 1; // calc(((coordz(coord) - (155 * 64)) / 8) - 1) - } - else if (WILDERNESS_UNDERGROUND_CUBOID.contains(point)) - { - return ((point.getY() - 9920) / 8) + 1; // calc(((coordz(coord) - (155 * 64)) / 8) + 1) - } - return 0; + return com.openosrs.client.util.PvPUtil.getWildernessLevelFrom(point); } /** @@ -86,20 +56,6 @@ public class PvPUtil */ public static boolean isAttackable(Client client, Player player) { - int wildernessLevel = 0; - - if (WorldType.isDeadmanWorld(client.getWorldType())) - { - return true; - } - if (WorldType.isPvpWorld(client.getWorldType())) - { - wildernessLevel += 15; - } - if (client.getVar(Varbits.IN_WILDERNESS) == 1) - { - wildernessLevel += getWildernessLevelFrom(client.getLocalPlayer().getWorldLocation()); - } - return wildernessLevel != 0 && Math.abs(client.getLocalPlayer().getCombatLevel() - player.getCombatLevel()) <= wildernessLevel; + return com.openosrs.client.util.PvPUtil.isAttackable(client, player); } }