diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-11-06 12:46:22 -0500 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-11-06 12:46:22 -0500 |
commit | 432ee590f73a08b184f0d0ec65b8549aa2f3e877 (patch) | |
tree | 2f45623e4528b20339ff9417666085243b1a039f /src/main | |
parent | dfe29936c3bf3c7189a9a4d73d4d1ec33122f7ea (diff) | |
download | SkyblockMod-432ee590f73a08b184f0d0ec65b8549aa2f3e877.tar.gz SkyblockMod-432ee590f73a08b184f0d0ec65b8549aa2f3e877.tar.bz2 SkyblockMod-432ee590f73a08b184f0d0ec65b8549aa2f3e877.zip |
Add support for farming 60
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/me/Danker/TheMod.java | 16 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/LobbySkillsCommand.java | 16 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/SkillsCommand.java | 16 | ||||
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 17 |
4 files changed, 38 insertions, 27 deletions
diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index bada8b8..e6cbfd0 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -328,12 +328,22 @@ public class TheMod String xpGained = section.substring(section.indexOf("+"), section.indexOf("(") - 1); double currentXp = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replaceAll(",", "")); - int previousXp = Utils.getPastXpEarned(Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", ""))); - double percentage = (double) Math.floor(((currentXp + previousXp) / 55172425) * 10000D) / 100D; + int limit; + int totalXp; + if (section.contains("Farming")) { + limit = 60; + totalXp = 111672425; + } else { + limit = 50; + totalXp = 55172425; + } + int previousXp = Utils.getPastXpEarned(Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")), limit); + double percentage = (double) Math.floor(((currentXp + previousXp) / totalXp) * 10000D) / 100D; + NumberFormat nf = NumberFormat.getNumberInstance(Locale.US); skillTimer = SKILL_TIME; showSkill = true; - skillText = EnumChatFormatting.AQUA + xpGained + " (" + NumberFormat.getNumberInstance(Locale.US).format(currentXp + previousXp) + "/55,172,425) " + percentage + "%"; + skillText = EnumChatFormatting.AQUA + xpGained + " (" + nf.format(currentXp + previousXp) + "/" + nf.format(totalXp) + ") " + percentage + "%"; } } } diff --git a/src/main/java/me/Danker/commands/LobbySkillsCommand.java b/src/main/java/me/Danker/commands/LobbySkillsCommand.java index 9eb01a3..dc89b63 100644 --- a/src/main/java/me/Danker/commands/LobbySkillsCommand.java +++ b/src/main/java/me/Danker/commands/LobbySkillsCommand.java @@ -103,35 +103,35 @@ public class LobbySkillsCommand extends CommandBase { if (latestProfile.has("experience_skill_farming") || latestProfile.has("experience_skill_mining") || latestProfile.has("experience_skill_combat") || latestProfile.has("experience_skill_foraging") || latestProfile.has("experience_skill_fishing") || latestProfile.has("experience_skill_enchanting") || latestProfile.has("experience_skill_alchemy")) { if (latestProfile.has("experience_skill_farming")) { - farmingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_farming").getAsDouble()); + farmingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_farming").getAsDouble(), 60); farmingLevel = (double) Math.round(farmingLevel * 100) / 100; } if (latestProfile.has("experience_skill_mining")) { - miningLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_mining").getAsDouble()); + miningLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_mining").getAsDouble(), 50); miningLevel = (double) Math.round(miningLevel * 100) / 100; } if (latestProfile.has("experience_skill_combat")) { - combatLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_combat").getAsDouble()); + combatLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_combat").getAsDouble(), 50); combatLevel = (double) Math.round(combatLevel * 100) / 100; } if (latestProfile.has("experience_skill_foraging")) { - foragingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_foraging").getAsDouble()); + foragingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_foraging").getAsDouble(), 50); foragingLevel = (double) Math.round(foragingLevel * 100) / 100; } if (latestProfile.has("experience_skill_fishing")) { - fishingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_fishing").getAsDouble()); + fishingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_fishing").getAsDouble(), 50); fishingLevel = (double) Math.round(fishingLevel * 100) / 100; } if (latestProfile.has("experience_skill_enchanting")) { - enchantingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_enchanting").getAsDouble()); + enchantingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_enchanting").getAsDouble(), 50); enchantingLevel = (double) Math.round(enchantingLevel * 100) / 100; } if (latestProfile.has("experience_skill_alchemy")) { - alchemyLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_alchemy").getAsDouble()); + alchemyLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_alchemy").getAsDouble(), 50); alchemyLevel = (double) Math.round(alchemyLevel * 100) / 100; } if (latestProfile.has("experience_skill_taming")) { - tamingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_taming").getAsDouble()); + tamingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_taming").getAsDouble(), 50); tamingLevel = (double) Math.round(tamingLevel * 100) / 100; } } else { diff --git a/src/main/java/me/Danker/commands/SkillsCommand.java b/src/main/java/me/Danker/commands/SkillsCommand.java index 50f2767..566443d 100644 --- a/src/main/java/me/Danker/commands/SkillsCommand.java +++ b/src/main/java/me/Danker/commands/SkillsCommand.java @@ -94,35 +94,35 @@ public class SkillsCommand extends CommandBase { if (userObject.has("experience_skill_farming") || userObject.has("experience_skill_mining") || userObject.has("experience_skill_combat") || userObject.has("experience_skill_foraging") || userObject.has("experience_skill_fishing") || userObject.has("experience_skill_enchanting") || userObject.has("experience_skill_alchemy")) { if (userObject.has("experience_skill_farming")) { - farmingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_farming").getAsDouble()); + farmingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_farming").getAsDouble(), 60); farmingLevel = (double) Math.round(farmingLevel * 100) / 100; } if (userObject.has("experience_skill_mining")) { - miningLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_mining").getAsDouble()); + miningLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_mining").getAsDouble(), 50); miningLevel = (double) Math.round(miningLevel * 100) / 100; } if (userObject.has("experience_skill_combat")) { - combatLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_combat").getAsDouble()); + combatLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_combat").getAsDouble(), 50); combatLevel = (double) Math.round(combatLevel * 100) / 100; } if (userObject.has("experience_skill_foraging")) { - foragingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_foraging").getAsDouble()); + foragingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_foraging").getAsDouble(), 50); foragingLevel = (double) Math.round(foragingLevel * 100) / 100; } if (userObject.has("experience_skill_fishing")) { - fishingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_fishing").getAsDouble()); + fishingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_fishing").getAsDouble(), 50); fishingLevel = (double) Math.round(fishingLevel * 100) / 100; } if (userObject.has("experience_skill_enchanting")) { - enchantingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_enchanting").getAsDouble()); + enchantingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_enchanting").getAsDouble(), 50); enchantingLevel = (double) Math.round(enchantingLevel * 100) / 100; } if (userObject.has("experience_skill_alchemy")) { - alchemyLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_alchemy").getAsDouble()); + alchemyLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_alchemy").getAsDouble(), 50); alchemyLevel = (double) Math.round(alchemyLevel * 100) / 100; } if (userObject.has("experience_skill_taming")) { - tamingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_taming").getAsDouble()); + tamingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_taming").getAsDouble(), 50); tamingLevel = (double) Math.round(tamingLevel * 100) / 100; } } else { diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 928e02f..7416c8e 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -36,10 +36,11 @@ public class Utils { public static boolean inSkyblock = false; public static boolean inDungeons = false; - static int[] skillXPPerLevel = {0, 50, 125, 200, 300, 500, 750, 1000, 1500, 2000, 3500, 5000, 7500, 10000, 15000, 20000, 30000, 50000, + public static int[] skillXPPerLevel = {0, 50, 125, 200, 300, 500, 750, 1000, 1500, 2000, 3500, 5000, 7500, 10000, 15000, 20000, 30000, 50000, 75000, 100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 1100000, 1200000, 1300000, 1400000, 1500000, 1600000, 1700000, 1800000, 1900000, 2000000, 2100000, 2200000, - 2300000, 2400000, 2500000, 2600000, 2750000, 2900000, 3100000, 3400000, 3700000, 4000000}; + 2300000, 2400000, 2500000, 2600000, 2750000, 2900000, 3100000, 3400000, 3700000, 4000000, 4300000, + 4600000, 4900000, 5200000, 5500000, 5800000, 6100000, 6400000, 6700000, 7000000}; static int[] dungeonsXPPerLevel = {0, 50, 75, 110, 160, 230, 330, 470, 670, 950, 1340, 1890, 2665, 3760, 5260, 7380, 10300, 14400, 20000, 27600, 38000, 52500, 71500, 97000, 132000, 180000, 243000, 328000, 445000, 600000, 800000, 1065000, 1410000, 1900000, 2500000, 3300000, 4300000, 5600000, 7200000, 9200000, 12000000, 15000000, @@ -212,14 +213,14 @@ public class Utils { return coinsSpentMillions + "M"; } - public static double xpToSkillLevel(double xp) { - for (int i = 0, xpAdded = 0; i < skillXPPerLevel.length; i++) { + public static double xpToSkillLevel(double xp, int limit) { + for (int i = 0, xpAdded = 0; i < limit + 1; i++) { xpAdded += skillXPPerLevel[i]; if (xp < xpAdded) { return (i - 1) + (xp - (xpAdded - skillXPPerLevel[i])) / skillXPPerLevel[i]; } } - return 50D; + return limit; } public static double xpToDungeonsLevel(double xp) { @@ -242,9 +243,9 @@ public class Utils { return -1; } - public static int getPastXpEarned(int currentLevelXp) { - if (currentLevelXp == 0) return 55172425; - for (int i = 1, xpAdded = 0; i < skillXPPerLevel.length; i++) { + public static int getPastXpEarned(int currentLevelXp, int limit) { + if (currentLevelXp == 0) return skillXPPerLevel[limit]; + for (int i = 1, xpAdded = 0; i < limit; i++) { xpAdded += skillXPPerLevel[i - 1]; if (currentLevelXp == skillXPPerLevel[i]) return xpAdded; } |