feat: Multiplier for Price Data (ex. Pressing a Key shows the price for x Item instead of just 1)

This commit is contained in:
jani270
2025-06-04 23:49:05 +02:00
committed by Linnea Gräf
parent 0af721bcb2
commit 33f2c27462

View File

@@ -1,5 +1,6 @@
package moe.nea.firmament.features.inventory
import org.lwjgl.glfw.GLFW
import net.minecraft.text.Text
import moe.nea.firmament.annotations.Subscribe
import moe.nea.firmament.events.ItemTooltipEvent
@@ -8,6 +9,7 @@ import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.repo.HypixelStaticData
import moe.nea.firmament.util.FirmFormatters.formatCommas
import moe.nea.firmament.util.bold
import moe.nea.firmament.util.darkGrey
import moe.nea.firmament.util.gold
import moe.nea.firmament.util.skyBlockId
import moe.nea.firmament.util.tr
@@ -20,6 +22,7 @@ object PriceData : FirmamentFeature {
object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val tooltipEnabled by toggle("enable-always") { true }
val enableKeybinding by keyBindingWithDefaultUnbound("enable-keybind")
val stackSizeKey by keyBinding("stack-size") { GLFW.GLFW_KEY_LEFT_SHIFT }
}
override val config get() = TConfig
@@ -44,28 +47,35 @@ object PriceData : FirmamentFeature {
return
}
val sbId = it.stack.skyBlockId
val stackSize = it.stack.count
val multiplier = if (TConfig.stackSizeKey.isPressed(atLeast = true)) stackSize else 1
val multiplierText =
Text.literal("[").append(TConfig.stackSizeKey.format().string).append(" to show x").append("${stackSize}]")
.darkGrey()
val bazaarData = HypixelStaticData.bazaarData[sbId]
val lowestBin = HypixelStaticData.lowestBin[sbId]
if (bazaarData != null) {
it.lines.add(Text.literal(""))
it.lines.add(multiplierText)
it.lines.add(
formatPrice(
tr("firmament.tooltip.bazaar.sell-order", "Bazaar Sell Order"),
bazaarData.quickStatus.sellPrice
bazaarData.quickStatus.sellPrice * multiplier
)
)
it.lines.add(
formatPrice(
tr("firmament.tooltip.bazaar.buy-order", "Bazaar Buy Order"),
bazaarData.quickStatus.buyPrice
bazaarData.quickStatus.buyPrice * multiplier
)
)
} else if (lowestBin != null) {
it.lines.add(Text.literal(""))
it.lines.add(multiplierText)
it.lines.add(
formatPrice(
tr("firmament.tooltip.ah.lowestbin", "Lowest BIN"),
lowestBin
lowestBin * multiplier
)
)
}