Planeshift
Public Types | Public Member Functions | Public Attributes

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>

List of all members.

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.
bool CheckPrerequisite (psCharacter *character)
 Check if the prerequisite for this response is valid.
csTicks ExecuteScript (gemActor *player, gemNPC *target)
 Returns SIZET_NOT_FOUND (-1) if it fails, or csTicks of response duration if successful.
int GetActiveQuest ()
psQuestPrereqOpGetPrerequisiteScript ()
const char * GetResponse (int &number)
const char * GetResponse ()
 Used for when a response number is unneeded (debug printf around in psnpcdialog)
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.
bool HasPublicResponse ()
 Check for SayResponseOp with public flag set, which tells chat whether it is public or private.
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.
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
int id
 xref from trigger response
NpcDialogMenumenu
 List of possible player trigger replies for this response, for display to the player.
csRef< psQuestPrereqOpprerequisite
 prerequisite for this Response to be available
psQuestquest
 Quest that this respons is part of.
csString response [MAX_RESP]
 possible alternative answers for this response
csPDelArray< ResponseOperationscript
 list of ops in script to execute when triggered
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.
csString triggerText
 This is the text that triggered the response.
int type
 record the type of response
csString voiceAudioPath [MAX_RESP]
 Optional vfs path to audio file to stream on demand to the client.
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

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.

xref from trigger response

Definition at line 397 of file dictionary.h.

csString NpcResponse::it

Definition at line 401 of file dictionary.h.

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

Definition at line 410 of file dictionary.h.

prerequisite for this Response to be available

Definition at line 409 of file dictionary.h.

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.

list of ops in script to execute when triggered

Definition at line 408 of file dictionary.h.

Definition at line 401 of file dictionary.h.

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.

This is the text that triggered the response.

Definition at line 402 of file dictionary.h.

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: