From b10906fc55a480675c9dcea9e402792791af6916 Mon Sep 17 00:00:00 2001 From: Fluboxer Date: Wed, 21 Feb 2024 15:04:59 +0300 Subject: 1st iteration of calculator for Croesus I did testings on M5 and M6 drops and so far it were working properly. Only thing I'm unsure is spirit pet and yes it does use big map for every dungeon drop lmao --- .../skyblocker/skyblock/dungeon/CroesusHelper.java | 8 +- .../skyblocker/skyblock/dungeon/CroesusProfit.java | 272 +++++++++++++++++++++ 2 files changed, 278 insertions(+), 2 deletions(-) create mode 100644 src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusHelper.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusHelper.java index e95b47c9..01422770 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusHelper.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusHelper.java @@ -25,8 +25,12 @@ public class CroesusHelper extends ContainerSolver { List highlights = new ArrayList<>(); for (Map.Entry entry : slots.entrySet()) { ItemStack stack = entry.getValue(); - if (stack != null && stack.getNbt() != null && (stack.getNbt().toString().contains("No more Chests to open!") || stack.getNbt().toString().contains("Opened Chest:"))) { - highlights.add(ColorHighlight.gray(entry.getKey())); + if (stack != null && stack.getNbt() != null) { + if (stack.getNbt().toString().contains("Opened Chest:")) { + highlights.add(ColorHighlight.gray(entry.getKey())); + } else if (stack.getNbt().toString().contains("No more Chests to open!")) { + highlights.add(ColorHighlight.red(entry.getKey())); + } } } return highlights; diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java new file mode 100644 index 00000000..a2a82aee --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java @@ -0,0 +1,272 @@ +package de.hysky.skyblocker.skyblock.dungeon; + +import com.google.gson.JsonObject; +import de.hysky.skyblocker.config.SkyblockerConfigManager; +import de.hysky.skyblocker.skyblock.item.tooltip.ItemTooltip; +import de.hysky.skyblocker.skyblock.item.tooltip.TooltipInfoType; +import de.hysky.skyblocker.utils.render.gui.ColorHighlight; +import de.hysky.skyblocker.utils.render.gui.ContainerSolver; +import it.unimi.dsi.fastutil.longs.LongBooleanPair; +import net.minecraft.client.item.TooltipContext; +import net.minecraft.item.ItemStack; +import net.minecraft.text.Text; +import net.minecraft.util.Formatting; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; + +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class CroesusProfit extends ContainerSolver { + private static final Logger LOGGER = LogManager.getLogger(); + private static final Pattern ESSENCE_PATTERN = Pattern.compile("(?[A-Za-z]+) Essence x(?[0-9]+)"); + private static final Pattern CHEST_PATTERN = Pattern.compile("literal\\{(.*?) Chest}"); + public CroesusProfit() { + super(".*Catacombs - Floor.*"); + } + + @Override + protected boolean isEnabled() { + return SkyblockerConfigManager.get().locations.dungeons.croesusProfit; + } + + @Override + protected List getColors(String[] groups, Map slots) { + List highlights = new ArrayList<>(); + ItemStack bestChest = null, secondBestChest = null; + long bestValue = 0, secondBestValue = 0; // If negative value of chest - it is out of the question + long dungeonKeyPriceData = getItemPrice("DUNGEON_CHEST_KEY")*2; // lesser ones don't worth the hassle + + for (Map.Entry entry : slots.entrySet()) { + ItemStack stack = entry.getValue(); + if (stack != null && stack.getNbt() != null && stack.getName().toString().contains("Chest")) { + long value = valueChest(stack); + if (value > bestValue) { + secondBestChest = bestChest; + secondBestValue = bestValue; + bestChest = stack; + bestValue = value; + } else if (value > secondBestValue) { + secondBestChest = stack; + secondBestValue = value; + } + } + } + + for (Map.Entry entry : slots.entrySet()) { + ItemStack stack = entry.getValue(); + if (stack != null && stack.getNbt() != null) { + if (stack.equals(bestChest)) { + highlights.add(ColorHighlight.green(entry.getKey())); + } else if (stack.equals(secondBestChest) && secondBestValue > dungeonKeyPriceData) { + highlights.add(ColorHighlight.yellow(entry.getKey())); + } + } + } + return highlights; + } + + + private long valueChest(@NotNull ItemStack chest) { + long chestValue = 0; + int chestPrice = 0; + List chestItems = new ArrayList<>(); + + Matcher matcher = CHEST_PATTERN.matcher(chest.getName().toString()); + String chestType = (matcher.find() ? matcher.group(1) : "Error"); // we are doing it for sole reason of saving us headache of a spirit pet rarity + + boolean processingContents = false; + for (Text line : chest.getTooltip(null, TooltipContext.BASIC)) { + String lineString = line.getString(); + if (lineString.contains("Contents")) { + processingContents = true; + continue; + } else if (lineString.isEmpty()) { + processingContents = false; + } else if (lineString.contains("Coins") && !processingContents) { + chestPrice = Integer.parseInt(lineString.replaceAll(",", "").replaceAll("\\D", "")); + } + + if (processingContents) { + if (lineString.contains("Essence")) { + matcher = ESSENCE_PATTERN.matcher(lineString); + if (matcher.matches()) { // add to chest value result of multiplying price of essence on it's amount + chestValue += getItemPrice(("ESSENCE_" + matcher.group("type")).toUpperCase()) * Integer.parseInt(matcher.group("amount")); + } + } else { + if (lineString.contains("Spirit")) { // I hate pets in chests. Speaking of which, this is only part of code I'm really not sure of + if (Objects.equals(chestType, "Diamond")) { + chestValue += getItemPrice("Spirit Epic"); // Diamond chest containts epic spirit + } else { + chestValue += getItemPrice(lineString); + } + } else { + chestItems.add(lineString); + } + } + } + } + for (String item : chestItems){ + chestValue += getItemPrice(item); + } + return chestValue-chestPrice; + } + + private long getItemPrice(String itemDisplayName) { + JsonObject bazaarPrices = TooltipInfoType.BAZAAR.getData(); + JsonObject lbinPrices = TooltipInfoType.LOWEST_BINS.getData(); + long itemValue = 0; + String id = dungeonDropsNameToId.get(itemDisplayName); + + if (bazaarPrices == null || lbinPrices == null) return 0; + + if (bazaarPrices.has(id)) { + JsonObject item = bazaarPrices.get(id).getAsJsonObject(); + boolean isPriceNull = item.get("sellPrice").isJsonNull(); + return (isPriceNull ? 0L : item.get("sellPrice").getAsLong()); + } else if (lbinPrices.has(id)) { + return lbinPrices.get(id).getAsLong(); + } + return itemValue; + } + + private String getChestType(String name) { + Matcher matcher = CHEST_PATTERN.matcher(name); + if (matcher.find()) { // add to chest value result of multiplying price of essence on it's amount + return matcher.group(); + } + return name; + } + + // I did a thing :( + final Map dungeonDropsNameToId = new HashMap<>() {{ + put("Enchanted Book (Ultimate Jerry I)", "ENCHANTMENT_ULTIMATE_JERRY_1"); // ultimate books start + put("Enchanted Book (Ultimate Jerry II)", "ENCHANTMENT_ULTIMATE_JERRY_2"); + put("Enchanted Book (Ultimate Jerry III)", "ENCHANTMENT_ULTIMATE_JERRY_3"); + put("Enchanted Book (Bank I)", "ENCHANTMENT_ULTIMATE_BANK_1"); + put("Enchanted Book (Bank II)", "ENCHANTMENT_ULTIMATE_BANK_2"); + put("Enchanted Book (Bank III)", "ENCHANTMENT_ULTIMATE_BANK_3"); + put("Enchanted Book (Combo I)", "ENCHANTMENT_ULTIMATE_COMBO_1"); + put("Enchanted Book (Combo II)", "ENCHANTMENT_ULTIMATE_COMBO_2"); + put("Enchanted Book (No Pain No Gain I)", "ENCHANTMENT_ULTIMATE_NO_PAIN_NO_GAIN_1"); + put("Enchanted Book (No Pain No Gain II)", "ENCHANTMENT_ULTIMATE_NO_PAIN_NO_GAIN_2"); + put("Enchanted Book (Ultimate Wise I)", "ENCHANTMENT_ULTIMATE_WISE_1"); + put("Enchanted Book (Ultimate Wise II)", "ENCHANTMENT_ULTIMATE_WISE_2"); + put("Enchanted Book (Wisdom I)", "ENCHANTMENT_ULTIMATE_WISDOM_1"); + put("Enchanted Book (Wisdom II)", "ENCHANTMENT_ULTIMATE_WISDOM_2"); + put("Enchanted Book (Last Stand I)", "ENCHANTMENT_ULTIMATE_LAST_STAND_1"); + put("Enchanted Book (Last Stand II)", "ENCHANTMENT_ULTIMATE_LAST_STAND_2"); + put("Enchanted Book (Rend I)", "ENCHANTMENT_ULTIMATE_REND_1"); + put("Enchanted Book (Rend II)", "ENCHANTMENT_ULTIMATE_REND_2"); + put("Enchanted Book (Legion I)", "ENCHANTMENT_ULTIMATE_LEGION_1"); + put("Enchanted Book (Swarm I)", "ENCHANTMENT_ULTIMATE_SWARM_1"); + put("Enchanted Book (One For All I)", "ENCHANTMENT_ULTIMATE_ONE_FOR_ALL_1"); + put("Enchanted Book (Soul Eater I)", "ENCHANTMENT_ULTIMATE_SOUL_EATER_1"); // ultimate books end + put("Enchanted Book (Infinite Quiver VI)", "ENCHANTMENT_INFINITE_QUIVER_6"); // enchanted books start + put("Enchanted Book (Infinite Quiver VII)", "ENCHANTMENT_INFINITE_QUIVER_7"); + put("Enchanted Book (Feather Falling VI)", "ENCHANTMENT_FEATHER_FALLING_6"); + put("Enchanted Book (Feather Falling VII)", "ENCHANTMENT_FEATHER_FALLING_7"); + put("Enchanted Book (Rejuvenate I)", "ENCHANTMENT_REJUVENATE_1"); + put("Enchanted Book (Rejuvenate II)", "ENCHANTMENT_REJUVENATE_2"); + put("Enchanted Book (Rejuvenate III)", "ENCHANTMENT_REJUVENATE_3"); + put("Enchanted Book (Overload)", "ENCHANTMENT_OVERLOAD_1"); + put("Enchanted Book (Lethality VI)", "ENCHANTMENT_LETHALITY_6"); + put("Enchanted Book (Thunderlord VII)", "ENCHANTMENT_THUNDERLORD_7"); // enchanted books end + + put("Hot Potato Book", "HOT_POTATO_BOOK"); // HPB, FPB, Recomb (universal drops) + put("Fuming Potato Book", "FUMING_POTATO_BOOK"); + put("Recombobulator 3000", "RECOMBOBULATOR_3000"); + put("Necromancer's Brooch", "NECROMANCER_BROOCH"); + put("ESSENCE_WITHER","ESSENCE_WITHER"); // Essences. Really stupid way of doing this + put("ESSENCE_UNDEAD", "ESSENCE_UNDEAD"); + put("ESSENCE_DRAGON", "ESSENCE_DRAGON"); + put("ESSENCE_SPIDER", "ESSENCE_SPIDER"); + put("ESSENCE_ICE", "ESSENCE_ICE"); + put("ESSENCE_DIAMOND", "ESSENCE_DIAMOND"); + put("ESSENCE_GOLD", "ESSENCE_GOLD"); + put("ESSENCE_CRIMSON", "ESSENCE_CRIMSON"); + put("DUNGEON_CHEST_KEY", "DUNGEON_CHEST_KEY"); + + put("Bonzo's Staff", "BONZO_STAFF"); // F1 M1 + put("Master Skull - Tier 1", "MASTER_SKULL_TIER_1"); + put("Bonzo's Mask", "BONZO_MASK"); + put("Balloon Snake", "BALLOON_SNAKE"); + put("Red Nose", "RED_NOSE"); + + put("Red Scarf", "RED_SCARF"); // F2 M2 + put("Adaptive Blade", "STONE_BLADE"); + put("Master Skull - Tier 2", "MASTER_SKULL_TIER_2"); + put("Adaptive Belt", "ADAPTIVE_BELT"); + put("Scarf's Studies", "SCARF_STUDIES"); + + put("First Master Star", "FIRST_MASTER_STAR"); // F3 M3 + put("Adaptive Helmet", "ADAPTIVE_HELMET"); + put("Adaptive Chestplate", "ADAPTIVE_CHESTPLATE"); + put("Adaptive Leggings", "ADAPTIVE_LEGGINGS"); + put("Adaptive Boots", "ADAPTIVE_BOOTS"); + put("Master Skull - Tier 3", "MASTER_SKULL_TIER_3"); + put("Suspicious Vial", "SUSPICIOUS_VIAL"); + + put("Spirit Sword", "SPIRIT_SWORD"); // F4 M4 + put("Spirit Shortbow", "ITEM_SPIRIT_BOW"); + put("Spirit Boots", "THORNS_BOOTS"); + put("Spirit", "SPIRIT;4"); // Spirit pet (Legendary) + put("Spirit Epic", "SPIRIT;3"); + + put("Second Master Star", "SECOND_MASTER_STAR"); + put("Spirit Wing", "SPIRIT_WING"); + put("Spirit Bone", "SPIRIT_BONE"); + put("Spirit Stone", "SPIRIT_DECOY"); + + put("Shadow Fury", "SHADOW_FURY"); // F5 M5 + put("Last Breath", "LAST_BREATH"); + put("Third Master Star", "THIRD_MASTER_STAR"); + put("Warped Stone", "AOTE_STONE"); + put("Livid Dagger", "LIVID_DAGGER"); + put("Shadow Assassin Helmet", "SHADOW_ASSASSIN_HELMET"); + put("Shadow Assassin Chestplate", "SHADOW_ASSASSIN_CHESTPLATE"); + put("Shadow Assassin Leggings", "SHADOW_ASSASSIN_LEGGINGS"); + put("Shadow Assassin Boots", "SHADOW_ASSASSIN_BOOTS"); + put("Shadow Assassin Cloak", "SHADOW_ASSASSIN_CLOAK"); + put("Master Skull - Tier 4", "MASTER_SKULL_TIER_4"); + put("Dark Orb", "DARK_ORB"); + + put("Precursor Eye", "PRECURSOR_EYE"); // F6 M6 + put("Giant's Sword", "GIANTS_SWORD"); + put("Necromancer Lord Helmet", "NECROMANCER_LORD_HELMET"); + put("Necromancer Lord Chestplate", "NECROMANCER_LORD_CHESTPLATE"); + put("Necromancer Lord Leggings", "NECROMANCER_LORD_LEGGINGS"); + put("Necromancer Lord Boots", "NECROMANCER_LORD_BOOTS"); + put("Fourth Master Star", "FOURTH_MASTER_STAR"); + put("Summoning Ring", "SUMMONING_RING"); + put("Fel Skull", "FEL_SKULL"); + put("Necromancer Sword", "NECROMANCER_SWORD"); + put("Soulweaver Gloves", "SOULWEAVER_GLOVES"); + put("Sadan's Brooch", "SADAN_BROOCH"); + put("Giant Tooth", "GIANT_TOOTH"); + + put("Precursor Gear", "PRECURSOR_GEAR"); // F7 M7 + put("Necron Dye", "DYE_NECRON"); + put("Storm the Fish", "STORM_THE_FISH"); + put("Maxor the Fish", "MAXOR_THE_FISH"); + put("Goldor the Fish", "GOLDOR_THE_FISH"); + put("Dark Claymore", "DARK_CLAYMORE"); + put("Necron's Handle", "NECRON_HANDLE"); + put("Master Skull - Tier 5", "MASTER_SKULL_TIER_5"); + put("Shadow Warp", "SHADOW_WARP_SCROLL"); + put("Wither Shield", "WITHER_SHIELD_SCROLL"); + put("Implosion", "IMPLOSION_SCROLL"); + put("Fifth Master Star", "FIFTH_MASTER_STAR"); + put("Auto Recombobulator", "AUTO_RECOMBOBULATOR"); + put("Wither Helmet", "WITHER_HELMET"); + put("Wither Chestplate", "WITHER_CHESTPLATE"); + put("Wither Leggings", "WITHER_LEGGINGS"); + put("Wither Boots", "WITHER_BOOTS"); + put("Wither Catalyst", "WITHER_CATALYST"); + put("Wither Cloak Sword", "WITHER_CLOAK"); + put("Wither Blood", "WITHER_BLOOD"); + }}; +} + -- cgit From eaac3c5b7c72f9953aa7f2c41ca9ad0873f7464e Mon Sep 17 00:00:00 2001 From: Fluboxer Date: Wed, 21 Feb 2024 23:22:44 +0300 Subject: minor improvements --- .../de/hysky/skyblocker/config/SkyblockerConfig.java | 6 +++--- .../skyblocker/config/categories/DungeonsCategory.java | 16 ++++++++-------- .../hysky/skyblocker/skyblock/dungeon/CroesusProfit.java | 13 ++++--------- src/main/resources/assets/skyblocker/lang/en_us.json | 4 ++-- 4 files changed, 17 insertions(+), 22 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index f8bd61d4..713a9fbd 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -683,9 +683,6 @@ public class SkyblockerConfig { @SerialEntry public boolean croesusHelper = true; - @SerialEntry - public boolean croesusProfit = true; - @SerialEntry public boolean enableMap = true; @@ -868,6 +865,9 @@ public class SkyblockerConfig { @SerialEntry public boolean includeEssence = true; + @SerialEntry + public boolean croesusProfit = true; + @SerialEntry public int neutralThreshold = 1000; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java index f22d9584..9d6e1beb 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java @@ -279,6 +279,14 @@ public class DungeonsCategory { newValue -> config.locations.dungeons.dungeonChestProfit.includeEssence = newValue) .controller(ConfigUtils::createBooleanController) .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonChestProfit.croesusProfit")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonChestProfit.croesusProfit.@Tooltip"))) + .binding(defaults.locations.dungeons.dungeonChestProfit.croesusProfit, + () -> config.locations.dungeons.dungeonChestProfit.croesusProfit, + newValue -> config.locations.dungeons.dungeonChestProfit.croesusProfit = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) .option(Option.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonChestProfit.neutralThreshold")) .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonChestProfit.neutralThreshold.@Tooltip"))) @@ -327,14 +335,6 @@ public class DungeonsCategory { newValue -> config.locations.dungeons.croesusHelper = newValue) .controller(ConfigUtils::createBooleanController) .build()) - .option(Option.createBuilder() - .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.croesusProfit")) - .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.croesusProfit.@Tooltip"))) - .binding(defaults.locations.dungeons.croesusProfit, - () -> config.locations.dungeons.croesusProfit, - newValue -> config.locations.dungeons.croesusProfit = newValue) - .controller(ConfigUtils::createBooleanController) - .build()) .option(Option.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.enableMap")) .binding(defaults.locations.dungeons.enableMap, diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java index a2a82aee..c6099e3e 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java @@ -2,17 +2,13 @@ package de.hysky.skyblocker.skyblock.dungeon; import com.google.gson.JsonObject; import de.hysky.skyblocker.config.SkyblockerConfigManager; -import de.hysky.skyblocker.skyblock.item.tooltip.ItemTooltip; import de.hysky.skyblocker.skyblock.item.tooltip.TooltipInfoType; import de.hysky.skyblocker.utils.render.gui.ColorHighlight; import de.hysky.skyblocker.utils.render.gui.ContainerSolver; -import it.unimi.dsi.fastutil.longs.LongBooleanPair; +import de.hysky.skyblocker.utils.ItemUtils; import net.minecraft.client.item.TooltipContext; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; -import net.minecraft.util.Formatting; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import java.util.*; @@ -20,7 +16,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class CroesusProfit extends ContainerSolver { - private static final Logger LOGGER = LogManager.getLogger(); private static final Pattern ESSENCE_PATTERN = Pattern.compile("(?[A-Za-z]+) Essence x(?[0-9]+)"); private static final Pattern CHEST_PATTERN = Pattern.compile("literal\\{(.*?) Chest}"); public CroesusProfit() { @@ -29,7 +24,7 @@ public class CroesusProfit extends ContainerSolver { @Override protected boolean isEnabled() { - return SkyblockerConfigManager.get().locations.dungeons.croesusProfit; + return SkyblockerConfigManager.get().locations.dungeons.dungeonChestProfit.croesusProfit; } @Override @@ -37,7 +32,7 @@ public class CroesusProfit extends ContainerSolver { List highlights = new ArrayList<>(); ItemStack bestChest = null, secondBestChest = null; long bestValue = 0, secondBestValue = 0; // If negative value of chest - it is out of the question - long dungeonKeyPriceData = getItemPrice("DUNGEON_CHEST_KEY")*2; // lesser ones don't worth the hassle + long dungeonKeyPriceData = getItemPrice("DUNGEON_CHEST_KEY") * 2; // lesser ones don't worth the hassle for (Map.Entry entry : slots.entrySet()) { ItemStack stack = entry.getValue(); @@ -78,7 +73,7 @@ public class CroesusProfit extends ContainerSolver { String chestType = (matcher.find() ? matcher.group(1) : "Error"); // we are doing it for sole reason of saving us headache of a spirit pet rarity boolean processingContents = false; - for (Text line : chest.getTooltip(null, TooltipContext.BASIC)) { + for (Text line : ItemUtils.getNbtTooltips(chest)) { String lineString = line.getString(); if (lineString.contains("Contents")) { processingContents = true; diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 7cfbcce6..63ff4fca 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -245,6 +245,8 @@ "text.autoconfig.skyblocker.option.locations.dungeons.dungeonChestProfit.includeKismet.@Tooltip": "When enabled, if you used a kismet the price of one will be subtracted from the profit", "text.autoconfig.skyblocker.option.locations.dungeons.dungeonChestProfit.includeEssence": "Include Essence", "text.autoconfig.skyblocker.option.locations.dungeons.dungeonChestProfit.includeEssence.@Tooltip": "Disabling is **not recommended** if you're a forgetful person.", + "text.autoconfig.skyblocker.option.locations.dungeons.dungeonChestProfit.croesusProfit": "Croesus Chest Profit Calculator", + "text.autoconfig.skyblocker.option.locations.dungeons.dungeonChestProfit.croesusProfit.@Tooltip": "Highlights chests with the best profit at the Croesus NPC.\n\n\nThe best chest will be highlighted green.\nIf there is a chest worth using dungeon key on, it will be highlighted yellow", "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "Enable Map", "text.autoconfig.skyblocker.option.locations.dungeons.dungeonChestProfit.neutralThreshold": "Neutral Threshold", "text.autoconfig.skyblocker.option.locations.dungeons.dungeonChestProfit.neutralThreshold.@Tooltip": "The threshold below which the profit is considered neutral.", "text.autoconfig.skyblocker.option.locations.dungeons.dungeonChestProfit.neutralColor": "Neutral Color", @@ -252,8 +254,6 @@ "text.autoconfig.skyblocker.option.locations.dungeons.dungeonChestProfit.lossColor": "Loss Color", "text.autoconfig.skyblocker.option.locations.dungeons.croesusHelper": "Croesus Helper", "text.autoconfig.skyblocker.option.locations.dungeons.croesusHelper.@Tooltip": "Gray out chests that have already been opened.", - "text.autoconfig.skyblocker.option.locations.dungeons.croesusProfit": "Croesus Chest Profit Calculator", - "text.autoconfig.skyblocker.option.locations.dungeons.croesusProfit.@Tooltip": "Highlights chests with the best profit at the Croesus NPC.\n\n\nThe best chest will be highlighted green.\nIf there is a chest worth using dungeon key on, it will be highlighted yellow", "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "Enable Map", "text.autoconfig.skyblocker.option.locations.dungeons.mapScreen": "Dungeon Map & Score Placement Config...", "text.autoconfig.skyblocker.option.locations.dungeons.mapScaling": "Map Scaling", "text.autoconfig.skyblocker.option.locations.dungeons.playerSecretsTracker": "Player Secrets Tracker", -- cgit From 019b8ab89993ae6c7f47ee9c19bd8d884f134d4e Mon Sep 17 00:00:00 2001 From: Fluboxer Date: Wed, 21 Feb 2024 23:26:33 +0300 Subject: I don't know what I did, but it should prevent user from shooting calculator in the foot --- .../de/hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java index fc5c7087..d798451e 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java @@ -15,8 +15,8 @@ import java.util.function.Predicate; public enum TooltipInfoType implements Runnable { NPC("https://hysky.de/api/npcprice", itemTooltip -> itemTooltip.enableNPCPrice, true), - BAZAAR("https://hysky.de/api/bazaar", itemTooltip -> itemTooltip.enableBazaarPrice || SkyblockerConfigManager.get().locations.dungeons.dungeonChestProfit.enableProfitCalculator || SkyblockerConfigManager.get().general.chestValue.enableChestValue, itemTooltip -> itemTooltip.enableBazaarPrice, false), - LOWEST_BINS("https://hysky.de/api/auctions/lowestbins", itemTooltip -> itemTooltip.enableLowestBIN || SkyblockerConfigManager.get().locations.dungeons.dungeonChestProfit.enableProfitCalculator || SkyblockerConfigManager.get().general.chestValue.enableChestValue, itemTooltip -> itemTooltip.enableLowestBIN, false), + BAZAAR("https://hysky.de/api/bazaar", itemTooltip -> itemTooltip.enableBazaarPrice || SkyblockerConfigManager.get().locations.dungeons.dungeonChestProfit.enableProfitCalculator || SkyblockerConfigManager.get().locations.dungeons.dungeonChestProfit.croesusProfit || SkyblockerConfigManager.get().general.chestValue.enableChestValue, itemTooltip -> itemTooltip.enableBazaarPrice, false), + LOWEST_BINS("https://hysky.de/api/auctions/lowestbins", itemTooltip -> itemTooltip.enableLowestBIN || SkyblockerConfigManager.get().locations.dungeons.dungeonChestProfit.enableProfitCalculator || SkyblockerConfigManager.get().locations.dungeons.dungeonChestProfit.croesusProfit || SkyblockerConfigManager.get().general.chestValue.enableChestValue, itemTooltip -> itemTooltip.enableLowestBIN, false), ONE_DAY_AVERAGE("https://moulberry.codes/auction_averages_lbin/1day.json", itemTooltip -> itemTooltip.enableAvgBIN, false), THREE_DAY_AVERAGE("https://moulberry.codes/auction_averages_lbin/3day.json", itemTooltip -> itemTooltip.enableAvgBIN || SkyblockerConfigManager.get().general.searchOverlay.enableAuctionHouse, itemTooltip -> itemTooltip.enableAvgBIN, false), MOTES("https://hysky.de/api/motesprice", itemTooltip -> itemTooltip.enableMotesPrice, itemTooltip -> itemTooltip.enableMotesPrice && Utils.isInTheRift(), true), -- cgit From 66d352114f5c318d8415e607856bf17d8163f1f3 Mon Sep 17 00:00:00 2001 From: Fluboxer Date: Wed, 21 Feb 2024 23:42:50 +0300 Subject: Made spirit pet detection more readable --- .../java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java index c6099e3e..aeba1c3f 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java @@ -91,12 +91,8 @@ public class CroesusProfit extends ContainerSolver { chestValue += getItemPrice(("ESSENCE_" + matcher.group("type")).toUpperCase()) * Integer.parseInt(matcher.group("amount")); } } else { - if (lineString.contains("Spirit")) { // I hate pets in chests. Speaking of which, this is only part of code I'm really not sure of - if (Objects.equals(chestType, "Diamond")) { - chestValue += getItemPrice("Spirit Epic"); // Diamond chest containts epic spirit - } else { - chestValue += getItemPrice(lineString); - } + if (lineString.contains("Spirit")) { + chestValue += Objects.equals(chestType, "Diamond") ? getItemPrice("Spirit Epic") : getItemPrice(lineString); } else { chestItems.add(lineString); } -- cgit From f03c1068cad98628a6948c22f7c3f98085a235de Mon Sep 17 00:00:00 2001 From: Fluboxer Date: Thu, 22 Feb 2024 15:44:40 +0300 Subject: Made spirit pet detection use color of text --- .../skyblocker/skyblock/dungeon/CroesusProfit.java | 26 ++++++++-------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java index aeba1c3f..437a6d24 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java @@ -3,21 +3,22 @@ package de.hysky.skyblocker.skyblock.dungeon; import com.google.gson.JsonObject; import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.skyblock.item.tooltip.TooltipInfoType; +import de.hysky.skyblocker.utils.ItemUtils; import de.hysky.skyblocker.utils.render.gui.ColorHighlight; import de.hysky.skyblocker.utils.render.gui.ContainerSolver; -import de.hysky.skyblocker.utils.ItemUtils; -import net.minecraft.client.item.TooltipContext; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; public class CroesusProfit extends ContainerSolver { private static final Pattern ESSENCE_PATTERN = Pattern.compile("(?[A-Za-z]+) Essence x(?[0-9]+)"); - private static final Pattern CHEST_PATTERN = Pattern.compile("literal\\{(.*?) Chest}"); public CroesusProfit() { super(".*Catacombs - Floor.*"); } @@ -69,9 +70,6 @@ public class CroesusProfit extends ContainerSolver { int chestPrice = 0; List chestItems = new ArrayList<>(); - Matcher matcher = CHEST_PATTERN.matcher(chest.getName().toString()); - String chestType = (matcher.find() ? matcher.group(1) : "Error"); // we are doing it for sole reason of saving us headache of a spirit pet rarity - boolean processingContents = false; for (Text line : ItemUtils.getNbtTooltips(chest)) { String lineString = line.getString(); @@ -86,13 +84,13 @@ public class CroesusProfit extends ContainerSolver { if (processingContents) { if (lineString.contains("Essence")) { - matcher = ESSENCE_PATTERN.matcher(lineString); + Matcher matcher = ESSENCE_PATTERN.matcher(lineString); if (matcher.matches()) { // add to chest value result of multiplying price of essence on it's amount chestValue += getItemPrice(("ESSENCE_" + matcher.group("type")).toUpperCase()) * Integer.parseInt(matcher.group("amount")); } } else { - if (lineString.contains("Spirit")) { - chestValue += Objects.equals(chestType, "Diamond") ? getItemPrice("Spirit Epic") : getItemPrice(lineString); + if (lineString.contains("Spirit")) { // TODO: make code like this to detect recombed gear (it can drop with 1% chance, according to wiki, tho I never saw any?) + chestValue += line.getStyle().toString().contains("color=dark_purple") ? getItemPrice("Spirit Epic") : getItemPrice(lineString); } else { chestItems.add(lineString); } @@ -105,6 +103,7 @@ public class CroesusProfit extends ContainerSolver { return chestValue-chestPrice; } + private long getItemPrice(String itemDisplayName) { JsonObject bazaarPrices = TooltipInfoType.BAZAAR.getData(); JsonObject lbinPrices = TooltipInfoType.LOWEST_BINS.getData(); @@ -123,13 +122,6 @@ public class CroesusProfit extends ContainerSolver { return itemValue; } - private String getChestType(String name) { - Matcher matcher = CHEST_PATTERN.matcher(name); - if (matcher.find()) { // add to chest value result of multiplying price of essence on it's amount - return matcher.group(); - } - return name; - } // I did a thing :( final Map dungeonDropsNameToId = new HashMap<>() {{ -- cgit From ba629fe86c1540e409475ddb5db2949b732e48ac Mon Sep 17 00:00:00 2001 From: Fluboxer Date: Thu, 22 Feb 2024 17:00:15 +0300 Subject: added support for shiny armor and hopefully fixed spirit pet price pulling --- .../de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java index 437a6d24..5be83144 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java @@ -195,8 +195,8 @@ public class CroesusProfit extends ContainerSolver { put("Spirit Sword", "SPIRIT_SWORD"); // F4 M4 put("Spirit Shortbow", "ITEM_SPIRIT_BOW"); put("Spirit Boots", "THORNS_BOOTS"); - put("Spirit", "SPIRIT;4"); // Spirit pet (Legendary) - put("Spirit Epic", "SPIRIT;3"); + put("Spirit", "LVL_1_LEGENDARY_SPIRIT"); // Spirit pet (Legendary) + put("Spirit Epic", "LVL_1_EPIC_SPIRIT"); put("Second Master Star", "SECOND_MASTER_STAR"); put("Spirit Wing", "SPIRIT_WING"); @@ -250,6 +250,12 @@ public class CroesusProfit extends ContainerSolver { put("Wither Catalyst", "WITHER_CATALYST"); put("Wither Cloak Sword", "WITHER_CLOAK"); put("Wither Blood", "WITHER_BLOOD"); + + put("Shiny Wither Helmet", "SHINY_WITHER_HELMET"); // M7 shiny drops + put("Shiny Wither Chestplate", "SHINY_WITHER_CHESTPLATE"); + put("Shiny Wither Leggings", "SHINY_WITHER_LEGGINGS"); + put("Shiny Wither Boots", "SHINY_WITHER_BOOTS"); + put("Shiny Necron's Handle", "SHINY_NECRON_HANDLE"); }}; } -- cgit From d31c457e7a95139751e988c57d792623c79e56f0 Mon Sep 17 00:00:00 2001 From: Fluboxer Date: Thu, 22 Feb 2024 17:03:34 +0300 Subject: added support for shiny armor and hopefully fixed spirit pet price pulling --- src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java index 5be83144..841df66b 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java @@ -255,7 +255,7 @@ public class CroesusProfit extends ContainerSolver { put("Shiny Wither Chestplate", "SHINY_WITHER_CHESTPLATE"); put("Shiny Wither Leggings", "SHINY_WITHER_LEGGINGS"); put("Shiny Wither Boots", "SHINY_WITHER_BOOTS"); - put("Shiny Necron's Handle", "SHINY_NECRON_HANDLE"); + put("Shiny Necron's Handle", "SHINY_NECRON_HANDLE"); // cool thing }}; } -- cgit From ba4ab62d90bf0f4636fa22a3e72768f161a1217e Mon Sep 17 00:00:00 2001 From: Fluboxer Date: Thu, 22 Feb 2024 20:55:00 +0300 Subject: added disc's that can rarely replace wither essence --- .../java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java index 841df66b..ca166915 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java @@ -256,6 +256,12 @@ public class CroesusProfit extends ContainerSolver { put("Shiny Wither Leggings", "SHINY_WITHER_LEGGINGS"); put("Shiny Wither Boots", "SHINY_WITHER_BOOTS"); put("Shiny Necron's Handle", "SHINY_NECRON_HANDLE"); // cool thing + + put("Dungeon Disc", "DUNGEON_DISC_1"); + put("Clown Disc", "DUNGEON_DISC_2"); + put("Watcher Disc", "DUNGEON_DISC_3"); + put("Old Disc", "DUNGEON_DISC_4"); + put("Necron Disc", "DUNGEON_DISC_5"); }}; } -- cgit