item charges: add toggle for guthix rest
Since guthix rest are not visibly different, but potions are, there are requests to restore the old behavior of having guthix rest on but potions off
This commit is contained in:
@@ -403,4 +403,16 @@ public interface ItemChargeConfig extends Config
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "showGuthixRestDoses",
|
||||||
|
name = "Guthix Rest Doses",
|
||||||
|
description = "Show Guthix Rest doses",
|
||||||
|
position = 29,
|
||||||
|
section = chargesSection
|
||||||
|
)
|
||||||
|
default boolean showGuthixRestDoses()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,18 +31,6 @@ import java.awt.Point;
|
|||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.widgets.WidgetItem;
|
import net.runelite.api.widgets.WidgetItem;
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.ABYSSAL_BRACELET;
|
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.AMULET_OF_BOUNTY;
|
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.AMULET_OF_CHEMISTRY;
|
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.BELLOWS;
|
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.FRUIT_BASKET;
|
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.FUNGICIDE_SPRAY;
|
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.IMPBOX;
|
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.POTION;
|
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.SACK;
|
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.TELEPORT;
|
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERCAN;
|
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERSKIN;
|
|
||||||
import net.runelite.client.ui.FontManager;
|
import net.runelite.client.ui.FontManager;
|
||||||
import net.runelite.client.ui.overlay.WidgetItemOverlay;
|
import net.runelite.client.ui.overlay.WidgetItemOverlay;
|
||||||
import net.runelite.client.ui.overlay.components.TextComponent;
|
import net.runelite.client.ui.overlay.components.TextComponent;
|
||||||
@@ -64,18 +52,11 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
|||||||
@Override
|
@Override
|
||||||
public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem widgetItem)
|
public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem widgetItem)
|
||||||
{
|
{
|
||||||
if (!displayOverlay())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
graphics.setFont(FontManager.getRunescapeSmallFont());
|
|
||||||
|
|
||||||
int charges;
|
int charges;
|
||||||
ItemWithConfig itemWithConfig = ItemWithConfig.findItem(itemId);
|
ItemWithConfig itemWithConfig = ItemWithConfig.findItem(itemId);
|
||||||
if (itemWithConfig != null)
|
if (itemWithConfig != null)
|
||||||
{
|
{
|
||||||
if (!itemWithConfig.getType().getEnabled().apply(config))
|
if (!itemWithConfig.getType().getEnabled().test(config))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -91,18 +72,7 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
|||||||
}
|
}
|
||||||
|
|
||||||
ItemChargeType type = chargeItem.getType();
|
ItemChargeType type = chargeItem.getType();
|
||||||
if ((type == TELEPORT && !config.showTeleportCharges())
|
if (!type.getEnabled().test(config))
|
||||||
|| (type == FUNGICIDE_SPRAY && !config.showFungicideCharges())
|
|
||||||
|| (type == IMPBOX && !config.showImpCharges())
|
|
||||||
|| (type == WATERCAN && !config.showWateringCanCharges())
|
|
||||||
|| (type == WATERSKIN && !config.showWaterskinCharges())
|
|
||||||
|| (type == BELLOWS && !config.showBellowCharges())
|
|
||||||
|| (type == FRUIT_BASKET && !config.showBasketCharges())
|
|
||||||
|| (type == SACK && !config.showSackCharges())
|
|
||||||
|| (type == ABYSSAL_BRACELET && !config.showAbyssalBraceletCharges())
|
|
||||||
|| (type == AMULET_OF_CHEMISTRY && !config.showAmuletOfChemistryCharges())
|
|
||||||
|| (type == AMULET_OF_BOUNTY && !config.showAmuletOfBountyCharges())
|
|
||||||
|| (type == POTION && !config.showPotionDoseCount()))
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -110,6 +80,8 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
|||||||
charges = chargeItem.getCharges();
|
charges = chargeItem.getCharges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
graphics.setFont(FontManager.getRunescapeSmallFont());
|
||||||
|
|
||||||
final Rectangle bounds = widgetItem.getCanvasBounds();
|
final Rectangle bounds = widgetItem.getCanvasBounds();
|
||||||
final TextComponent textComponent = new TextComponent();
|
final TextComponent textComponent = new TextComponent();
|
||||||
textComponent.setPosition(new Point(bounds.x - 1, bounds.y + 15));
|
textComponent.setPosition(new Point(bounds.x - 1, bounds.y + 15));
|
||||||
@@ -117,15 +89,4 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
|||||||
textComponent.setColor(itemChargePlugin.getColor(charges));
|
textComponent.setColor(itemChargePlugin.getColor(charges));
|
||||||
textComponent.render(graphics);
|
textComponent.render(graphics);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean displayOverlay()
|
|
||||||
{
|
|
||||||
return config.showTeleportCharges() || config.showDodgyCount() || config.showFungicideCharges()
|
|
||||||
|| config.showImpCharges() || config.showWateringCanCharges() || config.showWaterskinCharges()
|
|
||||||
|| config.showBellowCharges() || config.showBasketCharges() || config.showSackCharges()
|
|
||||||
|| config.showAbyssalBraceletCharges() || config.showExplorerRingCharges() || config.showRingOfForgingCount()
|
|
||||||
|| config.showAmuletOfChemistryCharges() || config.showAmuletOfBountyCharges() || config.showPotionDoseCount()
|
|
||||||
|| config.showBraceletOfSlaughterCharges() || config.showExpeditiousBraceletCharges();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -599,7 +599,7 @@ public class ItemChargePlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean enabled = type != null && type.getEnabled().apply(config);
|
boolean enabled = type != null && type.getEnabled().test(config);
|
||||||
|
|
||||||
if (showInfoboxes && enabled && charges > 0)
|
if (showInfoboxes && enabled && charges > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.itemcharges;
|
package net.runelite.client.plugins.itemcharges;
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Predicate;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@@ -50,7 +50,8 @@ enum ItemChargeType
|
|||||||
FRUIT_BASKET(ItemChargeConfig::showBasketCharges),
|
FRUIT_BASKET(ItemChargeConfig::showBasketCharges),
|
||||||
SACK(ItemChargeConfig::showSackCharges),
|
SACK(ItemChargeConfig::showSackCharges),
|
||||||
RING_OF_FORGING(ItemChargeConfig::showRingOfForgingCount),
|
RING_OF_FORGING(ItemChargeConfig::showRingOfForgingCount),
|
||||||
POTION(ItemChargeConfig::showPotionDoseCount);
|
POTION(ItemChargeConfig::showPotionDoseCount),
|
||||||
|
GUTHIX_REST(ItemChargeConfig::showGuthixRestDoses);
|
||||||
|
|
||||||
private final Function<ItemChargeConfig, Boolean> enabled;
|
private final Predicate<ItemChargeConfig> enabled;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,10 +231,10 @@ enum ItemWithCharge
|
|||||||
GLORYT4(TELEPORT, AMULET_OF_GLORY_T4, 4),
|
GLORYT4(TELEPORT, AMULET_OF_GLORY_T4, 4),
|
||||||
GLORYT5(TELEPORT, AMULET_OF_GLORY_T5, 5),
|
GLORYT5(TELEPORT, AMULET_OF_GLORY_T5, 5),
|
||||||
GLORYT6(TELEPORT, AMULET_OF_GLORY_T6, 6),
|
GLORYT6(TELEPORT, AMULET_OF_GLORY_T6, 6),
|
||||||
GREST1(POTION, GUTHIX_REST1, 1),
|
GREST1(GUTHIX_REST, GUTHIX_REST1, 1),
|
||||||
GREST2(POTION, GUTHIX_REST2, 2),
|
GREST2(GUTHIX_REST, GUTHIX_REST2, 2),
|
||||||
GREST3(POTION, GUTHIX_REST3, 3),
|
GREST3(GUTHIX_REST, GUTHIX_REST3, 3),
|
||||||
GREST4(POTION, GUTHIX_REST4, 4),
|
GREST4(GUTHIX_REST, GUTHIX_REST4, 4),
|
||||||
GUTHIX_BAL1(POTION, GUTHIX_BALANCE1, 1),
|
GUTHIX_BAL1(POTION, GUTHIX_BALANCE1, 1),
|
||||||
GUTHIX_BAL2(POTION, GUTHIX_BALANCE2, 2),
|
GUTHIX_BAL2(POTION, GUTHIX_BALANCE2, 2),
|
||||||
GUTHIX_BAL3(POTION, GUTHIX_BALANCE3, 3),
|
GUTHIX_BAL3(POTION, GUTHIX_BALANCE3, 3),
|
||||||
|
|||||||
Reference in New Issue
Block a user