[Package Index | Mudlib Index | Effect Index]

File /std/living/money.c

This file has all the functions to deal with living objects and money.

See also:
/obj/money.c and /obj/handlers/money_handler.c

Written by Pinkfish

Includes

This class includes the following files /include/shops/bank.h and /include/money.h

Method index

Public Functions

These are functions that everyone can access.

adjust_money
varargs void adjust_money(mixed amount,
                          string type)

This method adjusts the amount ofmoney the player has. It redirects the call off the the money object and calls the adjust_money() function on it. The amount can be a money array, in which case it will adjust the size by the members of the money array.

If the money object doesn't exist yet, this function might create a new money object. The exception is that if the amount argument is 0, nothing happens.

Parameters:
amount - the amount to adjust the money by
type - the type of coin to adjust

See also:
/obj/money->adjust_money()


give_money
int give_money(int base,
               int rand,
               string type)

This method is used to give some startup money to the npc.

Parameters:
base - the base amount ofmoney to give (fixed)
rand - the random amount ofmoney to give
type - the type of money to give (default: "copper")

Returns:
the return value of adjust_money()

See also:
/std/living/money.c

Example:
ob = clone_object(CLUCKY_CHICKEN);
// This will give the chicken 10 + random(10) royals.
// It is a royal chicken
ob->give_money(10, 10, "royal");

pay_money
varargs void pay_money(mixed m_array,
                       string where)

This method makes the player make a payment. This is used for shops and things.

Parameters:
m_array - the money to pay
where - the money area to make the payment in

See also:
/obj/handlers/money_handler->make_payment()


query_money
int query_money(string type)

This method returns all of the money of a certain type on the money object.

Parameters:
type - the type of money to return

Returns:
the number of those money items

See also:
query_value() and query_value_in()


query_money_array
mixed * query_money_array()

This method returns the money array associated with the money on the player object.

Returns:
the money array on the player object

See also:
set_money_array()


query_money_object
object query_money_object(int force)

This method returns the money object for the player. If the force flag is set then the object will be created if it does not exist.

Parameters:
force - make the money object exist


query_value
int query_value()

This method returns the value of the money as an integer. This is an absolute value of their worth.

Returns:
an integer value of their money

See also:
query_value_in()


query_value_in
int query_value_in(string where)

This method returns the value of the money as in integer in the specified place.

Parameters:
where - the place in which to determine the money from

Returns:
the integer value of money

See also:
query_value() and query_money()


set_money_array
void set_money_array(mixed * new_array)

This method sets the money array associated with the player. THis will overwrite any current money on the player.

Parameters:
new_array - the new money array for the player

See also:
query_money_array()


setup_money
void setup_money(int value,
                 string area)

This method provides a way to automatically distribute an amount of money in a particular currency, rather than adding each element seperately.

Parameters:
value - The value of currency to give, as per set_value