[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 /std/delivery.c</h2>
Inheritable Delivery System
<p>
This object provides a way of storing and sending objects to 
players while they are not online.  It is roughly based on
the concepts found in Post Offices that support parcel
depositing, and also Bernita's Flower Shop. (Which delivers
flowers to people when they log on.)
<p>
This object is easy to use, and can be combined with most
other objects on the Disc. (ie, /obj/monster and /std/room).
See delivery_room.c for a pre-made room which handles the 
delivery of objects.
<p>
Note that this system uses static login calls.  These 
must be configured first and turned on manually in order for
the delivery system to work.
<p>
In order to use this inheritable the following things must be
done:
<ul>
<li>The object that uses it created, and this object inherited.
<li>The save file set using set_save_file().
<li>Any extra settings such as delivery message and delay configured.
<li>setup_delivery() called on the object to finalize setup.
</ul><p>Written by Taffyd
<h2>Inherits</h2>
This class inherits the following classes <a href="global.auto_load.c.shtml">/global/auto_load.c</a><h2>Includes</h2>
This class includes the following files <a href="include.move_failures.h.shtml">/include/move_failures.h</a>, <a href="include.player_handler.h.shtml">/include/player_handler.h</a>, <a href="include.login.h.shtml">/include/login.h</a> and <a href="include.login_handler.h.shtml">/include/login_handler.h</a><h2>Class Index</h2>
<ul><li><a href="#class_delivery_item">delivery_item</a>
</ul><h2>Method index</h2>
<dl><ul>
<li><a href="#add_delivery">add_delivery</a>(mixed, mixed, object, int)<br/>
This method adds a new item to the delivery mapping for the specified 
recipient.
<li><a href="#check_delivery">check_delivery</a>(mixed, string)<br/>
This method is called by the login handler every time someone logs 
on to the Disc.
<li><a href="#clean_delivery_mapping">clean_delivery_mapping</a>()<li><a href="#clear_delivery">clear_delivery</a>()<br/>
This method is used to remove all deliveries currently stored within the 
delivery system.
<li><a href="#deliver_item">deliver_item</a>(string, object, string)<br/>
This method is called when an item is being delivered to a player.
<li><a href="#load_file">load_file</a>()<br/>
This method loads retrieves data from the save file, and handles the 
autoloading of the items.
<li><a href="#query_burdened_mess">query_burdened_mess</a>()<br/>
This returns the current delivery message that is displayed to the 
recipient of a delivery, if it is too heavy go to in their inventory.
<li><a href="#query_delivery">query_delivery</a>(string)<br/>
This method returns the delivery details for a particular person, or
the entire delivery mapping of one doesn't exist.
<li><a href="#query_delivery_delay">query_delivery_delay</a>()<br/>
This method returns how long after the login an item is delivered
to the recipient.
<li><a href="#query_delivery_mess">query_delivery_mess</a>()<br/>
This returns the current delivery message that is displayed to the 
recipient of a delivery.
<li><a href="#query_save_file">query_save_file</a>()<br/>
This method is used to query the save file in which the delivery data
is stored.
<li><a href="#save_file">save_file</a>()<br/>
This method saves all of the delivery data into the save file, handling 
saving of the auto loading as well.
<li><a href="#set_burdened_mess">set_burdened_mess</a>(string)<br/>
This method sets the message that is displayed when an item is too 
heavy to be placed in the victim's inventory.
<li><a href="#set_delivery">set_delivery</a>(mapping)<br/>
This is used to set all of the delivery mapping manually.
<li><a href="#set_delivery_delay">set_delivery_delay</a>(int)<br/>
This method is used to specify how many seconds to wait after login 
until the item is delivered.
<li><a href="#set_delivery_mess">set_delivery_mess</a>(string)<br/>
This method sets the delivery message that is displayed to the player 
when they log on.
<li><a href="#set_save_file">set_save_file</a>(string)<br/>
This method sets the save file to a file name so that auto loading and 
delivery details can be successfully saved.
<li><a href="#setup_delivery">setup_delivery</a>()<br/>
This method adds the object into the login handler's static login calls 
list.
<li><a href="#valid_delivery">valid_delivery</a>(class delivery_item, string)<br/>
This method is called by the check_delivery() function when it validates 
someone's deliveries.
</ul><h2>Public Functions</h2>
These are functions that everyone can access.<p>
.<ul><a name="add_delivery">
add_delivery</a><pre>
void add_delivery(mixed who,
                  mixed sender,
                  object item,
                  int delay)
</pre></br>
This method adds a new item to the delivery mapping for the specified 
recipient.  This should always be used instead of set_delivery(), as it
makes sure that all the data structures have been configured correctly.

<br/><ul>
<li><b>Parameters:</b>
<br/>who - the person to receive the item. 
<br/>sender - the person sending the file. 
<br/>item - the item to be sent
<br/>delay - how many seconds to wait before delivering item on the next
login.

<li><b>See also:</b>
<br/><a href="#check_delivery">check_delivery()
</a><li><b>Example:</b>
<br/><pre>     add_delivery(this_player(), "taffyd", frog, 360);</pre></dl>

<ul><a name="check_delivery">
check_delivery</a><pre>
void check_delivery(mixed person,
                    string type)
</pre></br>
This method is called by the login handler every time someone logs 
on to the Disc.  It handles the delivery of items and all sorts of 
nifty things.
<p>
<br/><ul>
<li><b>Parameters:</b>
<br/>person - the name of the person logging on
<br/>type - the type of login event


</dl>

<ul><a name="clean_delivery_mapping">
clean_delivery_mapping</a><pre>
void clean_delivery_mapping()
</pre>
<ul><a name="clear_delivery">
clear_delivery</a><pre>
void clear_delivery()
</pre></br>
This method is used to remove all deliveries currently stored within the 
delivery system.
<p>
Be very careful when using this function! It will save the cleared
delivery mapping after it has been called. 


<ul><a name="load_file">
load_file</a><pre>
void load_file()
</pre></br>
This method loads retrieves data from the save file, and handles the 
autoloading of the items.


<ul><a name="query_burdened_mess">
query_burdened_mess</a><pre>
string query_burdened_mess()
</pre></br>
This returns the current delivery message that is displayed to the 
recipient of a delivery, if it is too heavy go to in their inventory.
<p>
<br/><ul>
<li><b>Returns:</b>
<br/>the delivery message

<li><b>See also:</b>
<br/><a href="#set_burdened_mess">set_burdened_mess()</a> and <a href="#query_delivery_mess">query_delivery_mess()</a></dl>

<ul><a name="query_delivery">
query_delivery</a><pre>
varargs mixed query_delivery(string person)
</pre></br>
This method returns the delivery details for a particular person, or
the entire delivery mapping of one doesn't exist.
<p>
<br/><ul>
<li><b>Parameters:</b>
<br/>person - the person's delivery details to query. 

</dl>

<ul><a name="query_delivery_delay">
query_delivery_delay</a><pre>
int query_delivery_delay()
</pre></br>
This method returns how long after the login an item is delivered
to the recipient.
<br/><ul>
<li><b>Returns:</b>
<br/>the number of seconds unt    


</dl>

<ul><a name="query_delivery_mess">
query_delivery_mess</a><pre>
string query_delivery_mess()
</pre></br>
This returns the current delivery message that is displayed to the 
recipient of a delivery.

<br/><ul>
<li><b>Returns:</b>
<br/>the delivery message

<li><b>See also:</b>
<br/><a href="#set_delivery_mess">set_delivery_mess()</a></dl>

<ul><a name="query_save_file">
query_save_file</a><pre>
string query_save_file()
</pre></br>
This method is used to query the save file in which the delivery data
is stored.

<br/><ul>
<li><b>Returns:</b>
<br/> the path of the save file used to store delivery details.

</dl>

<ul><a name="save_file">
save_file</a><pre>
void save_file()
</pre></br>
This method saves all of the delivery data into the save file, handling 
saving of the auto loading as well.


<ul><a name="setup_delivery">
setup_delivery</a><pre>
void setup_delivery()
</pre></br>
This method adds the object into the login handler's static login calls 
list.  It only ever needs to be called _once_, and doesn't need to be 
called every time the object loads. 
<p>
Once this is done, the object will automatically be loaded whenever 
someone logs on.
<p> 
This must be called in order for the delivery system to work at all.



<h2>Protected Functions</h2>
These are functions that only objects inheriting the class can access.<p>
<ul><a name="deliver_item">
deliver_item</a><pre>
void deliver_item(string who,
                  object ob,
                  string sent_by)
</pre></br>
This method is called when an item is being delivered to a player.  The 
delivery message or the burdened mess is used depending on how the item
is delivered, and then it is removed from the delivery mapping.
<p>
Note that this routine uses add_message() to display movement messages
to the player, instead of tell_object() or a traditional move message. This
is so that the messages can be 'clumped' together properly, otherwise 
it just doesn't work.
<p>
<br/><ul>
<li><b>Parameters:</b>
<br/>who - the person to deliver to
<br/>ob - the object to deliver
<br/>sent_by - the person that send the parcel
<br/>position - its location in the recepient's delivery mapping.

</dl>

<ul><a name="set_burdened_mess">
set_burdened_mess</a><pre>
void set_burdened_mess(string s)
</pre></br>
This method sets the message that is displayed when an item is too 
heavy to be placed in the victim's inventory. This uses the same format
as the normal delivery message.
<p>
<br/><ul>
<li><b>Parameters:</b>
<br/>s - message to display
<li><b>See also:</b>
<br/><a href="#set_delivery_mess">set_delivery_mess()</a> and <a href="#query_burdened_mess">query_burdened_mess()
</a></dl>

<ul><a name="set_delivery">
set_delivery</a><pre>
void set_delivery(mapping x)
</pre></br>
This is used to set all of the delivery mapping manually.  You should 
not use this method.  

<br/><ul>
<li><b>Parameters:</b>
<br/>x - the new delivery mapping.
<li><b>See also:</b>
<br/><a href="#add_delivery">add_delivery()
</a></dl>

<ul><a name="set_delivery_delay">
set_delivery_delay</a><pre>
void set_delivery_delay(int new_time)
</pre></br>
This method is used to specify how many seconds to wait after login 
until the item is delivered.  Note that if this is too long, then the
receipient may log out before you can give them the item.  If the 
receipient logs out, then the item will be destroyed.
<p>
This is set to 5 by default.
<p>
<br/><ul>
<li><b>Parameters:</b>
<br/>new_time - the time in seconds after log in to deliver the message.

</dl>

<ul><a name="set_delivery_mess">
set_delivery_mess</a><pre>
void set_delivery_mess(string s)
</pre></br>
This method sets the delivery message that is displayed to the player 
when they log on. $S is substituted in the string with the name of 
the player who sent the message, $N is replaced with the a_short()
of the item being sent. 
<br/><ul>
<li><b>Parameters:</b>
<br/>s - the new delivery string
<li><b>See also:</b>
<br/><a href="#query_delivery_mess">query_delivery_mess()</a> and <a href="std.basic.desc.c.shtml#a_short">/std/basic/desc->a_short()</a><li><b>Example:</b>
<br/><pre>    set_delivery_mess("A small frog hops up to you, and thrusts $N "
        "into your arms.  He holds up a large sign that reads: \""
        "From $S\", and then runs away.\n");

// Recipient sees:
A small frog hops up to you, and thrusts a large blue box into your
arms.  He holds up a large sign that reads: \"From Taffyd!\", and then
runs away.
</pre></dl>

<ul><a name="set_save_file">
set_save_file</a><pre>
void set_save_file(string str)
</pre></br>
This method sets the save file to a file name so that auto loading and 
delivery details can be successfully saved.
<br/><ul>
<li><b>Parameters:</b>
<br/>str - the new path.

</dl>

<ul><a name="valid_delivery">
valid_delivery</a><pre>
int valid_delivery(class delivery_item delivery,
                   string person)
</pre></br>
This method is called by the check_delivery() function when it validates 
someone's deliveries.  It is used to determine whether or not it's time
for a delivery to be delivered, and whether or not to remove it.
<p>
<br/><ul>
<li><b>Parameters:</b>
<br/>delivery - the delivery item to be tested
<br/>person - the person to deliver the item to.
<p>
<li><b>Returns:</b>
<br/>1 if the delivery is not ready, 0 if it is. (yes, this is kind
of backwards.)

</dl>


<h2>Classes</h2>
These are nice data types for dealing with...  Data!<p>
<ul>
<li><a name="class_delivery_item">
delivery_item</a><pre>
class delivery_item {
                      object delivery_ob;
                      string sent_by;
                      int submit_time;
                      int delay_time;
}

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

