Crossfire Server, Trunk
plugins.c
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 1999-2014 Mark Wedel and the Crossfire Development Team
5  * Copyright (c) 1992 Frank Tore Johansen
6  *
7  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
8  * welcome to redistribute it under certain conditions. For details, please
9  * see COPYING and LICENSE.
10  *
11  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
12  */
13 
22 #if 0
23 
24 #define PLUGIN_DEBUG
25 #endif
26 
27 /*****************************************************************************/
28 /* First, the headers. We only include plugin.h, because all other includes */
29 /* are done into it, and plugproto.h (which is used only by this file). */
30 /*****************************************************************************/
31 
32 #include <assert.h>
33 #include <stdlib.h>
34 #include <string.h>
35 
36 #include "plugin.h"
37 #include "shop.h"
38 #include "sproto.h"
39 #include "svnversion.h"
40 #include "timers.h"
41 
42 #ifdef WIN32
43 #include "libloaderapi.h"
44 #endif
45 
47 #define NR_OF_HOOKS (sizeof(plug_hooks)/sizeof(*plug_hooks))
48 
49 static void cfapi_cost_string_from_value(int *type, ...);
50 static void cfapi_system_find_animation(int *type, ...);
51 static void cfapi_system_find_face(int *type, ...);
52 static void cfapi_system_strdup_local(int *type, ...);
53 static void cfapi_system_register_global_event(int *type, ...);
54 static void cfapi_system_unregister_global_event(int *type, ...);
55 static void cfapi_system_add_string(int *type, ...);
56 static void cfapi_system_remove_string(int *type, ...);
57 static void cfapi_system_find_string(int *type, ...);
58 static void cfapi_system_check_path(int *type, ...);
59 static void cfapi_system_re_cmp(int *type, ...);
60 static void cfapi_system_directory(int *type, ...);
61 static void cfapi_get_time(int *type, ...);
62 static void cfapi_get_season_name(int *type, ...);
63 static void cfapi_get_weekday_name(int *type, ...);
64 static void cfapi_get_month_name(int *type, ...);
65 static void cfapi_get_periodofday_name(int *type, ...);
66 static void cfapi_timer_create(int *type, ...);
67 static void cfapi_timer_destroy(int *type, ...);
68 static void cfapi_log(int *type, ...);
69 static void cfapi_map_get_map(int *type, ...);
70 static void cfapi_map_has_been_loaded(int *type, ...);
71 static void cfapi_map_create_path(int *type, ...);
72 static void cfapi_map_get_map_property(int *type, ...);
73 static void cfapi_map_set_map_property(int *type, ...);
74 static void cfapi_map_out_of_map(int *type, ...);
75 static void cfapi_map_update_position(int *type, ...);
76 static void cfapi_map_delete_map(int *type, ...);
77 static void cfapi_map_message(int *type, ...);
78 static void cfapi_map_get_object_at(int *type, ...);
79 static void cfapi_map_find_by_archetype_name(int *type, ...);
80 static void cfapi_map_change_light(int *type, ...);
81 static void cfapi_object_move(int *type, ...);
82 static void cfapi_object_get_key(int *type, ...);
83 static void cfapi_object_set_key(int *type, ...);
84 static void cfapi_object_get_property(int *type, ...);
85 static void cfapi_object_set_property(int *type, ...);
86 static void cfapi_object_apply_below(int *type, ...);
87 static void cfapi_object_apply(int *type, ...);
88 static void cfapi_object_identify(int *type, ...);
89 static void cfapi_object_describe(int *type, ...);
90 static void cfapi_object_drain(int *type, ...);
91 static void cfapi_object_remove_depletion(int *type, ...);
92 static void cfapi_object_fix(int *type, ...);
93 static void cfapi_object_give_skill(int *type, ...);
94 static void cfapi_object_transmute(int *type, ...);
95 static void cfapi_object_remove(int *type, ...);
96 static void cfapi_object_delete(int *type, ...);
97 static void cfapi_object_clone(int *type, ...);
98 static void cfapi_object_create(int *type, ...);
99 static void cfapi_object_insert(int *type, ...);
100 static void cfapi_object_split(int *type, ...);
101 static void cfapi_object_merge(int *type, ...);
102 static void cfapi_object_distance(int *type, ...);
103 static void cfapi_object_update(int *type, ...);
104 static void cfapi_object_clear(int *type, ...);
105 static void cfapi_object_reset(int *type, ...);
106 static void cfapi_object_clean_object(int *type, ...);
107 static void cfapi_object_on_same_map(int *type, ...);
108 static void cfapi_object_spring_trap(int *type, ...);
109 static void cfapi_object_check_trigger(int *type, ...);
110 static void cfapi_map_trigger_connected(int *type, ...);
111 static void cfapi_object_query_money(int *type, ...);
112 static void cfapi_object_cast(int *type, ...);
113 static void cfapi_object_learn_spell(int *type, ...);
114 static void cfapi_object_forget_spell(int *type, ...);
115 static void cfapi_object_check_spell(int *type, ...);
116 static void cfapi_object_pay_amount(int *type, ...);
117 static void cfapi_object_pay_item(int *type, ...);
118 static void cfapi_object_transfer(int *type, ...);
119 static void cfapi_object_find_archetype_inside(int *type, ...);
120 static void cfapi_object_find_by_arch_name(int *type, ...);
121 static void cfapi_object_find_by_name(int *type, ...);
122 static void cfapi_object_drop(int *type, ...);
123 static void cfapi_object_change_abil(int *type, ...);
124 static void cfapi_object_say(int *type, ...);
125 static void cfapi_player_find(int *type, ...);
126 static void cfapi_player_message(int *type, ...);
127 static void cfapi_object_change_exp(int *type, ...);
128 static void cfapi_player_can_pay(int *type, ...);
129 static void cfapi_player_knowledge(int *type, ...);
130 static void cfapi_object_teleport(int *type, ...);
131 static void cfapi_object_pickup(int *type, ...);
132 static void cfapi_archetype_get_property(int *type, ...);
133 static void cfapi_party_get_property(int *type, ...);
134 static void cfapi_region_get_property(int *type, ...);
135 static void cfapi_friendlylist_get_next(int *type, ...);
136 static void cfapi_set_random_map_variable(int *type, ...);
137 static void cfapi_generate_random_map(int *type, ...);
138 static void cfapi_object_user_event(int *type, ...);
139 static void cfapi_player_quest(int *type, ...);
140 static void cfapi_object_perm_exp(int *type, ...);
141 static void cfapi_register_command(int *type, ...);
142 static void cfapi_unregister_command(int *type, ...);
143 
147 static const hook_entry plug_hooks[] = {
148  { cfapi_system_add_string, 0, "cfapi_system_add_string" },
149  { cfapi_system_register_global_event, 1, "cfapi_system_register_global_event" },
150  { cfapi_system_remove_string, 2, "cfapi_system_remove_string" },
151  { cfapi_system_unregister_global_event, 3, "cfapi_system_unregister_global_event" },
152  { cfapi_system_check_path, 4, "cfapi_system_check_path" },
153  { cfapi_system_re_cmp, 5, "cfapi_system_re_cmp" },
154  { cfapi_system_strdup_local, 6, "cfapi_system_strdup_local" },
155  { cfapi_system_directory, 7, "cfapi_system_directory" },
156  { cfapi_system_find_animation, 8, "cfapi_system_find_animation" },
157  { cfapi_object_clean_object, 9, "cfapi_object_clean_object" },
158  { cfapi_object_on_same_map, 10, "cfapi_object_on_same_map" },
159  { cfapi_object_get_key, 11, "cfapi_object_get_key" },
160  { cfapi_object_set_key, 12, "cfapi_object_set_key" },
161  { cfapi_object_get_property, 13, "cfapi_object_get_property" },
162  { cfapi_object_set_property, 14, "cfapi_object_set_property" },
163  { cfapi_object_apply, 15, "cfapi_object_apply" },
164  { cfapi_object_identify, 16, "cfapi_object_identify" },
165  { cfapi_object_describe, 17, "cfapi_object_describe" },
166  { cfapi_object_drain, 18, "cfapi_object_drain" },
167  { cfapi_object_fix, 19, "cfapi_object_fix" },
168  { cfapi_object_give_skill, 20, "cfapi_object_give_skill" },
169  { cfapi_object_transmute, 21, "cfapi_object_transmute" },
170  { cfapi_object_remove, 22, "cfapi_object_remove" },
171  { cfapi_object_delete, 23, "cfapi_object_delete" },
172  { cfapi_object_clone, 24, "cfapi_object_clone" },
173  { cfapi_object_create, 26, "cfapi_object_create" },
174  { cfapi_object_insert, 27, "cfapi_object_insert" },
175  { cfapi_object_split, 28, "cfapi_object_split" },
176  { cfapi_object_merge, 29, "cfapi_object_merge" },
177  { cfapi_object_distance, 30, "cfapi_object_distance" },
178  { cfapi_object_update, 31, "cfapi_object_update" },
179  { cfapi_object_clear, 32, "cfapi_object_clear" },
180  { cfapi_object_reset, 33, "cfapi_object_reset" },
181  { cfapi_object_spring_trap, 35, "cfapi_object_spring_trap" },
182  { cfapi_object_check_trigger, 36, "cfapi_object_check_trigger" },
183  { cfapi_object_query_money, 38, "cfapi_object_query_money" },
184  { cfapi_object_cast, 39, "cfapi_object_cast" },
185  { cfapi_object_learn_spell, 40, "cfapi_object_learn_spell" },
186  { cfapi_object_forget_spell, 41, "cfapi_object_forget_spell" },
187  { cfapi_object_check_spell, 42, "cfapi_object_check_spell" },
188  { cfapi_object_pay_amount, 43, "cfapi_object_pay_amount" },
189  { cfapi_object_pay_item, 44, "cfapi_object_pay_item" },
190  { cfapi_object_transfer, 45, "cfapi_object_transfer" },
191  { cfapi_object_drop, 46, "cfapi_object_drop" },
192  { cfapi_object_change_abil, 47, "cfapi_object_change_abil" },
193  { cfapi_object_find_archetype_inside, 48, "cfapi_object_find_archetype_inside" },
194  { cfapi_object_say, 49, "cfapi_object_say" },
195  { cfapi_map_get_map, 50, "cfapi_map_get_map" },
196  { cfapi_map_has_been_loaded, 51, "cfapi_map_has_been_loaded" },
197  { cfapi_map_create_path, 52, "cfapi_map_create_path" },
198  { cfapi_map_get_map_property, 53, "cfapi_map_get_property" },
199  { cfapi_map_set_map_property, 54, "cfapi_map_set_property" },
200  { cfapi_map_out_of_map, 55, "cfapi_map_out_of_map" },
201  { cfapi_map_update_position, 56, "cfapi_map_update_position" },
202  { cfapi_map_delete_map, 57, "cfapi_map_delete_map" },
203  { cfapi_map_message, 58, "cfapi_map_message" },
204  { cfapi_map_get_object_at, 59, "cfapi_map_get_object_at" },
205  { cfapi_map_change_light, 60, "cfapi_map_change_light" },
206  { cfapi_map_find_by_archetype_name, 61, "cfapi_map_find_by_archetype_name" },
207  { cfapi_player_find, 62, "cfapi_player_find" },
208  { cfapi_player_message, 63, "cfapi_player_message" },
209  { cfapi_object_change_exp, 64, "cfapi_object_change_exp" },
210  { cfapi_object_teleport, 65, "cfapi_object_teleport" },
211  { cfapi_object_pickup, 67, "cfapi_object_pickup" },
212  { cfapi_object_move, 68, "cfapi_object_move" },
213  { cfapi_object_apply_below, 69, "cfapi_object_apply_below" },
214  { cfapi_generate_random_map, 70, "cfapi_generate_random_map" },
215  { cfapi_archetype_get_property, 71, "cfapi_archetype_get_property" },
216  { cfapi_party_get_property, 72, "cfapi_party_get_property" },
217  { cfapi_region_get_property, 73, "cfapi_region_get_property" },
218  { cfapi_player_can_pay, 74, "cfapi_player_can_pay" },
219  { cfapi_log, 75, "cfapi_log" },
220  { cfapi_get_time, 76, "cfapi_system_get_time" },
221  { cfapi_timer_create, 77, "cfapi_system_timer_create" },
222  { cfapi_timer_destroy, 78, "cfapi_system_timer_destroy" },
223  { cfapi_friendlylist_get_next, 79, "cfapi_friendlylist_get_next" },
224  { cfapi_set_random_map_variable, 80, "cfapi_set_random_map_variable" },
225  { cfapi_system_find_face, 81, "cfapi_system_find_face" },
226  { cfapi_get_season_name, 82, "cfapi_system_get_season_name" },
227  { cfapi_get_month_name, 83, "cfapi_system_get_month_name" },
228  { cfapi_get_weekday_name, 84, "cfapi_system_get_weekday_name" },
229  { cfapi_get_periodofday_name, 85, "cfapi_system_get_periodofday_name" },
230  { cfapi_map_trigger_connected, 86, "cfapi_map_trigger_connected" },
231  { cfapi_object_user_event, 87, "cfapi_object_user_event" },
232  { cfapi_system_find_string, 88, "cfapi_system_find_string" },
233  { cfapi_cost_string_from_value, 90, "cfapi_cost_string_from_value" },
234  { cfapi_player_quest, 91, "cfapi_player_quest" },
235  { cfapi_object_remove_depletion, 92, "cfapi_object_remove_depletion" },
236  { cfapi_object_find_by_arch_name, 93, "cfapi_object_find_by_arch_name" },
237  { cfapi_object_find_by_name, 94, "cfapi_object_find_by_name" },
238  { cfapi_player_knowledge, 95, "cfapi_player_knowledge" },
239  { cfapi_object_perm_exp, 96, "cfapi_object_perm_exp" },
240  { cfapi_register_command, 97, "cfapi_register_command" },
241  { cfapi_unregister_command, 98, "cfapi_unregister_command" },
242 };
243 
246 
247 /*****************************************************************************/
248 /* NEW PLUGIN STUFF STARTS HERE */
249 /*****************************************************************************/
250 
256 static crossfire_plugin *plugins_find_plugin(const char *id) {
257  crossfire_plugin *cp;
258 
259  if (plugins_list == NULL)
260  return NULL;
261 
262  for (cp = plugins_list; cp != NULL; cp = cp->next) {
263  if (!strcmp(id, cp->id)) {
264  return cp;
265  }
266  }
267  return NULL;
268 }
269 
270 #ifdef WIN32
271 static const char *plugins_dlerror(void)
272 {
273  static char buf[256];
274  DWORD err;
275  char *p;
276 
277  err = GetLastError();
278  if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, buf, sizeof (buf), NULL) == 0)
279  snprintf(buf, sizeof (buf), "error %lu", err);
280  p = strchr(buf, '\0');
281  while (p > buf && (p[-1] == '\r' || p[-1] == '\n'))
282  p--;
283  *p = '\0';
284  return buf;
285 }
286 
287 #endif /* WIN32 */
288 
294 static void send_changed_object(object *op) {
295  object *tmp;
296  player *pl;
297 
298  if (op->env != NULL) {
300  if (!tmp) {
301  for (pl = first_player; pl; pl = pl->next)
302  if (pl->ob->container == op->env)
303  break;
304  if (pl)
305  tmp = pl->ob;
306  else
307  tmp = NULL;
308  }
309  if (tmp)
310  /* We don't know what changed, so we send everything. */
312  } else {
314  if (tmp->type == PLAYER)
315  tmp->contr->socket.update_look = 1;
317  }
318 }
319 
320 static void cfapi_get_hooks(int *type, ...) {
321  va_list args;
322  int request_type;
323  char *buf;
324  f_plug_api *rapi;
325 
326  *type = CFAPI_NONE;
327 
328  va_start(args, type);
329  request_type = va_arg(args, int);
330  if (request_type == 0) { /* By nr */
331  size_t fid;
332 
333  fid = va_arg(args, int);
334  rapi = va_arg(args, f_plug_api *);
335  if (fid >= NR_OF_HOOKS) {
336  *rapi = NULL;
337  *type = CFAPI_NONE;
338  } else {
339  *rapi = plug_hooks[fid].func;
340  *type = CFAPI_FUNC;
341  }
342  } else { /* by name */
343  size_t i;
344 
345  buf = va_arg(args, char *);
346  rapi = va_arg(args, f_plug_api *);
347  *rapi = NULL;
348  *type = CFAPI_NONE;
349  for (i = 0; i < NR_OF_HOOKS; i++) {
350  if (!strcmp(buf, plug_hooks[i].fname)) {
351  *rapi = plug_hooks[i].func;
352  *type = CFAPI_FUNC;
353  break;
354  }
355  }
356  }
357  va_end(args);
358 }
359 
366 int plugins_init_plugin(const char *libfile) {
367  LIBPTRTYPE ptr;
368  f_plug_init initfunc;
369  f_plug_property propfunc;
370  f_plug_event eventfunc;
371  f_plug_postinit postfunc;
372  f_plug_postinit closefunc;
373  int i;
374  crossfire_plugin *cp;
375  crossfire_plugin *ccp;
376  char *svn_rev;
377 
378 
379  /* Open the plugin lib and load the required functions */
380  ptr = plugins_dlopen(libfile);
381  if (ptr == NULL) {
382  LOG(llevError, "Error trying to load %s: %s\n", libfile, plugins_dlerror());
383  return -1;
384  }
385  svn_rev = (char*) plugins_dlsym(ptr, "SvnRevPlugin");
386  if (svn_rev == NULL) {
387  LOG(llevError, "Unable to find SvnRevPlugin in %s\n", libfile);
388  plugins_dlclose(ptr);
389  return -1;
390  }
391  if (settings.ignore_plugin_compatibility == 0 && strcmp(svn_rev, SVN_REV)) {
392  LOG(llevError, "Version mismatch in in %s (%s != %s)\n", libfile, svn_rev, SVN_REV);
393  plugins_dlclose(ptr);
394  return -1;
395  }
396 
397  initfunc = (f_plug_init)plugins_dlsym(ptr, "initPlugin");
398  if (initfunc == NULL) {
399  LOG(llevError, "Plugin error while requesting %s.initPlugin: %s\n", libfile, plugins_dlerror());
400  plugins_dlclose(ptr);
401  return -1;
402  }
403  propfunc = (f_plug_property)plugins_dlsym(ptr, "getPluginProperty");
404  if (propfunc == NULL) {
405  LOG(llevError, "Plugin error while requesting %s.getPluginProperty: %s\n", libfile, plugins_dlerror());
406  plugins_dlclose(ptr);
407  return -1;
408  }
409  eventfunc = (f_plug_event)plugins_dlsym(ptr, "eventListener");
410  if (eventfunc == NULL) {
411  LOG(llevError, "Plugin error while requesting %s.eventListener: %s\n", libfile, plugins_dlerror());
412  plugins_dlclose(ptr);
413  return -1;
414  }
415  postfunc = (f_plug_postinit)plugins_dlsym(ptr, "postInitPlugin");
416  if (postfunc == NULL) {
417  LOG(llevError, "Plugin error while requesting %s.postInitPlugin: %s\n", libfile, plugins_dlerror());
418  plugins_dlclose(ptr);
419  return -1;
420  }
421  closefunc = (f_plug_postinit)plugins_dlsym(ptr, "closePlugin");
422  if (closefunc == NULL) {
423  LOG(llevError, "Plugin error while requesting %s.closePlugin: %s\n", libfile, plugins_dlerror());
424  plugins_dlclose(ptr);
425  return -1;
426  }
427  i = initfunc("2.0", cfapi_get_hooks);
428  cp = malloc(sizeof(crossfire_plugin));
429  for (i = 0; i < NR_EVENTS; i++)
430  cp->global_registration[i] = 0;
431  cp->propfunc = propfunc;
432  cp->closefunc = closefunc;
433  cp->libptr = ptr;
434  propfunc(&i, "Identification", cp->id, sizeof(cp->id));
435  propfunc(&i, "FullName", cp->fullname, sizeof(cp->fullname));
436  events_register_object_handler(cp->id, eventfunc);
437  cp->next = NULL;
438  cp->prev = NULL;
439  if (plugins_list == NULL) {
440  plugins_list = cp;
441  } else {
442  for (ccp = plugins_list; ccp->next != NULL; ccp = ccp->next)
443  ;
444  ccp->next = cp;
445  cp->prev = ccp;
446  }
447  postfunc();
448  return 0;
449 }
450 
457 int plugins_remove_plugin(const char *id) {
458  crossfire_plugin *cp;
459 
460  if (plugins_list == NULL)
461  return -1;
462 
463  for (cp = plugins_list; cp != NULL; cp = cp->next) {
464  if (!strcmp(id, cp->id)) {
465  crossfire_plugin *n;
466  crossfire_plugin *p;
467 
468  for (int eventcode = 0; eventcode < NR_EVENTS; eventcode++) {
469  if (cp->global_registration[eventcode]) {
470  events_unregister_global_handler(eventcode, cp->global_registration[eventcode]);
471  }
472  }
474 
475  n = cp->next;
476  p = cp->prev;
477  if (cp->closefunc)
478  cp->closefunc();
479  plugins_dlclose(cp->libptr);
480  if (n != NULL) {
481  if (p != NULL) {
482  n->prev = p;
483  p->next = n;
484  } else {
485  n->prev = NULL;
486  plugins_list = n;
487  }
488  } else {
489  if (p != NULL)
490  p->next = NULL;
491  else
492  plugins_list = NULL;
493  }
494  free(cp);
495  return 0;
496  }
497  }
498  return -1;
499 }
500 
506 void plugins_display_list(object *op) {
507  crossfire_plugin *cp;
508 
510  "List of loaded plugins:\n-----------------------");
511 
512  if (plugins_list == NULL)
513  return;
514 
515  for (cp = plugins_list; cp != NULL; cp = cp->next) {
517  "%s, %s",
518  cp->id, cp->fullname);
519  }
520 }
521 
522 /* SYSTEM-RELATED HOOKS */
523 
529 static void cfapi_cost_string_from_value(int *type, ...) {
530  uint64_t cost;
531  char *buffer, *final;
532  int length, largest_coin;
533  va_list args;
534 
535  va_start(args, type);
536  cost = va_arg(args, uint64_t);
537  largest_coin = va_arg(args, int);
538  buffer = va_arg(args, char*);
539  length = va_arg(args, int);
540  va_end(args);
541 
542  *type = CFAPI_NONE;
543 
544  if (length < 1)
545  return;
546 
547  final = cost_string_from_value(cost, largest_coin);
548 
549  strncpy(buffer, final, length - 1);
550  buffer[length - 1] = '\0';
551  free(final);
552 }
553 
559 static void cfapi_system_find_animation(int *type, ...) {
560  va_list args;
561  const char *name;
562  int *num;
563  const Animations *anim;
564 
565  va_start(args, type);
566  name = va_arg(args, const char *);
567  num = va_arg(args, int *);
568  va_end(args);
569 
571  (*num) = anim ? anim->num : 0;
572  *type = CFAPI_INT;
573 }
574 
580 static void cfapi_system_find_face(int *type, ...) {
581  va_list args;
582  const char *face;
583  int error;
584  int *num;
585  const Face *f;
586 
587  va_start(args, type);
588  face = va_arg(args, const char *);
589  error = va_arg(args, int);
590  num = va_arg(args, int *);
591  va_end(args);
592 
593  f = try_find_face(face, get_face_by_id(error));
594  (*num) = f ? f->number : 0;
595  *type = CFAPI_INT;
596 }
597 
603 static void cfapi_system_strdup_local(int *type, ...) {
604  va_list args;
605  const char *txt;
606  char **ret;
607 
608  va_start(args, type);
609  txt = va_arg(args, const char *);
610  ret = va_arg(args, char **);
611  va_end(args);
612 
613  *ret = strdup_local(txt);
614  *type = CFAPI_STRING;
615 }
616 
617 static void cfapi_system_register_global_event(int *type, ...) {
618  va_list args;
619  int eventcode;
620  char *pname;
621  f_plug_event hook;
622  crossfire_plugin *cp;
623 
624  va_start(args, type);
625  eventcode = va_arg(args, int);
626  pname = va_arg(args, char *);
627  hook = va_arg(args, f_plug_event);
628  va_end(args);
629 
630  *type = CFAPI_NONE;
631 
632  cp = plugins_find_plugin(pname);
633  if (!cp->global_registration[eventcode]) {
634  cp->global_registration[eventcode] = events_register_global_handler(eventcode, hook);
635  }
636 }
637 
639  va_list args;
640  int eventcode;
641  char *pname;
642  crossfire_plugin *cp;
643 
644  va_start(args, type);
645  eventcode = va_arg(args, int);
646  pname = va_arg(args, char *);
647  va_end(args);
648 
649  *type = CFAPI_NONE;
650 
651  cp = plugins_find_plugin(pname);
652  if (cp->global_registration[eventcode]) {
653  events_unregister_global_handler(eventcode, cp->global_registration[eventcode]);
654  cp->global_registration[eventcode] = 0;
655  }
656 }
657 
664 static void cfapi_system_add_string(int *type, ...) {
665  va_list args;
666  const char *str;
667  sstring *rv;
668 
669  va_start(args, type);
670  str = va_arg(args, const char *);
671  rv = va_arg(args, sstring *);
672  va_end(args);
673 
674  *rv = add_string(str);
675  *type = CFAPI_SSTRING;
676 }
677 
684 static void cfapi_system_remove_string(int *type, ...) {
685  va_list args;
686  sstring str;
687 
688  va_start(args, type);
689  str = va_arg(args, sstring);
690  va_end(args);
691 
692  free_string(str);
693  *type = CFAPI_NONE;
694 }
695 
702 static void cfapi_system_find_string(int *type, ...) {
703  va_list args;
704  const char *str;
705  sstring *rv;
706 
707  va_start(args, type);
708  str = va_arg(args, const char *);
709  rv = va_arg(args, sstring *);
710  va_end(args);
711 
712  *rv = find_string(str);
713  *type = CFAPI_SSTRING;
714 }
715 
721 static void cfapi_system_check_path(int *type, ...) {
722  va_list args;
723  const char *name;
724  int prepend_dir;
725  int *ret;
726 
727  va_start(args, type);
728 
729  name = va_arg(args, char *);
730  prepend_dir = va_arg(args, int);
731  ret = va_arg(args, int *);
732 
733  *ret = check_path(name, prepend_dir);
734 
735  va_end(args);
736  *type = CFAPI_INT;
737 }
738 
744 static void cfapi_system_re_cmp(int *type, ...) {
745  va_list args;
746  const char *str;
747  const char *regexp;
748  const char **rv;
749 
750  va_start(args, type);
751 
752  str = va_arg(args, char *);
753  regexp = va_arg(args, char *);
754  rv = va_arg(args, const char **);
755 
756  *rv = re_cmp(str, regexp);
757 
758  va_end(args);
759  *type = CFAPI_STRING;
760 }
761 
762 static void cfapi_system_directory(int *type, ...) {
763  va_list args;
764  int dirtype;
765  const char **str;
766 
767  va_start(args, type);
768 
769  dirtype = va_arg(args, int);
770  str = va_arg(args, const char **);
771  va_end(args);
772 
773  *type = CFAPI_STRING;
774 
775  switch (dirtype) {
776  case 0:
777  *str = settings.mapdir;
778  break;
779 
780  case 1:
782  break;
783 
784  case 2:
785  *str = settings.tmpdir;
786  break;
787 
788  case 3:
789  *str = settings.confdir;
790  break;
791 
792  case 4:
793  *str = settings.localdir;
794  break;
795 
796  case 5:
798  break;
799 
800  case 6:
801  *str = settings.datadir;
802  break;
803 
804  default:
805  *str = NULL;
806  }
807 }
808 
815 static void cfapi_get_time(int *type, ...) {
816  va_list args;
817  timeofday_t *tod;
818 
819  va_start(args, type);
820  tod = va_arg(args, timeofday_t *);
821  va_end(args);
822 
823  get_tod(tod);
824  *type = CFAPI_NONE;
825 }
826 
827 #define string_get_int(name) \
828  va_list args; \
829  int index; \
830  const char **str; \
831  va_start(args, type); \
832  index = va_arg(args, int); \
833  str = va_arg(args, const char **); \
834  va_end(args); \
835  *str = name(index); \
836  *type = CFAPI_STRING; \
837 
838 
846 static void cfapi_get_season_name(int *type, ...) {
848 }
849 
858 static void cfapi_get_weekday_name(int *type, ...) {
860 }
861 
870 static void cfapi_get_month_name(int *type, ...) {
872 }
873 
882 static void cfapi_get_periodofday_name(int *type, ...) {
884 }
885 
897 static void cfapi_timer_create(int *type, ...) {
898  va_list args;
899  int res;
900  object *ob;
901  long delay;
902  int mode;
903  int *timer;
904 
905  va_start(args, type);
906  ob = va_arg(args, object *);
907  delay = va_arg(args, long);
908  mode = va_arg(args, int);
909  timer = va_arg(args, int *);
910  va_end(args);
911  *type = CFAPI_INT;
912 
913  *timer = cftimer_find_free_id();
914  if (*timer != TIMER_ERR_ID) {
915  res = cftimer_create(*timer, delay, ob, mode);
916  if (res != TIMER_ERR_NONE)
917  *timer = res;
918  }
919 }
920 
930 static void cfapi_timer_destroy(int *type, ...) {
931  va_list args;
932  int id;
933  int *err;
934 
935  va_start(args, type);
936  id = va_arg(args, int);
937  err = va_arg(args, int *);
938  va_end(args);
939  *type = CFAPI_INT;
940 
941  *err = cftimer_destroy(id);
942 }
943 
949 static void cfapi_log(int *type, ...) {
950  va_list args;
951  LogLevel logLevel;
952  const char *message;
953 
954  va_start(args, type);
955  logLevel = va_arg(args, LogLevel);
956  message = va_arg(args, const char *);
957  LOG(logLevel, "%s", message);
958  va_end(args);
959 
960  *type = CFAPI_NONE;
961 }
962 
963 /* MAP RELATED HOOKS */
964 
973 static void cfapi_map_get_map(int *type, ...) {
974  va_list args;
975  mapstruct **ret;
976  int ctype;
977  int x, y;
978  int16_t nx, ny;
979  const char *name;
980  mapstruct *m;
981 
982  va_start(args, type);
983 
984  ctype = va_arg(args, int);
985 
986  switch (ctype) {
987  case 0:
988  x = va_arg(args, int);
989  y = va_arg(args, int);
990  ret = va_arg(args, mapstruct **);
991  *ret = get_empty_map(x, y);
992  break;
993 
994  case 1:
995  name = va_arg(args, const char *);
996  x = va_arg(args, int);
997  ret = va_arg(args, mapstruct **);
998  *ret = ready_map_name(name, x);
999  break;
1000 
1001  case 2:
1002  m = va_arg(args, mapstruct *);
1003  nx = va_arg(args, int);
1004  ny = va_arg(args, int);
1005  ret = va_arg(args, mapstruct **);
1006  *ret = get_map_from_coord(m, &nx, &ny);
1007  break;
1008 
1009  default:
1010  *type = CFAPI_NONE;
1011  va_end(args);
1012  return;
1013  break;
1014  }
1015  va_end(args);
1016  *type = CFAPI_PMAP;
1017 }
1018 
1024 static void cfapi_map_has_been_loaded(int *type, ...) {
1025  va_list args;
1026  mapstruct **map;
1027  char *string;
1028 
1029  va_start(args, type);
1030  string = va_arg(args, char *);
1031  map = va_arg(args, mapstruct **);
1032  *map = has_been_loaded(string);
1033  va_end(args);
1034  *type = CFAPI_PMAP;
1035 }
1036 
1042 static void cfapi_map_create_path(int *type, ...) {
1043  va_list args;
1044  int ctype, size;
1045  const char *str;
1046  char *name;
1047 
1048  va_start(args, type);
1049 
1050  ctype = va_arg(args, int);
1051  str = va_arg(args, const char *);
1052  name = va_arg(args, char *);
1053  size = va_arg(args, int);
1054  *type = CFAPI_STRING;
1055 
1056  switch (ctype) {
1057  case 0:
1058  create_pathname(str, name, size);
1059  break;
1060 
1061  case 1:
1063  break;
1064 
1065 /* case 2:
1066  rv = create_items_path(str);
1067  break;*/
1068 
1069  default:
1070  *type = CFAPI_NONE;
1071  break;
1072  }
1073  va_end(args);
1074 }
1075 
1076 static void cfapi_map_get_map_property(int *type, ...) {
1077  va_list args;
1078  mapstruct *map;
1079  int property;
1080 
1081  int *rint;
1082  mapstruct **rmap;
1083  sstring *rstr;
1084  region **rreg;
1085  int16_t *nx, *ny;
1086  int x, y;
1087 
1088  va_start(args, type);
1089 
1090  map = va_arg(args, mapstruct *);
1091  property = va_arg(args, int);
1092 
1093  switch (property) {
1094  case CFAPI_MAP_PROP_FLAGS:
1095  rmap = va_arg(args, mapstruct **);
1096  x = va_arg(args, int);
1097  y = va_arg(args, int);
1098  nx = va_arg(args, int16_t *);
1099  ny = va_arg(args, int16_t *);
1100  rint = va_arg(args, int *);
1101  *rint = get_map_flags(map, rmap, x, y, nx, ny);
1102  *type = CFAPI_INT;
1103  break;
1104 
1106  rint = va_arg(args, int *);
1107  *rint = calculate_difficulty(map);
1108  *type = CFAPI_INT;
1109  break;
1110 
1111  case CFAPI_MAP_PROP_PATH:
1112  rstr = va_arg(args, sstring *);
1113  *rstr = map->path;
1114  *type = CFAPI_SSTRING;
1115  break;
1116 
1118  rstr = va_arg(args, sstring *);
1119  *rstr = map->tmpname;
1120  *type = CFAPI_SSTRING;
1121  break;
1122 
1123  case CFAPI_MAP_PROP_NAME:
1124  rstr = va_arg(args, sstring *);
1125  *rstr = map->name;
1126  *type = CFAPI_SSTRING;
1127  break;
1128 
1130  rint = va_arg(args, int *);
1131  *rint = map->reset_time;
1132  *type = CFAPI_INT;
1133  break;
1134 
1136  rint = va_arg(args, int *);
1137  *rint = map->reset_timeout;
1138  *type = CFAPI_INT;
1139  break;
1140 
1142  rint = va_arg(args, int *);
1143  *rint = map->players;
1144  *type = CFAPI_INT;
1145  break;
1146 
1148  rint = va_arg(args, int *);
1149  *rint = map->darkness;
1150  *type = CFAPI_INT;
1151  break;
1152 
1153  case CFAPI_MAP_PROP_WIDTH:
1154  rint = va_arg(args, int *);
1155  *rint = map->width;
1156  *type = CFAPI_INT;
1157  break;
1158 
1159  case CFAPI_MAP_PROP_HEIGHT:
1160  rint = va_arg(args, int *);
1161  *rint = map->height;
1162  *type = CFAPI_INT;
1163  break;
1164 
1166  rint = va_arg(args, int *);
1167  *rint = map->enter_x;
1168  *type = CFAPI_INT;
1169  break;
1170 
1172  rint = va_arg(args, int *);
1173  *rint = map->enter_y;
1174  *type = CFAPI_INT;
1175  break;
1176 
1178  rstr = va_arg(args, sstring *);
1179  *rstr = map->msg;
1180  *type = CFAPI_SSTRING;
1181  break;
1182 
1183  case CFAPI_MAP_PROP_NEXT:
1184  rmap = va_arg(args, mapstruct **);
1185  *rmap = map ? map->next : first_map;
1186  *type = CFAPI_PMAP;
1187  break;
1188 
1189  case CFAPI_MAP_PROP_REGION:
1190  rreg = va_arg(args, region **);
1191  *rreg = get_region_by_map(map);
1192  *type = CFAPI_PREGION;
1193  break;
1194 
1195  case CFAPI_MAP_PROP_UNIQUE:
1196  rint = va_arg(args, int *);
1197  *rint = map->unique;
1198  *type = CFAPI_INT;
1199  break;
1200 
1201  default:
1202  *type = CFAPI_NONE;
1203  break;
1204  }
1205  va_end(args);
1206 }
1207 
1208 static void cfapi_map_set_map_property(int *type, ...) {
1209  va_list args;
1210  mapstruct *map;
1211  int property;
1212  const char *buf;
1213 
1214  va_start(args, type);
1215 
1216  map = va_arg(args, mapstruct *);
1217  property = va_arg(args, int);
1218 
1219  switch (property) {
1220  case CFAPI_MAP_PROP_PATH:
1221  buf = va_arg(args, const char *);
1222  strlcpy(map->path, buf, sizeof(map->path));
1223  *type = CFAPI_STRING;
1224  break;
1225 
1226  default:
1227  *type = CFAPI_NONE;
1228  break;
1229  }
1230  va_end(args);
1231 }
1232 
1238 static void cfapi_map_out_of_map(int *type, ...) {
1239  va_list args;
1240  mapstruct *map;
1241  int x, y;
1242  int *rint;
1243 
1244  va_start(args, type);
1245  map = va_arg(args, mapstruct *);
1246  x = va_arg(args, int);
1247  y = va_arg(args, int);
1248  rint = va_arg(args, int *);
1249 
1250  *rint = out_of_map(map, x, y);
1251  va_end(args);
1252  *type = CFAPI_INT;
1253 }
1254 
1260 static void cfapi_map_update_position(int *type, ...) {
1261  va_list args;
1262  mapstruct *map;
1263  int x, y;
1264 
1265  va_start(args, type);
1266 
1267  map = va_arg(args, mapstruct *);
1268  x = va_arg(args, int);
1269  y = va_arg(args, int);
1270 
1271  update_position(map, x, y);
1272  va_end(args);
1273  *type = CFAPI_NONE;
1274 }
1275 
1276 static void cfapi_map_delete_map(int *type, ...) {
1277  va_list args;
1278  mapstruct *map;
1279  va_start(args, type);
1280 
1281  map = va_arg(args, mapstruct *);
1282 
1283  delete_map(map);
1284 
1285  va_end(args);
1286  *type = CFAPI_NONE;
1287 }
1288 
1289 static void cfapi_map_message(int *type, ...) {
1290  va_list args;
1291  mapstruct *map;
1292  const char *string;
1293  int color;
1294 
1295  va_start(args, type);
1296  map = va_arg(args, mapstruct *);
1297  string = va_arg(args, const char *);
1298  color = va_arg(args, int);
1299  va_end(args);
1300 
1301  /* function should be extended to take message types probably */
1303  *type = CFAPI_NONE;
1304 }
1305 
1311 static void cfapi_map_get_object_at(int *type, ...) {
1312  va_list args;
1313  mapstruct *map;
1314  int x, y;
1315  int16_t sx, sy;
1316  object **robj;
1317 
1318  va_start(args, type);
1319  map = va_arg(args, mapstruct *);
1320  x = va_arg(args, int);
1321  y = va_arg(args, int);
1322  robj = va_arg(args, object **);
1323  va_end(args);
1324 
1325  sx = x;
1326  sy = y;
1327  if (get_map_flags(map, &map, x, y, &sx, &sy)&P_OUT_OF_MAP)
1328  *robj = NULL;
1329  else
1330  *robj = GET_MAP_OB(map, sx, sy);
1331  *type = CFAPI_POBJECT;
1332 }
1333 
1340 static void cfapi_map_find_by_archetype_name(int *type, ...) {
1341  va_list args;
1342  int x, y;
1343  mapstruct *map;
1344  char *msg;
1345  object **robj;
1346 
1347  va_start(args, type);
1348 
1349  msg = va_arg(args, char *);
1350  map = va_arg(args, mapstruct *);
1351  x = va_arg(args, int);
1352  y = va_arg(args, int);
1353  robj = va_arg(args, object **);
1354 
1355  va_end(args);
1356 
1358  *robj = at == NULL ? NULL : map_find_by_archetype(map, x, y, at);
1359  *type = CFAPI_POBJECT;
1360 }
1361 
1367 static void cfapi_map_change_light(int *type, ...) {
1368  va_list args;
1369  int change;
1370  mapstruct *map;
1371  int *rint;
1372 
1373  va_start(args, type);
1374  map = va_arg(args, mapstruct *);
1375  change = va_arg(args, int);
1376  rint = va_arg(args, int *);
1377  va_end(args);
1378 
1379  *type = CFAPI_INT;
1380  *rint = change_map_light(map, change);
1381 }
1382 
1383 /* OBJECT-RELATED HOOKS */
1384 
1398 static void cfapi_object_move(int *type, ...) {
1399  va_list args;
1400  int kind;
1401  object *op;
1402  object *activator;
1403  player *pl;
1404  int direction;
1405  int *ret;
1406 
1407  va_start(args, type);
1408  kind = va_arg(args, int);
1409  switch (kind) {
1410  case 0:
1411  op = va_arg(args, object *);
1412  direction = va_arg(args, int);
1413  activator = va_arg(args, object *);
1414  ret = va_arg(args, int *);
1415  va_end(args);
1416  *ret = move_ob(op, direction, activator);
1417  break;
1418 
1419  case 1:
1420  pl = va_arg(args, player *);
1421  direction = va_arg(args, int);
1422  ret = va_arg(args, int *);
1423  va_end(args);
1424  *ret = move_player(pl->ob, direction);
1425  break;
1426 
1427  case 2:
1428  op = va_arg(args, object *);
1429  ret = va_arg(args, int *);
1430  va_end(args);
1431  *ret = player_arrest(op);
1432  break;
1433 
1434  default:
1435  // Just end the use of variable args. We got a wrong type.
1436  va_end(args);
1437  }
1438  *type = CFAPI_INT;
1439 }
1440 
1448 static void cfapi_object_get_key(int *type, ...) {
1449  va_list args;
1450  const char *keyname;
1451  const char **value;
1452  object *op;
1453 
1454  va_start(args, type);
1455  op = va_arg(args, object *);
1456  keyname = va_arg(args, const char *);
1457  value = va_arg(args, const char **);
1458  va_end(args);
1459 
1460  *value = object_get_value(op, keyname);
1461  *type = CFAPI_SSTRING;
1462 }
1463 
1470 static void cfapi_object_set_key(int *type, ...) {
1471  va_list args;
1472  const char *keyname;
1473  const char *value;
1474  int *ret;
1475  object *op;
1476  int add_key;
1477 
1478  va_start(args, type);
1479  op = va_arg(args, object *);
1480  keyname = va_arg(args, char *);
1481  value = va_arg(args, char *);
1482  add_key = va_arg(args, int);
1483  ret = va_arg(args, int *);
1484  va_end(args);
1485 
1486  *ret = object_set_value(op, keyname, value, add_key);
1487  *type = CFAPI_INT;
1488 }
1489 
1493 static void cfapi_object_get_property(int *type, ...) {
1494  va_list args;
1495  int property;
1496  object *op;
1497  int *rint;
1498  object **robject;
1499  mapstruct **rmap;
1500  float *rfloat;
1501  archetype **rarch;
1502  sstring *rsstring;
1503  char *rbuffer;
1504  int rbufsize;
1505  MoveType *rmove;
1506  int64_t *rint64;
1507  partylist **rparty;
1508  double *rdouble;
1509  long *rlong;
1510 
1511  va_start(args, type);
1512 
1513  op = va_arg(args, object *);
1514  property = va_arg(args, int);
1515  switch (property) {
1517  robject = va_arg(args, object **);
1518  *robject = op->above;
1519  *type = CFAPI_POBJECT;
1520  break;
1521 
1523  robject = va_arg(args, object **);
1524  *robject = op->below;
1525  *type = CFAPI_POBJECT;
1526  break;
1527 
1529  robject = va_arg(args, object **);
1530  *robject = op->active_next;
1531  *type = CFAPI_POBJECT;
1532  break;
1533 
1535  robject = va_arg(args, object **);
1536  *robject = op->active_prev;
1537  *type = CFAPI_POBJECT;
1538  break;
1539 
1541  robject = va_arg(args, object **);
1542  *robject = op->inv;
1543  *type = CFAPI_POBJECT;
1544  break;
1545 
1547  robject = va_arg(args, object **);
1548  *robject = op->env;
1549  *type = CFAPI_POBJECT;
1550  break;
1551 
1553  robject = va_arg(args, object **);
1554  *robject = op->head;
1555  *type = CFAPI_POBJECT;
1556  break;
1557 
1559  robject = va_arg(args, object **);
1560  *robject = op->container;
1561  *type = CFAPI_POBJECT;
1562  break;
1563 
1564  case CFAPI_OBJECT_PROP_MAP:
1565  rmap = va_arg(args, mapstruct **);
1566  *rmap = op->map;
1567  *type = CFAPI_PMAP;
1568  break;
1569 
1571  rint = va_arg(args, int *);
1572  *rint = op->count;
1573  *type = CFAPI_INT;
1574  break;
1575 
1577  rbuffer = va_arg(args, char *);
1578  rbufsize = va_arg(args, int);
1579  query_name(op, rbuffer, rbufsize);
1580  *type = CFAPI_STRING;
1581  break;
1582 
1584  rsstring = va_arg(args, sstring *);
1585  *rsstring = op->name_pl;
1586  *type = CFAPI_SSTRING;
1587  break;
1588 
1590  rsstring = va_arg(args, sstring *);
1591  *rsstring = op->title;
1592  *type = CFAPI_SSTRING;
1593  break;
1594 
1596  rsstring = va_arg(args, sstring *);
1597  *rsstring = op->race;
1598  *type = CFAPI_SSTRING;
1599  break;
1600 
1602  rsstring = va_arg(args, sstring *);
1603  *rsstring = op->slaying;
1604  *type = CFAPI_SSTRING;
1605  break;
1606 
1608  rsstring = va_arg(args, sstring *);
1609  *rsstring = op->skill;
1610  *type = CFAPI_SSTRING;
1611  break;
1612 
1614  rsstring = va_arg(args, sstring *);
1615  *rsstring = op->msg;
1616  *type = CFAPI_SSTRING;
1617  break;
1618 
1620  rsstring = va_arg(args, sstring *);
1621  *rsstring = op->lore;
1622  *type = CFAPI_SSTRING;
1623  break;
1624 
1625  case CFAPI_OBJECT_PROP_X:
1626  rint = va_arg(args, int *);
1627  *rint = op->x;
1628  *type = CFAPI_INT;
1629  break;
1630 
1631  case CFAPI_OBJECT_PROP_Y:
1632  rint = va_arg(args, int *);
1633  *rint = op->y;
1634  *type = CFAPI_INT;
1635  break;
1636 
1638  rfloat = va_arg(args, float *);
1639  *rfloat = op->speed;
1640  *type = CFAPI_FLOAT;
1641  break;
1642 
1644  rfloat = va_arg(args, float *);
1645  *rfloat = op->speed_left;
1646  *type = CFAPI_FLOAT;
1647  break;
1648 
1650  rint = va_arg(args, int *);
1651  *rint = op->nrof;
1652  *type = CFAPI_INT;
1653  break;
1654 
1656  rint = va_arg(args, int *);
1657  *rint = op->direction;
1658  *type = CFAPI_INT;
1659  break;
1660 
1662  rint = va_arg(args, int *);
1663  *rint = op->facing;
1664  *type = CFAPI_INT;
1665  break;
1666 
1668  rint = va_arg(args, int *);
1669  *rint = op->type;
1670  *type = CFAPI_INT;
1671  break;
1672 
1674  rint = va_arg(args, int *);
1675  *rint = op->subtype;
1676  *type = CFAPI_INT;
1677  break;
1678 
1680  rint = va_arg(args, int *);
1681  *rint = op->client_type;
1682  *type = CFAPI_INT;
1683  break;
1684 
1685  case CFAPI_OBJECT_PROP_RESIST: {
1686  int idx;
1687  int16_t *resist;
1688 
1689  idx = va_arg(args, int);
1690  resist = va_arg(args, int16_t *);
1691  *resist = op->resist[idx];
1692  }
1693  *type = CFAPI_INT16;
1694  break;
1695 
1697  rint = va_arg(args, int *);
1698  *rint = op->attacktype;
1699  *type = CFAPI_INT;
1700  break;
1701 
1703  rint = va_arg(args, int *);
1704  *rint = op->path_attuned;
1705  *type = CFAPI_INT;
1706  break;
1707 
1709  rint = va_arg(args, int *);
1710  *rint = op->path_repelled;
1711  *type = CFAPI_INT;
1712  break;
1713 
1715  rint = va_arg(args, int *);
1716  *rint = op->path_denied;
1717  *type = CFAPI_INT;
1718  break;
1719 
1721  rint = va_arg(args, int *);
1722  *rint = op->material;
1723  *type = CFAPI_INT;
1724  break;
1725 
1727  rsstring = va_arg(args, sstring *);
1728  *rsstring = op->materialname;
1729  *type = CFAPI_SSTRING;
1730  break;
1731 
1733  rint = va_arg(args, int *);
1734  *rint = op->magic;
1735  *type = CFAPI_INT;
1736  break;
1737 
1739  rlong = va_arg(args, long *);
1740  *rlong = op->value;
1741  *type = CFAPI_LONG;
1742  break;
1743 
1745  rint = va_arg(args, int *);
1746  *rint = op->level;
1747  *type = CFAPI_INT;
1748  break;
1749 
1751  rint = va_arg(args, int *);
1752  *rint = op->last_heal;
1753  *type = CFAPI_INT;
1754  break;
1755 
1757  rint = va_arg(args, int *);
1758  *rint = op->last_sp;
1759  *type = CFAPI_INT;
1760  break;
1761 
1763  rint = va_arg(args, int *);
1764  *rint = op->last_grace;
1765  *type = CFAPI_INT;
1766  break;
1767 
1769  rint = va_arg(args, int *);
1770  *rint = op->last_eat;
1771  *type = CFAPI_INT;
1772  break;
1773 
1775  rint = va_arg(args, int *);
1776  *rint = op->invisible;
1777  *type = CFAPI_INT;
1778  break;
1779 
1781  rint = va_arg(args, int *);
1782  *rint = op->pick_up;
1783  *type = CFAPI_INT;
1784  break;
1785 
1787  rint = va_arg(args, int *);
1788  *rint = op->item_power;
1789  *type = CFAPI_INT;
1790  break;
1791 
1793  rint = va_arg(args, int *);
1794  *rint = op->gen_sp_armour;
1795  *type = CFAPI_INT;
1796  break;
1797 
1799  rint = va_arg(args, int *);
1800  *rint = op->weight;
1801  *type = CFAPI_INT;
1802  break;
1803 
1805  rint = va_arg(args, int *);
1806  *rint = op->weight_limit;
1807  *type = CFAPI_INT;
1808  break;
1809 
1811  rint = va_arg(args, int *);
1812  *rint = op->carrying;
1813  *type = CFAPI_INT;
1814  break;
1815 
1817  rint = va_arg(args, int *);
1818  *rint = op->glow_radius;
1819  *type = CFAPI_INT;
1820  break;
1821 
1823  rint64 = va_arg(args, int64_t *);
1824  *rint64 = op->total_exp;
1825  *type = CFAPI_SINT64;
1826  break;
1827 
1829  robject = va_arg(args, object **);
1830  *robject = op->current_weapon;
1831  *type = CFAPI_POBJECT;
1832  break;
1833 
1835  robject = va_arg(args, object **);
1836  *robject = op->enemy;
1837  *type = CFAPI_POBJECT;
1838  break;
1839 
1841  robject = va_arg(args, object **);
1842  *robject = op->attacked_by;
1843  *type = CFAPI_POBJECT;
1844  break;
1845 
1847  rint = va_arg(args, int *);
1848  *rint = op->run_away;
1849  *type = CFAPI_INT;
1850  break;
1851 
1853  robject = va_arg(args, object **);
1854  *robject = op->chosen_skill;
1855  *type = CFAPI_POBJECT;
1856  break;
1857 
1859  rint = va_arg(args, int *);
1860  *rint = op->hide;
1861  *type = CFAPI_INT;
1862  break;
1863 
1865  rint = va_arg(args, int *);
1866  *rint = op->move_status;
1867  *type = CFAPI_INT;
1868  break;
1869 
1871  rint = va_arg(args, int *);
1872  *rint = op->attack_movement;
1873  *type = CFAPI_INT;
1874  break;
1875 
1877  robject = va_arg(args, object **);
1878  *robject = op->spellitem;
1879  *type = CFAPI_POBJECT;
1880  break;
1881 
1883  rdouble = va_arg(args, double *);
1884  *rdouble = op->expmul;
1885  *type = CFAPI_DOUBLE;
1886  break;
1887 
1889  rarch = va_arg(args, archetype **);
1890  *rarch = op->arch;
1891  *type = CFAPI_PARCH;
1892  break;
1893 
1895  rarch = va_arg(args, archetype **);
1896  *rarch = op->other_arch;
1897  *type = CFAPI_PARCH;
1898  break;
1899 
1901  rsstring = va_arg(args, sstring *);
1902  *rsstring = op->custom_name;
1903  *type = CFAPI_SSTRING;
1904  break;
1905 
1907  rint = va_arg(args, int *);
1908  *rint = op->anim_speed;
1909  *type = CFAPI_INT;
1910  break;
1911 
1913  rint = va_arg(args, int *);
1914  *rint = is_friendly(op);
1915  *type = CFAPI_INT;
1916  break;
1917 
1919  rbuffer = va_arg(args, char *);
1920  rbufsize = va_arg(args, int);
1921  query_short_name(op, rbuffer, rbufsize);
1922  *type = CFAPI_STRING;
1923  break;
1924 
1926  int i;
1927 
1928  i = va_arg(args, int);
1929  rbuffer = va_arg(args, char *);
1930  rbufsize = va_arg(args, int);
1931  query_base_name(op, i, rbuffer, rbufsize);
1932  *type = CFAPI_STRING;
1933  }
1934  break;
1935 
1937  rsstring = va_arg(args, sstring *);
1938  *rsstring = op->name;
1939  *type = CFAPI_SSTRING;
1940  break;
1941 
1943  rint = va_arg(args, int *);
1944  *rint = is_magical(op);
1945  *type = CFAPI_INT;
1946  break;
1947 
1949  rint = va_arg(args, int *);
1950  *rint = op->stats.luck;
1951  *type = CFAPI_INT;
1952  break;
1953 
1954  case CFAPI_OBJECT_PROP_EXP:
1955  rint64 = va_arg(args, int64_t *);
1956  *rint64 = op->stats.exp;
1957  *type = CFAPI_SINT64;
1958  break;
1959 
1961  robject = va_arg(args, object **);
1962  *robject = object_get_owner(op);
1963  *type = CFAPI_POBJECT;
1964  break;
1965 
1967  int stype;
1968 
1969  stype = va_arg(args, int);
1970  switch (stype) {
1971  unsigned char ptype;
1972  char *buf;
1973  archetype *at;
1974 
1975  case 0: /* present_in_ob */
1976  ptype = (unsigned char)(va_arg(args, int));
1977  robject = va_arg(args, object **);
1978  *robject = object_present_in_ob(ptype, op);
1979  break;
1980 
1981  case 1: /* present_in_ob_by_name */
1982  ptype = (unsigned char)(va_arg(args, int));
1983  buf = va_arg(args, char *);
1984  robject = va_arg(args, object **);
1985  *robject = object_present_in_ob_by_name(ptype, buf, op);
1986  break;
1987 
1988  case 2: /* arch_present_in_ob */
1989  at = va_arg(args, archetype *);
1990  robject = va_arg(args, object **);
1991  *robject = arch_present_in_ob(at, op);
1992  break;
1993  }
1994  }
1995  *type = CFAPI_POBJECT;
1996  break;
1997 
1999  rint = va_arg(args, int *);
2000  *rint = (QUERY_FLAG(op, FLAG_WAS_WIZ));
2001  *type = CFAPI_INT;
2002  break;
2003 
2005  object *op2;
2006 
2007  op2 = va_arg(args, object *);
2008  rint = va_arg(args, int *);
2009  *rint = object_can_merge(op, op2);
2010  }
2011  *type = CFAPI_INT;
2012  break;
2013 
2015  object *op2;
2016 
2017  op2 = va_arg(args, object *);
2018  rint = va_arg(args, int *);
2019  *rint = object_can_pick(op2, op);
2020  }
2021  *type = CFAPI_INT;
2022  break;
2023 
2024  case CFAPI_OBJECT_PROP_FLAGS: {
2025  int fl;
2026 
2027  fl = va_arg(args, int);
2028  rint = va_arg(args, int *);
2029  *rint = QUERY_FLAG(op, fl);
2030  }
2031  *type = CFAPI_INT;
2032  break;
2033 
2034  case CFAPI_OBJECT_PROP_STR:
2035  rint = va_arg(args, int *);
2036  *rint = op->stats.Str;
2037  *type = CFAPI_INT;
2038  break;
2039 
2040  case CFAPI_OBJECT_PROP_DEX:
2041  rint = va_arg(args, int *);
2042  *rint = op->stats.Dex;
2043  *type = CFAPI_INT;
2044  break;
2045 
2046  case CFAPI_OBJECT_PROP_CON:
2047  rint = va_arg(args, int *);
2048  *rint = op->stats.Con;
2049  *type = CFAPI_INT;
2050  break;
2051 
2052  case CFAPI_OBJECT_PROP_WIS:
2053  rint = va_arg(args, int *);
2054  *rint = op->stats.Wis;
2055  *type = CFAPI_INT;
2056  break;
2057 
2058  case CFAPI_OBJECT_PROP_INT:
2059  rint = va_arg(args, int *);
2060  *rint = op->stats.Int;
2061  *type = CFAPI_INT;
2062  break;
2063 
2064  case CFAPI_OBJECT_PROP_POW:
2065  rint = va_arg(args, int *);
2066  *rint = op->stats.Pow;
2067  *type = CFAPI_INT;
2068  break;
2069 
2070  case CFAPI_OBJECT_PROP_CHA:
2071  rint = va_arg(args, int *);
2072  *rint = op->stats.Cha;
2073  *type = CFAPI_INT;
2074  break;
2075 
2076  case CFAPI_OBJECT_PROP_WC:
2077  rint = va_arg(args, int *);
2078  *rint = op->stats.wc;
2079  *type = CFAPI_INT;
2080  break;
2081 
2082  case CFAPI_OBJECT_PROP_AC:
2083  rint = va_arg(args, int *);
2084  *rint = op->stats.ac;
2085  *type = CFAPI_INT;
2086  break;
2087 
2088  case CFAPI_OBJECT_PROP_HP:
2089  rint = va_arg(args, int *);
2090  *rint = op->stats.hp;
2091  *type = CFAPI_INT;
2092  break;
2093 
2094  case CFAPI_OBJECT_PROP_SP:
2095  rint = va_arg(args, int *);
2096  *rint = op->stats.sp;
2097  *type = CFAPI_INT;
2098  break;
2099 
2100  case CFAPI_OBJECT_PROP_GP:
2101  rint = va_arg(args, int *);
2102  *rint = op->stats.grace;
2103  *type = CFAPI_INT;
2104  break;
2105 
2106  case CFAPI_OBJECT_PROP_FP:
2107  rint = va_arg(args, int *);
2108  *rint = op->stats.food;
2109  *type = CFAPI_INT;
2110  break;
2111 
2113  rint = va_arg(args, int *);
2114  *rint = op->stats.maxhp;
2115  *type = CFAPI_INT;
2116  break;
2117 
2119  rint = va_arg(args, int *);
2120  *rint = op->stats.maxsp;
2121  *type = CFAPI_INT;
2122  break;
2123 
2125  rint = va_arg(args, int *);
2126  *rint = op->stats.maxgrace;
2127  *type = CFAPI_INT;
2128  break;
2129 
2130  case CFAPI_OBJECT_PROP_DAM:
2131  rint = va_arg(args, int *);
2132  *rint = op->stats.dam;
2133  *type = CFAPI_INT;
2134  break;
2135 
2136  case CFAPI_OBJECT_PROP_GOD:
2137  rsstring = va_arg(args, sstring *);
2138  *rsstring = determine_god(op);
2139  *type = CFAPI_SSTRING;
2140  break;
2141 
2143  rsstring = va_arg(args, sstring *);
2144  *rsstring = op->arch->name;
2145  *type = CFAPI_SSTRING;
2146  break;
2147 
2149  rint = va_arg(args, int *);
2150  *rint = op->invisible;
2151  *type = CFAPI_INT;
2152  break;
2153 
2155  rsstring = va_arg(args, sstring *);
2156  if (op->face != NULL) {
2157  (*rsstring) = op->face->name;
2158  }
2159  else {
2160  (*rsstring) = NULL;
2161  }
2162  *type = CFAPI_SSTRING;
2163  break;
2164 
2166  rsstring = va_arg(args, sstring *);
2167  if (op->animation != NULL) {
2168  (*rsstring) = op->animation->name;
2169  }
2170  else {
2171  (*rsstring) = NULL;
2172  }
2173  *type = CFAPI_SSTRING;
2174  break;
2175 
2176  case CFAPI_PLAYER_PROP_IP:
2177  rsstring = va_arg(args, sstring *);
2178  *rsstring = op->contr->socket.host;
2179  *type = CFAPI_SSTRING;
2180  break;
2181 
2183  robject = va_arg(args, object **);
2184  *robject = find_marked_object(op);
2185  *type = CFAPI_POBJECT;
2186  break;
2187 
2189  rparty = va_arg(args, partylist **);
2190  *rparty = (op->contr ? op->contr->party : NULL);
2191  *type = CFAPI_PPARTY;
2192  break;
2193 
2195  robject = va_arg(args, object **);
2196  if (op)
2197  *robject = op->contr->next ? op->contr->next->ob : NULL;
2198  else
2199  /* This can be called when there is no player. */
2200  *robject = first_player ? first_player->ob : NULL;
2201  *type = CFAPI_POBJECT;
2202  break;
2203 
2205  rbuffer = va_arg(args, char *);
2206  rbufsize = va_arg(args, int);
2207  player_get_title(op->contr, rbuffer, rbufsize);
2208  *type = CFAPI_STRING;
2209  break;
2210 
2212  robject = va_arg(args, object **);
2213  *robject = op->contr->transport;
2214  *type = CFAPI_POBJECT;
2215  break;
2216 
2218  rmove = va_arg(args, MoveType *);
2219  *rmove = op->move_type;
2220  *type = CFAPI_MOVETYPE;
2221  break;
2222 
2224  rmove = va_arg(args, MoveType *);
2225  *rmove = op->move_block;
2226  *type = CFAPI_MOVETYPE;
2227  break;
2228 
2230  rmove = va_arg(args, MoveType *);
2231  *rmove = op->move_allow;
2232  *type = CFAPI_MOVETYPE;
2233  break;
2234 
2236  rmove = va_arg(args, MoveType *);
2237  *rmove = op->move_on;
2238  *type = CFAPI_MOVETYPE;
2239  break;
2240 
2242  rmove = va_arg(args, MoveType *);
2243  *rmove = op->move_off;
2244  *type = CFAPI_MOVETYPE;
2245  break;
2246 
2248  rmove = va_arg(args, MoveType *);
2249  *rmove = op->move_type;
2250  *type = CFAPI_MOVETYPE;
2251  break;
2252 
2254  rfloat = va_arg(args, float *);
2255  *rfloat = op->move_slow_penalty;
2256  *type = CFAPI_FLOAT;
2257  break;
2258 
2260  rbuffer = va_arg(args, char *);
2261  rbufsize = va_arg(args, int);
2262  strlcpy(rbuffer, op->contr->savebed_map, rbufsize);
2263  *type = CFAPI_STRING;
2264  break;
2265 
2267  rint = va_arg(args, int *);
2268  *rint = op->contr->bed_x;
2269  *type = CFAPI_INT;
2270  break;
2271 
2273  rint = va_arg(args, int *);
2274  *rint = op->contr->bed_y;
2275  *type = CFAPI_INT;
2276  break;
2277 
2279  rint = va_arg(args, int *);
2280  *rint = op->duration;
2281  *type = CFAPI_INT;
2282  break;
2283 
2284  default:
2285  *type = CFAPI_NONE;
2286  break;
2287  }
2288  va_end(args);
2289 }
2290 
2299 static void copy_message(object *op, const char *msg) {
2300  /* need to reset parsed dialog information */
2302  if (strlen(msg) == 0) {
2303  msg = NULL;
2304  }
2305  object_set_msg(op, msg);
2306 }
2307 
2316 static void cfapi_object_set_property(int *type, ...) {
2317  va_list args;
2318  int iarg, *ret;
2319  long larg;
2320  char *sarg;
2321  double darg;
2322  object *oparg;
2323  object *op;
2324  int property;
2325  int64_t s64arg;
2326  partylist *partyarg;
2327  float farg;
2328  MoveType *move; /* MoveType can't be used through va_arg so use MoveType * */
2329 
2330  va_start(args, type);
2331  op = va_arg(args, object *);
2332  property = va_arg(args, int);
2333  *type = CFAPI_NONE;
2334 
2335  if (op != NULL && (!op->arch || (op != &op->arch->clone))) {
2336  switch (property) {
2338  sarg = va_arg(args, char *);
2339  *type = CFAPI_STRING;
2340  FREE_AND_COPY(op->name, sarg);
2342  break;
2343 
2345  sarg = va_arg(args, char *);
2346  *type = CFAPI_STRING;
2347  FREE_AND_COPY(op->name_pl, sarg);
2349  break;
2350 
2352  sarg = va_arg(args, char *);
2353  *type = CFAPI_STRING;
2354  FREE_AND_COPY(op->title, sarg);
2355  break;
2356 
2358  sarg = va_arg(args, char *);
2359  *type = CFAPI_STRING;
2360  FREE_AND_COPY(op->race, sarg);
2361  break;
2362 
2364  sarg = va_arg(args, char *);
2365  *type = CFAPI_STRING;
2366  FREE_AND_COPY(op->slaying, sarg);
2367  break;
2368 
2370  sarg = va_arg(args, char *);
2371  *type = CFAPI_STRING;
2372  FREE_AND_COPY(op->skill, sarg);
2373  break;
2374 
2376  sarg = va_arg(args, char *);
2377  *type = CFAPI_STRING;
2378  copy_message(op, sarg);
2379  break;
2380 
2382  sarg = va_arg(args, char *);
2383  *type = CFAPI_STRING;
2384  FREE_AND_COPY(op->lore, sarg);
2385  break;
2386 
2388  farg = va_arg(args, double);
2389  *type = CFAPI_FLOAT;
2390  if (farg != op->speed) {
2391  op->speed = farg;
2393  }
2394  break;
2395 
2397  farg = va_arg(args, double);
2398  *type = CFAPI_FLOAT;
2399  op->speed_left = farg;
2400  break;
2401 
2403  iarg = va_arg(args, int);
2404  *type = CFAPI_INT;
2405  if (iarg < 0)
2406  iarg = 0;
2407  if (op->nrof > (uint32_t)iarg)
2408  object_decrease_nrof(op, op->nrof-iarg);
2409  else if (op->nrof < (uint32_t)iarg) {
2410  object *tmp;
2411  player *pl;
2412 
2413  op->nrof = iarg;
2414  if (op->env != NULL) {
2416  if (!tmp) {
2417  for (pl = first_player; pl; pl = pl->next)
2418  if (pl->ob->container == op->env)
2419  break;
2420  if (pl)
2421  tmp = pl->ob;
2422  else
2423  tmp = NULL;
2424  } else {
2426  fix_object(tmp);
2427  }
2428  if (tmp)
2430  } else {
2432  if (tmp->type == PLAYER)
2433  tmp->contr->socket.update_look = 1;
2434  FOR_ABOVE_FINISH();
2435  }
2436  }
2437  break;
2438 
2440  iarg = va_arg(args, int);
2441  *type = CFAPI_INT;
2442  op->direction = iarg;
2443  break;
2444 
2446  iarg = va_arg(args, int);
2447  *type = CFAPI_INT;
2448  op->facing = iarg;
2449  break;
2450 
2451  case CFAPI_OBJECT_PROP_RESIST: {
2452  int iargbis = va_arg(args, int);
2453 
2454  *type = CFAPI_INT16;
2455  iarg = va_arg(args, int);
2456  op->resist[iargbis] = iarg;
2457  }
2458  break;
2459 
2461  iarg = va_arg(args, int);
2462  *type = CFAPI_INT;
2463  op->attacktype = iarg;
2464  break;
2465 
2467  iarg = va_arg(args, int);
2468  *type = CFAPI_INT;
2469  op->path_attuned = iarg;
2470  break;
2471 
2473  iarg = va_arg(args, int);
2474  *type = CFAPI_INT;
2475  op->path_repelled = iarg;
2476  break;
2477 
2479  iarg = va_arg(args, int);
2480  *type = CFAPI_INT;
2481  op->path_denied = iarg;
2482  break;
2483 
2485  iarg = va_arg(args, int);
2486  *type = CFAPI_INT;
2487  op->material = iarg;
2488  break;
2489 
2491  break;
2492 
2494  iarg = va_arg(args, int);
2495  *type = CFAPI_INT;
2496  op->magic = iarg;
2497  break;
2498 
2500  larg = va_arg(args, long);
2501  *type = CFAPI_LONG;
2502  op->value = larg;
2503  break;
2504 
2506  iarg = va_arg(args, int);
2507  *type = CFAPI_INT;
2508  op->level = iarg;
2510  break;
2511 
2513  iarg = va_arg(args, int);
2514  *type = CFAPI_INT;
2515  op->last_heal = iarg;
2516  break;
2517 
2519  iarg = va_arg(args, int);
2520  *type = CFAPI_INT;
2521  op->last_sp = iarg;
2522  break;
2523 
2525  iarg = va_arg(args, int);
2526  *type = CFAPI_INT;
2527  op->last_grace = iarg;
2528  break;
2529 
2531  iarg = va_arg(args, int);
2532  *type = CFAPI_INT;
2533  op->last_eat = iarg;
2534  break;
2535 
2537  iarg = va_arg(args, int);
2538  *type = CFAPI_INT;
2539  op->invisible = iarg;
2540  break;
2541 
2543  iarg = va_arg(args, int);
2544  *type = CFAPI_INT;
2545  op->pick_up = iarg;
2546  break;
2547 
2549  iarg = va_arg(args, int);
2550  *type = CFAPI_INT;
2551  op->item_power = iarg;
2552  break;
2553 
2555  iarg = va_arg(args, int);
2556  *type = CFAPI_INT;
2557  op->gen_sp_armour = iarg;
2558  break;
2559 
2561  iarg = va_arg(args, int);
2562  *type = CFAPI_INT;
2563  if (op->weight != iarg) {
2564  object *tmp;
2565  player *pl;
2566 
2567  op->weight = iarg;
2568  if (op->env != NULL) {
2570  if (!tmp) {
2571  for (pl = first_player; pl; pl = pl->next)
2572  if (pl->ob->container == op->env)
2573  break;
2574  if (pl)
2575  tmp = pl->ob;
2576  else
2577  tmp = NULL;
2578  } else {
2580  fix_object(tmp);
2581  }
2582  if (tmp)
2584  } else {
2586  if (tmp->type == PLAYER)
2588  FOR_ABOVE_FINISH();
2589  }
2590  }
2591  break;
2592 
2594  iarg = va_arg(args, int);
2595  *type = CFAPI_INT;
2596  op->weight_limit = iarg;
2597  break;
2598 
2600  iarg = va_arg(args, int);
2601  *type = CFAPI_INT;
2602  if (op->glow_radius != iarg) {
2603  object *tmp;
2604 
2605  op->glow_radius = iarg;
2607  if (tmp->map != NULL) {
2608  SET_MAP_FLAGS(tmp->map, tmp->x, tmp->y, P_NEED_UPDATE);
2609  update_position(tmp->map, tmp->x, tmp->y);
2610  update_all_los(tmp->map, tmp->x, tmp->y);
2611  }
2612  }
2613  break;
2614 
2616  s64arg = va_arg(args, int64_t);
2617  *type = CFAPI_SINT64;
2618  op->total_exp = s64arg;
2619  break;
2620 
2622  oparg = va_arg(args, object *);
2623  *type = CFAPI_POBJECT;
2624  object_set_enemy(op, oparg);
2625  break;
2626 
2628  iarg = va_arg(args, int);
2629  *type = CFAPI_INT;
2630  op->run_away = iarg;
2631  break;
2632 
2634  oparg = va_arg(args, object *);
2635  *type = CFAPI_POBJECT;
2636  op->chosen_skill = oparg;
2637  break;
2638 
2640  iarg = va_arg(args, int);
2641  *type = CFAPI_INT;
2642  op->hide = iarg;
2643  break;
2644 
2646  iarg = va_arg(args, int);
2647  *type = CFAPI_INT;
2648  op->move_status = iarg;
2649  break;
2650 
2652  iarg = va_arg(args, int);
2653  *type = CFAPI_INT;
2654  op->attack_movement = iarg;
2655  break;
2656 
2658  oparg = va_arg(args, object *);
2659  *type = CFAPI_POBJECT;
2660  op->spellitem = oparg;
2661  break;
2662 
2664  darg = va_arg(args, double);
2665  *type = CFAPI_DOUBLE;
2666  op->expmul = darg;
2667  break;
2668 
2670  sarg = va_arg(args, char *);
2671  *type = CFAPI_STRING;
2672  FREE_AND_COPY(op->custom_name, sarg);
2674  break;
2675 
2677  iarg = va_arg(args, int);
2678  *type = CFAPI_INT;
2679  op->anim_speed = iarg;
2680  break;
2681 
2683  iarg = va_arg(args, int);
2684  *type = CFAPI_INT;
2685  if (iarg == 1 && is_friendly(op) == 0)
2687  else if (iarg == 0 && is_friendly(op) == 1)
2689  break;
2690 
2692  iarg = va_arg(args, int);
2693  *type = CFAPI_INT;
2694  op->stats.luck = iarg;
2695  break;
2696 
2697  case CFAPI_OBJECT_PROP_EXP:
2698  s64arg = va_arg(args, int64_t);
2699  *type = CFAPI_SINT64;
2700  op->stats.exp = s64arg;
2701  break;
2702 
2704  oparg = va_arg(args, object *);
2705  *type = CFAPI_POBJECT;
2706  object_set_owner(op, oparg);
2707  break;
2708 
2711  *type = CFAPI_NONE;
2712  break;
2713 
2714  case CFAPI_OBJECT_PROP_FLAGS: {
2715  int iargbis;
2716 
2717  iarg = va_arg(args, int);
2718  iargbis = va_arg(args, int);
2719  *type = CFAPI_INT;
2720 
2721  if (iargbis == 1)
2722  SET_FLAG(op, iarg);
2723  else
2724  CLEAR_FLAG(op, iarg);
2725  }
2726  break;
2727 
2728  case CFAPI_OBJECT_PROP_STR:
2729  iarg = va_arg(args, int);
2730  *type = CFAPI_INT;
2731  op->stats.Str = iarg;
2732  break;
2733 
2734  case CFAPI_OBJECT_PROP_DEX:
2735  iarg = va_arg(args, int);
2736  *type = CFAPI_INT;
2737  op->stats.Dex = iarg;
2738  break;
2739 
2740  case CFAPI_OBJECT_PROP_CON:
2741  iarg = va_arg(args, int);
2742  *type = CFAPI_INT;
2743  op->stats.Con = iarg;
2744  break;
2745 
2746  case CFAPI_OBJECT_PROP_WIS:
2747  iarg = va_arg(args, int);
2748  *type = CFAPI_INT;
2749  op->stats.Wis = iarg;
2750  break;
2751 
2752  case CFAPI_OBJECT_PROP_INT:
2753  iarg = va_arg(args, int);
2754  *type = CFAPI_INT;
2755  op->stats.Int = iarg;
2756  break;
2757 
2758  case CFAPI_OBJECT_PROP_POW:
2759  iarg = va_arg(args, int);
2760  *type = CFAPI_INT;
2761  op->stats.Pow = iarg;
2762  break;
2763 
2764  case CFAPI_OBJECT_PROP_CHA:
2765  iarg = va_arg(args, int);
2766  *type = CFAPI_INT;
2767  op->stats.Cha = iarg;
2768  break;
2769 
2770  case CFAPI_OBJECT_PROP_WC:
2771  iarg = va_arg(args, int);
2772  *type = CFAPI_INT;
2773  op->stats.wc = iarg;
2774  break;
2775 
2776  case CFAPI_OBJECT_PROP_AC:
2777  iarg = va_arg(args, int);
2778  *type = CFAPI_INT;
2779  op->stats.ac = iarg;
2780  break;
2781 
2782  case CFAPI_OBJECT_PROP_HP:
2783  iarg = va_arg(args, int);
2784  *type = CFAPI_INT;
2785  op->stats.hp = iarg;
2786  break;
2787 
2788  case CFAPI_OBJECT_PROP_SP:
2789  iarg = va_arg(args, int);
2790  *type = CFAPI_INT;
2791  op->stats.sp = iarg;
2792  break;
2793 
2794  case CFAPI_OBJECT_PROP_GP:
2795  iarg = va_arg(args, int);
2796  *type = CFAPI_INT;
2797  op->stats.grace = iarg;
2798  break;
2799 
2800  case CFAPI_OBJECT_PROP_FP:
2801  iarg = va_arg(args, int);
2802  *type = CFAPI_INT;
2803  op->stats.food = iarg;
2804  break;
2805 
2807  iarg = va_arg(args, int);
2808  *type = CFAPI_INT;
2809  op->stats.maxhp = iarg;
2810  break;
2811 
2813  iarg = va_arg(args, int);
2814  *type = CFAPI_INT;
2815  op->stats.maxsp = iarg;
2816  break;
2817 
2819  iarg = va_arg(args, int);
2820  *type = CFAPI_INT;
2821  op->stats.maxgrace = iarg;
2822  break;
2823 
2824  case CFAPI_OBJECT_PROP_DAM:
2825  iarg = va_arg(args, int);
2826  *type = CFAPI_INT;
2827  op->stats.dam = iarg;
2828  break;
2829 
2830  case CFAPI_OBJECT_PROP_FACE: {
2831  const Face *face;
2832  sarg = va_arg(args, char *);
2833  ret = va_arg(args, int *);
2834  *type = CFAPI_INT;
2835  face = try_find_face(sarg, 0);
2836  if (face != NULL) {
2837  op->face = face;
2838  op->state = 0;
2840  (*ret) = face->number;
2841  } else
2842  (*ret) = 0;
2843  break;
2844  }
2845 
2847  const Animations *anim;
2848  sarg = va_arg(args, char *);
2849  ret = va_arg(args, int *);
2850  *type = CFAPI_INT;
2851  anim = try_find_animation(sarg);
2852  if (anim != NULL) {
2853  op->animation = anim;
2854  SET_ANIMATION(op, 0);
2856  (*ret) = anim->num;
2857  } else {
2858  (*ret) = 0;
2859  }
2860  break;
2861  }
2862 
2864  iarg = va_arg(args, int);
2865  *type = CFAPI_INT;
2866  op->duration = iarg;
2867  break;
2868 
2870  if (op->contr) {
2871  oparg = va_arg(args, object *);
2872  *type = CFAPI_POBJECT;
2873  op->contr->mark = oparg;
2874  if (oparg) {
2875  op->contr->mark_count = oparg->count;
2876  } else {
2877  op->contr->mark_count = 0;
2878  }
2879  }
2880  break;
2881 
2883  if (op->contr) {
2884  partyarg = va_arg(args, partylist *);
2885  *type = CFAPI_PPARTY;
2886  party_join(op, partyarg);
2887  }
2888  break;
2889 
2891  sarg = va_arg(args, char *);
2892  *type = CFAPI_STRING;
2893  safe_strncpy(op->contr->savebed_map, sarg, MAX_BUF);
2894  break;
2895 
2897  iarg = va_arg(args, int);
2898  *type = CFAPI_INT;
2899  op->contr->bed_x = iarg;
2900  break;
2901 
2903  iarg = va_arg(args, int);
2904  *type = CFAPI_INT;
2905  op->contr->bed_y = iarg;
2906  break;
2907 
2909  sarg = va_arg(args, char *);
2910  *type = CFAPI_STRING;
2911  player_set_own_title(op->contr, sarg);
2912  break;
2913 
2915  move = va_arg(args, MoveType *);
2916  op->move_type = *move & MOVE_ALL;
2918  *type = CFAPI_MOVETYPE;
2919  break;
2920 
2922  move = va_arg(args, MoveType *);
2923  op->move_block = *move & MOVE_ALL;
2925  *type = CFAPI_MOVETYPE;
2926  break;
2927 
2929  move = va_arg(args, MoveType *);
2930  op->move_allow = *move & MOVE_ALL;
2932  *type = CFAPI_MOVETYPE;
2933  break;
2934 
2936  move = va_arg(args, MoveType *);
2937  op->move_on = *move & MOVE_ALL;
2939  *type = CFAPI_MOVETYPE;
2940  break;
2941 
2943  move = va_arg(args, MoveType *);
2944  op->move_off = *move & MOVE_ALL;
2946  *type = CFAPI_MOVETYPE;
2947  break;
2948 
2950  move = va_arg(args, MoveType *);
2951  op->move_type = *move & MOVE_ALL;
2953  *type = CFAPI_MOVETYPE;
2954  break;
2955 
2956  default:
2957  break;
2958  }
2959  }
2960  va_end(args);
2961 }
2962 
2969 static void cfapi_object_apply_below(int *type, ...) {
2970  va_list args;
2971  object *applier;
2972 
2973  va_start(args, type);
2974 
2975  applier = va_arg(args, object *);
2976 
2977  va_end(args);
2978 
2979  apply_by_living_below(applier);
2980  *type = CFAPI_NONE;
2981 }
2982 
2989 static void cfapi_object_apply(int *type, ...) {
2990  va_list args;
2991  object *applied;
2992  object *applier;
2993  int aflags;
2994  int *ret;
2995 
2996  va_start(args, type);
2997 
2998  applier = va_arg(args, object *);
2999  applied = va_arg(args, object *);
3000  aflags = va_arg(args, int);
3001  ret = va_arg(args, int *);
3002 
3003  va_end(args);
3004 
3005  *type = CFAPI_INT;
3006  *ret = apply_manual(applier, applied, aflags);
3007 }
3008 
3014 static void cfapi_object_identify(int *type, ...) {
3015  va_list args;
3016  object *op, **result;
3017 
3018  va_start(args, type);
3019 
3020  op = va_arg(args, object *);
3021  result = va_arg(args, object **);
3022 
3023  va_end(args);
3024 
3025  (*result) = identify(op);
3026  *type = CFAPI_POBJECT;
3027 }
3028 
3034 static void cfapi_object_describe(int *type, ...) {
3035  va_list args;
3036  object *op;
3037  object *owner;
3038  char *desc, *final;
3039  int size;
3040 
3041  va_start(args, type);
3042 
3043  op = va_arg(args, object *);
3044  owner = va_arg(args, object *);
3045  desc = va_arg(args, char *);
3046  size = va_arg(args, int);
3047  va_end(args);
3048 
3049  *type = CFAPI_STRING;
3050  final = stringbuffer_finish(describe_item(op, owner, 0, NULL));
3051  strncpy(desc, final, size);
3052  desc[size - 1] = '\0';
3053  free(final);
3054 }
3055 
3056 static void cfapi_object_drain(int *type, ...) {
3057  va_list args;
3058 
3059  object *op;
3060  int ds;
3061 
3062  va_start(args, type);
3063 
3064  op = va_arg(args, object *);
3065  ds = va_arg(args, int);
3066 
3067  va_end(args);
3068 
3069  drain_specific_stat(op, ds);
3070 
3071  *type = CFAPI_NONE;
3072 }
3073 
3074 static void cfapi_object_remove_depletion(int *type, ...) {
3075  va_list args;
3076 
3077  object *op;
3078  int level, *result;
3079 
3080  va_start(args, type);
3081 
3082  op = va_arg(args, object *);
3083  level = va_arg(args, int);
3084  result = va_arg(args, int*);
3085 
3086  va_end(args);
3087 
3089 
3090  *type = CFAPI_INT;
3091 }
3092 
3093 static void cfapi_object_fix(int *type, ...) {
3094  va_list args;
3095  object *op;
3096 
3097  va_start(args, type);
3098 
3099  op = va_arg(args, object *);
3100 
3101  va_end(args);
3102 
3103  fix_object(op);
3104 
3105  *type = CFAPI_NONE;
3106 }
3107 
3109 static void cfapi_object_give_skill(int *type, ...) {
3110  va_list args;
3111 
3112  object *op;
3113  char *skillname;
3114 
3115  va_start(args, type);
3116 
3117  op = va_arg(args, object *);
3118  skillname = va_arg(args, char *);
3119 
3120  va_end(args);
3121 
3122  *type = CFAPI_POBJECT;
3123  give_skill_by_name(op, skillname);
3124 }
3125 
3126 static void cfapi_object_transmute(int *type, ...) {
3127  va_list args;
3128 
3129  object *op;
3130  object *chg;
3131 
3132  va_start(args, type);
3133 
3134  op = va_arg(args, object *);
3135  chg = va_arg(args, object *);
3136 
3137  va_end(args);
3138 
3139  transmute_materialname(op, chg);
3140  *type = CFAPI_NONE;
3141 }
3142 
3143 static void cfapi_object_remove(int *type, ...) {
3144  va_list args;
3145  object *op;
3146 
3147  va_start(args, type);
3148 
3149  op = va_arg(args, object *);
3150 
3151  if (QUERY_FLAG(op, FLAG_REMOVED)) {
3152  LOG(llevError, "Plugin trying to remove removed object %s\n", op->name);
3153  va_end(args);
3154  *type = CFAPI_NONE;
3155  return;
3156  }
3157 
3158  va_end(args);
3159 
3160  object_remove(op);
3161  *type = CFAPI_NONE;
3162 }
3163 
3164 static void cfapi_object_delete(int *type, ...) {
3165  va_list args;
3166  object *op;
3167 
3168  va_start(args, type);
3169 
3170  op = va_arg(args, object *);
3171 
3173  LOG(llevError, "Plugin trying to free freed/non removed object %s\n", op->name);
3174  *type = CFAPI_NONE;
3175  va_end(args);
3176  return;
3177  }
3178 
3179  va_end(args);
3180 
3182 
3183  *type = CFAPI_NONE;
3184 }
3185 
3191 static void cfapi_object_clone(int *type, ...) {
3192  va_list args;
3193  object *op;
3194  int kind;
3195  object **robj;
3196 
3197  va_start(args, type);
3198 
3199  op = va_arg(args, object *);
3200  kind = va_arg(args, int);
3201  robj = va_arg(args, object **);
3202 
3203  va_end(args);
3204 
3205  if (kind == 0) {
3206  *type = CFAPI_POBJECT;
3207  *robj = object_create_clone(op);
3208  } else {
3209  object *tmp;
3210  tmp = object_new();
3211  object_copy(op, tmp);
3212  *type = CFAPI_POBJECT;
3213  *robj = tmp;
3214  }
3215  return;
3216 }
3217 
3223 static void cfapi_object_create(int *type, ...) {
3224  va_list args;
3225  int ival;
3226  object **robj;
3227  va_start(args, type);
3228  ival = va_arg(args, int);
3229 
3230  *type = CFAPI_POBJECT;
3231  switch (ival) {
3232  case 0:
3233  robj = va_arg(args, object **);
3234  *robj = object_new();
3235  break;
3236 
3237  case 1: { /* Named object. Nearly the old plugin behavior, but we don't add artifact suffixes */
3238  const char *sval;
3239  archetype *at;
3240 
3241  sval = va_arg(args, const char *);
3242  robj = va_arg(args, object **);
3243  va_end(args);
3244 
3245  at = try_find_archetype(sval);
3246  if (!at)
3247  at = find_archetype_by_object_name(sval);
3248  if (at) {
3249  *robj = object_create_arch(at);
3250  } else
3251  *robj = NULL;
3252  }
3253  break;
3254 
3255  default:
3256  *type = CFAPI_NONE;
3257  break;
3258  }
3259  va_end(args);
3260 }
3261 
3262 static void cfapi_object_insert(int *type, ...) {
3263  va_list args;
3264  object *op;
3265  object *orig;
3266  mapstruct *map;
3267  int flag, x, y;
3268  int itype;
3269  object **robj;
3270 
3271  va_start(args, type);
3272 
3273  op = va_arg(args, object *);
3274  if (!op) {
3275  LOG(llevError, "cfapi_object_insert: called with NULL object!\n");
3276  va_end(args);
3277  return;
3278  }
3279  if (QUERY_FLAG(op, FLAG_FREED)) {
3280  LOG(llevError, "cfapi_object_insert: called with FREED object!\n");
3281  va_end(args);
3282  return;
3283  }
3284  if (!QUERY_FLAG(op, FLAG_REMOVED)) {
3285  LOG(llevError, "cfapi_object_insert: called with not removed object %s!\n", op->name);
3286  object_remove(op);
3287  }
3288  itype = va_arg(args, int);
3289 
3290  switch (itype) {
3291  case 0:
3292  map = va_arg(args, mapstruct *);
3293  orig = va_arg(args, object *);
3294  flag = va_arg(args, int);
3295  x = va_arg(args, int);
3296  y = va_arg(args, int);
3297  robj = va_arg(args, object **);
3298  if (!map) {
3299  LOG(llevError, "cfapi_object_insert (0): called with NULL map, object %s!\n", op->name);
3301  *robj = NULL;
3302  } else
3303  *robj = object_insert_in_map_at(op, map, orig, flag, x, y);
3304  *type = CFAPI_POBJECT;
3305  break;
3306 
3307  case 1:
3308  map = va_arg(args, mapstruct *);
3309  orig = va_arg(args, object *);
3310  flag = va_arg(args, int);
3311  robj = va_arg(args, object **);
3312  if (!map) {
3313  LOG(llevError, "cfapi_object_insert (1): called with NULL map, object %s!\n", op->name);
3315  *robj = NULL;
3316  } else
3317  *robj = object_insert_in_map_at(op, map, orig, flag, op->x, op->y);
3318  *type = CFAPI_POBJECT;
3319  break;
3320 
3321  case 2:
3322  map = va_arg(args, mapstruct *);
3323  orig = va_arg(args, object *);
3324  flag = va_arg(args, int);
3325  x = va_arg(args, int);
3326  y = va_arg(args, int);
3327  robj = va_arg(args, object **);
3328  if (!map) {
3329  LOG(llevError, "cfapi_object_insert (0): called with NULL map, object %s!\n", op->name);
3331  *robj = NULL;
3332  } else {
3333  int dir = object_find_free_spot(op, map, x, y, 0, SIZEOFFREE);
3334  if (dir != -1) {
3335  *robj = object_insert_in_map_at(op, map, orig, flag, x + freearr_x[dir], y + freearr_y[dir]);
3336  } else {
3338  *robj = NULL;
3339  }
3340  }
3341  *type = CFAPI_POBJECT;
3342  break;
3343 
3344  case 3:
3345  orig = va_arg(args, object *);
3346  robj = va_arg(args, object **);
3347  if (!orig) {
3348  LOG(llevError, "cfapi_object_insert (3): called with NULL orig, object %s!\n", op->name);
3350  *robj = NULL;
3351  } else
3352  *robj = object_insert_in_ob(op, orig);
3353  *type = CFAPI_POBJECT;
3354  break;
3355 
3356  default:
3357  LOG(llevError, "cfapi_object_insert (1): called with itype %d which is not valid, object %s!\n", itype, op->name);
3359  *type = CFAPI_NONE;
3360  break;
3361  }
3362 
3363  va_end(args);
3364 }
3370 static void cfapi_object_split(int *type, ...) {
3371  va_list args;
3372 
3373  int nr, size;
3374  object *op;
3375  char *buf;
3376  object **split;
3377 
3378  va_start(args, type);
3379 
3380  op = va_arg(args, object *);
3381  nr = va_arg(args, int);
3382  buf = va_arg(args, char *);
3383  size = va_arg(args, int);
3384  split = va_arg(args, object **);
3385  va_end(args);
3386 
3387  *split = object_split(op, nr, buf, size);
3388  if (*split != NULL)
3389  {
3390  *type = CFAPI_POBJECT;
3391  }
3392  else
3393  {
3394  *type = CFAPI_NONE;
3395  }
3396 }
3397 
3403 static void cfapi_object_merge(int *type, ...) {
3404  va_list args;
3405  object *op;
3406  object *op2;
3407  object **merge;
3408 
3409  va_start(args, type);
3410 
3411  op = va_arg(args, object *);
3412  op2 = va_arg(args, object *);
3413  merge = va_arg(args, object **);
3414 
3415  va_end(args);
3416 
3417  *type = CFAPI_POBJECT;
3418  *merge = object_merge(op, op2);
3419 }
3420 
3426 static void cfapi_object_distance(int *type, ...) {
3427  va_list args;
3428  object *op;
3429  object *op2;
3430  int *rint;
3431  va_start(args, type);
3432 
3433  op = va_arg(args, object *);
3434  op2 = va_arg(args, object *);
3435  rint = va_arg(args, int *);
3436 
3437  va_end(args);
3438 
3439  *type = CFAPI_INT;
3440  *rint = object_distance(op, op2);
3441 }
3447 static void cfapi_object_update(int *type, ...) {
3448  va_list args;
3449  int action;
3450  object *op;
3451  va_start(args, type);
3452 
3453  op = va_arg(args, object *);
3454  action = va_arg(args, int);
3455 
3456  va_end(args);
3457 
3459  *type = CFAPI_NONE;
3460 }
3461 
3467 static void cfapi_object_clear(int *type, ...) {
3468  va_list args;
3469  object *op;
3470  va_start(args, type);
3471 
3472  op = va_arg(args, object *);
3473 
3474  va_end(args);
3475 
3476  object_clear(op);
3477  *type = CFAPI_NONE;
3478 }
3479 
3485 static void cfapi_object_reset(int *type, ...) {
3486  va_list args;
3487  object *op;
3488 
3489  va_start(args, type);
3490 
3491  op = va_arg(args, object *);
3492 
3493  va_end(args);
3494 
3495  object_reset(op);
3496  *type = CFAPI_NONE;
3497 }
3498 
3499 static void cfapi_object_clean_object(int *type, ...) {
3500  va_list args;
3501  object *op;
3502 
3503  va_start(args, type);
3504  op = va_arg(args, object *);
3505  clean_object(op);
3506  va_end(args);
3507  *type = CFAPI_NONE;
3508 }
3509 
3510 static void cfapi_object_on_same_map(int *type, ...) {
3511  va_list args;
3512  object *op1;
3513  object *op2;
3514  int *rint;
3515 
3516  va_start(args, type);
3517  op1 = va_arg(args, object *);
3518  op2 = va_arg(args, object *);
3519  rint = va_arg(args, int *);
3520  va_end(args);
3521 
3522  *type = CFAPI_INT;
3523  *rint = on_same_map(op1, op2);
3524 }
3525 
3526 static void cfapi_object_spring_trap(int *type, ...) {
3527  object *trap;
3528  object *victim;
3529  va_list args;
3530 
3531  va_start(args, type);
3532  trap = va_arg(args, object *);
3533  victim = va_arg(args, object *);
3534  va_end(args);
3535 
3536  spring_trap(trap, victim);
3537  *type = CFAPI_NONE;
3538 }
3539 
3545 static void cfapi_object_check_trigger(int *type, ...) {
3546  object *op;
3547  object *cause;
3548  va_list args;
3549  int *rint;
3550 
3551  va_start(args, type);
3552  op = va_arg(args, object *);
3553  cause = va_arg(args, object *);
3554  rint = va_arg(args, int *);
3555  va_end(args);
3556 
3557  *rint = check_trigger(op, cause);
3558  *type = CFAPI_INT;
3559 }
3560 
3572 static void cfapi_map_trigger_connected(int *type, ...) {
3573  objectlink *ol;
3574  object *cause;
3575  int state;
3576  va_list args;
3577 
3578  va_start(args, type);
3579  ol = va_arg(args, objectlink *);
3580  cause = va_arg(args, object *);
3581  state = va_arg(args, int);
3582  va_end(args);
3583  trigger_connected(ol, cause, state);
3584  *type = CFAPI_NONE;
3585 }
3586 
3592 static void cfapi_object_query_money(int *type, ...) {
3593  object *op;
3594  va_list args;
3595  int *rint;
3596 
3597  va_start(args, type);
3598  op = va_arg(args, object *);
3599  rint = va_arg(args, int *);
3600  va_end(args);
3601 
3602  *rint = query_money(op);
3603  *type = CFAPI_INT;
3604 }
3605 
3611 static void cfapi_object_cast(int *type, ...) {
3612  object *op;
3613  object *sp;
3614  int dir;
3615  char *str;
3616  object *caster;
3617  va_list args;
3618  int *rint;
3619 
3620  va_start(args, type);
3621  op = va_arg(args, object *);
3622  caster = va_arg(args, object *);
3623  dir = va_arg(args, int);
3624  sp = va_arg(args, object *);
3625  str = va_arg(args, char *);
3626  rint = va_arg(args, int *);
3627  va_end(args);
3628 
3629  *type = CFAPI_INT;
3630 
3631  if (!op->map) {
3632  *rint = -1;
3633  return;
3634  }
3635 
3636  *rint = cast_spell(op, caster, dir, sp, str);
3637 }
3638 
3639 static void cfapi_object_learn_spell(int *type, ...) {
3640  object *op;
3641  object *sp;
3642  int prayer;
3643  va_list args;
3644 
3645  va_start(args, type);
3646  op = va_arg(args, object *);
3647  sp = va_arg(args, object *);
3648  prayer = va_arg(args, int);
3649  va_end(args);
3650  do_learn_spell(op, sp, prayer);
3651  *type = CFAPI_NONE;
3652 }
3653 
3654 static void cfapi_object_forget_spell(int *type, ...) {
3655  object *op;
3656  object *sp;
3657  va_list args;
3658  char name[MAX_BUF];
3659 
3660  va_start(args, type);
3661  op = va_arg(args, object *);
3662  sp = va_arg(args, object *);
3663  va_end(args);
3664  query_name(sp, name, MAX_BUF);
3666  *type = CFAPI_NONE;
3667 }
3668 
3674 static void cfapi_object_check_spell(int *type, ...) {
3675  object *op;
3676  char *spellname;
3677  va_list args;
3678  object **robj;
3679 
3680  va_start(args, type);
3681  op = va_arg(args, object *);
3682  spellname = va_arg(args, char *);
3683  robj = va_arg(args, object **);
3684  va_end(args);
3685  *robj = check_spell_known(op, spellname);
3686  *type = CFAPI_POBJECT;
3687 }
3688 
3694 static void cfapi_object_pay_amount(int *type, ...) {
3695  object *op;
3696  uint64_t amount;
3697  va_list args;
3698  int *rint;
3699 
3700  va_start(args, type);
3701  op = va_arg(args, object *);
3702  amount = va_arg(args, uint64_t);
3703  rint = va_arg(args, int *);
3704  va_end(args);
3705 
3706  *rint = pay_for_amount(amount, op);
3707  *type = CFAPI_INT;
3708 }
3709 
3715 static void cfapi_object_pay_item(int *type, ...) {
3716  object *op;
3717  object *tobuy;
3718  int *rint;
3719 
3720  va_list args;
3721 
3722  va_start(args, type);
3723  tobuy = va_arg(args, object *);
3724  op = va_arg(args, object *);
3725  rint = va_arg(args, int *);
3726  va_end(args);
3727 
3728  *rint = pay_for_item(tobuy, op, 0);
3729  *type = CFAPI_INT;
3730 }
3731 
3739 static void cfapi_object_transfer(int *type, ...) {
3740  object *op;
3741  object *originator;
3742  int x, y, randompos, ttype, flag;
3743  va_list args;
3744  mapstruct *map;
3745  int *rint;
3746  object **robj;
3747 
3748  va_start(args, type);
3749  op = va_arg(args, object *);
3750  ttype = va_arg(args, int);
3751  switch (ttype) {
3752  case 0:
3753  x = va_arg(args, int);
3754  y = va_arg(args, int);
3755  randompos = va_arg(args, int);
3756  originator = va_arg(args, object *);
3757  rint = va_arg(args, int *);
3758  va_end(args);
3759 
3760  *rint = transfer_ob(op, x, y, randompos, originator);
3761  *type = CFAPI_INT;
3762  return;
3763  break;
3764 
3765  case 1:
3766  map = va_arg(args, mapstruct *);
3767  originator = va_arg(args, object *);
3768  flag = va_arg(args, int);
3769  x = va_arg(args, int);
3770  y = va_arg(args, int);
3771  robj = va_arg(args, object **);
3772  va_end(args);
3773  if (x < 0 || y < 0) {
3774  x = map->enter_x;
3775  y = map->enter_y;
3776  }
3777  *robj = object_insert_in_map_at(op, map, originator, flag, x, y);
3778  *type = CFAPI_POBJECT;
3779  return;
3780  break;
3781 
3782  case 2:
3783  x = va_arg(args, int);
3784  y = va_arg(args, int);
3785  rint = va_arg(args, int *);
3786  va_end(args);
3787 
3788  *rint = move_to(op, x, y);
3789  *type = CFAPI_INT;
3790  return;
3791 
3792  default:
3793  va_end(args);
3794  *type = CFAPI_NONE;
3795  return;
3796  break;
3797  }
3798 }
3799 
3804  object *op;
3805  char *str;
3806  va_list args;
3807  object **robj;
3808 
3809  *type = CFAPI_POBJECT;
3810  va_start(args, type);
3811  op = va_arg(args, object *);
3812 
3813  str = va_arg(args, char *);
3814  robj = va_arg(args, object **);
3816  *robj = at == NULL ? NULL : arch_present_in_ob(at, op);
3817  if (*robj == NULL) {
3818  char name[MAX_BUF];
3819 
3820  /* Search by name or slaying instead */
3821  FOR_INV_PREPARE(op, tmp) {
3822  if (tmp->name) {
3824  if (!strncmp(name, str, strlen(str)))
3825  *robj = tmp;
3826  if (!strncmp(tmp->name, str, strlen(str)))
3827  *robj = tmp;
3828  }
3829  if (tmp->slaying && !strcmp(tmp->slaying, str))
3830  *robj = tmp;
3831  if (*robj != NULL)
3832  break;
3833  } FOR_INV_FINISH();
3834  }
3835  va_end(args);
3836 }
3837 
3838 static void cfapi_object_find_by_arch_name(int *type, ...) {
3839  const object *who;
3840  object **result;
3841  const char *name;
3842  va_list args;
3843 
3844  va_start(args, type);
3845  who = va_arg(args, const object *);
3846  name = va_arg(args, const char *);
3847  result = va_arg(args, object **);
3848  va_end(args);
3849  *type = CFAPI_POBJECT;
3850 
3852 }
3853 
3854 static void cfapi_object_find_by_name(int *type, ...) {
3855  const object *who;
3856  object **result;
3857  const char *name;
3858  va_list args;
3859 
3860  va_start(args, type);
3861  who = va_arg(args, const object *);
3862  name = va_arg(args, const char *);
3863  result = va_arg(args, object **);
3864  va_end(args);
3865  *type = CFAPI_POBJECT;
3866 
3868 }
3869 
3875 static void cfapi_object_drop(int *type, ...) {
3876  object *op;
3877  object *author;
3878  va_list args;
3879 
3880  va_start(args, type);
3881  op = va_arg(args, object *);
3882  author = va_arg(args, object *);
3883  va_end(args);
3884  *type = CFAPI_NONE;
3885 
3886  if (QUERY_FLAG(op, FLAG_NO_DROP))
3887  return;
3888  drop(author, op);
3889 
3890  if (author->type == PLAYER) {
3891  author->contr->count = 0;
3892  author->contr->socket.update_look = 1;
3893  }
3894 }
3895 
3899 static void cfapi_object_change_abil(int *type, ...) {
3900  object *op, *tmp;
3901  int *rint;
3902  va_list args;
3903 
3904  va_start(args, type);
3905  op = va_arg(args, object *);
3906  tmp = va_arg(args, object *);
3907  rint = va_arg(args, int *);
3908  va_end(args);
3909 
3910  *type = CFAPI_INT;
3911  *rint = change_abil(op, tmp);
3912 }
3913 
3914 static void cfapi_object_say(int *type, ...) {
3915  object *op;
3916  char *msg;
3917  va_list args;
3918  int *rint;
3919  char empty[] = "";
3920 
3921  va_start(args, type);
3922  op = va_arg(args, object *);
3923  msg = va_arg(args, char *);
3924  rint = va_arg(args, int *);
3925  va_end(args);
3926 
3927  if (op->type == PLAYER) {
3928  command_say(op, msg == NULL ? empty : msg);
3929  } else {
3931  }
3932  *rint = 0;
3933  *type = CFAPI_INT;
3934 }
3935 
3936 /* PLAYER SUBCLASS */
3937 
3943 static void cfapi_player_find(int *type, ...) {
3944  va_list args;
3945  char *sval;
3946  player **rpl;
3947  va_start(args, type);
3948 
3949  sval = va_arg(args, char *);
3950  rpl = va_arg(args, player **);
3951  va_end(args);
3952 
3953  *rpl = find_player_partial_name(sval);
3954 
3955  *type = CFAPI_PPLAYER;
3956 }
3957 
3958 static void cfapi_player_message(int *type, ...) {
3959  va_list args;
3960  int flags;
3961  int pri;
3962  object *pl;
3963  char *buf;
3964 
3965  va_start(args, type);
3966 
3967  flags = va_arg(args, int);
3968  pri = va_arg(args, int);
3969  pl = va_arg(args, object *);
3970  buf = va_arg(args, char *);
3971  va_end(args);
3972 
3974  buf);
3975  *type = CFAPI_NONE;
3976 }
3977 
3984 static void cfapi_object_perm_exp(int *type, ...) {
3985  va_list args;
3986  object *op;
3987  int64_t *rlong;
3988 
3989  va_start(args, type);
3990  op = va_arg(args, object *);
3991  rlong = va_arg(args, int64_t *);
3992  va_end(args);
3993 
3994  *type = CFAPI_SINT64;
3995  *rlong = PERM_EXP(op->total_exp);
3996 }
3997 
4003 static void cfapi_object_change_exp(int *type, ...) {
4004  va_list args;
4005  int flag;
4006  object *ob;
4007  const char *skill;
4008  int64_t exp;
4009 
4010  va_start(args, type);
4011  ob = va_arg(args, object *);
4012  exp = va_arg(args, int64_t);
4013  skill = va_arg(args, const char *);
4014  flag = va_arg(args, int);
4015  va_end(args);
4016 
4017  *type = CFAPI_NONE;
4018  change_exp(ob, exp, skill, flag);
4019 }
4020 
4026 static void cfapi_player_can_pay(int *type, ...) {
4027  va_list args;
4028  object *pl;
4029  int *rint;
4030 
4031  va_start(args, type);
4032  pl = va_arg(args, object *);
4033  rint = va_arg(args, int *);
4034  va_end(args);
4035 
4036  *rint = can_pay(pl);
4037  *type = CFAPI_INT;
4038 }
4039 
4045 static void cfapi_player_knowledge(int *type, ...) {
4046  va_list args;
4047  object *pl;
4048  int *rint, what;
4049  const char *knowledge;
4050 
4051  va_start(args, type);
4052  what = va_arg(args, int);
4053 
4054  switch(what)
4055  {
4056  case 1:
4057  pl = va_arg(args, object *);
4058  knowledge = va_arg(args, const char *);
4059  rint = va_arg(args, int *);
4060 
4061  *type = CFAPI_INT;
4062 
4063  if (pl->contr == NULL) {
4064  LOG(llevError, "cfapi_player_knowledge: 'has' called for non player object %s", pl->name);
4065  *rint = 0;
4066  va_end(args);
4067  return;
4068  }
4069 
4070  *rint = knowledge_player_knows(pl->contr, knowledge);
4071  break;
4072 
4073  case 2:
4074  pl = va_arg(args, object *);
4075  knowledge = va_arg(args, const char *);
4076  *type = CFAPI_NONE;
4077  if (pl->contr != NULL)
4078  knowledge_give(pl->contr, knowledge, NULL);
4079 
4080  break;
4081 
4082  default:
4083  LOG(llevError, "cfapi_player_knowledge: invalid what %d", what);
4084  }
4085 
4086  va_end(args);
4087 }
4088 
4094 static void cfapi_object_teleport(int *type, ...) {
4095  mapstruct *map;
4096  int x, y;
4097  object *who;
4098  int *res;
4099  va_list args;
4100 
4101  va_start(args, type);
4102  who = va_arg(args, object *);
4103  map = va_arg(args, mapstruct *);
4104  x = va_arg(args, int);
4105  y = va_arg(args, int);
4106  res = va_arg(args, int *);
4107  va_end(args);
4108 
4109  *type = CFAPI_INT;
4110  *res = object_teleport(who, map, x, y);
4111 }
4112 
4113 static void cfapi_object_pickup(int *type, ...) {
4114  object *who;
4115  object *what;
4116  va_list args;
4117 
4118  va_start(args, type);
4119  who = va_arg(args, object *);
4120  what = va_arg(args, object *);
4121  va_end(args);
4122 
4123  pick_up(who, what);
4124  *type = CFAPI_NONE;
4125 }
4126 
4127 /* Archetype-related functions */
4128 static void cfapi_archetype_get_property(int *type, ...) {
4129  int prop;
4130  archetype *arch;
4131  va_list args;
4132  sstring *rsstring;
4133  archetype **rarch;
4134  object **robject;
4135 
4136  va_start(args, type);
4137  arch = va_arg(args, archetype *);
4138  prop = va_arg(args, int);
4139  switch (prop) {
4140  case CFAPI_ARCH_PROP_NAME:
4141  *type = CFAPI_SSTRING;
4142  rsstring = va_arg(args, sstring *);
4143  *rsstring = arch->name;
4144  break;
4145 
4146  case CFAPI_ARCH_PROP_NEXT:
4147  *type = CFAPI_PARCH;
4148  rarch = va_arg(args, archetype **);
4149  *rarch = get_next_archetype(arch);
4150  break;
4151 
4152  case CFAPI_ARCH_PROP_HEAD:
4153  *type = CFAPI_PARCH;
4154  rarch = va_arg(args, archetype **);
4155  *rarch = arch->head;
4156  break;
4157 
4158  case CFAPI_ARCH_PROP_MORE:
4159  *type = CFAPI_PARCH;
4160  rarch = va_arg(args, archetype **);
4161  *rarch = arch->more;
4162  break;
4163 
4164  case CFAPI_ARCH_PROP_CLONE:
4165  *type = CFAPI_POBJECT;
4166  robject = va_arg(args, object **);
4167  *robject = &arch->clone;
4168  break;
4169 
4170  default:
4171  *type = CFAPI_NONE;
4172  break;
4173  }
4174  va_end(args);
4175 }
4176 
4183 static void cfapi_party_get_property(int *type, ...) {
4184  partylist *party;
4185  int prop;
4186  va_list args;
4187  object *obarg;
4188  sstring *rsstring;
4189  player **rplayer;
4190  partylist **rparty;
4191 
4192  va_start(args, type);
4193  party = va_arg(args, partylist *);
4194  prop = va_arg(args, int);
4195  switch (prop) {
4196  case CFAPI_PARTY_PROP_NAME:
4197  rsstring = va_arg(args, sstring *);
4198  *rsstring = party->partyname;
4199  *type = CFAPI_SSTRING;
4200  break;
4201 
4202  case CFAPI_PARTY_PROP_NEXT:
4203  rparty = va_arg(args, partylist **);
4204  *rparty = (party ? party_get_next(party) : party_get_first());
4205  *type = CFAPI_PPARTY;
4206  break;
4207 
4209  rsstring = va_arg(args, sstring *);
4210  *rsstring = party_get_password(party);
4211  *type = CFAPI_SSTRING;
4212  break;
4213 
4215  *type = CFAPI_PPLAYER;
4216  obarg = va_arg(args, object *);
4217  rplayer = va_arg(args, player **);
4218  *rplayer = (obarg ? obarg->contr : first_player);
4219  for (; *rplayer != NULL; (*rplayer) = (*rplayer)->next)
4220  if ((*rplayer)->ob->contr->party == party) {
4221  break;
4222  }
4223  break;
4224 
4225  default:
4226  *type = CFAPI_NONE;
4227  break;
4228  }
4229  va_end(args);
4230 }
4231 
4238 static void cfapi_region_get_property(int *type, ...) {
4239  region *reg;
4240  int prop, *rint;
4241  va_list args;
4243  sstring *rsstring;
4244  region **rregion;
4245 
4246  va_start(args, type);
4247  reg = va_arg(args, region *);
4248  prop = va_arg(args, int);
4249  switch (prop) {
4251  rsstring = va_arg(args, sstring *);
4252  *rsstring = reg->name;
4253  *type = CFAPI_SSTRING;
4254  break;
4255 
4257  rregion = va_arg(args, region **);
4258  *rregion = (reg ? reg->next : first_region);
4259  *type = CFAPI_PREGION;
4260  break;
4261 
4263  rregion = va_arg(args, region **);
4264  *rregion = reg->parent;
4265  *type = CFAPI_PREGION;
4266  break;
4267 
4269  rsstring = va_arg(args, sstring *);
4270  *rsstring = reg->longname;
4271  *type = CFAPI_SSTRING;
4272  break;
4273 
4275  rsstring = va_arg(args, sstring *);
4276  *rsstring = reg->msg;
4277  *type = CFAPI_SSTRING;
4278  break;
4279 
4282  rint = va_arg(args, int*);
4283  *rint = (prop == CFAPI_REGION_PROP_JAIL_X ? reg->jailx : reg->jaily);
4284  *type = CFAPI_INT;
4285  break;
4286 
4288  rsstring = va_arg(args, sstring *);
4289  *rsstring = reg->jailmap;
4290  *type = CFAPI_SSTRING;
4291  break;
4292 
4293  default:
4294  *type = CFAPI_NONE;
4295  break;
4296  }
4297  va_end(args);
4298 }
4299 
4311 static void cfapi_friendlylist_get_next(int *type, ...) {
4312  object *ob;
4313  va_list args;
4314  object **robject;
4315 
4316  va_start(args, type);
4317  ob = va_arg(args, object *);
4318  robject = va_arg(args, object **);
4319  va_end(args);
4320 
4321  *type = CFAPI_POBJECT;
4322  *robject = get_next_friend(ob);
4323 }
4324 
4325 /*
4326  * Random-map related stuff.
4327  */
4328 
4335 static void cfapi_set_random_map_variable(int *type, ...) {
4336  va_list args;
4337  RMParms *rp;
4338  const char *buf;
4339  int *ret;
4340 
4341  va_start(args, type);
4342  rp = va_arg(args, RMParms *);
4343  buf = va_arg(args, const char *);
4344  ret = va_arg(args, int *);
4345  va_end(args);
4346 
4347  *ret = set_random_map_variable(rp, buf);
4348  *type = CFAPI_INT;
4349 }
4350 
4357 static void cfapi_generate_random_map(int *type, ...) {
4358  va_list args;
4359  const char *name;
4360  RMParms *rp;
4361  char **use_layout;
4362  sstring reset_group;
4363  mapstruct **ret;
4364 
4365  va_start(args, type);
4366  name = va_arg(args, const char *);
4367  rp = va_arg(args, RMParms *);
4368  use_layout = va_arg(args, char **);
4369  reset_group = va_arg(args, sstring);
4370  ret = va_arg(args, mapstruct **);
4371  va_end(args);
4372 
4373  *ret = generate_random_map(name, rp, use_layout, reset_group);
4374 }
4375 
4376 static void cfapi_object_user_event(int *type, ...) {
4377  object *op;
4378  object *activator;
4379  object *third;
4380  const char *message;
4381  int fix;
4382  int *ret;
4383  va_list args;
4384 
4385  va_start(args, type);
4386  op = va_arg(args, object *);
4387  activator = va_arg(args, object *);
4388  third = va_arg(args, object *);
4389  message = va_arg(args, const char *);
4390  fix = va_arg(args, int);
4391  ret = va_arg(args, int *);
4392  va_end(args);
4393 
4394  *ret = events_execute_object_user(op, activator, third, message, fix);
4395  *type = CFAPI_INT;
4396 }
4397 
4400 static void cfapi_player_quest(int *type, ...) {
4401  int op;
4402  va_list args;
4403  object *player;
4404  sstring code;
4405 
4406  va_start(args, type);
4407  op = va_arg(args, int);
4408  player = va_arg(args, object *);
4409  code = va_arg(args, sstring);
4410 
4411  if (player->contr == NULL) {
4412  LOG(llevError, "cfapi_player_quest called with non player object %s!\n", player->name);
4413  va_end(args);
4414  /* crash/quit? */
4415  return;
4416  }
4417 
4418  switch(op) {
4419  case CFAPI_PLAYER_QUEST_START: {
4420  int state = va_arg(args, int);
4421  quest_start(player->contr, code, state);
4422  *type = CFAPI_NONE;
4423  break;
4424  }
4426  int *ret = va_arg(args, int *);
4427  *ret = quest_get_player_state(player->contr, code);
4428  *type = CFAPI_INT;
4429  break;
4430  }
4432  int state = va_arg(args, int);
4433  quest_set_player_state(player->contr, code, state);
4434  *type = CFAPI_NONE;
4435  break;
4436  }
4438  int *ret = va_arg(args, int*);
4439  *ret = quest_was_completed(player->contr, code);
4440  *type = CFAPI_INT;
4441  break;
4442  }
4443  default:
4444  LOG(llevError, "invalid quest type: %d\n", op);
4445  *type = CFAPI_NONE;
4446  }
4447 
4448  va_end(args);
4449 }
4450 
4451 static void cfapi_register_command(int *type, ...) {
4452  va_list args;
4453  const char *name = NULL, *extra = NULL;
4454  float time;
4455  command_function func = NULL;
4456  command_function_extra func_extra = NULL;
4457  uint8_t register_type, command_type;
4459 
4460  va_start(args, type);
4461  register_type = va_arg(args, int);
4462  name = va_arg(args, const char *);
4463  if (register_type == 1) {
4464  func = va_arg(args, command_function);
4465  } else {
4466  extra = va_arg(args, const char *);
4467  func_extra = va_arg(args, command_function_extra);
4468  }
4469  command_type = (uint8_t)va_arg(args, int);
4470  if (command_type > COMMAND_TYPE_WIZARD) {
4471  command_type = COMMAND_TYPE_NORMAL;
4472  }
4473  time = va_arg(args, double);
4474  cr = va_arg(args, command_registration *);
4475  va_end(args);
4476 
4477  if (register_type == 1) {
4478  (*cr) = command_register(name, command_type, func, time);
4479  } else {
4480  (*cr) = command_register_extra(name, extra, command_type, func_extra, time);
4481  }
4482 
4483  *type = CFAPI_SINT64;
4484 }
4485 
4486 static void cfapi_unregister_command(int *type, ...) {
4487  va_list args;
4489 
4490  va_start(args, type);
4491  cr = va_arg(args, command_registration);
4492  va_end(args);
4493 
4494  command_unregister(cr);
4495 }
4496 
4497 /*****************************************************************************/
4498 /* NEW PLUGIN STUFF ENDS HERE */
4499 /*****************************************************************************/
4500 
4501 
4506 void initPlugins(void) {
4507  struct dirent *currentfile;
4508  DIR *plugdir;
4509  size_t l;
4510  char buf[MAX_BUF];
4511 
4512  snprintf(buf, sizeof(buf), "%s/plugins/", LIBDIR);
4513  LOG(llevDebug, "plugins: loading from %s\n", buf);
4514 
4515  plugdir = opendir(buf);
4516  if (plugdir == NULL)
4517  return;
4518 
4519  while ((currentfile = readdir(plugdir)) != NULL) {
4520  l = strlen(currentfile->d_name);
4521  if (l > strlen(PLUGIN_SUFFIX)) {
4523  int ignore = 0;
4524 
4525  if (strcmp(currentfile->d_name+l-strlen(PLUGIN_SUFFIX), PLUGIN_SUFFIX) != 0)
4526  continue;
4527 
4528  while (disable) {
4529  if (strcmp(disable->name, "All") == 0) {
4530  LOG(llevInfo, "plugins: disabling (all) %s\n", currentfile->d_name);
4531  ignore = 1;
4532  break;
4533  }
4534  if (strncmp(disable->name, currentfile->d_name, strlen(disable->name)) == 0 && strlen(currentfile->d_name) == strlen(PLUGIN_SUFFIX) + strlen(disable->name)) {
4535  LOG(llevInfo, "plugins: disabling %s\n", currentfile->d_name);
4536  ignore = 1;
4537  break;
4538  }
4539  disable = disable->next;
4540  }
4541  if (ignore == 0) {
4542  snprintf(buf, sizeof(buf), "%s/plugins/%s", LIBDIR, currentfile->d_name);
4543  LOG(llevInfo, "plugins: loading %s\n", currentfile->d_name);
4545  }
4546  }
4547  }
4548 
4549  closedir(plugdir);
4550 }
4551 
4556 void cleanupPlugins(void) {
4557  crossfire_plugin *cp;
4558 
4559  if (!plugins_list)
4560  return;
4561 
4562  for (cp = plugins_list; cp != NULL; ) {
4563  crossfire_plugin *next = cp->next;
4564  if (cp->closefunc)
4565  cp->closefunc();
4566  /* Don't actually unload plugins, it makes backtraces for memory
4567  * debugging (printed at exit) messed up. And it doesn't matter if we
4568  * don't free it here. The OS will do it for us.
4569  */
4570  /* plugins_dlclose(cp->libptr); */
4571  free(cp);
4572  cp = next;
4573  }
4574  plugins_list = NULL;
4575 }
get_month_name
const char * get_month_name(const int index)
Definition: time.c:111
cfapi_object_learn_spell
static void cfapi_object_learn_spell(int *type,...)
Definition: plugins.c:3639
give.next
def next
Definition: give.py:44
GET_MAP_OB
#define GET_MAP_OB(M, X, Y)
Definition: map.h:173
Face
Definition: face.h:14
cfapi_map_has_been_loaded
static void cfapi_map_has_been_loaded(int *type,...)
Definition: plugins.c:1024
ready_map_name
mapstruct * ready_map_name(const char *name, int flags)
Definition: map.c:1785
CFAPI_SSTRING
#define CFAPI_SSTRING
Definition: plugin.h:77
UP_OBJ_FACE
#define UP_OBJ_FACE
Definition: object.h:519
CFAPI_OBJECT_PROP_TITLE
#define CFAPI_OBJECT_PROP_TITLE
Definition: plugin.h:136
PLAYER
@ PLAYER
Definition: object.h:107
CFAPI_PPLAYER
#define CFAPI_PPLAYER
Definition: plugin.h:71
cfapi_player_message
static void cfapi_player_message(int *type,...)
Definition: plugins.c:3958
Settings::mapdir
const char * mapdir
Definition: global.h:246
cftimer_find_free_id
int cftimer_find_free_id(void)
Definition: timers.c:144
FREE_OBJ_NO_DESTROY_CALLBACK
#define FREE_OBJ_NO_DESTROY_CALLBACK
Definition: object.h:531
CFAPI_OBJECT_PROP_X
#define CFAPI_OBJECT_PROP_X
Definition: plugin.h:142
plugins_display_list
void plugins_display_list(object *op)
Definition: plugins.c:506
object_free
void object_free(object *ob, int flags)
Definition: object.c:1578
cfapi_player_quest
static void cfapi_player_quest(int *type,...)
Definition: plugins.c:4400
CFAPI_POBJECT
#define CFAPI_POBJECT
Definition: plugin.h:65
banquet.l
l
Definition: banquet.py:164
add_string
sstring add_string(const char *str)
Definition: shstr.c:124
f_plug_postinit
int(* f_plug_postinit)(void)
Definition: plugin.h:83
object_remove
void object_remove(object *op)
Definition: object.c:1819
safe_strncpy
#define safe_strncpy
Definition: compat.h:27
remove_friendly_object
void remove_friendly_object(object *op)
Definition: friend.cpp:56
object_sum_weight
signed long object_sum_weight(object *op)
Definition: object.c:572
CFAPI_OBJECT_PROP_CHA
#define CFAPI_OBJECT_PROP_CHA
Definition: plugin.h:207
object_set_enemy
void object_set_enemy(object *op, object *enemy)
Definition: object.c:919
cfapi_object_create
static void cfapi_object_create(int *type,...)
Definition: plugins.c:3223
CFAPI_MAP_PROP_TMPNAME
#define CFAPI_MAP_PROP_TMPNAME
Definition: plugin.h:252
_hook_entry
Definition: plugin.h:304
CFAPI_OBJECT_PROP_ARCH_NAME
#define CFAPI_OBJECT_PROP_ARCH_NAME
Definition: plugin.h:219
cfapi_get_hooks
static void cfapi_get_hooks(int *type,...)
Definition: plugins.c:320
CFAPI_OBJECT_PROP_ATTACK_MOVEMENT
#define CFAPI_OBJECT_PROP_ATTACK_MOVEMENT
Definition: plugin.h:182
cfapi_object_remove
static void cfapi_object_remove(int *type,...)
Definition: plugins.c:3143
llevError
@ llevError
Definition: logger.h:11
MOVE_ALL
#define MOVE_ALL
Definition: define.h:398
cfapi_object_perm_exp
static void cfapi_object_perm_exp(int *type,...)
Definition: plugins.c:3984
command_say
void command_say(object *op, const char *params)
Definition: c_chat.c:34
CFAPI_PARTY_PROP_NAME
#define CFAPI_PARTY_PROP_NAME
Definition: plugin.h:274
NR_EVENTS
#define NR_EVENTS
Definition: events.h:58
object_reset
void object_reset(object *op)
Definition: object.c:938
cfapi_object_cast
static void cfapi_object_cast(int *type,...)
Definition: plugins.c:3611
monster_npc_say
void monster_npc_say(object *npc, const char *cp)
Definition: monster.c:2485
check_path
int check_path(const char *name, int prepend_dir)
Definition: map.c:202
object_create_clone
object * object_create_clone(object *asrc)
Definition: object.c:3880
CFAPI_MAP_PROP_RESET_TIME
#define CFAPI_MAP_PROP_RESET_TIME
Definition: plugin.h:254
SET_FLAG
#define SET_FLAG(xyz, p)
Definition: define.h:224
_crossfire_plugin::closefunc
f_plug_postinit closefunc
Definition: plugin.h:99
CFAPI_MAP_PROP_RESET_TIMEOUT
#define CFAPI_MAP_PROP_RESET_TIMEOUT
Definition: plugin.h:255
CFAPI_REGION_PROP_LONGNAME
#define CFAPI_REGION_PROP_LONGNAME
Definition: plugin.h:282
cfapi_object_delete
static void cfapi_object_delete(int *type,...)
Definition: plugins.c:3164
CFAPI_OBJECT_PROP_LEVEL
#define CFAPI_OBJECT_PROP_LEVEL
Definition: plugin.h:161
CFAPI_NONE
#define CFAPI_NONE
Definition: plugin.h:60
cfapi_object_query_money
static void cfapi_object_query_money(int *type,...)
Definition: plugins.c:3592
CFAPI_PLAYER_PROP_BED_X
#define CFAPI_PLAYER_PROP_BED_X
Definition: plugin.h:238
strdup_local
#define strdup_local
Definition: compat.h:29
object_update
void object_update(object *op, int action)
Definition: object.c:1420
diamondslots.x
x
Definition: diamondslots.py:15
obj::count
tag_t count
Definition: object.h:302
cfapi_object_insert
static void cfapi_object_insert(int *type,...)
Definition: plugins.c:3262
QUERY_FLAG
#define QUERY_FLAG(xyz, p)
Definition: define.h:226
_crossfire_plugin::libptr
LIBPTRTYPE libptr
Definition: plugin.h:100
CFAPI_REGION_PROP_NEXT
#define CFAPI_REGION_PROP_NEXT
Definition: plugin.h:280
archininventory.arch
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
Definition: archininventory.py:16
get_next_archetype
archetype * get_next_archetype(archetype *current)
Definition: assets.cpp:280
clean_object
void clean_object(object *op)
Definition: map.c:1613
CFAPI_MAP_PROP_NEXT
#define CFAPI_MAP_PROP_NEXT
Definition: plugin.h:264
cfapi_system_strdup_local
static void cfapi_system_strdup_local(int *type,...)
Definition: plugins.c:603
do_learn_spell
void do_learn_spell(object *op, object *spell, int special_prayer)
Definition: apply.c:484
Settings::ignore_plugin_compatibility
uint8_t ignore_plugin_compatibility
Definition: global.h:322
cfapi_map_out_of_map
static void cfapi_map_out_of_map(int *type,...)
Definition: plugins.c:1238
get_next_friend
object * get_next_friend(object *current)
Definition: friend.cpp:147
out_of_map
int out_of_map(mapstruct *m, int x, int y)
Definition: map.c:2312
CFAPI_OBJECT_PROP_SLAYING
#define CFAPI_OBJECT_PROP_SLAYING
Definition: plugin.h:138
CFAPI_OBJECT_PROP_DEX
#define CFAPI_OBJECT_PROP_DEX
Definition: plugin.h:202
CFAPI_OBJECT_PROP_FRIENDLY
#define CFAPI_OBJECT_PROP_FRIENDLY
Definition: plugin.h:189
object_new
object * object_new(void)
Definition: object.c:1255
CFAPI_OBJECT_PROP_ARCHETYPE
#define CFAPI_OBJECT_PROP_ARCHETYPE
Definition: plugin.h:185
Settings::datadir
const char * datadir
Definition: global.h:243
cfapi_object_change_abil
static void cfapi_object_change_abil(int *type,...)
Definition: plugins.c:3899
cast_spell
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
Definition: spell_util.c:1420
calculate_difficulty
int calculate_difficulty(mapstruct *m)
Definition: map.c:1911
events_unregister_object_handler
void events_unregister_object_handler(const char *id)
Definition: events.cpp:269
CFAPI_OBJECT_PROP_BASE_NAME
#define CFAPI_OBJECT_PROP_BASE_NAME
Definition: plugin.h:191
object_find_by_arch_name
object * object_find_by_arch_name(const object *who, const char *name)
Definition: object.c:4223
UPD_WEIGHT
#define UPD_WEIGHT
Definition: newclient.h:316
pl
Definition: player.h:105
CFAPI_OBJECT_PROP_LAST_EAT
#define CFAPI_OBJECT_PROP_LAST_EAT
Definition: plugin.h:165
object_distance
int object_distance(const object *ob1, const object *ob2)
Definition: object.c:3632
CFAPI_OBJECT_PROP_MOVE_ON
#define CFAPI_OBJECT_PROP_MOVE_ON
Definition: plugin.h:227
spring_trap
void spring_trap(object *trap, object *victim)
Definition: rune.c:205
CFAPI_FUNC
#define CFAPI_FUNC
Definition: plugin.h:70
get_periodofday
const char * get_periodofday(const int index)
Definition: time.c:104
CFAPI_OBJECT_PROP_STR
#define CFAPI_OBJECT_PROP_STR
Definition: plugin.h:201
SVN_REV
#define SVN_REV
Definition: svnversion.h:2
set_random_map_variable
int set_random_map_variable(RMParms *rp, const char *buf)
Definition: reader.c:2579
quest_set_player_state
void quest_set_player_state(player *pl, sstring quest_code, int state)
Definition: quest.c:728
arch_present_in_ob
object * arch_present_in_ob(const archetype *at, const object *op)
Definition: object.c:3193
CFAPI_OBJECT_PROP_GOD
#define CFAPI_OBJECT_PROP_GOD
Definition: plugin.h:218
MoveType
unsigned char MoveType
Definition: define.h:417
guildjoin.ob
ob
Definition: guildjoin.py:42
regiondef::jailx
int16_t jailx
Definition: map.h:290
CFAPI_OBJECT_PROP_NEXT_ACTIVE_OB
#define CFAPI_OBJECT_PROP_NEXT_ACTIVE_OB
Definition: plugin.h:126
cfapi_player_find
static void cfapi_player_find(int *type,...)
Definition: plugins.c:3943
CFAPI_PLAYER_PROP_MARKED_ITEM
#define CFAPI_PLAYER_PROP_MARKED_ITEM
Definition: plugin.h:235
SET_ANIMATION
#define SET_ANIMATION(ob, newanim)
Definition: global.h:159
giveknowledge.knowledge
knowledge
DIALOGCHECK MINARGS 1 MAXARGS 1
Definition: giveknowledge.py:15
CFAPI_OBJECT_PROP_MAXSP
#define CFAPI_OBJECT_PROP_MAXSP
Definition: plugin.h:215
CFAPI_OBJECT_PROP_RAW_NAME
#define CFAPI_OBJECT_PROP_RAW_NAME
Definition: plugin.h:232
CFAPI_OBJECT_PROP_SPELL_ITEM
#define CFAPI_OBJECT_PROP_SPELL_ITEM
Definition: plugin.h:183
move_player
int move_player(object *op, int dir)
Definition: player.c:2923
pl::ob
object * ob
Definition: player.h:176
CFAPI_ARCH_PROP_NEXT
#define CFAPI_ARCH_PROP_NEXT
Definition: plugin.h:269
cfapi_get_time
static void cfapi_get_time(int *type,...)
Definition: plugins.c:815
create_pathname
char * create_pathname(const char *name, char *buf, size_t size)
Definition: map.c:103
cfapi_object_say
static void cfapi_object_say(int *type,...)
Definition: plugins.c:3914
object_can_merge
int object_can_merge(object *ob1, object *ob2)
Definition: object.c:433
CFAPI_OBJECT_PROP_Y
#define CFAPI_OBJECT_PROP_Y
Definition: plugin.h:143
CFAPI_OBJECT_PROP_ENEMY
#define CFAPI_OBJECT_PROP_ENEMY
Definition: plugin.h:176
cfapi_object_drain
static void cfapi_object_drain(int *type,...)
Definition: plugins.c:3056
CFAPI_OBJECT_PROP_MOVE_TYPE
#define CFAPI_OBJECT_PROP_MOVE_TYPE
Definition: plugin.h:224
cfapi_unregister_command
static void cfapi_unregister_command(int *type,...)
Definition: plugins.c:4486
Ice.tmp
int tmp
Definition: Ice.py:207
CFAPI_OBJECT_PROP_FACE
#define CFAPI_OBJECT_PROP_FACE
Definition: plugin.h:221
CFAPI_REGION_PROP_PARENT
#define CFAPI_REGION_PROP_PARENT
Definition: plugin.h:281
plugin.h
CFAPI_OBJECT_PROP_ENVIRONMENT
#define CFAPI_OBJECT_PROP_ENVIRONMENT
Definition: plugin.h:129
COMMAND_TYPE_NORMAL
#define COMMAND_TYPE_NORMAL
Definition: commands.h:35
CFAPI_PPARTY
#define CFAPI_PPARTY
Definition: plugin.h:72
CFAPI_OBJECT_PROP_ATTACKED_BY
#define CFAPI_OBJECT_PROP_ATTACKED_BY
Definition: plugin.h:177
generate_random_map
mapstruct * generate_random_map(const char *OutFileName, RMParms *RP, char **use_layout, sstring reset_group)
Definition: random_map.c:76
UPD_NROF
#define UPD_NROF
Definition: newclient.h:321
FOR_ABOVE_PREPARE
#define FOR_ABOVE_PREPARE(op_, it_)
Definition: define.h:687
send_changed_object
static void send_changed_object(object *op)
Definition: plugins.c:294
flags
static const flag_definition flags[]
Definition: gridarta-types-convert.c:101
CFAPI_OBJECT_PROP_PRESENT
#define CFAPI_OBJECT_PROP_PRESENT
Definition: plugin.h:196
player_set_own_title
void player_set_own_title(struct pl *pl, const char *title)
Definition: player.c:272
CFAPI_REGION_PROP_JAIL_PATH
#define CFAPI_REGION_PROP_JAIL_PATH
Definition: plugin.h:286
CFAPI_MAP_PROP_WIDTH
#define CFAPI_MAP_PROP_WIDTH
Definition: plugin.h:259
ext_info_map
void ext_info_map(int color, const mapstruct *map, uint8_t type, uint8_t subtype, const char *str1)
Definition: main.c:335
re_cmp
const char * re_cmp(const char *, const char *)
Definition: re-cmp.c:69
CFAPI_ARCH_PROP_NAME
#define CFAPI_ARCH_PROP_NAME
Definition: plugin.h:268
CFAPI_OBJECT_PROP_ITEM_POWER
#define CFAPI_OBJECT_PROP_ITEM_POWER
Definition: plugin.h:168
CFAPI_MAP_PROP_UNIQUE
#define CFAPI_MAP_PROP_UNIQUE
Definition: plugin.h:266
cfapi_object_check_trigger
static void cfapi_object_check_trigger(int *type,...)
Definition: plugins.c:3545
describe_item
StringBuffer * describe_item(const object *op, const object *owner, int use_media_tags, StringBuffer *buf)
Definition: item.c:941
cfapi_friendlylist_get_next
static void cfapi_friendlylist_get_next(int *type,...)
Definition: plugins.c:4311
f_plug_init
int(* f_plug_init)(const char *iversion, f_plug_api gethooksptr)
Definition: plugin.h:85
cfapi_object_remove_depletion
static void cfapi_object_remove_depletion(int *type,...)
Definition: plugins.c:3074
first_map
EXTERN mapstruct * first_map
Definition: global.h:116
smoking_pipe.color
color
Definition: smoking_pipe.py:5
apply_manual
int apply_manual(object *op, object *tmp, int aflag)
Definition: apply.c:597
CFAPI_FLOAT
#define CFAPI_FLOAT
Definition: plugin.h:67
apply_by_living_below
void apply_by_living_below(object *pl)
Definition: apply.c:695
MSG_TYPE_MISC
#define MSG_TYPE_MISC
Definition: newclient.h:413
CFAPI_OBJECT_PROP_CURRENT_WEAPON
#define CFAPI_OBJECT_PROP_CURRENT_WEAPON
Definition: plugin.h:175
cfapi_object_spring_trap
static void cfapi_object_spring_trap(int *type,...)
Definition: plugins.c:3526
cfapi_register_command
static void cfapi_register_command(int *type,...)
Definition: plugins.c:4451
cfapi_object_clean_object
static void cfapi_object_clean_object(int *type,...)
Definition: plugins.c:3499
cfapi_object_user_event
static void cfapi_object_user_event(int *type,...)
Definition: plugins.c:4376
cfapi_map_update_position
static void cfapi_map_update_position(int *type,...)
Definition: plugins.c:1260
_timeofday
Definition: tod.h:38
RMParms
Definition: random_map.h:14
MSG_TYPE_COMMAND
#define MSG_TYPE_COMMAND
Definition: newclient.h:404
cfapi_system_unregister_global_event
static void cfapi_system_unregister_global_event(int *type,...)
Definition: plugins.c:638
CFAPI_MAP_PROP_ENTER_X
#define CFAPI_MAP_PROP_ENTER_X
Definition: plugin.h:261
freearr_x
short freearr_x[SIZEOFFREE]
Definition: object.c:299
cfapi_object_forget_spell
static void cfapi_object_forget_spell(int *type,...)
Definition: plugins.c:3654
CFAPI_OBJECT_PROP_INVISIBLE
#define CFAPI_OBJECT_PROP_INVISIBLE
Definition: plugin.h:220
freearr_y
short freearr_y[SIZEOFFREE]
Definition: object.c:305
party_struct::partyname
char * partyname
Definition: party.h:14
plugins_dlerror
#define plugins_dlerror()
Definition: plugin.h:119
_crossfire_plugin::next
struct _crossfire_plugin * next
Definition: plugin.h:104
cfapi_object_give_skill
static void cfapi_object_give_skill(int *type,...)
Definition: plugins.c:3109
cfapi_system_directory
static void cfapi_system_directory(int *type,...)
Definition: plugins.c:762
linked_char
Definition: global.h:86
cfapi_player_can_pay
static void cfapi_player_can_pay(int *type,...)
Definition: plugins.c:4026
CFAPI_OBJECT_PROP_SKILL
#define CFAPI_OBJECT_PROP_SKILL
Definition: plugin.h:139
events_register_global_handler
event_registration events_register_global_handler(int eventcode, f_plug_event hook)
Definition: events.cpp:18
CFAPI_OBJECT_PROP_CLIENT_TYPE
#define CFAPI_OBJECT_PROP_CLIENT_TYPE
Definition: plugin.h:151
archt
Definition: object.h:469
settings
struct Settings settings
Definition: init.c:39
party_join
void party_join(object *op, partylist *party)
Definition: party.c:85
TIMER_ERR_ID
#define TIMER_ERR_ID
Definition: timers.h:67
object_merge
object * object_merge(object *op, object *top)
Definition: object.c:2031
_crossfire_plugin::global_registration
event_registration global_registration[NR_EVENTS]
Definition: plugin.h:103
object_get_value
const char * object_get_value(const object *op, const char *const key)
Definition: object.c:4317
MSG_TYPE_COMMAND_DEBUG
#define MSG_TYPE_COMMAND_DEBUG
Definition: newclient.h:528
CFAPI_OBJECT_PROP_PATH_DENIED
#define CFAPI_OBJECT_PROP_PATH_DENIED
Definition: plugin.h:156
identify
object * identify(object *op)
Definition: item.c:1409
CFAPI_MAP_PROP_REGION
#define CFAPI_MAP_PROP_REGION
Definition: plugin.h:265
free_string
void free_string(sstring str)
Definition: shstr.c:280
cfapi_object_move
static void cfapi_object_move(int *type,...)
Definition: plugins.c:1398
cfapi_map_find_by_archetype_name
static void cfapi_map_find_by_archetype_name(int *type,...)
Definition: plugins.c:1340
regiondef::next
struct regiondef * next
Definition: map.h:276
plugins_init_plugin
int plugins_init_plugin(const char *libfile)
Definition: plugins.c:366
TIMER_ERR_NONE
#define TIMER_ERR_NONE
Definition: timers.h:66
CFAPI_OBJECT_PROP_ANIM_SPEED
#define CFAPI_OBJECT_PROP_ANIM_SPEED
Definition: plugin.h:188
m
static event_registration m
Definition: citylife.cpp:427
CFAPI_OBJECT_PROP_AC
#define CFAPI_OBJECT_PROP_AC
Definition: plugin.h:209
events_register_object_handler
void events_register_object_handler(const char *id, f_plug_event handler)
Definition: events.cpp:264
autojail.who
who
Definition: autojail.py:3
cfapi_map_get_object_at
static void cfapi_map_get_object_at(int *type,...)
Definition: plugins.c:1311
party_get_first
partylist * party_get_first(void)
Definition: party.c:196
cfapi_system_re_cmp
static void cfapi_system_re_cmp(int *type,...)
Definition: plugins.c:744
pl::next
struct pl * next
Definition: player.h:106
opendir
DIR * opendir(const char *)
CFAPI_OBJECT_PROP_LORE
#define CFAPI_OBJECT_PROP_LORE
Definition: plugin.h:141
CFAPI_ARCH_PROP_HEAD
#define CFAPI_ARCH_PROP_HEAD
Definition: plugin.h:270
disinfect.map
map
Definition: disinfect.py:4
CFAPI_OBJECT_PROP_PICK_UP
#define CFAPI_OBJECT_PROP_PICK_UP
Definition: plugin.h:167
CFAPI_OBJECT_PROP_MOVE_OFF
#define CFAPI_OBJECT_PROP_MOVE_OFF
Definition: plugin.h:228
FLAG_WAS_WIZ
#define FLAG_WAS_WIZ
Definition: define.h:234
CFAPI_PLAYER_PROP_PARTY
#define CFAPI_PLAYER_PROP_PARTY
Definition: plugin.h:236
change_map_light
int change_map_light(mapstruct *m, int change)
Definition: map.c:2009
command_unregister
void command_unregister(command_registration command)
Definition: commands.cpp:537
linked_char::name
const char * name
Definition: global.h:87
get_tod
void get_tod(timeofday_t *tod)
Definition: time.c:215
determine_god
const char * determine_god(object *op)
Definition: gods.c:55
is_friendly
int is_friendly(const object *op)
Definition: friend.cpp:112
CFAPI_OBJECT_PROP_CHOSEN_SKILL
#define CFAPI_OBJECT_PROP_CHOSEN_SKILL
Definition: plugin.h:179
CFAPI_OBJECT_PROP_HP
#define CFAPI_OBJECT_PROP_HP
Definition: plugin.h:210
CFAPI_OBJECT_PROP_MAXHP
#define CFAPI_OBJECT_PROP_MAXHP
Definition: plugin.h:214
drop
void drop(object *op, object *tmp)
Definition: c_object.c:1168
diamondslots.activator
activator
Definition: diamondslots.py:10
make_face_from_files.args
args
Definition: make_face_from_files.py:31
cfapi_object_describe
static void cfapi_object_describe(int *type,...)
Definition: plugins.c:3034
rotate-tower.result
bool result
Definition: rotate-tower.py:13
CFAPI_OBJECT_PROP_OB_BELOW
#define CFAPI_OBJECT_PROP_OB_BELOW
Definition: plugin.h:125
regiondef::jaily
int16_t jaily
Definition: map.h:290
CFAPI_OBJECT_PROP_HIDDEN
#define CFAPI_OBJECT_PROP_HIDDEN
Definition: plugin.h:180
CFAPI_OBJECT_PROP_CARRYING
#define CFAPI_OBJECT_PROP_CARRYING
Definition: plugin.h:172
CFAPI_OBJECT_PROP_TOTAL_EXP
#define CFAPI_OBJECT_PROP_TOTAL_EXP
Definition: plugin.h:174
object_copy
void object_copy(const object *src_ob, object *dest_ob)
Definition: object.c:1064
move_ob
int move_ob(object *op, int dir, object *originator)
Definition: move.c:58
cftimer_destroy
int cftimer_destroy(int id)
Definition: timers.c:128
CFAPI_PLAYER_PROP_BED_Y
#define CFAPI_PLAYER_PROP_BED_Y
Definition: plugin.h:239
query_name
void query_name(const object *op, char *buf, size_t size)
Definition: item.c:585
plugins_remove_plugin
int plugins_remove_plugin(const char *id)
Definition: plugins.c:457
_crossfire_plugin::id
char id[MAX_BUF]
Definition: plugin.h:101
CFAPI_OBJECT_PROP_GEN_SP_ARMOUR
#define CFAPI_OBJECT_PROP_GEN_SP_ARMOUR
Definition: plugin.h:169
CFAPI_REGION_PROP_JAIL_Y
#define CFAPI_REGION_PROP_JAIL_Y
Definition: plugin.h:285
CFAPI_OBJECT_PROP_CHEATER
#define CFAPI_OBJECT_PROP_CHEATER
Definition: plugin.h:197
cfapi_map_create_path
static void cfapi_map_create_path(int *type,...)
Definition: plugins.c:1042
FOR_ABOVE_FINISH
#define FOR_ABOVE_FINISH()
Definition: define.h:694
events_unregister_global_handler
void events_unregister_global_handler(int eventcode, event_registration id)
Definition: events.cpp:25
CFAPI_MAP_PROP_MESSAGE
#define CFAPI_MAP_PROP_MESSAGE
Definition: plugin.h:263
Face::number
uint16_t number
Definition: face.h:15
cfapi_map_change_light
static void cfapi_map_change_light(int *type,...)
Definition: plugins.c:1367
CFAPI_OBJECT_PROP_RACE
#define CFAPI_OBJECT_PROP_RACE
Definition: plugin.h:137
f_plug_api
void(* f_plug_api)(int *type,...)
Definition: plugin.h:81
_crossfire_plugin::propfunc
f_plug_property propfunc
Definition: plugin.h:98
remove_depletion
int remove_depletion(object *op, int level)
Definition: living.c:756
cfapi_party_get_property
static void cfapi_party_get_property(int *type,...)
Definition: plugins.c:4183
CFAPI_OBJECT_PROP_MOVE_BLOCK
#define CFAPI_OBJECT_PROP_MOVE_BLOCK
Definition: plugin.h:225
CFAPI_OBJECT_PROP_FACING
#define CFAPI_OBJECT_PROP_FACING
Definition: plugin.h:148
cfapi_object_pay_amount
static void cfapi_object_pay_amount(int *type,...)
Definition: plugins.c:3694
CFAPI_INT
#define CFAPI_INT
Definition: plugin.h:61
CFAPI_OBJECT_PROP_WEIGHT
#define CFAPI_OBJECT_PROP_WEIGHT
Definition: plugin.h:170
cfapi_object_distance
static void cfapi_object_distance(int *type,...)
Definition: plugins.c:3426
object_can_pick
int object_can_pick(const object *who, const object *item)
Definition: object.c:3838
CFAPI_OBJECT_PROP_RESIST
#define CFAPI_OBJECT_PROP_RESIST
Definition: plugin.h:152
cfapi_system_find_string
static void cfapi_system_find_string(int *type,...)
Definition: plugins.c:702
CFAPI_PLAYER_PROP_IP
#define CFAPI_PLAYER_PROP_IP
Definition: plugin.h:234
object_clear
void object_clear(object *op)
Definition: object.c:987
CFAPI_OBJECT_PROP_DAM
#define CFAPI_OBJECT_PROP_DAM
Definition: plugin.h:217
cfapi_object_fix
static void cfapi_object_fix(int *type,...)
Definition: plugins.c:3093
make_face_from_files.str
str
Definition: make_face_from_files.py:24
cfapi_object_find_archetype_inside
static void cfapi_object_find_archetype_inside(int *type,...)
Definition: plugins.c:3803
NR_OF_HOOKS
#define NR_OF_HOOKS
Definition: plugins.c:47
readdir
struct dirent * readdir(DIR *)
FLAG_FREED
#define FLAG_FREED
Definition: define.h:233
cfapi_map_message
static void cfapi_map_message(int *type,...)
Definition: plugins.c:1289
cfapi_object_get_property
static void cfapi_object_get_property(int *type,...)
Definition: plugins.c:1493
convert.action
action
Definition: convert.py:25
find_string
sstring find_string(const char *str)
Definition: shstr.c:236
query_short_name
void query_short_name(const object *op, char *buf, size_t size)
Definition: item.c:510
object_present_in_ob
object * object_present_in_ob(uint8_t type, const object *op)
Definition: object.c:3139
navar-midane_pickup.msg
list msg
Definition: navar-midane_pickup.py:13
_crossfire_plugin::prev
struct _crossfire_plugin * prev
Definition: plugin.h:105
transmute_materialname
void transmute_materialname(object *op, const object *change)
Definition: utils.c:267
FREE_AND_COPY
#define FREE_AND_COPY(sv, nv)
Definition: global.h:201
regiondef::name
char * name
Definition: map.h:277
first_player
EXTERN player * first_player
Definition: global.h:115
CFAPI_OBJECT_PROP_PATH_ATTUNED
#define CFAPI_OBJECT_PROP_PATH_ATTUNED
Definition: plugin.h:154
events_execute_object_user
int events_execute_object_user(object *op, object *activator, object *third, const char *message, int fix)
Definition: events.cpp:282
cfapi_object_apply
static void cfapi_object_apply(int *type,...)
Definition: plugins.c:2989
obj::container
struct obj * container
Definition: object.h:294
CFAPI_ARCH_PROP_CLONE
#define CFAPI_ARCH_PROP_CLONE
Definition: plugin.h:272
CFAPI_OBJECT_PROP_EXP
#define CFAPI_OBJECT_PROP_EXP
Definition: plugin.h:194
SET_MAP_FLAGS
#define SET_MAP_FLAGS(M, X, Y, C)
Definition: map.h:164
CFAPI_OBJECT_PROP_SPEED
#define CFAPI_OBJECT_PROP_SPEED
Definition: plugin.h:144
fix_object
void fix_object(object *op)
Definition: living.c:1126
CFAPI_OBJECT_PROP_TYPE
#define CFAPI_OBJECT_PROP_TYPE
Definition: plugin.h:149
quest_was_completed
int quest_was_completed(player *pl, sstring quest_code)
Definition: quest.c:738
CFAPI_OBJECT_PROP_NROF
#define CFAPI_OBJECT_PROP_NROF
Definition: plugin.h:146
object_create_arch
object * object_create_arch(archetype *at)
Definition: arch.cpp:301
CFAPI_PLAYER_PROP_TITLE
#define CFAPI_PLAYER_PROP_TITLE
Definition: plugin.h:241
CFAPI_MAP_PROP_PATH
#define CFAPI_MAP_PROP_PATH
Definition: plugin.h:251
stringbuffer_finish
char * stringbuffer_finish(StringBuffer *sb)
Definition: stringbuffer.c:76
cfapi_map_get_map
static void cfapi_map_get_map(int *type,...)
Definition: plugins.c:973
cfapi_object_transfer
static void cfapi_object_transfer(int *type,...)
Definition: plugins.c:3739
is_magical
int is_magical(const object *op)
Definition: item.c:1215
linked_char::next
struct linked_char * next
Definition: global.h:88
CFAPI_OBJECT_PROP_CUSTOM_NAME
#define CFAPI_OBJECT_PROP_CUSTOM_NAME
Definition: plugin.h:187
CFAPI_OBJECT_PROP_PICKABLE
#define CFAPI_OBJECT_PROP_PICKABLE
Definition: plugin.h:199
FOR_INV_FINISH
#define FOR_INV_FINISH()
Definition: define.h:677
CFAPI_PREGION
#define CFAPI_PREGION
Definition: plugin.h:73
cfapi_system_register_global_event
static void cfapi_system_register_global_event(int *type,...)
Definition: plugins.c:617
_crossfire_plugin::fullname
char fullname[MAX_BUF]
Definition: plugin.h:102
player
struct pl player
object_set_value
int object_set_value(object *op, const char *key, const char *value, int add_key)
Definition: object.c:4470
sstring
const typedef char * sstring
Definition: global.h:40
CFAPI_PLAYER_QUEST_START
#define CFAPI_PLAYER_QUEST_START
Definition: plugin.h:244
CFAPI_REGION_PROP_NAME
#define CFAPI_REGION_PROP_NAME
Definition: plugin.h:279
cfapi_object_clone
static void cfapi_object_clone(int *type,...)
Definition: plugins.c:3191
CFAPI_OBJECT_PROP_INVISIBLE_TIME
#define CFAPI_OBJECT_PROP_INVISIBLE_TIME
Definition: plugin.h:166
CFAPI_OBJECT_PROP_ATTACK_TYPE
#define CFAPI_OBJECT_PROP_ATTACK_TYPE
Definition: plugin.h:153
move_to
int move_to(object *op, int x, int y)
Definition: move.c:563
CFAPI_REGION_PROP_JAIL_X
#define CFAPI_REGION_PROP_JAIL_X
Definition: plugin.h:284
Settings::confdir
const char * confdir
Definition: global.h:242
sproto.h
free_dialog_information
void free_dialog_information(object *op)
Definition: dialog.c:32
FLAG_NO_DROP
#define FLAG_NO_DROP
Definition: define.h:288
cfapi_archetype_get_property
static void cfapi_archetype_get_property(int *type,...)
Definition: plugins.c:4128
give.direction
direction
Definition: give.py:37
cfapi_object_split
static void cfapi_object_split(int *type,...)
Definition: plugins.c:3370
animate.anim
string anim
Definition: animate.py:20
cfapi_map_set_map_property
static void cfapi_map_set_map_property(int *type,...)
Definition: plugins.c:1208
get_face_by_id
const Face * get_face_by_id(uint16_t id)
Definition: assets.cpp:345
mapdef
Definition: map.h:317
cfapi_object_update
static void cfapi_object_update(int *type,...)
Definition: plugins.c:3447
MSG_SUBTYPE_NONE
#define MSG_SUBTYPE_NONE
Definition: newclient.h:420
cfapi_object_change_exp
static void cfapi_object_change_exp(int *type,...)
Definition: plugins.c:4003
CFAPI_OBJECT_PROP_OWNER
#define CFAPI_OBJECT_PROP_OWNER
Definition: plugin.h:195
delete_map
void delete_map(mapstruct *m)
Definition: map.c:1722
cfapi_timer_destroy
static void cfapi_timer_destroy(int *type,...)
Definition: plugins.c:930
create_overlay_pathname
void create_overlay_pathname(const char *name, char *buf, size_t size)
Definition: map.c:124
CFAPI_OBJECT_PROP_NAME_PLURAL
#define CFAPI_OBJECT_PROP_NAME_PLURAL
Definition: plugin.h:135
party_struct
Definition: party.h:10
CFAPI_PARTY_PROP_NEXT
#define CFAPI_PARTY_PROP_NEXT
Definition: plugin.h:275
object_set_owner
void object_set_owner(object *op, object *owner)
Definition: object.c:844
strlcpy
size_t strlcpy(char *dst, const char *src, size_t size)
Definition: porting.c:220
SIZEOFFREE
#define SIZEOFFREE
Definition: define.h:155
P_OUT_OF_MAP
#define P_OUT_OF_MAP
Definition: map.h:250
plug_hooks
static const hook_entry plug_hooks[]
Definition: plugins.c:147
MAX_BUF
#define MAX_BUF
Definition: define.h:35
CFAPI_MAP_PROP_NAME
#define CFAPI_MAP_PROP_NAME
Definition: plugin.h:253
UP_OBJ_INSERT
#define UP_OBJ_INSERT
Definition: object.h:516
COMMAND_TYPE_WIZARD
#define COMMAND_TYPE_WIZARD
Definition: commands.h:39
CFAPI_OBJECT_PROP_WIS
#define CFAPI_OBJECT_PROP_WIS
Definition: plugin.h:204
check_trigger
int check_trigger(object *op, object *cause)
Definition: button.c:518
CFAPI_OBJECT_PROP_POW
#define CFAPI_OBJECT_PROP_POW
Definition: plugin.h:206
transfer_ob
int transfer_ob(object *op, int x, int y, int randomly, object *originator)
Definition: move.c:163
cfapi_object_identify
static void cfapi_object_identify(int *type,...)
Definition: plugins.c:3014
CFAPI_REGION_PROP_MESSAGE
#define CFAPI_REGION_PROP_MESSAGE
Definition: plugin.h:283
cfapi_object_reset
static void cfapi_object_reset(int *type,...)
Definition: plugins.c:3485
Settings::playerdir
const char * playerdir
Definition: global.h:245
cfapi_cost_string_from_value
static void cfapi_cost_string_from_value(int *type,...)
Definition: plugins.c:529
try_find_animation
Animations * try_find_animation(const char *name)
Definition: assets.cpp:300
party_get_next
partylist * party_get_next(const partylist *party)
Definition: party.c:208
cfapi_object_check_spell
static void cfapi_object_check_spell(int *type,...)
Definition: plugins.c:3674
cfapi_object_set_key
static void cfapi_object_set_key(int *type,...)
Definition: plugins.c:1470
cfapi_object_transmute
static void cfapi_object_transmute(int *type,...)
Definition: plugins.c:3126
CFAPI_DOUBLE
#define CFAPI_DOUBLE
Definition: plugin.h:68
CFAPI_OBJECT_PROP_CONTAINER
#define CFAPI_OBJECT_PROP_CONTAINER
Definition: plugin.h:131
CFAPI_OBJECT_PROP_INVENTORY
#define CFAPI_OBJECT_PROP_INVENTORY
Definition: plugin.h:128
CFAPI_OBJECT_PROP_MAP
#define CFAPI_OBJECT_PROP_MAP
Definition: plugin.h:132
CFAPI_MAP_PROP_FLAGS
#define CFAPI_MAP_PROP_FLAGS
Definition: plugin.h:249
object_set_msg
void object_set_msg(object *op, const char *msg)
Definition: object.c:4781
CFAPI_MAP_PROP_DARKNESS
#define CFAPI_MAP_PROP_DARKNESS
Definition: plugin.h:258
diamondslots.message
string message
Definition: diamondslots.py:57
CFAPI_MAP_PROP_PLAYERS
#define CFAPI_MAP_PROP_PLAYERS
Definition: plugin.h:256
animations_struct
Definition: face.h:25
FLAG_REMOVED
#define FLAG_REMOVED
Definition: define.h:232
CFAPI_OBJECT_PROP_RUN_AWAY
#define CFAPI_OBJECT_PROP_RUN_AWAY
Definition: plugin.h:178
PERM_EXP
#define PERM_EXP(exptotal)
Definition: global.h:227
Settings::disabled_plugins
linked_char * disabled_plugins
Definition: global.h:321
CFAPI_SINT64
#define CFAPI_SINT64
Definition: plugin.h:76
CFAPI_PLAYER_PROP_TRANSPORT
#define CFAPI_PLAYER_PROP_TRANSPORT
Definition: plugin.h:242
llevInfo
@ llevInfo
Definition: logger.h:12
dirent
#define dirent
Definition: xdir.h:12
plugins_list
crossfire_plugin * plugins_list
Definition: plugins.c:245
NDI_UNIQUE
#define NDI_UNIQUE
Definition: newclient.h:262
CFAPI_PARTY_PROP_PLAYER
#define CFAPI_PARTY_PROP_PLAYER
Definition: plugin.h:277
CFAPI_PMAP
#define CFAPI_PMAP
Definition: plugin.h:66
CFAPI_PLAYER_QUEST_GET_STATE
#define CFAPI_PLAYER_QUEST_GET_STATE
Definition: plugin.h:245
cfapi_log
static void cfapi_log(int *type,...)
Definition: plugins.c:949
CFAPI_MAP_PROP_DIFFICULTY
#define CFAPI_MAP_PROP_DIFFICULTY
Definition: plugin.h:250
find_archetype_by_object_name
archetype * find_archetype_by_object_name(const char *name)
Definition: arch.cpp:55
regiondef::parent
struct regiondef * parent
Definition: map.h:278
cfapi_object_merge
static void cfapi_object_merge(int *type,...)
Definition: plugins.c:3403
CFAPI_OBJECT_PROP_ANIMATION
#define CFAPI_OBJECT_PROP_ANIMATION
Definition: plugin.h:222
CFAPI_OBJECT_PROP_INT
#define CFAPI_OBJECT_PROP_INT
Definition: plugin.h:205
CFAPI_OBJECT_PROP_SP
#define CFAPI_OBJECT_PROP_SP
Definition: plugin.h:211
party_get_password
const char * party_get_password(const partylist *party)
Definition: party.c:232
obj::contr
struct pl * contr
Definition: object.h:279
regiondef::jailmap
char * jailmap
Definition: map.h:289
cfapi_system_find_face
static void cfapi_system_find_face(int *type,...)
Definition: plugins.c:580
initPlugins
void initPlugins(void)
Definition: plugins.c:4506
add_friendly_object
void add_friendly_object(object *op)
Definition: friend.cpp:36
CFAPI_PLAYER_QUEST_SET_STATE
#define CFAPI_PLAYER_QUEST_SET_STATE
Definition: plugin.h:246
map_find_by_archetype
object * map_find_by_archetype(mapstruct *m, int x, int y, const archetype *at)
Definition: object.c:3089
CFAPI_OBJECT_PROP_NAME
#define CFAPI_OBJECT_PROP_NAME
Definition: plugin.h:134
CFAPI_OBJECT_PROP_EXP_MULTIPLIER
#define CFAPI_OBJECT_PROP_EXP_MULTIPLIER
Definition: plugin.h:184
cfapi_map_trigger_connected
static void cfapi_map_trigger_connected(int *type,...)
Definition: plugins.c:3572
cfapi_get_weekday_name
static void cfapi_get_weekday_name(int *type,...)
Definition: plugins.c:858
reputation.victim
victim
Definition: reputation.py:14
LOG
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.c:51
CFAPI_OBJECT_PROP_PREV_ACTIVE_OB
#define CFAPI_OBJECT_PROP_PREV_ACTIVE_OB
Definition: plugin.h:127
timers.h
P_NEED_UPDATE
#define P_NEED_UPDATE
Definition: map.h:240
cfapi_system_remove_string
static void cfapi_system_remove_string(int *type,...)
Definition: plugins.c:684
CFAPI_OBJECT_PROP_HEAD
#define CFAPI_OBJECT_PROP_HEAD
Definition: plugin.h:130
CFAPI_PARCH
#define CFAPI_PARCH
Definition: plugin.h:69
check_spell_known
object * check_spell_known(object *op, const char *name)
Definition: spell_util.c:393
f_plug_event
int(* f_plug_event)(int *type,...)
Definition: events.h:61
object_set_cheat
void object_set_cheat(object *op)
Definition: object.c:3245
give.op
op
Definition: give.py:33
object_find_free_spot
int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
Definition: object.c:3530
autojail.value
value
Definition: autojail.py:6
get_season_name
const char * get_season_name(const int index)
Definition: time.c:125
board.author
author
Definition: board.py:59
pay_for_item
int pay_for_item(object *op, object *pl, uint64_t reduction)
Definition: shop.c:501
CFAPI_PLAYER_PROP_BED_MAP
#define CFAPI_PLAYER_PROP_BED_MAP
Definition: plugin.h:237
CFAPI_INT16
#define CFAPI_INT16
Definition: plugin.h:74
shop.h
trigger_connected
void trigger_connected(objectlink *ol, object *cause, const int state)
Definition: button.c:41
CFAPI_OBJECT_PROP_WC
#define CFAPI_OBJECT_PROP_WC
Definition: plugin.h:208
plugins_dlsym
#define plugins_dlsym(lib, name)
Definition: plugin.h:118
CFAPI_OBJECT_PROP_GLOW_RADIUS
#define CFAPI_OBJECT_PROP_GLOW_RADIUS
Definition: plugin.h:173
query_money
uint64_t query_money(const object *op)
Definition: shop.c:430
cfapi_object_get_key
static void cfapi_object_get_key(int *type,...)
Definition: plugins.c:1448
esrv_update_item
void esrv_update_item(int flags, object *pl, object *op)
Definition: main.c:360
CFAPI_OBJECT_PROP_PATH_REPELLED
#define CFAPI_OBJECT_PROP_PATH_REPELLED
Definition: plugin.h:155
query_base_name
void query_base_name(const object *op, int plural, char *buf, size_t size)
Definition: item.c:686
CFAPI_OBJECT_PROP_CON
#define CFAPI_OBJECT_PROP_CON
Definition: plugin.h:203
diamondslots.y
y
Definition: diamondslots.py:16
copy_message
static void copy_message(object *op, const char *msg)
Definition: plugins.c:2299
CFAPI_STRING
#define CFAPI_STRING
Definition: plugin.h:64
CLEAR_FLAG
#define CLEAR_FLAG(xyz, p)
Definition: define.h:225
can_pay
int can_pay(object *pl)
Definition: shop.c:811
LIBPTRTYPE
#define LIBPTRTYPE
Definition: plugin.h:90
CFAPI_OBJECT_PROP_GP
#define CFAPI_OBJECT_PROP_GP
Definition: plugin.h:212
buf
StringBuffer * buf
Definition: readable.c:1610
CFAPI_OBJECT_PROP_MAGICAL
#define CFAPI_OBJECT_PROP_MAGICAL
Definition: plugin.h:192
change_exp
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Definition: living.c:2168
CFAPI_OBJECT_PROP_LAST_SP
#define CFAPI_OBJECT_PROP_LAST_SP
Definition: plugin.h:163
object_insert_in_ob
object * object_insert_in_ob(object *op, object *where)
Definition: object.c:2833
player_arrest
int player_arrest(object *who)
Definition: c_wiz.c:809
cfapi_get_season_name
static void cfapi_get_season_name(int *type,...)
Definition: plugins.c:846
update_all_los
void update_all_los(const mapstruct *map, int x, int y)
Definition: los.c:536
find_player_partial_name
player * find_player_partial_name(const char *plname)
Definition: player.c:111
object_update_speed
void object_update_speed(object *op)
Definition: object.c:1330
CFAPI_OBJECT_PROP_MATERIAL
#define CFAPI_OBJECT_PROP_MATERIAL
Definition: plugin.h:157
CFAPI_OBJECT_PROP_DURATION
#define CFAPI_OBJECT_PROP_DURATION
Definition: plugin.h:231
cfapi_object_find_by_name
static void cfapi_object_find_by_name(int *type,...)
Definition: plugins.c:3854
CFAPI_OBJECT_PROP_MOVE_STATUS
#define CFAPI_OBJECT_PROP_MOVE_STATUS
Definition: plugin.h:181
object_get_env_recursive
object * object_get_env_recursive(object *op)
Definition: object.c:594
CFAPI_OBJECT_PROP_OTHER_ARCH
#define CFAPI_OBJECT_PROP_OTHER_ARCH
Definition: plugin.h:186
cfapi_system_find_animation
static void cfapi_system_find_animation(int *type,...)
Definition: plugins.c:559
CFAPI_OBJECT_PROP_OB_ABOVE
#define CFAPI_OBJECT_PROP_OB_ABOVE
Definition: plugin.h:124
knowledge_player_knows
int knowledge_player_knows(const player *pl, const char *knowledge)
Definition: knowledge.c:1295
CFAPI_MAP_PROP_ENTER_Y
#define CFAPI_MAP_PROP_ENTER_Y
Definition: plugin.h:262
cfapi_object_teleport
static void cfapi_object_teleport(int *type,...)
Definition: plugins.c:4094
quest_start
void quest_start(player *pl, sstring quest_code, int state)
Definition: quest.c:692
CFAPI_OBJECT_PROP_LAST_HEAL
#define CFAPI_OBJECT_PROP_LAST_HEAL
Definition: plugin.h:162
object_present_in_ob_by_name
object * object_present_in_ob_by_name(int type, const char *str, const object *op)
Definition: object.c:3174
CFAPI_OBJECT_PROP_MOVE_ALLOW
#define CFAPI_OBJECT_PROP_MOVE_ALLOW
Definition: plugin.h:226
knowledge_give
void knowledge_give(player *pl, const char *marker, const object *book)
Definition: knowledge.c:993
get_region_by_map
region * get_region_by_map(mapstruct *m)
Definition: region.cpp:76
object_insert_in_map_at
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Definition: object.c:2080
CFAPI_ARCH_PROP_MORE
#define CFAPI_ARCH_PROP_MORE
Definition: plugin.h:271
draw_ext_info
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Definition: main.c:309
object_free_drop_inventory
void object_free_drop_inventory(object *ob)
Definition: object.c:1546
update_position
void update_position(mapstruct *m, int x, int y)
Definition: map.c:2133
cfapi_object_on_same_map
static void cfapi_object_on_same_map(int *type,...)
Definition: plugins.c:3510
command_function_extra
void(* command_function_extra)(object *op, const char *params, const char *extra)
Definition: commands.h:29
command_register
command_registration command_register(const char *name, uint8_t type, command_function func, float time)
Definition: commands.cpp:105
cfapi_object_clear
static void cfapi_object_clear(int *type,...)
Definition: plugins.c:3467
try_find_archetype
archetype * try_find_archetype(const char *name)
Definition: assets.cpp:288
plugins_find_plugin
static crossfire_plugin * plugins_find_plugin(const char *id)
Definition: plugins.c:256
CFAPI_OBJECT_PROP_MOVE_SLOW
#define CFAPI_OBJECT_PROP_MOVE_SLOW
Definition: plugin.h:229
CFAPI_OBJECT_PROP_MERGEABLE
#define CFAPI_OBJECT_PROP_MERGEABLE
Definition: plugin.h:198
cleanupPlugins
void cleanupPlugins(void)
Definition: plugins.c:4556
cfapi_get_month_name
static void cfapi_get_month_name(int *type,...)
Definition: plugins.c:870
try_find_face
const Face * try_find_face(const char *name, const Face *error)
Definition: assets.cpp:312
do_forget_spell
void do_forget_spell(object *op, const char *spell)
Definition: apply.c:525
quest.state
state
Definition: quest.py:13
cfapi_object_apply_below
static void cfapi_object_apply_below(int *type,...)
Definition: plugins.c:2969
command_registration
uint64_t command_registration
Definition: commands.h:32
cfapi_generate_random_map
static void cfapi_generate_random_map(int *type,...)
Definition: plugins.c:4357
cfapi_object_pay_item
static void cfapi_object_pay_item(int *type,...)
Definition: plugins.c:3715
cfapi_object_find_by_arch_name
static void cfapi_object_find_by_arch_name(int *type,...)
Definition: plugins.c:3838
CFAPI_OBJECT_PROP_MAGIC
#define CFAPI_OBJECT_PROP_MAGIC
Definition: plugin.h:159
cfapi_player_knowledge
static void cfapi_player_knowledge(int *type,...)
Definition: plugins.c:4045
object_decrease_nrof
object * object_decrease_nrof(object *op, uint32_t i)
Definition: object.c:2652
CFAPI_OBJECT_PROP_FLAGS
#define CFAPI_OBJECT_PROP_FLAGS
Definition: plugin.h:200
level
int level
Definition: readable.c:1608
CFAPI_OBJECT_PROP_LUCK
#define CFAPI_OBJECT_PROP_LUCK
Definition: plugin.h:193
cfapi_object_drop
static void cfapi_object_drop(int *type,...)
Definition: plugins.c:3875
get_weekday
const char * get_weekday(const int index)
Definition: time.c:118
CFAPI_MAP_PROP_HEIGHT
#define CFAPI_MAP_PROP_HEIGHT
Definition: plugin.h:260
object_teleport
int object_teleport(object *op, mapstruct *map, int x, int y)
Definition: move.c:597
object_find_by_name
object * object_find_by_name(const object *who, const char *name)
Definition: object.c:3927
cfapi_object_set_property
static void cfapi_object_set_property(int *type,...)
Definition: plugins.c:2316
UPD_ALL
#define UPD_ALL
Definition: newclient.h:322
command_register_extra
command_registration command_register_extra(const char *name, const char *extra, uint8_t type, command_function_extra func, float time)
Definition: commands.cpp:528
split
static std::vector< std::string > split(const std::string &field, const std::string &by)
Definition: mapper.cpp:2655
CFAPI_OBJECT_PROP_VALUE
#define CFAPI_OBJECT_PROP_VALUE
Definition: plugin.h:160
cfapi_set_random_map_variable
static void cfapi_set_random_map_variable(int *type,...)
Definition: plugins.c:4335
CFAPI_OBJECT_PROP_MESSAGE
#define CFAPI_OBJECT_PROP_MESSAGE
Definition: plugin.h:140
CFAPI_OBJECT_PROP_MOVE_SLOW_PENALTY
#define CFAPI_OBJECT_PROP_MOVE_SLOW_PENALTY
Definition: plugin.h:230
LogLevel
LogLevel
Definition: logger.h:10
string_get_int
#define string_get_int(name)
Definition: plugins.c:827
diamondslots.cost
int cost
Definition: diamondslots.py:21
CFAPI_OBJECT_PROP_MAXGP
#define CFAPI_OBJECT_PROP_MAXGP
Definition: plugin.h:216
CFAPI_OBJECT_PROP_COUNT
#define CFAPI_OBJECT_PROP_COUNT
Definition: plugin.h:133
CFAPI_OBJECT_PROP_SUBTYPE
#define CFAPI_OBJECT_PROP_SUBTYPE
Definition: plugin.h:150
Settings::tmpdir
const char * tmpdir
Definition: global.h:250
oblnk
Definition: object.h:446
CFAPI_PLAYER_QUEST_WAS_COMPLETED
#define CFAPI_PLAYER_QUEST_WAS_COMPLETED
Definition: plugin.h:247
svnversion.h
cfapi_region_get_property
static void cfapi_region_get_property(int *type,...)
Definition: plugins.c:4238
give_skill_by_name
object * give_skill_by_name(object *op, const char *skill_name)
Definition: living.c:1779
regiondef::msg
char * msg
Definition: map.h:285
command_function
void(* command_function)(object *op, const char *params)
Definition: commands.h:17
plugins_dlclose
#define plugins_dlclose(lib)
Definition: plugin.h:117
cfapi_map_get_map_property
static void cfapi_map_get_map_property(int *type,...)
Definition: plugins.c:1076
CFAPI_LONG
#define CFAPI_LONG
Definition: plugin.h:62
player_get_title
void player_get_title(const struct pl *pl, char *buf, size_t bufsize)
Definition: player.c:232
get_map_flags
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
Definition: map.c:301
object_get_player_container
object * object_get_player_container(object *op)
Definition: object.c:611
change_abil
int change_abil(object *op, object *tmp)
Definition: living.c:395
drain_specific_stat
void drain_specific_stat(object *op, int deplete_stats)
Definition: living.c:729
closedir
int closedir(DIR *)
pay_for_amount
int pay_for_amount(uint64_t to_pay, object *pl)
Definition: shop.c:461
first_region
EXTERN region * first_region
Definition: global.h:117
pick_up
void pick_up(object *op, object *alt)
Definition: c_object.c:519
regiondef::longname
char * longname
Definition: map.h:283
altar_valkyrie.pl
pl
Definition: altar_valkyrie.py:28
get_empty_map
mapstruct * get_empty_map(int sizex, int sizey)
Definition: map.c:869
on_same_map
int on_same_map(const object *op1, const object *op2)
Definition: map.c:2657
CFAPI_OBJECT_PROP_FP
#define CFAPI_OBJECT_PROP_FP
Definition: plugin.h:213
cfapi_get_periodofday_name
static void cfapi_get_periodofday_name(int *type,...)
Definition: plugins.c:882
cfapi_object_pickup
static void cfapi_object_pickup(int *type,...)
Definition: plugins.c:4113
get_map_from_coord
mapstruct * get_map_from_coord(mapstruct *m, int16_t *x, int16_t *y)
Definition: map.c:2385
object_split
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
Definition: object.c:2613
find_marked_object
object * find_marked_object(object *op)
Definition: c_object.c:1520
FOR_INV_PREPARE
#define FOR_INV_PREPARE(op_, it_)
Definition: define.h:670
_crossfire_plugin
Definition: plugin.h:97
CFAPI_PARTY_PROP_PASSWORD
#define CFAPI_PARTY_PROP_PASSWORD
Definition: plugin.h:276
CFAPI_OBJECT_PROP_LAST_GRACE
#define CFAPI_OBJECT_PROP_LAST_GRACE
Definition: plugin.h:164
altar_valkyrie.res
int res
Definition: altar_valkyrie.py:74
CFAPI_MOVETYPE
#define CFAPI_MOVETYPE
Definition: plugin.h:78
f_plug_property
void *(* f_plug_property)(int *type,...)
Definition: plugin.h:87
draw_ext_info_format
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
Definition: main.c:319
cfapi_system_add_string
static void cfapi_system_add_string(int *type,...)
Definition: plugins.c:664
CFAPI_PLAYER_PROP_NEXT
#define CFAPI_PLAYER_PROP_NEXT
Definition: plugin.h:240
cfapi_timer_create
static void cfapi_timer_create(int *type,...)
Definition: plugins.c:897
CFAPI_OBJECT_PROP_DIRECTION
#define CFAPI_OBJECT_PROP_DIRECTION
Definition: plugin.h:147
CFAPI_OBJECT_PROP_SHORT_NAME
#define CFAPI_OBJECT_PROP_SHORT_NAME
Definition: plugin.h:190
cfapi_system_check_path
static void cfapi_system_check_path(int *type,...)
Definition: plugins.c:721
llevDebug
@ llevDebug
Definition: logger.h:13
CFAPI_OBJECT_PROP_MATERIAL_NAME
#define CFAPI_OBJECT_PROP_MATERIAL_NAME
Definition: plugin.h:158
is_valid_types_gen.type
list type
Definition: is_valid_types_gen.py:25
plugins_dlopen
#define plugins_dlopen(fname)
Definition: plugin.h:116
cost_string_from_value
char * cost_string_from_value(uint64_t cost, int largest_coin)
Definition: shop.c:277
CFAPI_OBJECT_PROP_WEIGHT_LIMIT
#define CFAPI_OBJECT_PROP_WEIGHT_LIMIT
Definition: plugin.h:171
give.name
name
Definition: give.py:27
has_been_loaded
mapstruct * has_been_loaded(const char *name)
Definition: map.c:78
Settings::uniquedir
const char * uniquedir
Definition: global.h:248
CFAPI_OBJECT_PROP_SPEED_LEFT
#define CFAPI_OBJECT_PROP_SPEED_LEFT
Definition: plugin.h:145
quest_get_player_state
int quest_get_player_state(player *pl, sstring quest_code)
Definition: quest.c:672
cfapi_map_delete_map
static void cfapi_map_delete_map(int *type,...)
Definition: plugins.c:1276
cftimer_create
int cftimer_create(int id, long delay, object *ob, int mode)
Definition: timers.c:97
object_get_owner
object * object_get_owner(object *op)
Definition: object.c:808
_hook_entry::func
f_plug_api func
Definition: plugin.h:305
level
Definition: level.py:1
diamondslots.id
id
Definition: diamondslots.py:53
Settings::localdir
const char * localdir
Definition: global.h:244
regiondef
Definition: map.h:275