[Package Index | Mudlib Index | Effect Index]

File /obj/crafts/workbench_inherit.c

An inherit for players to craft their own simple items from raw materials. You'll need to make basic files for the objects they can craft, inheriting a standard craftable-item file, and specify the type of workbench and the raw material object it uses.

Written by Touchstone

Started 29.06.05

Inherits

This class inherits the following classes /std/object.c

Includes

This class includes the following files /include/tasks.h, /include/money.h and /include/shops/bank.h

Method index

Public Functions

These are functions that everyone can access.

add_type
varargs void add_type(string str,
                      int i,
                      int number,
                      string filename,
                      string func)

Adds one item to the mapping of types the workshop can be used to make.

Parameters:
str - the name of the item as used by the player
i - the difficulty of the item to make
number - the number of raw material items the item takes to make
filename - the name of the file for that item in the items directory

See also:
query_types() and remove_type()

Example:
add_type( "corset", 40, 1, "leather_corset" );

add_workshop_sign
object add_workshop_sign(string sign_long,
                         string sign_short,
                         string sign_language)

Automatically generates a comma-separated list of items you can make here and puts it into add_sign.

Parameters:
sign_long - the long description of the workshop sign
sign_short - the shortdescription of the workshop sign
sign_language - the language the sign should be in

Returns:
the sign object


parse_message
string parse_message(string mess,
                     string str,
                     object * materials)
query_fee
int query_fee()

Check how much we're charging, if at all.

Returns:
the fee to charge

See also:
set_fee()


query_finish_mess
string query_finish_mess()
query_material_needed
string * query_material_needed()

Check which raw materials the workshop wants.

Returns:
the array of materials that can be used.

See also:
set_material_needed()


query_shop_type
string query_shop_type()

Check what kind of workshop we have.

Returns:
the type of workshop

See also:
set_shop_type()


query_skill_used
string query_skill_used()

Check which skill we're using.

Returns:
the skill used

See also:
set_shop_type()


query_start_mess
string query_start_mess()
query_time_taken
int query_time_taken()

Check how long the process takes.
query_tm_mess
string query_tm_mess()
query_types
mapping query_types()

Lists the items that the workshop can make.

Returns:
the mapping of types the workshop can be used to make

See also:
add_type() and remove_type()


remove_type
void remove_type(string type)

Removes one item from the mapping of types the workshop can be used to make.

Parameters:
type - the item to remove

See also:
add_type() and query_types()


set_fee
void set_fee(int fee,
             string area)

Set the fee to 0 if you don't want to charge.

Parameters:
fee - the fee to charge
area - the money type to use

See also:
query_fee()

Example:
set_fee( 400, "Ankh-Morpork" );

set_finish_mess
void set_finish_mess(string str)

Sets the message given when the player finishes making an item. If you put $item in the string you give this function, it will be replaced by the name of the item they're making, and $material will be replaced by the query_multiple_short() of the raw materials used for it. May be used once.

Parameters:
str - the message given to the player

See also:
set_tm_mess() and set_start_mess()

Example:
set_finish_mess( "You finish making a $ and discard the remaining scraps "
  "of silk.\n" );

set_items_directory
void set_items_directory(string str)

Sets the directory which contains the files for each item players can craft in your workshop. Needs to be called once and only once.

Parameters:
str - the directory to use

Example:
set_items_directory( ROOMS + "workshop/" );


set_material_needed
void set_material_needed(string * str)

Sets the raw material objects used. It matches against query_name() and checks that it has the property (Crafts material) with a value of the workshop type. Needs to be called once and only once.

Parameters:
str - the names of the item used

See also:
query_material_needed()

Example:
set_material_needed( ({ "leather", "velvet" }) );

set_shop_type
void set_shop_type(string type,
                   string skill)

This sets the kind of workshop, eg. leatherworker or jeweller. It needs to be identical to the value given the (Crafts material) property on the raw material item. Needs to be called once and only once.

Parameters:
type - the shop type
skill - the skill used

See also:
query_shop_type() and query_skill()

Example:
set_shop_type( "leatherworker", "crafts.materials.leatherwork" );

set_start_mess
void set_start_mess(string str)

Sets the message given when the player starts making an item. If you put $item in the string you give this function, it will be replaced by the name of the item they're making, and $material will be replaced by the query_multiple_short() of the raw materials used for it. May be used once.

Parameters:
str - the message given to the player

See also:
set_tm_mess() and set_finish_mess()

Example:
set_start_mess( "You sit down and start cutting out the pattern for a $ "
  "from the silk.\n" );

set_time_taken
void set_time_taken(int t)

Set how long it takes to use this process. Set it to a positive number, the inherit puts in the required minus sign. May be used once.

Parameters:
t - the time to take


set_tm_mess
void set_tm_mess(string str)

Use this to set the message given when the player TMs. Don't bother putting in the colour codes and new line, it will do that for you. May be used once.