aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-29 15:42:01 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-29 15:42:01 +0200
commit5e273444ac192d1e10c48618de72c517c6b52c45 (patch)
tree4d1489437384bf33e0255e59d8d4b3af40badb95 /src/main/java/at/hannibal2
parentc71854634b925517847a8e6b4e178f9f771901f3 (diff)
downloadskyhanni-5e273444ac192d1e10c48618de72c517c6b52c45.tar.gz
skyhanni-5e273444ac192d1e10c48618de72c517c6b52c45.tar.bz2
skyhanni-5e273444ac192d1e10c48618de72c517c6b52c45.zip
Using tab list correctly when farming without cultivating
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt
index 3539e40af..8fdec3787 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter
import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.setCounter
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.TabListUpdateEvent
+import at.hannibal2.skyhanni.features.garden.farming.GardenCropMilestoneDisplay
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNeeded
@@ -27,7 +28,7 @@ class GardenCropMilestoneFix {
val tier = group("tier").romanToDecimalIfNeeded()
val crops = GardenCropMilestones.getCropsForTier(tier)
- changedValue(crop, crops, "level up chat message")
+ changedValue(crop, crops, "level up chat message", 0)
}
}
@@ -64,7 +65,7 @@ class GardenCropMilestoneFix {
val newValue = tabListValue.toLong()
if (tabListCropProgress[crop] != newValue) {
if (tabListCropProgress.containsKey(crop)) {
- changedValue(crop, newValue, "tab list")
+ changedValue(crop, newValue, "tab list", smallestPercentage.toInt())
}
}
tabListCropProgress[crop] = newValue
@@ -72,19 +73,21 @@ class GardenCropMilestoneFix {
private val loadedCrops = mutableListOf<CropType>()
- private fun changedValue(crop: CropType, tabListValue: Long, source: String) {
+ private fun changedValue(crop: CropType, tabListValue: Long, source: String, minDiff: Int) {
val calculated = crop.getCounter()
val diff = calculated - tabListValue
- if (diff < -5_000) {
+
+ if (diff <= -minDiff) {
crop.setCounter(tabListValue)
+ GardenCropMilestoneDisplay.update()
if (!loadedCrops.contains(crop)) {
LorenzUtils.chat("§e[SkyHanni] Loaded ${crop.cropName} milestone data from $source!")
loadedCrops.add(crop)
}
- }
- if (diff > 5_000) {
+ } else if (diff >= minDiff) {
LorenzUtils.debug("Fixed wrong ${crop.cropName} milestone data from $source: ${diff.addSeparators()}")
crop.setCounter(tabListValue)
+ GardenCropMilestoneDisplay.update()
}
}
} \ No newline at end of file