Add "Actions left" for Xp globes
This commit is contained in:
@@ -24,9 +24,8 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.xpglobes;
|
||||
|
||||
import net.runelite.api.Skill;
|
||||
|
||||
import java.time.Instant;
|
||||
import net.runelite.api.Skill;
|
||||
|
||||
public class XpGlobe
|
||||
{
|
||||
|
||||
@@ -42,6 +42,7 @@ import net.runelite.api.Experience;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.client.game.SkillIconManager;
|
||||
import net.runelite.client.plugins.xptracker.XpTrackerService;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
@@ -54,6 +55,7 @@ public class XpGlobesOverlay extends Overlay
|
||||
private final Client client;
|
||||
private final XpGlobesPlugin plugin;
|
||||
private final XpGlobesConfig config;
|
||||
private final XpTrackerService xpTrackerService;
|
||||
|
||||
@Inject
|
||||
private SkillIconManager iconManager;
|
||||
@@ -68,13 +70,14 @@ public class XpGlobesOverlay extends Overlay
|
||||
private static final int TOOLTIP_RECT_SIZE_X = 150;
|
||||
|
||||
@Inject
|
||||
public XpGlobesOverlay(Client client, XpGlobesPlugin plugin, XpGlobesConfig config)
|
||||
public XpGlobesOverlay(Client client, XpGlobesPlugin plugin, XpGlobesConfig config, XpTrackerService xpTrackerService)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
this.xpTrackerService = xpTrackerService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -230,7 +233,12 @@ public class XpGlobesOverlay extends Overlay
|
||||
lines.add(new PanelComponent.Line("Current xp:", Color.ORANGE, skillCurrentXp, Color.WHITE));
|
||||
if (mouseOverSkill.getGoalXp() != -1)
|
||||
{
|
||||
String skillXpToLvl = decimalFormat.format(mouseOverSkill.getGoalXp() - mouseOverSkill.getCurrentXp());
|
||||
int actionsLeft = xpTrackerService.getActionsLeft(mouseOverSkill.getSkill());
|
||||
String actionsLeftString = decimalFormat.format(actionsLeft);
|
||||
lines.add(new PanelComponent.Line("Actions left:", Color.ORANGE, actionsLeftString, Color.WHITE));
|
||||
|
||||
int xpLeft = mouseOverSkill.getGoalXp() - mouseOverSkill.getCurrentXp();
|
||||
String skillXpToLvl = decimalFormat.format(xpLeft);
|
||||
lines.add(new PanelComponent.Line("Xp to level:", Color.ORANGE, skillXpToLvl, Color.WHITE));
|
||||
|
||||
//Create progress bar for skill.
|
||||
|
||||
@@ -39,13 +39,16 @@ import net.runelite.api.events.ExperienceChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.xptracker.XpTrackerPlugin;
|
||||
import net.runelite.client.task.Schedule;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "XP Globes"
|
||||
)
|
||||
@PluginDependency(XpTrackerPlugin.class)
|
||||
public class XpGlobesPlugin extends Plugin
|
||||
{
|
||||
private static final int SECONDS_TO_SHOW_GLOBE = 10;
|
||||
@@ -57,9 +60,6 @@ public class XpGlobesPlugin extends Plugin
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private XpGlobesConfig config;
|
||||
|
||||
@Inject
|
||||
private XpGlobesOverlay overlay;
|
||||
|
||||
|
||||
@@ -41,4 +41,11 @@ public interface XpTrackerService
|
||||
* @return
|
||||
*/
|
||||
int getActionsHr(Skill skill);
|
||||
|
||||
/**
|
||||
* Get the number of actions remaining
|
||||
* @param skill
|
||||
* @return
|
||||
*/
|
||||
int getActionsLeft(Skill skill);
|
||||
}
|
||||
|
||||
@@ -52,4 +52,10 @@ class XpTrackerServiceImpl implements XpTrackerService
|
||||
SkillXPInfo xpInfo = plugin.getSkillXpInfo(skill);
|
||||
return xpInfo.getActionsHr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActionsLeft(Skill skill)
|
||||
{
|
||||
return plugin.getSkillXpInfo(skill).getActionsRemaining();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user