diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-11-28 19:52:29 -0500 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-11-28 19:52:29 -0500 |
commit | 9f8b62e18d6b3066ef247d56ec523da5377d538c (patch) | |
tree | 2d300160a82b18e6c38743eb6f2d8454dc8d04e7 /src/main | |
parent | c8a8b90f64b3622141a634e95a75e452da383136 (diff) | |
download | SkyblockMod-9f8b62e18d6b3066ef247d56ec523da5377d538c.tar.gz SkyblockMod-9f8b62e18d6b3066ef247d56ec523da5377d538c.tar.bz2 SkyblockMod-9f8b62e18d6b3066ef247d56ec523da5377d538c.zip |
Add time until next level to skill xp/hour counter
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/me/Danker/TheMod.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 292af96..e07d4f1 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -182,6 +182,7 @@ public class TheMod public static double enchantingXPGained = 0; static double alchemyXP = 0; public static double alchemyXPGained = 0; + static double xpLeft = 0; public static String MAIN_COLOUR; public static String SECONDARY_COLOUR; @@ -376,7 +377,9 @@ public class TheMod if (!section.contains("Runecrafting") && !section.contains("Carpentry")) { int limit = section.contains("Farming") ? 60 : 50; double currentXP = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); - int previousXP = Utils.getPastXpEarned(Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")), limit); + int xpToLevelUp = Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")); + xpLeft = xpToLevelUp - currentXP; + int previousXP = Utils.getPastXpEarned(xpToLevelUp, limit); double totalXP = currentXP + previousXP; double xpGained = Double.parseDouble(section.substring(section.indexOf("+") + 1, section.indexOf(" ")).replace(",", "")); String skill = section.substring(section.indexOf(" ") + 1, section.lastIndexOf(" ")); @@ -1306,6 +1309,10 @@ public class TheMod String skillTrackerText = SKILL_TRACKER_COLOUR + lastSkill + " XP Earned: " + NumberFormat.getNumberInstance(Locale.US).format(xpToShow) + "\n" + SKILL_TRACKER_COLOUR + "Time Elapsed: " + Utils.getTimeBetween(0, skillStopwatch.getTime() / 1000d) + "\n" + SKILL_TRACKER_COLOUR + "XP Per Hour: " + NumberFormat.getIntegerInstance(Locale.US).format(xpPerHour); + if (xpLeft >= 0) { + String time = xpPerHour == 0 ? "Never" : Utils.getTimeBetween(0, xpLeft / (xpPerHour / 3600D)); + skillTrackerText += "\n" + SKILL_TRACKER_COLOUR + "Time Until Next Level: " + time; + } if (!skillStopwatch.isStarted() || skillStopwatch.isSuspended()) { skillTrackerText += "\n" + EnumChatFormatting.RED + "PAUSED"; } |