[an error occurred while processing this directive]
[<a href="index.shtml">Package Index</a></code> | <a href="index_std.shtml">Mudlib Index</a></code> | <a href="index_eff.shtml">Effect Index</a></code>]<br><h2>File /obj/handlers/money_handler.c</h2>
This handles all the methods for determining values of coins and
the current valid set of coins.   It also handles change calculation.
This was written originaly by Pinkfish, reworked significantly by
Deutha to add in the multiple currency areas.<p><b>See also:</b><br>/std/living/money.c<br /><p>Written by Pinkfish
<h2>Includes</h2>
This class includes the following files /include/money.h and /include/shops/bank.h<h2>Method index</h2>
<ul>
<li><a href="#add_details">add_details</a>(string, string, string, string, string, mixed, string, string)<br/>
This method adds the details for the given coin type into the current
list.
<li><a href="#add_symbol">add_symbol</a>(string, string)<br/>
This method adds in a symboliser for a specified money area.
<li><a href="#add_type">add_type</a>(string, string, int)<br/>
This adds a type of money to the money handler.
<li><a href="#calc_change">calc_change</a>(int, mixed *)<br/>
This method calculates the change of a certain value from a
given money array.
<li><a href="#create_money_array">create_money_array</a>(int, string)<br/>
This method creates a money array from a certain value in a particular
money area.
<li><a href="#dump_money_ob">dump_money_ob</a>(object)<li><a href="#filter_legal_money_array">filter_legal_money_array</a>(mixed *, string)<br/>
This method is identical to filter_legal_tender, except that it takes
a money array rather than a money object
<li><a href="#filter_legal_money_to_array">filter_legal_money_to_array</a>(mixed *, string)<br/>
This method is identical to filter_legal_money_array, except that it
returns an array of two money arrays rather than an array of two
money objects
<li><a href="#filter_legal_tender">filter_legal_tender</a>(object, string)<br/>
This method figures out the legal and illegal tender money from
the specified money object in the specified money area.
<li><a href="#get_money_ob">get_money_ob</a>()<li><a href="#insert_into_money_array">insert_into_money_array</a>(mixed *, string, int)<li><a href="#make_money_array_payment">make_money_array_payment</a>(string, int, mixed *, string, int)<br/>
This method makes a payment from a money array.
<li><a href="#make_new_amount">make_new_amount</a>(int, string)<br/>
This method creates a money object of a certain value in a certain
money area.
<li><a href="#make_payment">make_payment</a>(string, int, object, string)<br/>
This method makes a payment of a particular amount in a particular
money area.
<li><a href="#merge_money_arrays">merge_money_arrays</a>(mixed *, mixed *)<br/>
This method merges two money arrays together and returns the
merged array
<li><a href="#money_array_from_string">money_array_from_string</a>(string, string)<br/>
This method attempts to find a money value from a string.
<li><a href="#money_string">money_string</a>(mixed)<br/>
This method converts a money array into a string so it can be displayed.
<li><a href="#money_value_string">money_value_string</a>(int, string)<br/>
This method returns a string which is based on the value of
the money in a certain money area.
<li><a href="#parse_money">parse_money</a>(string, object, string)<br/>
This method determines all the money from the player object and moves
it into a container.
<li><a href="#pay_amount_from">pay_amount_from</a>(int, object, string)<br/>
This method makes a payment from a specified money object.
<li><a href="#query_adjectives_for">query_adjectives_for</a>(string)<br/>
This method returns all the current adjectives for the given type
of money.
<li><a href="#query_aliases_for">query_aliases_for</a>(string)<br/>
This method returns all the current aliases for the given type
of money.
<li><a href="#query_aliases_of">query_aliases_of</a>(string)<br/>
This converts a currency type's alias (i.
<li><a href="#query_all_places">query_all_places</a>()<br/>
This method returns the current set of areas in which types can
be found.
<li><a href="#query_all_values">query_all_values</a>()<br/>
This method returns the mapping containing all the values of the
currently valid money types.
<li><a href="#query_details">query_details</a>()<br/>
This method returns all the details for the current set of
coins.
<li><a href="#query_details_for">query_details_for</a>(string)<br/>
This method returns the details for a specified type of money.
<li><a href="#query_main_plural_for">query_main_plural_for</a>(string)<br/>
This method returns the main short plural description of the money type.
<li><a href="#query_mapped_values_in">query_mapped_values_in</a>(string)<br/>
This method returns the values in the specified area.
<li><a href="#query_number_coins">query_number_coins</a>(mixed *)<br/>
This method returns the number of coins in the object.
<li><a href="#query_origin_of">query_origin_of</a>(string)<br/>
This takes a coin type and returns the place it is associated with.
<li><a href="#query_person_payments">query_person_payments</a>(int, string, object, object)<br/>
This method makes a payment from one person to another.
<li><a href="#query_plural_for">query_plural_for</a>(string)<br/>
This method returns the short plural description of the money type.
<li><a href="#query_short_for">query_short_for</a>(string)<br/>
This method returns the short description of the money type.
<li><a href="#query_singular_for">query_singular_for</a>(string)<br/>
This method returns the short singular description of the money type.
<li><a href="#query_smallest_value_in">query_smallest_value_in</a>(string)<br/>
This returns the smallest value in the specified area.
<li><a href="#query_symbol_for">query_symbol_for</a>(string)<br/>
This method returns the symboliser for the specified money area.
<li><a href="#query_symbols">query_symbols</a>()<br/>
This method returns all the symbols for the current money areas in the
handler.
<li><a href="#query_total_value">query_total_value</a>(mixed *, string)<br/>
This method determines the total value of a specified money array.
<li><a href="#query_valid_types">query_valid_types</a>()<br/>
This returns a list of valid coin types
<li><a href="#query_value">query_value</a>(string, string)<br/>
This method returns the value of a specified type of money in a certain
money area.
<li><a href="#query_value_of">query_value_of</a>(string)<br/>
This returns the value of a currency type.
<li><a href="#query_values">query_values</a>()<br/>
This method returns the values in the default area.
<li><a href="#query_values_in">query_values_in</a>(string)<br/>
This method returns the values in the specified area.
<li><a href="#query_weighted_values_in">query_weighted_values_in</a>(string, int)<li><a href="#remove_details">remove_details</a>(string)<br/>
This method removes the specified detail.
<li><a href="#remove_symbol">remove_symbol</a>(string)<br/>
This method removes the symboliser for the particular money area.
<li><a href="#remove_type">remove_type</a>(string, string)<br/>
This method removes the type of money from the handler.
<li><a href="#reset_cache">reset_cache</a>()<li><a href="#save_me">save_me</a>()<br/>
This method saves the current state of the money object.
<li><a href="#set_adjectives_for">set_adjectives_for</a>(string, string *)<br/>
This method sets the adjectives for the specified money type.
<li><a href="#set_aliases_for">set_aliases_for</a>(string, string *)<br/>
This method sets the aliases for the specified money type.
<li><a href="#set_plural_for">set_plural_for</a>(string, string)<br/>
This method sets the plural for the specified money type.
<li><a href="#set_singular_for">set_singular_for</a>(string, string)<br/>
This method sets the singular for the specified money type.
<li><a href="#smallest_in">smallest_in</a>(string)<br/>
This returns the smallest unit of currency in this place.
<li><a href="#smallest_value_in">smallest_value_in</a>(string)<br/>
This returns the smallest value of currency in this place.
<li><a href="#sort_money_array">sort_money_array</a>(mixed *)<li><a href="#sort_money_array_by">sort_money_array_by</a>(mixed *, function, int)<li><a href="#value_from_string">value_from_string</a>(string, string)<br/>
This method attempts to find a money value from a string.
</ul>
<h2>Public Functions</h2>
These are functions that everyone can access.<p>
<dl>
<dt class="autodocfuncname"><a name="add_details">
add_details</a><pre class="autodocfuncdef">
void add_details(string word,
                 string hd_sht,
                 string tl_sht,
                 string hd_lng,
                 string tl_lng,
                 mixed composition,
                 string plural,
                 string singular)
</pre><dd><br />
This method adds the details for the given coin type into the current
list.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
word - the coin type the details are for<br />
hd_sht - the heads side short<br />
tl_sht - the tail side short<br />
hd_lng - the head side long<br />
tl_lnd - the tail side long<br />
composition - the composition of the money<br />
plural - the plural value of the object, if 0 then use default plural<br />
singular - the singlar value of the object, if 0 then use default singular<br />
<br />
<dd><b>See also:</b>
<br /><a href="#query_details_for">query_details_for()</a> and <a href="#remove_details">remove_details()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="add_symbol">
add_symbol</a><pre class="autodocfuncdef">
void add_symbol(string word,
                string symboliser)
</pre><dd><br />
This method adds in a symboliser for a specified money area.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
word - the money area to add the symbol for<br />
symboliser - the path to the symboliser object<br />
<br />
<dd><b>See also:</b>
<br /><a href="#query_symbols">query_symbols()</a>, <a href="#query_symbol_for">query_symbol_for()</a> and <a href="#remove_symbol">remove_symbol()
</a><br /><br /><dd><b>Example:</b>
<br/><pre>add_symbol("Ankh-Morpork", "/d/am/money");</pre><br/><pre>
// This is an example of a symboliser object
string symbolise_value( int value ) {
   int dollars, pence;

   dollars = value / 400;
   pence = ( value % 400 ) / 4;
   if ( !pence ) {
      return "A$"+ dollars;
   }
   if ( !dollars ) {
      return pence +"p";
   }
   if ( pence < 10 ) {
      return "A$"+ dollars +".0"+ pence;
   }
   return "A$"+ dollars +"."+ pence;
} /* symbolise_value() */</pre><br /></dl>

<dt class="autodocfuncname"><a name="add_type">
add_type</a><pre class="autodocfuncdef">
void add_type(string where,
              string type,
              int value)
</pre><dd><br />
This adds a type of money to the money handler.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
where - the area in which to add the type of money<br />
type - the name of the money to add<br />
value - the value of the money<br />
<br />
<dd><b>See also:</b>
<br /><a href="#query_values_in">query_values_in()</a> and <a href="#remove_type">remove_type()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="calc_change">
calc_change</a><pre class="autodocfuncdef">
mixed * calc_change(int value,
                    mixed * mon_array)
</pre><dd><br />
This method calculates the change of a certain value from a
given money array.   This makes sure that the change does not include
money that does not actually exist.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
value - the value of the change to calculate<br />
mon_array - the money array to determine the change from<br />
<br />
<dd><b>Returns:</b>
<br />the money array containing the change to use<br /><br />
<dd><b>See also:</b>
<br /><a href="#make_payment">make_payment()</a> and <a href="#pay_amount_from">pay_amount_from()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="create_money_array">
create_money_array</a><pre class="autodocfuncdef">
varargs mixed * create_money_array(int value,
                                   string where)
</pre><dd><br />
This method creates a money array from a certain value in a particular
money area. A money array consists of ({ type, number }) pairs in an
array.   ie: ({ "brass", 12, "copper", 24 }).<br />
<br /><dl>
<dd><b>Parameters:</b><br />
value - the value to get the money array for<br />
where - the money area to get the value in<br />
<br />
<dd><b>Returns:</b>
<br />a money array for the value in the area<br /><br />
<dd><b>See also:</b>
<br /><a href="#money_value_string">money_value_string()
</a><br /><br /><dd><b>Example:</b>
<br/><pre>place = query_property("place");
if (!place) {
     place = "default";
}
mon_array = create_money_array( 1000, place);</pre><br /></dl>

<dt class="autodocfuncname"><a name="dump_money_ob">
dump_money_ob</a><pre class="autodocfuncdef">
void dump_money_ob(object ob)
</pre>
<dt class="autodocfuncname"><a name="filter_legal_money_array">
filter_legal_money_array</a><pre class="autodocfuncdef">
varargs object * filter_legal_money_array(mixed * m_array,
                                          string where)
</pre><dd><br />
This method is identical to filter_legal_tender, except that it takes
a money array rather than a money object<br />
<br /><dl>
<dd><b>Parameters:</b><br />
m_array - the money array to get the legal tender from<br />
where - the money area the tender is for<br />
<br />
<dd><b>Returns:</b>
<br />an two element array of objects ({ legal, illegal })<br /><br />
<dd><b>See also:</b>
<br /><a href="#parse_money">parse_money()</a>, <a href="#filter_legal_tender">filter_legal_tender()</a> and <a href="#filter_legal_money_to_array">filter_legal_money_to_array();
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="filter_legal_money_to_array">
filter_legal_money_to_array</a><pre class="autodocfuncdef">
varargs mixed * filter_legal_money_to_array(mixed * m_array,
                                            string where)
</pre><dd><br />
This method is identical to filter_legal_money_array, except that it
returns an array of two money arrays rather than an array of two
money objects<br />
<br /><dl>
<dd><b>Parameters:</b><br />
m_array - the money array to get the legal tender from<br />
where - the money area the tender is for<br />
<br />
<dd><b>Returns:</b>
<br />an two element array of money arrays ({ legal, illegal })<br /><br />
<dd><b>See also:</b>
<br /><a href="#parse_money">parse_money()</a>, <a href="#filter_legal_tender">filter_legal_tender()</a> and <a href="#filter_legal_money_array">filter_legal_money_array()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="filter_legal_tender">
filter_legal_tender</a><pre class="autodocfuncdef">
varargs object * filter_legal_tender(object money,
                                     string where)
</pre><dd><br />
This method figures out the legal and illegal tender money from
the specified money object in the specified money area.   This method
returns a two element array which consists of the legal and illegal
tender for the given money area.   ({ legal, illegal }).  WARNING:
This method destructs the money object passed to it.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
money - the money object to get the legal tender from<br />
where - the money area the tender is for<br />
<br />
<dd><b>Returns:</b>
<br />an two element array of objects ({ legal, illegal })<br /><br />
<dd><b>See also:</b>
<br /><a href="#parse_money">parse_money()</a>, <a href="#filter_legal_money_array">filter_legal_money_array()</a> and <a href="#filter_legal_money_to_array">filter_legal_money_to_array()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="get_money_ob">
get_money_ob</a><pre class="autodocfuncdef">
object get_money_ob()
</pre>
<dt class="autodocfuncname"><a name="insert_into_money_array">
insert_into_money_array</a><pre class="autodocfuncdef">
mixed * insert_into_money_array(mixed * marr,
                                string type,
                                int val)
</pre>
<dt class="autodocfuncname"><a name="make_money_array_payment">
make_money_array_payment</a><pre class="autodocfuncdef">
mixed * make_money_array_payment(string type,
                                 int value,
                                 mixed * mon_array,
                                 string where,
                                 int use_default)
</pre><dd><br />
This method makes a payment from a money array.  It returns the
depleted money array, the amount taken out and the change
needed.  If the type is not set, then the best fit for the value
is found from the array.
<p>
The return array is formated as:<br>
({ depleted_money_array, change, taken_from })<br>
The change is an integer value.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - the type of money to take out (ie: "Lancre Crown")<br />
value - the amount of the type to take out<br />
mon_array - the money array to use<br />
where - the money area<br />
use_default - allow the use of the default money type<br />
<br />
<dd><b>Returns:</b>
<br />the return array as formated above
<br /><br />
<dd><b>Example:</b>
<br/><pre>ret = make_money_array_payment("Lancre Crown", 2, mon_array, "Lancre", 0);</pre><br /></dl>

<dt class="autodocfuncname"><a name="make_new_amount">
make_new_amount</a><pre class="autodocfuncdef">
varargs object make_new_amount(int value,
                               string where)
</pre><dd><br />
This method creates a money object of a certain value in a certain
money area.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
value - the value to create the new money object with<br />
where - the area to create the new money object in<br />
<br />
<dd><b>Returns:</b>
<br />the new money object
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="make_payment">
make_payment</a><pre class="autodocfuncdef">
varargs mixed * make_payment(string type,
                             int value,
                             object ob,
                             string where)
</pre><dd><br />
This method makes a payment of a particular amount in a particular
money area.   Please note that player or living objects can double
as money objects in this circumstance.  The first element of the
payment array is the values which should be used to take off
the player, the second element is the change needed to be payed
back.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - the type of money to pay in (ie: "Lancre Crown")<br />
value - the number of the type to pay<br />
ob - the thing which is doing the payment (money object)<br />
where - the money area the payment will occur in<br />
<br />
<dd><b>Returns:</b>
<br />the payment array<br /><br />
<dd><b>See also:</b>
<br /><a href="#pay_amount_from">pay_amount_from()</a> and <a href="#calc_change">calc_change()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="merge_money_arrays">
merge_money_arrays</a><pre class="autodocfuncdef">
mixed * merge_money_arrays(mixed * m_array1,
                           mixed * m_array2)
</pre><dd><br />
This method merges two money arrays together and returns the
merged array<br />
<br /><dl>
<dd><b>Parameters:</b><br />
m_array1 - the first money array<br />
m_array2 - the second money_array<br />
<br />
<dd><b>Returns:</b>
<br />a money array of m_array1 and m_array2 joined
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="money_array_from_string">
money_array_from_string</a><pre class="autodocfuncdef">
mixed * money_array_from_string(string str,
                                string where)
</pre><dd><br />
This method attempts to find a money value from a string.  It will
attempt to do fuzzy matching of the type.  This means it will match on
partial matches, this could lead to somewhat weird behaviour...  So it
goes...  It will return a money array, rather than a value<br />
<br /><dl>
<dd><b>Parameters:</b><br />
str - the string to find the value of<br />
<br />
<dd><b>Returns:</b>
<br />a money array of the types matched<br /><br />
<dd><b>See also:</b>
<br /><a href="#money_value_string">money_value_string()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="money_string">
money_string</a><pre class="autodocfuncdef">
string money_string(mixed mon_array)
</pre><dd><br />
This method converts a money array into a string so it can be displayed.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
mon_array - the money array to convert into a string<br />
<br />
<dd><b>See also:</b>
<br /><a href="#money_value_string">money_value_string()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="money_value_string">
money_value_string</a><pre class="autodocfuncdef">
varargs string money_value_string(int val,
                                  string where)
</pre><dd><br />
This method returns a string which is based on the value of
the money in a certain money area.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
val - the value to get the string for<br />
where - the place to get the string for<br />
<br />
<dd><b>Returns:</b>
<br />a string of the money value in the certain money area<br /><br />
<dd><b>See also:</b>
<br /><a href="#create_money_array">create_money_array()</a>, <a href="#money_string">money_string()</a> and <a href="#value_from_string">value_from_string()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="parse_money">
parse_money</a><pre class="autodocfuncdef">
varargs mixed parse_money(string words,
                          object player,
                          string place)
</pre><dd><br />
This method determines all the money from the player object and moves
it into a container.  It then figures out the legal tender for
specified money area and tells the player if the given money is
legal tender for the current area.  It will automatically return the
illegal tender and send a message to the player about it.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
words - the string to match the money on<br />
player - the player who is attempting the transaction<br />
place - the money area the transaction is taking place<br />
<br />
<dd><b>Returns:</b>
<br />a money object consisting of the legal tender<br /><br />
<dd><b>See also:</b>
<br /><a href="#filter_legal_tender">filter_legal_tender()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="pay_amount_from">
pay_amount_from</a><pre class="autodocfuncdef">
varargs object pay_amount_from(int value,
                               object money,
                               string where)
</pre><dd><br />
This method makes a payment from a specified money object.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
value - the amount to pay<br />
money - the money object to pay from<br />
where - the money area the payment occurs in<br />
<br />
<dd><b>Returns:</b>
<br />the change object<br /><br />
<dd><b>See also:</b>
<br /><a href="#make_payment">make_payment()</a> and <a href="#calc_change">calc_change()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_adjectives_for">
query_adjectives_for</a><pre class="autodocfuncdef">
string * query_adjectives_for(string type)
</pre><dd><br />
This method returns all the current adjectives for the given type
of money.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - the type of money to get the aliases for<br />
<br />
<dd><b>Returns:</b>
<br />the adjectives for the money type<br /><br />
<dd><b>See also:</b>
<br /><a href="#set_adjectives_for">set_adjectives_for()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_aliases_for">
query_aliases_for</a><pre class="autodocfuncdef">
string * query_aliases_for(string type)
</pre><dd><br />
This method returns all the current aliases for the given type
of money.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - the type of money to get the aliases for<br />
<br />
<dd><b>Returns:</b>
<br />the aliases for the money type<br /><br />
<dd><b>See also:</b>
<br /><a href="#set_aliases_for">set_aliases_for()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_aliases_of">
query_aliases_of</a><pre class="autodocfuncdef">
string * query_aliases_of(string word)
</pre><dd><br />
This converts a currency type's alias (i.e. "royal" ) and returns
its 'real' names (i.e. "Ankh-Morpork royal"<br />
<br /><dl>
<dd><b>Parameters:</b><br />
word - the alias to find the real name of<br />
<br />
<dd><b>Returns:</b>
<br />an array of real names, or 0 if it's not a real alias
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_all_places">
query_all_places</a><pre class="autodocfuncdef">
string * query_all_places()
</pre><dd><br />
This method returns the current set of areas in which types can
be found.<br />
<br /><dl>
<dd><b>Returns:</b>
<br />the set of places
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_all_values">
query_all_values</a><pre class="autodocfuncdef">
mapping query_all_values()
</pre><dd><br />
This method returns the mapping containing all the values of the
currently valid money types.   The mapping has keys of the domain
of the money and has a value of an array.   The array contains
alternating name, value pairs.
<pre>
([ "default": ({ "brass", 1, "copper", 10, "silver", 100,
         "gold", 2000, "platinum", 6000 }) ])
</pre><br />
<br /><dl>
<dd><b>Returns:</b>
<br />the mapping of values<br /><br />
<dd><b>See also:</b>
<br /><a href="#query_values">query_values()</a> and <a href="#query_values_in">query_values_in()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_details">
query_details</a><pre class="autodocfuncdef">
mapping query_details()
</pre><dd><br />
This method returns all the details for the current set of
coins.   The details are information which is shown when the coin
is looked at.   Stuff about heads and tails and things.
<pre>
  ([
     "brass": ({ "heads", "tails", "a head", "a tail", "brass", 0, 0 }),
     "copper": ({ "heads", "tails", "a head", "a tail", "copper", 0, 0 }),
     "silver": ({ "heads", "tails", "a head", "a tail", "silver", 0, 0 }),
     "gold": ({ "heads", "tails", "a head", "a tail", "gold", 0, 0 }),
     "platinum": ({ "heads", "tails", "a head", "a tail", "platinum", 0, 0 }) ])
</pre>
The places correspond to:
<pre>
({ forward short, reverse short,
     forward long, reverse long, composition, plural, singular })
</pre><br />
<br /><dl>
<dd><b>Returns:</b>
<br />the details array
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_details_for">
query_details_for</a><pre class="autodocfuncdef">
mixed * query_details_for(string word)
</pre><dd><br />
This method returns the details for a specified type of money.
It will return an array of the form:
<pre>
({ "heads", "tails", "a head", "a tail", "brass", 0 })
</pre>
The places correspond to:
<pre>
({ forward short, reverse short,
     forward long, reverse long, composition, plural })
</pre><br />
<br /><dl>
<dd><b>Parameters:</b><br />
word - the money type to get the type for<br />
<br />
<dd><b>See also:</b>
<br /><a href="#add_details">add_details()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_main_plural_for">
query_main_plural_for</a><pre class="autodocfuncdef">
string query_main_plural_for(string type)
</pre><dd><br />
This method returns the main short plural description of the money type.
This returns the expanded plural version like 'Ankh-Morpork pennies'.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - the money type to get the short plural description for<br />
<br />
<dd><b>Returns:</b>
<br />the short plural description for the money object<br /><br />
<dd><b>See also:</b>
<br /><a href="#set_plural_for">set_plural_for()</a>, <a href="#query_plural_for">query_plural_for()</a> and <a href="#query_short_for">query_short_for()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_mapped_values_in">
query_mapped_values_in</a><pre class="autodocfuncdef">
mapping query_mapped_values_in(string where)
</pre><dd><br />
This method returns the values in the specified area.
It contains name, value pairs and is for the "default"
area.  It is returned as a mapping for easier sorting
& manipulation.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
where - the area in which to return the values for<br />
<br />
<dd><b>See also:</b>
<br /><a href="#query_all_values">query_all_values()</a>, <a href="#query_values">query_values()</a>, <a href="#add_type">add_type()</a> and <a href="#query_values_in">query_values_in()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_number_coins">
query_number_coins</a><pre class="autodocfuncdef">
int query_number_coins(mixed * money_array)
</pre><dd><br />
This method returns the number of coins in the object.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
money_array - The money array to count<br />
<br />
<dd><b>Returns:</b>
<br />the number of coins
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_origin_of">
query_origin_of</a><pre class="autodocfuncdef">
string query_origin_of(string type)
</pre><dd><br />
This takes a coin type and returns the place it is associated with.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - the coin type i.e. "Ankh-Morpork dollar"<br />
<br />
<dd><b>Returns:</b>
<br />the place i.e. "Ankh-Morpork"
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_person_payments">
query_person_payments</a><pre class="autodocfuncdef">
mixed * query_person_payments(int value,
                              string place,
                              object payer,
                              object payee)
</pre><dd><br />
This method makes a payment from one person to another.
This method figures out what money should be given to the player
and what should be taken from the other to make a payment of the
correct value in the correct place.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
value - the value to pay<br />
place - the place to make the payment in<br />
payer - the person the money is payed from<br />
payee - the person the money is payed to<br />
<br />
<dd><b>Returns:</b>
<br />two element array, or 0 if it cannot be done
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_plural_for">
query_plural_for</a><pre class="autodocfuncdef">
string query_plural_for(string type)
</pre><dd><br />
This method returns the short plural description of the money type.
This returns just the one word, like 'coins' or 'talons'.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - the money type to get the short plural description for<br />
<br />
<dd><b>Returns:</b>
<br />the short plural description for the money object<br /><br />
<dd><b>See also:</b>
<br /><a href="#set_plural_for">set_plural_for()</a> and <a href="#query_main_plural_for">query_main_plural_for()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_short_for">
query_short_for</a><pre class="autodocfuncdef">
string query_short_for(string type)
</pre><dd><br />
This method returns the short description of the money type.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - the money type to get the short description for<br />
<br />
<dd><b>Returns:</b>
<br />the short description for the money object<br /><br />
<dd><b>See also:</b>
<br /><a href="#query_main_plural_for">query_main_plural_for()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_singular_for">
query_singular_for</a><pre class="autodocfuncdef">
string query_singular_for(string type)
</pre><dd><br />
This method returns the short singular description of the money type.
This returns just the one word, like 'coins' or 'talons'.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - the money type to get the short singular description for<br />
<br />
<dd><b>Returns:</b>
<br />the short singular description for the money object<br /><br />
<dd><b>See also:</b>
<br /><a href="#set_singular_for">set_singular_for()</a> and <a href="#query_main_singular_for">query_main_singular_for()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_smallest_value_in">
query_smallest_value_in</a><pre class="autodocfuncdef">
int query_smallest_value_in(string where)
</pre><dd><br />
This returns the smallest value in the specified area.  Used to
make sure we are not charging too little or too much when doing
comparisons.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
where - the area to check
<br />
<br />
<dd><b>Returns:</b>
<br />the smallest value in the specified area<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_symbol_for">
query_symbol_for</a><pre class="autodocfuncdef">
string query_symbol_for(string word)
</pre><dd><br />
This method returns the symboliser for the specified money area.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
word - the area in which the money is occuring<br />
<br />
<dd><b>Returns:</b>
<br />the syboliser for the money area<br /><br />
<dd><b>See also:</b>
<br /><a href="#query_symbols">query_symbols()</a>, <a href="#add_symbol">add_symbol()</a> and <a href="#remove_symbol">remove_symbol()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_symbols">
query_symbols</a><pre class="autodocfuncdef">
mapping query_symbols()
</pre><dd><br />
This method returns all the symbols for the current money areas in the
handler.   The return value is mapping with the key being the
money area and the value being the symboliser for the money.
The symboliser is called with a value to get the money to
print itself out nicely.   This is used when the quantity of
actual coins is not known and only the value of them is
known.<br />
<br /><dl>
<dd><b>Returns:</b>
<br />all of the symbols<br /><br />
<dd><b>See also:</b>
<br /><a href="#query_symbol_for">query_symbol_for()</a>, <a href="#add_symbol">add_symbol()</a> and <a href="#remove_symbol">remove_symbol()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_total_value">
query_total_value</a><pre class="autodocfuncdef">
varargs int query_total_value(mixed * mon_array,
                              string where)
</pre><dd><br />
This method determines the total value of a specified money array.
A money array consists of pairs of values ({ type, number })<br />
<br /><dl>
<dd><b>Parameters:</b><br />
mon_array - the array to find the value of<br />
where - the money area to get the value in<br />
<br />
<dd><b>Returns:</b>
<br />the total value as an integer<br /><br />
<dd><b>See also:</b>
<br /><a href="#query_value">query_value()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_valid_types">
query_valid_types</a><pre class="autodocfuncdef">
string * query_valid_types()
</pre><dd><br />
This returns a list of valid coin types<br />
<br /><dl>
<dd><b>Returns:</b>
<br />an array of valid coin types
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_value">
query_value</a><pre class="autodocfuncdef">
varargs int query_value(string type,
                        string where)
</pre><dd><br />
This method returns the value of a specified type of money in a certain
money area.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - the type of money to get the value for<br />
where - the money area the money is in<br />
<br />
<dd><b>Returns:</b>
<br />the integer value of the money<br /><br />
<dd><b>See also:</b>
<br /><a href="#query_total_value">query_total_value()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_value_of">
query_value_of</a><pre class="autodocfuncdef">
int query_value_of(string type)
</pre><dd><br />
This returns the value of a currency type.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - currency type<br />
<br />
<dd><b>Returns:</b>
<br />an int of the currency type's value
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_values">
query_values</a><pre class="autodocfuncdef">
mixed * query_values()
</pre><dd><br />
This method returns the values in the default area.
This method returns the array as given in the value above.
It contains name, value pairs and is for the "default" area.<br />
<br /><dl>
<dd><b>Returns:</b>
<br />the array of values<br /><br />
<dd><b>See also:</b>
<br /><a href="#query_all_values">query_all_values()</a> and <a href="#query_values_in">query_values_in()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_values_in">
query_values_in</a><pre class="autodocfuncdef">
mixed * query_values_in(string where)
</pre><dd><br />
This method returns the values in the specified area.
It contains name, value pairs and is for the "default"
area.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
where - the area in which to return the values for<br />
<br />
<dd><b>Returns:</b>
<br />the array of values<br /><br />
<dd><b>See also:</b>
<br /><a href="#query_all_values">query_all_values()</a>, <a href="#query_values">query_values()</a>, <a href="#add_type">add_type()</a> and <a href="#query_mapped_values_in">query_mapped_values_in()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_weighted_values_in">
query_weighted_values_in</a><pre class="autodocfuncdef">
mixed * query_weighted_values_in(string where,
                                 int backwards)
</pre>
<dt class="autodocfuncname"><a name="remove_details">
remove_details</a><pre class="autodocfuncdef">
void remove_details(string word)
</pre><dd><br />
This method removes the specified detail.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
word - the type of money to remove the details for<br />
<br />
<dd><b>See also:</b>
<br /><a href="#add_detail">add_detail()</a> and <a href="#query_details_for">query_details_for()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="remove_symbol">
remove_symbol</a><pre class="autodocfuncdef">
void remove_symbol(string word)
</pre><dd><br />
This method removes the symboliser for the particular money area.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
word - the money area to remove the symbol for
<br />
<br />
<dd><b>See also:</b>
<br /><a href="#query_symbols">query_symbols()</a>, <a href="#query_symbol_for">query_symbol_for()</a> and <a href="#add_symbol">add_symbol()</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="remove_type">
remove_type</a><pre class="autodocfuncdef">
void remove_type(string where,
                 string type)
</pre><dd><br />
This method removes the type of money from the handler.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
where - the area to remove it from<br />
type - the type to remove<br />
<br />
<dd><b>See also:</b>
<br /><a href="#add_type">add_type()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="reset_cache">
reset_cache</a><pre class="autodocfuncdef">
void reset_cache()
</pre>
<dt class="autodocfuncname"><a name="save_me">
save_me</a><pre class="autodocfuncdef">
void save_me()
</pre><dd><br />
This method saves the current state of the money object.
<br />

<dt class="autodocfuncname"><a name="set_adjectives_for">
set_adjectives_for</a><pre class="autodocfuncdef">
void set_adjectives_for(string type,
                        string * words)
</pre><dd><br />
This method sets the adjectives for the specified money type.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - the type of money to set the adjectives for<br />
words - the adjectives for the money<br />
type - the type of money to set the adjectives for<br />
words - the adjectives for the money
<br />
<br />
<dd><b>See also:</b>
<br /><a href="#query_adjectives_for">query_adjectives_for()</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="set_aliases_for">
set_aliases_for</a><pre class="autodocfuncdef">
void set_aliases_for(string type,
                     string * words)
</pre><dd><br />
This method sets the aliases for the specified money type.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - the type of money to set the aliases for<br />
words - the aliases for the money<br />
type - the type of money to set the aliases for<br />
words - the aliases for the money
<br />
<br />
<dd><b>See also:</b>
<br /><a href="#query_aliases_for">query_aliases_for()</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="set_plural_for">
set_plural_for</a><pre class="autodocfuncdef">
void set_plural_for(string type,
                    string plural)
</pre><dd><br />
This method sets the plural for the specified money type.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - the money to set the plural for<br />
plural - the new plural for the money<br />
<br />
<dd><b>See also:</b>
<br /><a href="#query_plural_for">query_plural_for()</a> and <a href="#query_main_plural_for">query_main_plural_for()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="set_singular_for">
set_singular_for</a><pre class="autodocfuncdef">
void set_singular_for(string type,
                      string singular)
</pre><dd><br />
This method sets the singular for the specified money type.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
type - the money to set the plural for<br />
singular - the new singular for the money<br />
<br />
<dd><b>See also:</b>
<br /><a href="#query_short_for">query_short_for()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="smallest_in">
smallest_in</a><pre class="autodocfuncdef">
string smallest_in(string place)
</pre><dd><br />
This returns the smallest unit of currency in this place.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
place - The place to query.<br />
<br />
<dd><b>Returns:</b>
<br />A string of the smallest unit of currency<br /><br />
<dd><b>See also:</b>
<br /><a href="#smallest_value_in">smallest_value_in()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="smallest_value_in">
smallest_value_in</a><pre class="autodocfuncdef">
int smallest_value_in(string place)
</pre><dd><br />
This returns the smallest value of currency in this place.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
place - The place to query.<br />
<br />
<dd><b>Returns:</b>
<br />the value of the smallest unit of currency<br /><br />
<dd><b>See also:</b>
<br /><a href="#smallest_in">smallest_in()
</a><br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="sort_money_array">
sort_money_array</a><pre class="autodocfuncdef">
mixed * sort_money_array(mixed * marr)
</pre>
<dt class="autodocfuncname"><a name="sort_money_array_by">
sort_money_array_by</a><pre class="autodocfuncdef">
varargs mixed * sort_money_array_by(mixed * marr,
                                    function f,
                                    int backwards)
</pre>
<dt class="autodocfuncname"><a name="value_from_string">
value_from_string</a><pre class="autodocfuncdef">
int value_from_string(string str,
                      string where)
</pre><dd><br />
This method attempts to find a money value from a string.  It will
attempt to do fuzzy matching of the type.  This means it will match on
partial matches, this could lead to somewhat weird behaviour...  So it
goes...<br />
<br /><dl>
<dd><b>Parameters:</b><br />
str - the string to find the value of<br />
<br />
<dd><b>See also:</b>
<br /><a href="#money_value_string">money_value_string()</a><br /><br /><dd><b>Example:</b>
<br/><pre>// This will tell us the integer money value of the string.
write(MONEY_HAND->value_from_string("1 dollar and 12 pence",
                                    "Ankh-Morpork"));
</pre><br /></dl>

</dl>
[an error occurred while processing this directive]

