Planeshift
NpcResponse Class Reference

This class holds several possible responses and an action script for the npc to run whenever an appropriate trigger is triggered. More...

#include <dictionary.h>

Public Types

enum  { VALID_RESPONSE, ERROR_RESPONSE }
 

Public Member Functions

bool AddPrerequisite (psQuestPrereqOp *op, bool insertBeginning=false)
 Add a prerequisite to the prerequisite for this response. More...
 
bool CheckPrerequisite (psCharacter *character)
 Check if the prerequisite for this response is valid. More...
 
csTicks ExecuteScript (gemActor *player, gemNPC *target)
 Returns SIZET_NOT_FOUND (-1) if it fails, or csTicks of response duration if successful. More...
 
int GetActiveQuest ()
 
psQuestPrereqOpGetPrerequisiteScript ()
 
const char * GetResponse (int &number)
 
const char * GetResponse ()
 Used for when a response number is unneeded (debug printf around in psnpcdialog) More...
 
csString GetResponseScript ()
 
const char * GetVoiceFile (int &number)
 Returns the VFS path to the audio file which represents this response on the server, or NULL if one was not specified. More...
 
bool HasPublicResponse ()
 Check for SayResponseOp with public flag set, which tells chat whether it is public or private. More...
 
bool Load (iResultRow &row)
 
 NpcResponse ()
 
bool ParsePrerequisiteScript (const char *xmlstr, bool insertBeginning=false)
 Pars and append the xml based prerequisite script to the prerequisite for this Response. More...
 
bool ParseResponseScript (const char *xmlstr, bool insertBeginning=false)
 
void SetActiveQuest (int max)
 
virtual ~NpcResponse ()
 

Public Attributes

int active_quest
 which one should be run. this is actually set by check quest avail op More...
 
int id
 xref from trigger response More...
 
NpcDialogMenumenu
 List of possible player trigger replies for this response, for display to the player. More...
 
csRef< psQuestPrereqOpprerequisite
 prerequisite for this Response to be available More...
 
psQuestquest
 Quest that this respons is part of. More...
 
csString response [MAX_RESP]
 possible alternative answers for this response More...
 
csPDelArray< ResponseOperationscript
 list of ops in script to execute when triggered More...
 
csTicks timeDelay
 This tracks the current time delay for chat msgs in the responses, so a single script can have a sequence of things that take a while. More...
 
csString triggerText
 This is the text that triggered the response. More...
 
int type
 record the type of response More...
 
csString voiceAudioPath [MAX_RESP]
 Optional vfs path to audio file to stream on demand to the client. More...
 
record antecedents for next question pronouns
csString him
 
csString her
 
csString it
 
csString them
 

Detailed Description

This class holds several possible responses and an action script for the npc to run whenever an appropriate trigger is triggered.

Definition at line 394 of file dictionary.h.

Member Enumeration Documentation

anonymous enum
Enumerator
VALID_RESPONSE 
ERROR_RESPONSE 

Definition at line 412 of file dictionary.h.

Constructor & Destructor Documentation

NpcResponse::NpcResponse ( )
virtual NpcResponse::~NpcResponse ( )
virtual

Member Function Documentation

bool NpcResponse::AddPrerequisite ( psQuestPrereqOp op,
bool  insertBeginning = false 
)

Add a prerequisite to the prerequisite for this response.

Parameters
opThe prerequisite op to add
insertBeginningInsert at beginning or at end (Default at end).
Returns
True if successfully added.
bool NpcResponse::CheckPrerequisite ( psCharacter character)

Check if the prerequisite for this response is valid.

Parameters
characterThe Character trying to get the response
Returns
True if prerequisite are all ok
csTicks NpcResponse::ExecuteScript ( gemActor player,
gemNPC target 
)

Returns SIZET_NOT_FOUND (-1) if it fails, or csTicks of response duration if successful.

int NpcResponse::GetActiveQuest ( )
inline

Definition at line 424 of file dictionary.h.

psQuestPrereqOp* NpcResponse::GetPrerequisiteScript ( )
inline

Definition at line 454 of file dictionary.h.

const char* NpcResponse::GetResponse ( int number)
const char* NpcResponse::GetResponse ( )
inline

Used for when a response number is unneeded (debug printf around in psnpcdialog)

Definition at line 431 of file dictionary.h.

csString NpcResponse::GetResponseScript ( )
const char* NpcResponse::GetVoiceFile ( int number)
inline

Returns the VFS path to the audio file which represents this response on the server, or NULL if one was not specified.

Definition at line 438 of file dictionary.h.

bool NpcResponse::HasPublicResponse ( )

Check for SayResponseOp with public flag set, which tells chat whether it is public or private.

bool NpcResponse::Load ( iResultRow &  row)
bool NpcResponse::ParsePrerequisiteScript ( const char *  xmlstr,
bool  insertBeginning = false 
)

Pars and append the xml based prerequisite script to the prerequisite for this Response.

bool NpcResponse::ParseResponseScript ( const char *  xmlstr,
bool  insertBeginning = false 
)
void NpcResponse::SetActiveQuest ( int  max)

Member Data Documentation

int NpcResponse::active_quest

which one should be run. this is actually set by check quest avail op

Definition at line 406 of file dictionary.h.

csString NpcResponse::her

Definition at line 401 of file dictionary.h.

csString NpcResponse::him

Definition at line 401 of file dictionary.h.

int NpcResponse::id

xref from trigger response

Definition at line 397 of file dictionary.h.

csString NpcResponse::it

Definition at line 401 of file dictionary.h.

NpcDialogMenu* NpcResponse::menu

List of possible player trigger replies for this response, for display to the player.

Definition at line 410 of file dictionary.h.

csRef<psQuestPrereqOp> NpcResponse::prerequisite

prerequisite for this Response to be available

Definition at line 409 of file dictionary.h.

psQuest* NpcResponse::quest

Quest that this respons is part of.

Definition at line 405 of file dictionary.h.

csString NpcResponse::response[MAX_RESP]

possible alternative answers for this response

Definition at line 398 of file dictionary.h.

csPDelArray<ResponseOperation> NpcResponse::script

list of ops in script to execute when triggered

Definition at line 408 of file dictionary.h.

csString NpcResponse::them

Definition at line 401 of file dictionary.h.

csTicks NpcResponse::timeDelay

This tracks the current time delay for chat msgs in the responses, so a single script can have a sequence of things that take a while.

Definition at line 407 of file dictionary.h.

csString NpcResponse::triggerText

This is the text that triggered the response.

Definition at line 402 of file dictionary.h.

int NpcResponse::type

record the type of response

Definition at line 404 of file dictionary.h.

csString NpcResponse::voiceAudioPath[MAX_RESP]

Optional vfs path to audio file to stream on demand to the client.

Definition at line 403 of file dictionary.h.


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