From 7296e488bfe96eeb1cc91bbaeb3411f43d1f4386 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 24 Oct 2020 20:30:39 -0400 Subject: Add riddle, trivia, blaze puzzle solvers For the ChatTriggers haters --- .../java/me/Danker/commands/ToggleCommand.java | 31 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src/main/java/me/Danker/commands/ToggleCommand.java') diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 2835db6..71dc6ac 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -30,6 +30,10 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean expertiseLoreToggled; public static boolean skill50DisplayToggled; public static boolean outlineTextToggled; + // Puzzle Solvers + public static boolean threeManToggled; + public static boolean oruoToggled; + public static boolean blazeToggled; @Override public String getCommandName() { @@ -38,7 +42,9 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " "; + return "/" + getCommandName() + " "; } @Override @@ -49,7 +55,11 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "list"); + return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", + "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", + "sceptremessages", "petcolors", "dungeontimer", "golemalerts", + "expertiselore", "skill50display", "outlinetext", "threemanpuzzle", + "oruopuzzle", "blazepuzzle", "list"); } return null; } @@ -132,6 +142,18 @@ public class ToggleCommand extends CommandBase implements ICommand { outlineTextToggled = !outlineTextToggled; cf.writeBooleanConfig("toggles", "OutlineText", outlineTextToggled); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Outline displayed text has been set to " + EnumChatFormatting.DARK_GREEN + outlineTextToggled + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("threemanpuzzle")) { + threeManToggled = !threeManToggled; + cf.writeBooleanConfig("toggles", "ThreeManPuzzle", threeManToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Three man puzzle solver has been set to " + EnumChatFormatting.DARK_GREEN + threeManToggled + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("oruopuzzle")) { + oruoToggled = !oruoToggled; + cf.writeBooleanConfig("toggles", "OruoPuzzle", oruoToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Oruo trivia solver has been set to " + EnumChatFormatting.DARK_GREEN + threeManToggled + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("blazepuzzle")) { + blazeToggled = !blazeToggled; + cf.writeBooleanConfig("toggles", "BlazePuzzle", blazeToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Blaze puzzle solver has been set to " + EnumChatFormatting.DARK_GREEN + threeManToggled + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("list")) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Guild party notifications: " + EnumChatFormatting.DARK_GREEN + gpartyToggled + "\n" + EnumChatFormatting.GREEN + " Coord/Angle display: " + EnumChatFormatting.DARK_GREEN + coordsToggled + "\n" + @@ -149,7 +171,10 @@ public class ToggleCommand extends CommandBase implements ICommand { EnumChatFormatting.GREEN + " Golem spawn alerts: " + EnumChatFormatting.DARK_GREEN + golemAlertToggled + "\n" + EnumChatFormatting.GREEN + " Expertise in lore: " + EnumChatFormatting.DARK_GREEN + expertiseLoreToggled + "\n" + EnumChatFormatting.GREEN + " Skill 50 display: " + EnumChatFormatting.DARK_GREEN + skill50DisplayToggled + "\n" + - EnumChatFormatting.GREEN + " Outline displayed text: " + EnumChatFormatting.DARK_GREEN + outlineTextToggled)); + EnumChatFormatting.GREEN + " Outline displayed text: " + EnumChatFormatting.DARK_GREEN + outlineTextToggled + "\n" + + EnumChatFormatting.GREEN + " Three man puzzle solver: " + EnumChatFormatting.DARK_GREEN + threeManToggled + "\n" + + EnumChatFormatting.GREEN + " Oruo trivia solver: " + EnumChatFormatting.DARK_GREEN + oruoToggled + "\n" + + EnumChatFormatting.GREEN + " Blaze puzzle solver: " + EnumChatFormatting.DARK_GREEN + blazeToggled)); } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); } -- cgit From e37d0ebbabaa5b9387cf056228a9aa58479f78e1 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Tue, 27 Oct 2020 18:04:26 -0400 Subject: Add experimental creeper puzzle solver --- README.md | 2 +- src/main/java/me/Danker/TheMod.java | 57 +++++++++++++++- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/ToggleCommand.java | 16 +++-- src/main/java/me/Danker/gui/PuzzleSolversGui.java | 7 ++ .../java/me/Danker/handlers/ConfigHandler.java | 2 + src/main/java/me/Danker/utils/Utils.java | 75 ++++++++++++++++++++++ 7 files changed, 152 insertions(+), 9 deletions(-) (limited to 'src/main/java/me/Danker/commands/ToggleCommand.java') diff --git a/README.md b/README.md index 3169eb0..d508797 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Discord Server: https://discord.gg/QsEkNQS - Fishing tracker (with graphic display) (scalable) - Expertise kills in fishing rod lore - Dungeons tracker (with graphic display) (scalable) -- Dungeons puzzle solver (Riddle, trivia, blaze) (toggleable) +- Dungeons puzzle solver (Riddle, trivia, blaze, creeper) (toggleable) - Pet background colors based on level - Golem spawning alerts (toggleable) - Show total skill xp instead of progress to next level diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 9f19c97..5ff57e6 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -5,6 +5,7 @@ import java.awt.SystemTray; import java.awt.Toolkit; import java.awt.TrayIcon; import java.text.NumberFormat; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -50,14 +51,17 @@ import me.Danker.handlers.PacketHandler; import me.Danker.handlers.ScoreboardHandler; import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; +import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; +import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; import net.minecraft.event.ClickEvent.Action; +import net.minecraft.init.Blocks; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; @@ -70,6 +74,7 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; import net.minecraft.util.StringUtils; +import net.minecraft.util.Vec3; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.GuiScreenEvent; @@ -122,8 +127,13 @@ public class TheMod "My chest doesn't have the reward. We are all telling the truth", "My chest has the reward and I'm telling the truth", "The reward isn't in any of our chests", "Both of them are telling the truth."}; static Map triviaSolutions = new HashMap(); - Entity highestBlaze = null; - Entity lowestBlaze = null; + static Entity highestBlaze = null; + static Entity lowestBlaze = null; + // Among Us colours + static int[] creeperLineColours = {0x50EF39, 0xC51111, 0x132ED1, 0x117F2D, 0xED54BA, 0xEF7D0D, 0xF5F557, 0xD6E0F0, 0x6B2FBB, 0x39FEDC}; + static boolean drawCreeperLines = false; + static Vec3 creeperLocation = new Vec3(0, 0, 0); + static List creeperLines = new ArrayList(); static double dungeonStartTime = 0; static double bloodOpenTime = 0; @@ -195,6 +205,7 @@ public class TheMod triviaSolutions.put("How many Fairy Souls are there in Blazing Fortress?", "19 Fairy Souls"); triviaSolutions.put("How many Fairy Souls are there in The Park?", "11 Fairy Souls"); triviaSolutions.put("How many Fairy Souls are there in Jerry's Workshop?", "5 Fairy Souls"); + triviaSolutions.put("How many Fairy Souls are there in Hub?", "79 Fairy Souls"); triviaSolutions.put("How many Fairy Souls are there in The Hub?", "79 Fairy Souls"); triviaSolutions.put("How many Fairy Souls are there in Deep Caverns?", "21 Fairy Souls"); triviaSolutions.put("How many Fairy Souls are there in Gold Mine?", "12 Fairy Souls"); @@ -1927,6 +1938,43 @@ public class TheMod ConfigHandler.writeStringConfig("misc", "display", DisplayCommand.display); } + if (ToggleCommand.creeperToggled && Utils.inDungeons && mc.theWorld != null) { + double x = player.posX; + double y = player.posY; + double z = player.posZ; + // Find creepers nearby + AxisAlignedBB creeperScan = new AxisAlignedBB(x - 14, y - 8, z - 13, x + 14, y + 8, z + 13); // 28x16x26 cube + List creepers = mc.theWorld.getEntitiesWithinAABB(EntityCreeper.class, creeperScan); + // Check if creeper is nearby + if (creepers.size() > 0) { + EntityCreeper creeper = creepers.get(0); + // Start creeper line drawings + creeperLines.clear(); + if (!drawCreeperLines) creeperLocation = new Vec3(creeper.posX, creeper.posY + 1, creeper.posZ); + drawCreeperLines = true; + // Search for nearby sea lanterns and prismarine blocks + BlockPos point1 = new BlockPos(creeper.posX - 14, creeper.posY - 7, creeper.posZ - 13); + BlockPos point2 = new BlockPos(creeper.posX + 14, creeper.posY + 10, creeper.posZ + 13); + Iterable blocks = BlockPos.getAllInBox(point1, point2); + for (BlockPos blockPos : blocks) { + Block block = mc.theWorld.getBlockState(blockPos).getBlock(); + if (block == Blocks.sea_lantern || block == Blocks.prismarine) { + // Connect block to nearest block on opposite side + Vec3 startBlock = new Vec3(blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5); + BlockPos oppositeBlock = Utils.getFirstBlockPosAfterVectors(mc, startBlock, creeperLocation, 10, 20); + BlockPos endBlock = Utils.getNearbyBlock(mc, oppositeBlock, Blocks.sea_lantern, Blocks.prismarine); + if (endBlock != null) { + // Add to list for drawing + Vec3[] insertArray = {startBlock, new Vec3(endBlock.getX() + 0.5, endBlock.getY() + 0.5, endBlock.getZ() + 0.5)}; + creeperLines.add(insertArray); + } + } + } + } else { + drawCreeperLines = false; + } + } + tickAmount = 0; } @@ -2011,6 +2059,11 @@ public class TheMod Utils.draw3DBox(aabb, 0x00, 0xFF, 0x00, 0xFF, event.partialTicks); } } + if (ToggleCommand.creeperToggled && drawCreeperLines && !creeperLines.isEmpty()) { + for (int i = 0; i < creeperLines.size(); i++) { + Utils.draw3DLine(creeperLines.get(i)[0], creeperLines.get(i)[1], creeperLineColours[i % 10], event.partialTicks); + } + } } @SubscribeEvent diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 1ed931f..bf6ed7f 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -34,7 +34,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + EnumChatFormatting.GOLD + " /dsm" + EnumChatFormatting.AQUA + " - Opens the GUI for Danker's Skyblock Mod.\n" + - EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + EnumChatFormatting.GOLD + " /loot [winter/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 71dc6ac..39f1093 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -34,6 +34,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean threeManToggled; public static boolean oruoToggled; public static boolean blazeToggled; + public static boolean creeperToggled; @Override public String getCommandName() { @@ -44,7 +45,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public String getCommandUsage(ICommandSender arg0) { return "/" + getCommandName() + " "; + "outlinetext/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/list>"; } @Override @@ -59,7 +60,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "threemanpuzzle", - "oruopuzzle", "blazepuzzle", "list"); + "oruopuzzle", "blazepuzzle", "creeperpuzzle", "list"); } return null; } @@ -149,11 +150,15 @@ public class ToggleCommand extends CommandBase implements ICommand { } else if (arg1[0].equalsIgnoreCase("oruopuzzle")) { oruoToggled = !oruoToggled; cf.writeBooleanConfig("toggles", "OruoPuzzle", oruoToggled); - player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Oruo trivia solver has been set to " + EnumChatFormatting.DARK_GREEN + threeManToggled + EnumChatFormatting.GREEN + ".")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Oruo trivia solver has been set to " + EnumChatFormatting.DARK_GREEN + oruoToggled + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("blazepuzzle")) { blazeToggled = !blazeToggled; cf.writeBooleanConfig("toggles", "BlazePuzzle", blazeToggled); - player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Blaze puzzle solver has been set to " + EnumChatFormatting.DARK_GREEN + threeManToggled + EnumChatFormatting.GREEN + ".")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Blaze puzzle solver has been set to " + EnumChatFormatting.DARK_GREEN + blazeToggled + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("creeperpuzzle")) { + creeperToggled = !creeperToggled; + cf.writeBooleanConfig("creeperpuzzle", "CreeperPuzzle", creeperToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Creeper puzzle solver has been set to " + EnumChatFormatting.DARK_GREEN + creeperToggled + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("list")) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Guild party notifications: " + EnumChatFormatting.DARK_GREEN + gpartyToggled + "\n" + EnumChatFormatting.GREEN + " Coord/Angle display: " + EnumChatFormatting.DARK_GREEN + coordsToggled + "\n" + @@ -174,7 +179,8 @@ public class ToggleCommand extends CommandBase implements ICommand { EnumChatFormatting.GREEN + " Outline displayed text: " + EnumChatFormatting.DARK_GREEN + outlineTextToggled + "\n" + EnumChatFormatting.GREEN + " Three man puzzle solver: " + EnumChatFormatting.DARK_GREEN + threeManToggled + "\n" + EnumChatFormatting.GREEN + " Oruo trivia solver: " + EnumChatFormatting.DARK_GREEN + oruoToggled + "\n" + - EnumChatFormatting.GREEN + " Blaze puzzle solver: " + EnumChatFormatting.DARK_GREEN + blazeToggled)); + EnumChatFormatting.GREEN + " Blaze puzzle solver: " + EnumChatFormatting.DARK_GREEN + blazeToggled + "\n" + + EnumChatFormatting.GREEN + " Creeper puzzle solver: " + EnumChatFormatting.DARK_GREEN + creeperToggled)); } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index 8fbc32e..e2fa4ef 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -15,6 +15,7 @@ public class PuzzleSolversGui extends GuiScreen { private GuiButton riddle; private GuiButton trivia; private GuiButton blaze; + private GuiButton creeper; @Override public boolean doesGuiPauseGame() { @@ -33,11 +34,13 @@ public class PuzzleSolversGui extends GuiScreen { riddle = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Riddle Solver: " + Utils.getColouredBoolean(ToggleCommand.threeManToggled)); trivia = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Trivia Solver: " + Utils.getColouredBoolean(ToggleCommand.oruoToggled)); blaze = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Blaze Solver: " + Utils.getColouredBoolean(ToggleCommand.blazeToggled)); + creeper = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Creeper Solver : " + Utils.getColouredBoolean(ToggleCommand.creeperToggled)); this.buttonList.add(goBack); this.buttonList.add(riddle); this.buttonList.add(trivia); this.buttonList.add(blaze); + this.buttonList.add(creeper); } @Override @@ -62,6 +65,10 @@ public class PuzzleSolversGui extends GuiScreen { ToggleCommand.blazeToggled = !ToggleCommand.blazeToggled; ConfigHandler.writeBooleanConfig("toggles", "BlazePuzzle", ToggleCommand.blazeToggled); blaze.displayString = "Blaze Solver: " + Utils.getColouredBoolean(ToggleCommand.blazeToggled); + } else if (button == creeper) { + ToggleCommand.creeperToggled = !ToggleCommand.creeperToggled; + ConfigHandler.writeBooleanConfig("toggles", "CreeperPuzzle", ToggleCommand.creeperToggled); + creeper.displayString = "Creeper Solver: " + Utils.getColouredBoolean(ToggleCommand.creeperToggled); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 4663049..51b7f6e 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -192,6 +192,7 @@ public class ConfigHandler { 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("api", "APIKey")) writeStringConfig("api", "APIKey", ""); @@ -361,6 +362,7 @@ public class ConfigHandler { tf.threeManToggled = getBoolean("toggles", "ThreeManPuzzle"); tf.oruoToggled = getBoolean("toggles", "OruoPuzzle"); tf.blazeToggled = getBoolean("toggles", "BlazePuzzle"); + tf.creeperToggled = getBoolean("toggles", "CreeperPuzzle"); final BlockSlayerCommand bs = new BlockSlayerCommand(); String onlySlayer = getString("toggles", "BlockSlayer"); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 532d1b9..928e02f 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -1,5 +1,6 @@ package me.Danker.utils; +import java.awt.Color; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -10,6 +11,7 @@ import org.lwjgl.opengl.GL11; import me.Danker.TheMod; import me.Danker.handlers.ScoreboardHandler; import me.Danker.handlers.TextRenderer; +import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; @@ -22,11 +24,13 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StringUtils; +import net.minecraft.util.Vec3; public class Utils { @@ -251,6 +255,37 @@ public class Utils { return bool ? EnumChatFormatting.GREEN + "On" : EnumChatFormatting.RED + "Off"; } + public static void draw3DLine(Vec3 pos1, Vec3 pos2, int colourInt, float partialTicks) { + Entity render = Minecraft.getMinecraft().getRenderViewEntity(); + WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + Color colour = new Color(colourInt); + + double realX = render.lastTickPosX + (render.posX - render.lastTickPosX) * partialTicks; + double realY = render.lastTickPosY + (render.posY - render.lastTickPosY) * partialTicks; + double realZ = render.lastTickPosZ + (render.posZ - render.lastTickPosZ) * partialTicks; + + GlStateManager.pushMatrix(); + GlStateManager.translate(-realX, -realY, -realZ); + GlStateManager.disableTexture2D(); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GL11.glLineWidth(2); + GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue()/ 255f, colour.getAlpha() / 255f); + worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); + + worldRenderer.pos(pos1.xCoord, pos1.yCoord, pos1.zCoord).endVertex(); + worldRenderer.pos(pos2.xCoord, pos2.yCoord, pos2.zCoord).endVertex(); + Tessellator.getInstance().draw(); + + GlStateManager.translate(realX, realY, realZ); + GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } + public static void draw3DString(BlockPos pos, String text, int colour, float partialTicks) { Minecraft mc = Minecraft.getMinecraft(); EntityPlayer player = mc.thePlayer; @@ -326,4 +361,44 @@ public class Utils { GlStateManager.popMatrix(); } + public static BlockPos getFirstBlockPosAfterVectors(Minecraft mc, Vec3 pos1, Vec3 pos2, int strength, int distance) { + double x = pos2.xCoord - pos1.xCoord; + double y = pos2.yCoord - pos1.yCoord; + double z = pos2.zCoord - pos1.zCoord; + + for (int i = strength; i < distance * strength; i++) { // Start at least 1 strength away + double newX = pos1.xCoord + ((x / strength) * i); + double newY = pos1.yCoord + ((y / strength) * i); + double newZ = pos1.zCoord + ((z / strength) * i); + + BlockPos newBlock = new BlockPos(newX, newY, newZ); + if (mc.theWorld.getBlockState(newBlock).getBlock() != Blocks.air) { + return newBlock; + } + } + + return null; + } + + public static BlockPos getNearbyBlock(Minecraft mc, BlockPos pos, Block... blockTypes) { + if (pos == null) return null; + BlockPos pos1 = new BlockPos(pos.getX() - 2, pos.getY() - 3, pos.getZ() - 2); + BlockPos pos2 = new BlockPos(pos.getX() + 2, pos.getY() + 3, pos.getZ() + 2); + + BlockPos closestBlock = null; + double closestBlockDistance = 99; + Iterable blocks = BlockPos.getAllInBox(pos1, pos2); + + for (BlockPos block : blocks) { + for (Block blockType : blockTypes) { + if (mc.theWorld.getBlockState(block).getBlock() == blockType && block.distanceSq(pos) < closestBlockDistance) { + closestBlock = block; + closestBlockDistance = block.distanceSq(pos); + } + } + } + + return closestBlock; + } + } -- cgit From 16de1dc972fe6a920295a0458a96ad79ea1b684b Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Wed, 28 Oct 2020 18:49:33 -0400 Subject: Add molten wave message hider, add skill50display time to config and bug fixes Add missing toggles to /dsm Only allow riddle and trivia solver in dungeons Don't let creeper line point underground --- README.md | 1 + src/main/java/me/Danker/TheMod.java | 13 +++-- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/ToggleCommand.java | 12 +++- src/main/java/me/Danker/gui/DankerGui.java | 67 +++++++++++++++------- .../java/me/Danker/handlers/ConfigHandler.java | 5 ++ 6 files changed, 70 insertions(+), 30 deletions(-) (limited to 'src/main/java/me/Danker/commands/ToggleCommand.java') diff --git a/README.md b/README.md index d508797..c9ff37b 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Discord Server: https://discord.gg/QsEkNQS - Golden T10/T6/T4 enchant display (toggleable) - Block AOTD ability (toggleable) - Disable Spirit Sceptre messages (toggleable) +- Disable Midas Staff messages (toggleable) - Slayer item tracker (with graphic display) (scalable) - RNGesus drop alerts (toggleable) - Click in chat to open Maddox (toggleable) diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 5ff57e6..27aaef7 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -114,6 +114,7 @@ public class TheMod public static int titleTimer = -1; public static boolean showTitle = false; public static String titleText = ""; + public static int SKILL_TIME; public static int skillTimer = -1; public static boolean showSkill = false; public static String skillText = ""; @@ -320,7 +321,7 @@ public class TheMod int previousXp = Utils.getPastXpEarned(Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", ""))); double percentage = (double) Math.floor(((currentXp + previousXp) / 55172425) * 10000D) / 100D; - skillTimer = 40; + skillTimer = SKILL_TIME; showSkill = true; skillText = EnumChatFormatting.AQUA + xpGained + " (" + NumberFormat.getNumberInstance(Locale.US).format(currentXp + previousXp) + "/55,172,425) " + percentage + "%"; } @@ -338,7 +339,7 @@ public class TheMod } // Dungeon chat spoken by an NPC, containing : - if (ToggleCommand.threeManToggled && message.contains("[NPC]")) { + if (ToggleCommand.threeManToggled && Utils.inDungeons && message.contains("[NPC]")) { for (String solution : riddleSolutions) { if (message.contains(solution)) { String npcName = message.substring(message.indexOf("]") + 2, message.indexOf(":")); @@ -357,7 +358,7 @@ public class TheMod if (message.contains(":")) return; - if (ToggleCommand.oruoToggled) { + if (ToggleCommand.oruoToggled && Utils.inDungeons) { for (String question : triviaSolutions.keySet()) { if (message.contains(question)) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Answer: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + triviaSolutions.get(question))); @@ -1040,6 +1041,10 @@ public class TheMod if (!tc.sceptreMessages && message.contains("Your Bat Staff hit ")) { event.setCanceled(true); } + // Midas Staff + if (!tc.midasStaffMessages && message.contains("Your Molten Wave hit ")) { + event.setCanceled(true); + } } @SubscribeEvent @@ -1963,7 +1968,7 @@ public class TheMod Vec3 startBlock = new Vec3(blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5); BlockPos oppositeBlock = Utils.getFirstBlockPosAfterVectors(mc, startBlock, creeperLocation, 10, 20); BlockPos endBlock = Utils.getNearbyBlock(mc, oppositeBlock, Blocks.sea_lantern, Blocks.prismarine); - if (endBlock != null) { + if (endBlock != null && startBlock.yCoord > 68 && endBlock.getY() > 68) { // Don't create line underground // Add to list for drawing Vec3[] insertArray = {startBlock, new Vec3(endBlock.getX() + 0.5, endBlock.getY() + 0.5, endBlock.getZ() + 0.5)}; creeperLines.add(insertArray); diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index bf6ed7f..0175c81 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -34,7 +34,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + EnumChatFormatting.GOLD + " /dsm" + EnumChatFormatting.AQUA + " - Opens the GUI for Danker's Skyblock Mod.\n" + - EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + EnumChatFormatting.GOLD + " /loot [winter/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 39f1093..9b19a38 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -30,6 +30,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean expertiseLoreToggled; public static boolean skill50DisplayToggled; public static boolean outlineTextToggled; + public static boolean midasStaffMessages; // Puzzle Solvers public static boolean threeManToggled; public static boolean oruoToggled; @@ -45,7 +46,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public String getCommandUsage(ICommandSender arg0) { return "/" + getCommandName() + " "; + "outlinetext/midasstaffmessages/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/list>"; } @Override @@ -59,8 +60,8 @@ public class ToggleCommand extends CommandBase implements ICommand { return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", - "expertiselore", "skill50display", "outlinetext", "threemanpuzzle", - "oruopuzzle", "blazepuzzle", "creeperpuzzle", "list"); + "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", + "threemanpuzzle", "oruopuzzle", "blazepuzzle", "creeperpuzzle", "list"); } return null; } @@ -143,6 +144,10 @@ public class ToggleCommand extends CommandBase implements ICommand { outlineTextToggled = !outlineTextToggled; cf.writeBooleanConfig("toggles", "OutlineText", outlineTextToggled); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Outline displayed text has been set to " + EnumChatFormatting.DARK_GREEN + outlineTextToggled + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("midasstaffmessages")) { + midasStaffMessages = !midasStaffMessages; + cf.writeBooleanConfig("toggles", "MidasStaffMessages", midasStaffMessages); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Midas Staff messages have been set to " + EnumChatFormatting.DARK_GREEN + midasStaffMessages + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("threemanpuzzle")) { threeManToggled = !threeManToggled; cf.writeBooleanConfig("toggles", "ThreeManPuzzle", threeManToggled); @@ -177,6 +182,7 @@ public class ToggleCommand extends CommandBase implements ICommand { EnumChatFormatting.GREEN + " Expertise in lore: " + EnumChatFormatting.DARK_GREEN + expertiseLoreToggled + "\n" + EnumChatFormatting.GREEN + " Skill 50 display: " + EnumChatFormatting.DARK_GREEN + skill50DisplayToggled + "\n" + EnumChatFormatting.GREEN + " Outline displayed text: " + EnumChatFormatting.DARK_GREEN + outlineTextToggled + "\n" + + EnumChatFormatting.GREEN + " Midas Staff messages: " + EnumChatFormatting.DARK_GREEN + midasStaffMessages + "\n" + EnumChatFormatting.GREEN + " Three man puzzle solver: " + EnumChatFormatting.DARK_GREEN + threeManToggled + "\n" + EnumChatFormatting.GREEN + " Oruo trivia solver: " + EnumChatFormatting.DARK_GREEN + oruoToggled + "\n" + EnumChatFormatting.GREEN + " Blaze puzzle solver: " + EnumChatFormatting.DARK_GREEN + blazeToggled + "\n" + diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 37d1e01..7316395 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -45,6 +45,7 @@ public class DankerGui extends GuiScreen { private GuiButton expertiseLore; private GuiButton skill50Display; private GuiButton outlineText; + private GuiButton midasStaffMessages; public DankerGui(int page) { this.page = page; @@ -75,50 +76,56 @@ public class DankerGui extends GuiScreen { onlySlayer = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Set Slayer Quest"); puzzleSolvers = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Toggle Dungeons Puzzle Solvers"); outlineText = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Outline Displayed Text: " + Utils.getColouredBoolean(ToggleCommand.outlineTextToggled)); - gparty = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); - coords = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Coordinate/Angle Display: " + Utils.getColouredBoolean(ToggleCommand.coordsToggled)); - goldenEnch = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); - // Page 2 - slayerCount = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal)); - aotd = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Disable AOTD Ability: " + Utils.getColouredBoolean(ToggleCommand.aotdToggled)); - lividDagger = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Disable Livid Dagger Ability: " + Utils.getColouredBoolean(ToggleCommand.lividDaggerToggled)); - sceptreMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Enable Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); - petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); + splitFishing = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); dungeonTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); - golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); + coords = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Coordinate/Angle Display: " + Utils.getColouredBoolean(ToggleCommand.coordsToggled)); + // Page 2 + gparty = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); + goldenEnch = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); + slayerCount = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal)); + chatMaddox = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Click Chat to Open Maddox: " + Utils.getColouredBoolean(ToggleCommand.chatMaddoxToggled)); + spiritBearAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Spirit Bear Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.spiritBearAlerts)); + aotd = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Disable AOTD Ability: " + Utils.getColouredBoolean(ToggleCommand.aotdToggled)); + lividDagger = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Disable Livid Dagger Ability: " + Utils.getColouredBoolean(ToggleCommand.lividDaggerToggled)); // Page 3 - expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); - skill50Display = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled)); + sceptreMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); + midasStaffMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Midas Staff Messages: " + Utils.getColouredBoolean(ToggleCommand.midasStaffMessages)); + petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); + golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); + expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); + skill50Display = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled)); if (page == 1) { this.buttonList.add(changeDisplay); this.buttonList.add(onlySlayer); this.buttonList.add(puzzleSolvers); this.buttonList.add(outlineText); - this.buttonList.add(gparty); + this.buttonList.add(splitFishing); + this.buttonList.add(dungeonTimer); this.buttonList.add(coords); - this.buttonList.add(goldenEnch); this.buttonList.add(nextPage); - this.buttonList.add(closeGUI); } else if (page == 2) { + this.buttonList.add(gparty); + this.buttonList.add(goldenEnch); this.buttonList.add(slayerCount); + this.buttonList.add(chatMaddox); + this.buttonList.add(spiritBearAlert); this.buttonList.add(aotd); this.buttonList.add(lividDagger); - this.buttonList.add(sceptreMessages); - this.buttonList.add(petColours); - this.buttonList.add(dungeonTimer); - this.buttonList.add(golemAlerts); this.buttonList.add(nextPage); this.buttonList.add(backPage); - this.buttonList.add(closeGUI); } else if (page == 3) { + this.buttonList.add(sceptreMessages); + this.buttonList.add(midasStaffMessages); + this.buttonList.add(petColours); + this.buttonList.add(golemAlerts); this.buttonList.add(expertiseLore); this.buttonList.add(skill50Display); this.buttonList.add(backPage); - this.buttonList.add(closeGUI); } this.buttonList.add(githubLink); this.buttonList.add(discordLink); + this.buttonList.add(closeGUI); } @Override @@ -184,7 +191,7 @@ public class DankerGui extends GuiScreen { } else if (button == sceptreMessages) { ToggleCommand.sceptreMessages = !ToggleCommand.sceptreMessages; ConfigHandler.writeBooleanConfig("toggles", "SceptreMessages", ToggleCommand.sceptreMessages); - sceptreMessages.displayString = "Enable Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages); + sceptreMessages.displayString = "Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages); } else if (button == petColours) { ToggleCommand.petColoursToggled = !ToggleCommand.petColoursToggled; ConfigHandler.writeBooleanConfig("toggles", "PetColors", ToggleCommand.petColoursToggled); @@ -205,6 +212,22 @@ public class DankerGui extends GuiScreen { ToggleCommand.skill50DisplayToggled = !ToggleCommand.skill50DisplayToggled; ConfigHandler.writeBooleanConfig("toggles", "Skill50Display", ToggleCommand.skill50DisplayToggled); skill50Display.displayString = "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled); + } else if (button == splitFishing) { + ToggleCommand.splitFishing = !ToggleCommand.splitFishing; + ConfigHandler.writeBooleanConfig("toggles", "SplitFishing", ToggleCommand.splitFishing); + splitFishing.displayString = "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing); + } else if (button == chatMaddox) { + ToggleCommand.chatMaddoxToggled = !ToggleCommand.chatMaddoxToggled; + ConfigHandler.writeBooleanConfig("toggles", "ChatMaddox", ToggleCommand.chatMaddoxToggled); + chatMaddox.displayString = "Click Chat to Open Maddox: " + Utils.getColouredBoolean(ToggleCommand.chatMaddoxToggled); + } else if (button == spiritBearAlert) { + ToggleCommand.spiritBearAlerts = !ToggleCommand.spiritBearAlerts; + ConfigHandler.writeBooleanConfig("toggles", "SpiritBearAlerts", ToggleCommand.spiritBearAlerts); + spiritBearAlert.displayString = "Spirit Bear Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.spiritBearAlerts); + } else if (button == midasStaffMessages) { + ToggleCommand.midasStaffMessages = !ToggleCommand.midasStaffMessages; + ConfigHandler.writeBooleanConfig("toggles", "MidasStaffMessages", ToggleCommand.midasStaffMessages); + midasStaffMessages.displayString = "Midas Staff Messages: " + Utils.getColouredBoolean(ToggleCommand.midasStaffMessages); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 51b7f6e..579c3e0 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -2,6 +2,7 @@ package me.Danker.handlers; import java.io.File; +import me.Danker.TheMod; import me.Danker.commands.BlockSlayerCommand; import me.Danker.commands.DisplayCommand; import me.Danker.commands.LootCommand; @@ -188,6 +189,7 @@ public class ConfigHandler { 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", "MidasStaffMessages")) writeBooleanConfig("toggles", "MidasStaffMessages", true); // Puzzle Solvers if (!hasKey("toggles", "ThreeManPuzzle")) writeBooleanConfig("toggles", "ThreeManPuzzle", false); if (!hasKey("toggles", "OruoPuzzle")) writeBooleanConfig("toggles", "OruoPuzzle", false); @@ -324,6 +326,7 @@ public class ConfigHandler { if (!hasKey("misc", "display")) writeStringConfig("misc", "display", "off"); if (!hasKey("misc", "autoDisplay")) writeBooleanConfig("misc", "autoDisplay", false); + if (!hasKey("misc", "skill50Time")) writeIntConfig("misc", "skill50Time", 3); ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft()); int height = scaled.getScaledHeight(); @@ -358,6 +361,7 @@ public class ConfigHandler { tf.expertiseLoreToggled = getBoolean("toggles", "ExpertiseLore"); tf.skill50DisplayToggled = getBoolean("toggles", "Skill50Display"); tf.outlineTextToggled = getBoolean("toggles", "OutlineText"); + tf.midasStaffMessages = getBoolean("toggles", "MidasStaffMessages"); // Puzzle Solvers tf.threeManToggled = getBoolean("toggles", "ThreeManPuzzle"); tf.oruoToggled = getBoolean("toggles", "OruoPuzzle"); @@ -501,6 +505,7 @@ public class ConfigHandler { final DisplayCommand ds = new DisplayCommand(); ds.display = getString("misc", "display"); ds.auto = getBoolean("misc", "autoDisplay"); + TheMod.SKILL_TIME = getInt("misc", "skill50Time") * 20; final MoveCommand moc = new MoveCommand(); moc.coordsXY[0] = getInt("locations", "coordsX"); -- cgit From 056455031cbe8005a2172d6607b84efc453ac0ea Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sun, 1 Nov 2020 23:32:28 -0500 Subject: Add correct livid finder, change dungeon timer to only display in dungeons, bug fixes Change jar encoding to UTF-8 Update /resetloot catacombs with F5 and F6 Fix Spirit Sceptre message hider Remove debug message from fishing in Jerry Pond --- README.md | 7 ++-- build.gradle | 4 ++ src/main/java/me/Danker/TheMod.java | 47 ++++++++++++++++++++-- src/main/java/me/Danker/commands/DHelpCommand.java | 6 +-- src/main/java/me/Danker/commands/MoveCommand.java | 11 ++++- .../java/me/Danker/commands/ResetLootCommand.java | 11 +++++ src/main/java/me/Danker/commands/ScaleCommand.java | 9 ++++- .../java/me/Danker/commands/ToggleCommand.java | 11 ++++- src/main/java/me/Danker/gui/DankerGui.java | 7 ++++ src/main/java/me/Danker/gui/EditLocationsGui.java | 12 ++++++ .../java/me/Danker/handlers/ConfigHandler.java | 8 ++++ 11 files changed, 118 insertions(+), 15 deletions(-) (limited to 'src/main/java/me/Danker/commands/ToggleCommand.java') diff --git a/README.md b/README.md index c9ff37b..61ebfb6 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ Discord Server: https://discord.gg/QsEkNQS - Expertise kills in fishing rod lore - Dungeons tracker (with graphic display) (scalable) - Dungeons puzzle solver (Riddle, trivia, blaze, creeper) (toggleable) +- Find correct Livid (with graphic display of HP) (toggleable) - Pet background colors based on level - Golem spawning alerts (toggleable) - Show total skill xp instead of progress to next level @@ -33,14 +34,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/f(1-6)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. - /display [winter/f(1-6)/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display 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. +- /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/build.gradle b/build.gradle index cae3082..fbe23f4 100644 --- a/build.gradle +++ b/build.gradle @@ -26,6 +26,10 @@ archivesBaseName = "Danker's Skyblock Mod" sourceCompatibility = targetCompatibility = 1.8 +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} + minecraft { version = "1.8.9-11.15.1.2318-1.8.9" runDir = "run" diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 27aaef7..ca52372 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -85,6 +85,7 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Loader; @@ -96,6 +97,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; +import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerChangedDimensionEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent; import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; @@ -135,6 +137,8 @@ public class TheMod static boolean drawCreeperLines = false; static Vec3 creeperLocation = new Vec3(0, 0, 0); static List creeperLines = new ArrayList(); + static boolean foundLivid = false; + static Entity livid = null; static double dungeonStartTime = 0; static double bloodOpenTime = 0; @@ -300,6 +304,12 @@ public class TheMod } } + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + foundLivid = false; + livid = null; + } + // It randomly broke, so I had to make it the highest priority @SubscribeEvent(priority = EventPriority.HIGHEST) public void onChat(ClientChatReceivedEvent event) { @@ -1038,7 +1048,7 @@ public class TheMod } // Spirit Sceptre - if (!tc.sceptreMessages && message.contains("Your Bat Staff hit ")) { + if (!tc.sceptreMessages && message.contains("Your Spirit Sceptre hit ")) { event.setCanceled(true); } // Midas Staff @@ -1081,7 +1091,7 @@ public class TheMod new TextRenderer(Minecraft.getMinecraft(), coordText, moc.coordsXY[0], moc.coordsXY[1], ScaleCommand.coordsScale); } - if (tc.dungeonTimerToggled) { + if (tc.dungeonTimerToggled && Utils.inDungeons) { String dungeonTimerText = EnumChatFormatting.GRAY + "Wither Doors:\n" + EnumChatFormatting.DARK_RED + "Blood Open:\n" + EnumChatFormatting.RED + "Watcher Clear:\n" + @@ -1098,6 +1108,10 @@ public class TheMod new TextRenderer(Minecraft.getMinecraft(), dungeonTimers, (int) (moc.dungeonTimerXY[0] + (80 * ScaleCommand.dungeonTimerScale)), moc.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale); } + if (tc.lividSolverToggled && foundLivid && livid != null) { + new TextRenderer(Minecraft.getMinecraft(), livid.getName().replace("" + EnumChatFormatting.BOLD, ""), moc.lividHpXY[0], moc.lividHpXY[1], ScaleCommand.lividHpScale); + } + if (!ds.display.equals("off")) { final LootCommand lc = new LootCommand(); String dropsText = ""; @@ -1980,6 +1994,34 @@ public class TheMod } } + if (ToggleCommand.lividSolverToggled && Utils.inDungeons && !foundLivid && mc.theWorld != null) { + boolean inF5 = false; + + List scoreboard = ScoreboardHandler.getSidebarLines(); + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("The Catacombs (F5)")) { + inF5 = true; + break; + } + } + + if (inF5) { + List loadedLivids = new ArrayList(); + List entities = mc.theWorld.getLoadedEntityList(); + for (Entity entity : entities) { + String name = entity.getName(); + if (name.contains("Livid") && name.length() > 5 && name.charAt(1) == name.charAt(5) && !loadedLivids.contains(entity)) { + loadedLivids.add(entity); + } + } + if (loadedLivids.size() > 8) { + livid = loadedLivids.get(0); + foundLivid = true; + } + } + } + tickAmount = 0; } @@ -2249,7 +2291,6 @@ public class TheMod List scoreboard = ScoreboardHandler.getSidebarLines(); for (String s : scoreboard) { String sCleaned = ScoreboardHandler.cleanSB(s); - System.out.println(sCleaned); if (sCleaned.contains("Jerry's Workshop") || sCleaned.contains("Jerry Pond")) { if (lc.yetiSCs != -1) { lc.yetiSCs++; diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 0175c81..aaffa96 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -34,14 +34,14 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + EnumChatFormatting.GOLD + " /dsm" + EnumChatFormatting.AQUA + " - Opens the GUI for Danker's Skyblock Mod.\n" + - EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + EnumChatFormatting.GOLD + " /loot [winter/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + EnumChatFormatting.GOLD + " /display [winter/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active.\n" + EnumChatFormatting.GOLD + " /resetloot " + EnumChatFormatting.AQUA + " - Resets loot for trackers. /resetloot confirm confirms the reset.\n" + - EnumChatFormatting.GOLD + " /move " + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + - EnumChatFormatting.GOLD + " /scale " + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + + EnumChatFormatting.GOLD + " /move " + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + + EnumChatFormatting.GOLD + " /scale " + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + EnumChatFormatting.GOLD + " /slayer [player]" + EnumChatFormatting.AQUA + " - Uses API to get slayer xp of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /skills [player]" + EnumChatFormatting.AQUA + " - Uses API to get skill levels of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /lobbyskills" + EnumChatFormatting.AQUA + " - Uses API to find the average skills of the lobby, as well the three players with the highest skill average.\n" + diff --git a/src/main/java/me/Danker/commands/MoveCommand.java b/src/main/java/me/Danker/commands/MoveCommand.java index 7fb9acd..8b68e7e 100644 --- a/src/main/java/me/Danker/commands/MoveCommand.java +++ b/src/main/java/me/Danker/commands/MoveCommand.java @@ -17,6 +17,7 @@ public class MoveCommand extends CommandBase { public static int[] displayXY = {0, 0}; public static int[] dungeonTimerXY = {0, 0}; public static int[] skill50XY = {0, 0}; + public static int[] lividHpXY = {0, 0}; @Override public String getCommandName() { @@ -25,7 +26,7 @@ public class MoveCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " "; + return "/" + getCommandName() + " "; } @Override @@ -36,7 +37,7 @@ public class MoveCommand extends CommandBase { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp"); } return null; } @@ -75,6 +76,12 @@ public class MoveCommand extends CommandBase { cf.writeIntConfig("locations", "skill50X", skill50XY[0]); cf.writeIntConfig("locations", "skill50Y", skill50XY[1]); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Skill 50 display has been moved to " + EnumChatFormatting.DARK_GREEN + arg1[1] + ", " + arg1[2])); + } else if (arg1[0].equalsIgnoreCase("lividhp")) { + lividHpXY[0] = Integer.parseInt(arg1[1]); + lividHpXY[1] = Integer.parseInt(arg1[2]); + cf.writeIntConfig("locations", "lividHpX", lividHpXY[0]); + cf.writeIntConfig("locations", "lividHpY", lividHpXY[1]); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Livid HP has been moved to " + EnumChatFormatting.DARK_GREEN + arg1[1] + ", " + arg1[2])); } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index bf5b218..a4eee3a 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -217,8 +217,19 @@ public class ResetLootCommand extends CommandBase { lc.shadowAssLegsSession = 0; lc.shadowAssBootsSession = 0; lc.lividDaggersSession = 0; + lc.shadowFurysSession = 0; lc.f5CoinsSpentSession = 0; lc.f5TimeSpentSession = 0; + lc.ancientRosesSession = 0; + lc.precursorEyesSession = 0; + lc.giantsSwordsSession = 0; + lc.necroLordHelmsSession = 0; + lc.necroLordChestsSession = 0; + lc.necroLordLegsSession = 0; + lc.necroLordBootsSession = 0; + lc.necroSwordsSession = 0; + lc.f6CoinsSpentSession = 0; + lc.f6TimeSpentSession = 0; cf.deleteCategory("catacombs"); cf.reloadConfig(); } diff --git a/src/main/java/me/Danker/commands/ScaleCommand.java b/src/main/java/me/Danker/commands/ScaleCommand.java index 5f21b77..76a3062 100644 --- a/src/main/java/me/Danker/commands/ScaleCommand.java +++ b/src/main/java/me/Danker/commands/ScaleCommand.java @@ -17,6 +17,7 @@ public class ScaleCommand extends CommandBase { public static double displayScale; public static double dungeonTimerScale; public static double skill50Scale; + public static double lividHpScale; @Override public String getCommandName() { @@ -25,7 +26,7 @@ public class ScaleCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " "; + return "/" + getCommandName() + " "; } @Override @@ -36,7 +37,7 @@ public class ScaleCommand extends CommandBase { @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp"); } return null; } @@ -72,6 +73,10 @@ public class ScaleCommand extends CommandBase { skill50Scale = scaleAmount; ConfigHandler.writeDoubleConfig("scales", "skill50Scale", skill50Scale); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Skill 50 display has been scaled to " + EnumChatFormatting.DARK_GREEN + skill50Scale + "x")); + } else if (arg1[0].equalsIgnoreCase("lividhp")) { + lividHpScale = scaleAmount; + ConfigHandler.writeDoubleConfig("scales", "lividHpScale", lividHpScale); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Livid HP has been scaled to " + EnumChatFormatting.DARK_GREEN + lividHpScale + "x")); } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 9b19a38..f58777c 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -31,6 +31,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean skill50DisplayToggled; public static boolean outlineTextToggled; public static boolean midasStaffMessages; + public static boolean lividSolverToggled; // Puzzle Solvers public static boolean threeManToggled; public static boolean oruoToggled; @@ -46,7 +47,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public String getCommandUsage(ICommandSender arg0) { return "/" + getCommandName() + " "; + "outlinetext/midasstaffmessages/lividsolver/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/list>"; } @Override @@ -61,7 +62,8 @@ public class ToggleCommand extends CommandBase implements ICommand { "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", - "threemanpuzzle", "oruopuzzle", "blazepuzzle", "creeperpuzzle", "list"); + "lividsolver", "threemanpuzzle", "oruopuzzle", "blazepuzzle", "creeperpuzzle", + "list"); } return null; } @@ -148,6 +150,10 @@ public class ToggleCommand extends CommandBase implements ICommand { midasStaffMessages = !midasStaffMessages; cf.writeBooleanConfig("toggles", "MidasStaffMessages", midasStaffMessages); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Midas Staff messages have been set to " + EnumChatFormatting.DARK_GREEN + midasStaffMessages + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("lividsolver")) { + lividSolverToggled = !lividSolverToggled; + cf.writeBooleanConfig("toggles", "LividSolver", lividSolverToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Livid solver has been set to " + EnumChatFormatting.DARK_GREEN + lividSolverToggled + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("threemanpuzzle")) { threeManToggled = !threeManToggled; cf.writeBooleanConfig("toggles", "ThreeManPuzzle", threeManToggled); @@ -183,6 +189,7 @@ public class ToggleCommand extends CommandBase implements ICommand { EnumChatFormatting.GREEN + " Skill 50 display: " + EnumChatFormatting.DARK_GREEN + skill50DisplayToggled + "\n" + EnumChatFormatting.GREEN + " Outline displayed text: " + EnumChatFormatting.DARK_GREEN + outlineTextToggled + "\n" + EnumChatFormatting.GREEN + " Midas Staff messages: " + EnumChatFormatting.DARK_GREEN + midasStaffMessages + "\n" + + EnumChatFormatting.GREEN + " Livid solver: " + EnumChatFormatting.DARK_GREEN + lividSolverToggled + "\n" + EnumChatFormatting.GREEN + " Three man puzzle solver: " + EnumChatFormatting.DARK_GREEN + threeManToggled + "\n" + EnumChatFormatting.GREEN + " Oruo trivia solver: " + EnumChatFormatting.DARK_GREEN + oruoToggled + "\n" + EnumChatFormatting.GREEN + " Blaze puzzle solver: " + EnumChatFormatting.DARK_GREEN + blazeToggled + "\n" + diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 7316395..15e0fa5 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -46,6 +46,7 @@ public class DankerGui extends GuiScreen { private GuiButton skill50Display; private GuiButton outlineText; private GuiButton midasStaffMessages; + private GuiButton lividSolver; public DankerGui(int page) { this.page = page; @@ -94,6 +95,7 @@ public class DankerGui extends GuiScreen { golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); skill50Display = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled)); + lividSolver = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled)); if (page == 1) { this.buttonList.add(changeDisplay); @@ -121,6 +123,7 @@ public class DankerGui extends GuiScreen { this.buttonList.add(golemAlerts); this.buttonList.add(expertiseLore); this.buttonList.add(skill50Display); + this.buttonList.add(lividSolver); this.buttonList.add(backPage); } this.buttonList.add(githubLink); @@ -228,6 +231,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.midasStaffMessages = !ToggleCommand.midasStaffMessages; ConfigHandler.writeBooleanConfig("toggles", "MidasStaffMessages", ToggleCommand.midasStaffMessages); midasStaffMessages.displayString = "Midas Staff Messages: " + Utils.getColouredBoolean(ToggleCommand.midasStaffMessages); + } else if (button == lividSolver) { + ToggleCommand.lividSolverToggled = !ToggleCommand.lividSolverToggled; + ConfigHandler.writeBooleanConfig("toggles", "LividSolver", ToggleCommand.lividSolverToggled); + lividSolver.displayString = "Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled); } } diff --git a/src/main/java/me/Danker/gui/EditLocationsGui.java b/src/main/java/me/Danker/gui/EditLocationsGui.java index 8fbc4cb..f8b6712 100644 --- a/src/main/java/me/Danker/gui/EditLocationsGui.java +++ b/src/main/java/me/Danker/gui/EditLocationsGui.java @@ -19,6 +19,7 @@ public class EditLocationsGui extends GuiScreen { private LocationButton dungeonTimer; private LocationButton coords; private LocationButton skill50; + private LocationButton lividHP; @Override public boolean doesGuiPauseGame() { @@ -72,9 +73,11 @@ public class EditLocationsGui extends GuiScreen { dungeonTimer = new LocationButton(0, moc.dungeonTimerXY[0], moc.dungeonTimerXY[1], 113 * sc.dungeonTimerScale, 57 * sc.dungeonTimerScale, sc.dungeonTimerScale, dungeonTimerText, dungeonTimerNums, 80); coords = new LocationButton(0, moc.coordsXY[0], moc.coordsXY[1], 141 * sc.coordsScale, 12 * sc.coordsScale, sc.coordsScale, "74 / 14 / -26 (141.1 / 6.7)", null, null); skill50 = new LocationButton(0, moc.skill50XY[0], moc.skill50XY[1], 233 * sc.skill50Scale, 12 * sc.skill50Scale, sc.skill50Scale, EnumChatFormatting.AQUA + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", null, null); + lividHP = new LocationButton(0, moc.lividHpXY[0], moc.lividHpXY[1], 85 * sc.lividHpScale, 12 * sc.lividHpScale, sc.lividHpScale, EnumChatFormatting.WHITE + "﴾ Livid " + EnumChatFormatting.YELLOW + "6.9M" + EnumChatFormatting.RED + "❤ " + EnumChatFormatting.WHITE + "﴿", null, null); this.buttonList.add(coords); this.buttonList.add(dungeonTimer); + this.buttonList.add(lividHP); this.buttonList.add(display); this.buttonList.add(skill50); } @@ -111,6 +114,11 @@ public class EditLocationsGui extends GuiScreen { MoveCommand.skill50XY[1] += yMoved; skill50.xPosition = MoveCommand.skill50XY[0]; skill50.yPosition = MoveCommand.skill50XY[1]; + } else if (moving.equals("lividHP")) { + MoveCommand.lividHpXY[0] += xMoved; + MoveCommand.lividHpXY[1] += yMoved; + lividHP.xPosition = MoveCommand.lividHpXY[0]; + lividHP.yPosition = MoveCommand.lividHpXY[1]; } this.buttonList.clear(); initGui(); @@ -131,6 +139,8 @@ public class EditLocationsGui extends GuiScreen { moving = "coords"; } else if (button == skill50) { moving = "skill50"; + } else if (button == lividHP) { + moving = "lividHP"; } } } @@ -147,6 +157,8 @@ public class EditLocationsGui extends GuiScreen { ConfigHandler.writeIntConfig("locations", "dungeonTimerY", MoveCommand.dungeonTimerXY[1]); ConfigHandler.writeIntConfig("locations", "skill50X", MoveCommand.skill50XY[0]); ConfigHandler.writeIntConfig("locations", "skill50Y", MoveCommand.skill50XY[1]); + ConfigHandler.writeIntConfig("locations", "lividHpX", MoveCommand.lividHpXY[0]); + ConfigHandler.writeIntConfig("locations", "lividHpY", MoveCommand.lividHpXY[1]); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 579c3e0..86d2ccd 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -190,6 +190,7 @@ public class ConfigHandler { if (!hasKey("toggles", "Skill50Display")) writeBooleanConfig("toggles", "Skill50Display", false); if (!hasKey("toggles", "OutlineText")) writeBooleanConfig("toggles", "OutlineText", false); if (!hasKey("toggles", "MidasStaffMessages")) writeBooleanConfig("toggles", "MidasStaffMessages", true); + if (!hasKey("toggles", "LividSolver")) writeBooleanConfig("toggles", "LividSolver", false); // Puzzle Solvers if (!hasKey("toggles", "ThreeManPuzzle")) writeBooleanConfig("toggles", "ThreeManPuzzle", false); if (!hasKey("toggles", "OruoPuzzle")) writeBooleanConfig("toggles", "OruoPuzzle", false); @@ -338,10 +339,13 @@ public class ConfigHandler { 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("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); final ToggleCommand tf = new ToggleCommand(); tf.gpartyToggled = getBoolean("toggles", "GParty"); @@ -362,6 +366,7 @@ public class ConfigHandler { tf.skill50DisplayToggled = getBoolean("toggles", "Skill50Display"); tf.outlineTextToggled = getBoolean("toggles", "OutlineText"); tf.midasStaffMessages = getBoolean("toggles", "MidasStaffMessages"); + tf.lividSolverToggled = getBoolean("toggles", "LividSolver"); // Puzzle Solvers tf.threeManToggled = getBoolean("toggles", "ThreeManPuzzle"); tf.oruoToggled = getBoolean("toggles", "OruoPuzzle"); @@ -516,12 +521,15 @@ public class ConfigHandler { moc.dungeonTimerXY[1] = getInt("locations", "dungeonTimerY"); moc.skill50XY[0] = getInt("locations", "skill50X"); moc.skill50XY[1] = getInt("locations", "skill50Y"); + moc.lividHpXY[0] = getInt("locations", "lividHpX"); + moc.lividHpXY[1] = getInt("locations", "lividHpY"); final ScaleCommand sc = new ScaleCommand(); sc.coordsScale = getDouble("scales", "coordsScale"); sc.displayScale = getDouble("scales", "displayScale"); sc.dungeonTimerScale = getDouble("scales", "dungeonTimerScale"); sc.skill50Scale = getDouble("scales", "skill50Scale"); + sc.lividHpScale = getDouble("scales", "lividHpScale"); } } -- cgit