From 72eb6d8b5df4c86fbf5fb63eb3edae0f8c7e14d8 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 13 Aug 2020 00:35:14 -0400 Subject: Add chat maddox menu and dungeons tracker Don't have strings for Spirit Bone, Spirit Boots or Spirit Pet. Hoping that Spirit Pet tracking works. --- src/main/java/me/Danker/utils/Utils.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 4749305..5dc30c6 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -5,17 +5,20 @@ import java.util.List; import java.util.regex.Matcher; import me.Danker.TheMod; +import me.Danker.handlers.ScoreboardHandler; import me.Danker.handlers.TextRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.StringUtils; public class Utils { + public static boolean inSkyblock = false; + public static int getItems(String item) { Minecraft mc = Minecraft.getMinecraft(); EntityPlayer player = mc.thePlayer; @@ -85,4 +88,19 @@ public class Utils { new TextRenderer(mc, text, titleX, titleY, scale); } + public static void checkForSkyblock() { + Minecraft mc = Minecraft.getMinecraft(); + if (mc != null && mc.theWorld != null && !mc.isSingleplayer()) { + ScoreObjective scoreboardObj = mc.theWorld.getScoreboard().getObjectiveInDisplaySlot(1); + if (scoreboardObj != null) { + String scObjName = ScoreboardHandler.cleanSB(scoreboardObj.getDisplayName()); + if (scObjName.contains("SKYBLOCK")) { + inSkyblock = true; + return; + } + } + } + inSkyblock = false; + } + } -- cgit From 67cb5cc2b84743a936aeb8aa3b9e875b2e24a5ea Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 18 Aug 2020 18:56:52 -0400 Subject: Fix capitalization of pets Also move capitalization into Utils --- src/main/java/me/Danker/commands/PetsCommand.java | 15 +++++---------- src/main/java/me/Danker/utils/Utils.java | 10 ++++++++++ 2 files changed, 15 insertions(+), 10 deletions(-) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/commands/PetsCommand.java b/src/main/java/me/Danker/commands/PetsCommand.java index 75367ab..4967964 100644 --- a/src/main/java/me/Danker/commands/PetsCommand.java +++ b/src/main/java/me/Danker/commands/PetsCommand.java @@ -51,11 +51,6 @@ public class PetsCommand extends CommandBase { return 100; } - static String capitalize(String string) { - String capitalized = string.substring(0, 1).toUpperCase() + string.substring(1).toLowerCase(); - return capitalized; - } - @Override public String getCommandName() { return "petsof"; @@ -169,7 +164,7 @@ public class PetsCommand extends CommandBase { // Loop through pet rarities for (JsonObject legPet : legendaryPets) { - String petName = capitalize(legPet.get("type").getAsString()); + String petName = Utils.capitalizeString(legPet.get("type").getAsString()); int level = petXpToLevel(legPet.get("exp").getAsDouble(), "LEGENDARY"); String messageToAdd = ""; @@ -183,7 +178,7 @@ public class PetsCommand extends CommandBase { } for (JsonObject epicPet: epicPets) { - String petName = capitalize(epicPet.get("type").getAsString()); + String petName = Utils.capitalizeString(epicPet.get("type").getAsString()); int level = petXpToLevel(epicPet.get("exp").getAsDouble(), "EPIC"); String messageToAdd = ""; @@ -197,7 +192,7 @@ public class PetsCommand extends CommandBase { } for (JsonObject rarePet: rarePets) { - String petName = capitalize(rarePet.get("type").getAsString()); + String petName = Utils.capitalizeString(rarePet.get("type").getAsString()); int level = petXpToLevel(rarePet.get("exp").getAsDouble(), "RARE"); String messageToAdd = ""; @@ -211,7 +206,7 @@ public class PetsCommand extends CommandBase { } for (JsonObject uncommonPet: uncommonPets) { - String petName = capitalize(uncommonPet.get("type").getAsString()); + String petName = Utils.capitalizeString(uncommonPet.get("type").getAsString()); int level = petXpToLevel(uncommonPet.get("exp").getAsDouble(), "UNCOMMON"); String messageToAdd = ""; @@ -225,7 +220,7 @@ public class PetsCommand extends CommandBase { } for (JsonObject commonPet: commonPets) { - String petName = capitalize(commonPet.get("type").getAsString()); + String petName = Utils.capitalizeString(commonPet.get("type").getAsString()); int level = petXpToLevel(commonPet.get("exp").getAsDouble(), "COMMON"); String messageToAdd = ""; diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 5dc30c6..835e613 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -103,4 +103,14 @@ public class Utils { inSkyblock = false; } + public static String capitalizeString(String string) { + String[] words = string.split("_"); + + for (int i = 0; i < words.length; i++) { + words[i] = words[i].substring(0, 1).toUpperCase() + words[i].substring(1).toLowerCase(); + } + + return String.join(" ", words); + } + } -- cgit From d23181a65d0e49ea612d7d1ea2ae53701cfe7f0b Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 20 Aug 2020 15:55:04 -0400 Subject: Add (unfinished) skyblock players command Still missing JSON key for Jerry Workshop --- README.md | 10 +- src/main/java/me/Danker/TheMod.java | 2 + src/main/java/me/Danker/commands/BankCommand.java | 3 +- src/main/java/me/Danker/commands/DHelpCommand.java | 5 +- .../me/Danker/commands/SkyblockPlayersCommand.java | 152 +++++++++++++++++++++ src/main/java/me/Danker/utils/Utils.java | 7 + 6 files changed, 172 insertions(+), 7 deletions(-) create mode 100644 src/main/java/me/Danker/commands/SkyblockPlayersCommand.java (limited to 'src/main/java/me/Danker/utils') diff --git a/README.md b/README.md index ce76f57..91a6bb8 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ Discord Server: https://discord.gg/QsEkNQS - Coordinate and angle display (toggleable, graphic display) (scalable) - Golden T10/T6/T4 enchant display (toggleable) - Slayer item tracker (with graphic display) (scalable) +- RNGesus drop alerts (toggleable) +- Click in chat to open Maddox (toggleable) - Fishing tracker (with graphic display) (scalable) - Dungeons tracker (with graphic display) (scalable) - API commands @@ -15,14 +17,14 @@ Discord Server: https://discord.gg/QsEkNQS ## Commands - /dhelp - Returns this message in-game. -- /toggle - Toggles features. /toggle list returns values of every toggle. +- /toggle - Toggles features. /toggle list returns values of every toggle. - /setkey - Sets API key. -- /getkey - Returns key set with /setkey. +- /getkey - Returns key set with /setkey and copies it to your clipboard. - /loot [winter/f(1-4)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. - /display [winter/f(1-4)/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. +- /resetloot - - Resets loot for trackers. /resetloot confirm confirms the reset. - /move - Moves text display to specified X and Y coordinates. - /scale - Scales text display to a specified multipler between 0.1x and 10x. -- /resetloot - - Resets loot for trackers. /resetloot confirm confirms the reset. - /slayer [player] - Uses API to get slayer xp of a person. If no name is provided, it checks yours. - /skills [player] - Uses API to get skill levels of a person. If no name is provided, it checks yours. - /guildof [player] - Uses API to get guild name and guild master of a person. If no name is provided, it checks yours. @@ -30,6 +32,7 @@ Discord Server: https://discord.gg/QsEkNQS - /bank [player] - Uses API to get bank and purse coins of a person. If no name is provided, it checks yours. - /armor [player] - Uses API to get armour of a person. If no name is provided, it checks yours. - /importfishing - Imports your fishing stats from your latest profile to your fishing tracker using the API. +- /sbplayers - Uses API to find how many players are on each Skyblock island. ### Notes - Slayer tracker for token drops and 20% chance drops uses a 12x12x12 bounding box centered on the player to detect the drops. If you are out of the range of the item drop, it will not count on the tracker. @@ -37,3 +40,4 @@ Discord Server: https://discord.gg/QsEkNQS - If you use too many API commands too fast, you can and will get rate-limited. - An incorrect API key will result in an HTTP error code of 403. - Importing fishing uses your sea creature kills, which may not always be exactly correct (e.x. someone else kills your sea creature). +- If you want the Maddox menu binded to a key, get a chat binding mod and use the command "/dmodopenmaddoxmenu" (Must have chat maddox enabled) diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index a1fc23a..8c04511 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -29,6 +29,7 @@ import me.Danker.commands.ResetLootCommand; import me.Danker.commands.ScaleCommand; import me.Danker.commands.SetkeyCommand; import me.Danker.commands.SkillsCommand; +import me.Danker.commands.SkyblockPlayersCommand; import me.Danker.commands.SlayerCommand; import me.Danker.commands.ToggleCommand; import me.Danker.handlers.APIHandler; @@ -141,6 +142,7 @@ public class TheMod ClientCommandHandler.instance.registerCommand(new ResetLootCommand()); ClientCommandHandler.instance.registerCommand(new ScaleCommand()); ClientCommandHandler.instance.registerCommand(new ChatMaddoxCommand()); + ClientCommandHandler.instance.registerCommand(new SkyblockPlayersCommand()); } // Update checker diff --git a/src/main/java/me/Danker/commands/BankCommand.java b/src/main/java/me/Danker/commands/BankCommand.java index 683dae7..952929f 100644 --- a/src/main/java/me/Danker/commands/BankCommand.java +++ b/src/main/java/me/Danker/commands/BankCommand.java @@ -26,8 +26,7 @@ public class BankCommand extends CommandBase { } @Override - public List getCommandAliases() - { + public List getCommandAliases() { return Collections.singletonList("purse"); } diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 3bfafa0..0693b76 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -39,14 +39,15 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /display [winter/f(1-4)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead.\n" + EnumChatFormatting.GOLD + " /resetloot " + EnumChatFormatting.AQUA + " - Resets loot for trackers. /resetloot confirm confirms the reset.\n" + EnumChatFormatting.GOLD + " /move " + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + - EnumChatFormatting.GOLD + " /scale " + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + EnumChatFormatting.GOLD + " /slayer [player]" + EnumChatFormatting.AQUA + " - Uses API to get slayer xp of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /skills [player]" + EnumChatFormatting.AQUA + " - Uses API to get skill levels of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /guildof [player]" + EnumChatFormatting.AQUA + " - Uses API to get guild name and guild master of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /petsof [player]" + EnumChatFormatting.AQUA + " - Uses API to get pets of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /bank [player]" + EnumChatFormatting.AQUA + " - Uses API to get bank and purse coins of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /armor [player]" + EnumChatFormatting.AQUA + " - Uses API to get armour of a person. If no name is provided, it checks yours.\n" + - EnumChatFormatting.GOLD + " /importfishing" + EnumChatFormatting.AQUA + " - Imports your fishing stats from your latest profile to your fishing tracker using the API.\n")); + EnumChatFormatting.GOLD + " /importfishing" + EnumChatFormatting.AQUA + " - Imports your fishing stats from your latest profile to your fishing tracker using the API.\n" + + EnumChatFormatting.GOLD + " /sbplayers" + EnumChatFormatting.AQUA + " - Uses API to find how many players are on each Skyblock island.\n")); } } diff --git a/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java new file mode 100644 index 0000000..98afa28 --- /dev/null +++ b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java @@ -0,0 +1,152 @@ +package me.Danker.commands; + +import java.text.NumberFormat; +import java.util.Collections; +import java.util.List; +import java.util.Locale; + +import com.google.gson.JsonObject; + +import me.Danker.handlers.APIHandler; +import me.Danker.handlers.ConfigHandler; +import me.Danker.utils.Utils; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; + +public class SkyblockPlayersCommand extends CommandBase { + + @Override + public String getCommandName() { + return "sbplayers"; + } + + @Override + public List getCommandAliases() { + return Collections.singletonList("skyblockplayers"); + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return null; + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } + + @Override + public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { + // MULTI THREAD DRIFTING + new Thread(() -> { + APIHandler ah = new APIHandler(); + ConfigHandler cf = new ConfigHandler(); + EntityPlayer player = (EntityPlayer) arg0; + + // Check key + String key = cf.getString("api", "APIKey"); + if (key.equals("")) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Use /setkey.")); + } + + String playersURL = "https://api.hypixel.net/gameCounts?key=" + key; + System.out.println("Fetching player count..."); + JsonObject playersResponse = ah.getResponse(playersURL); + if (!playersResponse.get("success").getAsBoolean()) { + String reason = playersResponse.get("cause").getAsString(); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: " + reason)); + return; + } + + int totalPlayers = playersResponse.get("playerCount").getAsInt(); + // Skyblock players, comments show JSON key + int skyblockTotalPlayers = 0; // players + int privateIsland = 0; // dynamic + int hub = 0; // hub + int barn = 0; // farming_1 + int mushroomDesert = 0; // farming_2 + int park = 0; // foraging_1 + int goldMine = 0; // mining_1 + int deepCaverns = 0; // mining_2 + int spidersDen = 0; // combat_1 + int blazingFortress = 0; // combat_2 + int end = 0; // combat_3 + int dungeonsHub = 0; // dungeon_hub + int dungeons = 0; // dungeon + int darkAuction = 0; // dark_auction + int jerry = 0; + if (playersResponse.get("games").getAsJsonObject().get("SKYBLOCK").getAsJsonObject().has("modes")) { + JsonObject skyblockPlayers = playersResponse.get("games").getAsJsonObject().get("SKYBLOCK").getAsJsonObject().get("modes").getAsJsonObject(); + skyblockTotalPlayers = playersResponse.get("games").getAsJsonObject().get("SKYBLOCK").getAsJsonObject().get("players").getAsInt(); + if (skyblockPlayers.has("dynamic")) { + privateIsland = skyblockPlayers.get("dynamic").getAsInt(); + } + if (skyblockPlayers.has("hub")) { + hub = skyblockPlayers.get("hub").getAsInt(); + } + if (skyblockPlayers.has("farming_1")) { + barn = skyblockPlayers.get("farming_1").getAsInt(); + } + if (skyblockPlayers.has("farming_2")) { + mushroomDesert = skyblockPlayers.get("farming_2").getAsInt(); + } + if (skyblockPlayers.has("foraging_1")) { + park = skyblockPlayers.get("foraging_1").getAsInt(); + } + if (skyblockPlayers.has("mining_1")) { + goldMine = skyblockPlayers.get("mining_1").getAsInt(); + } + if (skyblockPlayers.has("mining_2")) { + deepCaverns = skyblockPlayers.get("mining_2").getAsInt(); + } + if (skyblockPlayers.has("combat_1")) { + spidersDen = skyblockPlayers.get("combat_1").getAsInt(); + } + if (skyblockPlayers.has("combat_2")) { + blazingFortress = skyblockPlayers.get("combat_2").getAsInt(); + } + if (skyblockPlayers.has("combat_3")) { + end = skyblockPlayers.get("combat_3").getAsInt(); + } + if (skyblockPlayers.has("dungeon_hub")) { + dungeonsHub = skyblockPlayers.get("dungeon_hub").getAsInt(); + } + if (skyblockPlayers.has("dungeon")) { + dungeons = skyblockPlayers.get("dungeon").getAsInt(); + } + if (skyblockPlayers.has("dark_auction")) { + darkAuction = skyblockPlayers.get("dark_auction").getAsInt(); + } + // Placeholder value until Jerry Workshop opens + if (skyblockPlayers.has("jerry")) { + jerry = skyblockPlayers.get("jerry").getAsInt(); + } + } + + NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.GREEN + " Hypixel: " + EnumChatFormatting.DARK_GREEN + nf.format(totalPlayers) + "\n" + + EnumChatFormatting.GREEN + " Skyblock: " + EnumChatFormatting.DARK_GREEN + nf.format(skyblockTotalPlayers) + " / " + Utils.getPercentage(skyblockTotalPlayers, totalPlayers) + "%\n" + + EnumChatFormatting.GREEN + " Private Island: " + EnumChatFormatting.DARK_GREEN + nf.format(privateIsland) + " / " + Utils.getPercentage(privateIsland, skyblockTotalPlayers) + "%\n" + + EnumChatFormatting.GREEN + " Hub: " + EnumChatFormatting.DARK_GREEN + nf.format(hub) + " / " + Utils.getPercentage(hub, skyblockTotalPlayers) + "%\n" + + EnumChatFormatting.GREEN + " Barn: " + EnumChatFormatting.DARK_GREEN + nf.format(barn) + " / " + Utils.getPercentage(barn, skyblockTotalPlayers) + "%\n" + + EnumChatFormatting.GREEN + " Mushroom Desert: " + EnumChatFormatting.DARK_GREEN + nf.format(mushroomDesert) + " / " + Utils.getPercentage(mushroomDesert, skyblockTotalPlayers) + "%\n" + + EnumChatFormatting.GREEN + " Park: " + EnumChatFormatting.DARK_GREEN + nf.format(park) + " / " + Utils.getPercentage(park, skyblockTotalPlayers) + "%\n" + + EnumChatFormatting.GREEN + " Gold Mine: " + EnumChatFormatting.DARK_GREEN + nf.format(goldMine) + " / " + Utils.getPercentage(goldMine, skyblockTotalPlayers) + "%\n" + + EnumChatFormatting.GREEN + " Deep Caverns: " + EnumChatFormatting.DARK_GREEN + nf.format(deepCaverns) + " / " + Utils.getPercentage(deepCaverns, skyblockTotalPlayers) + "%\n" + + EnumChatFormatting.GREEN + " Spider's Den: " + EnumChatFormatting.DARK_GREEN + nf.format(spidersDen) + " / " + Utils.getPercentage(spidersDen, skyblockTotalPlayers) + "%\n" + + EnumChatFormatting.GREEN + " Blazing Fortress: " + EnumChatFormatting.DARK_GREEN + nf.format(blazingFortress) + " / " + Utils.getPercentage(blazingFortress, skyblockTotalPlayers) + "%\n" + + EnumChatFormatting.GREEN + " The End: " + EnumChatFormatting.DARK_GREEN + nf.format(end) + " / " + Utils.getPercentage(end, skyblockTotalPlayers) + "%\n" + + EnumChatFormatting.GREEN + " Dungeons Hub: " + EnumChatFormatting.DARK_GREEN + nf.format(dungeonsHub) + " / " + Utils.getPercentage(dungeonsHub, skyblockTotalPlayers) + "%\n" + + EnumChatFormatting.GREEN + " Dungeons: " + EnumChatFormatting.DARK_GREEN + nf.format(dungeons) + " / " + Utils.getPercentage(dungeons, skyblockTotalPlayers) + "%\n" + + EnumChatFormatting.GREEN + " Dark Auction: " + EnumChatFormatting.DARK_GREEN + nf.format(darkAuction) + " / " + Utils.getPercentage(darkAuction, skyblockTotalPlayers) + "%\n" + + EnumChatFormatting.GREEN + " Jerry's Workshop: " + EnumChatFormatting.DARK_GREEN + nf.format(jerry) + " / " + Utils.getPercentage(jerry, skyblockTotalPlayers) + "%\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); + }).start(); + } + +} diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 835e613..7153014 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -113,4 +113,11 @@ public class Utils { return String.join(" ", words); } + public static double getPercentage(int num1, int num2) { + if (num2 == 0) return 0D; + double result = ((double) num1 * 100D) / (double) num2; + result = Math.round(result * 100D) / 100D; + return result; + } + } -- cgit From ece7f3de65618ee89f86513e4d8307a97c20f012 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 25 Aug 2020 00:18:42 -0400 Subject: Add pet background (temporary) colours and fix Jerry Workshop /sbplayers Colours are temporary, will be changed in a future commit. --- README.md | 1 + src/main/java/me/Danker/TheMod.java | 50 +++++++++++++++++++++- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../me/Danker/commands/SkyblockPlayersCommand.java | 7 ++- .../java/me/Danker/commands/ToggleCommand.java | 16 ++++--- .../java/me/Danker/handlers/ConfigHandler.java | 2 + src/main/java/me/Danker/utils/Utils.java | 18 ++++++++ 7 files changed, 85 insertions(+), 11 deletions(-) (limited to 'src/main/java/me/Danker/utils') diff --git a/README.md b/README.md index 373ee6c..27713b2 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Discord Server: https://discord.gg/QsEkNQS - Maddox Menu keybind - Fishing tracker (with graphic display) (scalable) - Dungeons tracker (with graphic display) (scalable) +- Pet background colors based on level - API commands - Update checker diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index ae6a810..7fc7d92 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -41,23 +41,27 @@ import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; import net.minecraft.event.ClickEvent.Action; +import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; @@ -1317,6 +1321,7 @@ public class TheMod @SubscribeEvent(priority = EventPriority.HIGHEST) public void onSound(final PlaySoundEvent event) { + if (!Utils.inSkyblock) return; if (event.name.equals("note.pling")) { // Don't check twice within 3 seconds checkItemsNow = System.currentTimeMillis() / 1000; @@ -1369,6 +1374,7 @@ public class TheMod @SubscribeEvent(priority = EventPriority.HIGHEST) public void onTooltip(ItemTooltipEvent event) { + if (!Utils.inSkyblock) return; final ToggleCommand tc = new ToggleCommand(); if (event.toolTip == null) return; @@ -1412,11 +1418,53 @@ public class TheMod @SubscribeEvent public void onKey(KeyInputEvent event) { + if (!Utils.inSkyblock) return; if (keyBindings[0].isPressed()) { Minecraft.getMinecraft().thePlayer.sendChatMessage(lastMaddoxCommand); } } + @SubscribeEvent + public void onGuiRender(GuiScreenEvent.BackgroundDrawnEvent event) { + if (!Utils.inSkyblock) return; + if (ToggleCommand.petColoursToggled && event.gui instanceof GuiChest) { + GuiChest inventory = (GuiChest) event.gui; + List invSlots = inventory.inventorySlots.inventorySlots; + for (Slot slot : invSlots) { + ItemStack item = slot.getStack(); + if (item == null) continue; + if (item.getDisplayName().contains("[Lvl ")) { + int colour; + int petLevel = Integer.parseInt(item.getDisplayName().substring(item.getDisplayName().indexOf(" ") + 1, item.getDisplayName().indexOf("]"))); + if (petLevel == 100) { + colour = 0xBFF2D249; // Gold + } else if (petLevel >= 90) { + colour = 0xBFE06C65; // Red + } else if (petLevel >= 80) { + colour = 0xBF5F91C0; // Blue + } else if (petLevel >= 70) { + colour = 0xBF84CA85; // Green + } else if (petLevel >= 60) { + colour = 0xBFF6C100; // Goldish + } else if (petLevel >= 50) { + colour = 0xBFA575D2; // Purple + } else if (petLevel >= 40) { + colour = 0xBFFFA252; // Orange + } else if (petLevel >= 30) { + colour = 0xBF845EF7; // Bluish purple + } else if (petLevel >= 20) { + colour = 0xBFD6336C; // Magenta + } else if (petLevel >= 10) { + colour = 0xBF58C9A3; // Teal + } else { + colour = 0xBFFEBBD1; // Pink + } + Utils.drawOnSlot(slot.xDisplayPosition, slot.yDisplayPosition, colour); + } + } + } + } + public void increaseEmpSC() { LootCommand lc = new LootCommand(); ConfigHandler cf = new ConfigHandler(); diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 976e469..4b92137 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -33,7 +33,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.AQUA + " <> = Mandatory parameter. [] = Optional parameter.\n" + EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + - EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + EnumChatFormatting.GOLD + " /loot [winter/f(1-4)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + diff --git a/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java index 98afa28..ee3c522 100644 --- a/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java +++ b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java @@ -78,7 +78,7 @@ public class SkyblockPlayersCommand extends CommandBase { int dungeonsHub = 0; // dungeon_hub int dungeons = 0; // dungeon int darkAuction = 0; // dark_auction - int jerry = 0; + int jerry = 0; // winter if (playersResponse.get("games").getAsJsonObject().get("SKYBLOCK").getAsJsonObject().has("modes")) { JsonObject skyblockPlayers = playersResponse.get("games").getAsJsonObject().get("SKYBLOCK").getAsJsonObject().get("modes").getAsJsonObject(); skyblockTotalPlayers = playersResponse.get("games").getAsJsonObject().get("SKYBLOCK").getAsJsonObject().get("players").getAsInt(); @@ -121,9 +121,8 @@ public class SkyblockPlayersCommand extends CommandBase { if (skyblockPlayers.has("dark_auction")) { darkAuction = skyblockPlayers.get("dark_auction").getAsInt(); } - // Placeholder value until Jerry Workshop opens - if (skyblockPlayers.has("jerry")) { - jerry = skyblockPlayers.get("jerry").getAsInt(); + if (skyblockPlayers.has("winter")) { + jerry = skyblockPlayers.get("winter").getAsInt(); } } diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 1e07f3a..5c37b83 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -23,6 +23,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean spiritBearAlerts; public static boolean aotdToggled; public static boolean sceptreMessages; + public static boolean petColoursToggled; @Override public String getCommandName() { @@ -31,7 +32,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " "; + return getCommandName() + " "; } @Override @@ -42,7 +43,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "list"); + return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "petcolors", "list"); } return null; } @@ -53,7 +54,7 @@ public class ToggleCommand extends CommandBase implements ICommand { final ConfigHandler cf = new ConfigHandler(); if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle ")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle ")); return; } @@ -97,6 +98,10 @@ public class ToggleCommand extends CommandBase implements ICommand { sceptreMessages = !sceptreMessages; cf.writeBooleanConfig("toggles", "SceptreMessages", sceptreMessages); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Spirit Sceptre messages have been set to " + EnumChatFormatting.DARK_GREEN + sceptreMessages + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("petcolors") || arg1[0].equalsIgnoreCase("petcolours")) { + petColoursToggled = !petColoursToggled; + cf.writeBooleanConfig("toggles", "PetColors", petColoursToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Pet colours have been set to " + EnumChatFormatting.DARK_GREEN + petColoursToggled + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("list")) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Guild party notifications: " + EnumChatFormatting.DARK_GREEN + gpartyToggled + "\n" + EnumChatFormatting.GREEN + " Coord/Angle display: " + EnumChatFormatting.DARK_GREEN + coordsToggled + "\n" + @@ -107,9 +112,10 @@ public class ToggleCommand extends CommandBase implements ICommand { EnumChatFormatting.GREEN + " Chat Maddox menu: " + EnumChatFormatting.DARK_GREEN + chatMaddoxToggled + "\n" + EnumChatFormatting.GREEN + " Spirit Bear alerts: " + EnumChatFormatting.DARK_GREEN + spiritBearAlerts + "\n" + EnumChatFormatting.GREEN + " Block AOTD ability: " + EnumChatFormatting.DARK_GREEN + aotdToggled + "\n" + - EnumChatFormatting.GREEN + " Spirit Sceptre messages: " + EnumChatFormatting.DARK_GREEN + sceptreMessages)); + EnumChatFormatting.GREEN + " Spirit Sceptre messages: " + EnumChatFormatting.DARK_GREEN + sceptreMessages + "\n" + + EnumChatFormatting.GREEN + " Pet colours: " + EnumChatFormatting.DARK_GREEN + petColoursToggled)); } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle ")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle ")); } } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 2c6f48d..aa6f5ba 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -179,6 +179,7 @@ public class ConfigHandler { if (!hasKey("toggles", "SpiritBearAlerts")) writeBooleanConfig("toggles", "SpiritBearAlerts", true); if (!hasKey("toggles", "AOTD")) writeBooleanConfig("toggles", "AOTD", false); if (!hasKey("toggles", "SceptreMessages")) writeBooleanConfig("toggles", "SceptreMessages", true); + if (!hasKey("toggles", "PetColors")) writeBooleanConfig("toggles", "PetColors", false); if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); @@ -294,6 +295,7 @@ public class ConfigHandler { tf.spiritBearAlerts = getBoolean("toggles", "SpiritBearAlerts"); tf.aotdToggled = getBoolean("toggles", "AOTD"); tf.sceptreMessages = getBoolean("toggles", "SceptreMessages"); + tf.petColoursToggled = getBoolean("toggles", "PetColors"); final LootCommand lc = new LootCommand(); // Wolf diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 7153014..16f790a 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -4,13 +4,19 @@ import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; +import org.lwjgl.opengl.GL11; + import me.Danker.TheMod; import me.Danker.handlers.ScoreboardHandler; import me.Danker.handlers.TextRenderer; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StringUtils; @@ -120,4 +126,16 @@ public class Utils { return result; } + public static void drawOnSlot(int xSlotPos, int ySlotPos, int colour) { + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int guiLeft = (sr.getScaledWidth() - 176) / 2; + int guiTop = (sr.getScaledHeight() - 221) / 2; + int x = guiLeft + xSlotPos; + int y = guiTop + ySlotPos; + + GL11.glTranslated(0, 0, 1); + Gui.drawRect(x, y, x + 16, y + 16, colour); + GL11.glTranslated(0, 0, -1); + } + } -- cgit From d7ca24feedb3ec7226c2832da48bf9f5b1df8054 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 25 Aug 2020 16:41:13 -0400 Subject: Fix pet colour when chest isn't 6 rows --- src/main/java/me/Danker/TheMod.java | 4 +--- src/main/java/me/Danker/utils/Utils.java | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 454cb9c..770a77d 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -41,9 +41,7 @@ import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; @@ -1460,7 +1458,7 @@ public class TheMod } else { colour = 0xBFFEBBD1; // Pink } - Utils.drawOnSlot(slot.xDisplayPosition, slot.yDisplayPosition, colour); + Utils.drawOnSlot(inventory.inventorySlots.inventorySlots.size(), slot.xDisplayPosition, slot.yDisplayPosition, colour); } } } diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 16f790a..0a6cebc 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -12,11 +12,9 @@ import me.Danker.handlers.TextRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StringUtils; @@ -126,12 +124,14 @@ public class Utils { return result; } - public static void drawOnSlot(int xSlotPos, int ySlotPos, int colour) { + public static void drawOnSlot(int size, int xSlotPos, int ySlotPos, int colour) { ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); int guiLeft = (sr.getScaledWidth() - 176) / 2; int guiTop = (sr.getScaledHeight() - 221) / 2; int x = guiLeft + xSlotPos; int y = guiTop + ySlotPos; + // Move down when chest isn't 6 rows + if (size != 90) y += (6 - (size - 36) / 9) * 9; GL11.glTranslated(0, 0, 1); Gui.drawRect(x, y, x + 16, y + 16, colour); -- cgit From c1ddb82463894e7a2604d85b57f5be640bfbf115 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 27 Aug 2020 01:50:07 -0400 Subject: Fix pet colours being offset by 1 pixel on some GUI scales --- src/main/java/me/Danker/utils/Utils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 0a6cebc..45479f7 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -127,7 +127,7 @@ public class Utils { public static void drawOnSlot(int size, int xSlotPos, int ySlotPos, int colour) { ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); int guiLeft = (sr.getScaledWidth() - 176) / 2; - int guiTop = (sr.getScaledHeight() - 221) / 2; + int guiTop = (sr.getScaledHeight() - 222) / 2; int x = guiLeft + xSlotPos; int y = guiTop + ySlotPos; // Move down when chest isn't 6 rows -- cgit From 4a48ac021fa23aadb88f8f690880e6d58538fa0b Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 28 Aug 2020 16:06:07 -0400 Subject: Add coins and time (not working) to dungeons tracker, change pet colours Change pet colours to the Steam level colours because I'm uncreative --- src/main/java/me/Danker/TheMod.java | 136 ++++++++++++++++------ src/main/java/me/Danker/commands/LootCommand.java | 62 ++++------ src/main/java/me/Danker/utils/Utils.java | 29 +++++ 3 files changed, 155 insertions(+), 72 deletions(-) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 266b511..68d2546 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -679,7 +679,9 @@ public class TheMod cf.writeIntConfig("catacombs", "recombobulator", lc.recombobulators); } if (message.contains(" RARE REWARD! Fuming Potato Book")) { - + lc.fumingPotatoBooks++; + lc.fumingPotatoBooksSession++; + cf.writeIntConfig("catacombs", "fumingBooks", lc.fumingPotatoBooks); } // F1 if (message.contains(" RARE REWARD! Bonzo's Staff")) { @@ -687,12 +689,28 @@ public class TheMod lc.bonzoStaffsSession++; cf.writeIntConfig("catacombs", "bonzoStaff", lc.bonzoStaffs); } + if (message.contains("Defeated Bonzo in ")) { + String time = message.substring(message.lastIndexOf(" ") + 1, message.length()); + int minutes = Integer.parseInt(message.substring(message.indexOf("m"))); + int seconds = Integer.parseInt(message.substring(message.indexOf("m") + 1, message.indexOf("s"))); + // Prevent rounding off errors + lc.f1TimeSpent = Math.floor(lc.f1TimeSpent + (minutes * 60) + seconds); + lc.f1TimeSpentSession = Math.floor(lc.f1TimeSpentSession + (minutes * 60) + seconds); + } // F2 if (message.contains(" RARE REWARD! Scarf's Studies")) { lc.scarfStudies++; lc.scarfStudiesSession++; cf.writeIntConfig("catacombs", "scarfStudies", lc.scarfStudies); } + if (message.contains("Defeated Scarf in ")) { + String time = message.substring(message.lastIndexOf(" ") + 1, message.length()); + int minutes = Integer.parseInt(message.substring(message.indexOf("m"))); + int seconds = Integer.parseInt(message.substring(message.indexOf("m") + 1, message.indexOf("s"))); + // Prevent rounding off errors + lc.f2TimeSpent = Math.floor(lc.f2TimeSpent + (minutes * 60) + seconds); + lc.f2TimeSpentSession = Math.floor(lc.f2TimeSpentSession + (minutes * 60) + seconds); + } // F3 if (message.contains(" RARE REWARD! Adaptive Helmet")) { lc.adaptiveHelms++; @@ -719,6 +737,14 @@ public class TheMod lc.adaptiveSwordsSession++; cf.writeIntConfig("catacombs", "adaptiveSword", lc.adaptiveSwords); } + if (message.contains("Defeated The Professor in ")) { + String time = message.substring(message.lastIndexOf(" ") + 1, message.length()); + int minutes = Integer.parseInt(message.substring(message.indexOf("m"))); + int seconds = Integer.parseInt(message.substring(message.indexOf("m") + 1, message.indexOf("s"))); + // Prevent rounding off errors + lc.f3TimeSpent = Math.floor(lc.f3TimeSpent + (minutes * 60) + seconds); + lc.f3TimeSpentSession = Math.floor(lc.f3TimeSpentSession + (minutes * 60) + seconds); + } // F4 if (message.contains(" Spirit Wing")) { lc.spiritWings++; @@ -760,6 +786,14 @@ public class TheMod lc.spiritBowsSession++; cf.writeIntConfig("catacombs", "spiritBow", lc.spiritBows); } + if (message.contains("Defeated Thorn in ")) { + String time = message.substring(message.lastIndexOf(" ") + 1, message.length()); + int minutes = Integer.parseInt(message.substring(message.indexOf("m"))); + int seconds = Integer.parseInt(message.substring(message.indexOf("m") + 1, message.indexOf("s"))); + // Prevent rounding off errors + lc.f4TimeSpent = Math.floor(lc.f4TimeSpent + (minutes * 60) + seconds); + lc.f4TimeSpentSession = Math.floor(lc.f4TimeSpentSession + (minutes * 60) + seconds); + } // Chat Maddox if (message.contains("[OPEN MENU]")) { @@ -816,7 +850,7 @@ public class TheMod if (lc.wolfTime == -1) { timeBetween = "Never"; } else { - timeBetween = lc.getTimeBetween(lc.wolfTime, timeNow); + timeBetween = Utils.getTimeBetween(lc.wolfTime, timeNow); } if (lc.wolfBosses == -1) { bossesBetween = "Never"; @@ -855,7 +889,7 @@ public class TheMod if (lc.wolfTimeSession == -1) { timeBetween = "Never"; } else { - timeBetween = lc.getTimeBetween(lc.wolfTimeSession, timeNow); + timeBetween = Utils.getTimeBetween(lc.wolfTimeSession, timeNow); } if (lc.wolfBossesSession == -1) { bossesBetween = "Never"; @@ -894,7 +928,7 @@ public class TheMod if (lc.spiderTime == -1) { timeBetween = "Never"; } else { - timeBetween = lc.getTimeBetween(lc.spiderTime, timeNow); + timeBetween = Utils.getTimeBetween(lc.spiderTime, timeNow); } if (lc.spiderBosses == -1) { bossesBetween = "Never"; @@ -933,7 +967,7 @@ public class TheMod if (lc.spiderTimeSession == -1) { timeBetween = "Never"; } else { - timeBetween = lc.getTimeBetween(lc.spiderTimeSession, timeNow); + timeBetween = Utils.getTimeBetween(lc.spiderTimeSession, timeNow); } if (lc.spiderBossesSession == -1) { bossesBetween = "Never"; @@ -972,7 +1006,7 @@ public class TheMod if (lc.zombieTime == -1) { timeBetween = "Never"; } else { - timeBetween = lc.getTimeBetween(lc.zombieTime, timeNow); + timeBetween = Utils.getTimeBetween(lc.zombieTime, timeNow); } if (lc.zombieBosses == -1) { bossesBetween = "Never"; @@ -1013,7 +1047,7 @@ public class TheMod if (lc.zombieTimeSession == -1) { timeBetween = "Never"; } else { - timeBetween = lc.getTimeBetween(lc.zombieTimeSession, timeNow); + timeBetween = Utils.getTimeBetween(lc.zombieTimeSession, timeNow); } if (lc.zombieBossesSession == -1) { bossesBetween = "Never"; @@ -1054,7 +1088,7 @@ public class TheMod if (lc.empTime == -1) { timeBetween = "Never"; } else { - timeBetween = lc.getTimeBetween(lc.empTime, timeNow); + timeBetween = Utils.getTimeBetween(lc.empTime, timeNow); } if (lc.empSCs == -1) { bossesBetween = "Never"; @@ -1115,7 +1149,7 @@ public class TheMod if (lc.empTimeSession == -1) { timeBetween = "Never"; } else { - timeBetween = lc.getTimeBetween(lc.empTimeSession, timeNow); + timeBetween = Utils.getTimeBetween(lc.empTimeSession, timeNow); } if (lc.empSCsSession == -1) { bossesBetween = "Never"; @@ -1209,31 +1243,47 @@ public class TheMod } else if (ds.display.equals("catacombs_floor_one")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + - EnumChatFormatting.BLUE + "Bonzo's Staffs:"; + EnumChatFormatting.BLUE + "Bonzo's Staffs:\n" + + EnumChatFormatting.GREEN + "Coins Spent:\n" + + EnumChatFormatting.GREEN + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooks) + "\n" + - EnumChatFormatting.BLUE + nf.format(lc.bonzoStaffs); + EnumChatFormatting.BLUE + nf.format(lc.bonzoStaffs) + "\n" + + EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f1TimeSpent) + "\n" + + EnumChatFormatting.GREEN + nf.format(lc.f1CoinsSpent); } else if (ds.display.equals("catacombs_floor_one_session")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + - EnumChatFormatting.BLUE + "Bonzo's Staffs:"; + EnumChatFormatting.BLUE + "Bonzo's Staffs:\n" + + EnumChatFormatting.GREEN + "Coins Spent:\n" + + EnumChatFormatting.GREEN + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooksSession) + "\n" + - EnumChatFormatting.BLUE + nf.format(lc.bonzoStaffsSession); + EnumChatFormatting.BLUE + nf.format(lc.bonzoStaffsSession) + "\n" + + EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f1TimeSpentSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(lc.f1CoinsSpentSession); } else if (ds.display.equals("catacombs_floor_two")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + - EnumChatFormatting.BLUE + "Scarf's Studies:"; + EnumChatFormatting.BLUE + "Scarf's Studies:\n" + + EnumChatFormatting.GREEN + "Coins Spent:\n" + + EnumChatFormatting.GREEN + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooks) + "\n" + - EnumChatFormatting.BLUE + nf.format(lc.scarfStudies); + EnumChatFormatting.BLUE + nf.format(lc.scarfStudies) + "\n" + + EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f2TimeSpent) + "\n" + + EnumChatFormatting.GREEN + nf.format(lc.f2CoinsSpent); } else if (ds.display.equals("catacombs_floor_two_session")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + - EnumChatFormatting.BLUE + "Scarf's Studies:"; + EnumChatFormatting.BLUE + "Scarf's Studies:" + + EnumChatFormatting.GREEN + "Coins Spent:\n" + + EnumChatFormatting.GREEN + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooksSession) + "\n" + - EnumChatFormatting.BLUE + nf.format(lc.scarfStudiesSession); + EnumChatFormatting.BLUE + nf.format(lc.scarfStudiesSession) + "\n" + + EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f2TimeSpentSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(lc.f2CoinsSpentSession); } else if (ds.display.equals("catacombs_floor_three")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + @@ -1241,14 +1291,18 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Adaptive Chestplates:\n" + EnumChatFormatting.DARK_PURPLE + "Adaptive Leggings:\n" + EnumChatFormatting.DARK_PURPLE + "Adaptive Boots:\n" + - EnumChatFormatting.DARK_PURPLE + "Adaptive Blades:"; + EnumChatFormatting.DARK_PURPLE + "Adaptive Blades:" + + EnumChatFormatting.GREEN + "Coins Spent:\n" + + EnumChatFormatting.GREEN + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooks) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveHelms) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveChests) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveLegs) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveBoots) + "\n" + - EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveSwords); + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveSwords) + "\n" + + EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f3TimeSpent) + "\n" + + EnumChatFormatting.GREEN + nf.format(lc.f3CoinsSpent); } else if (ds.display.equals("catacombs_floor_three_session")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + @@ -1256,14 +1310,18 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Adaptive Chestplates:\n" + EnumChatFormatting.DARK_PURPLE + "Adaptive Leggings:\n" + EnumChatFormatting.DARK_PURPLE + "Adaptive Boots:\n" + - EnumChatFormatting.DARK_PURPLE + "Adaptive Blades:"; + EnumChatFormatting.DARK_PURPLE + "Adaptive Blades:" + + EnumChatFormatting.GREEN + "Coins Spent:\n" + + EnumChatFormatting.GREEN + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooksSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveHelmsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveChestsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveLegsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveBootsSession) + "\n" + - EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveSwordsSession); + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveSwordsSession) + "\n" + + EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f3TimeSpentSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(lc.f3CoinsSpentSession); } else if (ds.display.equals("catacombs_floor_four")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + @@ -1273,7 +1331,9 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Spirit Swords:\n" + EnumChatFormatting.GOLD + "Spirit Bows:\n" + EnumChatFormatting.DARK_PURPLE + "Epic Spirit Pets:\n" + - EnumChatFormatting.GOLD + "Leg Spirit Pets:"; + EnumChatFormatting.GOLD + "Leg Spirit Pets:" + + EnumChatFormatting.GREEN + "Coins Spent:\n" + + EnumChatFormatting.GREEN + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooks) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.spiritWings) + "\n" + @@ -1282,7 +1342,9 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + nf.format(lc.spiritSwords) + "\n" + EnumChatFormatting.GOLD + nf.format(lc.spiritBows) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.epicSpiritPets) + "\n" + - EnumChatFormatting.GOLD + nf.format(lc.legSpiritPets); + EnumChatFormatting.GOLD + nf.format(lc.legSpiritPets) + "\n" + + EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f4TimeSpent) + "\n" + + EnumChatFormatting.GREEN + nf.format(lc.f4CoinsSpent); } else if (ds.display.equals("catacombs_floor_four_session")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + @@ -1292,7 +1354,9 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Spirit Swords:\n" + EnumChatFormatting.GOLD + "Spirit Bows:\n" + EnumChatFormatting.DARK_PURPLE + "Epic Spirit Pets:\n" + - EnumChatFormatting.GOLD + "Leg Spirit Pets:"; + EnumChatFormatting.GOLD + "Leg Spirit Pets:" + + EnumChatFormatting.GREEN + "Coins Spent:\n" + + EnumChatFormatting.GREEN + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooksSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.spiritWingsSession) + "\n" + @@ -1301,7 +1365,9 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + nf.format(lc.spiritSwordsSession) + "\n" + EnumChatFormatting.GOLD + nf.format(lc.spiritBowsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.epicSpiritPetsSession) + "\n" + - EnumChatFormatting.GOLD + nf.format(lc.legSpiritPetsSession); + EnumChatFormatting.GOLD + nf.format(lc.legSpiritPetsSession) + "\n" + + EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f4TimeSpentSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(lc.f4CoinsSpentSession); } else { ConfigHandler cf = new ConfigHandler(); @@ -1438,25 +1504,25 @@ public class TheMod if (petLevel == 100) { colour = 0xBFF2D249; // Gold } else if (petLevel >= 90) { - colour = 0xBFE06C65; // Red + colour = 0xBF9E794E; // Brown } else if (petLevel >= 80) { - colour = 0xBF5F91C0; // Blue + colour = 0xBF5C1F35; // idk weird magenta } else if (petLevel >= 70) { - colour = 0xBF84CA85; // Green + colour = 0xBFD64FC8; // Pink } else if (petLevel >= 60) { - colour = 0xBFF6C100; // Goldish + colour = 0xBF7E4FC6; // Purple } else if (petLevel >= 50) { - colour = 0xBFA575D2; // Purple + colour = 0xBF008AD8; // Light Blue } else if (petLevel >= 40) { - colour = 0xBFFFA252; // Orange + colour = 0xBF0EAC35; // Green } else if (petLevel >= 30) { - colour = 0xBF845EF7; // Bluish purple + colour = 0xBFFFC400; // Yellow } else if (petLevel >= 20) { - colour = 0xBFD6336C; // Magenta + colour = 0xBFEF5230; // Orange } else if (petLevel >= 10) { - colour = 0xBF58C9A3; // Teal + colour = 0xBFD62440; // Red } else { - colour = 0xBFFEBBD1; // Pink + colour = 0xBF999999; // Gray } Utils.drawOnSlot(inventory.inventorySlots.inventorySlots.size(), slot.xDisplayPosition, slot.yDisplayPosition, colour); } diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index fcd0973..fd65c58 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -4,6 +4,7 @@ import java.text.NumberFormat; import java.util.List; import java.util.Locale; +import me.Danker.utils.Utils; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; @@ -86,14 +87,20 @@ public class LootCommand extends CommandBase { public static int fumingPotatoBooks; // F1 public static int bonzoStaffs; + public static double f1CoinsSpent; + public static double f1TimeSpent; // F2 public static int scarfStudies; + public static double f2CoinsSpent; + public static double f2TimeSpent; // F3 public static int adaptiveHelms; public static int adaptiveChests; public static int adaptiveLegs; public static int adaptiveBoots; public static int adaptiveSwords; + public static double f3CoinsSpent; + public static double f3TimeSpent; // F4 public static int spiritWings; public static int spiritBones; @@ -102,6 +109,8 @@ public class LootCommand extends CommandBase { public static int spiritBows; public static int epicSpiritPets; public static int legSpiritPets; + public static double f4CoinsSpent; + public static double f4TimeSpent; // Single sessions (No config saves) // Wolf @@ -177,14 +186,20 @@ public class LootCommand extends CommandBase { public static int fumingPotatoBooksSession = 0; // F1 public static int bonzoStaffsSession = 0; + public static double f1CoinsSpentSession = 0; + public static double f1TimeSpentSession = 0; // F2 public static int scarfStudiesSession = 0; + public static double f2CoinsSpentSession = 0; + public static double f2TimeSpentSession = 0; // F3 public static int adaptiveHelmsSession = 0; public static int adaptiveChestsSession = 0; public static int adaptiveLegsSession = 0; public static int adaptiveBootsSession = 0; public static int adaptiveSwordsSession = 0; + public static double f3CoinsSpentSession = 0; + public static double f3TimeSpentSession = 0; // F4 public static int spiritWingsSession = 0; public static int spiritBonesSession = 0; @@ -193,35 +208,8 @@ public class LootCommand extends CommandBase { public static int spiritBowsSession = 0; public static int epicSpiritPetsSession = 0; public static int legSpiritPetsSession = 0; - - public String getTimeBetween(double timeOne, double timeTwo) { - double secondsBetween = Math.floor(timeTwo - timeOne); - - String timeFormatted = ""; - int days; - int hours; - int minutes; - int seconds; - - if (secondsBetween > 86400) { - // More than 1d, display #d#h - days = (int) (secondsBetween / 86400); - hours = (int) (secondsBetween % 86400 / 3600); - timeFormatted = days + "d" + hours + "h"; - } else if (secondsBetween > 3600) { - // More than 1h, display #h#m - hours = (int) (secondsBetween / 3600); - minutes = (int) (secondsBetween % 3600 / 60); - timeFormatted = hours + "h" + minutes + "m"; - } else { - // Display #m#s - minutes = (int) (secondsBetween / 60); - seconds = (int) (secondsBetween % 60); - timeFormatted = minutes + "m" + seconds + "s"; - } - - return timeFormatted; - } + public static double f4CoinsSpentSession = 0; + public static double f4TimeSpentSession = 0; @Override public String getCommandName() { @@ -275,7 +263,7 @@ public class LootCommand extends CommandBase { if (wolfTimeSession == -1) { timeBetween = "Never"; } else { - timeBetween = getTimeBetween(wolfTimeSession, timeNow); + timeBetween = Utils.getTimeBetween(wolfTimeSession, timeNow); } if (wolfBossesSession == -1) { bossesBetween = "Never"; @@ -308,7 +296,7 @@ public class LootCommand extends CommandBase { if (wolfTime == -1) { timeBetween = "Never"; } else { - timeBetween = getTimeBetween(wolfTime, timeNow); + timeBetween = Utils.getTimeBetween(wolfTime, timeNow); } if (wolfBosses == -1) { bossesBetween = "Never"; @@ -340,7 +328,7 @@ public class LootCommand extends CommandBase { if (spiderTimeSession == -1) { timeBetween = "Never"; } else { - timeBetween = getTimeBetween(spiderTimeSession, timeNow); + timeBetween = Utils.getTimeBetween(spiderTimeSession, timeNow); } if (spiderBossesSession == -1) { bossesBetween = "Never"; @@ -373,7 +361,7 @@ public class LootCommand extends CommandBase { if (spiderTime == -1) { timeBetween = "Never"; } else { - timeBetween = getTimeBetween(spiderTime, timeNow); + timeBetween = Utils.getTimeBetween(spiderTime, timeNow); } if (spiderBosses == -1) { bossesBetween = "Never"; @@ -405,7 +393,7 @@ public class LootCommand extends CommandBase { if (zombieTimeSession == -1) { timeBetween = "Never"; } else { - timeBetween = getTimeBetween(zombieTimeSession, timeNow); + timeBetween = Utils.getTimeBetween(zombieTimeSession, timeNow); } if (zombieBossesSession == -1) { bossesBetween = "Never"; @@ -439,7 +427,7 @@ public class LootCommand extends CommandBase { if (zombieTime == -1) { timeBetween = "Never"; } else { - timeBetween = getTimeBetween(zombieTime, timeNow); + timeBetween = Utils.getTimeBetween(zombieTime, timeNow); } if (zombieBosses == -1) { bossesBetween = "Never"; @@ -496,7 +484,7 @@ public class LootCommand extends CommandBase { if (empTimeSession == -1) { timeBetween = "Never"; } else { - timeBetween = getTimeBetween(empTimeSession, timeNow); + timeBetween = Utils.getTimeBetween(empTimeSession, timeNow); } if (empSCsSession == -1) { bossesBetween = "Never"; @@ -532,7 +520,7 @@ public class LootCommand extends CommandBase { if (empTime == -1) { timeBetween = "Never"; } else { - timeBetween = getTimeBetween(empTime, timeNow); + timeBetween = Utils.getTimeBetween(empTime, timeNow); } if (empSCs == -1) { bossesBetween = "Never"; diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 45479f7..f0a612e 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -138,4 +138,33 @@ public class Utils { GL11.glTranslated(0, 0, -1); } + public static String getTimeBetween(double timeOne, double timeTwo) { + double secondsBetween = Math.floor(timeTwo - timeOne); + + String timeFormatted = ""; + int days; + int hours; + int minutes; + int seconds; + + if (secondsBetween > 86400) { + // More than 1d, display #d#h + days = (int) (secondsBetween / 86400); + hours = (int) (secondsBetween % 86400 / 3600); + timeFormatted = days + "d" + hours + "h"; + } else if (secondsBetween > 3600) { + // More than 1h, display #h#m + hours = (int) (secondsBetween / 3600); + minutes = (int) (secondsBetween % 3600 / 60); + timeFormatted = hours + "h" + minutes + "m"; + } else { + // Display #m#s + minutes = (int) (secondsBetween / 60); + seconds = (int) (secondsBetween % 60); + timeFormatted = minutes + "m" + seconds + "s"; + } + + return timeFormatted; + } + } -- cgit From aafc6802b16f7f5b92f7ebcfaff263781f6f9546 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 29 Aug 2020 00:30:35 -0400 Subject: Optimize xp to skill level --- .../java/me/Danker/commands/SkillsCommand.java | 178 +-------------------- src/main/java/me/Danker/utils/Utils.java | 14 ++ 2 files changed, 22 insertions(+), 170 deletions(-) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/commands/SkillsCommand.java b/src/main/java/me/Danker/commands/SkillsCommand.java index 5818772..8128c90 100644 --- a/src/main/java/me/Danker/commands/SkillsCommand.java +++ b/src/main/java/me/Danker/commands/SkillsCommand.java @@ -16,168 +16,6 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; public class SkillsCommand extends CommandBase { - - static double xpToLevel(double xp) { - int level; - double progress; - - if (xp < 50) { - level = 0; - progress = xp / 50; - } else if (xp < 175) { - level = 1; - progress = (xp - 50) / 125; - } else if (xp < 375) { - level = 2; - progress = (xp - 175) / 200; - } else if (xp < 675) { - level = 3; - progress = (xp - 375) / 300; - } else if (xp < 1175) { - level = 4; - progress = (xp - 675) / 500; - } else if (xp < 1925) { - level = 5; - progress = (xp - 1175) / 750; - } else if (xp < 2925) { - level = 6; - progress = (xp - 1925) / 1000; - } else if (xp < 4425) { - level = 7; - progress = (xp - 2925) / 1500; - } else if (xp < 6425) { - level = 8; - progress = (xp - 4425) / 2000; - } else if (xp < 9925) { - level = 9; - progress = (xp - 6425) / 3500; - } else if (xp < 14925) { - level = 10; - progress = (xp - 9925) / 5000; - } else if (xp < 22425) { - level = 11; - progress = (xp - 14925) / 7500; - } else if (xp < 32425) { - level = 12; - progress = (xp - 22425) / 10000; - } else if (xp < 47425) { - level = 13; - progress = (xp - 32425) / 15000; - } else if (xp < 67425) { - level = 14; - progress = (xp - 47425) / 20000; - } else if (xp < 97425) { - level = 15; - progress = (xp - 67425) / 30000; - } else if (xp < 147425) { - level = 16; - progress = (xp - 97425) / 50000; - } else if (xp < 222425) { - level = 17; - progress = (xp - 147425) / 75000; - } else if (xp < 322425) { - level = 18; - progress = (xp - 222425) / 100000; - } else if (xp < 522425) { - level = 19; - progress = (xp - 322425) / 200000; - } else if (xp < 822425) { - level = 20; - progress = (xp - 522425) / 300000; - } else if (xp < 1222425) { - level = 21; - progress = (xp - 822425) / 400000; - } else if (xp < 1722425) { - level = 22; - progress = (xp - 1222425) / 500000; - } else if (xp < 2322425) { - level = 23; - progress = (xp - 1722425) / 600000; - } else if (xp < 3022425) { - level = 24; - progress = (xp - 2322425) / 700000; - } else if (xp < 3822425) { - level = 25; - progress = (xp - 3022425) / 800000; - } else if (xp < 4722425) { - level = 26; - progress = (xp - 3822425) / 900000; - } else if (xp < 5722425) { - level = 27; - progress = (xp - 4722425) / 1000000; - } else if (xp < 6822425) { - level = 28; - progress = (xp - 5722425) / 1100000; - } else if (xp < 8022425) { - level = 29; - progress = (xp - 6822425) / 1200000; - } else if (xp < 9322425) { - level = 30; - progress = (xp - 8022425) / 1300000; - } else if (xp < 10722425) { - level = 31; - progress = (xp - 9322425) / 1400000; - } else if (xp < 12222425) { - level = 32; - progress = (xp - 10722425) / 1500000; - } else if (xp < 13822425) { - level = 33; - progress = (xp - 12222425) / 1600000; - } else if (xp < 15522425) { - level = 34; - progress = (xp - 13822425) / 1700000; - } else if (xp < 17322425) { - level = 35; - progress = (xp - 15522425) / 1800000; - } else if (xp < 19222425) { - level = 36; - progress = (xp - 17322425) / 1900000; - } else if (xp < 21222425) { - level = 37; - progress = (xp - 19222425) / 2000000; - } else if (xp < 23322425) { - level = 38; - progress = (xp - 21222425) / 2100000; - } else if (xp < 25522425) { - level = 39; - progress = (xp - 23322425) / 2200000; - } else if (xp < 27822425) { - level = 40; - progress = (xp - 25522425) / 2300000; - } else if (xp < 30222425) { - level = 41; - progress = (xp - 27822425) / 2400000; - } else if (xp < 32722425) { - level = 42; - progress = (xp - 30222425) / 2500000; - } else if (xp < 35322425) { - level = 43; - progress = (xp - 32722425) / 2600000; - } else if (xp < 38072425) { - level = 44; - progress = (xp - 35322425) / 2750000; - } else if (xp < 40972425) { - level = 45; - progress = (xp - 38072425) / 2900000; - } else if (xp < 44072425) { - level = 46; - progress = (xp - 40972425) / 3100000; - } else if (xp < 47472425) { - level = 47; - progress = (xp - 44072425) / 3400000; - } else if (xp < 51172425) { - level = 48; - progress = (xp - 47472425) / 3700000; - } else if (xp < 55172425) { - level = 49; - progress = (xp - 51172425) / 4000000; - } else { - level = 50; - progress = 0; - } - - return level + progress; - } @Override public String getCommandName() { @@ -256,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 = xpToLevel(userObject.get("experience_skill_farming").getAsDouble()); + farmingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_farming").getAsDouble()); farmingLevel = (double) Math.round(farmingLevel * 100) / 100; } if (userObject.has("experience_skill_mining")) { - miningLevel = xpToLevel(userObject.get("experience_skill_mining").getAsDouble()); + miningLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_mining").getAsDouble()); miningLevel = (double) Math.round(miningLevel * 100) / 100; } if (userObject.has("experience_skill_combat")) { - combatLevel = xpToLevel(userObject.get("experience_skill_combat").getAsDouble()); + combatLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_combat").getAsDouble()); combatLevel = (double) Math.round(combatLevel * 100) / 100; } if (userObject.has("experience_skill_foraging")) { - foragingLevel = xpToLevel(userObject.get("experience_skill_foraging").getAsDouble()); + foragingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_foraging").getAsDouble()); foragingLevel = (double) Math.round(foragingLevel * 100) / 100; } if (userObject.has("experience_skill_fishing")) { - fishingLevel = xpToLevel(userObject.get("experience_skill_fishing").getAsDouble()); + fishingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_fishing").getAsDouble()); fishingLevel = (double) Math.round(fishingLevel * 100) / 100; } if (userObject.has("experience_skill_enchanting")) { - enchantingLevel = xpToLevel(userObject.get("experience_skill_enchanting").getAsDouble()); + enchantingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_enchanting").getAsDouble()); enchantingLevel = (double) Math.round(enchantingLevel * 100) / 100; } if (userObject.has("experience_skill_alchemy")) { - alchemyLevel = xpToLevel(userObject.get("experience_skill_alchemy").getAsDouble()); + alchemyLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_alchemy").getAsDouble()); alchemyLevel = (double) Math.round(alchemyLevel * 100) / 100; } if (userObject.has("experience_skill_taming")) { - tamingLevel = xpToLevel(userObject.get("experience_skill_taming").getAsDouble()); + tamingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_taming").getAsDouble()); 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 f0a612e..2dfa9c3 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -22,6 +22,10 @@ import net.minecraft.util.StringUtils; public class Utils { public static boolean inSkyblock = false; + 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}; public static int getItems(String item) { Minecraft mc = Minecraft.getMinecraft(); @@ -167,4 +171,14 @@ public class Utils { return timeFormatted; } + public static double xpToSkillLevel(double xp) { + for (int i = 0, xpAdded = 0; i < skillXPPerLevel.length; i++) { + xpAdded += skillXPPerLevel[i]; + if (xp < xpAdded) { + return (i - 1) + (xp - (xpAdded - skillXPPerLevel[i])) / skillXPPerLevel[i]; + } + } + return 50D; + } + } -- cgit From 6921e6b5804bebcdabd0a05f187273f005b58bea Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 3 Sep 2020 01:03:59 -0400 Subject: Add (untested) coins spent in dungeons --- src/main/java/me/Danker/TheMod.java | 120 +++++++++++++++------ src/main/java/me/Danker/commands/LootCommand.java | 16 +++ .../java/me/Danker/handlers/ConfigHandler.java | 16 +++ src/main/java/me/Danker/utils/Utils.java | 6 ++ 4 files changed, 126 insertions(+), 32 deletions(-) (limited to 'src/main/java/me/Danker/utils') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 4b60669..b24f48e 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -12,6 +12,7 @@ import java.util.Map; import java.util.regex.Pattern; import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; import com.google.gson.JsonObject; @@ -89,6 +90,7 @@ public class TheMod static int tickAmount = 1; public static String lastMaddoxCommand = "/cb placeholdervalue"; static KeyBinding[] keyBindings = new KeyBinding[1]; + static int lastMouse = -1; @EventHandler public void init(FMLInitializationEvent event) @@ -1283,46 +1285,46 @@ public class TheMod dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + EnumChatFormatting.BLUE + "Bonzo's Staffs:\n" + - EnumChatFormatting.GREEN + "Coins Spent:\n" + - EnumChatFormatting.GREEN + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooks) + "\n" + EnumChatFormatting.BLUE + nf.format(lc.bonzoStaffs) + "\n" + - EnumChatFormatting.GREEN + nf.format(lc.f1CoinsSpent) + "\n" + - EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f1TimeSpent); + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f1CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f1TimeSpent); } else if (ds.display.equals("catacombs_floor_one_session")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + EnumChatFormatting.BLUE + "Bonzo's Staffs:\n" + - EnumChatFormatting.GREEN + "Coins Spent:\n" + - EnumChatFormatting.GREEN + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooksSession) + "\n" + EnumChatFormatting.BLUE + nf.format(lc.bonzoStaffsSession) + "\n" + - EnumChatFormatting.GREEN + nf.format(lc.f1CoinsSpentSession) + "\n" + - EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f1TimeSpentSession); + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f1CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f1TimeSpentSession); } else if (ds.display.equals("catacombs_floor_two")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + EnumChatFormatting.BLUE + "Scarf's Studies:\n" + - EnumChatFormatting.GREEN + "Coins Spent:\n" + - EnumChatFormatting.GREEN + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooks) + "\n" + EnumChatFormatting.BLUE + nf.format(lc.scarfStudies) + "\n" + - EnumChatFormatting.GREEN + nf.format(lc.f2CoinsSpent) + "\n" + - EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f2TimeSpent); + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f2CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f2TimeSpent); } else if (ds.display.equals("catacombs_floor_two_session")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + EnumChatFormatting.BLUE + "Scarf's Studies:\n" + - EnumChatFormatting.GREEN + "Coins Spent:\n" + - EnumChatFormatting.GREEN + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooksSession) + "\n" + EnumChatFormatting.BLUE + nf.format(lc.scarfStudiesSession) + "\n" + - EnumChatFormatting.GREEN + nf.format(lc.f2CoinsSpentSession) + "\n" + - EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f2TimeSpentSession); + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f2CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f2TimeSpentSession); } else if (ds.display.equals("catacombs_floor_three")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + @@ -1331,8 +1333,8 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Adaptive Leggings:\n" + EnumChatFormatting.DARK_PURPLE + "Adaptive Boots:\n" + EnumChatFormatting.DARK_PURPLE + "Adaptive Blades\n:" + - EnumChatFormatting.GREEN + "Coins Spent:\n" + - EnumChatFormatting.GREEN + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooks) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveHelms) + "\n" + @@ -1340,8 +1342,8 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveLegs) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveBoots) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveSwords) + "\n" + - EnumChatFormatting.GREEN + nf.format(lc.f3CoinsSpent) + "\n" + - EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f3TimeSpent); + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f3CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f3TimeSpent); } else if (ds.display.equals("catacombs_floor_three_session")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + @@ -1350,8 +1352,8 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Adaptive Leggings:\n" + EnumChatFormatting.DARK_PURPLE + "Adaptive Boots:\n" + EnumChatFormatting.DARK_PURPLE + "Adaptive Blades\n:" + - EnumChatFormatting.GREEN + "Coins Spent:\n" + - EnumChatFormatting.GREEN + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooksSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveHelmsSession) + "\n" + @@ -1359,8 +1361,8 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveLegsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveBootsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveSwordsSession) + "\n" + - EnumChatFormatting.GREEN + nf.format(lc.f3CoinsSpentSession) + "\n" + - EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f3TimeSpentSession); + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f3CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f3TimeSpentSession); } else if (ds.display.equals("catacombs_floor_four")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + @@ -1371,8 +1373,8 @@ public class TheMod EnumChatFormatting.GOLD + "Spirit Bows:\n" + EnumChatFormatting.DARK_PURPLE + "Epic Spirit Pets:\n" + EnumChatFormatting.GOLD + "Leg Spirit Pets:\n" + - EnumChatFormatting.GREEN + "Coins Spent:\n" + - EnumChatFormatting.GREEN + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooks) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.spiritWings) + "\n" + @@ -1382,8 +1384,8 @@ public class TheMod EnumChatFormatting.GOLD + nf.format(lc.spiritBows) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.epicSpiritPets) + "\n" + EnumChatFormatting.GOLD + nf.format(lc.legSpiritPets) + "\n" + - EnumChatFormatting.GREEN + nf.format(lc.f4CoinsSpent) + "\n" + - EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f4TimeSpent); + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f4CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f4TimeSpent); } else if (ds.display.equals("catacombs_floor_four_session")) { dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + @@ -1394,8 +1396,8 @@ public class TheMod EnumChatFormatting.GOLD + "Spirit Bows:\n" + EnumChatFormatting.DARK_PURPLE + "Epic Spirit Pets:\n" + EnumChatFormatting.GOLD + "Leg Spirit Pets:\n" + - EnumChatFormatting.GREEN + "Coins Spent:\n" + - EnumChatFormatting.GREEN + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:\n"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooksSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.spiritWingsSession) + "\n" + @@ -1405,8 +1407,8 @@ public class TheMod EnumChatFormatting.GOLD + nf.format(lc.spiritBowsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.epicSpiritPetsSession) + "\n" + EnumChatFormatting.GOLD + nf.format(lc.legSpiritPetsSession) + "\n" + - EnumChatFormatting.GREEN + nf.format(lc.f4CoinsSpentSession) + "\n" + - EnumChatFormatting.GREEN + Utils.getTimeBetween(0, lc.f4TimeSpentSession); + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f4CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f4TimeSpentSession); } else { ConfigHandler cf = new ConfigHandler(); @@ -1528,6 +1530,60 @@ public class TheMod } } + @SubscribeEvent + public void onGuiMouseInput(GuiScreenEvent.MouseInputEvent.Pre event) { + if (!Utils.inSkyblock) return; + if (Mouse.getEventButton() != 0 && Mouse.getEventButton() != 1) return; // Left click or right click + if (Mouse.getEventButton() == lastMouse) return; + lastMouse = Mouse.getEventButton(); + + if (event.gui instanceof GuiChest) { + LootCommand lc = new LootCommand(); + ConfigHandler cf = new ConfigHandler(); + GuiChest inventory = (GuiChest) event.gui; + Slot mouseSlot = inventory.getSlotUnderMouse(); + if (mouseSlot == null || mouseSlot.getStack() == null) return; + ItemStack item = mouseSlot.getStack(); + + if (item.getDisplayName().contains("Open Reward Chest")) { + List tooltip = item.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); + for (String line : tooltip) { + if (line.contains("FREE")) { + break; + } else if (line.contains(" Coins")) { + int coinsSpent = Integer.parseInt(line.substring(0, line.indexOf(" ")).replaceAll(",", "")); + + List scoreboard = ScoreboardHandler.getSidebarLines(); + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("The Catacombs (")) { + if (sCleaned.contains("F1")) { + lc.f1CoinsSpent += coinsSpent; + lc.f1CoinsSpentSession += coinsSpent; + cf.writeDoubleConfig("catacombs", "floorOneCoins", lc.f1CoinsSpent); + } else if (sCleaned.contains("F2")) { + lc.f2CoinsSpent += coinsSpent; + lc.f2CoinsSpentSession += coinsSpent; + cf.writeDoubleConfig("catacombs", "floorTwoCoins", lc.f2CoinsSpent); + } else if (sCleaned.contains("F3")) { + lc.f3CoinsSpent += coinsSpent; + lc.f3CoinsSpentSession += coinsSpent; + cf.writeDoubleConfig("catacombs", "floorThreeCoins", lc.f3CoinsSpent); + } else if (sCleaned.contains("F4")) { + lc.f4CoinsSpent += coinsSpent; + lc.f4CoinsSpentSession += coinsSpent; + cf.writeDoubleConfig("catacombs", "floorFourCoins", lc.f4CoinsSpent); + } + break; + } + break; + } + } + } + } + } + } + @SubscribeEvent public void onGuiRender(GuiScreenEvent.BackgroundDrawnEvent event) { if (!Utils.inSkyblock) return; diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index 97db73d..3e9d0ba 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -592,6 +592,8 @@ public class LootCommand extends CommandBase { EnumChatFormatting.GOLD + " Recombobulator 3000s: " + nf.format(recombobulatorsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + " Fuming Potato Books: " + nf.format(fumingPotatoBooksSession) + "\n" + EnumChatFormatting.BLUE + " Bonzo's Staffs: " + nf.format(bonzoStaffsSession) + "\n" + + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f1CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f1TimeSpentSession) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); return; } @@ -600,6 +602,8 @@ public class LootCommand extends CommandBase { EnumChatFormatting.GOLD + " Recombobulator 3000s: " + nf.format(recombobulators) + "\n" + EnumChatFormatting.DARK_PURPLE + " Fuming Potato Books: " + nf.format(fumingPotatoBooks) + "\n" + EnumChatFormatting.BLUE + " Bonzo's Staffs: " + nf.format(bonzoStaffs) + "\n" + + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f1CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f1TimeSpent) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); } else if (arg1[1].equalsIgnoreCase("f2") || arg1[1].equalsIgnoreCase("floor2")) { if (showSession) { @@ -608,6 +612,8 @@ public class LootCommand extends CommandBase { EnumChatFormatting.GOLD + " Recombobulator 3000s: " + nf.format(recombobulatorsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + " Fuming Potato Books: " + nf.format(fumingPotatoBooksSession) + "\n" + EnumChatFormatting.BLUE + " Scarf's Studies: " + nf.format(scarfStudiesSession) + "\n" + + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f2CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f2TimeSpentSession) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); return; } @@ -616,6 +622,8 @@ public class LootCommand extends CommandBase { EnumChatFormatting.GOLD + " Recombobulator 3000s: " + nf.format(recombobulators) + "\n" + EnumChatFormatting.DARK_PURPLE + " Fuming Potato Books: " + nf.format(fumingPotatoBooks) + "\n" + EnumChatFormatting.BLUE + " Scarf's Studies: " + nf.format(scarfStudies) + "\n" + + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f2CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f2TimeSpent) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); } else if (arg1[1].equalsIgnoreCase("f3") || arg1[1].equalsIgnoreCase("floor3")) { if (showSession) { @@ -628,6 +636,8 @@ public class LootCommand extends CommandBase { EnumChatFormatting.DARK_PURPLE + " Adaptive Leggings: " + nf.format(adaptiveLegsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + " Adaptive Boots: " + nf.format(adaptiveBootsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + " Adaptive Blades: " + nf.format(adaptiveSwordsSession) + "\n" + + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f3CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f3TimeSpentSession) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); return; } @@ -640,6 +650,8 @@ public class LootCommand extends CommandBase { EnumChatFormatting.DARK_PURPLE + " Adaptive Leggings: " + nf.format(adaptiveLegs) + "\n" + EnumChatFormatting.DARK_PURPLE + " Adaptive Boots: " + nf.format(adaptiveBoots) + "\n" + EnumChatFormatting.DARK_PURPLE + " Adaptive Blades: " + nf.format(adaptiveSwords) + "\n" + + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f3CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f3TimeSpent) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); } else if (arg1[1].equalsIgnoreCase("f4") || arg1[1].equalsIgnoreCase("floor4")) { if (showSession) { @@ -654,6 +666,8 @@ public class LootCommand extends CommandBase { EnumChatFormatting.GOLD + " Spirit Bows: " + nf.format(spiritBowsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + " Epic Spirit Pets: " + nf.format(epicSpiritPetsSession) + "\n" + EnumChatFormatting.GOLD + " Leg Spirit Pets: " + nf.format(legSpiritPetsSession) + "\n" + + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f4CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f4TimeSpentSession) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); return; } @@ -668,6 +682,8 @@ public class LootCommand extends CommandBase { EnumChatFormatting.GOLD + " Spirit Bows: " + nf.format(spiritBows) + "\n" + EnumChatFormatting.DARK_PURPLE + " Epic Spirit Pets: " + nf.format(epicSpiritPets) + "\n" + EnumChatFormatting.GOLD + " Leg Spirit Pets: " + nf.format(legSpiritPets) + "\n" + + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f4CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f4TimeSpent) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot catacombs ")); diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 6671677..1955b3d 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -258,14 +258,20 @@ public class ConfigHandler { if (!hasKey("catacombs", "fumingBooks")) writeIntConfig("catacombs", "fumingBooks", 0); // F1 if (!hasKey("catacombs", "bonzoStaff")) writeIntConfig("catacombs", "bonzoStaff", 0); + if (!hasKey("catacombs", "floorOneCoins")) writeDoubleConfig("catacombs", "floorOneCoins", 0); + if (!hasKey("catacombs", "floorOneTime")) writeDoubleConfig("catacombs", "floorOneTime", 0); // F2 if (!hasKey("catacombs", "scarfStudies")) writeIntConfig("catacombs", "scarfStudies", 0); + if (!hasKey("catacombs", "floorTwoCoins")) writeDoubleConfig("catacombs", "floorTwoCoins", 0); + if (!hasKey("catacombs", "floorTwoTime")) writeDoubleConfig("catacombs", "floorTwoTime", 0); // F3 if (!hasKey("catacombs", "adaptiveHelm")) writeIntConfig("catacombs", "adaptiveHelm", 0); if (!hasKey("catacombs", "adaptiveChest")) writeIntConfig("catacombs", "adaptiveChest", 0); if (!hasKey("catacombs", "adaptiveLegging")) writeIntConfig("catacombs", "adaptiveLegging", 0); if (!hasKey("catacombs", "adaptiveBoot")) writeIntConfig("catacombs", "adaptiveBoot", 0); if (!hasKey("catacombs", "adaptiveSword")) writeIntConfig("catacombs", "adaptiveSword", 0); + if (!hasKey("catacombs", "floorThreeCoins")) writeDoubleConfig("catacombs", "floorThreeCoins", 0); + if (!hasKey("catacombs", "floorThreeTime")) writeDoubleConfig("catacombs", "floorThreeTime", 0); // F4 if (!hasKey("catacombs", "spiritWing")) writeIntConfig("catacombs", "spiritWing", 0); if (!hasKey("catacombs", "spiritBone")) writeIntConfig("catacombs", "spiritBone", 0); @@ -274,6 +280,8 @@ public class ConfigHandler { if (!hasKey("catacombs", "spiritBow")) writeIntConfig("catacombs", "spiritBow", 0); if (!hasKey("catacombs", "spiritPetEpic")) writeIntConfig("catacombs", "spiritPetEpic", 0); if (!hasKey("catacombs", "spiritPetLeg")) writeIntConfig("catacombs", "spiritPetLeg", 0); + if (!hasKey("catacombs", "floorFourCoins")) writeDoubleConfig("catacombs", "floorFourCoins", 0); + if (!hasKey("catacombs", "floorFourTime")) writeDoubleConfig("catacombs", "floorFourTime", 0); if (!hasKey("misc", "display")) writeStringConfig("misc", "display", "off"); @@ -375,14 +383,20 @@ public class ConfigHandler { lc.fumingPotatoBooks = getInt("catacombs", "fumingBooks"); // F1 lc.bonzoStaffs = getInt("catacombs", "bonzoStaff"); + lc.f1CoinsSpent = getDouble("catacombs", "floorOneCoins"); + lc.f1TimeSpent = getDouble("catacombs", "floorOneTime"); // F2 lc.scarfStudies = getInt("catacombs", "scarfStudies"); + lc.f2CoinsSpent = getDouble("catacombs", "floorTwoCoins"); + lc.f2TimeSpent = getDouble("catacombs", "floorTwoTime"); // F3 lc.adaptiveHelms = getInt("catacombs", "adaptiveHelm"); lc.adaptiveChests = getInt("catacombs", "adaptiveChest"); lc.adaptiveLegs = getInt("catacombs", "adaptiveLegging"); lc.adaptiveBoots = getInt("catacombs", "adaptiveBoot"); lc.adaptiveSwords = getInt("catacombs", "adaptiveSword"); + lc.f3CoinsSpent = getDouble("catacombs", "floorThreeCoins"); + lc.f3TimeSpent = getDouble("catacombs", "floorThreeTime"); // F4 lc.spiritWings = getInt("catacombs", "spiritWing"); lc.spiritBones = getInt("catacombs", "spiritBone"); @@ -391,6 +405,8 @@ public class ConfigHandler { lc.spiritBows = getInt("catacombs", "spiritBow"); lc.epicSpiritPets = getInt("catacombs", "spiritPetEpic"); lc.legSpiritPets = getInt("catacombs", "spiritPetLeg"); + lc.f4CoinsSpent = getDouble("catacombs", "floorFourCoins"); + lc.f4TimeSpent = getDouble("catacombs", "floorFourTime"); final DisplayCommand ds = new DisplayCommand(); ds.display = getString("misc", "display"); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 2dfa9c3..67f8439 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -171,6 +171,12 @@ public class Utils { return timeFormatted; } + public static String getMoneySpent(double coins) { + double coinsSpentMillions = coins / 1000000D; + coinsSpentMillions = Math.floor(coinsSpentMillions * 100D) / 100D; + return coinsSpentMillions + "M"; + } + public static double xpToSkillLevel(double xp) { for (int i = 0, xpAdded = 0; i < skillXPPerLevel.length; i++) { xpAdded += skillXPPerLevel[i]; -- cgit