19 #ifndef PS_DICTIONARY_ 20 #define PS_DICTIONARY_ 25 #include <csutil/csstring.h> 27 #include <csutil/refcount.h> 28 #include <csutil/parray.h> 29 #include <csutil/hash.h> 30 #include <csutil/redblacktree.h> 37 #include "../tools/wordnet/wn.h" 66 template<
typename K,
typename K2>
class NpcTriggerOrdering :
public CS::Container::RedBlackTreeOrderingTotal<NpcTrigger,NpcTrigger>
93 bool LoadSynonyms(iDataConnection*
db);
94 bool LoadTriggerGroups(iDataConnection*
db);
95 bool LoadTriggers(iDataConnection*
db);
96 bool LoadResponses(iDataConnection*
db);
97 bool LoadDisallowedWords(iDataConnection*
db);
101 void AddWords(csString &trigger);
108 NpcTerm* AddTerm(
const char* term);
110 int AddTriggerGroupEntry(
int id,
const char* txt,
int equivID);
111 csArray<NpcTrigger*> ParseMultiTrigger(
NpcTrigger* parsetrig);
119 bool FindKnowledgeArea(
const csString &name);
122 NpcTerm* FindTerm(
const char* term);
125 NpcTerm* FindTermOrSynonym(
const csString &term);
139 bool AddTrigger(iDataConnection*
db,
int databaseID,
int responseID);
142 bool CheckForTriggerGroup(csString &trigger);
145 void AddResponse(iDataConnection*
db,
int databaseID);
148 NpcResponse* AddResponse(
const char* response_text,
149 const char* pronoun_him,
150 const char* pronoun_her,
151 const char* pronoun_it,
152 const char* pronoun_them,
153 const char* npc_name,
156 const char* audio_path);
162 const char* mytrigger,
164 int trigger_response);
166 void DeleteTriggerResponse(
NpcTrigger* trigger,
int responseID);
188 void DeleteMenusForQuest(
psQuest* quest);
195 void Print(
const char* area);
206 csArray<const char*> hypernyms;
208 void BuildHypernymList();
234 hypernymSynNet = NULL;
236 this->term.Downcase();
244 const char* GetInterleavedHypernym(
size_t which);
280 bool Load(iResultRow &row);
286 int GetRandomResponse(
const csArray<int> &availableResponseList);
306 virtual bool Load(iDocumentNode* node) = 0;
307 virtual csString GetResponseScript() = 0;
339 csString GetQuestTitle();
361 void AddTrigger(
const csString &menuText,
const csString &trigger,
psQuest* quest,
psQuestPrereqOp* script=NULL);
373 void DeleteAllMenusOfQuest(
psQuest* quest);
379 void ShowMenu(
Client* client,csTicks delay,
gemNPC* npc);
421 bool Load(iResultRow &row);
423 void SetActiveQuest(
int max);
429 const char* GetResponse(
int &number);
434 return GetResponse(number);
440 return voiceAudioPath[number];
444 bool HasPublicResponse();
445 bool ParseResponseScript(
const char* xmlstr,
bool insertBeginning=
false);
451 csString GetResponseScript();
464 bool ParsePrerequisiteScript(
const char* xmlstr,
bool insertBeginning=
false);
473 bool AddPrerequisite(
psQuestPrereqOp* op,
bool insertBeginning =
false);
500 saypublic = is_public;
505 if(sayWhat)
delete sayWhat;
507 virtual bool Load(iDocumentNode* node);
508 virtual csString GetResponseScript();
532 actionNarrate=narrate;
534 actionpublic = is_public;
539 if(actWhat)
delete actWhat;
541 virtual bool Load(iDocumentNode* node);
542 virtual csString GetResponseScript();
566 virtual bool Load(iDocumentNode* node);
567 virtual csString GetResponseScript();
587 name=
"verifyquestcompleted";
591 virtual bool Load(iDocumentNode* node);
592 virtual csString GetResponseScript();
612 name =
"setvariable";
622 virtual bool Load(iDocumentNode* node);
628 virtual csString GetResponseScript();
659 name =
"unsetvariable";
669 virtual bool Load(iDocumentNode* node);
675 virtual csString GetResponseScript();
704 name=
"verifyquestassigned";
709 virtual bool Load(iDocumentNode* node);
710 virtual csString GetResponseScript();
742 name=
"verifyquestnotassigned";
747 virtual bool Load(iDocumentNode* node);
748 virtual csString GetResponseScript();
770 virtual bool Load(iDocumentNode* node);
771 virtual csString GetResponseScript();
801 name =
"questselect";
805 virtual bool Load(iDocumentNode* node)
809 virtual csString GetResponseScript();
828 name =
"checkquesttimeout";
832 virtual bool Load(iDocumentNode* node)
836 virtual csString GetResponseScript();
857 virtual bool Load(iDocumentNode* node);
858 virtual csString GetResponseScript();
879 virtual bool Load(iDocumentNode* node);
880 virtual csString GetResponseScript();
903 virtual bool Load(iDocumentNode* node);
904 virtual csString GetResponseScript();
924 virtual bool Load(iDocumentNode* node);
925 virtual csString GetResponseScript();
949 virtual bool Load(iDocumentNode* node);
950 virtual csString GetResponseScript();
970 virtual bool Load(iDocumentNode* node);
971 virtual csString GetResponseScript();
986 name =
"guild_award";
989 virtual bool Load(iDocumentNode* node);
990 virtual csString GetResponseScript();
1008 HIRE_COMMAND_RELEASE
1017 hireCommand(HIRE_COMMAND_START)
1022 virtual bool Load(iDocumentNode* node);
1023 virtual csString GetResponseScript();
1048 virtual bool Load(iDocumentNode* node);
1049 virtual csString GetResponseScript();
1068 virtual bool Load(iDocumentNode* node);
1069 virtual csString GetResponseScript();
1086 virtual bool Load(iDocumentNode* node);
1087 virtual csString GetResponseScript();
1101 name =
"doadmincmd";
1104 virtual bool Load(iDocumentNode* node);
1105 virtual csString GetResponseScript();
virtual bool Load(iDocumentNode *node)
csString origCommandString
Pure virtual base quest prerequisite operator class.
This script operation send a perception/command to the npc client.
VerifyQuestAssignedResponseOp()
string with npc declining to proceed because player does not have quest
virtual ~GiveItemResponseOp()
virtual ~CompleteQuestResponseOp()
This script operation makes an npc offer a list of possible rewards that the player can chose from (u...
csString error_msg
ptrs to cachemanager entries for quests. must have at least one.
virtual ~MoneyResponseOp()
Represents a skill an NPC, player or pet can learn.
csRef< psQuestPrereqOp > prerequisite
prerequisite for this Response to be available
NpcTriggerGroupEntry * parent
This script operation makes an npc do an action, like greet or bow, as part of his response to a play...
virtual ~DoAdminCommandResponseOp()
This script operation adjust a given faction.
VerifyQuestCompletedResponseOp()
string with npc declining to play ball if quest is not completed
csHash< NpcDialogMenu * > initial_popup_menus_by_quest_id
NpcTerm(const char *term)
Constructor for the term.
This script operation makes an npc give an item to a player, as part of his response to a player even...
A MathScript is a mini-program to run.
const char * GetTimeoutMsg()
virtual ~ActionResponseOp()
This script operation makes an npc complete a quest for a player, as part of his response to a player...
CheckQuestTimeoutOp(AssignQuestResponseOp *questop)
csString timeout_msg
ptrs to cachemanager entries for quests. must have at least one.
This script operation makes an npc give money to the player.
csString term
The recognized phrase/term.
This script operation is a pre operation to the AssingQuestResponseOp that is inserted at the start o...
NpcTerm * synonym
Pointer to a synonym term.
This class holds all information for one quest with its reference to parent quest, list of steps, lockoutime, sub quests, ...
This script operation makes an npc manage hires as part of his response to a player event...
virtual ~HireResponseOp()
AssignQuestResponseOp * quest_op
SayResponseOp(const char *name, bool is_public)
This script operation makes an npc uncomplete a quest for a player, as part of his response to a play...
VerifyQuestNotAssignedResponseOp()
string with npc declining to proceed because player does not have quest
csString variableValue
The value of the variable to be set.
csHash< NpcTriggerGroupEntry *, csString > trigger_groups
This script operation is used to unset character variables from npc dialogs.
virtual ~VerifyQuestCompletedResponseOp()
int id
xref from trigger response
This script operation is used to set character variables from npc dialogs.
const char * GetResponse()
Used for when a response number is unneeded (debug printf around in psnpcdialog)
CompleteQuestResponseOp()
NpcDialogMenu * menu
List of possible player trigger replies for this response, for display to the player.
virtual ~CheckQuestTimeoutOp()
DoAdminCommandResponseOp()
virtual ~AssignQuestSelectOp()
A phrase recognized by the dialog system.
virtual ~GuildAwardResponseOp()
NpcTriggerOrdering(NpcTrigger *const &a, NpcTrigger *const &b)
This script operation chooses randomly between the responses specified in the response columns and ca...
virtual ~ResponseOperation()
virtual ~VerifyQuestAssignedResponseOp()
int active_quest
which one should be run. this is actually set by check quest avail op
csHash< csString, csString > knowledgeAreas
Any semi-autonomous object, either a player or an NPC.
This script operation checks to make sure a named quest has not been assigned to a player...
const char * GetName()
only used for output in error messages while parsing the script in NpcResponse
This script operation executes an admin command.
iDataConnection * db
Global connection to the Database. Set from the psDatabase class.
psQuest * GetQuest(int n)
virtual ~FactionResponseOp()
virtual ~NPCCmdResponseOp()
csString variableName
The name of the variable to be set.
psQuest * quest
Quest that this respons is part of.
UnSetVariableResponseOp()
Constructor. Practically does nothing.
This script operation makes an npc do an action, like greet or bow, as part of his response to a play...
This script operation introduces an npc.
virtual ~UnSetVariableResponseOp()
Destructor.
AssignQuestSelectOp(AssignQuestResponseOp *questop)
bool saypublic
Indicates whether the response dialog should be said publicly or /tell in private.
NpcTriggerGroupEntry(int i, const char *txt, NpcTriggerGroupEntry *myParent=0)
AssignQuestResponseOp()
how many of the quests are valid.
virtual bool Load(iDocumentNode *node)
This script operation checks to make sure a named quest has been completed by a player, and stops the script if not, issuing the specified error_msg dialog.
csHash< NpcTriggerGroupEntry * > trigger_groups_by_id
virtual ~UncompleteQuestResponseOp()
virtual ~SetVariableResponseOp()
Destructor.
csHash< NpcResponse * > responses
int type
record the type of response
csHash< bool, csString > disallowed_words
bool operator<=(long lhs, const GmpInt &rhs)
void free_syns(SynsetPtr)
bool actionpublic
Indicates whether the response action should be shown publicly or in private.
csString triggerText
This is the text that triggered the response.
This class collects data of a netclient.
This script operation makes an npc assign one out of a list of quest to a player, as part of his resp...
This script operation invokes the progression manager to start training as part of his response to a ...
void void Initialize(iObjectRegistry *object_reg)
This script operation is a pre operation to the AssignQuestResponseOp that is inserted at the start o...
virtual ~IntroduceResponseOp()
csString variableName
The name of the variable to be set.
csString error_msg
ptrs to cachemanager entries for quests. must have at least one.
csString * sayWhat
Optional specific string to say, used by quest_scripts.
This script operation checks to make sure a named quest has been assigned to a player, and stops the script if not, issuing the specified error_msg dialog.
csHash< NpcTerm *, csString > phrases
csArray< QuestRewardItem > offer
This class holds several possible responses and an action script for the npc to run whenever an appro...
csTicks timeDelay
This tracks the current time delay for chat msgs in the responses, so a single script can have a sequ...
AssignQuestResponseOp * quest_op
This huge class stores all the properties of any object a player can have in the game.
virtual ~TrainResponseOp()
ActionResponseOp(const char *actionName, bool my, bool narrate, bool is_public)
bool operator==(T *p, const scoped_ptr< T > &b)
virtual ~AssignQuestResponseOp()
csHash< NpcDialogMenu *, csString > initial_popup_menus
Collection of all referenced knowledge areas.
psQuestPrereqOp * GetPrerequisiteScript()
int num_quests
string with npc declinign to give quest
csArray< int > responseIDlist
csRedBlackTree< NpcTrigger *, CS::Container::DefaultRedBlackTreeAllocator< NpcTrigger * >, NpcTriggerOrdering > NpcTriggerTree
virtual ~VerifyQuestNotAssignedResponseOp()
csString error_msg
ptrs to cachemanager entries for quests. must have at least one.
csPDelArray< ResponseOperation > script
list of ops in script to execute when triggered
Possible actions scriptable in the quest engine all inherit from this class.
virtual ~OfferRewardResponseOp()
csHash< NpcTrigger * > trigger_by_id
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.
SetVariableResponseOp()
Constructor. Practically does nothing.
This script operation invokes the progression manager to run a script, as part of his response to a p...
UncompleteQuestResponseOp()