diff options
Diffstat (limited to 'src/main')
5 files changed, 47 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index f3e9d7703..f1e88412b 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -255,6 +255,7 @@ import at.hannibal2.skyhanni.features.misc.compacttablist.AdvancedPlayerList import at.hannibal2.skyhanni.features.misc.compacttablist.TabListReader import at.hannibal2.skyhanni.features.misc.compacttablist.TabListRenderer import at.hannibal2.skyhanni.features.misc.discordrpc.DiscordRPCManager +import at.hannibal2.skyhanni.features.misc.items.AuctionHouseCopyUnderbidPrice import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue import at.hannibal2.skyhanni.features.misc.items.EstimatedWardrobePrice import at.hannibal2.skyhanni.features.misc.items.GlowingDroppedItems @@ -458,6 +459,7 @@ class SkyHanniMod { loadModule(TrophyFishMessages()) loadModule(BazaarBestSellMethod()) loadModule(BazaarOpenPriceWebsite()) + loadModule(AuctionHouseCopyUnderbidPrice()) loadModule(AnvilCombineHelper()) loadModule(SeaCreatureMessageShortener()) loadModule(AshfangFreezeCooldown()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java index 60cc0e405..01d9a29fe 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java @@ -163,6 +163,13 @@ public class InventoryConfig { public boolean highlightAuctions = true; @Expose + @ConfigOption(name = "Copy Underbid Price", + desc = "Copies the price of an item in the \"Create BIN Auction\" minus 1 coin into the clipboard for faster under-bidding.") + @ConfigEditorBoolean + @FeatureToggle + public boolean copyUnderbidPrice = false; + + @Expose @ConfigOption(name = "Shift Click Equipment", desc = "Makes normal clicks to shift clicks in equipment inventory") @ConfigEditorBoolean @FeatureToggle diff --git a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt index 921d591b2..fa8494dcb 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt @@ -95,6 +95,7 @@ object OtherInventoryData { private fun done(inventory: Inventory) { InventoryFullyOpenedEvent(inventory).postAndCatch() + inventory.fullyOpenedOnce = true InventoryUpdatedEvent(inventory).postAndCatch() acceptItems = false } @@ -104,5 +105,6 @@ object OtherInventoryData { val title: String, val slotCount: Int, val items: MutableMap<Int, ItemStack> = mutableMapOf(), + var fullyOpenedOnce: Boolean = false ) } diff --git a/src/main/java/at/hannibal2/skyhanni/events/InventoryFullyOpenedEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/InventoryFullyOpenedEvent.kt index ca165c31c..7ff2ca293 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/InventoryFullyOpenedEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/InventoryFullyOpenedEvent.kt @@ -3,13 +3,14 @@ package at.hannibal2.skyhanni.events import at.hannibal2.skyhanni.data.OtherInventoryData import net.minecraft.item.ItemStack -open class InventoryOpenEvent(inventory: OtherInventoryData.Inventory) : LorenzEvent() { +open class InventoryOpenEvent(private val inventory: OtherInventoryData.Inventory) : LorenzEvent() { val inventoryId: Int by lazy { inventory.windowId } val inventoryName: String by lazy { inventory.title } val inventorySize: Int by lazy { inventory.slotCount } val inventoryItems: Map<Int, ItemStack> by lazy { inventory.items } + val fullyOpenedOnce: Boolean get() = inventory.fullyOpenedOnce } class InventoryFullyOpenedEvent(inventory: OtherInventoryData.Inventory) : InventoryOpenEvent(inventory) -class InventoryUpdatedEvent(inventory: OtherInventoryData.Inventory) : InventoryOpenEvent(inventory)
\ No newline at end of file +class InventoryUpdatedEvent(inventory: OtherInventoryData.Inventory) : InventoryOpenEvent(inventory) 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 +} |