diff options
author | shennetsind <ind@henn.et> | 2013-09-17 16:56:04 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-09-17 16:56:04 -0300 |
commit | 78c7c6bf04a6c96d92524ae37ad165e65f599eb8 (patch) | |
tree | fc7d3a562c6c47b4f8836c984b5aef1c70b64d7c /src/map/npc.h | |
parent | 2884b361c247a66c91188cfeb924e1794d58da55 (diff) | |
download | hercules-78c7c6bf04a6c96d92524ae37ad165e65f599eb8.tar.gz hercules-78c7c6bf04a6c96d92524ae37ad165e65f599eb8.tar.bz2 hercules-78c7c6bf04a6c96d92524ae37ad165e65f599eb8.tar.xz hercules-78c7c6bf04a6c96d92524ae37ad165e65f599eb8.zip |
HPM: npc_chat.c Interfaced
Fully Integrated, closes #117
Also updated buildin_ functions to match latest script.c/.h macros.
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/npc.h')
-rw-r--r-- | src/map/npc.h | 60 |
1 files changed, 52 insertions, 8 deletions
diff --git a/src/map/npc.h b/src/map/npc.h index 0fc773dfc..6c1ca0972 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -98,10 +98,6 @@ enum actor_classes { //Since new npcs are added all the time, the max valid value is the one before the first mob (Scorpion = 1001) #define npcdb_checkid(id) ( ( (id) >= 46 && (id) <= 125) || (id) == HIDDEN_WARP_CLASS || ( (id) > 400 && (id) < MAX_NPC_CLASS ) || (id) == INVISIBLE_CLASS || ( (id) > MAX_NPC_CLASS2_START && (id) < MAX_NPC_CLASS2_END ) ) -#ifdef PCRE_SUPPORT -void npc_chat_finalize(struct npc_data* nd); -#endif - //Script NPC events. enum npce_event { NPCE_LOGIN, @@ -131,10 +127,6 @@ struct npc_path_data { unsigned short references; }; -/* comes from npc_chat.c */ -int npc_chat_sub (struct block_list* bl, va_list ap); - - /* npc.c interface */ struct npc_interface { /* */ @@ -246,4 +238,56 @@ struct npc_interface *npc; void npc_defaults(void); + +/* comes from npc_chat.c */ +#ifdef PCRE_SUPPORT +#include "../../3rdparty/pcre/include/pcre.h" +/* Structure containing all info associated with a single pattern block */ +struct pcrematch_entry { + struct pcrematch_entry* next; + char* pattern; + pcre* pcre_; + pcre_extra* pcre_extra_; + char* label; +}; + +/* A set of patterns that can be activated and deactived with a single command */ +struct pcrematch_set { + struct pcrematch_set* prev; + struct pcrematch_set* next; + struct pcrematch_entry* head; + int setid; +}; + +/* + * Entire data structure hung off a NPC + * + * The reason I have done it this way (a void * in npc_data and then + * this) was to reduce the number of patches that needed to be applied + * to a ragnarok distribution to bring this code online. I + * also wanted people to be able to grab this one file to get updates + * without having to do a large number of changes. + */ +struct npc_parse { + struct pcrematch_set* active; + struct pcrematch_set* inactive; +}; + +struct npc_chat_interface { + int (*sub) (struct block_list* bl, va_list ap); + void (*finalize) (struct npc_data* nd); + void (*def_pattern) (struct npc_data* nd, int setid, const char* pattern, const char* label); + struct pcrematch_entry* (*create_pcrematch_entry) (struct pcrematch_set* set); + void (*delete_pcreset) (struct npc_data* nd, int setid); + void (*deactivate_pcreset) (struct npc_data* nd, int setid); + void (*activate_pcreset) (struct npc_data* nd, int setid); + struct pcrematch_set* (*lookup_pcreset) (struct npc_data* nd, int setid); + void (*finalize_pcrematch_entry) (struct pcrematch_entry* e); +}; + +struct npc_chat_interface *npc_chat; + +void npc_chat_defaults(void); +#endif + #endif /* _NPC_H_ */ |