Planeshift
Public Member Functions

psCharacterQuestManager Class Reference

Class to manager a characters quest details. More...

#include <pscharquestmgr.h>

List of all members.

Public Member Functions

QuestAssignmentAssignQuest (psQuest *quest, PID assignerId)
 Assign a quest.
bool CheckQuestAssigned (psQuest *quest)
 Checks to see if a quest has been assigned.
bool CheckQuestAvailable (psQuest *quest, PID assignerId)
 This incorrectly named function checks if the npc (assigner_id) is supposed to answer in the (parent)quest at this moment.
bool CheckQuestCompleted (psQuest *quest)
 Checks to see if a quest has been completed.
bool CompleteQuest (psQuest *quest)
 Complete a quest.
bool DiscardQuest (psQuest *quest, bool force=false)
 Discard a quest.
void DiscardQuest (QuestAssignment *q, bool force=false)
 Discard a quest.
int GetAssignedQuestLastResponse (size_t i)
 Get the response of a particular quest.
size_t GetAssignedQuests (psQuestListMessage &quests, int cNum)
 Create a network message for all the assigned quests.
csArray< QuestAssignment * > & GetAssignedQuests ()
 Get a list of quests.
size_t GetNumAssignedQuests ()
 Gets the number of currently assigned quests.
void Initialize (psCharacter *owner)
 Setup this manager for a character.
QuestAssignmentIsQuestAssigned (int id)
 Check to see if a quest is assigned.
bool LoadQuestAssignments ()
 Load the quests from the database.
int NumberOfQuestsCompleted (csString category)
 Checks to see how many quests complete.
bool SetAssignedQuestLastResponse (psQuest *quest, int response, gemObject *npc)
 Set an assigned quest last response.
bool UpdateQuestAssignments (bool forceUpdate=false)
 Update the quest assignment list.
 ~psCharacterQuestManager ()
 Destroy the manager and delete all the assigned quests.

Detailed Description

Class to manager a characters quest details.

Definition at line 90 of file pscharquestmgr.h.


Constructor & Destructor Documentation

psCharacterQuestManager::~psCharacterQuestManager ( )

Destroy the manager and delete all the assigned quests.


Member Function Documentation

QuestAssignment* psCharacterQuestManager::AssignQuest ( psQuest quest,
PID  assignerId 
)

Assign a quest.

This assigns a quest to the character.

Parameters:
questThe quest object that will be assigned to the character.
assignerIdThe PID of the character that assigned the quest.
Returns:
A QuestAssignement object for the quest.
bool psCharacterQuestManager::CheckQuestAssigned ( psQuest quest)

Checks to see if a quest has been assigned.

Parameters:
questThe quest object to check if is assigned or not.
Returns:
true if the quest status is PSQUEST_ASSIGNED
bool psCharacterQuestManager::CheckQuestAvailable ( psQuest quest,
PID  assignerId 
)

This incorrectly named function checks if the npc (assigner_id) is supposed to answer in the (parent)quest at this moment.

Parameters:
questThe quest object to check.
assignerIdThe character that assigned the quest.
Returns:
True if the assigner is supposed to answer?
bool psCharacterQuestManager::CheckQuestCompleted ( psQuest quest)

Checks to see if a quest has been completed.

Parameters:
questThe quest object to check if it has been completed or not.
Returns:
true if the quest status is PSQUEST_COMPLETE
bool psCharacterQuestManager::CompleteQuest ( psQuest quest)

Complete a quest.

This sets a quest as completed for this character.

Parameters:
questThe quest object that was completed.
Returns:
true if the quest complete was successful, false otherwise.
void psCharacterQuestManager::DiscardQuest ( QuestAssignment q,
bool  force = false 
)

Discard a quest.

Parameters:
qThe QuestAssignment object for the quest we want to discard.
forceForce the quest to be discarded regardless of any conditions.
bool psCharacterQuestManager::DiscardQuest ( psQuest quest,
bool  force = false 
)

Discard a quest.

Parameters:
questThe Quest object for the quest we want to discard.
forceForce the quest to be discarded regardless of any conditions.
int psCharacterQuestManager::GetAssignedQuestLastResponse ( size_t  i)

Get the response of a particular quest.

Parameters:
iThe index into the list of quests to look for response.
Returns:
The last response ID for that quest or -1 if quest could not be found.
size_t psCharacterQuestManager::GetAssignedQuests ( psQuestListMessage quests,
int  cNum 
)

Create a network message for all the assigned quests.

Parameters:
questsThe network message to populate with the current quest assignment information.
cNumThe client number the network message is for.
Returns:
The number of quests that have been assigned.
csArray<QuestAssignment*>& psCharacterQuestManager::GetAssignedQuests ( ) [inline]

Get a list of quests.

Returns:
A csArray of the current QuestAssignments

Definition at line 205 of file pscharquestmgr.h.

size_t psCharacterQuestManager::GetNumAssignedQuests ( ) [inline]

Gets the number of currently assigned quests.

Returns:
The number of assigned quests.

Definition at line 167 of file pscharquestmgr.h.

void psCharacterQuestManager::Initialize ( psCharacter owner)

Setup this manager for a character.

Parameters:
ownerThe character that this quest manager is for.
QuestAssignment* psCharacterQuestManager::IsQuestAssigned ( int  id)

Check to see if a quest is assigned.

Parameters:
idThe unique database ID the quest has.
Returns:
A valid QuestAssignment if the quest had been assigned. Otherwise will return NULL if the quest has not been assigned.
bool psCharacterQuestManager::LoadQuestAssignments ( )

Load the quests from the database.

Make sure that the owner has a valid PID before loading because it uses that to figure out what to load.

int psCharacterQuestManager::NumberOfQuestsCompleted ( csString  category)

Checks to see how many quests complete.

Parameters:
categoryThe category of quests to check against.
Returns:
The number of quests that have been complete in the given category.
bool psCharacterQuestManager::SetAssignedQuestLastResponse ( psQuest quest,
int  response,
gemObject npc 
)

Set an assigned quest last response.

Parameters:
questThe quest object to set the last response for.
responseThe UID of the response used.
npcThe gemObject of the npc that was used.
Returns:
true if response could be set. false if it could not be.
bool psCharacterQuestManager::UpdateQuestAssignments ( bool  forceUpdate = false)

Update the quest assignment list.

This updates the database to write the current quest assignment lists for the character.

Parameters:
forceUpdateIf set to true, write the quest information even if it is not 'dirty'
Returns:
true if the quest information successfully written to database.

The documentation for this class was generated from the following file: