[Package Index | Mudlib Index | Effect Index]
This keeps track of who rented what rooms where and for how much.
After including
The most important function is the one that checks that someone
is allowed to enter.
Written by goldenthread Started 3 Sep y2k1
int check_entry( object player, object room )
it returns:
RENTAL_SUCCESS if the player rents the room successfully
RENTAL_NO_SUCH_ROOM if the room isn't on the books
RENTAL_ALREADY_RENTED if the room is rented to someone else
RENTAL_AVAILABLE if the player doesn't rent the room but it is available
Includes
This class includes the following files /include/room/room_rental.h, /include/money.h, /include/shops/bank.h and /include/am_time.hMethod index
Adds someone as allowed to enter a rented room
Adds a room to the handler with a rental cost.
Checks if a particular player is renting a particular room.
Clears the list of rooms available for rent.
Deletes a room from the handler
This handles evicting someone from a room and clearing the data associated
with this room rental.
Handles the actual renting of the room.
Evicts the tenant ( and guests ).
Returns the path of a room identified from a given short
Checks if someone is allowed to access a room
Returns the amount needed to pay for a rental
Returns a list of rooms available in a particular location.
Returns the time left for a room rental
Returns the name of whoever is renting the room specified.
Removes someone as allowed to enter a rented room
Removes the rented status from a room.
Public Functions
These are functions that everyone can access.
int add_allowed(string who,
string room)
Adds someone as allowed to enter a rented room
who - name of the person to add
room - the room to allow them in
int add_room(string path,
int cost,
object office,
int length)
Adds a room to the handler with a rental cost.
path - the path of the room to add to the handler
cost - the rental cost per day of this room
office - the current office
delete_room()
add_room( "/w/goldenthread/workroom", 1000000 )
int check_tenant(object player_ob,
object room_ob)
Checks if a particular player is renting a particular room.
returns:
RENTAL_SUCCESS if the player rents the room successfully
RENTAL_NO_SUCH_ROOM if the room isn't on the books
RENTAL_ALREADY_RENTED if the room is rented to someone else
RENTAL_AVAILABLE if the player doesn't rent the room but it is available
player_ob - the player object who you think might be renting the room
room_ob - the room object that you think the player might be renting
value dependent on success of check. See below for details
int clear_rooms(object office)
Clears the list of rooms available for rent.
office - the current office
WARNING: This clears all rooms bookable from this office.
int delete_room(string room,
object office)
Deletes a room from the handler
room - the path of the room that will be deleted from the handler
office - the current office
0 on success, 1 on failure
add_room()
int do_eviction(string room)
This handles evicting someone from a room and clearing the data associated
with this room rental.
room - the room to evict from
int do_rental(object player_ob,
string room,
object office)
Handles the actual renting of the room. If the prospective
tenant is already renting the room, it extends the rental.
returns:
RENTAL_SUCCESSFUL if the rental is successful
RENTAL_NO_SUCH_ROOM if the room isn't on the books
RENTAL_ALREADY_RENTED if someone else is renting the room already
RENTAL_NO_MONEY if the player hasn't enough money
player_ob - the player who is renting the room
room - the room that is to be rented
office - the current office
value dependent on success of rental. See below for details
remove_rental()
void evict_tenant(object room_ob)
Evicts the tenant ( and guests ).
room_ob - the room object
string get_room_from_short(string room_short)
Returns the path of a room identified from a given short
room_short - the short to query by
the path of the room
int is_allowed(string who,
string room)
Checks if someone is allowed to access a room
who - The person to add.
room - the room to check with
1 if they are, 0 otherwise
string query_current_renter(string room)
string query_key_property(string room)
int query_rental_length(string room)
string query_rental_length_string(string room)
int query_rental_value(string room)
Returns the amount needed to pay for a rental
room - the room being queried
rental amount
mapping query_rooms()
string * query_rooms_to_rent(object office)
Returns a list of rooms available in a particular location.
office - the office
a string ready for presentation to a player containing a
list of all rooms available in that office.
int query_time_left(string room)
Returns the time left for a room rental
room - the room to check with
-1 if no such room, 0 if no renter, the time left otherwise
string query_time_string(int time)
string query_who_rents(string room)
Returns the name of whoever is renting the room specified.
room - the short of the room you want to check
the short of the player who's renting the room
int remove_allow(string who,
string room)
Removes someone as allowed to enter a rented room
who - name of the person to add
room - the room to allow them in
int remove_rental(object room_ob)
Removes the rented status from a room. Should be called when the
time limit of the rental is over.
room_ob - the room object that is currently rented
0 on success, 1 on failure
do_rental()