aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorDavid Cole <40234707+DavidArthurCole@users.noreply.github.com>2024-07-07 05:28:16 -0400
committerGitHub <noreply@github.com>2024-07-07 11:28:16 +0200
commit3d691842dd3a937369725a87bcf5d91546168491 (patch)
tree7d5a6fa025526ce8ce3a7bc3cf6c056c56343276 /src/main/java
parent4c300de2cf0a33a737a4c4a8291d61bb99fc1074 (diff)
downloadskyhanni-3d691842dd3a937369725a87bcf5d91546168491.tar.gz
skyhanni-3d691842dd3a937369725a87bcf5d91546168491.tar.bz2
skyhanni-3d691842dd3a937369725a87bcf5d91546168491.zip
Improvement: Add Config option for Time Tower in "Best Upgrade" (#2142)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt23
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 }