aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt27
5 files changed, 26 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
index 6fa027640..fadaec07f 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
@@ -12,7 +12,7 @@ import com.google.gson.JsonPrimitive
object ConfigUpdaterMigrator {
val logger = LorenzLogger("ConfigMigration")
- const val CONFIG_VERSION = 44
+ const val CONFIG_VERSION = 45
fun JsonElement.at(chain: List<String>, init: Boolean): JsonElement? {
if (chain.isEmpty()) return this
if (this !is JsonObject) return null
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java
index d6f8a24fb..856ba0d05 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java
@@ -50,7 +50,8 @@ public class ChocolateFactoryConfig {
ChocolateFactoryStat.MULTIPLIER,
ChocolateFactoryStat.BARN,
ChocolateFactoryStat.TIME_TOWER,
- ChocolateFactoryStat.LEADERBOARD_POS
+ ChocolateFactoryStat.LEADERBOARD_POS,
+ ChocolateFactoryStat.TIME_TO_BEST_UPGRADE
));
@Expose
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 9ae839329..2638512d8 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java
@@ -96,6 +96,9 @@ public class ProfileSpecificStorage {
public long bestUpgradeAvailableAt = 0;
@Expose
+ public long bestUpgradeCost = 0;
+
+ @Expose
public long lastDataSave = 0;
@Expose
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 f4d921f8c..e584537fd 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
@@ -352,6 +352,7 @@ object ChocolateFactoryDataLoader {
val bestUpgrade = notMaxed.minByOrNull { it.effectiveCost ?: Double.MAX_VALUE }
profileStorage.bestUpgradeAvailableAt = bestUpgrade?.canAffordAt?.toMillis() ?: 0
+ profileStorage.bestUpgradeCost = bestUpgrade?.price ?: 0
ChocolateFactoryAPI.bestPossibleSlot = bestUpgrade?.getValidUpgradeIndex() ?: -1
val bestUpgradeLevel = bestUpgrade?.level ?: 0
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt
index e18f6738d..cb16bd823 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.renderables.Renderable
+import com.google.gson.JsonElement
import com.google.gson.JsonPrimitive
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -61,9 +62,11 @@ object ChocolateFactoryStats {
var chocolateUntilPrestige = "§6${chocolateUntilPrestigeCalculation.addSeparators()}"
if (chocolateUntilPrestigeCalculation <= 0) {
- chocolateUntilPrestige = "§aPrestige Avaliable"
+ chocolateUntilPrestige = "§aPrestige Available"
}
+ val upgradeAvailableAt = ChocolateAmount.CURRENT.formattedTimeUntilGoal(profileStorage.bestUpgradeCost)
+
val map = buildMap {
put(ChocolateFactoryStat.HEADER, "§6§lChocolate Factory Stats")
@@ -84,6 +87,7 @@ object ChocolateFactoryStats {
put(ChocolateFactoryStat.EMPTY, "")
put(ChocolateFactoryStat.EMPTY_2, "")
put(ChocolateFactoryStat.EMPTY_3, "")
+ put(ChocolateFactoryStat.EMPTY_4, "")
put(ChocolateFactoryStat.TIME_TOWER, "§eTime Tower: §6$timeTowerInfo")
put(ChocolateFactoryStat.TIME_TO_PRESTIGE, "§eTime To Prestige: $prestigeEstimate")
@@ -95,6 +99,7 @@ object ChocolateFactoryStats {
ChocolateFactoryStat.CHOCOLATE_UNTIL_PRESTIGE,
"§eChocolate To Prestige: $chocolateUntilPrestige"
)
+ put(ChocolateFactoryStat.TIME_TO_BEST_UPGRADE, "§eBest Upgrade: $upgradeAvailableAt")
}
val text = config.statsDisplayList.filter { it.shouldDisplay() }.mapNotNull { map[it] }
@@ -117,13 +122,17 @@ object ChocolateFactoryStats {
@SubscribeEvent
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
event.transform(42, "event.chocolateFactory.statsDisplayList") { element ->
- val jsonArray = element.asJsonArray
-
- jsonArray.add(JsonPrimitive("TIME_TOWER"))
- jsonArray.add(JsonPrimitive("TIME_TO_PRESTIGE"))
-
- jsonArray
+ addToDisplayList(element, "TIME_TOWER", "TIME_TO_PRESTIGE")
}
+ event.transform(45, "inventory.chocolateFactory.statsDisplayList") { element ->
+ addToDisplayList(element, "TIME_TO_BEST_UPGRADE")
+ }
+ }
+
+ private fun addToDisplayList(element: JsonElement, vararg toAdd: String): JsonElement {
+ val jsonArray = element.asJsonArray
+ toAdd.forEach { jsonArray.add(JsonPrimitive(it)) }
+ return jsonArray
}
enum class ChocolateFactoryStat(private val display: String, val shouldDisplay: () -> Boolean = { true }) {
@@ -141,10 +150,12 @@ object ChocolateFactoryStats {
EMPTY(""),
EMPTY_2(""),
EMPTY_3(""),
+ EMPTY_4(""),
TIME_TOWER("§eTime Tower: §62/3 Charges", { ChocolateFactoryTimeTowerManager.currentCharges() != -1 }),
- TIME_TO_PRESTIGE("§eTime To Prestige: §61d 13h 59m 4s", { ChocolateFactoryAPI.currentPrestige != 5 }),
+ TIME_TO_PRESTIGE("§eTime To Prestige: §b1d 13h 59m 4s", { ChocolateFactoryAPI.currentPrestige != 5 }),
RAW_PER_SECOND("§eRaw Per Second: §62,136"),
CHOCOLATE_UNTIL_PRESTIGE("§eChocolate To Prestige: §65,851", { ChocolateFactoryAPI.currentPrestige != 5 }),
+ TIME_TO_BEST_UPGRADE("§eBest Upgrade: §b 59m 4s"),
;
override fun toString(): String {