diff options
Diffstat (limited to 'src/main/java')
5 files changed, 61 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 79728810c..fed79b9c3 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -262,6 +262,7 @@ import at.hannibal2.skyhanni.features.inventory.AuctionsHighlighter import at.hannibal2.skyhanni.features.inventory.ChestValue import at.hannibal2.skyhanni.features.inventory.DojoRankDisplay import at.hannibal2.skyhanni.features.inventory.HarpFeatures +import at.hannibal2.skyhanni.features.inventory.HeldTimeInLore import at.hannibal2.skyhanni.features.inventory.HideNotClickableItems import at.hannibal2.skyhanni.features.inventory.HighlightBonzoMasks import at.hannibal2.skyhanni.features.inventory.ItemDisplayOverlayFeatures @@ -947,6 +948,7 @@ class SkyHanniMod { loadModule(SkillTooltip()) loadModule(MaxPurseItems()) loadModule(SuperCraftFeatures) + loadModule(HeldTimeInLore) loadModule(InfernoMinionFeatures()) loadModule(LimboPlaytime) loadModule(CopyPlaytime) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java index 86403f24a..872fb8ad6 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java @@ -127,6 +127,7 @@ public class InventoryConfig { DUNGEON_POTION_LEVEL("§bDungeon Potion Level", 13), VACUUM_GARDEN("§bVacuum (Garden)", 14), BOTTLE_OF_JYRRE("§bBottle Of Jyrre", 15), + DARK_CACAO_TRUFFLE("§bDark Cacao Truffle"), EDITION_NUMBER("§bEdition Number", 16), BINGO_GOAL_RANK("§bBingo Goal Rank"), ; @@ -228,4 +229,10 @@ public class InventoryConfig { @ConfigEditorBoolean @FeatureToggle public boolean shiftClickBrewing = false; + + @Expose + @ConfigOption(name = "Time Held in Lore", desc = "Shows time held for Bottle of Jyrre and Dark Cacao Truffle in the lore.") + @ConfigEditorBoolean + @FeatureToggle + public boolean timeHeldInLore = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HeldTimeInLore.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HeldTimeInLore.kt new file mode 100644 index 000000000..99801a322 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HeldTimeInLore.kt @@ -0,0 +1,37 @@ +package at.hannibal2.skyhanni.features.inventory + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzToolTipEvent +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getBottleOfJyrreSeconds +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getSecondsHeld +import at.hannibal2.skyhanni.utils.TimeUtils.format +import net.minecraft.item.ItemStack +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds + +object HeldTimeInLore { + private val config get() = SkyHanniMod.feature.inventory + + private val jyrreBottle by lazy { "NEW_BOTTLE_OF_JYRRE".asInternalName() } + private val cacaoTruffle by lazy { "DARK_CACAO_TRUFFLE".asInternalName() } + + @SubscribeEvent + fun onTooltip(event: LorenzToolTipEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!config.timeHeldInLore) return + + val seconds = event.itemStack.getSeconds() ?: return + val formatted = seconds.seconds.format() + + event.toolTip.add(10, "§7Time Held: §b$formatted") + } + + private fun ItemStack.getSeconds(): Int? = when (getInternalName()) { + jyrreBottle -> getBottleOfJyrreSeconds() + cacaoTruffle -> getSecondsHeld() + else -> null + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt index 08dec7a4a..9d1df7abd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumbe import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.BINGO_GOAL_RANK import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.BOTTLE_OF_JYRRE import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.COLLECTION_LEVEL +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.DARK_CACAO_TRUFFLE import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.DUNGEON_HEAD_FLOOR_NUMBER import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.DUNGEON_POTION_LEVEL import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.EDITION_NUMBER @@ -48,6 +49,7 @@ import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEdition import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getNewYearCake import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetLevel import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getRanchersSpeed +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getSecondsHeld import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import com.google.gson.JsonArray @@ -243,6 +245,11 @@ object ItemDisplayOverlayFeatures { return "§a${(seconds / 3600)}" } + if (DARK_CACAO_TRUFFLE.isSelected() && internalName == "DARK_CACAO_TRUFFLE".asInternalName()) { + val seconds = item.getSecondsHeld() ?: 0 + return "§a${(seconds / 3600)}" + } + if (EDITION_NUMBER.isSelected()) { item.getEdition()?.let { edition -> if (edition < 1_000) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt index b6cb3a330..1780764cd 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt @@ -179,16 +179,20 @@ object SkyBlockItemModifierUtils { fun ItemStack.getLivingMetalProgress() = getAttributeInt("lm_evo") + fun ItemStack.getSecondsHeld() = getAttributeInt("seconds_held") + fun ItemStack.getBottleOfJyrreSeconds() = getAttributeInt("bottle_of_jyrre_seconds") fun ItemStack.getEdition() = getAttributeInt("edition") fun ItemStack.getNewYearCake() = getAttributeInt("new_years_cake") - fun ItemStack.getEnchantments(): Map<String, Int>? = getExtraAttributes()?.takeIf { it.hasKey("enchantments") }?.run { - val enchantments = this.getCompoundTag("enchantments") - enchantments.keySet.associateWith { enchantments.getInteger(it) } - } + fun ItemStack.getEnchantments(): Map<String, Int>? = getExtraAttributes() + ?.takeIf { it.hasKey("enchantments") } + ?.run { + val enchantments = this.getCompoundTag("enchantments") + enchantments.keySet.associateWith { enchantments.getInteger(it) } + } fun ItemStack.getAppliedPocketSackInASack(): Int? { val data = cachedData |