aboutsummaryrefslogtreecommitdiff
path: root/basetypes
diff options
context:
space:
mode:
Diffstat (limited to 'basetypes')
-rw-r--r--basetypes/src/main/kotlin/moe/nea/ledger/ItemChange.kt43
-rw-r--r--basetypes/src/main/kotlin/moe/nea/ledger/TransactionType.kt35
2 files changed, 78 insertions, 0 deletions
diff --git a/basetypes/src/main/kotlin/moe/nea/ledger/ItemChange.kt b/basetypes/src/main/kotlin/moe/nea/ledger/ItemChange.kt
new file mode 100644
index 0000000..6cadf27
--- /dev/null
+++ b/basetypes/src/main/kotlin/moe/nea/ledger/ItemChange.kt
@@ -0,0 +1,43 @@
+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 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 unpairLose(pair: Pair<ItemId, Double>) = unpair(ChangeDirection.LOST, pair)
+
+ 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
diff --git a/basetypes/src/main/kotlin/moe/nea/ledger/TransactionType.kt b/basetypes/src/main/kotlin/moe/nea/ledger/TransactionType.kt
new file mode 100644
index 0000000..33c633d
--- /dev/null
+++ b/basetypes/src/main/kotlin/moe/nea/ledger/TransactionType.kt
@@ -0,0 +1,35 @@
+package moe.nea.ledger
+
+enum class TransactionType {
+ ACCESSORIES_SWAPPING,
+ ALLOWANCE_GAIN,
+ AUCTION_BOUGHT,
+ AUCTION_LISTING_CHARGE,
+ AUCTION_SOLD,
+ AUTOMERCHANT_PROFIT_COLLECT,
+ BANK_DEPOSIT,
+ BANK_WITHDRAW,
+ BAZAAR_BUY_INSTANT,
+ BAZAAR_BUY_ORDER,
+ BAZAAR_SELL_INSTANT,
+ BAZAAR_SELL_ORDER,
+ BITS_PURSE_STATUS,
+ BOOSTER_COOKIE_ATE,
+ CAPSAICIN_EYEDROPS_USED,
+ COMMUNITY_SHOP_BUY,
+ CORPSE_DESECRATED,
+ DIE_ROLLED,
+ DRACONIC_SACRIFICE,
+ DUNGEON_CHEST_OPEN,
+ FORGED,
+ GOD_POTION_DRANK,
+ GOD_POTION_MIXIN_DRANK,
+ KAT_TIMESKIP,
+ KAT_UPGRADE,
+ KISMET_REROLL,
+ KUUDRA_CHEST_OPEN,
+ NPC_BUY,
+ NPC_SELL,
+ VISITOR_BARGAIN,
+ WYRM_EVOKED,
+} \ No newline at end of file