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') 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