diff --git a/runelite-api/src/main/java/net/runelite/api/DecorativeObject.java b/runelite-api/src/main/java/net/runelite/api/DecorativeObject.java index b6e535b412..03bfc9df44 100644 --- a/runelite-api/src/main/java/net/runelite/api/DecorativeObject.java +++ b/runelite-api/src/main/java/net/runelite/api/DecorativeObject.java @@ -42,4 +42,14 @@ public interface DecorativeObject extends TileObject Renderable getRenderable(); Renderable getRenderable2(); + + Model getModel1(); + + Model getModel2(); + + int getYOffset(); + + int getXOffset(); + + int getOrientation(); } diff --git a/runelite-api/src/main/java/net/runelite/api/GameObject.java b/runelite-api/src/main/java/net/runelite/api/GameObject.java index 4a508f2180..c12744acbb 100644 --- a/runelite-api/src/main/java/net/runelite/api/GameObject.java +++ b/runelite-api/src/main/java/net/runelite/api/GameObject.java @@ -69,4 +69,8 @@ public interface GameObject extends TileObject Angle getOrientation(); Renderable getRenderable(); + + int getRsOrientation(); + + Model getModel(); } diff --git a/runelite-api/src/main/java/net/runelite/api/GroundObject.java b/runelite-api/src/main/java/net/runelite/api/GroundObject.java index 8a974cd752..828f61c8a9 100644 --- a/runelite-api/src/main/java/net/runelite/api/GroundObject.java +++ b/runelite-api/src/main/java/net/runelite/api/GroundObject.java @@ -30,4 +30,6 @@ package net.runelite.api; public interface GroundObject extends TileObject { Renderable getRenderable(); + + Model getModel(); } diff --git a/runelite-api/src/main/java/net/runelite/api/ItemLayer.java b/runelite-api/src/main/java/net/runelite/api/ItemLayer.java index 7be0b4b20b..b4317d8d8e 100644 --- a/runelite-api/src/main/java/net/runelite/api/ItemLayer.java +++ b/runelite-api/src/main/java/net/runelite/api/ItemLayer.java @@ -56,4 +56,8 @@ public interface ItemLayer extends TileObject * @return the top item */ Renderable getTop(); + + Model getModelBottom(); + Model getModelMiddle(); + Model getModelTop(); } 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..67bd09fbb5 100644 --- a/runelite-api/src/main/java/net/runelite/api/WallObject.java +++ b/runelite-api/src/main/java/net/runelite/api/WallObject.java @@ -52,4 +52,7 @@ public interface WallObject extends TileObject Renderable getRenderable1(); Renderable getRenderable2(); + + Model getModelA(); + Model getModelB(); } diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigItem.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigItem.java index bac268c761..031fd1fd34 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigItem.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigItem.java @@ -51,16 +51,24 @@ public @interface ConfigItem String unhide() default ""; + String unhideValue() default ""; + String hide() default ""; + String hideValue() default ""; + String parent() default ""; String enabledBy() default ""; + String enabledByValue() default ""; + String disabledBy() default ""; + String disabledByValue() default ""; + boolean parse() default false; Class clazz() default void.class; String method() default ""; -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/graphics/ModelOutlineRenderer.java b/runelite-client/src/main/java/net/runelite/client/graphics/ModelOutlineRenderer.java index 48276115af..203f16fdab 100644 --- a/runelite-client/src/main/java/net/runelite/client/graphics/ModelOutlineRenderer.java +++ b/runelite-client/src/main/java/net/runelite/client/graphics/ModelOutlineRenderer.java @@ -34,12 +34,18 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.List; import net.runelite.api.Client; +import net.runelite.api.DecorativeObject; +import net.runelite.api.GameObject; +import net.runelite.api.GroundObject; +import net.runelite.api.ItemLayer; import net.runelite.api.MainBufferProvider; import net.runelite.api.Model; import net.runelite.api.NPC; import net.runelite.api.NPCDefinition; import net.runelite.api.Perspective; import net.runelite.api.Player; +import net.runelite.api.TileObject; +import net.runelite.api.WallObject; import net.runelite.api.coords.LocalPoint; import net.runelite.client.task.Schedule; @@ -278,8 +284,7 @@ public class ModelOutlineRenderer * @param x1 The starting x position * @param x2 The ending x position */ - private void simulateHorizontalLineRasterizationForOutline( - int pixelPos, int x1, int x2) + private void simulateHorizontalLineRasterizationForOutline(int pixelPos, int x1, int x2) { if (x2 > clipX2) { @@ -337,8 +342,7 @@ public class ModelOutlineRenderer * @param x3 The starting x position of the second line * @param x4 The ending x position of the second line */ - private void outlineAroundHorizontalLine( - int pixelPos, int x1, int x2, int x3, int x4) + private void outlineAroundHorizontalLine(int pixelPos, int x1, int x2, int x3, int x4) { if (x1 < clipX1) { @@ -420,8 +424,7 @@ public class ModelOutlineRenderer * @param x3 The x position of the third vertex in the triangle * @param y3 The y position of the third vertex in the triangle */ - private void simulateTriangleRasterizationForOutline( - int x1, int y1, int x2, int y2, int x3, int y3) + private void simulateTriangleRasterizationForOutline(int x1, int y1, int x2, int y2, int x3, int y3) { // Swap vertices so y1 <= y2 <= y3 using bubble sort if (y1 > y2) @@ -615,8 +618,7 @@ public class ModelOutlineRenderer * @param vertexOrientation The orientation of the vertices * @return Returns true if any of them are inside the clip area, otherwise false */ - private boolean projectVertices(Model model, - final int localX, final int localY, final int localZ, final int vertexOrientation) + private boolean projectVertices(Model model, final int localX, final int localY, final int localZ, final int vertexOrientation) { final int cameraX = client.getCameraX(); final int cameraY = client.getCameraY(); @@ -742,8 +744,7 @@ public class ModelOutlineRenderer * @param innerColor The color of the pixels of the outline closest to the model * @param outerColor The color of the pixels of the outline furthest away from the model */ - private void renderOutline(BufferedImage image, int outlineWidth, - Color innerColor, Color outerColor) + private void renderOutline(BufferedImage image, int outlineWidth, Color innerColor, Color outerColor) { int[] imageData = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); List ps = getPriorityList(outlineWidth); @@ -886,9 +887,7 @@ public class ModelOutlineRenderer * @param innerColor The color of the pixels of the outline closest to the model * @param outerColor The color of the pixels of the outline furthest away from the model */ - private void drawModelOutline(Model model, - int localX, int localY, int localZ, int orientation, - int outlineWidth, Color innerColor, Color outerColor) + private void drawModelOutline(Model model, int localX, int localY, int localZ, int orientation, int outlineWidth, Color innerColor, Color outerColor) { if (outlineWidth <= 0) { @@ -930,8 +929,7 @@ public class ModelOutlineRenderer drawOutline(npc, outlineWidth, color, color); } - public void drawOutline(NPC npc, int outlineWidth, - Color innerColor, Color outerColor) + public void drawOutline(NPC npc, int outlineWidth, Color innerColor, Color outerColor) { int size = 1; NPCDefinition composition = npc.getTransformedDefinition(); @@ -959,8 +957,7 @@ public class ModelOutlineRenderer drawOutline(player, outlineWidth, color, color); } - public void drawOutline(Player player, int outlineWidth, - Color innerColor, Color outerColor) + public void drawOutline(Player player, int outlineWidth, Color innerColor, Color outerColor) { LocalPoint lp = player.getLocalLocation(); if (lp != null) @@ -970,4 +967,136 @@ public class ModelOutlineRenderer player.getOrientation(), outlineWidth, innerColor, outerColor); } } + + private void drawOutline(GameObject gameObject, int outlineWidth, Color innerColor, Color outerColor) + { + LocalPoint lp = gameObject.getLocalLocation(); + if (lp != null) + { + drawModelOutline(gameObject.getModel(), lp.getX(), lp.getY(), + Perspective.getTileHeight(client, lp, gameObject.getPlane()), + gameObject.getRsOrientation(), outlineWidth, innerColor, outerColor); + } + } + + private void drawOutline(GroundObject groundObject, int outlineWidth, Color innerColor, Color outerColor) + { + LocalPoint lp = groundObject.getLocalLocation(); + if (lp != null) + { + drawModelOutline(groundObject.getModel(), lp.getX(), lp.getY(), + Perspective.getTileHeight(client, lp, client.getPlane()), + 0, outlineWidth, innerColor, outerColor); + } + } + + private void drawOutline(ItemLayer itemLayer, int outlineWidth, Color innerColor, Color outerColor) + { + LocalPoint lp = itemLayer.getLocalLocation(); + if (lp != null) + { + Model model = itemLayer.getModelBottom(); + if (model != null) + { + drawModelOutline(model, lp.getX(), lp.getY(), + Perspective.getTileHeight(client, lp, itemLayer.getPlane()), + 0, outlineWidth, innerColor, outerColor); + } + + model = itemLayer.getModelMiddle(); + if (model != null) + { + drawModelOutline(model, lp.getX(), lp.getY(), + Perspective.getTileHeight(client, lp, itemLayer.getPlane()), + 0, outlineWidth, innerColor, outerColor); + } + + model = itemLayer.getModelTop(); + if (model != null) + { + drawModelOutline(model, lp.getX(), lp.getY(), + Perspective.getTileHeight(client, lp, itemLayer.getPlane()), + 0, outlineWidth, innerColor, outerColor); + } + } + } + + private void drawOutline(DecorativeObject decorativeObject, int outlineWidth, Color innerColor, Color outerColor) + { + LocalPoint lp = decorativeObject.getLocalLocation(); + if (lp != null) + { + Model model = decorativeObject.getModel1(); + if (model != null) + { + drawModelOutline(model, + lp.getX() + decorativeObject.getXOffset(), + lp.getY() + decorativeObject.getYOffset(), + Perspective.getTileHeight(client, lp, decorativeObject.getPlane()), + decorativeObject.getOrientation(), outlineWidth, innerColor, outerColor); + } + + model = decorativeObject.getModel2(); + if (model != null) + { + // Offset is not used for the second model + drawModelOutline(model, lp.getX(), lp.getY(), + Perspective.getTileHeight(client, lp, decorativeObject.getPlane()), + decorativeObject.getOrientation(), outlineWidth, innerColor, outerColor); + } + } + } + + private void drawOutline(WallObject wallObject, int outlineWidth, Color innerColor, Color outerColor) + { + LocalPoint lp = wallObject.getLocalLocation(); + if (lp != null) + { + Model model = wallObject.getModelA(); + if (model != null) + { + drawModelOutline(model, lp.getX(), lp.getY(), + Perspective.getTileHeight(client, lp, wallObject.getPlane()), + wallObject.getOrientationA(), outlineWidth, innerColor, outerColor); + } + + model = wallObject.getModelB(); + if (model != null) + { + drawModelOutline(model, lp.getX(), lp.getY(), + Perspective.getTileHeight(client, lp, wallObject.getPlane()), + wallObject.getOrientationB(), outlineWidth, innerColor, outerColor); + } + } + } + + public void drawOutline(TileObject tileObject, int outlineWidth, Color color) + { + drawOutline(tileObject, outlineWidth, color, color); + } + + public void drawOutline(TileObject tileObject, + int outlineWidth, Color innerColor, Color outerColor) + { + if (tileObject instanceof GameObject) + { + drawOutline((GameObject) tileObject, outlineWidth, innerColor, outerColor); + } + else if (tileObject instanceof GroundObject) + { + drawOutline((GroundObject) tileObject, outlineWidth, innerColor, outerColor); + } + else if (tileObject instanceof ItemLayer) + { + drawOutline((ItemLayer) tileObject, outlineWidth, innerColor, outerColor); + } + else if (tileObject instanceof DecorativeObject) + { + drawOutline((DecorativeObject) tileObject, outlineWidth, innerColor, outerColor); + } + else if (tileObject instanceof WallObject) + { + drawOutline((WallObject) tileObject, outlineWidth, innerColor, outerColor); + } + } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java index 39553d8271..4a4aec4bb8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java @@ -633,6 +633,26 @@ public class ConfigPanel extends PluginPanel { show = Boolean.parseBoolean(configManager.getConfiguration(cd.getGroup().value(), cid2.getItem().keyName())); } + else if (cid2.getType().isEnum()) + { + Class type = (Class) cid2.getType(); + try + { + Enum selectedItem = Enum.valueOf(type, configManager.getConfiguration(cd.getGroup().value(), cid2.getItem().keyName())); + if (!cid.getItem().unhideValue().equals("")) + { + show = selectedItem.toString().equals(cid.getItem().unhideValue()); + } + else if (!cid.getItem().hideValue().equals("")) + { + show = !selectedItem.toString().equals(cid.getItem().hideValue()); + } + } + catch (IllegalArgumentException ex) + { + log.info("So bad, so sad: {}", ex.toString()); + } + } } if (show) @@ -817,7 +837,7 @@ public class ConfigPanel extends PluginPanel } } }); - + if (cid.getItem().parse()) { JLabel parsingLabel = new JLabel(); @@ -1067,8 +1087,8 @@ public class ConfigPanel extends PluginPanel .splitToList(String.format("%s || %s", cid2.getItem().unhide(), cid2.getItem().hide())); if (itemHide.contains(cid.getItem().keyName())) - { // If another options visibility changes depending on the value of this checkbox, then render the entire menu again - + { + // If another options visibility changes depending on the value of this checkbox, then render the entire menu again reloadPluginlist(listItem, config, cd); } } @@ -1107,6 +1127,36 @@ public class ConfigPanel extends PluginPanel { JComboBox jComboBox = (JComboBox) component; configManager.setConfiguration(cd.getGroup().value(), cid.getItem().keyName(), ((Enum) jComboBox.getSelectedItem()).name()); + + for (ConfigItemDescriptor cid2 : cd.getItems()) + { + if (cid2.getItem().hidden() || !cid2.getItem().hide().isEmpty()) + { + List itemHide = Splitter + .onPattern("\\|\\|") + .trimResults() + .omitEmptyStrings() + .splitToList(String.format("%s || %s", cid2.getItem().unhide(), cid2.getItem().hide())); + + if (itemHide.contains(cid.getItem().keyName())) + { + reloadPluginlist(listItem, config, cd); + } + + String changedVal = ((Enum) jComboBox.getSelectedItem()).name(); + + if (cid2.getItem().enabledBy().contains(cid.getItem().keyName()) && cid2.getItem().enabledByValue().equals(changedVal)) + { + configManager.setConfiguration(cd.getGroup().value(), cid2.getItem().keyName(), "true"); + reloadPluginlist(listItem, config, cd); + } + else if (cid2.getItem().disabledBy().contains(cid.getItem().keyName()) && cid2.getItem().disabledByValue().equals(changedVal)) + { + configManager.setConfiguration(cd.getGroup().value(), cid2.getItem().keyName(), "false"); + reloadPluginlist(listItem, config, cd); + } + } + } } else if (component instanceof HotkeyButton) { @@ -1223,4 +1273,4 @@ public class ConfigPanel extends PluginPanel { openGroupConfigPanel(listItem, config, cd, true); } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsConfig.java index 7a59d02a33..5e57404903 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsConfig.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2019, Owain van Brakel * Copyright (c) 2018, Tomas Slusny * All rights reserved. * @@ -30,48 +31,85 @@ import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; import net.runelite.client.config.Range; +import net.runelite.client.config.Stub; @ConfigGroup("objectindicators") public interface ObjectIndicatorsConfig extends Config { @ConfigItem( - position = 0, + keyName = "overlayStub", + name = "Overlay Style", + description = "", + position = 0 + ) + default Stub overlayStub() + { + return new Stub(); + } + + @ConfigItem( + position = 1, + keyName = "objectMarkerRenderStyle", + name = "Highlight Style", + description = "Highlight setting", + parent = "overlayStub" + ) + default RenderStyle objectMarkerRenderStyle() + { + return RenderStyle.OUTLINE; + } + + + @ConfigItem( + position = 2, + keyName = "objectMarkerOutlineRenderStyle", + name = "Outline Style", + description = "Highlight outline setting", + parent = "overlayStub", + hidden = true, + unhide = "objectMarkerRenderStyle", + unhideValue = "OUTLINE" + ) + default OutlineRenderStyle objectMarkerOutlineRenderStyle() + { + return OutlineRenderStyle.NORMAL_OUTLINE; + } + + @ConfigItem( + keyName = "colorStub", + name = "Colors", + description = "", + position = 3 + ) + default Stub colorStub() + { + return new Stub(); + } + + @ConfigItem( + position = 4, keyName = "markerColor", name = "Marker color", - description = "Configures the color of object marker" + description = "Configures the outer color of object marker", + parent = "colorStub" ) - default Color markerColor() + default Color objectMarkerColor() { return Color.YELLOW; } @Range( - min = 0, - max = 10 + max = 100 ) @ConfigItem( - position = 1, - keyName = "stroke", - name = "Stroke Size", - description = "Configures the stroke size of object marker" - ) - default int stroke() - { - return 2; - } - - @Range( - min = 0, - max = 255 - ) - @ConfigItem( - position = 2, - keyName = "alpha", + position = 5, + keyName = "objectMarkerAlpha", name = "Alpha", - description = "Configures the opacity/alpha of object marker" + description = "Configures the opacity/alpha of object marker", + parent = "colorStub" ) - default int alpha() + default int objectMarkerAlpha() { - return 20; + return 100; } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java index 08c1aa94ff..a4e9aee7e9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2019, Owain van Brakel * Copyright (c) 2018, Tomas Slusny * All rights reserved. * @@ -24,33 +25,40 @@ */ package net.runelite.client.plugins.objectindicators; -import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Polygon; +import java.awt.geom.Area; +import static java.lang.Math.floor; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.DecorativeObject; import net.runelite.api.GameObject; import net.runelite.api.TileObject; +import net.runelite.client.graphics.ModelOutlineRenderer; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayPriority; +import net.runelite.client.ui.overlay.OverlayUtil; class ObjectIndicatorsOverlay extends Overlay { + private static final Color TRANSPARENT = new Color(0, 0, 0, 0); + private final Client client; private final ObjectIndicatorsConfig config; private final ObjectIndicatorsPlugin plugin; + private final ModelOutlineRenderer modelOutliner; @Inject - private ObjectIndicatorsOverlay(Client client, ObjectIndicatorsConfig config, ObjectIndicatorsPlugin plugin) + private ObjectIndicatorsOverlay(Client client, ObjectIndicatorsConfig config, ObjectIndicatorsPlugin plugin, ModelOutlineRenderer modelOutliner) { this.client = client; this.config = config; this.plugin = plugin; + this.modelOutliner = modelOutliner; setPosition(OverlayPosition.DYNAMIC); setPriority(OverlayPriority.LOW); setLayer(OverlayLayer.ABOVE_SCENE); @@ -66,46 +74,70 @@ class ObjectIndicatorsOverlay extends Overlay continue; } - final Polygon polygon; - Polygon polygon2 = null; + Color color = config.objectMarkerColor(); + int opacity = (int) floor(config.objectMarkerAlpha() * 2.55); + Color objectColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), opacity); - if (object instanceof GameObject) + switch (config.objectMarkerRenderStyle()) { - polygon = ((GameObject) object).getConvexHull(); - } - else if (object instanceof DecorativeObject) - { - polygon = ((DecorativeObject) object).getConvexHull(); - polygon2 = ((DecorativeObject) object).getConvexHull2(); - } - else - { - polygon = object.getCanvasTilePoly(); - } + case OUTLINE: + switch (config.objectMarkerOutlineRenderStyle()) + { + case THIN_OUTLINE: + modelOutliner.drawOutline(object, 1, objectColor); + break; - if (polygon != null) - { - renderPoly(graphics, polygon, config.markerColor(), config.stroke(), config.alpha()); - } + case NORMAL_OUTLINE: + modelOutliner.drawOutline(object, 2, objectColor); + break; - if (polygon2 != null) - { - renderPoly(graphics, polygon2, config.markerColor(), config.stroke(), config.alpha()); + case THIN_GLOW: + modelOutliner.drawOutline(object, 4, objectColor, TRANSPARENT); + break; + + case GLOW: + modelOutliner.drawOutline(object, 8, objectColor, TRANSPARENT); + break; + } + break; + case HULL: + final Polygon polygon; + Polygon polygon2 = null; + + if (object instanceof GameObject) + { + polygon = ((GameObject) object).getConvexHull(); + } + else if (object instanceof DecorativeObject) + { + polygon = ((DecorativeObject) object).getConvexHull(); + polygon2 = ((DecorativeObject) object).getConvexHull2(); + } + else + { + polygon = object.getCanvasTilePoly(); + } + + if (polygon != null) + { + OverlayUtil.renderPolygon(graphics, polygon, objectColor); + } + + if (polygon2 != null) + { + OverlayUtil.renderPolygon(graphics, polygon2, objectColor); + } + break; + case CLICKBOX: + Area clickbox = object.getClickbox(); + if (clickbox != null) + { + OverlayUtil.renderHoverableArea(graphics, object.getClickbox(), client.getMouseCanvasPosition(), TRANSPARENT, objectColor, objectColor.darker()); + } + break; } } return null; } - - private void renderPoly(Graphics2D graphics, Polygon polygon, Color color, int stroke, int alpha) - { - if (polygon != null) - { - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 255)); - graphics.setStroke(new BasicStroke(stroke)); - graphics.draw(polygon); - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha)); - graphics.fill(polygon); - } - } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/OutlineRenderStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/OutlineRenderStyle.java new file mode 100644 index 0000000000..2ed550f2b1 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/OutlineRenderStyle.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2019, Owain van Brakel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.client.plugins.objectindicators; + +public enum OutlineRenderStyle +{ + THIN_OUTLINE, + NORMAL_OUTLINE, + THIN_GLOW, + GLOW +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/RenderStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/RenderStyle.java new file mode 100644 index 0000000000..4ef9af24ca --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/RenderStyle.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2019, Owain van Brakel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.client.plugins.objectindicators; + +public enum RenderStyle +{ + CLICKBOX, + HULL, + OUTLINE +} \ No newline at end of file diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSBoundaryObjectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSBoundaryObjectMixin.java index 7d34fbe72f..698e5e4733 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSBoundaryObjectMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSBoundaryObjectMixin.java @@ -34,7 +34,7 @@ public abstract class RSBoundaryObjectMixin implements RSBoundaryObject } @Inject - private Model getModelA() + public Model getModelA() { Renderable renderable = getRenderable1(); if (renderable == null) @@ -53,7 +53,7 @@ public abstract class RSBoundaryObjectMixin implements RSBoundaryObject } @Inject - private Model getModelB() + public Model getModelB() { Renderable renderable = getRenderable2(); if (renderable == null) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSFloorDecorationMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSFloorDecorationMixin.java index fa25632e09..e1260cb83c 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSFloorDecorationMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSFloorDecorationMixin.java @@ -34,7 +34,8 @@ public abstract class RSFloorDecorationMixin implements RSFloorDecoration } @Inject - private Model getModel() + @Override + public Model getModel() { Renderable renderable = getRenderable(); if (renderable == null) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSGameObjectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSGameObjectMixin.java index 42d4001b4f..da84118774 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSGameObjectMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSGameObjectMixin.java @@ -59,7 +59,8 @@ public abstract class RSGameObjectMixin implements RSGameObject } @Inject - private RSModel getModel() + @Override + public RSModel getModel() { RSEntity renderable = getRenderable(); if (renderable == null) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundItemPileMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundItemPileMixin.java index 820150dbef..a12da101db 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundItemPileMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSGroundItemPileMixin.java @@ -1,6 +1,8 @@ package net.runelite.mixins; import java.awt.geom.Area; +import net.runelite.api.Model; +import net.runelite.api.Renderable; import net.runelite.api.mixins.Inject; import net.runelite.api.mixins.Mixin; import net.runelite.rs.api.RSGroundItemPile; @@ -31,4 +33,64 @@ public abstract class RSGroundItemPileMixin implements RSGroundItemPile { throw new UnsupportedOperationException(); } + + @Inject + @Override + public Model getModelBottom() + { + Renderable renderable = getBottom(); + if (renderable == null) + { + return null; + } + + if (renderable instanceof Model) + { + return (Model) renderable; + } + else + { + return renderable.getModel(); + } + } + + @Inject + @Override + public Model getModelMiddle() + { + Renderable renderable = getMiddle(); + if (renderable == null) + { + return null; + } + + if (renderable instanceof Model) + { + return (Model) renderable; + } + else + { + return renderable.getModel(); + } + } + + @Inject + @Override + public Model getModelTop() + { + Renderable renderable = getTop(); + if (renderable == null) + { + return null; + } + + if (renderable instanceof Model) + { + return (Model) renderable; + } + else + { + return renderable.getModel(); + } + } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSWallDecorationMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSWallDecorationMixin.java index 890e1161e0..53dc51e9bb 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSWallDecorationMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSWallDecorationMixin.java @@ -37,7 +37,8 @@ public abstract class RSWallDecorationMixin implements RSWallDecoration } @Inject - private RSModel getModel() + @Override + public RSModel getModel1() { RSEntity renderable = getRenderable(); if (renderable == null) @@ -60,7 +61,8 @@ public abstract class RSWallDecorationMixin implements RSWallDecoration } @Inject - private RSModel getModel2() + @Override + public RSModel getModel2() { RSEntity renderable = getRenderable2(); if (renderable == null) @@ -89,7 +91,7 @@ public abstract class RSWallDecorationMixin implements RSWallDecoration Area clickbox = new Area(); LocalPoint lp = getLocalLocation(); - Area clickboxA = Perspective.getClickbox(client, getModel(), 0, + Area clickboxA = Perspective.getClickbox(client, getModel1(), 0, new LocalPoint(lp.getX() + getXOffset(), lp.getY() + getYOffset())); Area clickboxB = Perspective.getClickbox(client, getModel2(), 0, lp); @@ -115,7 +117,7 @@ public abstract class RSWallDecorationMixin implements RSWallDecoration @Override public Polygon getConvexHull() { - RSModel model = getModel(); + RSModel model = getModel1(); if (model == null) { diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSGameObject.java b/runescape-api/src/main/java/net/runelite/rs/api/RSGameObject.java index 068cce5e3f..9d5d9bed74 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSGameObject.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSGameObject.java @@ -35,6 +35,7 @@ public interface RSGameObject extends GameObject int getHeight(); @Import("orientation") + @Override int getRsOrientation(); @Import("tag")