diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
3 files changed, 27 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java index 113ac7362..6b39f7f49 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java @@ -5,6 +5,7 @@ import com.google.gson.annotations.Expose; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider; import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; +import io.github.notenoughupdates.moulconfig.observer.Property; public class ChocolateUpgradeWarningsConfig { @Expose @@ -26,4 +27,9 @@ public class ChocolateUpgradeWarningsConfig { ) @ConfigEditorSlider(minValue = 0, maxValue = 10, minStep = 0.25f) public float timeBetweenWarnings = 1; + + @Expose + @ConfigOption(name = "Include Time Tower", desc = "Include Time Tower in the list of upgrades to be considered 'next best'.") + @ConfigEditorBoolean + public Property<Boolean> upgradeWarningTimeTower = Property.of(false); } diff --git a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java index 8cd2c6e3b..b49a9c612 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java @@ -28,6 +28,7 @@ import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems; import at.hannibal2.skyhanni.features.garden.pests.PestProfitTracker; import at.hannibal2.skyhanni.features.garden.pests.VinylType; import at.hannibal2.skyhanni.features.garden.visitor.VisitorReward; +import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryUpgrade; import at.hannibal2.skyhanni.features.inventory.wardrobe.WardrobeAPI; import at.hannibal2.skyhanni.features.mining.MineshaftPityDisplay; import at.hannibal2.skyhanni.features.mining.fossilexcavator.ExcavatorProfitTracker; diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt index 28447b1df..5dd8a52d3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt @@ -7,7 +7,9 @@ import at.hannibal2.skyhanni.events.InventoryUpdatedEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI.specialRabbitTextures import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ConditionalUtils +import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture @@ -148,6 +150,18 @@ object ChocolateFactoryDataLoader { ConditionalUtils.onToggle(soundProperty) { ChocolateFactoryAPI.warningSound = SoundUtils.createSound(soundProperty.get(), 1f) } + + config.chocolateUpgradeWarnings.upgradeWarningTimeTower.whenChanged { _, _ -> + ChocolateFactoryAPI.factoryUpgrades.takeIf { it.isNotEmpty() }?.let { + findBestUpgrades(it) + } ?: run { + ChatUtils.clickableChat( + "Could not determine your current statistics to get next upgrade. Open CF to fix this!", + onClick = { HypixelCommands.chocolateFactory() }, + "§eClick to run /cf!" + ) + } + } } private fun clearData() { @@ -427,9 +441,12 @@ object ChocolateFactoryDataLoader { private fun findBestUpgrades(list: List<ChocolateFactoryUpgrade>) { val profileStorage = profileStorage ?: return - // removing time tower here as people like to determine when to buy it themselves - val notMaxed = list.filter { - !it.isMaxed && it.slotIndex != ChocolateFactoryAPI.timeTowerIndex && it.effectiveCost != null + val ttFiltered = list.filter { + config.chocolateUpgradeWarnings.upgradeWarningTimeTower.get() || it.slotIndex != ChocolateFactoryAPI.timeTowerIndex + } + + val notMaxed = ttFiltered.filter { + !it.isMaxed && it.effectiveCost != null } val bestUpgrade = notMaxed.minByOrNull { it.effectiveCost ?: Double.MAX_VALUE } |