From fcd404d862b4b051474898076fcc06b406d1ea91 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Sun, 7 Apr 2024 21:36:08 +1000 Subject: Backend: Remove a lot of deprecated code (#1371) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/features/slayer/SlayerBossSpawnSoon.kt | 6 +++--- .../skyhanni/features/slayer/SlayerRngMeterDisplay.kt | 15 +++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer') diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt index d4953fb41..5a0fc0cfe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.SlayerAPI import at.hannibal2.skyhanni.events.SlayerProgressChangeEvent import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber +import at.hannibal2.skyhanni.utils.NumberUtil.formatDouble import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -21,7 +21,7 @@ class SlayerBossSpawnSoon { " \\(?(?[0-9.,k]+)/(?[0-9.,k]+)\\)?.*" ) - private var lastCompletion = 0f + private var lastCompletion = 0.0 private var warned = false @SubscribeEvent @@ -30,7 +30,7 @@ class SlayerBossSpawnSoon { if (!SlayerAPI.isInCorrectArea) return val completion = progressPattern.matchMatcher(event.newProgress.removeColor()) { - group("progress").formatNumber().toFloat() / group("total").formatNumber().toFloat() + group("progress").formatDouble() / group("total").formatDouble() } ?: return if (completion > config.percent / 100.0) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt index e2ae877bb..386fbf98a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt @@ -7,15 +7,15 @@ import at.hannibal2.skyhanni.data.SlayerAPI import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.events.SlayerChangeEvent import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore -import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment +import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber +import at.hannibal2.skyhanni.utils.NumberUtil.formatLong import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -48,10 +48,10 @@ class SlayerRngMeterDisplay { private var lastItemDroppedTime = 0L @SubscribeEvent - fun onTick(event: LorenzTickEvent) { + fun onSecondPassed(event: SecondPassedEvent) { if (!isEnabled()) return - if (event.repeatSeconds(1) && lastItemDroppedTime != 0L && System.currentTimeMillis() > lastItemDroppedTime + 4_000) { + if (lastItemDroppedTime != 0L && System.currentTimeMillis() > lastItemDroppedTime + 4_000) { lastItemDroppedTime = 0L update() } @@ -64,7 +64,6 @@ class SlayerRngMeterDisplay { @SubscribeEvent fun onChat(event: LorenzChatEvent) { - if (!isEnabled()) return if (config.hideChat && SlayerAPI.isInCorrectArea) { @@ -74,7 +73,7 @@ class SlayerRngMeterDisplay { } val currentMeter = updatePattern.matchMatcher(event.message) { - group("exp").formatNumber() + group("exp").formatLong() } ?: return val storage = getStorage() ?: return @@ -137,7 +136,7 @@ class SlayerRngMeterDisplay { storage.itemGoal = "" storage.goalNeeded = -1 } else { - storage.itemGoal = selectedItem.nameWithEnchantment + storage.itemGoal = selectedItem.itemName val jsonObject = Constants.RNGSCORE["slayer"].asJsonObject.get(getCurrentSlayer()).asJsonObject storage.goalNeeded = jsonObject.get(selectedItem.getInternalName().asString()).asLong } -- cgit