ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/plugin.h
Revision: 1.17
Committed: Sun Jul 1 05:00:18 2007 UTC (16 years, 10 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-2_2
Changes since 1.16: +11 -12 lines
Log Message:
- upgrade crossfire trt to the GPL version 3 (hopefully correctly).
- add a single file covered by the GNU Affero General Public License
  (which is not yet released, so I used the current draft, which is
  legally a bit wavy, but its likely better than nothing as it expresses
  direct intent by the authors, and we can upgrade as soon as it has been
  released).
  * this should ensure availability of source code for the server at least
    and hopefully also archetypes and maps even when modified versions
    are not being distributed, in accordance of section 13 of the agplv3.

File Contents

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