Planeshift
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>

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. More...
 
NpcResponse * FindXMLResponse (Client *client, csString trigger, int questID=-1)
 
bool Initialize (iDataConnection *db, PID npcID)
 
bool Initialize (iDataConnection *db)
 
bool LoadKnowledgeAreas (PID npcID)
 
 psNPCDialog (gemNPC *npc)
 
NpcResponse * Respond (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)
 
NpcResponse * ErrorResponse (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. More...
 
NpcResponse * FindOrGeneralizeTrigger (Client *client, NpcTriggerSentence &trigger, csArray< int > &gen_terms, int word)
 Find a trigger by trying every combinations of generalization for each term. More...
 
NpcResponse * FindResponse (csString &trigger, const char *text, int questID=-1)
 
NpcResponse * FindResponseWithAllPrior (const char *area, const char *trigger, int questID=-1)
 
NpcResponse * RepeatedResponse (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
 
Client * currentClient
 
gemActor * currentplayer
 
iDataConnection * db
 
DialogHistory dialogHistory
 
csArray< KnowledgeArea * > knowareas
 
csRandomGen * randomgen
 
gemNPC * self
 

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 151 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

psString psNPCDialog::antecedent_her
protected

Definition at line 157 of file psnpcdialog.h.

psString psNPCDialog::antecedent_him
protected

Definition at line 157 of file psnpcdialog.h.

psString psNPCDialog::antecedent_it
protected

Definition at line 157 of file psnpcdialog.h.

psString psNPCDialog::antecedent_them
protected

Definition at line 157 of file psnpcdialog.h.

Client* psNPCDialog::currentClient
protected

Definition at line 164 of file psnpcdialog.h.

gemActor* psNPCDialog::currentplayer
protected

Definition at line 163 of file psnpcdialog.h.

iDataConnection* psNPCDialog::db
protected

Definition at line 161 of file psnpcdialog.h.

DialogHistory psNPCDialog::dialogHistory
protected

Definition at line 165 of file psnpcdialog.h.

csArray<KnowledgeArea*> psNPCDialog::knowareas
protected

Definition at line 155 of file psnpcdialog.h.

csRandomGen* psNPCDialog::randomgen
protected

Definition at line 162 of file psnpcdialog.h.

gemNPC* psNPCDialog::self
protected

Definition at line 154 of file psnpcdialog.h.


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