ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/plugin.h
Revision: 1.15
Committed: Mon Dec 11 19:46:46 2006 UTC (17 years, 6 months ago) by pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: rel-2_0, rel-2_1, STABLE
Changes since 1.14: +0 -26 lines
Log Message:
removed #ifn?def WIN32 from all files

File Contents

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