aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/garden
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt37
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt4
6 files changed, 59 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt
index 461b2d698..147882837 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.garden.farming
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
+import at.hannibal2.skyhanni.config.features.garden.MoneyPerHourConfig.CustomFormatEntry
import at.hannibal2.skyhanni.events.GardenToolChangeEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
@@ -235,6 +236,7 @@ object CropMoneyDisplay {
return if (config.hideTitle) newDisplay.drop(1) else newDisplay
}
+ // TODO : Rewrite to not be index-reliant
private fun fullTitle(title: String): String {
val titleText: String
val nameList = mutableListOf<String>()
@@ -246,7 +248,8 @@ object CropMoneyDisplay {
)
val list = mutableListOf<String>()
for (index in config.customFormat) {
- map[index]?.let {
+ // TODO, change functionality to use enum rather than ordinals
+ map[index.ordinal]?.let {
list.add(it)
}
}
@@ -276,8 +279,7 @@ object CropMoneyDisplay {
val onlyNpcPrice =
(!config.useCustomFormat && LorenzUtils.noTradeMode) ||
- (config.useCustomFormat && config.customFormat.size == 1 &&
- config.customFormat[0] == 2)
+ (config.useCustomFormat && config.customFormat.singleOrNull() == CustomFormatEntry.NPC_PRICE)
for ((internalName, amount) in multipliers.moveEntryToTop { isSeeds(it.key) }) {
val crop = cropNames[internalName]!!
@@ -364,6 +366,7 @@ object CropMoneyDisplay {
private fun isSeeds(internalName: NEUInternalName) =
internalName.equals("ENCHANTED_SEEDS") || internalName.equals("SEEDS")
+ // TODO : Rewrite to not be index-reliant
private fun formatNumbers(sellOffer: Double, instantSell: Double, npcPrice: Double): Array<Double> {
return if (config.useCustomFormat) {
val map = mapOf(
@@ -373,7 +376,8 @@ object CropMoneyDisplay {
)
val newList = mutableListOf<Double>()
for (index in config.customFormat) {
- map[index]?.let {
+ // TODO, change functionality to use enum rather than ordinals
+ map[index.ordinal]?.let {
newList.add(it)
}
}
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 15dd12dc0..6190bc27b 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
@@ -95,7 +95,8 @@ class GardenBestCropTime {
for (crop in sorted.keys) {
if (crop.isMaxed()) continue
val millis = timeTillNextCrop[crop]!!
- val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get()]
+ // TODO, change functionality to use enum rather than ordinals
+ val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get().ordinal]
val duration = TimeUtils.formatDuration(millis, biggestUnit, maxUnits = 2)
val isCurrent = crop == currentCrop
number++
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 b290672af..6c3bedbf8 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
@@ -1,6 +1,9 @@
package at.hannibal2.skyhanni.features.garden.farming
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
+import at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry
+import at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.TimeFormatEntry
+import at.hannibal2.skyhanni.config.features.garden.cropmilestones.MushroomPetPerkConfig.MushroomTextEntry
import at.hannibal2.skyhanni.data.GardenCropMilestones
import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter
import at.hannibal2.skyhanni.data.GardenCropMilestones.isMaxed
@@ -17,6 +20,7 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon
import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType
import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.setSpeed
import at.hannibal2.skyhanni.test.command.ErrorManager
+import at.hannibal2.skyhanni.utils.ConfigUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils.round
@@ -175,7 +179,8 @@ object GardenCropMilestoneDisplay {
val missingTimeSeconds = missing / farmingFortuneSpeed
val millis = missingTimeSeconds * 1000
GardenBestCropTime.timeTillNextCrop[crop] = millis
- val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get()]
+ // TODO, change functionality to use enum rather than ordinals
+ val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get().ordinal]
val duration = TimeUtils.formatDuration(millis, biggestUnit)
tryWarn(millis, "§b${crop.cropName} $nextTier in $duration")
val speedText = "§7In §b$duration"
@@ -224,7 +229,8 @@ object GardenCropMilestoneDisplay {
private fun formatDisplay(lineMap: HashMap<Int, List<Any>>): MutableList<List<Any>> {
val newList = mutableListOf<List<Any>>()
for (index in config.text) {
- lineMap[index]?.let {
+ // TODO, change functionality to use enum rather than ordinals
+ lineMap[index.ordinal]?.let {
newList.add(it)
}
}
@@ -269,7 +275,8 @@ object GardenCropMilestoneDisplay {
val missingTimeSeconds = missing / blocksPerSecond
val millis = missingTimeSeconds * 1000
- val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get()]
+ // TODO, change functionality to use enum rather than ordinals
+ val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get().ordinal]
val duration = TimeUtils.formatDuration(millis.toLong(), biggestUnit)
lineMap[3] = Collections.singletonList("§7In §b$duration")
}
@@ -279,7 +286,8 @@ object GardenCropMilestoneDisplay {
val newList = mutableListOf<List<Any>>()
for (index in config.mushroomPetPerk.text) {
- lineMap[index]?.let {
+ // TODO, change functionality to use enum rather than ordinals
+ lineMap[index.ordinal]?.let {
newList.add(it)
}
}
@@ -303,5 +311,26 @@ object GardenCropMilestoneDisplay {
event.move(3, "garden.cropMilestoneMushroomPetPerkEnabled", "garden.cropMilestones.mushroomPetPerk.enabled")
event.move(3, "garden.cropMilestoneMushroomPetPerkText", "garden.cropMilestones.mushroomPetPerk.text")
event.move(3, "garden.cropMilestoneMushroomPetPerkPos", "garden.cropMilestones.mushroomPetPerk.pos")
+ event.move(
+ 11,
+ "garden.cropMilestones.highestTimeFormat",
+ "garden.cropMilestones.highestTimeFormat"
+ ) { element ->
+ ConfigUtils.migrateIntToEnum(element, TimeFormatEntry::class.java)
+ }
+ event.move(
+ 11,
+ "garden.cropMilestones.text",
+ "garden.cropMilestones.text"
+ ) { element ->
+ ConfigUtils.migrateIntArrayListToEnumArrayList(element, MilestoneTextEntry::class.java)
+ }
+ event.move(
+ 11,
+ "garden.cropMilestones.mushroomPetPerk.text",
+ "garden.cropMilestones.mushroomPetPerk.text"
+ ) { element ->
+ ConfigUtils.migrateIntArrayListToEnumArrayList(element, MushroomTextEntry::class.java)
+ }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt
index 4625f3b47..00eb4aaab 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.garden.visitor
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.config.Storage
+import at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry
import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
@@ -10,6 +11,7 @@ import at.hannibal2.skyhanni.events.PreProfileSwitchEvent
import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptEvent
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.test.command.ErrorManager
+import at.hannibal2.skyhanni.utils.ConfigUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut
@@ -45,7 +47,8 @@ object GardenVisitorDropStatistics {
private fun formatDisplay(map: List<List<Any>>): List<List<Any>> {
val newList = mutableListOf<List<Any>>()
for (index in config.textFormat) {
- newList.add(map[index])
+ // TODO, change functionality to use enum rather than ordinals
+ newList.add(map[index.ordinal])
}
return newList
}
@@ -118,6 +121,7 @@ object GardenVisitorDropStatistics {
val currentRarity = LorenzUtils.enumValueOf<VisitorRarity>(rarity)
val visitorRarities = GardenAPI.storage?.visitorDrops?.visitorRarities ?: return
fixRaritiesSize(visitorRarities)
+ // TODO, change functionality to use enum rather than ordinals
val temp = visitorRarities[currentRarity.ordinal] + 1
visitorRarities[currentRarity.ordinal] = temp
saveAndUpdate()
@@ -253,6 +257,10 @@ object GardenVisitorDropStatistics {
event.move(3, "${originalPrefix}displayIcons", "${newPrefix}displayIcons")
event.move(3, "${originalPrefix}onlyOnBarn", "${newPrefix}onlyOnBarn")
event.move(3, "${originalPrefix}visitorDropPos", "${newPrefix}pos")
+
+ event.move(11, "${newPrefix}textFormat", "${newPrefix}textFormat") { element ->
+ ConfigUtils.migrateIntArrayListToEnumArrayList(element, DropsStatisticsTextEntry::class.java)
+ }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
index 60b1d041d..fcde7ca24 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.garden.visitor
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
+import at.hannibal2.skyhanni.config.features.garden.visitor.RewardWarningConfig.ItemWarnEntry
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
@@ -20,6 +21,7 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
import at.hannibal2.skyhanni.test.command.ErrorManager
+import at.hannibal2.skyhanni.utils.ConfigUtils
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemBlink
@@ -607,6 +609,9 @@ class GardenVisitorFeatures {
event.move(3, "garden.visitorColoredName", "garden.visitors.coloredName")
event.move(3, "garden.visitorHypixelArrivedMessage", "garden.visitors.hypixelArrivedMessage")
event.move(3, "garden.visitorHideChat", "garden.visitors.hideChat")
+ event.move(11, "garden.visitors.rewardWarning.drops", "garden.visitors.rewardWarning.drops") { element ->
+ ConfigUtils.migrateIntArrayListToEnumArrayList(element, ItemWarnEntry::class.java)
+ }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt
index c8a68da36..260a9cdb2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt
@@ -121,8 +121,8 @@ object VisitorAPI {
fun hasReward(): VisitorReward? {
for (internalName in allRewards) {
val reward = VisitorReward.getByInternalName(internalName) ?: continue
-
- if (config.rewardWarning.drops.contains(reward.ordinal)) {
+ // TODO, change functionality to use enum rather than ordinals
+ if (config.rewardWarning.drops.elementAtOrNull(reward.ordinal) != null) {
return reward
}
}