Add config option that enables/disables mouse tooltip on rune pouch however since information is already available on screen if rune pouch is enabled.

This commit is contained in:
Lars Ørnlo
2018-05-05 19:01:59 +02:00
committed by Adam
parent ca8c8bef13
commit 43187c5f4c
3 changed files with 62 additions and 9 deletions

View File

@@ -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;
}
}

View File

@@ -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("</col></br>");
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));
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright (c) 2018, Lars <lars.oernlo@gmail.com>
* 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;
}
}