aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/ledger/ItemChange.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-12-19 20:18:39 +0100
committerLinnea Gräf <nea@nea.moe>2024-12-19 20:18:39 +0100
commiteda44cb8743c709c15a7ed03381d05e43728e647 (patch)
tree557a3bd4f096584158b46921f4826208396b4baa /src/main/kotlin/moe/nea/ledger/ItemChange.kt
parenta046b198645811fe1b7db129942505c379aabb03 (diff)
downloadLocalTransactionLedger-eda44cb8743c709c15a7ed03381d05e43728e647.tar.gz
LocalTransactionLedger-eda44cb8743c709c15a7ed03381d05e43728e647.tar.bz2
LocalTransactionLedger-eda44cb8743c709c15a7ed03381d05e43728e647.zip
feat: Add corpse loot detection
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/ItemChange.kt')
-rw-r--r--src/main/kotlin/moe/nea/ledger/ItemChange.kt6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/ItemChange.kt b/src/main/kotlin/moe/nea/ledger/ItemChange.kt
index 834cd2b..186a4e3 100644
--- a/src/main/kotlin/moe/nea/ledger/ItemChange.kt
+++ b/src/main/kotlin/moe/nea/ledger/ItemChange.kt
@@ -54,6 +54,12 @@ data class ItemChange(
return gain(ItemId.COINS, number)
}
+ fun unpair(direction: ChangeDirection, pair: Pair<ItemId, Double>): ItemChange {
+ return ItemChange(pair.first, pair.second, direction)
+ }
+
+ fun unpairGain(pair: Pair<ItemId, Double>) = unpair(ChangeDirection.GAINED, pair)
+
fun gain(itemId: ItemId, amount: Number): ItemChange {
return ItemChange(itemId, amount.toDouble(), ChangeDirection.GAINED)
}