From c92a8a13bd83a6d47f399b6845b6ac7885e6ab54 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Mon, 7 Dec 2020 15:21:25 -0500 Subject: Change water puzzle solver to display from chat message --- README.md | 4 ++-- src/main/java/me/Danker/DankersSkyblockMod.java | 25 +++++++++++++--------- src/main/java/me/Danker/commands/DHelpCommand.java | 4 ++-- src/main/java/me/Danker/commands/MoveCommand.java | 12 +++++++++-- src/main/java/me/Danker/commands/ScaleCommand.java | 11 ++++++++-- src/main/java/me/Danker/gui/EditLocationsGui.java | 24 +++++++++++++++++++-- .../java/me/Danker/handlers/ConfigHandler.java | 8 ++++++- 7 files changed, 67 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 6f5a596..f047470 100644 --- a/README.md +++ b/README.md @@ -51,8 +51,8 @@ Discord Server: https://discord.gg/QsEkNQS - /loot [winter/spooky/f(1-7)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. - /display [winter/spooky/f(1-7)/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. - /resetloot - - Resets loot for trackers. /resetloot confirm confirms the reset. -- /move - Moves text display to specified X and Y coordinates. -- /scale - Scales text display to a specified multipler between 0.1x and 10x. +- /move - Moves text display to specified X and Y coordinates. +- /scale - Scales text display to a specified multipler between 0.1x and 10x. - /slayer [player] - Uses API to get slayer xp of a person. If no name is provided, it checks yours. - /skills [player] - Uses API to get skill levels of a person. If no name is provided, it checks yours. - /lobbyskills - Uses API to find the average skills of the lobby, as well the three players with the highest skill average. diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 2157544..59704ea 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -113,6 +113,7 @@ public class DankersSkyblockMod static List creeperLines = new ArrayList<>(); static boolean prevInWaterRoom = false; static boolean inWaterRoom = false; + static String waterAnswers = null; static AxisAlignedBB correctTicTacToeButton = null; static Slot[] clickInOrderSlots = new Slot[36]; static int lastChronomatronRound = 0; @@ -1280,7 +1281,11 @@ public class DankersSkyblockMod new TextRenderer(mc, skillTrackerText, MoveCommand.skillTrackerXY[0], MoveCommand.skillTrackerXY[1], ScaleCommand.skillTrackerScale); } - + + if (ToggleCommand.waterToggled && Utils.inDungeons && waterAnswers != null) { + new TextRenderer(mc, waterAnswers, MoveCommand.waterAnswerXY[0], MoveCommand.waterAnswerXY[1], ScaleCommand.waterAnswerScale); + } + if (!DisplayCommand.display.equals("off")) { String dropsText = ""; String countText = ""; @@ -2475,14 +2480,12 @@ public class DankersSkyblockMod purple = orange = blue = green = red = ERROR_COLOUR + "Error detecting water puzzle variant."; break; } - player.addChatMessage(new ChatComponentText(DELIMITER_COLOUR + EnumChatFormatting.BOLD + "-------------------\n" + - MAIN_COLOUR + " The following levers must be down:\n " + - EnumChatFormatting.DARK_PURPLE + "Purple: " + purple + "\n " + - EnumChatFormatting.GOLD + "Orange: " + orange + "\n " + - EnumChatFormatting.BLUE + "Blue: " + blue + "\n " + - EnumChatFormatting.GREEN + "Green: " + green + "\n " + - EnumChatFormatting.RED + "Red: " + red + "\n" + - DELIMITER_COLOUR + EnumChatFormatting.BOLD + " -------------------")); + waterAnswers = MAIN_COLOUR + "The following levers must be down:\n" + + EnumChatFormatting.DARK_PURPLE + "Purple: " + purple + "\n" + + EnumChatFormatting.GOLD + "Orange: " + orange + "\n" + + EnumChatFormatting.BLUE + "Blue: " + blue + "\n" + + EnumChatFormatting.GREEN + "Green: " + green + "\n" + + EnumChatFormatting.RED + "Red: " + red; done = true; break; } @@ -2490,7 +2493,9 @@ public class DankersSkyblockMod } if (done) break; } - } + } else { + waterAnswers = null; + } }).start(); } diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 1628c0c..ee5958c 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -40,8 +40,8 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /loot [winter/festival/spooky/f(1-7)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + EnumChatFormatting.GOLD + " /display [winter/festival/spooky/f(1-7)/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 de5d98f..e9bfe61 100644 --- a/src/main/java/me/Danker/commands/MoveCommand.java +++ b/src/main/java/me/Danker/commands/MoveCommand.java @@ -20,6 +20,7 @@ public class MoveCommand extends CommandBase { public static int[] lividHpXY = {0, 0}; public static int[] cakeTimerXY = {0, 0}; public static int[] skillTrackerXY = {0, 0}; + public static int[] waterAnswerXY = {0, 0}; @Override public String getCommandName() { @@ -28,7 +29,7 @@ public class MoveCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " "; + return "/" + getCommandName() + " "; } @Override @@ -39,7 +40,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", "lividhp", "caketimer", "skilltracker"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker", "wateranswer"); } return null; } @@ -103,6 +104,13 @@ public class MoveCommand extends CommandBase { ConfigHandler.writeIntConfig("locations", "skillTrackerY", skillTrackerXY[1]); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); break; + case "wateranswer": + waterAnswerXY[0] = Integer.parseInt(arg1[1]); + waterAnswerXY[1] = Integer.parseInt(arg1[2]); + ConfigHandler.writeIntConfig("locations", "waterAnswerX", waterAnswerXY[0]); + ConfigHandler.writeIntConfig("locations", "waterAnswerY", waterAnswerXY[1]); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Water solver answer has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); + break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/ScaleCommand.java b/src/main/java/me/Danker/commands/ScaleCommand.java index c194fcb..85d0d5c 100644 --- a/src/main/java/me/Danker/commands/ScaleCommand.java +++ b/src/main/java/me/Danker/commands/ScaleCommand.java @@ -8,6 +8,7 @@ import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; +import sun.security.krb5.Config; import java.util.List; @@ -20,6 +21,7 @@ public class ScaleCommand extends CommandBase { public static double lividHpScale; public static double cakeTimerScale; public static double skillTrackerScale; + public static double waterAnswerScale; @Override public String getCommandName() { @@ -28,7 +30,7 @@ public class ScaleCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " "; + return "/" + getCommandName() + " "; } @Override @@ -39,7 +41,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", "lividhp", "caketimer", "skilltracker"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker", "wateranswer"); } return null; } @@ -95,6 +97,11 @@ public class ScaleCommand extends CommandBase { ConfigHandler.writeDoubleConfig("scales", "skillTrackerScale", skillTrackerScale); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + skillTrackerScale + "x")); break; + case "wateranswer": + waterAnswerScale = scaleAmount; + ConfigHandler.writeDoubleConfig("scales", "waterAnswerScale", waterAnswerScale); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Water solver answer has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + waterAnswerScale + "x")); + break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/gui/EditLocationsGui.java b/src/main/java/me/Danker/gui/EditLocationsGui.java index 63a47c0..8519f1a 100644 --- a/src/main/java/me/Danker/gui/EditLocationsGui.java +++ b/src/main/java/me/Danker/gui/EditLocationsGui.java @@ -25,6 +25,7 @@ public class EditLocationsGui extends GuiScreen { private LocationButton lividHP; private LocationButton cakeTimer; private LocationButton skillTracker; + private LocationButton waterAnswer; @Override public boolean doesGuiPauseGame() { @@ -74,7 +75,14 @@ public class EditLocationsGui extends GuiScreen { String skillTrackerText = DankersSkyblockMod.SKILL_TRACKER_COLOUR + "Farming XP Earned: 462,425.3\n" + DankersSkyblockMod.SKILL_TRACKER_COLOUR + "Time Elapsed: " + Utils.getTimeBetween(0, 3602) + "\n" + DankersSkyblockMod.SKILL_TRACKER_COLOUR + "XP Per Hour: 462,168"; - + + String waterAnswerText = DankersSkyblockMod.MAIN_COLOUR + "The following levers must be down:\n" + + EnumChatFormatting.DARK_PURPLE + "Purple: " + EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.GREEN + "Emerald, " + EnumChatFormatting.RED + "Clay\n" + + EnumChatFormatting.GOLD + "Orange: " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.DARK_GRAY + "Coal\n" + + EnumChatFormatting.BLUE + "Blue: " + EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.DARK_GRAY + "Coal, " + EnumChatFormatting.GREEN + "Emerald, " + EnumChatFormatting.RED + "Clay\n" + + EnumChatFormatting.GREEN + "Green: " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.GREEN + "Emerald\n" + + EnumChatFormatting.RED + "Red: " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.AQUA + "Diamond, " + EnumChatFormatting.GREEN + "Emerald, " + EnumChatFormatting.RED + "Clay"; + display = new LocationButton(0, MoveCommand.displayXY[0], MoveCommand.displayXY[1], 145 * ScaleCommand.displayScale, 102 * ScaleCommand.displayScale, ScaleCommand.displayScale, displayText, displayNums, 110); dungeonTimer = new LocationButton(0, MoveCommand.dungeonTimerXY[0], MoveCommand.dungeonTimerXY[1], 113 * ScaleCommand.dungeonTimerScale, 57 * ScaleCommand.dungeonTimerScale, ScaleCommand.dungeonTimerScale, dungeonTimerText, dungeonTimerNums, 80); coords = new LocationButton(0, MoveCommand.coordsXY[0], MoveCommand.coordsXY[1], 141 * ScaleCommand.coordsScale, 12 * ScaleCommand.coordsScale, ScaleCommand.coordsScale, DankersSkyblockMod.COORDS_COLOUR + "74 / 14 / -26 (141.1 / 6.7)", null, null); @@ -82,12 +90,14 @@ public class EditLocationsGui extends GuiScreen { lividHP = new LocationButton(0, MoveCommand.lividHpXY[0], MoveCommand.lividHpXY[1], 85 * ScaleCommand.lividHpScale, 12 * ScaleCommand.lividHpScale, ScaleCommand.lividHpScale, EnumChatFormatting.WHITE + "﴾ Livid " + EnumChatFormatting.YELLOW + "6.9M" + EnumChatFormatting.RED + "❤ " + EnumChatFormatting.WHITE + "﴿", null, null); cakeTimer = new LocationButton(0, MoveCommand.cakeTimerXY[0], MoveCommand.cakeTimerXY[1] + 5, 85 * ScaleCommand.cakeTimerScale, 18 * ScaleCommand.cakeTimerScale, ScaleCommand.cakeTimerScale, DankersSkyblockMod.CAKE_COLOUR + " 11h16m", null, null); skillTracker = new LocationButton(0, MoveCommand.skillTrackerXY[0], MoveCommand.skillTrackerXY[1], 150 * ScaleCommand.skillTrackerScale, 28 * ScaleCommand.skillTrackerScale, ScaleCommand.skillTrackerScale, skillTrackerText, null, null); - + waterAnswer = new LocationButton(0, MoveCommand.waterAnswerXY[0], MoveCommand.waterAnswerXY[1], 190 * ScaleCommand.waterAnswerScale, 54 * ScaleCommand.waterAnswerScale, ScaleCommand.waterAnswerScale, waterAnswerText, null, null); + this.buttonList.add(coords); this.buttonList.add(dungeonTimer); this.buttonList.add(lividHP); this.buttonList.add(cakeTimer); this.buttonList.add(skillTracker); + this.buttonList.add(waterAnswer); this.buttonList.add(display); this.buttonList.add(skill50); } @@ -155,6 +165,12 @@ public class EditLocationsGui extends GuiScreen { skillTracker.xPosition = MoveCommand.skillTrackerXY[0]; skillTracker.yPosition = MoveCommand.skillTrackerXY[1]; break; + case "waterAnswer": + MoveCommand.waterAnswerXY[0] += xMoved; + MoveCommand.waterAnswerXY[1] += yMoved; + waterAnswer.xPosition = MoveCommand.waterAnswerXY[0]; + waterAnswer.yPosition = MoveCommand.waterAnswerXY[1]; + break; } this.buttonList.clear(); initGui(); @@ -181,6 +197,8 @@ public class EditLocationsGui extends GuiScreen { moving = "cakeTimer"; } else if (button == skillTracker) { moving = "skillTracker"; + } else if (button == waterAnswer) { + moving = "waterAnswer"; } } } @@ -203,6 +221,8 @@ public class EditLocationsGui extends GuiScreen { ConfigHandler.writeIntConfig("locations", "cakeTimerY", MoveCommand.cakeTimerXY[1]); ConfigHandler.writeIntConfig("locations", "skillTrackerX", MoveCommand.skillTrackerXY[0]); ConfigHandler.writeIntConfig("locations", "skillTrackerY", MoveCommand.skillTrackerXY[1]); + ConfigHandler.writeIntConfig("locations", "waterAnswerX", MoveCommand.waterAnswerXY[1]); + ConfigHandler.writeIntConfig("locations", "waterAnswerY", MoveCommand.waterAnswerXY[1]); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index cbfb52b..23bd6c4 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -391,6 +391,8 @@ public class ConfigHandler { if (!hasKey("locations", "cakeTimerY")) writeIntConfig("locations", "cakeTimerY", 30); if (!hasKey("locations", "skillTrackerX")) writeIntConfig("locations", "skillTrackerX", 40); if (!hasKey("locations", "skillTrackerY")) writeIntConfig("locations", "skillTrackerY", 50); + if (!hasKey("locations", "waterAnswerX")) writeIntConfig("locations", "waterAnswerX", 100); + if (!hasKey("locations", "waterAnswerY")) writeIntConfig("locations", "waterAnswerY", 100); if (!hasKey("scales", "coordsScale")) writeDoubleConfig("scales", "coordsScale", 1); if (!hasKey("scales", "displayScale")) writeDoubleConfig("scales", "displayScale", 1); if (!hasKey("scales", "dungeonTimerScale")) writeDoubleConfig("scales", "dungeonTimerScale", 1); @@ -398,6 +400,7 @@ public class ConfigHandler { if (!hasKey("scales", "lividHpScale")) writeDoubleConfig("scales", "lividHpScale", 1); if (!hasKey("scales", "cakeTimerScale")) writeDoubleConfig("scales", "cakeTimerScale", 1); if (!hasKey("scales", "skillTrackerScale")) writeDoubleConfig("scales", "skillTrackerScale", 1); + if (!hasKey("scales", "waterAnswerScale")) writeDoubleConfig("scales", "waterAnswerScale", 1); if (!hasKey("colors", "main")) writeStringConfig("colors", "main", EnumChatFormatting.GREEN.toString()); if (!hasKey("colors", "secondary")) writeStringConfig("colors", "secondary", EnumChatFormatting.DARK_GREEN.toString()); @@ -640,6 +643,8 @@ public class ConfigHandler { MoveCommand.cakeTimerXY[1] = getInt("locations", "cakeTimerY"); MoveCommand.skillTrackerXY[0] = getInt("locations", "skillTrackerX"); MoveCommand.skillTrackerXY[1] = getInt("locations", "skillTrackerY"); + MoveCommand.waterAnswerXY[0] = getInt("locations", "waterAnswerX"); + MoveCommand.waterAnswerXY[1] = getInt("locations", "waterAnswerY"); ScaleCommand.coordsScale = getDouble("scales", "coordsScale"); ScaleCommand.displayScale = getDouble("scales", "displayScale"); @@ -648,7 +653,8 @@ public class ConfigHandler { ScaleCommand.lividHpScale = getDouble("scales", "lividHpScale"); ScaleCommand.cakeTimerScale = getDouble("scales", "cakeTimerScale"); ScaleCommand.skillTrackerScale = getDouble("scales", "skillTrackerScale"); - + ScaleCommand.waterAnswerScale = getDouble("scales", "waterAnswerScale"); + DankersSkyblockMod.MAIN_COLOUR = getString("colors", "main"); DankersSkyblockMod.SECONDARY_COLOUR = getString("colors", "secondary"); DankersSkyblockMod.DELIMITER_COLOUR = getString("colors", "delimiter"); -- cgit