diff options
Diffstat (limited to 'src/main/java')
33 files changed, 4090 insertions, 2753 deletions
diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index bada8b8..1cc0939 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -12,15 +12,16 @@ import java.util.Locale; import java.util.Map; import java.util.regex.Pattern; +import org.apache.commons.lang3.time.StopWatch; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; import com.google.gson.JsonObject; import me.Danker.commands.ArmourCommand; import me.Danker.commands.BankCommand; import me.Danker.commands.BlockSlayerCommand; -import me.Danker.commands.ChatMaddoxCommand; import me.Danker.commands.DHelpCommand; import me.Danker.commands.DankerGuiCommand; import me.Danker.commands.DisplayCommand; @@ -36,6 +37,7 @@ import me.Danker.commands.ReloadConfigCommand; import me.Danker.commands.ResetLootCommand; import me.Danker.commands.ScaleCommand; import me.Danker.commands.SetkeyCommand; +import me.Danker.commands.SkillTrackerCommand; import me.Danker.commands.SkillsCommand; import me.Danker.commands.SkyblockPlayersCommand; import me.Danker.commands.SlayerCommand; @@ -45,6 +47,7 @@ import me.Danker.gui.DisplayGui; import me.Danker.gui.EditLocationsGui; import me.Danker.gui.OnlySlayerGui; import me.Danker.gui.PuzzleSolversGui; +import me.Danker.gui.SkillTrackerGui; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.PacketHandler; @@ -54,6 +57,8 @@ import me.Danker.utils.Utils; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiChat; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; @@ -73,8 +78,10 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.StringUtils; import net.minecraft.util.Vec3; +import net.minecraft.world.World; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.GuiScreenEvent; @@ -87,7 +94,6 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.client.registry.ClientRegistry; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -97,8 +103,8 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; -import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerChangedDimensionEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent; import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; @@ -106,7 +112,7 @@ import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; public class TheMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.8.1"; + public static final String VERSION = "1.8.2"; static double checkItemsNow = 0; static double itemsChecked = 0; @@ -121,25 +127,34 @@ public class TheMod public static boolean showSkill = false; public static String skillText = ""; static int tickAmount = 1; - public static String lastMaddoxCommand = "/cb placeholdervalue"; - static KeyBinding[] keyBindings = new KeyBinding[1]; + static String lastMaddoxCommand = "/cb placeholder"; + static double lastMaddoxTime = 0; + static KeyBinding[] keyBindings = new KeyBinding[2]; static int lastMouse = -1; static boolean usingLabymod = false; public static String guiToOpen = null; + static boolean foundLivid = false; + static Entity livid = null; + public static double cakeTime; + + public static final ResourceLocation CAKE_ICON = new ResourceLocation("dsm", "icons/cake.png"); + 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."}; - static Map<String, String> triviaSolutions = new HashMap<String, String>(); + "My chest doesn't have the reward. We are all telling the truth", "My chest has the reward and I'm telling the truth", + "The reward isn't in any of our chests", "Both of them are telling the truth."}; + static Map<String, String[]> triviaSolutions = new HashMap<String, String[]>(); + static String[] triviaAnswers = null; static Entity highestBlaze = null; static Entity lowestBlaze = null; + static boolean lowToHigh = false; // Among Us colours - static int[] creeperLineColours = {0x50EF39, 0xC51111, 0x132ED1, 0x117F2D, 0xED54BA, 0xEF7D0D, 0xF5F557, 0xD6E0F0, 0x6B2FBB, 0x39FEDC}; + static final int[] CREEPER_COLOURS = {0x50EF39, 0xC51111, 0x132ED1, 0x117F2D, 0xED54BA, 0xEF7D0D, 0xF5F557, 0xD6E0F0, 0x6B2FBB, 0x39FEDC}; static boolean drawCreeperLines = false; static Vec3 creeperLocation = new Vec3(0, 0, 0); static List<Vec3[]> creeperLines = new ArrayList<Vec3[]>(); - static boolean foundLivid = false; - static Entity livid = null; - + static boolean prevInWaterRoom = false; + static boolean inWaterRoom = false; + static double dungeonStartTime = 0; static double bloodOpenTime = 0; static double watcherClearTime = 0; @@ -148,14 +163,46 @@ public class TheMod static int dungeonDeaths = 0; static int puzzleFails = 0; + static String lastSkill = "Farming"; + public static boolean showSkillTracker; + public static StopWatch skillStopwatch = new StopWatch(); + static double farmingXP = 0; + public static double farmingXPGained = 0; + static double miningXP = 0; + public static double miningXPGained = 0; + static double combatXP = 0; + public static double combatXPGained = 0; + static double foragingXP = 0; + public static double foragingXPGained = 0; + static double fishingXP = 0; + public static double fishingXPGained = 0; + static double enchantingXP = 0; + public static double enchantingXPGained = 0; + static double alchemyXP = 0; + public static double alchemyXPGained = 0; + + public static String MAIN_COLOUR; + public static String SECONDARY_COLOUR; + public static String ERROR_COLOUR; + public static String DELIMITER_COLOUR; + public static String TYPE_COLOUR; + public static String VALUE_COLOUR; + public static String SKILL_AVERAGE_COLOUR; + public static String ANSWER_COLOUR; + public static String SKILL_50_COLOUR; + public static String COORDS_COLOUR; + public static String CAKE_COLOUR; + public static String SKILL_TRACKER_COLOUR; + public static String TRIVIA_WRONG_ANSWER_COLOUR; + public static int LOWEST_BLAZE_COLOUR; + public static int HIGHEST_BLAZE_COLOUR; + @EventHandler public void init(FMLInitializationEvent event) { - FMLCommonHandler.instance().bus().register(this); MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new PacketHandler()); - final ConfigHandler cf = new ConfigHandler(); - cf.reloadConfig(); + ConfigHandler.reloadConfig(); // For golden enchants t6Enchants.put("9Angler VI", "6Angler VI"); @@ -191,45 +238,48 @@ public class TheMod t6Enchants.put("9Thunderlord VI", "6Thunderlord VI"); t6Enchants.put("9Vampirism VI", "6Vampirism VI"); - triviaSolutions.put("What is the status of The Watcher?", "Stalker"); - triviaSolutions.put("What is the status of Bonzo?", "New Necromancer"); - triviaSolutions.put("What is the status of Scarf?", "Apprentice Necromancer"); - triviaSolutions.put("What is the status of The Professor?", "Professor"); - triviaSolutions.put("What is the status of Thorn?", "Shaman Necromancer"); - triviaSolutions.put("What is the status of Livid?", "Master Necromancer"); - triviaSolutions.put("What is the status of Sadan?", "Necromancer Lord"); - triviaSolutions.put("What is the status of Maxor?", "Young Wither"); - triviaSolutions.put("What is the status of Goldor?", "Wither Soldier"); - triviaSolutions.put("What is the status of Storm?", "Elementalist"); - triviaSolutions.put("What is the status of Necron?", "Wither Lord"); - triviaSolutions.put("How many total Fairy Souls are there?", "209 Fairy Souls"); - triviaSolutions.put("How many Fairy Souls are there in Spider's Den?", "17 Fairy Souls"); - triviaSolutions.put("How many Fairy Souls are there in The End?", "12 Fairy Souls"); - triviaSolutions.put("How many Fairy Souls are there in The Barn?", "7 Fairy Souls"); - triviaSolutions.put("How many Fairy Souls are there in Mushroom Desert?", "8 Fairy Souls"); - triviaSolutions.put("How many Fairy Souls are there in Blazing Fortress?", "19 Fairy Souls"); - triviaSolutions.put("How many Fairy Souls are there in The Park?", "11 Fairy Souls"); - triviaSolutions.put("How many Fairy Souls are there in Jerry's Workshop?", "5 Fairy Souls"); - triviaSolutions.put("How many Fairy Souls are there in Hub?", "79 Fairy Souls"); - triviaSolutions.put("How many Fairy Souls are there in The Hub?", "79 Fairy Souls"); - triviaSolutions.put("How many Fairy Souls are there in Deep Caverns?", "21 Fairy Souls"); - triviaSolutions.put("How many Fairy Souls are there in Gold Mine?", "12 Fairy Souls"); - triviaSolutions.put("How many Fairy Souls are there in Dungeon Hub?", "7 Fairy Souls"); - triviaSolutions.put("Which brother is on the Spider's Den?", "Rick"); - triviaSolutions.put("What is the name of Rick's brother?", "Pat"); - triviaSolutions.put("What is the name of the Painter in the Hub?", "Marco"); - triviaSolutions.put("What is the name of the person that upgrades pets?", "Kat"); - triviaSolutions.put("What is the name of the lady of the Nether?", "Elle"); - triviaSolutions.put("Which villager in the Village gives you a Rogue Sword?", "Jamie"); - triviaSolutions.put("How many unique minions are there?", "52 Minions"); - triviaSolutions.put("Which of these enemies does not spawn in the Spider's Den?", "Zombie Spider OR Cave Spider OR Broodfather OR Wither Skeleton"); - triviaSolutions.put("Which of these monsters only spawns at night?", "Zombie Villager OR Ghast"); - triviaSolutions.put("Which of these is not a dragon in The End?", "Zoomer Dragon OR Weak Dragon OR Stonk Dragon OR Holy Dragon OR Boomer Dragon"); + 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"}); + triviaSolutions.put("What is the status of The Professor?", new String[]{"Professor"}); + triviaSolutions.put("What is the status of Thorn?", new String[]{"Shaman Necromancer"}); + triviaSolutions.put("What is the status of Livid?", new String[]{"Master Necromancer"}); + triviaSolutions.put("What is the status of Sadan?", new String[]{"Necromancer Lord"}); + triviaSolutions.put("What is the status of Maxor?", new String[]{"Young Wither"}); + 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[]{"209 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Spider's Den?", new String[]{"17 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 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"}); + triviaSolutions.put("How many Fairy Souls are there in Hub?", new String[]{"79 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in The Hub?", new String[]{"79 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Deep Caverns?", new String[]{"21 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Gold Mine?", new String[]{"12 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Dungeon Hub?", new String[]{"7 Fairy Souls"}); + triviaSolutions.put("Which brother is on the Spider's Den?", new String[]{"Rick"}); + triviaSolutions.put("What is the name of Rick's brother?", new String[]{"Pat"}); + triviaSolutions.put("What is the name of the Painter in the Hub?", new String[]{"Marco"}); + triviaSolutions.put("What is the name of the person that upgrades pets?", new String[]{"Kat"}); + triviaSolutions.put("What is the name of the lady of the Nether?", new String[]{"Elle"}); + triviaSolutions.put("Which villager in the Village gives you a Rogue Sword?", new String[]{"Jamie"}); + triviaSolutions.put("How many unique minions are there?", new String[]{"52 Minions"}); + triviaSolutions.put("Which of these enemies does not spawn in the Spider's Den?", new String[]{"Zombie Spider", "Cave Spider", "Wither Skeleton", + "Dashing Spooder", "Broodfather", "Night Spider"}); + triviaSolutions.put("Which of these monsters only spawns at night?", new String[]{"Zombie Villager", "Ghast"}); + triviaSolutions.put("Which of these is not a dragon in The End?", new String[]{"Zoomer Dragon", "Weak Dragon", "Stonk Dragon", "Holy Dragon", "Boomer Dragon", + "Booger Dragon", "Older Dragon", "Elder Dragon", "Stable Dragon", "Professor Dragon"}); String patternString = "(" + String.join("|", t6Enchants.keySet()) + ")"; pattern = Pattern.compile(patternString); keyBindings[0] = new KeyBinding("Open Maddox Menu", Keyboard.KEY_M, "Danker's Skyblock Mod"); + keyBindings[1] = new KeyBinding("Start/Stop Skill Tracker", Keyboard.KEY_NUMPAD5, "Danker's Skyblock Mod"); for (int i = 0; i < keyBindings.length; i++) { ClientRegistry.registerKeyBinding(keyBindings[i]); @@ -255,12 +305,12 @@ public class TheMod ClientCommandHandler.instance.registerCommand(new ImportFishingCommand()); ClientCommandHandler.instance.registerCommand(new ResetLootCommand()); ClientCommandHandler.instance.registerCommand(new ScaleCommand()); - ClientCommandHandler.instance.registerCommand(new ChatMaddoxCommand()); ClientCommandHandler.instance.registerCommand(new SkyblockPlayersCommand()); ClientCommandHandler.instance.registerCommand(new BlockSlayerCommand()); ClientCommandHandler.instance.registerCommand(new DungeonsCommand()); ClientCommandHandler.instance.registerCommand(new LobbySkillsCommand()); - ClientCommandHandler.instance.registerCommand(new DankerGuiCommand()); + ClientCommandHandler.instance.registerCommand(new DankerGuiCommand()); + ClientCommandHandler.instance.registerCommand(new SkillTrackerCommand()); } @EventHandler @@ -277,11 +327,10 @@ public class TheMod // MULTI THREAD DRIFTING new Thread(() -> { - APIHandler ah = new APIHandler(); EntityPlayer player = Minecraft.getMinecraft().thePlayer; System.err.println("Checking for updates..."); - JsonObject latestRelease = ah.getResponse("https://api.github.com/repos/bowser0000/SkyblockMod/releases/latest"); + JsonObject latestRelease = APIHandler.getResponse("https://api.github.com/repos/bowser0000/SkyblockMod/releases/latest"); String latestTag = latestRelease.get("tag_name").getAsString(); DefaultArtifactVersion currentVersion = new DefaultArtifactVersion(VERSION); @@ -298,7 +347,7 @@ public class TheMod } catch (InterruptedException ex) { System.err.println(ex); } - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + MODID + " is outdated. Please update to " + latestTag + ".\n").appendSibling(update)); + player.addChatMessage(new ChatComponentText(ERROR_COLOUR + MODID + " is outdated. Please update to " + latestTag + ".\n").appendSibling(update)); } }).start(); } @@ -313,8 +362,7 @@ public class TheMod // It randomly broke, so I had to make it the highest priority @SubscribeEvent(priority = EventPriority.HIGHEST) public void onChat(ClientChatReceivedEvent event) { - final ToggleCommand tc = new ToggleCommand(); - String message = event.message.getUnformattedText(); + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); if (!Utils.inSkyblock) return; @@ -322,38 +370,114 @@ public class TheMod if (event.type == 2) { String[] actionBarSections = event.message.getUnformattedText().split(" {3,}"); for (String section : actionBarSections) { - if (tc.skill50DisplayToggled) { - if (section.contains("+") && section.contains("/") && section.contains("(")) { - if (section.contains("Runecrafting")) return; - + if (section.contains("+") && section.contains("/") && section.contains("(")) { + if (!section.contains("Runecrafting") && !section.contains("Carpentry")) { + int limit = section.contains("Farming") ? 60 : 50; + double currentXP = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); + int previousXP = Utils.getPastXpEarned(Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")), limit); + double totalXP = currentXP + previousXP; + double xpGained = Double.parseDouble(section.substring(section.indexOf("+") + 1, section.indexOf(" ")).replace(",", "")); + String skill = section.substring(section.indexOf(" ") + 1, section.lastIndexOf(" ")); + switch (skill) { + case "Farming": + lastSkill = "Farming"; + if (farmingXP == 0) { + farmingXP = totalXP; + } else { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) farmingXPGained += totalXP - farmingXP; + farmingXP = totalXP; + } + break; + case "Mining": + lastSkill = "Mining"; + if (miningXP == 0) { + miningXP = totalXP; + } else { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) miningXPGained += totalXP - miningXP; + miningXP = totalXP; + } + break; + case "Combat": + lastSkill = "Combat"; + if (combatXP == 0) { + combatXP = totalXP; + } else { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) combatXPGained += totalXP - combatXP; + combatXP = totalXP; + } + break; + case "Foraging": + lastSkill = "Foraging"; + if (foragingXP == 0) { + foragingXP = totalXP; + } else { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) foragingXPGained += totalXP - foragingXP; + foragingXP = totalXP; + } + break; + case "Fishing": + lastSkill = "Fishing"; + if (fishingXP == 0) { + fishingXP = totalXP; + } else { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) fishingXPGained += totalXP - fishingXP; + fishingXP = totalXP; + } + break; + case "Enchanting": + lastSkill = "Enchanting"; + if (enchantingXP == 0) { + enchantingXP = totalXP; + } else { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) enchantingXPGained += totalXP - enchantingXP; + enchantingXP = totalXP; + } + break; + case "Alchemy": + lastSkill = "Alchemy"; + if (alchemyXP == 0) { + alchemyXP = totalXP; + } else { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) alchemyXPGained += totalXP - alchemyXP; + alchemyXP = totalXP; + } + break; + default: + System.err.println("Unknown skill."); + } + } + + if (ToggleCommand.skill50DisplayToggled && !section.contains("Runecrafting")) { String xpGained = section.substring(section.indexOf("+"), section.indexOf("(") - 1); - double currentXp = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replaceAll(",", "")); - int previousXp = Utils.getPastXpEarned(Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", ""))); - double percentage = (double) Math.floor(((currentXp + previousXp) / 55172425) * 10000D) / 100D; + double currentXp = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); + int limit; + int totalXp; + if (section.contains("Farming")) { + limit = 60; + totalXp = 111672425; + } else { + limit = 50; + totalXp = 55172425; + } + int previousXp = Utils.getPastXpEarned(Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")), limit); + double percentage = (double) Math.floor(((currentXp + previousXp) / totalXp) * 10000D) / 100D; + NumberFormat nf = NumberFormat.getNumberInstance(Locale.US); skillTimer = SKILL_TIME; showSkill = true; - skillText = EnumChatFormatting.AQUA + xpGained + " (" + NumberFormat.getNumberInstance(Locale.US).format(currentXp + previousXp) + "/55,172,425) " + percentage + "%"; + skillText = SKILL_50_COLOUR + xpGained + " (" + nf.format(currentXp + previousXp) + "/" + nf.format(totalXp) + ") " + percentage + "%"; } } } return; } - // Replace chat messages with Maddox command - List<IChatComponent> chatSiblings = event.message.getSiblings(); - for (IChatComponent sibling : chatSiblings) { - if (sibling.getChatStyle().getChatClickEvent() == null) { - sibling.setChatStyle(sibling.getChatStyle().setChatClickEvent(new ClickEvent(Action.RUN_COMMAND, "/dmodopenmaddoxmenu"))); - } - } - // Dungeon chat spoken by an NPC, containing : if (ToggleCommand.threeManToggled && Utils.inDungeons && message.contains("[NPC]")) { for (String solution : riddleSolutions) { if (message.contains(solution)) { String npcName = message.substring(message.indexOf("]") + 2, message.indexOf(":")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_GREEN + "" + EnumChatFormatting.BOLD + npcName + EnumChatFormatting.GREEN + " has the blessing.")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(ANSWER_COLOUR + EnumChatFormatting.BOLD + StringUtils.stripControlCodes(npcName) + MAIN_COLOUR + " has the blessing.")); break; } } @@ -368,16 +492,49 @@ public class TheMod if (message.contains(":")) return; + // Spirit Sceptre + if (!ToggleCommand.sceptreMessages && message.contains("Your Spirit Sceptre hit ")) { + event.setCanceled(true); + return; + } + // Midas Staff + if (!ToggleCommand.midasStaffMessages && message.contains("Your Molten Wave hit ")) { + event.setCanceled(true); + return; + } + // Heals + if (!ToggleCommand.healMessages && message.contains(" health!") && (message.contains("You healed ") || message.contains(" healed you for "))) { + event.setCanceled(true); + return; + } + if (ToggleCommand.oruoToggled && Utils.inDungeons) { + // Don't set every answer to wrong with this question + if (message.contains("What SkyBlock year is it?")) triviaAnswers = null; + for (String question : triviaSolutions.keySet()) { if (message.contains(question)) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Answer: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + triviaSolutions.get(question))); + triviaAnswers = triviaSolutions.get(question); 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; + } + if (!isSolution) { + char letter = message.charAt(5); + String option = message.substring(6, message.length()); + event.message = new ChatComponentText(" " + EnumChatFormatting.GOLD + letter + TRIVIA_WRONG_ANSWER_COLOUR + option); + return; + } + } } - if (tc.gpartyToggled) { + if (ToggleCommand.gpartyToggled) { if (message.contains(" has invited all members of ")) { try { final SystemTray tray = SystemTray.getSystemTray(); @@ -394,14 +551,17 @@ public class TheMod } } - if (tc.golemAlertToggled) { + if (ToggleCommand.golemAlertToggled) { if (message.contains("The ground begins to shake as an Endstone Protector rises from below!")) { Utils.createTitle(EnumChatFormatting.RED + "GOLEM SPAWNING!", 3); } } - final LootCommand lc = new LootCommand(); - final ConfigHandler cf = new ConfigHandler(); + if (message.contains("Yum! You gain +") && message.contains(" for 48 hours!")) { + cakeTime = System.currentTimeMillis() / 1000 + 172800; // Add 48 hours + ConfigHandler.writeDoubleConfig("misc", "cakeTime", cakeTime); + } + boolean wolfRNG = false; boolean spiderRNG = false; boolean zombieRNG = false; @@ -412,304 +572,303 @@ public class TheMod for (String s : scoreboard) { String sCleaned = ScoreboardHandler.cleanSB(s); if (sCleaned.contains("Sven Packmaster")) { - lc.wolfBooks++; - cf.writeIntConfig("wolf", "book", lc.wolfBooks); + LootCommand.wolfBooks++; + ConfigHandler.writeIntConfig("wolf", "book", LootCommand.wolfBooks); } else if (sCleaned.contains("Tarantula Broodfather")) { - lc.spiderBooks++; - cf.writeIntConfig("spider", "book", lc.spiderBooks); + LootCommand.spiderBooks++; + ConfigHandler.writeIntConfig("spider", "book", LootCommand.spiderBooks); } else if (sCleaned.contains("Revenant Horror")) { - lc.zombieBooks++; - cf.writeIntConfig("zombie", "book", lc.zombieBooks); + LootCommand.zombieBooks++; + ConfigHandler.writeIntConfig("zombie", "book", LootCommand.zombieBooks); } } } // Wolf if (message.contains("Talk to Maddox to claim your Wolf Slayer XP!")) { - lc.wolfSvens++; - lc.wolfSvensSession++; - if (lc.wolfBosses != -1) { - lc.wolfBosses++; + LootCommand.wolfSvens++; + LootCommand.wolfSvensSession++; + if (LootCommand.wolfBosses != -1) { + LootCommand.wolfBosses++; } - if (lc.wolfBossesSession != -1) { - lc.wolfBossesSession++; + if (LootCommand.wolfBossesSession != -1) { + LootCommand.wolfBossesSession++; } - cf.writeIntConfig("wolf", "svens", lc.wolfSvens); - cf.writeIntConfig("wolf", "bossRNG", lc.wolfBosses); + ConfigHandler.writeIntConfig("wolf", "svens", LootCommand.wolfSvens); + ConfigHandler.writeIntConfig("wolf", "bossRNG", LootCommand.wolfBosses); } else if (message.contains("RARE DROP! (Hamster Wheel)")) { - lc.wolfWheelsDrops++; - lc.wolfWheelsDropsSession++; - cf.writeIntConfig("wolf", "wheelDrops", lc.wolfWheelsDrops); + LootCommand.wolfWheelsDrops++; + LootCommand.wolfWheelsDropsSession++; + ConfigHandler.writeIntConfig("wolf", "wheelDrops", LootCommand.wolfWheelsDrops); } else if (message.contains("VERY RARE DROP! (") && message.contains(" Spirit Rune I)")) { // Removing the unicode here *should* fix rune drops not counting - lc.wolfSpirits++; - lc.wolfSpiritsSession++; - cf.writeIntConfig("wolf", "spirit", lc.wolfSpirits); + LootCommand.wolfSpirits++; + LootCommand.wolfSpiritsSession++; + ConfigHandler.writeIntConfig("wolf", "spirit", LootCommand.wolfSpirits); } else if (message.contains("CRAZY RARE DROP! (Red Claw Egg)")) { wolfRNG = true; - lc.wolfEggs++; - lc.wolfEggsSession++; - cf.writeIntConfig("wolf", "egg", lc.wolfEggs); - if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_RED + "RED CLAW EGG!", 3); + LootCommand.wolfEggs++; + LootCommand.wolfEggsSession++; + ConfigHandler.writeIntConfig("wolf", "egg", LootCommand.wolfEggs); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_RED + "RED CLAW EGG!", 3); } else if (message.contains("CRAZY RARE DROP! (") && message.contains(" Couture Rune I)")) { wolfRNG = true; - lc.wolfCoutures++; - lc.wolfCouturesSession++; - cf.writeIntConfig("wolf", "couture", lc.wolfCoutures); - if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "COUTURE RUNE!", 3); + LootCommand.wolfCoutures++; + LootCommand.wolfCouturesSession++; + ConfigHandler.writeIntConfig("wolf", "couture", LootCommand.wolfCoutures); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "COUTURE RUNE!", 3); } else if (message.contains("CRAZY RARE DROP! (Grizzly Bait)") || message.contains("CRAZY RARE DROP! (Rename Me)")) { // How did Skyblock devs even manage to make this item Rename Me wolfRNG = true; - lc.wolfBaits++; - lc.wolfBaitsSession++; - cf.writeIntConfig("wolf", "bait", lc.wolfBaits); - if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.AQUA + "GRIZZLY BAIT!", 3); + LootCommand.wolfBaits++; + LootCommand.wolfBaitsSession++; |
