From 3541785a4895f5856a17f229feb95b959c9b3d54 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Wed, 28 Jun 2023 08:16:51 +1000 Subject: Merge pull request #253 * fix --- .../skyhanni/features/misc/FrozenTreasureTracker.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/FrozenTreasureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/FrozenTreasureTracker.kt index 10c2f0bd6..c31135431 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/FrozenTreasureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/FrozenTreasureTracker.kt @@ -35,7 +35,7 @@ class FrozenTreasureTracker { private var treasureCount = mapOf() init { - fixedRateTimer(name = "skyhanni-dungeon-milestone-display", period = 15_000) { + fixedRateTimer(name = "skyhanni-dungeon-milestone-display", period = 1000) { if (!onJerryWorkshop()) return@fixedRateTimer calculateIcePerHour() } @@ -52,9 +52,17 @@ class FrozenTreasureTracker { private fun calculateIcePerHour() { val difference = estimatedIce - lastEstimatedIce lastEstimatedIce = estimatedIce + + if (difference == estimatedIce) { + return + } + + icePerHour = icePerMin.average().toInt() * 3600 + icePerMin.add(difference) + if (difference == 0L) { stoppedChecks += 1 - if (stoppedChecks == 12) { + if (stoppedChecks == 60) { stoppedChecks = 0 icePerMin.clear() icePerHour = 0 @@ -62,8 +70,6 @@ class FrozenTreasureTracker { return } stoppedChecks = 0 - icePerMin.add(difference) - if (difference != estimatedIce) icePerHour = icePerMin.average().toInt() * 240 } private fun formatDisplay(map: List>): List> { -- cgit