XPGlobes: allow stacking vertically.
This commit is contained in:
@@ -171,4 +171,22 @@ public interface XpGlobesConfig extends Config
|
|||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "alignOrbsVertically",
|
||||||
|
name = "Vertical Orbs",
|
||||||
|
description = "Aligns the orbs vertically instead of horizontally.",
|
||||||
|
hidden = true
|
||||||
|
)
|
||||||
|
default boolean alignOrbsVertically()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "alignOrbsVertically",
|
||||||
|
name = "",
|
||||||
|
description = ""
|
||||||
|
)
|
||||||
|
void setAlignOrbsVertically(Boolean alignOrbsVertically);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import java.time.Instant;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY;
|
||||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.client.game.SkillIconManager;
|
import net.runelite.client.game.SkillIconManager;
|
||||||
@@ -63,6 +64,7 @@ public class XpGlobesOverlay extends Overlay
|
|||||||
private static final int PROGRESS_RADIUS_REMAINDER = 0;
|
private static final int PROGRESS_RADIUS_REMAINDER = 0;
|
||||||
private static final int TOOLTIP_RECT_SIZE_X = 150;
|
private static final int TOOLTIP_RECT_SIZE_X = 150;
|
||||||
private static final Color DARK_OVERLAY_COLOR = new Color(0, 0, 0, 180);
|
private static final Color DARK_OVERLAY_COLOR = new Color(0, 0, 0, 180);
|
||||||
|
static final String FLIP_ACTION = "Flip";
|
||||||
|
|
||||||
private final Client client;
|
private final Client client;
|
||||||
private final XpGlobesPlugin plugin;
|
private final XpGlobesPlugin plugin;
|
||||||
@@ -91,6 +93,7 @@ public class XpGlobesOverlay extends Overlay
|
|||||||
this.xpTooltip.getComponent().setPreferredSize(new Dimension(TOOLTIP_RECT_SIZE_X, 0));
|
this.xpTooltip.getComponent().setPreferredSize(new Dimension(TOOLTIP_RECT_SIZE_X, 0));
|
||||||
setPosition(OverlayPosition.TOP_CENTER);
|
setPosition(OverlayPosition.TOP_CENTER);
|
||||||
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "XP Globes overlay"));
|
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "XP Globes overlay"));
|
||||||
|
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, FLIP_ACTION, "XP Globes overlay"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -103,18 +106,32 @@ public class XpGlobesOverlay extends Overlay
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int curDrawX = 0;
|
int curDrawPosition = 0;
|
||||||
for (final XpGlobe xpGlobe : xpGlobes)
|
for (final XpGlobe xpGlobe : xpGlobes)
|
||||||
{
|
{
|
||||||
int startXp = xpTrackerService.getStartGoalXp(xpGlobe.getSkill());
|
int startXp = xpTrackerService.getStartGoalXp(xpGlobe.getSkill());
|
||||||
int goalXp = xpTrackerService.getEndGoalXp(xpGlobe.getSkill());
|
int goalXp = xpTrackerService.getEndGoalXp(xpGlobe.getSkill());
|
||||||
renderProgressCircle(graphics, xpGlobe, startXp, goalXp, curDrawX, 0, getBounds());
|
if (config.alignOrbsVertically())
|
||||||
curDrawX += MINIMUM_STEP + config.xpOrbSize();
|
{
|
||||||
|
renderProgressCircle(graphics, xpGlobe, startXp, goalXp, 0, curDrawPosition, getBounds());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
renderProgressCircle(graphics, xpGlobe, startXp, goalXp, curDrawPosition, 0, getBounds());
|
||||||
|
}
|
||||||
|
curDrawPosition += MINIMUM_STEP + config.xpOrbSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get width of markers
|
// Get length of markers
|
||||||
final int markersLength = (queueSize * (config.xpOrbSize())) + ((MINIMUM_STEP) * (queueSize - 1));
|
final int markersLength = (queueSize * (config.xpOrbSize())) + ((MINIMUM_STEP) * (queueSize - 1));
|
||||||
return new Dimension(markersLength, config.xpOrbSize());
|
if (config.alignOrbsVertically())
|
||||||
|
{
|
||||||
|
return new Dimension(config.xpOrbSize(), markersLength);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new Dimension(markersLength, config.xpOrbSize());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getSkillProgress(int startXp, int currentXp, int goalXp)
|
private double getSkillProgress(int startXp, int currentXp, int goalXp)
|
||||||
|
|||||||
@@ -35,11 +35,13 @@ import javax.inject.Inject;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.Experience;
|
import net.runelite.api.Experience;
|
||||||
|
import net.runelite.api.MenuAction;
|
||||||
import net.runelite.api.Skill;
|
import net.runelite.api.Skill;
|
||||||
import net.runelite.api.events.GameStateChanged;
|
import net.runelite.api.events.GameStateChanged;
|
||||||
import net.runelite.api.events.StatChanged;
|
import net.runelite.api.events.StatChanged;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
import net.runelite.client.events.OverlayMenuClicked;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDependency;
|
import net.runelite.client.plugins.PluginDependency;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
@@ -166,6 +168,21 @@ public class XpGlobesPlugin extends Plugin
|
|||||||
globeCache = new XpGlobe[Skill.values().length - 1];
|
globeCache = new XpGlobe[Skill.values().length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onOverlayMenuClicked(final OverlayMenuClicked event)
|
||||||
|
{
|
||||||
|
if (!(event.getEntry().getMenuAction() == MenuAction.RUNELITE_OVERLAY
|
||||||
|
&& event.getOverlay() == overlay))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getEntry().getOption().equals(XpGlobesOverlay.FLIP_ACTION))
|
||||||
|
{
|
||||||
|
config.setAlignOrbsVertically(!config.alignOrbsVertically());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameStateChanged(GameStateChanged event)
|
public void onGameStateChanged(GameStateChanged event)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user