Economy

Global functions to interact with the economy. More...


Detailed Description

Global functions to interact with the economy.

Mostly bank functions. Include economy_h.fos for usage.

Initialization



void InitEconomy ()
 Initialize the economy.

Prices



uint GetItemPrice (uint pid)
int GetBaseModifier (Critter& player, Critter& trader, bool buy)
int GetItemSellModifier (Critter& player, Critter& trader)
int GetItemBuyModifier (Critter& player, Critter& trader)

Banks



void BanksAddMoney (uint amount)
 Add money divided among all banks.
void BanksRemoveMoney (uint amount)
 Remove money divided among all banks.
uint BanksGetTotalMoney ()
 Get total money stored in all banks combined.
bool BanksTransferToCritter (Critter& critter, uint amount, uint type, bool virtual)
string GetTransferReason (uint type)
bool BanksTransferFromCritter (Critter& critter, uint amount, uint type, bool virtual)
bool BankAddMoney (uint bankid, uint amount)
 Add some money to the specified bank's reserve.
bool BankRemoveMoney (uint bankid, uint amount)
 Remove some money from the specified bank's reserve.
bool BankSetMoney (uint bankid, uint amount)
 Set the total money of the specified bank.
bool BankTransferFromCritter (uint bankId, Critter& critter, uint amount, uint type, bool virtual)
bool BankAccountRemoveMoney (uint bankid, uint account, uint amount)
 Remove some amount of money from the specified account in the bank.
uint BankCreateAccount (uint bankid, uint playerid)
 Create an account for a specific player.
uint BankDepositMoney (uint bankid, uint playerid, uint account, int amount)
 Deposit some specified amount of money to the specified account in the bank.
uint BankWithdrawMoney (uint bankid, uint playerid, uint account, int amount)
 Withdraw some specified amount of money from the specified account in the bank.
uint BankTransferMoney (uint bankid, uint fromaccount, uint toaccount, uint amount)
 Transfer some specified amount of money from one account to another account in the bank.
uint BankGetAccountOwner (uint bankid, uint account)
 Get owner of the specified account.
int BankGetAccountBalance (uint bankid, uint account)
 Get balance of the specified account.
int BankGetAccountID (uint bankid, uint playerid)
 Get AccountID of specified players account.
bool BankAccountExists (uint bankid, uint account)
 Check if an account exists in the bank.
bool BankHasAccess (uint bankid, uint account, uint playerid)
 Check if a player has access to an account.
uint BankGetAccessCount (uint bankid, uint account)
 Check the amount of additional players that have access to a specific account.
uint BankGetAccountType (uint bankid, uint account)
 Check the account type.
uint BankSetAccountType (uint bankid, uint account, uint accounttype)
 Set the account type.
uint BankSetCreditRating (uint bankid, uint account, uint rating)
 Set the credit rating, currently doesn't effect anything.
uint BankGetCreditRating (uint bankid, uint account)
 Get the credit rating, currently doesn't effect anything.
uint BankSetLoan (uint bankid, uint account, uint loan)
 Set the loan amount.
uint BankGetLoan (uint bankid, uint account)
 Get the loan amount.
uint BankAddAccess (uint bankid, uint account, uint playerid)
 Give player access to a joint (shared) account.
uint BankRemoveAccess (uint bankid, uint account, uint playerid)
 Revoke player access to a joint (shared) account.
uint BankGetLoanInterest (uint bankid)
 Get the current loan interest of the bank.
uint BankSetLoanInterest (uint bankid, uint interest)
 Set the current loan interest of the bank.
float BankGetSaveInterest (uint bankid)
 Get the current save interest of the bank.
uint BankSetSaveInterest (uint bankid, float interest)
 Set the current save interest of the bank.
uint BankGetTotalMoney (uint bankid)
 Get total amount of money in the bank.
uint BankGetTotalBalance (uint bankid)
 Get sum of balances of all accounts in the bank.
float BankGetReserveRatio (uint bankid)
 Get ratio of bank reserve vs total balance.
uint BankTakeLoan (uint bankid, uint account, uint amount)
 Take a loan with specified account and amount.
uint BankGetNumberOfAccounts (uint bankid)
 Get total number of accounts created in the bank.

Function Documentation

void InitEconomy (  ) 

Initialize the economy.

The only call you'll really need to run, as it'll call other initializers.

uint GetItemPrice ( uint  pid  ) 
int GetBaseModifier ( Critter player,
Critter trader,
bool  buy 
)
int GetItemSellModifier ( Critter player,
Critter trader 
)
int GetItemBuyModifier ( Critter player,
Critter trader 
)
void BanksAddMoney ( uint  amount  ) 

Add money divided among all banks.

Parameters:
amount How much money to add to reserves, the money will be splittled evenly among the banks
void BanksRemoveMoney ( uint  amount  ) 

Remove money divided among all banks.

Parameters:
amount How much money to remove from reserves, the money will be taken as evenly as possible among the banks
uint BanksGetTotalMoney (  ) 

Get total money stored in all banks combined.

Returns:
Total money stored in all banks combined.
bool BanksTransferToCritter ( Critter critter,
uint  amount,
uint  type,
bool  virtual 
)
string GetTransferReason ( uint  type  ) 
bool BanksTransferFromCritter ( Critter critter,
uint  amount,
uint  type,
bool  virtual 
)
bool BankAddMoney ( uint  bankid,
uint  amount 
)

Add some money to the specified bank's reserve.

Parameters:
bankid Bank ID, see _economy.fos
amount How much money to add to reserves
Returns:
Returns operation status
bool BankRemoveMoney ( uint  bankid,
uint  amount 
)

Remove some money from the specified bank's reserve.

Parameters:
bankid Bank ID, see _economy.fos
amount How much money to remove from reserves
Returns:
Returns operation status
bool BankSetMoney ( uint  bankid,
uint  amount 
)

Set the total money of the specified bank.

Parameters:
bankid Bank ID, see _economy.fos
amount Set amount amount of money in reserves. Can't be negative
Returns:
Returns operation status
bool BankTransferFromCritter ( uint  bankId,
Critter critter,
uint  amount,
uint  type,
bool  virtual 
)
bool BankAccountRemoveMoney ( uint  bankid,
uint  account,
uint  amount 
)

Remove some amount of money from the specified account in the bank.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
amount Sum to remove from account
Returns:
Returns operation status
uint BankCreateAccount ( uint  bankid,
uint  playerid 
)

Create an account for a specific player.

Parameters:
bankid Bank ID, see _economy.fos
playerid ID of the player critter that the bankaccount should be created for
Returns:
Bank error code FD_BANK_RESULT_* defined in _economy.fos
uint BankDepositMoney ( uint  bankid,
uint  playerid,
uint  account,
int  amount 
)

Deposit some specified amount of money to the specified account in the bank.

Parameters:
bankid Bank ID, see _economy.fos
playerid ID of the player critter that deposits the money
account ID of the account that the player deposits money to
amount Amount of money that the player wants to deposit
Returns:
Bank error code FD_BANK_RESULT_* defined in _economy.fos
uint BankWithdrawMoney ( uint  bankid,
uint  playerid,
uint  account,
int  amount 
)

Withdraw some specified amount of money from the specified account in the bank.

Parameters:
bankid Bank ID, see _economy.fos
playerid ID of the player critter that withdraws the money
account ID of the account that the player withdraw money from
amount Amount of money that the player wants to withdraw
Returns:
Bank error code FD_BANK_RESULT_* defined in _economy.fos
uint BankTransferMoney ( uint  bankid,
uint  fromaccount,
uint  toaccount,
uint  amount 
)

Transfer some specified amount of money from one account to another account in the bank.

Parameters:
bankid Bank ID, see _economy.fos
fromaccount ID of the account from which money is tranferred
toaccount ID of the account to which money is tranferred
amount Amount of money that should be transferred
Returns:
Bank error code FD_BANK_RESULT_* defined in _economy.fos
uint BankGetAccountOwner ( uint  bankid,
uint  account 
)

Get owner of the specified account.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
Returns:
Returns critter.Id of the owner of the specified account
int BankGetAccountBalance ( uint  bankid,
uint  account 
)

Get balance of the specified account.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
Returns:
Returns account balance
int BankGetAccountID ( uint  bankid,
uint  playerid 
)

Get AccountID of specified players account.

Parameters:
bankid Bank ID, see _economy.fos
playerid Player ID
Returns:
Returns Account ID if found, -1 if none is found
bool BankAccountExists ( uint  bankid,
uint  account 
)

Check if an account exists in the bank.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
Returns:
Returns true if the account exists
bool BankHasAccess ( uint  bankid,
uint  account,
uint  playerid 
)

Check if a player has access to an account.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
playerid Player ID
Returns:
Returns true if the specified player has access to the account
uint BankGetAccessCount ( uint  bankid,
uint  account 
)

Check the amount of additional players that have access to a specific account.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
Returns:
Returns the amount of additional players that have access to the bank, can at minimum be 0 (only owner has access)
uint BankGetAccountType ( uint  bankid,
uint  account 
)

Check the account type.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
Returns:
Returns a value defined by the ACCOUNT_TYPE_* define in _economy.fos
uint BankSetAccountType ( uint  bankid,
uint  account,
uint  accounttype 
)

Set the account type.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
accounttype a value matching any of the ACCOUNT_TYPE_* defines in _economy.fos
Returns:
Bank error code FD_BANK_RESULT_* defined in _economy.fos
uint BankSetCreditRating ( uint  bankid,
uint  account,
uint  rating 
)

Set the credit rating, currently doesn't effect anything.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
rating a value matching any of the CREDITVALUE_* defines in _economy.fos
Returns:
Bank error code FD_BANK_RESULT_* defined in _economy.fos
uint BankGetCreditRating ( uint  bankid,
uint  account 
)

Get the credit rating, currently doesn't effect anything.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
Returns:
a value matching any of the CREDITVALUE_* defines in _economy.fos
uint BankSetLoan ( uint  bankid,
uint  account,
uint  loan 
)

Set the loan amount.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
loan The amount of loaned money
Returns:
Bank error code FD_BANK_RESULT_* defined in _economy.fos
uint BankGetLoan ( uint  bankid,
uint  account 
)

Get the loan amount.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
Returns:
The amount of loaned money
uint BankAddAccess ( uint  bankid,
uint  account,
uint  playerid 
)

Give player access to a joint (shared) account.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
playerid Player ID
Returns:
Bank error code FD_BANK_RESULT_* defined in _economy.fos
uint BankRemoveAccess ( uint  bankid,
uint  account,
uint  playerid 
)

Revoke player access to a joint (shared) account.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
playerid Player ID
Returns:
Bank error code FD_BANK_RESULT_* defined in _economy.fos
uint BankGetLoanInterest ( uint  bankid  ) 

Get the current loan interest of the bank.

Parameters:
bankid Bank ID, see _economy.fos
Returns:
Loan interest in percent
uint BankSetLoanInterest ( uint  bankid,
uint  interest 
)

Set the current loan interest of the bank.

Parameters:
bankid Bank ID, see _economy.fos
interest Loan interest in percent
Returns:
Bank error code FD_BANK_RESULT_* defined in _economy.fos
float BankGetSaveInterest ( uint  bankid  ) 

Get the current save interest of the bank.

Parameters:
bankid Bank ID, see _economy.fos
Returns:
Save interest in percent
uint BankSetSaveInterest ( uint  bankid,
float  interest 
)

Set the current save interest of the bank.

Parameters:
bankid Bank ID, see _economy.fos
interest Loan interest in percent
Returns:
Bank error code FD_BANK_RESULT_* defined in _economy.fos
uint BankGetTotalMoney ( uint  bankid  ) 

Get total amount of money in the bank.

Parameters:
bankid Bank ID, see _economy.fos
Returns:
Total amount of money in the bank
uint BankGetTotalBalance ( uint  bankid  ) 

Get sum of balances of all accounts in the bank.

Parameters:
bankid Bank ID, see _economy.fos
Returns:
Returns accounts balance
float BankGetReserveRatio ( uint  bankid  ) 

Get ratio of bank reserve vs total balance.

Parameters:
bankid Bank ID, see _economy.fos
Returns:
Returns reserve ratio
uint BankTakeLoan ( uint  bankid,
uint  account,
uint  amount 
)

Take a loan with specified account and amount.

Parameters:
bankid Bank ID, see _economy.fos
account Account ID
amount Amount of money to loan
Returns:
Bank error code FD_BANK_RESULT_* defined in _economy.fos
uint BankGetNumberOfAccounts ( uint  bankid  ) 

Get total number of accounts created in the bank.

Parameters:
bankid Bank ID, see _economy.fos
Returns:
Total number of accounts in the bank