summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-05-17 00:48:44 +0200
committerGitHub <noreply@github.com>2024-05-17 00:48:44 +0200
commitc7b6a0683c5e578c3018b413c307c800b33b3943 (patch)
tree95d0d58a9f8119a63ee64564e56682fdbc90ce69 /src/main/java/at/hannibal2/skyhanni/features/misc
parente65a4c1b4d8eb3a4b6870ea36ee606b08c8a4886 (diff)
downloadskyhanni-c7b6a0683c5e578c3018b413c307c800b33b3943.tar.gz
skyhanni-c7b6a0683c5e578c3018b413c307c800b33b3943.tar.bz2
skyhanni-c7b6a0683c5e578c3018b413c307c800b33b3943.zip
Feature: cofl ah search item (#1743)
Co-authored-by: Äkwav <16632490+Ekwav@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt76
1 files changed, 0 insertions, 76 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt
deleted file mode 100644
index 43ca734fc..000000000
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt
+++ /dev/null
@@ -1,76 +0,0 @@
-package at.hannibal2.skyhanni.features.misc.items
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
-import at.hannibal2.skyhanni.events.GuiKeyPressEvent
-import at.hannibal2.skyhanni.events.InventoryUpdatedEvent
-import at.hannibal2.skyhanni.utils.ChatUtils
-import at.hannibal2.skyhanni.utils.InventoryUtils
-import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
-import at.hannibal2.skyhanni.utils.ItemUtils.getLore
-import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.NEUInternalName
-import at.hannibal2.skyhanni.utils.NEUItems.getPrice
-import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
-import at.hannibal2.skyhanni.utils.NumberUtil.formatLong
-import at.hannibal2.skyhanni.utils.OSUtils
-import at.hannibal2.skyhanni.utils.StringUtils.matchFirst
-import at.hannibal2.skyhanni.utils.StringUtils.matches
-import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-class AuctionHouseCopyUnderbidPrice {
-
- private val config get() = SkyHanniMod.feature.inventory.auctions
-
- private val patternGroup = RepoPattern.group("auctions.underbid")
- private val auctionPricePattern by patternGroup.pattern(
- "price",
- "§7(?:Buy it now|Starting bid|Top bid): §6(?<coins>[0-9,]+) coins"
- )
- private val allowedInventoriesPattern by patternGroup.pattern(
- "allowedinventories",
- "(?:Auctions Browser|Manage Auctions|Auctions: \".*\"?)"
- )
-
- @SubscribeEvent
- fun onInventoryUpdated(event: InventoryUpdatedEvent) {
- if (!LorenzUtils.inSkyBlock) return
- if (!config.autoCopyUnderbidPrice) return
- if (!event.fullyOpenedOnce) return
- if (event.inventoryName != "Create BIN Auction") return
- val item = event.inventoryItems[13] ?: return
-
- val internalName = item.getInternalName()
- if (internalName == NEUInternalName.NONE) return
-
- val price = internalName.getPrice().toLong()
- if (price <= 0) {
- OSUtils.copyToClipboard("")
- return
- }
- val newPrice = price * item.stackSize - 1
- OSUtils.copyToClipboard("$newPrice")
- ChatUtils.chat("Copied ${newPrice.addSeparators()} to clipboard. (Copy Underbid Price)")
- }
-
- @SubscribeEvent
- fun onKeybind(event: GuiKeyPressEvent) {
- if (!config.copyUnderbidKeybind.isKeyHeld()) return
- if (!LorenzUtils.inSkyBlock) return
- if (!allowedInventoriesPattern.matches(InventoryUtils.openInventoryName())) return
- val stack = event.guiContainer.slotUnderMouse?.stack ?: return
-
- stack.getLore().matchFirst(auctionPricePattern) {
- val underbid = group("coins").formatLong() - 1
- OSUtils.copyToClipboard("$underbid")
- ChatUtils.chat("Copied ${underbid.addSeparators()} to clipboard.")
- }
- }
-
- @SubscribeEvent
- fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
- event.move(25, "inventory.copyUnderbidPrice", "inventory.auctions.autoCopyUnderbidPrice")
- }
-}