[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/artifact_handler.c

Keeps track of all the artifacts and the players known artifacts arrays.

Method index

Public Functions

These are functions that everyone can access.

add_artifact
void add_artifact(string name,
                  string file,
                  int max,
                  int min,
                  int bonus,
                  int value)

Add a new artifact into the artificat mapping.

Parameters:
name - the name of the artifact
file - the file name of the artifact
max - the maximum level
min - the minimum level
bonus - the bonus required to make
value - the value of the artifact

See also:
query_artificats()


add_known
void add_known(string person,
               string artifact)

Place an artifact into a players known artifact list.

Parameters:
person - the name of the person knowing the artifact
artifact - the name of the artifact being know


diagnose_artifact
void diagnose_artifact(object thing,
                       object person,
                        object)

Let a player attempt to find out what type of artifact the thing is.

Parameters:
thing - the item to diagnose
person - the person doing the diagnosis


query_artifact
int query_artifact(string name)

Returns the information about the named artificats.

Parameters:
name - the artificant name to get information on

Returns:
the informatioj on the artificant, 0 if the artifact does not exist


query_artifact_bonus
int query_artifact_bonus(string name)

Find the bonus to make associated with the artifact.

Parameters:
name - the name of the artifact

Returns:
the bonus to make associated with the artifact


query_artifact_file
string query_artifact_file(string name)

Find the file associated with the artifact.

Parameters:
name - the name of the artifact

Returns:
the file associated with the artifact


query_artifact_level
int query_artifact_level(string name,
                         int bonus)

Find the level of the artifact. The level is determined as the difference between the minimum and maximum artifact level squared divided by the bonus passed in minus the bonus to create plus the difference between the maximum and minimum levels plus the maximum level.
ie:

level = (((max-min) * (max-min)) / (bonus - make_bonus + max - min)) + min


Parameters:
name - the name of the artifact
bonus - the bonus modifier

Returns:
the level of the artifact


query_artifact_max
int query_artifact_max(string name)

Find the maximum level associated with the artifact.

Parameters:
name - the name of the artifact

Returns:
the maximum level associated with the artifact


query_artifact_min
int query_artifact_min(string name)

Find the minimum level associated with the artifact.

Parameters:
name - the name of the artifact

Returns:
the minimum level associated with the artifact


query_artifact_value
int query_artifact_value(string name,
                         int bonus)

Determine the value of the artificant. The value is determined by the following equation:
value = (value * max) / query_artifiact_level(name, bonus)


Parameters:
name - the name of the artifact
bonus - the bonus modifier

Returns:
the value of the artifact


query_artifact_value_info
int query_artifact_value_info(string name)

Find the value associated with the artifact.

Parameters:
name - the name of the artifact

Returns:
the value associated with the artifact


query_artifacts
mapping query_artifacts()

This method returns the artifacts mapping. The artifacts mapping has elements of the form:

   name : ({ file, max level, min level, bonus to make, value info })
e.g. "wand of eternal light" :
       ({ "/obj/wands/eternal_light", 85, 65, 250, 10000 })


Returns:
the artificats mapping


query_known
int query_known(string person,
                string artifact)

A person will not forget how to recognise an artifact (unless they refresh, in which case all of them are forgotten, i.e. the file is wiped) so to let a person learn to recognise an artifact, add a new line to their file consisting of its name and to see if they know an artifact, check in their file for its name. This method doesn't require a library handler.

Parameters:
person - the person check to see if they know the artifact
artifact - the artifact being checked

Returns:
1 if they know it, 0 if they do not


query_wand_name
string query_wand_name()

The name of the wand.

Returns:
the wand name


remove_artifact
void remove_artifact(string name)

Remove the artifact of the given name.

Parameters:
name - the name of the artifiact to remove


save_me
void save_me()

Saves the current state to disk.
zap
void zap(object thing,
         object person,
         object wand)

Zap the wand!

Parameters:
thing - the thing to zap with the wand
person - the person doing the zapping
wand - the wand being zapped