ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/plugin.h
Revision: 1.14
Committed: Tue Aug 29 05:03:55 2006 UTC (17 years, 9 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.13: +0 -36 lines
Log Message:
- added ready/unready/can_apply events and their passive versions
- removed support for event_*-fields in maps
- removed support for current_weapon_script
- removed timers
- removed say/shout/Tell and related commands

File Contents

# User Rev Content
1 root 1.1 /*****************************************************************************/
2     /* Crossfire plugin support - (C) 2001 by Yann Chachkoff. */
3     /* This code is placed under the GPL. */
4     /*****************************************************************************/
5    
6     /*****************************************************************************/
7     /* Headers needed. */
8     /*****************************************************************************/
9    
10     #ifndef PLUGIN_H_
11     #define PLUGIN_H_
12    
13     /*****************************************************************************/
14     /* This one does not exist under Win32. */
15     /*****************************************************************************/
16     #ifndef WIN32
17     #include <dlfcn.h>
18     #endif
19    
20     #undef MODULEAPI
21     #ifdef WIN32
22     #ifdef PYTHON_PLUGIN_EXPORTS
23     #define MODULEAPI __declspec(dllexport)
24     #else
25     #define MODULEAPI __declspec(dllimport)
26     #endif
27     #else
28     #define MODULEAPI
29     #endif
30    
31     #include <global.h>
32     #include <object.h>
33    
34     #ifdef HAVE_TIME_H
35     #include <time.h>
36     #endif
37     #include <../random_maps/random_map.h>
38     #include <../random_maps/rproto.h>
39    
40    
41     /*****************************************************************************/
42     /* This one does not exist under Win32. */
43     /*****************************************************************************/
44     #ifndef WIN32
45     #include <dirent.h>
46     #endif
47    
48 elmex 1.10 #define NR_EVENTS 42
49 root 1.1
50     #include <stdarg.h>
51    
52     #define CFAPI_NONE 0
53     #define CFAPI_INT 1
54     #define CFAPI_LONG 2
55     #define CFAPI_CHAR 3
56     #define CFAPI_STRING 4
57     #define CFAPI_POBJECT 5
58     #define CFAPI_PMAP 6
59     #define CFAPI_FLOAT 7
60     #define CFAPI_DOUBLE 8
61     #define CFAPI_PARCH 9
62     #define CFAPI_FUNC 10
63     #define CFAPI_PPLAYER 11
64     #define CFAPI_PPARTY 12
65     #define CFAPI_PREGION 13
66 elmex 1.3 #define CFAPI_INT16 14
67 root 1.1
68     typedef void* (*f_plug_api) (int* type, ...);
69     typedef int (*f_plug_postinit) (void);
70     typedef int (*f_plug_init)(const char* iversion, f_plug_api gethooksptr);
71    
72     #ifndef WIN32
73     #define LIBPTRTYPE void*
74     #else
75     #define LIBPTRTYPE HMODULE
76     #endif
77    
78     typedef struct _crossfire_plugin
79     {
80     f_plug_api eventfunc; /* Event Handler function */
81     f_plug_api propfunc; /* Plugin getProperty function */
82     f_plug_postinit closefunc; /* Plugin Termination function */
83     LIBPTRTYPE libptr; /* Pointer to the plugin library */
84     char id[MAX_BUF]; /* Plugin identification string */
85     char fullname[MAX_BUF]; /* Plugin full name */
86     f_plug_api gevent[NR_EVENTS]; /* Global events registered */
87     struct _crossfire_plugin *next;
88     struct _crossfire_plugin *prev;
89     } crossfire_plugin;
90    
91     extern int plugin_number;
92     extern crossfire_plugin* plugins_list;
93    
94     #ifdef WIN32
95    
96     #define plugins_dlopen(fname) LoadLibrary(fname)
97     #define plugins_dlclose(lib) FreeLibrary(lib)
98     #define plugins_dlsym(lib,name) GetProcAddress(lib,name)
99    
100     #else /*WIN32 */
101    
102     #define plugins_dlopen(fname) dlopen(fname,RTLD_NOW|RTLD_GLOBAL)
103     #define plugins_dlclose(lib) dlclose(lib)
104     #define plugins_dlsym(lib,name) dlsym(lib,name)
105     #define plugins_dlerror() dlerror()
106     #endif /* WIN32 */
107    
108    
109     /* OBJECT-RELATED HOOKS */
110    
111     #define CFAPI_OBJECT_PROP_OB_ABOVE 1
112     #define CFAPI_OBJECT_PROP_OB_BELOW 2
113     #define CFAPI_OBJECT_PROP_NEXT_ACTIVE_OB 3
114     #define CFAPI_OBJECT_PROP_PREV_ACTIVE_OB 4
115     #define CFAPI_OBJECT_PROP_INVENTORY 5
116     #define CFAPI_OBJECT_PROP_ENVIRONMENT 6
117     #define CFAPI_OBJECT_PROP_HEAD 7
118     #define CFAPI_OBJECT_PROP_CONTAINER 8
119     #define CFAPI_OBJECT_PROP_MAP 9
120     #define CFAPI_OBJECT_PROP_COUNT 10
121     #define CFAPI_OBJECT_PROP_REFCOUNT 11
122     #define CFAPI_OBJECT_PROP_NAME 12
123     #define CFAPI_OBJECT_PROP_NAME_PLURAL 13
124     #define CFAPI_OBJECT_PROP_TITLE 14
125     #define CFAPI_OBJECT_PROP_RACE 15
126     #define CFAPI_OBJECT_PROP_SLAYING 16
127     #define CFAPI_OBJECT_PROP_SKILL 17
128     #define CFAPI_OBJECT_PROP_MESSAGE 18
129     #define CFAPI_OBJECT_PROP_LORE 19
130     #define CFAPI_OBJECT_PROP_X 20
131     #define CFAPI_OBJECT_PROP_Y 21
132     #define CFAPI_OBJECT_PROP_SPEED 22
133     #define CFAPI_OBJECT_PROP_SPEED_LEFT 23
134     #define CFAPI_OBJECT_PROP_NROF 24
135     #define CFAPI_OBJECT_PROP_DIRECTION 25
136     #define CFAPI_OBJECT_PROP_FACING 26
137     #define CFAPI_OBJECT_PROP_TYPE 27
138     #define CFAPI_OBJECT_PROP_SUBTYPE 28
139     #define CFAPI_OBJECT_PROP_CLIENT_TYPE 29
140     #define CFAPI_OBJECT_PROP_RESIST 30
141     #define CFAPI_OBJECT_PROP_ATTACK_TYPE 31
142     #define CFAPI_OBJECT_PROP_PATH_ATTUNED 32
143     #define CFAPI_OBJECT_PROP_PATH_REPELLED 33
144     #define CFAPI_OBJECT_PROP_PATH_DENIED 34
145     #define CFAPI_OBJECT_PROP_MATERIAL 35
146     #define CFAPI_OBJECT_PROP_MATERIAL_NAME 36
147     #define CFAPI_OBJECT_PROP_MAGIC 37
148     #define CFAPI_OBJECT_PROP_VALUE 38
149     #define CFAPI_OBJECT_PROP_LEVEL 39
150     #define CFAPI_OBJECT_PROP_LAST_HEAL 40
151     #define CFAPI_OBJECT_PROP_LAST_SP 41
152     #define CFAPI_OBJECT_PROP_LAST_GRACE 42
153     #define CFAPI_OBJECT_PROP_LAST_EAT 43
154     #define CFAPI_OBJECT_PROP_INVISIBLE_TIME 44
155     #define CFAPI_OBJECT_PROP_PICK_UP 45
156     #define CFAPI_OBJECT_PROP_ITEM_POWER 46
157     #define CFAPI_OBJECT_PROP_GEN_SP_ARMOUR 47
158     #define CFAPI_OBJECT_PROP_WEIGHT 48
159     #define CFAPI_OBJECT_PROP_WEIGHT_LIMIT 49
160     #define CFAPI_OBJECT_PROP_CARRYING 50
161     #define CFAPI_OBJECT_PROP_GLOW_RADIUS 51
162     #define CFAPI_OBJECT_PROP_PERM_EXP 52
163     #define CFAPI_OBJECT_PROP_CURRENT_WEAPON 53
164     #define CFAPI_OBJECT_PROP_ENEMY 54
165     #define CFAPI_OBJECT_PROP_ATTACKED_BY 55
166     #define CFAPI_OBJECT_PROP_RUN_AWAY 56
167     #define CFAPI_OBJECT_PROP_CHOSEN_SKILL 57
168     #define CFAPI_OBJECT_PROP_HIDDEN 58
169     #define CFAPI_OBJECT_PROP_MOVE_STATUS 59
170     #define CFAPI_OBJECT_PROP_MOVE_TYPE 60
171     #define CFAPI_OBJECT_PROP_SPELL_ITEM 61
172     #define CFAPI_OBJECT_PROP_EXP_MULTIPLIER 62
173     #define CFAPI_OBJECT_PROP_ARCHETYPE 63
174     #define CFAPI_OBJECT_PROP_OTHER_ARCH 64
175     #define CFAPI_OBJECT_PROP_CUSTOM_NAME 65
176     #define CFAPI_OBJECT_PROP_ANIM_SPEED 66
177     #define CFAPI_OBJECT_PROP_FRIENDLY 67
178     #define CFAPI_OBJECT_PROP_SHORT_NAME 68
179     #define CFAPI_OBJECT_PROP_BASE_NAME 69
180     #define CFAPI_OBJECT_PROP_MAGICAL 70
181     #define CFAPI_OBJECT_PROP_LUCK 71
182     #define CFAPI_OBJECT_PROP_EXP 72
183     #define CFAPI_OBJECT_PROP_OWNER 73
184     #define CFAPI_OBJECT_PROP_PRESENT 74
185     #define CFAPI_OBJECT_PROP_CHEATER 75
186     #define CFAPI_OBJECT_PROP_MERGEABLE 76
187     #define CFAPI_OBJECT_PROP_PICKABLE 77
188     #define CFAPI_OBJECT_PROP_FLAGS 78
189     #define CFAPI_OBJECT_PROP_STR 79
190     #define CFAPI_OBJECT_PROP_DEX 80
191     #define CFAPI_OBJECT_PROP_CON 81
192     #define CFAPI_OBJECT_PROP_WIS 82
193     #define CFAPI_OBJECT_PROP_INT 83
194     #define CFAPI_OBJECT_PROP_POW 84
195     #define CFAPI_OBJECT_PROP_CHA 85
196     #define CFAPI_OBJECT_PROP_WC 86
197     #define CFAPI_OBJECT_PROP_AC 87
198     #define CFAPI_OBJECT_PROP_HP 88
199     #define CFAPI_OBJECT_PROP_SP 89
200     #define CFAPI_OBJECT_PROP_GP 90
201     #define CFAPI_OBJECT_PROP_FP 91
202     #define CFAPI_OBJECT_PROP_MAXHP 92
203     #define CFAPI_OBJECT_PROP_MAXSP 93
204     #define CFAPI_OBJECT_PROP_MAXGP 94
205     #define CFAPI_OBJECT_PROP_DAM 95
206     #define CFAPI_OBJECT_PROP_GOD 96
207     #define CFAPI_OBJECT_PROP_ARCH_NAME 97
208     #define CFAPI_OBJECT_PROP_INVISIBLE 98
209     #define CFAPI_OBJECT_PROP_FACE 99
210     #define CFAPI_OBJECT_ANIMATION 100
211     #define CFAPI_PLAYER_PROP_IP 150
212     #define CFAPI_PLAYER_PROP_MARKED_ITEM 151
213     #define CFAPI_PLAYER_PROP_PARTY 152
214    
215     #define CFAPI_MAP_PROP_FLAGS 0
216     #define CFAPI_MAP_PROP_DIFFICULTY 1
217     #define CFAPI_MAP_PROP_PATH 2
218     #define CFAPI_MAP_PROP_TMPNAME 3
219     #define CFAPI_MAP_PROP_NAME 4
220     #define CFAPI_MAP_PROP_RESET_TIME 5
221     #define CFAPI_MAP_PROP_RESET_TIMEOUT 6
222     #define CFAPI_MAP_PROP_PLAYERS 7
223     #define CFAPI_MAP_PROP_LIGHT 8
224     #define CFAPI_MAP_PROP_DARKNESS 9
225     #define CFAPI_MAP_PROP_WIDTH 10
226     #define CFAPI_MAP_PROP_HEIGHT 11
227     #define CFAPI_MAP_PROP_ENTER_X 12
228     #define CFAPI_MAP_PROP_ENTER_Y 13
229     #define CFAPI_MAP_PROP_TEMPERATURE 14
230     #define CFAPI_MAP_PROP_PRESSURE 15
231     #define CFAPI_MAP_PROP_HUMIDITY 16
232     #define CFAPI_MAP_PROP_WINDSPEED 17
233     #define CFAPI_MAP_PROP_WINDDIR 18
234     #define CFAPI_MAP_PROP_SKY 19
235     #define CFAPI_MAP_PROP_WPARTX 20
236     #define CFAPI_MAP_PROP_WPARTY 21
237     #define CFAPI_MAP_PROP_MESSAGE 22
238     #define CFAPI_MAP_PROP_NEXT 23
239     #define CFAPI_MAP_PROP_REGION 24
240    
241     #define CFAPI_ARCH_PROP_NAME 0
242     #define CFAPI_ARCH_PROP_NEXT 1
243     #define CFAPI_ARCH_PROP_HEAD 2
244     #define CFAPI_ARCH_PROP_MORE 3
245     #define CFAPI_ARCH_PROP_CLONE 4
246    
247     #define CFAPI_PARTY_PROP_NAME 0
248     #define CFAPI_PARTY_PROP_NEXT 1
249     #define CFAPI_PARTY_PROP_PASSWORD 2
250     #define CFAPI_PARTY_PROP_PLAYER 3
251    
252     #define CFAPI_REGION_PROP_NAME 0
253     #define CFAPI_REGION_PROP_NEXT 1
254     #define CFAPI_REGION_PROP_PARENT 2
255     #define CFAPI_REGION_PROP_LONGNAME 3
256     #define CFAPI_REGION_PROP_MESSAGE 4
257    
258     /*****************************************************************************/
259     /* Exportable functions. Any plugin should define all those. */
260     /* initPlugin is called when the plugin initialization process starts.*/
261     /* endPlugin is called before the plugin gets unloaded from memory. */
262     /* getPluginProperty is currently unused. */
263     /* registerHook is used to transmit hook pointers from server to plugin.*/
264     /* triggerEvent is called whenever an event occurs. */
265     /*****************************************************************************/
266     /*extern MODULEAPI CFParm* initPlugin(CFParm* PParm);
267     extern MODULEAPI CFParm* endPlugin(CFParm* PParm);
268     extern MODULEAPI CFParm* getPluginProperty(CFParm* PParm);
269     extern MODULEAPI CFParm* registerHook(CFParm* PParm);
270     extern MODULEAPI CFParm* triggerEvent(CFParm* PParm);
271     */
272    
273     typedef struct _hook_entry
274     {
275     f_plug_api func;
276     int fid;
277     char fname[256];
278     } hook_entry;
279    
280     #endif /*PLUGIN_H_*/