[an error occurred while processing this directive]
[<a href="index.shtml">Package Index</a></code> | <a href="index_std.shtml">Mudlib Index</a></code> | <a href="index_eff.shtml">Effect Index</a></code>]<br><h2>File /obj/handlers/hedgehog_handler.c</h2> 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:<br>
Faint ears might shrivel<br>
Tumble like cherry blossoms<br>
In a summer breeze
<p>Written by Gruper<p>Started 17th of Aug, 1998
<h2>Method index</h2>
<ul>
<li><a href="#add_crime">add_crime</a>(string, string)<br/>
This method adds 1 to the "crime level" of the singer.
<li><a href="#bonus_modifier">bonus_modifier</a>(string)<br/>
This function returns the modifier (a percentage) that should be
used to scale bonuses for someone who is dancing to the hedgehog song.
<li><a href="#chorus">chorus</a>(int)<br/>
<li><a href="#number_of_chorii">number_of_chorii</a>()<br/>
<li><a href="#number_of_verses">number_of_verses</a>()<br/>
<li><a href="#query_crime_level">query_crime_level</a>(string, string)<br/>
<li><a href="#query_interval">query_interval</a>()<br/>
This is the interval in seconds between bursts of singing.
<li><a href="#query_places">query_places</a>()<br/>
<li><a href="#query_punishment_in_place">query_punishment_in_place</a>(string)<br/>
This method returns a string tuple consisting of an object and a
function defined in that object.
<li><a href="#remove_criminal">remove_criminal</a>(mixed)<br/>
This method removes a criminal from the records in all places.
<li><a href="#remove_criminal_from_place">remove_criminal_from_place</a>(string, string)<br/>
This method removes a criminal from the records in a place.
<li><a href="#remove_place">remove_place</a>(string)<br/>
This method totally removes a place from all records.
<li><a href="#remove_place_criminals">remove_place_criminals</a>(string)<br/>
This method removes all criminal records from a place.
<li><a href="#remove_place_punishment">remove_place_punishment</a>(string)<br/>
This method removes a place from the list of places where
singing the song is illegal.
<li><a href="#set_punishment_in_place">set_punishment_in_place</a>(string, string, string)<br/>
This method makes an entry in the place_punishment mapping.
<li><a href="#verse">verse</a>(int)<br/>
</ul>
<h2>Public Functions</h2>
These are functions that everyone can access.<p>
<dl>
<dt class="autodocfuncname"><a name="add_crime">
add_crime</a><pre class="autodocfuncdef">
int add_crime(string criminal,
              string place)
</pre><dd><br />
This method adds 1 to the "crime level" of the singer.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
criminal - The name of the singer<br />
place - Where the crime was commited<br />
<br />
<dd><b>Returns:</b>
<br />The new "crime level" of the singer in "place"<br /><br />
<dd><b>See also:</b>
<br />query_crime_level
.c<br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="bonus_modifier">
bonus_modifier</a><pre class="autodocfuncdef">
int bonus_modifier(string skill)
</pre><dd><br />
This function returns the modifier (a percentage) that should be
used to scale bonuses for someone who is dancing to the hedgehog song.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
skill - The skill that you want a modifier for<br />
<br />
<dd><b>Returns:</b>
<br />The modifier
<br /><br />
<dd><b>Example:</b>
<br/><pre>modifier = ( args[SONG_STRENGTH] *
               HEDGEHOG_HANDLER->bonus_modifier( skill ) ) / 100;
         bonus -= modifier;</pre><br /></dl>

<dt class="autodocfuncname"><a name="chorus">
chorus</a><pre class="autodocfuncdef">
string * chorus(int c)
</pre><dd><br /><br />
<br /><dl>
<dd><b>Parameters:</b><br />
c - The chorus you want.  Valid range: [1, number_of_chorii]<br />
<br />
<dd><b>Returns:</b>
<br />Array of strings, each string a row in the requested chorus
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="number_of_chorii">
number_of_chorii</a><pre class="autodocfuncdef">
int number_of_chorii()
</pre><dd><br /><br />
<br /><dl>
<dd><b>Returns:</b>
<br />number Total number of chorii
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="number_of_verses">
number_of_verses</a><pre class="autodocfuncdef">
int number_of_verses()
</pre><dd><br /><br />
<br /><dl>
<dd><b>Returns:</b>
<br />number Total number of verses
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_crime_level">
query_crime_level</a><pre class="autodocfuncdef">
int query_crime_level(string criminal,
                      string place)
</pre><dd><br /><br />
<br /><dl>
<dd><b>Returns:</b>
<br />The crime level of "criminal" in "place"<br /><br />
<dd><b>See also:</b>
<br />query_places.c and add_crime
.c<br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_interval">
query_interval</a><pre class="autodocfuncdef">
int query_interval()
</pre><dd><br />
This is the interval in seconds between bursts of singing.<br />
<br /><dl>
<dd><b>Returns:</b>
<br />The interval
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_places">
query_places</a><pre class="autodocfuncdef">
string * query_places()
</pre><dd><br /><br />
<br /><dl>
<dd><b>Returns:</b>
<br />An array of the places where singing the hedgehog song is illegal<br /><br />
<dd><b>See also:</b>
<br />set_punishment_in_place
.c<br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="query_punishment_in_place">
query_punishment_in_place</a><pre class="autodocfuncdef">
string * query_punishment_in_place(string place)
</pre><dd><br />
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.<br />
<br /><dl>
<dd><b>Returns:</b>
<br />A ({ (object) string, (function) string }) pair or 0<br /><br />
<dd><b>See also:</b>
<br />query_crime_level.c and set_punishment_in_place
.c<br /><br /><dd><b>Example:</b>
<br/><pre>query_punishment_in_place( "/d/am/eight_sins/cochon" );</pre><br /></dl>

<dt class="autodocfuncname"><a name="remove_criminal">
remove_criminal</a><pre class="autodocfuncdef">
void remove_criminal(mixed criminal)
</pre><dd><br />
This method removes a criminal from the records in all places.
Useful for refresh and delete.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
criminal - The person whose criminal records are to be removed
<br />
<br />
<br /></dl>

<dt class="autodocfuncname"><a name="remove_criminal_from_place">
remove_criminal_from_place</a><pre class="autodocfuncdef">
void remove_criminal_from_place(string criminal,
                                string place)
</pre><dd><br />
This method removes a criminal from the records in a place.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
criminal - The person whose criminal records are to be removed<br />
place - The place from which the criminal's records are to be removed<br />
<br />
<dd><b>See also:</b>
<br />add_crime
.c<br /><br /><br /></dl>

<dt class="autodocfuncname"><a name="remove_place">
remove_place</a><pre class="autodocfuncdef">
void remove_place(string place)
</pre><dd><br />
This method totally removes a place from all records.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
place - The place that is to be removed
<br />
<br />
<br /></dl>

<dt class="autodocfuncname"><a name="remove_place_criminals">
remove_place_criminals</a><pre class="autodocfuncdef">
void remove_place_criminals(string place)
</pre><dd><br />
This method removes all criminal records from a place.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
place - The place where the "amnesty" is to be issued
<br />
<br />
<br /></dl>

<dt class="autodocfuncname"><a name="remove_place_punishment">
remove_place_punishment</a><pre class="autodocfuncdef">
void remove_place_punishment(string place)
</pre><dd><br />
This method removes a place from the list of places where
singing the song is illegal.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
string - place
<br />
<br />
<br /></dl>

<dt class="autodocfuncname"><a name="set_punishment_in_place">
set_punishment_in_place</a><pre class="autodocfuncdef">
int set_punishment_in_place(string place,
                            string obj,
                            string func)
</pre><dd><br />
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 :)<br />
<br /><dl>
<dd><b>Parameters:</b><br />
place - The place(*) where it is a crime to sing<br />
obj - The object(*) where func is defined<br />
func - The function(*) to be called when a crime is committed
(*) As strings.<br />
<br />
<dd><b>Returns:</b>
<br />0 if it fails, 1 if it registers.  Note that no evaluation is done<br /><br />
<dd><b>See also:</b>
<br />query_punishment_in_place
.c<br /><br /><dd><b>Example:</b>
<br/><pre>set_punishment_in_place( "/d/am", "/d/am/utils/am_hedgehog", "hedgehog_punishment" )</pre><br /></dl>

<dt class="autodocfuncname"><a name="verse">
verse</a><pre class="autodocfuncdef">
string * verse(int v)
</pre><dd><br /><br />
<br /><dl>
<dd><b>Parameters:</b><br />
v - The verse you want.  Valid range: [1, number_of_verses]<br />
<br />
<dd><b>Returns:</b>
<br />Array of strings, each string a row in the requested verse
<br /><br />
<br /></dl>

</dl>
[an error occurred while processing this directive]

