Go: Economy¶
Functions¶
OnMoneyBefore¶
| Go | |
|---|---|
OnMoneyBefore calls fn before every economy transaction; returning false vetoes it.
- Parameters:
- fn :
func(MoneyEvent) bool
- fn :
- Return type:
error - Slots:
money_listen_before_event
OnMoneyAfter¶
| Go | |
|---|---|
OnMoneyAfter calls fn after every economy transaction.
- Parameters:
- fn :
func(MoneyEvent)
- fn :
- Return type:
error - Slots:
money_listen_after_event
Money¶
| Go | |
|---|---|
Money is a balance. A negative answer means it cannot be read, an empty xuid or no economy backend, and is an error: a real balance is never negative.
- Parameters:
- xuid :
string
- xuid :
- Return type:
(int64, error) - Slots:
get_money
SetMoney¶
| Go | |
|---|---|
SetMoney sets a balance.
- Parameters:
- xuid :
string - amount :
int64
- xuid :
- Return type:
error - Slots:
set_money
AddMoney¶
| Go | |
|---|---|
AddMoney adds to a balance.
- Parameters:
- xuid :
string - delta :
int64
- xuid :
- Return type:
error - Slots:
add_money
ReduceMoney¶
| Go | |
|---|---|
ReduceMoney takes from a balance.
- Parameters:
- xuid :
string - delta :
int64
- xuid :
- Return type:
error - Slots:
reduce_money
TransferMoney¶
| Go | |
|---|---|
TransferMoney moves value between two balances; the recipient receives it taxed.
- Parameters:
- from :
string - to :
string - value :
int64 - note :
string
- from :
- Return type:
error - Slots:
trans_money
MoneyKind¶
| Go | |
|---|---|
MoneyKind is what an economy event does, one of the Money* kinds. A value outside them is one a newer economy backend sent; a veto listener should refuse it rather than guess.
| Name | Value | Description |
|---|---|---|
MoneySet |
0 |
|
MoneyAdd |
1 |
|
MoneyReduce |
2 |
|
MoneyTrans |
3 |
MoneyEvent¶
MoneyEvent is one economy transaction.