ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:important-caption: :heavy_exclamation_mark:
:caution-caption: :fire:
:warning-caption: :warning:
endif::[]
:toc: left
:toclevels: 5

= Money

This module adds money (wallet and bank).

== Extension

=== User

[source,lua]
----
self.cdata.wallet
self.cdata.bank


-- get wallet amount
User:getWallet()

-- get bank amount
User:getBank()

-- set wallet amount
User:setWallet(amount)

-- set bank amount
User:setBank(amount)

-- give money to bank
User:giveBank(amount)

-- give money to wallet
User:giveWallet(amount)

-- try a payment (with wallet)
-- dry: if passed/true, will not affect
-- return true if debited or false
User:tryPayment(amount, dry)

-- try a withdraw (from bank)
-- dry: if passed/true, will not affect
-- return true if withdrawn or false
User:tryWithdraw(amount, dry)

-- try a deposit
-- dry: if passed/true, will not affect
-- return true if deposited or false
User:tryDeposit(amount, dry)

-- try full payment (wallet + bank to complete payment)
-- dry: if passed/true, will not affect
-- return true if debited or false
User:tryFullPayment(amount, dry)
----

=== Server

[source,lua]
----
self.cfg
----

.Events
[horizontal]
`playerMoneyUpdate(user)`:: called when the player money is updated (load, change...)

== Item

=== money

Money packed as item.

=== money_binder

Used to pack an amount of wallet money into money item.

== Transformer processor

Consume and produce money in transformers.

`money`:: amount

.Example
----
...
money = 200
----
