diff options
author | bowser0000 <bowser0000@gmail.com> | 2022-08-09 20:32:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-09 20:32:25 -0400 |
commit | 4d2a84d9fd2f522b2ade9954f8d40f6d80e2b12b (patch) | |
tree | 7f762c94a742a07e5c3939e70d35cf7128071b32 /src/main/java/me/Danker/commands | |
parent | 48253eddf00cf5d94ecc2eb6b63e7c490b3145be (diff) | |
parent | f56302bee3939677fc3fd015a97b12b5100c45b1 (diff) | |
download | SkyblockMod-4d2a84d9fd2f522b2ade9954f8d40f6d80e2b12b.tar.gz SkyblockMod-4d2a84d9fd2f522b2ade9954f8d40f6d80e2b12b.tar.bz2 SkyblockMod-4d2a84d9fd2f522b2ade9954f8d40f6d80e2b12b.zip |
Merge branch 'development' into development
Diffstat (limited to 'src/main/java/me/Danker/commands')
6 files changed, 185 insertions, 21 deletions
diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index 21ada93..c340ed8 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/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/enderman/blaze/fishing/catacombs/mythological/ghost/auto/off> [winter/festival/spooky/ch/lava/session/f(1-7)/mm]"; + return "/" + getCommandName() + " <zombie/spider/wolf/enderman/blaze/fishing/catacombs/mythological/ghost/auto/off> [winter/festival/spooky/ch/lava/trophy/session/f(1-7)/mm]"; } public static String usage(ICommandSender arg0) { @@ -38,7 +38,7 @@ public class DisplayCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "blaze", "fishing", "catacombs", "mythological", "ghost", "auto", "off"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "trophy", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7", "mm", "master"); } else if (args.length > 1) { @@ -132,6 +132,13 @@ public class DisplayCommand extends CommandBase { LootDisplay.display = "fishing_lava"; } break; + case "trophy": + if (showSession) { + LootDisplay.display = "fishing_trophy_session"; + } else { + LootDisplay.display = "fishing_trophy"; + } + break; default: if (showSession) { LootDisplay.display = "fishing_session"; diff --git a/src/main/java/me/Danker/commands/ImportFishingCommand.java b/src/main/java/me/Danker/commands/ImportFishingCommand.java index 46d9906..6658bcd 100644 --- a/src/main/java/me/Danker/commands/ImportFishingCommand.java +++ b/src/main/java/me/Danker/commands/ImportFishingCommand.java @@ -3,6 +3,7 @@ package me.Danker.commands; import com.google.gson.JsonObject; import me.Danker.DankersSkyblockMod; import me.Danker.features.loot.FishingTracker; +import me.Danker.features.loot.TrophyFishTracker; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; @@ -63,7 +64,9 @@ public class ImportFishingCommand extends CommandBase { } System.out.println("Fetching fishing stats..."); - JsonObject statsObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("stats").getAsJsonObject(); + JsonObject memberObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject(); + JsonObject statsObject = memberObject.get("stats").getAsJsonObject(); + JsonObject trophyObject = memberObject.get("trophy_fish").getAsJsonObject(); FishingTracker.greatCatches = 0; FishingTracker.goodCatches = 0; @@ -123,7 +126,7 @@ public class ImportFishingCommand extends CommandBase { FishingTracker.thunders = getSCFromApi(statsObject, "kills_thunder"); FishingTracker.lordJawbuses = getSCFromApi(statsObject, "kills_lord_jawbus"); - System.out.println("Writing to config..."); + System.out.println("Writing SC to config..."); ConfigHandler.writeIntConfig("fishing", "goodCatch", FishingTracker.goodCatches); ConfigHandler.writeIntConfig("fishing", "greatCatch", FishingTracker.greatCatches); ConfigHandler.writeIntConfig("fishing", "seaCreature", FishingTracker.seaCreatures); @@ -172,6 +175,27 @@ public class ImportFishingCommand extends CommandBase { ConfigHandler.writeIntConfig("fishing", "thunder", FishingTracker.thunders); ConfigHandler.writeIntConfig("fishing", "lordJawbus", FishingTracker.lordJawbuses); + TrophyFishTracker.fish = TrophyFishTracker.createEmpty(); + TrophyFishTracker.fish.add("Sulpher Skitter", getTrophyFromAPI(trophyObject, "sulphur_skitter")); + TrophyFishTracker.fish.add("Obfuscated 1", getTrophyFromAPI(trophyObject, "obfuscated_fish_1")); + TrophyFishTracker.fish.add("Steaming-Hot Flounder", getTrophyFromAPI(trophyObject, "steaming_hot_flounder")); + TrophyFishTracker.fish.add("Obfuscated 2", getTrophyFromAPI(trophyObject, "obfuscated_fish_2")); + TrophyFishTracker.fish.add("Gusher", getTrophyFromAPI(trophyObject, "gusher")); + TrophyFishTracker.fish.add("Blobfish", getTrophyFromAPI(trophyObject, "blobfish")); + TrophyFishTracker.fish.add("Slugfish", getTrophyFromAPI(trophyObject, "slugfish")); + TrophyFishTracker.fish.add("Obfuscated 3", getTrophyFromAPI(trophyObject, "obfuscated_fish_3")); + TrophyFishTracker.fish.add("Flyfish", getTrophyFromAPI(trophyObject, "flyfish")); + TrophyFishTracker.fish.add("Lavahorse", getTrophyFromAPI(trophyObject, "lava_horse")); + TrophyFishTracker.fish.add("Mana Ray", getTrophyFromAPI(trophyObject, "mana_ray")); + TrophyFishTracker.fish.add("Volcanic Stonefish", getTrophyFromAPI(trophyObject, "volcanic_stonefish")); + TrophyFishTracker.fish.add("Vanille", getTrophyFromAPI(trophyObject, "vanille")); + TrophyFishTracker.fish.add("Skeleton Fish", getTrophyFromAPI(trophyObject, "skeleton_fish")); + TrophyFishTracker.fish.add("Moldfin", getTrophyFromAPI(trophyObject, "moldfin")); + TrophyFishTracker.fish.add("Soul Fish", getTrophyFromAPI(trophyObject, "soul_fish")); + TrophyFishTracker.fish.add("Karate Fish", getTrophyFromAPI(trophyObject, "karate_fish")); + TrophyFishTracker.fish.add("Golden Fish", getTrophyFromAPI(trophyObject, "golden_fish")); + TrophyFishTracker.save(); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Fishing stats imported.")); }).start(); } @@ -183,4 +207,15 @@ public class ImportFishingCommand extends CommandBase { return sc; } + static JsonObject getTrophyFromAPI(JsonObject obj, String name) { + JsonObject tiers = new JsonObject(); + + tiers.addProperty("BRONZE", obj.has(name + "_bronze") ? obj.get(name + "_bronze").getAsInt() : 0); + tiers.addProperty("SILVER", obj.has(name + "_silver") ? obj.get(name + "_silver").getAsInt() : 0); + tiers.addProperty("GOLD", obj.has(name + "_gold") ? obj.get(name + "_gold").getAsInt() : 0); + tiers.addProperty("DIAMOND", obj.has(name + "_diamond") ? obj.get(name + "_diamond").getAsInt() : 0); + + return tiers; + } + } diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index af5479e..3c224bb 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -24,7 +24,7 @@ public class LootCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <zombie/spider/wolf/enderman/blaze/fishing/catacombs/mythological> [winter/festival/spooky/ch/lava/f(1-7)/mm/session]"; + return "/" + getCommandName() + " <zombie/spider/wolf/enderman/blaze/fishing/catacombs/mythological> [winter/festival/spooky/ch/lava/trophy/f(1-7)/mm/session]"; } public static String usage(ICommandSender arg0) { @@ -41,7 +41,7 @@ public class LootCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "enderman", "blaze", "fishing", "catacombs", "mythological"); } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) { - return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "session"); + return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "ch", "lava", "trophy", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7", "mm", "master"); } else if (args.length > 1) { @@ -621,6 +621,54 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Creatures Since Lord Jawbus: " + bossesBetween + "\n" + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------")); return; + } else if (arg1[1].equalsIgnoreCase("trophy")) { + if (showSession) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + " Trophy Fishing Summary (Current Session):\n" + + EnumChatFormatting.WHITE + " Sulpher Skitter " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Sulpher Skitter") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Sulpher Skitter") + "\n" + + EnumChatFormatting.WHITE + " Obfuscated 1 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Obfuscated 1") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 1") + "\n" + + EnumChatFormatting.WHITE + " Steaminghot Flounder " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Steaming-Hot Flounder") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Steaming-Hot Flounder") + "\n" + + EnumChatFormatting.WHITE + " Gusher " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Gusher") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Gusher") + "\n" + + EnumChatFormatting.WHITE + " Blobfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Blobfish") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Blobfish") + "\n" + + EnumChatFormatting.GREEN + " Obfuscated 2 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Obfuscated 2") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 2") + "\n" + + EnumChatFormatting.GREEN + " Slugfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Slugfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Slugfish") + "\n" + + EnumChatFormatting.GREEN + " Flyfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Flyfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Flyfish") + "\n" + + EnumChatFormatting.BLUE + " Obfuscated 3 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Obfuscated 3") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Obfuscated 3") + "\n" + + EnumChatFormatting.BLUE + " Lavahorse " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Lavahorse") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Lavahorse") + "\n" + + EnumChatFormatting.BLUE + " Mana Ray " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Mana Ray") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Mana Ray") + "\n" + + EnumChatFormatting.BLUE + " Volcanic Stonefish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Volcanic Stonefish") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Volcanic Stonefish") + "\n" + + EnumChatFormatting.BLUE + " Vanille " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Vanille") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Vanille") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Skeleton Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Skeleton Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Skeleton Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Moldfin " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Moldfin") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Moldfin") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Soul Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Soul Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Soul Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Karate Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Karate Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Karate Fish") + "\n" + + EnumChatFormatting.GOLD + " Golden Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fishSession, "Golden Fish") + ")" + EnumChatFormatting.GOLD + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fishSession, "Golden Fish") + "\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + "-------------------")); + return; + } + + player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + " Trophy Fishing Summary:\n" + + EnumChatFormatting.WHITE + " Sulpher Skitter " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Sulpher Skitter") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Sulpher Skitter") + "\n" + + EnumChatFormatting.WHITE + " Obfuscated 1 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Obfuscated 1") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 1") + "\n" + + EnumChatFormatting.WHITE + " Steaminghot Flounder " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Steaming-Hot Flounder") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Steaming-Hot Flounder") + "\n" + + EnumChatFormatting.WHITE + " Gusher " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Gusher") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Gusher") + "\n" + + EnumChatFormatting.WHITE + " Blobfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Blobfish") + ")" + EnumChatFormatting.WHITE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Blobfish") + "\n" + + EnumChatFormatting.GREEN + " Obfuscated 2 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Obfuscated 2") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 2") + "\n" + + EnumChatFormatting.GREEN + " Slugfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Slugfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Slugfish") + "\n" + + EnumChatFormatting.GREEN + " Flyfish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Flyfish") + ")" + EnumChatFormatting.GREEN + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Flyfish") + "\n" + + EnumChatFormatting.BLUE + " Obfuscated 3 " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Obfuscated 3") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Obfuscated 3") + "\n" + + EnumChatFormatting.BLUE + " Lavahorse " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Lavahorse") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Lavahorse") + "\n" + + EnumChatFormatting.BLUE + " Mana Ray " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Mana Ray") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Mana Ray") + "\n" + + EnumChatFormatting.BLUE + " Volcanic Stonefish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Volcanic Stonefish") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Volcanic Stonefish") + "\n" + + EnumChatFormatting.BLUE + " Vanille " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Vanille") + ")" + EnumChatFormatting.BLUE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Vanille") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Skeleton Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Skeleton Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Skeleton Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Moldfin " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Moldfin") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Moldfin") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Soul Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Soul Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Soul Fish") + "\n" + + EnumChatFormatting.DARK_PURPLE + " Karate Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Karate Fish") + ")" + EnumChatFormatting.DARK_PURPLE + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Karate Fish") + "\n" + + EnumChatFormatting.GOLD + " Golden Fish " + EnumChatFormatting.DARK_GRAY + "(" + TrophyFishTracker.getSum(TrophyFishTracker.fish, "Golden Fish") + ")" + EnumChatFormatting.GOLD + ": " + TrophyFishTracker.getTierCount(TrophyFishTracker.fish, "Golden Fish") + "\n" + + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + "-------------------")); + return; } } diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index 9256394..00cf8f6 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -289,10 +289,14 @@ public class ResetLootCommand extends CommandBase { FishingTracker.taurusesSession = 0; FishingTracker.thundersSession = 0; FishingTracker.lordJawbusesSession = 0; - FishingTracker.jawbusTimeSession = 0; - FishingTracker.jawbusSCsSession = 0; + FishingTracker.jawbusTimeSession = -1; + FishingTracker.jawbusSCsSession = -1; ConfigHandler.deleteCategory("fishing"); ConfigHandler.reloadConfig(); + + TrophyFishTracker.fish = TrophyFishTracker.createEmpty(); + TrophyFishTracker.fishSession = TrophyFishTracker.createEmpty(); + TrophyFishTracker.save(); } static void resetMythological() { diff --git a/src/main/java/me/Danker/commands/SkillsCommand.java b/src/main/java/me/Danker/commands/SkillsCommand.java index f17c79d..be3cf3c 100644 --- a/src/main/java/me/Danker/commands/SkillsCommand.java +++ b/src/main/java/me/Danker/commands/SkillsCommand.java @@ -9,14 +9,20 @@ import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.event.HoverEvent; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; +import java.text.NumberFormat; import java.util.List; +import java.util.Locale; public class SkillsCommand extends CommandBase { - + + static NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); + @Override public String getCommandName() { return "skill"; @@ -85,7 +91,17 @@ public class SkillsCommand extends CommandBase { System.out.println("Fetching skills..."); JsonObject userObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject(); - + + ChatComponentText farmingLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Farming: "); + ChatComponentText miningLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Mining: "); + ChatComponentText combatLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Combat: "); + ChatComponentText foragingLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Foraging: "); + ChatComponentText fishingLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Fishing: "); + ChatComponentText enchantingLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Enchanting: "); + ChatComponentText alchemyLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Alchemy: "); + ChatComponentText tamingLevelText = new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + " Taming: "); + ChatComponentText newLine = new ChatComponentText("\n"); + double farmingLevel = 0; double miningLevel = 0; double combatLevel = 0; @@ -94,39 +110,55 @@ public class SkillsCommand extends CommandBase { double enchantingLevel = 0; double alchemyLevel = 0; double tamingLevel = 0; - + if (userObject.has("experience_skill_farming") || userObject.has("experience_skill_mining") || userObject.has("experience_skill_combat") || userObject.has("experience_skill_foraging") || userObject.has("experience_skill_fishing") || userObject.has("experience_skill_enchanting") || userObject.has("experience_skill_alchemy")) { if (userObject.has("experience_skill_farming")) { farmingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_farming").getAsDouble(), 60); farmingLevel = (double) Math.round(farmingLevel * 100) / 100; + farmingLevelText.setChatStyle(appendFormatted(farmingLevelText, "XP", userObject.get("experience_skill_farming").getAsDouble())); + farmingLevelText.setChatStyle(appendFormatted(farmingLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_farming").getAsDouble(), 60))); } if (userObject.has("experience_skill_mining")) { miningLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_mining").getAsDouble(), 60); miningLevel = (double) Math.round(miningLevel * 100) / 100; + miningLevelText.setChatStyle(appendFormatted(miningLevelText, "XP", userObject.get("experience_skill_mining").getAsDouble())); + miningLevelText.setChatStyle(appendFormatted(miningLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_mining").getAsDouble(), 60))); } if (userObject.has("experience_skill_combat")) { combatLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_combat").getAsDouble(), 60); combatLevel = (double) Math.round(combatLevel * 100) / 100; + combatLevelText.setChatStyle(appendFormatted(combatLevelText, "XP", userObject.get("experience_skill_combat").getAsDouble())); + combatLevelText.setChatStyle(appendFormatted(combatLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_combat").getAsDouble(), 60))); } if (userObject.has("experience_skill_foraging")) { foragingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_foraging").getAsDouble(), 50); foragingLevel = (double) Math.round(foragingLevel * 100) / 100; + foragingLevelText.setChatStyle(appendFormatted(foragingLevelText, "XP", userObject.get("experience_skill_foraging").getAsDouble())); + foragingLevelText.setChatStyle(appendFormatted(foragingLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_foraging").getAsDouble(), 50))); } if (userObject.has("experience_skill_fishing")) { fishingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_fishing").getAsDouble(), 50); fishingLevel = (double) Math.round(fishingLevel * 100) / 100; + fishingLevelText.setChatStyle(appendFormatted(fishingLevelText, "XP", userObject.get("experience_skill_fishing").getAsDouble())); + fishingLevelText.setChatStyle(appendFormatted(fishingLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_fishing").getAsDouble(), 50))); } if (userObject.has("experience_skill_enchanting")) { enchantingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_enchanting").getAsDouble(), 60); enchantingLevel = (double) Math.round(enchantingLevel * 100) / 100; + enchantingLevelText.setChatStyle(appendFormatted(enchantingLevelText, "XP", userObject.get("experience_skill_enchanting").getAsDouble())); + enchantingLevelText.setChatStyle(appendFormatted(enchantingLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_enchanting").getAsDouble(), 60))); } if (userObject.has("experience_skill_alchemy")) { alchemyLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_alchemy").getAsDouble(), 50); alchemyLevel = (double) Math.round(alchemyLevel * 100) / 100; + alchemyLevelText.setChatStyle(appendFormatted(alchemyLevelText, "XP", userObject.get("experience_skill_alchemy").getAsDouble())); + alchemyLevelText.setChatStyle(appendFormatted(alchemyLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_alchemy").getAsDouble(), 50))); } if (userObject.has("experience_skill_taming")) { tamingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_taming").getAsDouble(), 50); tamingLevel = (double) Math.round(tamingLevel * 100) / 100; + tamingLevelText.setChatStyle(appendFormatted(tamingLevelText, "XP", userObject.get("experience_skill_taming").getAsDouble())); + tamingLevelText.setChatStyle(appendFormatted(tamingLevelText, "Overflow XP", getOverflowXP(userObject.get("experience_skill_taming").getAsDouble(), 50))); } } else { // Get skills from achievement API, will be floored @@ -144,48 +176,82 @@ public class SkillsCommand extends CommandBase { JsonObject achievementObject = playerObject.get("player").getAsJsonObject().get("achievements").getAsJsonObject(); if (achievementObject.has("skyblock_harvester")) { farmingLevel = achievementObject.get("skyblock_harvester").getAsInt(); + farmingLevelText.setChatStyle(appendFormatted(farmingLevelText, "XP", Utils.skillLevelToXp((int) farmingLevel))); } if (achievementObject.has("skyblock_excavator")) { miningLevel = achievementObject.get("skyblock_excavator").getAsInt(); + miningLevelText.setChatStyle(appendFormatted(miningLevelText, "XP", Utils.skillLevelToXp((int) miningLevel))); } if (achievementObject.has("skyblock_combat")) { combatLevel = achievementObject.get("skyblock_combat").getAsInt(); + combatLevelText.setChatStyle(appendFormatted(combatLevelText, "XP", Utils.skillLevelToXp((int) combatLevel))); } if (achievementObject.has("skyblock_gatherer")) { foragingLevel = Math.min(achievementObject.get("skyblock_gatherer").getAsInt(), 50); + foragingLevelText.setChatStyle(appendFormatted(foragingLevelText, "XP", Utils.skillLevelToXp((int) foragingLevel))); } if (achievementObject.has("skyblock_angler")) { fishingLevel = Math.min(achievementObject.get("skyblock_angler").getAsInt(), 50); + fishingLevelText.setChatStyle(appendFormatted(fishingLevelText, "XP", Utils.skillLevelToXp((int) fishingLevel))); } if (achievementObject.has("skyblock_augmentation")) { enchantingLevel = achievementObject.get("skyblock_augmentation").getAsInt(); + enchantingLevelText.setChatStyle(appendFormatted(enchantingLevelText, "XP", Utils.skillLevelToXp((int) enchantingLevel))); } if (achievementObject.has("skyblock_concoctor")) { alchemyLevel = Math.min(achievementObject.get("skyblock_concoctor").getAsInt(), 50); + alchemyLevelText.setChatStyle(appendFormatted(alchemyLevelText, "XP", Utils.skillLevelToXp((int) alchemyLevel))); } if (achievementObject.has("skyblock_domesticator")) { tamingLevel = Math.min(achievementObject.get("skyblock_domesticator").getAsInt(), 50); + tamingLevelText.setChatStyle(appendFormatted(tamingLevelText, "XP", Utils.skillLevelToXp((int) tamingLevel))); } } + farmingLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + farmingLevel)); + miningLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + miningLevel)); + combatLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + combatLevel)); + foragingLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + foragingLevel)); + fishingLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + fishingLevel)); + enchantingLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + enchantingLevel)); + alchemyLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + alchemyLevel)); + tamingLevelText.appendSibling(new ChatComponentText(DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + tamingLevel)); + double skillAvg = (farmingLevel + miningLevel + combatLevel + foragingLevel + fishingLevel + enchantingLevel + alchemyLevel + tamingLevel) / 8; skillAvg = (double) Math.round(skillAvg * 100) / 100; double trueAvg = (Math.floor(farmingLevel) + Math.floor(miningLevel) + Math.floor(combatLevel) + Math.floor(foragingLevel) + Math.floor(fishingLevel) + Math.floor(enchantingLevel) + Math.floor(alchemyLevel) + Math.floor(tamingLevel)) / 8; player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + - EnumChatFormatting.AQUA + " " + username + "'s Skills:\n" + - DankersSkyblockMod.TYPE_COLOUR + " Farming: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + farmingLevel + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Mining: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + miningLevel + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Combat: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + combatLevel + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Foraging: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + foragingLevel + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Fishing: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + fishingLevel + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Enchanting: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + enchantingLevel + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Alchemy: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + alchemyLevel + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Taming: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + tamingLevel + "\n" + + EnumChatFormatting.AQUA + " " + username + "'s Skills:\n") + .appendSibling(farmingLevelText).appendSibling(newLine) + .appendSibling(miningLevelText).appendSibling(newLine) + .appendSibling(combatLevelText).appendSibling(newLine) + .appendSibling(foragingLevelText).appendSibling(newLine) + .appendSibling(fishingLevelText).appendSibling(newLine) + .appendSibling(enchantingLevelText).appendSibling(newLine) + .appendSibling(alchemyLevelText).appendSibling(newLine) + .appendSibling(tamingLevelText).appendSibling(newLine) + .appendSibling(new ChatComponentText( EnumChatFormatting.AQUA + " Average Skill Level: " + DankersSkyblockMod.SKILL_AVERAGE_COLOUR + EnumChatFormatting.BOLD + skillAvg + "\n" + EnumChatFormatting.AQUA + " True Average Skill Level: " + DankersSkyblockMod.SKILL_AVERAGE_COLOUR + EnumChatFormatting.BOLD + trueAvg + "\n" + - DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); + DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------"))); }).start(); } + static ChatStyle appendHover(ChatComponentText component, String text) { + String original = ""; + if (component.getChatStyle().getChatHoverEvent() != null) original = component.getChatStyle().getChatHoverEvent().getValue().getFormattedText(); + if (original.length() > 0) original += "\n"; + return component.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(original + text))); + } + + static ChatStyle appendFormatted(ChatComponentText component, String category, double number) { + return appendHover(component, DankersSkyblockMod.TYPE_COLOUR + category + ": " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(number)); + } + + static double getOverflowXP(double xp, int limit) { + if (limit == 50) return Math.max(0D, xp - 55172425D); + return Math.max(0D, xp - 111672425D); + } + } diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 2009e1c..00b41f3 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -50,6 +50,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean hidePetCandy; public static boolean highlightCommissions; public static boolean customColouredNames; + public static boolean customNametags; public static boolean endOfFarmAlert; public static boolean gemstoneLore; public static boolean crystalHollowWaypoints; @@ -63,6 +64,9 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean autoJoinSkyblock; public static boolean firePillar; public static boolean aliases; + public static boolean fishingAlert; + public static boolean minionLastCollected; + public static boolean showTrophyCompletion; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; |