aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-05-26 23:02:48 +1000
committerGitHub <noreply@github.com>2024-05-26 15:02:48 +0200
commitf67af16eacb6cdf3598183d473f072d123ef8a25 (patch)
tree62d11d0f5191d48eee31a630a0b054baeb89a509 /src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt
parent29657e24412baa7be9a1681593593368f92de26f (diff)
downloadskyhanni-f67af16eacb6cdf3598183d473f072d123ef8a25.tar.gz
skyhanni-f67af16eacb6cdf3598183d473f072d123ef8a25.tar.bz2
skyhanni-f67af16eacb6cdf3598183d473f072d123ef8a25.zip
Backend: Convert stuff to SimpleTimeMark (#1777)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt
index f4235cb73..3d3be9c3a 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt
@@ -15,6 +15,7 @@ import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull
import at.hannibal2.skyhanni.utils.NEUItems.getPrice
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.RecalculatingValue
+import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.TimeLimitedCache
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.minutes
@@ -24,20 +25,15 @@ object SlayerAPI {
private var nameCache = TimeLimitedCache<Pair<NEUInternalName, Int>, Pair<String, Double>>(1.minutes)
- var questStartTime = 0L
+ var questStartTime = SimpleTimeMark.farPast()
var isInCorrectArea = false
var isInAnyArea = false
var latestSlayerCategory = ""
- private var latestProgressChangeTime = 0L
- var latestWrongAreaWarning = 0L
+ var latestWrongAreaWarning = SimpleTimeMark.farPast()
var latestSlayerProgress = ""
fun hasActiveSlayerQuest() = latestSlayerCategory != ""
- fun getLatestProgressChangeTime() = if (latestSlayerProgress == "§eSlay the boss!") {
- System.currentTimeMillis()
- } else latestProgressChangeTime
-
fun getItemNameAndPrice(internalName: NEUInternalName, amount: Int): Pair<String, Double> =
nameCache.getOrPut(internalName to amount) {
val amountFormat = if (amount != 1) "§7${amount}x §r" else ""
@@ -76,7 +72,7 @@ object SlayerAPI {
if (!LorenzUtils.inSkyBlock) return
if (event.message.contains("§r§5§lSLAYER QUEST STARTED!")) {
- questStartTime = System.currentTimeMillis()
+ questStartTime = SimpleTimeMark.now()
}
if (event.message == " §r§a§lSLAYER QUEST COMPLETE!") {
@@ -118,7 +114,6 @@ object SlayerAPI {
if (latestSlayerProgress != slayerProgress) {
SlayerProgressChangeEvent(latestSlayerProgress, slayerProgress).postAndCatch()
latestSlayerProgress = slayerProgress
- latestProgressChangeTime = System.currentTimeMillis()
}
if (event.isMod(5)) {