diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2023-08-28 05:18:28 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-27 21:18:28 +0200 |
commit | 27f629589aeba6f2209f6c2e2c28af575b4ce022 (patch) | |
tree | 554c1badb15082482f7746afc9a574b870436279 /src/main/java/at | |
parent | 0f375522e6a4ac326c27b1f8b02e5de2b8491c4f (diff) | |
download | skyhanni-27f629589aeba6f2209f6c2e2c28af575b4ce022.tar.gz skyhanni-27f629589aeba6f2209f6c2e2c28af575b4ce022.tar.bz2 skyhanni-27f629589aeba6f2209f6c2e2c28af575b4ce022.zip |
Merge pull request #402
* garden exp
* refactored a lot of stuff
* make it not break
Diffstat (limited to 'src/main/java/at')
14 files changed, 125 insertions, 200 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index b4bdbb75e..927eabb46 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -153,7 +153,7 @@ class SkyHanniMod { loadModule(OtherInventoryData) loadModule(TabListData()) loadModule(RenderGuiData()) - loadModule(GardenCropMilestones()) + loadModule(GardenCropMilestones) loadModule(GardenCropUpgrades()) loadModule(OwnInventoryData()) loadModule(ToolTipData()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/GardenConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/GardenConfig.java index 27ebb1954..b3a5abd27 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/GardenConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/GardenConfig.java @@ -339,7 +339,7 @@ public class GardenConfig { @ConfigOption( name = "Progress Display", desc = "Shows the progress and ETA until the next crop milestone is reached and the current crops/minute value. " + - "§cRequires a tool with either a counter or cultivating enchantment." + "§eRequires a tool with either a counter or cultivating enchantment for full accuracy." ) @ConfigEditorBoolean @ConfigAccordionId(id = 6) diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt index 0742fae1e..48c16cb1c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt @@ -2,29 +2,18 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.CropMilestoneUpdateEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent +import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.jsonobjects.GardenJson import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class GardenCropMilestones { +object GardenCropMilestones { private val cropPattern = "§7Harvest §f(?<name>.*) §7on .*".toPattern() private val totalPattern = "§7Total: §a(?<name>.*)".toPattern() - // Add when api support is there -// @SubscribeEvent -// fun onProfileDataLoad(event: ProfileApiDataLoadedEvent) { -// val profileData = event.profileData -// for ((key, value) in profileData.entrySet()) { -// if (key.startsWith("experience_skill_")) { -// val label = key.substring(17) -// val exp = value.asLong -// gardenExp[label] = exp -// } -// } -// } - @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (event.inventoryName != "Crop Milestones") return @@ -45,116 +34,64 @@ class GardenCropMilestones { CropMilestoneUpdateEvent().postAndCatch() } - companion object { - val cropCounter: MutableMap<CropType, Long>? get() = GardenAPI.config?.cropCounter + private var cropMilestoneData: Map<CropType, List<Int>>? = null - // TODO make nullable - fun CropType.getCounter() = cropCounter?.get(this) ?: 0 + val cropCounter: MutableMap<CropType, Long>? get() = GardenAPI.config?.cropCounter - fun CropType.setCounter(counter: Long) { - cropCounter?.set(this, counter) - } + // TODO make nullable + fun CropType.getCounter() = cropCounter?.get(this) ?: 0 - fun CropType.isMaxed() = getCounter() >= 1_000_000_000 + fun CropType.setCounter(counter: Long) { + cropCounter?.set(this, counter) + } - fun getTierForCrops(crops: Long): Int { - var tier = 0 - var totalCrops = 0L - for (tierCrops in cropMilestone) { - totalCrops += tierCrops - if (totalCrops > crops) { - return tier - } - tier++ - } + fun CropType.isMaxed(): Boolean { + val maxValue = cropMilestoneData?.get(this)?.sum() ?: 1_000_000_000 // 1 bil for now + return getCounter() >= maxValue + } - return tier + fun getTierForCropCount(count: Long, crop: CropType): Int { + var tier = 0 + var totalCrops = 0L + val cropMilestone = cropMilestoneData?.get(crop) ?: return 0 + for (tierCrops in cropMilestone) { + totalCrops += tierCrops + if (totalCrops > count) { + return tier + } + tier++ } - fun getCropsForTier(requestedTier: Int): Long { - var totalCrops = 0L - var tier = 0 - for (tierCrops in cropMilestone) { - totalCrops += tierCrops - tier++ - if (tier == requestedTier) { - return totalCrops - } - } + return tier + } - return 0 + fun getCropsForTier(requestedTier: Int, crop: CropType): Long { + var totalCrops = 0L + var tier = 0 + val cropMilestone = cropMilestoneData?.get(crop) ?: return 0 + for (tierCrops in cropMilestone) { + totalCrops += tierCrops + tier++ + if (tier == requestedTier) { + return totalCrops + } } - fun CropType.progressToNextLevel(): Double { - val progress = getCounter() - val startTier = getTierForCrops(progress) - val startCrops = getCropsForTier(startTier) - val end = getCropsForTier(startTier + 1).toDouble() - return (progress - startCrops) / (end - startCrops) - } + return 0 + } - // TODO use repo - private val cropMilestone = listOf( - 100, - 150, - 250, - 500, - 1500, - 2500, - 5000, - 5000, - 10000, - 25000, - 25000, - 25000, - 30000, - 70000, - 100000, - 200000, - 250000, - 250000, - 500000, - 1000000, - 1500000, - 2000000, - 3000000, - 4000000, - 7000000, - 10000000, - 20000000, - 25000000, - 25000000, - 50000000, - 50000000, - 50000000, - 50000000, - 50000000, - 50000000, - 50000000, - 50000000, - 50000000, - 50000000, - 50000000, - 50000000, - 50000000, - 50000000, - 50000000, - 50000000, - 100000000, - ) + fun CropType.progressToNextLevel(): Double { + val progress = getCounter() + val startTier = getTierForCropCount(progress, this) + val startCrops = getCropsForTier(startTier, this) + val end = getCropsForTier(startTier + 1, this).toDouble() + return (progress - startCrops) / (end - startCrops) } -} -// TODO delete? -private fun String.formatNumber(): Long { - var text = replace(",", "") - val multiplier = if (text.endsWith("k")) { - text = text.substring(0, text.length - 1) - 1_000 - } else if (text.endsWith("m")) { - text = text.substring(0, text.length - 1) - 1_000_000 - } else 1 - val d = text.toDouble() - return (d * multiplier).toLong() -} + @SubscribeEvent + fun onRepoReload(event: RepositoryReloadEvent) { + val data = event.getConstant<GardenJson>("Garden") ?: return + cropMilestoneData = data.crop_milestones + println("loaded stuff: $cropMilestoneData") + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index 4b64ce4fc..fe4403046 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.CropAccessoryData import at.hannibal2.skyhanni.data.GardenCropMilestones -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter +import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.data.GardenCropUpgrades.Companion.getUpgradeLevel import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.features.garden.CropType.Companion.getTurboCrop @@ -194,10 +194,11 @@ class FarmingFortuneDisplay { } fun getDedicationFortune(tool: ItemStack?, cropType: CropType?): Double { + if (cropType == null) return 0.0 val dedicationLevel = tool?.getEnchantments()?.get("dedication") ?: 0 val dedicationMultiplier = listOf(0.0, 0.5, 0.75, 1.0, 2.0)[dedicationLevel] - val cropMilestone = GardenCropMilestones.getTierForCrops( - cropType?.getCounter() ?: 0 + val cropMilestone = GardenCropMilestones.getTierForCropCount( + cropType.getCounter(), cropType ) return dedicationMultiplier * cropMilestone } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index 083770c6f..05e407781 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -19,6 +19,7 @@ import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.MinecraftDispatcher import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getCultivatingCounter import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getHoeCounter +import at.hannibal2.skyhanni.utils.jsonobjects.GardenJson import kotlinx.coroutines.delay import kotlinx.coroutines.launch import kotlinx.coroutines.withContext @@ -191,6 +192,14 @@ object GardenAPI { return totalExp } } + + while (tier < requestedLevel) { + totalExp += gardenOverflowExp + tier++ + if (tier == requestedLevel) { + return totalExp + } + } return 0 } @@ -204,51 +213,21 @@ object GardenAPI { } tier++ } + totalExp += gardenOverflowExp + + while (totalExp < gardenExp) { + tier++ + totalExp += gardenOverflowExp + } return tier } - private val gardenExperience = listOf( - 0, - 70, - 100, - 140, - 240, - 600, - 1500, - 2000, - 2500, - 3000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, // level 15 - - // overflow levels till 40 for now, in 10k steps - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - ) + @SubscribeEvent + fun onRepoReload(event: RepositoryReloadEvent) { + val data = event.getConstant<GardenJson>("Garden") ?: return + gardenExperience = data.garden_exp + } + + private var gardenExperience = listOf<Int>() + private const val gardenOverflowExp = 10000 // can be changed I guess }
\ No newline at end of file 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 b643e5771..39ca5e7af 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.data.GardenCropMilestones -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.setCounter +import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter +import at.hannibal2.skyhanni.data.GardenCropMilestones.setCounter import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent @@ -28,7 +28,7 @@ class GardenCropMilestoneFix { val tier = group("tier").romanToDecimalIfNeeded() - val crops = GardenCropMilestones.getCropsForTier(tier) + val crops = GardenCropMilestones.getCropsForTier(tier, crop) changedValue(crop, crops, "level up chat message", 0) } } @@ -49,12 +49,6 @@ class GardenCropMilestoneFix { private fun check(cropName: String, tier: Int, percentage: Double) { if (!ProfileStorageData.loaded) return - val baseCrops = GardenCropMilestones.getCropsForTier(tier) - val next = GardenCropMilestones.getCropsForTier(tier + 1) - val progressCrops = next - baseCrops - - val progress = progressCrops * (percentage / 100) - val smallestPercentage = progressCrops * 0.0005 val crop = CropType.getByNameOrNull(cropName) if (crop == null) { @@ -62,6 +56,13 @@ class GardenCropMilestoneFix { return } + val baseCrops = GardenCropMilestones.getCropsForTier(tier, crop) + val next = GardenCropMilestones.getCropsForTier(tier + 1, crop) + val progressCrops = next - baseCrops + + val progress = progressCrops * (percentage / 100) + val smallestPercentage = progressCrops * 0.0005 + val tabListValue = baseCrops + progress - smallestPercentage val newValue = tabListValue.toLong() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt index 08882db71..afeee870b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter +import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.events.CropClickEvent import at.hannibal2.skyhanni.events.CropMilestoneUpdateEvent import at.hannibal2.skyhanni.events.GuiRenderEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt index efdf267ef..30afb0418 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt @@ -2,8 +2,8 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.GardenCropMilestones -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.isMaxed +import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter +import at.hannibal2.skyhanni.data.GardenCropMilestones.isMaxed import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest @@ -31,11 +31,11 @@ class GardenBestCropTime { if (crop.isMaxed()) continue val counter = crop.getCounter() - val currentTier = GardenCropMilestones.getTierForCrops(counter) + val currentTier = GardenCropMilestones.getTierForCropCount(counter, crop) - val cropsForCurrentTier = GardenCropMilestones.getCropsForTier(currentTier) + val cropsForCurrentTier = GardenCropMilestones.getCropsForTier(currentTier, crop) val nextTier = if (config.cropMilestoneBestShowMaxedNeeded.get()) 46 else currentTier + 1 - val cropsForNextTier = GardenCropMilestones.getCropsForTier(nextTier) + val cropsForNextTier = GardenCropMilestones.getCropsForTier(nextTier, crop) val have = counter - cropsForCurrentTier val need = cropsForNextTier - cropsForCurrentTier @@ -59,7 +59,7 @@ class GardenBestCropTime { val helpMap = mutableMapOf<CropType, Long>() for ((crop, time) in timeTillNextCrop) { if (crop.isMaxed()) continue - val currentTier = GardenCropMilestones.getTierForCrops(crop.getCounter()) + val currentTier = GardenCropMilestones.getTierForCropCount(crop.getCounter(), crop) val gardenExpForTier = getGardenExpForTier(currentTier + 1) val fakeTime = time / gardenExpForTier helpMap[crop] = fakeTime @@ -107,7 +107,7 @@ class GardenBestCropTime { val color = if (isCurrent) "§e" else "§7" val contestFormat = if (GardenNextJacobContest.isNextCrop(crop)) "§n" else "" - val currentTier = GardenCropMilestones.getTierForCrops(crop.getCounter()) + val currentTier = GardenCropMilestones.getTierForCropCount(crop.getCounter(), crop) val nextTier = if (config.cropMilestoneBestShowMaxedNeeded.get()) 46 else currentTier + 1 diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt index f6d0fe0b4..345ecb09a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt @@ -2,9 +2,9 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.GardenCropMilestones -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.isMaxed -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.setCounter +import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter +import at.hannibal2.skyhanni.data.GardenCropMilestones.isMaxed +import at.hannibal2.skyhanni.data.GardenCropMilestones.setCounter import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.features.garden.CropType @@ -138,7 +138,7 @@ object GardenCropMilestoneDisplay { val lineMap = HashMap<Int, List<Any>>() lineMap[0] = Collections.singletonList("§6Crop Milestones") - val currentTier = GardenCropMilestones.getTierForCrops(counter) + val currentTier = GardenCropMilestones.getTierForCropCount(counter, crop) val nextTier = if (config.cropMilestoneBestShowMaxedNeeded.get()) 46 else currentTier + 1 val list = mutableListOf<Any>() @@ -150,11 +150,11 @@ object GardenCropMilestoneDisplay { } lineMap[1] = list - val cropsForNextTier = GardenCropMilestones.getCropsForTier(nextTier) + val cropsForNextTier = GardenCropMilestones.getCropsForTier(nextTier, crop) val (have, need) = if (config.cropMilestoneBestShowMaxedNeeded.get()) { Pair(counter, cropsForNextTier) } else { - val cropsForCurrentTier = GardenCropMilestones.getCropsForTier(currentTier) + val cropsForCurrentTier = GardenCropMilestones.getCropsForTier(currentTier, crop) val have = counter - cropsForCurrentTier val need = cropsForNextTier - cropsForCurrentTier Pair(have, need) @@ -247,11 +247,11 @@ object GardenCropMilestoneDisplay { val lineMap = HashMap<Int, List<Any>>() val counter = CropType.MUSHROOM.getCounter() - val currentTier = GardenCropMilestones.getTierForCrops(counter) + val currentTier = GardenCropMilestones.getTierForCropCount(counter, CropType.MUSHROOM) val nextTier = currentTier + 1 - val cropsForCurrentTier = GardenCropMilestones.getCropsForTier(currentTier) - val cropsForNextTier = GardenCropMilestones.getCropsForTier(nextTier) + val cropsForCurrentTier = GardenCropMilestones.getCropsForTier(currentTier, CropType.MUSHROOM) + val cropsForNextTier = GardenCropMilestones.getCropsForTier(nextTier, CropType.MUSHROOM) val have = counter - cropsForCurrentTier val need = cropsForNextTier - cropsForCurrentTier diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt index c6ecce63c..c9868d4e3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt @@ -2,8 +2,8 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ClickType -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.setCounter +import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter +import at.hannibal2.skyhanni.data.GardenCropMilestones.setCounter import at.hannibal2.skyhanni.data.MayorElection import at.hannibal2.skyhanni.events.CropClickEvent import at.hannibal2.skyhanni.events.GardenToolChangeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt index 70ef53536..da5a45e24 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.garden.fortuneguide import at.hannibal2.skyhanni.data.CropAccessoryData import at.hannibal2.skyhanni.data.GardenCropMilestones -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter +import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.features.garden.CropAccessory import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.CropType.Companion.getTurboCrop @@ -198,7 +198,7 @@ object FortuneUpgrades { ) ) } - val cropMilestone = GardenCropMilestones.getTierForCrops(crop.getCounter()) + val cropMilestone = GardenCropMilestones.getTierForCropCount(crop.getCounter(), crop) if (dedicationLvl != 4 && cropMilestone > 0) { val dedicationMultiplier = listOf(0.5, 0.75, 1.0, 2.0)[dedicationLvl] val dedicationIncrease = diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneAverage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneAverage.kt index 7ea8ff423..47589d66c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneAverage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneAverage.kt @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.garden.inventory import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.GardenCropMilestones -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter +import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.events.CropMilestoneUpdateEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent @@ -20,7 +20,7 @@ class GardenCropMilestoneAverage { val tiers = mutableListOf<Double>() for (cropType in CropType.entries) { val counter = cropType.getCounter() - val tier = GardenCropMilestones.getTierForCrops(counter) + val tier = GardenCropMilestones.getTierForCropCount(counter, cropType) tiers.add(tier.toDouble()) } average = (tiers.sum() / CropType.entries.size).round(2) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt index 5b4102a15..e50a845da 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt @@ -4,9 +4,9 @@ package at.hannibal2.skyhanni.features.misc.discordrpc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.* -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getCounter -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.getTierForCrops -import at.hannibal2.skyhanni.data.GardenCropMilestones.Companion.progressToNextLevel +import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter +import at.hannibal2.skyhanni.data.GardenCropMilestones.getTierForCropCount +import at.hannibal2.skyhanni.data.GardenCropMilestones.progressToNextLevel import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.InventoryUtils @@ -264,7 +264,7 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?) CROP_MILESTONES({ val crop = InventoryUtils.getItemInHand()?.getCropType() val cropCounter = crop?.getCounter() - val tier = cropCounter?.let { getTierForCrops(it) } + val tier = cropCounter?.let { getTierForCropCount(it, crop) } val progress = tier?.let { LorenzUtils.formatPercentage(crop.progressToNextLevel()) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/GardenJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/GardenJson.java index 0a5a76c43..7f165ec1d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/GardenJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/GardenJson.java @@ -1,14 +1,21 @@ package at.hannibal2.skyhanni.utils.jsonobjects; +import at.hannibal2.skyhanni.features.garden.CropType; import com.google.gson.annotations.Expose; +import java.util.List; import java.util.Map; public class GardenJson { + @Expose + public List<Integer> garden_exp; + + @Expose + public Map<CropType, List<Integer>> crop_milestones; @Expose public Map<String, Double> organic_matter; @Expose public Map<String, Double> fuel; -} +}
\ No newline at end of file |