Studios
Treasuryhouse-3.jpg

Commands & Exports

SoonTreasuryQbox
PAGE 06 OF 06  ·  TROUBLESHOOTING → COMMANDS & EXPORTSdocs.glitchstudios.dev
Browse docs

Commands#

Command Who What
treasury Server console only Prints each government's balance and the last seven days of the ledger by kind

Server exports#

All exports are server side. Collect, Spend, Sink, SinkSociety, StampDuty, FuelExcise, TaxIncome and Adjust check the calling resource against Config.AllowedCallers and refuse a resource that is not listed.

Export signature What it does
Collect(amount, kind, citizenid, note, gov) Money into a government. gov is optional. Returns true when booked.
Spend(amount, kind, citizenid, note, gov) Money out of a government. The balance may go negative.
GetBalance(gov) Cached balance of one government. Defaults to the state account.
GetAccounts() Table of every account with its society account, label and balance
IsBankrupt(gov) True when the balance is below Config.Meta.bankruptFloor
GetRates() Current income, gst, stamp, rego, regoMin and exchange
StampDuty(identifier, price, what) Charges the buyer's bank and returns the duty taken, or 0 when nothing was taken
FuelExcise(source, price) For a fuel script to call after a pump sale. Returns the excise booked.
TaxIncome(source, citizenid, moneyType, amount, resource, reason) Called by the qbx_core patch. Returns the amount to hold back, never the full amount.
Sink(source, amount, kind, note) Books money a resource has already removed from a player and given to nobody
SinkSociety(society, amount, kind, note) The same for money taken from a society account
Adjust(gov, amount, note) Admin correction, booked as admin_adjust. Only resources in Config.AllowedCallers.Adjust can use it.
Lever(id, fallback) Read-only State Finances lever value, or the fallback. Used by the resource's own files.

Events#

Event Side What it does
glitch-treasury:server:foodOrder Server (job, customerCid, cashier, price, test, orderNumber). Reports a paid food order: customerCid is a citizenid or 'npc', cashier is a citizenid or 'kiosk'. Argument types are checked and the order price is capped by Config.Grant.maxOrderPrice.
qbx_core:server:onPaycheck Server Listened to, not fired by this resource. The qbx_core patch fires it after a paycheck is saved.

Callbacks and client API#

None. The resource has no client scripts, no net events and no callbacks.

Database tables#

Table What it holds
glitch_treasury_ledger One row per booking: time, kind, amount, citizen id, note and government
glitch_treasury_rego The last billed time per plate
banking_society_accounts omes_banking's table, where the balances are kept