ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/plugin.h
Revision: 1.16
Committed: Mon May 28 21:15:56 2007 UTC (17 years ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.15: +23 -4 lines
Log Message:
- update copyrights in .h files, where applicable
- rename preprocess to genkeywords

File Contents

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