Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
8234ab4
I don't understnad
Fazfoxy Nov 9, 2025
f26f86b
I somehow understand what is broken less now, whar
Fazfoxy Nov 9, 2025
235d6fa
Enchanted Book price resolution makes me feel like I am clueless as hell
Fazfoxy Nov 9, 2025
3f60c8d
actually functions thanks to nopo
Fazfoxy Nov 10, 2025
489b08a
actual Attribute Detection (and it works!)
Fazfoxy Nov 10, 2025
cc62ac9
Highlight, Book Shenanigans & Ignore already Opened Chests & Nicer lo…
Fazfoxy Nov 10, 2025
0fa75ff
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Nov 10, 2025
43c1ea6
slightly nicer tooltip on Chests
Fazfoxy Nov 10, 2025
67069a4
detekt and sillyness
Fazfoxy Nov 10, 2025
a1846ea
non nullable internalName
Fazfoxy Nov 10, 2025
ded0e89
detekt
Fazfoxy Nov 10, 2025
afad11c
currentLoreLine --> loreLine (why did I make it current that's stupid)
Fazfoxy Nov 13, 2025
51bb08f
Book resolution MUCH Cleaner
Fazfoxy Nov 13, 2025
e4801a9
formatting
Fazfoxy Nov 13, 2025
bb55ce6
detekt
Fazfoxy Nov 13, 2025
9c5e715
Useless Reset removal.
Fazfoxy Nov 14, 2025
d45d291
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Nov 14, 2025
a33c6b7
Merge branch 'refs/heads/beta' into fork/Fazfoxy/Croesus-Profit-Overlay
hannibal002 Nov 14, 2025
5a786ac
cleanup
hannibal002 Nov 14, 2025
9aad050
I can't actually think of a way to do this that isn't reliant on rend…
Fazfoxy Nov 14, 2025
eaa3321
the mega commit of review changes (oops)
Fazfoxy Nov 14, 2025
ecbcd3c
Lies now
Fazfoxy Nov 14, 2025
db675b2
detekt less hating of me?
Fazfoxy Nov 14, 2025
79126dd
Books decided to give up on working, I'm not even sure how or why thi…
Fazfoxy Nov 14, 2025
920d145
lets not use renderable.table to create lists actually
Fazfoxy Nov 14, 2025
49de033
Config name for new feature felt silly
Fazfoxy Nov 14, 2025
96c09b7
maybe make config link work
Fazfoxy Nov 14, 2025
2dc3ae6
using more strings
hannibal002 Nov 14, 2025
a606718
no longer throw Missing Item Errors at the user
Fazfoxy Nov 14, 2025
951fb39
This should be a good name for the future if someone inexplicably add…
Fazfoxy Nov 14, 2025
27a5e40
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Nov 15, 2025
0f2cded
TODO & Explainer comments for the next person to touch this feature.
Fazfoxy Nov 16, 2025
bfa33e0
more proper explanation & direct links for an exact point at which it…
Fazfoxy Nov 16, 2025
d309956
I don't understnad
Fazfoxy Nov 9, 2025
45e7660
I somehow understand what is broken less now, whar
Fazfoxy Nov 9, 2025
f0153af
Enchanted Book price resolution makes me feel like I am clueless as hell
Fazfoxy Nov 9, 2025
d888cec
actually functions thanks to nopo
Fazfoxy Nov 10, 2025
9082c0e
actual Attribute Detection (and it works!)
Fazfoxy Nov 10, 2025
c646fda
Highlight, Book Shenanigans & Ignore already Opened Chests & Nicer lo…
Fazfoxy Nov 10, 2025
a8448b0
slightly nicer tooltip on Chests
Fazfoxy Nov 10, 2025
fb92079
detekt and sillyness
Fazfoxy Nov 10, 2025
67e5058
non nullable internalName
Fazfoxy Nov 10, 2025
f2a0a5a
detekt
Fazfoxy Nov 10, 2025
692ca06
currentLoreLine --> loreLine (why did I make it current that's stupid)
Fazfoxy Nov 13, 2025
44289dc
Book resolution MUCH Cleaner
Fazfoxy Nov 13, 2025
2491885
formatting
Fazfoxy Nov 13, 2025
3e59818
detekt
Fazfoxy Nov 13, 2025
9ef813b
Useless Reset removal.
Fazfoxy Nov 14, 2025
aec77c0
merge conflicts
hannibal002 Nov 14, 2025
4b5b8c1
I can't actually think of a way to do this that isn't reliant on rend…
Fazfoxy Nov 14, 2025
f9ee2fd
the mega commit of review changes (oops)
Fazfoxy Nov 14, 2025
dadbc10
Lies now
Fazfoxy Nov 14, 2025
406b9f0
detekt less hating of me?
Fazfoxy Nov 14, 2025
f976292
merge conflicts
Fazfoxy Nov 14, 2025
421a94e
lets not use renderable.table to create lists actually
Fazfoxy Nov 14, 2025
44a4563
Config name for new feature felt silly
Fazfoxy Nov 14, 2025
7f22ab1
maybe make config link work
Fazfoxy Nov 14, 2025
0fce0b2
using more strings
hannibal002 Nov 14, 2025
3690c7a
no longer throw Missing Item Errors at the user
Fazfoxy Nov 14, 2025
cdecdc1
This should be a good name for the future if someone inexplicably add…
Fazfoxy Nov 14, 2025
9a01904
merge conflicts
Fazfoxy Nov 16, 2025
25bcacc
Merge remote-tracking branch 'origin/Croesus-Profit-Overlay' into Cro…
Fazfoxy Nov 25, 2025
0e25aca
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Nov 26, 2025
6ba47cb
Merge branch 'beta' into Croesus-Profit-Overlay
Fazfoxy Nov 26, 2025
8e63fea
Merge remote-tracking branch 'origin/Croesus-Profit-Overlay' into Cro…
Fazfoxy Nov 26, 2025
962c539
Kuudra chest fix
Fazfoxy Nov 28, 2025
1685e3d
I'm not even sure what's going on here because I'm pretty sure Blox i…
Fazfoxy Dec 3, 2025
b69c0b6
Dungeon Chest Key Fix
Fazfoxy Dec 4, 2025
d91d987
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Dec 4, 2025
7f94081
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Dec 15, 2025
d64052c
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Dec 17, 2025
35c334d
Fix Book resolving in Chests on 1.21 due to falty pattern with starti…
Fazfoxy Dec 18, 2025
f7e4caa
Merge branch 'beta' into Croesus-Profit-Overlay
Fazfoxy Dec 20, 2025
8fb64f1
actually works
Fazfoxy Dec 20, 2025
09bbc0b
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Dec 20, 2025
ecde674
pain
Fazfoxy Dec 20, 2025
f5eecbd
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Dec 21, 2025
001ac93
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Dec 26, 2025
3357e6c
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Jan 7, 2026
0298c91
fixed Multiple Copies of Chests & added runnable
Fazfoxy Jan 7, 2026
954cadf
Detekt?
Fazfoxy Jan 7, 2026
01c7139
Wood Chest Fix from 2 weeks ago error
Fazfoxy Jan 8, 2026
857277d
Merge remote-tracking branch 'origin/beta' into Croesus-Profit-Overlay
Fazfoxy Jan 8, 2026
93a47d4
Renderable Vertical & Merge Conflicts
Fazfoxy Jan 8, 2026
1593eea
Should be entirely Paritied with before.
Fazfoxy Jan 8, 2026
fa536ef
non functional Favouriting System
Fazfoxy Jan 9, 2026
90fbfbb
actually Functional Favouriting !!!
Fazfoxy Jan 9, 2026
5668d76
detekt stuff
Fazfoxy Jan 9, 2026
0a1bded
more detekt stuff
Fazfoxy Jan 9, 2026
57f2ad1
final detekt stuff for now
Fazfoxy Jan 9, 2026
77c3be2
Should Probably Not break the other feature.
Fazfoxy Jan 9, 2026
8f7fcdf
fixed other chest feature (oops) and did the Todo & marked favourites…
Fazfoxy Jan 9, 2026
fff0f55
Detekt Surely
Fazfoxy Jan 9, 2026
d203d50
Formatting & wording
Fazfoxy Jan 9, 2026
5918aa1
allow favouriting outside of Chests & Detekt, again
Fazfoxy Jan 9, 2026
e960972
remove the British, but detekt doesn't pick this one up.
Fazfoxy Jan 9, 2026
b3ba607
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Jan 9, 2026
3b156ed
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Jan 17, 2026
24642ee
Favourites in Instance Chest GUI & Favourites work on Wood Chest
Fazfoxy Jan 17, 2026
f9b155e
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Jan 19, 2026
6f21a83
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Jan 23, 2026
2acb400
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Jan 24, 2026
fa51f12
Merge branch 'hannibal002:beta' into Croesus-Profit-Overlay
Fazfoxy Jan 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigLink
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption

class InstanceChestProfitConfig {
// TODO since this feature toggle no longer enables the whole category, it should be renamed
@Expose
@ConfigOption(name = "Instance Chest Profit", desc = "Display chest profit for dungeons and kuudra.")
@ConfigEditorBoolean
Expand All @@ -27,4 +28,23 @@ class InstanceChestProfitConfig {
@Expose
@ConfigLink(owner = InstanceChestProfitConfig::class, field = "enabled")
val position: Position = Position(107, 141)

@Expose
@ConfigOption(name = "Croesus Chest Price Overlay", desc = "Display each chests' profit for Dungeons and Kuudra.")
@ConfigEditorBoolean
@FeatureToggle
var croesusEnabled: Boolean = false

@Expose
@ConfigOption(
name = "Croesus Chest Highlight",
desc = "Highlights most profitable chest for Dungeons and Kuudra.\n §4THIS RELIES ON CROESUS OVERLAY.",
)
@ConfigEditorBoolean
@FeatureToggle
var croesusHighlight: Boolean = true

@Expose
@ConfigLink(owner = InstanceChestProfitConfig::class, field = "croesusEnabled")
val croesusPosition: Position = Position(107, 141)
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package at.hannibal2.skyhanni.features.combat

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.api.enoughupdates.ItemResolutionQuery
import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
Expand All @@ -11,19 +13,27 @@
import at.hannibal2.skyhanni.features.nether.kuudra.KuudraApi
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ItemPriceUtils.formatCoin
import at.hannibal2.skyhanni.utils.ItemPriceUtils.getPriceOrNull
import at.hannibal2.skyhanni.utils.ItemPriceUtils.getPrice
import at.hannibal2.skyhanni.utils.ItemPriceUtils.getRawCraftCostOrNull
import at.hannibal2.skyhanni.utils.ItemUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName

Check warning on line 19 in src/main/java/at/hannibal2/skyhanni/features/combat/InstanceChestProfit.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.formatting.NoUnusedImports

Unused import
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.repoItemName
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzRarity
import at.hannibal2.skyhanni.utils.NeuInternalName
import at.hannibal2.skyhanni.utils.NeuInternalName.Companion.MISSING_ITEM
import at.hannibal2.skyhanni.utils.NeuInternalName.Companion.toInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.formatInt
import at.hannibal2.skyhanni.utils.PetUtils
import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.RenderUtils.highlight
import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderable
import at.hannibal2.skyhanni.utils.collection.CollectionUtils.addOrPut
import at.hannibal2.skyhanni.utils.collection.CollectionUtils.toSingletonListOrEmpty
import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.renderables.container.table.TableRenderable.Companion.table
import at.hannibal2.skyhanni.utils.renderables.primitives.emptyText
Expand Down Expand Up @@ -81,11 +91,89 @@
"§.\\w+ Kuudra Key",
)

/**
* REGEX-TEST: Master Catacombs - Floor II
* REGEX-TEST: Catacombs - Floor V
* REGEX-TEST: Kuudra - Infernal
*/
private val runNameCroesus by patternGroup.pattern(
"runname",
".*Catacombs - Flo.*|Kuudra - .*",
)

/**
* REGEX-TEST: §6Paid Chest
* REGEX-TEST: §6Paid
* REGEX-TEST: §fFree Chest
* REGEX-TEST: §fFree
*/
/* Dungeon chests are just the chest Type for example just 'Emerald', Kuudra CURRENTLY has them as Free Chest/Paid Chest in the same UI
if the Croesus main UI shows just Paid/Free this regex pattern should be removable mainly
if the Croesus UI starts showing like "Emerald Chest" as the Chest Name the Regex should include all the cata chest names too then. */
private val chestFutureProofing by patternGroup.pattern(
"kuudrachest",
"§.(?<chestname>Free|Paid)(?: Chest)?",
)

/**
* REGEX-TEST: §61,000,000 Coins
* REGEX-TEST: §aFREE
* REGEX-TEST: §6250,000 Coins
*/
private val chestCostCroesus by patternGroup.pattern(
"croesuscost",
"§6(?<amount>.*) Coins|§aFREE",
)

/**
* REGEX-TEST: §aAlready opened!'
*/
private val alreadyOpened by patternGroup.pattern(
"alreadyopened",
"§aAlready opened!",
)

/**
* REGEX-TEST: §d§lUltimate Wise I§f
* REGEX-TEST: §d§lCombo I§f
*/
private val bookColorFixer by patternGroup.pattern(
"bookcolorfix",
"(?<item>.+)(?:§.)+",
)

private val config get() = SkyHanniMod.feature.combat.instanceChestProfit

// TODO replace those three "in chest" booleans with inventory detectors
private var inDungeonChest = false
private var inKuudraChest = false
private var display: Renderable? = null
private var inCroesusRunMenu = false
private var chestDisplay: Renderable? = null
private var croesusDisplay: Renderable? = null
private val croesusDisplayList = mutableListOf<List<Renderable>>()
private var slotToHighlight = Pair(-1, 0.0)

enum class CroesusChestType(val stackChestName: String) {
WOOD("§fWood"),
GOLD("§6Gold"),
DIAMOND("§bDiamond"),
EMERALD("§2Emerald"),
OBSIDIAN("§5Obsidian"),
BEDROCK("§8Bedrock"),
FREE("§fFree"),
PAID("§6Paid"),
;

companion object {
fun getByStackName(stackName: String): CroesusChestType? {
var newStackName = stackName
chestFutureProofing.matchMatcher(stackName) {
newStackName = group("chestname")
}
return entries.firstOrNull { it.stackChestName == newStackName }
}
}
}

@HandleEvent
fun onInventoryOpen(event: InventoryFullyOpenedEvent) {
Expand All @@ -101,38 +189,132 @@
inKuudraChest = true
}

runNameCroesus.matches(name) -> inCroesusRunMenu = true

else -> return
}
inCroesusRunMenu = true

event.inventoryItems.forEach {
val chestType = CroesusChestType.getByStackName(it.value.displayName)
if (chestType != null) parseCroesusChest(it.value, chestType, it.key)
}

createCroesusDisplay()

createDisplay(event.inventoryItems)
}

@HandleEvent(priority = HandleEvent.LOWEST, onlyOnSkyblock = true)
fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) {
if (inCroesusRunMenu && slotToHighlight.first != -1 && config.croesusHighlight) {
event.container.inventorySlots[slotToHighlight.first].highlight(LorenzColor.GREEN)
}
}

@HandleEvent(InventoryCloseEvent::class)
fun onInventoryClose() {
inDungeonChest = false
inKuudraChest = false
inCroesusRunMenu = false
croesusDisplayList.clear()
slotToHighlight = Pair(-1, 0.0)
croesusDisplay = null
}

private fun parseCroesusChest(itemStack: ItemStack?, chestType: CroesusChestType, slot: Int) {
val chestList = mutableListOf<NeuInternalName>()
val chestTipsRenderables = mutableListOf<Renderable>()
chestTipsRenderables.add(Renderable.text("${chestType.stackChestName}:"))
var totalPrice = 0.0
var cost = 0.0
itemStack?.getLore()?.forEach { loreLine ->
if (alreadyOpened.matches(loreLine)) return
var itemPrice: Double
var itemName = ItemUtils.readBookType(loreLine) ?: loreLine
var itemInternalName = NeuInternalName.fromItemName(itemName)
bookColorFixer.matchMatcher(itemName) {
itemName = ItemResolutionQuery.resolveEnchantmentByName(group("item")) ?: itemName
itemInternalName = itemName.toInternalName()
}
if (itemInternalName != MISSING_ITEM) {
itemPrice = itemInternalName.getPrice(config.priceSource)
essencePattern.matchMatcher(loreLine) {
itemPrice = getEssence(group("name"), group("count").toInt())
}
if (dungeonChestKey.matches(loreLine)) {
cost += itemInternalName.getPrice(config.priceSource).times(-1)
itemPrice = -1.0
}
if (itemPrice != -1.0) {
chestTipsRenderables.add(Renderable.text(" ${itemInternalName.repoItemName}: ${itemPrice.formatCoin()} "))
totalPrice += itemPrice
chestList.add(itemInternalName)
}
kuudraChestKey.matchMatcher(loreLine) {
cost += itemInternalName.getRawCraftCostOrNull(config.priceSource)?.times(-1) ?: 0.0
}
}
chestCostCroesus.matchMatcher(loreLine) {
cost += groupOrNull("amount")?.formatInt()?.toDouble()?.times(-1) ?: 0.0
}
}
val preCostPrice = totalPrice
totalPrice += cost
if (slotToHighlight.second < totalPrice) slotToHighlight = Pair(slot, totalPrice)
chestTipsRenderables.add(Renderable.text("Cost: ${cost.formatCoin()}"))
chestTipsRenderables.add(Renderable.text("Profit: ${totalPrice.formatCoin()} §f(Pre Cost Profit ${preCostPrice.formatCoin()}§f)"))
croesusDisplayList.add(createCroesusSingleChestDisplay(chestType, totalPrice, chestTipsRenderables))
chestList.clear()
}

private fun createCroesusSingleChestDisplay(
chestType: CroesusChestType,
totalValue: Double,
contents: MutableList<Renderable>,
): List<Renderable> = Renderable.hoverTips(
Renderable.text("${chestType.stackChestName}: ${totalValue.formatCoin()}"),
contents,
).toSingletonListOrEmpty()

private fun createCroesusDisplay() {
val newDisplay = buildList {
add(listOf(Renderable.text("§6§lCroesus Profit Overlay")))
croesusDisplayList.forEach {
add(it)
}
}
croesusDisplay = Renderable.table(newDisplay, ySpacing = 1)
}

private fun getEssence(name: String, rawCount: Int): Double {
val count = if (name == "Crimson") rawCount * (1 + getKuudraEssenceBonus())
else rawCount.toDouble()
return count * (NeuInternalName.fromItemName(name).getPrice(config.priceSource))
}

private fun getAttribute(attributeName: String): Double = attributeShardPattern.matchMatcher(attributeName) {
val name = group("name")
val count = group("count").toInt()
count * (NeuInternalName.fromItemName(name).getPrice(config.priceSource))
} ?: 0.0

private fun createDisplay(items: Map<Int, ItemStack>) {
val itemsWithCost: MutableMap<String, Double> = mutableMapOf()
items.forEach {
if (it.value.getInternalNameOrNull() != null) {
val cost = EstimatedItemValueCalculator.getTotalPrice(it.value)
if (cost != null) itemsWithCost.addOrPut(it.value.getInternalName().repoItemName, cost)
val itemsWithCost = mutableMapOf<String, Double>()
for (item in items.values) {
if (item.getInternalNameOrNull() != null) {
val cost = EstimatedItemValueCalculator.getTotalPrice(item)
if (cost != null) itemsWithCost.addOrPut(item.repoItemName, cost)
}
attributeShardPattern.matchMatcher(it.value.displayName) {
val name = group("name")
val count = group("count").toInt()
val price = count * (NeuInternalName.fromItemName(name).getPriceOrNull(config.priceSource) ?: 0.0)
itemsWithCost.addOrPut(it.value.displayName, price)
val name = item.displayName
if (attributeShardPattern.matches(name)) {
val price = getAttribute(name)
itemsWithCost.addOrPut(name, price)
}
essencePattern.matchMatcher(it.value.displayName) {
val name = group("name")
val rawCount = group("count").toInt()
val count = if (name == "Crimson") rawCount * (1 + getKuudraEssenceBonus())
else rawCount.toDouble()
val price = count * (NeuInternalName.fromItemName(name).getPriceOrNull(config.priceSource) ?: 0.0)
itemsWithCost.addOrPut(it.value.displayName, price)
essencePattern.matchMatcher(name) {
val price = getEssence(group("name"), group("count").toInt())
// TODO remove if check, getEssence should return null if no price is found
if (price != 0.0) itemsWithCost.addOrPut(name, price)
}
}

Expand All @@ -144,7 +326,7 @@
}
dungeonChestKey.matchMatcher(it) {
val name = NeuInternalName.fromItemName(it)
itemsWithCost.put(it, name.getPriceOrNull(config.priceSource)?.times(-1) ?: 0.0)
itemsWithCost.put(it, name.getPrice(config.priceSource).times(-1))
}
kuudraChestKey.matchMatcher(it) {
val name = NeuInternalName.fromItemName(it)
Expand Down Expand Up @@ -189,11 +371,11 @@
add(listOf(Renderable.text("$color§lProfit"), Renderable.text("$color ${total.formatCoin()}")))
}

display = Renderable.table(newDisplay, ySpacing = 1)
chestDisplay = Renderable.table(newDisplay, ySpacing = 1)
}

private fun getKuudraEssenceBonus(): Double {
return ProfileStorageData.petProfiles?.pets?.filter { PetUtils.getPetProperName(it.fauxInternalName) == "KUUDRA" }
private fun getKuudraEssenceBonus(): Double =
ProfileStorageData.petProfiles?.pets?.filter { PetUtils.getPetProperName(it.fauxInternalName) == "KUUDRA" }
?.maxByOrNull { it.rarity.id }
?.let {
when (it.rarity) {
Expand All @@ -202,12 +384,20 @@
else -> 0.0
}
} ?: 0.0
}

@HandleEvent(GuiRenderEvent::class)
fun onRenderOverlay() {
if (!config.enabled || (!inDungeonChest && !inKuudraChest)) return

config.position.renderRenderable(display, posLabel = "Instance Chest Profit")
if (config.enabled && (inDungeonChest || inKuudraChest)) {
config.position.renderRenderable(
chestDisplay,
posLabel = "Instance Chest Profit",
)
}
if (config.croesusEnabled && inCroesusRunMenu) {
config.croesusPosition.renderRenderable(
croesusDisplay,
posLabel = "Croesus Chest Profit",
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ object CrystalNucleusApi {
if (itemName.contains(" Powder")) return null
// Books are not directly added to the loot map, but are checked for later.
if (itemName.startsWith("§fEnchanted")) {
val bookType = ItemUtils.readBookType(itemName)
val bookType = ItemUtils.readBookTypeStrippedColor(itemName)
return when (bookType) {
"Lapidary I" -> LAPIDARY_I_BOOK_ITEM to 1
"Fortune IV" -> FORTUNE_IV_BOOK_ITEM to 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ object FossilExcavatorApi {
ItemUtils.readItemAmount(group("item"))
} ?: return

ItemUtils.readBookType(pair.first)?.let {
ItemUtils.readBookTypeStrippedColor(pair.first)?.let {
pair = it to pair.second
}
loot.add(pair)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ object CorpseApi {
} ?: return

if (pair.first.startsWith("§fEnchanted Book (")) {
val book = ItemUtils.readBookType(pair.first) ?: return
val book = ItemUtils.readBookTypeStrippedColor(pair.first) ?: return
pair = book to pair.second
}
loot.add(pair)
Expand Down
Loading
Loading