diff options
Diffstat (limited to 'me/Danker')
-rw-r--r-- | me/Danker/TheMod.java | 325 | ||||
-rw-r--r-- | me/Danker/commands/ArmourCommand.java | 4 | ||||
-rw-r--r-- | me/Danker/commands/BankCommand.java | 4 | ||||
-rw-r--r-- | me/Danker/commands/DHelpCommand.java | 4 | ||||
-rw-r--r-- | me/Danker/commands/DisplayCommand.java | 51 | ||||
-rw-r--r-- | me/Danker/commands/GuildOfCommand.java | 4 | ||||
-rw-r--r-- | me/Danker/commands/LootCommand.java | 223 | ||||
-rw-r--r-- | me/Danker/commands/PetsCommand.java | 4 | ||||
-rw-r--r-- | me/Danker/commands/SkillsCommand.java | 4 | ||||
-rw-r--r-- | me/Danker/commands/SlayerCommand.java | 4 | ||||
-rw-r--r-- | me/Danker/utils/CommandUtils.java | 23 | ||||
-rw-r--r-- | me/Danker/utils/Utils.java | 60 |
12 files changed, 612 insertions, 98 deletions
diff --git a/me/Danker/TheMod.java b/me/Danker/TheMod.java index 6ed6c44..b6cf9be 100644 --- a/me/Danker/TheMod.java +++ b/me/Danker/TheMod.java @@ -9,7 +9,6 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.regex.Matcher; import java.util.regex.Pattern; import com.google.gson.JsonObject; @@ -33,15 +32,13 @@ import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.ScoreboardHandler; import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; import net.minecraft.event.ClickEvent.Action; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StringUtils; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; @@ -66,8 +63,8 @@ public class TheMod static double checkItemsNow = 0; static double itemsChecked = 0; - static Map<String, String> t6Enchants = new HashMap<String, String>(); - static Pattern pattern = Pattern.compile(""); + public static Map<String, String> t6Enchants = new HashMap<String, String>(); + public static Pattern pattern = Pattern.compile(""); static boolean updateChecked = false; @EventHandler @@ -218,83 +215,106 @@ public class TheMod // Wolf if (message.contains("Talk to Maddox to claim your Wolf Slayer XP!")) { lc.wolfSvens++; + lc.wolfSvensSession++; if (lc.wolfBosses != -1) { lc.wolfBosses++; } + if (lc.wolfBossesSession != -1) { + lc.wolfBossesSession++; + } cf.writeIntConfig("wolf", "svens", lc.wolfSvens); cf.writeIntConfig("wolf", "bossRNG", lc.wolfBosses); } // Removing the unicode here *should* fix rune drops not counting if (message.contains("VERY RARE DROP! (") && message.contains(" Spirit Rune I)")) { lc.wolfSpirits++; + lc.wolfSpiritsSession++; cf.writeIntConfig("wolf", "spirit", lc.wolfSpirits); } if (message.contains("CRAZY RARE DROP! (Red Claw Egg)")) { wolfRNG = true; lc.wolfEggs++; + lc.wolfEggsSession++; cf.writeIntConfig("wolf", "egg", lc.wolfEggs); } if (message.contains("CRAZY RARE DROP! (") && message.contains(" Couture Rune I)")) { wolfRNG = true; lc.wolfCoutures++; + lc.wolfCouturesSession++; 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++; + lc.wolfBaitsSession++; cf.writeIntConfig("wolf", "bait", lc.wolfBaits); } if (message.contains("CRAZY RARE DROP! (Overflux Capacitor)")) { wolfRNG = true; lc.wolfFluxes++; + lc.wolfFluxesSession++; cf.writeIntConfig("wolf", "flux", lc.wolfFluxes); } // Spider if (message.contains("Talk to Maddox to claim your Spider Slayer XP!")) { lc.spiderTarantulas++; + lc.spiderTarantulasSession++; if (lc.spiderBosses != -1) { lc.spiderBosses++; } + if (lc.spiderBossesSession != -1) { + lc.spiderBossesSession++; + } cf.writeIntConfig("spider", "tarantulas", lc.spiderTarantulas); cf.writeIntConfig("spider", "bossRNG", lc.spiderBosses); } if (message.contains("VERY RARE DROP! (") && message.contains(" Bite Rune I)")) { lc.spiderBites++; + lc.spiderBitesSession++; cf.writeIntConfig("spider", "bite", lc.spiderBites); } if (message.contains("VERY RARE DROP! (Spider Catalyst)")) { lc.spiderCatalysts++; + lc.spiderCatalystsSession++; cf.writeIntConfig("spider", "catalyst", lc.spiderCatalysts); } // T3 Spider Book Drop if (message.contains("CRAZY RARE DROP! (Enchanted Book)")) { lc.spiderBooks++; + lc.spiderBooksSession++; cf.writeIntConfig("spider", "book", lc.spiderBooks); } if (message.contains("CRAZY RARE DROP! (Fly Swatter)")) { spiderRNG = true; lc.spiderSwatters++; + lc.spiderSwattersSession++; cf.writeIntConfig("spider", "swatter", lc.spiderSwatters); } if (message.contains("CRAZY RARE DROP! (Tarantula Talisman")) { spiderRNG = true; lc.spiderTalismans++; + lc.spiderTalismansSession++; cf.writeIntConfig("spider", "talisman", lc.spiderTalismans); } if (message.contains("CRAZY RARE DROP! (Digested Mosquito)")) { spiderRNG = true; lc.spiderMosquitos++; + lc.spiderMosquitosSession++; cf.writeIntConfig("spider", "mosquito", lc.spiderMosquitos); } // Zombie if (message.contains("Talk to Maddox to claim your Zombie Slayer XP!")) { lc.zombieRevs++; + lc.zombieRevsSession++; if (lc.zombieBosses != -1) { lc.zombieBosses++; } + if (lc.zombieBossesSession != 1) { + lc.zombieBossesSession++; + } cf.writeIntConfig("zombie", "revs", lc.zombieRevs); cf.writeIntConfig("wolf", "bossRNG", lc.zombieBosses); } @@ -302,49 +322,59 @@ public class TheMod // works if (message.contains("VERY RARE DROP! (Revenant Catalyst)")) { lc.zombieRevCatas++; + lc.zombieRevCatasSession++; cf.writeIntConfig("zombie", "revCatalyst", lc.zombieRevCatas); } if (message.contains("VERY RARE DROP! (") && message.contains(" Pestilence Rune I)")) { lc.zombiePestilences++; + lc.zombiePestilencesSession++; cf.writeIntConfig("zombie", "pestilence", lc.zombiePestilences); } if (message.contains("VERY RARE DROP! (Undead Catalyst)")) { lc.zombieUndeadCatas++; + lc.zombieUndeadCatasSession++; cf.writeIntConfig("zombie", "undeadCatalyst", lc.zombieUndeadCatas); } if (message.contains("CRAZY RARE DROP! (Beheaded Horror)")) { zombieRNG = true; lc.zombieBeheadeds++; + lc.zombieBeheadedsSession++; cf.writeIntConfig("zombie", "beheaded", lc.zombieBeheadeds); } if (message.contains("CRAZY RARE DROP! (") && message.contains(" Snake Rune I)")) { zombieRNG = true; lc.zombieSnakes++; + lc.zombieSnakesSession++; cf.writeIntConfig("zombie", "snake", lc.zombieSnakes); } if (message.contains("CRAZY RARE DROP! (Scythe Blade)")) { zombieRNG = true; lc.zombieScythes++; + lc.zombieScythesSession++; cf.writeIntConfig("zombie", "scythe", lc.zombieScythes); } - // Time is stored in seconds, so if Skyblock - // survives until 2038, I'll just update it then if (wolfRNG) { lc.wolfTime = System.currentTimeMillis() / 1000; lc.wolfBosses = 0; + lc.wolfTimeSession = System.currentTimeMillis() / 1000; + lc.wolfBossesSession = 0; cf.writeDoubleConfig("wolf", "timeRNG", lc.wolfTime); cf.writeIntConfig("wolf", "bossRNG", 0); } if (spiderRNG) { lc.spiderTime = System.currentTimeMillis() / 1000; lc.spiderBosses = 0; + lc.spiderTimeSession = System.currentTimeMillis() / 1000; + lc.spiderBossesSession = 0; cf.writeDoubleConfig("spider", "timeRNG", lc.spiderTime); cf.writeIntConfig("spider", "bossRNG", 0); } if (zombieRNG) { lc.zombieTime = System.currentTimeMillis() / 1000; lc.zombieBosses = 0; + lc.zombieTimeSession = System.currentTimeMillis() / 1000; + lc.zombieBossesSession = 0; cf.writeDoubleConfig("zombie", "timeRNG", lc.zombieTime); cf.writeIntConfig("zombie", "bossRNG", 0); } @@ -352,15 +382,19 @@ public class TheMod // Fishing if (message.contains("GOOD CATCH!")) { lc.goodCatches++; + lc.goodCatchesSession++; cf.writeIntConfig("fishing", "goodCatch", lc.goodCatches); } if (message.contains("GREAT CATCH!")) { lc.greatCatches++; + lc.greatCatchesSession++; cf.writeIntConfig("fishing", "greatCatch", lc.greatCatches); } if (message.contains("You caught a lowly Squid")) { lc.squids++; lc.seaCreatures++; + lc.squidsSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "squid", lc.squids); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); increaseEmpSC(); @@ -368,6 +402,8 @@ public class TheMod if (message.contains("From the depths of the waters, you've reeled in a Sea Walker")) { lc.seaWalkers++; lc.seaCreatures++; + lc.seaWalkersSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "seaWalker", lc.seaWalkers); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); increaseEmpSC(); @@ -375,6 +411,8 @@ public class TheMod if (message.contains("Pitch darkness reveals you've caught a")) { lc.nightSquids++; lc.seaCreatures++; + lc.nightSquidsSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "nightSquid", lc.nightSquids); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); increaseEmpSC(); @@ -382,6 +420,8 @@ public class TheMod if (message.contains("You've stumbled upon a patrolling Sea Guardian")) { lc.seaGuardians++; lc.seaCreatures++; + lc.seaGuardiansSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "seaGuardian", lc.seaGuardians); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); increaseEmpSC(); @@ -389,6 +429,8 @@ public class TheMod if (message.contains("It looks like you've disrupted the Sea Witch's brewing session. Watch out, she's furious")) { lc.seaWitches++; lc.seaCreatures++; + lc.seaWitchesSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "seaWitch", lc.seaWitches); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); increaseEmpSC(); @@ -396,6 +438,8 @@ public class TheMod if (message.contains("From the depths of the waters, you've reeled in a Sea Archer")) { lc.seaArchers++; lc.seaCreatures++; + lc.seaArchersSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "seaArcher", lc.seaArchers); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); increaseEmpSC(); @@ -403,6 +447,8 @@ public class TheMod if (message.contains("The Monster of the Deep emerges from the dark depths")) { lc.monsterOfTheDeeps++; lc.seaCreatures++; + lc.monsterOfTheDeepsSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "monsterOfDeep", lc.monsterOfTheDeeps); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); increaseEmpSC(); @@ -410,6 +456,8 @@ public class TheMod if (message.contains("You have found a Catfish, don't let it steal your catches")) { lc.catfishes++; lc.seaCreatures++; + lc.catfishesSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "catfish", lc.catfishes); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); increaseEmpSC(); @@ -417,6 +465,8 @@ public class TheMod if (message.contains("Is this even a fish? It's the Carrot King")) { lc.carrotKings++; lc.seaCreatures++; + lc.carrotKingsSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "carrotKing", lc.carrotKings); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); increaseEmpSC(); @@ -424,6 +474,8 @@ public class TheMod if (message.contains("Gross! A Sea Leech")) { lc.seaLeeches++; lc.seaCreatures++; + lc.seaLeechesSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "seaLeech", lc.seaLeeches); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); increaseEmpSC(); @@ -431,6 +483,8 @@ public class TheMod if (message.contains("You've discovered a Guardian Defender of the sea")) { lc.guardianDefenders++; lc.seaCreatures++; + lc.guardianDefendersSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "guardianDefender", lc.guardianDefenders); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); increaseEmpSC(); @@ -438,6 +492,8 @@ public class TheMod if (message.contains("You have awoken the Deep Sea Protector, prepare for a battle")) { lc.deepSeaProtectors++; lc.seaCreatures++; + lc.deepSeaProtectorsSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "deepSeaProtector", lc.deepSeaProtectors); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); increaseEmpSC(); @@ -445,6 +501,8 @@ public class TheMod if (message.contains("The Water Hydra has come to test your strength")) { lc.hydras++; lc.seaCreatures++; + lc.hydrasSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "hydra", lc.hydras); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); increaseEmpSC(); @@ -454,6 +512,10 @@ public class TheMod lc.seaCreatures++; lc.empTime = System.currentTimeMillis() / 1000; lc.empSCs = 0; + lc.seaEmperorsSession++; + lc.seaCreaturesSession++; + lc.empTimeSession = System.currentTimeMillis() / 1000; + lc.empSCsSession = 0; cf.writeIntConfig("fishing", "seaEmperor", lc.seaEmperors); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); cf.writeDoubleConfig("fishing", "empTime", lc.empTime); @@ -463,24 +525,32 @@ public class TheMod if (message.contains("Frozen Steve fell into the pond long ago")) { lc.frozenSteves++; lc.seaCreatures++; + lc.frozenStevesSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "frozenSteve", lc.frozenSteves); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); } if (message.contains("It's a snowman! He looks harmless")) { lc.frostyTheSnowmans++; lc.seaCreatures++; + lc.frostyTheSnowmansSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "snowman", lc.frostyTheSnowmans); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); } if (message.contains("stole Jerry's Gifts...get them back")) { lc.grinches++; lc.seaCreatures++; + lc.grinchesSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "grinch", lc.grinches); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); } if (message.contains("What is this creature")) { lc.yetis++; lc.seaCreatures++; + lc.yetisSession++; + lc.seaCreaturesSession++; cf.writeIntConfig("fishing", "yeti", lc.yetis); cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures); } @@ -549,6 +619,40 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + lc.wolfFluxes + "\n" + EnumChatFormatting.AQUA + timeBetween + "\n" + EnumChatFormatting.AQUA + bossesBetween; + } else if (ds.display.equals("wolf_session")) { + if (lc.wolfTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = lc.getTimeBetween(lc.wolfTimeSession, timeNow); + } + if (lc.wolfBossesSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(lc.wolfBossesSession); + } + + dropsText = EnumChatFormatting.GOLD + "Svens Killed:\n" + + EnumChatFormatting.GREEN + "Wolf Teeth:\n" + + EnumChatFormatting.BLUE + "Hamster Wheels:\n" + + EnumChatFormatting.AQUA + "Spirit Runes:\n" + + EnumChatFormatting.WHITE + "Critical VI Books:\n" + + EnumChatFormatting.DARK_RED + "Red Claw Eggs:\n" + + EnumChatFormatting.GOLD + "Couture Runes:\n" + + EnumChatFormatting.AQUA + "Grizzly Baits:\n" + + EnumChatFormatting.DARK_PURPLE + "Overfluxes:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + countText = EnumChatFormatting.GOLD + nf.format(lc.wolfSvensSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(lc.wolfTeethSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(lc.wolfWheelsSession) + "\n" + + EnumChatFormatting.AQUA + lc.wolfSpiritsSession + "\n" + + EnumChatFormatting.WHITE + lc.wolfBooksSession + "\n" + + EnumChatFormatting.DARK_RED + lc.wolfEggsSession + "\n" + + EnumChatFormatting.GOLD + lc.wolfCouturesSession + "\n" + + EnumChatFormatting.AQUA + lc.wolfBaitsSession + "\n" + + EnumChatFormatting.DARK_PURPLE + lc.wolfFluxesSession + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; } else if (ds.display.equals("spider")) { if (lc.spiderTime == -1) { timeBetween = "Never"; @@ -583,6 +687,40 @@ public class TheMod EnumChatFormatting.GOLD + lc.spiderMosquitos + "\n" + EnumChatFormatting.AQUA + timeBetween + "\n" + EnumChatFormatting.AQUA + bossesBetween; + } else if (ds.display.equals("spider_session")) { + if (lc.spiderTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = lc.getTimeBetween(lc.spiderTimeSession, timeNow); + } + if (lc.spiderBossesSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(lc.spiderBossesSession); + } + + dropsText = EnumChatFormatting.GOLD + "Tarantulas Killed:\n" + + EnumChatFormatting.GREEN + "Tarantula Webs:\n" + + EnumChatFormatting.DARK_GREEN + "Arrow Poison:\n" + + EnumChatFormatting.DARK_GRAY + "Bite Runes:\n" + + EnumChatFormatting.WHITE + "Bane VI Books:\n" + + EnumChatFormatting.AQUA + "Spider Catalysts:\n" + + EnumChatFormatting.DARK_PURPLE + "Tarantula Talismans:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Fly Swatters:\n" + + EnumChatFormatting.GOLD + "Digested Mosquitos:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + countText = EnumChatFormatting.GOLD + nf.format(lc.spiderTarantulasSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(lc.spiderWebsSession) + "\n" + + EnumChatFormatting.DARK_GREEN + nf.format(lc.spiderTAPSession) + "\n" + + EnumChatFormatting.DARK_GRAY + lc.spiderBitesSession + "\n" + + EnumChatFormatting.WHITE + lc.spiderBooksSession + "\n" + + EnumChatFormatting.AQUA + lc.spiderCatalystsSession + "\n" + + EnumChatFormatting.DARK_PURPLE + lc.spiderTalismansSession + "\n" + + EnumChatFormatting.LIGHT_PURPLE + lc.spiderSwattersSession + "\n" + + EnumChatFormatting.GOLD + lc.spiderMosquitosSession + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; } else if (ds.display.equals("zombie")) { if (lc.zombieTime == -1) { timeBetween = "Never"; @@ -619,6 +757,42 @@ public class TheMod EnumChatFormatting.GOLD + lc.zombieScythes + "\n" + EnumChatFormatting.AQUA + timeBetween + "\n" + EnumChatFormatting.AQUA + bossesBetween; + } else if (ds.display.equals("zombie_session")) { + if (lc.zombieTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = lc.getTimeBetween(lc.zombieTimeSession, timeNow); + } + if (lc.zombieBossesSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(lc.zombieBossesSession); + } + + dropsText = EnumChatFormatting.GOLD + "Revs Killed:\n" + + EnumChatFormatting.GREEN + "Revenant Flesh:\n" + + EnumChatFormatting.BLUE + "Foul Flesh:\n" + + EnumChatFormatting.DARK_GREEN + "Pestilence Runes:\n" + + EnumChatFormatting.WHITE + "Smite VI Books:\n" + + EnumChatFormatting.AQUA + "Undead Catalysts:\n" + + EnumChatFormatting.DARK_PURPLE + "Beheaded Horrors:\n" + + EnumChatFormatting.RED + "Revenant Catalysts:\n" + + EnumChatFormatting.DARK_GREEN + "Snake Runes:\n" + + EnumChatFormatting.GOLD + "Scythe Blades:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + countText = EnumChatFormatting.GOLD + nf.format(lc.zombieRevsSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(lc.zombieRevFleshSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(lc.zombieFoulFleshSession) + "\n" + + EnumChatFormatting.DARK_GREEN + lc.zombiePestilencesSession + "\n" + + EnumChatFormatting.WHITE + lc.zombieBooksSession + "\n" + + EnumChatFormatting.AQUA + lc.zombieUndeadCatasSession + "\n" + + EnumChatFormatting.DARK_PURPLE + lc.zombieBeheadedsSession + "\n" + + EnumChatFormatting.RED + lc.zombieRevCatasSession + "\n" + + EnumChatFormatting.DARK_GREEN + lc.zombieSnakesSession + "\n" + + EnumChatFormatting.GOLD + lc.zombieScythes + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; } else if (ds.display.equals("fishing")) { if (lc.empTime == -1) { timeBetween = "Never"; @@ -673,8 +847,61 @@ public class TheMod new TextRenderer(Minecraft.getMinecraft(), dropsTextTwo, moc.displayXY[0] + 145, moc.displayXY[1], Integer.parseInt("FFFFFF", 16)); new TextRenderer(Minecraft.getMinecraft(), countTextTwo, moc.displayXY[0] + 255, moc.displayXY[1], Integer.parseInt("FFFFFF", 16)); + } else if (ds.display.equals("fishing_session")) { + if (lc.empTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = lc.getTimeBetween(lc.empTimeSession, timeNow); + } + if (lc.empSCsSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(lc.empSCsSession); + } - } else if (ds.display.equals("fishingwinter")) { + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.GRAY + "Squids:\n" + + EnumChatFormatting.GREEN + "Sea Walkers:\n" + + EnumChatFormatting.DARK_GRAY + "Night Squids:\n" + + EnumChatFormatting.DARK_AQUA + "Sea Guardians:\n" + + EnumChatFormatting.BLUE + "Sea Witches:\n" + + EnumChatFormatting.GREEN + "Sea Archers:\n" + + EnumChatFormatting.GREEN + "Monster of Deeps:"; + countText = EnumChatFormatting.AQUA + nf.format(lc.seaCreaturesSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.goodCatchesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.greatCatchesSession) + "\n" + + EnumChatFormatting.GRAY + nf.format(lc.squidsSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(lc.seaWalkersSession) + "\n" + + EnumChatFormatting.DARK_GRAY + nf.format(lc.nightSquidsSession) + "\n" + + EnumChatFormatting.DARK_AQUA + nf.format(lc.seaGuardiansSession) + "\n" + + EnumChatFormatting.BLUE + nf.format(lc.seaWitchesSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(lc.seaArchersSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(lc.monsterOfTheDeepsSession); + // Seperated to save vertical space + String dropsTextTwo = EnumChatFormatting.YELLOW + "Catfishes:\n" + + EnumChatFormatting.GOLD + "Carrot Kings:\n" + + EnumChatFormatting.GRAY + "Sea Leeches:\n" + + EnumChatFormatting.DARK_PURPLE + "Guardian Defenders:\n" + + EnumChatFormatting.DARK_PURPLE + "Deep Sea Protectors:\n" + + EnumChatFormatting.GOLD + "Hydras:\n" + + EnumChatFormatting.GOLD + "Sea Emperors:\n" + + EnumChatFormatting.AQUA + "Time Since Emp:\n" + + EnumChatFormatting.AQUA + "Creatures Since Emp:"; + String countTextTwo = EnumChatFormatting.YELLOW + nf.format(lc.catfishesSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.carrotKingsSession) + "\n" + + EnumChatFormatting.GRAY + nf.format(lc.seaLeechesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.guardianDefendersSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.deepSeaProtectorsSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.hydrasSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.seaEmperorsSession) + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + + new TextRenderer(Minecraft.getMinecraft(), dropsTextTwo, moc.displayXY[0] + 145, moc.displayXY[1], Integer.parseInt("FFFFFF", 16)); + new TextRenderer(Minecraft.getMinecraft(), countTextTwo, moc.displayXY[0] + 255, moc.displayXY[1], Integer.parseInt("FFFFFF", 16)); + } else if (ds.display.equals("fishing_winter")) { dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + EnumChatFormatting.GOLD + "Good Catches:\n" + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + @@ -689,6 +916,27 @@ public class TheMod EnumChatFormatting.WHITE + nf.format(lc.frostyTheSnowmans) + "\n" + EnumChatFormatting.DARK_GREEN + nf.format(lc.grinches) + "\n" + EnumChatFormatting.GOLD + nf.format(lc.yetis); + } else if (ds.display.contentEquals("fishing_winter_session")) { + dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" + + EnumChatFormatting.GOLD + "Good Catches:\n" + + EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" + + EnumChatFormatting.AQUA + "Frozen Steves:\n" + + EnumChatFormatting.WHITE + "Snowmans:\n" + + EnumChatFormatting.DARK_GREEN + "Grinches:\n" + + EnumChatFormatting.GOLD + "Yetis:"; + countText = EnumChatFormatting.AQUA + nf.format(lc.seaCreaturesSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.goodCatchesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(lc.greatCatchesSession) + "\n" + + EnumChatFormatting.AQUA + nf.format(lc.frozenStevesSession) + "\n" + + EnumChatFormatting.WHITE + nf.format(lc.frostyTheSnowmansSession) + "\n" + + EnumChatFormatting.DARK_GREEN + nf.format(lc.grinchesSession) + "\n" + + EnumChatFormatting.GOLD + nf.format(lc.yetisSession); + } else { + ConfigHandler cf = new ConfigHandler(); + + System.out.println("Display was an unknown value, turning off."); + ds.display = "off"; + cf.writeStringConfig("misc", "display", "off"); } new TextRenderer(Minecraft.getMinecraft(), dropsText, moc.displayXY[0], moc.displayXY[1], Integer.parseInt("FFFFFF", 16)); new TextRenderer(Minecraft.getMinecraft(), countText, moc.displayXY[0] + 110, moc.displayXY[1], Integer.parseInt("FFFFFF", 16)); @@ -712,12 +960,12 @@ public class TheMod final LootCommand lc = new LootCommand(); final ConfigHandler cf = new ConfigHandler(); - int itemTeeth = getItems("Wolf Tooth"); - int itemWheels = getItems("Hamster Wheel"); - int itemWebs = getItems("Tarantula Web"); - int itemTAP = getItems("Toxic Arrow Poison"); - int itemRev = getItems("Revenant Flesh"); - int itemFoul = getItems("Foul Flesh"); + int itemTeeth = Utils.getItems("Wolf Tooth"); + int itemWheels = Utils.getItems("Hamster Wheel"); + int itemWebs = Utils.getItems("Tarantula Web"); + int itemTAP = Utils.getItems("Toxic Arrow Poison"); + int itemRev = Utils.getItems("Revenant Flesh"); + int itemFoul = Utils.getItems("Foul Flesh"); // If no items, are detected, allow check again. Should fix items not being found if (itemTeeth + itemWheels + itemWebs + itemTAP + itemRev + itemFoul > 0) { @@ -728,6 +976,12 @@ public class TheMod lc.spiderTAP += itemTAP; lc.zombieRevFlesh += itemRev; lc.zombieFoulFlesh += itemFoul; + lc.wolfTeethSession += itemTeeth; + lc.wolfWheelsSession += itemWheels; + lc.spiderWebsSession += itemWebs; + lc.spiderTAPSession += itemTAP; + lc.zombieRevFleshSession += itemRev; + lc.zombieFoulFleshSession += itemFoul; cf.writeIntConfig("wolf", "teeth", lc.wolfTeeth); cf.writeIntConfig("wolf", "wheel", lc.wolfWheels); @@ -748,47 +1002,22 @@ public class TheMod if (event.toolTip == null) return; if (tc.goldenToggled) { for (int i = 0; i < event.toolTip.size(); i++) { - event.toolTip.set(i, returnGoldenEnchants(event.toolTip.get(i))); + event.toolTip.set(i, Utils.returnGoldenEnchants(event.toolTip.get(i))); } } } - public int getItems(String item) { - Minecraft mc = Minecraft.getMinecraft(); - EntityPlayer player = mc.thePlayer; - - double x = player.posX; - double y = player.posY; - double z = player.posZ; - AxisAlignedBB scan = new AxisAlignedBB(x - 6, y - 6, z - 6, x + 6, y + 6, z + 6); - List<EntityItem> items = mc.theWorld.getEntitiesWithinAABB(EntityItem.class, scan); - - for (EntityItem i : items) { - String itemName = StringUtils.stripControlCodes(i.getEntityItem().getDisplayName()); - if (itemName.equals(item)) return i.getEntityItem().stackSize; - } - // No items found - return 0; - } - - public String returnGoldenEnchants(String line) { - Matcher matcher = pattern.matcher(line); - StringBuffer out = new StringBuffer(); - - while (matcher.find()) { - matcher.appendReplacement(out, t6Enchants.get(matcher.group(1))); - } - matcher.appendTail(out); - - return out.toString(); - } - public void increaseEmpSC() { LootCommand lc = new LootCommand(); ConfigHandler cf = new ConfigHandler(); - if (lc.empSCs == -1) return; - lc.empSCs++; + if (lc.empSCs != -1) { + lc.empSCs++; + } + if (lc.empSCsSession != -1) { + lc.empSCsSession++; + } + cf.writeIntConfig("fishing", "empSC", lc.empSCs); } diff --git a/me/Danker/commands/ArmourCommand.java b/me/Danker/commands/ArmourCommand.java index fa2973d..255825c 100644 --- a/me/Danker/commands/ArmourCommand.java +++ b/me/Danker/commands/ArmourCommand.java @@ -11,7 +11,7 @@ import com.google.gson.JsonObject; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; -import me.Danker.utils.CommandUtils; +import me.Danker.utils.Utils; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; @@ -49,7 +49,7 @@ public class ArmourCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return CommandUtils.getMatchingPlayers(args[0]); + return Utils.getMatchingPlayers(args[0]); } return null; } diff --git a/me/Danker/commands/BankCommand.java b/me/Danker/commands/BankCommand.java index 0dd00e7..e32e66f 100644 --- a/me/Danker/commands/BankCommand.java +++ b/me/Danker/commands/BankCommand.java @@ -8,7 +8,7 @@ import com.google.gson.JsonObject; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; -import me.Danker.utils.CommandUtils; +import me.Danker.utils.Utils; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; @@ -43,7 +43,7 @@ public class BankCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return CommandUtils.getMatchingPlayers(args[0]); + return Utils.getMatchingPlayers(args[0]); } return null; } diff --git a/me/Danker/commands/DHelpCommand.java b/me/Danker/commands/DHelpCommand.java index 28c7ea3..e4bc278 100644 --- a/me/Danker/commands/DHelpCommand.java +++ b/me/Danker/commands/DHelpCommand.java @@ -35,8 +35,8 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey <key>" + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey.\n" + - EnumChatFormatting.GOLD + " /loot <zombie/spider/wolf/fishing> [winter]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + - EnumChatFormatting.GOLD + " /display <zombie/spider/wolf/fishing/off> [winter]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead.\n" + + EnumChatFormatting.GOLD + " /loot <zombie/spider/wolf/fishing> [winter/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + + EnumChatFormatting.GOLD + " /display <zombie/spider/wolf/fishing/off> [winter/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead.\n" + EnumChatFormatting.GOLD + " /move <coords/display> <x> <y>" + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + EnumChatFormatting.GOLD + " /slayer [player]" + EnumChatFormatting.AQUA + " - Uses API to get slayer xp of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /skills [player]" + EnumChatFormatting.AQUA + " - Uses API to get skill levels of a person. If no name is provided, it checks yours.\n" + diff --git a/me/Danker/commands/DisplayCommand.java b/me/Danker/commands/DisplayCommand.java index 761aa30..989edaf 100644 --- a/me/Danker/commands/DisplayCommand.java +++ b/me/Danker/commands/DisplayCommand.java @@ -21,7 +21,7 @@ public class DisplayCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " <zombie/spider/wolf/fishing/off> [winter]"; + return getCommandName() + " <zombie/spider/wolf/fishing/off> [winter/session]"; } @Override @@ -34,7 +34,9 @@ public class DisplayCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing", "off"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter"); + return getListOfStringsMatchingLastWord(args, "winter", "session"); + } else if (args.length == 2 || (args.length == 3 && args[0].equalsIgnoreCase("fishing") && args[1].equalsIgnoreCase("winter"))) { + return getListOfStringsMatchingLastWord(args, "session"); } return null; } @@ -44,28 +46,59 @@ public class DisplayCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display <zombie/spider/wolf/fishing/off> [winter]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display <zombie/spider/wolf/fishing/off> [winter/session]")); return; } final ConfigHandler cf = new ConfigHandler(); + boolean showSession = false; + + if (arg1.length > 1) { + if (arg1[1].equalsIgnoreCase("session")) { + showSession = true; + } else if (arg1.length > 2) { + if (arg1[2].equalsIgnoreCase("session")) { + showSession = true; + } + } + } if (arg1[0].equalsIgnoreCase("wolf")) { - display = "wolf"; + if (showSession) { + display = "wolf_session"; + } else { + display = "wolf"; + } } else if (arg1[0].equalsIgnoreCase("spider")) { - display = "spider"; + if (showSession) { + display = "spider_session"; + } else { + display = "spider"; + } } else if (arg1[0].equalsIgnoreCase("zombie")) { - display = "zombie"; + if (showSession) { + display = "zombie_session"; + } else { + display = "zombie"; + } } else if (arg1[0].equalsIgnoreCase("fishing")) { if (arg1.length > 1 && arg1[1].equalsIgnoreCase("winter")) { - display = "fishingwinter"; + if (showSession) { + display = "fishing_winter_session"; + } else { + display = "fishing_winter"; + } } else { - display = "fishing"; + if (showSession) { + display = "fishing_session"; + } else { + display = "fishing"; + } } } else if (arg1[0].equalsIgnoreCase("off")) { display = "off"; } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display <zombie/spider/wolf/fishing/off> [winter]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display <zombie/spider/wolf/fishing/off> [winter/session]")); return; } player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Display set to " + EnumChatFormatting.DARK_GREEN + display + EnumChatFormatting.GREEN + ".")); diff --git a/me/Danker/commands/GuildOfCommand.java b/me/Danker/commands/GuildOfCommand.java index 74fb728..238ba81 100644 --- a/me/Danker/commands/GuildOfCommand.java +++ b/me/Danker/commands/GuildOfCommand.java @@ -8,7 +8,7 @@ import com.google.gson.JsonObject; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; -import me.Danker.utils.CommandUtils; +import me.Danker.utils.Utils; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; @@ -37,7 +37,7 @@ public class GuildOfCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return CommandUtils.getMatchingPlayers(args[0]); + return Utils.getMatchingPlayers(args[0]); } return null; } diff --git a/me/Danker/commands/LootCommand.java b/me/Danker/commands/LootCommand.java index f93eda9..9478d8f 100644 --- a/me/Danker/commands/LootCommand.java +++ b/me/Danker/commands/LootCommand.java @@ -77,6 +77,71 @@ public class LootCommand extends CommandBase { public static int grinches; public static int yetis; + // Single sessions (No config saves) + // Wolf + public static int wolfSvensSession = 0; + public static int wolfTeethSession = 0; + public static int wolfWheelsSession = 0; + public static int wolfSpiritsSession = 0; + public static int wolfBooksSession = 0; + public static int wolfEggsSession = 0; + public static int wolfCouturesSession = 0; + public static int wolfBaitsSession = 0; + public static int wolfFluxesSession = 0; + public static double wolfTimeSession = -1; + public static int wolfBossesSession = -1; + // Spider + public static int spiderTarantulasSession = 0; + public static int spiderWebsSession = 0; + public static int spiderTAPSession = 0; + public static int spiderBitesSession = 0; + public static int spiderCatalystsSession = 0; + public static int spiderBooksSession = 0; + public static int spiderSwattersSession = 0; + public static int spiderTalismansSession = 0; + public static int spiderMosquitosSession = 0; + public static double spiderTimeSession = -1; + public static int spiderBossesSession = -1; + // Zombie + public static int zombieRevsSession = 0; + public static int zombieRevFleshSession = 0; + public static int zombieFoulFleshSession = 0; + public static int zombiePestilencesSession = 0; + public static int zombieUndeadCatasSession = 0; + public static int zombieBooksSession = 0; + public static int zombieBeheadedsSession = 0; + public static int zombieRevCatasSession = 0; + public static int zombieSnakesSession = 0; + public static int zombieScythesSession = 0; + public static double zombieTimeSession = -1; + public static int zombieBossesSession = -1; + + // Fishing + public static int seaCreaturesSession = 0; + public static int goodCatchesSession = 0; + public static int greatCatchesSession = 0; + public static int squidsSession = 0; + public static int seaWalkersSession = 0; + public static int nightSquidsSession = 0; + public static int seaGuardiansSession = 0; + public static int seaWitchesSession = 0; + public static int seaArchersSession = 0; + public static int monsterOfTheDeepsSession = 0; + public static int catfishesSession = 0; + public static int carrotKingsSession = 0; + public static int seaLeechesSession = 0; + public static int guardianDefendersSession = 0; + public static int deepSeaProtectorsSession = 0; + public static int hydrasSession = 0; + public static int seaEmperorsSession = 0; + public static double empTimeSession = -1; + public static int empSCsSession = -1; + // Fishing Winter + public static int frozenStevesSession = 0; + public static int frostyTheSnowmansSession = 0; + public static int grinchesSession = 0; + public static int yetisSession = 0; + public String getTimeBetween(double timeOne, double timeTwo) { double secondsBetween = Math.floor(timeTwo - timeOne); @@ -113,7 +178,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " <zombie/spider/wolf/fishing> [winter]"; + return getCommandName() + " <zombie/spider/wolf/fishing> [winter/session]"; } @Override @@ -126,7 +191,9 @@ public class LootCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter"); + return getListOfStringsMatchingLastWord(args, "winter", "session"); + } else if (args.length == 2 || (args.length == 3 && args[0].equalsIgnoreCase("fishing") && args[1].equalsIgnoreCase("winter"))) { + return getListOfStringsMatchingLastWord(args, "session"); } return null; } @@ -136,7 +203,7 @@ public class LootCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot <zombie/spider/wolf/fishing> [winter]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot <zombie/spider/wolf/fishing> [winter/session]")); return; } @@ -144,7 +211,48 @@ public class LootCommand extends CommandBase { String timeBetween; String bossesBetween; NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); + boolean showSession = false; + + if (arg1.length > 1) { + if (arg1[1].equalsIgnoreCase("session")) { + showSession = true; + } else if (arg1.length > 2) { + if (arg1[2].equalsIgnoreCase("session")) { + showSession = true; + } + } + } + if (arg1[0].equalsIgnoreCase("wolf")) { + if (showSession) { + if (wolfTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = getTimeBetween(wolfTimeSession, timeNow); + } + if (wolfBossesSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(wolfBossesSession); + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.DARK_AQUA + EnumChatFormatting.BOLD + " Sven Loot Summary (Current Session):\n" + + EnumChatFormatting.GOLD + " Svens Killed: " + nf.format(wolfSvensSession) + "\n" + + EnumChatFormatting.GREEN + " Wolf Teeth: " + nf.format(wolfTeethSession) + "\n" + + EnumChatFormatting.BLUE + " Hamster Wheels: " + nf.format(wolfWheelsSession) + "\n" + + EnumChatFormatting.AQUA + " Spirit Runes: " + wolfSpiritsSession + "\n" + + EnumChatFormatting.WHITE + " Critical VI Books: " + wolfBooksSession + "\n" + + EnumChatFormatting.DARK_RED + " Red Claw Eggs: " + wolfEggsSession + "\n" + + EnumChatFormatting.GOLD + " Couture Runes: " + wolfCouturesSession + "\n" + + EnumChatFormatting.AQUA + " Grizzly Baits: " + wolfBaitsSession + "\n" + + EnumChatFormatting.DARK_PURPLE + " Overfluxes: " + wolfFluxesSession + "\n" + + EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); + return; + } + if (wolfTime == -1) { timeBetween = "Never"; } else { @@ -171,6 +279,35 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); } else if (arg1[0].equalsIgnoreCase("spider")) { + if (showSession) { + if (spiderTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = getTimeBetween(spiderTimeSession, timeNow); + } + if (spiderBossesSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(spiderBossesSession); + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " Spider Loot Summary (Current Session):\n" + + EnumChatFormatting.GOLD + " Tarantulas Killed: " + nf.format(spiderTarantulasSession) + "\n" + + EnumChatFormatting.GREEN + " Tarantula Webs: " + nf.format(spiderWebsSession) + "\n" + + EnumChatFormatting.DARK_GREEN + " Arrow Poison: " + nf.format(spiderTAPSession) + "\n" + + EnumChatFormatting.DARK_GRAY + " Bite Runes: " + spiderBitesSession + "\n" + + EnumChatFormatting.WHITE + " Bane VI Books: " + spiderBooksSession + "\n" + + EnumChatFormatting.AQUA + " Spider Catalysts: " + spiderCatalystsSession + "\n" + + EnumChatFormatting.DARK_PURPLE + " Tarantula Talismans: " + spiderTalismansSession + "\n" + + EnumChatFormatting.LIGHT_PURPLE + " Fly Swatters: " + spiderSwattersSession + "\n" + + EnumChatFormatting.GOLD + " Digested Mosquitos: " + spiderMosquitosSession + "\n" + + EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " -------------------")); + return; + } + if (spiderTime == -1) { timeBetween = "Never"; } else { @@ -197,6 +334,36 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + EnumChatFormatting.RED + EnumChatFormatting.BOLD + " -------------------")); } else if (arg1[0].equalsIgnoreCase("zombie")) { + if (showSession) { + if (zombieTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = getTimeBetween(zombieTimeSession, timeNow); + } + if (zombieBossesSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(zombieBossesSession); + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + " Zombie Loot Summary (Current Session):\n" + + EnumChatFormatting.GOLD + " Revs Killed: " + nf.format(zombieRevsSession) + "\n" + + EnumChatFormatting.GREEN + " Revenant Flesh: " + nf.format(zombieRevFleshSession) + "\n" + + EnumChatFormatting.BLUE + " Foul Flesh: " + nf.format(zombieFoulFleshSession) + "\n" + + EnumChatFormatting.DARK_GREEN + " Pestilence Runes: " + zombiePestilencesSession + "\n" + + EnumChatFormatting.WHITE + " Smite VI Books: " + zombieBooksSession + "\n" + + EnumChatFormatting.AQUA + " Undead Catalysts: " + zombieUndeadCatasSession + "\n" + + EnumChatFormatting.DARK_PURPLE + " Beheaded Horrors: " + zombieBeheadedsSession + "\n" + + EnumChatFormatting.RED + " Revenant Catalysts: " + zombieRevCatasSession + "\n" + + EnumChatFormatting.DARK_GREEN + " Snake Runes: " + zombieSnakesSession + "\n" + + EnumChatFormatting.GOLD + " Scythe Blades: " + zombieScythesSession + "\n" + + EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + + EnumChatFormatting.GREEN + EnumChatFormatting.BOLD + " -------------------")); + return; + } + if (zombieTime == -1) { timeBetween = "Never"; } else { @@ -226,6 +393,17 @@ public class LootCommand extends CommandBase { } else if (arg1[0].equalsIgnoreCase("fishing")) { if (arg1.length > 1) { if (arg1[1].equalsIgnoreCase("winter")) { + if (showSession) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.WHITE + EnumChatFormatting.BOLD + " Winter Fishing Summary (Current Session):\n" + + EnumChatFormatting.AQUA + " Frozen Steves: " + nf.format(frozenStevesSession) + "\n" + + EnumChatFormatting.WHITE + " Snowmans: " + nf.format(frostyTheSnowmansSession) + "\n" + + EnumChatFormatting.DARK_GREEN + " Grinches: " + nf.format(grinchesSession) + "\n" + + EnumChatFormatting.GOLD + " Yetis: " + nf.format(yetisSession) + "\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); + return; + } + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + EnumChatFormatting.WHITE + EnumChatFormatting.BOLD + " Winter Fishing Summary:\n" + EnumChatFormatting.AQUA + " Frozen Steves: " + nf.format(frozenSteves) + "\n" + @@ -237,6 +415,43 @@ public class LootCommand extends CommandBase { } } + if (showSession) { + if (empTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = getTimeBetween(empTimeSession, timeNow); + } + if (empSCsSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(empSCsSession); + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " Fishing Summary (Current Session):\n" + + EnumChatFormatting.AQUA + " Sea Creatures Caught: " + nf.format(seaCreaturesSession) + "\n" + + EnumChatFormatting.GOLD + " Good Catches: " + nf.format(goodCatchesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Great Catches: " + nf.format(greatCatchesSession) + "\n\n" + + EnumChatFormatting.GRAY + " Squids: " + nf.format(squidsSession) + "\n" + + EnumChatFormatting.GREEN + " Sea Walkers: " + nf.format(seaWalkersSession) + "\n" + + EnumChatFormatting.DARK_GRAY + " Night Squids: " + nf.format(nightSquidsSession) + "\n" + + EnumChatFormatting.DARK_AQUA + " Sea Guardians: " + nf.format(seaGuardiansSession) + "\n" + + EnumChatFormatting.BLUE + " Sea Witches: " + nf.format(seaWitchesSession) + "\n" + + EnumChatFormatting.GREEN + " Sea Archers: " + nf.format(seaArchersSession) + "\n" + + EnumChatFormatting.GREEN + " Monster of the Deeps: " + nf.format(monsterOfTheDeepsSession) + "\n" + + EnumChatFormatting.YELLOW + " Catfishes: " + nf.format(catfishesSession) + "\n" + + EnumChatFormatting.GOLD + " Carrot Kings: " + nf.format(carrotKingsSession) + "\n" + + EnumChatFormatting.GRAY + " Sea Leeches: " + nf.format(seaLeechesSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Guardian Defenders: " + nf.format(guardianDefendersSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Deep Sea Protectors: " + nf.format(deepSeaProtectorsSession) + "\n" + + EnumChatFormatting.GOLD + " Hydras: " + nf.format(hydrasSession) + "\n" + + EnumChatFormatting.GOLD + " Sea Emperors: " + nf.format(seaEmperorsSession) + "\n" + + EnumChatFormatting.AQUA + " Time Since Sea Emperor: " + timeBetween + "\n" + + EnumChatFormatting.AQUA + " Sea Creatures Since Sea Emperor: " + bossesBetween + "\n" + + EnumChatFormatting.DARK_AQUA + EnumChatFormatting.BOLD + " -------------------")); + return; + } + if (empTime == -1) { timeBetween = "Never"; } else { @@ -271,7 +486,7 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Sea Creatures Since Sea Emperor: " + bossesBetween + "\n" + EnumChatFormatting.DARK_AQUA + EnumChatFormatting.BOLD + " -------------------")); } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot <zombie/spider/wolf>")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot <zombie/spider/wolf/fishing> [winter/session]")); } } diff --git a/me/Danker/commands/PetsCommand.java b/me/Danker/commands/PetsCommand.java index 6d7f241..75367ab 100644 --- a/me/Danker/commands/PetsCommand.java +++ b/me/Danker/commands/PetsCommand.java @@ -10,7 +10,7 @@ import com.google.gson.JsonObject; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; -import me.Danker.utils.CommandUtils; +import me.Danker.utils.Utils; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; @@ -74,7 +74,7 @@ public class PetsCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return CommandUtils.getMatchingPlayers(args[0]); + return Utils.getMatchingPlayers(args[0]); } return null; } diff --git a/me/Danker/commands/SkillsCommand.java b/me/Danker/commands/SkillsCommand.java index e248757..5818772 100644 --- a/me/Danker/commands/SkillsCommand.java +++ b/me/Danker/commands/SkillsCommand.java @@ -6,7 +6,7 @@ import com.google.gson.JsonObject; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; -import me.Danker.utils.CommandUtils; +import me.Danker.utils.Utils; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; @@ -197,7 +197,7 @@ public class SkillsCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return CommandUtils.getMatchingPlayers(args[0]); + return Utils.getMatchingPlayers(args[0]); } return null; } diff --git a/me/Danker/commands/SlayerCommand.java b/me/Danker/commands/SlayerCommand.java index a6fe85e..f8100b4 100644 --- a/me/Danker/commands/SlayerCommand.java +++ b/me/Danker/commands/SlayerCommand.java @@ -7,7 +7,7 @@ import com.google.gson.JsonObject; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; -import me.Danker.utils.CommandUtils; +import me.Danker.utils.Utils; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; @@ -36,7 +36,7 @@ public class SlayerCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return CommandUtils.getMatchingPlayers(args[0]); + return Utils.getMatchingPlayers(args[0]); } return null; } diff --git a/me/Danker/utils/CommandUtils.java b/me/Danker/utils/CommandUtils.java deleted file mode 100644 index 7b10ad5..0000000 --- a/me/Danker/utils/CommandUtils.java +++ /dev/null @@ -1,23 +0,0 @@ -package me.Danker.utils; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; - -public class CommandUtils { - public static List<String> getMatchingPlayers(String arg) { - List<String> matchingPlayers = new ArrayList<>(); - List<EntityPlayer> players = Minecraft.getMinecraft().theWorld.playerEntities; - - for (EntityPlayer player : players) { - String playerName = player.getName(); - if (playerName.toLowerCase().startsWith(arg.toLowerCase())) { - matchingPlayers.add(playerName); - } - } - - return matchingPlayers; - } -} diff --git a/me/Danker/utils/Utils.java b/me/Danker/utils/Utils.java new file mode 100644 index 0000000..409e0b6 --- /dev/null +++ b/me/Danker/utils/Utils.java @@ -0,0 +1,60 @@ +package me.Danker.utils; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; + +import me.Danker.TheMod; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.StringUtils; + +public class Utils { + + public static int getItems(String item) { + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayer player = mc.thePlayer; + + double x = player.posX; + double y = player.posY; + double z = player.posZ; + AxisAlignedBB scan = new AxisAlignedBB(x - 6, y - 6, z - 6, x + 6, y + 6, z + 6); + List<EntityItem> items = mc.theWorld.getEntitiesWithinAABB(EntityItem.class, scan); + + for (EntityItem i : items) { + String itemName = StringUtils.stripControlCodes(i.getEntityItem().getDisplayName()); + if (itemName.equals(item)) return i.getEntityItem().stackSize; + } + // No items found + return 0; + } + + public static String returnGoldenEnchants(String line) { + Matcher matcher = TheMod.pattern.matcher(line); + StringBuffer out = new StringBuffer(); + + while (matcher.find()) { + matcher.appendReplacement(out, TheMod.t6Enchants.get(matcher.group(1))); + } + matcher.appendTail(out); + + return out.toString(); + } + + public static List<String> getMatchingPlayers(String arg) { + List<String> matchingPlayers = new ArrayList<>(); + List<EntityPlayer> players = Minecraft.getMinecraft().theWorld.playerEntities; + + for (EntityPlayer player : players) { + String playerName = player.getName(); + if (playerName.toLowerCase().startsWith(arg.toLowerCase())) { + matchingPlayers.add(playerName); + } + } + + return matchingPlayers; + } + +} |