[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/cmr_handler.c

This handler deals with identifying materials and colours. Your skill and experience are used to determine if you can successfully identify a particular material or colour.

Written by Deutha

Includes

This class includes the following files /include/cmr.h, /include/library.h and /include/colour.h

Method index

Public Functions

These are functions that everyone can access.

add_colour
string add_colour(string word,
                  int fine,
                  int crude,
                  int qp_thresh,
                  int gp_thresh)

This function is used to add a known colour to the handler.

Parameters:
word - The name of the colour
fine - The colour tone, an index out of MODIFIERS
crude - The basic colour, an index out of COLOURS
qp_thresh - Quest points required to help identify this colour
gp_thresh - Guild points required to help identify this colour

Returns:
The outcome of the call


add_material
string add_material(string word,
                    int colour,
                    int type,
                    int skill_reqd,
                    int skill_thresh)

Add a new material to the handler. The colour of the material is an index into the COLOUR array defined in colour.h. The type of material is an index into the MATERIALS array defined in cmr.h. skill_reqd is an index into the SKILLS array defined in cmr.h but can also take the special value of 99 to indicate that the material can only be identified if someone has told the person what the material is or 0 to indicate that everyone knows what the material is. If the skill_reqd is a skill the skill_thresh is the bonus needed in that skill to identify the material.

Parameters:
word - The name of the material
colour - The index into the colour array for the colour of the material. (see colour.h)
type - Type of material
skill_reqd - Index into the array of skills (see cmr.h)
skill_thresh - The bonus required in the appropriate skill.

Returns:
The outcome of the call


clean_up
int clean_up()
delete_colour
int delete_colour(string word)

Remove a colour from the handler.

Parameters:
word - The colour to remove.

Returns:
1 for success, 0 for failure


delete_material
int delete_material(string word)

Remove a material from the handler.

Parameters:
word - The name of the material to remove.

Returns:
1 on success, 0 on failure


identify_colour
string identify_colour(string word,
                       object player)

Used to determine if a player can identify a particular colour. The function returns the colour's name or a string giving a rough description if they're unable to identify it.

Parameters:
word - The colour they're trying to identify
player - The player trying to identify the colour

Returns:
Description


identify_material
string identify_material(string word,
                         object player,
                         int article)

Used to determine if a player can identify a particular material. The function returns the materials name or a string giving a rough description if they're unable to identify it. Some materials can be identified by being high enough at a particular skill (defined in cmr.h) while others are only learned by being taught and others are known to everyone.

Parameters:
word - The name of the material
player - The player trying to identify it
article - Definite or indefinite article

Returns:
Description

See also:
cmr_library.c and cmr .c


query_colour_details
int * query_colour_details(string word)

Returns the array of information stored about a particular colour. The array is setup using add_colour.

Parameters:
word - The colour in question

Returns:
The colour details

See also:
add_colour .c


query_colour_names
string * query_colour_names()

List all the known colours in the handler.

Returns:
An array of strings of colour names


query_material_adjective
string query_material_adjective(string word)

This returns a description (in fact a number of adjectives) for a given material. What it actually looks like.

Parameters:
The - name of the material

Returns:
A description


query_material_ansi_colour
string query_material_ansi_colour(string word)

Returns the ansi colour associated with the material eg. yellow for gold, red for a red mineral pebble etc.

Parameters:
word - The material's name

Returns:
ansi Colour sequence for that colour


query_material_details
int * query_material_details(string word)

Return the details of a material set with add_material

Parameters:
word - The material in question

Returns:
An integer array of material details.


query_material_names
string * query_material_names()

List all the known materials by name.

Returns:
An array of strings of material names