diff options
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/ItemChange.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/ledger/ItemChange.kt | 6 |
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) } |