diff options
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) { |