xp tracker: add start and goal levels to on-canvas tracker
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.xptracker;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
@@ -31,8 +32,10 @@ import java.awt.Rectangle;
|
||||
import java.awt.image.BufferedImage;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Experience;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.SkillColor;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.components.ComponentOrientation;
|
||||
import net.runelite.client.ui.overlay.components.ImageComponent;
|
||||
@@ -113,6 +116,15 @@ class XpInfoBoxOverlay extends Overlay
|
||||
iconXpSplitPanel.getChildren().add(iconXpSplit);
|
||||
|
||||
final ProgressBarComponent progressBarComponent = new ProgressBarComponent();
|
||||
|
||||
progressBarComponent.setBackgroundColor(new Color(61, 56, 49));
|
||||
progressBarComponent.setForegroundColor(SkillColor.find(skill).getColor());
|
||||
|
||||
progressBarComponent.setLeftLabel(String.valueOf(snapshot.getStartLevel()));
|
||||
progressBarComponent.setRightLabel(snapshot.getEndGoalXp() == Experience.MAX_SKILL_XP
|
||||
? "200M"
|
||||
: String.valueOf(snapshot.getEndLevel()));
|
||||
|
||||
progressBarComponent.setValue(snapshot.getSkillProgressToGoal());
|
||||
|
||||
panel.getChildren().add(iconXpSplitPanel);
|
||||
|
||||
@@ -46,10 +46,14 @@ public class ProgressBarComponent implements LayoutableRenderableEntity
|
||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.0");
|
||||
private static final DecimalFormat DECIMAL_FORMAT_ABS = new DecimalFormat("#0");
|
||||
|
||||
private static final int SIDE_LABEL_OFFSET = 4;
|
||||
|
||||
private long minimum;
|
||||
private long maximum = 100;
|
||||
private double value;
|
||||
private LabelDisplayMode labelDisplayMode = LabelDisplayMode.PERCENTAGE;
|
||||
private String leftLabel;
|
||||
private String rightLabel;
|
||||
private Color foregroundColor = new Color(82, 161, 82);
|
||||
private Color backgroundColor = new Color(255, 255, 255, 127);
|
||||
private Color fontColor = Color.WHITE;
|
||||
@@ -99,6 +103,24 @@ public class ProgressBarComponent implements LayoutableRenderableEntity
|
||||
textComponent.setText(textToWrite);
|
||||
textComponent.render(graphics);
|
||||
|
||||
if (leftLabel != null)
|
||||
{
|
||||
final TextComponent leftTextComponent = new TextComponent();
|
||||
leftTextComponent.setPosition(new Point(barX + SIDE_LABEL_OFFSET, progressTextY));
|
||||
leftTextComponent.setColor(fontColor);
|
||||
leftTextComponent.setText(leftLabel);
|
||||
leftTextComponent.render(graphics);
|
||||
}
|
||||
|
||||
if (rightLabel != null)
|
||||
{
|
||||
final TextComponent leftTextComponent = new TextComponent();
|
||||
leftTextComponent.setPosition(new Point(barX + width - metrics.stringWidth(rightLabel) - SIDE_LABEL_OFFSET, progressTextY));
|
||||
leftTextComponent.setColor(fontColor);
|
||||
leftTextComponent.setText(rightLabel);
|
||||
leftTextComponent.render(graphics);
|
||||
}
|
||||
|
||||
final Dimension dimension = new Dimension(width, height);
|
||||
bounds.setLocation(preferredLocation);
|
||||
bounds.setSize(dimension);
|
||||
|
||||
Reference in New Issue
Block a user