Planeshift
Classes | Public Member Functions | Protected Attributes

psQuest Class Reference

This class holds the master list of all quests available in the game. More...

#include <psquest.h>

List of all members.

Classes

struct  TriggerResponse

Public Member Functions

bool Active ()
 Check if the quest is active (and also it's parents).
void Active (bool state)
 Sets activation status of the quest.
bool AddPrerequisite (csRef< psQuestPrereqOp > op)
bool AddPrerequisite (csString prerequisitescript)
void AddSubQuest (int id)
 Adds a pointer to a menu.
void AddTriggerResponse (NpcTrigger *trigger, NpcResponse *response)
 Adds a set of pointers to a trigger and a response.
const csString & GetCategory () const
int GetID () const
 The id can be defined by the database or dynamically created.
const char * GetImage () const
const char * GetName () const
psQuestGetParentQuest () const
unsigned int GetPlayerLockoutTime () const
csRef< psQuestPrereqOp > & GetPrerequisite ()
 Return the prerequisite for this quest.
csString GetPrerequisiteStr ()
unsigned int GetQuestLastActivatedTime () const
unsigned int GetQuestLockoutTime () const
int GetStep () const
csArray< int > & GetSubQuests ()
 Returns an ordered list of the subquests of this quest (so it's steps).
const char * GetTask () const
bool HasInfinitePlayerLockout () const
bool hasTaskText ()
 Gets if the task (quest description/note) contains some text.
bool Load (iResultRow &row)
 loads the quest information from a supplied result set
bool PostLoad ()
 parses the prerequisite string and caches the result
 psQuest (int id=0, const char *name="")
 default constructor
void SetParentQuest (psQuest *parent)
void SetQuestLastActivatedTime (unsigned int when)
void SetTask (csString mytask)
virtual ~psQuest ()

Protected Attributes

bool active
csString category
int flags
int id
 quest id - either as stored in the database or as assigned by CacheManager::AddDynamicQuest
csString image
bool infinitePlayerLockout
csString name
 unique quest name
psQuestparent_quest
 parent quest of this quest (or NULL if there is none)
unsigned int player_lockout_time
csRef< psQuestPrereqOpprerequisite
csString prerequisiteStr
unsigned int quest_last_activated
unsigned int quest_lockout_time
int step_id
 natoka: never used, though i suppose it was ment for the substep number
csArray< intsubquests
 list of IDs of the subquests of this quest
csString task
csArray< TriggerResponsetriggerPairs
 list of trigger-response pairs added for the quest

Detailed Description

This class holds the master list of all quests available in the game.

Definition at line 66 of file psquest.h.


Constructor & Destructor Documentation

psQuest::psQuest ( int  id = 0,
const char *  name = "" 
)

default constructor

Parameters:
idquestID - either from the database, or dynamically created
nameis a unique string
virtual psQuest::~psQuest ( ) [virtual]

Member Function Documentation

bool psQuest::Active ( ) [inline]

Check if the quest is active (and also it's parents).

A quest to be active must be active itself and, if so, also it's parents (most probably earlier steps) must be active themselves so check back to them if this quest is active else return as not active directly.

Returns:
The active status of the quest.

Definition at line 225 of file psquest.h.

void psQuest::Active ( bool  state) [inline]

Sets activation status of the quest.

Definition at line 233 of file psquest.h.

bool psQuest::AddPrerequisite ( csRef< psQuestPrereqOp op)
bool psQuest::AddPrerequisite ( csString  prerequisitescript)
void psQuest::AddSubQuest ( int  id) [inline]

Adds a pointer to a menu.

This is needed for deallocation at desctruction time.

Parameters:
menucreated by the quests questscript Register a quest as a subquest of this quest.

Subquests are normally generated when parsing quest_scripts.

Parameters:
idof the subquest to register.

Definition at line 187 of file psquest.h.

void psQuest::AddTriggerResponse ( NpcTrigger trigger,
NpcResponse response 
)

Adds a set of pointers to a trigger and a response.

This is needed for deallocation at desctruction time.

Parameters:
triggercreated by the quests questscript
responsecreated by the quests questscript
const csString& psQuest::GetCategory ( ) const [inline]

Definition at line 212 of file psquest.h.

int psQuest::GetID ( ) const [inline]

The id can be defined by the database or dynamically created.

Dynamic creation takes place in CacheManager::AddDynamicQuest

Returns:
the quest's id

Definition at line 94 of file psquest.h.

const char* psQuest::GetImage ( ) const [inline]

Definition at line 105 of file psquest.h.

const char* psQuest::GetName ( ) const [inline]
Returns:
the quest's name

Definition at line 101 of file psquest.h.

psQuest* psQuest::GetParentQuest ( ) const [inline]

Definition at line 127 of file psquest.h.

unsigned int psQuest::GetPlayerLockoutTime ( ) const [inline]

Definition at line 143 of file psquest.h.

csRef<psQuestPrereqOp>& psQuest::GetPrerequisite ( ) [inline]

Return the prerequisite for this quest.

Returns:
The prerequisite for this quest.

Definition at line 207 of file psquest.h.

csString psQuest::GetPrerequisiteStr ( )
unsigned int psQuest::GetQuestLastActivatedTime ( ) const [inline]

Definition at line 151 of file psquest.h.

unsigned int psQuest::GetQuestLockoutTime ( ) const [inline]

Definition at line 147 of file psquest.h.

int psQuest::GetStep ( ) const [inline]

Definition at line 135 of file psquest.h.

csArray<int>& psQuest::GetSubQuests ( ) [inline]

Returns an ordered list of the subquests of this quest (so it's steps).

Returns:
A reference to an array containing the id of each subquests.

Definition at line 197 of file psquest.h.

const char* psQuest::GetTask ( ) const [inline]

Definition at line 109 of file psquest.h.

bool psQuest::HasInfinitePlayerLockout ( ) const [inline]

Definition at line 139 of file psquest.h.

bool psQuest::hasTaskText ( ) [inline]

Gets if the task (quest description/note) contains some text.

Returns:
TRUE if the task has some text, FALSE otherwise.

Definition at line 119 of file psquest.h.

bool psQuest::Load ( iResultRow &  row)

loads the quest information from a supplied result set

Parameters:
rowresult set to store in this object
bool psQuest::PostLoad ( )

parses the prerequisite string and caches the result

void psQuest::SetParentQuest ( psQuest parent) [inline]

Definition at line 131 of file psquest.h.

void psQuest::SetQuestLastActivatedTime ( unsigned int  when) [inline]

Definition at line 155 of file psquest.h.

void psQuest::SetTask ( csString  mytask) [inline]

Definition at line 123 of file psquest.h.


Member Data Documentation

bool psQuest::active [protected]

Definition at line 265 of file psquest.h.

csString psQuest::category [protected]

Definition at line 247 of file psquest.h.

int psQuest::flags [protected]

Definition at line 243 of file psquest.h.

int psQuest::id [protected]

quest id - either as stored in the database or as assigned by CacheManager::AddDynamicQuest

Definition at line 239 of file psquest.h.

csString psQuest::image [protected]

Definition at line 242 of file psquest.h.

Definition at line 249 of file psquest.h.

csString psQuest::name [protected]

unique quest name

Definition at line 240 of file psquest.h.

parent quest of this quest (or NULL if there is none)

Definition at line 244 of file psquest.h.

Definition at line 251 of file psquest.h.

Definition at line 246 of file psquest.h.

csString psQuest::prerequisiteStr [protected]

Definition at line 248 of file psquest.h.

Definition at line 253 of file psquest.h.

Definition at line 252 of file psquest.h.

int psQuest::step_id [protected]

natoka: never used, though i suppose it was ment for the substep number

Definition at line 245 of file psquest.h.

list of IDs of the subquests of this quest

Definition at line 263 of file psquest.h.

csString psQuest::task [protected]

Definition at line 241 of file psquest.h.

list of trigger-response pairs added for the quest

Definition at line 262 of file psquest.h.


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