diff options
| author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-04-07 21:36:08 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-07 13:36:08 +0200 |
| commit | fcd404d862b4b051474898076fcc06b406d1ea91 (patch) | |
| tree | 7659d22a41d1529a8d4ebaa62958bc0934596431 /src/main/java/at/hannibal2/skyhanni/features/slayer | |
| parent | 03c416202ccdec17cc46f6d07aae111fa977771a (diff) | |
| download | skyhanni-fcd404d862b4b051474898076fcc06b406d1ea91.tar.gz skyhanni-fcd404d862b4b051474898076fcc06b406d1ea91.tar.bz2 skyhanni-fcd404d862b4b051474898076fcc06b406d1ea91.zip | |
Backend: Remove a lot of deprecated code (#1371)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerBossSpawnSoon.kt | 6 | ||||
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt | 15 |
2 files changed, 10 insertions, 11 deletions
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 { " \\(?(?<progress>[0-9.,k]+)/(?<total>[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 } |
