From c19fd41b46538b901c8caf6f380f71e82e665dd0 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Thu, 9 Jul 2020 22:20:07 -0400 Subject: Add Slayer tracker No tracker for token items and 20% drops yet, will come soon. --- me/Danker/GetkeyCommand.java | 2 +- me/Danker/LootCommand.java | 180 +++++++++++++++++++++++++ me/Danker/ScoreboardHandler.java | 60 +++++++++ me/Danker/TextRenderer.java | 10 ++ me/Danker/TheMod.java | 276 ++++++++++++++++++++++++++++++++++++--- me/Danker/ToggleCommand.java | 2 +- 6 files changed, 508 insertions(+), 22 deletions(-) create mode 100644 me/Danker/LootCommand.java create mode 100644 me/Danker/ScoreboardHandler.java create mode 100644 me/Danker/TextRenderer.java (limited to 'me') diff --git a/me/Danker/GetkeyCommand.java b/me/Danker/GetkeyCommand.java index 60c5eb8..fcbe133 100644 --- a/me/Danker/GetkeyCommand.java +++ b/me/Danker/GetkeyCommand.java @@ -30,7 +30,7 @@ public class GetkeyCommand extends CommandBase implements ICommand { final ConfigHandler cf = new ConfigHandler(); if (cf.getString("api", "APIKey").equals("")) { - player.addChatMessage(new ChatComponentText("API key not set. Get a new one by doing /api new.")); + player.addChatMessage(new ChatComponentText("API key not set. Set your API key using /setkey.")); } else { player.addChatMessage(new ChatComponentText("Your set API key is " + cf.getString("api", "APIKey"))); } diff --git a/me/Danker/LootCommand.java b/me/Danker/LootCommand.java new file mode 100644 index 0000000..f4970ff --- /dev/null +++ b/me/Danker/LootCommand.java @@ -0,0 +1,180 @@ +package me.Danker; + +import java.util.List; + +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.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; + +public class LootCommand extends CommandBase { + // Wolf + public static int wolfSvens; + public static int wolfSpirits; + public static int wolfBooks; + public static int wolfEggs; + public static int wolfCoutures; + public static int wolfBaits; + public static int wolfFluxes; + public static int wolfTime; + public static int wolfBosses; + // Spider + public static int spiderTarantulas; + public static int spiderBites; + public static int spiderCatalysts; + public static int spiderBooks; + public static int spiderSwatters; + public static int spiderTalismans; + public static int spiderMosquitos; + public static int spiderTime; + public static int spiderBosses; + // Zombie + public static int zombieRevs; + public static int zombiePestilences; + public static int zombieUndeadCatas; + public static int zombieBooks; + public static int zombieBeheadeds; + public static int zombieRevCatas; + public static int zombieSnakes; + public static int zombieScythes; + public static int zombieTime; + public static int zombieBosses; + + public String getTimeBetween(int timeOne, int timeTwo) { + int secondsBetween = timeTwo - timeOne; + + String timeFormatted = ""; + int days; + int hours; + int minutes; + int seconds; + + if (secondsBetween > 86400) { + // More than 1d, display #d#h + days = secondsBetween / 86400; + hours = secondsBetween % 86400 / 3600; + timeFormatted = days + "d" + hours + "h"; + } else if (secondsBetween > 3600) { + // More than 1h, display #h#m + hours = secondsBetween / 3600; + minutes = secondsBetween % 3600 / 60; + timeFormatted = hours + "h" + minutes + "m"; + } else { + // Display #m#s + minutes = secondsBetween / 60; + seconds = secondsBetween % 60; + timeFormatted = minutes + "m" + seconds + "s"; + } + + return timeFormatted; + } + + @Override + public String getCommandName() { + return "loot"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return getCommandName() + " [wolf/spider/zombie]"; + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } + + @Override + public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { + final EntityPlayer player = (EntityPlayer)arg0; + + if (arg1.length == 0) { + player.addChatMessage(new ChatComponentText("Usage: /loot [wolf/spider/zombie]")); + return; + } + + int timeNow = (int) System.currentTimeMillis() / 1000; + String timeBetween; + String bossesBetween; + if (arg1[0].equalsIgnoreCase("wolf")) { + if (wolfTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = getTimeBetween(wolfTime, timeNow); + } + if (wolfBosses == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = Integer.toString(wolfBosses); + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.DARK_AQUA + "" + EnumChatFormatting.BOLD + " Sven Loot Summary:\n" + + EnumChatFormatting.GOLD + " Svens Killed: " + wolfSvens + "\n" + + EnumChatFormatting.AQUA + " Spirit Runes: " + wolfSpirits + "\n" + + EnumChatFormatting.WHITE + " Critical VI Books: " + wolfBooks + "\n" + + EnumChatFormatting.DARK_RED + " Red Claw Eggs: " + wolfEggs + "\n" + + EnumChatFormatting.GOLD + " Couture Runes: " + wolfCoutures + "\n" + + EnumChatFormatting.AQUA + " Grizzly Baits: " + wolfBaits + "\n" + + EnumChatFormatting.DARK_PURPLE + " Overfluxes: " + wolfFluxes + "\n" + + EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + + EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + " -------------------")); + } else if (arg1[0].equalsIgnoreCase("spider")) { + if (spiderTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = getTimeBetween(spiderTime, timeNow); + } + if (spiderBosses == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = Integer.toString(spiderBosses); + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + " Spider Loot Summary:\n" + + EnumChatFormatting.GOLD + " Tarantulas Killed: " + spiderTarantulas + "\n" + + EnumChatFormatting.DARK_GRAY + " Bite Runes: " + spiderBites + "\n" + + EnumChatFormatting.WHITE + " Bane VI Books: " + spiderBooks + "\n" + + EnumChatFormatting.AQUA + " Spider Catalysts: " + spiderCatalysts + "\n" + + EnumChatFormatting.DARK_PURPLE + " Tarantula Talismans: " + spiderTalismans + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Fly Swatters: " + spiderSwatters + "\n" + + EnumChatFormatting.GOLD + " Digested Mosquitos: " + spiderMosquitos + "\n" + + EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + + EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + " -------------------")); + } else if (arg1[0].equalsIgnoreCase("zombie")) { + if (zombieTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = getTimeBetween(zombieTime, timeNow); + } + if (zombieBosses == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = Integer.toString(zombieBosses); + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.DARK_GREEN + "" + EnumChatFormatting.BOLD + " Zombie Loot Summary:\n" + + EnumChatFormatting.GOLD + " Revs Killed: " + zombieRevs + "\n" + + EnumChatFormatting.DARK_GREEN + " Pestilence Runes: " + zombiePestilences + "\n" + + EnumChatFormatting.WHITE + " Smite VI Books: " + zombieBooks + "\n" + + EnumChatFormatting.AQUA + " Undead Catalysts: " + zombieUndeadCatas + "\n" + + EnumChatFormatting.DARK_PURPLE + " Beheaded Horrors: " + zombieBeheadeds + "\n" + + EnumChatFormatting.RED + " Revenant Catalysts: " + zombieRevCatas + "\n" + + EnumChatFormatting.DARK_GREEN + " Snake Runes: " + zombieSnakes + "\n" + + EnumChatFormatting.GOLD + " Scythe Blades: " + zombieScythes + "\n" + + EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + + EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + " -------------------")); + } else { + player.addChatMessage(new ChatComponentText("Usage: /loot [wolf/spider/zombie]")); + } + + } + +} diff --git a/me/Danker/ScoreboardHandler.java b/me/Danker/ScoreboardHandler.java new file mode 100644 index 0000000..4198a82 --- /dev/null +++ b/me/Danker/ScoreboardHandler.java @@ -0,0 +1,60 @@ +package me.Danker; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; + +import net.minecraft.client.Minecraft; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.util.StringUtils; + +public class ScoreboardHandler { + + public static String cleanSB(String scoreboard) { + char[] nvString = StringUtils.stripControlCodes(scoreboard).toCharArray(); + StringBuilder cleaned = new StringBuilder(); + + for (char c : nvString) { + if ((int) c > 20 && (int) c < 127) { + cleaned.append(c); + } + } + + return cleaned.toString(); + } + + public static List getSidebarLines() { + List lines = new ArrayList<>(); + Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard(); + if (scoreboard == null) return lines; + + ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); + if (objective == null) return lines; + + Collection scores = scoreboard.getSortedScores(objective); + List list = Lists.newArrayList(scores.stream() + .filter(input -> input != null && input.getPlayerName() != null && !input.getPlayerName() + .startsWith("#")) + .collect(Collectors.toList())); + + if (list.size() > 15) { + scores = Lists.newArrayList(Iterables.skip(list, scores.size() - 15)); + } else { + scores = list; + } + + for (Score score : scores) { + ScorePlayerTeam team = scoreboard.getPlayersTeam(score.getPlayerName()); + lines.add(ScorePlayerTeam.formatPlayerName(team, score.getPlayerName())); + } + + return lines; + } +} diff --git a/me/Danker/TextRenderer.java b/me/Danker/TextRenderer.java new file mode 100644 index 0000000..e8205bd --- /dev/null +++ b/me/Danker/TextRenderer.java @@ -0,0 +1,10 @@ +package me.Danker; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; + +public class TextRenderer extends Gui { + public TextRenderer(Minecraft mc, String text, int x, int y, int colour) { + drawString(mc.fontRendererObj, text, x, y, colour); + } +} diff --git a/me/Danker/TheMod.java b/me/Danker/TheMod.java index 5f98066..8850bff 100644 --- a/me/Danker/TheMod.java +++ b/me/Danker/TheMod.java @@ -4,13 +4,16 @@ import java.awt.Image; import java.awt.SystemTray; import java.awt.Toolkit; import java.awt.TrayIcon; +import java.util.List; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -22,7 +25,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class TheMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.2"; + public static final String VERSION = "1.3"; @EventHandler public void init(FMLInitializationEvent event) @@ -36,9 +39,75 @@ public class TheMod if (!cf.hasKey("toggles", "Coords")) cf.writeBooleanConfig("toggles", "Coords", true); if (!cf.hasKey("api", "APIKey")) cf.writeStringConfig("api", "APIKey", ""); + // Wolf Loot + if (!cf.hasKey("wolf", "svens")) cf.writeIntConfig("wolf", "svens", 0); + if (!cf.hasKey("wolf", "spirit")) cf.writeIntConfig("wolf", "spirit", 0); + if (!cf.hasKey("wolf", "book")) cf.writeIntConfig("wolf", "book", 0); + if (!cf.hasKey("wolf", "egg")) cf.writeIntConfig("wolf", "egg", 0); + if (!cf.hasKey("wolf", "couture")) cf.writeIntConfig("wolf", "couture", 0); + if (!cf.hasKey("wolf", "bait")) cf.writeIntConfig("wolf", "bait", 0); + if (!cf.hasKey("wolf", "flux")) cf.writeIntConfig("wolf", "flux", 0); + if (!cf.hasKey("wolf", "timeRNG")) cf.writeIntConfig("wolf", "timeRNG", -1); + if (!cf.hasKey("wolf", "bossRNG")) cf.writeIntConfig("wolf", "bossRNG", -1); + // Spider Loot + if (!cf.hasKey("spider", "tarantulas")) cf.writeIntConfig("spider", "tarantulas", 0); + if (!cf.hasKey("spider", "bite")) cf.writeIntConfig("spider", "bite", 0); + if (!cf.hasKey("spider", "catalyst")) cf.writeIntConfig("spider", "catalyst", 0); + if (!cf.hasKey("spider", "book")) cf.writeIntConfig("spider", "book", 0); + if (!cf.hasKey("spider", "swatter")) cf.writeIntConfig("spider", "swatter", 0); + if (!cf.hasKey("spider", "talisman")) cf.writeIntConfig("spider", "talisman", 0); + if (!cf.hasKey("spider", "mosquito")) cf.writeIntConfig("spider", "mosquito", 0); + if (!cf.hasKey("spider", "timeRNG")) cf.writeIntConfig("spider", "timeRNG", -1); + if (!cf.hasKey("spider", "bossRNG")) cf.writeIntConfig("spider", "bossRNG", -1); + // Zombie Loot + if (!cf.hasKey("zombie", "revs")) cf.writeIntConfig("zombie", "revs", 0); + if (!cf.hasKey("zombie", "pestilence")) cf.writeIntConfig("zombie", "pestilence", 0); + if (!cf.hasKey("zombie", "undeadCatalyst")) cf.writeIntConfig("zombie", "undeadCatalyst", 0); + if (!cf.hasKey("zombie", "book")) cf.writeIntConfig("zombie", "book", 0); + if (!cf.hasKey("zombie", "beheaded")) cf.writeIntConfig("zombie", "beheaded", 0); + if (!cf.hasKey("zombie", "revCatalyst")) cf.writeIntConfig("zombie", "revCatalyst", 0); + if (!cf.hasKey("zombie", "snake")) cf.writeIntConfig("zombie", "snake", 0); + if (!cf.hasKey("zombie", "scythe")) cf.writeIntConfig("zombie", "scythe", 0); + if (!cf.hasKey("zombie", "timeRNG")) cf.writeIntConfig("zombie", "timeRNG", -1); + if (!cf.hasKey("zombie", "bossRNG")) cf.writeIntConfig("zombie", "bossRNG", -1); + final ToggleCommand tf = new ToggleCommand(); tf.gpartyToggled = cf.getBoolean("toggles", "GParty"); tf.coordsToggled = cf.getBoolean("toggles", "Coords"); + + final LootCommand lc = new LootCommand(); + // Wolf + lc.wolfSvens = cf.getInt("wolf", "svens"); + lc.wolfSpirits = cf.getInt("wolf", "spirit"); + lc.wolfBooks = cf.getInt("wolf", "book"); + lc.wolfEggs = cf.getInt("wolf", "egg"); + lc.wolfCoutures = cf.getInt("wolf", "couture"); + lc.wolfBaits = cf.getInt("wolf", "bait"); + lc.wolfFluxes = cf.getInt("wolf", "flux"); + lc.wolfTime = cf.getInt("wolf", "timeRNG"); + lc.wolfBosses = cf.getInt("wolf", "bossRNG"); + // Spider + lc.spiderTarantulas = cf.getInt("spider", "tarantulas"); + lc.spiderBites = cf.getInt("spider", "bite"); + lc.spiderCatalysts = cf.getInt("spider", "catalyst"); + lc.spiderBooks = cf.getInt("spider", "book"); + lc.spiderSwatters = cf.getInt("spider", "swatter"); + lc.spiderTalismans = cf.getInt("spider", "talisman"); + lc.spiderMosquitos = cf.getInt("spider", "mosquito"); + lc.spiderTime = cf.getInt("spider", "timeRNG"); + lc.spiderBosses = cf.getInt("spider", "bossRNG"); + // Zombie + lc.zombieRevs = cf.getInt("zombie", "revs"); + lc.zombiePestilences = cf.getInt("zombie", "pestilence"); + lc.zombieUndeadCatas = cf.getInt("zombie", "undeadCatalyst"); + lc.zombieBooks = cf.getInt("zombie", "book"); + lc.zombieBeheadeds = cf.getInt("zombie", "beheaded"); + lc.zombieRevCatas = cf.getInt("zombie", "revCatalyst"); + lc.zombieSnakes = cf.getInt("zombie", "snake"); + lc.zombieScythes = cf.getInt("zombie", "scythe"); + lc.zombieTime = cf.getInt("zombie", "timeRNG"); + lc.zombieBosses = cf.getInt("zombie", "bossRNG"); + } @EventHandler @@ -46,6 +115,7 @@ public class TheMod ClientCommandHandler.instance.registerCommand(new ToggleCommand()); ClientCommandHandler.instance.registerCommand(new SetkeyCommand()); ClientCommandHandler.instance.registerCommand(new GetkeyCommand()); + ClientCommandHandler.instance.registerCommand(new LootCommand()); } @SubscribeEvent @@ -53,25 +123,187 @@ public class TheMod final ToggleCommand tc = new ToggleCommand(); final boolean isGPartyToggled = tc.getToggle("gparty"); String message = event.message.getUnformattedText(); - String messagelc = message.toLowerCase(); - if (isGPartyToggled) { - if (messagelc.contains(" has invited all members of ")) { - try { - final SystemTray tray = SystemTray.getSystemTray(); - final Image image = Toolkit.getDefaultToolkit().createImage("icon.png"); - final TrayIcon trayIcon = new TrayIcon(image, "Guild Party Notifier"); - trayIcon.setImageAutoSize(true); - trayIcon.setToolTip("Guild Party Notifier"); - tray.add(trayIcon); - trayIcon.displayMessage("Guild Party", message, TrayIcon.MessageType.INFO); - tray.remove(trayIcon); - } catch (Exception ex) { - System.err.print(ex); + if (!message.contains(":")) { + if (isGPartyToggled) { + if (message.contains(" has invited all members of ")) { + System.out.println(message); + try { + final SystemTray tray = SystemTray.getSystemTray(); + final Image image = Toolkit.getDefaultToolkit().createImage("icon.png"); + final TrayIcon trayIcon = new TrayIcon(image, "Guild Party Notifier"); + trayIcon.setImageAutoSize(true); + trayIcon.setToolTip("Guild Party Notifier"); + tray.add(trayIcon); + trayIcon.displayMessage("Guild Party", message, TrayIcon.MessageType.INFO); + tray.remove(trayIcon); + } catch (Exception ex) { + System.err.print(ex); + } + } + } + + // Time is stored as a 32-bit int in seconds, so if Skyblock + // survives until 2038, I'll just update it then + final LootCommand lc = new LootCommand(); + final ConfigHandler cf = new ConfigHandler(); + boolean wolfRNG = false; + boolean spiderRNG = false; + boolean zombieRNG = false; + // T6 books + if (message.contains("VERY RARE DROP! (Enchanted Book)")) { + // Loop through scoreboard to see what boss you're doing + List scoreboard = ScoreboardHandler.getSidebarLines(); + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("Sven Packmaster")) { + lc.wolfBooks++; + cf.writeIntConfig("wolf", "book", lc.wolfBooks); + } else if (sCleaned.contains("Tarantula Broodfather")) { + lc.spiderBooks++; + cf.writeIntConfig("spider", "book", lc.spiderBooks); + } else if (sCleaned.contains("Revenant Horror")) { + lc.zombieBooks++; + cf.writeIntConfig("zombie", "book", lc.zombieBooks); + } } } - } - + + // Wolf + if (message.contains("Talk to Maddox to claim your Wolf Slayer XP!")) { + lc.wolfSvens++; + cf.writeIntConfig("wolf", "svens", lc.wolfSvens); + } + if (message.contains("VERY RARE DROP! (◆ Spirit Rune ")) { + lc.wolfSpirits++; + cf.writeIntConfig("wolf", "spirit", lc.wolfSpirits); + } + if (message.contains("CRAZY RARE DROP! (Red Claw Egg)")) { + wolfRNG = true; + lc.wolfEggs++; + cf.writeIntConfig("wolf", "egg", lc.wolfEggs); + } + if (message.contains("CRAZY RARE DROP! (◆ Couture Rune")) { + wolfRNG = true; + lc.wolfCoutures++; + cf.writeIntConfig("wolf", "couture", lc.wolfCoutures); + } + // How did Skyblock devs even manage to make this item Rename Me + if (message.contains("CRAZY RARE DROP! (Grizzly Bait)") || message.contains("CRAZY RARE DROP! (Rename Me)")) { + wolfRNG = true; + lc.wolfBaits++; + cf.writeIntConfig("wolf", "bait", lc.wolfBaits); + } + if (message.contains("CRAZY RARE DROP! (Overflux Capacitor)")) { + wolfRNG = true; + lc.wolfFluxes++; + cf.writeIntConfig("wolf", "flux", lc.wolfFluxes); + } + + // Spider + if (message.contains("Talk to Maddox to claim your Spider Slayer XP!")) { + lc.spiderTarantulas++; + cf.writeIntConfig("spider", "tarantulas", lc.spiderTarantulas); + } + + if (message.contains("VERY RARE DROP! (◆ Bite Rune")) { + lc.spiderBites++; + cf.writeIntConfig("spider", "bite", lc.spiderBites); + } + if (message.contains("VERY RARE DROP! (Spider Catalyst)")) { + lc.spiderCatalysts++; + cf.writeIntConfig("spider", "catalyst", lc.spiderCatalysts); + } + // T3 Spider Book Drop + if (message.contains("CRAZY RARE DROP! (Enchanted Book)")) { + lc.spiderBooks++; + cf.writeIntConfig("spider", "book", lc.spiderBooks); + } + if (message.contains("CRAZY RARE DROP! (Fly Swatter)")) { + spiderRNG = true; + lc.spiderSwatters++; + cf.writeIntConfig("spider", "swatter", lc.spiderSwatters); + } + if (message.contains("CRAZY RARE DROP! (Tarantula Talisman")) { + spiderRNG = true; + lc.spiderTalismans++; + cf.writeIntConfig("spider", "talisman", lc.spiderTalismans); + } + if (message.contains("CRAZY RARE DROP! (Digested Mosquito)")) { + spiderRNG = true; + lc.spiderMosquitos++; + cf.writeIntConfig("spider", "mosquito", lc.spiderMosquitos); + } + + // Zombie + if (message.contains("Talk to Maddox to claim your Zombie Slayer XP!")) { + lc.zombieRevs++; + cf.writeIntConfig("zombie", "revs", lc.zombieRevs); + } + // I couldn't find a pic of someone getting this drop, so I'm assuming this works + if (message.contains("VERY RARE DROP! (Revenant Catalyst)")) { + lc.zombieRevCatas++; + cf.writeIntConfig("zombie", "revCatalyst", lc.zombieRevCatas); + } + if (message.contains("VERY RARE DROP! (◆ Pestilence Rune")) { + lc.zombiePestilences++; + cf.writeIntConfig("zombie", "pestilence", lc.zombiePestilences); + } + if (message.contains("VERY RARE DROP! (Undead Catalyst)")) { + lc.zombieUndeadCatas++; + cf.writeIntConfig("zombie", "undeadCatalyst", lc.zombieUndeadCatas); + } + if (message.contains("CRAZY RARE DROP! (Beheaded Horror)")) { + zombieRNG = true; + lc.zombieBeheadeds++; + cf.writeIntConfig("zombie", "beheaded", lc.zombieBeheadeds); + } + + if (message.contains("CRAZY RARE DROP! (◆ Snake Rune")) { + zombieRNG = true; + lc.zombieSnakes++; + cf.writeIntConfig("zombie", "snake", lc.zombieSnakes); + } + if (message.contains("CRAZY RARE DROP! (Scythe Blade)")) { + zombieRNG = true; + lc.zombieScythes++; + cf.writeIntConfig("zombie", "scythe", lc.zombieScythes); + } + + if (wolfRNG) { + lc.wolfTime = (int) System.currentTimeMillis() / 1000; + lc.wolfBosses = 0; + cf.writeIntConfig("wolf", "timeRNG", lc.wolfTime); + cf.writeIntConfig("wolf", "bossRNG", 0); + } else { + if (lc.wolfBosses != -1) { + lc.wolfBosses++; + } + cf.writeIntConfig("wolf", "bossRNG", lc.wolfBosses); + } + if (spiderRNG) { + lc.spiderTime = (int) System.currentTimeMillis() / 1000; + lc.spiderBosses = 0; + cf.writeIntConfig("spider", "timeRNG", lc.spiderTime); + cf.writeIntConfig("spider", "bossRNG", 0); + } else { + if (lc.spiderBosses != -1) { + lc.spiderBosses++; + } + cf.writeIntConfig("spider", "bossRNG", lc.spiderBosses); + } + if (zombieRNG) { + lc.zombieTime = (int) System.currentTimeMillis() / 1000; + lc.zombieBosses = 0; + cf.writeIntConfig("zombie", "timeRNG", lc.zombieTime); + cf.writeIntConfig("zombie", "bossRNG", 0); + } else { + if (lc.zombieBosses != -1) { + lc.zombieBosses++; + } + cf.writeIntConfig("wolf", "bossRNG", lc.zombieBosses); + } + } } @SubscribeEvent @@ -81,14 +313,18 @@ public class TheMod final boolean isCoordsToggled = tc.getToggle("coords"); if (isCoordsToggled) { + ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft()); EntityPlayer player = Minecraft.getMinecraft().thePlayer; + double xDir = (player.rotationYaw % 360 + 360) % 360; if (xDir > 180) xDir -= 360; xDir = (double) Math.round(xDir * 10d) / 10d; double yDir = (double) Math.round(player.rotationPitch * 10d) / 10d; - String text = (int) player.posX + " / " + (int) player.posY + " / " + (int) player.posZ + " (" + xDir + " / " + yDir + ")"; - new CoordRenderer(Minecraft.getMinecraft(), text); + + String coordText = (int) player.posX + " / " + (int) player.posY + " / " + (int) player.posZ + " (" + xDir + " / " + yDir + ")"; + int height = scaled.getScaledHeight(); + new TextRenderer(Minecraft.getMinecraft(), coordText, 5, height - 25, Integer.parseInt("FFFFFF", 16)); } - } + } diff --git a/me/Danker/ToggleCommand.java b/me/Danker/ToggleCommand.java index 8c27da6..daf59d0 100644 --- a/me/Danker/ToggleCommand.java +++ b/me/Danker/ToggleCommand.java @@ -57,7 +57,7 @@ public class ToggleCommand extends CommandBase implements ICommand { player.addChatMessage(new ChatComponentText("Guild party notifications: " + gpartyToggled)); player.addChatMessage(new ChatComponentText("Coord/Angle display: " + coordsToggled)); } else { - player.addChatMessage(new ChatComponentText("Unknown value.")); + player.addChatMessage(new ChatComponentText("Usage: /toggle [gparty/coords]")); } } } -- cgit