From 7c45e48050e8ee792f391fc660232950a36c494b Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sun, 22 Jun 2025 15:19:01 +0200 Subject: feat: Allow skipping DFU for REI lore cache generation --- src/main/kotlin/repo/ItemCache.kt | 4 ++++ src/main/kotlin/repo/RepoManager.kt | 1 + src/main/kotlin/repo/SBItemStack.kt | 44 +++++++++++++++++++++++++++---------- 3 files changed, 37 insertions(+), 12 deletions(-) (limited to 'src/main') diff --git a/src/main/kotlin/repo/ItemCache.kt b/src/main/kotlin/repo/ItemCache.kt index 09eedac..5e05dba 100644 --- a/src/main/kotlin/repo/ItemCache.kt +++ b/src/main/kotlin/repo/ItemCache.kt @@ -146,6 +146,10 @@ object ItemCache : IReloadable { } } + fun hasCacheFor(skyblockId: SkyblockId): Boolean { + return skyblockId.neuItem in cache + } + fun NEUItem?.asItemStack(idHint: SkyblockId? = null, loreReplacements: Map? = null): ItemStack { if (this == null) return brokenItemStack(null, idHint) var s = cache[this.skyblockItemId] diff --git a/src/main/kotlin/repo/RepoManager.kt b/src/main/kotlin/repo/RepoManager.kt index cc36fba..115dd54 100644 --- a/src/main/kotlin/repo/RepoManager.kt +++ b/src/main/kotlin/repo/RepoManager.kt @@ -46,6 +46,7 @@ object RepoManager { } val alwaysSuperCraft by toggle("enable-super-craft") { true } var warnForMissingItemListMod by toggle("warn-for-missing-item-list-mod") { true } + val perfectTooltips by toggle("perfect-tooltips") { false } } val currentDownloadedSha by RepoDownloadManager::latestSavedVersionHash diff --git a/src/main/kotlin/repo/SBItemStack.kt b/src/main/kotlin/repo/SBItemStack.kt index 3690866..0026e03 100644 --- a/src/main/kotlin/repo/SBItemStack.kt +++ b/src/main/kotlin/repo/SBItemStack.kt @@ -225,14 +225,21 @@ data class SBItemStack constructor( Text.literal( buffKind.prefix + formattedAmount + statFormatting.postFix + - buffKind.postFix + " ") - .withColor(buffKind.color))) + buffKind.postFix + " " + ) + .withColor(buffKind.color) + ) + ) } fun formatValue() = - Text.literal(FirmFormatters.formatCommas(valueNum ?: 0.0, - 1, - includeSign = true) + statFormatting.postFix + " ") + Text.literal( + FirmFormatters.formatCommas( + valueNum ?: 0.0, + 1, + includeSign = true + ) + statFormatting.postFix + " " + ) .setStyle(Style.EMPTY.withColor(statFormatting.color)) val statFormatting = formattingOverrides[statName] ?: StatFormatting("", Formatting.GREEN) @@ -413,13 +420,26 @@ data class SBItemStack constructor( .append(starString(stars)) val isDungeon = ItemType.fromItemStack(itemStack)?.isDungeon ?: true val truncatedStarCount = if (isDungeon) minOf(5, stars) else stars - appendEnhancedStats(itemStack, - baseStats - .filter { it.statFormatting.isStarAffected } - .associate { - it.statName to ((it.valueNum ?: 0.0) * (truncatedStarCount * 0.02)) - }, - BuffKind.STAR_BUFF) + appendEnhancedStats( + itemStack, + baseStats + .filter { it.statFormatting.isStarAffected } + .associate { + it.statName to ((it.valueNum ?: 0.0) * (truncatedStarCount * 0.02)) + }, + BuffKind.STAR_BUFF + ) + } + + fun isWarm(): Boolean { + if (itemStack_ != null) return true + if (ItemCache.hasCacheFor(skyblockId)) return true + return false + } + + fun asLazyImmutableItemStack(): ItemStack? { + if (isWarm()) return asImmutableItemStack() + return null } fun asImmutableItemStack(): ItemStack { -- cgit