feat: Allow using fine gemstones for pristine profit tracker
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
package moe.nea.firmament.features.mining
|
||||
|
||||
import io.github.notenoughupdates.moulconfig.xml.Bind
|
||||
@@ -26,16 +25,19 @@ object PristineProfitTracker : FirmamentFeature {
|
||||
|
||||
enum class GemstoneKind(
|
||||
val label: String,
|
||||
val flawedId: SkyblockId,
|
||||
) {
|
||||
SAPPHIRE("Sapphire", SkyblockId("FLAWED_SAPPHIRE_GEM")),
|
||||
RUBY("Ruby", SkyblockId("FLAWED_RUBY_GEM")),
|
||||
AMETHYST("Amethyst", SkyblockId("FLAWED_AMETHYST_GEM")),
|
||||
AMBER("Amber", SkyblockId("FLAWED_AMBER_GEM")),
|
||||
TOPAZ("Topaz", SkyblockId("FLAWED_TOPAZ_GEM")),
|
||||
JADE("Jade", SkyblockId("FLAWED_JADE_GEM")),
|
||||
JASPER("Jasper", SkyblockId("FLAWED_JASPER_GEM")),
|
||||
OPAL("Opal", SkyblockId("FLAWED_OPAL_GEM")),
|
||||
SAPPHIRE("Sapphire"),
|
||||
RUBY("Ruby"),
|
||||
AMETHYST("Amethyst"),
|
||||
AMBER("Amber"),
|
||||
TOPAZ("Topaz"),
|
||||
JADE("Jade"),
|
||||
JASPER("Jasper"),
|
||||
OPAL("Opal"),
|
||||
;
|
||||
|
||||
val flawedId: SkyblockId = SkyblockId("FLAWED_${name}_GEM")
|
||||
val fineId: SkyblockId = SkyblockId("FINE_${name}_GEM")
|
||||
}
|
||||
|
||||
@Serializable
|
||||
@@ -52,6 +54,7 @@ object PristineProfitTracker : FirmamentFeature {
|
||||
object TConfig : ManagedConfig(identifier, Category.MINING) {
|
||||
val timeout by duration("timeout", 0.seconds, 120.seconds) { 30.seconds }
|
||||
val gui by position("position", 80, 30) { Point(0.05, 0.2) }
|
||||
val useFineGemstones by toggle("fine-gemstones") { false }
|
||||
}
|
||||
|
||||
val sellingStrategy = BazaarPriceStrategy.SELL_ORDER
|
||||
@@ -62,6 +65,10 @@ object PristineProfitTracker : FirmamentFeature {
|
||||
}) Gemstone x(?<count>[0-9,]+)!".toPattern()
|
||||
|
||||
val collectionHistogram = Histogram<Double>(10000, 180.seconds)
|
||||
|
||||
/**
|
||||
* Separate histogram for money, since money changes based on gemstone, therefore we cannot calculate money from collection.
|
||||
*/
|
||||
val moneyHistogram = Histogram<Double>(10000, 180.seconds)
|
||||
|
||||
object ProfitHud : MoulConfigHud("pristine_profit", TConfig.gui) {
|
||||
@@ -87,6 +94,8 @@ object PristineProfitTracker : FirmamentFeature {
|
||||
|
||||
val SECONDS_PER_HOUR = 3600
|
||||
val ROUGHS_PER_FLAWED = 80
|
||||
val FLAWED_PER_FINE = 80
|
||||
val ROUGHS_PER_FINE = ROUGHS_PER_FLAWED * FLAWED_PER_FINE
|
||||
|
||||
fun updateUi() {
|
||||
val collectionPerSecond = collectionHistogram.averagePer({ it }, 1.seconds)
|
||||
@@ -123,7 +132,9 @@ object PristineProfitTracker : FirmamentFeature {
|
||||
pristineRegex.useMatch(it.unformattedString) {
|
||||
val gemstoneKind = GemstoneKind.valueOf(group("kind").uppercase())
|
||||
val flawedCount = parseIntWithComma(group("count"))
|
||||
val moneyAmount = sellingStrategy.getSellPrice(gemstoneKind.flawedId) * flawedCount
|
||||
val moneyAmount =
|
||||
if (TConfig.useFineGemstones) sellingStrategy.getSellPrice(gemstoneKind.fineId) * flawedCount / FLAWED_PER_FINE
|
||||
else sellingStrategy.getSellPrice(gemstoneKind.flawedId) * flawedCount
|
||||
moneyHistogram.record(moneyAmount)
|
||||
val collectionAmount = flawedCount * ROUGHS_PER_FLAWED
|
||||
collectionHistogram.record(collectionAmount.toDouble())
|
||||
|
||||
@@ -157,6 +157,8 @@
|
||||
"firmament.config.price-data.enable-keybind": "Enable only with Keybinding",
|
||||
"firmament.config.price-data.enable-keybind.description": "Only show auction/bazaar prices when holding this keybinding. Unbind to always show.",
|
||||
"firmament.config.pristine-profit": "Pristine Profit Tracker",
|
||||
"firmament.config.pristine-profit.fine-gemstones": "Use Fine Gemstones",
|
||||
"firmament.config.pristine-profit.fine-gemstones.description": "Use the (more stable) price of fine gemstones, instead of flawed gemstones.",
|
||||
"firmament.config.pristine-profit.position": "Position",
|
||||
"firmament.config.pristine-profit.position.description": "Edit the pristine profit hud location.",
|
||||
"firmament.config.pristine-profit.timeout": "Timeout (0 = disabled)",
|
||||
|
||||
Reference in New Issue
Block a user