aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/ledger/ItemChange.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-12-08 00:42:01 +0100
committerLinnea Gräf <nea@nea.moe>2024-12-08 00:42:01 +0100
commitfa72dd4ce107190cda7bc56234fed650f20e3aa9 (patch)
tree57a5fa0c224db5bb670e26813c958a768d6bdf90 /src/main/kotlin/moe/nea/ledger/ItemChange.kt
parent0a2342c015b310172f933df765d8651013c26f16 (diff)
downloadLocalTransactionLedger-fa72dd4ce107190cda7bc56234fed650f20e3aa9.tar.gz
LocalTransactionLedger-fa72dd4ce107190cda7bc56234fed650f20e3aa9.tar.bz2
LocalTransactionLedger-fa72dd4ce107190cda7bc56234fed650f20e3aa9.zip
feat: Add visitor trading detection
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/ItemChange.kt')
-rw-r--r--src/main/kotlin/moe/nea/ledger/ItemChange.kt33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/ItemChange.kt b/src/main/kotlin/moe/nea/ledger/ItemChange.kt
new file mode 100644
index 0000000..a8bb7e8
--- /dev/null
+++ b/src/main/kotlin/moe/nea/ledger/ItemChange.kt
@@ -0,0 +1,33 @@
+package moe.nea.ledger
+
+data class ItemChange(
+ val itemId: ItemId,
+ val count: Double,
+ val direction: ChangeDirection,
+) {
+ enum class ChangeDirection {
+ GAINED,
+ TRANSFORM,
+ SYNC,
+ CATALYST,
+ LOST;
+ }
+
+ companion object {
+ fun gainCoins(number: Double): ItemChange {
+ return gain(ItemId.COINS, number)
+ }
+
+ fun gain(itemId: ItemId, amount: Number): ItemChange {
+ return ItemChange(itemId, amount.toDouble(), ChangeDirection.GAINED)
+ }
+
+ fun lose(itemId: ItemId, amount: Number): ItemChange {
+ return ItemChange(itemId, amount.toDouble(), ChangeDirection.LOST)
+ }
+
+ fun loseCoins(number: Double): ItemChange {
+ return lose(ItemId.COINS, number)
+ }
+ }
+} \ No newline at end of file