[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/secure_handlers/inhume.c

Inhumation handler The process is as follows. 1) Someone requests a contract. 2) When the inhumee next logs in, certain info is calculated from them: guild level, PK status, etc. 3) If the contractor is logged in at that time, they are told whether the contract was accepted, how much the contract will cost, and they are given instructions on how and where to pay. 4) The contractor pays at any of the guild branches. 5) The contracter may submit a message at this point which will be passed on to the inhumee when the contract is filled. Once the contract as been paid, it is open for collection by any graduated assassin. Once the assassin has inhumed the inhumee, they can collect their wages at the inhumation office. If the assassin does not collect their payment within a certain time, it expires. If paid contracts expire, the requestor receives a mail and is told to collect their refund, minus a service charge. If a contract is in the "Informed" state -- that is, the contractor has been told how much to pay, but has not yet done so, any PK may confirm the contract, and they become the bastard of record (the "owner" of the contract). If they try to pay and a contract has not been placed, or they do not have enough money, they will not be given any information. In other words, you can't go round trying to confirm contracts on all your friends to check if they've got contracts on them. Contract costs are based on the guildlevel of the subject, their levels in specific anti-inhumation skills, and how many lives they have left. There is no minimum level for contracts; any PK is eligible. It will cost a large amount more if the victim is on their last life. There is also the provision for 'warning' contracts - much cheaper contracts which do not take a life. The Guild Enforcer System: Special contracts are placed either automatically (for killing or stealing on Guild property ) or by the Guildmaster. Placing a special contract on a non-guildmember by the GM also requires the support of a housemaster. Special contracts have a 0 value. Once a Special contract is in place, any Guild Enforcer may attempt to close it. The roster of enforcers is controlled by the Guildmaster.

Written by shrike Originally written by Ceres, in October '95. Modified by Turrican to use classes instead of fixed key mappings 3-5-96. Modified extensively by Shrike in Oct-Dec. 1999, to add the Guild Enforcer system, customizable receipts, and divers alarums. Oh yeah, I also autodoc'ed the damn thing.

Includes

This class includes the following files /include/player_handler.h, /include/playtesters.h, /include/mail.h, /include/money.h, /include/login_handler.h, /include/guilds.h, /include/inhume.h, /include/player.h, /include/playerinfo.h, /include/assassin.h and /include/shops/bank.h

Class Index

Method index

Public Functions

These are functions that everyone can access.

activate_insurance
nomask int activate_insurance(string player)

Transfer someone who is on the moeny-back trial period to full membership. This sets up the sacrosanct mapping entry, and pays the money into the coffers.

Parameters:
player - The name of the player to activate

Returns:
1 for success, 0 if it couldn't do it.


add_collect
nomask void add_collect(string who,
                        string target,
                        int refund,
                        int value,
                        int time)

Manually set up a payment for someone. This function is access controlled.

Parameters:
who - The person who the payment is for.
target - The name of the player who was inhumed (or 0 if it's a refund).
refund - Flag indicating whether this is a refund (or a payment).
value - Monetary value of the payment.
time - Timestamp for the payment.


add_contract
nomask varargs void add_contract(mixed player,
                                 int stat,
                                 string message,
                                 int nodeath)

Add a contract to the player. Generally this is used to add Special contracts, but it can be used to add any kind of contract. For special contracts, this will also keep a running tab of what crimes were committed by the player. This function is access-controlled.

Parameters:
player - The player object/name to add the contract to
stat - The status of the contract. Must be between 0 and 4


add_contract_with_details
nomask int add_contract_with_details(string sucker,
                                     class contract record)

Add a contract to the books with all the details already filled in.

Parameters:
sucker - Who the contract is on.
record - The intended contract class.

Returns:
1 for success, 0 for failure.


add_enforcer
nomask int add_enforcer(string name)

Add a player to the roster of Guild Enforcers. Returns 1 for success, 0 if that player is already an enforcer, or -1 if the player is not an assassin. This function is access-controlled.

Parameters:
name - The name of the player to add

Returns:
1, 0, or -1 as above


add_git
nomask int add_git(string who)

Add (or update) a player's ledger of crimes against the guild. This function is access-controlled.

Parameters:
who - name of the player to add

Returns:
an integer count of the number of the player's crimes to date.


add_npc_contract
nomask int add_npc_contract(string npc,
                            string requested)

Add a contract on the given NPC. If it's not a valid npc (ie not in the npc mapping), then fail. This function is access-controlled.

Parameters:
npc - the query_name of the NPC on whom a contract should be placed.

Returns:
-1 if the NPC is not in the mapping, 0 if there is already a contract, or 1 for success.


add_npc_contract_details
nomask int add_npc_contract_details(string name,
                                    string short,
                                    int val,
                                    int auto)

Add an NPC to the mapping of inhumable targets. This function is access-controlled.

Parameters:
name - The NPC's set_name
short - The NPC's proper name, as it should appear in the books
val - the value of the contract, in AM dollars
auto - Set to 1 if this NPC should be on the list of automatically generated contracts.

Returns:
0 if there's something wrong with the parameters, -1 if there's already an NPC on file with that set_name, 1 if successful.


add_sacrosanct
nomask varargs void add_sacrosanct(string who,
                                   int days,
                                   int counter)

Mark someone as not able to be inhumed. They will be unable to be contracted until time() > duration. This function is access-controlled.

Parameters:
who - Name of the person not to be inhumed
days - Length of time that the player will be protected, in days.
counter - What to set the counter to. if this parameter is nonzero, duration will be taken to be a time, and directly added into the sacrosanct entry.


allowed_to_contract
nomask int allowed_to_contract(object bastard)

Check to make sure that this player is allowed to place contracts. They are not allowed if they are disavowed from the assassinsguild, or if they have the "cannot place contracts" property on them.

Parameters:
bastard - the player object to check

Returns:
1 if they are allowed, 0 if not allowed.


award_contract
nomask void award_contract(string sucker,
                           string assassin)

Take a currently active contract and remove it from the books, and give the assassin credit for closing it. This will set up payments and keep the certificate up to date. This function is access controlled.

Parameters:
sucker - Name of the person whose contract should be closed.
assassin - Name of the assassin to give the credit to.


calc_collect_value
nomask int calc_collect_value(string who,
                              int aftertax)

Figure out how much a given person is owed, either pre or post taxes and fees.

Parameters:
who - The name of the player to calculate the value for
aftertax - Do we want pre- or post-tax value?

Returns:
the value owed, in brass coins (monetary units)


calc_collect_value_matrix
nomask int * calc_collect_value_matrix(string who)

Returns either a 2-element integer array in the form ({ pretax, posttax }) or 0 if the person does not have any money owing.

Parameters:
who - The name of the player to check

Returns:
the pre and post tax amounts owed, or 0


calc_contract_cost
nomask int calc_contract_cost(object sucker)

Calculate how much the guild will charge for a contract on this player. This is based on guild level and anti-inhumation skills. This figure will then be massaged by validate_contract.

Parameters:
sucker - the player object to calculate the cost for.


calc_place
nomask string calc_place(object player)

This is used to pass in a location to the money handler.

Parameters:
player - The player object to check

Returns:
The player's location, or "default" if it cannot be determined


calc_protection_cost
nomask int calc_protection_cost(object wimp,
                                int duration)

Figure out the protection cost for a given player for a given number of days.

Parameters:
wimp - The player object to check
duration - The number of days to check the cost for

Returns:
The cost, in brass coins


can_close_players
nomask int can_close_players(string who)

Determine whether or not a given player is allowed to view or close PK contracts. This is determined by age, guild level, number of (NPC) contracts closed, and whether or not the player handler says the assassin is active.

Parameters:
who - the name of the player to check.

Returns:
1 if they are allowed to handle PKs, 0 otherwise.


check_last_inhumed
nomask int check_last_inhumed(string who)

Check the last_inhumed entry for this player to see if it's still active.

Parameters:
who - The name of the player to check

Returns:
1 if they are still under protection, 0 if it has expired.


check_sacrosanct
nomask int check_sacrosanct(string who)

Check whether someone has been marked as not allowed to be inhumed. This function is access-controlled.

Parameters:
who - Player's name

Returns:
1 if they are not allowed to be inhumed, 0 otherwise.


clear_collect
nomask void clear_collect(string player)

Remove the collection entry for a player. This function is access-controlled.

Parameters:
player - The name of the player


clear_contract
nomask void clear_contract(string player)

Remove a contract for the given player/npc. Does not return any money if it's active -- use expire_contract if that's what you want to do. This function is access-controlled.

Parameters:
player - The name of the player


clear_git_entry
nomask mixed clear_git_entry(string who)

Remove a player from the gits mapping. Returns 0 if they were not in the mapping, or a copy of the entry if they were successfully removed. This function is access-controlled.

Parameters:
who - the name of the player to exonerate

Returns:
0 or int *


clear_last_inhumed
nomask void clear_last_inhumed(string player)

Remove the last_inhumed entry for a player. This function is access-controlled.

Parameters:
player - The name of the player


clear_npc_inhumed
nomask int clear_npc_inhumed(string name)

Clear the last inhumed entry for an NPC. This function is access controlled.

Parameters:
who - the name of the NPC to clear.

Returns:
1 if successful, 0 otherwise.


clear_sacrosanct
nomask int clear_sacrosanct(string who)

Admin function to clear a sacrosanct mapping entry. This function is access-controlled.

Parameters:
who - the name of the player to clear

Returns:
1 if successful, 0 otherwise.


collect_payment
nomask string collect_payment(object collector)

Handle the payment of wages for inhumations performed. This also handles returning the cash in the event of an expired contract.

Parameters:
collector - The player object doing the collecting

Returns:
The success/fail message


collect_type
nomask int collect_type(string who)

Figure out whether the given person has refunds, payments, or both waiting for them.

Parameters:
who - The name of the person to check.

Returns:
An integer code.


convert_old_contracts
nomask void convert_old_contracts(string reason)

Used to convert the older existing contracts whenever the contract class changes. Always add data members at the end, and they should be initialized within convert_contract().

Parameters:
reason - A note to go into the log file of why the contracts are being updated.


cost_inform_callback
void cost_inform_callback(string p_name,
                          string type)

Called by the login handler. This sets up the validation and inform processes. Do not call this function unless you really know what you're doing. This means you.

Parameters:
p_name - The name of the player who is entering Discworld
type - The login type, one of login, logout, netdeath, or reconnect


decrement_crimes_for
nomask int decrement_crimes_for(string who)

Add (or update) a player's ledger of crimes against the guild. This function is access-controlled.

Parameters:
who - name of the player to update

Returns:
an integer count of the number of the player's remaining crimes.


delayed_contract
nomask void delayed_contract(string sucker)

A player has logged in after a contract was requested. Validate it and inform the bastard who requested it.

Parameters:
sucker - The player who is contracted


delete_enforcer
nomask int delete_enforcer(string name)

Remove a player from the list of Guild Enforcers. Returns 0 if they're not an enforcer to begin with, 1 if they were successfully deleted from the enforcer array. This function is access-controlled.

Parameters:
name - The name of the player to remove

Returns:
1 or 0 as above


deposit_value_in_coffer
nomask int deposit_value_in_coffer(int amt)

Add some money into the guild coffers. This function is access-controlled.

Parameters:
amt - Amount of money, in base (brass coin) units.

Returns:
The new amount in the coffer.


donate_money
nomask string donate_money(object philanthropist,
                           mixed m_array,
                           string place)

This function interfaces directly with the secretaries, like pay_for_contract and new_contract. It pays a certain amount of money directly into the coffers. This function is access-controlled.

Parameters:
philanthropist - the player object doing the donating
value - how much money
place - what currency it's being paid in

Returns:
A string for the secretary to say.


entering
void entering(string p_name,
              string type)

Called by the login handler. This sets up the validation and inform processes. Do not call this function unless you really know what you're doing. This means you.

Parameters:
p_name - The name of the player who is entering Discworld
type - The login type, one of login, logout, netdeath, or reconnect


expire_contract
nomask void expire_contract(string sucker)

This function is used to expire a contract. This will remove it from the books, and if it is active, return the money to the bastard who paid for it. (note that this is not necessarily the person who requested it) This function is access-controlled.

Parameters:
sucker - Which contract to expire


finish_up
nomask void finish_up(string str,
                      string message,
                      string sucker)

Get the text of the message, and store it in the contract info.

Parameters:
message - The contents of the message
sucker - The name of the contracted player
str - The input to be parsed for yes/no


get_message_text
nomask void get_message_text(string message,
                             string sucker)

Get the text of the message, and then pass it on to finish_up.

Parameters:
message - The contents of the message
sucker - The name of the contracted player


inform_cost
nomask void inform_cost(string sucker)

Inform the contractor of the cost of the contract and ask them to go pay up if it was accepted, or tell them why it was rejected.

Parameters:
sucker - The target player's name


inform_customer
nomask void inform_customer(string bastard)

Send a message off to someone who has had at least one contract closed for them recently.

Parameters:
bastard - The name of the player to inform.


is_inhume_on_sight
nomask int is_inhume_on_sight(string who)

Check if a player is inhume-on-sight This function is access-controlled.

Parameters:
who - the name of the player to check

Returns:
1 if they are inhume-on-sight, 0 if they are not


list_contractable_npcs
nomask string list_contractable_npcs(string place)

Give a nicely formatted table of NPCs that you can request contracts on, and prices.

Parameters:
place - the money area to calculate prices for.

Returns:
the formatted table as a string.


list_enforcers
nomask string list_enforcers()

Get a nice formatted string containing the names of the Guild Enforcers. This function is access-controlled.

Returns:
The formatted string


list_inhumes
nomask string list_inhumes(string assassin)



Parameters:
assassin - The name of the assassin to query

Returns:
A record of the assassin's inhumes (formatted string)


list_sacrosanct
nomask mapping list_sacrosanct()

Query the entire sacrosanct mapping. This function is access-controlled.

Returns:
the sacrosanct mapping.


make_receipt
nomask void make_receipt(object corpse,
                         string name)

This is the code that makes the receipt that's left on the bodies of inhumed victims. NPC targets don't get a receipt.

Parameters:
corpse - The corpse object into which the card should be moved
name - The name of the person who was just inhumed


new_contract
nomask string new_contract(object bastard,
                           string sucker,
                           int nodeath)

Setup a new contract. Do some rudimentary checks and then wait until the sucker logs in. Things are continued by delayed_contract.

Parameters:
bastard - The person requesting the contract
sucker - The person it's being requested on

Returns:
A string describing the status of the contract


ok_to_contract_npc
nomask int ok_to_contract_npc(string name)

Figure out if it's ok to place a contract on this NPC yet.

Parameters:
name - the name of the NPC to check.

Returns:
1 if it's ok, 0 oterwise.


ok_to_inhume
nomask int ok_to_inhume(object assassin,
                        object victim)

Check to see if the assassin can inhume the victim at this time. This is based on the guild levels of each party, and the time elapsed since the contract became active.

Parameters:
assassin - The attempting assassin
victim - The intended victim


pay_for_contract
nomask string pay_for_contract(string sucker,
                               object bastard)

Setup a validated contract. If you have not requested the contract, but you are PK and have enough money on you, you are allowed to pay. However, you will get no information about the contract if you do not have enough money on you to pay for it.

Parameters:
sucker - The person whose contract is being paid for
bastard - The player object doing the paying.

Returns:
A success/fail message


pay_protection_money
nomask string pay_protection_money(object wimp,
                                   int duration)

This function interfaces directly with the secretaries, like pay_for_contract and new_contract. It pays a certain amount of money into the protection account for the player, a portion of that money going to the guild coffers. This function is access-controlled.

Parameters:
wimp - The player object requesting protection
amt - How much to pay (in brass coins)
duration - The length of time (in days) the protection will be active.

Returns:
A string for the secretary to say.


payment_table
nomask string payment_table(string who)

Return a list of payments awaiting the given player. This function is access controlled.

Parameters:
who - The player to check.

Returns:
a string containing the list of payments.


player_deleted
nomask void player_deleted(mixed player,
                           int totally)

This is called by the refresh handler when a player deletes. I can't think of any reason why you would ever need to call this on your own, though, so you probably shouldn't.

Parameters:
player - The player object/name
totally - Int flag. 1 if the refresh was total, 0 if partial. Not used.


player_refreshed
nomask varargs void player_refreshed(mixed player,
                                     int totally,
                                     int deleted)

This is called by the refresh handler when a player refreshes. I can't think of any reason why you would ever need to call this on your own, though, so you probably shouldn't.

Parameters:
player - The player object/name
totally - Int flag. 1 if the refresh was total, 0 if partial. Not used.
deleted - Set to 1 if the player deleted instead of just refreshing.


query_all_contracts
nomask string query_all_contracts()

Return a list of all the current contracts. Creators get a more thorough rundown of information, including times and requestors' names. Players only see Active and Informed contracts, and if they're Guild Enforcers, they see Special contracts as well. This function is access-controlled.

Parameters:
display_players - set to 1 if we are displaying player contracts.

Returns:
A formatted string containing the contract listings


query_all_messages
nomask string query_all_messages()

Get a list of all currently-active messages. This function is access-controlled.

Returns:
the formatted string


query_benefactors
mapping query_benefactors()
query_coffer
nomask int query_coffer()

Check how much money is in the Guild coffers. This function is access-controlled.

Returns:
Amount of money, in base (brass coin) units.


query_contract
nomask int query_contract(string who)

Admin function to check the status of a contract

Parameters:
who - Player's name

Returns:
The status of the contract, as defined in


query_contract_date
nomask int query_contract_date(string who)

Admin function to check the date of a contract. This is the last time when progress was made, so it changes as the contract is validated, accepted, and paid for.

Parameters:
who - Player's name

Returns:
The date, in integer format


query_contract_info
nomask string query_contract_info(string who)

Admin function to check the details of a contract. This returns a nicely formatted string detailing the contract's specifics. This function is access-controlled.

Parameters:
who - Player's name

Returns:
The formatted string


query_contract_nodeath
nomask int query_contract_nodeath(string who)

Admin function to check whether a contract is of the no-loss-of-life variety.

Parameters:
who - Player's name

Returns:
0 if it's a 'normal' contract, 1 if the target won't lose a life.


query_contract_value
nomask int query_contract_value(string who)

Admin function to check the value of a contract.

Parameters:
who - Player's name

Returns:
The value in monetary units


query_contracts_by
nomask string * query_contracts_by(string player)

This method returns a list of all the people that this person has put a contract on. This function is access-controlled.

Parameters:
bastard - the person who placed the contract

Returns:
the list of contracts they placed


query_contracts_in_state
nomask string * query_contracts_in_state(int status)

This method returns a list of all the people that have a contract in a given status.

Parameters:
state - The status of the contracts to list.

Returns:
the list of contracts in that state.


query_enforcer
nomask int query_enforcer(string pname)

Check if a given player is a Guild Enforcer. This function is access-controlled.

Parameters:
pname - The name of the assassin to query

Returns:
1 if they are a Guild Enforcer, 0 if not.


query_enforcers
nomask string * query_enforcers()

List all Guild Enforcers. This function is access-controlled.

Returns:
The array of enforcers' names


query_git
nomask int * query_git(string who)

Return the git info for a given player. Format is ({ number_of_offenses, last_offense_time }) This function is access-controlled.

Parameters:
who - player name to query

Returns:
an integer array, or 0 if they are not in the books.


query_gits
nomask mapping query_gits()

Return a mapping with all the git-info. Format of each entry is ({ number_of_offenses, last_offense_time })

Returns:
a copy of the git mapping.


query_inhumations
nomask mapping query_inhumations(string who)

Used by the certificate.

Returns:
The inhumed mapping.


query_inhume_record
nomask mapping query_inhume_record(string assassin)



Parameters:
assassin - The name of the assassin to query

Returns:
A record of the assassin's inhumes, in the format (["name":val])


query_npc_contract
nomask class npc_contract query_npc_contract(string name)

Get the information for an NPC contract.

Parameters:
name - The name of the NPC to query.

Returns:
a 2-element array of the form ({ short, value (in AM dollars) }).


query_npc_contracts
nomask mapping query_npc_contracts()

List all the possible NPC contracts.

Returns:
a mapping with all the NPC contract information in it.


query_npc_time
nomask int query_npc_time(string name)

Report the timestmp of this NPC's last inhumation.

Parameters:
name - the name of he NPC to check.

Returns:
0 if the NPC is not in the list, or the time.


query_offenses
nomask string query_offenses(string player)

Return a nicely formatted list thingie of a person's offenses for their Special contract.

Parameters:
player - The name of the player

Returns:
The formatted result string


query_payments
nomask string query_payments(object who)

If the calling object is a cre, this will return a complete listing of payments due. Otherwise it will only return what payments are due to the calling player. This function is access-controlled - if you are not on the authorized list you will not see everyone's collection info.

Returns:
a formatted list of all the outstanding collections.


query_requested_or_paid
nomask int query_requested_or_paid(string sucker,
                                   string bastard)

Check whether the bastard requested or paid for the contract on the sucker. This function is access-controlled.

Parameters:
sucker - The contract in question
bastard - The person to check for involvement

Returns:
-1 if there is no contract on sucker, 0 if bastard is not involved, 1 if they are.


query_special_contracts
nomask string * query_special_contracts()

Get a listing of all Special contracts.

Returns:
An array of names


query_times_killed
nomask int query_times_killed(string killer,
                              string sucker)

How many times has the assassin inhumed a particular victim?

Parameters:
killer - The name of the assassin
sucker - The name of the victim

Returns:
The number of times killer has inhumed victim


refund_insurance
nomask int refund_insurance(string player)

Take an entry that's in the money-back trial period and refund the money to the player.

Parameters:
player - The name of the player to refund

Returns:
1 for success, 0 if it couldn't do it.


remove_npc_contract
nomask int remove_npc_contract(string name)

Remove an NPC from the mapping of inhumable targets. This function is access-controlled.

Parameters:
name - The NPC's set_name

Returns:
0 if name is 0 or there's no NPC on file with that set_name, 1 if successful.


request_npc_contract
nomask string request_npc_contract(object bastard,
                                   string sucker)

Internal function for requesting an NPC contract.

Parameters:
bastard - the player object doing the requesting.
sucker - who to request the contract on.

Returns:
a string for the secretary to say back to you.


set_contract_bastard
nomask void set_contract_bastard(string sucker,
                                 string bastard,
                                 string reason)

Admin function to change the current bastard of the contract. This function is access-controlled.

Parameters:
sucker - The target of the contract
bastard - The name to change the bastard of record to
reason - Reason for changing the bastard (this is mandatory)


set_contract_nodeath
nomask int set_contract_nodeath(string sucker,
                                int nodeath)
set_contract_status
int set_contract_status(string who,
                        int status)

Sets the status of a contract. Use this with caution, as you can really bugger things up if you don't know what you're doing.

Parameters:
who - Who the contract is on.
status - The new status.

Returns:
The new status of the contract, or a negative error code.


set_npc_auto_flag
int set_npc_auto_flag(string name,
                      int val)

Set the automatic flag for an NPC contract. Any value != 0 will be interpreted as 1. This funtion is access controlled.

Parameters:
name - the NPC's name to alter.
val - The new value for the flag.

Returns:
-1 if that npc is not in the books, 0 if the flag was already set to that value, 1 if it was changed.


someone_inhumed
nomask varargs void someone_inhumed(object sucker,
                                    object killer,
                                    int nocorpse)

Called every time someone is inhumed, by the inhume command. It sets up collection mappings as appropriate, and also updates inhume records and last_inhumed entries. Removes the contract from the books.

Parameters:
sucker - The poor sap who was just inhumed.
killer - Guess.


special_contract_table
nomask string special_contract_table()

Get a nicely-formatted, sorted, columnar table of special contracts.

Returns:
The sorted table of names


submit_message
nomask void submit_message(string sucker)

Called when a player decides to submit a message annotation to a contract. Collects some input and then calls get_message_text to continue.
tidy_up
nomask void tidy_up()

This is the bookkeeping function. It handles expiring old contracts and collections, as well as adding periodic NPC contracts. Please don't call this function unless you know exactly what it does.

Classes

These are nice data types for dealing with... Data!