diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2024-04-04 22:05:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-04 22:05:11 +0200 |
commit | d991a496edc2181806e56dd5aea07161349a4e87 (patch) | |
tree | c89da970150ebbb93baf880f9be335a346fbbf5b /src/main/java/at | |
parent | 6b46e843c22403ace91a11390b862b5b0f04a441 (diff) | |
download | skyhanni-d991a496edc2181806e56dd5aea07161349a4e87.tar.gz skyhanni-d991a496edc2181806e56dd5aea07161349a4e87.tar.bz2 skyhanni-d991a496edc2181806e56dd5aea07161349a4e87.zip |
Improvement: Get Magical Power from Maxwell (#1327)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt index fc046c965..414540ea5 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.groupOrNull import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NumberUtil.formatInt +import at.hannibal2.skyhanni.utils.StringUtils.matchFirst import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -75,6 +76,10 @@ object MaxwellAPI { "gui.thaumaturgy.data", "§(?<color>.)\\+(?<amount>[^ ]+)(?<icon>.) (?<name>.+)" ) + private val thaumaturgyMagicalPowerPattern by group.pattern( + "gui.thaumaturgy.magicalpower", + "§7Total: §6(?<mp>\\d+) Magical Power" + ) private val statsTuningGuiPattern by group.pattern( "gui.thaumaturgy.statstuning", "Stats Tuning" @@ -139,6 +144,7 @@ object MaxwellAPI { if (isThaumaturgyInventory(event.inventoryName)) { loadThaumaturgyCurrentPower(event.inventoryItems) loadThaumaturgyTunings(event.inventoryItems) + loadThaumaturgyMagicalPower(event.inventoryItems) } if (yourBagsGuiPattern.matches(event.inventoryName)) { @@ -200,7 +206,7 @@ object MaxwellAPI { private fun loadThaumaturgyTunings(inventoryItems: Map<Int, ItemStack>) { val tunings = tunings ?: return - // Only load those rounded values if we dont have any values at all + // Only load those rounded values if we don't have any values at all if (tunings.isNotEmpty()) return val item = inventoryItems[51] ?: return @@ -220,6 +226,13 @@ object MaxwellAPI { this.tunings = map } + private fun loadThaumaturgyMagicalPower(inventoryItems: Map<Int, ItemStack>) { + val item = inventoryItems[48] ?: return + item.getLore().matchFirst(thaumaturgyMagicalPowerPattern) { + magicalPower = group("mp").formatInt() + } + } + private fun processStack(stack: ItemStack) { for (line in stack.getLore()) { redstoneCollectionRequirementPattern.matchMatcher(line) { |