diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java index cc5344771a..d5d7cadba8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java @@ -71,11 +71,22 @@ public interface BoostsConfig extends Config return false; } + @ConfigItem( + keyName = "displayIconPanel", + name = "Icons", + description = "Show boosts next to icons (transparent background)", + position = 4 + ) + default boolean displayIcons() + { + return false; + } + @ConfigItem( keyName = "displayNextBuffChange", name = "Display next buff change", description = "Configures whether or not to display when the next buffed stat change will be", - position = 4 + position = 5 ) default DisplayChangeMode displayNextBuffChange() { @@ -86,7 +97,7 @@ public interface BoostsConfig extends Config keyName = "displayNextDebuffChange", name = "Display next debuff change", description = "Configures whether or not to display when the next debuffed stat change will be", - position = 5 + position = 6 ) default DisplayChangeMode displayNextDebuffChange() { @@ -97,7 +108,7 @@ public interface BoostsConfig extends Config keyName = "boostThreshold", name = "Boost Amount Threshold", description = "The amount of levels boosted to send a notification at. A value of 0 will disable notification.", - position = 6 + position = 7 ) default int boostThreshold() { @@ -108,7 +119,7 @@ public interface BoostsConfig extends Config keyName = "groupNotifications", name = "Group Notifications", description = "Configures whether or not to group notifications for multiple skills into a single notification", - position = 7 + position = 8 ) default boolean groupNotifications() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java index 49d9389462..113205ecfd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java @@ -62,7 +62,7 @@ class BoostsOverlay extends Overlay @Override public Dimension render(Graphics2D graphics) { - if (config.displayInfoboxes()) + if (config.displayInfoboxes() || config.displayIcons()) { return null; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsPlugin.java index 511359206e..5dabff0736 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsPlugin.java @@ -28,7 +28,7 @@ import com.google.common.collect.ImmutableSet; import com.google.inject.Provides; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import javax.inject.Inject; @@ -87,14 +87,16 @@ public class BoostsPlugin extends Plugin @Inject private BoostsOverlay boostsOverlay; + //made this a LinkedHashSet so the order stays consistent for my OCD + @Getter + private final Set shownSkills = new LinkedHashSet<>(); @Inject private BoostsConfig config; @Inject private SkillIconManager skillIconManager; - - @Getter - private final Set shownSkills = new HashSet<>(); + @Inject + private CombatIconsOverlay combatIconsOverlay; private boolean isChangedDown = false; private boolean isChangedUp = false; @@ -115,7 +117,7 @@ public class BoostsPlugin extends Plugin protected void startUp() throws Exception { overlayManager.add(boostsOverlay); - + overlayManager.add(combatIconsOverlay); updateShownSkills(); updateBoostedStats(); Arrays.fill(lastSkillLevels, -1); @@ -137,6 +139,7 @@ public class BoostsPlugin extends Plugin protected void shutDown() throws Exception { overlayManager.remove(boostsOverlay); + overlayManager.remove(combatIconsOverlay); infoBoxManager.removeIf(t -> t instanceof BoostIndicator || t instanceof StatChangeIndicator); preserveBeenActive = false; lastChangeDown = -1; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CombatIconsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CombatIconsOverlay.java new file mode 100644 index 0000000000..0609c4f1c8 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CombatIconsOverlay.java @@ -0,0 +1,137 @@ +package net.runelite.client.plugins.boosts; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; +import javax.inject.Inject; +import net.runelite.api.Client; +import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; +import net.runelite.api.Skill; +import net.runelite.client.game.SkillIconManager; +import net.runelite.client.ui.overlay.Overlay; +import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE; +import net.runelite.client.ui.overlay.OverlayMenuEntry; +import net.runelite.client.ui.overlay.OverlayPosition; +import net.runelite.client.ui.overlay.OverlayPriority; +import net.runelite.client.ui.overlay.components.ComponentOrientation; +import net.runelite.client.ui.overlay.components.ImageComponent; +import net.runelite.client.ui.overlay.components.LineComponent; +import net.runelite.client.ui.overlay.components.PanelComponent; +import net.runelite.client.util.ColorUtil; +import net.runelite.client.util.ImageUtil; + +class CombatIconsOverlay extends Overlay +{ + private final Client client; + private final BoostsConfig config; + private final PanelComponent panelComponent = new PanelComponent(); + private final SkillIconManager iconManager; + private final BoostsPlugin plugin; + + @Inject + private CombatIconsOverlay(Client client, BoostsConfig config, BoostsPlugin plugin, SkillIconManager iconManager) + { + super(plugin); + this.plugin = plugin; + this.client = client; + this.config = config; + this.iconManager = iconManager; + setPosition(OverlayPosition.TOP_LEFT); + setPriority(OverlayPriority.MED); + getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Boosts overlay")); + } + + @Override + public Dimension render(Graphics2D graphics) + { + if (config.displayInfoboxes() || !config.displayIcons()) + { + return null; + } + + panelComponent.getChildren().clear(); + panelComponent.setPreferredSize(new Dimension(28, 0)); + panelComponent.setWrapping(2); + panelComponent.setBackgroundColor(null); + panelComponent.setBorder(new Rectangle()); + + if (plugin.canShowBoosts()) + { + for (Skill skill : plugin.getShownSkills()) + { + final int boosted = client.getBoostedSkillLevel(skill); + final int base = client.getRealSkillLevel(skill); + + if (boosted == base) + { + continue; + } + + final int boost = boosted - base; + final Color strColor = getTextColor(boost); + String str; + + if (config.useRelativeBoost()) + { + str = String.valueOf(boost); + if (boost > 0) + { + str = "+" + str; + } + } + else + { + str = ColorUtil.prependColorTag(Integer.toString(boosted), strColor); + } + + BufferedImage skillImage = iconManager.getSkillImage(skill, true); + panelComponent.setOrientation(ComponentOrientation.HORIZONTAL); + panelComponent.getChildren().add(new ImageComponent(skillImage)); + panelComponent.getChildren().add(LineComponent.builder() + .left("") + .right(str) + .rightColor(strColor) + .build()); + } + } + + int nextChange = plugin.getChangeDownTicks(); + + if (nextChange != -1) + { + BufferedImage buffImage = ImageUtil.getResourceStreamFromClass(getClass(), "buffedSmall.png"); + panelComponent.getChildren().add(new ImageComponent(buffImage)); + panelComponent.getChildren().add(LineComponent.builder() + .left("") + .right(String.valueOf(plugin.getChangeTime(nextChange))) + .build()); + } + + nextChange = plugin.getChangeUpTicks(); + + if (nextChange != -1) + { + BufferedImage debuffImage = ImageUtil.getResourceStreamFromClass(getClass(), "debuffedSmall.png"); + panelComponent.getChildren().add(new ImageComponent(debuffImage)); + panelComponent.getChildren().add(LineComponent.builder() + .left("") + .right(String.valueOf(plugin.getChangeTime(nextChange))) + .build()); + } + + return panelComponent.render(graphics); + } + + private Color getTextColor(int boost) + { + if (boost < 0) + { + return new Color(238, 51, 51); + } + + return boost <= config.boostThreshold() ? Color.YELLOW : Color.GREEN; + + } +} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/buffedSmall.png b/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/buffedSmall.png new file mode 100644 index 0000000000..b204e0c54d Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/buffedSmall.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/debuffedSmall.png b/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/debuffedSmall.png new file mode 100644 index 0000000000..9afe14a537 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/debuffedSmall.png differ diff --git a/runelite-client/src/main/resources/skill_icons_small/attack.png b/runelite-client/src/main/resources/skill_icons_small/attack.png index 76a4f0f899..bb86b9f4af 100644 Binary files a/runelite-client/src/main/resources/skill_icons_small/attack.png and b/runelite-client/src/main/resources/skill_icons_small/attack.png differ diff --git a/runelite-client/src/main/resources/skill_icons_small/defence.png b/runelite-client/src/main/resources/skill_icons_small/defence.png index d35edc75c9..b7b1630910 100644 Binary files a/runelite-client/src/main/resources/skill_icons_small/defence.png and b/runelite-client/src/main/resources/skill_icons_small/defence.png differ diff --git a/runelite-client/src/main/resources/skill_icons_small/magic.png b/runelite-client/src/main/resources/skill_icons_small/magic.png index 871221f89b..7811389659 100644 Binary files a/runelite-client/src/main/resources/skill_icons_small/magic.png and b/runelite-client/src/main/resources/skill_icons_small/magic.png differ diff --git a/runelite-client/src/main/resources/skill_icons_small/strength.png b/runelite-client/src/main/resources/skill_icons_small/strength.png index 3c69b7bfa0..1d950c40a4 100644 Binary files a/runelite-client/src/main/resources/skill_icons_small/strength.png and b/runelite-client/src/main/resources/skill_icons_small/strength.png differ