aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorObsidian <108832807+Obsidianninja11@users.noreply.github.com>2023-09-02 02:34:09 -0800
committerGitHub <noreply@github.com>2023-09-02 12:34:09 +0200
commit63a636cabb1dc64baa5c1970269ceb0db1088e9e (patch)
treebcd8a813bc2e8c9a946a0235d3983a9d7989f286 /src/main
parent95339511e6397004b8da6e6a9425ce3a5be6b834 (diff)
downloadskyhanni-63a636cabb1dc64baa5c1970269ceb0db1088e9e.tar.gz
skyhanni-63a636cabb1dc64baa5c1970269ceb0db1088e9e.tar.bz2
skyhanni-63a636cabb1dc64baa5c1970269ceb0db1088e9e.zip
Composter calculation fix (#433)
Fixed fairly major composter profit calculation with multi-drop #433
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt12
2 files changed, 9 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
index 2f88c52de..aab3b082b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
@@ -16,6 +16,7 @@ import java.util.*
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds
import kotlin.time.DurationUnit
+import kotlin.math.floor
class ComposterDisplay {
private val config get() = SkyHanniMod.feature.garden
@@ -69,8 +70,8 @@ class ComposterDisplay {
val organicMatterRequired = ComposterAPI.organicMatterRequiredPer(null)
val fuelRequired = ComposterAPI.fuelRequiredPer(null)
- val organicMatterRemaining = organicMatter / organicMatterRequired
- val fuelRemaining = fuel / fuelRequired
+ val organicMatterRemaining = floor(organicMatter / organicMatterRequired)
+ val fuelRemaining = floor(fuel / fuelRequired)
val endOfOrganicMatter = timePerCompost * organicMatterRemaining
val endOfFuel = timePerCompost * fuelRemaining
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
index 66c7b2c41..67a288e66 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
@@ -201,9 +201,9 @@ class ComposterOverlay {
val matterPer = ComposterAPI.organicMatterRequiredPer(null)
val matterPerPreview = ComposterAPI.organicMatterRequiredPer(upgrade)
- val matterMaxDuration = ComposterAPI.timePerCompost(null) * (maxOrganicMatter / matterPer)
+ val matterMaxDuration = ComposterAPI.timePerCompost(null) * floor(maxOrganicMatter / matterPer)
val matterMaxDurationPreview =
- ComposterAPI.timePerCompost(upgrade) * (maxOrganicMatterPreview / matterPerPreview)
+ ComposterAPI.timePerCompost(upgrade) * floor(maxOrganicMatterPreview / matterPerPreview)
var format = formatTime(matterMaxDuration)
var formatPreview =
@@ -217,9 +217,9 @@ class ComposterOverlay {
val fuelRequiredPer = ComposterAPI.fuelRequiredPer(null)
val fuelRequiredPerPreview = ComposterAPI.fuelRequiredPer(upgrade)
- val fuelMaxDuration = ComposterAPI.timePerCompost(null) * (maxFuel / fuelRequiredPer)
+ val fuelMaxDuration = ComposterAPI.timePerCompost(null) * floor(maxFuel / fuelRequiredPer)
val fuelMaxDurationPreview =
- ComposterAPI.timePerCompost(upgrade) * (maxFuelPreview / fuelRequiredPerPreview)
+ ComposterAPI.timePerCompost(upgrade) * floor(maxFuelPreview / fuelRequiredPerPreview)
format = formatTime(fuelMaxDuration)
formatPreview =
@@ -350,8 +350,8 @@ class ComposterOverlay {
val priceCompost = getPrice("COMPOST")
- val profit = (priceCompost - (fuelPricePer + organicMatterPricePer)) * multiplier
- val profitPreview = (priceCompost - (fuelPricePerPreview + organicMatterPricePerPreview)) * multiplierPreview
+ val profit = ((priceCompost * multiDropFactor) - (fuelPricePer + organicMatterPricePer))*timeMultiplier
+ val profitPreview = ((priceCompost * multiDropFactorPreview) - (fuelPricePerPreview + organicMatterPricePerPreview))*timeMultiplierPreview
val profitFormatPreview = if (profit != profitPreview) " §c➜ §6" + NumberUtil.format(profitPreview) else ""
val profitFormat = " §7Profit per $timeText: §6${NumberUtil.format(profit)}$profitFormatPreview"