diff options
author | Empa <42304516+ItsEmpa@users.noreply.github.com> | 2024-06-12 17:10:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-12 17:10:02 +0200 |
commit | 2a465d20b139c93064bd2032e0932f150756d8c5 (patch) | |
tree | 7544d7938b963bd8cb7a9b356d59df82f74d9e1d /src/main/java/at | |
parent | aad0618be1a84abec30b35d8ae2ec1db084ff236 (diff) | |
download | skyhanni-2a465d20b139c93064bd2032e0932f150756d8c5.tar.gz skyhanni-2a465d20b139c93064bd2032e0932f150756d8c5.tar.bz2 skyhanni-2a465d20b139c93064bd2032e0932f150756d8c5.zip |
Fix: No MP Message (#2065)
Co-authored-by: Luna <luna@alexia.lol>
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt index 56e3cdf42..194664c94 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt @@ -57,6 +57,7 @@ object MaxwellAPI { storage?.maxwell?.favoritePowers = value } + private val NO_POWER by lazy { getPowerByNameOrNull("No Power") } private var powers = mutableListOf<String>() private val patternGroup = RepoPattern.group("data.maxwell") @@ -258,23 +259,24 @@ object MaxwellAPI { var foundMagicalPower = false for (line in stack.getLore()) { redstoneCollectionRequirementPattern.matchMatcher(line) { + if (magicalPower == 0 && currentPower == NO_POWER) return ChatUtils.chat( "Seems like you don't have the Requirement for the Accessory Bag yet, " + "setting power to No Power and magical power to 0.", ) - currentPower = getPowerByNameOrNull("No Power") + currentPower = NO_POWER magicalPower = 0 + tunings = listOf() return } - if (noPowerSelectedPattern.matches(line)) currentPower = getPowerByNameOrNull("No Power") + if (noPowerSelectedPattern.matches(line)) currentPower = NO_POWER inventoryMPPattern.matchMatcher(line) { // MagicalPower is boosted in catacombs if (DungeonAPI.inDungeon()) return@matchMatcher - val mp = group("mp") - magicalPower = mp.formatInt() + magicalPower = group("mp").formatInt() foundMagicalPower = true } @@ -292,7 +294,10 @@ object MaxwellAPI { } // If Magical Power isn't in the lore - if (!foundMagicalPower) magicalPower = 0 + if (!foundMagicalPower) { + magicalPower = 0 + tunings = listOf() + } } fun getPowerByNameOrNull(name: String) = powers.find { it == name } |