Adds an option to make the boosts plugin look kinda neat
@@ -71,11 +71,22 @@ public interface BoostsConfig extends Config
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "displayIconPanel",
|
||||||
|
name = "Icons",
|
||||||
|
description = "Show boosts next to icons (transparent background)",
|
||||||
|
position = 4
|
||||||
|
)
|
||||||
|
default boolean displayIcons()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "displayNextBuffChange",
|
keyName = "displayNextBuffChange",
|
||||||
name = "Display next buff change",
|
name = "Display next buff change",
|
||||||
description = "Configures whether or not to display when the next buffed stat change will be",
|
description = "Configures whether or not to display when the next buffed stat change will be",
|
||||||
position = 4
|
position = 5
|
||||||
)
|
)
|
||||||
default DisplayChangeMode displayNextBuffChange()
|
default DisplayChangeMode displayNextBuffChange()
|
||||||
{
|
{
|
||||||
@@ -86,7 +97,7 @@ public interface BoostsConfig extends Config
|
|||||||
keyName = "displayNextDebuffChange",
|
keyName = "displayNextDebuffChange",
|
||||||
name = "Display next debuff change",
|
name = "Display next debuff change",
|
||||||
description = "Configures whether or not to display when the next debuffed stat change will be",
|
description = "Configures whether or not to display when the next debuffed stat change will be",
|
||||||
position = 5
|
position = 6
|
||||||
)
|
)
|
||||||
default DisplayChangeMode displayNextDebuffChange()
|
default DisplayChangeMode displayNextDebuffChange()
|
||||||
{
|
{
|
||||||
@@ -97,7 +108,7 @@ public interface BoostsConfig extends Config
|
|||||||
keyName = "boostThreshold",
|
keyName = "boostThreshold",
|
||||||
name = "Boost Amount Threshold",
|
name = "Boost Amount Threshold",
|
||||||
description = "The amount of levels boosted to send a notification at. A value of 0 will disable notification.",
|
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()
|
default int boostThreshold()
|
||||||
{
|
{
|
||||||
@@ -108,7 +119,7 @@ public interface BoostsConfig extends Config
|
|||||||
keyName = "groupNotifications",
|
keyName = "groupNotifications",
|
||||||
name = "Group Notifications",
|
name = "Group Notifications",
|
||||||
description = "Configures whether or not to group notifications for multiple skills into a single notification",
|
description = "Configures whether or not to group notifications for multiple skills into a single notification",
|
||||||
position = 7
|
position = 8
|
||||||
)
|
)
|
||||||
default boolean groupNotifications()
|
default boolean groupNotifications()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class BoostsOverlay extends Overlay
|
|||||||
@Override
|
@Override
|
||||||
public Dimension render(Graphics2D graphics)
|
public Dimension render(Graphics2D graphics)
|
||||||
{
|
{
|
||||||
if (config.displayInfoboxes())
|
if (config.displayInfoboxes() || config.displayIcons())
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import com.google.common.collect.ImmutableSet;
|
|||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -87,14 +87,16 @@ public class BoostsPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private BoostsOverlay boostsOverlay;
|
private BoostsOverlay boostsOverlay;
|
||||||
|
|
||||||
|
//made this a LinkedHashSet so the order stays consistent for my OCD
|
||||||
|
@Getter
|
||||||
|
private final Set<Skill> shownSkills = new LinkedHashSet<>();
|
||||||
@Inject
|
@Inject
|
||||||
private BoostsConfig config;
|
private BoostsConfig config;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private SkillIconManager skillIconManager;
|
private SkillIconManager skillIconManager;
|
||||||
|
@Inject
|
||||||
@Getter
|
private CombatIconsOverlay combatIconsOverlay;
|
||||||
private final Set<Skill> shownSkills = new HashSet<>();
|
|
||||||
|
|
||||||
private boolean isChangedDown = false;
|
private boolean isChangedDown = false;
|
||||||
private boolean isChangedUp = false;
|
private boolean isChangedUp = false;
|
||||||
@@ -115,7 +117,7 @@ public class BoostsPlugin extends Plugin
|
|||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
overlayManager.add(boostsOverlay);
|
overlayManager.add(boostsOverlay);
|
||||||
|
overlayManager.add(combatIconsOverlay);
|
||||||
updateShownSkills();
|
updateShownSkills();
|
||||||
updateBoostedStats();
|
updateBoostedStats();
|
||||||
Arrays.fill(lastSkillLevels, -1);
|
Arrays.fill(lastSkillLevels, -1);
|
||||||
@@ -137,6 +139,7 @@ public class BoostsPlugin extends Plugin
|
|||||||
protected void shutDown() throws Exception
|
protected void shutDown() throws Exception
|
||||||
{
|
{
|
||||||
overlayManager.remove(boostsOverlay);
|
overlayManager.remove(boostsOverlay);
|
||||||
|
overlayManager.remove(combatIconsOverlay);
|
||||||
infoBoxManager.removeIf(t -> t instanceof BoostIndicator || t instanceof StatChangeIndicator);
|
infoBoxManager.removeIf(t -> t instanceof BoostIndicator || t instanceof StatChangeIndicator);
|
||||||
preserveBeenActive = false;
|
preserveBeenActive = false;
|
||||||
lastChangeDown = -1;
|
lastChangeDown = -1;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 536 B |
|
After Width: | Height: | Size: 562 B |
|
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 308 B |
|
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 248 B |
|
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 319 B |
|
Before Width: | Height: | Size: 326 B After Width: | Height: | Size: 316 B |