diff options
Diffstat (limited to 'src/main/java')
16 files changed, 386 insertions, 53 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index fbd5cb5..b5c1cff 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -59,7 +59,7 @@ import java.util.Map; @Mod(modid = DankersSkyblockMod.MODID, version = DankersSkyblockMod.VERSION, clientSideOnly = true) public class DankersSkyblockMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.8.6-beta1"; + public static final String VERSION = "1.8.6-beta2"; public static int titleTimer = -1; public static boolean showTitle = false; public static String titleText = ""; @@ -114,6 +114,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new PetColours()); MinecraftForge.EVENT_BUS.register(new Reparty()); MinecraftForge.EVENT_BUS.register(new SelectAllColourSolver()); + MinecraftForge.EVENT_BUS.register(new SilverfishSolver()); MinecraftForge.EVENT_BUS.register(new Skill50Display()); MinecraftForge.EVENT_BUS.register(new SkillTracker()); MinecraftForge.EVENT_BUS.register(new SpamHider()); diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 6272a60..c1ae5af 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 <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/lividdagger/flowerweapons/sceptremessages/midasstaffmessages/implosionmessages/healmessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/caketimer/lowhealthnotify/lividsolver/stopsalvagestarred/notifyslayerslain/autoskilltracker/necronnotifications/bonzotimer/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/boulderpuzzle/watchermessage/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/lividdagger/flowerweapons/sceptremessages/midasstaffmessages/implosionmessages/healmessages/cooldownmessages/manamessages/killcombomessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/caketimer/lowhealthnotify/lividsolver/stopsalvagestarred/notifyslayerslain/autoskilltracker/necronnotifications/bonzotimer/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/boulderpuzzle/silverfishpuzzle/watchermessage/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey <key>" + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + EnumChatFormatting.GOLD + " /loot <zombie/spider/wolf/fishing/catacombs/mythological/> [winter/festival/spooky/f(1-7)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index 9ba86da..fff1ce7 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -58,6 +58,9 @@ public class DankerGuiCommand extends CommandBase { debug.append("[midasstaffmessages][").append(ToggleCommand.midasStaffMessages).append("]\n"); debug.append("[implosionmessages][").append(ToggleCommand.implosionMessages).append("]\n"); debug.append("[healmessages][").append(ToggleCommand.healMessages).append("]\n"); + debug.append("[cooldownmessages][").append(ToggleCommand.cooldownMessages).append("]\n"); + debug.append("[manamessages][").append(ToggleCommand.manaMessages).append("]\n"); + debug.append("[killcombomessages][").append(ToggleCommand.killComboMessages).append("]\n"); debug.append("[caketimer][").append(ToggleCommand.cakeTimerToggled).append("]\n"); debug.append("[lowhealthnotify][").append(ToggleCommand.lowHealthNotifyToggled).append("]\n"); debug.append("[lividsolver][").append(ToggleCommand.lividSolverToggled).append("]\n"); @@ -73,6 +76,7 @@ public class DankerGuiCommand extends CommandBase { 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("[silverfishpuzzle][").append(ToggleCommand.silverfishToggled).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"); diff --git a/src/main/java/me/Danker/commands/FairySoulsCommand.java b/src/main/java/me/Danker/commands/FairySoulsCommand.java index 77a7586..478851b 100644 --- a/src/main/java/me/Danker/commands/FairySoulsCommand.java +++ b/src/main/java/me/Danker/commands/FairySoulsCommand.java @@ -22,7 +22,7 @@ public class FairySoulsCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender sender) { - return "/" + getCommandName() + "[name]"; + return "/" + getCommandName() + " [name]"; } @Override @@ -84,7 +84,7 @@ public class FairySoulsCommand extends CommandBase { int fairy_souls = userObject.get("fairy_souls_collected").getAsInt(); System.out.println(fairy_souls); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "The player " + username + " has " + DankersSkyblockMod.VALUE_COLOUR + fairy_souls + DankersSkyblockMod.MAIN_COLOUR + "/220" + " collected")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "The player " + username + " has " + DankersSkyblockMod.VALUE_COLOUR + fairy_souls + DankersSkyblockMod.MAIN_COLOUR + "/222" + " collected")); }).start(); diff --git a/src/main/java/me/Danker/commands/LobbySkillsCommand.java b/src/main/java/me/Danker/commands/LobbySkillsCommand.java index 61ceea7..3d0c575 100644 --- a/src/main/java/me/Danker/commands/LobbySkillsCommand.java +++ b/src/main/java/me/Danker/commands/LobbySkillsCommand.java @@ -104,7 +104,7 @@ public class LobbySkillsCommand extends CommandBase { miningLevel = (double) Math.round(miningLevel * 100) / 100; } if (latestProfile.has("experience_skill_combat")) { - combatLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_combat").getAsDouble(), 50); + combatLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_combat").getAsDouble(), 60); combatLevel = (double) Math.round(combatLevel * 100) / 100; } if (latestProfile.has("experience_skill_foraging")) { @@ -146,7 +146,7 @@ public class LobbySkillsCommand extends CommandBase { miningLevel = achievementObject.get("skyblock_excavator").getAsInt(); } if (achievementObject.has("skyblock_combat")) { - combatLevel = Math.min(achievementObject.get("skyblock_combat").getAsInt(), 50); + combatLevel = achievementObject.get("skyblock_combat").getAsInt(); } if (achievementObject.has("skyblock_gatherer")) { foragingLevel = Math.min(achievementObject.get("skyblock_gatherer").getAsInt(), 50); diff --git a/src/main/java/me/Danker/commands/SkillsCommand.java b/src/main/java/me/Danker/commands/SkillsCommand.java index 6edbb4e..a9ce9d1 100644 --- a/src/main/java/me/Danker/commands/SkillsCommand.java +++ b/src/main/java/me/Danker/commands/SkillsCommand.java @@ -100,7 +100,7 @@ public class SkillsCommand extends CommandBase { miningLevel = (double) Math.round(miningLevel * 100) / 100; } if (userObject.has("experience_skill_combat")) { - combatLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_combat").getAsDouble(), 50); + combatLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_combat").getAsDouble(), 60); combatLevel = (double) Math.round(combatLevel * 100) / 100; } if (userObject.has("experience_skill_foraging")) { @@ -144,7 +144,7 @@ public class SkillsCommand extends CommandBase { miningLevel = achievementObject.get("skyblock_excavator").getAsInt(); } if (achievementObject.has("skyblock_combat")) { - combatLevel = Math.min(achievementObject.get("skyblock_combat").getAsInt(), 50); + combatLevel = achievementObject.get("skyblock_combat").getAsInt(); } if (achievementObject.has("skyblock_gatherer")) { foragingLevel = Math.min(achievementObject.get("skyblock_gatherer").getAsInt(), 50); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 0ce17ef..e44f8ce 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -38,6 +38,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean healMessages; public static boolean cooldownMessages; public static boolean manaMessages; + public static boolean killComboMessages; // Dungeons Messages public static boolean lowHealthNotifyToggled; public static boolean lividSolverToggled; @@ -57,6 +58,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean waterToggled; public static boolean ticTacToeToggled; public static boolean boulderToggled; + public static boolean silverfishToggled; // Terminal Helpers public static boolean startsWithToggled; public static boolean selectAllToggled; @@ -70,7 +72,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean hideTooltipsInExperimentAddonsToggled; public static boolean specialHoeRightClick; public static boolean melodyTooltips; - + @Override public String getCommandName() { return "toggle"; @@ -82,11 +84,12 @@ public class ToggleCommand extends CommandBase implements ICommand { return "/" + getCommandName() + " <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalert/" + "aotd/lividdagger/shadowfury/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/specialhoe/melodytooltips/list>"; + "manamessages/killcombomessages/caketimer/lowhealthnotify/lividsolver/stopsalvagestarred/" + + "notifyslayerslain/necronnotifications/bonzotimer/threemanpuzzle/oruopuzzle/blazepuzzle/" + + "creeperpuzzle/waterpuzzle/tictactoepuzzle/boulderpuzzle/silverfishpuzzle/watchermessage/" + + "startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/" + + "itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/ " + + "/specialhoe/melodytooltips/list>"; } @Override @@ -101,12 +104,15 @@ public class ToggleCommand extends CommandBase implements ICommand { "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", "shadowfury", "flowerweapons", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", - "implosionmessages", "healmessages", "cooldownmessages", "manamessages", "caketimer", "lowhealthnotify", "autoskilltracker", - "lividsolver", "stopsalvagestarred", "notifyslayerslain", "necronnotifications", + "implosionmessages", "healmessages", "cooldownmessages", "manamessages", + "killcombomessages", "caketimer", "lowhealthnotify", "autoskilltracker", "lividsolver", + "stopsalvagestarred", "notifyslayerslain", "necronnotifications", "bonzotimer", "threemanpuzzle", "oruopuzzle", "blazepuzzle", - "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "startswithterminal", - "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer", - "chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "specialhoe", "melodytooltips","list"); + "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "boulderpuzzle", + "silverfishpuzzle", "watchermessage", "startswithterminal", + "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", + "itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs", + "hidetooltipsinaddons", "pickblock", "specialhoe", "melodytooltips", "list"); } return null; } @@ -211,6 +217,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "ManaMessages", manaMessages); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Out of mana messages has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + manaMessages + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "killcombomessages": + killComboMessages = !killComboMessages; + ConfigHandler.writeBooleanConfig("toggles", "KillComboMessages", killComboMessages); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Kill combo messages has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + killComboMessages + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "petcolors": case "petcolours": petColoursToggled = !petColoursToggled; @@ -317,6 +328,11 @@ public class ToggleCommand extends CommandBase implements ICommand { 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 "silverfishpuzzle": + silverfishToggled = !silverfishToggled; + ConfigHandler.writeBooleanConfig("toggles", "SilverfishPuzzle", silverfishToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Silverfish puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + silverfishToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "watchermessage": watcherReadyToggled = !watcherReadyToggled; ConfigHandler.writeBooleanConfig("toggles", "WatcherReadyMessage", watcherReadyToggled); @@ -393,7 +409,6 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Spirit Bear alerts: " + DankersSkyblockMod.VALUE_COLOUR + spiritBearAlerts + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Block AOTD ability: " + DankersSkyblockMod.VALUE_COLOUR + aotdToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Block Livid Dagger ability: " + DankersSkyblockMod.VALUE_COLOUR + lividDaggerToggled + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Block Shadow Fury ability: " + DankersSkyblockMod.VALUE_COLOUR + shadowFuryToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Prevent Placing FoT/Spirit Sceptre: " + DankersSkyblockMod.VALUE_COLOUR + flowerWeaponsToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Spirit Sceptre messages: " + DankersSkyblockMod.VALUE_COLOUR + sceptreMessages + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Midas Staff messages: " + DankersSkyblockMod.VALUE_COLOUR + midasStaffMessages + "\n" + @@ -418,6 +433,7 @@ public class ToggleCommand extends CommandBase implements ICommand { 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 + " Silverfish puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + silverfishToggled + "\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/Skill50Display.java b/src/main/java/me/Danker/features/Skill50Display.java index 511bb16..3b73cf9 100644 --- a/src/main/java/me/Danker/features/Skill50Display.java +++ b/src/main/java/me/Danker/features/Skill50Display.java @@ -36,7 +36,7 @@ public class Skill50Display { double currentXp = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); int limit; int totalXp; - if (section.contains("Farming") || section.contains("Enchanting") || section.contains("Mining")) { + if (section.contains("Farming") || section.contains("Enchanting") || section.contains("Mining") || section.contains("Combat")) { limit = 60; totalXp = 111672425; } else { diff --git a/src/main/java/me/Danker/features/SkillTracker.java b/src/main/java/me/Danker/features/SkillTracker.java index 15e9fdd..60eb632 100644 --- a/src/main/java/me/Danker/features/SkillTracker.java +++ b/src/main/java/me/Danker/features/SkillTracker.java @@ -63,7 +63,7 @@ public class SkillTracker { } timeSinceGained = System.currentTimeMillis() / 1000; - int limit = section.contains("Farming") || section.contains("Enchanting") || section.contains("Mining") ? 60 : 50; + int limit = section.contains("Farming") || section.contains("Enchanting") || section.contains("Mining") || section.contains("Combat") ? 60 : 50; double currentXP = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); int xpToLevelUp = Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")); xpLeft = xpToLevelUp - currentXP; diff --git a/src/main/java/me/Danker/features/SpamHider.java b/src/main/java/me/Danker/features/SpamHider.java index 4b22f61..a88d9e5 100644 --- a/src/main/java/me/Danker/features/SpamHider.java +++ b/src/main/java/me/Danker/features/SpamHider.java @@ -44,6 +44,13 @@ public class SpamHider { if (!ToggleCommand.implosionMessages) { if (message.contains("Your Implosion hit ") || message.contains("There are blocks in the way")) { event.setCanceled(true); + return; + } + } + // Kill Combo + if (!ToggleCommand.killComboMessages) { + if ((message.contains("+") && message.contains(" Kill Combo ")) || message.contains("Your Kill Combo has expired!")) { + event.setCanceled(true); } } } diff --git a/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java new file mode 100644 index 0000000..c07524d --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java @@ -0,0 +1,183 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.SilverfishUtils; +import me.Danker.utils.Utils; +import net.minecraft.block.BlockHopper; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.monster.EntitySilverfish; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.*; +import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderWorldLastEvent; +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 SilverfishSolver { + + static boolean prevInSilverfishRoom = false; + static boolean inSilverfishRoom = false; + static BlockPos chest = null; + static EnumFacing silverfishRoomDirection = null; + static List<SilverfishUtils.Point> route = new ArrayList<>(); + public static int SILVERFISH_LINE_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(); + World world = mc.theWorld; + EntityPlayerSP player = mc.thePlayer; + if (DankersSkyblockMod.tickAmount % 20 == 0) { + if (ToggleCommand.silverfishToggled && Utils.inDungeons && world != null && player != null) { + new Thread(() -> { + boolean foundRoom = false; + prevInSilverfishRoom = inSilverfishRoom; + double x = player.posX; + double z = player.posZ; + // Find creepers nearby + AxisAlignedBB entityScan = new AxisAlignedBB(x - 25, 67, z - 25, x + 25, 68, z + 25); // 50x1x50 + List<EntitySilverfish> silverfishes = world.getEntitiesWithinAABB(EntitySilverfish.class, entityScan); + List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, entityScan); + if (silverfishes.size() > 0 && items.size() > 0) { + double silverfishX = silverfishes.get(0).posX; + double silverfishZ = silverfishes.get(0).posZ; + for (EntityItem item : items) { + if (Item.getIdFromItem(item.getEntityItem().getItem()) == 46 && Math.abs(item.posX - silverfishX) < 1 && Math.abs(item.posZ - silverfishZ) < 1) { + Iterable<BlockPos> blocks = BlockPos.getAllInBox(new BlockPos(player.posX - 27, 67, player.posZ - 27), new BlockPos(player.posX + 27, 67, player.posZ + 27)); + for (BlockPos blockPos : blocks) { + if (world.getBlockState(blockPos).getBlock() == Blocks.chest && world.getBlockState(blockPos.add(0, 2, 0)).getBlock() == Blocks.hopper) { + foundRoom = true; + inSilverfishRoom = true; + if (!prevInSilverfishRoom) { + chest = blockPos; + BlockPos silverfishBlock = new BlockPos(silverfishX, 67, silverfishZ); + TileEntity hopper = world.getTileEntity(blockPos.add(0, 2, 0)); + silverfishRoomDirection = BlockHopper.getFacing(hopper.getBlockMetadata()); + char[][] board = new char[19][19]; + SilverfishUtils.Point silverfishPoint = null; + + switch (silverfishRoomDirection) { + case NORTH: + for (int row = chest.getZ() + 3, xIteration = 0; xIteration < 19; row++, xIteration++) { + for (int column = chest.getX() - 9, yIteration = 0; yIteration < 19; column++, yIteration++) { + if (world.getBlockState(new BlockPos(column, 67, row)).getBlock() != Blocks.air) { + board[xIteration][yIteration] = 'X'; + } else if (silverfishBlock.equals(new BlockPos(column, 67, row))) { + silverfishPoint = new SilverfishUtils.Point(xIteration, yIteration); + } + } + } + break; + case EAST: + for (int row = chest.getX() - 3, xIteration = 0; xIteration < 19; row--, xIteration++) { + for (int column = chest.getZ() - 9, yIteration = 0; yIteration < 19; column++, yIteration++) { + if (world.getBlockState(new BlockPos(row, 67, column)).getBlock() != Blocks.air) { + board[xIteration][yIteration] = 'X'; + } else if (silverfishBlock.equals(new BlockPos(row, 67, column))) { + silverfishPoint = new SilverfishUtils.Point(xIteration, yIteration); + } + } + } + break; + case SOUTH: + for (int row = chest.getZ() - 3, xIteration = 0; xIteration < 19; row--, xIteration++) { + for (int column = chest.getX() + 9, yIteration = 0; yIteration < 19; column--, yIteration++) { + if (world.getBlockState(new BlockPos(column, 67, row)).getBlock() != Blocks.air) { + board[xIteration][yIteration] = 'X'; + } else if (silverfishBlock.equals(new BlockPos(column, 67, row))) { + silverfishPoint = new SilverfishUtils.Point(xIteration, yIteration); + } + } + } + break; + case WEST: + for (int row = chest.getX() + 3, xIteration = 0; xIteration < 19; row++, xIteration++) { + for (int column = chest.getZ() + 9, yIteration = 0; yIteration < 19; column--, yIteration++) { + if (world.getBlockState(new BlockPos(row, 67, column)).getBlock() != Blocks.air) { + board[xIteration][yIteration] = 'X'; + } else if (silverfishBlock.equals(new BlockPos(row, 67, column))) { + board[xIteration][yIteration] = 'S'; + silverfishPoint = new SilverfishUtils.Point(xIteration, yIteration); + } + } + } + break; + default: + return; + } + System.out.println(Arrays.deepToString(board)); + + List<SilverfishUtils.Point> endPoints = new ArrayList<>(); + for (int column = 0; column < 19; column++) { + if (board[0][column] != 'X') endPoints.add(new SilverfishUtils.Point(0, column)); + } + + route = SilverfishUtils.solve(board, silverfishPoint, endPoints); + } + } + } + } + } + } + if (!foundRoom) reset(); + }).start(); + } + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.silverfishToggled && Utils.inDungeons && route != null && route.size() > 0 && chest != null) { + for (int i = 0; i < route.size() - 1; i++) { + Vec3 pos1 = null; + Vec3 pos2 = null; + switch (silverfishRoomDirection) { + case NORTH: + pos1 = new Vec3(chest.getX() - 8.5 + route.get(i).column, 67.5, chest.getZ() + 3.5 + route.get(i).row); + pos2 = new Vec3(chest.getX() - 8.5 + route.get(i + 1).column, 67.5, chest.getZ() + 3.5 + route.get(i + 1).row); + break; + case EAST: + pos1 = new Vec3(chest.getX() - 2.5 - route.get(i).row, 67.5, chest.getZ() - 8.5 + route.get(i).column); + pos2 = new Vec3(chest.getX() - 2.5 - route.get(i + 1).row, 67.5, chest.getZ() - 8.5 + route.get(i + 1).column); + break; + case SOUTH: + pos1 = new Vec3(chest.getX() + 9.5 - route.get(i).column, 67.5, chest.getZ() - 2.5 - route.get(i).row); + pos2 = new Vec3(chest.getX() + 9.5 - route.get(i + 1).column, 67.5, chest.getZ() - 2.5 - route.get(i + 1).row); + break; + case WEST: + pos1 = new Vec3(chest.getX() + 3.5 + route.get(i).row, 67.5, chest.getZ() + 9.5 - route.get(i).column); + pos2 = new Vec3(chest.getX() + 3.5 + route.get(i + 1).row, 67.5, chest.getZ() + 9.5 - route.get(i + 1).column); + break; + default: + return; + } + Utils.draw3DLine(pos1, pos2, SILVERFISH_LINE_COLOUR, 5, true, event.partialTicks); + } + } + } + + static void reset() { + inSilverfishRoom = false; + chest = null; + silverfishRoomDirection = null; + route.clear(); + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java index b769634..9adc555 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java @@ -30,8 +30,8 @@ public class TriviaSolver { triviaSolutions.put("What is the status of Goldor?", new String[]{"Wither Soldier"}); triviaSolutions.put("What is the status of Storm?", new String[]{"Elementalist"}); triviaSolutions.put("What is the status of Necron?", new String[]{"Wither Lord"}); - triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"220 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in Spider's Den?", new String[]{"17 Fairy Souls"}); + triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"222 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Spider's Den?", new String[]{"19 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The End?", new String[]{"12 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The Barn?", new String[]{"7 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Mushroom Desert?", new String[]{"8 Fairy Souls"}); diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 4c487a8..32aab9c 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -9,7 +9,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; -import scala.tools.reflect.ToolBoxFactory; import java.awt.*; import java.io.IOException; @@ -58,6 +57,7 @@ public class DankerGui extends GuiScreen { private GuiButton healMessages; private GuiButton cooldownMessages; private GuiButton manaMessages; + private GuiButton killComboMessages; //Dungeons private GuiButton dungeonTimer; private GuiButton lowHealthNotify; @@ -119,30 +119,31 @@ public class DankerGui extends GuiScreen { implosionMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Implosion Messages: " + Utils.getColouredBoolean(ToggleCommand.implosionMessages)); healMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Heal Messages: " + Utils.getColouredBoolean(ToggleCommand.healMessages)); cooldownMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Cooldown Messages: " + Utils.getColouredBoolean(ToggleCommand.cooldownMessages)); - manaMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Mana Messages: " + Utils.getColouredBoolean((ToggleCommand.manaMessages))); + manaMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Mana Messages: " + Utils.getColouredBoolean(ToggleCommand.manaMessages)); // Page 4 - goldenEnch = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); - petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); - expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); - gparty = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); - golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); - rngesusAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "RNGesus Alerts: " + Utils.getColouredBoolean(ToggleCommand.rngesusAlerts)); - splitFishing = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); + killComboMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Kill Combo Messages: " + Utils.getColouredBoolean(ToggleCommand.killComboMessages)); + goldenEnch = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); + petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); + expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); + gparty = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); + golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); + rngesusAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "RNGesus Alerts: " + Utils.getColouredBoolean(ToggleCommand.rngesusAlerts)); // Page 5 - lowHealthNotify = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Low Health Notifications: " + Utils.getColouredBoolean(ToggleCommand.lowHealthNotifyToggled)); - lividSolver = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled)); - dungeonTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); - stopSalvageStarred = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Stop Salvaging Starred Items: " + Utils.getColouredBoolean(ToggleCommand.stopSalvageStarredToggled)); - watcherReadyMessage = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Display Watcher Ready Message: " + Utils.getColouredBoolean(ToggleCommand.watcherReadyToggled)); - flowerWeapons = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Prevent Placing FoT/Spirit Sceptre: " + Utils.getColouredBoolean(ToggleCommand.flowerWeaponsToggled)); - notifySlayerSlain = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Notify when Slayer Slain: " + Utils.getColouredBoolean(ToggleCommand.notifySlayerSlainToggled)); + splitFishing = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); + lowHealthNotify = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Low Health Notifications: " + Utils.getColouredBoolean(ToggleCommand.lowHealthNotifyToggled)); + lividSolver = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled)); + dungeonTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); + stopSalvageStarred = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Stop Salvaging Starred Items: " + Utils.getColouredBoolean(ToggleCommand.stopSalvageStarredToggled)); + watcherReadyMessage = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Display Watcher Ready Message: " + Utils.getColouredBoolean(ToggleCommand.watcherReadyToggled)); + flowerWeapons = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Prevent Placing FoT/Spirit Sceptre: " + Utils.getColouredBoolean(ToggleCommand.flowerWeaponsToggled)); //Page 6 - necronNotifications = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Necron Phase Notifications: " + Utils.getColouredBoolean(ToggleCommand.necronNotificationsToggled)); - bonzoTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Bonzo's Mask Timer: " + Utils.getColouredBoolean(ToggleCommand.bonzoTimerToggled)); - autoSkillTracker = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Auto Start/Stop Skill Tracker: " + Utils.getColouredBoolean(ToggleCommand.autoSkillTrackerToggled)); - shadowFury = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Block Shadow Fury ability: " + Utils.getColouredBoolean(ToggleCommand.shadowFuryToggled)); - specialHoe = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Block Special Hoe right click: " + Utils.getColouredBoolean(ToggleCommand.specialHoeRightClick)); - melodyTooltips = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Hide tooltips in Melody's Harp: " + Utils.getColouredBoolean(ToggleCommand.melodyTooltips)); + notifySlayerSlain = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Notify when Slayer Slain: " + Utils.getColouredBoolean(ToggleCommand.notifySlayerSlainToggled)); + necronNotifications = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Necron Phase Notifications: " + Utils.getColouredBoolean(ToggleCommand.necronNotificationsToggled)); + bonzoTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Bonzo's Mask Timer: " + Utils.getColouredBoolean(ToggleCommand.bonzoTimerToggled)); + autoSkillTracker = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Auto Start/Stop Skill Tracker: " + Utils.getColouredBoolean(ToggleCommand.autoSkillTrackerToggled)); + shadowFury = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Block Shadow Fury ability: " + Utils.getColouredBoolean(ToggleCommand.shadowFuryToggled)); + specialHoe = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Block Special Hoe right click: " + Utils.getColouredBoolean(ToggleCommand.specialHoeRightClick)); + melodyTooltips = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Hide tooltips in Melody's Harp: " + Utils.getColouredBoolean(ToggleCommand.melodyTooltips)); switch (page) { case 1: @@ -178,6 +179,7 @@ public class DankerGui extends GuiScreen { this.buttonList.add(backPage); break; case 4: + this.buttonList.add(killComboMessages); this.buttonList.add(goldenEnch); this.buttonList.add(petColours); this.buttonList.add(expertiseLore); @@ -189,6 +191,7 @@ public class DankerGui extends GuiScreen { this.buttonList.add(backPage); break; case 5: + this.buttonList.add(splitFishing); this.buttonList.add(lowHealthNotify); this.buttonList.add(lividSolver); this.buttonList.add(dungeonTimer); @@ -200,6 +203,7 @@ public class DankerGui extends GuiScreen { this.buttonList.add(backPage); break; case 6: + this.buttonList.add(notifySlayerSlain); this.buttonList.add(necronNotifications); this.buttonList.add(bonzoTimer); this.buttonList.add(autoSkillTracker); @@ -401,6 +405,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.melodyTooltips = !ToggleCommand.melodyTooltips; ConfigHandler.writeBooleanConfig("toggles", "MelodyTooltips", ToggleCommand.melodyTooltips); melodyTooltips.displayString = "Hide tooltips in Melody's Harp: " + Utils.getColouredBoolean(ToggleCommand.melodyTooltips); + } else if (button == killComboMessages) { + ToggleCommand.killComboMessages = !ToggleCommand.killComboMessages; + ConfigHandler.writeBooleanConfig("toggles", "KillComboMessages", ToggleCommand.killComboMessages); + killComboMessages.displayString = "Kill Combo Messages: " + Utils.getColouredBoolean(ToggleCommand.killComboMessages); } } diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index f502df9..3864b80 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -23,6 +23,7 @@ public class PuzzleSolversGui extends GuiScreen { private GuiButton water; private GuiButton ticTacToe; private GuiButton boulder; + private GuiButton silverfish; private GuiButton startsWith; private GuiButton selectAll; private GuiButton clickOrder; @@ -59,11 +60,12 @@ public class PuzzleSolversGui extends GuiScreen { ticTacToe = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Tic Tac Toe Solver: " + Utils.getColouredBoolean(ToggleCommand.ticTacToeToggled)); boulder = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Boulder Solver: " + Utils.getColouredBoolean(ToggleCommand.boulderToggled)); // Page 2 - 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)); + silverfish = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Silverfish Solver: " + Utils.getColouredBoolean(ToggleCommand.silverfishToggled)); + startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); + selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); + clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled)); + blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled)); + itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); switch (page) { case 1: @@ -77,6 +79,7 @@ public class PuzzleSolversGui extends GuiScreen { this.buttonList.add(nextPage); break; case 2: + this.buttonList.add(silverfish); this.buttonList.add(startsWith); this.buttonList.add(selectAll); this.buttonList.add(clickOrder); @@ -130,6 +133,10 @@ public class PuzzleSolversGui extends GuiScreen { ToggleCommand.boulderToggled = !ToggleCommand.boulderToggled; ConfigHandler.writeBooleanConfig("toggles", "BoulderPuzzle", ToggleCommand.boulderToggled); boulder.displayString = "Boulder Solver: " + Utils.getColouredBoolean(ToggleCommand.boulderToggled); + } else if (button == silverfish) { + ToggleCommand.silverfishToggled = !ToggleCommand.silverfishToggled; + ConfigHandler.writeBooleanConfig("toggles", "SilverfishPuzzle", ToggleCommand.silverfishToggled); + silverfish.displayString = "Silverfish Solver: " + Utils.getColouredBoolean(ToggleCommand.silverfishToggled); } 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 23ccb09..892f231 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -90,7 +90,7 @@ public class ConfigHandler { } return true; } - + public static void writeIntConfig(String category, String key, int value) { config = new Configuration(new File(file)); try { @@ -235,7 +235,8 @@ public class ConfigHandler { ToggleCommand.healMessages = initBoolean("toggles", "HealMessages", true); ToggleCommand.cooldownMessages = initBoolean("toggles", "CooldownMessages", true); ToggleCommand.manaMessages = initBoolean("toggles", "ManaMessages", true); - //Dungeons + ToggleCommand.killComboMessages = initBoolean("toggles", "KillComboMessages", true); + // Dungeons ToggleCommand.dungeonTimerToggled = initBoolean("toggles", "DungeonTimer", false); ToggleCommand.lowHealthNotifyToggled = initBoolean("toggles", "LowHealthNotify", false); ToggleCommand.lividSolverToggled = initBoolean("toggles", "LividSolver", false); @@ -255,6 +256,7 @@ public class ConfigHandler { ToggleCommand.waterToggled = initBoolean("toggles", "WaterPuzzle", false); ToggleCommand.ticTacToeToggled = initBoolean("toggles", "TicTacToePuzzle", false); ToggleCommand.boulderToggled = initBoolean("toggles", "BoulderPuzzle", false); + ToggleCommand.silverfishToggled = initBoolean("toggles", "SilverfishPuzzle", false); ToggleCommand.startsWithToggled = initBoolean("toggles", "StartsWithTerminal", false); ToggleCommand.selectAllToggled = initBoolean("toggles", "SelectAllTerminal", false); ToggleCommand.clickInOrderToggled = initBoolean("toggles", "ClickInOrderTerminal", false); @@ -513,6 +515,7 @@ public class ConfigHandler { 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); + SilverfishSolver.SILVERFISH_LINE_COLOUR = initInt("colors", "silverfishLine", 0x40FF40); // Commands if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false); diff --git a/src/main/java/me/Danker/utils/SilverfishUtils.java b/src/main/java/me/Danker/utils/SilverfishUtils.java new file mode 100644 index 0000000..e495da5 --- /dev/null +++ b/src/main/java/me/Danker/utils/SilverfishUtils.java @@ -0,0 +1,104 @@ +package me.Danker.utils; + +import java.util.*; + +public class SilverfishUtils { + + // bfs + public static List<Point> solve(char[][] board, Point startPos, List<Point> endColumns) { + LinkedList<Point> queue = new LinkedList<>(); + Map<Point, Point> visited = new HashMap<>(); + queue.add(startPos); + visited.put(startPos, null); + while (!queue.isEmpty()) { + if (queue.size() > 1000000) break; + Point position = queue.pollFirst(); + for (Direction direction : Direction.values()) { + Point pushedPoint = push(board, position, direction); + if (visited.containsKey(pushedPoint)) continue; + queue.add(pushedPoint); + visited.put(pushedPoint, position); + for (Point endColumn : endColumns) { + if (pushedPoint.equals(endColumn)) { + List<Point> route = new ArrayList<>(); + Point lastPoint = pushedPoint; + while (lastPoint != null) { + route.add(0, lastPoint); + lastPoint = visited.get(lastPoint); + } + return route; + } + } + } + } + return new ArrayList<>(); + } + + public static Point push(char[][] board, Point pos, Direction direction) { + switch (direction) { + case UP: + for (int row = pos.row; row >= 0; row--) { + if (board[row][pos.column] == 'X') { + return new Point(row + 1, pos.column); + } + } + return new Point(0, pos.column); + case DOWN: + for (int row = pos.row; row <= 18; row++) { + if (board[row][pos.column] == 'X') { + return new Point(row - 1, pos.column); + } + } + return new Point(18, pos.column); + case LEFT: + for (int column = pos.column; column >= 0; column--) { + if (board[pos.row][column] == 'X') { + return new Point(pos.row, column + 1); + } + } + return new Point(pos.row, 0); + case RIGHT: + for (int column = pos.column; column <= 18; column++) { + if (board[pos.row][column] == 'X') { + return new Point(pos.row, column - 1); + } + } + return new Point(pos.row, 18); + } + return null; + } + + public static class Point { + + public int row; + public int column; + + public Point(int row, int column) { + this.row = row; + this.column = column; + } + + @Override + public int hashCode() { + return Objects.hash(row, column); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof Point) { + Point point = (Point) obj; + return row == point.row && column == point.column; + } + return false; + } + + } + + enum Direction { + UP, + DOWN, + LEFT, + RIGHT + } + +} |