Planeshift
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

NPCDialogDict Class Reference

#include <dictionary.h>

List of all members.

Public Member Functions

void AddMenu (const char *name, NpcDialogMenu *menu)
 Store an initial trigger menu with the specified NPC name.
void AddMenu (NpcDialogMenu *menu)
 Store a menu with the dictionary NOTE: this is hacky - natoka.
void AddResponse (iDataConnection *db, int databaseID)
 Loads a response from database (its id=databaseID)
NpcResponseAddResponse (const char *response_text, const char *pronoun_him, const char *pronoun_her, const char *pronoun_it, const char *pronoun_them, const char *npc_name, int &new_id, psQuest *quest, const char *audio_path)
 Adds a response dynamically not from the database.
NpcResponseAddResponse (const char *script)
 Adds a scripted response.
bool AddTrigger (iDataConnection *db, int databaseID, int responseID)
 Loads a trigger from database (its id=databaseID)
NpcTriggerAddTrigger (const char *k_area, const char *mytrigger, int prior_response, int trigger_response)
bool CheckForTriggerGroup (csString &trigger)
 substitute master trigger if this is child trigger in group.
void DeleteMenusForQuest (psQuest *quest)
 Remove the quest related NpcDialogMenu entries.
void DeleteTriggerResponse (NpcTrigger *trigger, int responseID)
bool FindKnowledgeArea (const csString &name)
NpcDialogMenuFindMenu (const char *name)
 Find a stored initial trigger menu with the specified NPC name.
NpcResponseFindResponse (int responseID)
 Lookup the response with the given ID from responses.
NpcResponseFindResponse (gemNPC *npc, const char *area, const char *trigger, int faction, int priorresponse, Client *client, int questID=-1)
NpcTermFindTerm (const char *term)
 Returns record of 'term' (or NULL if unknown)
NpcTermFindTermOrSynonym (const csString &term)
 Returns synonym of 'term' (or NULL if unknown).
bool Initialize (iDataConnection *db)
 NPCDialogDict ()
void Print (const char *area)
 Dump the entire dictionary.
void RemoveEmptyMenu (NpcDialogMenu *menu)
virtual ~NPCDialogDict ()

Protected Types

typedef csRedBlackTree
< NpcTrigger
*, CS::Container::DefaultRedBlackTreeAllocator
< NpcTrigger * >
, NpcTriggerOrdering
NpcTriggerTree

Protected Member Functions

NpcTermAddTerm (const char *term)
 Adds a new record to 'terms'.
int AddTriggerGroupEntry (int id, const char *txt, int equivID)
void AddWords (csString &trigger)
 All unknown words from 'trigger' that are not disallowed are added to 'phrases'.
bool LoadDisallowedWords (iDataConnection *db)
bool LoadResponses (iDataConnection *db)
bool LoadSynonyms (iDataConnection *db)
bool LoadTriggerGroups (iDataConnection *db)
bool LoadTriggers (iDataConnection *db)
csArray< NpcTrigger * > ParseMultiTrigger (NpcTrigger *parsetrig)

Protected Attributes

csHash< bool, csString > disallowed_words
int dynamic_id
csHash< NpcDialogMenu *, csString > initial_popup_menus
 Collection of all referenced knowledge areas.
csHash< NpcDialogMenu * > initial_popup_menus_by_quest_id
csHash< csString, csString > knowledgeAreas
csHash< NpcTerm *, csString > phrases
csHash< NpcResponse * > responses
csHash< NpcTrigger * > trigger_by_id
csHash< NpcTriggerGroupEntry
*, csString > 
trigger_groups
csHash< NpcTriggerGroupEntry * > trigger_groups_by_id
NpcTriggerTree triggers

Detailed Description

Definition at line 74 of file dictionary.h.


Member Typedef Documentation

typedef csRedBlackTree<NpcTrigger*, CS::Container::DefaultRedBlackTreeAllocator<NpcTrigger*>, NpcTriggerOrdering> NPCDialogDict::NpcTriggerTree [protected]

Definition at line 77 of file dictionary.h.


Constructor & Destructor Documentation

NPCDialogDict::NPCDialogDict ( )
virtual NPCDialogDict::~NPCDialogDict ( ) [virtual]

Member Function Documentation

void NPCDialogDict::AddMenu ( const char *  name,
NpcDialogMenu menu 
)

Store an initial trigger menu with the specified NPC name.

void NPCDialogDict::AddMenu ( NpcDialogMenu menu)

Store a menu with the dictionary NOTE: this is hacky - natoka.

Parameters:
menuto register - it will get cleaned up on dict destruction
NpcResponse* NPCDialogDict::AddResponse ( const char *  response_text,
const char *  pronoun_him,
const char *  pronoun_her,
const char *  pronoun_it,
const char *  pronoun_them,
const char *  npc_name,
int new_id,
psQuest quest,
const char *  audio_path 
)

Adds a response dynamically not from the database.

Supplies new_id if 0.

NpcResponse* NPCDialogDict::AddResponse ( const char *  script)

Adds a scripted response.

void NPCDialogDict::AddResponse ( iDataConnection *  db,
int  databaseID 
)

Loads a response from database (its id=databaseID)

NpcTerm* NPCDialogDict::AddTerm ( const char *  term) [protected]

Adds a new record to 'terms'.

Returns:
A new term or and existing term if allready added.
bool NPCDialogDict::AddTrigger ( iDataConnection *  db,
int  databaseID,
int  responseID 
)

Loads a trigger from database (its id=databaseID)

NpcTrigger* NPCDialogDict::AddTrigger ( const char *  k_area,
const char *  mytrigger,
int  prior_response,
int  trigger_response 
)
int NPCDialogDict::AddTriggerGroupEntry ( int  id,
const char *  txt,
int  equivID 
) [protected]
void NPCDialogDict::AddWords ( csString &  trigger) [protected]

All unknown words from 'trigger' that are not disallowed are added to 'phrases'.

All disallowed words from 'trigger' are removed from 'trigger'

bool NPCDialogDict::CheckForTriggerGroup ( csString &  trigger)

substitute master trigger if this is child trigger in group.

return true if substituted

void NPCDialogDict::DeleteMenusForQuest ( psQuest quest)

Remove the quest related NpcDialogMenu entries.

Will remove the DialogTrigger entries (as storde in triggers) of all NpcDialogMenu objects that have been registered in this dictionary.

Parameters:
questpointer to delete the menus for.
void NPCDialogDict::DeleteTriggerResponse ( NpcTrigger trigger,
int  responseID 
)
bool NPCDialogDict::FindKnowledgeArea ( const csString &  name)
NpcDialogMenu* NPCDialogDict::FindMenu ( const char *  name)

Find a stored initial trigger menu with the specified NPC name.

NpcResponse* NPCDialogDict::FindResponse ( gemNPC npc,
const char *  area,
const char *  trigger,
int  faction,
int  priorresponse,
Client client,
int  questID = -1 
)
NpcResponse* NPCDialogDict::FindResponse ( int  responseID)

Lookup the response with the given ID from responses.

NpcTerm* NPCDialogDict::FindTerm ( const char *  term)

Returns record of 'term' (or NULL if unknown)

NpcTerm* NPCDialogDict::FindTermOrSynonym ( const csString &  term)

Returns synonym of 'term' (or NULL if unknown).

If 'term' is known but has no synonym, then 'term' itself is returned

bool NPCDialogDict::Initialize ( iDataConnection *  db)
bool NPCDialogDict::LoadDisallowedWords ( iDataConnection *  db) [protected]
bool NPCDialogDict::LoadResponses ( iDataConnection *  db) [protected]
bool NPCDialogDict::LoadSynonyms ( iDataConnection *  db) [protected]
bool NPCDialogDict::LoadTriggerGroups ( iDataConnection *  db) [protected]
bool NPCDialogDict::LoadTriggers ( iDataConnection *  db) [protected]
csArray<NpcTrigger*> NPCDialogDict::ParseMultiTrigger ( NpcTrigger parsetrig) [protected]
void NPCDialogDict::Print ( const char *  area)

Dump the entire dictionary.

void NPCDialogDict::RemoveEmptyMenu ( NpcDialogMenu menu)

Member Data Documentation

csHash<bool, csString> NPCDialogDict::disallowed_words [protected]

Definition at line 84 of file dictionary.h.

Definition at line 91 of file dictionary.h.

csHash<NpcDialogMenu*,csString> NPCDialogDict::initial_popup_menus [protected]

Collection of all referenced knowledge areas.

This is a storage area for popup menus parsed during quest loading, which is done before NPCs are spawned.

Definition at line 88 of file dictionary.h.

Definition at line 89 of file dictionary.h.

csHash<csString,csString> NPCDialogDict::knowledgeAreas [protected]

Definition at line 85 of file dictionary.h.

csHash<NpcTerm*, csString> NPCDialogDict::phrases [protected]

Definition at line 78 of file dictionary.h.

csHash<NpcResponse*> NPCDialogDict::responses [protected]

Definition at line 83 of file dictionary.h.

Definition at line 82 of file dictionary.h.

csHash<NpcTriggerGroupEntry*, csString> NPCDialogDict::trigger_groups [protected]

Definition at line 79 of file dictionary.h.

Definition at line 80 of file dictionary.h.

Definition at line 81 of file dictionary.h.


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