Add theoretical boost to item stat overlay
This commit is contained in:
@@ -37,13 +37,36 @@ import net.runelite.client.config.ConfigItem;
|
|||||||
public interface ItemStatConfig extends Config
|
public interface ItemStatConfig extends Config
|
||||||
{
|
{
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "tooltipMode",
|
keyName = "relative",
|
||||||
name = "Tooltip mode",
|
name = "Show Relative",
|
||||||
description = "How to show tooltip values"
|
description = "Show relative stat change in tooltip"
|
||||||
)
|
)
|
||||||
default TooltipMode tooltipMode()
|
|
||||||
|
default boolean relative()
|
||||||
{
|
{
|
||||||
return TooltipMode.BOTH;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "absolute",
|
||||||
|
name = "Show Absolute",
|
||||||
|
description = "Show absolute stat change in tooltip"
|
||||||
|
)
|
||||||
|
|
||||||
|
default boolean absolute()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "theoretical",
|
||||||
|
name = "Show Theoretical",
|
||||||
|
description = "Show theoretical stat change in tooltip"
|
||||||
|
)
|
||||||
|
|
||||||
|
default boolean theoretical()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
|
|||||||
@@ -56,11 +56,11 @@ public class ItemStatOverlay extends Overlay
|
|||||||
@Override
|
@Override
|
||||||
public Dimension render(Graphics2D graphics, Point parent)
|
public Dimension render(Graphics2D graphics, Point parent)
|
||||||
{
|
{
|
||||||
TooltipMode tooltipMode = config.tooltipMode();
|
if (!config.relative() && !config.absolute() && !config.theoretical())
|
||||||
if (tooltipMode == TooltipMode.OFF)
|
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
WidgetItem[] inventory = queryRunner.runQuery(new InventoryWidgetItemQuery());
|
WidgetItem[] inventory = queryRunner.runQuery(new InventoryWidgetItemQuery());
|
||||||
Point mousePos = new Point(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY());
|
Point mousePos = new Point(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY());
|
||||||
for (WidgetItem item : inventory)
|
for (WidgetItem item : inventory)
|
||||||
@@ -74,27 +74,7 @@ public class ItemStatOverlay extends Overlay
|
|||||||
StatsChanges statsChanges = change.calculate(client);
|
StatsChanges statsChanges = change.calculate(client);
|
||||||
for (StatChange c : statsChanges.getStatChanges())
|
for (StatChange c : statsChanges.getStatChanges())
|
||||||
{
|
{
|
||||||
b.append("<col=");
|
b.append(buildStatChangeString(c));
|
||||||
b.append(Integer.toHexString(Positivity.getColor(config, c.getPositivity()).getRGB() & 0xFFFFFF));
|
|
||||||
b.append(">");
|
|
||||||
if (tooltipMode.isRelative())
|
|
||||||
{
|
|
||||||
b.append(c.getRelative());
|
|
||||||
}
|
|
||||||
if (tooltipMode == TooltipMode.BOTH)
|
|
||||||
{
|
|
||||||
b.append(" (");
|
|
||||||
}
|
|
||||||
if (tooltipMode.isAbsolute())
|
|
||||||
{
|
|
||||||
b.append(c.getAbsolute());
|
|
||||||
}
|
|
||||||
if (tooltipMode == TooltipMode.BOTH)
|
|
||||||
{
|
|
||||||
b.append(")");
|
|
||||||
}
|
|
||||||
b.append(" ").append(c.getStat().getName());
|
|
||||||
b.append("</br>");
|
|
||||||
}
|
}
|
||||||
tooltipManager.add(new Tooltip(b.toString()));
|
tooltipManager.add(new Tooltip(b.toString()));
|
||||||
}
|
}
|
||||||
@@ -102,4 +82,41 @@ public class ItemStatOverlay extends Overlay
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String buildStatChangeString(StatChange c)
|
||||||
|
{
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
b.append("<col=");
|
||||||
|
b.append(Integer.toHexString(Positivity.getColor(config, c.getPositivity()).getRGB() & 0xFFFFFF));
|
||||||
|
b.append(">");
|
||||||
|
|
||||||
|
if (config.relative())
|
||||||
|
{
|
||||||
|
b.append(c.getRelative());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.theoretical())
|
||||||
|
{
|
||||||
|
b.append("/");
|
||||||
|
b.append(c.getTheoretical());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.absolute() && (config.relative() || config.theoretical()))
|
||||||
|
{
|
||||||
|
b.append(" (");
|
||||||
|
}
|
||||||
|
if (config.absolute())
|
||||||
|
{
|
||||||
|
b.append(c.getAbsolute());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.absolute() && (config.relative() || config.theoretical()))
|
||||||
|
{
|
||||||
|
b.append(")");
|
||||||
|
}
|
||||||
|
b.append(" ").append(c.getStat().getName());
|
||||||
|
b.append("</br>");
|
||||||
|
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public abstract class StatBoost extends SingleEffect
|
|||||||
}
|
}
|
||||||
out.setAbsolute(Integer.toString(newValue));
|
out.setAbsolute(Integer.toString(newValue));
|
||||||
out.setRelative(String.format("%+d", delta));
|
out.setRelative(String.format("%+d", delta));
|
||||||
|
out.setTheoretical(String.format("%+d", calcedDelta));
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,5 +36,6 @@ public class StatChange
|
|||||||
private Stat stat;
|
private Stat stat;
|
||||||
private String relative;
|
private String relative;
|
||||||
private String absolute;
|
private String absolute;
|
||||||
|
private String theoretical;
|
||||||
private Positivity positivity;
|
private Positivity positivity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2018 Abex
|
|
||||||
* 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.itemstats;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum TooltipMode
|
|
||||||
{
|
|
||||||
OFF("Off", 0x0),
|
|
||||||
RELATIVE("Relative", 0x1),
|
|
||||||
ABSOLUTE("Absolute", 0x2),
|
|
||||||
BOTH("Both", 0x3);
|
|
||||||
|
|
||||||
private final String display;
|
|
||||||
private final int value;
|
|
||||||
|
|
||||||
public boolean isRelative()
|
|
||||||
{
|
|
||||||
return (value & 0x01) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAbsolute()
|
|
||||||
{
|
|
||||||
return (value & 0x02) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return display;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user