[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/housing.c

A handler to track player houses. This handler should only be used for general houses that are available for sale or rent. Don't add club or special (eg. guildmaster) houses here or they'll get sold or rented :) The handler stores information about registered player houses, makes houses vacant if their owners are idle and charges rent on rented houses.

Written by Ceres

Includes

This class includes the following files /include/housing.h, /include/clubs.h, /include/nomic_system.h, /include/login_handler.h, /include/money.h, /include/player_handler.h, /include/shops/bank.h and /include/am_time.h

Method index

Public Functions

These are functions that everyone can access.

add_house
int add_house(string house,
              string * other_rooms,
              string address,
              string region,
              int type)

Add a new house to the handler.

Parameters:
house - the basename of the house
other_rooms - an array of other rooms in the house
address - a string for the address
region - the region (used for house sales)
type - an integer. 1 for owned, 0 for rented.

Returns:
1 for success, 0 for failure


add_rooms
int add_rooms(string house,
              string * rooms)

Add secondary rooms to a house.

Parameters:
house - the basename of the house
an - array of basenames for the rooms

Returns:
1 for success 0 for failure


clear_in_arrears
int clear_in_arrears(string house)

Mark a house as no longer being in arrears.

Parameters:
house - the base name of the house

Returns:
1 for success 0 for failure


for_sale_name
int for_sale_name(string name)

Test to see if the provided name is a reserved name for housing which is for sale.

Parameters:
name - Name to test

Returns:
1 if the name is reserved for the sale process, 0 otherwise


is_house_club
int is_house_club(string house)

This method checks to see if the house is a club house property.

Parameters:
house - the house to check for

Returns:
1 if it is club house property

See also:
query_vacant(), is_house_lease() and is_house_rental()


is_house_lease
int is_house_lease(string house)

This method checks to see if the house is a leaseable property.

Parameters:
house - the house to check for

Returns:
1 if it is lease property

See also:
query_vacant(), is_house_club() and is_house_rental()


is_house_rental
int is_house_rental(string house)

This method checks to see if the house is a rental property.

Parameters:
house - the house to check for

Returns:
1 if it is rental

See also:
query_vacant(), is_house_club() and is_house_lease()


is_owned
int is_owned(string house)

This function determines if the specific house is owned by someone properly and not for sale or under offer.

Parameters:
house - the house to look up

Returns:
1 if the house is owned

See also:
query_vacant()


modify_house
int modify_house(string house,
                 string * other_rooms,
                 string address,
                 string region,
                 int type)

Modify a houses information.

Parameters:
house - the basename of the house
other_rooms - an array of other rooms in the house
address - a string for the address
region - the region (used for house sales)
type - an integer. 1 for owned, 0 for rented.

Returns:
1 for success, 0 for failure


query_address
string query_address(string house)

Find out the address of a house.

Parameters:
house - The basename of the house

Returns:
the address.


query_all_housing_area_citizenships
mapping query_all_housing_area_citizenships()

This method returns all of the current mappings between the housing area and the citizenship. This should not be used for anything except debugging.

Returns:
all the housing area stuff


query_bank
string query_bank(string house)

Return which bank account rent will be removed from for a house.

Parameters:
house - The basename of the house

Returns:
the bank name.


query_city
string query_city(string house)

Query the city name for this house

Parameters:
house - the registered name of the house

Returns:
the city in which the house exists


query_house
int query_house(string house)

Check if a given house is registered.

Parameters:
house - The basename of the house

Returns:
1 if its registered, 0 otherwise.


query_housing_area_bank
string query_housing_area_bank(string area)

This method returns the current mappings between the housing area and the initial bank to use.

Parameters:
area - the area to check

Returns:
the initial bank used, DEFAULT_BANK if none set


query_housing_area_citizenship
string query_housing_area_citizenship(string area)

This method returns the current mappings between the housing area and the required citizenship.

Parameters:
area - the area to check

Returns:
the citizenship required, 0 if none


query_housing_area_place
string query_housing_area_place(string area)

This method returns the current mappings between the housing area and the money area ("Ankh-Morpork", "Counterweight Continent", etc) to use.

Parameters:
area - the area to check

Returns:
the money area used, DEFAULT_PLACE if none set


query_in_arrears
int query_in_arrears(string house)

Check to see if the house is in arrears.

Parameters:
house - the main registered room of the house

Returns:
-1 for unknown house, 0 for not in arrears, 1 for in arrears


query_lease
int query_lease(string house)

Find out when the lease ends

Parameters:
house - The basename of the house

Returns:
the time the lease ends.


query_main_room
string query_main_room(string room)

Query the main registered room for a given room in a house.

Parameters:
room - base_name() of the room to test

Returns:
The main registered room, or 0 if one cannot be found.


query_owner
string query_owner(string house)

Find out the current owner of this house.

Parameters:
house - The basename of the house

Returns:
the owners name.


query_owner_houses
string * query_owner_houses(string region,
                            string owner)

The list of houses owned by the specific person in the specific region.

Parameters:
region - the region to find the hosues in
owner - the owner of the houses

Returns:
the owners of the houses


query_previous_owner
string query_previous_owner(string house)

Query the previous owner (for while a house is up for auction)

Parameters:
house - the "main" registered room of the house

Returns:
0 for unknown house or no previous owner, else the previous owner name


query_region
string query_region(string house)

Find out the region a house is in for sale/rental purposes.

Parameters:
house - The basename of the house

Returns:
the region.


query_rooms
string * query_rooms(string house)

Get a list of the houses rooms.

Parameters:
house - The basename of the house

Returns:
a list of rooms.


query_street_exit
string query_street_exit(string house)

Query the non-player room to which trapped players can be transported

Parameters:
house - Registered name of the house

Returns:
0 on error (or unregistered exit), otherwise the exit.


query_type
int query_type(string house)

Find out the type of a house. ie. Whether it's rented or owned.

Parameters:
house - The basename of the house

Returns:
the type.


query_vacant
string * query_vacant(string region)

Function to get a list of houses that are vacant in a given region. This function is used by the auction system or other sales mechanism.

Parameters:
region - Region to list houses in

Returns:
a list of houses.

See also:
is_owned(), is_house_rental(), is_house_lease() and is_house_club()


query_value
int query_value(string house)

Find out the current value of a house.

Parameters:
house - The basename of the house

Returns:
the value.


recover_from_backup
int recover_from_backup(string backup_file)
remove_house
int remove_house(string house)

Remove a house from the list of houses

Parameters:
house - the basename of the house

Returns:
1 for success 0 for failure


remove_housing_area_citizenship
void remove_housing_area_citizenship(string area)

This method removes the mapping between a housing area and it's citizenship requirements.

Parameters:
area - the housing area to remove the link from


remove_rooms
int remove_rooms(string house,
                 string * rooms)

Remove secondary rooms from a house.

Parameters:
house - the basename of the house
an - array of basenames for the rooms

Returns:
1 for success 0 for failure


rename_house
int rename_house(string house,
                 string newhouse)

Rename a house. This will remove the "main" room and replace it with another.

Parameters:
house - the current basename of the house
newhouse - the new basename.


set_address
int set_address(string house,
                string address)

Set the address of this house.

Parameters:
house - The basename of the house
address - The new address of the house

Returns:
1 for success 0 for failure


set_bank
int set_bank(string house,
             string bank)

Set the bank account to be used for rent on this house.

Parameters:
house - The basename of the house
owner - The new bank to use

Returns:
1 for success 0 for failure


set_city
int set_city(string house,
             string city)

Set the city (display) name for this property

Parameters:
house - Base registered name of the property
city - Display name for the city

Returns:
1 on success, 0 on failure


set_for_sale
int set_for_sale(string house)

Mark a house as being For Sale this puts it in the list of possible houses to go into the vacant list.

Parameters:
house - the basename of the house

Returns:
1 for success 0 for failure


set_housing_area_citizenship
void set_housing_area_citizenship(string area,
                                  string citizenship)

This method sets a mapping between a housing area and the citizenship required to hold a house there.

Parameters:
area - the housing area to link
citizenship - the citizenship the housing area needs


set_housing_area_money
void set_housing_area_money(string area,
                            string bank,
                            string place)

This sets the type of money to use for the specific housing area. It also sets the default bank for the region.

Parameters:
area - the area to set the money for
bank - the default bank to use
place - the money type to use (coinage)


set_in_arrears
int set_in_arrears(string house)

Mark a house as being in arrears. This is the step just prior to being repossessed.

Parameters:
house - the basename of the house

Returns:
1 for success 0 for failure


set_lease
int set_lease(string house,
              int lease)

Set the term of the lease if the property is leased.

Parameters:
house - The basename of the house
lease - The time the lease ends. If this is zero the default will be applied.


set_owner
int set_owner(string house,
              string owner)

Set the owner of this house.

Parameters:
house - The basename of the house
owner - The new owner of the house

Returns:
1 for success 0 for failure


set_region
int set_region(string house,
               string region)

Set the region of this house.

Parameters:
house - The basename of the house
region - The new region of the house

Returns:
1 for success 0 for failure


set_street_exit
int set_street_exit(string house,
                    string exit)

Set the street exit for the house

Parameters:
house - base registered name of the property
exit - The non-player room to which a player can be safely sent.

Returns:
0 on failure, 1 on success


set_type
int set_type(string house,
             int type)

Set the type of a house. ie. Whether it's rented or owned. (2 for leased, 1 for rented, 0 for owned).

Parameters:
house - The basename of the house

Returns:
the type.


set_under_offer
int set_under_offer(string house)

Mark a house as being Under Offer (to prevent anyone else trying to sell it too.

Parameters:
house - the basename of the house

Returns:
1 for success 0 for failure


set_value
int set_value(string house,
              int value)

Set the value of a particular house.

Parameters:
house - the basename of the house
value - the value in monetary units.

Returns:
1 for success 0 for failure