From d056aa0ec706820a94e36e2c4866c15a12b9af6e Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sat, 5 Dec 2020 10:58:21 -0500 Subject: Add Superpairs helper --- src/main/java/me/Danker/DankersSkyblockMod.java | 32 +++++++++++++++++++--- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/ToggleCommand.java | 15 ++++++++-- src/main/java/me/Danker/gui/ExperimentsGui.java | 7 +++++ .../java/me/Danker/handlers/ConfigHandler.java | 2 ++ 5 files changed, 50 insertions(+), 8 deletions(-) (limited to 'src/main/java/me') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 35a19c9..d272121 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -117,8 +117,9 @@ public class DankersSkyblockMod static int lastChronomatronRound = 0; static List chronomatronPattern = new ArrayList<>(); static int chronomatronMouseClicks = 0; - - static double dungeonStartTime = 0; + static ItemStack[] superpairSlots = new ItemStack[53]; + + static double dungeonStartTime = 0; static double bloodOpenTime = 0; static double watcherClearTime = 0; static double bossClearTime = 0; @@ -2605,6 +2606,28 @@ public class DankersSkyblockMod } } } + if(mc.currentScreen instanceof GuiChest) { + ContainerChest chest = (ContainerChest) mc.thePlayer.openContainer; + IInventory inv = chest.getLowerChestInventory(); + String chestName = inv.getDisplayName().getUnformattedText(); + if (ToggleCommand.superpairsToggled && chestName.contains("Superpairs (")) { + for (int i = 0; i < 53; i++) { + ItemStack itemStack = inv.getStackInSlot(i); + if (itemStack == null) continue; + String itemName = itemStack.getDisplayName(); + if (Item.getIdFromItem(itemStack.getItem()) == 95) continue; + if (itemName.contains("Instant Find")) continue; + + if (superpairSlots[i] != null) return; + superpairSlots[i] = itemStack; + } + for (int i = 0; i < 53; i++) { + ItemStack itemStack = superpairSlots[i]; + if (itemStack == null) continue; + inv.setInventorySlotContents(i, itemStack); + } + } + } } // Checks 10 times per second @@ -2619,8 +2642,8 @@ public class DankersSkyblockMod } } } - - if (titleTimer >= 0) { + + if (titleTimer >= 0) { if (titleTimer == 0) { showTitle = false; } @@ -2861,6 +2884,7 @@ public class DankersSkyblockMod lastChronomatronRound = 0; chronomatronPattern.clear(); chronomatronMouseClicks = 0; + superpairSlots = new ItemStack[53]; } @SubscribeEvent diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 332c47f..1628c0c 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/festival/spooky/f(1-7)/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 541a59a..916cc2e 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -50,6 +50,7 @@ public class ToggleCommand extends CommandBase implements ICommand { // Experiments public static boolean ultrasequencerToggled; public static boolean chronomatronToggled; + public static boolean superpairsToggled; @Override public String getCommandName() { @@ -62,7 +63,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "aotd/lividdagger/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/" + "outlinetext/midasstaffmessages/implosionmessages/healmessages/caketimer/lowhealthnotify/" + "lividsolver/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/" + - "startswithterminal/selectallterminal/itemframeonsealanterns/ultrasequencer/chronomatron/list>"; + "startswithterminal/selectallterminal/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/list>"; } @Override @@ -81,7 +82,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "lividsolver", "threemanpuzzle", "oruopuzzle", "blazepuzzle", "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "startswithterminal", "selectallterminal", "itemframeonsealanterns", "ultrasequencer", - "chronomatron", "list"); + "chronomatron", "superpairs", "list"); } return null; } @@ -266,6 +267,12 @@ public class ToggleCommand extends CommandBase implements ICommand { chronomatronToggled = !chronomatronToggled; ConfigHandler.writeBooleanConfig("toggles", "Chronomatron", chronomatronToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Chronomatron solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + chronomatronToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "superpairs": + superpairsToggled = !superpairsToggled; + ConfigHandler.writeBooleanConfig("toggles", "Superpairs", superpairsToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Superpairs solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + chronomatronToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "list": player.addChatMessage(new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + "Guild party notifications: " + DankersSkyblockMod.VALUE_COLOUR + gpartyToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Coord/Angle display: " + DankersSkyblockMod.VALUE_COLOUR + coordsToggled + "\n" + @@ -300,7 +307,9 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Select all color items terminal solver: " + DankersSkyblockMod.VALUE_COLOUR + selectAllToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Ignore item frames on sea lanterns: " + DankersSkyblockMod.VALUE_COLOUR + itemFrameOnSeaLanternsToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Ultra sequencer solver: " + DankersSkyblockMod.VALUE_COLOUR + ultrasequencerToggled + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Chronomatron solver: " + DankersSkyblockMod.VALUE_COLOUR + chronomatronToggled)); + DankersSkyblockMod.TYPE_COLOUR + " Chronomatron solver: " + DankersSkyblockMod.VALUE_COLOUR + chronomatronToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Superpairs solver: " + DankersSkyblockMod.VALUE_COLOUR + superpairsToggled + )); break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); diff --git a/src/main/java/me/Danker/gui/ExperimentsGui.java b/src/main/java/me/Danker/gui/ExperimentsGui.java index 8b19820..42c9b66 100644 --- a/src/main/java/me/Danker/gui/ExperimentsGui.java +++ b/src/main/java/me/Danker/gui/ExperimentsGui.java @@ -14,6 +14,7 @@ public class ExperimentsGui extends GuiScreen { private GuiButton goBack; private GuiButton ultrasequencer; private GuiButton chronomatron; + private GuiButton superpairs; @Override public boolean doesGuiPauseGame() { @@ -31,10 +32,12 @@ public class ExperimentsGui extends GuiScreen { goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); ultrasequencer = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Ultrasequencer Solver: " + Utils.getColouredBoolean(ToggleCommand.ultrasequencerToggled)); chronomatron = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Chronomatron Solver: " + Utils.getColouredBoolean(ToggleCommand.chronomatronToggled)); + superpairs = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Superpairs Solver: " + Utils.getColouredBoolean(ToggleCommand.superpairsToggled)); this.buttonList.add(goBack); this.buttonList.add(ultrasequencer); this.buttonList.add(chronomatron); + this.buttonList.add(superpairs); } @Override @@ -55,6 +58,10 @@ public class ExperimentsGui extends GuiScreen { ToggleCommand.chronomatronToggled = !ToggleCommand.chronomatronToggled; ConfigHandler.writeBooleanConfig("toggles", "Chronomatron", ToggleCommand.chronomatronToggled); chronomatron.displayString = "Chronomatron Solver: " + Utils.getColouredBoolean(ToggleCommand.chronomatronToggled); + } else if (button == superpairs) { + ToggleCommand.superpairsToggled = !ToggleCommand.superpairsToggled; + ConfigHandler.writeBooleanConfig("toggles", "Superpairs", ToggleCommand.superpairsToggled); + superpairs.displayString = "Superpairs Solver: " + Utils.getColouredBoolean(ToggleCommand.superpairsToggled); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 5280747..0d0ccb1 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -203,6 +203,7 @@ public class ConfigHandler { if (!hasKey("toggles", "IgnoreItemFrameOnSeaLanterns")) writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", false); if (!hasKey("toggles", "UltraSequencer")) writeBooleanConfig("toggles", "UltraSequencer", false); if (!hasKey("toggles", "Chronomatron")) writeBooleanConfig("toggles", "Chronomatron", false); + if (!hasKey("toggles", "Superpairs")) writeBooleanConfig("toggles", "Superpairs", false); if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); @@ -446,6 +447,7 @@ public class ConfigHandler { ToggleCommand.itemFrameOnSeaLanternsToggled = getBoolean("toggles", "IgnoreItemFrameOnSeaLanterns"); ToggleCommand.ultrasequencerToggled = getBoolean("toggles", "UltraSequencer"); ToggleCommand.chronomatronToggled = getBoolean("toggles", "Chronomatron"); + ToggleCommand.superpairsToggled = getBoolean("toggles", "Superpairs"); String onlySlayer = getString("toggles", "BlockSlayer"); if (!onlySlayer.equals("")) { -- cgit