[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/inherit/pub.c</h2>
This is the inheritable bit of the pub.  The actual file you should
inherit is /std/shops/pub_shop.c
<p>
Based on the original "pub.c" code, this version allows you to buy an
actual drink (inna glass) instead of just forcefeeding you with whatever
you purchase.  You can also create food and serve it on plates, in boxes,
or whatever.
<p>
The items on sale are either cloned from the armoury, cloned from a file
or cloned in the "create_item()" code in the pub code itself.  Containers
for these items are done in the same way, using the "create_container()"
function.  This is the same as the "create_object()" system in
"item_shop.c".  You can also buy items for other people (or groups of
other people) in the pub.
<p>
There are several standard glasses and plates available for drinks and
food in the "pub_shop.h" header file, if you don't want to create the
glasses and plates yourself.  These plates use the "/obj/misc/plate.c"
inheritable file.
<p>
A "counter" will automatically be placed in the pub.  If any item cannot
be moved into the person who ordered it (i.e they are carrying too much )
it will be placed on the counter.  Empty glasses and so on will be
cleared from the counter after 3 seconds.  To ensure that this happens,
make sure that the container object you use has the property "pub item"
added to it.  Items will only be cleared if they are empty.<p><b>See also:</b><br><a href="std.shops.pub_shop.c.shtml">/std/shops/pub_shop.c</a>, <a href="include.shops.pub_shop.h.shtml">/include/shops/pub_shop.h</a> and /include/volumes.h
<p>Written by Lemming<p>Started 23/10/1999<h2>Inherits</h2>
This class inherits the following classes <a href="std.shops.inherit.shop_event.c.shtml">/std/shops/inherit/shop_event.c</a> and <a href="std.shops.inherit.open_shop.c.shtml">/std/shops/inherit/open_shop.c</a><h2>Includes</h2>
This class includes the following files <a href="include.map.h.shtml">/include/map.h</a>, <a href="include.move_failures.h.shtml">/include/move_failures.h</a>, /include/shops/bank.h, <a href="include.money.h.shtml">/include/money.h</a>, <a href="include.shops.pub_shop.h.shtml">/include/shops/pub_shop.h</a> and <a href="include.armoury.h.shtml">/include/armoury.h</a><h2>Method index</h2>
<dl><ul>
<li><a href="#add_menu_alias">add_menu_alias</a>(mixed, string)<br/>
This method allows you to add an alias to an item sold in the pub.
<li><a href="#add_menu_aliases">add_menu_aliases</a>(string *, string)<br/>
This method allows you to add multiple aliases at once.
<li><a href="#add_menu_item">add_menu_item</a>(string, int, int, string, string, int, int)<br/>
This is the method used to add items to the menu.
<li><a href="#make_counter">make_counter</a>()<br/>
This function creates the counter for the pub.
<li><a href="#query_counter">query_counter</a>()<br/>
This method returns the object currently being used as a counter in the
pub.
<li><a href="#query_discount">query_discount</a>(object)<br/>
This function can be masked and used to determine a discount that is
applied to all items sold, so for instance you could check the guild of
'ob' and give a discount to Witches, or something.
<li><a href="#query_display_header">query_display_header</a>()<br/>
This method returns a flag stating whether display of the menu header
is on or off.
<li><a href="#query_display_subheadings">query_display_subheadings</a>()<br/>
This method returns a flag stating whether display of the menu subheadings
is on or off.
<li><a href="#query_language">query_language</a>()<br/>
This method returns the language used in the shop.
<li><a href="#query_menu">query_menu</a>()<br/>
This method returns the object currently being used as a menu in the
pub.
<li><a href="#query_menu_aliases">query_menu_aliases</a>()<br/>
This method returns a list of all the aliases currently available in
the pub.
<li><a href="#query_menu_header">query_menu_header</a>()<br/>
This method returns the current menu header text.
<li><a href="#query_menu_items">query_menu_items</a>()<br/>
This method returns a list of all the items currently available in
the pub.
<li><a href="#query_menu_subheadings">query_menu_subheadings</a>()<br/>
This method returns the current menu subheading text.
<li><a href="#query_no_standard_alias">query_no_standard_alias</a>()<br/>
This method returns a flag stating whether standard aliases will be added
or not.
<li><a href="#query_pub">query_pub</a>()<br/>
This method checks to see if this is a pub.
<li><a href="#read">read</a>()<br/>
This method produces the menu from the item information, with the menu
header at the top, all items available grouped by type and sorted by
cost.
<li><a href="#remove_menu_alias">remove_menu_alias</a>(string)<br/>
This method allows you to remove an alias from those currently available
in the pub.
<li><a href="#remove_menu_item">remove_menu_item</a>(string)<br/>
This method allows you to remove an item from those currently available
in the pub.
<li><a href="#set_display_header">set_display_header</a>(int)<br/>
This method allows you to switch the menu header (defaults to "The menu
reads:") that appears at the top of the menu on and off.
<li><a href="#set_display_subheadings">set_display_subheadings</a>(int)<br/>
This method allows you to switch the subheadings ("Alcoholic Beverages",
"Meals", etc) that appear above different types of items on and off.
<li><a href="#set_language">set_language</a>(string)<br/>
This method sets the language to use in the shop.
<li><a href="#set_menu_header">set_menu_header</a>(string)<br/>
This method sets the header that appears at the top of the menu.
<li><a href="#set_menu_subheadings">set_menu_subheadings</a>(int, string)<br/>
This method sets the subheadings that appear at the top of the menu.
<li><a href="#set_no_standard_alias">set_no_standard_alias</a>(int)<br/>
This method allows you to turn on or off the addition of standard aliases
when new menu items are added.
</ul><h2>Public Functions</h2>
These are functions that everyone can access.<p>
.<ul><a name="add_menu_alias">
add_menu_alias</a><pre>
void add_menu_alias(mixed alias,
                    string actual)
</pre></br>
This method allows you to add an alias to an item sold in the pub.  Many
aliases are added by default so you shouldn't have to use this too
often.  See the help on "set_no_standard_alias()" to see what aliases are
added automatically.
<br/><ul>
<li><b>Parameters:</b>
<br/>alias - the alias to add
<br/>alias - the real item that the alias refers to
<li><b>See also:</b>
<br/><a href="#add_menu_aliases">add_menu_aliases()</a>, <a href="#query_menu_aliases">query_menu_aliases()</a>, <a href="#remove_menu_alias">remove_menu_alias()</a> and <a href="#set_no_standard_alias">set_no_standard_alias()
</a><li><b>Example:</b>
<br/><pre>// Allow "buy lancre ale" instead of "buy Ale from Lancre"
add_menu_alias( "lancre ale", "Ale from Lancre" );</pre></dl>

<ul><a name="add_menu_aliases">
add_menu_aliases</a><pre>
void add_menu_aliases(string * aliases,
                      string actual)
</pre></br>
This method allows you to add multiple aliases at once.  Many aliases are
added by default so you shouldn't have to use this too often.  See the 
help on "set_no_standard_alias()" to see what aliases are added 
automatically.
<br/><ul>
<li><b>Parameters:</b>
<br/>aliases - an array of aliases to add
<br/>alias - the real item that the aliases refer to
<li><b>See also:</b>
<br/><a href="#add_menu_alias">add_menu_alias()</a>, <a href="#query_menu_aliases">query_menu_aliases()</a>, <a href="#remove_menu_alias">remove_menu_alias()</a> and <a href="#set_no_standard_alias">set_no_standard_alias()
</a><li><b>Example:</b>
<br/><pre>// Add friendly aliases to "Beef burger and chips"
add_menu_aliases( ({ "beef burger",
                     "beefburger",
                       "burger" }), "Beef burger and chips" );</pre></dl>

<ul><a name="add_menu_item">
add_menu_item</a><pre>
varargs void add_menu_item(string name,
                           int type,
                           int cost,
                           string item,
                           string container,
                           int volume,
                           int intox)
</pre></br>
This is the method used to add items to the menu.  Only the first four
parameters are required, the rest are optional.
<p>
The "type" parameter is used to determine which section of the menu the
item should reside in, and should be selected from those in the
"pub_shop.h" header file.
<p>
The "item" parameter is used to generate the actual product on sale.  This
value can be:
<ul>
<li> a name, which is passed to the "create_item()" function in the room code
<li> a filename, which is cloned, or
<li> an armoury identifier, which is passed to the armoury handler.
</ul>
<p>
The "container" parameter is the same as the "item" parameter, except that
it refers to the container the item comes in and is passed to
"create_container()" instead of "create_item()".  You can also use the
standard containers listed in the "pub_shop.h" header file.  It is
optional, and setting it to 0 will cause it to be ignored.
<p>
The "volume" parameter is optional and is passed directly to
"set_amount()" on the object cloned from "item".  It can be used to alter
the volume of a liquid cloned from a file, so the file itself does not
have to be changed.  It is optional, and setting it to 0 will cause it to
be ignored.  If this is set to 0 then the item will fill up the
container.  Standard volume definitions can be found in the "volumes.h"
header file.
<p>
The last parameter, "intox", is optional and is used only by NPCs to
determine how alcoholic an item is.  This should be between 0 and 10,
with 0 being non-alcoholic and 10 being something like Suicider.  It 
defaults to 0.  Note:  This has no effect on the actual alcohol content
of the item.
<p>
The different volumes of standard containers can be taken from
/include/volumes.h which has defines for all the standard volumes.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the description to be displayed on the menu
<br/>type - the type of item
<br/>cost - the cost of the item
<br/>item - the name, filename or armoury identifier for the item itself
<br/>container - the name, filename or armoury identifier for the
container (optional)
<br/>volume - the volume that the item should be set to (optional)
<br/>intox - the intoxification value, on a scale of 0 to 10 (optional)
<li><b>See also:</b>
<br/><a href="#query_menu_items">query_menu_items()</a>, <a href="#remove_menu_item">remove_menu_item()</a> and /include/volumes.h
<li><b>Example:</b>
<br/><pre>// Add a main course called "Big meat pie", cloned from the file
// "/obj/food/meatpie.food"
add_menu_item( "Big meat pie", PUB_MAINCOURSE, 1000,
   "/obj/food/meatpie.food" );</pre><br/><pre>
// Same as above, but let's put the pie on a plate
add_menu_item( "Big meat pie", PUB_MAINCOURSE, 1000,
   "/obj/food/meatpie.food", PUB_STD_PLATE );</pre><br/><pre>
// Add a glass of ale, with the ale cloned from a file and the glass
// cloned in the "create_container()" function in the room code
add_menu_item( "Pint of ale", PUB_ALCOHOL, 500, "/obj/food/ale.food",
   "new_pint_glass" );</pre><br/><pre>
// The same as above, but we only want half a pint of ale in the glass, we
// want to use the standard glasses in the header file and we want to set
// the intoxification value of the ale to 5
add_menu_item( "Half-pint of ale in a pint glass", PUB_ALCOHOL, 300,
   "/obj/food/ale.food", PUB_STD_PINT, VOLUME_HALFPINT, 5 );</pre><br/><pre>
// Create a beefburger with added vodka in the "create_item()" function in
// the room code and put it in a small satchel from the armoury
add_menu_item( "Beefburger with special sauce", PUB_MAINCOURSE, 800,
   "vodka_burger", "small satchel", 0, 7 );</pre></dl>

<ul><a name="make_counter">
make_counter</a><pre>
object make_counter()
</pre></br>
This function creates the counter for the pub.  It defaults to cloning
PUB_COUNTER_FILE and making it a hidden object.
If you are creating your own counter object then making it hidden is a
good idea.  If it's not hidden, make sure it at least cannot be moved or
buried.
The counter should clear empty objects with the "pub item" property if
they are placed on it.  Making it clear non-empty objects is a bad idea,
since items will be placed here if the purchaser is unable to carry
them.
<br/><ul>
<li><b>Returns:</b>
<br/>the new counter object
<li><b>See also:</b>
<br/><a href="#query_counter">query_counter()</a> and /include/shops/pub_shop.h
</dl>

<ul><a name="query_counter">
query_counter</a><pre>
object query_counter()
</pre></br>
This method returns the object currently being used as a counter in the
pub.
<br/><ul>
<li><b>Returns:</b>
<br/>the file name of the counter
<li><b>See also:</b>
<br/><a href="#make_counter">make_counter()
</a></dl>

<ul><a name="query_discount">
query_discount</a><pre>
float query_discount(object ob)
</pre></br>
This function can be masked and used to determine a discount that is
applied to all items sold, so for instance you could check the guild of
'ob' and give a discount to Witches, or something.  By default the
discount is zero, so query_discount returns 1.0
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the object doing the buying
<li><b>Returns:</b>
<br/>a float to multiply the price by
<li><b>Example:</b>
<br/><pre>// Give Priests a 10% discount
float query_discount( object ob ) {
   if( ob->query_guild_ob() == "/std/guilds/priest.c" )
      return 0.9;
   else
      return 1.0;
}
</pre></dl>

<ul><a name="query_display_header">
query_display_header</a><pre>
int query_display_header()
</pre></br>
This method returns a flag stating whether display of the menu header
is on or off.
<br/><ul>
<li><b>Returns:</b>
<br/>1 for header, 0 for no header
<li><b>See also:</b>
<br/><a href="#set_display_header">set_display_header()</a>, <a href="#set_menu_header">set_menu_header()</a> and <a href="#query_menu_header">query_menu_header()
</a></dl>

<ul><a name="query_display_subheadings">
query_display_subheadings</a><pre>
int query_display_subheadings()
</pre></br>
This method returns a flag stating whether display of the menu subheadings
is on or off.
<br/><ul>
<li><b>Returns:</b>
<br/>1 for headings, 0 for no headings
<li><b>See also:</b>
<br/><a href="#set_display_subheadings">set_display_subheadings()</a>, <a href="#set_menu_subheadings">set_menu_subheadings()</a> and <a href="#query_menu_subheadings">query_menu_subheadings()
</a></dl>

<ul><a name="query_language">
query_language</a><pre>
string query_language()
</pre></br>
This method returns the language used in the shop.
<br/><ul>
<li><b>Returns:</b>
<br/>the language used in the shop

</dl>

<ul><a name="query_menu">
query_menu</a><pre>
object query_menu()
</pre></br>
This method returns the object currently being used as a menu in the
pub.
<br/><ul>
<li><b>Returns:</b>
<br/>the file name of the menu

</dl>

<ul><a name="query_menu_aliases">
query_menu_aliases</a><pre>
mapping query_menu_aliases()
</pre></br>
This method returns a list of all the aliases currently available in
the pub.
<br/><ul>
<li><b>Returns:</b>
<br/>alias : real name
<li><b>See also:</b>
<br/><a href="#add_menu_alias">add_menu_alias()</a>, <a href="#add_menu_aliases">add_menu_aliases()</a>, <a href="#remove_menu_alias">remove_menu_alias()</a> and <a href="#set_no_standard_alias">set_no_standard_alias()
</a></dl>

<ul><a name="query_menu_header">
query_menu_header</a><pre>
string query_menu_header()
</pre></br>
This method returns the current menu header text.
<br/><ul>
<li><b>Returns:</b>
<br/>the menu header text
<li><b>See also:</b>
<br/><a href="#set_menu_header">set_menu_header()</a>, <a href="#set_display_header">set_display_header()</a> and <a href="#query_display_header">query_display_header()
</a></dl>

<ul><a name="query_menu_items">
query_menu_items</a><pre>
mapping query_menu_items()
</pre></br>
This method returns a list of all the items currently available in
the pub.
<br/><ul>
<li><b>Returns:</b>
<br/>items available, listing type, price and intoxification value
<li><b>See also:</b>
<br/><a href="#add_menu_item">add_menu_item()</a> and <a href="#remove_menu_item">remove_menu_item()
</a></dl>

<ul><a name="query_menu_subheadings">
query_menu_subheadings</a><pre>
string * query_menu_subheadings()
</pre></br>
This method returns the current menu subheading text.
<br/><ul>
<li><b>Returns:</b>
<br/>the menu subheadings
<li><b>See also:</b>
<br/><a href="#set_menu_subheadings">set_menu_subheadings()</a>, <a href="#set_display_subheadings">set_display_subheadings()</a> and <a href="#query_display_subheadings">query_display_subheadings()
</a></dl>

<ul><a name="query_no_standard_alias">
query_no_standard_alias</a><pre>
int query_no_standard_alias()
</pre></br>
This method returns a flag stating whether standard aliases will be added
or not.
<br/><ul>
<li><b>Returns:</b>
<br/>0 if standard aliases will be added, 1 if not
<li><b>See also:</b>
<br/><a href="#set_no_standard_alias">set_no_standard_alias()
</a></dl>

<ul><a name="query_pub">
query_pub</a><pre>
int query_pub()
</pre></br>
This method checks to see if this is a pub.
<br/><ul>
<li><b>Returns:</b>
<br/>always return 1

</dl>

<ul><a name="read">
read</a><pre>
string read()
</pre></br>
This method produces the menu from the item information, with the menu
header at the top, all items available grouped by type and sorted by
cost.  If you don't want the menu printed this way then mask this
function and return your own.
<br/><ul>
<li><b>Returns:</b>
<br/>the menu text
<li><b>See also:</b>
<br/><a href="#add_menu_item">add_menu_item()</a>, <a href="#set_display_header">set_display_header()</a>, <a href="#set_menu_header">set_menu_header()</a>, <a href="#set_display_subheadings">set_display_subheadings()</a> and <a href="#set_menu_subheadings">set_menu_subheadings()
</a></dl>

<ul><a name="remove_menu_alias">
remove_menu_alias</a><pre>
int remove_menu_alias(string alias)
</pre></br>
This method allows you to remove an alias from those currently available
in the pub.
<br/><ul>
<li><b>Parameters:</b>
<br/>alias - the alias to remove from the list
<li><b>Returns:</b>
<br/>1 if successful, 0 if unsuccessful
<li><b>See also:</b>
<br/><a href="#add_menu_alias">add_menu_alias()</a>, <a href="#add_menu_aliases">add_menu_aliases()</a>, <a href="#query_menu_aliases">query_menu_aliases()</a> and <a href="#set_no_standard_alias">set_no_standard_alias()
</a></dl>

<ul><a name="remove_menu_item">
remove_menu_item</a><pre>
int remove_menu_item(string name)
</pre></br>
This method allows you to remove an item from those currently available
in the pub.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the name of the item to remove
<li><b>Returns:</b>
<br/>1 if successful, 0 if unsuccessful
<li><b>See also:</b>
<br/><a href="#add_menu_item">add_menu_item()</a> and <a href="#query_menu_items">query_menu_items()
</a></dl>

<ul><a name="set_display_header">
set_display_header</a><pre>
void set_display_header(int value)
</pre></br>
This method allows you to switch the menu header (defaults to "The menu
reads:") that appears at the top of the menu on and off.
<br/><ul>
<li><b>Parameters:</b>
<br/>value - set to 1 to display header or 0 to remove them
<li><b>See also:</b>
<br/><a href="#query_display_header">query_display_header()</a>, <a href="#set_menu_header">set_menu_header()</a> and <a href="#query_menu_header">query_menu_header()
</a></dl>

<ul><a name="set_display_subheadings">
set_display_subheadings</a><pre>
void set_display_subheadings(int value)
</pre></br>
This method allows you to switch the subheadings ("Alcoholic Beverages",
"Meals", etc) that appear above different types of items on and off.
<br/><ul>
<li><b>Parameters:</b>
<br/>value - set to 1 to display subheadings or 0 to remove them
<li><b>See also:</b>
<br/><a href="#query_display_subheadings">query_display_subheadings()</a>, <a href="#set_menu_subheadings">set_menu_subheadings()</a> and <a href="#query_menu_subheadings">query_menu_subheadings()
</a></dl>

<ul><a name="set_language">
set_language</a><pre>
void set_language(string language)
</pre></br>
This method sets the language to use in the shop.
<br/><ul>
<li><b>Parameters:</b>
<br/>language - the language to use

</dl>

<ul><a name="set_menu_header">
set_menu_header</a><pre>
void set_menu_header(string header)
</pre></br>
This method sets the header that appears at the top of the menu.  By
default this is "The menu reads:".
<br/><ul>
<li><b>Parameters:</b>
<br/>header - the new menu header
<li><b>See also:</b>
<br/><a href="#query_menu_header">query_menu_header()</a>, <a href="#set_display_header">set_display_header()</a> and <a href="#query_display_header">query_display_header()
</a></dl>

<ul><a name="set_menu_subheadings">
set_menu_subheadings</a><pre>
void set_menu_subheadings(int subheading,
                          string text)
</pre></br>
This method sets the subheadings that appear at the top of the menu.
<br/><ul>
<li><b>Parameters:</b>
<br/>subheading - the subheading to change (use the #defines listed in
"pub_shop.h")
<br/>text - the new menu subheading text
<li><b>See also:</b>
<br/><a href="#query_menu_subheadings">query_menu_subheadings()</a>, <a href="#set_display_subheadings">set_display_subheadings()</a> and <a href="#query_display_subheadings">query_display_subheadings()
</a></dl>

<ul><a name="set_no_standard_alias">
set_no_standard_alias</a><pre>
void set_no_standard_alias(int flag)
</pre></br>
This method allows you to turn on or off the addition of standard aliases
when new menu items are added.  By default it is turned on.  Standard
aliases are added as follows:
If you added an item called "Lancre vintage wine" the aliases added would
be:
<ul>
<li> vintage wine
<li> lancre wine
<li> wine
</ul>
An alias of the name in lowercase is always added regardless of whether
or not this flag is turned on or off.  You may wish to turn this off if
you are adding several items which could be mistaken for each other, for
instance "Lancre beer" and "Morporkian beer".
<br/><ul>
<li><b>Parameters:</b>
<br/>flag - 0 if standard aliases should be added, 1 if not
<li><b>See also:</b>
<br/><a href="#add_menu_alias">add_menu_alias()</a>, <a href="#query_menu_aliases">query_menu_aliases()</a>, <a href="#remove_alias">remove_alias()</a> and <a href="#query_no_standard_alias">query_no_standard_alias()
</a></dl>


[an error occurred while processing this directive]

