diff options
author | CuzImClicks <bruno778.whiteelfie@gmail.com> | 2021-04-30 08:24:42 +0200 |
---|---|---|
committer | CuzImClicks <bruno778.whiteelfie@gmail.com> | 2021-04-30 08:24:42 +0200 |
commit | a5572571f43ab3bd89c08678bba3050672be7615 (patch) | |
tree | 5169f378416544c0436186b5770d0d88fd26c981 /src/main/java/me | |
parent | 09622e51e46d6772e9017bfa9bb544616ebba8b7 (diff) | |
parent | d79def85f593605e0ac2ff59232449b4a8446bb8 (diff) | |
download | SkyblockMod-a5572571f43ab3bd89c08678bba3050672be7615.tar.gz SkyblockMod-a5572571f43ab3bd89c08678bba3050672be7615.tar.bz2 SkyblockMod-a5572571f43ab3bd89c08678bba3050672be7615.zip |
Merge branch 'development' of https://github.com/bowser0000/SkyblockMod into development
Diffstat (limited to 'src/main/java/me')
24 files changed, 880 insertions, 171 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index fe5d7ac..fe31d96 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -1,5 +1,6 @@ package me.Danker; +import com.google.gson.JsonObject; import me.Danker.commands.*; import me.Danker.commands.warp.*; import me.Danker.events.ChestSlotClickedEvent; @@ -10,6 +11,7 @@ import me.Danker.features.loot.LootDisplay; import me.Danker.features.loot.LootTracker; import me.Danker.features.puzzlesolvers.*; import me.Danker.gui.*; +import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.PacketHandler; import me.Danker.utils.Utils; @@ -63,7 +65,7 @@ import java.util.Map; @Mod(modid = DankersSkyblockMod.MODID, version = DankersSkyblockMod.VERSION, clientSideOnly = true) public class DankersSkyblockMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.8.6"; + public static final String VERSION = "1.8.7-beta1"; public static int titleTimer = -1; public static boolean showTitle = false; public static String titleText = ""; @@ -75,6 +77,7 @@ public class DankersSkyblockMod { public static String guiToOpen = null; public static boolean firstLaunch = false; public static String configDirectory; + public static JsonObject data = null; public static String MAIN_COLOUR; public static String SECONDARY_COLOUR; @@ -102,10 +105,13 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new DungeonTimer()); MinecraftForge.EVENT_BUS.register(new ExpertiseLore()); MinecraftForge.EVENT_BUS.register(new FasterMaddoxCalling()); + MinecraftForge.EVENT_BUS.register(new GiantHPDisplay()); MinecraftForge.EVENT_BUS.register(new GoldenEnchants()); MinecraftForge.EVENT_BUS.register(new GolemSpawningAlert()); MinecraftForge.EVENT_BUS.register(new GpartyNotifications()); + MinecraftForge.EVENT_BUS.register(new HidePetCandy()); MinecraftForge.EVENT_BUS.register(new HideTooltipsInExperiments()); + MinecraftForge.EVENT_BUS.register(new HighlightSkeletonMasters()); MinecraftForge.EVENT_BUS.register(new IceWalkSolver()); MinecraftForge.EVENT_BUS.register(new LividSolver()); MinecraftForge.EVENT_BUS.register(new LootDisplay()); @@ -126,6 +132,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new StartsWithSolver()); MinecraftForge.EVENT_BUS.register(new StopSalvagingStarredItems()); MinecraftForge.EVENT_BUS.register(new SuperpairsSolver()); + MinecraftForge.EVENT_BUS.register(new TetherDisplay()); MinecraftForge.EVENT_BUS.register(new ThreeManSolver()); MinecraftForge.EVENT_BUS.register(new TicTacToeSolver()); MinecraftForge.EVENT_BUS.register(new TriviaSolver()); @@ -148,6 +155,11 @@ public class DankersSkyblockMod { for (KeyBinding keyBinding : keyBindings) { ClientRegistry.registerKeyBinding(keyBinding); } + + new Thread(() -> { + DankersSkyblockMod.data = APIHandler.getResponse("https://raw.githubusercontent.com/bowser0000/SkyblockMod-REPO/main/data.json"); + System.out.println("Loaded data from GitHub?: " + (DankersSkyblockMod.data != null && DankersSkyblockMod.data.has("trivia"))); + }).start(); } @EventHandler @@ -167,6 +179,7 @@ public class DankersSkyblockMod { ClientCommandHandler.instance.registerCommand(new LootCommand()); ClientCommandHandler.instance.registerCommand(new MoveCommand()); ClientCommandHandler.instance.registerCommand(new PetsCommand()); + ClientCommandHandler.instance.registerCommand(new PlayerCommand()); ClientCommandHandler.instance.registerCommand(new ReloadConfigCommand()); ClientCommandHandler.instance.registerCommand(new ResetLootCommand()); ClientCommandHandler.instance.registerCommand(new ScaleCommand()); diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 207e700..f12d0ee 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -50,12 +50,14 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + PetsCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Uses API to get pets of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + BankCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Uses API to get bank and purse coins of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + ArmourCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Uses API to get armour of a person. If no name is provided, it checks yours.\n" + + EnumChatFormatting.GOLD + DungeonHub.usage(arg0) + EnumChatFormatting.AQUA + " - Uses API to get dungeon levels of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + ImportFishingCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Imports your fishing stats from your latest profile to your fishing tracker using the API.\n" + EnumChatFormatting.GOLD + SkyblockPlayersCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Uses API to find how many players are on each Skyblock island.\n" + EnumChatFormatting.GOLD + SkillTrackerCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Text display for skill xp/hour.\n" + EnumChatFormatting.GOLD + LobbyBankCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Uses API to find the average bank total of the lobby, as well the three players with the highest total money in the bank(and purse).\n" + EnumChatFormatting.GOLD + RepartyCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Disbands and reparties all members in the party.\n" + EnumChatFormatting.GOLD + CustomMusicCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Stops or reloads the custom music.\n" + + EnumChatFormatting.GOLD + PlayerCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Uses API to find skills, slayers, coins and weight of a player.\n" + EnumChatFormatting.GOLD + Crypt.usage(arg0) + EnumChatFormatting.AQUA + " - Warps you to the Crypt in the Hub. \n" + EnumChatFormatting.GOLD + DarkAuction.usage(arg0) + EnumChatFormatting.AQUA + " - Warps you to the Dark Auction in the Hub. \n" + EnumChatFormatting.GOLD + Dragon.usage(arg0) + EnumChatFormatting.AQUA + " - Warps you to the Dragons Nest in the End. \n" + diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index 5076ef7..6f548fa 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -88,7 +88,13 @@ public class DankerGuiCommand extends CommandBase { debug.append("[superpairs][").append(ToggleCommand.superpairsToggled).append("]\n"); debug.append("[hidetooltipsinaddons][").append(ToggleCommand.hideTooltipsInExperimentAddonsToggled).append("]\n"); debug.append("[pickblock][").append(ToggleCommand.swapToPickBlockToggled).append("]\n"); - debug.append("[melodyTooltips][").append(ToggleCommand.melodyTooltips).append("]\n"); + debug.append("[melodytooltips][").append(ToggleCommand.melodyTooltips).append("]\n"); + debug.append("[highlightslayers][").append(ToggleCommand.highlightSlayers).append("]\n"); + debug.append("[highlightarachne][").append(ToggleCommand.highlightArachne).append("]\n"); + debug.append("[highlightskeletonmasters][").append(ToggleCommand.highlightSkeletonMasters).append("]\n"); + debug.append("[teammatesinradius][").append(ToggleCommand.teammatesInRadius).append("]\n"); + debug.append("[gianthp][").append(ToggleCommand.giantHP).append("]\n"); + debug.append("[hidepetcandy][").append(ToggleCommand.hidePetCandy).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"); diff --git a/src/main/java/me/Danker/commands/MoveCommand.java b/src/main/java/me/Danker/commands/MoveCommand.java index 6fe2939..b17794c 100644 --- a/src/main/java/me/Danker/commands/MoveCommand.java +++ b/src/main/java/me/Danker/commands/MoveCommand.java @@ -23,6 +23,8 @@ public class MoveCommand extends CommandBase { public static int[] waterAnswerXY = {0, 0}; public static int[] bonzoTimerXY = {0, 0}; public static int[] golemTimerXY = {0 ,0}; + public static int[] teammatesInRadiusXY = {0, 0}; + public static int[] giantHPXY = {0, 0}; @Override public String getCommandName() { @@ -31,7 +33,7 @@ public class MoveCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer> <x> <y>"; + return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer/teammatesinradius/gianthp> <x> <y>"; } public static String usage(ICommandSender arg0) { @@ -46,7 +48,9 @@ public class MoveCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker", "wateranswer", "bonzotimer", "golemtimer"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", + "skilltracker", "wateranswer", "bonzotimer", "golemtimer", "teammatesinradius", + "gianthp"); } return null; } @@ -131,6 +135,20 @@ public class MoveCommand extends CommandBase { ConfigHandler.writeIntConfig("locations", "golemTimerY", golemTimerXY[1]); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Golem timer has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); break; + case "teammatesinradius": + teammatesInRadiusXY[0] = Integer.parseInt(arg1[1]); + teammatesInRadiusXY[1] = Integer.parseInt(arg1[2]); + ConfigHandler.writeIntConfig("locations", "teammatesInRadiusX", teammatesInRadiusXY[0]); + ConfigHandler.writeIntConfig("locations", "teammatesInRadiusY", teammatesInRadiusXY[1]); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Teammates in radius has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); + break; + case "gianthp": + giantHPXY[0] = Integer.parseInt(arg1[1]); + giantHPXY[1] = Integer.parseInt(arg1[2]); + ConfigHandler.writeIntConfig("locations", "giantHPX", giantHPXY[0]); + 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; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/PlayerCommand.java b/src/main/java/me/Danker/commands/PlayerCommand.java new file mode 100644 index 0000000..ef0ed4c --- /dev/null +++ b/src/main/java/me/Danker/commands/PlayerCommand.java @@ -0,0 +1,252 @@ +package me.Danker.commands; + +import com.google.gson.JsonObject; +import me.Danker.DankersSkyblockMod; +import me.Danker.handlers.APIHandler; +import me.Danker.handlers.ConfigHandler; +import me.Danker.utils.Utils; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; + +import java.text.NumberFormat; +import java.util.List; +import java.util.Locale; + +public class PlayerCommand extends CommandBase { + + @Override + public String getCommandName() { + return "player"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return "/" + getCommandName() + " [name]"; + } + + public static String usage(ICommandSender arg0) { + return new SkillsCommand().getCommandUsage(arg0); + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } + + @Override + public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { + if (args.length == 1) { + return Utils.getMatchingPlayers(args[0]); + } + return null; + } + + @Override + public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { + // MULTI THREAD DRIFTING + new Thread(() -> { + EntityPlayer player = (EntityPlayer) arg0; + + // Check key + String key = ConfigHandler.getString("api", "APIKey"); + if (key.equals("")) { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "API key not set. Use /setkey.")); + return; + } + + // Get UUID for Hypixel API requests + String username; + String uuid; + if (arg1.length == 0) { + username = player.getName(); + uuid = player.getUniqueID().toString().replaceAll("[\\-]", ""); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking stats of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); + } else { + username = arg1[0]; + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking stats of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); + uuid = APIHandler.getUUID(username); + } + + // Find stats of latest profile + String latestProfile = APIHandler.getLatestProfileID(uuid, key); + if (latestProfile == null) return; + + String profileURL = "https://api.hypixel.net/skyblock/profile?profile=" + latestProfile + "&key=" + key; + System.out.println("Fetching profile..."); + JsonObject profileResponse = APIHandler.getResponse(profileURL); + if (!profileResponse.get("success").getAsBoolean()) { + String reason = profileResponse.get("cause").getAsString(); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); + return; + } + + // Skills + System.out.println("Fetching skills..."); + JsonObject userObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject(); + + double farmingLevel = 0; + double miningLevel = 0; + double combatLevel = 0; + double foragingLevel = 0; + double fishingLevel = 0; + double enchantingLevel = 0; + double alchemyLevel = 0; + double tamingLevel = 0; + + if (userObject.has("experience_skill_farming") || userObject.has("experience_skill_mining") || userObject.has("experience_skill_combat") || userObject.has("experience_skill_foraging") || userObject.has("experience_skill_fishing") || userObject.has("experience_skill_enchanting") || userObject.has("experience_skill_alchemy")) { + if (userObject.has("experience_skill_farming")) { + farmingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_farming").getAsDouble(), 60); + farmingLevel = (double) Math.round(farmingLevel * 100) / 100; + } + if (userObject.has("experience_skill_mining")) { + miningLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_mining").getAsDouble(), 60); + miningLevel = (double) Math.round(miningLevel * 100) / 100; + } + if (userObject.has("experience_skill_combat")) { + combatLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_combat").getAsDouble(), 60); + combatLevel = (double) Math.round(combatLevel * 100) / 100; + } + if (userObject.has("experience_skill_foraging")) { + foragingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_foraging").getAsDouble(), 50); + foragingLevel = (double) Math.round(foragingLevel * 100) / 100; + } + if (userObject.has("experience_skill_fishing")) { + fishingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_fishing").getAsDouble(), 50); + fishingLevel = (double) Math.round(fishingLevel * 100) / 100; + } + if (userObject.has("experience_skill_enchanting")) { + enchantingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_enchanting").getAsDouble(), 60); + enchantingLevel = (double) Math.round(enchantingLevel * 100) / 100; + } + if (userObject.has("experience_skill_alchemy")) { + alchemyLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_alchemy").getAsDouble(), 50); + alchemyLevel = (double) Math.round(alchemyLevel * 100) / 100; + } + if (userObject.has("experience_skill_taming")) { + tamingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_taming").getAsDouble(), 50); + tamingLevel = (double) Math.round(tamingLevel * 100) / 100; + } + } else { + // Get skills from achievement API, will be floored + + String playerURL = "https://api.hypixel.net/player?uuid=" + uuid + "&key=" + key; + System.out.println("Fetching skills from achievement API"); + JsonObject playerObject = APIHandler.getResponse(playerURL); + + if (!playerObject.get("success").getAsBoolean()) { + String reason = profileResponse.get("cause").getAsString(); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); + return; + } + + JsonObject achievementObject = playerObject.get("player").getAsJsonObject().get("achievements").getAsJsonObject(); + if (achievementObject.has("skyblock_harvester")) { + farmingLevel = achievementObject.get("skyblock_harvester").getAsInt(); + } + if (achievementObject.has("skyblock_excavator")) { + miningLevel = achievementObject.get("skyblock_excavator").getAsInt(); + } + if (achievementObject.has("skyblock_combat")) { + combatLevel = achievementObject.get("skyblock_combat").getAsInt(); + } + if (achievementObject.has("skyblock_gatherer")) { + foragingLevel = Math.min(achievementObject.get("skyblock_gatherer").getAsInt(), 50); + } + if (achievementObject.has("skyblock_angler")) { + fishingLevel = Math.min(achievementObject.get("skyblock_angler").getAsInt(), 50); + } + if (achievementObject.has("skyblock_augmentation")) { + enchantingLevel = achievementObject.get("skyblock_augmentation").getAsInt(); + } + if (achievementObject.has("skyblock_concoctor")) { + alchemyLevel = Math.min(achievementObject.get("skyblock_concoctor").getAsInt(), 50); + } + if (achievementObject.has("skyblock_domesticator")) { + tamingLevel = Math.min(achievementObject.get("skyblock_domesticator").getAsInt(), 50); + } + } + + double skillAvg = (farmingLevel + miningLevel + combatLevel + foragingLevel + fishingLevel + enchantingLevel + alchemyLevel + tamingLevel) / 8; + skillAvg = (double) Math.round(skillAvg * 100) / 100; + double trueAvg = (Math.floor(farmingLevel) + Math.floor(miningLevel) + Math.floor(combatLevel) + Math.floor(foragingLevel) + Math.floor(fishingLevel) + Math.floor(enchantingLevel) + Math.floor(alchemyLevel) + Math.floor(tamingLevel)) / 8; + + // Slayers + System.out.println("Fetching slayer stats..."); + JsonObject slayersObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("slayer_bosses").getAsJsonObject(); + // Zombie + int zombieXP = 0; + if (slayersObject.get("zombie").getAsJsonObject().has("xp")) { + zombieXP = slayersObject.get("zombie").getAsJsonObject().get("xp").getAsInt(); + } + // Spider + int spiderXP = 0; + if (slayersObject.get("spider").getAsJsonObject().has("xp")) { + spiderXP = slayersObject.get("spider").getAsJsonObject().get("xp").getAsInt(); + } + // Wolf + int wolfXP = 0; + if (slayersObject.get("wolf").getAsJsonObject().has("xp")) { + wolfXP = slayersObject.get("wolf").getAsJsonObject().get("xp").getAsInt(); + } + + // Bank + System.out.println("Fetching bank + purse coins..."); + double bankCoins = 0; + double purseCoins = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("coin_purse").getAsDouble(); + purseCoins = Math.floor(purseCoins * 100.0) / 100.0; + + // Check for bank api + if (profileResponse.get("profile").getAsJsonObject().has("banking")) { + bankCoins = profileResponse.get("profile").getAsJsonObject().get("banking").getAsJsonObject().get("balance").getAsDouble(); + bankCoins = Math.floor(bankCoins * 100.0) / 100.0; + } + + // Weight + System.out.println("Fetching weight from Senither API..."); + String weightURL = "https://hypixel-api.senither.com/v1/profiles/" + uuid + "/weight?key=" + key; + JsonObject weightResponse = APIHandler.getResponse(weightURL); + if (weightResponse.get("status").getAsInt() != 200) { + String reason = weightResponse.get("reason").getAsString(); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); + return; + } + + double weight = weightResponse.get("data").getAsJsonObject().get("weight").getAsDouble(); + double overflow = weightResponse.get("data").getAsJsonObject().get("weight_overflow").getAsDouble(); + + NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); + NumberFormat nfd = NumberFormat.getNumberInstance(Locale.US); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.AQUA + " " + username + "'s Skills:\n" + + DankersSkyblockMod.TYPE_COLOUR + " Farming: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + farmingLevel + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Mining: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + miningLevel + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Combat: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + combatLevel + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Foraging: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + foragingLevel + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Fishing: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + fishingLevel + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Enchanting: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + enchantingLevel + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Alchemy: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + alchemyLevel + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Taming: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + tamingLevel + "\n" + + EnumChatFormatting.AQUA + " Average Skill Level: " + DankersSkyblockMod.SKILL_AVERAGE_COLOUR + EnumChatFormatting.BOLD + skillAvg + "\n" + + EnumChatFormatting.AQUA + " True Average Skill Level: " + DankersSkyblockMod.SKILL_AVERAGE_COLOUR + EnumChatFormatting.BOLD + trueAvg + "\n\n" + + EnumChatFormatting.AQUA + " " + username + "'s Total Slayer XP: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + nf.format(zombieXP + spiderXP + wolfXP) + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Zombie XP: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(zombieXP) + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Spider XP: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(spiderXP) + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Wolf XP: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(wolfXP) + "\n\n" + + EnumChatFormatting.AQUA + " " + username + "'s Coins:\n" + + DankersSkyblockMod.TYPE_COLOUR + " Bank: " + (bankCoins == 0 ? EnumChatFormatting.RED + "Bank API disabled." : EnumChatFormatting.GOLD + nf.format(bankCoins)) + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Purse: " + EnumChatFormatting.GOLD + nf.format(purseCoins) + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Total: " + EnumChatFormatting.GOLD + nf.format(bankCoins + purseCoins) + "\n\n" + + EnumChatFormatting.AQUA + " " + username + "'s Weight:\n" + + DankersSkyblockMod.TYPE_COLOUR + " Total Weight: " + DankersSkyblockMod.VALUE_COLOUR + nfd.format(weight + overflow) + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Weight: " + DankersSkyblockMod.VALUE_COLOUR + nfd.format(weight) + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Overflow: " + DankersSkyblockMod.VALUE_COLOUR + nfd.format(overflow) + "\n" + + DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); + }).start(); + } + +} diff --git a/src/main/java/me/Danker/commands/ScaleCommand.java b/src/main/java/me/Danker/commands/ScaleCommand.java index b27ac50..def0e57 100644 --- a/src/main/java/me/Danker/commands/ScaleCommand.java +++ b/src/main/java/me/Danker/commands/ScaleCommand.java @@ -23,6 +23,8 @@ public class ScaleCommand extends CommandBase { public static double waterAnswerScale; public static double bonzoTimerScale; public static double golemTimerScale; + public static double teammatesInRadiusScale; + public static double giantHPScale; @Override public String getCommandName() { @@ -31,7 +33,7 @@ public class ScaleCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer> <size (0.1 - 10)>"; + return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer/teammatesinradius/gianthp> <size (0.1 - 10)>"; } public static String usage(ICommandSender arg0) { @@ -46,7 +48,9 @@ public class ScaleCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker", "wateranswer", "bonzotimer", "golemtimer"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", + "skilltracker", "wateranswer", "bonzotimer", "golemtimer", "teammatesinradius", + "gianthp"); } return null; } @@ -117,6 +121,16 @@ public class ScaleCommand extends CommandBase { ConfigHandler.writeDoubleConfig("scales", "golemTimerScale", golemTimerScale); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Golem timer has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + golemTimerScale + "x")); break; + case "teammatesinradius": + teammatesInRadiusScale = scaleAmount; + ConfigHandler.writeDoubleConfig("scales", "teammatesInRadiusScale", teammatesInRadiusScale); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Teammates in radius has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + teammatesInRadiusScale + "x")); + break; + case "gianthp": + giantHPScale = scaleAmount; + ConfigHandler.writeDoubleConfig("scales", "giantHPScale", giantHPScale); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Giant hp has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + giantHPScale + "x")); + break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/SkillsCommand.java b/src/main/java/me/Danker/commands/SkillsCommand.java index a17fedb..6195e81 100644 --- a/src/main/java/me/Danker/commands/SkillsCommand.java +++ b/src/main/java/me/Danker/commands/SkillsCommand.java @@ -19,7 +19,7 @@ public class SkillsCommand extends CommandBase { @Override public String getCommandName() { - return "skills"; + return "skill"; } @Override diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index b9c52e7..c04e0a8 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -33,6 +33,10 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean cakeTimerToggled; public static boolean highlightSlayers; public static boolean highlightArachne; + public static boolean highlightSkeletonMasters; + public static boolean teammatesInRadius; + public static boolean giantHP; + public static boolean hidePetCandy; public static boolean highlightCommissions; // Chat Messages public static boolean sceptreMessages; @@ -93,8 +97,8 @@ public class ToggleCommand extends CommandBase implements ICommand { "creeperpuzzle/waterpuzzle/tictactoepuzzle/boulderpuzzle/silverfishpuzzle/icewalkpuzzle/watchermessage/" + "startswithterminal/selectallterminal/clickinorderterminal/" + "ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/" + - "melodytooltips/highlightslayers/highlightarachne/dungeonbossmusic/bloodroommusic/" + - "dungeonmusic/highlightcommissions/list>"; + "melodytooltips/highlightslayers/highlightarachne/highlightskeletonmasters/teammatesinradius/" + + "gianthp/hidepetcandy/dungeonbossmusic/bloodroommusic/dungeonmusic/highlightcommissions/list>"; } public static String usage(ICommandSender arg0) { @@ -122,7 +126,8 @@ public class ToggleCommand extends CommandBase implements ICommand { "selectallterminal", "clickinorderterminal", "ultrasequencer", "chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "melodytooltips", "highlightslayers", - "dungeonbossmusic", "bloodroommusic", "dungeonmusic", "highlightcommissions", "list"); + "highlightskeletonmasters", "dungeonbossmusic", "bloodroommusic", "dungeonmusic", + "teammatesinradius", "gianthp", "hidepetcandy", "highlightcommissions", "list"); } return null; } @@ -386,21 +391,43 @@ public class ToggleCommand extends CommandBase implements ICommand { case "melodytooltips": melodyTooltips = !melodyTooltips; ConfigHandler.writeBooleanConfig("toggles", "MelodyTooltips", melodyTooltips); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Hide tooltips in Melody's Harp " + DankersSkyblockMod.SECONDARY_COLOUR + melodyTooltips + DankersSkyblockMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Hide tooltips in Melody's Harp has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + melodyTooltips + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "highlightslayers": highlightSlayers = !highlightSlayers; ConfigHandler.writeBooleanConfig("toggles", "HighlightSlayers", highlightSlayers); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Highlight Slayer Bosses " + DankersSkyblockMod.SECONDARY_COLOUR + highlightSlayers + DankersSkyblockMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Highlight Slayer Bosses has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + highlightSlayers + DankersSkyblockMod.MAIN_COLOUR + ".")); break; - case "highlightArachne": + case "highlightarachne": highlightArachne = !highlightArachne; ConfigHandler.writeBooleanConfig("toggles", "HighlightArachne", highlightArachne); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Highlight Arachne " + DankersSkyblockMod.SECONDARY_COLOUR + highlightArachne + DankersSkyblockMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Highlight Arachne has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + highlightArachne + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "highlightskeletonmasters": + highlightSkeletonMasters = !highlightSkeletonMasters; + ConfigHandler.writeBooleanConfig("toggles", "HighlightSkeletonMasters", highlightSkeletonMasters); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Highlight Skeleton Masters has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + highlightSkeletonMasters + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "teammatesinradius": + teammatesInRadius = !teammatesInRadius; + ConfigHandler.writeBooleanConfig("toggles", "TeammatesInRadius", teammatesInRadius); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Teammates in radius has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + teammatesInRadius + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "gianthp": + giantHP = !giantHP; + ConfigHandler.writeBooleanConfig("toggles", "GiantHP", giantHP); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Giant HP display has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + giantHP + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "hidepetcandy": + hidePetCandy = !hidePetCandy; + ConfigHandler.writeBooleanConfig("toggles", "HidePetCandy", hidePetCandy); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Hide pet candy has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + hidePetCandy + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "highlightcommissions": highlightCommissions = !highlightCommissions; ConfigHandler.writeBooleanConfig("toggles", "HighlightCommissions", highlightCommissions); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Highlight Commissions " + DankersSkyblockMod.SECONDARY_COLOUR + highlightCommissions + DankersSkyblockMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Highlight Commissions has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + highlightCommissions + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "dungeonbossmusic": dungeonBossMusic = !dungeonBossMusic; CustomMusic.dungeonboss.stop(); @@ -460,10 +487,15 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Chronomatron solver: " + DankersSkyblockMod.VALUE_COLOUR + chronomatronToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Superpairs solver: " + DankersSkyblockMod.VALUE_COLOUR + superpairsToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Hide tooltips in experiment addons: " + DankersSkyblockMod.VALUE_COLOUR + hideTooltipsInExperimentAddonsToggled + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Auto-swap to pick block " + DankersSkyblockMod.VALUE_COLOUR + swapToPickBlockToggled + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Hide tooltips in Melody's Harp " + DankersSkyblockMod.VALUE_COLOUR + melodyTooltips + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Highlight Slayer Bosses " + DankersSkyblockMod.VALUE_COLOUR + highlightSlayers + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Highlight Arachne Boss " + DankersSkyblockMod.VALUE_COLOUR + highlightArachne + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Auto-swap to pick block: " + DankersSkyblockMod.VALUE_COLOUR + swapToPickBlockToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Hide tooltips in Melody's Harp: " + DankersSkyblockMod.VALUE_COLOUR + melodyTooltips + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Highlight Slayer Bosses: " + DankersSkyblockMod.VALUE_COLOUR + highlightSlayers + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Highlight Arachne Boss: " + DankersSkyblockMod.VALUE_COLOUR + highlightArachne + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Highlight Skeleton Masters: " + DankersSkyblockMod.VALUE_COLOUR + highlightSkeletonMasters + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Teammates in radius: " + DankersSkyblockMod.VALUE_COLOUR + teammatesInRadius + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Giant HP display: " + DankersSkyblockMod.VALUE_COLOUR + giantHP + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Hide pet candy: " + DankersSkyblockMod.VALUE_COLOUR + hidePetCandy + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Highlight commissions: " + DankersSkyblockMod.VALUE_COLOUR + highlightCommissions + "\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 diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index 4b1f6bb..342727b 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -66,6 +66,8 @@ public class CustomMusic { if (!prevInDungeonBossRoom) { dungeonboss.start(); } + } else { + inDungeonBossRoom = false; } } } diff --git a/src/main/java/me/Danker/features/GiantHPDisplay.java b/src/main/java/me/Danker/features/GiantHPDisplay.java new file mode 100644 index 0000000..07378dd --- /dev/null +++ b/src/main/java/me/Danker/features/GiantHPDisplay.java @@ -0,0 +1,71 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlay; +import me.Danker.handlers.ScoreboardHandler; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.util.StringUtils; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; + +public class GiantHPDisplay { + + static Pattern f6GiantPattern = Pattern.compile("(Jolly Pink Giant|L\\.A\\.S\\.R\\.|The Diamond Giant|Bigfoot).*"); + static List<Entity> giants = new ArrayList<>(); + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + World world = Minecraft.getMinecraft().theWorld; + if (DankersSkyblockMod.tickAmount % 20 == 0) { + if (ToggleCommand.giantHP && Utils.inDungeons && world != null) { + giants.clear(); + List<String> scoreboard = ScoreboardHandler.getSidebarLines(); + String firstLine = ScoreboardHandler.cleanSB(scoreboard.get(scoreboard.size() - 1)); + + if (firstLine.contains("sadan")) { + List<Entity> entities = world.getLoadedEntityList(); + + for (Entity entity : entities) { + String name = StringUtils.stripControlCodes(entity.getName()); + if (f6GiantPattern.matcher(name).find()) { + giants.add(entity); + } + } + } else if (firstLine.contains("138,30") || firstLine.contains("354,66") || firstLine.contains("138,66")) { + List<Entity> entities = world.getLoadedEntityList(); + + for (Entity entity : entities) { + if (entity.getName().contains("Giant ")) { + giants.add(entity); + } + } + } + } + } + } + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + if (ToggleCommand.giantHP && Utils.inDungeons && giants.size() > 0) { + StringBuilder sb = new StringBuilder(); + + for (Entity giant : giants) { + if (!giant.isDead) sb.append(Utils.removeBold(giant.getDisplayName().getFormattedText())).append("\n"); + } + + new TextRenderer(Minecraft.getMinecraft(), sb.toString(), 100, 100, 1); + } + } + +} diff --git a/src/main/java/me/Danker/features/HidePetCandy.java b/src/main/java/me/Danker/features/HidePetCandy.java new file mode 100644 index 0000000..8ef28d2 --- /dev/null +++ b/src/main/java/me/Danker/features/HidePetCandy.java @@ -0,0 +1,26 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class HidePetCandy { + + @SubscribeEvent + public void onTooltip(ItemTooltipEvent event) { + if (!Utils.inSkyblock) return; + if (event.toolTip == null) return; + + if (ToggleCommand.hidePetCandy) { + for (int i = 0; i < event.toolTip.size(); i++) { + if (event.toolTip.get(i).endsWith("Pet Candy Used")) { + event.toolTip.remove(i); + event.toolTip.remove(i); + break; + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/HighlightSkeletonMasters.java b/src/main/java/me/Danker/features/HighlightSkeletonMasters.java new file mode 100644 index 0000000..f97699c --- /dev/null +++ b/src/main/java/me/Danker/features/HighlightSkeletonMasters.java @@ -0,0 +1,42 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.event.RenderLivingEvent; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.ArrayList; +import java.util.List; + +public class HighlightSkeletonMasters { + + static List<Entity> skeletonMasters = new ArrayList<>(); + public static int SKELETON_MASTER_COLOUR; + + @SubscribeEvent + public void onRenderEntity(RenderLivingEvent.Pre<EntityLivingBase> event) { + if (ToggleCommand.highlightSkeletonMasters && event.entity instanceof EntitySkeleton && Utils.inDungeons) { + ItemStack helmet = event.entity.getCurrentArmor(3); + if (helmet != null && helmet.getDisplayName().endsWith("Skeleton Master Helmet")) { + skeletonMasters.add(event.entity); + } + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.highlightSkeletonMasters) { + for (Entity skeletonMaster : skeletonMasters) { + if (!skeletonMaster.isDead) + Utils.draw3DBox(skeletonMaster.getEntityBoundingBox(), SKELETON_MASTER_COLOUR, event.partialTicks); + } + skeletonMasters.clear(); + } + } + +} diff --git a/src/main/java/me/Danker/features/TetherDisplay.java b/src/main/java/me/Danker/features/TetherDisplay.java new file mode 100644 index 0000000..363b90f --- /dev/null +++ b/src/main/java/me/Danker/features/TetherDisplay.java @@ -0,0 +1,60 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlay; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityOtherPlayerMP; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.ArrayList; +import java.util.List; + +public class TetherDisplay { + + static List<String> playersInRadius = new ArrayList<>(); + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayer player = mc.thePlayer; + World world = mc.theWorld; + if (DankersSkyblockMod.tickAmount % 10 == 0) { + if (ToggleCommand.teammatesInRadius && Utils.inDungeons && player != null && world != null) { + playersInRadius.clear(); + List<EntityPlayer> teammates = world.getEntitiesWithinAABB(EntityOtherPlayerMP.class, new AxisAlignedBB(player.posX - 30, player.posY - 30, player.posZ - 30, player.posX + 30, player.posY + 30, player.posZ + 30)); + + for (EntityPlayer teammate : teammates) { + if (Utils.isRealPlayer(teammate) && !teammate.isInvisible() && player.getDistanceToEntity(teammate) <= 30F) { + playersInRadius.add(teammate.getDisplayName().getSiblings().get(0).getFormattedText()); + } + } + } + } + } + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + if (ToggleCommand.teammatesInRadius && Utils.inDungeons) { + String teammates; + if (playersInRadius.size() > 0) { + teammates = String.join("\n", playersInRadius); + } else { + teammates = EnumChatFormatting.RED + "NONE"; + } + new TextRenderer(Minecraft.getMinecraft(), EnumChatFormatting.AQUA + "Teammates In Radius:\n" + teammates, MoveCommand.teammatesInRadiusXY[0], MoveCommand.teammatesInRadiusXY[1], ScaleCommand.teammatesInRadiusScale); + } + } + +} diff --git a/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java index 7ff7e7a..cd6bcf4 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java @@ -78,7 +78,12 @@ public class CreeperSolver { public void onWorldRender(RenderWorldLastEvent event) { if (ToggleCommand.creeperToggled && drawCreeperLines && !creeperLines.isEmpty()) { for (int i = 0; i < creeperLines.size(); i++) { - Utils.draw3DLine(creeperLines.get(i)[0], creeperLines.get(i)[1], CREEPER_COLOURS[i % 10], 2, true, event.partialTicks); + Vec3 pos1 = creeperLines.get(i)[0]; + Vec3 pos2 = creeperLines.get(i)[1]; + int colour = CREEPER_COLOURS[i % 10]; + Utils.draw3DLine(pos1, pos2, colour, 2, true, event.partialTicks); + Utils.drawFilled3DBox(new AxisAlignedBB(pos1.xCoord - 0.51, pos1.yCoord - 0.51, pos1.zCoord - 0.51, pos1.xCoord + 0.51, pos1.yCoord + 0.51, pos1.zCoord + 0.51), colour, true, true, event.partialTicks); + Utils.drawFilled3DBox(new AxisAlignedBB(pos2.xCoord - 0.51, pos2.yCoord - 0.51, pos2.zCoord - 0.51, pos2.xCoord + 0.51, pos2.yCoord + 0.51, pos2.zCoord + 0.51), colour, true, true, event.partialTicks); } } } diff --git a/src/main/java/me/Danker/features/puzzlesolvers/LividSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/LividSolver.java index b537198..6f02982 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/LividSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/LividSolver.java @@ -5,7 +5,6 @@ import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; import me.Danker.commands.ToggleCommand; import me.Danker.events.RenderOverlay; -import me.Danker.handlers.ScoreboardHandler; import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; @@ -39,18 +38,7 @@ public class LividSolver { World world = Minecraft.getMinecraft().theWorld; if (DankersSkyblockMod.tickAmount % 20 == 0) { if (ToggleCommand.lividSolverToggled && Utils.inDungeons && !foundLivid && world != null) { - boolean inF5 = false; - - List<String> scoreboard = ScoreboardHandler.getSidebarLines(); - for (String s : scoreboard) { - String sCleaned = ScoreboardHandler.cleanSB(s); - if (sCleaned.contains("The Catacombs (F5)")) { - inF5 = true; - break; - } - } - - if (inF5) { + if (Utils.isInScoreboard("The Catacombs (F5)")) { List<Entity> loadedLivids = new ArrayList<>(); List<Entity> entities = world.getLoadedEntityList(); for (Entity entity : entities) { diff --git a/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java index 8f7de95..500c8eb 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java @@ -1,5 +1,6 @@ package me.Danker.features.puzzlesolvers; +import com.google.gson.JsonArray; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; import me.Danker.utils.Utils; @@ -16,6 +17,7 @@ import java.util.List; public class ThreeManSolver { + // Hard coded solutions if api call fails static String[] riddleSolutions = {"The reward is not in my chest!", "At least one of them is lying, and the reward is not in", "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."}; @@ -33,33 +35,22 @@ public class ThreeManSolver { if (!Utils.inDungeons) return; if (ToggleCommand.threeManToggled && message.contains("[NPC]")) { - for (String solution : riddleSolutions) { - if (message.contains(solution)) { - Minecraft mc = Minecraft.getMinecraft(); - String npcName = message.substring(message.indexOf("]") + 2, message.indexOf(":")); - mc.thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.ANSWER_COLOUR + EnumChatFormatting.BOLD + StringUtils.stripControlCodes(npcName) + DankersSkyblockMod.MAIN_COLOUR + " has the blessing.")); - if (riddleChest == null) { - List<Entity> entities = mc.theWorld.getLoadedEntityList(); - for (Entity entity : entities) { - if (entity == null || !entity.hasCustomName()) continue; - if (entity.getCustomNameTag().contains(npcName)) { - BlockPos npcLocation = new BlockPos(entity.posX, 69, entity.posZ); - if (mc.theWorld.getBlockState(npcLocation.north()).getBlock() == Blocks.chest) { - riddleChest = npcLocation.north(); - } else if (mc.theWorld.getBlockState(npcLocation.east()).getBlock() == Blocks.chest) { - riddleChest = npcLocation.east(); - } else if (mc.theWorld.getBlockState(npcLocation.south()).getBlock() == Blocks.chest) { - riddleChest = npcLocation.south(); - } else if (mc.theWorld.getBlockState(npcLocation.west()).getBlock() == Blocks.chest) { - riddleChest = npcLocation.west(); - } else { - System.out.print("Could not find correct riddle chest."); - } - break; - } - } + if (DankersSkyblockMod.data != null && DankersSkyblockMod.data.has("threeman")) { + JsonArray riddleSolutions = DankersSkyblockMod.data.get("threeman").getAsJsonArray(); + + for (int i = 0; i < riddleSolutions.size(); i++) { + String solution = riddleSolutions.get(i).getAsString(); + if (message.contains(solution)) { + answer(message); + break; + } + } + } else { + for (String solution : riddleSolutions) { + if (message.contains(solution)) { + answer(message); + break; } - break; } } } @@ -72,4 +63,32 @@ public class ThreeManSolver { } } + public static void answer(String message) { + Minecraft mc = Minecraft.getMinecraft(); + String npcName = message.substring(message.indexOf("]") + 2, message.indexOf(":")); + mc.thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.ANSWER_COLOUR + EnumChatFormatting.BOLD + StringUtils.stripControlCodes(npcName) + DankersSkyblockMod.MAIN_COLOUR + " has the blessing.")); + + if (riddleChest == null) { + List<Entity> entities = mc.theWorld.getLoadedEntityList(); + for (Entity entity : entities) { + if (entity == null || !entity.hasCustomName()) continue; + if (entity.getCustomNameTag().contains(npcName)) { + BlockPos npcLocation = new BlockPos(entity.posX, 69, entity.posZ); + if (mc.theWorld.getBlockState(npcLocation.north()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.north(); + } else if (mc.theWorld.getBlockState(npcLocation.east()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.east(); + } else if (mc.theWorld.getBlockState(npcLocation.south()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.south(); + } else if (mc.theWorld.getBlockState(npcLocation.west()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.west(); + } else { + System.out.print("Could not find correct riddle chest."); + } + break; + } + } + } + } + } diff --git a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java index 9adc555..dd2c23e 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java @@ -1,5 +1,9 @@ package me.Danker.features.puzzlesolvers; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; import me.Danker.utils.Utils; import net.minecraft.util.ChatComponentText; @@ -9,16 +13,21 @@ 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.HashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; public class TriviaSolver { static Map<String, String[]> triviaSolutions = new HashMap<>(); static String[] triviaAnswers = null; + static JsonArray triviaAnswersJson = null; public static String TRIVIA_WRONG_ANSWER_COLOUR; public static void init() { + // Hard coded solutions if api call fails triviaSolutions.put("What is the status of The Watcher?", new String[]{"Stalker"}); triviaSolutions.put("What is the status of Bonzo?", new String[]{"New Necromancer"}); triviaSolutions.put("What is the status of Scarf?", new String[]{"Apprentice Necromancer"}); @@ -30,11 +39,10 @@ public class TriviaSolver { triviaSolutions.put("What is the status of Goldor?", new String[]{"Wither Soldier"}); triviaSolutions.put("What is the status of Storm?", new String[]{"Elementalist"}); triviaSolutions.put("What is the status of Necron?", new String[]{"Wither Lord"}); - triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"222 Fairy Souls"}); + triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"227 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Spider's Den?", new String[]{"19 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The End?", new String[]{"12 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in The Barn?", new String[]{"7 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in Mushroom Desert?", new String[]{"8 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in The Farming Islands?", new String[]{"20 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Blazing Fortress?", new String[]{"19 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The Park?", new String[]{"11 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Jerry's Workshop?", new String[]{"5 Fairy Souls"}); @@ -65,35 +73,76 @@ public class TriviaSolver { if (event.type == 2) return; if (ToggleCommand.oruoToggled) { - if (message.contains("What SkyBlock year is it?")) { - double currentTime = System.currentTimeMillis() /1000L; + if (DankersSkyblockMod.data != null && DankersSkyblockMod.data.has("trivia")) { + if (message.contains("What SkyBlock year is it?")) { + double currentTime = System.currentTimeMillis() / 1000L; - double diff = Math.floor(currentTime - 1560276000); + double diff = Math.floor(currentTime - 1560276000); - int year = (int) (diff / 446400 + 1); - triviaAnswers = new String[]{"Year " + year}; - } else { - for (String question : triviaSolutions.keySet()) { - if (message.contains(question)) { - triviaAnswers = triviaSolutions.get(question); - break; + int year = (int) (diff / 446400 + 1); + triviaAnswersJson = new JsonArray(); + triviaAnswersJson.add(new JsonPrimitive("Year " + year)); + } else { + JsonObject triviaSolutions = DankersSkyblockMod.data.get("trivia").getAsJsonObject(); + + List<String> triviaSolutionsList = triviaSolutions.entrySet().stream() + .map(Map.Entry::getKey) + .collect(Collectors.toCollection(ArrayList::new)); + for (String question : triviaSolutionsList) { + if (message.contains(question)) { + triviaAnswersJson = triviaSolutions.get(question).getAsJsonArray(); + break; + } } } - } - // Set wrong answers to red and remove click events - if (triviaAnswers != null && (message.contains("ⓐ") || message.contains("ⓑ") || message.contains("ⓒ"))) { - boolean isSolution = false; - for (String solution : triviaAnswers) { - if (message.contains(solution)) { - isSolution = true; - break; + // Set wrong answers to red and remove click events + if (triviaAnswersJson != null && (message.contains("ⓐ") || message.contains("ⓑ") || message.contains("ⓒ"))) { + boolean isSolution = false; + for (int i = 0; i < triviaAnswersJson.size(); i++) { + String solution = triviaAnswersJson.get(i).getAsString(); + if (message.contains(solution)) { + isSolution = true; + break; + } + } + if (!isSolution) { + char letter = message.charAt(5); + String option = message.substring(6); + event.message = new ChatComponentText(" " + EnumChatFormatting.GOLD + letter + TRIVIA_WRONG_ANSWER_COLOUR + option); + } + } + } else { + if (message.contains("What SkyBlock year is it?")) { + double currentTime = System.currentTimeMillis() / 1000L; + + double diff = Math.floor(currentTime - 1560276000); + + int year = (int) (diff / 446400 + 1); + triviaAnswers = new String[]{"Year " + year}; + } else { + for (String question : triviaSolutions.keySet()) { + if (message.contains(question)) { + triviaAnswers = triviaSolutions.get(question); + break; + } } } - if (!isSolution) { - char letter = message.charAt(5); - String option = message.substring(6); - event.message = new ChatComponentText(" " + EnumChatFormatting.GOLD + letter + TRIVIA_WRONG_ANSWER_COLOUR + option); + + // Set wrong answers to red and remove click events + if (triviaAnswers != null && (message.contains("ⓐ") || message.contains("ⓑ") || message.contains("ⓒ"))) { + boolean isSolution = false; + for (String solution : triviaAnswers) { + if (message.contains(solution)) { + isSolution = true; + break; + } + } + if (!isSolution) { + char letter = message.charAt(5); + String option = message.substring(6); + event.message = new ChatComponentText(" " + EnumChatFormatting.GOLD + letter + TRIVIA_WRONG_ANSWER_COLOUR + option); + } } } } diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 22cc001..11e8bfa 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -2,10 +2,16 @@ package me.Danker.gui; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; +import me.Danker.gui.buttons.FeatureButton; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.client.gui.*; import net.minecraft.util.StringUtils; @@ -57,6 +63,10 @@ public class DankerGui extends GuiScreen { private GuiButton autoSkillTracker; private GuiButton highlightArachne; private GuiButton highlightSlayer; + private GuiButton highlightSkeletonMasters; + private GuiButton teammatesInRadius; + private GuiButton giantHP; + private GuiButton hidePetCandy; private GuiButton highlightCommissions; // Chat Messages private GuiButton sceptreMessages; @@ -107,42 +117,47 @@ public class DankerGui extends GuiScreen { experimentationTableSolvers = new GuiButton(0, 0, 0, "Toggle Experimentation Table Solvers"); skillTracker = new GuiButton(0, 0, 0, "Toggle Skill XP/Hour Tracking"); customMusic = new GuiButton(0, 0, 0, "Custom Music"); - outlineText = new GuiButton(0, 0, 0, "Outline Displayed Text: " + Utils.getColouredBoolean(ToggleCommand.outlineTextToggled)); - pickBlock = new GuiButton(0, 0, 0, "Auto-Swap to Pick Block: " + Utils.getColouredBoolean(ToggleCommand.swapToPickBlockToggled)); - coords = new GuiButton(0, 0, 0, "Coordinate/Angle Display: " + Utils.getColouredBoolean(ToggleCommand.coordsToggled)); - chatMaddox = new GuiButton(0, 0, 0, "Click On-Screen to Open Maddox: " + Utils.getColouredBoolean(ToggleCommand.chatMaddoxToggled)); - cakeTimer = new GuiButton(0, 0, 0, "Cake Timer: " + Utils.getColouredBoolean(ToggleCommand.cakeTimerToggled)); - skill50Display = new GuiButton(0, 0, 0, "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled)); - slayerCount = new GuiButton(0, 0, 0, "Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal)); - spiritBearAlert = new GuiButton(0, 0, 0, "Spirit Bear Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.spiritBearAlerts)); - sceptreMessages = new GuiButton(0, 0, 0, "Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); - midasStaffMessages = new GuiButton(0, 0, 0, "Midas Staff Messages: " + Utils.getColouredBoolean(ToggleCommand.midasStaffMessages)); - implosionMessages = new GuiButton(0, 0, 0, "Implosion Messages: " + Utils.getColouredBoolean(ToggleCommand.implosionMessages)); - healMessages = new GuiButton(0, 0, 0, "Heal Messages: " + Utils.getColouredBoolean(ToggleCommand.healMessages)); - cooldownMessages = new GuiButton(0, 0, 0, "Cooldown Messages: " + Utils.getColouredBoolean(ToggleCommand.cooldownMessages)); - manaMessages = new GuiButton(0, 0, 0, "Mana Messages: " + Utils.getColouredBoolean(ToggleCommand.manaMessages)); - killComboMessages = new GuiButton(0, 0, 0, "Kill Combo Messages: " + Utils.getColouredBoolean(ToggleCommand.killComboMessages)); - goldenEnch = new GuiButton(0, 0, 0, "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); - petColours = new GuiButton(0, 0, 0, "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); - expertiseLore = new GuiButton(0, 0, 0, "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); - gparty = new GuiButton(0, 0, 0, "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); - golemAlerts = new GuiButton(0, 0, 0, "Golem Spawn Alert And Timer: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); - rngesusAlert = new GuiButton(0, 0, 0, "RNGesus Alerts: " + Utils.getColouredBoolean(ToggleCommand.rngesusAlerts)); - splitFishing = new GuiButton(0, 0, 0, "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); - lowHealthNotify = new GuiButton(0, 0, 0, "Low Health Notifications: " + Utils.getColouredBoolean(ToggleCommand.lowHealthNotifyToggled)); - lividSolver = new GuiButton(0, 0, 0, "Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled)); - dungeonTimer = new GuiButton(0, 0, 0, "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); - stopSalvageStarred = new GuiButton(0, 0, 0, "Stop Salvaging Starred Items: " + Utils.getColouredBoolean(ToggleCommand.stopSalvageStarredToggled)); - watcherReadyMessage = new GuiButton(0, 0, 0, "Display Watcher Ready Message: " + Utils.getColouredBoolean(ToggleCommand.watcherReadyToggled)); - notifySlayerSlain = new GuiButton(0, 0, 0, "Notify when Slayer Slain: " + Utils.getColouredBoolean(ToggleCommand.notifySlayerSlainToggled)); - necronNotifications = new GuiButton(0, 0, 0, "Necron Phase Notifications: " + Utils.getColouredBoolean(ToggleCommand.necronNotificationsToggled)); - bonzoTimer = new GuiButton(0, 0, 0, "Bonzo's Mask Timer: " + Utils.getColouredBoolean(ToggleCommand.bonzoTimerToggled)); - autoSkillTracker = new GuiButton(0, 0, 0, "Auto Start/Stop Skill Tracker: " + Utils.getColouredBoolean(ToggleCommand.autoSkillTrackerToggled)); - melodyTooltips = new GuiButton(0, 0, 0, "Hide tooltips in Melody's Harp: " + Utils.getColouredBoolean(ToggleCommand.melodyTooltips)); - highlightArachne = new GuiButton(0, 0, 0, "Highlight Arachne: " + Utils.getColouredBoolean(ToggleCommand.highlightArachne)); - highlightSlayer = new GuiButton(0, 0, 0, "Highlight Slayer: " + Utils.getColouredBoolean(ToggleCommand.highlightSlayers)); - highlightCommissions = new GuiButton(0, 0, 0, "Highlight Commissions: " + Utils.getColouredBoolean(ToggleCommand.highlightCommissions)); + outlineText = new FeatureButton("Outline Displayed Text: " + Utils.getColouredBoolean(ToggleCommand.outlineTextToggled), "Adds bold outline to on-screen text."); + pickBlock = new FeatureButton("Auto-Swap to Pick Block: " + Utils.getColouredBoolean(ToggleCommand.swapToPickBlockToggled), "Automatically changes left clicks to middle clicks.\nHelpful when lagging."); + coords = new FeatureButton("Coordinate/Angle Display: " + Utils.getColouredBoolean(ToggleCommand.coordsToggled), "Displays coordinates and angle."); + chatMaddox = new FeatureButton("Click On-Screen to Open Maddox: " + Utils.getColouredBoolean(ToggleCommand.chatMaddoxToggled), "Open chat then click anywhere after calling Maddox to open the menu."); + cakeTimer = new FeatureButton("Cake Timer: " + Utils.getColouredBoolean(ToggleCommand.cakeTimerToggled), "Displays time until century cake buffs run out."); + skill50Display = new FeatureButton("Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled), "Display total progress to max skill level."); + slayerCount = new FeatureButton("Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal), "Counts times dropped instead of amount dropped.\nE.x. Hamster Wheels: 40 -> Hamster Wheels: 10 times."); + spiritBearAlert = new FeatureButton("Spirit Bear Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.spiritBearAlerts), "Alert when Spirit Bear spawns."); + sceptreMessages = new FeatureButton("Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages), "Turn " + EnumChatFormatting.RED + "off" + EnumChatFormatting.RESET + " to hide Spirit Sceptre messages."); + midasStaffMessages = new FeatureButton("Midas Staff Messages: " + Utils.getColouredBoolean(ToggleCommand.midasStaffMessages), "Turn " + EnumChatFormatting.RED + "off" + EnumChatFormatting.RESET + " to hide Midas Staff messages."); + implosionMessages = new FeatureButton("Implosion Messages: " + Utils.getColouredBoolean(ToggleCommand.implosionMessages), "Turn " + EnumChatFormatting.RED + "off" + EnumChatFormatting.RESET + " to hide Implosion messages."); + healMessages = new FeatureButton("Heal Messages: " + Utils.getColouredBoolean(ToggleCommand.healMessages), "Turn " + EnumChatFormatting.RED + "off" + EnumChatFormatting.RESET + " to hide healing messages."); + cooldownMessages = new FeatureButton("Cooldown Messages: " + Utils.getColouredBoolean(ToggleCommand.cooldownMessages), "Turn " + EnumChatFormatting.RED + "off" + EnumChatFormatting.RESET + " to hide cooldown messages."); + manaMessages = new FeatureButton("Mana Messages: " + Utils.getColouredBoolean(ToggleCommand.manaMessages), "Turn " + EnumChatFormatting.RED + "off" + EnumChatFormatting.RESET + " to hide out of mana messages."); + killComboMessages = new FeatureButton("Kill Combo Messages: " + Utils.getColouredBoolean(ToggleCommand.killComboMessages), "Turn " + EnumChatFormatting.RED + "off" + EnumChatFormatting.RESET + " to hide kill combo messages."); + goldenEnch = new FeatureButton("Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled), "Turns expensive enchants golden in tooltips."); + petColours = new FeatureButton("Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled), "Colors pets based on their level."); + expertiseLore = new FeatureButton("Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled), "Adds expertise kills to fishing rod tooltip."); + gparty = new FeatureButton("Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled), "Creates desktop notification on guild party."); + golemAlerts = new FeatureButton("Golem Spawn Alert And Timer: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled), "Creates alert with 20s countdown when golem is spawning."); + rngesusAlert = new FeatureButton("RNGesus Alerts: " + Utils.getColouredBoolean(ToggleCommand.rngesusAlerts), "Alerts when an RNGesus item is dropped."); + splitFishing = new FeatureButton("Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing), "Splits fishing display in half to save vertical space."); + lowHealthNotify = new FeatureButton("Low Health Notifications: " + Utils.getColouredBoolean(ToggleCommand.lowHealthNotifyToggled), "Alerts when dungeon teammate has low health."); + lividSolver = new FeatureButton("Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled), "Shows health and color of correct Livid."); + dungeonTimer = new FeatureButton("Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled), "Displays timing of certain dungeon objectives and other information."); + stopSalvageStarred = new FeatureButton("Stop Salvaging Starred Items: " + Utils.getColouredBoolean(ToggleCommand.stopSalvageStarredToggled), "Blocks salvaging starred items."); + watcherReadyMessage = new FeatureButton("Display Watcher Ready Message: " + Utils.getColouredBoolean(ToggleCommand.watcherReadyToggled), "Alerts when Watcher finishes spawning mobs."); + notifySlayerSlain = new FeatureButton("Notify when Slayer Slain: " + Utils.getColouredBoolean(ToggleCommand.notifySlayerSlainToggled), "Alerts when slayer boss has been slain."); + necronNotifications = new FeatureButton("Necron Phase Notifications: " + Utils.getColouredBoolean(ToggleCommand.necronNotificationsToggled), "Creates alert on different phases of the Necron fight."); + bonzoTimer = new FeatureButton("Bonzo's Mask Timer: " + Utils.getColouredBoolean(ToggleCommand.bonzoTimerToggled), "Displays cooldown of Bonzo Mask ability."); + autoSkillTracker = new FeatureButton("Auto Start/Stop Skill Tracker: " + Utils.getColouredBoolean(ToggleCommand.autoSkillTrackerToggled), "Automatically pauses skill tracker when opening a gui."); + melodyTooltips = new FeatureButton("Hide tooltips in Melody's Harp: " + Utils.getColouredBoolean(ToggleCommand.melodyTooltips), "Hides tooltips in Melody's Harp."); + highlightArachne = new FeatureButton("Highlight Arachne: " + Utils.getColouredBoolean(ToggleCommand.highlightArachne), "Highlights Arachne bosses."); + highlightSlayer = new FeatureButton("Highlight Slayer: " + Utils.getColouredBoolean(ToggleCommand.highlightSlayers), "Highlights Slayer bosses."); + highlightSkeletonMasters = new FeatureButton("Highlight Skeleton Masters: " + Utils.getColouredBoolean(ToggleCommand.highlightSkeletonMasters), "Highlights Skeleton Masters."); + teammatesInRadius = new FeatureButton("Display Players in 30 Block Radius: " + Utils.getColouredBoolean(ToggleCommand.teammatesInRadius), "Displays dungeon teammates in 30 block radius for tether and diversion."); + giantHP = new FeatureButton("Display Giant HP: " + Utils.getColouredBoolean(ToggleCommand.giantHP), "Displays health of Sadan's giants during F6 bossfight and F7 blood room."); + hidePetCandy = new FeatureButton("Hide Pet Candy: " + Utils.getColouredBoolean(ToggleCommand.hidePetCandy), "Hide pet candy in pet tooltips."); + highlightCommissions = new FeatureButton("Highlight Commissions: " + Utils.getColouredBoolean(ToggleCommand.highlightCommissions), "Show which commissions are completed."); + allButtons.clear(); allButtons.add(changeDisplay); allButtons.add(puzzleSolvers); allButtons.add(experimentationTableSolvers); @@ -182,6 +197,10 @@ public class DankerGui extends GuiScreen { allButtons.add(melodyTooltips); allButtons.add(highlightArachne); allButtons.add(highlightSlayer); + allButtons.add(highlightSkeletonMasters); + allButtons.add(teammatesInRadius); + allButtons.add(giantHP); + allButtons.add(hidePetCandy); allButtons.add(highlightCommissions); search.setText(initSearchText); @@ -231,6 +250,13 @@ public class DankerGui extends GuiScreen { int pageWidth = mc.fontRendererObj.getStringWidth(pageText); new TextRenderer(mc, pageText, width / 2 - pageWidth / 2, 10, 1D); + for (GuiButton button : this.buttonList) { + if (button instanceof FeatureButton && button.isMouseOver()) { + FeatureButton feature = (FeatureButton) button; + drawHoveringText(feature.hoverText, mouseX - 5, mouseY); + } + } + search.drawTextBox(); } @@ -402,6 +428,22 @@ public class DankerGui extends GuiScreen { ToggleCommand.highlightSlayers = !ToggleCommand.highlightSlayers; ConfigHandler.writeBooleanConfig("toggles", "HighlightSlayers", ToggleCommand.highlightSlayers); highlightSlayer.displayString = "Highlight Slayer: " + Utils.getColouredBoolean(ToggleCommand.highlightSlayers); + } else if (button == highlightSkeletonMasters) { + ToggleCommand.highlightSkeletonMasters = !ToggleCommand.highlightSkeletonMasters; + ConfigHandler.writeBooleanConfig("toggles", "HighlightSkeletonMasters", ToggleCommand.highlightSkeletonMasters); + highlightSkeletonMasters.displayString = "Highlight Skeleton Masters: " + Utils.getColouredBoolean(ToggleCommand.highlightSkeletonMasters); + } else if (button == teammatesInRadius) { + ToggleCommand.teammatesInRadius = !ToggleCommand.teammatesInRadius; + ConfigHandler.writeBooleanConfig("toggles", "TeammatesInRadius", ToggleCommand.teammatesInRadius); + teammatesInRadius.displayString = "Display Players in 30 Block Radius: " + Utils.getColouredBoolean(ToggleCommand.teammatesInRadius); + } else if (button == giantHP) { + ToggleCommand.giantHP = !ToggleCommand.giantHP; + ConfigHandler.writeBooleanConfig("toggles", "GiantHP", ToggleCommand.giantHP); + giantHP.displayString = "Display Giant HP: " + Utils.getColouredBoolean(ToggleCommand.giantHP); + } else if (button == hidePetCandy) { + ToggleCommand.hidePetCandy = !ToggleCommand.hidePetCandy; + ConfigHandler.writeBooleanConfig("toggles", "HidePetCandy", ToggleCommand.hidePetCandy); + hidePetCandy.displayString = "Hide Pet Candy: " + Utils.getColouredBoolean(ToggleCommand.hidePetCandy); } else if (button == highlightCommissions) { ToggleCommand.highlightCommissions = !ToggleCommand.highlightCommissions; ConfigHandler.writeBooleanConfig("toggles", "HighlightCommissions", ToggleCommand.highlightCommissions); @@ -419,6 +461,7 @@ public class DankerGui extends GuiScreen { protected void keyTyped(char typedChar, int keyCode) throws IOException { super.keyTyped(typedChar, keyCode); search.textboxKeyTyped(typedChar, keyCode); + initSearchText = search.getText(); reInit(); } diff --git a/src/main/java/me/Danker/gui/EditLocationsGui.java b/src/main/java/me/Danker/gui/EditLocationsGui.java index 3a7c94b..fed6ee9 100644 --- a/src/main/java/me/Danker/gui/EditLocationsGui.java +++ b/src/main/java/me/Danker/gui/EditLocationsGui.java @@ -29,6 +29,8 @@ public class EditLocationsGui extends GuiScreen { private LocationButton waterAnswer; private LocationButton bonzoTimer; private LocationButton golemTimer; + private LocationButton teammatesInRadius; + private LocationButton giantHP; @Override public boolean doesGuiPauseGame() { @@ -86,16 +88,30 @@ public class EditLocationsGui extends GuiScreen { 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, NoF3Coords.COORDS_COLOUR + "74 / 14 / -26 (141.1 / 6.7)", null, null); - skill50 = new LocationButton(0, MoveCommand.skill50XY[0], MoveCommand.skill50XY[1], 233 * ScaleCommand.skill50Scale, 12 * ScaleCommand.skill50Scale, ScaleCommand.skill50Scale, Skill50Display.SKILL_50_COLOUR + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", null, null); - 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, CakeTimer.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); - bonzoTimer = new LocationButton(0, MoveCommand.bonzoTimerXY[0], MoveCommand.bonzoTimerXY[1] + 5, 53 * ScaleCommand.bonzoTimerScale, 18 * ScaleCommand.bonzoTimerScale, ScaleCommand.bonzoTimerScale, BonzoMaskTimer.BONZO_COLOR + " 3m30s", null, null); - golemTimer = new LocationButton(0, MoveCommand.golemTimerXY[0], MoveCommand.golemTimerXY[1] + 5, 42 * ScaleCommand.golemTimerScale, 18 * ScaleCommand.golemTimerScale, ScaleCommand.golemTimerScale, GolemSpawningAlert.GOLEM_COLOUR + " 20s", null, null); + String teammatesInRadiusText = EnumChatFormatting.AQUA + "Teammates In Radius:\n" + + EnumChatFormatting.GREEN + "NoticeMehSenpai\n" + + EnumChatFormatting.GREEN + "DeathStreeks\n" + + EnumChatFormatting.GREEN + "Not_A_Neko\n" + + EnumChatFormatting.GREEN + "Minikloon"; + + String giantHPText = EnumChatFormatting.DARK_RED + "L.A.S.R. " + EnumChatFormatting.GREEN + "25M" + EnumChatFormatting.RED + "❤\n" + + EnumChatFormatting.RED + "Bigfoot " + EnumChatFormatting.GREEN + "25M" + EnumChatFormatting.RED + "❤\n" + + EnumChatFormatting.LIGHT_PURPLE + "Jolly Pink Giant " + EnumChatFormatting.GREEN + "25M" + EnumChatFormatting.RED + "❤\n" + + EnumChatFormatting.DARK_AQUA + "The Diamond Giant " + EnumChatFormatting.GREEN + "25M" + EnumChatFormatting.RED + "❤"; + + + 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); + coords = new LocationButton(MoveCommand.coordsXY[0], MoveCommand.coordsXY[1], ScaleCommand.coordsScale, NoF3Coords.COORDS_COLOUR + "74 / 14 / -26 (141.1 / 6.7)", null, null); + skill50 = new LocationButton(MoveCommand.skill50XY[0], MoveCommand.skill50XY[1], ScaleCommand.skill50Scale, Skill50Display.SKILL_50_COLOUR + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", null, null); + lividHP = new LocationButton(MoveCommand.lividHpXY[0], MoveCommand.lividHpXY[1], ScaleCommand.lividHpScale, EnumChatFormatting.WHITE + "﴾ Livid " + EnumChatFormatting.YELLOW + "6.9M" + EnumChatFormatting.RED + "❤ " + EnumChatFormatting.WHITE + "﴿", null, null); + cakeTimer = new LocationButton(MoveCommand.cakeTimerXY[0], MoveCommand.cakeTimerXY[1] + 5, ScaleCommand.cakeTimerScale, CakeTimer.CAKE_COLOUR + " 11h16m", null, null); + skillTracker = new LocationButton(MoveCommand.skillTrackerXY[0], MoveCommand.skillTrackerXY[1], ScaleCommand.skillTrackerScale, skillTrackerText, null, null); + waterAnswer = new LocationButton(MoveCommand.waterAnswerXY[0], MoveCommand.waterAnswerXY[1], ScaleCommand.waterAnswerScale, waterAnswerText, null, null); + bonzoTimer = new LocationButton(MoveCommand.bonzoTimerXY[0], MoveCommand.bonzoTimerXY[1] + 5, ScaleCommand.bonzoTimerScale, BonzoMaskTimer.BONZO_COLOR + " 3m30s", null, null); + 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); this.buttonList.add(coords); this.buttonList.add(dungeonTimer); @@ -107,6 +123,8 @@ public class EditLocationsGui extends GuiScreen { this.buttonList.add(display); this.buttonList.add(skill50); this.buttonList.add(golemTimer); + this.buttonList.add(teammatesInRadius); + this.buttonList.add(giantHP); } @Override @@ -204,6 +222,18 @@ public class EditLocationsGui extends GuiScreen { golemTimer.xPosition = MoveCommand.golemTimerXY[0]; golemTimer.yPosition = MoveCommand.golemTimerXY[1]; break; + case "teammatesInRadius": + MoveCommand.teammatesInRadiusXY[0] += xMoved; + MoveCommand.teammatesInRadiusXY[1] += yMoved; + teammatesInRadius.xPosition = MoveCommand.teammatesInRadiusXY[0]; + teammatesInRadius.yPosition = MoveCommand.teammatesInRadiusXY[1]; + break; + case "giantHP": + MoveCommand.giantHPXY[0] += xMoved; + MoveCommand.giantHPXY[1] += yMoved; + giantHP.xPosition = MoveCommand.giantHPXY[0]; + giantHP.yPosition = MoveCommand.giantHPXY[1]; + break; } this.buttonList.clear(); initGui(); @@ -236,6 +266,10 @@ public class EditLocationsGui extends GuiScreen { moving = "bonzoTimer"; } else if (button == golemTimer) { moving = "golemTimer"; + } else if (button == teammatesInRadius) { + moving = "teammatesInRadius"; + } else if (button == giantHP) { + moving = "giantHP"; } } } @@ -264,6 +298,10 @@ public class EditLocationsGui extends GuiScreen { ConfigHandler.writeIntConfig("locations", "bonzoTimerY", MoveCommand.bonzoTimerXY[1]); ConfigHandler.writeIntConfig("locations", "golemTimerX", MoveCommand.golemTimerXY[0]); ConfigHandler.writeIntConfig("locations", "golemTimerY", MoveCommand.golemTimerXY[1]); + ConfigHandler.writeIntConfig("locations", "teammatesInRadiusX", MoveCommand.teammatesInRadiusXY[0]); + ConfigHandler.writeIntConfig("locations", "teammatesInRadiusY", MoveCommand.teammatesInRadiusXY[1]); + ConfigHandler.writeIntConfig("locations", "giantHPX", MoveCommand.giantHPXY[0]); + ConfigHandler.writeIntConfig("locations", "giantHPY", MoveCommand.giantHPXY[1]); } } diff --git a/src/main/java/me/Danker/gui/buttons/FeatureButton.java b/src/main/java/me/Danker/gui/buttons/FeatureButton.java new file mode 100644 index 0000000..a997e09 --- /dev/null +++ b/src/main/java/me/Danker/gui/buttons/FeatureButton.java @@ -0,0 +1,17 @@ +package me.Danker.gui.buttons; + +import net.minecraft.client.gui.GuiButton; + +import java.util.Arrays; +import java.util.List; + +public class FeatureButton extends GuiButton { + + public List<String> hoverText; + + public FeatureButton(String displayString, String hoverText) { + super(0, 0, 0, displayString); + this.hoverText = Arrays.asList(hoverText.split("\n")); + } + +} diff --git a/src/main/java/me/Danker/gui/buttons/LocationButton.java b/src/main/java/me/Danker/gui/buttons/LocationButton.java index a8937fd..f328c58 100644 --- a/src/main/java/me/Danker/gui/buttons/LocationButton.java +++ b/src/main/java/me/Danker/gui/buttons/LocationButton.java @@ -13,21 +13,17 @@ public class LocationButton extends GuiButton { private String text; private String text2; private Integer text2Offset; + private int longestText; - public LocationButton(int buttonId, int x, int y, double width, double height, double scale, String text, String text2, Integer text2Offset) { - super(buttonId, x, y, text); + public LocationButton(int x, int y, double scale, String text, String text2, Integer text2Offset) { + super(0, x, y, text); this.x = x; this.y = y; - this.width = (int) width; - this.height = (int) height; this.scale = scale; this.text = text; this.text2 = text2; this.text2Offset = text2Offset; - } - - @Override - public void drawButton(Minecraft mc, int mouseX, int mouseY) { + String[] splitText; if (text2 == null) { splitText = text.split("\n"); @@ -37,16 +33,23 @@ public class LocationButton extends GuiButton { int longestText = -1; for (String s : splitText) { - int stringLength = mc.fontRendererObj.getStringWidth(s); + int stringLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth(s); if (stringLength > longestText) { longestText = stringLength; } } - + + this.longestText = longestText; + this.height = (int) ((splitText.length * 9 + 3) * scale); + this.width = (int) ((this.longestText + 3) * scale); + } + + @Override + public void drawButton(Minecraft mc, int mouseX, int mouseY) { if (text2 == null) { - drawRect(x - 2, y - 2, (int) (x + longestText * scale + 3), (int) (y + (splitText.length * 9 + 3) * scale), 0x40D3D3D3); + drawRect(x - 2, y - 2, x + width, y + height, 0x40D3D3D3); } else { - drawRect(x - 2, y - 2, (int) (x + (longestText + text2Offset) * scale + 3), (int) (y + (splitText.length * 9 + 3) * scale), 0x40D3D3D3); + drawRect(x - 2, y - 2, (int) (x + (longestText + text2Offset + 3) * scale), y + height, 0x40D3D3D3); new TextRenderer(mc, text2, (int) (x + (text2Offset * scale)), y, scale); } new TextRenderer(mc, text, x, y, scale); diff --git a/src/main/java/me/Danker/handlers/APIHandler.java b/src/main/java/me/Danker/handlers/APIHandler.java index c9460fe..66001a3 100644 --- a/src/main/java/me/Danker/handlers/APIHandler.java +++ b/src/main/java/me/Danker/handlers/APIHandler.java @@ -25,6 +25,7 @@ public class APIHandler { URL url = new URL(urlString); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); + conn.setRequestProperty("User-Agent", "Dsm/1.0"); if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); @@ -40,7 +41,7 @@ public class APIHandler { return gson.fromJson(response.toString(), JsonObject.class); } else { - if (urlString.startsWith("https://api.hypixel.net/")) { + if (urlString.startsWith("https://api.hypixel.net/") || urlString.startsWith("https://hypixel-api.senither.com")) { InputStream errorStream = conn.getErrorStream(); try (Scanner scanner = new Scanner(errorStream)) { scanner.useDelimiter("\\Z"); diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 0fe7245..ecd15f3 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -32,9 +32,7 @@ public class ConfigHandler { } public static int getInt(String category, String key) { - config = new Configuration(new File(file)); try { - config.load(); if (config.getCategory(category).containsKey(key)) { return config.get(category, key, 0).getInt(); } @@ -47,9 +45,7 @@ public class ConfigHandler { } public static double getDouble(String category, String key) { - config = new Configuration(new File(file)); try { - config.load(); if (config.getCategory(category).containsKey(key)) { return config.get(category, key, 0D).getDouble(); } @@ -62,9 +58,7 @@ public class ConfigHandler { } public static String getString(String category, String key) { - config = new Configuration(new File(file)); try { - config.load(); if (config.getCategory(category).containsKey(key)) { return config.get(category, key, "").getString(); } @@ -77,9 +71,7 @@ public class ConfigHandler { } public static boolean getBoolean(String category, String key) { - config = new Configuration(new File(file)); try { - config.load(); if (config.getCategory(category).containsKey(key)) { return config.get(category, key, false).getBoolean(); } @@ -92,9 +84,7 @@ public class ConfigHandler { } public static void writeIntConfig(String category, String key, int value) { - config = new Configuration(new File(file)); try { - config.load(); int set = config.get(category, key, value).getInt(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { @@ -105,9 +95,7 @@ public class ConfigHandler { } public static void writeDoubleConfig(String category, String key, double value) { - config = new Configuration(new File(file)); try { - config.load(); double set = config.get(category, key, value).getDouble(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { @@ -118,9 +106,7 @@ public class ConfigHandler { } public static void writeStringConfig(String category, String key, String value) { - config = new Configuration(new File(file)); try { - config.load(); String set = config.get(category, key, value).getString(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { @@ -131,9 +117,7 @@ public class ConfigHandler { } public static void writeBooleanConfig(String category, String key, boolean value) { - config = new Configuration(new File(file)); try { - config.load(); boolean set = config.get(category, key, value).getBoolean(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { @@ -144,9 +128,7 @@ public class ConfigHandler { } public static boolean hasKey(String category, String key) { - config = new Configuration(new File(file)); try { - config.load(); if (!config.hasCategory(category)) return false; return config.getCategory(category).containsKey(key); } catch (Exception ex) { @@ -158,9 +140,7 @@ public class ConfigHandler { } public static void deleteCategory(String category) { - config = new Configuration(new File(file)); try { - config.load(); if (config.hasCategory(category)) { config.removeCategory(new ConfigCategory(category)); } @@ -208,6 +188,8 @@ public class ConfigHandler { } public static void reloadConfig() { + init(); + // Toggles ToggleCommand.gpartyToggled = initBoolean("toggles", "GParty", false); ToggleCommand.coordsToggled = initBoolean("toggles", "Coords", false); @@ -229,6 +211,10 @@ public class ConfigHandler { ToggleCommand.highlightSlayers = initBoolean("toggles", "HighlightSlayers", false); ToggleCommand.highlightArachne = initBoolean("toggles", "HighlightArachne", false); ToggleCommand.highlightCommissions = initBoolean("toggles", "HighlightCommissions", false); + ToggleCommand.highlightSkeletonMasters = initBoolean("toggles", "HighlightSkeletonMasters", false); + ToggleCommand.teammatesInRadius = initBoolean("toggles", "TeammatesInRadius", false); + ToggleCommand.giantHP = initBoolean("toggles", "GiantHP", false); + ToggleCommand.hidePetCandy = initBoolean("toggles", "HidePetCandy", false); // Chat Messages ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); @@ -478,6 +464,10 @@ public class ConfigHandler { MoveCommand.bonzoTimerXY[1] = initInt("locations", "bonzoTimerY", 80); MoveCommand.golemTimerXY[0] = initInt("locations", "golemTimerX", 100); MoveCommand.golemTimerXY[1] = initInt("locations", "golemTimerY", 30); + MoveCommand.teammatesInRadiusXY[0] = initInt("locations", "teammatesInRadiusX", 80); + MoveCommand.teammatesInRadiusXY[1] = initInt("locations", "teammatesInRadiusY", 100); + MoveCommand.giantHPXY[0] = initInt("locations", "giantHPX", 80); + MoveCommand.giantHPXY[1] = initInt("locations", "giantHPY", 150); // Scales ScaleCommand.coordsScale = initDouble("scales", "coordsScale", 1); @@ -490,6 +480,8 @@ public class ConfigHandler { ScaleCommand.waterAnswerScale = initDouble("scales", "waterAnswerScale", 1); ScaleCommand.bonzoTimerScale = initDouble("scales", "bonzoTimerScale", 1); ScaleCommand.golemTimerScale = initDouble("scales", "golemTimerScale", 1); + ScaleCommand.teammatesInRadiusScale = initDouble("scales", "teammatesInRadiusScale", 1); + ScaleCommand.giantHPScale = initDouble("scales", "giantHPScale", 1); // Colours DankersSkyblockMod.MAIN_COLOUR = initString("colors", "main", EnumChatFormatting.GREEN.toString()); @@ -511,6 +503,7 @@ public class ConfigHandler { BlazeSolver.HIGHEST_BLAZE_COLOUR = initInt("colors", "blazeHighest", 0x40FF40); SlayerESP.SLAYER_COLOUR = initInt("colors", "slayerColor", 0x0000FF); ArachneESP.ARACHANE_COLOUR = initInt("colors", "arachneColor", 0x00FF00); + HighlightSkeletonMasters.SKELETON_MASTER_COLOUR = initInt("colors", "skeletonMaster", 0xFF0000); PetColours.PET_1_TO_9 = initInt("colors", "pet1To9", 0x999999); // Grey PetColours.PET_10_TO_19 = initInt("colors", "pet10To19", 0xD62440); // Red PetColours.PET_20_TO_29 = initInt("colors", "pet20To29", 0xEF5230); // Orange diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 1a24c69..d3d6325 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -30,6 +30,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.regex.Matcher; +import java.util.regex.Pattern; public class Utils { @@ -45,6 +46,7 @@ public class Utils { 1065000, 1410000, 1900000, 2500000, 3300000, 4300000, 5600000, 7200000, 9200000, 12000000, 15000000, 19000000, 24000000, 30000000, 38000000, 48000000, 60000000, 75000000, 93000000, 116250000}; static int[] expertiseKills = {50, 100, 250, 500, 1000, 2500, 5500, 10000, 15000}; + static Pattern boldPattern = Pattern.compile("(?i)\\u00A7L"); public static int getItems(String item) { Minecraft mc = Minecraft.getMinecraft(); @@ -145,17 +147,22 @@ public class Utils { } public static void checkForDungeons() { - if (inSkyblock) { - List<String> scoreboard = ScoreboardHandler.getSidebarLines(); - for (String s : scoreboard) { - String sCleaned = ScoreboardHandler.cleanSB(s); - if (sCleaned.contains("The Catacombs")) { - inDungeons = true; - return; - } + if (inSkyblock) { + if (isInScoreboard("The Catacombs")) { + inDungeons = true; + return; } } - inDungeons = false; + inDungeons = false; + } + + public static boolean isInScoreboard(String text) { + List<String> scoreboard = ScoreboardHandler.getSidebarLines(); + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains(text)) return true; + } + return false; } public static String capitalizeString(String string) { @@ -533,5 +540,13 @@ public class Utils { return null; } } + + public static boolean isRealPlayer(EntityPlayer player) { + return player.getUniqueID().version() == 4 && !player.isPlayerSleeping(); + } + + public static String removeBold(String text) { + return boldPattern.matcher(text).replaceAll(""); + } } |