From e23facf0d51acacf797b9f0d887cd065cfbccdb6 Mon Sep 17 00:00:00 2001 From: Journey Date: Thu, 11 Jul 2019 04:03:20 -0500 Subject: [PATCH] Status Orb Plugin: Fix run energy overlay Owain broke the overlay on the run energy orb by adding an extra if to the logic where it wasn't really needed so that it only ended up showing the overlay when the `run time left` option was enabled. This fixes it back to how it was originally where it always shows the overlay whenever you mouse over the run energy orb. --- .../plugins/statusorbs/StatusOrbsOverlay.java | 69 +++++++++---------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusorbs/StatusOrbsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusorbs/StatusOrbsOverlay.java index 901b2aa771..e6e2fce619 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusorbs/StatusOrbsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/statusorbs/StatusOrbsOverlay.java @@ -139,49 +139,46 @@ public class StatusOrbsOverlay extends Overlay renderRegen(g, WidgetInfo.MINIMAP_SPEC_ORB, percentSpec, SPECIAL_COLOR); } - if (plugin.isReplaceOrbText()) + final Widget runOrb = client.getWidget(WidgetInfo.MINIMAP_TOGGLE_RUN_ORB); + + if (runOrb == null || runOrb.isHidden()) { - final Widget runOrb = client.getWidget(WidgetInfo.MINIMAP_TOGGLE_RUN_ORB); + return null; + } - if (runOrb == null || runOrb.isHidden()) + final Rectangle bounds = runOrb.getBounds(); + + if (bounds.getX() <= 0) + { + return null; + } + + final Point mousePosition = client.getMouseCanvasPosition(); + + if (bounds.contains(mousePosition.getX(), mousePosition.getY())) + { + StringBuilder sb = new StringBuilder(); + sb.append("Weight: ").append(client.getWeight()).append(" kg
"); + + if (plugin.isReplaceOrbText()) { - return null; + sb.append("Run Energy: ").append(client.getEnergy()).append("%"); + } + else + { + sb.append("Run Time Remaining: ").append(plugin.getEstimatedRunTimeRemaining(false)); } - final Rectangle bounds = runOrb.getBounds(); - - if (bounds.getX() <= 0) + int secondsUntil100 = plugin.getEstimatedRecoverTimeRemaining(); + if (secondsUntil100 > 0) { - return null; + final int minutes = (int) Math.floor(secondsUntil100 / 60.0); + final int seconds = (int) Math.floor(secondsUntil100 - (minutes * 60.0)); + + sb.append("
").append("100% Energy In: ").append(minutes).append(':').append(StringUtils.leftPad(Integer.toString(seconds), 2, "0")); } - final Point mousePosition = client.getMouseCanvasPosition(); - - if (bounds.contains(mousePosition.getX(), mousePosition.getY())) - { - StringBuilder sb = new StringBuilder(); - sb.append("Weight: ").append(client.getWeight()).append(" kg
"); - - if (plugin.isReplaceOrbText()) - { - sb.append("Run Energy: ").append(client.getEnergy()).append("%"); - } - else - { - sb.append("Run Time Remaining: ").append(plugin.getEstimatedRunTimeRemaining(false)); - } - - int secondsUntil100 = plugin.getEstimatedRecoverTimeRemaining(); - if (secondsUntil100 > 0) - { - final int minutes = (int) Math.floor(secondsUntil100 / 60.0); - final int seconds = (int) Math.floor(secondsUntil100 - (minutes * 60.0)); - - sb.append("
").append("100% Energy In: ").append(minutes).append(':').append(StringUtils.leftPad(Integer.toString(seconds), 2, "0")); - } - - tooltipManager.add(new Tooltip(sb.toString())); - } + tooltipManager.add(new Tooltip(sb.toString())); } if (plugin.isShowRun()) @@ -225,4 +222,4 @@ public class StatusOrbsOverlay extends Overlay g.setColor(color); g.draw(arc); } -} \ No newline at end of file +}