[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/hedgehog_handler.c

This is the hedgehog handler. It keeps track of the verses of the hedgehog song and how the dancing to the song affects skills. It also keeps track of witches who have been singing in the wrong place - singing the hedgehog song is forbidden in e.g. Ankh-Morpork (enforced by Musicians' guild). Crimes and errors are recorded in /log/HEDGEHOG. Warning:
Faint ears might shrivel
Tumble like cherry blossoms
In a summer breeze

Written by Gruper

Started 17th of Aug, 1998

Method index

Public Functions

These are functions that everyone can access.

add_crime
int add_crime(string criminal,
              string place)

This method adds 1 to the "crime level" of the singer.

Parameters:
criminal - The name of the singer
place - Where the crime was commited

Returns:
The new "crime level" of the singer in "place"

See also:
query_crime_level .c


bonus_modifier
int bonus_modifier(string skill)

This function returns the modifier (a percentage) that should be used to scale bonuses for someone who is dancing to the hedgehog song.

Parameters:
skill - The skill that you want a modifier for

Returns:
The modifier

Example:
modifier = ( args[SONG_STRENGTH] *
               HEDGEHOG_HANDLER->bonus_modifier( skill ) ) / 100;
         bonus -= modifier;

chorus
string * chorus(int c)



Parameters:
c - The chorus you want. Valid range: [1, number_of_chorii]

Returns:
Array of strings, each string a row in the requested chorus


number_of_chorii
int number_of_chorii()



Returns:
number Total number of chorii


number_of_verses
int number_of_verses()



Returns:
number Total number of verses


query_crime_level
int query_crime_level(string criminal,
                      string place)



Returns:
The crime level of "criminal" in "place"

See also:
query_places.c and add_crime .c


query_interval
int query_interval()

This is the interval in seconds between bursts of singing.

Returns:
The interval


query_places
string * query_places()



Returns:
An array of the places where singing the hedgehog song is illegal

See also:
set_punishment_in_place .c


query_punishment_in_place
string * query_punishment_in_place(string place)

This method returns a string tuple consisting of an object and a function defined in that object. How do we know in which "place" to look? We first examine the whole path of the filename of the room surrounding the player, then the directory of that file and so on, until we either find something or reach the root directory. If someone is singing in /d/am/eight_sins/cochon, we first check the whole path, then /d/am/eight_sins, /d/am. Since /d/am has a punishment entry in our mapping, we can return that and feel happy about it. If we find no punishment, we return 0.

Returns:
A ({ (object) string, (function) string }) pair or 0

See also:
query_crime_level.c and set_punishment_in_place .c

Example:
query_punishment_in_place( "/d/am/eight_sins/cochon" );

remove_criminal
void remove_criminal(mixed criminal)

This method removes a criminal from the records in all places. Useful for refresh and delete.

Parameters:
criminal - The person whose criminal records are to be removed


remove_criminal_from_place
void remove_criminal_from_place(string criminal,
                                string place)

This method removes a criminal from the records in a place.

Parameters:
criminal - The person whose criminal records are to be removed
place - The place from which the criminal's records are to be removed

See also:
add_crime .c


remove_place
void remove_place(string place)

This method totally removes a place from all records.

Parameters:
place - The place that is to be removed


remove_place_criminals
void remove_place_criminals(string place)

This method removes all criminal records from a place.

Parameters:
place - The place where the "amnesty" is to be issued


remove_place_punishment
void remove_place_punishment(string place)

This method removes a place from the list of places where singing the song is illegal.

Parameters:
string - place


set_punishment_in_place
int set_punishment_in_place(string place,
                            string obj,
                            string func)

This method makes an entry in the place_punishment mapping. The function in the object should be defined as void some_function( object player ). This function will be called by the hedgehog song effect if the witch attempts to sing while in "place". It should handle all the punishment stuff, such as breaking the player's fingers :)

Parameters:
place - The place(*) where it is a crime to sing
obj - The object(*) where func is defined
func - The function(*) to be called when a crime is committed (*) As strings.

Returns:
0 if it fails, 1 if it registers. Note that no evaluation is done

See also:
query_punishment_in_place .c

Example:
set_punishment_in_place( "/d/am", "/d/am/utils/am_hedgehog", "hedgehog_punishment" )

verse
string * verse(int v)



Parameters:
v - The verse you want. Valid range: [1, number_of_verses]

Returns:
Array of strings, each string a row in the requested verse