[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/shops/print_shop.c</h2>
A printing workshop so that players can create their own books runs.
<P>
This can be divided up into two rooms, an office (where you pay for
the printing to be done) and a collection room (where you do the collection).
To enable this behaviour the collection room needs to know about the
office.  The office stores all the information, so you call
set_office_room(room_path); on the collection room and
set_no_collection() on the office.
<p><b>See also:</b><br><a href="#set_office_room">set_office_room()</a> and <a href="#set_no_collection">set_no_collection();
</a><p>Written by Pinkfish<p>Started Thu Jan 29 17:55:47 CST 1998<h2>Inherits</h2>
This class inherits the following classes <a href="std.room.basic_room.c.shtml">/std/room/basic_room.c</a><h2>Includes</h2>
This class includes the following files <a href="include.money.h.shtml">/include/money.h</a>, <a href="include.book_handler.h.shtml">/include/book_handler.h</a>, /include/shops/bank.h and <a href="include.language.h.shtml">/include/language.h</a><h2>Method index</h2>
<dl><ul>
<li><a href="#add_auto_load_info">add_auto_load_info</a>(string, string)<br/>
This method saves the autoload information out to a file and returns
the number associated with the file.
<li><a href="#add_print_run">add_print_run</a>(string, object, int, string)<br/>
This adds an object into the current set to be collected.
<li><a href="#add_translation_cost">add_translation_cost</a>(string, int)<br/>
This method will add the cost to translate from one language to
another.
<li><a href="#check_for_magic_writing">check_for_magic_writing</a>(object)<br/>
Checks to see if the object has any magic writing on it.
<li><a href="#check_for_untranslatable_language">check_for_untranslatable_language</a>(object)<br/>
Checks to see if the book contains a language we cannot translate.
<li><a href="#copyright_holder">copyright_holder</a>(object)<br/>
This method returns the current copyright holder of the object.
<li><a href="#do_claim">do_claim</a>(object *)<br/>
This method sets up the copyright for the objects.
<li><a href="#do_collect">do_collect</a>()<br/>
This is when the player comes back to collect the book they have
printed.
<li><a href="#do_print">do_print</a>(object *, string)<br/>
This method will be called by the print add_command.
<li><a href="#do_print_copies">do_print_copies</a>(object *, int, string)<br/>
This method will be called when the player tries to print a certain
number of copies of a book.
<li><a href="#do_print_run">do_print_run</a>(object, int, int, string)<br/>
This method does the actual print run.
<li><a href="#find_book_or_paper">find_book_or_paper</a>(object *)<br/>
This method finds a single book or piece of paper to work on.
<li><a href="#is_copyright">is_copyright</a>(object)<br/>
This method checks to make sure that the player is the correct holder
of the copyright and that the book is still copyright.
<li><a href="#load_it">load_it</a>()<br/>
Loads the saved information off the disc.
<li><a href="#price_object">price_object</a>(object, int, string)<br/>
Figure out how much this object will cost to make.
<li><a href="#print_pricing">print_pricing</a>(object, string)<br/>
This method will print out the pricing schedule for the object.
<li><a href="#query_all_translantion_costs">query_all_translantion_costs</a>()<br/>
This method will return a mapping of all the translation costs.
<li><a href="#query_default_language">query_default_language</a>()<br/>
This method will return the current default language for the
print shop.
<li><a href="#query_discount_schedule">query_discount_schedule</a>()<br/>
This method returns the discount schedule.
<li><a href="#query_dynamic_auto_load_info">query_dynamic_auto_load_info</a>(int)<br/>
This method returns dynamic the autoload information associated with the
file.
<li><a href="#query_letter_cost">query_letter_cost</a>()<br/>
This queries the cost per letter.
<li><a href="#query_no_collection">query_no_collection</a>()<br/>
This returns the no collection flag used by the room.
<li><a href="#query_office_room">query_office_room</a>()<br/>
Returns the current office room associated with this room.
<li><a href="#query_open_func">query_open_func</a>()<br/>
This method returns the current function which is used to check for
the openness of the shop.
<li><a href="#query_print_run">query_print_run</a>(string)<br/>
This method returns the array of documents awaiting collection.
<li><a href="#query_print_shop_name">query_print_shop_name</a>()<br/>
This method will return the current name of the print shop.
<li><a href="#query_save_dir">query_save_dir</a>()<br/>
Returns the save file name
<li><a href="#query_static_auto_load_info">query_static_auto_load_info</a>(int)<br/>
This method returns static the autoload information associated with the
file.
<li><a href="#remove_print_run">remove_print_run</a>(string, mixed *)<br/>
This method will remove a players print run.
<li><a href="#remove_translation_cost">remove_translation_cost</a>(string)<br/>
This method will remove the translation cost for a specific language.
<li><a href="#save_it">save_it</a>()<br/>
Saves the information to the disc.
<li><a href="#set_default_language">set_default_language</a>(string)<br/>
This method sets the default language to use in the print shop.
<li><a href="#set_discount_schedule">set_discount_schedule</a>(mixed *)<br/>
Sets the discount schedule for this object.
<li><a href="#set_letter_cost">set_letter_cost</a>(int)<br/>
This queries the cost per letter.
<li><a href="#set_no_collection">set_no_collection</a>(int)<br/>
This sets the no collection flag.
<li><a href="#set_office_room">set_office_room</a>(string)<br/>
Sets the office room to which this collection room is associated.
<li><a href="#set_open_func">set_open_func</a>(function)<br/>
This method sets the function to evaluate to check to see if the shop
is open or not.
<li><a href="#set_print_shop_name">set_print_shop_name</a>(string)<br/>
This method sets the name of the print shop which will be used on
books when they are printed.
<li><a href="#set_save_dir">set_save_dir</a>(string)<br/>
Sets the save file name.
</ul><h2>Public Functions</h2>
These are functions that everyone can access.<p>
.<ul><a name="add_print_run">
add_print_run</a><pre>
void add_print_run(string name,
                   object ob,
                   int number,
                   string language)
</pre></br>
This adds an object into the current set to be collected.  This handles
figuring out the nice number to use for the static and dynamic save
numbers.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the name of the person adding the run
<br/>ob - the object being added
<br/>cost - the cost of the object
<br/>number - the number to be printer
<li><b>See also:</b>
<br/><a href="#do_collect">do_collect()</a> and <a href="#query_print_run">query_print_run()
</a></dl>

<ul><a name="add_translation_cost">
add_translation_cost</a><pre>
void add_translation_cost(string lang,
                          int cost)
</pre></br>
This method will add the cost to translate from one language to
another.  The default is translating to the common language and
this cost will be used in both directions.  ie: the cost of translating
from djelian to common is the same as translating from common to
djelian.  If translating between two languages that are not the
default language, say the default is common and we want to translate
from djelian to wombat, then the cost from djelian->common and then
common->wombat will be used.
<br/><ul>
<li><b>Parameters:</b>
<br/>lang - the language to set the translation cost of
<br/>cost - the cost is in percentage, 200 means twice the price
<li><b>See also:</b>
<br/><a href="#set_default_language">set_default_language()</a>, <a href="#remove_translation_cost">remove_translation_cost()</a> and <a href="#query_all_translation_costs">query_all_translation_costs()
</a></dl>

<ul><a name="check_for_magic_writing">
check_for_magic_writing</a><pre>
int check_for_magic_writing(object ob)
</pre></br>
Checks to see if the object has any magic writing on it.
<br/><ul>
<li><b>Returns:</b>
<br/>1 if there is magic writing, 0 if not.
<li><b>See also:</b>
<br/><a href="#find_book_or_paper">find_book_or_paper()</a> and <a href="obj.handlers.language.c.shtml#query_language_magic">/obj/handlers/language->query_language_magic()
</a></dl>

<ul><a name="check_for_untranslatable_language">
check_for_untranslatable_language</a><pre>
int check_for_untranslatable_language(object ob)
</pre></br>
Checks to see if the book contains a language we cannot translate.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the book to check for languages
<li><b>Returns:</b>
<br/>1 if there is a language we cannot deal with
<li><b>See also:</b>
<br/><a href="#check_magic_writing">check_magic_writing()</a>, <a href="#find_book_or_paper">find_book_or_paper()</a>, <a href="#set_default_language">set_default_language()</a> and <a href="#add_translation_cost">add_translation_cost()
</a></dl>

<ul><a name="do_print">
do_print</a><pre>
int do_print(object * obs,
             string language)
</pre></br>
This method will be called by the print add_command.  It will print out
the pricing schedule and how long the item will take to make.
<br/><ul>
<li><b>Parameters:</b>
<br/>obs - the objects which have been matched
<br/>language - the language to print the book in
<li><b>Returns:</b>
<br/>1 on success, 0 on failure
<li><b>See also:</b>
<br/><a href="#do_print_copies">do_print_copies()
</a></dl>

<ul><a name="do_print_copies">
do_print_copies</a><pre>
int do_print_copies(object * obs,
                    int number,
                    string language)
</pre></br>
This method will be called when the player tries to print a certain
number of copies of a book.
<br/><ul>
<li><b>Parameters:</b>
<br/>obs - the objects which have been matched
<br/>number - the number of prints to do
<br/>language - the language to print the book in
<li><b>Returns:</b>
<br/>1 on success, 0 on failure
<li><b>See also:</b>
<br/><a href="#do_print">do_print()
</a></dl>

<ul><a name="do_print_run">
do_print_run</a><pre>
void do_print_run(object ob,
                  int number,
                  int cost,
                  string language)
</pre></br>
This method does the actual print run.  It creates all the objects
and makes the player pay for them all.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the object to print
<br/>number - the number to print
<br/>cost - the cost of the object
<br/>the - language to translate things to
<li><b>See also:</b>
<br/><a href="#do_print_copies">do_print_copies()
</a></dl>

<ul><a name="find_book_or_paper">
find_book_or_paper</a><pre>
object find_book_or_paper(object * obs)
</pre></br>
This method finds a single book or piece of paper to work on.  It will
return 0 if multiple objects are found, or none are found.  It will
set the error message appropriately.
<br/><ul>
<li><b>Parameters:</b>
<br/>obs - the objects to check for a book or paper
<li><b>Returns:</b>
<br/>the book or paper found
<li><b>See also:</b>
<br/><a href="#check_magic_writing">check_magic_writing()
</a></dl>

<ul><a name="load_it">
load_it</a><pre>
void load_it()
</pre></br>
Loads the saved information off the disc.
<br/><ul>
<li><b>See also:</b>
<br/><a href="#set_save_dir">set_save_dir()</a> and <a href="#save_it">save_it()
</a></dl>

<ul><a name="price_object">
price_object</a><pre>
int price_object(object ob,
                 int num,
                 string to_language)
</pre></br>
Figure out how much this object will cost to make.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the object to price
<br/>num - the number of them to print
<li><b>Returns:</b>
<br/>the cost of the item

</dl>

<ul><a name="print_pricing">
print_pricing</a><pre>
void print_pricing(object ob,
                   string language)
</pre></br>
This method will print out the pricing schedule for the object.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the object to get a pricing schedule of.

</dl>

<ul><a name="query_all_translantion_costs">
query_all_translantion_costs</a><pre>
mapping query_all_translantion_costs()
</pre></br>
This method will return a mapping of all the translation costs.
The keys are the languages and the values are the costs in terms
of percentages.
<br/><ul>
<li><b>Returns:</b>
<br/>the current translation cost mapping
<li><b>See also:</b>
<br/><a href="#add_translation_cost">add_translation_cost()</a> and <a href="#remove_translation_cost">remove_translation_cost()
</a></dl>

<ul><a name="query_default_language">
query_default_language</a><pre>
string query_default_language()
</pre></br>
This method will return the current default language for the
print shop.
<br/><ul>
<li><b>Returns:</b>
<br/>the current default language
<li><b>See also:</b>
<br/><a href="#set_default_language">set_default_language()</a>, <a href="#add_translation_cost">add_translation_cost()</a> and <a href="#check_for_untranslatable_language">check_for_untranslatable_language()
</a></dl>

<ul><a name="query_discount_schedule">
query_discount_schedule</a><pre>
mixed * query_discount_schedule()
</pre></br>
This method returns the discount schedule.  There is a default discount
schedule setup for printing shops.  The discount schedule tells how much
of a discount you get for certain numbers of a run.  It returns
an array of the form:
<pre>
({ ({ numn1, dis1 }), ({ num2, dis2}), ... })
</pre>
Where each number is the discount amount for printing less than that
number of items.  The array must be sorted from the lowest number to
the highest number.
<br/><ul>
<li><b>Returns:</b>
<br/>the discount schedule
<li><b>See also:</b>
<br/><a href="#set_discount_schedule">set_discount_schedule()
</a></dl>

<ul><a name="query_dynamic_auto_load_info">
query_dynamic_auto_load_info</a><pre>
mapping query_dynamic_auto_load_info(int num)
</pre></br>
This method returns dynamic the autoload information associated with the
file.
<br/><ul>
<li><b>Parameters:</b>
<br/>num - the number associated with the information
<li><b>Returns:</b>
<br/>the dynamic auto load string, 0 if none

</dl>

<ul><a name="query_letter_cost">
query_letter_cost</a><pre>
int query_letter_cost()
</pre></br>
This queries the cost per letter.
<br/><ul>
<li><b>Returns:</b>
<br/>the cost per letter
<li><b>See also:</b>
<br/><a href="#set_letter_cost">set_letter_cost()</a> and <a href="#print_cost">print_cost()
</a></dl>

<ul><a name="query_no_collection">
query_no_collection</a><pre>
int query_no_collection()
</pre></br>
This returns the no collection flag used by the room.
<br/><ul>
<li><b>Returns:</b>
<br/>the no collection flag
<li><b>See also:</b>
<br/><a href="#set_no_collection">set_no_collection()</a> and <a href="#query_office_room">query_office_room()
</a></dl>

<ul><a name="query_office_room">
query_office_room</a><pre>
string query_office_room()
</pre></br>
Returns the current office room associated with this room.
<br/><ul>
<li><b>Returns:</b>
<br/>the current office room
<li><b>See also:</b>
<br/><a href="#set_office_room">set_office_room()</a> and <a href="#query_no_collection">query_no_collection()
</a></dl>

<ul><a name="query_open_func">
query_open_func</a><pre>
function query_open_func()
</pre></br>
This method returns the current function which is used to check for
the openness of the shop.
<br/><ul>
<li><b>Returns:</b>
<br/>the current open function

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

<ul><a name="query_print_run">
query_print_run</a><pre>
mixed * query_print_run(string name)
</pre></br>
This method returns the array of documents awaiting collection.  If there
are not documents this returns 0.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the player to query
<li><b>Returns:</b>
<br/>an array containing the player information, or 0 if none
<li><b>See also:</b>
<br/><a href="#add_print_run">add_print_run()</a> and /include/print_shop.h
</dl>

<ul><a name="query_print_shop_name">
query_print_shop_name</a><pre>
string query_print_shop_name()
</pre></br>
This method will return the current name of the print shop.
<br/><ul>
<li><b>Returns:</b>
<br/>the name of the print shop

</dl>

<ul><a name="query_save_dir">
query_save_dir</a><pre>
string query_save_dir()
</pre></br>
Returns the save file name
<br/><ul>
<li><b>Returns:</b>
<br/>save file name
<li><b>See also:</b>
<br/><a href="#set_save_dir">set_save_dir()</a>, <a href="#load_it">load_it()</a> and <a href="#save_it">save_it()
</a></dl>

<ul><a name="query_static_auto_load_info">
query_static_auto_load_info</a><pre>
string query_static_auto_load_info(int num)
</pre></br>
This method returns static the autoload information associated with the
file.
<br/><ul>
<li><b>Parameters:</b>
<br/>num - the number associated with the information
<li><b>Returns:</b>
<br/>the static auto load string, 0 if none

</dl>

<ul><a name="remove_print_run">
remove_print_run</a><pre>
void remove_print_run(string name,
                      mixed * info)
</pre></br>
This method will remove a players print run.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the player whose print run is to be removed.
<li><b>See also:</b>
<br/><a href="#query_print_run">query_print_run()</a> and <a href="#add_print_run">add_print_run()
</a></dl>

<ul><a name="remove_translation_cost">
remove_translation_cost</a><pre>
void remove_translation_cost(string lang)
</pre></br>
This method will remove the translation cost for a specific language.
<br/><ul>
<li><b>Parameters:</b>
<br/>lang - the language to remove the translation cost of
<li><b>See also:</b>
<br/><a href="#set_default_language">set_default_language()</a>, <a href="#add_translation_cost">add_translation_cost()</a> and <a href="#query_all_translation_costs">query_all_translation_costs()
</a></dl>

<ul><a name="save_it">
save_it</a><pre>
void save_it()
</pre></br>
Saves the information to the disc.
<br/><ul>
<li><b>See also:</b>
<br/><a href="#set_save_dir">set_save_dir()</a> and <a href="#load_it">load_it()
</a></dl>

<ul><a name="set_default_language">
set_default_language</a><pre>
void set_default_language(string lang)
</pre></br>
This method sets the default language to use in the print shop.
Anything written in this language will cost nothing extra to
duplicate.
<br/><ul>
<li><b>Parameters:</b>
<br/>lang - the new default language
<li><b>See also:</b>
<br/><a href="#query_default_language">query_default_language()</a>, <a href="#add_translation_cost">add_translation_cost()</a> and <a href="#check_for_untranslatable_language">check_for_untranslatable_language()
</a></dl>

<ul><a name="set_discount_schedule">
set_discount_schedule</a><pre>
void set_discount_schedule(mixed * value)
</pre></br>
Sets the discount schedule for this object.  See the query_discount_schedule
help for the format of the array.
<br/><ul>
<li><b>Parameters:</b>
<br/>value - the new discount schedule.
<li><b>See also:</b>
<br/><a href="#query_discount_schedule">query_discount_schedule()
</a></dl>

<ul><a name="set_letter_cost">
set_letter_cost</a><pre>
void set_letter_cost(int value)
</pre></br>
This queries the cost per letter.
<br/><ul>
<li><b>Parameters:</b>
<br/>value - the new cost per letter
<li><b>See also:</b>
<br/><a href="#query_letter_cost">query_letter_cost()</a> and <a href="#print_cost">print_cost()
</a></dl>

<ul><a name="set_no_collection">
set_no_collection</a><pre>
void set_no_collection(int collect)
</pre></br>
This sets the no collection flag.  It makes it so this room cannot be
used for collections.  If this is set then there should be an associated
collection room used to pick up the books from.  This room should
use the set_office_room() function to set the office room to use
for the collections.
<br/><ul>
<li><b>Parameters:</b>
<br/>collect - the new value of no_collections flag
<li><b>See also:</b>
<br/><a href="#query_no_collection">query_no_collection()</a> and <a href="#set_office_room">set_office_room()
</a></dl>

<ul><a name="set_office_room">
set_office_room</a><pre>
void set_office_room(string room)
</pre></br>
Sets the office room to which this collection room is associated.  If
this is set on a room, you cannot setup print jobs in the room and this
room specified here is queried for the information about the jobs to
collect.
<br/><ul>
<li><b>Parameters:</b>
<br/>room - the new office room
<li><b>See also:</b>
<br/><a href="#query_office_room">query_office_room()</a> and <a href="#set_no_collection">set_no_collection()
</a></dl>

<ul><a name="set_open_func">
set_open_func</a><pre>
void set_open_func(function func)
</pre></br>
This method sets the function to evaluate to check to see if the shop
is open or not.  This should set any error messages which are needed.
The objects are passed in as an argument in the do_print functions
and nothing is passed in for the collection check.
<br/><ul>
<li><b>Parameters:</b>
<br/>func - the open function
<li><b>See also:</b>
<br/><a href="#query_open_func">query_open_func()</a>, <a href="#do_print">do_print()</a>, <a href="#do_print_copies">do_print_copies()</a> and <a href="#do_collect">do_collect()
</a></dl>

<ul><a name="set_print_shop_name">
set_print_shop_name</a><pre>
void set_print_shop_name(string name)
</pre></br>
This method sets the name of the print shop which will be used on
books when they are printed.  This is only needed in the collection
room, this is the name that is placed on the fly leaf.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the name of the print shop

</dl>

<ul><a name="set_save_dir">
set_save_dir</a><pre>
void set_save_dir(string name)
</pre></br>
Sets the save file name.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the name of the save file
<li><b>See also:</b>
<br/><a href="#query_save_dir">query_save_dir()</a>, <a href="#load_it">load_it()</a> and <a href="#save_it">save_it()
</a></dl>


<h2>Protected Functions</h2>
These are functions that only objects inheriting the class can access.<p>
<ul><a name="add_auto_load_info">
add_auto_load_info</a><pre>
int add_auto_load_info(string static,
                       string dynamic)
</pre></br>
This method saves the autoload information out to a file and returns
the number associated with the file.
<br/><ul>
<li><b>Parameters:</b>
<br/>static_arg - the static auto load information
<br/>dynamic_arg - the dynamic auto load information
<li><b>Returns:</b>
<br/>the number associated with the save files

</dl>

<ul><a name="copyright_holder">
copyright_holder</a><pre>
string copyright_holder(object book)
</pre></br>
This method returns the current copyright holder of the object.
<br/><ul>
<li><b>Parameters:</b>
<br/>book - the book to get the copyright of
<li><b>Returns:</b>
<br/>the name of the copyright holder, 0 if none

</dl>

<ul><a name="do_claim">
do_claim</a><pre>
int do_claim(object * obs)
</pre></br>
This method sets up the copyright for the objects.  This will check for
existing copyright status and then check with the book handler to see
if it still fits the criteria.  If it does not then it will add itself
as a new book.
<br/><ul>
<li><b>Parameters:</b>
<br/>obs - the objects to claim copyright on

</dl>

<ul><a name="do_collect">
do_collect</a><pre>
int do_collect()
</pre></br>
This is when the player comes back to collect the book they have
printed.
<br/><ul>
<li><b>Returns:</b>
<br/>1 on success, 0 on failure

</dl>

<ul><a name="is_copyright">
is_copyright</a><pre>
int is_copyright(object book)
</pre></br>
This method checks to make sure that the player is the correct holder
of the copyright and that the book is still copyright.
<br/><ul>
<li><b>Parameters:</b>
<br/>book - the book to check
<li><b>Returns:</b>
<br/>1 if it is copyright

</dl>


[an error occurred while processing this directive]

