OBJECT
/d/archwiz/common/finance/bankobject
LAST UPDATE
Wessex, 04-Apr-98
SYNOPSIS
#include <money.h>
[...]
BANKOBJECT-><function>
DESCRIPTION
The Bankobject handles the accounts of the players.
It offers various functions, which are:
(CU = Currency Unit (== copper coins))
void LoadAccounts(void|int force)
Load the account-database. It won't be loaded, if the
accounts are already created. To do this, you have to set
the force-flag to non-zero.
void SaveAccounts()
Saves the account-database
int HasAccount(string player)
Returns a non-zero value, if the player has an account.
mapping QueryAccounts()
Returns the account-mapping. The following entries can be
found in there (defines from money.h):
A_AMOUNT the CU (Currency Unit) amount on
the player's account
A_CREATED when the account has been created
A_DEPOSIT the last time something got deposit by the
player
A_WITHDRAW the last time the player withdrawed something
from her/his account
int SetAccount(string player,int amount)
Sets the amount of CU on the players account. If the
account doesn't exist, it will be created. If the player
doesn't exist, it won't be created.
SetAccount returns a non-zero value, if the setting was
successful.
int AddAccount(string player,int amount)
Same as SetAccount, but the amount will be added to the
amount on the account. If the resulting value on the account
is less than zero, AddAccount will return 0 else, if all
other checks from have been passed successfully and the
amount on the account got changed, it will return 1.
int QueryAccount(string player)
This function returns -1, if the player has no account else
it will return the amount of CU on the players account.
mapping QueryFullAccount(string player)
Returns all data about an account of the player. The result
may be evaluated just like the result of QueryAccounts.
E. g. QueryFullAccount("wessex") might return:
(["wessex":1000;786657700;786657792;786657795])
i. e.:
Wessex has 1000 CU on his account (A_AMOUNT),
his account was created on Mon Dex 5 21:01:40 1994 (A_CREATED),
he last deposited on Mon Dec 5 21:03:12 1994 (A_DEPOSIT) and
he last withdrawed on Mon Dec 5 21:03:15 1994 (A_WITHDRAW).
int CloseAccount(string player)
This closes the account of the player (removes it from the
database). On success 1 is returned else 0.
On every reset the bankobject will check a certain amount of
accounts, if they should still exist. They will be deleted
when either the owner doesn't exist in the mud or the owner
is a Learner/Wizard.
SEE ALSO