diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-09-05 18:35:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-05 18:35:43 -0400 |
commit | 20b405f59dcd92df1b4c3cd5b9ac353652ef4405 (patch) | |
tree | f387a1ca10387c77381a22568b486984da5b38a6 | |
parent | 3ed5e14d43c6f3ff3cdce7598d01254e9465c33d (diff) | |
parent | a29cfb42db5da544f8445f56acb3742e396d8dee (diff) | |
download | SkyblockMod-20b405f59dcd92df1b4c3cd5b9ac353652ef4405.tar.gz SkyblockMod-20b405f59dcd92df1b4c3cd5b9ac353652ef4405.tar.bz2 SkyblockMod-20b405f59dcd92df1b4c3cd5b9ac353652ef4405.zip |
v1.7v1.7
Merge pull request #13 from bowser0000/development
20 files changed, 1448 insertions, 361 deletions
@@ -6,22 +6,29 @@ Discord Server: https://discord.gg/QsEkNQS ## Current features - Guild party desktop notifications (toggleable) - Coordinate and angle display (toggleable, graphic display) (scalable) -- Golden T6/T4 enchant display (toggleable) +- Golden T10/T6/T4 enchant display (toggleable) +- Block AOTD ability (toggleable) +- Disable Spirit Sceptre messages (toggleable) - Slayer item tracker (with graphic display) (scalable) +- RNGesus drop alerts (toggleable) +- Click in chat to open Maddox (toggleable) +- 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 ## Commands - /dhelp - Returns this message in-game. -- /toggle <gparty/coords/golden/slayercount/rngesusalerts/list> - Toggles features. /toggle list returns values of every toggle. +- /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/sceptremessages/petcolors/dungeontimer/list> - Toggles features. /toggle list returns values of every toggle. - /setkey <key> - Sets API key. -- /getkey - Returns key set with /setkey. -- /loot <zombie/spider/wolf/fishing> [winter/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. -- /display <zombie/spider/wolf/fishing/off> [winter/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. -- /move <coords/display> <x> <y> - Moves text display to specified X and Y coordinates. -- /scale <coords/display> <scale (0.1 - 10)> - Scales text display to a specified multipler between 0.1x and 10x. -- /resetloot <zombie/spider/wolf/fishing/confirm/cancel> - - Resets loot for trackers. /resetloot confirm confirms the reset. +- /getkey - Returns key set with /setkey and copies it to your clipboard. +- /loot <zombie/spider/wolf/fishing/catacombs> [winter/f(1-4)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. +- /display <zombie/spider/wolf/fishing/catacombs> [winter/f(1-4)/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. +- /resetloot <zombie/spider/wolf/fishing/catacombs/confirm/cancel> - - Resets loot for trackers. /resetloot confirm confirms the reset. +- /move <coords/display/dungeontimer> <x> <y> - Moves text display to specified X and Y coordinates. +- /scale <coords/display/dungeontimer> <scale (0.1 - 10)> - Scales text display to a specified multipler between 0.1x and 10x. - /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. @@ -29,6 +36,10 @@ 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. + +## Keybinds +- Open Maddox menu - M by default. ### 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. diff --git a/build.gradle b/build.gradle index fc9077f..e335794 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ plugins { id "net.minecraftforge.gradle.forge" version "2.0.2" } */ -version = "1.6.1" +version = "1.7" group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Danker's Skyblock Mod" diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index b99ac42..ec2dedf 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -11,10 +11,14 @@ import java.util.Locale; import java.util.Map; import java.util.regex.Pattern; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + import com.google.gson.JsonObject; import me.Danker.commands.ArmourCommand; import me.Danker.commands.BankCommand; +import me.Danker.commands.ChatMaddoxCommand; import me.Danker.commands.DHelpCommand; import me.Danker.commands.DisplayCommand; import me.Danker.commands.GetkeyCommand; @@ -28,6 +32,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; @@ -36,18 +41,28 @@ import me.Danker.handlers.ScoreboardHandler; 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.inventory.GuiChest; +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.minecraft.util.StringUtils; 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.registry.ClientRegistry; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -55,6 +70,7 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; @@ -62,7 +78,7 @@ import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; public class TheMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.6.1"; + public static final String VERSION = "1.7"; static double checkItemsNow = 0; static double itemsChecked = 0; @@ -72,6 +88,18 @@ public class TheMod public static int titleTimer = -1; public static boolean showTitle = false; public static String titleText = ""; + static int tickAmount = 1; + public static String lastMaddoxCommand = "/cb placeholdervalue"; + static KeyBinding[] keyBindings = new KeyBinding[1]; + static int lastMouse = -1; + + static double dungeonStartTime = 0; + static double bloodOpenTime = 0; + static double watcherClearTime = 0; + static double bossClearTime = 0; + static int witherDoors = 0; + static int dungeonDeaths = 0; + static int puzzleFails = 0; @EventHandler public void init(FMLInitializationEvent event) @@ -83,35 +111,43 @@ public class TheMod cf.reloadConfig(); // For golden enchants - t6Enchants.put("Bane of Arthropods VI", EnumChatFormatting.GOLD + "Bane of Arthropods VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Critical VI", EnumChatFormatting.GOLD + "Critical VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Dragon Hunter V", EnumChatFormatting.GOLD + "Dragon Hunter V" + EnumChatFormatting.BLUE); - t6Enchants.put("Ender Slayer VI", EnumChatFormatting.GOLD + "Ender Slayer VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Experience IV", EnumChatFormatting.GOLD + "Experience IV" + EnumChatFormatting.BLUE); - t6Enchants.put("Giant Killer VI", EnumChatFormatting.GOLD + "Giant Killer VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Life Steal IV", EnumChatFormatting.GOLD + "Life Steal IV" + EnumChatFormatting.BLUE); - t6Enchants.put("Looting IV", EnumChatFormatting.GOLD + "Looting IV" + EnumChatFormatting.BLUE); - t6Enchants.put("Luck VI", EnumChatFormatting.GOLD + "Luck VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Scavenger IV", EnumChatFormatting.GOLD + "Scavenger IV" + EnumChatFormatting.BLUE); - t6Enchants.put("Scavenger V", EnumChatFormatting.GOLD + "Scavenger V" + EnumChatFormatting.BLUE); - t6Enchants.put("Sharpness VI", EnumChatFormatting.GOLD + "Sharpness VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Smite VI", EnumChatFormatting.GOLD + "Smite VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Smite VII", EnumChatFormatting.GOLD + "Smite VII" + EnumChatFormatting.BLUE); - t6Enchants.put("Vampirism VI", EnumChatFormatting.GOLD + "Vampirism VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Power VI", EnumChatFormatting.GOLD + "Power VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Growth VI", EnumChatFormatting.GOLD + "Growth VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Protection VI", EnumChatFormatting.GOLD + "Protection VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Efficiency VI", EnumChatFormatting.GOLD + "Efficiency VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Angler VI", EnumChatFormatting.GOLD + "Angler VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Caster VI", EnumChatFormatting.GOLD + "Caster VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Frail VI", EnumChatFormatting.GOLD + "Frail VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Luck of the Sea VI", EnumChatFormatting.GOLD + "Luck of the Sea VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Lure VI", EnumChatFormatting.GOLD + "Lure VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Magnet VI", EnumChatFormatting.GOLD + "Magnet VI" + EnumChatFormatting.BLUE); - t6Enchants.put("Spiked Hook VI", EnumChatFormatting.GOLD + "Spiked Hook VI" + EnumChatFormatting.BLUE); + t6Enchants.put("9Bane of Arthropods VI", "6Bane of Arthropods VI"); + t6Enchants.put("9Critical VI", "6Critical VI"); + t6Enchants.put("9Dragon Hunter V", "6Dragon Hunter V"); + t6Enchants.put("9Ender Slayer VI", "6Ender Slayer VI"); + t6Enchants.put("9Experience IV", "6Experience IV"); + t6Enchants.put("9Giant Killer VI", "6Giant Killer VI"); + t6Enchants.put("9Life Steal IV", "6Life Steal IV"); + t6Enchants.put("9Looting IV", "6Looting IV"); + t6Enchants.put("9Luck VI", "6Luck VI"); + t6Enchants.put("9Scavenger IV", "6Scavenger IV"); + t6Enchants.put("9Scavenger V", "6Scavenger V"); + t6Enchants.put("9Sharpness VI", "6Sharpness VI"); + t6Enchants.put("9Smite VII", "6Smite VII"); + t6Enchants.put("9Smite VI", "6Smite VI"); + t6Enchants.put("9Vampirism VI", "6Vampirism VI"); + t6Enchants.put("9Power VI", "6Power VI"); + t6Enchants.put("9Growth VI", "6Growth VI"); + t6Enchants.put("9Protection VI", "6Protection VI"); + t6Enchants.put("9Efficiency VI", "6Efficiency VI"); + t6Enchants.put("9Angler VI", "6Angler VI"); + t6Enchants.put("9Caster VI", "6Caster VI"); + t6Enchants.put("9Frail VI", "6Frail VI"); + t6Enchants.put("9Luck of the Sea VI", "6Luck of the Sea VI"); + t6Enchants.put("9Lure VI", "6Lure VI"); + t6Enchants.put("9Magnet VI", "6Magnet VI"); + t6Enchants.put("9Spiked Hook VI", "6Spiked Hook VI"); + t6Enchants.put("9Feather Falling X", "6Feather Falling X"); + t6Enchants.put("9Infinite Quiver X", "6Infinite Quiver X"); String patternString = "(" + String.join("|", t6Enchants.keySet()) + ")"; pattern = Pattern.compile(patternString); + + keyBindings[0] = new KeyBinding("Open Maddox Menu", Keyboard.KEY_M, "Danker's Skyblock Mod"); + + for (int i = 0; i < keyBindings.length; i++) { + ClientRegistry.registerKeyBinding(keyBindings[i]); + } } @EventHandler @@ -133,6 +169,8 @@ public class TheMod ClientCommandHandler.instance.registerCommand(new ImportFishingCommand()); ClientCommandHandler.instance.registerCommand(new ResetLootCommand()); ClientCommandHandler.instance.registerCommand(new ScaleCommand()); + ClientCommandHandler.instance.registerCommand(new ChatMaddoxCommand()); + ClientCommandHandler.instance.registerCommand(new SkyblockPlayersCommand()); } // Update checker @@ -176,11 +214,29 @@ public class TheMod final ToggleCommand tc = new ToggleCommand(); String message = event.message.getUnformattedText(); + if (event.type == 2) return; + if (!Utils.inSkyblock) return; + + // Replace chat messages with Maddox command + List<IChatComponent> chatSiblings = event.message.getSiblings(); + for (IChatComponent sibling : chatSiblings) { + if (sibling.getChatStyle().getChatClickEvent() == null) { + sibling.setChatStyle(sibling.getChatStyle().setChatClickEvent(new ClickEvent(Action.RUN_COMMAND, "/dmodopenmaddoxmenu"))); + } + } + + // Dungeon chat spoken by an NPC, containing : + if (message.contains("[BOSS] The Watcher: You have proven yourself. You may pass.")) { + watcherClearTime = System.currentTimeMillis() / 1000; + } + if (message.contains(" PUZZLE FAIL! ") || message.contains("chose the wrong answer! I shall never forget this moment")) { + dungeonDeaths++; + } + if (message.contains(":")) return; if (tc.gpartyToggled) { if (message.contains(" has invited all members of ")) { - System.out.println(message); try { final SystemTray tray = SystemTray.getSystemTray(); final Image image = Toolkit.getDefaultToolkit().createImage("icon.png"); @@ -195,7 +251,7 @@ public class TheMod } } } - + final LootCommand lc = new LootCommand(); final ConfigHandler cf = new ConfigHandler(); boolean wolfRNG = false; @@ -335,7 +391,7 @@ public class TheMod lc.zombieBossesSession++; } cf.writeIntConfig("zombie", "revs", lc.zombieRevs); - cf.writeIntConfig("wolf", "bossRNG", lc.zombieBosses); + cf.writeIntConfig("zombie", "bossRNG", lc.zombieBosses); } if (message.contains("RARE DROP! (Foul Flesh)")) { lc.zombieFoulFleshDrops++; @@ -425,7 +481,7 @@ public class TheMod cf.writeIntConfig("fishing", "squid", lc.squids); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); - increaseEmpSC(); + increaseSeaCreatures(); } if (message.contains("From the depths of the waters, you've reeled in a Sea Walker")) { lc.seaWalkers++; @@ -437,7 +493,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaWalker", lc.seaWalkers); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); - increaseEmpSC(); + increaseSeaCreatures(); } if (message.contains("Pitch darkness reveals you've caught a")) { lc.nightSquids++; @@ -449,7 +505,7 @@ public class TheMod cf.writeIntConfig("fishing", "nightSquid", lc.nightSquids); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); - increaseEmpSC(); + increaseSeaCreatures(); } if (message.contains("You've stumbled upon a patrolling Sea Guardian")) { lc.seaGuardians++; @@ -461,7 +517,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaGuardian", lc.seaGuardians); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); - increaseEmpSC(); + increaseSeaCreatures(); } if (message.contains("It looks like you've disrupted the Sea Witch's brewing session. Watch out, she's furious")) { lc.seaWitches++; @@ -473,7 +529,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaWitch", lc.seaWitches); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); - increaseEmpSC(); + increaseSeaCreatures(); } if (message.contains("From the depths of the waters, you've reeled in a Sea Archer")) { lc.seaArchers++; @@ -485,7 +541,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaArcher", lc.seaArchers); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); - increaseEmpSC(); + increaseSeaCreatures(); } if (message.contains("The Monster of the Deep emerges from the dark depths")) { lc.monsterOfTheDeeps++; @@ -497,7 +553,7 @@ public class TheMod cf.writeIntConfig("fishing", "monsterOfDeep", lc.monsterOfTheDeeps); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); - increaseEmpSC(); + increaseSeaCreatures(); } if (message.contains("You have found a Catfish, don't let it steal your catches")) { lc.catfishes++; @@ -509,7 +565,7 @@ public class TheMod cf.writeIntConfig("fishing", "catfish", lc.catfishes); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); - increaseEmpSC(); + increaseSeaCreatures(); } if (message.contains("Is this even a fish? It's the Carrot King")) { lc.carrotKings++; @@ -521,7 +577,7 @@ public class TheMod cf.writeIntConfig("fishing", "carrotKing", lc.carrotKings); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); - increaseEmpSC(); + increaseSeaCreatures(); } if (message.contains("Gross! A Sea Leech")) { lc.seaLeeches++; @@ -533,7 +589,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaLeech", lc.seaLeeches); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); - increaseEmpSC(); + increaseSeaCreatures(); } if (message.contains("You've discovered a Guardian Defender of the sea")) { lc.guardianDefenders++; @@ -545,7 +601,7 @@ public class TheMod cf.writeIntConfig("fishing", "guardianDefender", lc.guardianDefenders); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); - increaseEmpSC(); + increaseSeaCreatures(); } if (message.contains("You have awoken the Deep Sea Protector, prepare for a battle")) { lc.deepSeaProtectors++; @@ -557,7 +613,7 @@ public class TheMod cf.writeIntConfig("fishing", "deepSeaProtector", lc.deepSeaProtectors); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); - increaseEmpSC(); + increaseSeaCreatures(); } if (message.contains("The Water Hydra has come to test your strength")) { lc.hydras++; @@ -569,7 +625,7 @@ public class TheMod cf.writeIntConfig("fishing", "hydra", lc.hydras); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); - increaseEmpSC(); + increaseSeaCreatures(); } if (message.contains("The Sea Emperor arises from the depths")) { lc.seaEmperors++; @@ -599,6 +655,7 @@ public class TheMod cf.writeIntConfig("fishing", "frozenSteve", lc.frozenSteves); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); + increaseSeaCreatures(); } if (message.contains("It's a snowman! He looks harmless")) { lc.frostyTheSnowmans++; @@ -610,6 +667,7 @@ public class TheMod cf.writeIntConfig("fishing", "snowman", lc.frostyTheSnowmans); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); + increaseSeaCreatures(); } if (message.contains("stole Jerry's Gifts...get them back")) { lc.grinches++; @@ -621,18 +679,194 @@ public class TheMod cf.writeIntConfig("fishing", "grinch", lc.grinches); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); + increaseSeaCreatures(); } if (message.contains("What is this creature")) { lc.yetis++; lc.seaCreatures++; lc.fishingMilestone++; + lc.yetiTime = System.currentTimeMillis() / 1000; + lc.yetiSCs = 0; lc.yetisSession++; lc.seaCreaturesSession++; lc.fishingMilestoneSession++; + lc.yetiTimeSession = System.currentTimeMillis() / 1000; + lc.yetiSCsSession = 0; cf.writeIntConfig("fishing", "yeti", lc.yetis); + cf.writeDoubleConfig("fishing", "yetiTime", lc.yetiTime); + cf.writeIntConfig("fishing", "yetiSC", lc.yetiSCs); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); } + + // Catacombs Dungeons + // Timers + if (message.contains("Dungeon starts in 1 second.")) { + dungeonStartTime = System.currentTimeMillis() / 1000; + bloodOpenTime = dungeonStartTime; + watcherClearTime = dungeonStartTime; + bossClearTime = dungeonStartTime; + witherDoors = 0; + dungeonDeaths = 0; + puzzleFails = 0; + } + if (message.contains("The BLOOD DOOR has been opened!")) { + bloodOpenTime = System.currentTimeMillis() / 1000; + } + if (message.contains(" opened a WITHER door!")) { + witherDoors++; + } + if (message.contains(" and became a ghost.")) { + dungeonDeaths++; + } + + // Trackers + if (message.contains(" Defeated ") && message.contains(" in ")) { + bossClearTime = System.currentTimeMillis() / 1000; + } + if (message.contains("EXTRA STATS ")) { + List<String> scoreboard = ScoreboardHandler.getSidebarLines(); + int timeToAdd = 0; + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("The Catacombs (")) { + // Add time to floor + if (sCleaned.contains("F1")) { + lc.f1TimeSpent = Math.floor(lc.f1TimeSpent + timeToAdd); + lc.f1TimeSpentSession = Math.floor(lc.f1TimeSpentSession + timeToAdd); + cf.writeDoubleConfig("catacombs", "floorOneTime", lc.f1TimeSpent); + } else if (sCleaned.contains("F2")) { + lc.f2TimeSpent = Math.floor(lc.f2TimeSpent + timeToAdd); + lc.f2TimeSpentSession = Math.floor(lc.f2TimeSpentSession + timeToAdd); + cf.writeDoubleConfig("catacombs", "floorTwoTime", lc.f2TimeSpent); + } else if (sCleaned.contains("F3")) { + lc.f3TimeSpent = Math.floor(lc.f3TimeSpent + timeToAdd); + lc.f3TimeSpentSession = Math.floor(lc.f3TimeSpentSession + timeToAdd); + cf.writeDoubleConfig("catacombs", "floorThreeTime", lc.f3TimeSpent); + } else if (sCleaned.contains("F4")) { + lc.f4TimeSpent = Math.floor(lc.f4TimeSpent + timeToAdd); + lc.f4TimeSpentSession = Math.floor(lc.f4TimeSpentSession + timeToAdd); + cf.writeDoubleConfig("catacombs", "floorFourTime", lc.f4TimeSpent); + } + } else if (sCleaned.contains("Time Elapsed:")) { + // Get floor time + String time = sCleaned.substring(sCleaned.indexOf(":") + 2); + int minutes = Integer.parseInt(time.substring(0, time.indexOf("m"))); + int seconds = Integer.parseInt(time.substring(time.indexOf("m") + 1, time.indexOf("s"))); + timeToAdd = (minutes * 60) + seconds; + } + } + } + if (message.contains(" RARE REWARD! Recombobulator 3000")) { + lc.recombobulators++; + lc.recombobulatorsSession++; + 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")) { + lc.bonzoStaffs++; + lc.bonzoStaffsSession++; + cf.writeIntConfig("catacombs", "bonzoStaff", lc.bonzoStaffs); + } + // F2 + if (message.contains(" RARE REWARD! Scarf's Studies")) { + lc.scarfStudies++; + lc.scarfStudiesSession++; + cf.writeIntConfig("catacombs", "scarfStudies", lc.scarfStudies); + } + // F3 + if (message.contains(" RARE REWARD! Adaptive Helmet")) { + lc.adaptiveHelms++; + lc.adaptiveHelmsSession++; + cf.writeIntConfig("catacombs", "adaptiveHelm", lc.adaptiveHelms); + } + if (message.contains(" RARE REWARD! Adaptive Chestplate")) { + lc.adaptiveChests++; + lc.adaptiveChestsSession++; + cf.writeIntConfig("catacombs", "adaptiveChest", lc.adaptiveChests); + } + if (message.contains(" RARE REWARD! Adaptive Leggings")) { + lc.adaptiveLegs++; + lc.adaptiveLegsSession++; + cf.writeIntConfig("catacombs", "adaptiveLegging", lc.adaptiveLegs); + } + if (message.contains(" RARE REWARD! Adaptive Boots")) { + lc.adaptiveBoots++; + lc.adaptiveBootsSession++; + cf.writeIntConfig("catacombs", "adaptiveBoot", lc.adaptiveBoots); + } + if (message.contains(" RARE REWARD! Adaptive Blade")) { + lc.adaptiveSwords++; + lc.adaptiveSwordsSession++; + cf.writeIntConfig("catacombs", "adaptiveSword", lc.adaptiveSwords); + } + // F4 + if (message.contains(" Spirit Wing")) { + lc.spiritWings++; + lc.spiritWingsSession++; + cf.writeIntConfig("catacombs", "spiritWing", lc.spiritWings); + } + // TODO + // Fix strings for Spirit Bone, Spirit Boots + if (message.contains(" ") && message.contains("Spirit Bone")) { + lc.spiritBones++; + lc.spiritBonesSession++; + cf.writeIntConfig("catacombs", "spiritBone", lc.spiritBones); + } + if (message.contains(" ") && message.contains("Spirit Boots")) { + lc.spiritBoots++; + lc.spiritBootsSession++; + cf.writeIntConfig("catacombs", "spiritBoot", lc.spiritBoots); + } + if (message.contains(" [Lvl 1] Spirit")) { + String formattedMessage = event.message.getFormattedText(); + // Unicode colour code messes up here, just gonna remove the symbols + if (formattedMessage.contains("5Spirit")) { + lc.epicSpiritPets++; + lc.epicSpiritPetsSession++; + cf.writeIntConfig("catacombs", "spiritPetEpic", lc.epicSpiritPets); + } else if (formattedMessage.contains("6Spirit")) { + lc.legSpiritPets++; + lc.legSpiritPetsSession++; + cf.writeIntConfig("catacombs", "spiritPetLeg", lc.legSpiritPets); + } + } + if (message.contains(" Spirit Sword")) { + lc.spiritSwords++; + lc.spiritSwordsSession++; + cf.writeIntConfig("catacombs", "spiritSword", lc.spiritSwords); + } + if (message.contains(" Spirit Bow")) { + lc.spiritBows++; + lc.spiritBowsSession++; + cf.writeIntConfig("catacombs", "spiritBow", lc.spiritBows); + } + + // Chat Maddox + if (message.contains("[OPEN MENU]")) { + List<IChatComponent> listOfSiblings = event.message.getSiblings(); + for (IChatComponent sibling : listOfSiblings) { + if (sibling.getUnformattedText().contains("[OPEN MENU]")) { + lastMaddoxCommand = sibling.getChatStyle().getChatClickEvent().getValue(); + } + } + if (tc.chatMaddoxToggled) Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Click anywhere in chat to open Maddox")); + } + + // Spirit Bear alerts + if (tc.spiritBearAlerts && message.contains("The Spirit Bear has appeared!")) { + Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "SPIRIT BEAR", 2); + } + + // Spirit Sceptre + if (!tc.sceptreMessages && message.contains("Your Bat Staff hit ")) { + event.setCanceled(true); + } } @SubscribeEvent @@ -654,6 +888,23 @@ public class TheMod new TextRenderer(Minecraft.getMinecraft(), coordText, moc.coordsXY[0], moc.coordsXY[1], ScaleCommand.coordsScale); } + if (tc.dungeonTimerToggled) { + String dungeonTimerText = EnumChatFormatting.GRAY + "Wither Doors:\n" + + EnumChatFormatting.DARK_RED + "Blood Open:\n" + + EnumChatFormatting.RED + "Watcher Clear:\n" + + EnumChatFormatting.BLUE + "Boss Clear:\n" + + EnumChatFormatting.YELLOW + "Deaths:\n" + + EnumChatFormatting.YELLOW + "Puzzle Fails:"; + String dungeonTimers = EnumChatFormatting.GRAY + "" + witherDoors + "\n" + + EnumChatFormatting.DARK_RED + Utils.getTimeBetween(dungeonStartTime, bloodOpenTime) + "\n" + + EnumChatFormatting.RED + Utils.getTimeBetween(dungeonStartTime, watcherClearTime) + "\n" + + EnumChatFormatting.BLUE + Utils.getTimeBetween(dungeonStartTime, bossClearTime) + "\n" + + EnumChatFormatting.YELLOW + dungeonDeaths + "\n" + + EnumChatFormatting.YELLOW + puzzleFails; + new TextRenderer(Minecraft.getMinecraft(), dungeonTimerText, moc.dungeonTimerXY[0], moc.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale); + new TextRenderer(Minecraft.getMinecraft(), dungeonTimers, (int) (moc.dungeonTimerXY[0] + (80 * ScaleCommand.dungeonTimerScale)), moc.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale); + } + if (!ds.display.equals("off")) { final LootCommand lc = new LootCommand(); String dropsText = ""; @@ -668,7 +919,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"; @@ -707,7 +958,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"; @@ -746,7 +997,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"; @@ -785,7 +1036,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"; @@ -824,7 +1075,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"; @@ -865,7 +1116,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"; @@ -906,7 +1157,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"; @@ -956,13 +1207,18 @@ public class TheMod EnumChatFormatting.AQUA + timeBetween + "\n" + EnumChatFormatting.AQUA + bossesBetween; - new TextRenderer(Minecraft.getMinecraft(), dropsTextTwo, (int) (moc.displayXY[0] + (145 * ScaleCommand.displayScale)), moc.displayXY[1], ScaleCommand.displayScale); - new TextRenderer(Minecraft.getMinecraft(), countTextTwo, (int) (moc.displayXY[0] + (255 * ScaleCommand.displayScale)), moc.displayXY[1], ScaleCommand.displayScale); + if (tc.splitFishing) { + new TextRenderer(Minecraft.getMinecraft(), dropsTextTwo, (int) (moc.displayXY[0] + (160 * ScaleCommand.displayScale)), moc.displayXY[1], ScaleCommand.displayScale); + new TextRenderer(Minecraft.getMinecraft(), countTextTwo, (int) (moc.displayXY[0] + (270 * ScaleCommand.displayScale)), moc.displayXY[1], ScaleCommand.displayScale); + } else { + dropsText += "\n" + dropsTextTwo; + countText += "\n" + countTextTwo; + } } else if (ds.display.equals("fishing_session")) { 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"; @@ -1012,9 +1268,25 @@ public class TheMod EnumChatFormatting.AQUA + timeBetween + "\n" + EnumChatFormatting.AQUA + bossesBetween; - new TextRenderer(Minecraft.getMinecraft(), dropsTextTwo, (int) (moc.displayXY[0] + (145 * ScaleCommand.displayScale)), moc.displayXY[1], ScaleCommand.displayScale); - new TextRenderer(Minecraft.getMinecraft(), countTextTwo, (int) (moc.displayXY[0] + (255 * ScaleCommand.displayScale)), moc.displayXY[1], ScaleCommand.displayScale); + if (tc.splitFishing) { + new TextRenderer(Minecraft.getMinecraft(), dropsTextTwo, (int) (moc.displayXY[0] + (160 * ScaleCommand.displayScale)), moc.displayXY[1], ScaleCommand.displayScale); + new TextRenderer(Minecraft.getMinecraft(), countTextTwo, (int) (moc.displayXY[0] + (270 * ScaleCommand.displayScale)), moc.displayXY[1], ScaleCommand.displayScale); + } else { + dropsText += "\n" + dropsTextTwo; + countText += "\n" + countTextTwo; + } } else if (ds.display.equals("fishing_winter")) { + if (lc.yetiTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(lc.yetiTime, timeNow); + } + if (lc.yetiSCs == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(lc.yetiSCs); + } + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + EnumChatFormatting.GOLD + "Good Catches:\n" + @@ -1022,7 +1294,9 @@ public class TheMod EnumChatFormatting.AQUA + "Frozen Steves:\n" + EnumChatFormatting.WHITE + "Snowmans:\n" + EnumChatFormatting.DARK_GREEN + "Grinches:\n" + - EnumChatFormatting.GOLD + "Yetis:"; + EnumChatFormatting.GOLD + "Yetis:\n" + + EnumChatFormatting.AQUA + "Time Since Yeti:\n" + + EnumChatFormatting.AQUA + "Creatures Since Yeti:"; countText = EnumChatFormatting.AQUA + nf.format(lc.seaCreatures) + "\n" + EnumChatFormatting.AQUA + nf.format(lc.fishingMilestone) + "\n" + EnumChatFormatting.GOLD + nf.format(lc.goodCatches) + "\n" + @@ -1030,16 +1304,31 @@ public class TheMod EnumChatFormatting.AQUA + nf.format(lc.frozenSteves) + "\n" + EnumChatFormatting.WHITE + nf.format(lc.frostyTheSnowmans) + "\n" + EnumChatFormatting.DARK_GREEN + nf.format(lc.grinches) + "\n" + - EnumChatFormatting.GOLD + nf.format(lc.yetis); + EnumChatFormatting.GOLD + nf.format(lc.yetis) + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; } else if (ds.display.equals("fishing_winter_session")) { + if (lc.yetiTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(lc.yetiTimeSession, timeNow); + } + if (lc.yetiSCsSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(lc.yetiSCsSession); + } + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + - EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + EnumChatFormatting.GOLD + "Good Catches:\n" + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + EnumChatFormatting.AQUA + "Frozen Steves:\n" + EnumChatFormatting.WHITE + "Snowmans:\n" + EnumChatFormatting.DARK_GREEN + "Grinches:\n" + - EnumChatFormatting.GOLD + "Yetis:"; + EnumChatFormatting.GOLD + "Yetis:\n" + + EnumChatFormatting.AQUA + "Time Since Yeti:\n" + + EnumChatFormatting.AQUA + "Creatures Since Yeti:"; countText = EnumChatFormatting.AQUA + nf.format(lc.seaCreaturesSession) + "\n" + EnumChatFormatting.AQUA + nf.format(lc.fishingMilestoneSession) + "\n" + EnumChatFormatting.GOLD + nf.format(lc.goodCatchesSession) + "\n" + @@ -1047,7 +1336,137 @@ public class TheMod EnumChatFormatting.AQUA + nf.format(lc.frozenStevesSession) + "\n" + EnumChatFormatting.WHITE + nf.format(lc.frostyTheSnowmansSession) + "\n" + EnumChatFormatting.DARK_GREEN + nf.format(lc.grinchesSession) + "\n" + - EnumChatFormatting.GOLD + nf.format(lc.yetisSession); + EnumChatFormatting.GOLD + nf.format(lc.yetisSession) + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + } 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:\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.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.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.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.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.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.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.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" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Helmets:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Chestplates:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Leggings:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Boots:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Blades:\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" + + 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) + "\n" + + 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" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Helmets:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Chestplates:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Leggings:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Boots:\n" + + EnumChatFormatting.DARK_PURPLE + "Adaptive Blades:\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" + + 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) + "\n" + + 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" + + EnumChatFormatting.DARK_PURPLE + "Spirit Wings:\n" + + EnumChatFormatting.DARK_PURPLE + "Spirit Bones:\n" + + EnumChatFormatting.DARK_PURPLE + "Spirit Boots:\n" + + EnumChatFormatting.DARK_PURPLE + "Spirit Swords:\n" + + EnumChatFormatting.GOLD + "Spirit Bows:\n" + + EnumChatFormatting.DARK_PURPLE + "Epic Spirit Pets:\n" + + EnumChatFormatting.GOLD + "Leg Spirit Pets:\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" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.spiritBones) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.spiritBoots) + "\n" + + 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) + "\n" + + 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" + + EnumChatFormatting.DARK_PURPLE + "Spirit Wings:\n" + + EnumChatFormatting.DARK_PURPLE + "Spirit Bones:\n" + + EnumChatFormatting.DARK_PURPLE + "Spirit Boots:\n" + + EnumChatFormatting.DARK_PURPLE + "Spirit Swords:\n" + + EnumChatFormatting.GOLD + "Spirit Bows:\n" + + EnumChatFormatting.DARK_PURPLE + "Epic Spirit Pets:\n" + + EnumChatFormatting.GOLD + "Leg Spirit Pets:\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" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.spiritBonesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.spiritBootsSession) + "\n" + + 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) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f4CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f4TimeSpentSession); } else { ConfigHandler cf = new ConfigHandler(); @@ -1066,6 +1485,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; @@ -1118,6 +1538,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; @@ -1130,6 +1551,16 @@ public class TheMod @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { + // Check if player is in Skyblock every second + tickAmount++; + if (tickAmount % 20 == 0) { + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + if (player != null) { + Utils.checkForSkyblock(); + } + tickAmount = 1; + } + if (titleTimer >= 0) { if (titleTimer == 0) { showTitle = false; @@ -1138,7 +1569,124 @@ public class TheMod } } - public void increaseEmpSC() { + @SubscribeEvent + public void onInteract(PlayerInteractEvent event) { + if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return; + ItemStack item = event.entityPlayer.getHeldItem(); + if (item == null) return; + + if (ToggleCommand.aotdToggled && item.getDisplayName().contains("Aspect of the Dragons") && event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR) { + event.setCanceled(true); + } + } + + @SubscribeEvent + public void onKey(KeyInputEvent event) { + if (!Utils.inSkyblock) return; + if (keyBindings[0].isPressed()) { + Minecraft.getMinecraft().thePlayer.sendChatMessage(lastMaddoxCommand); + } + } + + @SubscribeEvent + public void onGuiMouseInput(GuiScreenEvent.MouseInputEvent.Pre event) { + if (!Utils.inSkyblock) return; + if (Mouse.getEventButton() == lastMouse) return; + lastMouse = Mouse.getEventButton(); + if (Mouse.getEventButton() != 0 && Mouse.getEventButton() != 1) return; // Left click or right click + + 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<String> tooltip = item.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); + for (String lineUnclean : tooltip) { + String line = StringUtils.stripControlCodes(lineUnclean); + if (line.contains("FREE")) { + break; + } else if (line.contains(" Coins")) { + int coinsSpent = Integer.parseInt(line.substring(0, line.indexOf(" ")).replaceAll(",", "")); + + List<String> 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; + if (ToggleCommand.petColoursToggled && event.gui instanceof GuiChest) { + GuiChest inventory = (GuiChest) event.gui; + List<Slot> invSlots = inventory.inventorySlots.inventorySlots; + for (Slot slot : invSlots) { + ItemStack item = slot.getStack(); + if (item == null) continue; + String name = item.getDisplayName(); + if (name.contains("[Lvl ")) { + if (name.endsWith("aHealer") || name.endsWith("aMage") || name.endsWith("aBerserk") || name.endsWith("aArcher") || name.endsWith("aTank")) continue; + 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 = 0xBF9E794E; // Brown + } else if (petLevel >= 80) { + colour = 0xBF5C1F35; // idk weird magenta + } else if (petLevel >= 70) { + colour = 0xBFD64FC8; // Pink + } else if (petLevel >= 60) { + colour = 0xBF7E4FC6; // Purple + } else if (petLevel >= 50) { + colour = 0xBF008AD8; // Light Blue + } else if (petLevel >= 40) { + colour = 0xBF0EAC35; // Green + } else if (petLevel >= 30) { + colour = 0xBFFFC400; // Yellow + } else if (petLevel >= 20) { + colour = 0xBFEF5230; // Orange + } else if (petLevel >= 10) { + colour = 0xBFD62440; // Red + } else { + colour = 0xBF999999; // Gray + } + Utils.drawOnSlot(inventory.inventorySlots.inventorySlots.size(), slot.xDisplayPosition, slot.yDisplayPosition, colour); + } + } + } + } + + public void increaseSeaCreatures() { LootCommand lc = new LootCommand(); ConfigHandler cf = new ConfigHandler(); @@ -1148,8 +1696,23 @@ public class TheMod if (lc.empSCsSession != -1) { lc.empSCsSession++; } + // Only increment Yetis when in Jerry's Workshop + List<String> scoreboard = ScoreboardHandler.getSidebarLines(); + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("Jerry's Workshop")) { + if (lc.yetiSCs != -1) { + lc.yetiSCs++; + } + if (lc.yetiSCsSession != -1) { + lc.yetiSCsSession++; + } + } + } cf.writeIntConfig("fishing", "empSC", lc.empSCs); + cf.writeIntConfig("fishing", "yetiSC", lc.yetiSCs); + } } diff --git a/src/main/java/me/Danker/commands/BankCommand.java b/src/main/java/me/Danker/commands/BankCommand.java index e32e66f..952929f 100644 --- a/src/main/java/me/Danker/commands/BankCommand.java +++ b/src/main/java/me/Danker/commands/BankCommand.java @@ -3,6 +3,7 @@ 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; @@ -25,8 +26,7 @@ public class BankCommand extends CommandBase { } @Override - public List<String> getCommandAliases() - { + public List<String> getCommandAliases() { return Collections.singletonList("purse"); } @@ -91,6 +91,7 @@ public class BankCommand extends CommandBase { System.out.println("Fetching bank + purse coins..."); double purseCoins = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("coin_purse").getAsDouble(); purseCoins = (double) Math.floor(purseCoins * 100.0) / 100.0; + NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); // Check for bank api if (profileResponse.get("profile").getAsJsonObject().has("banking")) { @@ -99,14 +100,14 @@ public class BankCommand extends CommandBase { player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + EnumChatFormatting.AQUA + " " + username + "'s Coins:\n" + - EnumChatFormatting.GREEN + " Bank: " + EnumChatFormatting.GOLD + NumberFormat.getInstance().format(bankCoins) + "\n" + - EnumChatFormatting.GREEN + " Purse: " + EnumChatFormatting.GOLD + NumberFormat.getInstance().format(purseCoins) + "\n" + + EnumChatFormatting.GREEN + " Bank: " + EnumChatFormatting.GOLD + nf.format(bankCoins) + "\n" + + EnumChatFormatting.GREEN + " Purse: " + EnumChatFormatting.GOLD + nf.format(purseCoins) + "\n" + EnumChatFormatting.AQUA + " " + EnumChatFormatting.BOLD + "-------------------")); } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + EnumChatFormatting.AQUA + " " + username + "'s Coins:\n" + EnumChatFormatting.GREEN + " Bank: " + EnumChatFormatting.RED + "Bank API disabled.\n" + - EnumChatFormatting.GREEN + " Purse: " + EnumChatFormatting.GOLD + NumberFormat.getInstance().format(purseCoins) + "\n" + + EnumChatFormatting.GREEN + " Purse: " + EnumChatFormatting.GOLD + nf.format(purseCoins) + "\n" + EnumChatFormatting.AQUA + " " + EnumChatFormatting.BOLD + "-------------------")); } }).start(); diff --git a/src/main/java/me/Danker/commands/ChatMaddoxCommand.java b/src/main/java/me/Danker/commands/ChatMaddoxCommand.java new file mode 100644 index 0000000..518f26f --- /dev/null +++ b/src/main/java/me/Danker/commands/ChatMaddoxCommand.java @@ -0,0 +1,33 @@ +package me.Danker.commands; + +import me.Danker.TheMod; +import net.minecraft.client.Minecraft; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; + +public class ChatMaddoxCommand extends CommandBase { + + @Override + public String getCommandName() { + return "dmodopenmaddoxmenu"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return null; + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } + + @Override + public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { + if (!ToggleCommand.chatMaddoxToggled) return; + Minecraft.getMinecraft().thePlayer.sendChatMessage(TheMod.lastMaddoxCommand); + } + +} diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 9ca6a6e..52db06b 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -31,22 +31,25 @@ public class DHelpCommand extends CommandBase { player.addChatMessage(new ChatComponentText("\n" + EnumChatFormatting.GOLD + " " + TheMod.MODID + " Version " + TheMod.VERSION + "\n" + 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 <gparty/coords/golden/slayercount/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/sceptremessages/petcolors/dungeontimer/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey <key>" + EnumChatFormatting.AQUA + " - Sets API key.\n" + - EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey.\n" + - EnumChatFormatting.GOLD + " /loot <zombie/spider/wolf/fishing> [winter/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + - EnumChatFormatting.GOLD + " /display <zombie/spider/wolf/fishing/off> [winter/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead.\n" + - EnumChatFormatting.GOLD + " /resetloot <zombie/spider/wolf/fishing/confirm/cancel>" + EnumChatFormatting.AQUA + " - Resets loot for trackers. /resetloot confirm confirms the reset.\n" + - EnumChatFormatting.GOLD + " /move <coords/display> <x> <y>" + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + - EnumChatFormatting.GOLD + " /scale <coords/display> <scale (0.1 - 10)" + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + + EnumChatFormatting.GOLD + " /loot <zombie/spider/wolf/fishing/catacombs> [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" + + EnumChatFormatting.GOLD + " /display <zombie/spider/wolf/fishing/catacombs/off> [winter/f(1-4)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead.\n" + + EnumChatFormatting.GOLD + " /resetloot <zombie/spider/wolf/fishing/catacombs/confirm/cancel>" + EnumChatFormatting.AQUA + " - Resets loot for trackers. /resetloot confirm confirms the reset.\n" + + EnumChatFormatting.GOLD + " /move <coords/display/dungeontimer> <x> <y>" + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + + EnumChatFormatting.GOLD + " /scale <coords/display/dungeontimer> <scale (0.1 - 10)>" + 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" + + EnumChatFormatting.GREEN + " Open Maddox Menu" + EnumChatFormatting.AQUA + " - M by default.\n")); } } diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index 916245e..2f7690d 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/me/Danker/commands/DisplayCommand.java @@ -21,7 +21,7 @@ public class DisplayCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " <zombie/spider/wolf/fishing/off> [winter/session]"; + return getCommandName() + " <zombie/spider/wolf/fishing/catacombs/off> [winter/session/f(1-4)]"; } @Override @@ -32,10 +32,12 @@ public class DisplayCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing", "off"); + return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing", "catacombs", "off"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { return getListOfStringsMatchingLastWord(args, "winter", "session"); - } else if (args.length == 2 || (args.length == 3 && args[0].equalsIgnoreCase("fishing") && args[1].equalsIgnoreCase("winter"))) { + } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { + return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4"); + } else if (args.length > 1 || (args.length == 3 && args[0].equalsIgnoreCase("fishing") && args[1].equalsIgnoreCase("winter"))) { return getListOfStringsMatchingLastWord(args, "session"); } return null; @@ -46,22 +48,14 @@ public class DisplayCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display <zombie/spider/wolf/fishing/off> [winter/session]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: <zombie/spider/wolf/fishing/catacombs/off> [winter/session/f(1-4)]")); return; } final ConfigHandler cf = new ConfigHandler(); boolean showSession = false; - if (arg1.length > 1) { - if (arg1[1].equalsIgnoreCase("session")) { - showSession = true; - } else if (arg1.length > 2) { - if (arg1[2].equalsIgnoreCase("session")) { - showSession = true; - } - } - } + if (arg1[arg1.length - 1].equalsIgnoreCase("session")) showSession = true; if (arg1[0].equalsIgnoreCase("wolf")) { if (showSession) { @@ -95,10 +89,43 @@ public class DisplayCommand extends CommandBase { display = "fishing"; } } + } else if (arg1[0].equalsIgnoreCase("catacombs")) { + if (arg1.length == 1) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display catacombs <f1/f2/f3/f4>")); + return; + } + if (arg1[1].equalsIgnoreCase("f1") || arg1[1].equalsIgnoreCase("floor1")) { + if (showSession) { + display = "catacombs_floor_one_session"; + } else { + display = "catacombs_floor_one"; + } + } else if (arg1[1].equalsIgnoreCase("f2") || arg1[1].equalsIgnoreCase("floor2")) { + if (showSession) { + display = "catacombs_floor_two_session"; + } else { + display = "catacombs_floor_two"; + } + } else if (arg1[1].equalsIgnoreCase("f3") || arg1[1].equalsIgnoreCase("floor3")) { + if (showSession) { + display = "catacombs_floor_three_session"; + } else { + display = "catacombs_floor_three"; + } + } else if (arg1[1].equalsIgnoreCase("f4") || arg1[1].equalsIgnoreCase("floor4")) { + if (showSession) { + display = "catacombs_floor_four_session"; + } else { + display = "catacombs_floor_four"; + } + } else { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display catacombs <f1/f2/f3/f4>")); + return; + } } else if (arg1[0].equalsIgnoreCase("off")) { display = "off"; } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display <zombie/spider/wolf/fishing/off> [winter/session]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: <zombie/spider/wolf/fishing/catacombs/off> [winter/session/f(1-4)]")); return; } player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Display set to " + EnumChatFormatting.DARK_GREEN + display + EnumChatFormatting.GREEN + ".")); diff --git a/src/main/java/me/Danker/commands/GetkeyCommand.java b/src/main/java/me/Danker/commands/GetkeyCommand.java index 80354fe..f06e66f 100644 --- a/src/main/java/me/Danker/commands/GetkeyCommand.java +++ b/src/main/java/me/Danker/commands/GetkeyCommand.java @@ -1,5 +1,9 @@ package me.Danker.commands; +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.StringSelection; + import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -28,14 +32,19 @@ public class GetkeyCommand extends CommandBase implements ICommand { @Override public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { - final EntityPlayer player = (EntityPlayer)arg0; - final ConfigHandler cf = new ConfigHandler(); - - if (cf.getString("api", "APIKey").equals("")) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Set your API key using /setkey.")); - } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Your set API key is " + EnumChatFormatting.DARK_GREEN + cf.getString("api", "APIKey"))); - } + EntityPlayer player = (EntityPlayer)arg0; + ConfigHandler cf = new ConfigHandler(); + Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + StringSelection stringSelection = new StringSelection(cf.getString("api", "APIKey")); + + if (cf.getString("api", "APIKey").equals("")) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Set your API key using /setkey.")); + } + + clipboard.setContents(stringSelection, null); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Your set API key is " + EnumChatFormatting.DARK_GREEN + cf.getString("api", "APIKey") + "\n" + + EnumChatFormatting.GREEN + "Your set API key has been copied to the clipboard.")); + } } diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index d64e9d9..a877a8d 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; @@ -80,6 +81,38 @@ public class LootCommand extends CommandBase { public static int frostyTheSnowmans; public static int grinches; public static int yetis; + public static double yetiTime; + public static int yetiSCs; + + // Catacombs Dungeons + public static int recombobulators; + 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; + public static int spiritBoots; + public static int spiritSwords; + 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 @@ -149,35 +182,38 @@ public class LootCommand extends CommandBase { public static int frostyTheSnowmansSession = 0; public static int grinchesSession = 0; public static int yetisSession = 0; + public static double yetiTimeSession = 0; + public static int yetiSCsSession = 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; - } + // Catacombs Dungeons + public static int recombobulatorsSession = 0; + 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; + public static int spiritBootsSession = 0; + public static int spiritSwordsSession = 0; + public static int spiritBowsSession = 0; + public static int epicSpiritPetsSession = 0; + public static int legSpiritPetsSession = 0; + public static double f4CoinsSpentSession = 0; + public static double f4TimeSpentSession = 0; @Override public String getCommandName() { @@ -186,7 +222,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " <zombie/spider/wolf/fishing> [winter/session]"; + return getCommandName() + " <zombie/spider/wolf/fishing/catacombs> [winter/f(1-4)/session]"; } @Override @@ -197,10 +233,12 @@ public class LootCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing"); + return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing", "catacombs"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { return getListOfStringsMatchingLastWord(args, "winter", "session"); - } else if (args.length == 2 || (args.length == 3 && args[0].equalsIgnoreCase("fishing") && args[1].equalsIgnoreCase("winter"))) { + } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { + return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4"); + } else if (args.length > 1 || (args.length == 3 && args[0].equalsIgnoreCase("fishing") && args[1].equalsIgnoreCase("winter"))) { return getListOfStringsMatchingLastWord(args, "session"); } return null; @@ -211,7 +249,7 @@ public class LootCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot <zombie/spider/wolf/fishing> [winter/session]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot <zombie/spider/wolf/fishing/catacombs> [winter/f(1-4)/session]")); return; } @@ -222,22 +260,14 @@ public class LootCommand extends CommandBase { NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); boolean showSession = false; - if (arg1.length > 1) { - if (arg1[1].equalsIgnoreCase("session")) { - showSession = true; - } else if (arg1.length > 2) { - if (arg1[2].equalsIgnoreCase("session")) { - showSession = true; - } - } - } - + if (arg1[arg1.length - 1].equalsIgnoreCase("session")) showSession = true; + if (arg1[0].equalsIgnoreCase("wolf")) { if (showSession) { if (wolfTimeSession == -1) { timeBetween = "Never"; } else { - timeBetween = getTimeBetween(wolfTimeSession, timeNow); + timeBetween = Utils.getTimeBetween(wolfTimeSession, timeNow); } if (wolfBossesSession == -1) { bossesBetween = "Never"; @@ -270,7 +300,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"; @@ -302,7 +332,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"; @@ -335,7 +365,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"; @@ -367,7 +397,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"; @@ -401,7 +431,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"; @@ -433,22 +463,48 @@ public class LootCommand extends CommandBase { if (arg1.length > 1) { if (arg1[1].equalsIgnoreCase("winter")) { if (showSession) { + if (yetiTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(yetiTimeSession, timeNow); + } + if (yetiSCsSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(yetiSCsSession); + } + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + EnumChatFormatting.WHITE + EnumChatFormatting.BOLD + " Winter Fishing Summary (Current Session):\n" + EnumChatFormatting.AQUA + " Frozen Steves: " + nf.format(frozenStevesSession) + "\n" + EnumChatFormatting.WHITE + " Snowmans: " + nf.format(frostyTheSnowmansSession) + "\n" + EnumChatFormatting.DARK_GREEN + " Grinches: " + nf.format(grinchesSession) + "\n" + EnumChatFormatting.GOLD + " Yetis: " + nf.format(yetisSession) + "\n" + + EnumChatFormatting.AQUA + " Time Since Yeti: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Creatures Since Yeti: " + bossesBetween + "\n" + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); return; } + if (yetiTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(yetiTime, timeNow); + } + if (yetiSCs == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(yetiSCs); + } + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + EnumChatFormatting.WHITE + EnumChatFormatting.BOLD + " Winter Fishing Summary:\n" + EnumChatFormatting.AQUA + " Frozen Steves: " + nf.format(frozenSteves) + "\n" + EnumChatFormatting.WHITE + " Snowmans: " + nf.format(frostyTheSnowmans) + "\n" + EnumChatFormatting.DARK_GREEN + " Grinches: " + nf.format(grinches) + "\n" + EnumChatFormatting.GOLD + " Yetis: " + nf.format(yetis) + "\n" + + EnumChatFormatting.AQUA + " Time Since Yeti: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Creatures Since Yeti: " + bossesBetween + "\n" + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); return; } @@ -458,7 +514,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"; @@ -494,7 +550,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"; @@ -524,8 +580,116 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Time Since Sea Emperor: " + timeBetween + "\n" + EnumChatFormatting.AQUA + " Sea Creatures Since Sea Emperor: " + bossesBetween + "\n" + EnumChatFormatting.DARK_AQUA + EnumChatFormatting.BOLD + " -------------------")); + } else if (arg1[0].equalsIgnoreCase("catacombs")) { + if (arg1.length == 1) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot catacombs <f1/f2/f3/f4>")); + return; + } + if (arg1[1].equalsIgnoreCase("f1") || arg1[1].equalsIgnoreCase("floor1")) { + if (showSession) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Catacombs F1 Summary (Current Session):\n" + + 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; + } + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Catacombs F1 Summary:\n" + + 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) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Catacombs F2 Summary (Current Session):\n" + + 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; + } + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Catacombs F2 Summary:\n" + + 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) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Catacombs F3 Summary (Current Session):\n" + + EnumChatFormatting.GOLD + " Recombobulator 3000s: " + nf.format(recombobulatorsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Fuming Potato Books: " + nf.format(fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Adaptive Helmets: " + nf.format(adaptiveHelmsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Adaptive Chestplates: " + nf.format(adaptiveChestsSession) + "\n" + + 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; + } + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Catacombs F3 Summary:\n" + + EnumChatFormatting.GOLD + " Recombobulator 3000s: " + nf.format(recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Fuming Potato Books: " + nf.format(fumingPotatoBooks) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Adaptive Helmets: " + nf.format(adaptiveHelms) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Adaptive Chestplates: " + nf.format(adaptiveChests) + "\n" + + 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) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Catacombs F4 Summary (Current Session):\n" + + EnumChatFormatting.GOLD + " Recombobulator 3000s: " + nf.format(recombobulatorsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Fuming Potato Books: " + nf.format(fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Spirit Wings: " + nf.format(spiritWingsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Spirit Bones: " + nf.format(spiritBonesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Spirit Boots: " + nf.format(spiritBootsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Spirit Swords: " + nf.format(spiritSwordsSession) + "\n" + + 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; + } + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Catacombs F4 Summary:\n" + + EnumChatFormatting.GOLD + " Recombobulator 3000s: " + nf.format(recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Fuming Potato Books: " + nf.format(fumingPotatoBooks) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Spirit Wings: " + nf.format(spiritWings) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Spirit Bones: " + nf.format(spiritBones) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Spirit Boots: " + nf.format(spiritBoots) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Spirit Swords: " + nf.format(spiritSwords) + "\n" + + 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 <f1/f2/f3/f4>")); + } } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot <zombie/spider/wolf/fishing> [winter/session]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot <zombie/spider/wolf/fishing/catacombs> [winter/f(1-4)/session]")); } } diff --git a/src/main/java/me/Danker/commands/MoveCommand.java b/src/main/java/me/Danker/commands/MoveCommand.java index 1232e18..24396ff 100644 --- a/src/main/java/me/Danker/commands/MoveCommand.java +++ b/src/main/java/me/Danker/commands/MoveCommand.java @@ -15,6 +15,7 @@ public class MoveCommand extends CommandBase { public static int[] coordsXY = {0, 0}; public static int[] displayXY = {0, 0}; + public static int[] dungeonTimerXY = {0, 0}; @Override public String getCommandName() { @@ -23,7 +24,7 @@ public class MoveCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " <coords/display> <x> <y>"; + return getCommandName() + " <coords/display/dungeontimer> <x> <y>"; } @Override @@ -34,7 +35,7 @@ public class MoveCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "coords", "display"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer"); } return null; } @@ -45,7 +46,7 @@ public class MoveCommand extends CommandBase { final ConfigHandler cf = new ConfigHandler(); if (arg1.length < 2) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /move <coords/display> <x> <y>")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /move <coords/display/dungeontimer> <x> <y>")); return; } @@ -61,8 +62,14 @@ public class MoveCommand extends CommandBase { cf.writeIntConfig("locations", "displayX", displayXY[0]); cf.writeIntConfig("locations", "displayY", displayXY[1]); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Tracker display has been moved to " + EnumChatFormatting.DARK_GREEN + arg1[1] + ", " + arg1[2])); + } else if (arg1[0].equalsIgnoreCase("dungeontimer")) { + dungeonTimerXY[0] = Integer.parseInt(arg1[1]); + dungeonTimerXY[1] = Integer.parseInt(arg1[2]); + cf.writeIntConfig("locations", "dungeonTimerX", dungeonTimerXY[0]); + cf.writeIntConfig("locations", "dungeonTimerY", dungeonTimerXY[1]); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Dungeon timer has been moved to " + EnumChatFormatting.DARK_GREEN + arg1[1] + ", " + arg1[2])); } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /move <coords/display> <x> <y>")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /move <coords/display/dungeontimer> <x> <y>")); } } diff --git a/src/main/java/me/Danker/commands/PetsCommand.java b/src/main/java/me/Danker/commands/PetsCommand.java index 75367ab..c697689 100644 --- a/src/main/java/me/Danker/commands/PetsCommand.java +++ b/src/main/java/me/Danker/commands/PetsCommand.java @@ -23,7 +23,7 @@ public class PetsCommand extends CommandBase { static int petXpToLevel(double xp, String rarity) { int[] xpPerLevel = {100, 110, 120, 130, 145, 160, 175, 190, 210, 230, 250, 275, 300, 330, 360, 400, 440, 490, 540, 600, 660, 730, - 800, 880, 860, 1050, 1150, 1260, 1380, 1510, 1650, 1800, 1960, 2130, 2310, 2500, 2700, 2920, 3160, 3420, 3700, + 800, 880, 960, 1050, 1150, 1260, 1380, 1510, 1650, 1800, 1960, 2130, 2310, 2500, 2700, 2920, 3160, 3420, 3700, 4000, 4350, 4750, 5200, 5700, 6300, 7000, 7800, 8700, 9700, 10800, 12000, 13300, 14700, 16200, 17800, 19500, 21300, 23200, 25200, 27400, 29800, 32400, 35200, 38200, 41400, 44800, 48400, 52200, 56200, 60400, 64800, 69400, 74200, 79200, 84700, 90700, 97200, 104200, 111700, 119700, 128200, 137200, 146700, 156700, 167700, 179700, 192700, @@ -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/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index 1afc204..dd540d6 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -23,7 +23,7 @@ public class ResetLootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + "<zombie/spider/wolf/fishing/confirm/cancel>"; + return getCommandName() + "<zombie/spider/wolf/fishing/catacombs/confirm/cancel>"; } @Override @@ -38,7 +38,7 @@ public class ResetLootCommand extends CommandBase { if (confirmReset) { return getListOfStringsMatchingLastWord(args, "confirm", "cancel"); } else { - return getListOfStringsMatchingLastWord(args, "zombie", "spider", "wolf", "fishing"); + return getListOfStringsMatchingLastWord(args, "zombie", "spider", "wolf", "fishing", "catacombs"); } } @@ -47,7 +47,7 @@ public class ResetLootCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /resetloot <zombie/spider/wolf/fishing>")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /resetloot <zombie/spider/wolf/fishing/catacombs>")); return; } @@ -63,6 +63,8 @@ public class ResetLootCommand extends CommandBase { resetWolf(); } else if (resetOption.equalsIgnoreCase("fishing")) { resetFishing(); + } else if (resetOption.equalsIgnoreCase("catacombs")) { + resetCatacombs(); } player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Reset complete.")); } else if (arg1[0].equalsIgnoreCase("cancel")) { @@ -73,7 +75,7 @@ public class ResetLootCommand extends CommandBase { EnumChatFormatting.RED + " Cancel by using /resetloot cancel.")); } } else { - if (arg1[0].equalsIgnoreCase("zombie") || arg1[0].equalsIgnoreCase("spider") || arg1[0].equalsIgnoreCase("wolf") || arg1[0].equalsIgnoreCase("fishing")) { + if (arg1[0].equalsIgnoreCase("zombie") || arg1[0].equalsIgnoreCase("spider") || arg1[0].equalsIgnoreCase("wolf") || arg1[0].equalsIgnoreCase("fishing") || arg1[0].equalsIgnoreCase("catacombs")) { resetOption = arg1[0]; player.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Are you sure you want to reset the " + resetOption + " tracker?" + " Confirm with " + EnumChatFormatting.GREEN + "/resetloot confirm" + EnumChatFormatting.YELLOW + "." + @@ -82,7 +84,7 @@ public class ResetLootCommand extends CommandBase { } else if (arg1[0].equalsIgnoreCase("confirm") || arg1[0].equalsIgnoreCase("cancel")) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Pick something to reset first.")); } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /resetloot <zombie/spider/wolf/fishing>")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /resetloot <zombie/spider/wolf/fishing/catacombs>")); } } } @@ -174,8 +176,39 @@ public class ResetLootCommand extends CommandBase { lc.frostyTheSnowmansSession = 0; lc.grinchesSession = 0; lc.yetisSession = 0; + lc.yetiTimeSession = -1; + lc.yetiSCsSession = -1; cf.deleteCategory("fishing"); cf.reloadConfig(); } + + static void resetCatacombs() { + LootCommand lc = new LootCommand(); + ConfigHandler cf = new ConfigHandler(); + lc.recombobulatorsSession = 0; + lc.fumingPotatoBooksSession = 0; + lc.bonzoStaffsSession = 0; + lc.f1CoinsSpentSession = 0; + lc.f1TimeSpentSession = 0; + lc.scarfStudiesSession = 0; + lc.f2CoinsSpentSession = 0; + lc.f2TimeSpentSession = 0; + lc.adaptiveHelmsSession = 0; + lc.adaptiveChestsSession = 0; + lc.adaptiveLegsSession = 0; + lc.adaptiveBootsSession = 0; + lc.adaptiveSwordsSession = 0; + lc.f3CoinsSpentSession = 0; + lc.f3TimeSpentSession = 0; + lc.spiritWingsSession = 0; + lc.spiritBonesSession = 0; + lc.spiritBootsSession = 0; + lc.spiritSwordsSession = 0; + lc.epicSpiritPetsSession = 0; + lc.f4CoinsSpentSession = 0; + lc.f4TimeSpentSession = 0; + cf.deleteCategory("catacombs"); + cf.reloadConfig(); + } } diff --git a/src/main/java/me/Danker/commands/ScaleCommand.java b/src/main/java/me/Danker/commands/ScaleCommand.java index f8c73c9..7b56b6d 100644 --- a/src/main/java/me/Danker/commands/ScaleCommand.java +++ b/src/main/java/me/Danker/commands/ScaleCommand.java @@ -15,6 +15,7 @@ public class ScaleCommand extends CommandBase { public static double coordsScale; public static double displayScale; + public static double dungeonTimerScale; @Override public String getCommandName() { @@ -23,7 +24,7 @@ public class ScaleCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " <coords/display> <size (0.1 - 10)>"; + return getCommandName() + " <coords/display/dungeontimer> <size (0.1 - 10)>"; } @Override @@ -34,7 +35,7 @@ public class ScaleCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "coords", "display"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer"); } return null; } @@ -44,11 +45,11 @@ public class ScaleCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length < 2) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /scale <coords/display> <size (0.1 - 10)>")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /scale <coords/display/dungeontimer> <size (0.1 - 10)>")); return; } - double scaleAmount = (double) Math.floor(Double.parseDouble(arg1[1]) * 10.0) / 10.0; + double scaleAmount = (double) Math.floor(Double.parseDouble(arg1[1]) * 100.0) / 100.0; if (scaleAmount < 0.1 || scaleAmount > 10.0) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Scale multipler can only be between 0.1x and 10x.")); return; @@ -62,8 +63,12 @@ public class ScaleCommand extends CommandBase { displayScale = scaleAmount; ConfigHandler.writeDoubleConfig("scales", "displayScale", displayScale); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Display has been scaled to " + EnumChatFormatting.DARK_GREEN + displayScale + "x")); + } else if (arg1[0].equalsIgnoreCase("dungeontimer")) { + dungeonTimerScale = scaleAmount; + ConfigHandler.writeDoubleConfig("scales", "dungeonTimerScale", dungeonTimerScale); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Dungeon timer has been scaled to " + EnumChatFormatting.DARK_GREEN + dungeonTimerScale + "x")); } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /scale <coords/display> <size (0.1 - 10)>")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /scale <coords/display/dungeontimer> <size (0.1 - 10)>")); } } 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/commands/SkyblockPlayersCommand.java b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java new file mode 100644 index 0000000..ee3c522 --- /dev/null +++ b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java @@ -0,0 +1,151 @@ +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<String> 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; // 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(); + 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(); + } + if (skyblockPlayers.has("winter")) { + jerry = skyblockPlayers.get("winter").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/commands/SlayerCommand.java b/src/main/java/me/Danker/commands/SlayerCommand.java index f8100b4..0aba569 100644 --- a/src/main/java/me/Danker/commands/SlayerCommand.java +++ b/src/main/java/me/Danker/commands/SlayerCommand.java @@ -2,6 +2,7 @@ package me.Danker.commands; import java.text.NumberFormat; import java.util.List; +import java.util.Locale; import com.google.gson.JsonObject; @@ -99,11 +100,12 @@ public class SlayerCommand extends CommandBase { wolfXP = slayersObject.get("wolf").getAsJsonObject().get("xp").getAsInt(); } + NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + - EnumChatFormatting.AQUA + " " + username + "'s Total XP: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + NumberFormat.getIntegerInstance().format(zombieXP + spiderXP + wolfXP) + "\n" + - EnumChatFormatting.AQUA + " Zombie XP: " + EnumChatFormatting.BLUE + EnumChatFormatting.BOLD + NumberFormat.getIntegerInstance().format(zombieXP) + "\n" + - EnumChatFormatting.AQUA + " Spider XP: " + EnumChatFormatting.BLUE + EnumChatFormatting.BOLD + NumberFormat.getIntegerInstance().format(spiderXP) + "\n" + - EnumChatFormatting.AQUA + " Wolf XP: " + EnumChatFormatting.BLUE + EnumChatFormatting.BOLD + NumberFormat.getIntegerInstance().format(wolfXP) + "\n" + + EnumChatFormatting.AQUA + " " + username + "'s Total XP: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + nf.format(zombieXP + spiderXP + wolfXP) + "\n" + + EnumChatFormatting.AQUA + " Zombie XP: " + EnumChatFormatting.BLUE + EnumChatFormatting.BOLD + nf.format(zombieXP) + "\n" + + EnumChatFormatting.AQUA + " Spider XP: " + EnumChatFormatting.BLUE + EnumChatFormatting.BOLD + nf.format(spiderXP) + "\n" + + EnumChatFormatting.AQUA + " Wolf XP: " + EnumChatFormatting.BLUE + EnumChatFormatting.BOLD + nf.format(wolfXP) + "\n" + EnumChatFormatting.AQUA + " " + EnumChatFormatting.BOLD + "-------------------")); }).start(); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index decf99a..b1e5270 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -18,6 +18,13 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean goldenToggled; public static boolean slayerCountTotal; public static boolean rngesusAlerts; + public static boolean splitFishing; + public static boolean chatMaddoxToggled; + public static boolean spiritBearAlerts; + public static boolean aotdToggled; + public static boolean sceptreMessages; + public static boolean petColoursToggled; + public static boolean dungeonTimerToggled; @Override public String getCommandName() { @@ -26,7 +33,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " <gparty/coords/golden/slayercount/rngesusalerts/list>"; + return getCommandName() + " <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalert/aotd/sceptremessages/petcolors/dungeontimer/list>"; } @Override @@ -37,7 +44,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "list"); + return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "petcolors", "dungeontimer", "list"); } return null; } @@ -48,7 +55,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 <gparty/coords/golden/slayercount/rngesusalerts/list>")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/sceptremessages/petcolors/dungeontimer/list>")); return; } @@ -66,18 +73,55 @@ public class ToggleCommand extends CommandBase implements ICommand { player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Golden T6 enchants has been set to " + EnumChatFormatting.DARK_GREEN + goldenToggled + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("slayercount")) { slayerCountTotal = !slayerCountTotal; + cf.writeBooleanConfig("toggles", "SlayerCount", slayerCountTotal); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Counting total 20% slayer drops has been set to " + EnumChatFormatting.DARK_GREEN + slayerCountTotal + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("rngesusalerts")) { rngesusAlerts = !rngesusAlerts; + cf.writeBooleanConfig("toggles", "RNGesusAlerts", rngesusAlerts); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Slayer RNGesus alerts has been set to " + EnumChatFormatting.DARK_GREEN + rngesusAlerts + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("splitfishing")) { + splitFishing = !splitFishing; + cf.writeBooleanConfig("toggles", "SplitFishing", splitFishing); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Split fishing display has been set to " + EnumChatFormatting.DARK_GREEN + splitFishing + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("chatmaddox")) { + chatMaddoxToggled = !chatMaddoxToggled; + cf.writeBooleanConfig("toggles", "ChatMaddox", chatMaddoxToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Chat Maddox menu has been set to " + EnumChatFormatting.DARK_GREEN + chatMaddoxToggled + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("spiritbearalerts")) { + spiritBearAlerts = !spiritBearAlerts; + cf.writeBooleanConfig("toggles", "SpiritBearAlerts", spiritBearAlerts); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Spirit Bear alerts have been set to " + EnumChatFormatting.DARK_GREEN + spiritBearAlerts + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("aotd")) { + aotdToggled = !aotdToggled; + cf.writeBooleanConfig("toggles", "AOTD", aotdToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Block AOTD ability been set to " + EnumChatFormatting.DARK_GREEN + aotdToggled + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("sceptremessages")) { + 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("dungeontimer")) { + dungeonTimerToggled = !dungeonTimerToggled; + cf.writeBooleanConfig("toggles", "DungeonTimer", dungeonTimerToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Dungeon timer has been set to " + EnumChatFormatting.DARK_GREEN + dungeonTimerToggled + 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" + EnumChatFormatting.GREEN + " Golden T6 enchants: " + EnumChatFormatting.DARK_GREEN + goldenToggled + "\n" + EnumChatFormatting.GREEN + " Counting total 20% slayer drops: " + EnumChatFormatting.DARK_GREEN + slayerCountTotal + "\n" + - EnumChatFormatting.GREEN + " Slayer RNGesus alerts: " + EnumChatFormatting.DARK_GREEN + rngesusAlerts)); + EnumChatFormatting.GREEN + " Slayer RNGesus alerts: " + EnumChatFormatting.DARK_GREEN + rngesusAlerts + "\n" + + EnumChatFormatting.GREEN + " Split fishing display: " + EnumChatFormatting.DARK_GREEN + splitFishing + "\n" + + 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 + "\n" + + EnumChatFormatting.GREEN + " Pet colours: " + EnumChatFormatting.DARK_GREEN + petColoursToggled + "\n" + + EnumChatFormatting.GREEN + " Dungeon timer: " + EnumChatFormatting.DARK_GREEN + dungeonTimerToggled)); } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/slayercount/rngesusalerts/list>")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/sceptremessages/petcolors/dungeontimer/list>")); } } } diff --git a/src/main/java/me/Danker/handlers/APIHandler.java b/src/main/java/me/Danker/handlers/APIHandler.java index 783ca92..34a73ff 100644 --- a/src/main/java/me/Danker/handlers/APIHandler.java +++ b/src/main/java/me/Danker/handlers/APIHandler.java @@ -2,10 +2,12 @@ package me.Danker.handlers; import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; +import java.util.Scanner; import com.google.gson.Gson; import com.google.gson.JsonArray; @@ -41,6 +43,17 @@ public class APIHandler { return object; } else { + if (urlString.startsWith("https://api.hypixel.net/")) { + InputStream errorStream = conn.getErrorStream(); + try (Scanner scanner = new Scanner(errorStream)) { + scanner.useDelimiter("\\Z"); + String error = scanner.next(); + + Gson gson = new Gson(); + JsonObject object = gson.fromJson(error, JsonObject.class); + return object; + } + } player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Request failed. HTTP Error Code: " + conn.getResponseCode())); } } catch (MalformedURLException ex) { diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 4fc4be5..34aaffe 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -174,6 +174,14 @@ public class ConfigHandler { if (!hasKey("toggles", "Golden")) writeBooleanConfig("toggles", "Golden", false); if (!hasKey("toggles", "SlayerCount")) writeBooleanConfig("toggles", "SlayerCount", true); if (!hasKey("toggles", "RNGesusAlerts")) writeBooleanConfig("toggles", "RNGesusAlerts", true); + if (!hasKey("toggles", "SplitFishing")) writeBooleanConfig("toggles", "SplitFishing", true); + if (!hasKey("toggles", "ChatMaddox")) writeBooleanConfig("toggles", "ChatMaddox", true); + 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("toggles", "DungeonTimer")) writeBooleanConfig("toggles", "DungeonTimer", false); + if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); // Wolf Loot @@ -243,6 +251,38 @@ public class ConfigHandler { if (!hasKey("fishing", "snowman")) writeIntConfig("fishing", "snowman", 0); if (!hasKey("fishing", "grinch")) writeIntConfig("fishing", "grinch", 0); if (!hasKey("fishing", "yeti")) writeIntConfig("fishing", "yeti", 0); + if (!hasKey("fishing", "yetiTime")) writeDoubleConfig("fishing", "yetiTime", -1); + if (!hasKey("fishing", "yetiSC")) writeIntConfig("fishing", "yetiSC", -1); + + // Dungeons + if (!hasKey("catacombs", "recombobulator")) writeIntConfig("catacombs", "recombobulator", 0); + 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); + if (!hasKey("catacombs", "spiritBoot")) writeIntConfig("catacombs", "spiritBoot", 0); + if (!hasKey("catacombs", "spiritSword")) writeIntConfig("catacombs", "spiritSword", 0); + 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"); @@ -252,8 +292,11 @@ public class ConfigHandler { if (!hasKey("locations", "coordsY")) writeIntConfig("locations", "coordsY", height - 25); if (!hasKey("locations", "displayX")) writeIntConfig("locations", "displayX", 80); if (!hasKey("locations", "displayY")) writeIntConfig("locations", "displayY", 5); + if (!hasKey("locations", "dungeonTimerX")) writeIntConfig("locations", "dungeonTimerX", 5); + if (!hasKey("locations", "dungeonTimerY")) writeIntConfig("locations", "dungeonTimerY", 5); if (!hasKey("scales", "coordsScale")) writeDoubleConfig("scales", "coordsScale", 1); if (!hasKey("scales", "displayScale")) writeDoubleConfig("scales", "displayScale", 1); + if (!hasKey("scales", "dungeonTimerScale")) writeDoubleConfig("scales", "dungeonTimerScale", 1); final ToggleCommand tf = new ToggleCommand(); tf.gpartyToggled = getBoolean("toggles", "GParty"); @@ -261,6 +304,13 @@ public class ConfigHandler { tf.goldenToggled = getBoolean("toggles", "Golden"); tf.slayerCountTotal = getBoolean("toggles", "SlayerCount"); tf.rngesusAlerts = getBoolean("toggles", "RNGesusAlerts"); + tf.splitFishing = getBoolean("toggles", "SplitFishing"); + tf.chatMaddoxToggled = getBoolean("toggles", "ChatMaddox"); + tf.spiritBearAlerts = getBoolean("toggles", "SpiritBearAlerts"); + tf.aotdToggled = getBoolean("toggles", "AOTD"); + tf.sceptreMessages = getBoolean("toggles", "SceptreMessages"); + tf.petColoursToggled = getBoolean("toggles", "PetColors"); + tf.dungeonTimerToggled = getBoolean("toggles", "DungeonTimer"); final LootCommand lc = new LootCommand(); // Wolf @@ -316,6 +366,7 @@ public class ConfigHandler { lc.seaArchers = getInt("fishing", "seaArcher"); lc.monsterOfTheDeeps = getInt("fishing", "monsterOfDeep"); lc.catfishes = getInt("fishing", "catfish"); + lc.carrotKings = getInt("fishing", "carrotKing"); lc.seaLeeches = getInt("fishing", "seaLeech"); lc.guardianDefenders = getInt("fishing", "guardianDefender"); lc.deepSeaProtectors = getInt("fishing", "deepSeaProtector"); @@ -329,6 +380,38 @@ public class ConfigHandler { lc.frostyTheSnowmans = getInt("fishing", "snowman"); lc.grinches = getInt("fishing", "grinch"); lc.yetis = getInt("fishing", "yeti"); + lc.yetiTime = getDouble("fishing", "yetiTime"); + lc.yetiSCs = getInt("fishing", "yetiSC"); + + // Dungeons + lc.recombobulators = getInt("catacombs", "recombobulator"); + 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"); + lc.spiritBoots = getInt("catacombs", "spiritBoot"); + lc.spiritSwords = getInt("catacombs", "spiritSword"); + 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"); @@ -338,10 +421,13 @@ public class ConfigHandler { moc.coordsXY[1] = getInt("locations", "coordsY"); moc.displayXY[0] = getInt("locations", "displayX"); moc.displayXY[1] = getInt("locations", "displayY"); + moc.dungeonTimerXY[0] = getInt("locations", "dungeonTimerX"); + moc.dungeonTimerXY[1] = getInt("locations", "dungeonTimerY"); final ScaleCommand sc = new ScaleCommand(); sc.coordsScale = getDouble("scales", "coordsScale"); sc.displayScale = getDouble("scales", "displayScale"); + sc.dungeonTimerScale = getDouble("scales", "dungeonTimerScale"); } } diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 4749305..67f8439 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -4,18 +4,29 @@ 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.GuiChest; 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; + 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(); EntityPlayer player = mc.thePlayer; @@ -85,4 +96,95 @@ 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; + } + + 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); + } + + 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; + } + + 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() - 222) / 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); + 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; + } + + 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]; + if (xp < xpAdded) { + return (i - 1) + (xp - (xpAdded - skillXPPerLevel[i])) / skillXPPerLevel[i]; + } + } + return 50D; + } + } |