diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-06-23 00:08:22 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-06-23 00:08:22 +0200 |
commit | 86fe9ce47707cc59f25b78082aff7962d107d95a (patch) | |
tree | 0a3d9f2a30b6e46bd5473b327b602ff1421a4894 /src/main/java/at/hannibal2 | |
parent | d2789b6938fa5db55b7d4fe258c48cacfab1f35d (diff) | |
download | skyhanni-86fe9ce47707cc59f25b78082aff7962d107d95a.tar.gz skyhanni-86fe9ce47707cc59f25b78082aff7962d107d95a.tar.bz2 skyhanni-86fe9ce47707cc59f25b78082aff7962d107d95a.zip |
Fixed maxed rift time being off after teleporting out of wizard portal using Intruder/Porhtal
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt | 1 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt | 18 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt index 0b9bc9fbc..c4b452396 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAgaricusCap.kt @@ -63,7 +63,6 @@ class RiftAgaricusCap { val countDown = System.currentTimeMillis() - startTime val format = TimeUtils.formatDuration(countDown - 1000, showMilliSeconds = true) - event.drawDynamicText(location, "§b$format", 1.5) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt index ffe8097c1..3901d8370 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftTimer.kt @@ -32,7 +32,7 @@ class RiftTimer { val message = event.message " §r§7You have §r§a(?<time>.*)ф §r§7left before the rift collapses!".toPattern().matchMatcher(message) { val time = group("time") - maxTime = formatTime(time) + maxTime = getTime(time) } } @@ -45,23 +45,27 @@ class RiftTimer { "§(?<color>[a7])(?<time>.*)ф Left.*".toPattern().matchMatcher(entry) { val color = group("color") if (color == "7") { - display = emptyList() + val currentTime = getTime(group("time")) + if (currentTime > maxTime) { + maxTime = currentTime + update(currentTime) + } return } - val time = group("time") - val currentTime = formatTime(time) - update(currentTime) + update(getTime(group("time"))) } } } - private fun formatTime(time: String) = TimeUtils.getMillis(time.replace("m", "m ")) + private fun getTime(time: String) = TimeUtils.getMillis(time.replace("m", "m ")) private fun update(currentTime: Long) { if (currentTime == latestTime) return val diff = (currentTime - latestTime) + 1000 latestTime = currentTime - addDiff(diff) + if (latestTime != maxTime) { + addDiff(diff) + } val currentFormat = TimeUtils.formatDuration(currentTime) val percentage = LorenzUtils.formatPercentage(currentTime.toDouble() / maxTime) |