From 0016be3161a6d33bdd8d74d1552b3f3d76c51818 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 8 Sep 2020 20:23:48 -0400 Subject: Fix /scg crashing with pet colours --- src/main/java/me/Danker/TheMod.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index ec2dedf..7a1f219 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -1649,11 +1649,12 @@ public class TheMod if (ToggleCommand.petColoursToggled && event.gui instanceof GuiChest) { GuiChest inventory = (GuiChest) event.gui; List invSlots = inventory.inventorySlots.inventorySlots; + Pattern petPattern = Pattern.compile("\\[Lvl [\\d]{1,3}]"); for (Slot slot : invSlots) { ItemStack item = slot.getStack(); if (item == null) continue; String name = item.getDisplayName(); - if (name.contains("[Lvl ")) { + if (petPattern.matcher(StringUtils.stripControlCodes(name)).find()) { 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("]"))); -- cgit From 274ebcc8062617aa3d5a59b9bec4de4484c7c01f Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 12 Sep 2020 16:49:42 -0400 Subject: Add ability to block starting other slayer quests --- README.md | 3 +- src/main/java/me/Danker/TheMod.java | 118 +++++++++++++-------- .../me/Danker/commands/BlockSlayerCommand.java | 97 +++++++++++++++++ src/main/java/me/Danker/commands/DHelpCommand.java | 1 + .../java/me/Danker/handlers/ConfigHandler.java | 9 ++ 5 files changed, 183 insertions(+), 45 deletions(-) create mode 100644 src/main/java/me/Danker/commands/BlockSlayerCommand.java (limited to 'src/main/java') diff --git a/README.md b/README.md index b125559..7276989 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Discord Server: https://discord.gg/QsEkNQS - RNGesus drop alerts (toggleable) - Click in chat to open Maddox (toggleable) - Maddox Menu keybind +- Block starting other slayer quests - Fishing tracker (with graphic display) (scalable) - Dungeons tracker (with graphic display) (scalable) - Pet background colors based on level @@ -37,6 +38,7 @@ Discord Server: https://discord.gg/QsEkNQS - /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. +- /blockslayer <1/2/3/4> - Stops you from starting a slayer quest other than the one specified. ## Keybinds - Open Maddox menu - M by default. @@ -45,5 +47,4 @@ Discord Server: https://discord.gg/QsEkNQS - 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. - API commands may take a while depending on your internet connection. The API may also go down. - If you use too many API commands too fast, you can and will get rate-limited. -- An incorrect API key will result in an HTTP error code of 403. - Importing fishing uses your sea creature kills, which may not always be exactly correct (e.x. someone else kills your sea creature). diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 7a1f219..195f348 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -18,6 +18,7 @@ import com.google.gson.JsonObject; import me.Danker.commands.ArmourCommand; import me.Danker.commands.BankCommand; +import me.Danker.commands.BlockSlayerCommand; import me.Danker.commands.ChatMaddoxCommand; import me.Danker.commands.DHelpCommand; import me.Danker.commands.DisplayCommand; @@ -47,6 +48,9 @@ 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.Container; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.util.ChatComponentText; @@ -171,6 +175,7 @@ public class TheMod ClientCommandHandler.instance.registerCommand(new ScaleCommand()); ClientCommandHandler.instance.registerCommand(new ChatMaddoxCommand()); ClientCommandHandler.instance.registerCommand(new SkyblockPlayersCommand()); + ClientCommandHandler.instance.registerCommand(new BlockSlayerCommand()); } // Update checker @@ -1596,50 +1601,75 @@ public class TheMod 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 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 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; - } - } - } + Container containerChest = ((GuiChest) event.gui).inventorySlots; + if (containerChest instanceof ContainerChest) { + // a lot of declarations here, if you get scarred, my bad + LootCommand lc = new LootCommand(); + ConfigHandler cf = new ConfigHandler(); + GuiChest chest = (GuiChest) event.gui; + IInventory inventory = ((ContainerChest) containerChest).getLowerChestInventory(); + Slot mouseSlot = chest.getSlotUnderMouse(); + if (mouseSlot == null || mouseSlot.getStack() == null) return; + ItemStack item = mouseSlot.getStack(); + String inventoryName = inventory.getDisplayName().getUnformattedText(); + + if (inventoryName.endsWith(" Chest") && item.getDisplayName().contains("Open Reward Chest")) { + List 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 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; + } + } + } if (!BlockSlayerCommand.onlySlayerName.equals("")) { + if (inventoryName.equals("Slayer")) { + if (!item.getDisplayName().contains("Revenant Horror") && !item.getDisplayName().contains("Tarantula Broodfather") && !item.getDisplayName().contains("Sven Packmaster")) return; + if (!item.getDisplayName().contains(BlockSlayerCommand.onlySlayerName)) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Danker's Skyblock Mod has stopped you from starting this quest (Set to " + BlockSlayerCommand.onlySlayerName + " " + BlockSlayerCommand.onlySlayerNumber + ")")); + Minecraft.getMinecraft().thePlayer.playSound("note.bass", 1, (float) 0.5); + event.setCanceled(true); + } + } else if (inventoryName.equals("Revenant Horror") || inventoryName.equals("Tarantula Broodfather") || inventoryName.equals("Sven Packmaster")) { + if (item.getDisplayName().contains("Revenant Horror") || item.getDisplayName().contains("Tarantula Broodfather") || item.getDisplayName().contains("Sven Packmaster")) { + // Only check number as they passed the above check + String slayerNumber = item.getDisplayName().substring(item.getDisplayName().lastIndexOf(" ") + 1, item.getDisplayName().length()); + if (!slayerNumber.equals(BlockSlayerCommand.onlySlayerNumber)) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Danker's Skyblock Mod has stopped you from starting this quest (Set to " + BlockSlayerCommand.onlySlayerName + " " + BlockSlayerCommand.onlySlayerNumber + ")")); + Minecraft.getMinecraft().thePlayer.playSound("note.bass", 1, (float) 0.5); + event.setCanceled(true); + } + } + } + } + } } } diff --git a/src/main/java/me/Danker/commands/BlockSlayerCommand.java b/src/main/java/me/Danker/commands/BlockSlayerCommand.java new file mode 100644 index 0000000..f88a334 --- /dev/null +++ b/src/main/java/me/Danker/commands/BlockSlayerCommand.java @@ -0,0 +1,97 @@ +package me.Danker.commands; + +import java.util.List; + +import me.Danker.handlers.ConfigHandler; +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.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; + +public class BlockSlayerCommand extends CommandBase { + + public static String onlySlayerName = ""; + public static String onlySlayerNumber = ""; + + @Override + public String getCommandName() { + return "blockslayer"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return "/" + getCommandName() + " <1/2/3/4>"; + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } + + @Override + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { + if (args.length == 1) { + return getListOfStringsMatchingLastWord(args, "zombie", "spider", "wolf"); + } else if (args.length == 2) { + return getListOfStringsMatchingLastWord(args, "1", "2", "3", "4"); + } + return null; + } + + @Override + public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { + final EntityPlayer player = (EntityPlayer)arg0; + final ConfigHandler cf = new ConfigHandler(); + + if (arg1.length == 0 || (arg1.length == 1 && !arg1[0].equalsIgnoreCase("off"))) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); + return; + } + + if (arg1[0].equalsIgnoreCase("zombie")) { + onlySlayerName = "Revenant Horror"; + } else if (arg1[0].equalsIgnoreCase("spider")) { + onlySlayerName = "Tarantula Broodfather"; + } else if (arg1[0].equalsIgnoreCase("wolf")) { + onlySlayerName = "Sven Packmaster"; + } else if (arg1[0].equalsIgnoreCase("off")) { + onlySlayerName = ""; + onlySlayerNumber = ""; + cf.writeStringConfig("toggles", "BlockSlayer", ""); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Slayer blocking turned off.")); + return; + } else { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); + return; + } + + int slayerNumber = Integer.parseInt(arg1[1]); + // Just manually set to roman numeral, I don't wanna put a whole converter in here + switch (slayerNumber) { + case 1: + onlySlayerNumber = "I"; + break; + case 2: + onlySlayerNumber = "II"; + break; + case 3: + onlySlayerNumber = "III"; + break; + case 4: + onlySlayerNumber = "IV"; + break; + default: + onlySlayerName = ""; + onlySlayerNumber = ""; + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); + return; + } + + cf.writeStringConfig("toggles", "BlockSlayer", onlySlayerName + " " + onlySlayerNumber); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Slayer blocking set to " + EnumChatFormatting.DARK_GREEN + onlySlayerName + " " + onlySlayerNumber)); + } + +} diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 52db06b..43f6e94 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -49,6 +49,7 @@ public class DHelpCommand extends CommandBase { 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 + " /sbplayers" + EnumChatFormatting.AQUA + " - Uses API to find how many players are on each Skyblock island.\n" + + EnumChatFormatting.GOLD + " /blockslayer <1/2/3/4>" + EnumChatFormatting.AQUA + " - Stops you from starting a slayer quest other than the one specified.\n" + EnumChatFormatting.GREEN + " Open Maddox Menu" + EnumChatFormatting.AQUA + " - M by default.\n")); } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 34aaffe..f14c4c4 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -2,6 +2,7 @@ package me.Danker.handlers; import java.io.File; +import me.Danker.commands.BlockSlayerCommand; import me.Danker.commands.DisplayCommand; import me.Danker.commands.LootCommand; import me.Danker.commands.MoveCommand; @@ -181,6 +182,7 @@ public class ConfigHandler { 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("toggles", "BlockSlayer")) writeStringConfig("toggles", "BlockSlayer", ""); if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); @@ -312,6 +314,13 @@ public class ConfigHandler { tf.petColoursToggled = getBoolean("toggles", "PetColors"); tf.dungeonTimerToggled = getBoolean("toggles", "DungeonTimer"); + final BlockSlayerCommand bs = new BlockSlayerCommand(); + String onlySlayer = getString("toggles", "BlockSlayer"); + if (!onlySlayer.equals("")) { + bs.onlySlayerName = onlySlayer.substring(0, onlySlayer.lastIndexOf(" ")); + bs.onlySlayerNumber = onlySlayer.substring(onlySlayer.lastIndexOf(" ") + 1, onlySlayer.length()); + } + final LootCommand lc = new LootCommand(); // Wolf lc.wolfSvens = getInt("wolf", "svens"); -- cgit From 0bbf2635b76352c241dcfe0f85c14e2e9a73405b Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 12 Sep 2020 22:16:26 -0400 Subject: Add amount of pets and guild members to commands --- src/main/java/me/Danker/commands/GuildOfCommand.java | 3 +++ src/main/java/me/Danker/commands/PetsCommand.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/commands/GuildOfCommand.java b/src/main/java/me/Danker/commands/GuildOfCommand.java index 238ba81..dca1974 100644 --- a/src/main/java/me/Danker/commands/GuildOfCommand.java +++ b/src/main/java/me/Danker/commands/GuildOfCommand.java @@ -83,12 +83,14 @@ public class GuildOfCommand extends CommandBase { String guildName = "N/A"; String guildMaster = "N/A"; + int players = 0; // Check if player is in guild if (!guildResponse.get("guild").isJsonNull()) { guildName = guildResponse.get("guild").getAsJsonObject().get("name").getAsString(); // Loop through members to find guildmaster JsonArray guildMembers = guildResponse.get("guild").getAsJsonObject().get("members").getAsJsonArray(); + players = guildMembers.size(); for (JsonElement member : guildMembers) { JsonObject memberObject = member.getAsJsonObject(); String memberRank = memberObject.get("rank").getAsString(); @@ -109,6 +111,7 @@ public class GuildOfCommand extends CommandBase { EnumChatFormatting.AQUA + " " + username + "'s Guild:\n" + EnumChatFormatting.GREEN + " Guild: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + guildName + "\n" + EnumChatFormatting.GREEN + " Guildmaster: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + guildMaster + "\n" + + EnumChatFormatting.GREEN + " Members: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + players + "\n" + EnumChatFormatting.AQUA + " " + EnumChatFormatting.BOLD + "-------------------")); }).start(); } diff --git a/src/main/java/me/Danker/commands/PetsCommand.java b/src/main/java/me/Danker/commands/PetsCommand.java index c697689..2ad196e 100644 --- a/src/main/java/me/Danker/commands/PetsCommand.java +++ b/src/main/java/me/Danker/commands/PetsCommand.java @@ -159,8 +159,9 @@ public class PetsCommand extends CommandBase { } } + int totalPets = commonPets.size() + uncommonPets.size() + rarePets.size() + epicPets.size() + legendaryPets.size(); String finalMessage = EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + - EnumChatFormatting.AQUA + " " + username + "'s Pets:\n"; + EnumChatFormatting.AQUA + " " + username + "'s Pets (" + totalPets + "):\n"; // Loop through pet rarities for (JsonObject legPet : legendaryPets) { -- cgit From 05a53bb80df79e399b5b5a573311059f9f467ff6 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 14 Sep 2020 18:27:29 -0400 Subject: Add shark tracker and golem alert --- src/main/java/me/Danker/TheMod.java | 91 +++++++++++++++++++++- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/DisplayCommand.java | 14 +++- src/main/java/me/Danker/commands/LootCommand.java | 37 ++++++++- .../java/me/Danker/commands/ResetLootCommand.java | 4 + .../java/me/Danker/commands/ToggleCommand.java | 16 ++-- .../java/me/Danker/handlers/ConfigHandler.java | 12 +++ 7 files changed, 161 insertions(+), 15 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 195f348..8769bd3 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -257,6 +257,12 @@ public class TheMod } } + if (tc.golemAlertToggled) { + if (message.contains("The ground begins to shake as an Endstone Protector rises from below!")) { + Utils.createTitle(EnumChatFormatting.RED + "GOLEM SPAWNING!", 3); + } + } + final LootCommand lc = new LootCommand(); final ConfigHandler cf = new ConfigHandler(); boolean wolfRNG = false; @@ -703,6 +709,55 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); } + // Fishing Festival + if (message.contains("A tiny fin emerges from the water, you've caught a Nurse Shark")) { + lc.nurseSharks++; + lc.seaCreatures++; + lc.fishingMilestone++; + lc.nurseSharksSession++; + lc.seaCreaturesSession++; + lc.fishingMilestoneSession++; + cf.writeIntConfig("fishing", "nurseShark", lc.nurseSharks); + cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); + cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); + increaseSeaCreatures(); + } + if (message.contains("You spot a fin as blue as the water it came from, it's a Blue Shark")) { + lc.blueSharks++; + lc.seaCreatures++; + lc.fishingMilestone++; + lc.blueSharksSession++; + lc.seaCreaturesSession++; + lc.fishingMilestoneSession++; + cf.writeIntConfig("fishing", "blueShark", lc.blueSharks); + cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); + cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); + increaseSeaCreatures(); + } + if (message.contains("A striped beast bounds from the depths, the wild Tiger Shark")) { + lc.tigerSharks++; + lc.seaCreatures++; + lc.fishingMilestone++; + lc.tigerSharksSession++; + lc.seaCreaturesSession++; + lc.fishingMilestoneSession++; + cf.writeIntConfig("fishing", "tigerShark", lc.tigerSharks); + cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); + cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); + increaseSeaCreatures(); + } + if (message.contains("Hide no longer, a Great White Shark has tracked your scent and thirsts for your blood")) { + lc.greatWhiteSharks++; + lc.seaCreatures++; + lc.fishingMilestone++; + lc.greatWhiteSharksSession++; + lc.seaCreaturesSession++; + lc.fishingMilestoneSession++; + cf.writeIntConfig("fishing", "greatWhiteShark", lc.greatWhiteSharks); + cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); + cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); + increaseSeaCreatures(); + } // Catacombs Dungeons // Timers @@ -1344,7 +1399,41 @@ public class TheMod EnumChatFormatting.GOLD + nf.format(lc.yetisSession) + "\n" + EnumChatFormatting.AQUA + timeBetween + "\n" + EnumChatFormatting.AQUA + bossesBetween; - } else if (ds.display.equals("catacombs_floor_one")) { + } else if (ds.display.equals("fishing_festival")) { + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Nurse Sharks:\n" + + EnumChatFormatting.BLUE + "Blue Sharks:\n" + + EnumChatFormatting.GOLD + "Tiger Sharks:\n" + + EnumChatFormatting.WHITE + "Great White Sharks:"; + countText = EnumChatFormatting.AQUA + nf.format(lc.seaCreatures) + "\n" + + EnumChatFormatting.AQUA + nf.format(lc.fishingMilestone) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.goodCatches) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.greatCatches) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + nf.format(lc.nurseSharks) + "\n" + + EnumChatFormatting.BLUE + nf.format(lc.blueSharks) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.tigerSharks) + "\n" + + EnumChatFormatting.WHITE + nf.format(lc.greatWhiteSharks); + } else if (ds.display.equals("fishing_festival_session")) { + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.AQUA + "Fishing Milestone:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Nurse Sharks:\n" + + EnumChatFormatting.BLUE + "Blue Sharks:\n" + + EnumChatFormatting.GOLD + "Tiger Sharks:\n" + + EnumChatFormatting.WHITE + "Great White Sharks:"; + countText = EnumChatFormatting.AQUA + nf.format(lc.seaCreaturesSession) + "\n" + + EnumChatFormatting.AQUA + nf.format(lc.fishingMilestoneSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.goodCatchesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.greatCatchesSession) + "\n" + + EnumChatFormatting.LIGHT_PURPLE + nf.format(lc.nurseSharksSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(lc.blueSharksSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.tigerSharksSession) + "\n" + + EnumChatFormatting.WHITE + nf.format(lc.greatWhiteSharksSession); + } 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" + diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 43f6e94..d71d1b3 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -33,7 +33,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.AQUA + " <> = Mandatory parameter. [] = Optional parameter.\n" + EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + - EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + EnumChatFormatting.GOLD + " /loot [winter/f(1-4)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index 2f7690d..b27079a 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() + " [winter/session/f(1-4)]"; + return getCommandName() + " [winter/festival/session/f(1-4)]"; } @Override @@ -34,7 +34,7 @@ public class DisplayCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing", "catacombs", "off"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "session"); } 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"))) { @@ -48,7 +48,7 @@ public class DisplayCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: [winter/session/f(1-4)]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); return; } @@ -82,6 +82,12 @@ public class DisplayCommand extends CommandBase { } else { display = "fishing_winter"; } + } else if (arg1.length > 1 && arg1[1].equalsIgnoreCase("festival")) { + if (showSession) { + display = "fishing_festival_session"; + } else { + display = "fishing_festival"; + } } else { if (showSession) { display = "fishing_session"; @@ -125,7 +131,7 @@ public class DisplayCommand extends CommandBase { } else if (arg1[0].equalsIgnoreCase("off")) { display = "off"; } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: [winter/session/f(1-4)]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); 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/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index a877a8d..e0fa0aa 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -83,6 +83,11 @@ public class LootCommand extends CommandBase { public static int yetis; public static double yetiTime; public static int yetiSCs; + // Fishing Festival + public static int nurseSharks; + public static int blueSharks; + public static int tigerSharks; + public static int greatWhiteSharks; // Catacombs Dungeons public static int recombobulators; @@ -184,6 +189,11 @@ public class LootCommand extends CommandBase { public static int yetisSession = 0; public static double yetiTimeSession = 0; public static int yetiSCsSession = 0; + // Fishing Festival + public static int nurseSharksSession = 0; + public static int blueSharksSession = 0; + public static int tigerSharksSession = 0; + public static int greatWhiteSharksSession = 0; // Catacombs Dungeons public static int recombobulatorsSession = 0; @@ -222,7 +232,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " [winter/f(1-4)/session]"; + return getCommandName() + " [winter/festival/f(1-4)/session]"; } @Override @@ -235,7 +245,7 @@ public class LootCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing", "catacombs"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "session"); } 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"))) { @@ -249,7 +259,7 @@ public class LootCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot [winter/f(1-4)/session]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); return; } @@ -507,6 +517,25 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Creatures Since Yeti: " + bossesBetween + "\n" + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); return; + } else if (arg1[1].equalsIgnoreCase("festival")) { + if (showSession) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.DARK_BLUE + EnumChatFormatting.BOLD + " Fishing Festival Summary (Current Session):\n" + + EnumChatFormatting.LIGHT_PURPLE + " Nurse Sharks: " + nf.format(nurseSharksSession) + "\n" + + EnumChatFormatting.BLUE + " Blue Sharks: " + nf.format(blueSharksSession) + "\n" + + EnumChatFormatting.GOLD + " Tiger Sharks: " + nf.format(tigerSharksSession) + "\n" + + EnumChatFormatting.WHITE + " Great White Sharks: " + nf.format(greatWhiteSharksSession) + "\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); + return; + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.DARK_BLUE + EnumChatFormatting.BOLD + " Fishing Festival Summary:\n" + + EnumChatFormatting.LIGHT_PURPLE + " Nurse Sharks: " + nf.format(nurseSharks) + "\n" + + EnumChatFormatting.BLUE + " Blue Sharks: " + nf.format(blueSharks) + "\n" + + EnumChatFormatting.GOLD + " Tiger Sharks: " + nf.format(tigerSharks) + "\n" + + EnumChatFormatting.WHITE + " Great White Sharks: " + nf.format(greatWhiteSharks) + "\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); } } @@ -689,7 +718,7 @@ public class LootCommand extends CommandBase { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot catacombs ")); } } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot [winter/f(1-4)/session]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); } } diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index dd540d6..9a5d745 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -178,6 +178,10 @@ public class ResetLootCommand extends CommandBase { lc.yetisSession = 0; lc.yetiTimeSession = -1; lc.yetiSCsSession = -1; + lc.nurseSharksSession = 0; + lc.blueSharksSession = 0; + lc.tigerSharksSession = 0; + lc.greatWhiteSharksSession = 0; cf.deleteCategory("fishing"); cf.reloadConfig(); } diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index b1e5270..373aae4 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -25,6 +25,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean sceptreMessages; public static boolean petColoursToggled; public static boolean dungeonTimerToggled; + public static boolean golemAlertToggled; @Override public String getCommandName() { @@ -33,7 +34,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " "; + return getCommandName() + " "; } @Override @@ -44,7 +45,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "petcolors", "dungeontimer", "list"); + return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "list"); } return null; } @@ -55,7 +56,7 @@ public class ToggleCommand extends CommandBase implements ICommand { final ConfigHandler cf = new ConfigHandler(); if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle ")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); return; } @@ -107,6 +108,10 @@ public class ToggleCommand extends CommandBase implements ICommand { 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("golemalerts")) { + golemAlertToggled = !golemAlertToggled; + cf.writeBooleanConfig("toggles", "GolemAlerts", golemAlertToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Golem spawn alerts has been set to " + EnumChatFormatting.DARK_GREEN + golemAlertToggled + 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" + @@ -119,9 +124,10 @@ public class ToggleCommand extends CommandBase implements ICommand { 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)); + EnumChatFormatting.GREEN + " Dungeon timer: " + EnumChatFormatting.DARK_GREEN + dungeonTimerToggled + "\n" + + EnumChatFormatting.GREEN + " Golem spawn alerts: " + EnumChatFormatting.DARK_GREEN + golemAlertToggled)); } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle ")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); } } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index f14c4c4..127f178 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -183,6 +183,7 @@ public class ConfigHandler { if (!hasKey("toggles", "PetColors")) writeBooleanConfig("toggles", "PetColors", false); if (!hasKey("toggles", "DungeonTimer")) writeBooleanConfig("toggles", "DungeonTimer", false); if (!hasKey("toggles", "BlockSlayer")) writeStringConfig("toggles", "BlockSlayer", ""); + if (!hasKey("toggles", "GolemAlerts")) writeBooleanConfig("toggles", "GolemAlerts", false); if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); @@ -255,6 +256,11 @@ public class ConfigHandler { if (!hasKey("fishing", "yeti")) writeIntConfig("fishing", "yeti", 0); if (!hasKey("fishing", "yetiTime")) writeDoubleConfig("fishing", "yetiTime", -1); if (!hasKey("fishing", "yetiSC")) writeIntConfig("fishing", "yetiSC", -1); + // Fishing Festival + if (!hasKey("fishing", "nurseShark")) writeIntConfig("fishing", "nurseShark", 0); + if (!hasKey("fishing", "blueShark")) writeIntConfig("fishing", "blueShark", 0); + if (!hasKey("fishing", "tigerShark")) writeIntConfig("fishing", "tigerShark", 0); + if (!hasKey("fishing", "greatWhiteShark")) writeIntConfig("fishing", "greatWhiteShark", 0); // Dungeons if (!hasKey("catacombs", "recombobulator")) writeIntConfig("catacombs", "recombobulator", 0); @@ -313,6 +319,7 @@ public class ConfigHandler { tf.sceptreMessages = getBoolean("toggles", "SceptreMessages"); tf.petColoursToggled = getBoolean("toggles", "PetColors"); tf.dungeonTimerToggled = getBoolean("toggles", "DungeonTimer"); + tf.golemAlertToggled = getBoolean("toggles", "GolemAlerts"); final BlockSlayerCommand bs = new BlockSlayerCommand(); String onlySlayer = getString("toggles", "BlockSlayer"); @@ -391,6 +398,11 @@ public class ConfigHandler { lc.yetis = getInt("fishing", "yeti"); lc.yetiTime = getDouble("fishing", "yetiTime"); lc.yetiSCs = getInt("fishing", "yetiSC"); + // Fishing Festival + lc.nurseSharks = getInt("fishing", "nurseShark"); + lc.blueSharks = getInt("fishing", "blueShark"); + lc.tigerSharks = getInt("fishing", "tigerShark"); + lc.greatWhiteSharks = getInt("fishing", "greatWhiteShark"); // Dungeons lc.recombobulators = getInt("catacombs", "recombobulator"); -- cgit From 3198b59936c0221b258fa6e97edaf33eed336ee7 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 14 Sep 2020 18:35:13 -0400 Subject: Add importing shark kills --- .../me/Danker/commands/ImportFishingCommand.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/commands/ImportFishingCommand.java b/src/main/java/me/Danker/commands/ImportFishingCommand.java index bbbcb9f..dc9bd9b 100644 --- a/src/main/java/me/Danker/commands/ImportFishingCommand.java +++ b/src/main/java/me/Danker/commands/ImportFishingCommand.java @@ -202,6 +202,30 @@ public class ImportFishingCommand extends CommandBase { } lc.seaCreatures += lc.yetis; + lc.nurseSharks = 0; + if (statsObject.has("kills_nurse_shark")) { + lc.nurseSharks = statsObject.get("kills_nurse_shark").getAsInt(); + } + lc.seaCreatures += lc.nurseSharks; + + lc.blueSharks = 0; + if (statsObject.has("kills_nurse_shark")) { + lc.blueSharks = statsObject.get("kills_blue_shark").getAsInt(); + } + lc.seaCreatures += lc.blueSharks; + + lc.tigerSharks = 0; + if (statsObject.has("kills_nurse_shark")) { + lc.tigerSharks = statsObject.get("kills_tiger_shark").getAsInt(); + } + lc.seaCreatures += lc.tigerSharks; + + lc.greatWhiteSharks = 0; + if (statsObject.has("kills_nurse_shark")) { + lc.greatWhiteSharks = statsObject.get("kills_great_white_shark").getAsInt(); + } + lc.seaCreatures += lc.greatWhiteSharks; + System.out.println("Writing to config..."); cf.writeIntConfig("fishing", "goodCatch", lc.goodCatches); cf.writeIntConfig("fishing", "greatCatch", lc.greatCatches); @@ -225,6 +249,10 @@ public class ImportFishingCommand extends CommandBase { cf.writeIntConfig("fishing", "snowman", lc.frostyTheSnowmans); cf.writeIntConfig("fishing", "grinch", lc.grinches); cf.writeIntConfig("fishing", "yeti", lc.yetis); + cf.writeIntConfig("fishing", "nurseShark", lc.nurseSharks); + cf.writeIntConfig("fishing", "blueShark", lc.blueSharks); + cf.writeIntConfig("fishing", "tigerShark", lc.tigerSharks); + cf.writeIntConfig("fishing", "greatWhiteShark", lc.greatWhiteSharks); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Fishing stats imported.")); }).start(); -- cgit From 1e82de1cfd719c72f4c0c6ffc541fe6da5fad8ab Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 14 Sep 2020 22:57:57 -0400 Subject: Add expertise kills in fishing rod lore --- README.md | 1 + src/main/java/me/Danker/TheMod.java | 21 +++++++++++++++++++++ src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- src/main/java/me/Danker/commands/ToggleCommand.java | 12 +++++++++--- src/main/java/me/Danker/handlers/ConfigHandler.java | 2 ++ src/main/java/me/Danker/utils/Utils.java | 10 ++++++++++ 6 files changed, 44 insertions(+), 4 deletions(-) (limited to 'src/main/java') diff --git a/README.md b/README.md index 7276989..2bc167f 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Discord Server: https://discord.gg/QsEkNQS - Maddox Menu keybind - Block starting other slayer quests - Fishing tracker (with graphic display) (scalable) +- Expertise kills in fishing rod lore - Dungeons tracker (with graphic display) (scalable) - Pet background colors based on level - API commands diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 8769bd3..925b5df 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -53,6 +53,7 @@ import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; @@ -1636,11 +1637,31 @@ public class TheMod final ToggleCommand tc = new ToggleCommand(); if (event.toolTip == null) return; + + ItemStack item = event.itemStack; if (tc.goldenToggled) { for (int i = 0; i < event.toolTip.size(); i++) { event.toolTip.set(i, Utils.returnGoldenEnchants(event.toolTip.get(i))); } } + + if (tc.expertiseLoreToggled) { + if (item.hasTagCompound()) { + NBTTagCompound tags = item.getSubCompound("ExtraAttributes", false); + if (tags != null) { + if (tags.hasKey("expertise_kills")) { + int index = 4; + if (!Minecraft.getMinecraft().gameSettings.advancedItemTooltips) index -= 2; + + event.toolTip.add(event.toolTip.size() - index, ""); + event.toolTip.add(event.toolTip.size() - index, "Expertise Kills: " + EnumChatFormatting.RED + tags.getInteger("expertise_kills")); + if (Utils.expertiseKillsLeft(tags.getInteger("expertise_kills")) != -1) { + event.toolTip.add(event.toolTip.size() - index, Utils.expertiseKillsLeft(tags.getInteger("expertise_kills")) + " kills to tier up!"); + } + } + } + } + } } @SubscribeEvent diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index d71d1b3..0db8749 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -33,7 +33,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.AQUA + " <> = Mandatory parameter. [] = Optional parameter.\n" + EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + - EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + EnumChatFormatting.GOLD + " /loot [winter/f(1-4)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 373aae4..c766165 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -26,6 +26,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean petColoursToggled; public static boolean dungeonTimerToggled; public static boolean golemAlertToggled; + public static boolean expertiseLoreToggled; @Override public String getCommandName() { @@ -34,7 +35,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " "; + return getCommandName() + " "; } @Override @@ -45,7 +46,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "list"); + return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "list"); } return null; } @@ -112,6 +113,10 @@ public class ToggleCommand extends CommandBase implements ICommand { golemAlertToggled = !golemAlertToggled; cf.writeBooleanConfig("toggles", "GolemAlerts", golemAlertToggled); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Golem spawn alerts has been set to " + EnumChatFormatting.DARK_GREEN + golemAlertToggled + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("expertiselore")) { + expertiseLoreToggled = !expertiseLoreToggled; + cf.writeBooleanConfig("toggles", "ExpertiseLore", expertiseLoreToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Expertise in lore has been set to " + EnumChatFormatting.DARK_GREEN + expertiseLoreToggled + 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" + @@ -125,7 +130,8 @@ public class ToggleCommand extends CommandBase implements ICommand { 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 + "\n" + - EnumChatFormatting.GREEN + " Golem spawn alerts: " + EnumChatFormatting.DARK_GREEN + golemAlertToggled)); + EnumChatFormatting.GREEN + " Golem spawn alerts: " + EnumChatFormatting.DARK_GREEN + golemAlertToggled + "\n" + + EnumChatFormatting.GREEN + " Expertise in lore: " + EnumChatFormatting.DARK_GREEN + expertiseLoreToggled)); } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 127f178..3c38de6 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -184,6 +184,7 @@ public class ConfigHandler { if (!hasKey("toggles", "DungeonTimer")) writeBooleanConfig("toggles", "DungeonTimer", false); if (!hasKey("toggles", "BlockSlayer")) writeStringConfig("toggles", "BlockSlayer", ""); if (!hasKey("toggles", "GolemAlerts")) writeBooleanConfig("toggles", "GolemAlerts", false); + if (!hasKey("toggles", "ExpertiseLore")) writeBooleanConfig("toggles", "ExpertiseLore", true); if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); @@ -320,6 +321,7 @@ public class ConfigHandler { tf.petColoursToggled = getBoolean("toggles", "PetColors"); tf.dungeonTimerToggled = getBoolean("toggles", "DungeonTimer"); tf.golemAlertToggled = getBoolean("toggles", "GolemAlerts"); + tf.expertiseLoreToggled = getBoolean("toggles", "ExpertiseLore"); final BlockSlayerCommand bs = new BlockSlayerCommand(); String onlySlayer = getString("toggles", "BlockSlayer"); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 67f8439..3c213a9 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -26,6 +26,7 @@ public class Utils { 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}; + static int[] expertiseKills = {50, 100, 250, 500, 1000, 2500, 5500, 10000, 15000}; public static int getItems(String item) { Minecraft mc = Minecraft.getMinecraft(); @@ -187,4 +188,13 @@ public class Utils { return 50D; } + public static int expertiseKillsLeft(int kills) { + for (int i = 0; i < expertiseKills.length; i++) { + if (kills < expertiseKills[i]) { + return expertiseKills[i] - kills; + } + } + return -1; + } + } -- cgit From 510a100010ddd3eb9f1dad2da99f57ce96416e6d Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 18 Sep 2020 16:53:03 -0400 Subject: Add incomplete F5 tracker --- src/main/java/me/Danker/TheMod.java | 95 +++++++++++++++++++--- src/main/java/me/Danker/commands/DHelpCommand.java | 4 +- .../java/me/Danker/commands/DisplayCommand.java | 12 ++- src/main/java/me/Danker/commands/LootCommand.java | 50 +++++++++++- .../java/me/Danker/commands/ResetLootCommand.java | 7 ++ .../java/me/Danker/handlers/ConfigHandler.java | 16 ++++ 6 files changed, 166 insertions(+), 18 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 925b5df..953956a 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -235,7 +235,7 @@ public class TheMod 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")) { + if (message.contains("PUZZLE FAIL! ") || message.contains("chose the wrong answer! I shall never forget this moment")) { dungeonDeaths++; } @@ -808,10 +808,15 @@ public class TheMod lc.f4TimeSpent = Math.floor(lc.f4TimeSpent + timeToAdd); lc.f4TimeSpentSession = Math.floor(lc.f4TimeSpentSession + timeToAdd); cf.writeDoubleConfig("catacombs", "floorFourTime", lc.f4TimeSpent); + } else if (sCleaned.contains("F5")) { + lc.f5TimeSpent = Math.floor(lc.f5TimeSpent + timeToAdd); + lc.f5TimeSpentSession = Math.floor(lc.f5TimeSpentSession + timeToAdd); + cf.writeDoubleConfig("catacombs", "floorFiveTime", lc.f5TimeSpent); } } else if (sCleaned.contains("Time Elapsed:")) { // Get floor time String time = sCleaned.substring(sCleaned.indexOf(":") + 2); + time = time.replaceAll("\\s", ""); 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; @@ -907,6 +912,32 @@ public class TheMod lc.spiritBowsSession++; cf.writeIntConfig("catacombs", "spiritBow", lc.spiritBows); } + // F5 + if (message.contains(" Warped Stone")) { + lc.warpedStones++; + lc.warpedStonesSession++; + cf.writeIntConfig("catacombs", "warpedStone", lc.warpedStones); + } + if (message.contains(" Shadow Assassin Helmet")) { + lc.shadowAssHelms++; + lc.shadowAssHelmsSession++; + cf.writeIntConfig("catacombs", "shadowAssassinHelm", lc.shadowAssHelms); + } + if (message.contains(" Shadow Assassin Chestplate")) { + lc.shadowAssChests++; + lc.shadowAssChestsSession++; + cf.writeIntConfig("catacombs", "shadowAssassinChest", lc.shadowAssChests); + } + if (message.contains(" Shadow Assassin Leggings")) { + lc.shadowAssLegs++; + lc.shadowAssLegsSession++; + cf.writeIntConfig("catacombs", "shadowAssassinLegging", lc.shadowAssLegs); + } + if (message.contains(" Shadow Assassin Boots")) { + lc.shadowAssBoots++; + lc.shadowAssBootsSession++; + cf.writeIntConfig("catacombs", "shadowAssassinBoot", lc.shadowAssBoots); + } // Chat Maddox if (message.contains("[OPEN MENU]")) { @@ -1439,7 +1470,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + EnumChatFormatting.BLUE + "Bonzo's Staffs:\n" + EnumChatFormatting.AQUA + "Coins Spent:\n" + - EnumChatFormatting.AQUA + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Time Spent:"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooks) + "\n" + EnumChatFormatting.BLUE + nf.format(lc.bonzoStaffs) + "\n" + @@ -1450,7 +1481,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + EnumChatFormatting.BLUE + "Bonzo's Staffs:\n" + EnumChatFormatting.AQUA + "Coins Spent:\n" + - EnumChatFormatting.AQUA + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Time Spent:"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooksSession) + "\n" + EnumChatFormatting.BLUE + nf.format(lc.bonzoStaffsSession) + "\n" + @@ -1461,7 +1492,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + EnumChatFormatting.BLUE + "Scarf's Studies:\n" + EnumChatFormatting.AQUA + "Coins Spent:\n" + - EnumChatFormatting.AQUA + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Time Spent:"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooks) + "\n" + EnumChatFormatting.BLUE + nf.format(lc.scarfStudies) + "\n" + @@ -1472,7 +1503,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + EnumChatFormatting.BLUE + "Scarf's Studies:\n" + EnumChatFormatting.AQUA + "Coins Spent:\n" + - EnumChatFormatting.AQUA + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Time Spent:"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooksSession) + "\n" + EnumChatFormatting.BLUE + nf.format(lc.scarfStudiesSession) + "\n" + @@ -1487,7 +1518,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Adaptive Boots:\n" + EnumChatFormatting.DARK_PURPLE + "Adaptive Blades:\n" + EnumChatFormatting.AQUA + "Coins Spent:\n" + - EnumChatFormatting.AQUA + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Time Spent:"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooks) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveHelms) + "\n" + @@ -1506,7 +1537,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Adaptive Boots:\n" + EnumChatFormatting.DARK_PURPLE + "Adaptive Blades:\n" + EnumChatFormatting.AQUA + "Coins Spent:\n" + - EnumChatFormatting.AQUA + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Time Spent:"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooksSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.adaptiveHelmsSession) + "\n" + @@ -1527,7 +1558,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Epic Spirit Pets:\n" + EnumChatFormatting.GOLD + "Leg Spirit Pets:\n" + EnumChatFormatting.AQUA + "Coins Spent:\n" + - EnumChatFormatting.AQUA + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Time Spent:"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooks) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.spiritWings) + "\n" + @@ -1550,7 +1581,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Epic Spirit Pets:\n" + EnumChatFormatting.GOLD + "Leg Spirit Pets:\n" + EnumChatFormatting.AQUA + "Coins Spent:\n" + - EnumChatFormatting.AQUA + "Time Spent:\n"; + EnumChatFormatting.AQUA + "Time Spent:"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooksSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.spiritWingsSession) + "\n" + @@ -1562,6 +1593,44 @@ public class TheMod EnumChatFormatting.GOLD + nf.format(lc.legSpiritPetsSession) + "\n" + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f4CoinsSpentSession) + "\n" + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f4TimeSpentSession); + } else if (ds.display.equals("catacombs_floor_five")) { + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.BLUE + "Warped Stones:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Helmets:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Chestplates:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Leggings:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Boots:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooks) + "\n" + + EnumChatFormatting.BLUE + nf.format(lc.warpedStones) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssHelms) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssChests) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssLegs) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssBoots) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f5CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f5TimeSpent); + } else if (ds.display.equals("catacombs_floor_five_session")) { + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.BLUE + "Warped Stones:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Helmets:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Chestplates:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Leggings:\n" + + EnumChatFormatting.DARK_PURPLE + "Shadow Boots:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(lc.warpedStonesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssHelmsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssChestsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssLegsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssBootsSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f5CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f5TimeSpentSession); } else { ConfigHandler cf = new ConfigHandler(); @@ -1752,6 +1821,10 @@ public class TheMod lc.f4CoinsSpent += coinsSpent; lc.f4CoinsSpentSession += coinsSpent; cf.writeDoubleConfig("catacombs", "floorFourCoins", lc.f4CoinsSpent); + } else if (sCleaned.contains("F5")) { + lc.f5CoinsSpent += coinsSpent; + lc.f5CoinsSpentSession += coinsSpent; + cf.writeDoubleConfig("catacombs", "floorFiveCoins", lc.f5CoinsSpent); } break; } @@ -1759,7 +1832,9 @@ public class TheMod break; } } - } if (!BlockSlayerCommand.onlySlayerName.equals("")) { + } + + if (!BlockSlayerCommand.onlySlayerName.equals("")) { if (inventoryName.equals("Slayer")) { if (!item.getDisplayName().contains("Revenant Horror") && !item.getDisplayName().contains("Tarantula Broodfather") && !item.getDisplayName().contains("Sven Packmaster")) return; if (!item.getDisplayName().contains(BlockSlayerCommand.onlySlayerName)) { diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 0db8749..e76b160 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -36,8 +36,8 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + - EnumChatFormatting.GOLD + " /loot [winter/f(1-4)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + - EnumChatFormatting.GOLD + " /display [winter/f(1-4)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead.\n" + + EnumChatFormatting.GOLD + " /loot [winter/f(1-5)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + + EnumChatFormatting.GOLD + " /display [winter/f(1-5)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead.\n" + EnumChatFormatting.GOLD + " /resetloot " + EnumChatFormatting.AQUA + " - Resets loot for trackers. /resetloot confirm confirms the reset.\n" + EnumChatFormatting.GOLD + " /move " + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + EnumChatFormatting.GOLD + " /scale " + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index b27079a..b571e1f 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() + " [winter/festival/session/f(1-4)]"; + return getCommandName() + " [winter/festival/session/f(1-5)]"; } @Override @@ -36,7 +36,7 @@ public class DisplayCommand extends CommandBase { } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { return getListOfStringsMatchingLastWord(args, "winter", "festival", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { - return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4"); + return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5"); } else if (args.length > 1 || (args.length == 3 && args[0].equalsIgnoreCase("fishing") && args[1].equalsIgnoreCase("winter"))) { return getListOfStringsMatchingLastWord(args, "session"); } @@ -124,8 +124,14 @@ public class DisplayCommand extends CommandBase { } else { display = "catacombs_floor_four"; } + } else if (arg1[1].equalsIgnoreCase("f5") || arg1[1].equalsIgnoreCase("floor5")) { + if (showSession) { + display = "catacombs_floor_five_session"; + } else { + display = "catacombs_floor_five"; + } } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display catacombs ")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display catacombs ")); return; } } else if (arg1[0].equalsIgnoreCase("off")) { diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index e0fa0aa..a66db01 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -118,6 +118,14 @@ public class LootCommand extends CommandBase { public static int legSpiritPets; public static double f4CoinsSpent; public static double f4TimeSpent; + // F5 + public static int warpedStones; + public static int shadowAssHelms; + public static int shadowAssChests; + public static int shadowAssLegs; + public static int shadowAssBoots; + public static double f5CoinsSpent; + public static double f5TimeSpent; // Single sessions (No config saves) // Wolf @@ -224,6 +232,14 @@ public class LootCommand extends CommandBase { public static int legSpiritPetsSession = 0; public static double f4CoinsSpentSession = 0; public static double f4TimeSpentSession = 0; + // F5 + public static int warpedStonesSession = 0; + public static int shadowAssHelmsSession = 0; + public static int shadowAssChestsSession = 0; + public static int shadowAssLegsSession = 0; + public static int shadowAssBootsSession = 0; + public static double f5CoinsSpentSession = 0; + public static double f5TimeSpentSession = 0; @Override public String getCommandName() { @@ -232,7 +248,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " [winter/festival/f(1-4)/session]"; + return getCommandName() + " [winter/festival/f(1-5)/session]"; } @Override @@ -247,7 +263,7 @@ public class LootCommand extends CommandBase { } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { return getListOfStringsMatchingLastWord(args, "winter", "festival", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { - return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4"); + return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5"); } else if (args.length > 1 || (args.length == 3 && args[0].equalsIgnoreCase("fishing") && args[1].equalsIgnoreCase("winter"))) { return getListOfStringsMatchingLastWord(args, "session"); } @@ -714,8 +730,36 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f4CoinsSpent) + "\n" + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f4TimeSpent) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); + } else if (arg1[1].equalsIgnoreCase("f5") || arg1[1].equalsIgnoreCase("floor5")) { + if (showSession) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Catacombs F5 Summary (Current Session):\n" + + EnumChatFormatting.GOLD + " Recombobulator 3000s: " + nf.format(recombobulatorsSession) + "\n" + + EnumChatFormatting.BLUE + " Warped Stones: " + nf.format(warpedStonesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Fuming Potato Books: " + nf.format(fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Helmets: " + nf.format(shadowAssHelmsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Chests: " + nf.format(shadowAssChestsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Legs: " + nf.format(shadowAssLegsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Boots: " + nf.format(shadowAssBootsSession) + "\n" + + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f5CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f5TimeSpentSession) + "\n" + + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); + return; + } + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Catacombs F5 Summary:\n" + + EnumChatFormatting.GOLD + " Recombobulator 3000s: " + nf.format(recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Fuming Potato Books: " + nf.format(fumingPotatoBooks) + "\n" + + EnumChatFormatting.BLUE + " Warped Stones: " + nf.format(warpedStones) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Helmets: " + nf.format(shadowAssHelms) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Chests: " + nf.format(shadowAssChests) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Legs: " + nf.format(shadowAssLegs) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Boots: " + nf.format(shadowAssBoots) + "\n" + + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f5CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f5TimeSpent) + "\n" + + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot catacombs ")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot catacombs ")); } } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index 9a5d745..a6da64d 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -211,6 +211,13 @@ public class ResetLootCommand extends CommandBase { lc.epicSpiritPetsSession = 0; lc.f4CoinsSpentSession = 0; lc.f4TimeSpentSession = 0; + lc.warpedStonesSession = 0; + lc.shadowAssHelmsSession = 0; + lc.shadowAssChestsSession = 0; + lc.shadowAssLegsSession = 0; + lc.shadowAssBootsSession = 0; + lc.f5CoinsSpentSession = 0; + lc.f5TimeSpentSession = 0; cf.deleteCategory("catacombs"); cf.reloadConfig(); } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 3c38de6..0f730e2 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -292,6 +292,14 @@ public class ConfigHandler { if (!hasKey("catacombs", "spiritPetLeg")) writeIntConfig("catacombs", "spiritPetLeg", 0); if (!hasKey("catacombs", "floorFourCoins")) writeDoubleConfig("catacombs", "floorFourCoins", 0); if (!hasKey("catacombs", "floorFourTime")) writeDoubleConfig("catacombs", "floorFourTime", 0); + // F5 + if (!hasKey("catacombs", "warpedStone")) writeIntConfig("catacombs", "warpedStone", 0); + if (!hasKey("catacombs", "shadowAssassinHelm")) writeIntConfig("catacombs", "shadowAssassinHelm", 0); + if (!hasKey("catacombs", "shadowAssassinChest")) writeIntConfig("catacombs", "shadowAssassinChest", 0); + if (!hasKey("catacombs", "shadowAssassinLegging")) writeIntConfig("catacombs", "shadowAssassinLegging", 0); + if (!hasKey("catacombs", "shadowAssassinBoot")) writeIntConfig("catacombs", "shadowAssassinBoot", 0); + if (!hasKey("catacombs", "floorFiveCoins")) writeDoubleConfig("catacombs", "floorFiveCoins", 0); + if (!hasKey("catacombs", "floorFiveTime")) writeDoubleConfig("catacombs", "floorFiveTime", 0); if (!hasKey("misc", "display")) writeStringConfig("misc", "display", "off"); @@ -435,6 +443,14 @@ public class ConfigHandler { lc.legSpiritPets = getInt("catacombs", "spiritPetLeg"); lc.f4CoinsSpent = getDouble("catacombs", "floorFourCoins"); lc.f4TimeSpent = getDouble("catacombs", "floorFourTime"); + // F5 + lc.warpedStones = getInt("catacombs", "warpedStone"); + lc.shadowAssHelms = getInt("catacombs", "shadowAssassinHelm"); + lc.shadowAssChests = getInt("catacombs", "shadowAssassinChest"); + lc.shadowAssLegs = getInt("catacombs", "shadowAssassinLegging"); + lc.shadowAssBoots = getInt("catacombs", "shadowAssassinBoot"); + lc.f5CoinsSpent = getDouble("catacombs", "floorFiveCoins"); + lc.f5TimeSpent = getDouble("catacombs", "floorFiveTime"); final DisplayCommand ds = new DisplayCommand(); ds.display = getString("misc", "display"); -- cgit From 5d39b54edd055d8e0293294bb2e174d4035a7b6f Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sun, 20 Sep 2020 16:36:36 -0400 Subject: Add Livid Daggers to F5 tracker --- src/main/java/me/Danker/TheMod.java | 9 +++++++++ src/main/java/me/Danker/commands/LootCommand.java | 4 ++++ src/main/java/me/Danker/commands/ResetLootCommand.java | 1 + src/main/java/me/Danker/handlers/ConfigHandler.java | 2 ++ 4 files changed, 16 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 953956a..fc38e6f 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -938,6 +938,11 @@ public class TheMod lc.shadowAssBootsSession++; cf.writeIntConfig("catacombs", "shadowAssassinBoot", lc.shadowAssBoots); } + if (message.contains(" Livid Dagger")) { + lc.lividDaggers++; + lc.lividDaggersSession++; + cf.writeIntConfig("catacombs", "lividDagger", lc.lividDaggers); + } // Chat Maddox if (message.contains("[OPEN MENU]")) { @@ -1601,6 +1606,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Shadow Chestplates:\n" + EnumChatFormatting.DARK_PURPLE + "Shadow Leggings:\n" + EnumChatFormatting.DARK_PURPLE + "Shadow Boots:\n" + + EnumChatFormatting.GOLD + "Livid Daggers:\n" + EnumChatFormatting.AQUA + "Coins Spent:\n" + EnumChatFormatting.AQUA + "Time Spent:"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + @@ -1610,6 +1616,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssChests) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssLegs) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssBoots) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.lividDaggers) + "\n" + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f5CoinsSpent) + "\n" + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f5TimeSpent); } else if (ds.display.equals("catacombs_floor_five_session")) { @@ -1620,6 +1627,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Shadow Chestplates:\n" + EnumChatFormatting.DARK_PURPLE + "Shadow Leggings:\n" + EnumChatFormatting.DARK_PURPLE + "Shadow Boots:\n" + + EnumChatFormatting.GOLD + "Livid Daggers:\n" + EnumChatFormatting.AQUA + "Coins Spent:\n" + EnumChatFormatting.AQUA + "Time Spent:"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + @@ -1629,6 +1637,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssChestsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssLegsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssBootsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.lividDaggersSession) + "\n" + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f5CoinsSpentSession) + "\n" + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f5TimeSpentSession); } else { diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index a66db01..c63779e 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -124,6 +124,7 @@ public class LootCommand extends CommandBase { public static int shadowAssChests; public static int shadowAssLegs; public static int shadowAssBoots; + public static int lividDaggers; public static double f5CoinsSpent; public static double f5TimeSpent; @@ -238,6 +239,7 @@ public class LootCommand extends CommandBase { public static int shadowAssChestsSession = 0; public static int shadowAssLegsSession = 0; public static int shadowAssBootsSession = 0; + public static int lividDaggersSession = 0; public static double f5CoinsSpentSession = 0; public static double f5TimeSpentSession = 0; @@ -741,6 +743,7 @@ public class LootCommand extends CommandBase { EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Chests: " + nf.format(shadowAssChestsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Legs: " + nf.format(shadowAssLegsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Boots: " + nf.format(shadowAssBootsSession) + "\n" + + EnumChatFormatting.GOLD + " Livid Daggers: " + nf.format(lividDaggersSession) + "\n" + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f5CoinsSpentSession) + "\n" + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f5TimeSpentSession) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); @@ -755,6 +758,7 @@ public class LootCommand extends CommandBase { EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Chests: " + nf.format(shadowAssChests) + "\n" + EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Legs: " + nf.format(shadowAssLegs) + "\n" + EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Boots: " + nf.format(shadowAssBoots) + "\n" + + EnumChatFormatting.GOLD + " Livid Daggers: " + nf.format(lividDaggers) + "\n" + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f5CoinsSpent) + "\n" + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f5TimeSpent) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index a6da64d..844ec0a 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -216,6 +216,7 @@ public class ResetLootCommand extends CommandBase { lc.shadowAssChestsSession = 0; lc.shadowAssLegsSession = 0; lc.shadowAssBootsSession = 0; + lc.lividDaggersSession = 0; lc.f5CoinsSpentSession = 0; lc.f5TimeSpentSession = 0; cf.deleteCategory("catacombs"); diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 0f730e2..e58d092 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -298,6 +298,7 @@ public class ConfigHandler { if (!hasKey("catacombs", "shadowAssassinChest")) writeIntConfig("catacombs", "shadowAssassinChest", 0); if (!hasKey("catacombs", "shadowAssassinLegging")) writeIntConfig("catacombs", "shadowAssassinLegging", 0); if (!hasKey("catacombs", "shadowAssassinBoot")) writeIntConfig("catacombs", "shadowAssassinBoot", 0); + if (!hasKey("catacombs", "lividDagger")) writeIntConfig("catacombs", "lividDagger", 0); if (!hasKey("catacombs", "floorFiveCoins")) writeDoubleConfig("catacombs", "floorFiveCoins", 0); if (!hasKey("catacombs", "floorFiveTime")) writeDoubleConfig("catacombs", "floorFiveTime", 0); @@ -449,6 +450,7 @@ public class ConfigHandler { lc.shadowAssChests = getInt("catacombs", "shadowAssassinChest"); lc.shadowAssLegs = getInt("catacombs", "shadowAssassinLegging"); lc.shadowAssBoots = getInt("catacombs", "shadowAssassinBoot"); + lc.lividDaggers = getInt("catacombs", "lividDagger"); lc.f5CoinsSpent = getDouble("catacombs", "floorFiveCoins"); lc.f5TimeSpent = getDouble("catacombs", "floorFiveTime"); -- cgit From bedf3448667d59e4ba0f54b6ddb77461793e9349 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 22 Sep 2020 15:57:30 -0400 Subject: Add /dungeons command --- README.md | 8 +- src/main/java/me/Danker/TheMod.java | 2 + src/main/java/me/Danker/commands/DHelpCommand.java | 1 + .../java/me/Danker/commands/DungeonsCommand.java | 110 +++++++++++++++++++++ src/main/java/me/Danker/utils/Utils.java | 21 +++- 5 files changed, 136 insertions(+), 6 deletions(-) create mode 100644 src/main/java/me/Danker/commands/DungeonsCommand.java (limited to 'src/main/java') diff --git a/README.md b/README.md index 2bc167f..0e9a478 100644 --- a/README.md +++ b/README.md @@ -18,16 +18,17 @@ Discord Server: https://discord.gg/QsEkNQS - Expertise kills in fishing rod lore - Dungeons tracker (with graphic display) (scalable) - Pet background colors based on level +- Golem spawning alerts (toggleable) - API commands - Update checker ## Commands - /dhelp - Returns this message in-game. -- /toggle - Toggles features. /toggle list returns values of every toggle. +- /toggle - Toggles features. /toggle list returns values of every toggle. - /setkey - Sets API key. - /getkey - Returns key set with /setkey and copies it to your clipboard. -- /loot [winter/f(1-4)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. -- /display [winter/f(1-4)/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. +- /loot [winter/f(1-5)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. +- /display [winter/f(1-5)/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. - /resetloot - - Resets loot for trackers. /resetloot confirm confirms the reset. - /move - Moves text display to specified X and Y coordinates. - /scale - Scales text display to a specified multipler between 0.1x and 10x. @@ -37,6 +38,7 @@ Discord Server: https://discord.gg/QsEkNQS - /petsof [player] - Uses API to get pets of a person. If no name is provided, it checks yours. - /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. +- /dungeons [player] - Uses API to get dungeon levels 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. - /blockslayer <1/2/3/4> - Stops you from starting a slayer quest other than the one specified. diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index fc38e6f..b26fc86 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -22,6 +22,7 @@ import me.Danker.commands.BlockSlayerCommand; import me.Danker.commands.ChatMaddoxCommand; import me.Danker.commands.DHelpCommand; import me.Danker.commands.DisplayCommand; +import me.Danker.commands.DungeonsCommand; import me.Danker.commands.GetkeyCommand; import me.Danker.commands.GuildOfCommand; import me.Danker.commands.ImportFishingCommand; @@ -177,6 +178,7 @@ public class TheMod ClientCommandHandler.instance.registerCommand(new ChatMaddoxCommand()); ClientCommandHandler.instance.registerCommand(new SkyblockPlayersCommand()); ClientCommandHandler.instance.registerCommand(new BlockSlayerCommand()); + ClientCommandHandler.instance.registerCommand(new DungeonsCommand()); } // Update checker diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index e76b160..d76481f 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -47,6 +47,7 @@ public class DHelpCommand extends CommandBase { 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 + " /dungeons [player] " + EnumChatFormatting.AQUA + " - Uses API to get dungeon levels 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 + " /sbplayers" + EnumChatFormatting.AQUA + " - Uses API to find how many players are on each Skyblock island.\n" + EnumChatFormatting.GOLD + " /blockslayer <1/2/3/4>" + EnumChatFormatting.AQUA + " - Stops you from starting a slayer quest other than the one specified.\n" + diff --git a/src/main/java/me/Danker/commands/DungeonsCommand.java b/src/main/java/me/Danker/commands/DungeonsCommand.java new file mode 100644 index 0000000..251cf3d --- /dev/null +++ b/src/main/java/me/Danker/commands/DungeonsCommand.java @@ -0,0 +1,110 @@ +package me.Danker.commands; + +import java.util.List; + +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.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; + +public class DungeonsCommand extends CommandBase { + + @Override + public String getCommandName() { + return "dungeons"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return "/" + getCommandName() + " [name]"; + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } + + @Override + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { + if (args.length == 1) { + return Utils.getMatchingPlayers(args[0]); + } + return null; + } + + @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.")); + } + + // Get UUID for Hypixel API requests + String username; + String uuid; + if (arg1.length == 0) { + username = player.getName(); + uuid = player.getUniqueID().toString().replaceAll("[\\-]", ""); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking dungeon stats of " + EnumChatFormatting.DARK_GREEN + username)); + } else { + username = arg1[0]; + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking dungeon stats of " + EnumChatFormatting.DARK_GREEN + username)); + uuid = ah.getUUID(username); + } + + // Find stats of latest profile + String latestProfile = ah.getLatestProfileID(uuid, key); + if (latestProfile == null) return; + + String profileURL = "https://api.hypixel.net/skyblock/profile?profile=" + latestProfile + "&key=" + key; + System.out.println("Fetching profile..."); + JsonObject profileResponse = ah.getResponse(profileURL); + if (!profileResponse.get("success").getAsBoolean()) { + String reason = profileResponse.get("cause").getAsString(); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: " + reason)); + return; + } + + System.out.println("Fetching dungeon stats..."); + JsonObject dungeonsObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("dungeons").getAsJsonObject(); + if (!dungeonsObject.get("dungeon_types").getAsJsonObject().get("catacombs").getAsJsonObject().has("experience")) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "This player has not played dungeons.")); + return; + } + + double catacombs = Utils.xpToDungeonsLevel(dungeonsObject.get("dungeon_types").getAsJsonObject().get("catacombs").getAsJsonObject().get("experience").getAsDouble()); + double healer = Utils.xpToDungeonsLevel(dungeonsObject.get("player_classes").getAsJsonObject().get("healer").getAsJsonObject().get("experience").getAsDouble()); + double mage = Utils.xpToDungeonsLevel(dungeonsObject.get("player_classes").getAsJsonObject().get("mage").getAsJsonObject().get("experience").getAsDouble()); + double berserk = Utils.xpToDungeonsLevel(dungeonsObject.get("player_classes").getAsJsonObject().get("berserk").getAsJsonObject().get("experience").getAsDouble()); + double archer = Utils.xpToDungeonsLevel(dungeonsObject.get("player_classes").getAsJsonObject().get("archer").getAsJsonObject().get("experience").getAsDouble()); + double tank = Utils.xpToDungeonsLevel(dungeonsObject.get("player_classes").getAsJsonObject().get("tank").getAsJsonObject().get("experience").getAsDouble()); + String selectedClass = Utils.capitalizeString(dungeonsObject.get("selected_dungeon_class").getAsString()); + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + " Catacombs Level: " + catacombs + "\n" + + EnumChatFormatting.GOLD + " Selected Class: " + selectedClass + "\n\n" + + EnumChatFormatting.YELLOW + " Healer Level: " + healer + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Mage Level: " + mage + "\n" + + EnumChatFormatting.RED + " Berserk Level: " + berserk + "\n" + + EnumChatFormatting.GREEN + " Archer Level: " + archer + "\n" + + EnumChatFormatting.BLUE + " Tank Level: " + tank + "\n" + + EnumChatFormatting.AQUA + " " + EnumChatFormatting.BOLD + "-------------------")); + }).start(); + } + +} diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 3c213a9..d7aa112 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -23,9 +23,13 @@ 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}; + 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}; + static int[] dungeonsXPPerLevel = {0, 50, 75, 110, 160, 230, 330, 470, 670, 950, 1340, 1890, 2665, 3760, 5260, 7380, 10300, 14400, + 20000, 27600, 38000, 52500, 71500, 97000, 132000, 180000, 243000, 328000, 445000, 600000, 800000, + 1065000, 1410000, 1900000, 2500000, 3300000, 4300000, 5600000, 7200000, 9200000, 12000000, 15000000, + 19000000, 24000000, 30000000, 38000000, 48000000, 60000000, 75000000, 93000000, 116250000}; static int[] expertiseKills = {50, 100, 250, 500, 1000, 2500, 5500, 10000, 15000}; public static int getItems(String item) { @@ -188,6 +192,17 @@ public class Utils { return 50D; } + public static double xpToDungeonsLevel(double xp) { + for (int i = 0, xpAdded = 0; i < dungeonsXPPerLevel.length; i++) { + xpAdded += dungeonsXPPerLevel[i]; + if (xp < xpAdded) { + double level = (i - 1) + (xp - (xpAdded - dungeonsXPPerLevel[i])) / dungeonsXPPerLevel[i]; + return (double) Math.round(level * 100) / 100; + } + } + return 50D; + } + public static int expertiseKillsLeft(int kills) { for (int i = 0; i < expertiseKills.length; i++) { if (kills < expertiseKills[i]) { -- cgit From aaead3c4f64ababbe60f9788714658fd81b67a3e Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 22 Sep 2020 16:06:46 -0400 Subject: Start using getCommandUsage() --- src/main/java/me/Danker/commands/ArmourCommand.java | 2 +- src/main/java/me/Danker/commands/BankCommand.java | 2 +- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- src/main/java/me/Danker/commands/DisplayCommand.java | 6 +++--- src/main/java/me/Danker/commands/GetkeyCommand.java | 2 +- src/main/java/me/Danker/commands/GuildOfCommand.java | 2 +- src/main/java/me/Danker/commands/ImportFishingCommand.java | 2 +- src/main/java/me/Danker/commands/LootCommand.java | 6 +++--- src/main/java/me/Danker/commands/MoveCommand.java | 6 +++--- src/main/java/me/Danker/commands/PetsCommand.java | 2 +- src/main/java/me/Danker/commands/ReloadConfigCommand.java | 2 +- src/main/java/me/Danker/commands/ResetLootCommand.java | 2 +- src/main/java/me/Danker/commands/ScaleCommand.java | 6 +++--- src/main/java/me/Danker/commands/SetkeyCommand.java | 4 ++-- src/main/java/me/Danker/commands/SkillsCommand.java | 2 +- src/main/java/me/Danker/commands/SkyblockPlayersCommand.java | 2 +- src/main/java/me/Danker/commands/SlayerCommand.java | 2 +- src/main/java/me/Danker/commands/ToggleCommand.java | 6 +++--- 18 files changed, 29 insertions(+), 29 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/commands/ArmourCommand.java b/src/main/java/me/Danker/commands/ArmourCommand.java index 255825c..4fcd282 100644 --- a/src/main/java/me/Danker/commands/ArmourCommand.java +++ b/src/main/java/me/Danker/commands/ArmourCommand.java @@ -38,7 +38,7 @@ public class ArmourCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " [name]"; + return "/" + getCommandName() + " [name]"; } @Override diff --git a/src/main/java/me/Danker/commands/BankCommand.java b/src/main/java/me/Danker/commands/BankCommand.java index 952929f..0d9540c 100644 --- a/src/main/java/me/Danker/commands/BankCommand.java +++ b/src/main/java/me/Danker/commands/BankCommand.java @@ -32,7 +32,7 @@ public class BankCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " [name]"; + return "/" + getCommandName() + " [name]"; } @Override diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index d76481f..e4783f2 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -17,7 +17,7 @@ public class DHelpCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName(); + return "/" + getCommandName(); } @Override diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index b571e1f..a0b49d6 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() + " [winter/festival/session/f(1-5)]"; + return "/" + getCommandName() + " [winter/festival/session/f(1-5)]"; } @Override @@ -48,7 +48,7 @@ public class DisplayCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); return; } @@ -137,7 +137,7 @@ public class DisplayCommand extends CommandBase { } else if (arg1[0].equalsIgnoreCase("off")) { display = "off"; } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); 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 f06e66f..8a650de 100644 --- a/src/main/java/me/Danker/commands/GetkeyCommand.java +++ b/src/main/java/me/Danker/commands/GetkeyCommand.java @@ -22,7 +22,7 @@ public class GetkeyCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName(); + return "/" + getCommandName(); } @Override diff --git a/src/main/java/me/Danker/commands/GuildOfCommand.java b/src/main/java/me/Danker/commands/GuildOfCommand.java index dca1974..be804c1 100644 --- a/src/main/java/me/Danker/commands/GuildOfCommand.java +++ b/src/main/java/me/Danker/commands/GuildOfCommand.java @@ -26,7 +26,7 @@ public class GuildOfCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " [name]"; + return "/" + getCommandName() + " [name]"; } @Override diff --git a/src/main/java/me/Danker/commands/ImportFishingCommand.java b/src/main/java/me/Danker/commands/ImportFishingCommand.java index dc9bd9b..9376a8d 100644 --- a/src/main/java/me/Danker/commands/ImportFishingCommand.java +++ b/src/main/java/me/Danker/commands/ImportFishingCommand.java @@ -20,7 +20,7 @@ public class ImportFishingCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName(); + return "/" + getCommandName(); } @Override diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index c63779e..b69f6fa 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -250,7 +250,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " [winter/festival/f(1-5)/session]"; + return "/" + getCommandName() + " [winter/festival/f(1-5)/session]"; } @Override @@ -277,7 +277,7 @@ public class LootCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); return; } @@ -766,7 +766,7 @@ public class LootCommand extends CommandBase { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot catacombs ")); } } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); } } diff --git a/src/main/java/me/Danker/commands/MoveCommand.java b/src/main/java/me/Danker/commands/MoveCommand.java index 24396ff..bbc62b8 100644 --- a/src/main/java/me/Danker/commands/MoveCommand.java +++ b/src/main/java/me/Danker/commands/MoveCommand.java @@ -24,7 +24,7 @@ public class MoveCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " "; + return "/" + getCommandName() + " "; } @Override @@ -46,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 ")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); return; } @@ -69,7 +69,7 @@ public class MoveCommand extends CommandBase { 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 ")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); } } diff --git a/src/main/java/me/Danker/commands/PetsCommand.java b/src/main/java/me/Danker/commands/PetsCommand.java index 2ad196e..d6d4122 100644 --- a/src/main/java/me/Danker/commands/PetsCommand.java +++ b/src/main/java/me/Danker/commands/PetsCommand.java @@ -58,7 +58,7 @@ public class PetsCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " [name]"; + return "/" + getCommandName() + " [name]"; } @Override diff --git a/src/main/java/me/Danker/commands/ReloadConfigCommand.java b/src/main/java/me/Danker/commands/ReloadConfigCommand.java index 122f1c1..75ee215 100644 --- a/src/main/java/me/Danker/commands/ReloadConfigCommand.java +++ b/src/main/java/me/Danker/commands/ReloadConfigCommand.java @@ -17,7 +17,7 @@ public class ReloadConfigCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName(); + return "/" + getCommandName(); } @Override diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index 844ec0a..bf5b218 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() + ""; + return "/" + getCommandName() + ""; } @Override diff --git a/src/main/java/me/Danker/commands/ScaleCommand.java b/src/main/java/me/Danker/commands/ScaleCommand.java index 7b56b6d..cd53add 100644 --- a/src/main/java/me/Danker/commands/ScaleCommand.java +++ b/src/main/java/me/Danker/commands/ScaleCommand.java @@ -24,7 +24,7 @@ public class ScaleCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " "; + return "/" + getCommandName() + " "; } @Override @@ -45,7 +45,7 @@ public class ScaleCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length < 2) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /scale ")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); return; } @@ -68,7 +68,7 @@ public class ScaleCommand extends CommandBase { 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 ")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); } } diff --git a/src/main/java/me/Danker/commands/SetkeyCommand.java b/src/main/java/me/Danker/commands/SetkeyCommand.java index f68ff75..9fc5228 100644 --- a/src/main/java/me/Danker/commands/SetkeyCommand.java +++ b/src/main/java/me/Danker/commands/SetkeyCommand.java @@ -18,7 +18,7 @@ public class SetkeyCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " "; + return "/" + getCommandName() + " "; } @Override @@ -31,7 +31,7 @@ public class SetkeyCommand extends CommandBase implements ICommand { final EntityPlayer player = (EntityPlayer)arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /setkey ")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); return; } diff --git a/src/main/java/me/Danker/commands/SkillsCommand.java b/src/main/java/me/Danker/commands/SkillsCommand.java index 8128c90..0bdc762 100644 --- a/src/main/java/me/Danker/commands/SkillsCommand.java +++ b/src/main/java/me/Danker/commands/SkillsCommand.java @@ -24,7 +24,7 @@ public class SkillsCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " [name]"; + return "/" + getCommandName() + " [name]"; } @Override diff --git a/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java index ee3c522..1c70bc2 100644 --- a/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java +++ b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java @@ -31,7 +31,7 @@ public class SkyblockPlayersCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return null; + return "/" + getCommandName(); } @Override diff --git a/src/main/java/me/Danker/commands/SlayerCommand.java b/src/main/java/me/Danker/commands/SlayerCommand.java index 0aba569..58ded5e 100644 --- a/src/main/java/me/Danker/commands/SlayerCommand.java +++ b/src/main/java/me/Danker/commands/SlayerCommand.java @@ -26,7 +26,7 @@ public class SlayerCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " [name]"; + return "/" + getCommandName() + " [name]"; } @Override diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index c766165..321eb33 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -35,7 +35,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " "; + return "/" + getCommandName() + " "; } @Override @@ -57,7 +57,7 @@ public class ToggleCommand extends CommandBase implements ICommand { final ConfigHandler cf = new ConfigHandler(); if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); return; } @@ -133,7 +133,7 @@ public class ToggleCommand extends CommandBase implements ICommand { EnumChatFormatting.GREEN + " Golem spawn alerts: " + EnumChatFormatting.DARK_GREEN + golemAlertToggled + "\n" + EnumChatFormatting.GREEN + " Expertise in lore: " + EnumChatFormatting.DARK_GREEN + expertiseLoreToggled)); } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); } } } -- cgit From 1de001488dcb038ea3cb1a372061620392837069 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Wed, 23 Sep 2020 19:58:24 -0400 Subject: Add LabyMod support for text rendering --- src/main/java/me/Danker/TheMod.java | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index b26fc86..8c0660f 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -70,9 +70,11 @@ 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.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -98,6 +100,7 @@ public class TheMod public static String lastMaddoxCommand = "/cb placeholdervalue"; static KeyBinding[] keyBindings = new KeyBinding[1]; static int lastMouse = -1; + static boolean usingLabymod = false; static double dungeonStartTime = 0; static double bloodOpenTime = 0; @@ -108,8 +111,7 @@ public class TheMod static int puzzleFails = 0; @EventHandler - public void init(FMLInitializationEvent event) - { + public void init(FMLInitializationEvent event) { FMLCommonHandler.instance().bus().register(this); MinecraftForge.EVENT_BUS.register(this); @@ -181,6 +183,12 @@ public class TheMod ClientCommandHandler.instance.registerCommand(new DungeonsCommand()); } + @EventHandler + public void postInit(final FMLPostInitializationEvent event) { + usingLabymod = Loader.isModLoaded("labymod"); + System.out.println("LabyMod detection: " + usingLabymod); + } + // Update checker @SubscribeEvent public void onJoin(EntityJoinWorldEvent event) { @@ -970,7 +978,20 @@ public class TheMod @SubscribeEvent public void renderPlayerInfo(final RenderGameOverlayEvent.Post event) { - if (event.type != RenderGameOverlayEvent.ElementType.EXPERIENCE) return; + if (usingLabymod) return; + if (event.type != RenderGameOverlayEvent.ElementType.EXPERIENCE && event.type != RenderGameOverlayEvent.ElementType.JUMPBAR) return; + renderEverything(); + } + + // LabyMod Support + @SubscribeEvent + public void renderPlayerInfoLabyMod(final RenderGameOverlayEvent event) { + if (!usingLabymod) return; + if (event.type != null) return; + renderEverything(); + } + + public void renderEverything() { final ToggleCommand tc = new ToggleCommand(); final MoveCommand moc = new MoveCommand(); final DisplayCommand ds = new DisplayCommand(); -- cgit From 050a1b2d8fbea8567de76d6515908470054d81c1 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 24 Sep 2020 23:14:56 -0400 Subject: Add option for displaying total skill xp instead of progress to next level --- README.md | 7 +++-- src/main/java/me/Danker/TheMod.java | 34 +++++++++++++++++++++- src/main/java/me/Danker/commands/DHelpCommand.java | 6 ++-- src/main/java/me/Danker/commands/MoveCommand.java | 11 +++++-- src/main/java/me/Danker/commands/ScaleCommand.java | 9 ++++-- .../java/me/Danker/commands/ToggleCommand.java | 12 ++++++-- .../java/me/Danker/handlers/ConfigHandler.java | 8 +++++ src/main/java/me/Danker/utils/Utils.java | 9 ++++++ 8 files changed, 82 insertions(+), 14 deletions(-) (limited to 'src/main/java') diff --git a/README.md b/README.md index 42c94a7..88cbf41 100644 --- a/README.md +++ b/README.md @@ -23,19 +23,20 @@ Discord Server: https://discord.gg/QsEkNQS - Dungeons tracker (with graphic display) (scalable) - Pet background colors based on level - Golem spawning alerts (toggleable) +- Show total skill xp instead of progress to next level - API commands - Update checker ## Commands - /dhelp - Returns this message in-game. -- /toggle - Toggles features. /toggle list returns values of every toggle. +- /toggle - Toggles features. /toggle list returns values of every toggle. - /setkey - Sets API key. - /getkey - Returns key set with /setkey and copies it to your clipboard. - /loot [winter/f(1-5)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. - /display [winter/f(1-5)/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. - /resetloot - - Resets loot for trackers. /resetloot confirm confirms the reset. -- /move - Moves text display to specified X and Y coordinates. -- /scale - Scales text display to a specified multipler between 0.1x and 10x. +- /move - Moves text display to specified X and Y coordinates. +- /scale - 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. diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 8c0660f..44cc938 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -96,6 +96,9 @@ public class TheMod public static int titleTimer = -1; public static boolean showTitle = false; public static String titleText = ""; + public static int skillTimer = -1; + public static boolean showSkill = false; + public static String skillText = ""; static int tickAmount = 1; public static String lastMaddoxCommand = "/cb placeholdervalue"; static KeyBinding[] keyBindings = new KeyBinding[1]; @@ -230,9 +233,29 @@ public class TheMod final ToggleCommand tc = new ToggleCommand(); String message = event.message.getUnformattedText(); - if (event.type == 2) return; if (!Utils.inSkyblock) return; + // Action Bar + if (event.type == 2) { + String[] actionBarSections = event.message.getUnformattedText().split(" {3,}"); + for (String section : actionBarSections) { + if (tc.skill50DisplayToggled) { + if (section.contains("(")) { + if (section.contains("Runecrafting")) return; + + String xpGained = section.substring(section.indexOf("+"), section.indexOf("(") - 1); + double currentXp = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replaceAll(",", "")); + int previousXp = Utils.getPastXpEarned(Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", ""))); + + skillTimer = 40; + showSkill = true; + skillText = EnumChatFormatting.AQUA + xpGained + " (" + NumberFormat.getNumberInstance(Locale.US).format(currentXp + previousXp) + "/55,172,425)"; + } + } + } + return; + } + // Replace chat messages with Maddox command List chatSiblings = event.message.getSiblings(); for (IChatComponent sibling : chatSiblings) { @@ -1677,6 +1700,9 @@ public class TheMod if (showTitle) { Utils.drawTitle(titleText); } + if (showSkill) { + new TextRenderer(Minecraft.getMinecraft(), skillText, moc.skill50XY[0], moc.skill50XY[1], ScaleCommand.skill50Scale); + } } @SubscribeEvent(priority = EventPriority.HIGHEST) @@ -1783,6 +1809,12 @@ public class TheMod } titleTimer--; } + if (skillTimer >= 0) { + if (skillTimer == 0) { + showSkill = false; + } + skillTimer--; + } } @SubscribeEvent diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index e4783f2..0afa767 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -33,14 +33,14 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.AQUA + " <> = Mandatory parameter. [] = Optional parameter.\n" + EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + - EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + EnumChatFormatting.GOLD + " /loot [winter/f(1-5)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + EnumChatFormatting.GOLD + " /display [winter/f(1-5)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead.\n" + EnumChatFormatting.GOLD + " /resetloot " + EnumChatFormatting.AQUA + " - Resets loot for trackers. /resetloot confirm confirms the reset.\n" + - EnumChatFormatting.GOLD + " /move " + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + - EnumChatFormatting.GOLD + " /scale " + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + + EnumChatFormatting.GOLD + " /move " + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + + EnumChatFormatting.GOLD + " /scale " + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + EnumChatFormatting.GOLD + " /slayer [player]" + EnumChatFormatting.AQUA + " - Uses API to get slayer xp of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /skills [player]" + EnumChatFormatting.AQUA + " - Uses API to get skill levels of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /guildof [player]" + EnumChatFormatting.AQUA + " - Uses API to get guild name and guild master of a person. If no name is provided, it checks yours.\n" + diff --git a/src/main/java/me/Danker/commands/MoveCommand.java b/src/main/java/me/Danker/commands/MoveCommand.java index bbc62b8..7fb9acd 100644 --- a/src/main/java/me/Danker/commands/MoveCommand.java +++ b/src/main/java/me/Danker/commands/MoveCommand.java @@ -16,6 +16,7 @@ public class MoveCommand extends CommandBase { public static int[] coordsXY = {0, 0}; public static int[] displayXY = {0, 0}; public static int[] dungeonTimerXY = {0, 0}; + public static int[] skill50XY = {0, 0}; @Override public String getCommandName() { @@ -24,7 +25,7 @@ public class MoveCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " "; + return "/" + getCommandName() + " "; } @Override @@ -35,7 +36,7 @@ public class MoveCommand extends CommandBase { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50"); } return null; } @@ -68,6 +69,12 @@ public class MoveCommand extends CommandBase { 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 if (arg1[0].equalsIgnoreCase("skill50")) { + skill50XY[0] = Integer.parseInt(arg1[1]); + skill50XY[1] = Integer.parseInt(arg1[2]); + cf.writeIntConfig("locations", "skill50X", skill50XY[0]); + cf.writeIntConfig("locations", "skill50Y", skill50XY[1]); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Skill 50 display has been moved to " + EnumChatFormatting.DARK_GREEN + arg1[1] + ", " + arg1[2])); } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/ScaleCommand.java b/src/main/java/me/Danker/commands/ScaleCommand.java index cd53add..5f21b77 100644 --- a/src/main/java/me/Danker/commands/ScaleCommand.java +++ b/src/main/java/me/Danker/commands/ScaleCommand.java @@ -16,6 +16,7 @@ public class ScaleCommand extends CommandBase { public static double coordsScale; public static double displayScale; public static double dungeonTimerScale; + public static double skill50Scale; @Override public String getCommandName() { @@ -24,7 +25,7 @@ public class ScaleCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " "; + return "/" + getCommandName() + " "; } @Override @@ -35,7 +36,7 @@ public class ScaleCommand extends CommandBase { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50"); } return null; } @@ -67,6 +68,10 @@ public class ScaleCommand extends CommandBase { 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 if (arg1[0].equalsIgnoreCase("skill50")) { + skill50Scale = scaleAmount; + ConfigHandler.writeDoubleConfig("scales", "skill50Scale", skill50Scale); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Skill 50 display has been scaled to " + EnumChatFormatting.DARK_GREEN + skill50Scale + "x")); } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 321eb33..0172ab1 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -27,6 +27,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean dungeonTimerToggled; public static boolean golemAlertToggled; public static boolean expertiseLoreToggled; + public static boolean skill50DisplayToggled; @Override public String getCommandName() { @@ -35,7 +36,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " "; + return "/" + getCommandName() + " "; } @Override @@ -46,7 +47,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "list"); + return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "list"); } return null; } @@ -117,6 +118,10 @@ public class ToggleCommand extends CommandBase implements ICommand { expertiseLoreToggled = !expertiseLoreToggled; cf.writeBooleanConfig("toggles", "ExpertiseLore", expertiseLoreToggled); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Expertise in lore has been set to " + EnumChatFormatting.DARK_GREEN + expertiseLoreToggled + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("skill50display")) { + skill50DisplayToggled = !skill50DisplayToggled; + cf.writeBooleanConfig("toggles", "Skill50Display", skill50DisplayToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Skill 50 display has been set to " + EnumChatFormatting.DARK_GREEN + skill50DisplayToggled + 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" + @@ -131,7 +136,8 @@ public class ToggleCommand extends CommandBase implements ICommand { EnumChatFormatting.GREEN + " Pet colours: " + EnumChatFormatting.DARK_GREEN + petColoursToggled + "\n" + EnumChatFormatting.GREEN + " Dungeon timer: " + EnumChatFormatting.DARK_GREEN + dungeonTimerToggled + "\n" + EnumChatFormatting.GREEN + " Golem spawn alerts: " + EnumChatFormatting.DARK_GREEN + golemAlertToggled + "\n" + - EnumChatFormatting.GREEN + " Expertise in lore: " + EnumChatFormatting.DARK_GREEN + expertiseLoreToggled)); + EnumChatFormatting.GREEN + " Expertise in lore: " + EnumChatFormatting.DARK_GREEN + expertiseLoreToggled + "\n" + + EnumChatFormatting.GREEN + " Skill 50 display: " + EnumChatFormatting.DARK_GREEN + skill50DisplayToggled)); } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index e58d092..ac7d656 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -185,6 +185,7 @@ public class ConfigHandler { if (!hasKey("toggles", "BlockSlayer")) writeStringConfig("toggles", "BlockSlayer", ""); if (!hasKey("toggles", "GolemAlerts")) writeBooleanConfig("toggles", "GolemAlerts", false); if (!hasKey("toggles", "ExpertiseLore")) writeBooleanConfig("toggles", "ExpertiseLore", true); + if (!hasKey("toggles", "Skill50Display")) writeBooleanConfig("toggles", "Skill50Display", false); if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); @@ -312,9 +313,12 @@ public class ConfigHandler { 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("locations", "skill50X")) writeIntConfig("locations", "skill50X", 40); + if (!hasKey("locations", "skill50Y")) writeIntConfig("locations", "skill50Y", 10); if (!hasKey("scales", "coordsScale")) writeDoubleConfig("scales", "coordsScale", 1); if (!hasKey("scales", "displayScale")) writeDoubleConfig("scales", "displayScale", 1); if (!hasKey("scales", "dungeonTimerScale")) writeDoubleConfig("scales", "dungeonTimerScale", 1); + if (!hasKey("scales", "skill50Scale")) writeDoubleConfig("scales", "skill50Scale", 1); final ToggleCommand tf = new ToggleCommand(); tf.gpartyToggled = getBoolean("toggles", "GParty"); @@ -331,6 +335,7 @@ public class ConfigHandler { tf.dungeonTimerToggled = getBoolean("toggles", "DungeonTimer"); tf.golemAlertToggled = getBoolean("toggles", "GolemAlerts"); tf.expertiseLoreToggled = getBoolean("toggles", "ExpertiseLore"); + tf.skill50DisplayToggled = getBoolean("toggles", "Skill50Display"); final BlockSlayerCommand bs = new BlockSlayerCommand(); String onlySlayer = getString("toggles", "BlockSlayer"); @@ -464,11 +469,14 @@ public class ConfigHandler { moc.displayXY[1] = getInt("locations", "displayY"); moc.dungeonTimerXY[0] = getInt("locations", "dungeonTimerX"); moc.dungeonTimerXY[1] = getInt("locations", "dungeonTimerY"); + moc.skill50XY[0] = getInt("locations", "skill50X"); + moc.skill50XY[1] = getInt("locations", "skill50Y"); final ScaleCommand sc = new ScaleCommand(); sc.coordsScale = getDouble("scales", "coordsScale"); sc.displayScale = getDouble("scales", "displayScale"); sc.dungeonTimerScale = getDouble("scales", "dungeonTimerScale"); + sc.skill50Scale = getDouble("scales", "skill50Scale"); } } diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index d7aa112..e6f35b4 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -212,4 +212,13 @@ public class Utils { return -1; } + public static int getPastXpEarned(int currentLevelXp) { + if (currentLevelXp == 0) return 55172425; + for (int i = 1, xpAdded = 0; i < skillXPPerLevel.length; i++) { + xpAdded += skillXPPerLevel[i - 1]; + if (currentLevelXp == skillXPPerLevel[i]) return xpAdded; + } + return 0; + } + } -- cgit From 861a1b604991986963dde848c4a86c586408640b Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 25 Sep 2020 09:41:56 -0400 Subject: Add percentage to total skill xp display --- src/main/java/me/Danker/TheMod.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 44cc938..f4fb082 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -246,10 +246,11 @@ public class TheMod String xpGained = section.substring(section.indexOf("+"), section.indexOf("(") - 1); double currentXp = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replaceAll(",", "")); int previousXp = Utils.getPastXpEarned(Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", ""))); + double percentage = (double) Math.floor(((currentXp + previousXp) / 55172425) * 10000D) / 100D; skillTimer = 40; showSkill = true; - skillText = EnumChatFormatting.AQUA + xpGained + " (" + NumberFormat.getNumberInstance(Locale.US).format(currentXp + previousXp) + "/55,172,425)"; + skillText = EnumChatFormatting.AQUA + xpGained + " (" + NumberFormat.getNumberInstance(Locale.US).format(currentXp + previousXp) + "/55,172,425) " + percentage + "%"; } } } -- cgit From 3629f2f90c24a76c3568cb63d4d03623ce1d54c7 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 28 Sep 2020 11:50:08 -0400 Subject: Fix player tab complete and UUID returning error 204 --- src/main/java/me/Danker/handlers/APIHandler.java | 5 ++++- src/main/java/me/Danker/utils/Utils.java | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/handlers/APIHandler.java b/src/main/java/me/Danker/handlers/APIHandler.java index 34a73ff..b8d52dc 100644 --- a/src/main/java/me/Danker/handlers/APIHandler.java +++ b/src/main/java/me/Danker/handlers/APIHandler.java @@ -53,8 +53,11 @@ public class APIHandler { JsonObject object = gson.fromJson(error, JsonObject.class); return object; } + } else if (urlString.startsWith("https://api.mojang.com/users/profiles/minecraft/") && conn.getResponseCode() == 204) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: Player does not exist.")); + } else { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Request failed. HTTP Error Code: " + conn.getResponseCode())); } - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Request failed. HTTP Error Code: " + conn.getResponseCode())); } } catch (MalformedURLException ex) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "An error has occured. See logs for more details.")); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index e6f35b4..d872aa2 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -1,6 +1,7 @@ package me.Danker.utils; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.regex.Matcher; @@ -12,7 +13,7 @@ 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.client.network.NetworkPlayerInfo; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.scoreboard.ScoreObjective; @@ -64,10 +65,10 @@ public class Utils { public static List getMatchingPlayers(String arg) { List matchingPlayers = new ArrayList<>(); - List players = Minecraft.getMinecraft().theWorld.playerEntities; + Collection players = Minecraft.getMinecraft().getNetHandler().getPlayerInfoMap(); - for (EntityPlayer player : players) { - String playerName = player.getName(); + for (NetworkPlayerInfo player : players) { + String playerName = player.getGameProfile().getName(); if (playerName.toLowerCase().startsWith(arg.toLowerCase())) { matchingPlayers.add(playerName); } -- cgit From 8aedd48bc175afbef395fcb735c352dffc0b6634 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 28 Sep 2020 15:12:35 -0400 Subject: Fix tab complete for new tab list --- src/main/java/me/Danker/utils/Utils.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index d872aa2..ae9f08b 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -69,6 +69,7 @@ public class Utils { for (NetworkPlayerInfo player : players) { String playerName = player.getGameProfile().getName(); + if (playerName.startsWith("!")) continue; // New tablist if (playerName.toLowerCase().startsWith(arg.toLowerCase())) { matchingPlayers.add(playerName); } -- cgit From 72e0768329adc83143d7a93c13761dbe89586fb5 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 28 Sep 2020 17:25:12 -0400 Subject: Fix issues with Yeti tracker --- src/main/java/me/Danker/TheMod.java | 3 ++- src/main/java/me/Danker/commands/LootCommand.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index f4fb082..7da75d3 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -1981,7 +1981,8 @@ public class TheMod List scoreboard = ScoreboardHandler.getSidebarLines(); for (String s : scoreboard) { String sCleaned = ScoreboardHandler.cleanSB(s); - if (sCleaned.contains("Jerry's Workshop")) { + System.out.println(sCleaned); + if (sCleaned.contains("Jerry's Workshop") || sCleaned.contains("Jerry Pond")) { if (lc.yetiSCs != -1) { lc.yetiSCs++; } diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index b69f6fa..f090269 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -196,8 +196,8 @@ 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 static double yetiTimeSession = -1; + public static int yetiSCsSession = -1; // Fishing Festival public static int nurseSharksSession = 0; public static int blueSharksSession = 0; -- cgit From 4a4aa1e0d511feb544401d9b41607f693887b55b Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 28 Sep 2020 22:05:56 -0400 Subject: Add Shadow Fury to F5 drop list --- src/main/java/me/Danker/TheMod.java | 9 +++++++++ src/main/java/me/Danker/commands/LootCommand.java | 4 ++++ src/main/java/me/Danker/handlers/ConfigHandler.java | 2 ++ 3 files changed, 15 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 7da75d3..3205a24 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -977,6 +977,11 @@ public class TheMod lc.lividDaggersSession++; cf.writeIntConfig("catacombs", "lividDagger", lc.lividDaggers); } + if (message.contains(" RARE REWARD! Shadow Fury")) { + lc.shadowFurys++; + lc.shadowFurysSession++; + cf.writeIntConfig("catacombs", "shadowFury", lc.shadowFurys); + } // Chat Maddox if (message.contains("[OPEN MENU]")) { @@ -1654,6 +1659,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Shadow Leggings:\n" + EnumChatFormatting.DARK_PURPLE + "Shadow Boots:\n" + EnumChatFormatting.GOLD + "Livid Daggers:\n" + + EnumChatFormatting.GOLD + "Shadow Furys:\n" + EnumChatFormatting.AQUA + "Coins Spent:\n" + EnumChatFormatting.AQUA + "Time Spent:"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + @@ -1664,6 +1670,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssLegs) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssBoots) + "\n" + EnumChatFormatting.GOLD + nf.format(lc.lividDaggers) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.shadowFurys) + "\n" + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f5CoinsSpent) + "\n" + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f5TimeSpent); } else if (ds.display.equals("catacombs_floor_five_session")) { @@ -1675,6 +1682,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Shadow Leggings:\n" + EnumChatFormatting.DARK_PURPLE + "Shadow Boots:\n" + EnumChatFormatting.GOLD + "Livid Daggers:\n" + + EnumChatFormatting.GOLD + "Shadow Furys:\n" + EnumChatFormatting.AQUA + "Coins Spent:\n" + EnumChatFormatting.AQUA + "Time Spent:"; countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + @@ -1685,6 +1693,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssLegsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(lc.shadowAssBootsSession) + "\n" + EnumChatFormatting.GOLD + nf.format(lc.lividDaggersSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.shadowFurysSession) + "\n" + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f5CoinsSpentSession) + "\n" + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f5TimeSpentSession); } else { diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index f090269..0d8f3b8 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -125,6 +125,7 @@ public class LootCommand extends CommandBase { public static int shadowAssLegs; public static int shadowAssBoots; public static int lividDaggers; + public static int shadowFurys; public static double f5CoinsSpent; public static double f5TimeSpent; @@ -240,6 +241,7 @@ public class LootCommand extends CommandBase { public static int shadowAssLegsSession = 0; public static int shadowAssBootsSession = 0; public static int lividDaggersSession = 0; + public static int shadowFurysSession = 0; public static double f5CoinsSpentSession = 0; public static double f5TimeSpentSession = 0; @@ -744,6 +746,7 @@ public class LootCommand extends CommandBase { EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Legs: " + nf.format(shadowAssLegsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Boots: " + nf.format(shadowAssBootsSession) + "\n" + EnumChatFormatting.GOLD + " Livid Daggers: " + nf.format(lividDaggersSession) + "\n" + + EnumChatFormatting.GOLD + " Shadow Furys: " + nf.format(shadowFurysSession) + "\n" + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f5CoinsSpentSession) + "\n" + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f5TimeSpentSession) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); @@ -759,6 +762,7 @@ public class LootCommand extends CommandBase { EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Legs: " + nf.format(shadowAssLegs) + "\n" + EnumChatFormatting.DARK_PURPLE + " Shadow Assassin Boots: " + nf.format(shadowAssBoots) + "\n" + EnumChatFormatting.GOLD + " Livid Daggers: " + nf.format(lividDaggers) + "\n" + + EnumChatFormatting.GOLD + " Shadow Furys: " + nf.format(shadowFurys) + "\n" + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f5CoinsSpent) + "\n" + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f5TimeSpent) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index ac7d656..4138fcb 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -300,6 +300,7 @@ public class ConfigHandler { if (!hasKey("catacombs", "shadowAssassinLegging")) writeIntConfig("catacombs", "shadowAssassinLegging", 0); if (!hasKey("catacombs", "shadowAssassinBoot")) writeIntConfig("catacombs", "shadowAssassinBoot", 0); if (!hasKey("catacombs", "lividDagger")) writeIntConfig("catacombs", "lividDagger", 0); + if (!hasKey("catacombs", "shadowFury")) writeIntConfig("catacombs", "shadowFury", 0); if (!hasKey("catacombs", "floorFiveCoins")) writeDoubleConfig("catacombs", "floorFiveCoins", 0); if (!hasKey("catacombs", "floorFiveTime")) writeDoubleConfig("catacombs", "floorFiveTime", 0); @@ -456,6 +457,7 @@ public class ConfigHandler { lc.shadowAssLegs = getInt("catacombs", "shadowAssassinLegging"); lc.shadowAssBoots = getInt("catacombs", "shadowAssassinBoot"); lc.lividDaggers = getInt("catacombs", "lividDagger"); + lc.shadowFurys = getInt("catacombs", "shadowFury"); lc.f5CoinsSpent = getDouble("catacombs", "floorFiveCoins"); lc.f5TimeSpent = getDouble("catacombs", "floorFiveTime"); -- cgit From d620d60c40db7ec2c7c59c01a5b02cb431552944 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 2 Oct 2020 09:24:12 -0400 Subject: Fix /skills for people missing taming achievement --- src/main/java/me/Danker/TheMod.java | 6 +++- .../java/me/Danker/commands/SkillsCommand.java | 32 ++++++++++++++++------ 2 files changed, 29 insertions(+), 9 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 3205a24..9185615 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -1809,8 +1809,12 @@ public class TheMod EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; if (player != null) { Utils.checkForSkyblock(); + // if (Utils.inSkyblock) { + // System.out.println("Autosyncing inventory to server..."); + // player.inventoryContainer.detectAndSendChanges(); // Spirit boot fix every 1 second + // } } - tickAmount = 1; + tickAmount = 0; } if (titleTimer >= 0) { diff --git a/src/main/java/me/Danker/commands/SkillsCommand.java b/src/main/java/me/Danker/commands/SkillsCommand.java index 0bdc762..50f2767 100644 --- a/src/main/java/me/Danker/commands/SkillsCommand.java +++ b/src/main/java/me/Danker/commands/SkillsCommand.java @@ -139,14 +139,30 @@ public class SkillsCommand extends CommandBase { } JsonObject achievementObject = playerObject.get("player").getAsJsonObject().get("achievements").getAsJsonObject(); - farmingLevel = achievementObject.get("skyblock_harvester").getAsInt(); - miningLevel = achievementObject.get("skyblock_excavator").getAsInt(); - combatLevel = achievementObject.get("skyblock_combat").getAsInt(); - foragingLevel = achievementObject.get("skyblock_gatherer").getAsInt(); - fishingLevel = achievementObject.get("skyblock_angler").getAsInt(); - enchantingLevel = achievementObject.get("skyblock_augmentation").getAsInt(); - alchemyLevel = achievementObject.get("skyblock_concoctor").getAsInt(); - tamingLevel = achievementObject.get("skyblock_domesticator").getAsInt(); + if (achievementObject.has("skyblock_harvester")) { + farmingLevel = achievementObject.get("skyblock_harvester").getAsInt(); + } + if (achievementObject.has("skyblock_excavator")) { + miningLevel = achievementObject.get("skyblock_excavator").getAsInt(); + } + if (achievementObject.has("skyblock_combat")) { + combatLevel = achievementObject.get("skyblock_combat").getAsInt(); + } + if (achievementObject.has("skyblock_gatherer")) { + foragingLevel = achievementObject.get("skyblock_gatherer").getAsInt(); + } + if (achievementObject.has("skyblock_angler")) { + fishingLevel = achievementObject.get("skyblock_angler").getAsInt(); + } + if (achievementObject.has("skyblock_augmentation")) { + enchantingLevel = achievementObject.get("skyblock_augmentation").getAsInt(); + } + if (achievementObject.has("skyblock_concoctor")) { + alchemyLevel = achievementObject.get("skyblock_concoctor").getAsInt(); + } + if (achievementObject.has("skyblock_domesticator")) { + tamingLevel = achievementObject.get("skyblock_domesticator").getAsInt(); + } } double skillAvg = (farmingLevel + miningLevel + combatLevel + foragingLevel + fishingLevel + enchantingLevel + alchemyLevel + tamingLevel) / 8; -- cgit From 5915c13b1390b613ceefe67011d1f66939e138c2 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 2 Oct 2020 14:03:12 -0400 Subject: Add command to see skill levels of lobby --- README.md | 1 + src/main/java/me/Danker/TheMod.java | 2 + src/main/java/me/Danker/commands/DHelpCommand.java | 1 + .../me/Danker/commands/LobbySkillsCommand.java | 215 +++++++++++++++++++++ 4 files changed, 219 insertions(+) create mode 100644 src/main/java/me/Danker/commands/LobbySkillsCommand.java (limited to 'src/main/java') diff --git a/README.md b/README.md index 88cbf41..2fca0f4 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Discord Server: https://discord.gg/QsEkNQS - /scale - 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. +- /lobbyskills - Uses API to find the average skills of the lobby, as well the three players with the highest skill average. - /guildof [player] - Uses API to get guild name and guild master of a person. If no name is provided, it checks yours. - /petsof [player] - Uses API to get pets of a person. If no name is provided, it checks yours. - /bank [player] - Uses API to get bank and purse coins of a person. If no name is provided, it checks yours. diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 9185615..496a6a8 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -26,6 +26,7 @@ import me.Danker.commands.DungeonsCommand; import me.Danker.commands.GetkeyCommand; import me.Danker.commands.GuildOfCommand; import me.Danker.commands.ImportFishingCommand; +import me.Danker.commands.LobbySkillsCommand; import me.Danker.commands.LootCommand; import me.Danker.commands.MoveCommand; import me.Danker.commands.PetsCommand; @@ -184,6 +185,7 @@ public class TheMod ClientCommandHandler.instance.registerCommand(new SkyblockPlayersCommand()); ClientCommandHandler.instance.registerCommand(new BlockSlayerCommand()); ClientCommandHandler.instance.registerCommand(new DungeonsCommand()); + ClientCommandHandler.instance.registerCommand(new LobbySkillsCommand()); } @EventHandler diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 0afa767..2cefb9b 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -43,6 +43,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /scale " + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + EnumChatFormatting.GOLD + " /slayer [player]" + EnumChatFormatting.AQUA + " - Uses API to get slayer xp of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /skills [player]" + EnumChatFormatting.AQUA + " - Uses API to get skill levels of a person. If no name is provided, it checks yours.\n" + + EnumChatFormatting.GOLD + " /lobbyskills" + EnumChatFormatting.AQUA + " - Uses API to find the average skills of the lobby, as well the three players with the highest skill average.\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" + diff --git a/src/main/java/me/Danker/commands/LobbySkillsCommand.java b/src/main/java/me/Danker/commands/LobbySkillsCommand.java new file mode 100644 index 0000000..1bcd38a --- /dev/null +++ b/src/main/java/me/Danker/commands/LobbySkillsCommand.java @@ -0,0 +1,215 @@ +package me.Danker.commands; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Collectors; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; + +import me.Danker.handlers.APIHandler; +import me.Danker.handlers.ConfigHandler; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.network.NetworkPlayerInfo; +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 LobbySkillsCommand extends CommandBase { + + Thread mainThread = null; + + @Override + public String getCommandName() { + return "lobbyskills"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return "/" + getCommandName(); + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } + + @Override + public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { + EntityPlayer playerSP = (EntityPlayer) arg0; + ConfigHandler cf = new ConfigHandler(); + APIHandler ah = new APIHandler(); + boolean someErrored = false; + Map unsortedSAList = new HashMap(); + ArrayList lobbySkills = new ArrayList(); + // Check key + String key = cf.getString("api", "APIKey"); + if (key.equals("")) { + playerSP.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Use /setkey.")); + return; + } + + mainThread = new Thread(() -> { + try { + // Create deep copy of players to prevent passing reference and ConcurrentModificationException + Collection players = new ArrayList(Minecraft.getMinecraft().getNetHandler().getPlayerInfoMap()); + playerSP.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking skill average of lobby. Estimated time: " + (int) (players.size() * 1.2 + 1) + " seconds.")); + // Send request every .6 seconds, leaving room for another 20 requests per minute + + for (final NetworkPlayerInfo player : players) { + // Manually get latest profile to use reduced requests on extra achievement API + System.out.println("Now parsing " + player.getGameProfile().getName()); + String UUID = player.getGameProfile().getId().toString().replaceAll("-", ""); + long biggestLastSave = 0; + int profileIndex = -1; + Thread.sleep(600); + JsonObject profileResponse = ah.getResponse("https://api.hypixel.net/skyblock/profiles?uuid=" + UUID + "&key=" + key); + if (!profileResponse.get("success").getAsBoolean()) { + String reason = profileResponse.get("cause").getAsString(); + System.out.println("User " + player.getGameProfile().getName() + " failed with reason: " + reason); + continue; + } + if (profileResponse.get("profiles").isJsonNull()) continue; + + JsonArray profiles = profileResponse.get("profiles").getAsJsonArray(); + for (int i = 0; i < profiles.size(); i++) { + JsonObject profile = profiles.get(i).getAsJsonObject(); + if (!profile.get("members").getAsJsonObject().get(UUID).getAsJsonObject().has("last_save")) continue; + if (profile.get("members").getAsJsonObject().get(UUID).getAsJsonObject().get("last_save").getAsLong() > biggestLastSave) { + biggestLastSave = profile.get("members").getAsJsonObject().get(UUID).getAsJsonObject().get("last_save").getAsLong(); + profileIndex = i; + } + } + if (profileIndex == -1 || biggestLastSave == 0) continue; + JsonObject latestProfile = profiles.get(profileIndex).getAsJsonObject().get("members").getAsJsonObject().get(UUID).getAsJsonObject(); + + // Get SA + double farmingLevel = 0; + double miningLevel = 0; + double combatLevel = 0; + double foragingLevel = 0; + double fishingLevel = 0; + double enchantingLevel = 0; + double alchemyLevel = 0; + double tamingLevel = 0; + + if (latestProfile.has("experience_skill_farming") || latestProfile.has("experience_skill_mining") || latestProfile.has("experience_skill_combat") || latestProfile.has("experience_skill_foraging") || latestProfile.has("experience_skill_fishing") || latestProfile.has("experience_skill_enchanting") || latestProfile.has("experience_skill_alchemy")) { + if (latestProfile.has("experience_skill_farming")) { + farmingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_farming").getAsDouble()); + farmingLevel = (double) Math.round(farmingLevel * 100) / 100; + } + if (latestProfile.has("experience_skill_mining")) { + miningLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_mining").getAsDouble()); + miningLevel = (double) Math.round(miningLevel * 100) / 100; + } + if (latestProfile.has("experience_skill_combat")) { + combatLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_combat").getAsDouble()); + combatLevel = (double) Math.round(combatLevel * 100) / 100; + } + if (latestProfile.has("experience_skill_foraging")) { + foragingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_foraging").getAsDouble()); + foragingLevel = (double) Math.round(foragingLevel * 100) / 100; + } + if (latestProfile.has("experience_skill_fishing")) { + fishingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_fishing").getAsDouble()); + fishingLevel = (double) Math.round(fishingLevel * 100) / 100; + } + if (latestProfile.has("experience_skill_enchanting")) { + enchantingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_enchanting").getAsDouble()); + enchantingLevel = (double) Math.round(enchantingLevel * 100) / 100; + } + if (latestProfile.has("experience_skill_alchemy")) { + alchemyLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_alchemy").getAsDouble()); + alchemyLevel = (double) Math.round(alchemyLevel * 100) / 100; + } + if (latestProfile.has("experience_skill_taming")) { + tamingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_taming").getAsDouble()); + tamingLevel = (double) Math.round(tamingLevel * 100) / 100; + } + } else { + Thread.sleep(600); // Sleep for another request + System.out.println("Fetching skills from achievement API"); + JsonObject playerObject = ah.getResponse("https://api.hypixel.net/player?uuid=" + UUID + "&key=" + key); + + if (!playerObject.get("success").getAsBoolean()) { + String reason = profileResponse.get("cause").getAsString(); + System.out.println("User " + player.getGameProfile().getName() + " failed with reason: " + reason); + continue; + } + + JsonObject achievementObject = playerObject.get("player").getAsJsonObject().get("achievements").getAsJsonObject(); + if (achievementObject.has("skyblock_harvester")) { + farmingLevel = achievementObject.get("skyblock_harvester").getAsInt(); + } + if (achievementObject.has("skyblock_excavator")) { + miningLevel = achievementObject.get("skyblock_excavator").getAsInt(); + } + if (achievementObject.has("skyblock_combat")) { + combatLevel = achievementObject.get("skyblock_combat").getAsInt(); + } + if (achievementObject.has("skyblock_gatherer")) { + foragingLevel = achievementObject.get("skyblock_gatherer").getAsInt(); + } + if (achievementObject.has("skyblock_angler")) { + fishingLevel = achievementObject.get("skyblock_angler").getAsInt(); + } + if (achievementObject.has("skyblock_augmentation")) { + enchantingLevel = achievementObject.get("skyblock_augmentation").getAsInt(); + } + if (achievementObject.has("skyblock_concoctor")) { + alchemyLevel = achievementObject.get("skyblock_concoctor").getAsInt(); + } + if (achievementObject.has("skyblock_domesticator")) { + tamingLevel = achievementObject.get("skyblock_domesticator").getAsInt(); + } + } + + double skillAvg = (farmingLevel + miningLevel + combatLevel + foragingLevel + fishingLevel + enchantingLevel + alchemyLevel + tamingLevel) / 8; + skillAvg = (double) Math.round(skillAvg * 100) / 100; + unsortedSAList.put(player.getGameProfile().getName(), skillAvg); // Put SA in HashMap + lobbySkills.add(skillAvg); // Add SA to lobby skills + } + + // I have no idea how this works, or even what :: does but this sorts the skill averages + Map sortedSAList = unsortedSAList.entrySet().stream() + .sorted(Entry.comparingByValue().reversed()) + .collect(Collectors.toMap(Entry::getKey, Entry::getValue, + (e1, e2) -> e1, LinkedHashMap::new)); + + String[] sortedSAListKeys = sortedSAList.keySet().toArray(new String[sortedSAList.keySet().size()]); + String top3 = ""; + for (int i = 0; i < 3 && i < sortedSAListKeys.length; i++) { + top3 += "\n " + EnumChatFormatting.AQUA + sortedSAListKeys[i] + ": " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + sortedSAList.get(sortedSAListKeys[i]); + } + + // Get lobby sa + double lobbySA = 0; + for (int i = 0; i < lobbySkills.size(); i++) { + lobbySA += lobbySkills.get(i); + } + lobbySA = (double) Math.round((lobbySA / lobbySkills.size()) * 100) / 100; + + // Finally say skill lobby avg and highest SA users + playerSP.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.GREEN + " Lobby Skill Average: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + lobbySA + "\n" + + EnumChatFormatting.GREEN + " Highest Skill Averages:" + top3 + "\n" + + EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + " -------------------")); + } catch (InterruptedException ex) { + System.out.println("Current skill average list: " + unsortedSAList.toString()); + Thread.currentThread().interrupt(); + System.out.println("Interrupted /lobbyskills thread."); + } + + }); + mainThread.start(); + } + +} -- cgit From 1af820750f2a9a343265b887ce5709e338a656bc Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 2 Oct 2020 14:04:42 -0400 Subject: Forgot a + Whoops --- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 2cefb9b..e3e615b 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -43,7 +43,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /scale " + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + EnumChatFormatting.GOLD + " /slayer [player]" + EnumChatFormatting.AQUA + " - Uses API to get slayer xp of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /skills [player]" + EnumChatFormatting.AQUA + " - Uses API to get skill levels of a person. If no name is provided, it checks yours.\n" + - EnumChatFormatting.GOLD + " /lobbyskills" + EnumChatFormatting.AQUA + " - Uses API to find the average skills of the lobby, as well the three players with the highest skill average.\n" + EnumChatFormatting.GOLD + " /lobbyskills" + EnumChatFormatting.AQUA + " - Uses API to find the average skills of the lobby, as well the three players with the highest skill average.\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" + -- cgit From 06a4cd2bd1e939c591e0ee781ed0cc937f1523c5 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 2 Oct 2020 16:08:04 -0400 Subject: Rename /blockslayer to /onlyslayer --- README.md | 2 +- src/main/java/me/Danker/commands/BlockSlayerCommand.java | 2 +- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- src/main/java/me/Danker/commands/LobbySkillsCommand.java | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/main/java') diff --git a/README.md b/README.md index 2fca0f4..770e91b 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Discord Server: https://discord.gg/QsEkNQS - /dungeons [player] - Uses API to get dungeon levels 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. -- /blockslayer <1/2/3/4> - Stops you from starting a slayer quest other than the one specified. +- /onlyslayer <1/2/3/4> - Stops you from starting a slayer quest other than the one specified. ## Keybinds - Open Maddox menu - M by default. diff --git a/src/main/java/me/Danker/commands/BlockSlayerCommand.java b/src/main/java/me/Danker/commands/BlockSlayerCommand.java index f88a334..83a0358 100644 --- a/src/main/java/me/Danker/commands/BlockSlayerCommand.java +++ b/src/main/java/me/Danker/commands/BlockSlayerCommand.java @@ -18,7 +18,7 @@ public class BlockSlayerCommand extends CommandBase { @Override public String getCommandName() { - return "blockslayer"; + return "onlyslayer"; } @Override diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index e3e615b..ecb327e 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -51,7 +51,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /dungeons [player] " + EnumChatFormatting.AQUA + " - Uses API to get dungeon levels 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 + " /sbplayers" + EnumChatFormatting.AQUA + " - Uses API to find how many players are on each Skyblock island.\n" + - EnumChatFormatting.GOLD + " /blockslayer <1/2/3/4>" + EnumChatFormatting.AQUA + " - Stops you from starting a slayer quest other than the one specified.\n" + + EnumChatFormatting.GOLD + " /onlyslayer <1/2/3/4>" + EnumChatFormatting.AQUA + " - Stops you from starting a slayer quest other than the one specified.\n" + EnumChatFormatting.GREEN + " Open Maddox Menu" + EnumChatFormatting.AQUA + " - M by default.\n")); } diff --git a/src/main/java/me/Danker/commands/LobbySkillsCommand.java b/src/main/java/me/Danker/commands/LobbySkillsCommand.java index 1bcd38a..7e6387b 100644 --- a/src/main/java/me/Danker/commands/LobbySkillsCommand.java +++ b/src/main/java/me/Danker/commands/LobbySkillsCommand.java @@ -66,7 +66,6 @@ public class LobbySkillsCommand extends CommandBase { for (final NetworkPlayerInfo player : players) { // Manually get latest profile to use reduced requests on extra achievement API - System.out.println("Now parsing " + player.getGameProfile().getName()); String UUID = player.getGameProfile().getId().toString().replaceAll("-", ""); long biggestLastSave = 0; int profileIndex = -1; -- cgit From 5dcce09ab839b00a3dd2e1db114f12856f08ae66 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 2 Oct 2020 16:27:23 -0400 Subject: Optimize new tab /lobbyskills --- src/main/java/me/Danker/commands/LobbySkillsCommand.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/commands/LobbySkillsCommand.java b/src/main/java/me/Danker/commands/LobbySkillsCommand.java index 7e6387b..9eb01a3 100644 --- a/src/main/java/me/Danker/commands/LobbySkillsCommand.java +++ b/src/main/java/me/Danker/commands/LobbySkillsCommand.java @@ -65,6 +65,7 @@ public class LobbySkillsCommand extends CommandBase { // Send request every .6 seconds, leaving room for another 20 requests per minute for (final NetworkPlayerInfo player : players) { + if (player.getGameProfile().getName().startsWith("!")) continue; // Manually get latest profile to use reduced requests on extra achievement API String UUID = player.getGameProfile().getId().toString().replaceAll("-", ""); long biggestLastSave = 0; -- cgit From cea757125fa368c9e5db6250b0891b006653b69a Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 5 Oct 2020 11:01:09 -0400 Subject: Optimize chat checking Yandere dev moment --- src/main/java/me/Danker/TheMod.java | 436 ++++++++++++++---------------------- 1 file changed, 173 insertions(+), 263 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 496a6a8..a3602aa 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -336,50 +336,39 @@ public class TheMod } cf.writeIntConfig("wolf", "svens", lc.wolfSvens); cf.writeIntConfig("wolf", "bossRNG", lc.wolfBosses); - } - if (message.contains("RARE DROP! (Hamster Wheel)")) { + } else if (message.contains("RARE DROP! (Hamster Wheel)")) { lc.wolfWheelsDrops++; lc.wolfWheelsDropsSession++; cf.writeIntConfig("wolf", "wheelDrops", lc.wolfWheelsDrops); - } - // Removing the unicode here *should* fix rune drops not counting - if (message.contains("VERY RARE DROP! (") && message.contains(" Spirit Rune I)")) { + } else if (message.contains("VERY RARE DROP! (") && message.contains(" Spirit Rune I)")) { // Removing the unicode here *should* fix rune drops not counting lc.wolfSpirits++; lc.wolfSpiritsSession++; cf.writeIntConfig("wolf", "spirit", lc.wolfSpirits); - } - if (message.contains("CRAZY RARE DROP! (Red Claw Egg)")) { + } else if (message.contains("CRAZY RARE DROP! (Red Claw Egg)")) { wolfRNG = true; lc.wolfEggs++; lc.wolfEggsSession++; cf.writeIntConfig("wolf", "egg", lc.wolfEggs); if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_RED + "RED CLAW EGG!", 3); - } - if (message.contains("CRAZY RARE DROP! (") && message.contains(" Couture Rune I)")) { + } else if (message.contains("CRAZY RARE DROP! (") && message.contains(" Couture Rune I)")) { wolfRNG = true; lc.wolfCoutures++; lc.wolfCouturesSession++; cf.writeIntConfig("wolf", "couture", lc.wolfCoutures); if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "COUTURE RUNE!", 3); - } - // How did Skyblock devs even manage to make this item Rename Me - if (message.contains("CRAZY RARE DROP! (Grizzly Bait)") || message.contains("CRAZY RARE DROP! (Rename Me)")) { + } else if (message.contains("CRAZY RARE DROP! (Grizzly Bait)") || message.contains("CRAZY RARE DROP! (Rename Me)")) { // How did Skyblock devs even manage to make this item Rename Me wolfRNG = true; lc.wolfBaits++; lc.wolfBaitsSession++; cf.writeIntConfig("wolf", "bait", lc.wolfBaits); if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.AQUA + "GRIZZLY BAIT!", 3); - } - if (message.contains("CRAZY RARE DROP! (Overflux Capacitor)")) { + } else if (message.contains("CRAZY RARE DROP! (Overflux Capacitor)")) { wolfRNG = true; lc.wolfFluxes++; lc.wolfFluxesSession++; cf.writeIntConfig("wolf", "flux", lc.wolfFluxes); if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "OVERFLUX CAPACITOR!", 5); - } - - // Spider - if (message.contains("Talk to Maddox to claim your Spider Slayer XP!")) { + } else if (message.contains("Talk to Maddox to claim your Spider Slayer XP!")) { // Spider lc.spiderTarantulas++; lc.spiderTarantulasSession++; if (lc.spiderBosses != -1) { @@ -390,46 +379,37 @@ public class TheMod } cf.writeIntConfig("spider", "tarantulas", lc.spiderTarantulas); cf.writeIntConfig("spider", "bossRNG", lc.spiderBosses); - } - if (message.contains("RARE DROP! (Toxic Arrow Poison)")) { + } else if (message.contains("RARE DROP! (Toxic Arrow Poison)")) { lc.spiderTAPDrops++; lc.spiderTAPDropsSession++; cf.writeIntConfig("spider", "tapDrops", lc.spiderTAPDrops); - } - if (message.contains("VERY RARE DROP! (") && message.contains(" Bite Rune I)")) { + } else if (message.contains("VERY RARE DROP! (") && message.contains(" Bite Rune I)")) { lc.spiderBites++; lc.spiderBitesSession++; cf.writeIntConfig("spider", "bite", lc.spiderBites); - } - if (message.contains("VERY RARE DROP! (Spider Catalyst)")) { + } else if (message.contains("VERY RARE DROP! (Spider Catalyst)")) { lc.spiderCatalysts++; lc.spiderCatalystsSession++; cf.writeIntConfig("spider", "catalyst", lc.spiderCatalysts); - } - if (message.contains("CRAZY RARE DROP! (Fly Swatter)")) { + } else if (message.contains("CRAZY RARE DROP! (Fly Swatter)")) { spiderRNG = true; lc.spiderSwatters++; lc.spiderSwattersSession++; cf.writeIntConfig("spider", "swatter", lc.spiderSwatters); if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.LIGHT_PURPLE + "FLY SWATTER!", 3); - } - if (message.contains("CRAZY RARE DROP! (Tarantula Talisman")) { + } else if (message.contains("CRAZY RARE DROP! (Tarantula Talisman")) { spiderRNG = true; lc.spiderTalismans++; lc.spiderTalismansSession++; cf.writeIntConfig("spider", "talisman", lc.spiderTalismans); if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "TARANTULA TALISMAN!", 3); - } - if (message.contains("CRAZY RARE DROP! (Digested Mosquito)")) { + } else if (message.contains("CRAZY RARE DROP! (Digested Mosquito)")) { spiderRNG = true; lc.spiderMosquitos++; lc.spiderMosquitosSession++; cf.writeIntConfig("spider", "mosquito", lc.spiderMosquitos); if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "DIGESTED MOSQUITO!", 5); - } - - // Zombie - if (message.contains("Talk to Maddox to claim your Zombie Slayer XP!")) { + } else if (message.contains("Talk to Maddox to claim your Zombie Slayer XP!")) { // Zombie lc.zombieRevs++; lc.zombieRevsSession++; if (lc.zombieBosses != -1) { @@ -440,86 +420,49 @@ public class TheMod } cf.writeIntConfig("zombie", "revs", lc.zombieRevs); cf.writeIntConfig("zombie", "bossRNG", lc.zombieBosses); - } - if (message.contains("RARE DROP! (Foul Flesh)")) { + } else if (message.contains("RARE DROP! (Foul Flesh)")) { lc.zombieFoulFleshDrops++; lc.zombieFoulFleshDropsSession++; cf.writeIntConfig("zombie", "foulFleshDrops", lc.zombieFoulFleshDrops); - } - if (message.contains("VERY RARE DROP! (Revenant Catalyst)")) { + } else if (message.contains("VERY RARE DROP! (Revenant Catalyst)")) { lc.zombieRevCatas++; lc.zombieRevCatasSession++; cf.writeIntConfig("zombie", "revCatalyst", lc.zombieRevCatas); - } - if (message.contains("VERY RARE DROP! (") && message.contains(" Pestilence Rune I)")) { + } else if (message.contains("VERY RARE DROP! (") && message.contains(" Pestilence Rune I)")) { lc.zombiePestilences++; lc.zombiePestilencesSession++; cf.writeIntConfig("zombie", "pestilence", lc.zombiePestilences); - } - if (message.contains("VERY RARE DROP! (Undead Catalyst)")) { + } else if (message.contains("VERY RARE DROP! (Undead Catalyst)")) { lc.zombieUndeadCatas++; lc.zombieUndeadCatasSession++; cf.writeIntConfig("zombie", "undeadCatalyst", lc.zombieUndeadCatas); - } - if (message.contains("CRAZY RARE DROP! (Beheaded Horror)")) { + } else if (message.contains("CRAZY RARE DROP! (Beheaded Horror)")) { zombieRNG = true; lc.zombieBeheadeds++; lc.zombieBeheadedsSession++; cf.writeIntConfig("zombie", "beheaded", lc.zombieBeheadeds); if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "BEHEADED HORROR!", 3); - } - if (message.contains("CRAZY RARE DROP! (") && message.contains(" Snake Rune I)")) { + } else if (message.contains("CRAZY RARE DROP! (") && message.contains(" Snake Rune I)")) { zombieRNG = true; lc.zombieSnakes++; lc.zombieSnakesSession++; cf.writeIntConfig("zombie", "snake", lc.zombieSnakes); if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_GREEN + "SNAKE RUNE!", 3); - } - if (message.contains("CRAZY RARE DROP! (Scythe Blade)")) { + } else if (message.contains("CRAZY RARE DROP! (Scythe Blade)")) { zombieRNG = true; lc.zombieScythes++; lc.zombieScythesSession++; cf.writeIntConfig("zombie", "scythe", lc.zombieScythes); if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "SCYTHE BLADE!", 5); - } - - if (wolfRNG) { - lc.wolfTime = System.currentTimeMillis() / 1000; - lc.wolfBosses = 0; - lc.wolfTimeSession = System.currentTimeMillis() / 1000; - lc.wolfBossesSession = 0; - cf.writeDoubleConfig("wolf", "timeRNG", lc.wolfTime); - cf.writeIntConfig("wolf", "bossRNG", 0); - } - if (spiderRNG) { - lc.spiderTime = System.currentTimeMillis() / 1000; - lc.spiderBosses = 0; - lc.spiderTimeSession = System.currentTimeMillis() / 1000; - lc.spiderBossesSession = 0; - cf.writeDoubleConfig("spider", "timeRNG", lc.spiderTime); - cf.writeIntConfig("spider", "bossRNG", 0); - } - if (zombieRNG) { - lc.zombieTime = System.currentTimeMillis() / 1000; - lc.zombieBosses = 0; - lc.zombieTimeSession = System.currentTimeMillis() / 1000; - lc.zombieBossesSession = 0; - cf.writeDoubleConfig("zombie", "timeRNG", lc.zombieTime); - cf.writeIntConfig("zombie", "bossRNG", 0); - } - - // Fishing - if (message.contains("GOOD CATCH!")) { + } else if (message.contains("GOOD CATCH!")) { // Fishing lc.goodCatches++; lc.goodCatchesSession++; cf.writeIntConfig("fishing", "goodCatch", lc.goodCatches); - } - if (message.contains("GREAT CATCH!")) { + } else if (message.contains("GREAT CATCH!")) { lc.greatCatches++; lc.greatCatchesSession++; cf.writeIntConfig("fishing", "greatCatch", lc.greatCatches); - } - if (message.contains("You caught a lowly Squid")) { + } else if (message.contains("You caught a lowly Squid")) { lc.squids++; lc.seaCreatures++; lc.fishingMilestone++; @@ -530,8 +473,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("From the depths of the waters, you've reeled in a Sea Walker")) { + } else if (message.contains("From the depths of the waters, you've reeled in a Sea Walker")) { lc.seaWalkers++; lc.seaCreatures++; lc.fishingMilestone++; @@ -542,8 +484,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("Pitch darkness reveals you've caught a")) { + } else if (message.contains("Pitch darkness reveals you've caught a")) { lc.nightSquids++; lc.seaCreatures++; lc.fishingMilestone++; @@ -554,8 +495,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("You've stumbled upon a patrolling Sea Guardian")) { + } else if (message.contains("You've stumbled upon a patrolling Sea Guardian")) { lc.seaGuardians++; lc.seaCreatures++; lc.fishingMilestone++; @@ -566,8 +506,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("It looks like you've disrupted the Sea Witch's brewing session. Watch out, she's furious")) { + } else if (message.contains("It looks like you've disrupted the Sea Witch's brewing session. Watch out, she's furious")) { lc.seaWitches++; lc.seaCreatures++; lc.fishingMilestone++; @@ -578,8 +517,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("From the depths of the waters, you've reeled in a Sea Archer")) { + } else if (message.contains("From the depths of the waters, you've reeled in a Sea Archer")) { lc.seaArchers++; lc.seaCreatures++; lc.fishingMilestone++; @@ -590,8 +528,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("The Monster of the Deep emerges from the dark depths")) { + } else if (message.contains("The Monster of the Deep emerges from the dark depths")) { lc.monsterOfTheDeeps++; lc.seaCreatures++; lc.fishingMilestone++; @@ -602,8 +539,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("You have found a Catfish, don't let it steal your catches")) { + } else if (message.contains("You have found a Catfish, don't let it steal your catches")) { lc.catfishes++; lc.seaCreatures++; lc.fishingMilestone++; @@ -614,8 +550,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("Is this even a fish? It's the Carrot King")) { + } else if (message.contains("Is this even a fish? It's the Carrot King")) { lc.carrotKings++; lc.seaCreatures++; lc.fishingMilestone++; @@ -626,8 +561,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("Gross! A Sea Leech")) { + } else if (message.contains("Gross! A Sea Leech")) { lc.seaLeeches++; lc.seaCreatures++; lc.fishingMilestone++; @@ -638,8 +572,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("You've discovered a Guardian Defender of the sea")) { + } else if (message.contains("You've discovered a Guardian Defender of the sea")) { lc.guardianDefenders++; lc.seaCreatures++; lc.fishingMilestone++; @@ -650,8 +583,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("You have awoken the Deep Sea Protector, prepare for a battle")) { + } else if (message.contains("You have awoken the Deep Sea Protector, prepare for a battle")) { lc.deepSeaProtectors++; lc.seaCreatures++; lc.fishingMilestone++; @@ -662,8 +594,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("The Water Hydra has come to test your strength")) { + } else if (message.contains("The Water Hydra has come to test your strength")) { lc.hydras++; lc.seaCreatures++; lc.fishingMilestone++; @@ -674,8 +605,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("The Sea Emperor arises from the depths")) { + } else if (message.contains("The Sea Emperor arises from the depths")) { lc.seaEmperors++; lc.seaCreatures++; lc.fishingMilestone++; @@ -691,9 +621,7 @@ public class TheMod cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); cf.writeDoubleConfig("fishing", "empTime", lc.empTime); cf.writeIntConfig("fishing", "empSC", lc.empSCs); - } - // Fishing Winter - if (message.contains("Frozen Steve fell into the pond long ago")) { + } else if (message.contains("Frozen Steve fell into the pond long ago")) { // Fishing Winter lc.frozenSteves++; lc.seaCreatures++; lc.fishingMilestone++; @@ -704,8 +632,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("It's a snowman! He looks harmless")) { + } else if (message.contains("It's a snowman! He looks harmless")) { lc.frostyTheSnowmans++; lc.seaCreatures++; lc.fishingMilestone++; @@ -716,8 +643,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("stole Jerry's Gifts...get them back")) { + } else if (message.contains("stole Jerry's Gifts...get them back")) { lc.grinches++; lc.seaCreatures++; lc.fishingMilestone++; @@ -728,8 +654,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("What is this creature")) { + } else if (message.contains("What is this creature")) { lc.yetis++; lc.seaCreatures++; lc.fishingMilestone++; @@ -745,9 +670,7 @@ public class TheMod cf.writeIntConfig("fishing", "yetiSC", lc.yetiSCs); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); - } - // Fishing Festival - if (message.contains("A tiny fin emerges from the water, you've caught a Nurse Shark")) { + } else if (message.contains("A tiny fin emerges from the water, you've caught a Nurse Shark")) { // Fishing Festival lc.nurseSharks++; lc.seaCreatures++; lc.fishingMilestone++; @@ -758,8 +681,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("You spot a fin as blue as the water it came from, it's a Blue Shark")) { + } else if (message.contains("You spot a fin as blue as the water it came from, it's a Blue Shark")) { lc.blueSharks++; lc.seaCreatures++; lc.fishingMilestone++; @@ -770,8 +692,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("A striped beast bounds from the depths, the wild Tiger Shark")) { + } else if (message.contains("A striped beast bounds from the depths, the wild Tiger Shark")) { lc.tigerSharks++; lc.seaCreatures++; lc.fishingMilestone++; @@ -782,8 +703,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - if (message.contains("Hide no longer, a Great White Shark has tracked your scent and thirsts for your blood")) { + } else if (message.contains("Hide no longer, a Great White Shark has tracked your scent and thirsts for your blood")) { lc.greatWhiteSharks++; lc.seaCreatures++; lc.fishingMilestone++; @@ -794,11 +714,7 @@ public class TheMod cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone); increaseSeaCreatures(); - } - - // Catacombs Dungeons - // Timers - if (message.contains("Dungeon starts in 1 second.")) { + } else if (message.contains("Dungeon starts in 1 second.")) { // Dungeons Stuff dungeonStartTime = System.currentTimeMillis() / 1000; bloodOpenTime = dungeonStartTime; watcherClearTime = dungeonStartTime; @@ -806,22 +722,15 @@ public class TheMod witherDoors = 0; dungeonDeaths = 0; puzzleFails = 0; - } - if (message.contains("The BLOOD DOOR has been opened!")) { + } else if (message.contains("The BLOOD DOOR has been opened!")) { bloodOpenTime = System.currentTimeMillis() / 1000; - } - if (message.contains(" opened a WITHER door!")) { + } else if (message.contains(" opened a WITHER door!")) { witherDoors++; - } - if (message.contains(" and became a ghost.")) { + } else if (message.contains(" and became a ghost.")) { dungeonDeaths++; - } - - // Trackers - if (message.contains(" Defeated ") && message.contains(" in ")) { + } else if (message.contains(" Defeated ") && message.contains(" in ")) { bossClearTime = System.currentTimeMillis() / 1000; - } - if (message.contains("EXTRA STATS ")) { + } else if (message.contains("EXTRA STATS ")) { List scoreboard = ScoreboardHandler.getSidebarLines(); int timeToAdd = 0; for (String s : scoreboard) { @@ -859,130 +768,131 @@ public class TheMod } } } - 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); - } - // F5 - if (message.contains(" Warped Stone")) { - lc.warpedStones++; - lc.warpedStonesSession++; - cf.writeIntConfig("catacombs", "warpedStone", lc.warpedStones); - } - if (message.contains(" Shadow Assassin Helmet")) { - lc.shadowAssHelms++; - lc.shadowAssHelmsSession++; - cf.writeIntConfig("catacombs", "shadowAssassinHelm", lc.shadowAssHelms); - } - if (message.contains(" Shadow Assassin Chestplate")) { - lc.shadowAssChests++; - lc.shadowAssChestsSession++; - cf.writeIntConfig("catacombs", "shadowAssassinChest", lc.shadowAssChests); - } - if (message.contains(" Shadow Assassin Leggings")) { - lc.shadowAssLegs++; - lc.shadowAssLegsSession++; - cf.writeIntConfig("catacombs", "shadowAssassinLegging", lc.shadowAssLegs); + + if (wolfRNG) { + lc.wolfTime = System.currentTimeMillis() / 1000; + lc.wolfBosses = 0; + lc.wolfTimeSession = System.currentTimeMillis() / 1000; + lc.wolfBossesSession = 0; + cf.writeDoubleConfig("wolf", "timeRNG", lc.wolfTime); + cf.writeIntConfig("wolf", "bossRNG", 0); } - if (message.contains(" Shadow Assassin Boots")) { - lc.shadowAssBoots++; - lc.shadowAssBootsSession++; - cf.writeIntConfig("catacombs", "shadowAssassinBoot", lc.shadowAssBoots); + if (spiderRNG) { + lc.spiderTime = System.currentTimeMillis() / 1000; + lc.spiderBosses = 0; + lc.spiderTimeSession = System.currentTimeMillis() / 1000; + lc.spiderBossesSession = 0; + cf.writeDoubleConfig("spider", "timeRNG", lc.spiderTime); + cf.writeIntConfig("spider", "bossRNG", 0); } - if (message.contains(" Livid Dagger")) { - lc.lividDaggers++; - lc.lividDaggersSession++; - cf.writeIntConfig("catacombs", "lividDagger", lc.lividDaggers); + if (zombieRNG) { + lc.zombieTime = System.currentTimeMillis() / 1000; + lc.zombieBosses = 0; + lc.zombieTimeSession = System.currentTimeMillis() / 1000; + lc.zombieBossesSession = 0; + cf.writeDoubleConfig("zombie", "timeRNG", lc.zombieTime); + cf.writeIntConfig("zombie", "bossRNG", 0); } - if (message.contains(" RARE REWARD! Shadow Fury")) { - lc.shadowFurys++; - lc.shadowFurysSession++; - cf.writeIntConfig("catacombs", "shadowFury", lc.shadowFurys); + + // Dungeons Trackers + if (message.contains(" ")) { + if (message.contains("Recombobulator 3000")) { + lc.recombobulators++; + lc.recombobulatorsSession++; + cf.writeIntConfig("catacombs", "recombobulator", lc.recombobulators); + } else if (message.contains("Fuming Potato Book")) { + lc.fumingPotatoBooks++; + lc.fumingPotatoBooksSession++; + cf.writeIntConfig("catacombs", "fumingBooks", lc.fumingPotatoBooks); + } else if (message.contains("Bonzo's Staff")) { // F1 + lc.bonzoStaffs++; + lc.bonzoStaffsSession++; + cf.writeIntConfig("catacombs", "bonzoStaff", lc.bonzoStaffs); + } else if (message.contains("Scarf's Studies")) { // F2 + lc.scarfStudies++; + lc.scarfStudiesSession++; + cf.writeIntConfig("catacombs", "scarfStudies", lc.scarfStudies); + } else if (message.contains("Adaptive Helmet")) { // F3 + lc.adaptiveHelms++; + lc.adaptiveHelmsSession++; + cf.writeIntConfig("catacombs", "adaptiveHelm", lc.adaptiveHelms); + } else if (message.contains("Adaptive Chestplate")) { + lc.adaptiveChests++; + lc.adaptiveChestsSession++; + cf.writeIntConfig("catacombs", "adaptiveChest", lc.adaptiveChests); + } else if (message.contains("Adaptive Leggings")) { + lc.adaptiveLegs++; + lc.adaptiveLegsSession++; + cf.writeIntConfig("catacombs", "adaptiveLegging", lc.adaptiveLegs); + } else if (message.contains("Adaptive Boots")) { + lc.adaptiveBoots++; + lc.adaptiveBootsSession++; + cf.writeIntConfig("catacombs", "adaptiveBoot", lc.adaptiveBoots); + } else if (message.contains("Adaptive Blade")) { + lc.adaptiveSwords++; + lc.adaptiveSwordsSession++; + cf.writeIntConfig("catacombs", "adaptiveSword", lc.adaptiveSwords); + } else if (message.contains("Spirit Wing")) { // F4 + lc.spiritWings++; + lc.spiritWingsSession++; + cf.writeIntConfig("catacombs", "spiritWing", lc.spiritWings); + } else if (message.contains("Spirit Bone")) { + lc.spiritBones++; + lc.spiritBonesSession++; + cf.writeIntConfig("catacombs", "spiritBone", lc.spiritBones); + } else if (message.contains("Spirit Boots")) { + lc.spiritBoots++; + lc.spiritBootsSession++; + cf.writeIntConfig("catacombs", "spiritBoot", lc.spiritBoots); + } else 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); + } + } else if (message.contains("Spirit Sword")) { + lc.spiritSwords++; + lc.spiritSwordsSession++; + cf.writeIntConfig("catacombs", "spiritSword", lc.spiritSwords); + } else if (message.contains("Spirit Bow")) { + lc.spiritBows++; + lc.spiritBowsSession++; + cf.writeIntConfig("catacombs", "spiritBow", lc.spiritBows); + } else if (message.contains("Warped Stone")) { // F5 + lc.warpedStones++; + lc.warpedStonesSession++; + cf.writeIntConfig("catacombs", "warpedStone", lc.warpedStones); + } else if (message.contains("Shadow Assassin Helmet")) { + lc.shadowAssHelms++; + lc.shadowAssHelmsSession++; + cf.writeIntConfig("catacombs", "shadowAssassinHelm", lc.shadowAssHelms); + } else if (message.contains("Shadow Assassin Chestplate")) { + lc.shadowAssChests++; + lc.shadowAssChestsSession++; + cf.writeIntConfig("catacombs", "shadowAssassinChest", lc.shadowAssChests); + } else if (message.contains("Shadow Assassin Leggings")) { + lc.shadowAssLegs++; + lc.shadowAssLegsSession++; + cf.writeIntConfig("catacombs", "shadowAssassinLegging", lc.shadowAssLegs); + } else if (message.contains("Shadow Assassin Boots")) { + lc.shadowAssBoots++; + lc.shadowAssBootsSession++; + cf.writeIntConfig("catacombs", "shadowAssassinBoot", lc.shadowAssBoots); + } else if (message.contains("Livid Dagger")) { + lc.lividDaggers++; + lc.lividDaggersSession++; + cf.writeIntConfig("catacombs", "lividDagger", lc.lividDaggers); + } else if (message.contains("Shadow Fury")) { + lc.shadowFurys++; + lc.shadowFurysSession++; + cf.writeIntConfig("catacombs", "shadowFury", lc.shadowFurys); + } } // Chat Maddox -- cgit From 5ee051205869192a61ee2abdf119ea7b5d4bce14 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 5 Oct 2020 11:02:42 -0400 Subject: Fix puzzle fails not counting --- src/main/java/me/Danker/TheMod.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index a3602aa..68e516b 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -272,7 +272,7 @@ public class TheMod watcherClearTime = System.currentTimeMillis() / 1000; } if (message.contains("PUZZLE FAIL! ") || message.contains("chose the wrong answer! I shall never forget this moment")) { - dungeonDeaths++; + puzzleFails++; } if (message.contains(":")) return; -- cgit From 2a1c6ec74089d247e63e80682b48e1777b9dd388 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 5 Oct 2020 11:42:01 -0400 Subject: Add F6 tracker --- README.md | 4 +- src/main/java/me/Danker/TheMod.java | 90 ++++++++++++++++++++++ src/main/java/me/Danker/commands/DHelpCommand.java | 4 +- .../java/me/Danker/commands/DisplayCommand.java | 12 ++- src/main/java/me/Danker/commands/LootCommand.java | 62 ++++++++++++++- .../java/me/Danker/handlers/ConfigHandler.java | 22 ++++++ 6 files changed, 184 insertions(+), 10 deletions(-) (limited to 'src/main/java') diff --git a/README.md b/README.md index 770e91b..09a2bf0 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,8 @@ Discord Server: https://discord.gg/QsEkNQS - /toggle - Toggles features. /toggle list returns values of every toggle. - /setkey - Sets API key. - /getkey - Returns key set with /setkey and copies it to your clipboard. -- /loot [winter/f(1-5)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. -- /display [winter/f(1-5)/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. +- /loot [winter/f(1-6)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. +- /display [winter/f(1-6)/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. - /resetloot - - Resets loot for trackers. /resetloot confirm confirms the reset. - /move - Moves text display to specified X and Y coordinates. - /scale - Scales text display to a specified multipler between 0.1x and 10x. diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 68e516b..ababc34 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -757,6 +757,10 @@ public class TheMod lc.f5TimeSpent = Math.floor(lc.f5TimeSpent + timeToAdd); lc.f5TimeSpentSession = Math.floor(lc.f5TimeSpentSession + timeToAdd); cf.writeDoubleConfig("catacombs", "floorFiveTime", lc.f5TimeSpent); + } else if (sCleaned.contains("F6")) { + lc.f6TimeSpent = Math.floor(lc.f6TimeSpent + timeToAdd); + lc.f6TimeSpentSession = Math.floor(lc.f6TimeSpentSession + timeToAdd); + cf.writeDoubleConfig("catacombs", "floorSixTime", lc.f6TimeSpent); } } else if (sCleaned.contains("Time Elapsed:")) { // Get floor time @@ -892,6 +896,38 @@ public class TheMod lc.shadowFurys++; lc.shadowFurysSession++; cf.writeIntConfig("catacombs", "shadowFury", lc.shadowFurys); + } else if (message.contains("Ancient Rose")) { // F6 + lc.ancientRoses++; + lc.ancientRosesSession++; + cf.writeIntConfig("catacombs", "ancientRose", lc.ancientRoses); + } else if (message.contains("Precursor Eye")) { + lc.precursorEyes++; + lc.precursorEyesSession++; + cf.writeIntConfig("catacombs", "precursorEye", lc.precursorEyes); + } else if (message.contains("Giant's Sword")) { + lc.giantsSwords++; + lc.giantsSwordsSession++; + cf.writeIntConfig("catacombs", "giantsSword", lc.giantsSwords); + } else if (message.contains("Necromancer Lord Helmet")) { + lc.necroLordHelms++; + lc.necroLordHelmsSession++; + cf.writeIntConfig("catacombs", "necroLordHelm", lc.necroLordHelms); + } else if (message.contains("Necromancer Lord Chestplate")) { + lc.necroLordChests++; + lc.necroLordChestsSession++; + cf.writeIntConfig("catacombs", "necroLordChest", lc.necroLordChests); + } else if (message.contains("Necromancer Lord Leggings")) { + lc.necroLordLegs++; + lc.necroLordLegsSession++; + cf.writeIntConfig("catacombs", "necroLordLegging", lc.necroLordLegs); + } else if (message.contains("Necromancer Lord Boots")) { + lc.necroLordBoots++; + lc.necroLordBootsSession++; + cf.writeIntConfig("catacombs", "necroLordBoot", lc.necroLordBoots); + } else if (message.contains("Necromancer Sword")) { + lc.necroSwords++; + lc.necroSwordsSession++; + cf.writeIntConfig("catacombs", "necroSword", lc.necroSwords); } } @@ -1608,6 +1644,56 @@ public class TheMod EnumChatFormatting.GOLD + nf.format(lc.shadowFurysSession) + "\n" + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f5CoinsSpentSession) + "\n" + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f5TimeSpentSession); + } else if (ds.display.equals("catacombs_floor_six")) { + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.BLUE + "Ancient Roses:\n" + + EnumChatFormatting.GOLD + "Precursor Eyes:\n" + + EnumChatFormatting.GOLD + "Giant's Swords:\n" + + EnumChatFormatting.GOLD + "Necro Lord Helmets:\n" + + EnumChatFormatting.GOLD + "Necro Lord Chests:\n" + + EnumChatFormatting.GOLD + "Necro Lord Leggings:\n" + + EnumChatFormatting.GOLD + "Necro Lord Boots:\n" + + EnumChatFormatting.GOLD + "Necro Swords:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooks) + "\n" + + EnumChatFormatting.BLUE + nf.format(lc.ancientRoses) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.precursorEyes) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.giantsSwords) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.necroLordHelms) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.necroLordChests) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.necroLordLegs) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.necroLordBoots) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.necroSwords) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f6CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f6TimeSpent); + } else if (ds.display.equals("catacombs_floor_six_session")) { + dropsText = EnumChatFormatting.GOLD + "Recombobulators:\n" + + EnumChatFormatting.DARK_PURPLE + "Fuming Potato Books:\n" + + EnumChatFormatting.BLUE + "Ancient Roses:\n" + + EnumChatFormatting.GOLD + "Precursor Eyes:\n" + + EnumChatFormatting.GOLD + "Giant's Swords:\n" + + EnumChatFormatting.GOLD + "Necro Lord Helmets:\n" + + EnumChatFormatting.GOLD + "Necro Lord Chests:\n" + + EnumChatFormatting.GOLD + "Necro Lord Leggings:\n" + + EnumChatFormatting.GOLD + "Necro Lord Boots:\n" + + EnumChatFormatting.GOLD + "Necro Swords:\n" + + EnumChatFormatting.AQUA + "Coins Spent:\n" + + EnumChatFormatting.AQUA + "Time Spent:"; + countText = EnumChatFormatting.GOLD + nf.format(lc.recombobulatorsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(lc.ancientRosesSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.precursorEyesSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.giantsSwordsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.necroLordHelmsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.necroLordChestsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.necroLordLegsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.necroLordBootsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.necroSwordsSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getMoneySpent(lc.f6CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, lc.f6TimeSpentSession); } else { ConfigHandler cf = new ConfigHandler(); @@ -1815,6 +1901,10 @@ public class TheMod lc.f5CoinsSpent += coinsSpent; lc.f5CoinsSpentSession += coinsSpent; cf.writeDoubleConfig("catacombs", "floorFiveCoins", lc.f5CoinsSpent); + } else if (sCleaned.contains("F6")) { + lc.f6CoinsSpent += coinsSpent; + lc.f6CoinsSpentSession += coinsSpent; + cf.writeDoubleConfig("catacombs", "floorSixCoins", lc.f6CoinsSpent); } break; } diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index ecb327e..d9e6d21 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -36,8 +36,8 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + - EnumChatFormatting.GOLD + " /loot [winter/f(1-5)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + - EnumChatFormatting.GOLD + " /display [winter/f(1-5)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead.\n" + + EnumChatFormatting.GOLD + " /loot [winter/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + + EnumChatFormatting.GOLD + " /display [winter/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead.\n" + EnumChatFormatting.GOLD + " /resetloot " + EnumChatFormatting.AQUA + " - Resets loot for trackers. /resetloot confirm confirms the reset.\n" + EnumChatFormatting.GOLD + " /move " + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + EnumChatFormatting.GOLD + " /scale " + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index a0b49d6..271b172 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() + " [winter/festival/session/f(1-5)]"; + return "/" + getCommandName() + " [winter/festival/session/f(1-6)]"; } @Override @@ -36,7 +36,7 @@ public class DisplayCommand extends CommandBase { } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { return getListOfStringsMatchingLastWord(args, "winter", "festival", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { - return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5"); + return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6"); } else if (args.length > 1 || (args.length == 3 && args[0].equalsIgnoreCase("fishing") && args[1].equalsIgnoreCase("winter"))) { return getListOfStringsMatchingLastWord(args, "session"); } @@ -130,8 +130,14 @@ public class DisplayCommand extends CommandBase { } else { display = "catacombs_floor_five"; } + } else if (arg1[1].equalsIgnoreCase("f6") || arg1[1].equalsIgnoreCase("floor6")) { + if (showSession) { + display = "catacombs_floor_six_session"; + } else { + display = "catacombs_floor_six"; + } } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display catacombs ")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display catacombs ")); return; } } else if (arg1[0].equalsIgnoreCase("off")) { diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index 0d8f3b8..bbe4f73 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -128,6 +128,17 @@ public class LootCommand extends CommandBase { public static int shadowFurys; public static double f5CoinsSpent; public static double f5TimeSpent; + // F6 + public static int ancientRoses; + public static int precursorEyes; + public static int giantsSwords; + public static int necroLordHelms; + public static int necroLordChests; + public static int necroLordLegs; + public static int necroLordBoots; + public static int necroSwords; + public static double f6CoinsSpent; + public static double f6TimeSpent; // Single sessions (No config saves) // Wolf @@ -244,6 +255,17 @@ public class LootCommand extends CommandBase { public static int shadowFurysSession = 0; public static double f5CoinsSpentSession = 0; public static double f5TimeSpentSession = 0; + // F6 + public static int ancientRosesSession = 0; + public static int precursorEyesSession = 0; + public static int giantsSwordsSession = 0; + public static int necroLordHelmsSession = 0; + public static int necroLordChestsSession = 0; + public static int necroLordLegsSession = 0; + public static int necroLordBootsSession = 0; + public static int necroSwordsSession = 0; + public static double f6CoinsSpentSession = 0; + public static double f6TimeSpentSession = 0; @Override public String getCommandName() { @@ -252,7 +274,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [winter/festival/f(1-5)/session]"; + return "/" + getCommandName() + " [winter/festival/f(1-6)/session]"; } @Override @@ -267,7 +289,7 @@ public class LootCommand extends CommandBase { } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { return getListOfStringsMatchingLastWord(args, "winter", "festival", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { - return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5"); + return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6"); } else if (args.length > 1 || (args.length == 3 && args[0].equalsIgnoreCase("fishing") && args[1].equalsIgnoreCase("winter"))) { return getListOfStringsMatchingLastWord(args, "session"); } @@ -766,8 +788,42 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f5CoinsSpent) + "\n" + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f5TimeSpent) + "\n" + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); + } else if (arg1[1].equalsIgnoreCase("f6") || arg1[1].equalsIgnoreCase("floor6")) { + if (showSession) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Catacombs F6 Summary (Current Session):\n" + + EnumChatFormatting.GOLD + " Recombobulator 3000s: " + nf.format(recombobulatorsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Fuming Potato Books: " + nf.format(fumingPotatoBooksSession) + "\n" + + EnumChatFormatting.BLUE + " Ancient Roses: " + nf.format(ancientRosesSession) + "\n" + + EnumChatFormatting.GOLD + " Precursor Eyes: " + nf.format(precursorEyesSession) + "\n" + + EnumChatFormatting.GOLD + " Giant's Swords: " + nf.format(giantsSwordsSession) + "\n" + + EnumChatFormatting.GOLD + " Necro Lord Helmets: " + nf.format(necroLordHelmsSession) + "\n" + + EnumChatFormatting.GOLD + " Necro Lord Chestplates: " + nf.format(necroLordChestsSession) + "\n" + + EnumChatFormatting.GOLD + " Necro Lord Leggings: " + nf.format(necroLordLegsSession) + "\n" + + EnumChatFormatting.GOLD + " Necro Lord Boots: " + nf.format(necroLordBootsSession) + "\n" + + EnumChatFormatting.GOLD + " Necro Swords: " + nf.format(necroSwordsSession) + "\n" + + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f6CoinsSpentSession) + "\n" + + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f6TimeSpentSession) + "\n" + + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); + return; + } + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " Catacombs F6 Summary:\n" + + EnumChatFormatting.GOLD + " Recombobulator 3000s: " + nf.format(recombobulators) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Fuming Potato Books: " + nf.format(fumingPotatoBooks) + "\n" + + EnumChatFormatting.BLUE + " Ancient Roses: " + nf.format(ancientRoses) + "\n" + + EnumChatFormatting.GOLD + " Precursor Eyes: " + nf.format(precursorEyes) + "\n" + + EnumChatFormatting.GOLD + " Giant's Swords: " + nf.format(giantsSwords) + "\n" + + EnumChatFormatting.GOLD + " Necro Lord Helmets: " + nf.format(necroLordHelms) + "\n" + + EnumChatFormatting.GOLD + " Necro Lord Chestplates: " + nf.format(necroLordChests) + "\n" + + EnumChatFormatting.GOLD + " Necro Lord Leggings: " + nf.format(necroLordLegs) + "\n" + + EnumChatFormatting.GOLD + " Necro Lord Boots: " + nf.format(necroLordBoots) + "\n" + + EnumChatFormatting.GOLD + " Necro Swords: " + nf.format(necroSwords) + "\n" + + EnumChatFormatting.AQUA + " Coins Spent: " + Utils.getMoneySpent(f6CoinsSpent) + "\n" + + EnumChatFormatting.AQUA + " Time Spent: " + Utils.getTimeBetween(0, f6TimeSpent) + "\n" + + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot catacombs ")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot catacombs ")); } } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 4138fcb..dede01f 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -303,6 +303,17 @@ public class ConfigHandler { if (!hasKey("catacombs", "shadowFury")) writeIntConfig("catacombs", "shadowFury", 0); if (!hasKey("catacombs", "floorFiveCoins")) writeDoubleConfig("catacombs", "floorFiveCoins", 0); if (!hasKey("catacombs", "floorFiveTime")) writeDoubleConfig("catacombs", "floorFiveTime", 0); + // F6 + if (!hasKey("catacombs", "ancientRose")) writeIntConfig("catacombs", "ancientRose", 0); + if (!hasKey("catacombs", "precursorEye")) writeIntConfig("catacombs", "precursorEye", 0); + if (!hasKey("catacombs", "giantsSword")) writeIntConfig("catacombs", "giantsSword", 0); + if (!hasKey("catacombs", "necroLordHelm")) writeIntConfig("catacombs", "necroHelm", 0); + if (!hasKey("catacombs", "necroLordChest")) writeIntConfig("catacombs", "necroChest", 0); + if (!hasKey("catacombs", "necroLordLegging")) writeIntConfig("catacombs", "necroLegging", 0); + if (!hasKey("catacombs", "necroLordBoot")) writeIntConfig("catacombs", "necroBoot", 0); + if (!hasKey("catacombs", "necroSword")) writeIntConfig("catacombs", "necroSword", 0); + if (!hasKey("catacombs", "floorSixCoins")) writeDoubleConfig("catacombs", "floorSixCoins", 0); + if (!hasKey("catacombs", "floorSixTime")) writeDoubleConfig("catacombs", "floorSixTime", 0); if (!hasKey("misc", "display")) writeStringConfig("misc", "display", "off"); @@ -460,6 +471,17 @@ public class ConfigHandler { lc.shadowFurys = getInt("catacombs", "shadowFury"); lc.f5CoinsSpent = getDouble("catacombs", "floorFiveCoins"); lc.f5TimeSpent = getDouble("catacombs", "floorFiveTime"); + // F6 + lc.ancientRoses = getInt("catacombs", "ancientRose"); + lc.precursorEyes = getInt("catacombs", "precursorEye"); + lc.giantsSwords = getInt("catacombs", "giantsSword"); + lc.necroLordHelms = getInt("catacombs", "necroLordHelm"); + lc.necroLordChests = getInt("catacombs", "necroLordChest"); + lc.necroLordLegs = getInt("catacombs", "necroLordLegging"); + lc.necroLordBoots = getInt("catacombs", "necroLordBoot"); + lc.necroSwords = getInt("catacombs", "necroSword"); + lc.f6CoinsSpent = getDouble("catacombs", "floorSixCoins"); + lc.f6TimeSpent = getDouble("catacombs", "floorSixTime"); final DisplayCommand ds = new DisplayCommand(); ds.display = getString("misc", "display"); -- cgit From 0379a3c43be18b22d77056eb5b26b4f239d9988e Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 5 Oct 2020 18:19:52 -0400 Subject: Add auto slayer tracker display --- README.md | 2 +- src/main/java/me/Danker/TheMod.java | 30 ++++++++++++++++++---- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/DisplayCommand.java | 12 +++++++-- .../java/me/Danker/handlers/ConfigHandler.java | 2 ++ 5 files changed, 39 insertions(+), 9 deletions(-) (limited to 'src/main/java') diff --git a/README.md b/README.md index 09a2bf0..e16f853 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Discord Server: https://discord.gg/QsEkNQS - /setkey - Sets API key. - /getkey - Returns key set with /setkey and copies it to your clipboard. - /loot [winter/f(1-6)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. -- /display [winter/f(1-6)/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. +- /display [winter/f(1-6)/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. - /resetloot - - Resets loot for trackers. /resetloot confirm confirms the reset. - /move - Moves text display to specified X and Y coordinates. - /scale - Scales text display to a specified multipler between 0.1x and 10x. diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index ababc34..973a0da 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -56,6 +56,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; @@ -1804,14 +1805,33 @@ public class TheMod // Check if player is in Skyblock every second tickAmount++; if (tickAmount % 20 == 0) { - EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; + if (player != null) { Utils.checkForSkyblock(); - // if (Utils.inSkyblock) { - // System.out.println("Autosyncing inventory to server..."); - // player.inventoryContainer.detectAndSendChanges(); // Spirit boot fix every 1 second - // } } + + if (DisplayCommand.auto && mc != null && mc.theWorld != null) { + List scoreboard = ScoreboardHandler.getSidebarLines(); + boolean found = false; + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("Sven Packmaster")) { + DisplayCommand.display = "wolf"; + found = true; + } else if (sCleaned.contains("Tarantula Broodfather")) { + DisplayCommand.display = "spider"; + found = true; + } else if (sCleaned.contains("Revenant Horror")) { + DisplayCommand.display = "zombie"; + found = true; + } + } + if (!found) DisplayCommand.display = "off"; + ConfigHandler.writeStringConfig("misc", "display", DisplayCommand.display); + } + tickAmount = 0; } diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index d9e6d21..65cff49 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -37,7 +37,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + EnumChatFormatting.GOLD + " /loot [winter/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + - EnumChatFormatting.GOLD + " /display [winter/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead.\n" + + EnumChatFormatting.GOLD + " /display [winter/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active.\n" + EnumChatFormatting.GOLD + " /resetloot " + EnumChatFormatting.AQUA + " - Resets loot for trackers. /resetloot confirm confirms the reset.\n" + EnumChatFormatting.GOLD + " /move " + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + EnumChatFormatting.GOLD + " /scale " + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index 271b172..b96ab2b 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/me/Danker/commands/DisplayCommand.java @@ -13,6 +13,7 @@ import net.minecraft.util.EnumChatFormatting; public class DisplayCommand extends CommandBase { public static String display; + public static boolean auto; @Override public String getCommandName() { @@ -21,7 +22,7 @@ public class DisplayCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " [winter/festival/session/f(1-6)]"; + return "/" + getCommandName() + " [winter/festival/session/f(1-6)]"; } @Override @@ -32,7 +33,7 @@ public class DisplayCommand extends CommandBase { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing", "catacombs", "off"); + return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing", "catacombs", "auto", "off"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { return getListOfStringsMatchingLastWord(args, "winter", "festival", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { @@ -140,13 +141,20 @@ public class DisplayCommand extends CommandBase { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display catacombs ")); return; } + } else if (arg1[0].equalsIgnoreCase("auto")) { + auto = true; + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Display set to " + EnumChatFormatting.DARK_GREEN + "auto" + EnumChatFormatting.GREEN + ".")); + cf.writeBooleanConfig("misc", "autoDisplay", true); + return; } else if (arg1[0].equalsIgnoreCase("off")) { display = "off"; } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); return; } + auto = false; player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Display set to " + EnumChatFormatting.DARK_GREEN + display + EnumChatFormatting.GREEN + ".")); + cf.writeBooleanConfig("misc", "autoDisplay", false); cf.writeStringConfig("misc", "display", display); } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index dede01f..0c839d1 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -316,6 +316,7 @@ public class ConfigHandler { if (!hasKey("catacombs", "floorSixTime")) writeDoubleConfig("catacombs", "floorSixTime", 0); if (!hasKey("misc", "display")) writeStringConfig("misc", "display", "off"); + if (!hasKey("misc", "autoDisplay")) writeBooleanConfig("misc", "autoDisplay", false); ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft()); int height = scaled.getScaledHeight(); @@ -485,6 +486,7 @@ public class ConfigHandler { final DisplayCommand ds = new DisplayCommand(); ds.display = getString("misc", "display"); + ds.auto = getBoolean("misc", "autoDisplay"); final MoveCommand moc = new MoveCommand(); moc.coordsXY[0] = getInt("locations", "coordsX"); -- cgit From a0ab465c3d39eac177f45d2b2f6903a27be3ba61 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 6 Oct 2020 11:39:43 -0400 Subject: Fix skill50display freezing action bar --- src/main/java/me/Danker/TheMod.java | 2 +- src/main/java/me/Danker/handlers/ScoreboardHandler.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 973a0da..5af08ac 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -243,7 +243,7 @@ public class TheMod String[] actionBarSections = event.message.getUnformattedText().split(" {3,}"); for (String section : actionBarSections) { if (tc.skill50DisplayToggled) { - if (section.contains("(")) { + if (section.contains("+") && section.contains("/") && section.contains("(")) { if (section.contains("Runecrafting")) return; String xpGained = section.substring(section.indexOf("+"), section.indexOf("(") - 1); diff --git a/src/main/java/me/Danker/handlers/ScoreboardHandler.java b/src/main/java/me/Danker/handlers/ScoreboardHandler.java index e89591b..92fc844 100644 --- a/src/main/java/me/Danker/handlers/ScoreboardHandler.java +++ b/src/main/java/me/Danker/handlers/ScoreboardHandler.java @@ -41,7 +41,7 @@ public class ScoreboardHandler { Collection scores = scoreboard.getSortedScores(objective); List list = Lists.newArrayList(scores.stream() .filter(input -> input != null && input.getPlayerName() != null && !input.getPlayerName() - .startsWith("#")) + .startsWith("#")) .collect(Collectors.toList())); if (list.size() > 15) { -- cgit From 5d477d9d06933c7a52ea5df17160b89391387872 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 6 Oct 2020 21:02:00 -0400 Subject: Add ability to outline text in the style of SBA --- README.md | 2 +- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- src/main/java/me/Danker/commands/ToggleCommand.java | 12 +++++++++--- src/main/java/me/Danker/handlers/ConfigHandler.java | 2 ++ src/main/java/me/Danker/handlers/TextRenderer.java | 13 ++++++++++++- 5 files changed, 25 insertions(+), 6 deletions(-) (limited to 'src/main/java') diff --git a/README.md b/README.md index e16f853..8cf9471 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Discord Server: https://discord.gg/QsEkNQS ## Commands - /dhelp - Returns this message in-game. -- /toggle - Toggles features. /toggle list returns values of every toggle. +- /toggle - Toggles features. /toggle list returns values of every toggle. - /setkey - Sets API key. - /getkey - Returns key set with /setkey and copies it to your clipboard. - /loot [winter/f(1-6)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 65cff49..57cffa3 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -33,7 +33,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.AQUA + " <> = Mandatory parameter. [] = Optional parameter.\n" + EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + - EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + EnumChatFormatting.GOLD + " /loot [winter/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 0172ab1..affa5cf 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -28,6 +28,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean golemAlertToggled; public static boolean expertiseLoreToggled; public static boolean skill50DisplayToggled; + public static boolean outlineTextToggled; @Override public String getCommandName() { @@ -36,7 +37,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " "; + return "/" + getCommandName() + " "; } @Override @@ -47,7 +48,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "list"); + return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "list"); } return null; } @@ -122,6 +123,10 @@ public class ToggleCommand extends CommandBase implements ICommand { skill50DisplayToggled = !skill50DisplayToggled; cf.writeBooleanConfig("toggles", "Skill50Display", skill50DisplayToggled); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Skill 50 display has been set to " + EnumChatFormatting.DARK_GREEN + skill50DisplayToggled + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("outlinetext")) { + outlineTextToggled = !outlineTextToggled; + cf.writeBooleanConfig("toggles", "OutlineText", outlineTextToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Outline displayed text has been set to " + EnumChatFormatting.DARK_GREEN + outlineTextToggled + 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" + @@ -137,7 +142,8 @@ public class ToggleCommand extends CommandBase implements ICommand { EnumChatFormatting.GREEN + " Dungeon timer: " + EnumChatFormatting.DARK_GREEN + dungeonTimerToggled + "\n" + EnumChatFormatting.GREEN + " Golem spawn alerts: " + EnumChatFormatting.DARK_GREEN + golemAlertToggled + "\n" + EnumChatFormatting.GREEN + " Expertise in lore: " + EnumChatFormatting.DARK_GREEN + expertiseLoreToggled + "\n" + - EnumChatFormatting.GREEN + " Skill 50 display: " + EnumChatFormatting.DARK_GREEN + skill50DisplayToggled)); + EnumChatFormatting.GREEN + " Skill 50 display: " + EnumChatFormatting.DARK_GREEN + skill50DisplayToggled + "\n" + + EnumChatFormatting.GREEN + " Outline displayed text: " + EnumChatFormatting.DARK_GREEN + outlineTextToggled)); } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 0c839d1..fcb33b2 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -186,6 +186,7 @@ public class ConfigHandler { if (!hasKey("toggles", "GolemAlerts")) writeBooleanConfig("toggles", "GolemAlerts", false); if (!hasKey("toggles", "ExpertiseLore")) writeBooleanConfig("toggles", "ExpertiseLore", true); if (!hasKey("toggles", "Skill50Display")) writeBooleanConfig("toggles", "Skill50Display", false); + if (!hasKey("toggles", "OutlineText")) writeBooleanConfig("toggles", "OutlineText", false); if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); @@ -349,6 +350,7 @@ public class ConfigHandler { tf.golemAlertToggled = getBoolean("toggles", "GolemAlerts"); tf.expertiseLoreToggled = getBoolean("toggles", "ExpertiseLore"); tf.skill50DisplayToggled = getBoolean("toggles", "Skill50Display"); + tf.outlineTextToggled = getBoolean("toggles", "OutlineText"); final BlockSlayerCommand bs = new BlockSlayerCommand(); String onlySlayer = getString("toggles", "BlockSlayer"); diff --git a/src/main/java/me/Danker/handlers/TextRenderer.java b/src/main/java/me/Danker/handlers/TextRenderer.java index bf5711d..0e965e6 100644 --- a/src/main/java/me/Danker/handlers/TextRenderer.java +++ b/src/main/java/me/Danker/handlers/TextRenderer.java @@ -2,8 +2,10 @@ package me.Danker.handlers; import org.lwjgl.opengl.GL11; +import me.Danker.commands.ToggleCommand; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; +import net.minecraft.util.StringUtils; public class TextRenderer extends Gui { public TextRenderer(Minecraft mc, String text, int x, int y, double scale) { @@ -13,7 +15,16 @@ public class TextRenderer extends Gui { y -= mc.fontRendererObj.FONT_HEIGHT; for (String line : text.split("\n")) { y += mc.fontRendererObj.FONT_HEIGHT * scale; - drawString(mc.fontRendererObj, line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF); + if (ToggleCommand.outlineTextToggled) { + String noColorLine = StringUtils.stripControlCodes(line); + mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale) - 1, (int) Math.round(y / scale), 0x000000, false); + mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale) + 1, (int) Math.round(y / scale), 0x000000, false); + mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale), (int) Math.round(y / scale) - 1, 0x000000, false); + mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale), (int) Math.round(y / scale) + 1, 0x000000, false); + mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, false); + } else { + mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, true); + } } GL11.glScaled(scaleReset, scaleReset, scaleReset); } -- cgit From 68111a9d9c9d403436dc2041010f337580d48d60 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 9 Oct 2020 10:54:39 -0400 Subject: Add GUI: /dsm No GUI for moving or scaling displays yet --- README.md | 1 + src/main/java/me/Danker/TheMod.java | 29 ++- src/main/java/me/Danker/commands/DHelpCommand.java | 1 + .../java/me/Danker/commands/DankerGuiCommand.java | 32 ++++ src/main/java/me/Danker/gui/DankerGui.java | 194 +++++++++++++++++++++ src/main/java/me/Danker/gui/DisplayGui.java | 155 ++++++++++++++++ src/main/java/me/Danker/gui/EditLocationsGui.java | 112 ++++++++++++ src/main/java/me/Danker/gui/OnlySlayerGui.java | 129 ++++++++++++++ src/main/java/me/Danker/utils/Utils.java | 5 + 9 files changed, 657 insertions(+), 1 deletion(-) create mode 100644 src/main/java/me/Danker/commands/DankerGuiCommand.java create mode 100644 src/main/java/me/Danker/gui/DankerGui.java create mode 100644 src/main/java/me/Danker/gui/DisplayGui.java create mode 100644 src/main/java/me/Danker/gui/EditLocationsGui.java create mode 100644 src/main/java/me/Danker/gui/OnlySlayerGui.java (limited to 'src/main/java') diff --git a/README.md b/README.md index 8cf9471..607e4ea 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Discord Server: https://discord.gg/QsEkNQS ## Commands - /dhelp - Returns this message in-game. +- /dsm - Opens the GUI for Danker's Skyblock Mod. - /toggle - Toggles features. /toggle list returns values of every toggle. - /setkey - Sets API key. - /getkey - Returns key set with /setkey and copies it to your clipboard. diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 5af08ac..f7b7763 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -21,6 +21,7 @@ import me.Danker.commands.BankCommand; import me.Danker.commands.BlockSlayerCommand; import me.Danker.commands.ChatMaddoxCommand; import me.Danker.commands.DHelpCommand; +import me.Danker.commands.DankerGuiCommand; import me.Danker.commands.DisplayCommand; import me.Danker.commands.DungeonsCommand; import me.Danker.commands.GetkeyCommand; @@ -38,6 +39,10 @@ import me.Danker.commands.SkillsCommand; import me.Danker.commands.SkyblockPlayersCommand; import me.Danker.commands.SlayerCommand; import me.Danker.commands.ToggleCommand; +import me.Danker.gui.DankerGui; +import me.Danker.gui.DisplayGui; +import me.Danker.gui.EditLocationsGui; +import me.Danker.gui.OnlySlayerGui; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.ScoreboardHandler; @@ -56,7 +61,6 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; @@ -106,6 +110,7 @@ public class TheMod static KeyBinding[] keyBindings = new KeyBinding[1]; static int lastMouse = -1; static boolean usingLabymod = false; + public static String guiToOpen = null; static double dungeonStartTime = 0; static double bloodOpenTime = 0; @@ -187,6 +192,7 @@ public class TheMod ClientCommandHandler.instance.registerCommand(new BlockSlayerCommand()); ClientCommandHandler.instance.registerCommand(new DungeonsCommand()); ClientCommandHandler.instance.registerCommand(new LobbySkillsCommand()); + ClientCommandHandler.instance.registerCommand(new DankerGuiCommand()); } @EventHandler @@ -974,6 +980,8 @@ public class TheMod final MoveCommand moc = new MoveCommand(); final DisplayCommand ds = new DisplayCommand(); + if (Minecraft.getMinecraft().currentScreen instanceof EditLocationsGui) return; + if (tc.coordsToggled) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; @@ -1849,6 +1857,25 @@ public class TheMod } } + // Delay GUI by 1 tick + @SubscribeEvent + public void onRenderTick(TickEvent.RenderTickEvent event) { + if (guiToOpen != null) { + Minecraft mc = Minecraft.getMinecraft(); + if (guiToOpen.startsWith("dankergui")) { + int page = Character.getNumericValue(guiToOpen.charAt(guiToOpen.length() - 1)); + mc.displayGuiScreen(new DankerGui(page)); + } else if (guiToOpen.equals("displaygui")) { + mc.displayGuiScreen(new DisplayGui()); + } else if (guiToOpen.equals("onlyslayergui")) { + mc.displayGuiScreen(new OnlySlayerGui()); + } else if (guiToOpen.equals("editlocations")) { + mc.displayGuiScreen(new EditLocationsGui()); + } + guiToOpen = null; + } + } + @SubscribeEvent public void onInteract(PlayerInteractEvent event) { if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return; diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 57cffa3..32b7d4b 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -33,6 +33,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.AQUA + " <> = Mandatory parameter. [] = Optional parameter.\n" + EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + + EnumChatFormatting.GOLD + " /dsm" + EnumChatFormatting.AQUA + " - Opens the GUI for Danker's Skyblock Mod.\n" + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java new file mode 100644 index 0000000..ef39d24 --- /dev/null +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -0,0 +1,32 @@ +package me.Danker.commands; + +import me.Danker.TheMod; +import me.Danker.gui.DankerGui; +import net.minecraft.client.Minecraft; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; + +public class DankerGuiCommand extends CommandBase { + + @Override + public String getCommandName() { + return "dsm"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return null; + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } + + @Override + public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { + TheMod.guiToOpen = "dankergui1"; + } + +} diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java new file mode 100644 index 0000000..502bcb6 --- /dev/null +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -0,0 +1,194 @@ +package me.Danker.gui; + +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import me.Danker.TheMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.handlers.ConfigHandler; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiConfirmOpenLink; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; + +public class DankerGui extends GuiScreen { + + private int page; + + private GuiButton closeGUI; + private GuiButton backPage; + private GuiButton nextPage; + private GuiButton githubLink; + private GuiButton discordLink; + private GuiButton changeDisplay; + private GuiButton onlySlayer; + // Toggles + private GuiButton gparty; + private GuiButton coords; + private GuiButton goldenEnch; + private GuiButton slayerCount; + private GuiButton rngesusAlert; + private GuiButton splitFishing; + private GuiButton chatMaddox; + private GuiButton spiritBearAlert; + private GuiButton aotd; + private GuiButton sceptreMessages; + private GuiButton petColours; + private GuiButton dungeonTimer; + private GuiButton golemAlerts; + private GuiButton expertiseLore; + private GuiButton skill50Display; + private GuiButton outlineText; + + public DankerGui(int page) { + this.page = page; + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int height = sr.getScaledHeight(); + int width = sr.getScaledWidth(); + + // Default button size is 200, 20 + closeGUI = new GuiButton(0, width / 2 - 100, (int) (height * 0.9), "Close"); + backPage = new GuiButton(0, width / 2 - 100, (int) (height * 0.8), 80, 20, "< Back"); + nextPage = new GuiButton(0, width / 2 + 20, (int) (height * 0.8), 80, 20, "Next >"); + githubLink = new GuiButton(0, 2, height - 50, 80, 20, "GitHub"); + discordLink = new GuiButton(0, 2, height - 30, 80, 20, "Discord"); + + // Page 1 + changeDisplay = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Change Display Settings"); + onlySlayer = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Set Slayer Quest"); + outlineText = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Outline Displayed Text: " + Utils.getColouredBoolean(ToggleCommand.outlineTextToggled)); + gparty = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); + coords = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Coordinate/Angle Display: " + Utils.getColouredBoolean(ToggleCommand.coordsToggled)); + goldenEnch = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); + slayerCount = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal)); + // Page 2 + aotd = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Disable AOTD Ability: " + Utils.getColouredBoolean(ToggleCommand.aotdToggled)); + sceptreMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Enable Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); + petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); + dungeonTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); + golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); + expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); + skill50Display = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled)); + + if (page == 1) { + this.buttonList.add(changeDisplay); + this.buttonList.add(onlySlayer); + this.buttonList.add(outlineText); + this.buttonList.add(gparty); + this.buttonList.add(coords); + this.buttonList.add(goldenEnch); + this.buttonList.add(slayerCount); + this.buttonList.add(nextPage); + this.buttonList.add(closeGUI); + } else if (page == 2) { + this.buttonList.add(aotd); + this.buttonList.add(sceptreMessages); + this.buttonList.add(petColours); + this.buttonList.add(dungeonTimer); + this.buttonList.add(golemAlerts); + this.buttonList.add(expertiseLore); + this.buttonList.add(skill50Display); + this.buttonList.add(backPage); + this.buttonList.add(closeGUI); + } + this.buttonList.add(githubLink); + this.buttonList.add(discordLink); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + @Override + public void actionPerformed(GuiButton button) { + if (button == closeGUI) { + Minecraft.getMinecraft().thePlayer.closeScreen(); + } else if (button == nextPage) { + TheMod.guiToOpen = "dankergui" + (page + 1); + } else if (button == backPage) { + TheMod.guiToOpen = "dankergui" + (page - 1); + } else if (button == githubLink) { + try { + Desktop.getDesktop().browse(new URI("https://github.com/bowser0000/SkyblockMod")); + } catch (IOException | URISyntaxException ex) { + System.err.println(ex); + } + } else if (button == discordLink) { + try { + Desktop.getDesktop().browse(new URI("https://discord.gg/QsEkNQS")); + } catch (IOException | URISyntaxException ex) { + System.err.println(ex); + } + } else if (button == changeDisplay) { + TheMod.guiToOpen = "displaygui"; + } else if (button == onlySlayer) { + TheMod.guiToOpen = "onlyslayergui"; + } else if (button == outlineText) { + ToggleCommand.outlineTextToggled = !ToggleCommand.outlineTextToggled; + ConfigHandler.writeBooleanConfig("toggles", "OutlineText", ToggleCommand.outlineTextToggled); + outlineText.displayString = "Outline Displayed Text: " + Utils.getColouredBoolean(ToggleCommand.outlineTextToggled); + } else if (button == gparty) { + ToggleCommand.gpartyToggled = !ToggleCommand.gpartyToggled; + ConfigHandler.writeBooleanConfig("toggles", "GParty", ToggleCommand.gpartyToggled); + gparty.displayString = "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled); + } else if (button == coords) { + ToggleCommand.coordsToggled = !ToggleCommand.coordsToggled; + ConfigHandler.writeBooleanConfig("toggles", "Coords", ToggleCommand.coordsToggled); + coords.displayString = "Coordinate/Angle Display: " + Utils.getColouredBoolean(ToggleCommand.coordsToggled); + } else if (button == goldenEnch) { + ToggleCommand.goldenToggled = !ToggleCommand.goldenToggled; + ConfigHandler.writeBooleanConfig("toggles", "Golden", ToggleCommand.goldenToggled); + goldenEnch.displayString = "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled); + } else if (button == slayerCount) { + ToggleCommand.slayerCountTotal = !ToggleCommand.slayerCountTotal; + ConfigHandler.writeBooleanConfig("toggles", "SlayerCount", ToggleCommand.slayerCountTotal); + slayerCount.displayString = "Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal); + } else if (button == aotd) { + ToggleCommand.aotdToggled = !ToggleCommand.aotdToggled; + ConfigHandler.writeBooleanConfig("toggles", "AOTD", ToggleCommand.aotdToggled); + aotd.displayString = "Disable AOTD Ability: " + Utils.getColouredBoolean(ToggleCommand.aotdToggled); + } else if (button == sceptreMessages) { + ToggleCommand.sceptreMessages = !ToggleCommand.sceptreMessages; + ConfigHandler.writeBooleanConfig("toggles", "SceptreMessages", ToggleCommand.sceptreMessages); + sceptreMessages.displayString = "Enable Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages); + } else if (button == petColours) { + ToggleCommand.petColoursToggled = !ToggleCommand.petColoursToggled; + ConfigHandler.writeBooleanConfig("toggles", "PetColors", ToggleCommand.petColoursToggled); + petColours.displayString = "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled); + } else if (button == dungeonTimer) { + ToggleCommand.dungeonTimerToggled = !ToggleCommand.dungeonTimerToggled; + ConfigHandler.writeBooleanConfig("toggles", "DungeonTimer", ToggleCommand.dungeonTimerToggled); + dungeonTimer.displayString = "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled); + } else if (button == golemAlerts) { + ToggleCommand.golemAlertToggled = !ToggleCommand.golemAlertToggled; + ConfigHandler.writeBooleanConfig("toggles", "GolemAlerts", ToggleCommand.golemAlertToggled); + golemAlerts.displayString = "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled); + } else if (button == expertiseLore) { + ToggleCommand.expertiseLoreToggled = !ToggleCommand.expertiseLoreToggled; + ConfigHandler.writeBooleanConfig("toggles", "ExpertiseLore", ToggleCommand.expertiseLoreToggled); + expertiseLore.displayString = "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled); + } else if (button == skill50Display) { + ToggleCommand.skill50DisplayToggled = !ToggleCommand.skill50DisplayToggled; + ConfigHandler.writeBooleanConfig("toggles", "Skill50Display", ToggleCommand.skill50DisplayToggled); + skill50Display.displayString = "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled); + } + } + +} diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java new file mode 100644 index 0000000..d71f4b9 --- /dev/null +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -0,0 +1,155 @@ +package me.Danker.gui; + +import me.Danker.TheMod; +import me.Danker.commands.DisplayCommand; +import me.Danker.handlers.ConfigHandler; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; + +public class DisplayGui extends GuiScreen { + + private boolean addSession = false; + + private GuiButton goBack; + //private GuiButton editLocations; + private GuiButton off; + private GuiButton showSession; + private GuiButton zombie; + private GuiButton spider; + private GuiButton wolf; + private GuiButton auto; + private GuiButton fishing; + private GuiButton fishingWinter; + private GuiButton fishingFestival; + private GuiButton catacombsF1; + private GuiButton catacombsF2; + private GuiButton catacombsF3; + private GuiButton catacombsF4; + private GuiButton catacombsF5; + private GuiButton catacombsF6; + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int height = sr.getScaledHeight(); + int width = sr.getScaledWidth(); + + goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); + //editLocations = new GuiButton(0, 2, height - 55, 100, 20, "Edit Locations"); + showSession = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Current Session Only: " + Utils.getColouredBoolean(addSession)); + off = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Off"); + zombie = new GuiButton(0, width / 2 - 190, (int) (height * 0.3), 80, 20, "Zombie"); + spider = new GuiButton(0, width / 2 - 90, (int) (height * 0.3), 80, 20, "Spider"); + wolf = new GuiButton(0, width / 2 + 10, (int) (height * 0.3), 80, 20, "Wolf"); + auto = new GuiButton(0, width / 2 + 110, (int) (height * 0.3), 80, 20, "Auto"); + fishing = new GuiButton(0, width / 2 - 190, (int) (height * 0.4), 110, 20, "Fishing"); + fishingWinter = new GuiButton(0, width / 2 - 55, (int) (height * 0.4), 110, 20, "Fishing Winter"); + fishingFestival = new GuiButton(0, width / 2 + 75, (int) (height * 0.4), 110, 20, "Fishing Festival"); + catacombsF1 = new GuiButton(0, width / 2 - 145, (int) (height * 0.55), 50, 20, "F1"); + catacombsF2 = new GuiButton(0, width / 2 - 85, (int) (height * 0.55), 50, 20, "F2"); + catacombsF3 = new GuiButton(0, width / 2 - 25, (int) (height * 0.55), 50, 20, "F3"); + catacombsF4 = new GuiButton(0, width / 2 + 35, (int) (height * 0.55), 50, 20, "F4"); + catacombsF5 = new GuiButton(0, width / 2 + 95, (int) (height * 0.55), 50, 20, "F5"); + catacombsF6 = new GuiButton(0, width / 2 - 145, (int) (height * 0.63), 50, 20, "F6"); + + this.buttonList.add(showSession); + this.buttonList.add(off); + this.buttonList.add(zombie); + this.buttonList.add(spider); + this.buttonList.add(wolf); + this.buttonList.add(auto); + this.buttonList.add(fishing); + this.buttonList.add(fishingWinter); + this.buttonList.add(fishingFestival); + this.buttonList.add(catacombsF1); + this.buttonList.add(catacombsF2); + this.buttonList.add(catacombsF3); + this.buttonList.add(catacombsF4); + this.buttonList.add(catacombsF5); + this.buttonList.add(catacombsF6); + //this.buttonList.add(editLocations); + this.buttonList.add(goBack); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + Minecraft mc = Minecraft.getMinecraft(); + + String displayText; + if (DisplayCommand.auto) { + displayText = "Current Display: auto"; + } else { + displayText = "Current Display: " + DisplayCommand.display; + } + int displayWidth = mc.fontRendererObj.getStringWidth(displayText); + new TextRenderer(mc, displayText, width / 2 - displayWidth / 2, 10, 1D); + + String catacombsTitleText = "Catacombs Dungeon"; + int catacombsTitleWidth = mc.fontRendererObj.getStringWidth(catacombsTitleText); + new TextRenderer(mc, catacombsTitleText, width / 2 - catacombsTitleWidth / 2, (int) (height * 0.5), 1D); + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + @Override + public void actionPerformed(GuiButton button) { + if (button == goBack) { + TheMod.guiToOpen = "dankergui1"; + //} else if (button == editLocations) { + //TheMod.guiToOpen = "editlocations"; + } else if (button == showSession) { + addSession = !addSession; + showSession.displayString = "Current Session Only: " + Utils.getColouredBoolean(addSession); + } else if (button == off) { + setDisplay("off", true); + } else if (button == zombie) { + setDisplay("zombie", false); + } else if (button == spider) { + setDisplay("spider", false); + } else if (button == wolf) { + setDisplay("wolf", false); + } else if (button == auto) { + DisplayCommand.auto = true; + ConfigHandler.writeBooleanConfig("misc", "autoDisplay", true); + } else if (button == fishing) { + setDisplay("fishing", false); + } else if (button == fishingWinter) { + setDisplay("fishing_winter", false); + } else if (button == fishingFestival) { + setDisplay("fishing_festival", false); + } else if (button == catacombsF1) { + setDisplay("catacombs_floor_one", false); + } else if (button == catacombsF2) { + setDisplay("catacombs_floor_two", false); + } else if (button == catacombsF3) { + setDisplay("catacombs_floor_three", false); + } else if (button == catacombsF4) { + setDisplay("catacombs_floor_four", false); + } else if (button == catacombsF5) { + setDisplay("catacombs_floor_five", false); + } else if (button == catacombsF6) { + setDisplay("catacombs_floor_six", false); + } + } + + public void setDisplay(String display, boolean forceNoSession) { + if (!forceNoSession && addSession) display += "_session"; + DisplayCommand.auto = false; + DisplayCommand.display = display; + ConfigHandler.writeBooleanConfig("misc", "autoDisplay", false); + ConfigHandler.writeStringConfig("misc", "display", display); + } + +} diff --git a/src/main/java/me/Danker/gui/EditLocationsGui.java b/src/main/java/me/Danker/gui/EditLocationsGui.java new file mode 100644 index 0000000..8cfed2d --- /dev/null +++ b/src/main/java/me/Danker/gui/EditLocationsGui.java @@ -0,0 +1,112 @@ +package me.Danker.gui; + +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.util.EnumChatFormatting; + +public class EditLocationsGui extends GuiScreen { + + private int lastMouseX = -1; + private int lastMouseY = -1; + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + + Minecraft mc = Minecraft.getMinecraft(); + + drawRect(MoveCommand.coordsXY[0] - 2, MoveCommand.coordsXY[1] - 2, (int) (MoveCommand.coordsXY[0] + (139 * ScaleCommand.coordsScale)), (int) (MoveCommand.coordsXY[1] + (12 * ScaleCommand.coordsScale)), 0x40D3D3D3); + new TextRenderer(mc, "74 / 14 / -26 (141.1 / 6.7)", MoveCommand.coordsXY[0], MoveCommand.coordsXY[1], ScaleCommand.coordsScale); + + 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 dungeonTimerNums = EnumChatFormatting.GRAY + "" + 5 + "\n" + + EnumChatFormatting.DARK_RED + Utils.getTimeBetween(0, 33) + "\n" + + EnumChatFormatting.RED + Utils.getTimeBetween(0, 129) + "\n" + + EnumChatFormatting.BLUE + Utils.getTimeBetween(0, 169) + "\n" + + EnumChatFormatting.YELLOW + 2 + "\n" + + EnumChatFormatting.YELLOW + 1; + drawRect(MoveCommand.dungeonTimerXY[0] - 2, MoveCommand.dungeonTimerXY[1] - 2, (int) (MoveCommand.dungeonTimerXY[0] + (112 * ScaleCommand.dungeonTimerScale)), (int) (MoveCommand.dungeonTimerXY[1] + (56 * ScaleCommand.dungeonTimerScale)), 0x40D3D3D3); + new TextRenderer(mc, dungeonTimerText, MoveCommand.dungeonTimerXY[0], MoveCommand.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale); + new TextRenderer(mc, dungeonTimerNums, (int) (MoveCommand.dungeonTimerXY[0] + (80 * ScaleCommand.dungeonTimerScale)), MoveCommand.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale); + + String displayText = EnumChatFormatting.GOLD + "Svens Killed:\n" + + EnumChatFormatting.GREEN + "Wolf Teeth:\n" + + EnumChatFormatting.BLUE + "Hamster Wheels:\n" + + EnumChatFormatting.AQUA + "Spirit Runes:\n" + + EnumChatFormatting.WHITE + "Critical VI Books:\n" + + EnumChatFormatting.DARK_RED + "Red Claw Eggs:\n" + + EnumChatFormatting.GOLD + "Couture Runes:\n" + + EnumChatFormatting.AQUA + "Grizzly Baits:\n" + + EnumChatFormatting.DARK_PURPLE + "Overfluxes:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + String displayNums = EnumChatFormatting.GOLD + "1,024" + "\n" + + EnumChatFormatting.GREEN + "59,719" + "\n" + + EnumChatFormatting.BLUE + "36" + "\n" + + EnumChatFormatting.AQUA + "64" + "\n" + + EnumChatFormatting.WHITE + "17" + "\n" + + EnumChatFormatting.DARK_RED + "3" + "\n" + + EnumChatFormatting.GOLD + "4" + "\n" + + EnumChatFormatting.AQUA + "0" + "\n" + + EnumChatFormatting.DARK_PURPLE + "5" + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, 2678400) + "\n" + + EnumChatFormatting.AQUA + "5,000"; + drawRect(MoveCommand.displayXY[0] - 2, MoveCommand.displayXY[1] - 2, (int) (MoveCommand.displayXY[0] + (144 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (100 * ScaleCommand.displayScale)), 0x40D3D3D3); + new TextRenderer(mc, displayText, MoveCommand.displayXY[0], MoveCommand.displayXY[1], ScaleCommand.displayScale); + new TextRenderer(mc, displayNums, (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), MoveCommand.displayXY[1], ScaleCommand.displayScale); + + drawRect(MoveCommand.skill50XY[0] - 2, MoveCommand.skill50XY[1] - 2, (int) (MoveCommand.skill50XY[0] + (232 * ScaleCommand.skill50Scale)), (int) (MoveCommand.skill50XY[1] + (12 * ScaleCommand.skill50Scale)), 0x40D3D3D3); + new TextRenderer(mc, EnumChatFormatting.AQUA + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", MoveCommand.skill50XY[0], MoveCommand.skill50XY[1], ScaleCommand.skill50Scale); + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + /*@Override + public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { + super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick); + + if (lastMouseX == -1) lastMouseX = mouseX; + if (lastMouseY == -1) lastMouseY = mouseY; + + int xMoved = mouseX - lastMouseX; + int yMoved = mouseY - lastMouseY; + + // Display + if (isInsideBox(MoveCommand.displayXY[0] - 2, MoveCommand.displayXY[1] - 2, (int) (MoveCommand.displayXY[0] + (144 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (100 * ScaleCommand.displayScale)), mouseX, mouseY)) { + System.out.println("lastMouseX: " + lastMouseX + ", mouseX: " + mouseX + ", xMoved: " + xMoved); + MoveCommand.displayXY[0] += xMoved; + MoveCommand.displayXY[1] += yMoved; + } + + lastMouseX = mouseX; + lastMouseY = mouseY; + } + + boolean isInsideBox(int x1, int y1, int x2, int y2, int x, int y) { + if (x >= x1 && x <= x2 && y >= y1 && y <= y2) { + return true; + } + return false; + }*/ + +} diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java new file mode 100644 index 0000000..0573777 --- /dev/null +++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java @@ -0,0 +1,129 @@ +package me.Danker.gui; + +import me.Danker.commands.BlockSlayerCommand; +import me.Danker.handlers.ConfigHandler; +import me.Danker.handlers.TextRenderer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; + +public class OnlySlayerGui extends GuiScreen { + + private int onlyNumberInt = 4; + private String onlyName = "Revenant Horror"; + + private GuiButton off; + private GuiButton zombie; + private GuiButton spider; + private GuiButton wolf; + private GuiButton one; + private GuiButton two; + private GuiButton three; + private GuiButton four; + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int height = sr.getScaledHeight(); + int width = sr.getScaledWidth(); + + onlyName = BlockSlayerCommand.onlySlayerName; + if (BlockSlayerCommand.onlySlayerNumber.equals("I")) { + onlyNumberInt = 1; + } else if (BlockSlayerCommand.onlySlayerNumber.equals("II")) { + onlyNumberInt = 2; + } else if (BlockSlayerCommand.onlySlayerNumber.equals("III")) { + onlyNumberInt = 3; + } else { + onlyNumberInt = 4; + } + + off = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Off"); + zombie = new GuiButton(0, width / 2 - 200, (int) (height * 0.4), 120, 20, "Zombie"); + spider = new GuiButton(0, width / 2 - 60, (int) (height * 0.4), 120, 20, "Spider"); + wolf = new GuiButton(0, width / 2 + 80, (int) (height * 0.4), 120, 20, "Wolf"); + one = new GuiButton(0, width / 2 - 190, (int) (height * 0.6), 85, 20, "I"); + two = new GuiButton(0, width / 2 - 95, (int) (height * 0.6), 85, 20, "II"); + three = new GuiButton(0, width / 2 + 10, (int) (height * 0.6), 85, 20, "III"); + four = new GuiButton(0, width / 2 + 115, (int) (height * 0.6), 85, 20, "IV"); + + this.buttonList.add(off); + this.buttonList.add(zombie); + this.buttonList.add(spider); + this.buttonList.add(wolf); + this.buttonList.add(one); + this.buttonList.add(two); + this.buttonList.add(three); + this.buttonList.add(four); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + Minecraft mc = Minecraft.getMinecraft(); + + String displayText; + if (BlockSlayerCommand.onlySlayerName.equals("")) { + displayText = "Only Allow Slayer: Off"; + } else { + displayText = "Only Allow Slayer: " + BlockSlayerCommand.onlySlayerName + " " + BlockSlayerCommand.onlySlayerNumber; + } + int displayWidth = mc.fontRendererObj.getStringWidth(displayText); + new TextRenderer(mc, displayText, width / 2 - displayWidth / 2, 10, 1D); + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + @Override + public void actionPerformed(GuiButton button) { + if (button == off) { + BlockSlayerCommand.onlySlayerName = ""; + BlockSlayerCommand.onlySlayerNumber = ""; + ConfigHandler.writeStringConfig("toggles", "BlockSlayer", ""); + return; + } else if (button == zombie) { + onlyName = "Revenant Horror"; + } else if (button == spider) { + onlyName = "Tarantula Broodfather"; + } else if (button == wolf) { + onlyName = "Sven Packmaster"; + } else if (button == one) { + onlyNumberInt = 1; + } else if (button == two) { + onlyNumberInt = 2; + } else if (button == three) { + onlyNumberInt = 3; + } else if (button == four) { + onlyNumberInt = 4; + } + + String onlyNumber; + switch (onlyNumberInt) { + case 1: + onlyNumber = "I"; + break; + case 2: + onlyNumber = "II"; + break; + case 3: + onlyNumber = "III"; + break; + case 4: + default: + onlyNumber = "IV"; + } + + BlockSlayerCommand.onlySlayerName = onlyName; + BlockSlayerCommand.onlySlayerNumber = onlyNumber; + ConfigHandler.writeStringConfig("toggles", "BlockSlayer", BlockSlayerCommand.onlySlayerName + " " + BlockSlayerCommand.onlySlayerNumber); + } + +} diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index ae9f08b..ba01071 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -18,6 +18,7 @@ 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.EnumChatFormatting; import net.minecraft.util.StringUtils; public class Utils { @@ -223,4 +224,8 @@ public class Utils { return 0; } + public static String getColouredBoolean(boolean bool) { + return bool ? EnumChatFormatting.GREEN + "On" : EnumChatFormatting.RED + "Off"; + } + } -- cgit From ff7001b95634e610a56220c58bc9619c063203da Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 16 Oct 2020 15:20:27 -0400 Subject: Add ability to drag around displays WIP WIP, buggy with scaling --- src/main/java/me/Danker/gui/DisplayGui.java | 10 +- src/main/java/me/Danker/gui/EditLocationsGui.java | 140 +++++++++++++-------- src/main/java/me/Danker/gui/OnlySlayerGui.java | 8 +- .../java/me/Danker/gui/buttons/LocationButton.java | 61 +++++++++ 4 files changed, 163 insertions(+), 56 deletions(-) create mode 100644 src/main/java/me/Danker/gui/buttons/LocationButton.java (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index d71f4b9..945dbc3 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -15,7 +15,7 @@ public class DisplayGui extends GuiScreen { private boolean addSession = false; private GuiButton goBack; - //private GuiButton editLocations; + private GuiButton editLocations; private GuiButton off; private GuiButton showSession; private GuiButton zombie; @@ -46,7 +46,7 @@ public class DisplayGui extends GuiScreen { int width = sr.getScaledWidth(); goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); - //editLocations = new GuiButton(0, 2, height - 55, 100, 20, "Edit Locations"); + editLocations = new GuiButton(0, 2, height - 55, 100, 20, "Edit Locations"); showSession = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Current Session Only: " + Utils.getColouredBoolean(addSession)); off = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Off"); zombie = new GuiButton(0, width / 2 - 190, (int) (height * 0.3), 80, 20, "Zombie"); @@ -78,7 +78,7 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(catacombsF4); this.buttonList.add(catacombsF5); this.buttonList.add(catacombsF6); - //this.buttonList.add(editLocations); + this.buttonList.add(editLocations); this.buttonList.add(goBack); } @@ -107,8 +107,8 @@ public class DisplayGui extends GuiScreen { public void actionPerformed(GuiButton button) { if (button == goBack) { TheMod.guiToOpen = "dankergui1"; - //} else if (button == editLocations) { - //TheMod.guiToOpen = "editlocations"; + } else if (button == editLocations) { + TheMod.guiToOpen = "editlocations"; } else if (button == showSession) { addSession = !addSession; showSession.displayString = "Current Session Only: " + Utils.getColouredBoolean(addSession); diff --git a/src/main/java/me/Danker/gui/EditLocationsGui.java b/src/main/java/me/Danker/gui/EditLocationsGui.java index 8cfed2d..8fbc4cb 100644 --- a/src/main/java/me/Danker/gui/EditLocationsGui.java +++ b/src/main/java/me/Danker/gui/EditLocationsGui.java @@ -2,18 +2,24 @@ package me.Danker.gui; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; -import me.Danker.handlers.TextRenderer; +import me.Danker.gui.buttons.LocationButton; +import me.Danker.handlers.ConfigHandler; import me.Danker.utils.Utils; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.EnumChatFormatting; public class EditLocationsGui extends GuiScreen { + private String moving = null; private int lastMouseX = -1; private int lastMouseY = -1; + private LocationButton display; + private LocationButton dungeonTimer; + private LocationButton coords; + private LocationButton skill50; + @Override public boolean doesGuiPauseGame() { return false; @@ -22,32 +28,9 @@ public class EditLocationsGui extends GuiScreen { @Override public void initGui() { super.initGui(); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - this.drawDefaultBackground(); - - Minecraft mc = Minecraft.getMinecraft(); - - drawRect(MoveCommand.coordsXY[0] - 2, MoveCommand.coordsXY[1] - 2, (int) (MoveCommand.coordsXY[0] + (139 * ScaleCommand.coordsScale)), (int) (MoveCommand.coordsXY[1] + (12 * ScaleCommand.coordsScale)), 0x40D3D3D3); - new TextRenderer(mc, "74 / 14 / -26 (141.1 / 6.7)", MoveCommand.coordsXY[0], MoveCommand.coordsXY[1], ScaleCommand.coordsScale); - - 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 dungeonTimerNums = EnumChatFormatting.GRAY + "" + 5 + "\n" + - EnumChatFormatting.DARK_RED + Utils.getTimeBetween(0, 33) + "\n" + - EnumChatFormatting.RED + Utils.getTimeBetween(0, 129) + "\n" + - EnumChatFormatting.BLUE + Utils.getTimeBetween(0, 169) + "\n" + - EnumChatFormatting.YELLOW + 2 + "\n" + - EnumChatFormatting.YELLOW + 1; - drawRect(MoveCommand.dungeonTimerXY[0] - 2, MoveCommand.dungeonTimerXY[1] - 2, (int) (MoveCommand.dungeonTimerXY[0] + (112 * ScaleCommand.dungeonTimerScale)), (int) (MoveCommand.dungeonTimerXY[1] + (56 * ScaleCommand.dungeonTimerScale)), 0x40D3D3D3); - new TextRenderer(mc, dungeonTimerText, MoveCommand.dungeonTimerXY[0], MoveCommand.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale); - new TextRenderer(mc, dungeonTimerNums, (int) (MoveCommand.dungeonTimerXY[0] + (80 * ScaleCommand.dungeonTimerScale)), MoveCommand.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale); + // Ease of typing + MoveCommand moc = new MoveCommand(); + ScaleCommand sc = new ScaleCommand(); String displayText = EnumChatFormatting.GOLD + "Svens Killed:\n" + EnumChatFormatting.GREEN + "Wolf Teeth:\n" + @@ -71,42 +54,99 @@ public class EditLocationsGui extends GuiScreen { EnumChatFormatting.DARK_PURPLE + "5" + "\n" + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, 2678400) + "\n" + EnumChatFormatting.AQUA + "5,000"; - drawRect(MoveCommand.displayXY[0] - 2, MoveCommand.displayXY[1] - 2, (int) (MoveCommand.displayXY[0] + (144 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (100 * ScaleCommand.displayScale)), 0x40D3D3D3); - new TextRenderer(mc, displayText, MoveCommand.displayXY[0], MoveCommand.displayXY[1], ScaleCommand.displayScale); - new TextRenderer(mc, displayNums, (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), MoveCommand.displayXY[1], ScaleCommand.displayScale); - drawRect(MoveCommand.skill50XY[0] - 2, MoveCommand.skill50XY[1] - 2, (int) (MoveCommand.skill50XY[0] + (232 * ScaleCommand.skill50Scale)), (int) (MoveCommand.skill50XY[1] + (12 * ScaleCommand.skill50Scale)), 0x40D3D3D3); - new TextRenderer(mc, EnumChatFormatting.AQUA + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", MoveCommand.skill50XY[0], MoveCommand.skill50XY[1], ScaleCommand.skill50Scale); + 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 dungeonTimerNums = EnumChatFormatting.GRAY + "" + 5 + "\n" + + EnumChatFormatting.DARK_RED + Utils.getTimeBetween(0, 33) + "\n" + + EnumChatFormatting.RED + Utils.getTimeBetween(0, 129) + "\n" + + EnumChatFormatting.BLUE + Utils.getTimeBetween(0, 169) + "\n" + + EnumChatFormatting.YELLOW + 2 + "\n" + + EnumChatFormatting.YELLOW + 1; + display = new LocationButton(0, moc.displayXY[0], moc.displayXY[1], 145 * sc.displayScale, 102 * sc.displayScale, sc.displayScale, displayText, displayNums, 110); + dungeonTimer = new LocationButton(0, moc.dungeonTimerXY[0], moc.dungeonTimerXY[1], 113 * sc.dungeonTimerScale, 57 * sc.dungeonTimerScale, sc.dungeonTimerScale, dungeonTimerText, dungeonTimerNums, 80); + coords = new LocationButton(0, moc.coordsXY[0], moc.coordsXY[1], 141 * sc.coordsScale, 12 * sc.coordsScale, sc.coordsScale, "74 / 14 / -26 (141.1 / 6.7)", null, null); + skill50 = new LocationButton(0, moc.skill50XY[0], moc.skill50XY[1], 233 * sc.skill50Scale, 12 * sc.skill50Scale, sc.skill50Scale, EnumChatFormatting.AQUA + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", null, null); + + this.buttonList.add(coords); + this.buttonList.add(dungeonTimer); + this.buttonList.add(display); + this.buttonList.add(skill50); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + mouseMoved(mouseX, mouseY); super.drawScreen(mouseX, mouseY, partialTicks); } - /*@Override - public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { - super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick); - - if (lastMouseX == -1) lastMouseX = mouseX; - if (lastMouseY == -1) lastMouseY = mouseY; - + private void mouseMoved(int mouseX, int mouseY) { int xMoved = mouseX - lastMouseX; int yMoved = mouseY - lastMouseY; - // Display - if (isInsideBox(MoveCommand.displayXY[0] - 2, MoveCommand.displayXY[1] - 2, (int) (MoveCommand.displayXY[0] + (144 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (100 * ScaleCommand.displayScale)), mouseX, mouseY)) { - System.out.println("lastMouseX: " + lastMouseX + ", mouseX: " + mouseX + ", xMoved: " + xMoved); - MoveCommand.displayXY[0] += xMoved; - MoveCommand.displayXY[1] += yMoved; + if (moving != null) { + if (moving.equals("display")) { + MoveCommand.displayXY[0] += xMoved; + MoveCommand.displayXY[1] += yMoved; + display.xPosition = MoveCommand.displayXY[0]; + display.yPosition = MoveCommand.displayXY[1]; + } else if (moving.equals("dungeonTimer")) { + MoveCommand.dungeonTimerXY[0] += xMoved; + MoveCommand.dungeonTimerXY[1] += yMoved; + dungeonTimer.xPosition = MoveCommand.dungeonTimerXY[0]; + dungeonTimer.yPosition = MoveCommand.dungeonTimerXY[1]; + } else if (moving.equals("coords")) { + MoveCommand.coordsXY[0] += xMoved; + MoveCommand.coordsXY[1] += yMoved; + coords.xPosition = MoveCommand.coordsXY[0]; + coords.yPosition = MoveCommand.coordsXY[1]; + } else if (moving.equals("skill50")) { + MoveCommand.skill50XY[0] += xMoved; + MoveCommand.skill50XY[1] += yMoved; + skill50.xPosition = MoveCommand.skill50XY[0]; + skill50.yPosition = MoveCommand.skill50XY[1]; + } + this.buttonList.clear(); + initGui(); } lastMouseX = mouseX; lastMouseY = mouseY; } - boolean isInsideBox(int x1, int y1, int x2, int y2, int x, int y) { - if (x >= x1 && x <= x2 && y >= y1 && y <= y2) { - return true; + @Override + public void actionPerformed(GuiButton button) { + if (button instanceof LocationButton) { + if (button == display) { + moving = "display"; + } else if (button == dungeonTimer) { + moving = "dungeonTimer"; + } else if (button == coords) { + moving = "coords"; + } else if (button == skill50) { + moving = "skill50"; + } } - return false; - }*/ + } + + @Override + public void mouseReleased(int mouseX, int mouseY, int state) { + super.mouseReleased(mouseX, mouseY, state); + moving = null; + ConfigHandler.writeIntConfig("locations", "coordsX", MoveCommand.coordsXY[0]); + ConfigHandler.writeIntConfig("locations", "coordsY", MoveCommand.coordsXY[1]); + ConfigHandler.writeIntConfig("locations", "displayX", MoveCommand.displayXY[0]); + ConfigHandler.writeIntConfig("locations", "displayY", MoveCommand.displayXY[1]); + ConfigHandler.writeIntConfig("locations", "dungeonTimerX", MoveCommand.dungeonTimerXY[0]); + ConfigHandler.writeIntConfig("locations", "dungeonTimerY", MoveCommand.dungeonTimerXY[1]); + ConfigHandler.writeIntConfig("locations", "skill50X", MoveCommand.skill50XY[0]); + ConfigHandler.writeIntConfig("locations", "skill50Y", MoveCommand.skill50XY[1]); + } } diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java index 0573777..c96bfd6 100644 --- a/src/main/java/me/Danker/gui/OnlySlayerGui.java +++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java @@ -1,5 +1,6 @@ package me.Danker.gui; +import me.Danker.TheMod; import me.Danker.commands.BlockSlayerCommand; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; @@ -13,6 +14,7 @@ public class OnlySlayerGui extends GuiScreen { private int onlyNumberInt = 4; private String onlyName = "Revenant Horror"; + private GuiButton goBack; private GuiButton off; private GuiButton zombie; private GuiButton spider; @@ -46,6 +48,7 @@ public class OnlySlayerGui extends GuiScreen { onlyNumberInt = 4; } + goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); off = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Off"); zombie = new GuiButton(0, width / 2 - 200, (int) (height * 0.4), 120, 20, "Zombie"); spider = new GuiButton(0, width / 2 - 60, (int) (height * 0.4), 120, 20, "Spider"); @@ -63,6 +66,7 @@ public class OnlySlayerGui extends GuiScreen { this.buttonList.add(two); this.buttonList.add(three); this.buttonList.add(four); + this.buttonList.add(goBack); } @Override @@ -84,7 +88,9 @@ public class OnlySlayerGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { - if (button == off) { + if (button == goBack) { + TheMod.guiToOpen = "dankergui1"; + } else if (button == off) { BlockSlayerCommand.onlySlayerName = ""; BlockSlayerCommand.onlySlayerNumber = ""; ConfigHandler.writeStringConfig("toggles", "BlockSlayer", ""); diff --git a/src/main/java/me/Danker/gui/buttons/LocationButton.java b/src/main/java/me/Danker/gui/buttons/LocationButton.java new file mode 100644 index 0000000..061f198 --- /dev/null +++ b/src/main/java/me/Danker/gui/buttons/LocationButton.java @@ -0,0 +1,61 @@ +package me.Danker.gui.buttons; + +import me.Danker.handlers.TextRenderer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.SoundHandler; +import net.minecraft.client.gui.GuiButton; + +public class LocationButton extends GuiButton { + + private int x; + private int y; + private double scale; + private String text; + private String text2; + private Integer text2Offset; + + public LocationButton(int buttonId, int x, int y, double width, double height, double scale, String text, String text2, Integer text2Offset) { + super(buttonId, x, y, text); + this.x = x; + this.y = y; + this.width = (int) width; + this.height = (int) height; + this.scale = scale; + this.text = text; + this.text2 = text2; + this.text2Offset = text2Offset; + } + + @Override + public void drawButton(Minecraft mc, int mouseX, int mouseY) { + String[] splitText; + if (text2 == null) { + splitText = text.split("\n"); + } else { + splitText = text2.split("\n"); + } + int index = 0; + int longestText = -1; + for (int i = 0; i < splitText.length; i++) { + int stringLength = mc.fontRendererObj.getStringWidth(splitText[i]); + if (stringLength > longestText) { + index = i; + longestText = stringLength; + } + } + + if (text2 == null) { + drawRect(x - 2, y - 2, (int) (x + longestText * scale + 3), (int) (y + (splitText.length * 9 + 3) * scale), 0x40D3D3D3); + } else { + drawRect(x - 2, y - 2, (int) (x + (longestText + text2Offset) * scale + 3), (int) (y + (splitText.length * 9 + 3) * scale), 0x40D3D3D3); + new TextRenderer(mc, text2, (int) (x + (text2Offset * scale)), y, scale); + } + new TextRenderer(mc, text, x, y, scale); + } + + @Override + public void playPressSound(SoundHandler soundHandler) { + + } + +} -- cgit From 3413ab538e830977206ec1b6bd95e5f6c334ebf1 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 16 Oct 2020 22:24:32 -0400 Subject: Add ability to disable Livid Dagger --- src/main/java/me/Danker/TheMod.java | 9 ++++++-- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/ToggleCommand.java | 9 ++++++-- src/main/java/me/Danker/gui/DankerGui.java | 24 ++++++++++++++++------ .../java/me/Danker/handlers/ConfigHandler.java | 2 ++ 5 files changed, 35 insertions(+), 11 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index f7b7763..3bb11cf 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -1882,8 +1882,13 @@ public class TheMod 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); + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR) { + if (ToggleCommand.aotdToggled && item.getDisplayName().contains("Aspect of the Dragons")) { + event.setCanceled(true); + } + if (ToggleCommand.lividDaggerToggled && item.getDisplayName().contains("Livid Dagger")) { + event.setCanceled(true); + } } } diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 32b7d4b..03aa318 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -34,7 +34,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + EnumChatFormatting.GOLD + " /dsm" + EnumChatFormatting.AQUA + " - Opens the GUI for Danker's Skyblock Mod.\n" + - EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + EnumChatFormatting.GOLD + " /loot [winter/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index affa5cf..fbe5dcc 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -22,6 +22,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean chatMaddoxToggled; public static boolean spiritBearAlerts; public static boolean aotdToggled; + public static boolean lividDaggerToggled; public static boolean sceptreMessages; public static boolean petColoursToggled; public static boolean dungeonTimerToggled; @@ -37,7 +38,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " "; + return "/" + getCommandName() + " "; } @Override @@ -48,7 +49,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "list"); + return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "list"); } return null; } @@ -99,6 +100,10 @@ public class ToggleCommand extends CommandBase implements ICommand { 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("lividdagger")) { + lividDaggerToggled = !lividDaggerToggled; + cf.writeBooleanConfig("toggles", "LividDagger", lividDaggerToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Block Livid Dagger ability been set to " + EnumChatFormatting.DARK_GREEN + lividDaggerToggled + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("sceptremessages")) { sceptreMessages = !sceptreMessages; cf.writeBooleanConfig("toggles", "SceptreMessages", sceptreMessages); diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 502bcb6..0ee10b9 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -36,6 +36,7 @@ public class DankerGui extends GuiScreen { private GuiButton chatMaddox; private GuiButton spiritBearAlert; private GuiButton aotd; + private GuiButton lividDagger; private GuiButton sceptreMessages; private GuiButton petColours; private GuiButton dungeonTimer; @@ -78,12 +79,14 @@ public class DankerGui extends GuiScreen { slayerCount = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal)); // Page 2 aotd = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Disable AOTD Ability: " + Utils.getColouredBoolean(ToggleCommand.aotdToggled)); - sceptreMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Enable Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); - petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); - dungeonTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); - golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); - expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); - skill50Display = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled)); + lividDagger = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Disable Livid Dagger Ability: " + Utils.getColouredBoolean(ToggleCommand.lividDaggerToggled)); + sceptreMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Enable Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); + petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); + dungeonTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); + golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); + expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); + // Page 3 + skill50Display = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled)); if (page == 1) { this.buttonList.add(changeDisplay); @@ -97,11 +100,16 @@ public class DankerGui extends GuiScreen { this.buttonList.add(closeGUI); } else if (page == 2) { this.buttonList.add(aotd); + this.buttonList.add(lividDagger); this.buttonList.add(sceptreMessages); this.buttonList.add(petColours); this.buttonList.add(dungeonTimer); this.buttonList.add(golemAlerts); this.buttonList.add(expertiseLore); + this.buttonList.add(nextPage); + this.buttonList.add(backPage); + this.buttonList.add(closeGUI); + } else if (page == 3) { this.buttonList.add(skill50Display); this.buttonList.add(backPage); this.buttonList.add(closeGUI); @@ -164,6 +172,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.aotdToggled = !ToggleCommand.aotdToggled; ConfigHandler.writeBooleanConfig("toggles", "AOTD", ToggleCommand.aotdToggled); aotd.displayString = "Disable AOTD Ability: " + Utils.getColouredBoolean(ToggleCommand.aotdToggled); + } else if (button == lividDagger) { + ToggleCommand.lividDaggerToggled = !ToggleCommand.lividDaggerToggled; + ConfigHandler.writeBooleanConfig("toggles", "LividDagger", ToggleCommand.lividDaggerToggled); + lividDagger.displayString = "Disable Livid Dagger Ability: " + Utils.getColouredBoolean(ToggleCommand.lividDaggerToggled); } else if (button == sceptreMessages) { ToggleCommand.sceptreMessages = !ToggleCommand.sceptreMessages; ConfigHandler.writeBooleanConfig("toggles", "SceptreMessages", ToggleCommand.sceptreMessages); diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index fcb33b2..b903cd3 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -179,6 +179,7 @@ public class ConfigHandler { if (!hasKey("toggles", "ChatMaddox")) writeBooleanConfig("toggles", "ChatMaddox", true); if (!hasKey("toggles", "SpiritBearAlerts")) writeBooleanConfig("toggles", "SpiritBearAlerts", true); if (!hasKey("toggles", "AOTD")) writeBooleanConfig("toggles", "AOTD", false); + if (!hasKey("toggles", "LividDagger")) writeBooleanConfig("toggles", "LividDagger", 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); @@ -344,6 +345,7 @@ public class ConfigHandler { tf.chatMaddoxToggled = getBoolean("toggles", "ChatMaddox"); tf.spiritBearAlerts = getBoolean("toggles", "SpiritBearAlerts"); tf.aotdToggled = getBoolean("toggles", "AOTD"); + tf.lividDaggerToggled = getBoolean("toggles", "LividDagger"); tf.sceptreMessages = getBoolean("toggles", "SceptreMessages"); tf.petColoursToggled = getBoolean("toggles", "PetColors"); tf.dungeonTimerToggled = getBoolean("toggles", "DungeonTimer"); -- cgit From 65f8c8ea13df8451583ef257976f761d13d35f1f Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sun, 18 Oct 2020 05:36:00 -0400 Subject: Add Spirit Boots fix Experimental, could cause issues elsewhere. Uses reflection to modify packet equipmentSlot to correct values. Credit to Cold tQ for the help. --- src/main/java/me/Danker/TheMod.java | 12 +++++++++ .../java/me/Danker/handlers/PacketHandler.java | 31 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/main/java/me/Danker/handlers/PacketHandler.java (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 3bb11cf..fa327fe 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -45,6 +45,7 @@ import me.Danker.gui.EditLocationsGui; import me.Danker.gui.OnlySlayerGui; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; +import me.Danker.handlers.PacketHandler; import me.Danker.handlers.ScoreboardHandler; import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; @@ -86,6 +87,7 @@ 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.network.FMLNetworkEvent.ClientConnectedToServerEvent; import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; @Mod(modid = TheMod.MODID, version = TheMod.VERSION, clientSideOnly = true) @@ -124,6 +126,7 @@ public class TheMod public void init(FMLInitializationEvent event) { FMLCommonHandler.instance().bus().register(this); MinecraftForge.EVENT_BUS.register(this); + MinecraftForge.EVENT_BUS.register(new PacketHandler()); final ConfigHandler cf = new ConfigHandler(); cf.reloadConfig(); @@ -2034,6 +2037,15 @@ public class TheMod } } + @SubscribeEvent + public void onServerConnect(ClientConnectedToServerEvent event) { + if (!PacketHandler.added) { + event.manager.channel().pipeline().addBefore("packet_handler", "danker_packet_handler", new PacketHandler()); + PacketHandler.added = true; + System.out.println("Added packet handler to channel pipeline."); + } + } + public void increaseSeaCreatures() { LootCommand lc = new LootCommand(); ConfigHandler cf = new ConfigHandler(); diff --git a/src/main/java/me/Danker/handlers/PacketHandler.java b/src/main/java/me/Danker/handlers/PacketHandler.java new file mode 100644 index 0000000..56bbc24 --- /dev/null +++ b/src/main/java/me/Danker/handlers/PacketHandler.java @@ -0,0 +1,31 @@ +package me.Danker.handlers; + +import java.lang.reflect.Field; + +import io.netty.channel.ChannelDuplexHandler; +import io.netty.channel.ChannelHandlerContext; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S04PacketEntityEquipment; + +public class PacketHandler extends ChannelDuplexHandler { + + public static boolean added = false; + + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + if (Utils.inSkyblock && msg instanceof Packet && msg.getClass().getName().endsWith("S04PacketEntityEquipment")) { // Inventory packet name + S04PacketEntityEquipment packet = (S04PacketEntityEquipment) msg; + if (packet.getEntityID() == Minecraft.getMinecraft().thePlayer.getEntityId()) { + Field slot = packet.getClass().getDeclaredField("field_149392_b"); // equipmentSlot + slot.setAccessible(true); + slot.setInt(packet, slot.getInt(packet) + 1); + msg = packet; + } + } + + super.channelRead(ctx, msg); + } + +} -- cgit From 3dde239389482ef25825a5fc9e6379430360a228 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sun, 18 Oct 2020 21:34:56 -0400 Subject: Add dungeons to auto display --- src/main/java/me/Danker/TheMod.java | 15 +++++++++++++++ src/main/java/me/Danker/gui/DisplayGui.java | 12 ++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index fa327fe..87e4dd7 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -1837,6 +1837,21 @@ public class TheMod } else if (sCleaned.contains("Revenant Horror")) { DisplayCommand.display = "zombie"; found = true; + } else if (sCleaned.contains("The Catacombs (")) { + if (sCleaned.contains("F1")) { + DisplayCommand.display = "catacombs_floor_one"; + } else if (sCleaned.contains("F2")) { + DisplayCommand.display = "catacombs_floor_two"; + } else if (sCleaned.contains("F3")) { + DisplayCommand.display = "catacombs_floor_three"; + } else if (sCleaned.contains("F4")) { + DisplayCommand.display = "catacombs_floor_four"; + } else if (sCleaned.contains("F5")) { + DisplayCommand.display = "catacombs_floor_five"; + } else if (sCleaned.contains("F6")) { + DisplayCommand.display = "catacombs_floor_six"; + } + found = true; } } if (!found) DisplayCommand.display = "off"; diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 945dbc3..243bedb 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -48,11 +48,11 @@ public class DisplayGui extends GuiScreen { goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); editLocations = new GuiButton(0, 2, height - 55, 100, 20, "Edit Locations"); showSession = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Current Session Only: " + Utils.getColouredBoolean(addSession)); - off = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Off"); - zombie = new GuiButton(0, width / 2 - 190, (int) (height * 0.3), 80, 20, "Zombie"); - spider = new GuiButton(0, width / 2 - 90, (int) (height * 0.3), 80, 20, "Spider"); - wolf = new GuiButton(0, width / 2 + 10, (int) (height * 0.3), 80, 20, "Wolf"); - auto = new GuiButton(0, width / 2 + 110, (int) (height * 0.3), 80, 20, "Auto"); + off = new GuiButton(0, width / 2 - 210, (int) (height * 0.2), "Off"); + auto = new GuiButton(0, width / 2 + 10, (int) (height * 0.2), "Auto"); + zombie = new GuiButton(0, width / 2 - 190, (int) (height * 0.3), 110, 20, "Zombie"); + spider = new GuiButton(0, width / 2 - 55, (int) (height * 0.3), 110, 20, "Spider"); + wolf = new GuiButton(0, width / 2 + 75, (int) (height * 0.3), 110, 20, "Wolf"); fishing = new GuiButton(0, width / 2 - 190, (int) (height * 0.4), 110, 20, "Fishing"); fishingWinter = new GuiButton(0, width / 2 - 55, (int) (height * 0.4), 110, 20, "Fishing Winter"); fishingFestival = new GuiButton(0, width / 2 + 75, (int) (height * 0.4), 110, 20, "Fishing Festival"); @@ -65,10 +65,10 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(showSession); this.buttonList.add(off); + this.buttonList.add(auto); this.buttonList.add(zombie); this.buttonList.add(spider); this.buttonList.add(wolf); - this.buttonList.add(auto); this.buttonList.add(fishing); this.buttonList.add(fishingWinter); this.buttonList.add(fishingFestival); -- cgit From 1635fe604e6ca2d32d96409165fcc298f1c5b067 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 20 Oct 2020 11:55:48 -0400 Subject: Change version to 1.8 --- build.gradle | 2 +- src/main/java/me/Danker/TheMod.java | 2 +- src/main/java/me/Danker/commands/ToggleCommand.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/build.gradle b/build.gradle index e335794..cae3082 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ plugins { id "net.minecraftforge.gradle.forge" version "2.0.2" } */ -version = "1.7" +version = "1.8" 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 87e4dd7..4c30ee9 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -94,7 +94,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.7"; + public static final String VERSION = "1.8"; static double checkItemsNow = 0; static double itemsChecked = 0; diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index fbe5dcc..2835db6 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -142,6 +142,7 @@ public class ToggleCommand extends CommandBase implements ICommand { EnumChatFormatting.GREEN + " Chat Maddox menu: " + EnumChatFormatting.DARK_GREEN + chatMaddoxToggled + "\n" + EnumChatFormatting.GREEN + " Spirit Bear alerts: " + EnumChatFormatting.DARK_GREEN + spiritBearAlerts + "\n" + EnumChatFormatting.GREEN + " Block AOTD ability: " + EnumChatFormatting.DARK_GREEN + aotdToggled + "\n" + + EnumChatFormatting.GREEN + " Block Livid Dagger ability: " + EnumChatFormatting.DARK_GREEN + lividDaggerToggled + "\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 + "\n" + -- cgit