Planeshift
Public Member Functions | Protected Member Functions | Protected Attributes

psNPCDialog Class Reference

This class exists per NPC, and holds all dialog triggers, responses and scripts for this particular NPC by holding references to his/her Knowledge Areas. More...

#include <psnpcdialog.h>

List of all members.

Public Member Functions

bool AddKnowledgeArea (const char *ka_name)
bool AddResponse (const char *area, const char *words, const char *response, const char *minfaction)
bool AddSynonym (const char *word, const char *synonym)
bool AddWord (const char *word)
bool AssignNPCArea (const char *npcname, const char *areaname)
void DumpDialog ()
 Add a new trigger to the cached list.
NpcResponseFindXMLResponse (Client *client, csString trigger, int questID=-1)
bool Initialize (iDataConnection *db)
bool Initialize (iDataConnection *db, PID npcID)
bool LoadKnowledgeAreas (PID npcID)
 psNPCDialog (gemNPC *npc)
NpcResponseRespond (const char *text, Client *client)
void SubstituteKeywords (Client *player, csString &response) const
virtual ~psNPCDialog ()

Protected Member Functions

void AddBadText (const char *text, const char *trigger)
bool CheckPronouns (psString &text)
void CleanPunctuation (psString &str, bool cleanQMark=true)
NpcResponseErrorResponse (const psString &text, const char *trigger)
void FilterKnownTerms (const psString &text, NpcTriggerSentence &trigger, Client *client)
 Recognizes phrases in the text and translates them to synonyms, Ignores any unrecognized phrases.
NpcResponseFindOrGeneralizeTrigger (Client *client, NpcTriggerSentence &trigger, csArray< int > &gen_terms, int word)
 Find a trigger by trying every combinations of generalization for each term.
NpcResponseFindResponse (csString &trigger, const char *text, int questID=-1)
NpcResponseFindResponseWithAllPrior (const char *area, const char *trigger, int questID=-1)
NpcResponseRepeatedResponse (const psString &text, NpcResponse *resp, csTicks when, int times)
void UpdateAntecedents (NpcResponse *resp)

Protected Attributes

psString antecedent_her
psString antecedent_him
psString antecedent_it
psString antecedent_them
ClientcurrentClient
gemActorcurrentplayer
iDataConnection * db
DialogHistory dialogHistory
csArray< KnowledgeArea * > knowareas
csRandomGen * randomgen
gemNPCself

Detailed Description

This class exists per NPC, and holds all dialog triggers, responses and scripts for this particular NPC by holding references to his/her Knowledge Areas.

Definition at line 146 of file psnpcdialog.h.


Constructor & Destructor Documentation

psNPCDialog::psNPCDialog ( gemNPC npc)
virtual psNPCDialog::~psNPCDialog ( ) [virtual]

Member Function Documentation

void psNPCDialog::AddBadText ( const char *  text,
const char *  trigger 
) [protected]
bool psNPCDialog::AddKnowledgeArea ( const char *  ka_name)
bool psNPCDialog::AddResponse ( const char *  area,
const char *  words,
const char *  response,
const char *  minfaction 
)
bool psNPCDialog::AddSynonym ( const char *  word,
const char *  synonym 
)
bool psNPCDialog::AddWord ( const char *  word)
bool psNPCDialog::AssignNPCArea ( const char *  npcname,
const char *  areaname 
)
bool psNPCDialog::CheckPronouns ( psString text) [protected]
void psNPCDialog::CleanPunctuation ( psString str,
bool  cleanQMark = true 
) [protected]
void psNPCDialog::DumpDialog ( )

Add a new trigger to the cached list.

Add a new response to the cached list.

NpcResponse* psNPCDialog::ErrorResponse ( const psString text,
const char *  trigger 
) [protected]
void psNPCDialog::FilterKnownTerms ( const psString text,
NpcTriggerSentence trigger,
Client client 
) [protected]

Recognizes phrases in the text and translates them to synonyms, Ignores any unrecognized phrases.

Returns array of recognized phrases.

NpcResponse* psNPCDialog::FindOrGeneralizeTrigger ( Client client,
NpcTriggerSentence trigger,
csArray< int > &  gen_terms,
int  word 
) [protected]

Find a trigger by trying every combinations of generalization for each term.

NpcResponse* psNPCDialog::FindResponse ( csString &  trigger,
const char *  text,
int  questID = -1 
) [protected]
NpcResponse* psNPCDialog::FindResponseWithAllPrior ( const char *  area,
const char *  trigger,
int  questID = -1 
) [protected]
NpcResponse* psNPCDialog::FindXMLResponse ( Client client,
csString  trigger,
int  questID = -1 
)
bool psNPCDialog::Initialize ( iDataConnection *  db,
PID  npcID 
)
bool psNPCDialog::Initialize ( iDataConnection *  db)
bool psNPCDialog::LoadKnowledgeAreas ( PID  npcID)
NpcResponse* psNPCDialog::RepeatedResponse ( const psString text,
NpcResponse resp,
csTicks  when,
int  times 
) [protected]
NpcResponse* psNPCDialog::Respond ( const char *  text,
Client client 
)
void psNPCDialog::SubstituteKeywords ( Client player,
csString &  response 
) const
void psNPCDialog::UpdateAntecedents ( NpcResponse resp) [protected]

Member Data Documentation

Definition at line 152 of file psnpcdialog.h.

Definition at line 152 of file psnpcdialog.h.

Definition at line 152 of file psnpcdialog.h.

Definition at line 152 of file psnpcdialog.h.

Definition at line 159 of file psnpcdialog.h.

Definition at line 158 of file psnpcdialog.h.

iDataConnection* psNPCDialog::db [protected]

Definition at line 156 of file psnpcdialog.h.

Definition at line 160 of file psnpcdialog.h.

Definition at line 150 of file psnpcdialog.h.

csRandomGen* psNPCDialog::randomgen [protected]

Definition at line 157 of file psnpcdialog.h.

gemNPC* psNPCDialog::self [protected]

Definition at line 149 of file psnpcdialog.h.


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