From 9d2361ec88296eab1e03bf4e944ef6b4f4e14b62 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 17 Jan 2023 23:08:40 +0100 Subject: Fixed steaming hot flounder in custom trophy fish counter. --- CHANGELOG.md | 3 +++ .../java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt | 1 - .../java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt | 3 ++- src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80caf86cd..6c265786b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ + Added Crimson Isle Reputation Helper. + Added Barn Timer - Shows the time and amount of sea creatures while fishing on the barn via hub. +### Fixes ++ Fixed steaming hot flounder in custom trophy fish counter. + ## Version 0.14 ### Features diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt index c83e28ae8..baa5898c8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt @@ -96,7 +96,6 @@ class BarnFishingTimer { if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.fishing.barnTimer) return if (!rightLocation) return - if (currentCount == 0) return val duration = System.currentTimeMillis() - startTime diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt index 2db229525..2bf5bb2ce 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/TrophyFishMessages.kt @@ -44,6 +44,7 @@ class TrophyFishMessages { if (!SkyHanniMod.feature.fishing.trophyCounter) return val message = event.message + //TODO replace logic with regex if (message.startsWith("§6§lTROPHY FISH! §r§bYou caught a")) { var displayName = if (message.contains(" a §r")) message.between(" a §r", "§r §r") else message.between(" an §r", "§r §r") @@ -53,7 +54,7 @@ class TrophyFishMessages { } val rarity = message.between("§r §r", "§b.").lowercase().replace("§l", "") - val name = (rarity + "_" + displayName).removeColor().lowercase().replace(" ", "") + val name = (rarity + "_" + displayName).removeColor().lowercase().replace(" ", "").replace("-", "") val amount = map.getOrDefault(name, 0) + 1 map[name] = amount event.blockedReason = "trophy_fish" diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 7dea12015..83152f486 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -107,6 +107,7 @@ object LorenzUtils { return kotlin.math.round(this * multiplier) / multiplier } + // TODO replace all calls with regex fun String.between(start: String, end: String): String = this.split(start, end)[1] val EntityLivingBase.baseMaxHealth: Double -- cgit