[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/library.c

The library is a sort of information center. Currently it supports only the recording on stories about players and recording the quests that they have done.

See also:
/include/library.h

Written by Furball

Includes

This class includes the following files /include/player.h, /include/move_failures.h, /include/player_handler.h, /include/playtesters.h and /include/quest_handler.h

Class Index

Method index

Public Functions

These are functions that everyone can access.

calculate_quest_points
void calculate_quest_points(string name)
delete_player_quest_info
mixed delete_player_quest_info(string pl_name,
                               string qu_name)

This method deletes all quest info for a quest for the specific player.

Parameters:
pl_name - the player name
qu_name - the quest name


flush_cache
void flush_cache(string name)
get_most_recent_quest
string get_most_recent_quest(string name)

This method returns the most recently completed quest by the player.

Parameters:
name - the player name

Returns:
the most recently completed quest


get_most_recent_time
int get_most_recent_time(string name)

This method get sthe most recent time a quest was complete by the player.

Parameters:
name - the name of the player

Returns:
the time of the most recently completed quest


query_active_quest_points
int query_active_quest_points(string name)

This method returns the current number of quest points gathered by the player for active quests.

Parameters:
name - the player

Returns:
the current number of inactive quest points

See also:
/obj/handlers/query_handler->query_quest_level()


query_all_player_quest_info
mapping query_all_player_quest_info(string pl_name)

This method returns all the quest information for a player. This information is used for quests which have several parts to them and information needs to be stored about the player as they attempt to complete it. The keys of the mapping are the quest names and the values are the information associated with the quest.

Parameters:
pl_name - the name of the player

Returns:
the mapping containing all the quest info


query_inactive_quest_points
int query_inactive_quest_points(string name)

This method returns the current number of quest points gathered by the player for inactive quests.

Parameters:
name - the player

Returns:
the current number of inactive quest points

See also:
/obj/handlers/query_handler->query_quest_level()


query_player_quest_info
mixed query_player_quest_info(string pl_name,
                              string qu_name)

This method returns the quest info for a specific quest. This information is used for quests which have several parts to them and information needs to be stored about the player as they attempt to complete it.

Parameters:
pl_name - the player name
qu_name - the quest name

Returns:
the information associated with the quest


query_quest_done
int query_quest_done(string player,
                     string quest)

This method tells us if the player has completed the quest.

Parameters:
player - the name of the player
quest - the quest name

Returns:
1 if the quest has been done, 0 if it has not


query_quest_points
int query_quest_points(string name)

This method returns the current number of quest points gathered by the player for both active and inactive quests.

Parameters:
name - the player

Returns:
the current number of quest points

See also:
/obj/handlers/query_handler->query_quest_level()


query_quest_time
int query_quest_time(string name,
                     string qu_name)

This method returns the time at which a quest is completed.

Parameters:
name - the name of the player to get the time for
qu_name - the name of the quest

Returns:
the time at which it is completed


query_quests
string * query_quests(string name)

This method returns the set of currently completed quests by the player.

Parameters:
name - the name of the player

Returns:
the array of completed quests


query_story
string query_story(string name)

This method returns the story associated with the player. This is created from all the information about the quests they have done joined together into a neato story.

Parameters:
name - the player name

Returns:
the story of the player

See also:
/obj/handlers/quest_handler->query_quest_story()


query_title
string query_title(string name)

This method returns the players current title.

Parameters:
name - the name of the player

Returns:
their current title, 0 if no title

See also:
/obj/handlers/quest_handler.c


restart
int restart(mixed name)

This method is called when a player refreshes totaly so they can start again from scratch.

Parameters:
name - the player name

Returns:
0 if they do not exists, 1 if they do


save_them
void save_them(object thing)

This method causes the player to be saved.

Parameters:
thing - the player to save


set_player_quest_info
void set_player_quest_info(string pl_name,
                           string qu_name,
                           mixed details)

This method sets the information related to the players quest. This information is used for quests which have several parts to them and information needs to be stored about the player as they attempt to complete it.

Parameters:
pl_name - the name of the player
qu_name - the quest name
details - the information associated with the quest.


set_quest
int set_quest(string pl_name,
              string qu_name,
              int no_xp)

This method sets the player as having done the quest and if we should give them xp for it This function should be called when a quest is finished. It will then call the quest_completed function on the quest handler and do all assorted modifications to the player object etc. The name should be the players name and the quest should be the name of the quest that is stored in the quest handler.

The include file should be used for calls to this handler.

Parameters:
pl_name - name of the player
qu_name - name of the quest
no_xp - do not give out xp

Returns:
0 if the quest is already completed

See also:
/obj/handlers/quest_handler->quest_completed()

Example:
// Set the player as completing the womble friend quest, they get
// xp for it.
LIBRARY->set_quest(this_player()->query_name(), "womble friend", 0);

unset_quest
varargs int unset_quest(string pl_name,
                        string qu_name,
                        int reset_info)

This method removes a quest from the players list of completed quests.

Parameters:
pl_name - the player name
qu_name - the quest name
reset_info - If true quest info for the quests will be reset

Returns:
0 if they have not done the quest, 1 if they habe

See also:
/obj/handlers/quest_handler.c


unset_quests
varargs int * unset_quests(string pl_name,
                           string * qu_names,
                           int reset_info)

This method removes a set of quests from the players list of completed quests.

Parameters:
pl_name - the player name
qu_names - the quest names
reset_info - If true quest info for the quests will be reset

Returns:
An array of corresponding 0 if they have not done the quest, 1 if they have

See also:
/obj/handlers/quest_handler.c


Classes

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