[Package Index | Mudlib Index | Effect Index]
Description
This office is the nerve centre of the shop. Most of the data structures are defined and maintained from here, and virtually all of the managerial functions are forwarded here. It is this object that passes the common variables across to other files as they call for them. This minimises the complexity of setting up each object - as long as they point to this object, and this object is correctly set up, the objects will know which shop they belong to, who the employees are, who the proprietor is etc.
Before the shop will function correctly, it must be registered with the handler - see set_very_short()
Most of the functions defined in the office are not needed by creators. Those that are needed are shown in the examples. Other functions are not necessary, but may be useful.
The source to this object is split into 15 different files. The main file, office.c includes the other files under the office_code directory. This is intended to ease code maintenance as the total size of the office code (as of December 2000) is around 165k.
In general, the functions contained in office.c are those intended to be used directly by creators. The other functions are called internally by the shop.
The data itself is also saved into several files. The data is arranged into these files to minimise the amount of disk activity when changes are made. For example, employee data changes every time an employee does something. The list of applicants, however, changes only when an application status changes. They are, therefore, saved into seperate files. Also, each save call is subject to a callout, and will limit the amount of disk writing actually done. The only data not stored by this file is the stock data, which is saved by each cabinet individually. All data and logs are saved into several files within a directory "/d/(domain)/save/player_shops/(shop_very_short)/". In addition, some data are cleared if it hasn't been used for a while. This will typically save up to 100k of memory for a store the size of Tarnach's.
The shop supports notice boards, posting all hirings, promotions, bonus amounts in addition to any posts requested in the inheriting object. In the absence of a board, all posts are mailed to each employee and each employee will have access to an additional "memo" command in the office.
Applications are handled automatically, with managers voting whether to accept or reject an application. On gaining positive votes from at least 50% of the managers, an applicant is hired. If they receive more than 50% negative votes, they are rejected. If there are insufficient votes to settle the decision, an applicant will be hired if more managers have voted for than against. Policy suggestions are handled in a similar way.
The shop's two main administration routines are run on a regular basis. The first of these is run every day and is responsible for checking that employees are still valid players (not deleted chars or creators). It conducts automatic promotions, and handles demotions for inactive employees. It also updates the lists of declined applicants and banned people and removes that status if applicable. Finally, it calls the check_hire_list() function to see if we can hire any new employees.
The second is run every Discworld month. This review involves paying employees directly into their nominated bank account, and awarding bonuses based on the current value of the bonus fund.
See also:
/include/player_shop.h, /std/shops/player_shop/mgr_office.c, /std/shops/player_shop/counter.c, /std/shops/player_shop/storeroom.c, /std/shops/player_shop/shop_front.c and /std/shops/player_shop/shopkeeper.c
Written by Ringo
Started 1st August 1999
#include "path.h" inherit "/std/shops/player_shop/office"; void setup() { set_light(60); set_place("Lancre"); set_language("morporkian"); set_proprietor("Tarnach Fendertwin"); set_shop_name("Tarnach Fendertwin's Quality Consumables (Creel Springs)"); set_very_short("TFQC-CS", PATH + "save/"); set_channel("tarnachcs", 0); set_stock_policy("magical spell components"); set_shop_front(PATH+ "front"); set_counter(PATH+ "counter"); set_storeroom(PATH+ "storeroom"); set_directions("east", "east", "east"); set_shopkeeper(PATH + "shopkeeper"); set_short("office of Tarnach's shop"); set_long("This room is the office of the Creel Springs branch of " "Tarnach Fendertwin's Quality Consumables. There is a door to the " "managers' office in the south wall.\n"); add_sign("The sign is a small piece of paper stuck to the wall.\n", "This seems to be a handwritten note from Tarnach himself. " "The handwriting, not to mention the spelling and the grammar, " "is appalling, so it's difficult to make out much. All you " "can understand is something about what the \"office\" is for.", "sign", "sign" )->add_property( "there", "on one wall"); add_exit("east", PATH+ "counter", "door"); add_manager_exit("south", PATH + "mgr_office"); }
.
mapping get_applicants()Query the list of applicants. This method returns the list of applicants as a mapping formatted as follows:
mapping get_baddies()Query the people banned from the shop. This method returns a mapping of the people banned from this shop, along with the time that they were banned, the person banning them, and the reason they were banned. The format for this mapping is:
string * get_employees()Query the list of employees. This method returns the list of employees, sorted alphabetically.
string * get_managers()Query the list of managers. This method returns the list of managers, sorted alphabetically.
mapping get_new_policies()Query the policy suggestions. These are the policies that have been proposed but not yet implemented.
mapping get_policies(int type)Query the policies. These are the policies currently in effect.
string * get_retired()Query the list of retired managers. This method returns the list of retired managers, sorted alphabetically.
string * get_supervisors()Query the list of supervisors. This method returns the list of supervisors, sorted alphabetically.
int num_employees_in()Query the number of employees currently clocked in. This function will also clock out any employees that are no longer on DW.
int query_applicant(string player)Determine if this person has applied for a job.
int query_baddie(string player)Determine if this person is banned from the shop.
int query_bonus()Query the value of the bonus account. This is the current value of the bonus account. Will need converting to local currency if it is to be displayed.
string query_channel()Query the channel used by the shop.
string query_counter()Query the path to the shop counter.
void query_creator(string creator)Query the maintainer of this shop's files.
int query_declined(string player)Determine if a player was declined for a job. This method is used to determine if there is a declined application registered for a player.
int query_employee(string player)Determine if this person is an employee of the shop.
mapping query_employees()Return the employee data. This includes only active employees - retired managers are not included. The data is formatted as:
string query_language()Query the language used in communications with this shop. Useful for signs, books, etc.
string * query_list_array()Query the list of items sold by the shop. Generates an array of the keys to the list mapping.
mapping query_list_mapping()Query the list of items sold by the shop.
string query_list_string()Query the list of items sold by the shop. Generates a list of all items bought & sold by this shop, and outputs a multiple short string for use in displays.
int query_manager(string player)Determine if this person is a manager of this shop.
int query_maxemp()Query the maximum number of employees.
string query_mgr_office()Query the path to the managers' office.
int query_num_cabinets()Query the number of storeroom cabinets.
int query_pay()Query the base pay rate. This is the base pay rate set by the managers; the amount each employee will receive for a single transaction.
string query_place()Query the location of this shop.
int query_policy(string policy)Determine if a shop policy exists.
int query_profit()Query the value of the profit account. This is the current value of the profit account. Will need converting to local currency if it is to be displayed.
string query_proprietor()Query the name of the proprietor.
int query_retired(string player)Determine if this person is a retired manager of this shop.
string query_shop_front()Query the path to the shop front.
string query_shop_name()Query the full name of the shop.
string query_shopkeeper()Query the shopkeeper name.
int query_stock(string items)Query number of items in stock. Determines the number of a specific item currently held by this shop.
string query_storeroom()Query the path to the storeroom.
int query_supervisor(string player)Determine if this person is a supervisor of this shop.
string shop_very_short()Query the very short name of the shop.
void add_manager_exit(string dir, string path)Set the exit to the managers' office. This method also modifies the exit to allow only managers to enter the managers' office.
add_manager_exit( "east", PATH + "tarnach's_man_office" );
void save_emps()Save the employee data file. This method uses a call_out to help minimise the amount of disk activity during normal operations of the shop. The very short name of the shop must have been set previously.
void save_me()Save the shop data file. This method uses a call_out to help minimise the amount of disk activity during normal operations of the shop. The very short name of the shop must have been set previously.
void set_channel(string name, int board)Set the channel used by the shop. This sets the channel used by the employees' badges, and also the name of the board. If a board has been set-up for this shop, this function will also add the board into the room.
set_channel( "tarnachcs", 0 );
void set_counter(string path)Set the path to the counter. This is the full path and filename of the counter object to be used by this shop.
set_counter( PATH + "counter" );
void set_creator(string creator)Set the creator of this shop. This person will receive all applications, complaints, suggestions etc in the absence of any managers. Default is set by CREATOR in
set_creator( "ringo" );
void set_directions(string store, string counter, string shop)Set the directions to other parts of the shop. This function is used by the npc shopkeeper to navigate around the shop, using the exits at the given directions. These directions should be the standard "north", "south", "up" etc.
set_directions( "southeast", "southeast", "southeast" );
void set_language(string language)Set the language for all communications with this shop. This is used by signs, books, and all sorts of other readable and listenable things.
set_language( "djelian" );
void set_place(string place)Set the location of the shop. This is used by the money handling functions to determine which currency to use and therefore should be one of the locations returned by the query_all_places() function in /obj/handlers/money_handler
set_place( "Lancre" );
void set_proprietor(string name)Set the name of the proprietor. A fictional name; the owner of this establishment. All administration board posts & mudmails will be sent by this name.
set_proprietor( "Tarnach Fendertwin" );
void set_shop_front(string path)Set the path to the customer area.
set_shop_front( PATH + "shopfront" );
void set_shop_name(string name)Set the full name of the shop. This is used throughout the shop, and passed to the shop front as the short description for the shop.
set_shop_name( "Tarnach Fendertwin's Quality Consumables (Creel Springs)" );
void set_shopkeeper(string path)Set the npc shopkeeper object. Call this after setting up the shop's paths (i.e. to the front room, stock room, etc.), because the shopkeeper has to know where these things are!
set_shopkeeper( PATH + "shopkeeper" );
void set_stock_policy(string desc)Set the stock's main policy. This is a general description of the items that this store deals in.
set_stock_policy( "magical spell components" );
void set_storeroom(string path)Set the path to the storeroom.
set_storeroom( PATH + "storeroom" );
void set_very_short(string name, string savedir)Set the very short name of the shop. This is used in many places including save-file names, setting up player-titles, and mail headers. It should be no more than around 4 or 5 chars in length. This function also restores all saved data. You must register this name by calling add_shop() in the handler.
set_very_short( "TFQC-CS", PATH + "save/" );