[Package Index | Mudlib Index | Effect Index]
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.
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.
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.
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.
See also:
/std/shops/pub_shop.c, /include/shops/pub_shop.h and /include/volumes.h
Written by Lemming
Started 23/10/1999
.
void add_menu_alias(mixed alias, string actual)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.
// Allow "buy lancre ale" instead of "buy Ale from Lancre" add_menu_alias( "lancre ale", "Ale from Lancre" );
void add_menu_aliases(string * aliases, string actual)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.
// Add friendly aliases to "Beef burger and chips" add_menu_aliases( ({ "beef burger", "beefburger", "burger" }), "Beef burger and chips" );
varargs void add_menu_item(string name, int type, int cost, string item, string container, int volume, int intox)This is the method used to add items to the menu. Only the first four parameters are required, the rest are optional.
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.
The "item" parameter is used to generate the actual product on sale. This value can be:
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.
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.
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.
The different volumes of standard containers can be taken from
/include/volumes.h which has defines for all the standard volumes.
// 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" );
// 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 );
// 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" );
// 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 );
// 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 );
object make_counter()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.
object query_counter()This method returns the object currently being used as a counter in the pub.
float query_discount(object ob)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
// 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; }
int query_display_header()This method returns a flag stating whether display of the menu header is on or off.
int query_display_subheadings()This method returns a flag stating whether display of the menu subheadings is on or off.
string query_language()This method returns the language used in the shop.
object query_menu()This method returns the object currently being used as a menu in the pub.
mapping query_menu_aliases()This method returns a list of all the aliases currently available in the pub.
string query_menu_header()This method returns the current menu header text.
mapping query_menu_items()This method returns a list of all the items currently available in the pub.
string * query_menu_subheadings()This method returns the current menu subheading text.
int query_no_standard_alias()This method returns a flag stating whether standard aliases will be added or not.
int query_pub()This method checks to see if this is a pub.
string read()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.
int remove_menu_alias(string alias)This method allows you to remove an alias from those currently available in the pub.
int remove_menu_item(string name)This method allows you to remove an item from those currently available in the pub.
void set_display_header(int value)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.
void set_display_subheadings(int value)This method allows you to switch the subheadings ("Alcoholic Beverages", "Meals", etc) that appear above different types of items on and off.
void set_language(string language)This method sets the language to use in the shop.
void set_menu_header(string header)This method sets the header that appears at the top of the menu. By default this is "The menu reads:".
void set_menu_subheadings(int subheading, string text)This method sets the subheadings that appear at the top of the menu.
void set_no_standard_alias(int flag)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: