aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-08-02 10:56:49 +0200
committerGitHub <noreply@github.com>2024-08-02 10:56:49 +0200
commita6b7559cec69bda9e8202de6440da784d3f8925a (patch)
tree59bf748bcd562b0d826a4cc9b6dd67f4e67aa417 /src/main/java/at/hannibal2
parent58f09c23327f1553e099a5cf0d263a7a89232672 (diff)
downloadskyhanni-a6b7559cec69bda9e8202de6440da784d3f8925a.tar.gz
skyhanni-a6b7559cec69bda9e8202de6440da784d3f8925a.tar.bz2
skyhanni-a6b7559cec69bda9e8202de6440da784d3f8925a.zip
Fix: HotmData Level Detection with Blue Egg (#2295)
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HotmData.kt20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt b/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt
index c66d2fa84..e82ddd4ae 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt
@@ -357,16 +357,16 @@ enum class HotmData(
val printName = name.allLettersFirstUppercase()
- /** Level which are actually paid with powder (does exclude [blueEgg]*/
- val rawLevel: Int
+ /** Level which are actually paid with powder (does exclude [blueEgg])*/
+ var rawLevel: Int
get() = storage?.perks?.get(this.name)?.level ?: 0
+ private set(value) {
+ storage?.perks?.computeIfAbsent(this.name) { HotmTree.HotmPerk() }?.level = value
+ }
/** Level for which the effect that is present (considers [enabled] and [blueEgg])*/
- var activeLevel: Int
+ val activeLevel: Int
get() = if (enabled) effectivLevel else 0
- private set(value) {
- storage?.perks?.computeIfAbsent(this.name) { HotmTree.HotmPerk() }?.level = value.minus(blueEgg())
- }
/** Level that considering [blueEgg]*/
val effectivLevel: Int get() = storage?.perks?.get(this.name)?.level?.plus(blueEgg()) ?: 0
@@ -524,7 +524,7 @@ enum class HotmData(
fun getPerkByNameOrNull(name: String): HotmData? = entries.find { it.guiName == name }
private fun resetTree() = entries.forEach {
- it.activeLevel = 0
+ it.rawLevel = 0
it.enabled = false
it.isUnlocked = false
HotmAPI.Powder.entries.forEach { it.setCurrent(it.getTotal()) }
@@ -542,7 +542,7 @@ enum class HotmData(
val lore = item.getLore().takeIf { it.isNotEmpty() } ?: return
if (entry != PEAK_OF_THE_MOUNTAIN && notUnlockedPattern.matches(lore.last())) {
- entry.activeLevel = 0
+ entry.rawLevel = 0
entry.enabled = false
entry.isUnlocked = false
return
@@ -550,7 +550,7 @@ enum class HotmData(
entry.isUnlocked = true
- entry.activeLevel = levelPattern.matchMatcher(lore.first()) {
+ entry.rawLevel = levelPattern.matchMatcher(lore.first()) {
group("level").toInt().transformIf({ group("color") == "b" }, { this.minus(1) })
} ?: entry.maxLevel
@@ -681,7 +681,7 @@ enum class HotmData(
DelayedRun.runNextTick {
InventoryUtils.getItemsInOpenChest().forEach { it.parse() }
abilities.filter { it.isUnlocked }.forEach {
- it.activeLevel = if (PEAK_OF_THE_MOUNTAIN.rawLevel >= 1) 2 else 1
+ it.rawLevel = if (PEAK_OF_THE_MOUNTAIN.rawLevel >= 1) 2 else 1
}
}
}