From ad53066846fb168255499a332a1ad4bca39f5935 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 27 Feb 2021 18:25:51 -0500 Subject: Move features into their own files --- src/main/java/me/Danker/features/AutoDisplay.java | 73 +++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/main/java/me/Danker/features/AutoDisplay.java (limited to 'src/main/java/me/Danker/features/AutoDisplay.java') diff --git a/src/main/java/me/Danker/features/AutoDisplay.java b/src/main/java/me/Danker/features/AutoDisplay.java new file mode 100644 index 0000000..aaed4ca --- /dev/null +++ b/src/main/java/me/Danker/features/AutoDisplay.java @@ -0,0 +1,73 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.DisplayCommand; +import me.Danker.handlers.ConfigHandler; +import me.Danker.handlers.ScoreboardHandler; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.List; + +public class AutoDisplay { + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + Minecraft mc = Minecraft.getMinecraft(); + World world = mc.theWorld; + EntityPlayerSP player = mc.thePlayer; + if (DankersSkyblockMod.tickAmount % 20 == 0) { + if (DisplayCommand.auto && world != null && player != 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; + } 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"; + } else if (sCleaned.contains("F7")) { + DisplayCommand.display = "catacombs_floor_seven"; + } + found = true; + } + } + for (int i = 0; i < 8; i++) { + ItemStack hotbarItem = player.inventory.getStackInSlot(i); + if (hotbarItem == null) continue; + if (hotbarItem.getDisplayName().contains("Ancestral Spade")) { + DisplayCommand.display = "mythological"; + found = true; + } + } + if (!found) DisplayCommand.display = "off"; + ConfigHandler.writeStringConfig("misc", "display", DisplayCommand.display); + } + } + } + +} -- cgit From abeb54dbea7e4219f4a277211cd33df3aff39dd9 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 27 Feb 2021 19:06:17 -0500 Subject: Make config handling easier And move display variables to LootDisplay.java --- .../java/me/Danker/commands/DankerGuiCommand.java | 5 +- .../java/me/Danker/commands/DisplayCommand.java | 79 +- src/main/java/me/Danker/features/AutoDisplay.java | 29 +- .../java/me/Danker/features/loot/LootDisplay.java | 9 +- src/main/java/me/Danker/gui/DisplayGui.java | 11 +- .../java/me/Danker/handlers/ConfigHandler.java | 845 ++++++++------------- 6 files changed, 370 insertions(+), 608 deletions(-) (limited to 'src/main/java/me/Danker/features/AutoDisplay.java') diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index deddc01..5ffd754 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -2,6 +2,7 @@ package me.Danker.commands; import me.Danker.DankersSkyblockMod; import me.Danker.features.SkillTracker; +import me.Danker.features.loot.LootDisplay; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.ResourcePackRepository; import net.minecraft.command.CommandBase; @@ -92,8 +93,8 @@ public class DankerGuiCommand extends CommandBase { debug.append("[skilltracker][").append(MoveCommand.skillTrackerXY[0]).append(", ").append(MoveCommand.skillTrackerXY[1]).append("]\n"); debug.append("[wateranswer][").append(MoveCommand.waterAnswerXY[0]).append(", ").append(MoveCommand.waterAnswerXY[1]).append("]\n"); debug.append("# Other Settings\n"); - debug.append("[Current Display][").append(DisplayCommand.display).append("]\n"); - debug.append("[Auto Display][").append(DisplayCommand.auto).append("]\n"); + debug.append("[Current Display][").append(LootDisplay.display).append("]\n"); + debug.append("[Auto Display][").append(LootDisplay.auto).append("]\n"); debug.append("[Skill Tracker Visible][").append(SkillTracker.showSkillTracker).append("]\n"); debug.append("# Resource Packs\n"); if (Minecraft.getMinecraft().getResourcePackRepository().getRepositoryEntries().size() == 0) { diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index d20491b..74f142a 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/me/Danker/commands/DisplayCommand.java @@ -1,6 +1,7 @@ package me.Danker.commands; import me.Danker.DankersSkyblockMod; +import me.Danker.features.loot.LootDisplay; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -12,8 +13,6 @@ import net.minecraft.util.ChatComponentText; import java.util.List; public class DisplayCommand extends CommandBase { - public static String display; - public static boolean auto; @Override public String getCommandName() { @@ -60,23 +59,23 @@ public class DisplayCommand extends CommandBase { switch (arg1[0].toLowerCase()) { case "wolf": if (showSession) { - display = "wolf_session"; + LootDisplay.display = "wolf_session"; } else { - display = "wolf"; + LootDisplay.display = "wolf"; } break; case "spider": if (showSession) { - display = "spider_session"; + LootDisplay.display = "spider_session"; } else { - display = "spider"; + LootDisplay.display = "spider"; } break; case "zombie": if (showSession) { - display = "zombie_session"; + LootDisplay.display = "zombie_session"; } else { - display = "zombie"; + LootDisplay.display = "zombie"; } break; case "fishing": @@ -84,45 +83,45 @@ public class DisplayCommand extends CommandBase { switch (arg1[1].toLowerCase()) { case "winter": if (showSession) { - display = "fishing_winter_session"; + LootDisplay.display = "fishing_winter_session"; } else { - display = "fishing_winter"; + LootDisplay.display = "fishing_winter"; } break; case "festival": if (showSession) { - display = "fishing_festival_session"; + LootDisplay.display = "fishing_festival_session"; } else { - display = "fishing_festival"; + LootDisplay.display = "fishing_festival"; } break; case "spooky": if (showSession) { - display = "fishing_spooky_session"; + LootDisplay.display = "fishing_spooky_session"; } else { - display = "fishing_spooky"; + LootDisplay.display = "fishing_spooky"; } break; default: if (showSession) { - display = "fishing_session"; + LootDisplay.display = "fishing_session"; } else { - display = "fishing"; + LootDisplay.display = "fishing"; } } } else { if (showSession) { - display = "fishing_session"; + LootDisplay.display = "fishing_session"; } else { - display = "fishing"; + LootDisplay.display = "fishing"; } } break; case "mythological": if (showSession) { - display = "mythological_session"; + LootDisplay.display = "mythological_session"; } else { - display = "mythological"; + LootDisplay.display = "mythological"; } break; case "catacombs": @@ -135,57 +134,57 @@ public class DisplayCommand extends CommandBase { case "f1": case "floor1": if (showSession) { - display = "catacombs_floor_one_session"; + LootDisplay.display = "catacombs_floor_one_session"; } else { - display = "catacombs_floor_one"; + LootDisplay.display = "catacombs_floor_one"; } break; case "f2": case "floor2": if (showSession) { - display = "catacombs_floor_two_session"; + LootDisplay.display = "catacombs_floor_two_session"; } else { - display = "catacombs_floor_two"; + LootDisplay.display = "catacombs_floor_two"; } break; case "f3": case "floor3": if (showSession) { - display = "catacombs_floor_three_session"; + LootDisplay.display = "catacombs_floor_three_session"; } else { - display = "catacombs_floor_three"; + LootDisplay.display = "catacombs_floor_three"; } break; case "f4": case "floor4": if (showSession) { - display = "catacombs_floor_four_session"; + LootDisplay.display = "catacombs_floor_four_session"; } else { - display = "catacombs_floor_four"; + LootDisplay.display = "catacombs_floor_four"; } break; case "f5": case "floor5": if (showSession) { - display = "catacombs_floor_five_session"; + LootDisplay.display = "catacombs_floor_five_session"; } else { - display = "catacombs_floor_five"; + LootDisplay.display = "catacombs_floor_five"; } break; case "f6": case "floor6": if (showSession) { - display = "catacombs_floor_six_session"; + LootDisplay.display = "catacombs_floor_six_session"; } else { - display = "catacombs_floor_six"; + LootDisplay.display = "catacombs_floor_six"; } break; case "f7": case "floor7": if (showSession) { - display = "catacombs_floor_seven_session"; + LootDisplay.display = "catacombs_floor_seven_session"; } else { - display = "catacombs_floor_seven"; + LootDisplay.display = "catacombs_floor_seven"; } break; default: @@ -194,22 +193,22 @@ public class DisplayCommand extends CommandBase { } break; case "auto": - auto = true; + LootDisplay.auto = true; player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Display set to " + DankersSkyblockMod.SECONDARY_COLOUR + "auto" + DankersSkyblockMod.MAIN_COLOUR + ".")); ConfigHandler.writeBooleanConfig("misc", "autoDisplay", true); return; case "off": - display = "off"; + LootDisplay.display = "off"; break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; } - - auto = false; - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Display set to " + DankersSkyblockMod.SECONDARY_COLOUR + display + DankersSkyblockMod.MAIN_COLOUR + ".")); + + LootDisplay.auto = false; + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Display set to " + DankersSkyblockMod.SECONDARY_COLOUR + LootDisplay.display + DankersSkyblockMod.MAIN_COLOUR + ".")); ConfigHandler.writeBooleanConfig("misc", "autoDisplay", false); - ConfigHandler.writeStringConfig("misc", "display", display); + ConfigHandler.writeStringConfig("misc", "display", LootDisplay.display); } } diff --git a/src/main/java/me/Danker/features/AutoDisplay.java b/src/main/java/me/Danker/features/AutoDisplay.java index aaed4ca..5411034 100644 --- a/src/main/java/me/Danker/features/AutoDisplay.java +++ b/src/main/java/me/Danker/features/AutoDisplay.java @@ -2,6 +2,7 @@ package me.Danker.features; import me.Danker.DankersSkyblockMod; import me.Danker.commands.DisplayCommand; +import me.Danker.features.loot.LootDisplay; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.ScoreboardHandler; import net.minecraft.client.Minecraft; @@ -23,35 +24,35 @@ public class AutoDisplay { World world = mc.theWorld; EntityPlayerSP player = mc.thePlayer; if (DankersSkyblockMod.tickAmount % 20 == 0) { - if (DisplayCommand.auto && world != null && player != null) { + if (LootDisplay.auto && world != null && player != 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"; + LootDisplay.display = "wolf"; found = true; } else if (sCleaned.contains("Tarantula Broodfather")) { - DisplayCommand.display = "spider"; + LootDisplay.display = "spider"; found = true; } else if (sCleaned.contains("Revenant Horror")) { - DisplayCommand.display = "zombie"; + LootDisplay.display = "zombie"; found = true; } else if (sCleaned.contains("The Catacombs (")) { if (sCleaned.contains("F1")) { - DisplayCommand.display = "catacombs_floor_one"; + LootDisplay.display = "catacombs_floor_one"; } else if (sCleaned.contains("F2")) { - DisplayCommand.display = "catacombs_floor_two"; + LootDisplay.display = "catacombs_floor_two"; } else if (sCleaned.contains("F3")) { - DisplayCommand.display = "catacombs_floor_three"; + LootDisplay.display = "catacombs_floor_three"; } else if (sCleaned.contains("F4")) { - DisplayCommand.display = "catacombs_floor_four"; + LootDisplay.display = "catacombs_floor_four"; } else if (sCleaned.contains("F5")) { - DisplayCommand.display = "catacombs_floor_five"; + LootDisplay.display = "catacombs_floor_five"; } else if (sCleaned.contains("F6")) { - DisplayCommand.display = "catacombs_floor_six"; + LootDisplay.display = "catacombs_floor_six"; } else if (sCleaned.contains("F7")) { - DisplayCommand.display = "catacombs_floor_seven"; + LootDisplay.display = "catacombs_floor_seven"; } found = true; } @@ -60,12 +61,12 @@ public class AutoDisplay { ItemStack hotbarItem = player.inventory.getStackInSlot(i); if (hotbarItem == null) continue; if (hotbarItem.getDisplayName().contains("Ancestral Spade")) { - DisplayCommand.display = "mythological"; + LootDisplay.display = "mythological"; found = true; } } - if (!found) DisplayCommand.display = "off"; - ConfigHandler.writeStringConfig("misc", "display", DisplayCommand.display); + if (!found) LootDisplay.display = "off"; + ConfigHandler.writeStringConfig("misc", "display", LootDisplay.display); } } } diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index d4868e3..4013c0a 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -17,9 +17,12 @@ import java.util.Locale; public class LootDisplay { + public static String display; + public static boolean auto; + @SubscribeEvent public void renderPlayerInfo(RenderOverlay event) { - if (!DisplayCommand.display.equals("off")) { + if (!display.equals("off")) { Minecraft mc = Minecraft.getMinecraft(); String dropsText = ""; String countText = ""; @@ -31,7 +34,7 @@ public class LootDisplay { double timeNow = System.currentTimeMillis() / 1000; NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); - switch (DisplayCommand.display) { + switch (display) { case "wolf": if (LootTracker.wolfTime == -1) { timeBetween = "Never"; @@ -892,7 +895,7 @@ public class LootDisplay { break; default: System.out.println("Display was an unknown value, turning off."); - DisplayCommand.display = "off"; + display = "off"; ConfigHandler.writeStringConfig("misc", "display", "off"); } new TextRenderer(mc, dropsText, MoveCommand.displayXY[0], MoveCommand.displayXY[1], ScaleCommand.displayScale); diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 2f704b3..4e5831d 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -2,6 +2,7 @@ package me.Danker.gui; import me.Danker.DankersSkyblockMod; import me.Danker.commands.DisplayCommand; +import me.Danker.features.loot.LootDisplay; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; @@ -94,10 +95,10 @@ public class DisplayGui extends GuiScreen { Minecraft mc = Minecraft.getMinecraft(); String displayText; - if (DisplayCommand.auto) { + if (LootDisplay.auto) { displayText = "Current Display: auto"; } else { - displayText = "Current Display: " + DisplayCommand.display; + displayText = "Current Display: " + LootDisplay.display; } int displayWidth = mc.fontRendererObj.getStringWidth(displayText); new TextRenderer(mc, displayText, width / 2 - displayWidth / 2, 10, 1D); @@ -125,7 +126,7 @@ public class DisplayGui extends GuiScreen { } else if (button == wolf) { setDisplay("wolf", false); } else if (button == auto) { - DisplayCommand.auto = true; + LootDisplay.auto = true; ConfigHandler.writeBooleanConfig("misc", "autoDisplay", true); } else if (button == fishing) { setDisplay("fishing", false); @@ -156,8 +157,8 @@ public class DisplayGui extends GuiScreen { public void setDisplay(String display, boolean forceNoSession) { if (!forceNoSession && addSession) display += "_session"; - DisplayCommand.auto = false; - DisplayCommand.display = display; + LootDisplay.auto = false; + LootDisplay.display = display; ConfigHandler.writeBooleanConfig("misc", "autoDisplay", false); ConfigHandler.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 7c51b1b..53f499b 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -6,6 +6,7 @@ import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; import me.Danker.commands.ToggleCommand; import me.Danker.features.*; +import me.Danker.features.loot.LootDisplay; import me.Danker.features.loot.LootTracker; import me.Danker.features.puzzlesolvers.*; import net.minecraft.client.Minecraft; @@ -170,354 +171,103 @@ public class ConfigHandler { config.save(); } } - - public static void reloadConfig() { - // Config init - if (!hasKey("toggles", "GParty")) writeBooleanConfig("toggles", "GParty", false); - if (!hasKey("toggles", "Coords")) writeBooleanConfig("toggles", "Coords", false); - if (!hasKey("toggles", "Golden")) writeBooleanConfig("toggles", "Golden", false); - if (!hasKey("toggles", "SlayerCount")) writeBooleanConfig("toggles", "SlayerCount", true); - if (!hasKey("toggles", "RNGesusAlerts")) writeBooleanConfig("toggles", "RNGesusAlerts", true); - if (!hasKey("toggles", "SplitFishing")) writeBooleanConfig("toggles", "SplitFishing", true); - if (!hasKey("toggles", "ChatMaddox")) writeBooleanConfig("toggles", "ChatMaddox", true); - if (!hasKey("toggles", "SpiritBearAlerts")) writeBooleanConfig("toggles", "SpiritBearAlerts", true); - if (!hasKey("toggles", "AOTD")) writeBooleanConfig("toggles", "AOTD", false); - if (!hasKey("toggles", "LividDagger")) writeBooleanConfig("toggles", "LividDagger", false); - if (!hasKey("toggles", "MidasStaffMessages")) writeBooleanConfig("toggles", "MidasStaffMessages", true); - if (!hasKey("toggles", "ImplosionMessages")) writeBooleanConfig("toggles", "ImplosionMessages", true); - if (!hasKey("toggles", "HealMessages")) writeBooleanConfig("toggles", "HealMessages", true); - if (!hasKey("toggles", "PetColors")) writeBooleanConfig("toggles", "PetColors", 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("toggles", "Skill50Display")) writeBooleanConfig("toggles", "Skill50Display", false); - if (!hasKey("toggles", "OutlineText")) writeBooleanConfig("toggles", "OutlineText", false); - if (!hasKey("toggles", "CakeTimer")) writeBooleanConfig("toggles", "CakeTimer", false); - // Chat Messages - if (!hasKey("toggles", "SceptreMessages")) writeBooleanConfig("toggles", "SceptreMessages", true); - if (!hasKey("toggles", "MidasStaffMessages")) writeBooleanConfig("toggles", "MidasStaffMessages", true); - if (!hasKey("toggles", "ImplosionMessages")) writeBooleanConfig("toggles", "ImplosionMessages", true); - if (!hasKey("toggles", "HealMessages")) writeBooleanConfig("toggles", "HealMessages", true); - if (!hasKey("toggles", "CooldownMessages")) writeBooleanConfig("toggles","CooldownMessages",true); - if (!hasKey("toggles", "ManaMessages")) writeBooleanConfig("toggles","ManaMessages",true); - // Dungeons - if (!hasKey("toggles", "DungeonTimer")) writeBooleanConfig("toggles", "DungeonTimer", false); - if (!hasKey("toggles", "LowHealthNotify")) writeBooleanConfig("toggles", "LowHealthNotify", false); - if (!hasKey("toggles", "LividSolver")) writeBooleanConfig("toggles", "LividSolver", false); - if (!hasKey("toggles", "StopSalvageStarred")) writeBooleanConfig("toggles", "StopSalvageStarred", false); - if (!hasKey("toggles", "WatcherReadyMessage")) writeBooleanConfig("toggles", "WatcherReadyMessage", false); - if (!hasKey("toggles", "PickBlock")) writeBooleanConfig("toggles", "PickBlock", false); - if (!hasKey("toggles", "FlowerWeapons")) writeBooleanConfig("toggles", "FlowerWeapons", false); - if (!hasKey("toggles", "NotifySlayerSlain")) writeBooleanConfig("toggles", "NotifySlayerSlain", false); - if (!hasKey("toggles", "NecronNotifications")) writeBooleanConfig("toggles", "NecronNotifications", false); - if (!hasKey("toggles", "BonzoTimer")) writeBooleanConfig("toggles", "BonzoTimer", false); - if (!hasKey("toggles", "AutoSkillTracker")) writeBooleanConfig("toggles", "AutoSkillTracker", false); - // Puzzle Solvers - if (!hasKey("toggles", "ThreeManPuzzle")) writeBooleanConfig("toggles", "ThreeManPuzzle", false); - if (!hasKey("toggles", "OruoPuzzle")) writeBooleanConfig("toggles", "OruoPuzzle", false); - if (!hasKey("toggles", "BlazePuzzle")) writeBooleanConfig("toggles", "BlazePuzzle", false); - if (!hasKey("toggles", "CreeperPuzzle")) writeBooleanConfig("toggles", "CreeperPuzzle", false); - if (!hasKey("toggles", "WaterPuzzle")) writeBooleanConfig("toggles", "WaterPuzzle", false); - if (!hasKey("toggles", "TicTacToePuzzle")) writeBooleanConfig("toggles", "TicTacToePuzzle", false); - if (!hasKey("toggles", "StartsWithTerminal")) writeBooleanConfig("toggles", "StartsWithTerminal", false); - if (!hasKey("toggles", "SelectAllTerminal")) writeBooleanConfig("toggles", "SelectAllTerminal", false); - if (!hasKey("toggles", "ClickInOrderTerminal")) writeBooleanConfig("toggles", "ClickInOrderTerminal", false); - if (!hasKey("toggles", "BlockWrongTerminalClicks")) writeBooleanConfig("toggles", "BlockWrongTerminalClicks", false); - if (!hasKey("toggles", "IgnoreItemFrameOnSeaLanterns")) writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", false); - // Experiment Solvers - 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("toggles", "HideTooltipsInExperimentAddons")) writeBooleanConfig("toggles", "HideTooltipsInExperimentAddons", false); - if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); - - // Wolf Loot - if (!hasKey("wolf", "svens")) writeIntConfig("wolf", "svens", 0); - if (!hasKey("wolf", "teeth")) writeIntConfig("wolf", "teeth", 0); - if (!hasKey("wolf", "wheel")) writeIntConfig("wolf", "wheel", 0); - if (!hasKey("wolf", "wheelDrops")) writeIntConfig("wolf", "wheelDrops", 0); - if (!hasKey("wolf", "spirit")) writeIntConfig("wolf", "spirit", 0); - if (!hasKey("wolf", "book")) writeIntConfig("wolf", "book", 0); - if (!hasKey("wolf", "egg")) writeIntConfig("wolf", "egg", 0); - if (!hasKey("wolf", "couture")) writeIntConfig("wolf", "couture", 0); - if (!hasKey("wolf", "bait")) writeIntConfig("wolf", "bait", 0); - if (!hasKey("wolf", "flux")) writeIntConfig("wolf", "flux", 0); - if (!hasKey("wolf", "timeRNG")) writeDoubleConfig("wolf", "timeRNG", -1); - if (!hasKey("wolf", "bossRNG")) writeIntConfig("wolf", "bossRNG", -1); - // Spider Loot - if (!hasKey("spider", "tarantulas")) writeIntConfig("spider", "tarantulas", 0); - if (!hasKey("spider", "web")) writeIntConfig("spider", "web", 0); - if (!hasKey("spider", "tap")) writeIntConfig("spider", "tap", 0); - if (!hasKey("spider", "tapDrops")) writeIntConfig("spider", "tapDrops", 0); - if (!hasKey("spider", "bite")) writeIntConfig("spider", "bite", 0); - if (!hasKey("spider", "catalyst")) writeIntConfig("spider", "catalyst", 0); - if (!hasKey("spider", "book")) writeIntConfig("spider", "book", 0); - if (!hasKey("spider", "swatter")) writeIntConfig("spider", "swatter", 0); - if (!hasKey("spider", "talisman")) writeIntConfig("spider", "talisman", 0); - if (!hasKey("spider", "mosquito")) writeIntConfig("spider", "mosquito", 0); - if (!hasKey("spider", "timeRNG")) writeDoubleConfig("spider", "timeRNG", -1); - if (!hasKey("spider", "bossRNG")) writeIntConfig("spider", "bossRNG", -1); - // Zombie Loot - if (!hasKey("zombie", "revs")) writeIntConfig("zombie", "revs", 0); - if (!hasKey("zombie", "revFlesh")) writeIntConfig("zombie", "revFlesh", 0); - if (!hasKey("zombie", "foulFlesh")) writeIntConfig("zombie", "foulFlesh", 0); - if (!hasKey("zombie", "foulFleshDrops")) writeIntConfig("zombie", "foulFleshDrops", 0); - if (!hasKey("zombie", "pestilence")) writeIntConfig("zombie", "pestilence", 0); - if (!hasKey("zombie", "undeadCatalyst")) writeIntConfig("zombie", "undeadCatalyst", 0); - if (!hasKey("zombie", "book")) writeIntConfig("zombie", "book", 0); - if (!hasKey("zombie", "beheaded")) writeIntConfig("zombie", "beheaded", 0); - if (!hasKey("zombie", "revCatalyst")) writeIntConfig("zombie", "revCatalyst", 0); - if (!hasKey("zombie", "snake")) writeIntConfig("zombie", "snake", 0); - if (!hasKey("zombie", "scythe")) writeIntConfig("zombie", "scythe", 0); - if (!hasKey("zombie", "timeRNG")) writeDoubleConfig("zombie", "timeRNG", -1); - if (!hasKey("zombie", "bossRNG")) writeIntConfig("zombie", "bossRNG", -1); - - // Fishing - if (!hasKey("fishing", "seaCreature")) writeIntConfig("fishing", "seaCreature", 0); - if (!hasKey("fishing", "goodCatch")) writeIntConfig("fishing", "goodCatch", 0); - if (!hasKey("fishing", "greatCatch")) writeIntConfig("fishing", "greatCatch", 0); - if (!hasKey("fishing", "squid")) writeIntConfig("fishing", "squid", 0); - if (!hasKey("fishing", "seaWalker")) writeIntConfig("fishing", "seaWalker", 0); - if (!hasKey("fishing", "nightSquid")) writeIntConfig("fishing", "nightSquid", 0); - if (!hasKey("fishing", "seaGuardian")) writeIntConfig("fishing", "seaGuardian", 0); - if (!hasKey("fishing", "seaWitch")) writeIntConfig("fishing", "seaWitch", 0); - if (!hasKey("fishing", "seaArcher")) writeIntConfig("fishing", "seaArcher", 0); - if (!hasKey("fishing", "monsterOfDeep")) writeIntConfig("fishing", "monsterOfDeep", 0); - if (!hasKey("fishing", "catfish")) writeIntConfig("fishing", "catfish", 0); - if (!hasKey("fishing", "carrotKing")) writeIntConfig("fishing", "carrotKing", 0); - if (!hasKey("fishing", "seaLeech")) writeIntConfig("fishing", "seaLeech", 0); - if (!hasKey("fishing", "guardianDefender")) writeIntConfig("fishing", "guardianDefender", 0); - if (!hasKey("fishing", "deepSeaProtector")) writeIntConfig("fishing", "deepSeaProtector", 0); - if (!hasKey("fishing", "hydra")) writeIntConfig("fishing", "hydra", 0); - if (!hasKey("fishing", "seaEmperor")) writeIntConfig("fishing", "seaEmperor", 0); - if (!hasKey("fishing", "empTime")) writeDoubleConfig("fishing", "empTime", -1); - if (!hasKey("fishing", "empSC")) writeIntConfig("fishing", "empSC", -1); - if (!hasKey("fishing", "milestone")) writeIntConfig("fishing", "milestone", 0); - // Fishing Winter - if (!hasKey("fishing", "frozenSteve")) writeIntConfig("fishing", "frozenSteve", 0); - if (!hasKey("fishing", "snowman")) writeIntConfig("fishing", "snowman", 0); - if (!hasKey("fishing", "grinch")) writeIntConfig("fishing", "grinch", 0); - if (!hasKey("fishing", "yeti")) writeIntConfig("fishing", "yeti", 0); - if (!hasKey("fishing", "yetiTime")) writeDoubleConfig("fishing", "yetiTime", -1); - if (!hasKey("fishing", "yetiSC")) writeIntConfig("fishing", "yetiSC", -1); - // 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); - // Spooky Fishing - if (!hasKey("fishing", "scarecrow")) writeIntConfig("fishing", "scarecrow", 0); - if (!hasKey("fishing", "nightmare")) writeIntConfig("fishing", "nightmare", 0); - if (!hasKey("fishing", "werewolf")) writeIntConfig("fishing", "werewolf", 0); - if (!hasKey("fishing", "phantomFisher")) writeIntConfig("fishing", "phantomFisher", 0); - if (!hasKey("fishing", "grimReaper")) writeIntConfig("fishing", "grimReaper", 0); - - // Mythological - if (!hasKey("mythological", "coins")) writeDoubleConfig("mythological", "coins", 0); - if (!hasKey("mythological", "griffinFeather")) writeIntConfig("mythological", "griffinFeather", 0); - if (!hasKey("mythological", "crownOfGreed")) writeIntConfig("mythological", "crownOfGreed", 0); - if (!hasKey("mythological", "washedUpSouvenir")) writeIntConfig("mythological", "washedUpSouvenir", 0); - if (!hasKey("mythological", "minosHunter")) writeIntConfig("mythological", "minosHunter", 0); - if (!hasKey("mythological", "siameseLynx")) writeIntConfig("mythological", "siameseLynx", 0); - if (!hasKey("mythological", "minotaur")) writeIntConfig("mythological", "minotaur", 0); - if (!hasKey("mythological", "gaiaConstruct")) writeIntConfig("mythological", "gaiaConstruct", 0); - if (!hasKey("mythological", "minosChampion")) writeIntConfig("mythological", "minosChampion", 0); - if (!hasKey("mythological", "minosInquisitor")) writeIntConfig("mythological", "minosInquisitor", 0); - - // Dungeons - if (!hasKey("catacombs", "recombobulator")) writeIntConfig("catacombs", "recombobulator", 0); - if (!hasKey("catacombs", "fumingBooks")) writeIntConfig("catacombs", "fumingBooks", 0); - // F1 - if (!hasKey("catacombs", "bonzoStaff")) writeIntConfig("catacombs", "bonzoStaff", 0); - if (!hasKey("catacombs", "floorOneCoins")) writeDoubleConfig("catacombs", "floorOneCoins", 0); - if (!hasKey("catacombs", "floorOneTime")) writeDoubleConfig("catacombs", "floorOneTime", 0); - // F2 - if (!hasKey("catacombs", "scarfStudies")) writeIntConfig("catacombs", "scarfStudies", 0); - if (!hasKey("catacombs", "floorTwoCoins")) writeDoubleConfig("catacombs", "floorTwoCoins", 0); - if (!hasKey("catacombs", "floorTwoTime")) writeDoubleConfig("catacombs", "floorTwoTime", 0); - // F3 - if (!hasKey("catacombs", "adaptiveHelm")) writeIntConfig("catacombs", "adaptiveHelm", 0); - if (!hasKey("catacombs", "adaptiveChest")) writeIntConfig("catacombs", "adaptiveChest", 0); - if (!hasKey("catacombs", "adaptiveLegging")) writeIntConfig("catacombs", "adaptiveLegging", 0); - if (!hasKey("catacombs", "adaptiveBoot")) writeIntConfig("catacombs", "adaptiveBoot", 0); - if (!hasKey("catacombs", "adaptiveSword")) writeIntConfig("catacombs", "adaptiveSword", 0); - if (!hasKey("catacombs", "floorThreeCoins")) writeDoubleConfig("catacombs", "floorThreeCoins", 0); - if (!hasKey("catacombs", "floorThreeTime")) writeDoubleConfig("catacombs", "floorThreeTime", 0); - // F4 - if (!hasKey("catacombs", "spiritWing")) writeIntConfig("catacombs", "spiritWing", 0); - if (!hasKey("catacombs", "spiritBone")) writeIntConfig("catacombs", "spiritBone", 0); - if (!hasKey("catacombs", "spiritBoot")) writeIntConfig("catacombs", "spiritBoot", 0); - if (!hasKey("catacombs", "spiritSword")) writeIntConfig("catacombs", "spiritSword", 0); - if (!hasKey("catacombs", "spiritBow")) writeIntConfig("catacombs", "spiritBow", 0); - if (!hasKey("catacombs", "spiritPetEpic")) writeIntConfig("catacombs", "spiritPetEpic", 0); - if (!hasKey("catacombs", "spiritPetLeg")) writeIntConfig("catacombs", "spiritPetLeg", 0); - if (!hasKey("catacombs", "floorFourCoins")) writeDoubleConfig("catacombs", "floorFourCoins", 0); - if (!hasKey("catacombs", "floorFourTime")) writeDoubleConfig("catacombs", "floorFourTime", 0); - // 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", "lastBreath")) writeIntConfig("catacombs", "lastBreath", 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); - // 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); - // F7 - if (!hasKey("catacombs", "witherBlood")) writeIntConfig("catacombs", "witherBlood", 0); - if (!hasKey("catacombs", "witherCloak")) writeIntConfig("catacombs", "witherCloak", 0); - if (!hasKey("catacombs", "implosion")) writeIntConfig("catacombs", "implosion", 0); - if (!hasKey("catacombs", "witherShield")) writeIntConfig("catacombs", "witherShield", 0); - if (!hasKey("catacombs", "shadowWarp")) writeIntConfig("catacombs", "shadowWarp", 0); - if (!hasKey("catacombs", "necronsHandle")) writeIntConfig("catacombs", "necronsHandle", 0); - if (!hasKey("catacombs", "autoRecomb")) writeIntConfig("catacombs", "autoRecomb", 0); - if (!hasKey("catacombs", "witherHelm")) writeIntConfig("catacombs", "witherHelm", 0); - if (!hasKey("catacombs", "witherChest")) writeIntConfig("catacombs", "witherChest", 0); - if (!hasKey("catacombs", "witherLegging")) writeIntConfig("catacombs", "witherLegging", 0); - if (!hasKey("catacombs", "witherBoot")) writeIntConfig("catacombs", "witherBoot", 0); - if (!hasKey("catacombs", "floorSevenCoins")) writeDoubleConfig("catacombs", "floorSevenCoins", 0); - if (!hasKey("catacombs", "floorSevenTime")) writeDoubleConfig("catacombs", "floorSevenTime", 0); - - if (!hasKey("misc", "display")) writeStringConfig("misc", "display", "off"); - if (!hasKey("misc", "autoDisplay")) writeBooleanConfig("misc", "autoDisplay", false); - if (!hasKey("misc", "skill50Time")) writeIntConfig("misc", "skill50Time", 3); - if (!hasKey("misc", "cakeTime")) writeDoubleConfig("misc", "cakeTime", 0); - if (!hasKey("misc", "showSkillTracker")) writeBooleanConfig("misc", "showSkillTracker", false); - if (!hasKey("misc", "firstLaunch")) writeBooleanConfig("misc", "firstLaunch", true); + public static int initInt(String category, String key, int defaultValue) { + if (!hasKey(category, key)) { + writeIntConfig(category, key, defaultValue); + return defaultValue; + } else { + return getInt(category, key); + } + } - ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft()); - int height = scaled.getScaledHeight(); - if (!hasKey("locations", "coordsX")) writeIntConfig("locations", "coordsX", 5); - if (!hasKey("locations", "coordsY")) writeIntConfig("locations", "coordsY", height - 25); - if (!hasKey("locations", "displayX")) writeIntConfig("locations", "displayX", 80); - if (!hasKey("locations", "displayY")) writeIntConfig("locations", "displayY", 5); - if (!hasKey("locations", "dungeonTimerX")) writeIntConfig("locations", "dungeonTimerX", 5); - if (!hasKey("locations", "dungeonTimerY")) writeIntConfig("locations", "dungeonTimerY", 5); - if (!hasKey("locations", "skill50X")) writeIntConfig("locations", "skill50X", 40); - if (!hasKey("locations", "skill50Y")) writeIntConfig("locations", "skill50Y", 10); - if (!hasKey("locations", "lividHpX")) writeIntConfig("locations", "lividHpX", 40); - if (!hasKey("locations", "lividHpY")) writeIntConfig("locations", "lividHpY", 20); - if (!hasKey("locations", "cakeTimerX")) writeIntConfig("locations", "cakeTimerX", 40); - if (!hasKey("locations", "cakeTimerY")) writeIntConfig("locations", "cakeTimerY", 30); - if (!hasKey("locations", "skillTrackerX")) writeIntConfig("locations", "skillTrackerX", 40); - if (!hasKey("locations", "skillTrackerY")) writeIntConfig("locations", "skillTrackerY", 50); - if (!hasKey("locations", "waterAnswerX")) writeIntConfig("locations", "waterAnswerX", 100); - if (!hasKey("locations", "waterAnswerY")) writeIntConfig("locations", "waterAnswerY", 100); - if (!hasKey("locations", "bonzoTimerX")) writeIntConfig("locations", "bonzoTimerX", 40); - if (!hasKey("locations", "bonzoTimerY")) writeIntConfig("locations", "bonzoTimerY", 80); - 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); - if (!hasKey("scales", "lividHpScale")) writeDoubleConfig("scales", "lividHpScale", 1); - if (!hasKey("scales", "cakeTimerScale")) writeDoubleConfig("scales", "cakeTimerScale", 1); - if (!hasKey("scales", "skillTrackerScale")) writeDoubleConfig("scales", "skillTrackerScale", 1); - if (!hasKey("scales", "waterAnswerScale")) writeDoubleConfig("scales", "waterAnswerScale", 1); - if (!hasKey("scales", "bonzoTimerScale")) writeDoubleConfig("scales", "bonzoTimerScale", 1); + public static double initDouble(String category, String key, double defaultValue) { + if (!hasKey(category, key)) { + writeDoubleConfig(category, key, defaultValue); + return defaultValue; + } else { + return getDouble(category, key); + } + } - if (!hasKey("colors", "main")) writeStringConfig("colors", "main", EnumChatFormatting.GREEN.toString()); - if (!hasKey("colors", "secondary")) writeStringConfig("colors", "secondary", EnumChatFormatting.DARK_GREEN.toString()); - if (!hasKey("colors", "delimiter")) writeStringConfig("colors", "delimiter", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.STRIKETHROUGH.toString()); - if (!hasKey("colors", "error")) writeStringConfig("colors", "error", EnumChatFormatting.RED.toString()); - if (!hasKey("colors", "type")) writeStringConfig("colors", "type", EnumChatFormatting.GREEN.toString()); - if (!hasKey("colors", "value")) writeStringConfig("colors", "value", EnumChatFormatting.DARK_GREEN.toString()); - if (!hasKey("colors", "skillAverage")) writeStringConfig("colors", "skillAverage", EnumChatFormatting.GOLD.toString()); - if (!hasKey("colors", "answer")) writeStringConfig("colors", "answer", EnumChatFormatting.DARK_GREEN.toString()); - if (!hasKey("colors", "skill50Display")) writeStringConfig("colors", "skill50Display", EnumChatFormatting.AQUA.toString()); - if (!hasKey("colors", "coordsDisplay")) writeStringConfig("colors", "coordsDisplay", EnumChatFormatting.WHITE.toString()); - if (!hasKey("colors", "cakeDisplay")) writeStringConfig("colors", "cakeDisplay", EnumChatFormatting.GOLD.toString()); - if (!hasKey("colors", "skillTracker")) writeStringConfig("colors", "skillTracker", EnumChatFormatting.AQUA.toString()); - if (!hasKey("colors", "triviaWrongAnswer")) writeStringConfig("colors", "triviaWrongAnswer", EnumChatFormatting.RED.toString()); - if (!hasKey("colors", "bonzoDisplay")) writeStringConfig("colors", "bonzoDisplay", EnumChatFormatting.RED.toString()); - if (!hasKey("colors", "blazeLowest")) writeIntConfig("colors", "blazeLowest", 0xFF0000); - if (!hasKey("colors", "blazeHighest")) writeIntConfig("colors", "blazeHighest", 0x40FF40); - if (!hasKey("colors", "pet1To9")) writeIntConfig("colors", "pet1To9", 0x999999); // Gray - if (!hasKey("colors", "pet10To19")) writeIntConfig("colors", "pet10To19", 0xD62440); // Red - if (!hasKey("colors", "pet20To29")) writeIntConfig("colors", "pet20To29", 0xEF5230); // Orange - if (!hasKey("colors", "pet30To39")) writeIntConfig("colors", "pet30To39", 0xFFC400); // Yellow - if (!hasKey("colors", "pet40To49")) writeIntConfig("colors", "pet40To49", 0x0EAC35); // Green - if (!hasKey("colors", "pet50To59")) writeIntConfig("colors", "pet50To59", 0x008AD8); // Light Blue - if (!hasKey("colors", "pet60To69")) writeIntConfig("colors", "pet60To69", 0x7E4FC6); // Purple - if (!hasKey("colors", "pet70To79")) writeIntConfig("colors", "pet70To79", 0xD64FC8); // Pink - if (!hasKey("colors", "pet80To89")) writeIntConfig("colors", "pet80To89", 0x5C1F35); // idk weird magenta - if (!hasKey("colors", "pet90To99")) writeIntConfig("colors", "pet90To99", 0x9E794E); // Brown - if (!hasKey("colors", "pet100")) writeIntConfig("colors", "pet100", 0xF2D249); // Gold - if (!hasKey("colors", "ultrasequencerNext")) writeIntConfig("colors", "ultrasequencerNext", 0x40FF40); - if (!hasKey("colors", "ultrasequencerNextToNext")) writeIntConfig("colors", "ultrasequencerNextToNext", 0x40DAE6); - if (!hasKey("colors", "chronomatronNext")) writeIntConfig("colors", "chronomatronNext", 0x40FF40); - if (!hasKey("colors", "chronomatronNextToNext")) writeIntConfig("colors", "chronomatronNextToNext", 0x40DAE6); - if (!hasKey("colors", "clickInOrderNext")) writeIntConfig("colors", "clickInOrderNext", 0xFF00DD); - if (!hasKey("colors", "clickInOrderNextToNext")) writeIntConfig("colors", "clickInOrderNextToNext", 0x0BEFE7); + public static String initString(String category, String key, String defaultValue) { + if (!hasKey(category, key)) { + writeStringConfig(category, key, defaultValue); + return defaultValue; + } else { + return getString(category, key); + } + } - // Commands - if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false); - - ToggleCommand.gpartyToggled = getBoolean("toggles", "GParty"); - ToggleCommand.coordsToggled = getBoolean("toggles", "Coords"); - ToggleCommand.goldenToggled = getBoolean("toggles", "Golden"); - ToggleCommand.slayerCountTotal = getBoolean("toggles", "SlayerCount"); - ToggleCommand.rngesusAlerts = getBoolean("toggles", "RNGesusAlerts"); - ToggleCommand.splitFishing = getBoolean("toggles", "SplitFishing"); - ToggleCommand.chatMaddoxToggled = getBoolean("toggles", "ChatMaddox"); - ToggleCommand.spiritBearAlerts = getBoolean("toggles", "SpiritBearAlerts"); - ToggleCommand.aotdToggled = getBoolean("toggles", "AOTD"); - ToggleCommand.lividDaggerToggled = getBoolean("toggles", "LividDagger"); - ToggleCommand.petColoursToggled = getBoolean("toggles", "PetColors"); - ToggleCommand.golemAlertToggled = getBoolean("toggles", "GolemAlerts"); - ToggleCommand.expertiseLoreToggled = getBoolean("toggles", "ExpertiseLore"); - ToggleCommand.skill50DisplayToggled = getBoolean("toggles", "Skill50Display"); - ToggleCommand.outlineTextToggled = getBoolean("toggles", "OutlineText"); - ToggleCommand.cakeTimerToggled = getBoolean("toggles", "CakeTimer"); + public static boolean initBoolean(String category, String key, boolean defaultValue) { + if (!hasKey(category, key)) { + writeBooleanConfig(category, key, defaultValue); + return defaultValue; + } else { + return getBoolean(category, key); + } + } + + public static void reloadConfig() { + // Toggles + ToggleCommand.gpartyToggled = initBoolean("toggles", "GParty", false); + ToggleCommand.coordsToggled = initBoolean("toggles", "Coords", false); + ToggleCommand.goldenToggled = initBoolean("toggles", "Golden", false); + ToggleCommand.slayerCountTotal = initBoolean("toggles", "SlayerCount", true); + ToggleCommand.rngesusAlerts = initBoolean("toggles", "RNGesusAlerts", false); + ToggleCommand.splitFishing = initBoolean("toggles", "SplitFishing", true); + ToggleCommand.chatMaddoxToggled = initBoolean("toggles", "ChatMaddox", false); + ToggleCommand.spiritBearAlerts = initBoolean("toggles", "SpiritBearAlerts", false); + ToggleCommand.aotdToggled = initBoolean("toggles", "AOTD", false); + ToggleCommand.lividDaggerToggled = initBoolean("toggles", "LividDagger", false); + ToggleCommand.petColoursToggled = initBoolean("toggles", "PetColors", false); + ToggleCommand.golemAlertToggled = initBoolean("toggles", "GolemAlerts", false); + ToggleCommand.expertiseLoreToggled = initBoolean("toggles", "ExpertiseLore", false); + ToggleCommand.skill50DisplayToggled = initBoolean("toggles", "Skill50Display", false); + ToggleCommand.outlineTextToggled = initBoolean("toggles", "OutlineText", false); + ToggleCommand.cakeTimerToggled = initBoolean("toggles", "CakeTimer", false); // Chat Messages - ToggleCommand.sceptreMessages = getBoolean("toggles", "SceptreMessages"); - ToggleCommand.midasStaffMessages = getBoolean("toggles", "MidasStaffMessages"); - ToggleCommand.implosionMessages = getBoolean("toggles", "ImplosionMessages"); - ToggleCommand.healMessages = getBoolean("toggles", "HealMessages"); - ToggleCommand.cooldownMessages = getBoolean("toggles", "CooldownMessages"); - ToggleCommand.manaMessages = getBoolean("toggles", "ManaMessages"); + ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); + ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); + ToggleCommand.implosionMessages = initBoolean("toggles", "ImplosionMessages", true); + ToggleCommand.healMessages = initBoolean("toggles", "HealMessages", true); + ToggleCommand.cooldownMessages = initBoolean("toggles", "CooldownMessages", true); + ToggleCommand.manaMessages = initBoolean("toggles", "ManaMessages", true); //Dungeons - ToggleCommand.dungeonTimerToggled = getBoolean("toggles", "DungeonTimer"); - ToggleCommand.lowHealthNotifyToggled = getBoolean("toggles", "LowHealthNotify"); - ToggleCommand.lividSolverToggled = getBoolean("toggles", "LividSolver"); - ToggleCommand.stopSalvageStarredToggled = getBoolean("toggles", "StopSalvageStarred"); - ToggleCommand.watcherReadyToggled = getBoolean("toggles", "WatcherReadyMessage"); - ToggleCommand.notifySlayerSlainToggled = getBoolean("toggles", "NotifySlayerSlain"); - ToggleCommand.necronNotificationsToggled = getBoolean("toggles", "NecronNotifications"); - ToggleCommand.bonzoTimerToggled = getBoolean("toggles", "BonzoTimer"); - ToggleCommand.swapToPickBlockToggled = getBoolean("toggles", "PickBlock"); - ToggleCommand.flowerWeaponsToggled = getBoolean("toggles", "FlowerWeapons"); - ToggleCommand.autoSkillTrackerToggled = getBoolean("toggles", "AutoSkillTracker"); + ToggleCommand.dungeonTimerToggled = initBoolean("toggles", "DungeonTimer", false); + ToggleCommand.lowHealthNotifyToggled = initBoolean("toggles", "LowHealthNotify", false); + ToggleCommand.lividSolverToggled = initBoolean("toggles", "LividSolver", false); + ToggleCommand.stopSalvageStarredToggled = initBoolean("toggles", "StopSalvageStarred", false); + ToggleCommand.watcherReadyToggled = initBoolean("toggles", "WatcherReadyMessage", false); + ToggleCommand.notifySlayerSlainToggled = initBoolean("toggles", "NotifySlayerSlain", false); + ToggleCommand.necronNotificationsToggled = initBoolean("toggles", "NecronNotifications", false); + ToggleCommand.bonzoTimerToggled = initBoolean("toggles", "BonzoTimer", false); + ToggleCommand.swapToPickBlockToggled = initBoolean("toggles", "PickBlock", false); + ToggleCommand.flowerWeaponsToggled = initBoolean("toggles", "FlowerWeapons", false); + ToggleCommand.autoSkillTrackerToggled = initBoolean("toggles", "AutoSkillTracker", false); // Puzzle Solvers - ToggleCommand.threeManToggled = getBoolean("toggles", "ThreeManPuzzle"); - ToggleCommand.oruoToggled = getBoolean("toggles", "OruoPuzzle"); - ToggleCommand.blazeToggled = getBoolean("toggles", "BlazePuzzle"); - ToggleCommand.creeperToggled = getBoolean("toggles", "CreeperPuzzle"); - ToggleCommand.waterToggled = getBoolean("toggles", "WaterPuzzle"); - ToggleCommand.ticTacToeToggled = getBoolean("toggles", "TicTacToePuzzle"); - ToggleCommand.startsWithToggled = getBoolean("toggles", "StartsWithTerminal"); - ToggleCommand.selectAllToggled = getBoolean("toggles", "SelectAllTerminal"); - ToggleCommand.clickInOrderToggled = getBoolean("toggles", "ClickInOrderTerminal"); - ToggleCommand.blockWrongTerminalClicksToggled = getBoolean("toggles", "BlockWrongTerminalClicks"); - ToggleCommand.itemFrameOnSeaLanternsToggled = getBoolean("toggles", "IgnoreItemFrameOnSeaLanterns"); + ToggleCommand.threeManToggled = initBoolean("toggles", "ThreeManPuzzle", false); + ToggleCommand.oruoToggled = initBoolean("toggles", "OruoPuzzle", false); + ToggleCommand.blazeToggled = initBoolean("toggles", "BlazePuzzle", false); + ToggleCommand.creeperToggled = initBoolean("toggles", "CreeperPuzzle", false); + ToggleCommand.waterToggled = initBoolean("toggles", "WaterPuzzle", false); + ToggleCommand.ticTacToeToggled = initBoolean("toggles", "TicTacToePuzzle", false); + ToggleCommand.startsWithToggled = initBoolean("toggles", "StartsWithTerminal", false); + ToggleCommand.selectAllToggled = initBoolean("toggles", "SelectAllTerminal", false); + ToggleCommand.clickInOrderToggled = initBoolean("toggles", "ClickInOrderTerminal", false); + ToggleCommand.blockWrongTerminalClicksToggled = initBoolean("toggles", "BlockWrongTerminalClicks", false); + ToggleCommand.itemFrameOnSeaLanternsToggled = initBoolean("toggles", "IgnoreItemFrameOnSeaLanterns", false); // Experiment Solvers - ToggleCommand.ultrasequencerToggled = getBoolean("toggles", "UltraSequencer"); - ToggleCommand.chronomatronToggled = getBoolean("toggles", "Chronomatron"); - ToggleCommand.superpairsToggled = getBoolean("toggles", "Superpairs"); - ToggleCommand.hideTooltipsInExperimentAddonsToggled = getBoolean("toggles", "HideTooltipsInExperimentAddons"); + ToggleCommand.ultrasequencerToggled = initBoolean("toggles", "UltraSequencer", false); + ToggleCommand.chronomatronToggled = initBoolean("toggles", "Chronomatron", false); + ToggleCommand.superpairsToggled = initBoolean("toggles", "Superpairs", false); + ToggleCommand.hideTooltipsInExperimentAddonsToggled = initBoolean("toggles", "HideTooltipsInExperimentAddons", false); + + // API + if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); + // Block Wrong Slayer + if (!hasKey("toggles", "BlockSlayer")) writeStringConfig("toggles", "BlockSlayer", ""); String onlySlayer = getString("toggles", "BlockSlayer"); if (!onlySlayer.equals("")) { BlockWrongSlayer.onlySlayerName = onlySlayer.substring(0, onlySlayer.lastIndexOf(" ")); @@ -525,235 +275,242 @@ public class ConfigHandler { } // Wolf - LootTracker.wolfSvens = getInt("wolf", "svens"); - LootTracker.wolfTeeth = getInt("wolf", "teeth"); - LootTracker.wolfWheels = getInt("wolf", "wheel"); - LootTracker.wolfWheelsDrops = getInt("wolf", "wheelDrops"); - LootTracker.wolfSpirits = getInt("wolf", "spirit"); - LootTracker.wolfBooks = getInt("wolf", "book"); - LootTracker.wolfEggs = getInt("wolf", "egg"); - LootTracker.wolfCoutures = getInt("wolf", "couture"); - LootTracker.wolfBaits = getInt("wolf", "bait"); - LootTracker.wolfFluxes = getInt("wolf", "flux"); - LootTracker.wolfTime = getDouble("wolf", "timeRNG"); - LootTracker.wolfBosses = getInt("wolf", "bossRNG"); + LootTracker.wolfSvens = initInt("wolf", "svens", 0); + LootTracker.wolfTeeth = initInt("wolf", "teeth", 0); + LootTracker.wolfWheels = initInt("wolf", "wheel", 0); + LootTracker.wolfWheelsDrops = initInt("wolf", "wheelDrops", 0); + LootTracker.wolfSpirits = initInt("wolf", "spirit", 0); + LootTracker.wolfBooks = initInt("wolf", "book", 0); + LootTracker.wolfEggs = initInt("wolf", "egg", 0); + LootTracker.wolfCoutures = initInt("wolf", "couture", 0); + LootTracker.wolfBaits = initInt("wolf", "bait", 0); + LootTracker.wolfFluxes = initInt("wolf", "flux", 0); + LootTracker.wolfTime = initDouble("wolf", "timeRNG", -1); + LootTracker.wolfBosses = initInt("wolf", "bossRNG", -1); // Spider - LootTracker.spiderTarantulas = getInt("spider", "tarantulas"); - LootTracker.spiderWebs = getInt("spider", "web"); - LootTracker.spiderTAP = getInt("spider", "tap"); - LootTracker.spiderTAPDrops = getInt("spider", "tapDrops"); - LootTracker.spiderBites = getInt("spider", "bite"); - LootTracker.spiderCatalysts = getInt("spider", "catalyst"); - LootTracker.spiderBooks = getInt("spider", "book"); - LootTracker.spiderSwatters = getInt("spider", "swatter"); - LootTracker.spiderTalismans = getInt("spider", "talisman"); - LootTracker.spiderMosquitos = getInt("spider", "mosquito"); - LootTracker.spiderTime = getDouble("spider", "timeRNG"); - LootTracker.spiderBosses = getInt("spider", "bossRNG"); + LootTracker.spiderTarantulas = initInt("spider", "tarantulas", 0); + LootTracker.spiderWebs = initInt("spider", "web", 0); + LootTracker.spiderTAP = initInt("spider", "tap", 0); + LootTracker.spiderTAPDrops = initInt("spider", "tapDrops", 0); + LootTracker.spiderBites = initInt("spider", "bite", 0); + LootTracker.spiderCatalysts = initInt("spider", "catalyst", 0); + LootTracker.spiderBooks = initInt("spider", "book", 0); + LootTracker.spiderSwatters = initInt("spider", "swatter", 0); + LootTracker.spiderTalismans = initInt("spider", "talisman", 0); + LootTracker.spiderMosquitos = initInt("spider", "mosquito", 0); + LootTracker.spiderTime = initDouble("spider", "timeRNG", -1); + LootTracker.spiderBosses = initInt("spider", "bossRNG", -1); // Zombie - LootTracker.zombieRevs = getInt("zombie", "revs"); - LootTracker.zombieRevFlesh = getInt("zombie", "revFlesh"); - LootTracker.zombieFoulFlesh = getInt("zombie", "foulFlesh"); - LootTracker.zombieFoulFleshDrops = getInt("zombie", "foulFleshDrops"); - LootTracker.zombiePestilences = getInt("zombie", "pestilence"); - LootTracker.zombieUndeadCatas = getInt("zombie", "undeadCatalyst"); - LootTracker.zombieBooks = getInt("zombie", "book"); - LootTracker.zombieBeheadeds = getInt("zombie", "beheaded"); - LootTracker.zombieRevCatas = getInt("zombie", "revCatalyst"); - LootTracker.zombieSnakes = getInt("zombie", "snake"); - LootTracker.zombieScythes = getInt("zombie", "scythe"); - LootTracker.zombieTime = getDouble("zombie", "timeRNG"); - LootTracker.zombieBosses = getInt("zombie", "bossRNG"); + LootTracker.zombieRevs = initInt("zombie", "revs", 0); + LootTracker.zombieRevFlesh = initInt("zombie", "revFlesh", 0); + LootTracker.zombieFoulFlesh = initInt("zombie", "foulFlesh", 0); + LootTracker.zombieFoulFleshDrops = initInt("zombie", "foulFleshDrops", 0); + LootTracker.zombiePestilences = initInt("zombie", "pestilence", 0); + LootTracker.zombieUndeadCatas = initInt("zombie", "undeadCatalyst", 0); + LootTracker.zombieBooks = initInt("zombie", "book", 0); + LootTracker.zombieBeheadeds = initInt("zombie", "beheaded", 0); + LootTracker.zombieRevCatas = initInt("zombie", "revCatalyst", 0); + LootTracker.zombieSnakes = initInt("zombie", "snake", 0); + LootTracker.zombieScythes = initInt("zombie", "scythe", 0); + LootTracker.zombieTime = initDouble("zombie", "timeRNG", -1); + LootTracker.zombieBosses = initInt("zombie", "bossRNG", -1); // Fishing - LootTracker.seaCreatures = getInt("fishing", "seaCreature"); - LootTracker.goodCatches = getInt("fishing", "goodCatch"); - LootTracker.greatCatches = getInt("fishing", "greatCatch"); - LootTracker.squids = getInt("fishing", "squid"); - LootTracker.seaWalkers = getInt("fishing", "seaWalker"); - LootTracker.nightSquids = getInt("fishing", "nightSquid"); - LootTracker.seaGuardians = getInt("fishing", "seaGuardian"); - LootTracker.seaWitches = getInt("fishing", "seaWitch"); - LootTracker.seaArchers = getInt("fishing", "seaArcher"); - LootTracker.monsterOfTheDeeps = getInt("fishing", "monsterOfDeep"); - LootTracker.catfishes = getInt("fishing", "catfish"); - LootTracker.carrotKings = getInt("fishing", "carrotKing"); - LootTracker.seaLeeches = getInt("fishing", "seaLeech"); - LootTracker.guardianDefenders = getInt("fishing", "guardianDefender"); - LootTracker.deepSeaProtectors = getInt("fishing", "deepSeaProtector"); - LootTracker.hydras = getInt("fishing", "hydra"); - LootTracker.seaEmperors = getInt("fishing", "seaEmperor"); - LootTracker.empTime = getDouble("fishing", "empTime"); - LootTracker.empSCs = getInt("fishing", "empSC"); - LootTracker.fishingMilestone = getInt("fishing", "milestone"); + LootTracker.seaCreatures = initInt("fishing", "seaCreature", 0); + LootTracker.goodCatches = initInt("fishing", "goodCatch", 0); + LootTracker.greatCatches = initInt("fishing", "greatCatch", 0); + LootTracker.squids = initInt("fishing", "squid", 0); + LootTracker.seaWalkers = initInt("fishing", "seaWalker", 0); + LootTracker.nightSquids = initInt("fishing", "nightSquid", 0); + LootTracker.seaGuardians = initInt("fishing", "seaGuardian", 0); + LootTracker.seaWitches = initInt("fishing", "seaWitch", 0); + LootTracker.seaArchers = initInt("fishing", "seaArcher", 0); + LootTracker.monsterOfTheDeeps = initInt("fishing", "monsterOfDeep", 0); + LootTracker.catfishes = initInt("fishing", "catfish", 0); + LootTracker.carrotKings = initInt("fishing", "carrotKing", 0); + LootTracker.seaLeeches = initInt("fishing", "seaLeech", 0); + LootTracker.guardianDefenders = initInt("fishing", "guardianDefender", 0); + LootTracker.deepSeaProtectors = initInt("fishing", "deepSeaProtector", 0); + LootTracker.hydras = initInt("fishing", "hydra", 0); + LootTracker.seaEmperors = initInt("fishing", "seaEmperor", 0); + LootTracker.empTime = initDouble("fishing", "empTime", -1); + LootTracker.empSCs = initInt("fishing", "empSC", -1); + LootTracker.fishingMilestone = initInt("fishing", "milestone", 0); // Fishing Winter - LootTracker.frozenSteves = getInt("fishing", "frozenSteve"); - LootTracker.frostyTheSnowmans = getInt("fishing", "snowman"); - LootTracker.grinches = getInt("fishing", "grinch"); - LootTracker.yetis = getInt("fishing", "yeti"); - LootTracker.yetiTime = getDouble("fishing", "yetiTime"); - LootTracker.yetiSCs = getInt("fishing", "yetiSC"); + LootTracker.frozenSteves = initInt("fishing", "frozenSteve", 0); + LootTracker.frostyTheSnowmans = initInt("fishing", "snowman", 0); + LootTracker.grinches = initInt("fishing", "grinch", 0); + LootTracker.yetis = initInt("fishing", "yeti", 0); + LootTracker.yetiTime = initDouble("fishing", "yetiTime", -1); + LootTracker.yetiSCs = initInt("fishing", "yetiSC", -1); // Fishing Festival - LootTracker.nurseSharks = getInt("fishing", "nurseShark"); - LootTracker.blueSharks = getInt("fishing", "blueShark"); - LootTracker.tigerSharks = getInt("fishing", "tigerShark"); - LootTracker.greatWhiteSharks = getInt("fishing", "greatWhiteShark"); + LootTracker.nurseSharks = initInt("fishing", "nurseShark", 0); + LootTracker.blueSharks = initInt("fishing", "blueShark", 0); + LootTracker.tigerSharks = initInt("fishing", "tigerShark", 0); + LootTracker.greatWhiteSharks = initInt("fishing", "greatWhiteShark", 0); // Spooky Fishing - LootTracker.scarecrows = getInt("fishing", "scarecrow"); - LootTracker.nightmares = getInt("fishing", "nightmare"); - LootTracker.werewolfs = getInt("fishing", "werewolf"); - LootTracker.phantomFishers = getInt("fishing", "phantomFisher"); - LootTracker.grimReapers = getInt("fishing", "grimReaper"); + LootTracker.scarecrows = initInt("fishing", "scarecrow", 0); + LootTracker.nightmares = initInt("fishing", "nightmare", 0); + LootTracker.werewolfs = initInt("fishing", "werewolf", 0); + LootTracker.phantomFishers = initInt("fishing", "phantomFisher", 0); + LootTracker.grimReapers = initInt("fishing", "grimReaper", 0); // Mythological - LootTracker.mythCoins = getDouble("mythological", "coins"); - LootTracker.griffinFeathers = getInt("mythological", "griffinFeather"); - LootTracker.crownOfGreeds = getInt("mythological", "crownOfGreed"); - LootTracker.washedUpSouvenirs = getInt("mythological", "washedUpSouvenir"); - LootTracker.minosHunters = getInt("mythological", "minosHunter"); - LootTracker.siameseLynxes = getInt("mythological", "siameseLynx"); - LootTracker.minotaurs = getInt("mythological", "minotaur"); - LootTracker.gaiaConstructs = getInt("mythological", "gaiaConstruct"); - LootTracker.minosChampions = getInt("mythological", "minosChampion"); - LootTracker.minosInquisitors = getInt("mythological", "minosInquisitor"); + LootTracker.mythCoins = initDouble("mythological", "coins", 0); + LootTracker.griffinFeathers = initInt("mythological", "griffinFeather", 0); + LootTracker.crownOfGreeds = initInt("mythological", "crownOfGreed", 0); + LootTracker.washedUpSouvenirs = initInt("mythological", "washedUpSouvenir", 0); + LootTracker.minosHunters = initInt("mythological", "minosHunter", 0); + LootTracker.siameseLynxes = initInt("mythological", "siameseLynx", 0); + LootTracker.minotaurs = initInt("mythological", "minotaur", 0); + LootTracker.gaiaConstructs = initInt("mythological", "gaiaConstruct", 0); + LootTracker.minosChampions = initInt("mythological", "minosChampion", 0); + LootTracker.minosInquisitors = initInt("mythological", "minosInquisitor", 0); // Dungeons - LootTracker.recombobulators = getInt("catacombs", "recombobulator"); - LootTracker.fumingPotatoBooks = getInt("catacombs", "fumingBooks"); + LootTracker.recombobulators = initInt("catacombs", "recombobulator", 0); + LootTracker.fumingPotatoBooks = initInt("catacombs", "fumingBooks", 0); // F1 - LootTracker.bonzoStaffs = getInt("catacombs", "bonzoStaff"); - LootTracker.f1CoinsSpent = getDouble("catacombs", "floorOneCoins"); - LootTracker.f1TimeSpent = getDouble("catacombs", "floorOneTime"); + LootTracker.bonzoStaffs = initInt("catacombs", "bonzoStaff", 0); + LootTracker.f1CoinsSpent = initDouble("catacombs", "floorOneCoins", 0); + LootTracker.f1TimeSpent = initDouble("catacombs", "floorOneTime", 0); // F2 - LootTracker.scarfStudies = getInt("catacombs", "scarfStudies"); - LootTracker.f2CoinsSpent = getDouble("catacombs", "floorTwoCoins"); - LootTracker.f2TimeSpent = getDouble("catacombs", "floorTwoTime"); + LootTracker.scarfStudies = initInt("catacombs", "scarfStudies", 0); + LootTracker.f2CoinsSpent = initDouble("catacombs", "floorTwoCoins", 0); + LootTracker.f2TimeSpent = initDouble("catacombs", "floorTwoTime", 0); // F3 - LootTracker.adaptiveHelms = getInt("catacombs", "adaptiveHelm"); - LootTracker.adaptiveChests = getInt("catacombs", "adaptiveChest"); - LootTracker.adaptiveLegs = getInt("catacombs", "adaptiveLegging"); - LootTracker.adaptiveBoots = getInt("catacombs", "adaptiveBoot"); - LootTracker.adaptiveSwords = getInt("catacombs", "adaptiveSword"); - LootTracker.f3CoinsSpent = getDouble("catacombs", "floorThreeCoins"); - LootTracker.f3TimeSpent = getDouble("catacombs", "floorThreeTime"); + LootTracker.adaptiveHelms = initInt("catacombs", "adaptiveHelm", 0); + LootTracker.adaptiveChests = initInt("catacombs", "adaptiveChest", 0); + LootTracker.adaptiveLegs = initInt("catacombs", "adaptiveLegging", 0); + LootTracker.adaptiveBoots = initInt("catacombs", "adaptiveBoot", 0); + LootTracker.adaptiveSwords = initInt("catacombs", "adaptiveSword", 0); + LootTracker.f3CoinsSpent = initDouble("catacombs", "floorThreeCoins", 0); + LootTracker.f3TimeSpent = initDouble("catacombs", "floorThreeTime", 0); // F4 - LootTracker.spiritWings = getInt("catacombs", "spiritWing"); - LootTracker.spiritBones = getInt("catacombs", "spiritBone"); - LootTracker.spiritBoots = getInt("catacombs", "spiritBoot"); - LootTracker.spiritSwords = getInt("catacombs", "spiritSword"); - LootTracker.spiritBows = getInt("catacombs", "spiritBow"); - LootTracker.epicSpiritPets = getInt("catacombs", "spiritPetEpic"); - LootTracker.legSpiritPets = getInt("catacombs", "spiritPetLeg"); - LootTracker.f4CoinsSpent = getDouble("catacombs", "floorFourCoins"); - LootTracker.f4TimeSpent = getDouble("catacombs", "floorFourTime"); + LootTracker.spiritWings = initInt("catacombs", "spiritWing", 0); + LootTracker.spiritBones = initInt("catacombs", "spiritBone", 0); + LootTracker.spiritBoots = initInt("catacombs", "spiritBoot", 0); + LootTracker.spiritSwords = initInt("catacombs", "spiritSword", 0); + LootTracker.spiritBows = initInt("catacombs", "spiritBow", 0); + LootTracker.epicSpiritPets = initInt("catacombs", "spiritPetEpic", 0); + LootTracker.legSpiritPets = initInt("catacombs", "spiritPetLeg", 0); + LootTracker.f4CoinsSpent = initDouble("catacombs", "floorFourCoins", 0); + LootTracker.f4TimeSpent = initDouble("catacombs", "floorFourTime", 0); // F5 - LootTracker.warpedStones = getInt("catacombs", "warpedStone"); - LootTracker.shadowAssHelms = getInt("catacombs", "shadowAssassinHelm"); - LootTracker.shadowAssChests = getInt("catacombs", "shadowAssassinChest"); - LootTracker.shadowAssLegs = getInt("catacombs", "shadowAssassinLegging"); - LootTracker.shadowAssBoots = getInt("catacombs", "shadowAssassinBoot"); - LootTracker.lastBreaths = getInt("catacombs", "lastBreath"); - LootTracker.lividDaggers = getInt("catacombs", "lividDagger"); - LootTracker.shadowFurys = getInt("catacombs", "shadowFury"); - LootTracker.f5CoinsSpent = getDouble("catacombs", "floorFiveCoins"); - LootTracker.f5TimeSpent = getDouble("catacombs", "floorFiveTime"); + LootTracker.warpedStones = initInt("catacombs", "warpedStone", 0); + LootTracker.shadowAssHelms = initInt("catacombs", "shadowAssassinHelm", 0); + LootTracker.shadowAssChests = initInt("catacombs", "shadowAssassinChest", 0); + LootTracker.shadowAssLegs = initInt("catacombs", "shadowAssassinLegging", 0); + LootTracker.shadowAssBoots = initInt("catacombs", "shadowAssassinBoot", 0); + LootTracker.lastBreaths = initInt("catacombs", "lastBreath", 0); + LootTracker.lividDaggers = initInt("catacombs", "lividDagger", 0); + LootTracker.shadowFurys = initInt("catacombs", "shadowFury", 0); + LootTracker.f5CoinsSpent = initDouble("catacombs", "floorFiveCoins", 0); + LootTracker.f5TimeSpent = initDouble("catacombs", "floorFiveTime", 0); // F6 - LootTracker.ancientRoses = getInt("catacombs", "ancientRose"); - LootTracker.precursorEyes = getInt("catacombs", "precursorEye"); - LootTracker.giantsSwords = getInt("catacombs", "giantsSword"); - LootTracker.necroLordHelms = getInt("catacombs", "necroLordHelm"); - LootTracker.necroLordChests = getInt("catacombs", "necroLordChest"); - LootTracker.necroLordLegs = getInt("catacombs", "necroLordLegging"); - LootTracker.necroLordBoots = getInt("catacombs", "necroLordBoot"); - LootTracker.necroSwords = getInt("catacombs", "necroSword"); - LootTracker.f6CoinsSpent = getDouble("catacombs", "floorSixCoins"); - LootTracker.f6TimeSpent = getDouble("catacombs", "floorSixTime"); + LootTracker.ancientRoses = initInt("catacombs", "ancientRose", 0); + LootTracker.precursorEyes = initInt("catacombs", "precursorEye", 0); + LootTracker.giantsSwords = initInt("catacombs", "giantsSword", 0); + LootTracker.necroLordHelms = initInt("catacombs", "necroLordHelm", 0); + LootTracker.necroLordChests = initInt("catacombs", "necroLordChest", 0); + LootTracker.necroLordLegs = initInt("catacombs", "necroLordLegging", 0); + LootTracker.necroLordBoots = initInt("catacombs", "necroLordBoot", 0); + LootTracker.necroSwords = initInt("catacombs", "necroSword", 0); + LootTracker.f6CoinsSpent = initDouble("catacombs", "floorSixCoins", 0); + LootTracker.f6TimeSpent = initDouble("catacombs", "floorSixTime", 0); // F7 - LootTracker.witherBloods = getInt("catacombs", "witherBlood"); - LootTracker.witherCloaks = getInt("catacombs", "witherCloak"); - LootTracker.implosions = getInt("catacombs", "implosion"); - LootTracker.witherShields = getInt("catacombs", "witherShield"); - LootTracker.shadowWarps = getInt("catacombs", "shadowWarp"); - LootTracker.necronsHandles = getInt("catacombs", "necronsHandle"); - LootTracker.autoRecombs = getInt("catacombs", "autoRecomb"); - LootTracker.witherHelms = getInt("catacombs", "witherHelm"); - LootTracker.witherChests = getInt("catacombs", "witherChest"); - LootTracker.witherLegs = getInt("catacombs", "witherLegging"); - LootTracker.witherBoots = getInt("catacombs", "witherBoot"); - LootTracker.f7CoinsSpent = getDouble("catacombs", "floorSevenCoins"); - LootTracker.f7TimeSpent = getDouble("catacombs", "floorSevenTime"); + LootTracker.witherBloods = initInt("catacombs", "witherBlood", 0); + LootTracker.witherCloaks = initInt("catacombs", "witherCloak", 0); + LootTracker.implosions = initInt("catacombs", "implosion", 0); + LootTracker.witherShields = initInt("catacombs", "witherShield", 0); + LootTracker.shadowWarps = initInt("catacombs", "shadowWarp", 0); + LootTracker.necronsHandles = initInt("catacombs", "necronsHandle", 0); + LootTracker.autoRecombs = initInt("catacombs", "autoRecomb", 0); + LootTracker.witherHelms = initInt("catacombs", "witherHelm", 0); + LootTracker.witherChests = initInt("catacombs", "witherChest", 0); + LootTracker.witherLegs = initInt("catacombs", "witherLegging", 0); + LootTracker.witherBoots = initInt("catacombs", "witherBoot", 0); + LootTracker.f7CoinsSpent = initDouble("catacombs", "floorSevenCoins", 0); + LootTracker.f7TimeSpent = initDouble("catacombs", "floorSevenTime", 0); // Misc - DisplayCommand.display = getString("misc", "display"); - DisplayCommand.auto = getBoolean("misc", "autoDisplay"); - Skill50Display.SKILL_TIME = getInt("misc", "skill50Time") * 20; - CakeTimer.cakeTime = getDouble("misc", "cakeTime"); - SkillTracker.showSkillTracker = getBoolean("misc", "showSkillTracker"); - DankersSkyblockMod.firstLaunch = getBoolean("misc", "firstLaunch"); + LootDisplay.display = initString("misc", "display", "off"); + LootDisplay.auto = initBoolean("misc", "autoDisplay", false); + Skill50Display.SKILL_TIME = initInt("misc", "skill50Time", 3) * 20; + CakeTimer.cakeTime = initDouble("misc", "cakeTime", 0); + SkillTracker.showSkillTracker = initBoolean("misc", "showSkillTracker", false); + DankersSkyblockMod.firstLaunch = initBoolean("misc", "firstLaunch", true); - MoveCommand.coordsXY[0] = getInt("locations", "coordsX"); - MoveCommand.coordsXY[1] = getInt("locations", "coordsY"); - MoveCommand.displayXY[0] = getInt("locations", "displayX"); - MoveCommand.displayXY[1] = getInt("locations", "displayY"); - MoveCommand.dungeonTimerXY[0] = getInt("locations", "dungeonTimerX"); - MoveCommand.dungeonTimerXY[1] = getInt("locations", "dungeonTimerY"); - MoveCommand.skill50XY[0] = getInt("locations", "skill50X"); - MoveCommand.skill50XY[1] = getInt("locations", "skill50Y"); - MoveCommand.lividHpXY[0] = getInt("locations", "lividHpX"); - MoveCommand.lividHpXY[1] = getInt("locations", "lividHpY"); - MoveCommand.cakeTimerXY[0] = getInt("locations", "cakeTimerX"); - MoveCommand.cakeTimerXY[1] = getInt("locations", "cakeTimerY"); - MoveCommand.skillTrackerXY[0] = getInt("locations", "skillTrackerX"); - MoveCommand.skillTrackerXY[1] = getInt("locations", "skillTrackerY"); - MoveCommand.waterAnswerXY[0] = getInt("locations", "waterAnswerX"); - MoveCommand.waterAnswerXY[1] = getInt("locations", "waterAnswerY"); - MoveCommand.bonzoTimerXY[0] = getInt("locations", "bonzoTimerX"); - MoveCommand.bonzoTimerXY[1] = getInt("locations", "bonzoTimerY"); + // Locations + ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft()); + int height = scaled.getScaledHeight(); + MoveCommand.coordsXY[0] = initInt("locations", "coordsX", 5); + MoveCommand.coordsXY[1] = initInt("locations", "coordsY", height - 25); + MoveCommand.displayXY[0] = initInt("locations", "displayX", 80); + MoveCommand.displayXY[1] = initInt("locations", "displayY", 5); + MoveCommand.dungeonTimerXY[0] = initInt("locations", "dungeonTimerX", 5); + MoveCommand.dungeonTimerXY[1] = initInt("locations", "dungeonTimerY", 5); + MoveCommand.skill50XY[0] = initInt("locations", "skill50X", 40); + MoveCommand.skill50XY[1] = initInt("locations", "skill50Y", 10); + MoveCommand.lividHpXY[0] = initInt("locations", "lividHpX", 40); + MoveCommand.lividHpXY[1] = initInt("locations", "lividHpY", 20); + MoveCommand.cakeTimerXY[0] = initInt("locations", "cakeTimerX", 40); + MoveCommand.cakeTimerXY[1] = initInt("locations", "cakeTimerY", 30); + MoveCommand.skillTrackerXY[0] = initInt("locations", "skillTrackerX", 40); + MoveCommand.skillTrackerXY[1] = initInt("locations", "skillTrackerY", 50); + MoveCommand.waterAnswerXY[0] = initInt("locations", "waterAnswerX", 100); + MoveCommand.waterAnswerXY[1] = initInt("locations", "waterAnswerY", 100); + MoveCommand.bonzoTimerXY[0] = initInt("locations", "bonzoTimerX", 40); + MoveCommand.bonzoTimerXY[1] = initInt("locations", "bonzoTimerY", 80); + // Scales + ScaleCommand.coordsScale = initDouble("scales", "coordsScale", 1); + ScaleCommand.displayScale = initDouble("scales", "displayScale", 1); + ScaleCommand.dungeonTimerScale = initDouble("scales", "dungeonTimerScale", 1); + ScaleCommand.skill50Scale = initDouble("scales", "skill50Scale", 1); + ScaleCommand.lividHpScale = initDouble("scales", "lividHpScale", 1); + ScaleCommand.cakeTimerScale = initDouble("scales", "cakeTimerScale", 1); + ScaleCommand.skillTrackerScale = initDouble("scales", "skillTrackerScale", 1); + ScaleCommand.waterAnswerScale = initDouble("scales", "waterAnswerScale", 1); + ScaleCommand.bonzoTimerScale = initDouble("scales", "bonzoTimerScale", 1); - ScaleCommand.coordsScale = getDouble("scales", "coordsScale"); - ScaleCommand.displayScale = getDouble("scales", "displayScale"); - ScaleCommand.dungeonTimerScale = getDouble("scales", "dungeonTimerScale"); - ScaleCommand.skill50Scale = getDouble("scales", "skill50Scale"); - ScaleCommand.lividHpScale = getDouble("scales", "lividHpScale"); - ScaleCommand.cakeTimerScale = getDouble("scales", "cakeTimerScale"); - ScaleCommand.skillTrackerScale = getDouble("scales", "skillTrackerScale"); - ScaleCommand.waterAnswerScale = getDouble("scales", "waterAnswerScale"); - ScaleCommand.bonzoTimerScale = getDouble("scales", "bonzoTimerScale"); + // Colours + DankersSkyblockMod.MAIN_COLOUR = initString("colors", "main", EnumChatFormatting.GREEN.toString()); + DankersSkyblockMod.SECONDARY_COLOUR = initString("colors", "secondary", EnumChatFormatting.DARK_GREEN.toString()); + DankersSkyblockMod.DELIMITER_COLOUR = initString("colors", "delimiter", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.STRIKETHROUGH.toString()); + DankersSkyblockMod.ERROR_COLOUR = initString("colors", "error", EnumChatFormatting.RED.toString()); + DankersSkyblockMod.TYPE_COLOUR = initString("colors", "type", EnumChatFormatting.GREEN.toString()); + DankersSkyblockMod.VALUE_COLOUR = initString("colors", "value", EnumChatFormatting.DARK_GREEN.toString()); + DankersSkyblockMod.SKILL_AVERAGE_COLOUR = initString("colors", "skillAverage", EnumChatFormatting.GOLD.toString()); + DankersSkyblockMod.ANSWER_COLOUR = initString("colors", "answer", EnumChatFormatting.DARK_GREEN.toString()); + Skill50Display.SKILL_50_COLOUR = initString("colors", "skill50Display", EnumChatFormatting.AQUA.toString()); + NoF3Coords.COORDS_COLOUR = initString("colors", "coordsDisplay", EnumChatFormatting.WHITE.toString()); + CakeTimer.CAKE_COLOUR = initString("colors", "cakeDisplay", EnumChatFormatting.GOLD.toString()); + SkillTracker.SKILL_TRACKER_COLOUR = initString("colors", "skillTracker", EnumChatFormatting.AQUA.toString()); + TriviaSolver.TRIVIA_WRONG_ANSWER_COLOUR = initString("colors", "triviaWrongAnswer", EnumChatFormatting.RED.toString()); + BonzoMaskTimer.BONZO_COLOR = initString("colors", "bonzoDisplay", EnumChatFormatting.RED.toString()); + BlazeSolver.LOWEST_BLAZE_COLOUR = initInt("colors", "blazeLowest", 0xFF0000); + BlazeSolver.HIGHEST_BLAZE_COLOUR = initInt("colors", "blazeHighest", 0x40FF40); + PetColours.PET_1_TO_9 = initInt("colors", "pet1To9", 0x999999); // Grey + PetColours.PET_10_TO_19 = initInt("colors", "pet10To19", 0xD62440); // Red + PetColours.PET_20_TO_29 = initInt("colors", "pet20To29", 0xEF5230); // Orange + PetColours.PET_30_TO_39 = initInt("colors", "pet30To39", 0xFFC400); // Yellow + PetColours.PET_40_TO_49 = initInt("colors", "pet40To49", 0x0EAC35); // Green + PetColours.PET_50_TO_59 = initInt("colors", "pet50To59", 0x008AD8); // Light Blue + PetColours.PET_60_TO_69 = initInt("colors", "pet60To69", 0x7E4FC6); // Purple + PetColours.PET_70_TO_79 = initInt("colors", "pet70To79", 0xD64FC8); // Pink + PetColours.PET_80_TO_89 = initInt("colors", "pet80To89", 0x5C1F35); // idk weird magenta + PetColours.PET_90_TO_99 = initInt("colors", "pet90To99", 0x9E794E); // Brown + PetColours.PET_100 = initInt("colors", "pet100", 0xF2D249); // Gold + UltrasequencerSolver.ULTRASEQUENCER_NEXT = initInt("colors", "ultrasequencerNext", 0x40FF40); + UltrasequencerSolver.ULTRASEQUENCER_NEXT_TO_NEXT = initInt("colors", "ultrasequencerNextToNext", 0x40DAE6); + ChronomatronSolver.CHRONOMATRON_NEXT = initInt("colors", "chronomatronNext", 0x40FF40); + ChronomatronSolver.CHRONOMATRON_NEXT_TO_NEXT = initInt("colors", "chronomatronNextToNext", 0x40DAE6); + ClickInOrderSolver.CLICK_IN_ORDER_NEXT = initInt("colors", "clickInOrderNext", 0xFF00DD); + ClickInOrderSolver.CLICK_IN_ORDER_NEXT_TO_NEXT = initInt("colors", "clickInOrderNextToNext", 0x0BEFE7); - DankersSkyblockMod.MAIN_COLOUR = getString("colors", "main"); - DankersSkyblockMod.SECONDARY_COLOUR = getString("colors", "secondary"); - DankersSkyblockMod.DELIMITER_COLOUR = getString("colors", "delimiter"); - DankersSkyblockMod.ERROR_COLOUR = getString("colors", "error"); - DankersSkyblockMod.TYPE_COLOUR = getString("colors", "type"); - DankersSkyblockMod.VALUE_COLOUR = getString("colors", "value"); - DankersSkyblockMod.SKILL_AVERAGE_COLOUR = getString("colors", "skillAverage"); - DankersSkyblockMod.ANSWER_COLOUR = getString("colors", "answer"); - Skill50Display.SKILL_50_COLOUR = getString("colors", "skill50Display"); - NoF3Coords.COORDS_COLOUR = getString("colors", "coordsDisplay"); - CakeTimer.CAKE_COLOUR = getString("colors", "cakeDisplay"); - SkillTracker.SKILL_TRACKER_COLOUR = getString("colors", "skillTracker"); - TriviaSolver.TRIVIA_WRONG_ANSWER_COLOUR = getString("colors", "triviaWrongAnswer"); - BonzoMaskTimer.BONZO_COLOR = getString("colors", "bonzoDisplay"); - BlazeSolver.LOWEST_BLAZE_COLOUR = getInt("colors", "blazeLowest"); - BlazeSolver.HIGHEST_BLAZE_COLOUR = getInt("colors", "blazeHighest"); - PetColours.PET_1_TO_9 = getInt("colors", "pet1To9"); - PetColours.PET_10_TO_19 = getInt("colors", "pet10To19"); - PetColours.PET_20_TO_29 = getInt("colors", "pet20To29"); - PetColours.PET_30_TO_39 = getInt("colors", "pet30To39"); - PetColours.PET_40_TO_49 = getInt("colors", "pet40To49"); - PetColours.PET_50_TO_59 = getInt("colors", "pet50To59"); - PetColours.PET_60_TO_69 = getInt("colors", "pet60To69"); - PetColours.PET_70_TO_79 = getInt("colors", "pet70To79"); - PetColours.PET_80_TO_89 = getInt("colors", "pet80To89"); - PetColours.PET_90_TO_99 = getInt("colors", "pet90To99"); - PetColours.PET_100 = getInt("colors", "pet100"); - UltrasequencerSolver.ULTRASEQUENCER_NEXT = getInt("colors", "ultrasequencerNext"); - UltrasequencerSolver.ULTRASEQUENCER_NEXT_TO_NEXT = getInt("colors", "ultrasequencerNextToNext"); - ChronomatronSolver.CHRONOMATRON_NEXT = getInt("colors", "chronomatronNext"); - ChronomatronSolver.CHRONOMATRON_NEXT_TO_NEXT = getInt("colors", "chronomatronNextToNext"); - ClickInOrderSolver.CLICK_IN_ORDER_NEXT = getInt("colors", "clickInOrderNext"); - ClickInOrderSolver.CLICK_IN_ORDER_NEXT_TO_NEXT = getInt("colors", "clickInOrderNextToNext"); + // Commands + if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false); } } -- cgit From e7237307e71c649b4b7c880259ff1781fcc7c435 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 4 Mar 2021 22:00:19 -0500 Subject: Add boulder puzzle solver --- README.md | 15 +- src/main/java/me/Danker/DankersSkyblockMod.java | 6 +- src/main/java/me/Danker/commands/DHelpCommand.java | 3 +- .../java/me/Danker/commands/DankerGuiCommand.java | 4 + .../java/me/Danker/commands/ToggleCommand.java | 19 +- src/main/java/me/Danker/features/AutoDisplay.java | 1 - .../java/me/Danker/features/BlockAbilities.java | 84 +++++++ .../java/me/Danker/features/loot/LootDisplay.java | 1 - .../features/puzzlesolvers/BlockAbilities.java | 84 ------- .../features/puzzlesolvers/BoulderSolver.java | 188 ++++++++++++++ .../features/puzzlesolvers/CreeperSolver.java | 2 +- .../features/puzzlesolvers/ThreeManSolver.java | 2 +- .../features/puzzlesolvers/TriviaSolver.java | 5 +- src/main/java/me/Danker/gui/DisplayGui.java | 1 - src/main/java/me/Danker/gui/PuzzleSolversGui.java | 19 +- .../java/me/Danker/handlers/ConfigHandler.java | 4 +- src/main/java/me/Danker/utils/BoulderUtils.java | 280 +++++++++++++++++++++ src/main/java/me/Danker/utils/Utils.java | 24 +- 18 files changed, 623 insertions(+), 119 deletions(-) create mode 100644 src/main/java/me/Danker/features/BlockAbilities.java delete mode 100644 src/main/java/me/Danker/features/puzzlesolvers/BlockAbilities.java create mode 100644 src/main/java/me/Danker/features/puzzlesolvers/BoulderSolver.java create mode 100644 src/main/java/me/Danker/utils/BoulderUtils.java (limited to 'src/main/java/me/Danker/features/AutoDisplay.java') diff --git a/README.md b/README.md index e96ce00..6673b43 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,11 @@ Discord Server: https://discord.gg/QsEkNQS - Click anywhere on-screen to open Maddox - Maddox menu keybind - Block starting other slayer quests +- Slayer slain alert - Fishing, jerry fishing, fishing festival, spooky fishing trackers - Expertise kills in fishing rod lore - Catacombs trackers -- Dungeons puzzle solver (Riddle, trivia, blaze, creeper, water, tic tac toe) +- Dungeons puzzle solver (Riddle, trivia, blaze, creeper, water, tic tac toe, boulder) - Dungeons timer (watcher, boss, deaths, and puzzle fails) - Watcher ready message - Catacombs F7 Stage 3 solvers (Starts with letter, select all colour, ignore arrows on sea lanterns) @@ -52,14 +53,14 @@ 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. +- /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/spooky/f(1-7)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. -- /display [winter/spooky/f(1-7)/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. +- /loot [winter/festival/spooky/f(1-7)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. +- /display [winter/festival/spooky/f(1-7)/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. - /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. diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 38e956f..0920520 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -65,8 +65,8 @@ public class DankersSkyblockMod { public static String titleText = ""; public static int tickAmount = 1; public static KeyBinding[] keyBindings = new KeyBinding[3]; - static boolean usingLabymod = false; - static boolean usingOAM = false; + public static boolean usingLabymod = false; + public static boolean usingOAM = false; static boolean OAMWarning = false; public static String guiToOpen = null; public static boolean firstLaunch = false; @@ -92,6 +92,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new BlockWrongSlayer()); MinecraftForge.EVENT_BUS.register(new BlockWrongTerminalClicks()); MinecraftForge.EVENT_BUS.register(new BonzoMaskTimer()); + MinecraftForge.EVENT_BUS.register(new BoulderSolver()); MinecraftForge.EVENT_BUS.register(new CakeTimer()); MinecraftForge.EVENT_BUS.register(new ChronomatronSolver()); MinecraftForge.EVENT_BUS.register(new ClickInOrderSolver()); @@ -130,6 +131,7 @@ public class DankersSkyblockMod { ConfigHandler.reloadConfig(); GoldenEnchants.init(); + TriviaSolver.init(); keyBindings[0] = new KeyBinding("Open Maddox Menu", Keyboard.KEY_M, "Danker's Skyblock Mod"); keyBindings[1] = new KeyBinding("Regular Ability", Keyboard.KEY_NUMPAD4, "Danker's Skyblock Mod"); diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index bcaf8b0..6272a60 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" + @@ -54,6 +54,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /sbplayers" + EnumChatFormatting.AQUA + " - Uses API to find how many players are on each Skyblock island.\n" + EnumChatFormatting.GOLD + " /onlyslayer <1/2/3/4>" + EnumChatFormatting.AQUA + " - Stops you from starting a slayer quest other than the one specified.\n" + EnumChatFormatting.GOLD + " /skilltracker " + EnumChatFormatting.AQUA + " - Text display for skill xp/hour.\n" + + EnumChatFormatting.GOLD + " /reparty " + EnumChatFormatting.AQUA + " - Disbands and reparties all members in the party.\n" + EnumChatFormatting.GREEN + " Open Maddox Menu" + EnumChatFormatting.AQUA + " - M by default.\n" + EnumChatFormatting.GREEN + " Start/Stop Skill Tracker" + EnumChatFormatting.AQUA + " - Numpad 5 by default.\n")); } diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index 5ffd754..9ba86da 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -72,6 +72,7 @@ public class DankerGuiCommand extends CommandBase { debug.append("[creeperpuzzle][").append(ToggleCommand.creeperToggled).append("]\n"); debug.append("[waterpuzzle][").append(ToggleCommand.waterToggled).append("]\n"); debug.append("[tictactoepuzzle][").append(ToggleCommand.ticTacToeToggled).append("]\n"); + debug.append("[boulderpuzzle][").append(ToggleCommand.boulderToggled).append("]\n"); debug.append("[watchermessage][").append(ToggleCommand.watcherReadyToggled).append("]\n"); debug.append("[startswithterminal][").append(ToggleCommand.startsWithToggled).append("]\n"); debug.append("[selectallterminal][").append(ToggleCommand.selectAllToggled).append("]\n"); @@ -96,6 +97,9 @@ public class DankerGuiCommand extends CommandBase { debug.append("[Current Display][").append(LootDisplay.display).append("]\n"); debug.append("[Auto Display][").append(LootDisplay.auto).append("]\n"); debug.append("[Skill Tracker Visible][").append(SkillTracker.showSkillTracker).append("]\n"); + debug.append("# Problematic Mods\n"); + debug.append("[LabyMod][").append(DankersSkyblockMod.usingLabymod).append("]\n"); + debug.append("[OAM][").append(DankersSkyblockMod.usingOAM).append("]\n"); debug.append("# Resource Packs\n"); if (Minecraft.getMinecraft().getResourcePackRepository().getRepositoryEntries().size() == 0) { debug.append("\n"); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index b632abc..77dc82e 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -55,6 +55,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean creeperToggled; public static boolean waterToggled; public static boolean ticTacToeToggled; + public static boolean boulderToggled; // Terminal Helpers public static boolean startsWithToggled; public static boolean selectAllToggled; @@ -76,11 +77,13 @@ public class ToggleCommand extends CommandBase implements ICommand { public String getCommandUsage(ICommandSender arg0) { return "/" + getCommandName() + " "; + "aotd/lividdagger/flowerweapons/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/" + + "skill50display/outlinetext/midasstaffmessages/implosionmessages/healmessages/cooldownmessages/" + + "manamessages/caketimer/lowhealthnotify/lividsolver/stopsalvagestarred/notifyslayerslain/" + + "necronnotifications/bonzotimer/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/" + + "tictactoepuzzle/boulderpuzzle/watchermessage/startswithterminal/selectallterminal/" + + "clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/" + + "chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>"; } @Override @@ -301,6 +304,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "TicTacToePuzzle", ticTacToeToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Tic tac toe puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + ticTacToeToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "boulderpuzzle": + boulderToggled = !boulderToggled; + ConfigHandler.writeBooleanConfig("toggles", "BoulderPuzzle", boulderToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Boulder puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + boulderToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "watchermessage": watcherReadyToggled = !watcherReadyToggled; ConfigHandler.writeBooleanConfig("toggles", "WatcherReadyMessage", watcherReadyToggled); @@ -390,6 +398,7 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Creeper puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + creeperToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Water puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + waterToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Tic tac toe puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + ticTacToeToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Boulder puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + boulderToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Watcher ready message: " + DankersSkyblockMod.VALUE_COLOUR + watcherReadyToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Starts with letter terminal solver: " + DankersSkyblockMod.VALUE_COLOUR + startsWithToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Select all color items terminal solver: " + DankersSkyblockMod.VALUE_COLOUR + selectAllToggled + "\n" + diff --git a/src/main/java/me/Danker/features/AutoDisplay.java b/src/main/java/me/Danker/features/AutoDisplay.java index 5411034..876fb6a 100644 --- a/src/main/java/me/Danker/features/AutoDisplay.java +++ b/src/main/java/me/Danker/features/AutoDisplay.java @@ -1,7 +1,6 @@ package me.Danker.features; import me.Danker.DankersSkyblockMod; -import me.Danker.commands.DisplayCommand; import me.Danker.features.loot.LootDisplay; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.ScoreboardHandler; diff --git a/src/main/java/me/Danker/features/BlockAbilities.java b/src/main/java/me/Danker/features/BlockAbilities.java new file mode 100644 index 0000000..19a887c --- /dev/null +++ b/src/main/java/me/Danker/features/BlockAbilities.java @@ -0,0 +1,84 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.ArrayList; +import java.util.Arrays; + +public class BlockAbilities { + + @SubscribeEvent + public void onInteract(PlayerInteractEvent event) { + if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return; + ItemStack item = event.entityPlayer.getHeldItem(); + if (item == null) return; + + if (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); + } + } else if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock(); + + ArrayList interactables = new ArrayList<>(Arrays.asList( + Blocks.acacia_door, + Blocks.anvil, + Blocks.beacon, + Blocks.bed, + Blocks.birch_door, + Blocks.brewing_stand, + Blocks.command_block, + Blocks.crafting_table, + Blocks.chest, + Blocks.dark_oak_door, + Blocks.daylight_detector, + Blocks.daylight_detector_inverted, + Blocks.dispenser, + Blocks.dropper, + Blocks.enchanting_table, + Blocks.ender_chest, + Blocks.furnace, + Blocks.hopper, + Blocks.jungle_door, + Blocks.lever, + Blocks.noteblock, + Blocks.powered_comparator, + Blocks.unpowered_comparator, + Blocks.powered_repeater, + Blocks.unpowered_repeater, + Blocks.standing_sign, + Blocks.wall_sign, + Blocks.trapdoor, + Blocks.trapped_chest, + Blocks.wooden_button, + Blocks.stone_button, + Blocks.oak_door, + Blocks.skull + )); + if (Utils.inDungeons) { + interactables.add(Blocks.coal_block); + interactables.add(Blocks.stained_hardened_clay); + } + + if (!interactables.contains(block)) { + 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/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index 4013c0a..363b70c 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -1,6 +1,5 @@ package me.Danker.features.loot; -import me.Danker.commands.DisplayCommand; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; import me.Danker.commands.ToggleCommand; diff --git a/src/main/java/me/Danker/features/puzzlesolvers/BlockAbilities.java b/src/main/java/me/Danker/features/puzzlesolvers/BlockAbilities.java deleted file mode 100644 index 464b76a..0000000 --- a/src/main/java/me/Danker/features/puzzlesolvers/BlockAbilities.java +++ /dev/null @@ -1,84 +0,0 @@ -package me.Danker.features.puzzlesolvers; - -import me.Danker.commands.ToggleCommand; -import me.Danker.utils.Utils; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -import java.util.ArrayList; -import java.util.Arrays; - -public class BlockAbilities { - - @SubscribeEvent - public void onInteract(PlayerInteractEvent event) { - if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return; - ItemStack item = event.entityPlayer.getHeldItem(); - if (item == null) return; - - if (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); - } - } else if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { - Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock(); - - ArrayList interactables = new ArrayList<>(Arrays.asList( - Blocks.acacia_door, - Blocks.anvil, - Blocks.beacon, - Blocks.bed, - Blocks.birch_door, - Blocks.brewing_stand, - Blocks.command_block, - Blocks.crafting_table, - Blocks.chest, - Blocks.dark_oak_door, - Blocks.daylight_detector, - Blocks.daylight_detector_inverted, - Blocks.dispenser, - Blocks.dropper, - Blocks.enchanting_table, - Blocks.ender_chest, - Blocks.furnace, - Blocks.hopper, - Blocks.jungle_door, - Blocks.lever, - Blocks.noteblock, - Blocks.powered_comparator, - Blocks.unpowered_comparator, - Blocks.powered_repeater, - Blocks.unpowered_repeater, - Blocks.standing_sign, - Blocks.wall_sign, - Blocks.trapdoor, - Blocks.trapped_chest, - Blocks.wooden_button, - Blocks.stone_button, - Blocks.oak_door, - Blocks.skull - )); - if (Utils.inDungeons) { - interactables.add(Blocks.coal_block); - interactables.add(Blocks.stained_hardened_clay); - } - - if (!interactables.contains(block)) { - 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/features/puzzlesolvers/BoulderSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/BoulderSolver.java new file mode 100644 index 0000000..0089038 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/BoulderSolver.java @@ -0,0 +1,188 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.BoulderUtils; +import me.Danker.utils.Utils; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class BoulderSolver { + + static boolean prevInBoulderRoom = false; + static boolean inBoulderRoom = false; + static BlockPos chest = null; + static String boulderRoomDirection = null; + public static List route = new ArrayList<>(); + static int currentStep = 0; + public static int BOULDER_COLOUR; + public static int BOULDER_ARROW_COLOUR; + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + reset(); + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; + World world = mc.theWorld; + if (DankersSkyblockMod.tickAmount % 20 == 0) { + if (ToggleCommand.boulderToggled && Utils.inDungeons && world != null && player != null) { + // multi thread block checking + new Thread(() -> { + prevInBoulderRoom = inBoulderRoom; + int quartzBlocksFound = 0; + int barriersFound = 0; + BlockPos plusPlusQuartz = null; + BlockPos minusMinusQuartz = null; + Iterable blocks = BlockPos.getAllInBox(new BlockPos(player.posX - 25, 68, player.posZ - 25), new BlockPos(player.posX + 25, 68, player.posZ + 25)); + // Detect boulder room + for (BlockPos blockPos : blocks) { + if (world.getBlockState(blockPos).getBlock() == Blocks.quartz_block) { + quartzBlocksFound++; + if (plusPlusQuartz == null || (blockPos.getX() >= plusPlusQuartz.getX() && blockPos.getZ() >= plusPlusQuartz.getZ())) { + plusPlusQuartz = blockPos; + } + if (minusMinusQuartz == null || (blockPos.getX() <= minusMinusQuartz.getX() && blockPos.getZ() <= minusMinusQuartz.getZ())) { + minusMinusQuartz = blockPos; + } + if (quartzBlocksFound == 8) { + break; + } + } else if (world.getBlockState(blockPos).getBlock() == Blocks.barrier) { + barriersFound++; + } + } + + if (quartzBlocksFound == 8 && barriersFound >= 350) { + inBoulderRoom = true; + if (!prevInBoulderRoom) { + // Get boulder locations + char[][] board = new char[7][7]; + for (int x = plusPlusQuartz.getX() - 1, iterationX = 0; iterationX < 7; x -= 3, iterationX++) { + for (int z = plusPlusQuartz.getZ() - 1, iterationZ = 0; iterationZ < 7; z -= 3, iterationZ++) { + BlockPos boulderPos = new BlockPos(x, 66, z); + if (world.getBlockState(boulderPos).getBlock() == Blocks.planks) { + board[iterationX][iterationZ] = 'X'; + } + } + } + + // Detect rotation of room + BlockPos northChest = minusMinusQuartz.add(11, -2, -2); + BlockPos eastChest = plusPlusQuartz.add(2, -2, -11); + BlockPos southChest = plusPlusQuartz.add(-11, -2, 2); + BlockPos westChest = minusMinusQuartz.add(-2, -2, 11); + if (world.getBlockState(northChest).getBlock() == Blocks.chest) { + boulderRoomDirection = "north"; + chest = northChest; + board = BoulderUtils.flipVertically(BoulderUtils.rotateClockwise(board)); + } else if (world.getBlockState(eastChest).getBlock() == Blocks.chest) { + boulderRoomDirection = "east"; + chest = eastChest; + board = BoulderUtils.flipHorizontally(board); + } else if (world.getBlockState(southChest).getBlock() == Blocks.chest) { + boulderRoomDirection = "south"; + chest = southChest; + board = BoulderUtils.flipHorizontally(BoulderUtils.rotateClockwise(board)); + } else if (world.getBlockState(westChest).getBlock() == Blocks.chest) { + boulderRoomDirection = "west"; + chest = westChest; + board = BoulderUtils.flipVertically(board); + } else { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Could not determine orientation of boulder room.")); + return; + } + board = BoulderUtils.removeFirstRow(board); + if (BoulderUtils.hasOpenPath(board)) return; + + long startTime = System.currentTimeMillis(); + reset(); + int length = BoulderUtils.findSolution(board, 0, route); + long endTime = System.currentTimeMillis(); + System.out.println("Time elapsed: " + (endTime - startTime) + "ms, " + BoulderUtils.iterations + " iterations."); + if (length == 10) { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "No solution to puzzle found, most likely puzzle failed.")); + } else { + System.out.println("Solved " + boulderRoomDirection + " facing boulder room in " + length + " steps. Path:"); + for (int[] block : route) { + System.out.println(Arrays.toString(block)); + } + } + } + } else { + chest = null; + boulderRoomDirection = null; + inBoulderRoom = false; + } + }).start(); + } + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.boulderToggled && Utils.inDungeons && route.size() > 0 && currentStep < route.size() && chest != null) { + int[] currentBlockArray = route.get(currentStep); + AxisAlignedBB currentBoulder = BoulderUtils.getBoulder(currentBlockArray[0], currentBlockArray[1], chest, boulderRoomDirection); + if (currentBoulder == null) return; + Utils.drawFilled3DBox(currentBoulder, BOULDER_COLOUR, true, false, event.partialTicks); + char direction; + switch (currentBlockArray[2]) { + case 1: + direction = 'u'; + break; + case 2: + direction = 'd'; + break; + case 3: + direction = 'l'; + break; + case 4: + direction = 'r'; + break; + default: + return; + } + BoulderUtils.drawArrow(currentBoulder, boulderRoomDirection, direction, 0xFF000000 + BOULDER_ARROW_COLOUR, event.partialTicks); + } + } + + @SubscribeEvent + public void onInteract(PlayerInteractEvent event) { + if (Minecraft.getMinecraft().thePlayer != event.entityPlayer || !inBoulderRoom || !ToggleCommand.boulderToggled) return; + + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock(); + if (block == Blocks.stone_button) currentStep++; + } + } + + static void reset() { + route.clear(); + currentStep = 0; + BoulderUtils.seenBoardStates.clear(); + BoulderUtils.iterations = 0; + BoulderUtils.fastestSolution = 10; + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java index 8c7132c..7ff7e7a 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java @@ -78,7 +78,7 @@ public class CreeperSolver { public void onWorldRender(RenderWorldLastEvent event) { if (ToggleCommand.creeperToggled && drawCreeperLines && !creeperLines.isEmpty()) { for (int i = 0; i < creeperLines.size(); i++) { - Utils.draw3DLine(creeperLines.get(i)[0], creeperLines.get(i)[1], CREEPER_COLOURS[i % 10], event.partialTicks); + Utils.draw3DLine(creeperLines.get(i)[0], creeperLines.get(i)[1], CREEPER_COLOURS[i % 10], 2, true, event.partialTicks); } } } diff --git a/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java index 36721c1..8f7de95 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java @@ -68,7 +68,7 @@ public class ThreeManSolver { @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { if (ToggleCommand.threeManToggled && riddleChest != null) { - Utils.drawFilled3DBox(new AxisAlignedBB(riddleChest.getX() - 0.05, riddleChest.getY(), riddleChest.getZ() - 0.05, riddleChest.getX() + 1.05, riddleChest.getY() + 1, riddleChest.getZ() + 1.05), 0x197F19, true, event.partialTicks); + Utils.drawFilled3DBox(new AxisAlignedBB(riddleChest.getX() - 0.05, riddleChest.getY(), riddleChest.getZ() - 0.05, riddleChest.getX() + 1.05, riddleChest.getY() + 1, riddleChest.getZ() + 1.05), 0x197F19, true, true, event.partialTicks); } } diff --git a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java index ac2cd0c..b769634 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java @@ -6,8 +6,6 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StringUtils; import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -20,8 +18,7 @@ public class TriviaSolver { static String[] triviaAnswers = null; public static String TRIVIA_WRONG_ANSWER_COLOUR; - @Mod.EventHandler - public void init(FMLInitializationEvent event) { + public static void init() { triviaSolutions.put("What is the status of The Watcher?", new String[]{"Stalker"}); triviaSolutions.put("What is the status of Bonzo?", new String[]{"New Necromancer"}); triviaSolutions.put("What is the status of Scarf?", new String[]{"Apprentice Necromancer"}); diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 4e5831d..ceda556 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -1,7 +1,6 @@ package me.Danker.gui; import me.Danker.DankersSkyblockMod; -import me.Danker.commands.DisplayCommand; import me.Danker.features.loot.LootDisplay; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index 17eb433..f502df9 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -22,6 +22,7 @@ public class PuzzleSolversGui extends GuiScreen { private GuiButton creeper; private GuiButton water; private GuiButton ticTacToe; + private GuiButton boulder; private GuiButton startsWith; private GuiButton selectAll; private GuiButton clickOrder; @@ -56,12 +57,13 @@ public class PuzzleSolversGui extends GuiScreen { creeper = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Creeper Solver: " + Utils.getColouredBoolean(ToggleCommand.creeperToggled)); water = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Water Solver: " + Utils.getColouredBoolean(ToggleCommand.waterToggled)); ticTacToe = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Tic Tac Toe Solver: " + Utils.getColouredBoolean(ToggleCommand.ticTacToeToggled)); - startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); + boulder = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Boulder Solver: " + Utils.getColouredBoolean(ToggleCommand.boulderToggled)); // Page 2 - selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); - clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled)); - blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled)); - itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); + startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); + selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); + clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled)); + blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled)); + itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); switch (page) { case 1: @@ -71,10 +73,11 @@ public class PuzzleSolversGui extends GuiScreen { this.buttonList.add(creeper); this.buttonList.add(water); this.buttonList.add(ticTacToe); - this.buttonList.add(startsWith); + this.buttonList.add(boulder); this.buttonList.add(nextPage); break; case 2: + this.buttonList.add(startsWith); this.buttonList.add(selectAll); this.buttonList.add(clickOrder); this.buttonList.add(blockClicks); @@ -123,6 +126,10 @@ public class PuzzleSolversGui extends GuiScreen { ToggleCommand.ticTacToeToggled = !ToggleCommand.ticTacToeToggled; ConfigHandler.writeBooleanConfig("toggles", "TicTacToePuzzle", ToggleCommand.ticTacToeToggled); ticTacToe.displayString = "Tic Tac Toe Solver: " + Utils.getColouredBoolean(ToggleCommand.ticTacToeToggled); + } else if (button == boulder) { + ToggleCommand.boulderToggled = !ToggleCommand.boulderToggled; + ConfigHandler.writeBooleanConfig("toggles", "BoulderPuzzle", ToggleCommand.boulderToggled); + boulder.displayString = "Boulder Solver: " + Utils.getColouredBoolean(ToggleCommand.boulderToggled); } else if (button == startsWith) { ToggleCommand.startsWithToggled = !ToggleCommand.startsWithToggled; ConfigHandler.writeBooleanConfig("toggles", "StartsWithTerminal", ToggleCommand.startsWithToggled); diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 53f499b..30778e7 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -1,7 +1,6 @@ package me.Danker.handlers; import me.Danker.DankersSkyblockMod; -import me.Danker.commands.DisplayCommand; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; import me.Danker.commands.ToggleCommand; @@ -252,6 +251,7 @@ public class ConfigHandler { ToggleCommand.creeperToggled = initBoolean("toggles", "CreeperPuzzle", false); ToggleCommand.waterToggled = initBoolean("toggles", "WaterPuzzle", false); ToggleCommand.ticTacToeToggled = initBoolean("toggles", "TicTacToePuzzle", false); + ToggleCommand.boulderToggled = initBoolean("toggles", "BoulderPuzzle", false); ToggleCommand.startsWithToggled = initBoolean("toggles", "StartsWithTerminal", false); ToggleCommand.selectAllToggled = initBoolean("toggles", "SelectAllTerminal", false); ToggleCommand.clickInOrderToggled = initBoolean("toggles", "ClickInOrderTerminal", false); @@ -508,6 +508,8 @@ public class ConfigHandler { ChronomatronSolver.CHRONOMATRON_NEXT_TO_NEXT = initInt("colors", "chronomatronNextToNext", 0x40DAE6); ClickInOrderSolver.CLICK_IN_ORDER_NEXT = initInt("colors", "clickInOrderNext", 0xFF00DD); ClickInOrderSolver.CLICK_IN_ORDER_NEXT_TO_NEXT = initInt("colors", "clickInOrderNextToNext", 0x0BEFE7); + BoulderSolver.BOULDER_COLOUR = initInt("colors", "boulder", 0x197F19); + BoulderSolver.BOULDER_ARROW_COLOUR = initInt("colors", "boulderArrow", 0x006000); // Commands if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false); diff --git a/src/main/java/me/Danker/utils/BoulderUtils.java b/src/main/java/me/Danker/utils/BoulderUtils.java new file mode 100644 index 0000000..2d437d0 --- /dev/null +++ b/src/main/java/me/Danker/utils/BoulderUtils.java @@ -0,0 +1,280 @@ +package me.Danker.utils; + +import me.Danker.features.puzzlesolvers.BoulderSolver; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; + +public class BoulderUtils { + + public static HashSet seenBoardStates = new HashSet<>(); + public static long iterations = 0; + public static int fastestSolution = 10; + + /* + CC BY-SA 4.0 + Unmodified + Question: https://stackoverflow.com/questions/5617016/ + Answer: https://stackoverflow.com/a/53397359 + Author: https://stackoverflow.com/users/3647002/gayan-weerakutti + */ + public static char[][] copy(char[][] array) { + return Arrays.stream(array).map(char[]::clone).toArray(char[][]::new); + } + + public static char[][] flipVertically(char[][] board) { + char[][] newBoard = new char[7][7]; + + for (int row = 0; row < 7; row++) { + System.arraycopy(board[6 - row], 0, newBoard[row], 0, 7); + } + + return newBoard; + } + + public static char[][] flipHorizontally(char[][] board) { + char[][] newBoard = new char[7][7]; + + for (int row = 0; row < 7; row++) { + for (int column = 0; column < 7; column++) { + newBoard[row][column] = board[row][6 - column]; + } + } + + return newBoard; + } + + public static char[][] rotateClockwise(char[][] board) { + char[][] newBoard = new char[7][7]; + + for (int row = 0; row < 7; row++) { + for (int column = 0; column < 7; column++) { + newBoard[column][6 - row] = board[row][column]; + } + } + + return newBoard; + } + + public static char[][] removeFirstRow(char[][] board) { + List list = new ArrayList<>(Arrays.asList(board)); + list.remove(0); + return list.toArray(new char[][]{}); + } + + public static String toString(char[][] board) { + StringBuilder sb = new StringBuilder(); + for (char[] row : board) { + for (char column : row) { + sb.append(column); + } + } + return sb.toString(); + } + + public static int findSolution(char[][] board, int depth, List route) { + if (depth > 9) return 10; + String boardString = toString(board); + if (seenBoardStates.contains(boardString)) return 10; // this line turns 600 million iterations to 700 thousand + seenBoardStates.add(boardString); + if (hasOpenPath(board)) return depth; + + char[][] floodFilledBoard = floodFillBottom(board); + List newRoute = new ArrayList<>(route); + int solutionLength = 10; + int bestRow = -1; + int bestColumn = -1; + int bestDirection = -1; + for (int row = 0; row < 6; row++) { + for (int column = 0; column < 7; column++) { + iterations++; + if (floodFilledBoard[row][column] == 'X' && isTouchingOpenSpace(floodFilledBoard, row, column)) { + if (canBePushed(floodFilledBoard, row, column, 'u')) { + int solution = findSolution(push(board, row, column, 'u'), depth + 1, add(newRoute, new int[]{row, column, 1})); + if (solution < solutionLength) { + solutionLength = solution; + bestRow = row; + bestColumn = column; + bestDirection = 1; + } + } + if (canBePushed(floodFilledBoard, row, column, 'd')) { + int solution = findSolution(push(board, row, column, 'd'), depth + 1, add(newRoute, new int[]{row, column, 2})); + if (solution < solutionLength) { + solutionLength = solution; + bestRow = row; + bestColumn = column; + bestDirection = 2; + } + } + if (canBePushed(floodFilledBoard, row, column, 'l')) { + int solution = findSolution(push(board, row, column, 'l'), depth + 1, add(newRoute, new int[]{row, column, 3})); + if (solution < solutionLength) { + solutionLength = solution; + bestRow = row; + bestColumn = column; + bestDirection = 3; + } + } + if (canBePushed(floodFilledBoard, row, column, 'r')) { + int solution = findSolution(push(board, row, column, 'r'), depth + 1, add(newRoute, new int[]{row, column, 4})); + if (solution < solutionLength) { + solutionLength = solution; + bestRow = row; + bestColumn = column; + bestDirection = 4; + } + } + } + } + } + + if (bestRow != -1) { + newRoute.add(0, new int[]{bestRow, bestColumn, bestDirection}); + } + if (solutionLength < fastestSolution) { + fastestSolution = solutionLength; + newRoute.add(newRoute.remove(0)); // dont know why the last one goes first but this fixes it + BoulderSolver.route = new ArrayList<>(newRoute); + } + return solutionLength; + } + + public static boolean canBePushed(char[][] floodFilledBoard, int row, int column, char direction) { + switch (direction) { + case 'u': + if (row > 0 && row < 5 && floodFilledBoard[row - 1][column] != 'X' && floodFilledBoard[row + 1][column] == 'O') return true; + break; + case 'd': + if (row > 0 && row < 5 && floodFilledBoard[row - 1][column] == 'O' && floodFilledBoard[row + 1][column] != 'X') return true; + break; + case 'l': + if (column > 0 && column < 6 && floodFilledBoard[row][column - 1] != 'X' && floodFilledBoard[row][column + 1] == 'O') return true; + break; + case 'r': + if (column > 0 && column < 6 && floodFilledBoard[row][column - 1] == 'O' && floodFilledBoard[row][column + 1] != 'X') return true; + break; + } + return false; + } + + public static char[][] push(char[][] board, int row, int column, char direction) { + char[][] newBoard = copy(board); + switch (direction) { + case 'u': + newBoard[row - 1][column] = 'X'; + break; + case 'd': + newBoard[row + 1][column] = 'X'; + break; + case 'l': + newBoard[row][column - 1] = 'X'; + break; + case 'r': + newBoard[row][column + 1] = 'X'; + } + newBoard[row][column] = '\0'; + return newBoard; + } + + public static boolean isTouchingOpenSpace(char[][] floodFilledBoard, int row, int column) { + return (row > 0 && floodFilledBoard[row - 1][column] == 'O') || + (row < 5 && floodFilledBoard[row + 1][column] == 'O') || + (column > 0 && floodFilledBoard[row][column - 1] == 'O') || + (column < 6 && floodFilledBoard[row][column + 1] == 'O'); + } + + public static boolean hasOpenPath(char[][] board) { + char[][] newBoard = floodFillBottom(copy(board)); + // Check if flood fill reached top + for (int column = 0; column < 7; column++) { + if (newBoard[0][column] == 'O') return true; + } + return false; + } + + public static char[][] floodFillBottom(char[][] board) { + char[][] newBoard = copy(board); + for (int column = 0; column < 7; column++) { + if (newBoard[5][column] == '\0') { + newBoard = floodFill(newBoard, 5, column); + } + } + return newBoard; + } + + public static char[][] floodFill(char[][] board, int row, int column) { + if (row < 0 || row > 5 || column < 0 || column > 6) return board; + if (board[row][column] == '\0') { + board[row][column] = 'O'; + floodFill(board, row - 1, column); + floodFill(board, row + 1, column); + floodFill(board, row, column - 1); + floodFill(board, row, column + 1); + return board; + } + return board; + } + + public static List add(List list, int[] arrayToAdd) { + List newList = new ArrayList<>(list); + newList.add(arrayToAdd); + return newList; + } + + public static AxisAlignedBB getBoulder(int row, int column, BlockPos chestLocation, String boulderRoomDirection) { + BlockPos boulderPosition; + switch (boulderRoomDirection) { + case "north": + boulderPosition = chestLocation.add(3 * column - 10, -2, 3 * row + 4); + break; + case "east": + boulderPosition = chestLocation.add(-3 * row - 6, -2, 3 * column - 10); + break; + case "south": + boulderPosition = chestLocation.add(-3 * column + 8, -2, -3 * row - 6); + break; + case "west": + boulderPosition = chestLocation.add(3 * row + 4, -2, -3 * column + 8); + break; + default: + return null; + } + return new AxisAlignedBB(boulderPosition.getX() - 0.01, boulderPosition.getY() - 0.01, boulderPosition.getZ() - 0.01, boulderPosition.getX() + 3.01, boulderPosition.getY() + 3.01, boulderPosition.getZ() + 3.01); + } + + public static void drawArrow(AxisAlignedBB aabb, String boulderRoomDirection, char direction, int colourInt, float partialTicks) { + double averageX = (aabb.minX + aabb.maxX) / 2; + double thirtyPercent = (aabb.maxX - aabb.minX) * 0.3; + double averageZ = (aabb.minZ + aabb.maxZ) / 2; + if (((boulderRoomDirection.equals("north") || boulderRoomDirection.equals("south")) && (direction == 'u' || direction == 'd')) || + ((boulderRoomDirection.equals("east") || boulderRoomDirection.equals("west")) && (direction == 'l' || direction == 'r'))) { + Utils.draw3DLine(new Vec3(averageX, aabb.minY, aabb.minZ), new Vec3(averageX, aabb.minY, aabb.maxZ), colourInt, 10, false, partialTicks); + } else { + Utils.draw3DLine(new Vec3(aabb.minX, aabb.minY, averageZ), new Vec3(aabb.maxX, aabb.minY, averageZ), colourInt, 10, false, partialTicks); + } + + if ((boulderRoomDirection.equals("north") && direction == 'u') || (boulderRoomDirection.equals("south") && direction == 'd') || + (boulderRoomDirection.equals("east") && direction == 'l') || (boulderRoomDirection.equals("west") && direction == 'r')) { + Utils.draw3DLine(new Vec3(averageX, aabb.minY, aabb.minZ), new Vec3(aabb.minX + thirtyPercent, aabb.minY, aabb.minZ + thirtyPercent), colourInt, 10, false, partialTicks); + Utils.draw3DLine(new Vec3(averageX, aabb.minY, aabb.minZ), new Vec3(aabb.maxX - thirtyPercent, aabb.minY, aabb.minZ + thirtyPercent), colourInt, 10, false, partialTicks); + } else if ((boulderRoomDirection.equals("north") && direction == 'd') || (boulderRoomDirection.equals("south") && direction == 'u') || + (boulderRoomDirection.equals("east") && direction == 'r') || (boulderRoomDirection.equals("west") && direction == 'l')) { + Utils.draw3DLine(new Vec3(averageX, aabb.minY, aabb.maxZ), new Vec3(aabb.minX + thirtyPercent, aabb.minY, aabb.maxZ - thirtyPercent), colourInt, 10, false, partialTicks); + Utils.draw3DLine(new Vec3(averageX, aabb.minY, aabb.maxZ), new Vec3(aabb.maxX - thirtyPercent, aabb.minY, aabb.maxZ - thirtyPercent), colourInt, 10, false, partialTicks); + } else if ((boulderRoomDirection.equals("north") && direction == 'l') || (boulderRoomDirection.equals("south") && direction == 'r') || + (boulderRoomDirection.equals("east") && direction == 'd') || (boulderRoomDirection.equals("west") && direction == 'u')) { + Utils.draw3DLine(new Vec3(aabb.minX, aabb.minY, averageZ), new Vec3(aabb.minX + thirtyPercent, aabb.minY, aabb.minZ + thirtyPercent), colourInt, 10, false, partialTicks); + Utils.draw3DLine(new Vec3(aabb.minX, aabb.minY, averageZ), new Vec3(aabb.minX + thirtyPercent, aabb.minY, aabb.maxZ - thirtyPercent), colourInt, 10, false, partialTicks); + } else { + Utils.draw3DLine(new Vec3(aabb.maxX, aabb.minY, averageZ), new Vec3(aabb.maxX - thirtyPercent, aabb.minY, aabb.minZ + thirtyPercent), colourInt, 10, false, partialTicks); + Utils.draw3DLine(new Vec3(aabb.maxX, aabb.minY, averageZ), new Vec3(aabb.maxX - thirtyPercent, aabb.minY, aabb.maxZ - thirtyPercent), colourInt, 10, false, partialTicks); + } + } + +} diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 911704f..1a24c69 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -305,7 +305,7 @@ public class Utils { }); } - public static void draw3DLine(Vec3 pos1, Vec3 pos2, int colourInt, float partialTicks) { + public static void draw3DLine(Vec3 pos1, Vec3 pos2, int colourInt, int lineWidth, boolean depth, float partialTicks) { Entity render = Minecraft.getMinecraft().getRenderViewEntity(); WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); Color colour = new Color(colourInt); @@ -320,7 +320,11 @@ public class Utils { GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GL11.glLineWidth(2); + GL11.glLineWidth(lineWidth); + if (!depth) { + GL11.glDisable(GL11.GL_DEPTH_TEST); + GlStateManager.depthMask(false); + } GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue() / 255f, colour.getAlpha() / 255f); worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); @@ -329,6 +333,10 @@ public class Utils { Tessellator.getInstance().draw(); GlStateManager.translate(realX, realY, realZ); + if (!depth) { + GL11.glEnable(GL11.GL_DEPTH_TEST); + GlStateManager.depthMask(true); + } GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); @@ -386,7 +394,7 @@ public class Utils { GlStateManager.popMatrix(); } - public static void drawFilled3DBox(AxisAlignedBB aabb, int colourInt, boolean translucent, float partialTicks) { + public static void drawFilled3DBox(AxisAlignedBB aabb, int colourInt, boolean translucent, boolean depth, float partialTicks) { Entity render = Minecraft.getMinecraft().getRenderViewEntity(); WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); Color colour = new Color(colourInt); @@ -401,8 +409,12 @@ public class Utils { GlStateManager.disableTexture2D(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, translucent ? 1 : 771, 1, 0); GlStateManager.disableCull(); + GlStateManager.tryBlendFuncSeparate(770, translucent ? 1 : 771, 1, 0); + if (!depth) { + GL11.glDisable(GL11.GL_DEPTH_TEST); + GlStateManager.depthMask(false); + } GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue() / 255f, colour.getAlpha() / 255f); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); // Bottom @@ -438,6 +450,10 @@ public class Utils { Tessellator.getInstance().draw(); GlStateManager.translate(realX, realY, realZ); + if (!depth) { + GL11.glEnable(GL11.GL_DEPTH_TEST); + GlStateManager.depthMask(true); + } GlStateManager.enableCull(); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); -- cgit From ed93b04124db9b8944ddd1ed33d0f4dabf4a486b Mon Sep 17 00:00:00 2001 From: RabbitType99 Date: Thu, 11 Mar 2021 19:48:53 +0100 Subject: Added Ghost Tracker/ Fixed Installer crashes due to renaming ModID --- .../java/DefenitlyNotAJoikedInstallerFrame.java | 10 ++-- .../java/me/Danker/commands/DisplayCommand.java | 11 ++++- .../java/me/Danker/commands/ToggleCommand.java | 20 ++++++-- src/main/java/me/Danker/features/AutoDisplay.java | 3 ++ .../java/me/Danker/features/loot/LootDisplay.java | 30 ++++++++++++ .../java/me/Danker/features/loot/LootTracker.java | 56 ++++++++++++++++++++++ src/main/java/me/Danker/gui/DisplayGui.java | 8 +++- .../java/me/Danker/handlers/ConfigHandler.java | 12 ++++- 8 files changed, 136 insertions(+), 14 deletions(-) (limited to 'src/main/java/me/Danker/features/AutoDisplay.java') diff --git a/src/main/java/DefenitlyNotAJoikedInstallerFrame.java b/src/main/java/DefenitlyNotAJoikedInstallerFrame.java index d52d65b..e4c9b64 100644 --- a/src/main/java/DefenitlyNotAJoikedInstallerFrame.java +++ b/src/main/java/DefenitlyNotAJoikedInstallerFrame.java @@ -155,7 +155,7 @@ public class DefenitlyNotAJoikedInstallerFrame extends JFrame implements ActionL versionInfo.setFont(new Font(Font.DIALOG, Font.BOLD, 14)); versionInfo.setHorizontalAlignment(SwingConstants.CENTER); versionInfo.setPreferredSize(new Dimension(w, h)); - versionInfo.setText("Danker's SkyblockMod - Installer by Biscuit
for Minecraft 1.8.9
"); + versionInfo.setText("Danker's Skyblock Mod - Installer by Biscuit
for Minecraft 1.8.9
"); y += h-5; } catch (Throwable ivjExc) { @@ -175,7 +175,7 @@ public class DefenitlyNotAJoikedInstallerFrame extends JFrame implements ActionL descriptionText = new JTextArea(); descriptionText.setName("TextArea"); setTextAreaProperties(descriptionText); - descriptionText.setText("This installer will copy Danker's SkyblockMod into your forge mods folder for you, and replace any old versions that already exist. " + + descriptionText.setText("This installer will copy Danker's Skyblock Mod into your forge mods folder for you, and replace any old versions that already exist. " + "Close this if you prefer to do this yourself!"); descriptionText.setWrapStyleWord(true); @@ -479,7 +479,7 @@ public class DefenitlyNotAJoikedInstallerFrame extends JFrame implements ActionL if (mcModInfo != null) { InputStream inputStream = jarFile.getInputStream(mcModInfo); String modID = getModIDFromInputStream(inputStream); - if (modID.equals("dankersskyblockmod")) { + if (modID.equals("Danker's Skyblock Mod")) { jarFile.close(); try { boolean deleted = file.delete(); @@ -589,11 +589,11 @@ public class DefenitlyNotAJoikedInstallerFrame extends JFrame implements ActionL } public void showMessage(String message) { - JOptionPane.showMessageDialog(null, message, "Danker's SkyblockMod", JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(null, message, "Danker's Skyblock Mod", JOptionPane.INFORMATION_MESSAGE); } public void showErrorMessage(String message) { - JOptionPane.showMessageDialog(null, message, "Danker's SkyblockMod - Error", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, message, "Danker's Skyblock Mod - Error", JOptionPane.ERROR_MESSAGE); } public enum OperatingSystem { diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index 74f142a..7760ec9 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/spooky/session/f(1-7)]"; + return "/" + getCommandName() + " [winter/festival/spooky/session/f(1-7)]"; } @Override @@ -32,7 +32,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", "mythological", "auto", "off"); + return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing", "catacombs", "mythological", "ghost", "auto", "off"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { @@ -192,6 +192,13 @@ public class DisplayCommand extends CommandBase { return; } break; + case "ghost": + if (showSession) { + LootDisplay.display = "ghost_session"; + } else { + LootDisplay.display = "ghost"; + } + case "auto": LootDisplay.auto = true; player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Display set to " + DankersSkyblockMod.SECONDARY_COLOUR + "auto" + DankersSkyblockMod.MAIN_COLOUR + ".")); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 294cf1a..2a4f588 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -18,6 +18,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean goldenToggled; public static boolean slayerCountTotal; public static boolean rngesusAlerts; + public static boolean ghostDisplay; public static boolean splitFishing; public static boolean chatMaddoxToggled; public static boolean spiritBearAlerts; @@ -25,6 +26,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean lividDaggerToggled; public static boolean petColoursToggled; public static boolean dungeonTimerToggled; + public static boolean ghostTimerToggled; public static boolean golemAlertToggled; public static boolean expertiseLoreToggled; public static boolean skill50DisplayToggled; @@ -78,8 +80,8 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", + return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "ghostdisplay", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", - "flowerweapons", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", + "flowerweapons", "sceptremessages", "petcolors", "dungeontimer", /*"ghosttimer",*/ "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", "implosionmessages", "healmessages", "cooldownmessages", "manamessages", "killcombomessages", "caketimer", "lowhealthnotify", "autoskilltracker", "lividsolver", @@ -148,6 +150,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "RNGesusAlerts", rngesusAlerts); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Slayer RNGesus alerts has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + rngesusAlerts + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "ghostDisplay": + ghostDisplay = !ghostDisplay; + ConfigHandler.writeBooleanConfig("toggles", "GhostDisplay", ghostDisplay); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Ghost Display has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + ghostDisplay + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "splitfishing": splitFishing = !splitFishing; ConfigHandler.writeBooleanConfig("toggles", "SplitFishing", splitFishing); @@ -224,6 +231,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "DungeonTimer", dungeonTimerToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Dungeon timer has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + dungeonTimerToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + /*case "ghostTimer": + ghostTimerToggled = !ghostTimerToggled; + ConfigHandler.writeBooleanConfig("toggles", "GhostTimer", ghostTimerToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Ghost timer has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + ghostTimerToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; */ case "golemalerts": golemAlertToggled = !golemAlertToggled; ConfigHandler.writeBooleanConfig("toggles", "GolemAlerts", golemAlertToggled); diff --git a/src/main/java/me/Danker/features/AutoDisplay.java b/src/main/java/me/Danker/features/AutoDisplay.java index 876fb6a..182c0b4 100644 --- a/src/main/java/me/Danker/features/AutoDisplay.java +++ b/src/main/java/me/Danker/features/AutoDisplay.java @@ -37,6 +37,9 @@ public class AutoDisplay { } else if (sCleaned.contains("Revenant Horror")) { LootDisplay.display = "zombie"; found = true; + } else if (sCleaned.contains("The Mist")){ + LootDisplay.display = "ghost"; + found = true; } else if (sCleaned.contains("The Catacombs (")) { if (sCleaned.contains("F1")) { LootDisplay.display = "catacombs_floor_one"; diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index 363b70c..e3f43e8 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -892,6 +892,36 @@ public class LootDisplay { EnumChatFormatting.AQUA + Utils.getMoneySpent(LootTracker.f7CoinsSpentSession) + "\n" + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, LootTracker.f7TimeSpentSession); break; + case "ghost_session": + dropsText = EnumChatFormatting.GOLD + "Bags of Cash:\n" + + EnumChatFormatting.BLUE + "Sorrows:\n" + + EnumChatFormatting.DARK_PURPLE + "Ghosty Boots:\n" + + EnumChatFormatting.DARK_PURPLE + "Voltas:\n" + + EnumChatFormatting.DARK_PURPLE + "Plasmas:" ; // + \n + // EnumChatFormatting.AQUA + "Time Spent:" + + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.bagOfCashSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.sorrowSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.ghostlyBootsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.voltaSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.plasmaSession); //+ "\n" + + // EnumChatFormatting.AQUA + nf.format(LootTracker.ghostsTimeSpentSession); + break; + case "ghost": + dropsText = EnumChatFormatting.GOLD + "Bags of Cash:\n" + + EnumChatFormatting.BLUE + "Sorrows:\n" + + EnumChatFormatting.DARK_PURPLE + "Ghosty Boots:\n" + + EnumChatFormatting.DARK_PURPLE + "Voltas:\n" + + EnumChatFormatting.DARK_PURPLE + "Plasmas:" ; // + \n + // EnumChatFormatting.AQUA + "Time Spent:" + + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.bagOfCashSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(LootTracker.sorrowSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.ghostlyBootsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.voltaSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootTracker.plasmaSession); //+ "\n" + + // EnumChatFormatting.AQUA + nf.format(LootTracker.ghostsTimeSpentSession); + break; + + default: System.out.println("Display was an unknown value, turning off."); display = "off"; diff --git a/src/main/java/me/Danker/features/loot/LootTracker.java b/src/main/java/me/Danker/features/loot/LootTracker.java index f7f7044..6430bc2 100644 --- a/src/main/java/me/Danker/features/loot/LootTracker.java +++ b/src/main/java/me/Danker/features/loot/LootTracker.java @@ -176,6 +176,15 @@ public class LootTracker { public static int witherBoots; public static double f7CoinsSpent; public static double f7TimeSpent; + // Ghosts + public static int sorrows = 0; + public static int bagOfCashs = 0; + public static int voltas = 0; + public static int plasmas = 0; + public static int ghostlyBoots = 0; + // public static double ghostsTimeSpent = -1; + + // Single sessions (No config saves) // Wolf @@ -336,6 +345,14 @@ public class LootTracker { public static int witherBootsSession = 0; public static double f7CoinsSpentSession = 0; public static double f7TimeSpentSession = 0; + // Ghosts + public static int sorrowSession = 0; + public static int bagOfCashSession = 0; + public static int voltaSession = 0; + public static int plasmaSession = 0; + public static int ghostlyBootsSession = 0; + // public static double ghostsSecondsSinceStarts = 0; + static double checkItemsNow = 0; static double itemsChecked = 0; @@ -344,6 +361,7 @@ public class LootTracker { public void onChat(ClientChatReceivedEvent event) { String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + if (!Utils.inSkyblock) return; if (event.type == 2) return; if (message.contains(":")) return; @@ -352,6 +370,8 @@ public class LootTracker { boolean spiderRNG = false; boolean zombieRNG = false; + + // Slayer tracker // T6 books if (message.contains("VERY RARE DROP! (Enchanted Book)") || message.contains("CRAZY RARE DROP! (Enchanted Book)")) { @@ -369,6 +389,7 @@ public class LootTracker { zombieBooks++; ConfigHandler.writeIntConfig("zombie", "book", zombieBooks); } + } } @@ -957,6 +978,41 @@ public class LootTracker { ConfigHandler.writeIntConfig("mythological", "minosInquisitor", minosInquisitors); } } + + + if (message.contains("RARE DROP!")) { + if (message.contains("Sorrow")) { + sorrows++; + sorrowSession++; + ConfigHandler.writeIntConfig("ghosts", "sorrow", sorrows); + } + if (message.contains("Volta")) { + voltas++; + voltaSession++; + ConfigHandler.writeIntConfig("ghosts", "volta", voltas); + } + if (message.contains("Plasma")) { + plasmas++; + plasmaSession++; + ConfigHandler.writeIntConfig("ghosts", "plasma", plasmas); + } + if (message.contains("Ghostly Boots")) { + ghostlyBoots++; + ghostlyBootsSession++; + ConfigHandler.writeIntConfig("ghosts", "ghostlyBoots", ghostlyBoots); + } + if (message.contains("Bag of Cash")) { + bagOfCashs++; + bagOfCashSession++; + ConfigHandler.writeIntConfig("ghosts", "bagOfCash", bagOfCashs); + } + + + + } + + + } @SubscribeEvent diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index ceda556..f38c29e 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -33,6 +33,7 @@ public class DisplayGui extends GuiScreen { private GuiButton catacombsF5; private GuiButton catacombsF6; private GuiButton catacombsF7; + private GuiButton ghost; @Override public boolean doesGuiPauseGame() { @@ -58,7 +59,7 @@ public class DisplayGui extends GuiScreen { fishingWinter = new GuiButton(0, width / 2 - 110, (int) (height * 0.4), 100, 20, "Fishing Winter"); fishingFestival = new GuiButton(0, width / 2 + 10, (int) (height * 0.4), 100, 20, "Fishing Festival"); fishingSpooky = new GuiButton(0, width / 2 + 130, (int) (height * 0.4), 100, 20, "Fishing Spooky"); - mythological = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), 200, 20, "Mythological"); + mythological = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), 95, 20, "Mythological"); catacombsF1 = new GuiButton(0, width / 2 - 205, (int) (height * 0.65), 50, 20, "F1"); catacombsF2 = new GuiButton(0, width / 2 - 145, (int) (height * 0.65), 50, 20, "F2"); catacombsF3 = new GuiButton(0, width / 2 - 85, (int) (height * 0.65), 50, 20, "F3"); @@ -66,6 +67,7 @@ public class DisplayGui extends GuiScreen { catacombsF5 = new GuiButton(0, width / 2 + 35, (int) (height * 0.65), 50, 20, "F5"); catacombsF6 = new GuiButton(0, width / 2 + 95, (int) (height * 0.65), 50, 20, "F6"); catacombsF7 = new GuiButton(0, width / 2 + 155, (int) (height * 0.65), 50, 20, "F7"); + ghost = new GuiButton(0, width / 2 + 5, (int) (height * 0.5), 95, 20, "Ghost"); this.buttonList.add(showSession); this.buttonList.add(off); @@ -85,6 +87,7 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(catacombsF5); this.buttonList.add(catacombsF6); this.buttonList.add(catacombsF7); + this.buttonList.add(ghost); this.buttonList.add(goBack); } @@ -151,7 +154,8 @@ public class DisplayGui extends GuiScreen { setDisplay("catacombs_floor_six", false); } else if (button == catacombsF7) { setDisplay("catacombs_floor_seven", false); - } + } else if (button == ghost) + setDisplay("ghost",false); } public void setDisplay(String display, boolean forceNoSession) { diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 52b1883..759808d 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -214,6 +214,8 @@ public class ConfigHandler { ToggleCommand.goldenToggled = initBoolean("toggles", "Golden", false); ToggleCommand.slayerCountTotal = initBoolean("toggles", "SlayerCount", true); ToggleCommand.rngesusAlerts = initBoolean("toggles", "RNGesusAlerts", false); + ToggleCommand.ghostDisplay = initBoolean("toggles", "GhostDisplay", true); + ToggleCommand.dungeonTimerToggled = initBoolean("toggles", "GhostTimer", false); ToggleCommand.splitFishing = initBoolean("toggles", "SplitFishing", true); ToggleCommand.chatMaddoxToggled = initBoolean("toggles", "ChatMaddox", false); ToggleCommand.spiritBearAlerts = initBoolean("toggles", "SpiritBearAlerts", false); @@ -434,7 +436,15 @@ public class ConfigHandler { LootTracker.witherBoots = initInt("catacombs", "witherBoot", 0); LootTracker.f7CoinsSpent = initDouble("catacombs", "floorSevenCoins", 0); LootTracker.f7TimeSpent = initDouble("catacombs", "floorSevenTime", 0); - + + // Ghost + LootTracker.sorrows = initInt("ghosts", "sorrow", 0); + LootTracker.voltas = initInt("ghosts", "volta", 0); + LootTracker.plasmas = initInt("ghosts", "plasma", 0); + LootTracker.ghostlyBoots = initInt("ghosts", "ghostlyBoots", 0); + LootTracker.bagOfCashs = initInt("ghosts", "bagOfCash", 0); + + // Misc LootDisplay.display = initString("misc", "display", "off"); LootDisplay.auto = initBoolean("misc", "autoDisplay", false); -- cgit