Crossfire Server, Branches 1.12  R18729
plugin_common.h
Go to the documentation of this file.
1 /*****************************************************************************/
2 /* Crossfire Plugin Interface Common Parts */
3 /* Version: 2.0beta8 (also known as "Alexander") */
4 /* Contact: yann.chachkoff@myrealbox.com */
5 /*****************************************************************************/
6 /* That code is placed under the GNU General Public Licence (GPL) */
7 /* (C)2001-2005 by Chachkoff Yann (Feel free to deliver your complaints) */
8 /*****************************************************************************/
9 /* CrossFire, A Multiplayer game for X-windows */
10 /* */
11 /* Copyright (C) 2000 Mark Wedel */
12 /* Copyright (C) 1992 Frank Tore Johansen */
13 /* */
14 /* This program is free software; you can redistribute it and/or modify */
15 /* it under the terms of the GNU General Public License as published by */
16 /* the Free Software Foundation; either version 2 of the License, or */
17 /* (at your option) any later version. */
18 /* */
19 /* This program is distributed in the hope that it will be useful, */
20 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
21 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
22 /* GNU General Public License for more details. */
23 /* */
24 /* You should have received a copy of the GNU General Public License */
25 /* along with this program; if not, write to the Free Software */
26 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
27 /* */
28 /*****************************************************************************/
29 #ifndef PLUGIN_COMMON_H
30 #define PLUGIN_COMMON_H
31 
32 #ifdef WIN32
33 #define CF_PLUGIN __declspec(dllexport)
34 #else
35 #define CF_PLUGIN
36 #endif
37 
38 #include <plugin.h>
39 
40 #define PLUGIN_ERROR_INT 0x0FFFFF
41 
42 extern int cf_init_plugin(f_plug_api getHooks);
43 extern void cf_system_register_global_event(int event, const char *name, f_plug_api hook);
44 extern void cf_system_unregister_global_event(int event, const char *name);
45 
46 /* General functions */
47 extern sstring cf_add_string(const char *str);
48 extern void cf_free_string(sstring str);
49 extern sstring cf_find_string(const char *str);
50 extern char *cf_strdup_local(const char *str);
51 extern char *cf_get_maps_directory(const char *name, char *buf, int size);
52 extern int cf_find_animation(const char *txt);
53 extern int cf_find_face(const char *name, int error);
54 extern void cf_log(LogLevel logLevel, const char *format, ...);
55 extern void cf_log_plain(LogLevel logLevel, const char *message);
56 extern void cf_get_time(timeofday_t *tod);
57 extern int cf_timer_create(object *ob, long delay, int mode);
58 extern int cf_timer_destroy(int id);
59 extern const char *cf_get_directory(int id);
60 extern const char *cf_re_cmp(const char *str, const char *regexp);
61 extern const char *cf_get_season_name(int index);
62 extern const char *cf_get_month_name(int index);
63 extern const char *cf_get_weekday_name(int index);
64 extern const char *cf_get_periodofday_name(int index);
65 
66 /* Objects */
67 extern void cf_object_set_int_property(object *op, int propcode, int value);
68 extern int cf_object_get_int_property(object *op, int propcode);
69 extern long cf_object_get_long_property(object *op, long propcode);
70 extern void cf_object_set_movetype_property(object *op, int propcode, MoveType value);
71 extern MoveType cf_object_get_movetype_property(object *op, int propcode);
72 extern object *cf_object_get_object_property(object *op, int propcode);
73 extern void cf_object_set_object_property(object *op, int propcode, object *value);
74 extern float cf_object_get_float_property(object *op, int propcode);
75 extern void cf_object_set_float_property(object *op, int propcode, float value);
76 extern mapstruct *cf_object_get_map_property(object *op, int propcode);
77 extern archetype *cf_object_get_archetype_property(object *op, int propcode);
78 extern partylist *cf_object_get_partylist_property(object *op, int propcode);
79 extern sint64 cf_object_get_int64_property(object *op, int propcode);
80 extern void cf_object_set_int64_property(object *op, int propcode, sint64 value);
81 extern double cf_object_get_double_property(object *op, int propcode);
82 extern sstring cf_object_get_sstring_property(object *op, int propcode);
83 extern char *cf_object_get_string_property(object *op, int propcode, char *buf, int size);
84 extern void cf_fix_object(object *op);
85 extern char *cf_query_name(object *ob, char *name, int size);
86 extern sstring cf_query_name_pl(object *ob);
87 extern char *cf_query_base_name(object *ob, int plural, char *name, int size);
88 extern const char *cf_object_get_msg(object *);
89 extern void cf_object_set_weight(object *ob, int weight);
90 extern int cf_object_get_weight(object *ob);
91 extern void cf_object_set_weight_limit(object *ob, int weight);
92 extern int cf_object_get_weight_limit(object *ob);
93 extern int cf_object_set_nrof(object *, int nrof);
94 extern int cf_object_get_nrof(object *);
95 extern int cf_object_get_flag(object *ob, int flag);
96 extern void cf_object_set_flag(object *ob, int flag, int value);
97 extern object *cf_object_insert_in_ob(object *op, object *where);
98 extern void cf_object_set_string_property(object *op, int propcode, const char *value);
99 extern void cf_spring_trap(object *trap, object *victim);
100 extern int cf_object_check_trigger(object *op, object *cause);
101 extern int cf_object_query_money(const object *op);
102 extern int cf_object_query_cost(const object *tmp, object *who, int flag);
103 extern int cf_object_cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg);
104 extern void cf_object_learn_spell(object *op, object *spell, int special_prayer);
105 extern void cf_object_forget_spell(object *op, object *sp);
106 extern object *cf_object_check_for_spell(object *op, const char *name);
107 extern int cf_object_cast_ability(object *caster, object *ctoo, int dir, object *sp, char *flags);
108 extern int cf_object_pay_amount(object *pl, uint64 to_pay);
109 extern int cf_object_pay_item(object *op, object *pl);
110 extern void cf_object_set_long_property(object *op, int propcode, long value);
111 extern int cf_object_transfer(object *op, int x, int y, int randomly, object *originator);
112 extern int cf_object_move_to(object *op, int x, int y);
113 extern int cf_object_out_of_map(object *op, int x, int y);
114 extern void cf_object_drop(object *op, object *author);
115 extern void cf_object_say(object *op, char *msg);
116 extern object *cf_object_insert_object(object *op, object *container);
117 extern object *cf_object_present_archname_inside(object *op, char *whatstr);
118 extern int cf_object_apply(object *op, object *author, int flags);
119 extern void cf_object_remove(object *op);
120 extern void cf_object_free(object *ob);
121 extern object *cf_create_object(void);
122 extern object *cf_create_object_by_name(const char *name);
123 extern object *cf_object_change_map(object *op, mapstruct *m, object *originator, int flag, int x, int y);
124 extern int cf_object_teleport(object *ob, mapstruct *map, int x, int y);
125 extern void cf_object_update(object *op, int flags);
126 extern void cf_object_pickup(object *op, object *what);
127 extern const char *cf_object_get_key(object *op, const char *keyname);
128 extern int cf_object_set_key(object *op, const char *keyname, const char *value, int add_key);
129 extern sint16 cf_object_get_resistance(object *op, int rtype);
130 extern void cf_object_set_resistance(object *op, int rtype, sint16 value);
131 extern int cf_object_move(object *op, int dir, object*originator);
132 extern void cf_object_apply_below(object *pl);
133 extern object *cf_object_clone(object *op, int clonetype);
134 extern void cf_object_change_exp(object *op, sint64 exp, const char *skill_name, int flag);
135 extern int cf_object_change_abil(object *op, object *tmp);
136 extern int cf_object_user_event(object *op, object *activator, object *third, const char *message, int fix);
137 /* Maps */
138 /*extern void *cf_map_get_property(mapstruct *map, int propcode);*/
139 extern sstring cf_map_get_sstring_property(mapstruct *map, int propcode);
140 extern mapstruct *cf_map_get_map_property(mapstruct *map, int propcode);
141 extern region *cf_map_get_region_property(mapstruct *map, int propcode);
142 extern int cf_map_get_int_property(mapstruct *map, int property);
143 
144 extern void cf_map_set_int_property(mapstruct *map, int propcode, int value);
145 extern void cf_map_set_string_property(mapstruct *map, int propcode, const char *value);
146 extern mapstruct *cf_map_get_map(const char *name, int flags);
147 extern mapstruct *cf_get_empty_map(int sizex, int sizey);
148 extern mapstruct *cf_map_get_first(void);
149 extern mapstruct *cf_map_has_been_loaded(const char *name);
150 extern void cf_map_message(mapstruct *m, const char *msg, int color);
151 extern object *cf_map_get_object_at(mapstruct *m, int x, int y);
152 extern object *cf_map_insert_object(mapstruct *where, object *op, int x, int y);
153 extern object *cf_map_present_arch_by_name(const char *str, mapstruct *map, int nx, int ny);
154 extern int cf_map_get_flags(mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny);
155 extern object *cf_map_insert_object_there(object *op, mapstruct *m, object *originator, int flag);
156 extern int cf_map_get_difficulty(mapstruct *map);
157 extern int cf_map_get_reset_time(mapstruct *map);
158 extern int cf_map_get_reset_timeout(mapstruct *map);
159 extern int cf_map_get_players(mapstruct *map);
160 extern int cf_map_get_darkness(mapstruct *map);
161 extern int cf_map_get_light(mapstruct *map);
162 extern int cf_map_get_width(mapstruct *map);
163 extern int cf_map_get_height(mapstruct *map);
164 extern int cf_map_get_enter_x(mapstruct *map);
165 extern int cf_map_get_enter_y(mapstruct *map);
166 extern int cf_map_change_light(mapstruct *m, int change);
167 extern void cf_map_trigger_connected(objectlink *ol, object *cause, int state);
168 
169 /* Random maps */
170 extern int cf_random_map_set_variable(RMParms *rp, const char *buf);
171 extern mapstruct *cf_random_map_generate(const char *OutFileName, RMParms *RP, char **use_layout);
172 
173 /* Players */
174 extern sstring cf_player_get_title(object *op);
175 extern void cf_player_set_title(object *op, const char *title);
176 extern sstring cf_player_get_ip(object *op);
177 extern object *cf_player_get_marked_item(object *op);
178 extern void cf_player_set_marked_item(object *op, object *ob);
179 extern player *cf_player_find(const char *plname);
180 extern void cf_player_message(object *op, char *txt, int flags);
181 extern int cf_player_move(player *pl, int dir);
182 extern partylist *cf_player_get_party(object *op);
183 extern void cf_player_set_party(object *op, partylist *party);
184 extern int cf_player_can_pay(object *op);
185 
186 /* Archetypes */
187 extern archetype *cf_archetype_get_first(void);
192 extern object *cf_archetype_get_clone(archetype *arch);
193 
194 /* Parties */
195 extern partylist *cf_party_get_first(void);
196 extern const char *cf_party_get_name(partylist *party);
197 extern partylist *cf_party_get_next(partylist *party);
198 extern const char *cf_party_get_password(partylist *party);
200 extern player *cf_party_get_next_player(partylist *party, player *op);
201 
202 /* Regions */
203 extern region *cf_region_get_first(void);
204 extern const char *cf_region_get_name(region *reg);
205 extern region *cf_region_get_next(region *reg);
206 extern region *cf_region_get_parent(region *reg);
207 extern const char *cf_region_get_longname(region *reg);
208 extern const char *cf_region_get_message(region *reg);
209 
210 /* Friendly list */
211 extern object *cf_friendlylist_get_first(void);
212 extern object *cf_friendlylist_get_next(object *ob);
213 
214 #ifdef WIN32
215 
216 struct timezone {
217  int tz_minuteswest;
218  int tz_dsttime;
219 };
220 
221 int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info);
222 
223 #endif
224 
225 #endif /* PLUGIN_COMMON_H */
int cf_object_set_nrof(object *, int nrof)
int tz_dsttime
Definition: win32.c:41
sint64 cf_object_get_int64_property(object *op, int propcode)
Definition: player.h:146
long cf_object_get_long_property(object *op, long propcode)
int cf_map_get_light(mapstruct *map)
void cf_map_message(mapstruct *m, const char *msg, int color)
object * cf_archetype_get_clone(archetype *arch)
object * cf_object_change_map(object *op, mapstruct *m, object *originator, int flag, int x, int y)
signed short sint16
Definition: global.h:72
object * cf_create_object(void)
void cf_get_time(timeofday_t *tod)
void cf_spring_trap(object *trap, object *victim)
Definition: object.h:298
void cf_free_string(sstring str)
int cf_object_cast_ability(object *caster, object *ctoo, int dir, object *sp, char *flags)
const char * cf_get_month_name(int index)
const char * cf_object_get_key(object *op, const char *keyname)
const char * cf_object_get_msg(object *)
void cf_object_set_flag(object *ob, int flag, int value)
mapstruct * cf_get_empty_map(int sizex, int sizey)
int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info)
Definition: win32.c:54
object * cf_object_insert_in_ob(object *op, object *where)
partylist * cf_player_get_party(object *op)
unsigned char MoveType
Definition: define.h:725
partylist * cf_party_get_first(void)
void cf_object_set_weight(object *ob, int weight)
int cf_map_change_light(mapstruct *m, int change)
region * cf_map_get_region_property(mapstruct *map, int propcode)
region * cf_region_get_first(void)
const char * cf_party_get_name(partylist *party)
sint16 cf_object_get_resistance(object *op, int rtype)
int cf_object_pay_item(object *op, object *pl)
void *(* f_plug_api)(int *type,...)
Definition: plugin.h:121
int cf_map_get_height(mapstruct *map)
int cf_map_get_difficulty(mapstruct *map)
void cf_object_apply_below(object *pl)
mapstruct * cf_map_get_map_property(mapstruct *map, int propcode)
void cf_object_update(object *op, int flags)
region * cf_region_get_parent(region *reg)
int cf_player_move(player *pl, int dir)
void cf_fix_object(object *op)
archetype * cf_archetype_get_next(archetype *arch)
int cf_timer_destroy(int id)
region * cf_region_get_next(region *reg)
object * cf_player_get_marked_item(object *op)
char * cf_object_get_string_property(object *op, int propcode, char *buf, int size)
player * cf_player_find(const char *plname)
void cf_system_register_global_event(int event, const char *name, f_plug_api hook)
sstring cf_add_string(const char *str)
int cf_object_get_int_property(object *op, int propcode)
archetype * cf_archetype_get_head(archetype *arch)
Definition: object.h:321
char * cf_query_base_name(object *ob, int plural, char *name, int size)
int cf_object_transfer(object *op, int x, int y, int randomly, object *originator)
void cf_object_forget_spell(object *op, object *sp)
const char * cf_get_weekday_name(int index)
int cf_find_animation(const char *txt)
partylist * cf_party_get_next(partylist *party)
const char * cf_region_get_message(region *reg)
void cf_log(LogLevel logLevel, const char *format,...)
float cf_object_get_float_property(object *op, int propcode)
void cf_object_learn_spell(object *op, object *spell, int special_prayer)
int cf_object_check_trigger(object *op, object *cause)
sstring cf_object_get_sstring_property(object *op, int propcode)
void cf_log_plain(LogLevel logLevel, const char *message)
int cf_object_pay_amount(object *pl, uint64 to_pay)
const char * cf_get_season_name(int index)
char * cf_strdup_local(const char *str)
object * cf_friendlylist_get_first(void)
MoveType cf_object_get_movetype_property(object *op, int propcode)
void cf_player_set_marked_item(object *op, object *ob)
int cf_player_can_pay(object *op)
int cf_timer_create(object *ob, long delay, int mode)
int cf_object_get_weight(object *ob)
int cf_map_get_players(mapstruct *map)
int cf_init_plugin(f_plug_api getHooks)
void cf_object_set_int_property(object *op, int propcode, int value)
int cf_object_query_cost(const object *tmp, object *who, int flag)
void cf_object_set_float_property(object *op, int propcode, float value)
const char * cf_party_get_password(partylist *party)
Definition: map.h:297
int cf_object_user_event(object *op, object *activator, object *third, const char *message, int fix)
mapstruct * cf_map_get_map(const char *name, int flags)
double cf_object_get_double_property(object *op, int propcode)
sstring cf_find_string(const char *str)
object * cf_map_present_arch_by_name(const char *str, mapstruct *map, int nx, int ny)
sstring cf_query_name_pl(object *ob)
void cf_object_set_int64_property(object *op, int propcode, sint64 value)
const char * cf_region_get_name(region *reg)
object * cf_map_insert_object(mapstruct *where, object *op, int x, int y)
int cf_object_get_nrof(object *)
int cf_map_get_reset_time(mapstruct *map)
object * cf_object_insert_object(object *op, object *container)
void cf_object_say(object *op, char *msg)
void cf_system_unregister_global_event(int event, const char *name)
void * value
Definition: hashtable.h:12
void cf_map_set_string_property(mapstruct *map, int propcode, const char *value)
int cf_object_query_money(const object *op)
char * cf_get_maps_directory(const char *name, char *buf, int size)
int cf_random_map_set_variable(RMParms *rp, const char *buf)
void cf_map_set_int_property(mapstruct *map, int propcode, int value)
object * cf_friendlylist_get_next(object *ob)
object * cf_object_present_archname_inside(object *op, char *whatstr)
int cf_map_get_reset_timeout(mapstruct *map)
LogLevel
Definition: logger.h:37
int cf_map_get_darkness(mapstruct *map)
void cf_object_set_movetype_property(object *op, int propcode, MoveType value)
int cf_find_face(const char *name, int error)
mapstruct * cf_object_get_map_property(object *op, int propcode)
void cf_object_remove(object *op)
void cf_map_trigger_connected(objectlink *ol, object *cause, int state)
object * cf_map_get_object_at(mapstruct *m, int x, int y)
static const flag_definition flags[]
int cf_object_apply(object *op, object *author, int flags)
void cf_player_set_party(object *op, partylist *party)
const char * cf_re_cmp(const char *str, const char *regexp)
object * cf_object_get_object_property(object *op, int propcode)
const char * sstring
Definition: global.h:84
void cf_object_set_weight_limit(object *ob, int weight)
archetype * cf_archetype_get_first(void)
void cf_player_message(object *op, char *txt, int flags)
player * cf_party_get_next_player(partylist *party, player *op)
player * cf_party_get_first_player(partylist *party)
int cf_object_get_flag(object *ob, int flag)
int cf_object_move(object *op, int dir, object *originator)
sstring cf_player_get_ip(object *op)
Definition: tod.h:61
archetype * cf_archetype_get_more(archetype *arch)
void cf_object_pickup(object *op, object *what)
void cf_object_drop(object *op, object *author)
void cf_object_change_exp(object *op, sint64 exp, const char *skill_name, int flag)
mapstruct * cf_map_has_been_loaded(const char *name)
int cf_map_get_enter_y(mapstruct *map)
sstring cf_map_get_sstring_property(mapstruct *map, int propcode)
const char * cf_get_directory(int id)
mapstruct * cf_map_get_first(void)
void cf_player_set_title(object *op, const char *title)
const char * cf_region_get_longname(region *reg)
object * cf_object_check_for_spell(object *op, const char *name)
sstring cf_player_get_title(object *op)
void cf_object_set_resistance(object *op, int rtype, sint16 value)
int cf_object_teleport(object *ob, mapstruct *map, int x, int y)
partylist * cf_object_get_partylist_property(object *op, int propcode)
object * cf_object_clone(object *op, int clonetype)
archetype * cf_object_get_archetype_property(object *op, int propcode)
void cf_object_set_string_property(object *op, int propcode, const char *value)
void cf_object_set_long_property(object *op, int propcode, long value)
sstring cf_archetype_get_name(archetype *arch)
Definition: win32.c:39
Definition: map.h:346
const char * cf_get_periodofday_name(int index)
void cf_object_free(object *ob)
int cf_object_out_of_map(object *op, int x, int y)
int cf_object_change_abil(object *op, object *tmp)
int cf_object_get_weight_limit(object *ob)
mapstruct * cf_random_map_generate(const char *OutFileName, RMParms *RP, char **use_layout)
object * cf_map_insert_object_there(object *op, mapstruct *m, object *originator, int flag)
int cf_map_get_int_property(mapstruct *map, int property)
object * cf_create_object_by_name(const char *name)
char * cf_query_name(object *ob, char *name, int size)
int cf_map_get_width(mapstruct *map)
int cf_object_move_to(object *op, int x, int y)
int cf_object_cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
int cf_map_get_enter_x(mapstruct *map)
int cf_map_get_flags(mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny)
int tz_minuteswest
Definition: win32.c:40
void cf_object_set_object_property(object *op, int propcode, object *value)
int cf_object_set_key(object *op, const char *keyname, const char *value, int add_key)