[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/armoury.c

Keeps track of all the standard armours, weapons and clothing.

See also:
/include/armoury.h

Written by Furball

Inherits

This class inherits the following classes /std/room/basic_room.c

Includes

This class includes the following files /include/move_failures.h

Method index

Public Functions

These are functions that everyone can access.

choose_small_item
varargs object choose_small_item(string area)

This will choose a small item from the specific area.

Parameters:
area - the are to check in

Returns:
the small object to choose


query_area
mapping query_area(string domain)

Returns the list of domain armoury items.

Parameters:
domain - the domain/area to get the items from.

Returns:
the area sub-mapping.


query_areas
string * query_areas()
query_last_list
string query_last_list()
query_smalls
object * query_smalls(string area)

This returns the list of small objects available for the area. These are things that can be fgound in gutters and so on.

Parameters:
area - the area of the recycling

Returns:
the array of small objects


rehash_specific_dir
int rehash_specific_dir(string dir)

This method rehashes a specific directory of things. At the moment we fudge this a little.

Parameters:
dir - the directory to rehash

Returns:
1 if it found something to rehash


remap_file_path
string remap_file_path(string path)

This method tries to find a match for the object if it has moved between directories.

Parameters:
path - the old path

Returns:
the new path


request_armour
object request_armour(string word,
int percent)

Requests a armour from the armoury. This is an obsolete function please use request_item().

Parameters:
word - the name of the armour
percentage - the percentage condition to return it in

Returns:
the requested armour

See also:
request_item()


request_clothing
object request_clothing(string word,
int percent)

Requests some clothing from the armoury. This is an obsolete function please use request_item().

Parameters:
word - the name of the clothing
percentage - the percentage condition to return it in

Returns:
the requested clothing

See also:
request_item()


request_item
varargs object request_item(string word,
int percent,
string area,
mixed extra)

General item retreival function. It returns a new item it handles any sort of item. The percentage is the percentage condition in which it is returned. The "word" parameter is the name of the requested item, essentially the filename without directory and with "_"'s changed to " "'s. The "percent" parameter is used as measure of how good it is compared to a fully functional one. So a 50% dagger is only 50% as good as a 100% one.

The file armoury.h defines the ARMOURY variable. You need to include this into your file to use it. You should include this file and uyse ythis define rather than the full path to the armoury, as otherwise your code could stuff up :)

If the function armoury_init exists on the item it will be called with the 'percent' and 'extra' arguments as passed to this function. If armoury_init does not exist, the function set_percentage will be called with the 'percent' argument.

Parameters:
word - the name of the item to retreive
percent - the percentage condition to be in
area - the area to choose the item in
extra - item-specific initialization parameter

Returns:
the requested object, or 0 on failure

See also:
/include/armoury.h

Example:
// get a slightly worn long sword and give it to the npc.
ARMOURY->request_item("long sword", 85)->move(npc);

// Get a random condition armour.
armour = ARMOURY->request_item("leather jacket", random(100));

request_item_path
varargs string request_item_path(string word,
string area)
request_jewellery
object request_jewellery(string word,
int percent)

Requests some jewellery from the armoury. This is an obsolete function please use request_item().

Parameters:
word - the name of the jewellery
percentage - the percentage condition to return it in

Returns:
the requested jewellery

See also:
request_item()


request_scabbard
object request_scabbard(string word,
int percent)

Requests a scabbard from the armoury. This is an obsolete function please use request_item().

Parameters:
word - the name of the scabbard
percentage - the percentage condition to return it in

Returns:
the requested scabbard

See also:
request_item()


request_weapon
object request_weapon(string word,
int percent)

Requests a weapon from the armoury. This is an obsolete function please use request_item().

Parameters:
word - the name of the weapon
percentage - the percentage condition to return it in

Returns:
the requested weapon

See also:
request_item()


search_by_name
mixed search_by_name(string name)