aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-02-15 20:42:19 +0100
committerLinnea Gräf <nea@nea.moe>2024-02-15 20:42:19 +0100
commitb7aa6cddd2a4134ff3ee53c8c1bc707dc1cab89c (patch)
tree3bb7db321605507aa3e8025c0dd7c64ea3edca3a /src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt
parentedc72af6ec6055822d0deed8efe3c952cbf65026 (diff)
downloadLocalTransactionLedger-b7aa6cddd2a4134ff3ee53c8c1bc707dc1cab89c.tar.gz
LocalTransactionLedger-b7aa6cddd2a4134ff3ee53c8c1bc707dc1cab89c.tar.bz2
LocalTransactionLedger-b7aa6cddd2a4134ff3ee53c8c1bc707dc1cab89c.zip
Add bazaar order support
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt')
-rw-r--r--src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt b/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt
index 988e317..b1d953e 100644
--- a/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt
+++ b/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt
@@ -25,11 +25,14 @@ class ItemIdProvider {
fun saveInventoryIds(event: BeforeGuiAction) {
val chest = (event.gui as? GuiChest) ?: return
val slots = chest.inventorySlots as ContainerChest
+ val isOrderMenu = slots.lowerChestInventory.name.unformattedString() == "Your Bazaar Orders"
slots.inventorySlots.forEach {
val stack = it.stack ?: return@forEach
val nbt = stack.tagCompound ?: NBTTagCompound()
val display = nbt.getCompoundTag("display")
- val name = display.getString("Name").unformattedString()
+ var name = display.getString("Name").unformattedString()
+ if (isOrderMenu)
+ name = name.removePrefix("BUY ").removePrefix("SELL ")
val id = stack.getInternalId()
if (id != null && name.isNotBlank()) {
knownNames[name] = id