aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt33
1 files changed, 33 insertions, 0 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
new file mode 100644
index 000000000..0f2a45659
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt
@@ -0,0 +1,33 @@
+package at.hannibal2.skyhanni.features.misc.items
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.InventoryUpdatedEvent
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
+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.OSUtils
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class AuctionHouseCopyUnderbidPrice {
+ private val config get() = SkyHanniMod.feature.inventory
+
+ @SubscribeEvent
+ fun onInventoryUpdated(event: InventoryUpdatedEvent) {
+ if (!isEnabled()) 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() - 1
+ if (price <= 0) return
+ OSUtils.copyToClipboard("$price")
+ LorenzUtils.chat("Set §e${price.addSeparators()} §eto clipboard. (Copy Underbid Price)")
+ }
+
+ fun isEnabled() = LorenzUtils.inSkyBlock && config.copyUnderbidPrice
+}