From 43187c5f4ce001e4e682c0dea12eb5d89cea84e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20=C3=98rnlo?= Date: Sat, 5 May 2018 19:01:59 +0200 Subject: [PATCH] Add config option that enables/disables mouse tooltip on rune pouch however since information is already available on screen if rune pouch is enabled. --- .../plugins/runepouch/RunepouchConfig.java | 18 +++++--- .../plugins/runepouch/RunepouchOverlay.java | 8 +++- .../config/RunePouchOverlayMode.java | 45 +++++++++++++++++++ 3 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/runepouch/config/RunePouchOverlayMode.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchConfig.java index 8485aef51e..663dd9d94a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchConfig.java @@ -28,6 +28,7 @@ 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.plugins.runepouch.config.RunePouchOverlayMode; @ConfigGroup( keyName = "runepouch", @@ -39,7 +40,8 @@ public interface RunepouchConfig extends Config @ConfigItem( keyName = "fontcolor", name = "Font Color", - description = "Color of the font for the number of runes in pouch" + description = "Color of the font for the number of runes in pouch", + position = 1 ) default Color fontColor() { @@ -49,7 +51,8 @@ public interface RunepouchConfig extends Config @ConfigItem( keyName = "runeicons", name = "Show Rune Icons", - description = "Show the rune icons next to the number of runes in pouch" + description = "Show the rune icons next to the number of runes in pouch", + position = 2 ) default boolean showIcons() { @@ -57,12 +60,13 @@ public interface RunepouchConfig extends Config } @ConfigItem( - keyName = "showOnlyOnHover", - name = "Show only on hover", - description = "Show the runes only when hovered" + keyName = "runePouchOverlayMode", + name = "Display mode", + description = "Configures where rune pouch overlay is displayed", + position = 3 ) - default boolean showOnlyOnHover() + default RunePouchOverlayMode runePouchOverlayMode() { - return false; + return RunePouchOverlayMode.BOTH; } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java index dbbe54c565..5f6a5b3e63 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java @@ -37,6 +37,8 @@ import net.runelite.api.Varbits; import net.runelite.api.queries.InventoryWidgetItemQuery; import net.runelite.api.widgets.WidgetItem; import net.runelite.client.game.ItemManager; +import static net.runelite.client.plugins.runepouch.config.RunePouchOverlayMode.BOTH; +import static net.runelite.client.plugins.runepouch.config.RunePouchOverlayMode.MOUSE_HOVER; import net.runelite.client.ui.FontManager; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; @@ -125,7 +127,7 @@ public class RunepouchOverlay extends Overlay .append(rune.getName()) .append("
"); - if (config.showOnlyOnHover()) + if (config.runePouchOverlayMode() == MOUSE_HOVER) { continue; } @@ -154,7 +156,9 @@ public class RunepouchOverlay extends Overlay String tooltip = tooltipBuilder.toString(); - if (!tooltip.isEmpty() && runePouch.getCanvasBounds().contains(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY())) + if (!tooltip.isEmpty() + && runePouch.getCanvasBounds().contains(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY()) + && (config.runePouchOverlayMode() == MOUSE_HOVER || config.runePouchOverlayMode() == BOTH)) { tooltipManager.add(new Tooltip(tooltip)); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/config/RunePouchOverlayMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/config/RunePouchOverlayMode.java new file mode 100644 index 0000000000..2ea02e883c --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/config/RunePouchOverlayMode.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2018, Lars + * 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.runepouch.config; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum RunePouchOverlayMode +{ + INVENTORY("Inventory"), + MOUSE_HOVER("Mouse hover"), + BOTH("Both"); + + private final String name; + + @Override + public String toString() + { + return name; + } +}