diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuConfig.java index 48d0d3efb3..0e44decfa0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuConfig.java @@ -28,16 +28,29 @@ import java.awt.Color; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.Stub; @ConfigGroup("runedoku") public interface RunedokuConfig extends Config { @ConfigItem( - position = 0, - keyName = "mindRuneColor", - name = "Mind Rune Color", - description = "Color used to highlight Mind runes." + position = 0, + keyName = "colorStub", + name = "Colors", + description = "" //stubs don't show descriptions when hovered over + ) + default Stub colorStub() + { + return new Stub(); + } + + @ConfigItem( + position = 1, + keyName = "mindRuneColor", + name = "Mind Rune Color", + description = "Color used to highlight Mind runes.", + parent = "colorStub" ) default Color mindRuneColor() { @@ -45,10 +58,11 @@ public interface RunedokuConfig extends Config } @ConfigItem( - position = 1, - keyName = "fireRuneColor", - name = "Fire Rune Color", - description = "Color used to highlight Fire runes." + position = 2, + keyName = "fireRuneColor", + name = "Fire Rune Color", + description = "Color used to highlight Fire runes.", + parent = "colorStub" ) default Color fireRuneColor() { @@ -56,10 +70,11 @@ public interface RunedokuConfig extends Config } @ConfigItem( - position = 2, - keyName = "bodyRuneColor", - name = "Body Rune Color", - description = "Color used to highlight Body runes." + position = 3, + keyName = "bodyRuneColor", + name = "Body Rune Color", + description = "Color used to highlight Body runes.", + parent = "colorStub" ) default Color bodyRuneColor() { @@ -67,10 +82,11 @@ public interface RunedokuConfig extends Config } @ConfigItem( - position = 3, - keyName = "airRuneColor", - name = "Air Rune Color", - description = "Color used to highlight Air runes." + position = 4, + keyName = "airRuneColor", + name = "Air Rune Color", + description = "Color used to highlight Air runes.", + parent = "colorStub" ) default Color airRuneColor() { @@ -78,10 +94,11 @@ public interface RunedokuConfig extends Config } @ConfigItem( - position = 4, - keyName = "deathRuneColor", - name = "Death Rune Color", - description = "Color used to highlight Death runes." + position = 5, + keyName = "deathRuneColor", + name = "Death Rune Color", + description = "Color used to highlight Death runes.", + parent = "colorStub" ) default Color deathRuneColor() { @@ -89,10 +106,11 @@ public interface RunedokuConfig extends Config } @ConfigItem( - position = 5, - keyName = "waterRuneColor", - name = "Water Rune Color", - description = "Color used to highlight Water runes." + position = 6, + keyName = "waterRuneColor", + name = "Water Rune Color", + description = "Color used to highlight Water runes.", + parent = "colorStub" ) default Color waterRuneColor() { @@ -100,10 +118,11 @@ public interface RunedokuConfig extends Config } @ConfigItem( - position = 6, - keyName = "chaosRuneColor", - name = "Chaos Rune Color", - description = "Color used to highlight Chaos runes." + position = 7, + keyName = "chaosRuneColor", + name = "Chaos Rune Color", + description = "Color used to highlight Chaos runes.", + parent = "colorStub" ) default Color chaosRuneColor() { @@ -111,10 +130,11 @@ public interface RunedokuConfig extends Config } @ConfigItem( - position = 7, - keyName = "earthRuneColor", - name = "Earth Rune Color", - description = "Color used to highlight Earth runes." + position = 8, + keyName = "earthRuneColor", + name = "Earth Rune Color", + description = "Color used to highlight Earth runes.", + parent = "colorStub" ) default Color earthRuneColor() { @@ -122,14 +142,37 @@ public interface RunedokuConfig extends Config } @ConfigItem( - position = 8, - keyName = "lawRuneColor", - name = "Law Rune Color", - description = "Color used to highlight Law runes." + position = 9, + keyName = "lawRuneColor", + name = "Law Rune Color", + description = "Color used to highlight Law runes.", + parent = "colorStub" ) default Color lawRuneColor() { return Color.CYAN; } + @ConfigItem( + position = 10, + keyName = "miscFeature", + name = "Miscellaneous Features", + description = "" + ) + default Stub miscFeature() + { + return new Stub(); + } + + @ConfigItem( + position = 11, + keyName = "onlyHighlightSelectedPiece", + name = "Only Highlight Selected Piece", + description = "Instead of showing all, this option only show what rune you have selected." + ) + default boolean onlyHighlightSelectedPiece() + { + return false; + } + } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuOverlay.java index 2394c66166..5e44e55bee 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuOverlay.java @@ -47,15 +47,17 @@ class RunedokuOverlay extends Overlay private final RunedokuPlugin plugin; private final Client client; private final RunedokuUtil util; + private final RunedokuConfig config; @Inject - private RunedokuOverlay(final RunedokuPlugin plugin, final Client client, final RunedokuUtil util) + private RunedokuOverlay(final RunedokuPlugin plugin, final Client client, final RunedokuUtil util, final RunedokuConfig config) { super(plugin); this.plugin = plugin; this.client = client; this.util = util; + this.config = config; setPosition(OverlayPosition.DETACHED); setLayer(OverlayLayer.ALWAYS_ON_TOP); @@ -138,7 +140,10 @@ class RunedokuOverlay extends Overlay } else { - OverlayUtil.renderPolygon(graphics, RunedokuUtil.rectangleToPolygon(squareToHighlight.getBounds()), util.sudokuPieceToColor(simpleArr.get(iteration))); + if (!config.onlyHighlightSelectedPiece() ^ (config.onlyHighlightSelectedPiece() && util.getSelectedPiece(client) == simpleArr.get(iteration))) + { + OverlayUtil.renderPolygon(graphics, RunedokuUtil.rectangleToPolygon(squareToHighlight.getBounds()), util.sudokuPieceToColor(simpleArr.get(iteration))); + } } iteration++; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuUtil.java b/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuUtil.java index 8dba20275d..36c5ac5662 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuUtil.java @@ -180,4 +180,41 @@ class RunedokuUtil return myArr; } + /** + * @param client + * @return + */ + int getSelectedPiece(Client client) + { + for (int i = 91; i < 100; i++) + { + Widget selectedPieceWidget = client.getWidget(288, i); + if (!selectedPieceWidget.isHidden()) + { + switch (i) + { + case 91: + return 8; + case 92: + return 6; + case 93: + return 4; + case 94: + return 2; + case 95: + return 1; + case 96: + return 3; + case 97: + return 5; + case 98: + return 7; + case 99: + return 9; + } + } + } + return -1; + } + }