diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2023-06-28 08:16:51 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 00:16:51 +0200 |
commit | 3541785a4895f5856a17f229feb95b959c9b3d54 (patch) | |
tree | 0d14a8d8a70b4a8f172dffe0bd39eea5e5331e69 | |
parent | bb46333098315e5e27a82b797cf5326fb770efb3 (diff) | |
download | skyhanni-3541785a4895f5856a17f229feb95b959c9b3d54.tar.gz skyhanni-3541785a4895f5856a17f229feb95b959c9b3d54.tar.bz2 skyhanni-3541785a4895f5856a17f229feb95b959c9b3d54.zip |
Merge pull request #253
* fix
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/FrozenTreasureTracker.kt | 14 |
1 files changed, 10 insertions, 4 deletions
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<FrozenTreasure, Int>() 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<Any>>): List<List<Any>> { |