From beb9d2367991633a6ba2d5b2b4b5601753e2e998 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Sat, 9 Dec 2023 22:21:10 +0100 Subject: Fix: Bazaar showing Minion XP (#785) Fixed showing Minion XP display in Bazaar. #785 --- .../hannibal2/skyhanni/features/minion/MinionFeatures.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index 5fc4474d9..9aee4035d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -33,10 +33,12 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.RenderUtils.drawString import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.SpecialColour +import at.hannibal2.skyhanni.utils.StringUtils.find import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.TimeUtils import at.hannibal2.skyhanni.utils.getLorenzVec +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest @@ -61,12 +63,14 @@ class MinionFeatures { private var lastInventoryClosed = 0L private var coinsPerDay = "" - private val minionUpgradePattern = "§aYou have upgraded your Minion to Tier (?.*)".toPattern() - private val minionCoinPattern = "§aYou received §r§6(.*) coins§r§a!".toPattern() + private val minionUpgradePattern by RepoPattern.pattern("minion.chat.upgrade", "§aYou have upgraded your Minion to Tier (?.*)") + private val minionCoinPattern by RepoPattern.pattern("minion.chat.coin", "§aYou received §r§6(.*) coins§r§a!") + private val minionTitlePattern by RepoPattern.pattern("minion.title", "Minion [^➜]") + private val minionCollectItemPattern by RepoPattern.pattern("minion.item.collect", "^§aCollect All$") @SubscribeEvent fun onPlayerInteract(event: PlayerInteractEvent) { - if (!enableWithHub()) return + if (!enable()) return if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) return val lookingAt = event.pos.offset(event.face).toLorenzVec() @@ -126,10 +130,10 @@ class MinionFeatures { @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!enableWithHub()) return - if (!event.inventoryName.contains("Minion ")) return + if (!minionTitlePattern.find(event.inventoryName)) return event.inventoryItems[48]?.let { - if ("§aCollect All" == it.name) { + if (minionCollectItemPattern.matches(it.name ?: "")) { MinionOpenEvent(event.inventoryName, event.inventoryItems).postAndCatch() return } -- cgit