diff options
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | src/main/java/me/Danker/DankersSkyblockMod.java | 1 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/DankerGuiCommand.java | 6 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/MoveCommand.java | 13 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/ScaleCommand.java | 11 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/ToggleCommand.java | 11 | ||||
-rw-r--r-- | src/main/java/me/Danker/features/AbilityCooldowns.java | 81 | ||||
-rw-r--r-- | src/main/java/me/Danker/features/puzzlesolvers/TeleportPadSolver.java | 45 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/DankerGui.java | 13 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/EditLocationsGui.java | 16 | ||||
-rw-r--r-- | src/main/java/me/Danker/handlers/ConfigHandler.java | 8 | ||||
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 42 |
12 files changed, 239 insertions, 13 deletions
@@ -59,6 +59,7 @@ Discord Server: https://discord.gg/QsEkNQS - Hide pet candy in pet tooltip - Custom name colors - Crystal Hollows waypoints (with SkyblockExtras support) +- Ability cooldowns display ## Commands - /dhelp - Returns this message in-game. @@ -69,8 +70,8 @@ Discord Server: https://discord.gg/QsEkNQS - /loot <zombie/spider/wolf/enderman/fishing/catacombs/mythological/> [winter/festival/spooky/f(1-7)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. - /display <zombie/spider/wolf/enderman/fishing/catacombs/mythological/ghosts/auto/off> [winter/festival/spooky/f(1-7)/session] - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active. - /resetloot <zombie/spider/wolf/enderman/fishing/catacombs/mythological/confirm/cancel> - - Resets loot for trackers. /resetloot confirm confirms the reset. -- /move <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer/teammatesinradius/gianthp> <x> <y> - Moves text display to specified X and Y coordinates. -- /scale <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer/teammatesinradius/gianthp> <scale (0.1 - 10)> - Scales text display to a specified multipler between 0.1x and 10x. +- /move <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer/teammatesinradius/gianthp/abilitycooldowns> <x> <y> - Moves text display to specified X and Y coordinates. +- /scale <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer/teammatesinradius/gianthp/abilitycooldowns> <scale (0.1 - 10)> - 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. - /skill [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 d1b797f..b0e0de0 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -127,6 +127,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new HideTooltipsInExperiments()); MinecraftForge.EVENT_BUS.register(new HighlightSkeletonMasters()); MinecraftForge.EVENT_BUS.register(new IceWalkSolver()); + MinecraftForge.EVENT_BUS.register(new AbilityCooldowns()); MinecraftForge.EVENT_BUS.register(new LividSolver()); MinecraftForge.EVENT_BUS.register(new LowHealthNotifications()); MinecraftForge.EVENT_BUS.register(new NecronNotifications()); diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index d6b92eb..0f3b527 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -110,6 +110,7 @@ public class DankerGuiCommand extends CommandBase { debug.append("[crystalhollowwaypoints][").append(ToggleCommand.crystalHollowWaypoints).append("]\n"); debug.append("[crystalautowaypoints][").append(ToggleCommand.crystalAutoWaypoints).append("]\n"); debug.append("[autoacceptreparty][").append(ToggleCommand.autoAcceptReparty).append("]\n"); + debug.append("[abilitycooldowns][").append(ToggleCommand.abilityCooldowns).append("]\n"); debug.append("[dungeonbossmusic][").append(ToggleCommand.dungeonBossMusic).append("]\n"); debug.append("[bloodroommusic][").append(ToggleCommand.bloodRoomMusic).append("]\n"); debug.append("[dungeonmusic][").append(ToggleCommand.dungeonMusic).append("]\n"); @@ -122,6 +123,11 @@ public class DankerGuiCommand extends CommandBase { debug.append("[caketimer][").append(MoveCommand.cakeTimerXY[0]).append(", ").append(MoveCommand.cakeTimerXY[1]).append("]\n"); debug.append("[skilltracker][").append(MoveCommand.skillTrackerXY[0]).append(", ").append(MoveCommand.skillTrackerXY[1]).append("]\n"); debug.append("[wateranswer][").append(MoveCommand.waterAnswerXY[0]).append(", ").append(MoveCommand.waterAnswerXY[1]).append("]\n"); + debug.append("[bonzotimer][").append(MoveCommand.bonzoTimerXY[0]).append(", ").append(MoveCommand.bonzoTimerXY[1]).append("]\n"); + debug.append("[golemtimer][").append(MoveCommand.golemTimerXY[0]).append(", ").append(MoveCommand.golemTimerXY[1]).append("]\n"); + debug.append("[teammatesinradius][").append(MoveCommand.teammatesInRadiusXY[0]).append(", ").append(MoveCommand.teammatesInRadiusXY[1]).append("]\n"); + debug.append("[gianthp][").append(MoveCommand.giantHPXY[0]).append(", ").append(MoveCommand.giantHPXY[1]).append("]\n"); + debug.append("[abilitycooldowns][").append(MoveCommand.abilityCooldownsXY[0]).append(", ").append(MoveCommand.abilityCooldownsXY[1]).append("]\n"); debug.append("# Other Settings\n"); debug.append("[Current Display][").append(LootDisplay.display).append("]\n"); debug.append("[Auto Display][").append(LootDisplay.auto).append("]\n"); diff --git a/src/main/java/me/Danker/commands/MoveCommand.java b/src/main/java/me/Danker/commands/MoveCommand.java index b17794c..a43d09b 100644 --- a/src/main/java/me/Danker/commands/MoveCommand.java +++ b/src/main/java/me/Danker/commands/MoveCommand.java @@ -25,6 +25,7 @@ public class MoveCommand extends CommandBase { public static int[] golemTimerXY = {0 ,0}; public static int[] teammatesInRadiusXY = {0, 0}; public static int[] giantHPXY = {0, 0}; + public static int[] abilityCooldownsXY = {0, 0}; @Override public String getCommandName() { @@ -33,7 +34,8 @@ public class MoveCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer/teammatesinradius/gianthp> <x> <y>"; + return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/" + + "wateranswer/bonzotimer/golemtimer/teammatesinradius/gianthp/abilitycooldowns> <x> <y>"; } public static String usage(ICommandSender arg0) { @@ -50,7 +52,7 @@ public class MoveCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker", "wateranswer", "bonzotimer", "golemtimer", "teammatesinradius", - "gianthp"); + "gianthp", "abilitycooldowns"); } return null; } @@ -149,6 +151,13 @@ public class MoveCommand extends CommandBase { ConfigHandler.writeIntConfig("locations", "giantHPY", giantHPXY[1]); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Giant HP has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); break; + case "abilitycooldowns": + abilityCooldownsXY[0] = Integer.parseInt(arg1[1]); + abilityCooldownsXY[1] = Integer.parseInt(arg1[2]); + ConfigHandler.writeIntConfig("locations", "abilityCooldownsX", abilityCooldownsXY[0]); + ConfigHandler.writeIntConfig("locations", "abilityCooldownsY", abilityCooldownsXY[1]); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Ability cooldowns 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 def0e57..b38d57e 100644 --- a/src/main/java/me/Danker/commands/ScaleCommand.java +++ b/src/main/java/me/Danker/commands/ScaleCommand.java @@ -25,6 +25,7 @@ public class ScaleCommand extends CommandBase { public static double golemTimerScale; public static double teammatesInRadiusScale; public static double giantHPScale; + public static double abilityCooldownsScale; @Override public String getCommandName() { @@ -33,7 +34,8 @@ public class ScaleCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer/teammatesinradius/gianthp> <size (0.1 - 10)>"; + return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/" + + "bonzotimer/golemtimer/teammatesinradius/gianthp/abilitycooldown> <size (0.1 - 10)>"; } public static String usage(ICommandSender arg0) { @@ -50,7 +52,7 @@ public class ScaleCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker", "wateranswer", "bonzotimer", "golemtimer", "teammatesinradius", - "gianthp"); + "gianthp", "abilitycooldowns"); } return null; } @@ -131,6 +133,11 @@ public class ScaleCommand extends CommandBase { ConfigHandler.writeDoubleConfig("scales", "giantHPScale", giantHPScale); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Giant hp has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + giantHPScale + "x")); break; + case "abilitycooldowns": + abilityCooldownsScale = scaleAmount; + ConfigHandler.writeDoubleConfig("scales", "abilityCooldownsScale", abilityCooldownsScale); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Ability cooldowns has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + abilityCooldownsScale + "x")); + break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 7d1020a..0255915 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -45,6 +45,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean crystalHollowWaypoints; public static boolean crystalAutoWaypoints; public static boolean autoAcceptReparty; + public static boolean abilityCooldowns; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; @@ -118,7 +119,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/" + "melodytooltips/highlightslayers/highlightarachne/highlightskeletonmasters/teammatesinradius/" + "gianthp/hidepetcandy/customcolorednames/endoffarmalert/gemstonelore/crystalhollowwaypoints/crystalautowaypoints/" + - "autoacceptreparty/dungeonbossmusic/bloodroommusic/dungeonmusic/hubmusic/islandmusic/dungeonhubmusic/" + + "autoacceptreparty/abilitycooldowns/dungeonbossmusic/bloodroommusic/dungeonmusic/hubmusic/islandmusic/dungeonhubmusic/" + "farmingislandsmusic/goldminemusic/deepcavernsmusic/crystalhollowsmusic/spidersdenmusic/blazingfortressmusic/endmusic/" + "parkmusic/list>"; } @@ -151,7 +152,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "highlightskeletonmasters", "dungeonbossmusic", "bloodroommusic", "dungeonmusic", "teammatesinradius", "gianthp", "hidepetcandy", "customcolorednames", "endoffarmalert", "gemstonelore", "crystalhollowwaypoints", "crystalautowaypoints", "autoacceptreparty", - "hubmusic", "islandmusic", "dungeonhubmusic", "farmingislandsmusic", "goldminemusic", + "itemcooldowns", "hubmusic", "islandmusic", "dungeonhubmusic", "farmingislandsmusic", "goldminemusic", "deepcavernsmusic", "dwarvenminesmusic", "crystalhollowsmusic", "spidersdenmusic", "blazingfortressmusic", "endmusic", "parkmusic", "list"); } @@ -485,6 +486,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "AutoAcceptReparty", autoAcceptReparty); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Auto accept reparty has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + autoAcceptReparty + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "abilitycooldowns": + abilityCooldowns = !abilityCooldowns; + ConfigHandler.writeBooleanConfig("toggles", "AbilityCooldowns", abilityCooldowns); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Ability cooldowns display as been set to " + DankersSkyblockMod.SECONDARY_COLOUR + abilityCooldowns + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "dungeonbossmusic": dungeonBossMusic = !dungeonBossMusic; CustomMusic.dungeonboss.stop(); @@ -631,6 +637,7 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Crystal Hollows waypoints: " + DankersSkyblockMod.VALUE_COLOUR + crystalHollowWaypoints + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Auto Crystal Hollows waypoints: " + DankersSkyblockMod.VALUE_COLOUR + crystalAutoWaypoints + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Auto accept reparty: " + DankersSkyblockMod.VALUE_COLOUR + autoAcceptReparty + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Ability cooldown display: " + DankersSkyblockMod.VALUE_COLOUR + abilityCooldowns + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Custom dungeon boss music: " + DankersSkyblockMod.VALUE_COLOUR + dungeonBossMusic + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Custom blood room music: " + DankersSkyblockMod.VALUE_COLOUR + bloodRoomMusic + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Custom dungeon music: " + DankersSkyblockMod.VALUE_COLOUR + dungeonMusic + "\n" + diff --git a/src/main/java/me/Danker/features/AbilityCooldowns.java b/src/main/java/me/Danker/features/AbilityCooldowns.java new file mode 100644 index 0000000..ed6767e --- /dev/null +++ b/src/main/java/me/Danker/features/AbilityCooldowns.java @@ -0,0 +1,81 @@ +package me.Danker.features; + +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.events.RenderOverlayEvent; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.ArrayList; +import java.util.List; + +public class AbilityCooldowns { + + List<Ability> cooldowns = new ArrayList<>(); + + @SubscribeEvent(priority = EventPriority.LOW) + public void onChat(ClientChatReceivedEvent event) { + if (!Utils.inSkyblock || event.type != 2) return; + + String[] actionBarSections = StringUtils.stripControlCodes(event.message.getUnformattedText()).split(" {3,}"); + + for (String section : actionBarSections) { + if (section.charAt(0) == '-' && section.contains("(") && section.charAt(section.length() - 1) == ')') { + String ability = section.substring(section.indexOf("(") + 1, section.length() - 1); + + for (Ability cooldown : cooldowns) { + if (cooldown.ability.equals(ability)) return; + } + + cooldowns.add(new Ability(ability, Utils.getCooldownFromAbility(ability))); + } + } + } + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlayEvent event) { + if (Utils.inSkyblock) { + StringBuilder sb = new StringBuilder(); + + for (int i = cooldowns.size() - 1; i >= 0; i--) { + Ability ability = cooldowns.get(i); + + if (ability.getCooldown() <= 0) { + cooldowns.remove(i); + continue; + } + + sb.insert(0, ability.getTimer() + "\n"); + } + + new TextRenderer(Minecraft.getMinecraft(), sb.toString(), MoveCommand.abilityCooldownsXY[0], MoveCommand.abilityCooldownsXY[1], ScaleCommand.abilityCooldownsScale); + } + } + + public static class Ability { + + public final String ability; + private final long cooldown; + + public Ability(String ability, int cooldown) { + this.ability = ability; + this.cooldown = System.currentTimeMillis() + cooldown * 1000L; + } + + public String getTimer() { + return EnumChatFormatting.GREEN + ability + ": " + EnumChatFormatting.YELLOW + getCooldown() + "s"; + } + + public double getCooldown() { + return (cooldown - System.currentTimeMillis()) / 1000D; + } + + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/TeleportPadSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/TeleportPadSolver.java new file mode 100644 index 0000000..8e03671 --- /dev/null +++ b/src/main/java/me/Danker/features/puzzlesolvers/TeleportPadSolver.java @@ -0,0 +1,45 @@ +package me.Danker.features.puzzlesolvers; + +import me.Danker.DankersSkyblockMod; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.util.BlockPos; +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.List; + +public class TeleportPadSolver { + + static List<BlockPos> usedPads = new ArrayList<>(); + static BlockPos finalPad = null; + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + usedPads.clear(); + finalPad = null; + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; + World world = mc.theWorld; + + if (DankersSkyblockMod.tickAmount % 20 == 0) { + + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + + } + +} diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index f2d3bf3..7f407a6 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -23,9 +23,9 @@ import java.util.List; public class DankerGui extends GuiScreen { - private int page; - private List<GuiButton> allButtons = new ArrayList<>(); - private List<GuiButton> foundButtons = new ArrayList<>(); + private final int page; + private final List<GuiButton> allButtons = new ArrayList<>(); + private final List<GuiButton> foundButtons = new ArrayList<>(); String initSearchText; private GuiButton closeGUI; @@ -71,6 +71,7 @@ public class DankerGui extends GuiScreen { private GuiButton endOfFarmAlert; private GuiButton gemstoneLore; private GuiButton autoAcceptReparty; + private GuiButton abilityCooldown; // Chat Messages private GuiButton sceptreMessages; private GuiButton midasStaffMessages; @@ -163,6 +164,7 @@ public class DankerGui extends GuiScreen { endOfFarmAlert = new FeatureButton("Alert When Reaching End of Farm: " + Utils.getColouredBoolean(ToggleCommand.endOfFarmAlert), "Alerts when you go past coords set with /dsmfarmlength."); gemstoneLore = new FeatureButton("Applied Gemstones in Lore: " + Utils.getColouredBoolean(ToggleCommand.gemstoneLore), "Adds applied gemstones to item tooltip."); autoAcceptReparty = new FeatureButton("Auto Accept Reparty: " + Utils.getColouredBoolean(ToggleCommand.autoAcceptReparty), "Automatically rejoins parties when disbanded and invited."); + abilityCooldown = new FeatureButton("Ability Cooldowns: " + Utils.getColouredBoolean(ToggleCommand.abilityCooldowns), "Displays ability cooldowns."); allButtons.clear(); allButtons.add(changeDisplay); @@ -213,6 +215,7 @@ public class DankerGui extends GuiScreen { allButtons.add(endOfFarmAlert); allButtons.add(gemstoneLore); allButtons.add(autoAcceptReparty); + allButtons.add(abilityCooldown); search.setText(initSearchText); search.setVisible(true); @@ -473,6 +476,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.autoAcceptReparty = !ToggleCommand.autoAcceptReparty; ConfigHandler.writeBooleanConfig("toggles", "AutoAcceptReparty", ToggleCommand.autoAcceptReparty); autoAcceptReparty.displayString = "Auto Accept Reparty: " + Utils.getColouredBoolean(ToggleCommand.autoAcceptReparty); + } else if (button == abilityCooldown) { + ToggleCommand.abilityCooldowns = !ToggleCommand.abilityCooldowns; + ConfigHandler.writeBooleanConfig("toggles", "AbilityCooldowns", ToggleCommand.abilityCooldowns); + abilityCooldown.displayString = "Ability Cooldowns: " + Utils.getColouredBoolean(ToggleCommand.abilityCooldowns); } } diff --git a/src/main/java/me/Danker/gui/EditLocationsGui.java b/src/main/java/me/Danker/gui/EditLocationsGui.java index fed6ee9..e24de8b 100644 --- a/src/main/java/me/Danker/gui/EditLocationsGui.java +++ b/src/main/java/me/Danker/gui/EditLocationsGui.java @@ -31,6 +31,7 @@ public class EditLocationsGui extends GuiScreen { private LocationButton golemTimer; private LocationButton teammatesInRadius; private LocationButton giantHP; + private LocationButton abilityCooldown; @Override public boolean doesGuiPauseGame() { @@ -99,6 +100,9 @@ public class EditLocationsGui extends GuiScreen { EnumChatFormatting.LIGHT_PURPLE + "Jolly Pink Giant " + EnumChatFormatting.GREEN + "25M" + EnumChatFormatting.RED + "❤\n" + EnumChatFormatting.DARK_AQUA + "The Diamond Giant " + EnumChatFormatting.GREEN + "25M" + EnumChatFormatting.RED + "❤"; + String abilityCooldownText = EnumChatFormatting.GREEN + "Spirit Glide: " + EnumChatFormatting.YELLOW + "32.734s\n" + + EnumChatFormatting.GREEN + "Parley: " + EnumChatFormatting.YELLOW + "2.652s\n" + + EnumChatFormatting.GREEN + "Ice Spray: " + EnumChatFormatting.YELLOW + "1.429s"; display = new LocationButton(MoveCommand.displayXY[0], MoveCommand.displayXY[1], ScaleCommand.displayScale, displayText, displayNums, 110); dungeonTimer = new LocationButton(MoveCommand.dungeonTimerXY[0], MoveCommand.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale, dungeonTimerText, dungeonTimerNums, 80); @@ -112,6 +116,7 @@ public class EditLocationsGui extends GuiScreen { golemTimer = new LocationButton(MoveCommand.golemTimerXY[0], MoveCommand.golemTimerXY[1] + 5, ScaleCommand.golemTimerScale, GolemSpawningAlert.GOLEM_COLOUR + " 20s", null, null); teammatesInRadius = new LocationButton(MoveCommand.teammatesInRadiusXY[0], MoveCommand.teammatesInRadiusXY[1], ScaleCommand.teammatesInRadiusScale, teammatesInRadiusText, null, null); giantHP = new LocationButton(MoveCommand.giantHPXY[0], MoveCommand.giantHPXY[1], ScaleCommand.giantHPScale, giantHPText, null, null); + abilityCooldown = new LocationButton(MoveCommand.abilityCooldownsXY[0], MoveCommand.abilityCooldownsXY[1], ScaleCommand.abilityCooldownsScale, abilityCooldownText, null, null); this.buttonList.add(coords); this.buttonList.add(dungeonTimer); @@ -125,6 +130,7 @@ public class EditLocationsGui extends GuiScreen { this.buttonList.add(golemTimer); this.buttonList.add(teammatesInRadius); this.buttonList.add(giantHP); + this.buttonList.add(abilityCooldown); } @Override @@ -234,6 +240,12 @@ public class EditLocationsGui extends GuiScreen { giantHP.xPosition = MoveCommand.giantHPXY[0]; giantHP.yPosition = MoveCommand.giantHPXY[1]; break; + case "abilityCooldown": + MoveCommand.abilityCooldownsXY[0] += xMoved; + MoveCommand.abilityCooldownsXY[1] += yMoved; + abilityCooldown.xPosition = MoveCommand.abilityCooldownsXY[0]; + abilityCooldown.yPosition = MoveCommand.abilityCooldownsXY[1]; + break; } this.buttonList.clear(); initGui(); @@ -270,6 +282,8 @@ public class EditLocationsGui extends GuiScreen { moving = "teammatesInRadius"; } else if (button == giantHP) { moving = "giantHP"; + } else if (button == abilityCooldown) { + moving = "abilityCooldown"; } } } @@ -302,6 +316,8 @@ public class EditLocationsGui extends GuiScreen { ConfigHandler.writeIntConfig("locations", "teammatesInRadiusY", MoveCommand.teammatesInRadiusXY[1]); ConfigHandler.writeIntConfig("locations", "giantHPX", MoveCommand.giantHPXY[0]); ConfigHandler.writeIntConfig("locations", "giantHPY", MoveCommand.giantHPXY[1]); + ConfigHandler.writeIntConfig("locations", "abilityCooldownsX", MoveCommand.abilityCooldownsXY[0]); + ConfigHandler.writeIntConfig("locations", "abilityCooldownsY", MoveCommand.abilityCooldownsXY[1]); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 5323202..9195184 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -217,8 +217,9 @@ public class ConfigHandler { ToggleCommand.endOfFarmAlert = initBoolean("toggles", "EndOfFarmAlert", false); ToggleCommand.gemstoneLore = initBoolean("toggles", "GemstoneLore", false); ToggleCommand.crystalHollowWaypoints = initBoolean("toggles", "CrystalHollowWaypoints", false); - ToggleCommand.crystalAutoWaypoints = initBoolean("toggles", "CrystalAutoWaypoints", true); + ToggleCommand.crystalAutoWaypoints = initBoolean("toggles", "CrystalAutoWaypoints", true); // enabled by default ToggleCommand.autoAcceptReparty = initBoolean("toggles", "AutoAcceptReparty", false); + ToggleCommand.abilityCooldowns = initBoolean("toggles", "AbilityCooldowns", false); // Chat Messages ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); @@ -531,6 +532,8 @@ public class ConfigHandler { MoveCommand.teammatesInRadiusXY[1] = initInt("locations", "teammatesInRadiusY", 100); MoveCommand.giantHPXY[0] = initInt("locations", "giantHPX", 80); MoveCommand.giantHPXY[1] = initInt("locations", "giantHPY", 150); + MoveCommand.abilityCooldownsXY[0] = initInt("locations", "abilityCooldownsX", 120); + MoveCommand.abilityCooldownsXY[1] = initInt("locations", "abilityCooldownsY", 150); // Scales ScaleCommand.coordsScale = initDouble("scales", "coordsScale", 1); @@ -545,6 +548,7 @@ public class ConfigHandler { ScaleCommand.golemTimerScale = initDouble("scales", "golemTimerScale", 1); ScaleCommand.teammatesInRadiusScale = initDouble("scales", "teammatesInRadiusScale", 1); ScaleCommand.giantHPScale = initDouble("scales", "giantHPScale", 1); + ScaleCommand.abilityCooldownsScale = initDouble("scales", "abilityCooldownsScale", 1); // Skills DankersSkyblockMod.farmingLevel = initInt("skills", "farming", -1); @@ -559,7 +563,7 @@ public class ConfigHandler { // Colours DankersSkyblockMod.MAIN_COLOUR = initString("colors", "main", EnumChatFormatting.GREEN.toString()); DankersSkyblockMod.SECONDARY_COLOUR = initString("colors", "secondary", EnumChatFormatting.DARK_GREEN.toString()); - DankersSkyblockMod.DELIMITER_COLOUR = initString("colors", "delimiter", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.STRIKETHROUGH.toString()); + DankersSkyblockMod.DELIMITER_COLOUR = initString("colors", "delimiter", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.STRIKETHROUGH); DankersSkyblockMod.ERROR_COLOUR = initString("colors", "error", EnumChatFormatting.RED.toString()); DankersSkyblockMod.TYPE_COLOUR = initString("colors", "type", EnumChatFormatting.GREEN.toString()); DankersSkyblockMod.VALUE_COLOUR = initString("colors", "value", EnumChatFormatting.DARK_GREEN.toString()); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 71fc4ba..f7ebad6 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -9,6 +9,7 @@ import me.Danker.handlers.ScoreboardHandler; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.settings.GameSettings; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.entity.player.EntityPlayer; @@ -421,4 +422,45 @@ public class Utils { System.out.println("Refreshed DSM repo at " + System.currentTimeMillis()); } + public static int getCooldownFromAbility(String ability) { + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + boolean foundAbility = false; + + List<ItemStack> itemsToSearch = new ArrayList<>(); + + for (int i = 0; i < 8; i++) { + ItemStack hotbarItem = player.inventory.getStackInSlot(i); + if (hotbarItem == null) continue; + itemsToSearch.add(hotbarItem); + } + + for (int i = 0; i < 4; i++) { + ItemStack armorItem = player.inventory.armorItemInSlot(0); + if (armorItem == null) continue; + itemsToSearch.add(armorItem); + } + + for (ItemStack item : itemsToSearch) { + List<String> tooltip = item.getTooltip(player, false); + + for (String line : tooltip) { + System.out.println(line); + if (line.contains(EnumChatFormatting.GOLD + "Ability: ")) { + if (line.contains(EnumChatFormatting.GOLD + "Ability: " + ability)) { + foundAbility = true; + continue; + } else if (foundAbility) { + break; + } + } + + if (foundAbility && line.contains(EnumChatFormatting.DARK_GRAY + "Cooldown: ")) { + return Integer.parseInt(StringUtils.stripControlCodes(line).replaceAll("[^\\d]", "")); + } + } + } + + return 0; + } + } |