From a45ad0c4a62f2c90f821cadaac5afaceb40848da Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sun, 12 May 2019 23:36:19 -0600 Subject: [PATCH 1/3] runelite-api: Correct WallObject documentation --- .../java/net/runelite/api/WallObject.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/WallObject.java b/runelite-api/src/main/java/net/runelite/api/WallObject.java index 9a7156b654..ddc4a734cd 100644 --- a/runelite-api/src/main/java/net/runelite/api/WallObject.java +++ b/runelite-api/src/main/java/net/runelite/api/WallObject.java @@ -25,28 +25,33 @@ package net.runelite.api; /** - * Represents the wall of a tile, which is an un-passable boundary. + * Represents one or two walls on a tile */ public interface WallObject extends TileObject { /** - * Gets the first orientation of the wall. - * - * @return the first orientation, 0-2048 where 0 is north + * A bitfield with the orientation of a wall + * 1 = East + * 2 = North + * 4 = West + * 8 = South */ int getOrientationA(); /** - * Gets the second orientation value of the wall. - * - * @return the second orientation, 0-2048 where 0 is north + * A bitfield containing the orientation of the second wall on this tile, + * or 0 if there is no second wall. + * @see #getOrientationA */ int getOrientationB(); /** - * Gets the boundary configuration of the wall. - * - * @return the boundary configuration + * A bitfield containing various flags: + *
{@code
+	 * object type id = bits & 0x20
+	 * orientation (0-3) = bits >>> 6 & 3
+	 * supports items = bits >>> 8 & 1
+	 * }
*/ int getConfig(); From feb2454e55083cc2a661660d8844294191963d53 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sun, 12 May 2019 23:49:36 -0600 Subject: [PATCH 2/3] mixins: Correct WallObject's clickbox The orientation is baked into the model and this var has nothing to do with what this method takes in this slot --- .../src/main/java/net/runelite/mixins/RSWallObjectMixin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSWallObjectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSWallObjectMixin.java index 3ef5358ffd..e5db24d686 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSWallObjectMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSWallObjectMixin.java @@ -101,8 +101,8 @@ public abstract class RSWallObjectMixin implements RSWallObject { Area clickbox = new Area(); - Area clickboxA = Perspective.getClickbox(client, getModelA(), getOrientationA(), getLocalLocation()); - Area clickboxB = Perspective.getClickbox(client, getModelB(), getOrientationB(), getLocalLocation()); + Area clickboxA = Perspective.getClickbox(client, getModelA(), 0, getLocalLocation()); + Area clickboxB = Perspective.getClickbox(client, getModelB(), 0, getLocalLocation()); if (clickboxA == null && clickboxB == null) { From f2935dcfdb629ae7b3a1748889dd323b6a892db8 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sun, 12 May 2019 23:59:03 -0600 Subject: [PATCH 3/3] mixins: Correct DecorativeObject's clickbox - getOrientation has nothing to do with getClickbox's orientation parameter - model A is offset by x/yOffset - model B exists sometimes --- .../mixins/RSDecorativeObjectMixin.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSDecorativeObjectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSDecorativeObjectMixin.java index e86e689fef..9bf27786eb 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSDecorativeObjectMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSDecorativeObjectMixin.java @@ -110,7 +110,29 @@ public abstract class RSDecorativeObjectMixin implements RSDecorativeObject @Override public Area getClickbox() { - return Perspective.getClickbox(client, getModel(), getOrientation(), getLocalLocation()); + Area clickbox = new Area(); + + LocalPoint lp = getLocalLocation(); + Area clickboxA = Perspective.getClickbox(client, getModel(), 0, + new LocalPoint(lp.getX() + getXOffset(), lp.getY() + getYOffset())); + Area clickboxB = Perspective.getClickbox(client, getModel2(), 0, lp); + + if (clickboxA == null && clickboxB == null) + { + return null; + } + + if (clickboxA != null) + { + clickbox.add(clickboxA); + } + + if (clickboxB != null) + { + clickbox.add(clickboxB); + } + + return clickbox; } @Inject