Crossfire Server, Trunk  R21670
plugin_common.c
Go to the documentation of this file.
1 /*****************************************************************************/
2 /* Crossfire Plugin Interface Common Parts */
3 /* Version: 2.0beta8 (also known as "Alexander") */
4 /* Contact: yann.chachkoff@myrealbox.com */
5 /*****************************************************************************/
6 /* The CPICP are the various functions of the server that can be used by all */
7 /* plugins. It is recommended that plugins do not call the server-provided */
8 /* functions directly, but instead use the wrappers provided here by the */
9 /* CPICP interface. By doing so, various validity checks can be performed */
10 /* by CPICP, protecting the server from potential nasty effects of passing */
11 /* it wrong parameter values. */
12 /*****************************************************************************/
13 /* That code is placed under the GNU General Public Licence (GPL) */
14 /* (C)2001-2005 by Chachkoff Yann (Feel free to deliver your complaints) */
15 /*****************************************************************************/
16 /* CrossFire, A Multiplayer game for X-windows */
17 /* */
18 /* Copyright (C) 2000 Mark Wedel */
19 /* Copyright (C) 1992 Frank Tore Johansen */
20 /* */
21 /* This program is free software; you can redistribute it and/or modify */
22 /* it under the terms of the GNU General Public License as published by */
23 /* the Free Software Foundation; either version 2 of the License, or */
24 /* (at your option) any later version. */
25 /* */
26 /* This program is distributed in the hope that it will be useful, */
27 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
28 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
29 /* GNU General Public License for more details. */
30 /* */
31 /* You should have received a copy of the GNU General Public License */
32 /* along with this program; if not, write to the Free Software */
33 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
34 /* */
35 /*****************************************************************************/
36 
37 #include <assert.h>
38 #include <string.h>
39 
40 #include "plugin_common.h"
41 
56 
130 
131 #define GET_HOOK(x, y, z) { \
132  getHooks(&z, 1, y, &x); \
133  if (z != CFAPI_FUNC) { \
134  printf("unable to find hook %s!\n", y); \
135  return 0; \
136  } \
137 }
138 
139 int cf_init_plugin(f_plug_api getHooks) {
140  int z;
141 
142  GET_HOOK(cfapiSystem_strdup_local, "cfapi_system_strdup_local", z);
143  GET_HOOK(cfapiSystem_add_string, "cfapi_system_add_string", z);
144  GET_HOOK(cfapiSystem_register_global_event, "cfapi_system_register_global_event", z);
145  GET_HOOK(cfapiSystem_remove_string, "cfapi_system_remove_string", z);
146  GET_HOOK(cfapiSystem_directory, "cfapi_system_directory", z);
147  GET_HOOK(cfapiSystem_unregister_global_event, "cfapi_system_unregister_global_event", z);
148  GET_HOOK(cfapiSystem_find_animation, "cfapi_system_find_animation", z);
149  GET_HOOK(cfapiSystem_find_face, "cfapi_system_find_face", z);
150  GET_HOOK(cfapiSystem_re_cmp, "cfapi_system_re_cmp", z);
151  GET_HOOK(cfapiObject_get_property, "cfapi_object_get_property", z);
152  GET_HOOK(cfapiObject_set_property, "cfapi_object_set_property", z);
153  GET_HOOK(cfapiObject_apply, "cfapi_object_apply", z);
154  GET_HOOK(cfapiObject_identify, "cfapi_object_identify", z);
155  GET_HOOK(cfapiObject_describe, "cfapi_object_describe", z);
156  GET_HOOK(cfapiObject_drain, "cfapi_object_drain", z);
157  GET_HOOK(cfapiObject_fix, "cfapi_object_fix", z);
158  GET_HOOK(cfapiObject_give_skill, "cfapi_object_give_skill", z);
159  GET_HOOK(cfapiObject_transmute, "cfapi_object_transmute", z);
160  GET_HOOK(cfapiObject_remove, "cfapi_object_remove", z);
161  GET_HOOK(cfapiObject_delete, "cfapi_object_delete", z);
162  GET_HOOK(cfapiObject_clone, "cfapi_object_clone", z);
163  GET_HOOK(cfapiObject_create, "cfapi_object_create", z);
164  GET_HOOK(cfapiObject_insert, "cfapi_object_insert", z);
165  GET_HOOK(cfapiObject_split, "cfapi_object_split", z);
166  GET_HOOK(cfapiObject_merge, "cfapi_object_merge", z);
167  GET_HOOK(cfapiObject_distance, "cfapi_object_distance", z);
168  GET_HOOK(cfapiObject_update, "cfapi_object_update", z);
169  GET_HOOK(cfapiObject_clear, "cfapi_object_clear", z);
170  GET_HOOK(cfapiObject_reset, "cfapi_object_reset", z);
171  GET_HOOK(cfapiObject_activate_rune, "cfapi_object_spring_trap", z);
172  GET_HOOK(cfapiObject_check_trigger, "cfapi_object_check_trigger", z);
173  GET_HOOK(cfapiObject_query_money, "cfapi_object_query_money", z);
174  GET_HOOK(cfapiObject_cast, "cfapi_object_cast", z);
175  GET_HOOK(cfapiObject_learn_spell, "cfapi_object_learn_spell", z);
176  GET_HOOK(cfapiObject_forget_spell, "cfapi_object_forget_spell", z);
177  GET_HOOK(cfapiObject_check_spell, "cfapi_object_check_spell", z);
178  GET_HOOK(cfapiObject_pay_amount, "cfapi_object_pay_amount", z);
179  GET_HOOK(cfapiObject_pay_item, "cfapi_object_pay_item", z);
180  GET_HOOK(cfapiObject_transfer, "cfapi_object_transfer", z);
181  GET_HOOK(cfapiObject_find_archetype_inside, "cfapi_object_find_archetype_inside", z);
182  GET_HOOK(cfapiObject_remove, "cfapi_object_remove", z);
183  GET_HOOK(cfapiObject_delete, "cfapi_object_delete", z);
184  GET_HOOK(cfapiObject_out_of_map, "cfapi_map_out_of_map", z);
185  GET_HOOK(cfapiObject_drop, "cfapi_object_drop", z);
186  GET_HOOK(cfapiObject_change_abil, "cfapi_object_change_abil", z);
187  GET_HOOK(cfapiObject_say, "cfapi_object_say", z);
188  GET_HOOK(cfapiMap_create_path, "cfapi_map_create_path", z);
189  GET_HOOK(cfapiMap_get_property, "cfapi_map_get_property", z);
190  GET_HOOK(cfapiMap_set_property, "cfapi_map_set_property", z);
191  GET_HOOK(cfapiMap_get_map, "cfapi_map_get_map", z);
192  GET_HOOK(cfapiMap_message, "cfapi_map_message", z);
193  GET_HOOK(cfapiMap_get_object_at, "cfapi_map_get_object_at", z);
194  GET_HOOK(cfapiMap_find_by_archetype_name, "cfapi_map_find_by_archetype_name", z);
195  GET_HOOK(cfapiMap_change_light, "cfapi_map_change_light", z);
196  GET_HOOK(cfapiMap_has_been_loaded, "cfapi_map_has_been_loaded", z);
197  GET_HOOK(cfapiMap_trigger_connected, "cfapi_map_trigger_connected", z);
198  GET_HOOK(cfapiPlayer_find, "cfapi_player_find", z);
199  GET_HOOK(cfapiPlayer_message, "cfapi_player_message", z);
200  GET_HOOK(cfapiObject_teleport, "cfapi_object_teleport", z);
201  GET_HOOK(cfapiObject_pickup, "cfapi_object_pickup", z);
202  GET_HOOK(cfapiObject_get_key, "cfapi_object_get_key", z);
203  GET_HOOK(cfapiObject_set_key, "cfapi_object_set_key", z);
204  GET_HOOK(cfapiObject_move, "cfapi_object_move", z);
205  GET_HOOK(cfapiObject_apply_below, "cfapi_object_apply_below", z);
206  GET_HOOK(cfapiArchetype_get_property, "cfapi_archetype_get_property", z);
207  GET_HOOK(cfapiParty_get_property, "cfapi_party_get_property", z);
208  GET_HOOK(cfapiRegion_get_property, "cfapi_region_get_property", z);
209  GET_HOOK(cfapiPlayer_can_pay, "cfapi_player_can_pay", z);
210  GET_HOOK(cfapiSystem_log, "cfapi_log", z);
211  GET_HOOK(cfapiSystem_get_time, "cfapi_system_get_time", z);
212  GET_HOOK(cfapiSystem_timer_create, "cfapi_system_timer_create", z);
213  GET_HOOK(cfapiSystem_timer_destroy, "cfapi_system_timer_destroy", z);
214  GET_HOOK(cfapiFriendlylist_get_next, "cfapi_friendlylist_get_next", z);
215  GET_HOOK(cfapiSet_random_map_variable, "cfapi_set_random_map_variable", z);
216  GET_HOOK(cfapiGenerate_random_map, "cfapi_generate_random_map", z);
217  GET_HOOK(cfapiObject_change_exp, "cfapi_object_change_exp", z);
218  GET_HOOK(cfapiSystem_get_season_name, "cfapi_system_get_season_name", z);
219  GET_HOOK(cfapiSystem_get_month_name, "cfapi_system_get_month_name", z);
220  GET_HOOK(cfapiSystem_get_weekday_name, "cfapi_system_get_weekday_name", z);
221  GET_HOOK(cfapiSystem_get_periodofday_name, "cfapi_system_get_periodofday_name", z);
222  GET_HOOK(cfapiObject_user_event, "cfapi_object_user_event", z);
223  GET_HOOK(cfapiSystem_find_string, "cfapi_system_find_string", z);
224  GET_HOOK(cfapiCost_string_from_value, "cfapi_cost_string_from_value", z);
225  GET_HOOK(cfapiPlayer_quest, "cfapi_player_quest", z);
226  GET_HOOK(cfapiObject_remove_depletion, "cfapi_object_remove_depletion", z);
227  GET_HOOK(cfapiObject_find_by_arch_name, "cfapi_object_find_by_arch_name", z);
228  GET_HOOK(cfapiObject_find_by_name, "cfapi_object_find_by_name", z);
229  GET_HOOK(cfapiPlayer_knowledge, "cfapi_player_knowledge", z);
230  GET_HOOK(cfapiObject_perm_exp, "cfapi_object_perm_exp", z);
231  return 1;
232 }
233 
234 /* Should get replaced by tons of more explicit wrappers */
235 /*void *cf_map_get_property(mapstruct *map, int propcode) {
236  int type;
237  return cfapiMap_get_property(&type, propcode, map);
238 }*/
239 
240 int cf_map_get_int_property(mapstruct *map, int property) {
241  int type, value;
242 
243  cfapiMap_get_property(&type, map, property, &value);
244  assert(type == CFAPI_INT);
245  return value;
246 }
247 
248 int cf_object_user_event(object *op, object *activator, object *third, const char *message, int fix) {
249  int type, value;
250 
251  cfapiObject_user_event(&type, op, activator, third, message, fix, &value);
252  assert(type == CFAPI_INT);
253  return value;
254 }
255 
257  int type;
258  sstring value;
259 
260  cfapiMap_get_property(&type, map, propcode, &value);
261  assert(type == CFAPI_SSTRING);
262  return value;
263 }
264 
266  int type;
267  mapstruct *value;
268 
269  cfapiMap_get_property(&type, map, propcode, &value);
270  assert(type == CFAPI_PMAP);
271  return value;
272 }
273 
275  int type;
276  region *value;
277 
278  cfapiMap_get_property(&type, map, propcode, &value);
279  assert(type == CFAPI_PREGION);
280  return value;
281 }
282 
283 /* Should get replaced by tons of more explicit wrappers */
284 void cf_map_set_int_property(mapstruct *map, int propcode, int value) {
285  int type;
286 
287  cfapiMap_set_property(&type, map, propcode, value);
288  assert(type == CFAPI_INT);
289 }
290 
291 void cf_map_set_string_property(mapstruct *map, int propcode, const char *value) {
292  int type;
293 
294  cfapiMap_set_property(&type, map, propcode, value);
295  assert(type == CFAPI_STRING);
296 }
297 
298 /* Should get replaced by tons of more explicit wrappers */
299 int16_t cf_object_get_resistance(object *op, int rtype) {
300  int type;
301  int16_t resist;
302 
303  cfapiObject_get_property(&type, op, CFAPI_OBJECT_PROP_RESIST, rtype, &resist);
304  assert(type == CFAPI_INT16);
305  return resist;
306 }
307 void cf_object_set_resistance(object *op, int rtype, int16_t value) {
308  int type;
309 
310  cfapiObject_set_property(&type, op, CFAPI_OBJECT_PROP_RESIST, rtype, value);
311  assert(type == CFAPI_INT16);
312 }
313 
314 /* Should get replaced by tons of more explicit wrappers */
315 void cf_object_set_int_property(object *op, int propcode, int value) {
316  int type;
317 
318  cfapiObject_set_property(&type, op, propcode, value);
319  assert(type == CFAPI_INT);
320 }
321 int cf_object_get_int_property(object *op, int propcode) {
322  int type, value;
323 
324  cfapiObject_get_property(&type, op, propcode, &value);
325  assert(type == CFAPI_INT);
326  return value;
327 }
328 long cf_object_get_long_property(object *op, long propcode) {
329  int type;
330  long value;
331 
332  cfapiObject_get_property(&type, op, propcode, &value);
333  assert(type == CFAPI_LONG);
334  return value;
335 }
336 void cf_object_set_movetype_property(object *op, int propcode, MoveType value) {
337  int type;
338 
339  /* note: MoveType can't be used through va_arg, so use MoveType * */
340  cfapiObject_set_property(&type, op, propcode, &value);
341  assert(type == CFAPI_MOVETYPE);
342 }
343 MoveType cf_object_get_movetype_property(object *op, int propcode) {
344  int type;
345  MoveType value;
346 
347  cfapiObject_get_property(&type, op, propcode, &value);
348  assert(type == CFAPI_MOVETYPE);
349  return value;
350 }
351 object *cf_object_get_object_property(object *op, int propcode) {
352  int type;
353  object *value;
354 
355  cfapiObject_get_property(&type, op, propcode, &value);
356  assert(type == CFAPI_POBJECT);
357  return value;
358 }
359 mapstruct *cf_object_get_map_property(object *op, int propcode) {
360  int type;
361  mapstruct *value;
362 
363  cfapiObject_get_property(&type, op, propcode, &value);
364  assert(type == CFAPI_PMAP);
365  return value;
366 }
367 int64_t cf_object_get_int64_property(object *op, int propcode) {
368  int type;
369  int64_t value;
370 
371  cfapiObject_get_property(&type, op, propcode, &value);
372  assert(type == CFAPI_SINT64);
373  return value;
374 }
375 /* Should get replaced by tons of more explicit wrappers */
376 void cf_object_set_long_property(object *op, int propcode, long value) {
377  int type;
378 
379  cfapiObject_set_property(&type, op, propcode, value);
380  assert(type == CFAPI_LONG);
381 }
382 void cf_object_set_float_property(object *op, int propcode, float value) {
383  int type;
384 
385  cfapiObject_set_property(&type, op, propcode, value);
386  assert(type == CFAPI_FLOAT);
387 }
388 void cf_object_set_int64_property(object *op, int propcode, int64_t value) {
389  int type;
390 
391  cfapiObject_set_property(&type, op, propcode, value);
392  assert(type == CFAPI_SINT64);
393 }
394 float cf_object_get_float_property(object *op, int propcode) {
395  int type;
396  float value;
397 
398  cfapiObject_get_property(&type, op, propcode, &value);
399  assert(type == CFAPI_FLOAT);
400  return value;
401 }
402 archetype *cf_object_get_archetype_property(object *op, int propcode) {
403  int type;
404  archetype *value;
405 
406  cfapiObject_get_property(&type, op, propcode, &value);
407  assert(type == CFAPI_PARCH);
408  return value;
409 }
410 partylist *cf_object_get_partylist_property(object *op, int propcode) {
411  int type;
412  partylist *value;
413 
414  cfapiObject_get_property(&type, op, propcode, &value);
415  assert(type == CFAPI_PPARTY);
416  return value;
417 }
418 double cf_object_get_double_property(object *op, int propcode) {
419  int type;
420  double value;
421 
422  cfapiObject_get_property(&type, op, propcode, &value);
423  assert(type == CFAPI_DOUBLE);
424  return value;
425 }
426 sstring cf_object_get_sstring_property(object *op, int propcode) {
427  int type;
428  sstring value;
429 
430  cfapiObject_get_property(&type, op, propcode, &value);
431  assert(type == CFAPI_SSTRING);
432  return value;
433 }
434 char *cf_object_get_string_property(object *op, int propcode, char *buf, int size) {
435  int type;
436 
437  cfapiObject_get_property(&type, op, propcode, buf, size);
438  assert(type == CFAPI_STRING);
439  return buf;
440 }
441 /* Should get replaced by tons of more explicit wrappers */
442 void cf_object_set_string_property(object *op, int propcode, const char *value) {
443  int type;
444 
445  /* use cf_object_set_face() for changing the face! */
446  assert(propcode != CFAPI_OBJECT_PROP_FACE);
447  /* use cf_object_set_animation() to change the animation */
448  assert(propcode != CFAPI_OBJECT_PROP_ANIMATION);
449 
450  cfapiObject_set_property(&type, op, propcode, value);
451  assert(type == CFAPI_STRING);
452 }
453 
460 int cf_object_set_face(object *op, const char *face) {
461  int type, ret;
462  cfapiObject_set_property(&type, op, CFAPI_OBJECT_PROP_FACE, face, &ret);
463  assert(type == CFAPI_INT);
464  return ret;
465 }
472 int cf_object_set_animation(object *op, const char *animation) {
473  int type, ret;
474  cfapiObject_set_property(&type, op, CFAPI_OBJECT_PROP_ANIMATION, animation, &ret);
475  assert(type == CFAPI_INT);
476  return ret;
477 }
478 
479 void cf_object_set_object_property(object *op, int propcode, object *value) {
480  int type;
481 
482  cfapiObject_set_property(&type, op, propcode, value);
483  assert(type == CFAPI_POBJECT);
484 }
485 
490 void cf_object_change_exp(object *op, int64_t exp, const char *skill_name, int flag) {
491  int type;
492 
493  cfapiObject_change_exp(&type, op, exp, skill_name && strlen(skill_name) > 0 ? skill_name : NULL, flag);
494  assert(type == CFAPI_NONE);
495 }
496 
502  int type, ret;
503 
504  cfapiObject_perm_exp(&type, op, &ret);
505  assert(type == CFAPI_SINT64);
506  return ret;
507 }
508 
509 int cf_player_move(player *pl, int dir) {
510  int type, ret;
511 
512  cfapiObject_move(&type, 1, pl, dir, &ret);
513  assert(type == CFAPI_INT);
514  return ret;
515 }
516 int cf_object_move(object *op, int dir, object*originator) {
517  int type, ret;
518 
519  cfapiObject_move(&type, 0, op, dir, originator, &ret);
520  assert(type == CFAPI_INT);
521  return ret;
522 }
527 int cf_object_apply(object *op, object *tmp, int aflag) {
528  int type, ret;
529 
530  cfapiObject_apply(&type, op, tmp, aflag, &ret);
531  return ret;
532 }
533 
538 void cf_object_apply_below(object *pl) {
539  int type;
540 
541  cfapiObject_apply_below(&type, pl);
542 }
547 void cf_object_remove(object *op) {
548  int type;
549 
550  cfapiObject_remove(&type, op);
551 }
557  int type;
558 
559  cfapiObject_delete(&type, ob);
560 }
564 object *cf_object_present_archname_inside(object *op, char *whatstr) {
565  int type;
566  object *value;
567 
568  cfapiObject_find_archetype_inside(&type, op, whatstr, &value);
569  assert(type == CFAPI_POBJECT);
570  return value;
571 }
572 
577 object *cf_object_find_by_arch_name(const object *who, const char *name) {
578  int type;
579  object *result;
580 
581  cfapiObject_find_by_arch_name(&type, who, name, &result);
582  assert(type == CFAPI_POBJECT);
583  return result;
584 }
585 
590 object *cf_object_find_by_name(const object *who, const char *name) {
591  int type;
592  object *result;
593 
594  cfapiObject_find_by_name(&type, who, name, &result);
595  assert(type == CFAPI_POBJECT);
596  return result;
597 }
598 
603 int cf_object_transfer(object *op, int x, int y, int randomly, object *originator) {
604  int type, value;
605 
606  cfapiObject_transfer(&type, op, 0, x, y, randomly, originator, &value);
607  assert(type == CFAPI_INT);
608  return value;
609 }
610 
615 int cf_object_move_to(object *op, int x, int y) {
616  int type, value;
617 
618  cfapiObject_transfer(&type, op, 2, x, y, &value);
619  assert(type == CFAPI_INT);
620  return value;
621 }
622 
627 object *cf_object_change_map(object *op, mapstruct *m, object *originator, int flag, int x, int y) {
628  int type;
629  object *value;
630 
631  cfapiObject_transfer(&type, op, 1, m, originator, flag, x, y, &value);
632  assert(type == CFAPI_POBJECT);
633  return value;
634 }
635 
640 object *cf_map_get_object_at(mapstruct *m, int x, int y) {
641  int type;
642  object *value;
643 
644  cfapiMap_get_object_at(&type, m, x, y, &value);
645  assert(type == CFAPI_POBJECT);
646  return value;
647 }
652 void cf_map_message(mapstruct *m, const char *msg, int color) {
653  int type;
654 
655  cfapiMap_message(&type, m, msg, color);
656 }
657 
668 object *cf_object_clone(object *op, int clonetype) {
669  int type;
670  object *value;
671 
672  cfapiObject_clone(&type, op, clonetype, &value);
673  assert(type == CFAPI_POBJECT);
674  return value;
675 }
676 
677 
682 object *cf_object_split(object *orig_ob, uint32_t nr, char *err, size_t size) {
683  int type;
684  object *value;
685 
686  cfapiObject_split(&type, orig_ob, nr, err, size, &value);
687 
688  if (value == NULL)
689  {
690  assert(type == CFAPI_NONE);
691  }
692  else
693  {
694  assert(type == CFAPI_POBJECT);
695  }
696 
697  return value;
698 }
699 
700 
705 int cf_object_pay_item(object *op, object *pl) {
706  int type, value;
707 
708  cfapiObject_pay_item(&type, op, pl, &value);
709  assert(type == CFAPI_INT);
710  return value;
711 }
712 
717 int cf_object_pay_amount(object *pl, uint64_t to_pay) {
718  int type, value;
719 
720  cfapiObject_pay_amount(&type, pl, to_pay, &value);
721  assert(type == CFAPI_INT);
722  return value;
723 }
724 
729 int cf_object_cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg) {
730  int type, value;
731 
732  cfapiObject_cast(&type, op, caster, dir, spell_ob, stringarg, &value);
733  assert(type == CFAPI_INT);
734  return value;
735 }
736 
741 void cf_object_learn_spell(object *op, object *spell, int special_prayer) {
742  int type;
743 
744  cfapiObject_learn_spell(&type, op, spell, special_prayer);
745  assert(type == CFAPI_NONE);
746 }
747 
753 void cf_object_forget_spell(object *op, object *sp) {
754  int type;
755 
756  cfapiObject_forget_spell(&type, op, sp);
757 }
758 
763 object *cf_object_check_for_spell(object *op, const char *name) {
764  int type;
765  object *value;
766 
767  cfapiObject_check_spell(&type, op, name, &value);
768  assert(type == CFAPI_POBJECT);
769  return value;
770 }
771 
772 void cf_player_message(object *op, char *txt, int flags) {
773  int type;
774 
775  cfapiPlayer_message(&type, flags, 0, op, txt);
776  assert(type == CFAPI_NONE);
777 }
778 
783 int cf_object_remove_depletion(object *op, int level) {
784  int type, result;
785 
786  cfapiObject_remove_depletion(&type, op, level, &result);
787  assert(type == CFAPI_INT);
788  return result;
789 }
790 
797 object *cf_identify(object *op) {
798  int type;
799  object *result;
800 
801  cfapiObject_identify(&type, op, &result);
802  assert(type == CFAPI_POBJECT);
803  return result;
804 }
805 
810 player *cf_player_find(const char *plname) {
811  int type;
812  player *value;
813 
814  cfapiPlayer_find(&type, plname, &value);
815  assert(type == CFAPI_PPLAYER);
816  return value;
817 }
818 
819 char *cf_player_get_title(object *op, char *title, int size) {
820  int type;
821 
822  cfapiObject_get_property(&type, op, CFAPI_PLAYER_PROP_TITLE, title, size);
823  assert(type == CFAPI_STRING);
824  return title;
825 }
826 
827 void cf_player_set_title(object *op, const char *title) {
828  int type;
829 
831 }
832 
834  int type;
835  sstring value;
836 
838  assert(type == CFAPI_SSTRING);
839  return value;
840 }
841 
842 object *cf_player_get_marked_item(object *op) {
843  int type;
844  object *value;
845 
847  assert(type == CFAPI_POBJECT);
848  return value;
849 }
850 
851 void cf_player_set_marked_item(object *op, object *ob) {
852  int type;
853 
855 }
856 
859 }
860 
861 void cf_player_set_party(object *op, partylist *party) {
862  int type;
863 
865 }
866 
871 int cf_player_can_pay(object *pl) {
872  int type, value;
873 
874  cfapiPlayer_can_pay(&type, pl, &value);
875  assert(type == CFAPI_INT);
876  return value;
877 }
878 
885 int cf_player_knowledge_has(object *op, const char *knowledge) {
886  int type, value;
887 
888  cfapiPlayer_knowledge(&type, 1, op, knowledge, &value);
889  assert(type == CFAPI_INT);
890  return value;
891 }
892 
898 void cf_player_knowledge_give(object *op, const char *knowledge) {
899  int type;
900 
901  cfapiPlayer_knowledge(&type, 2, op, knowledge);
902  assert(type == CFAPI_NONE);
903 }
904 
909 int cf_player_arrest(object *who) {
910  int type, value;
911  cfapiObject_move(&type, 2, who, &value);
912  assert(type == CFAPI_INT);
913  return value;
914 }
915 
920 mapstruct *cf_map_get_map(const char *name, int flags) {
921  int type;
922  mapstruct *ret;
923 
924  cfapiMap_get_map(&type, 1, name, flags, &ret);
925  assert(type == CFAPI_PMAP);
926  return ret;
927 }
928 
933 mapstruct *cf_get_empty_map(int sizex, int sizey) {
934  int type;
935  mapstruct *ret;
936 
937  cfapiMap_get_map(&type, 0, sizex, sizey, &ret);
938  assert(type == CFAPI_PMAP);
939  return ret;
940 }
941 
946 mapstruct *cf_map_has_been_loaded(const char *name) {
947  int type;
948  mapstruct *ret;
949 
950  cfapiMap_has_been_loaded(&type, name, &ret);
951  assert(type == CFAPI_PMAP);
952  return ret;
953 }
954 
962 }
963 
968 int cf_object_query_money(const object *op) {
969  int type, value;
970 
971  cfapiObject_query_money(&type, op, &value);
972  assert(type == CFAPI_INT);
973  return value;
974 }
975 
979 void cf_cost_string_from_value(uint64_t cost, int largest_coin, char *buffer, int length) {
980  int type;
981 
982  cfapiCost_string_from_value(&type, cost, largest_coin, buffer, length);
983  assert(type == CFAPI_NONE);
984 }
985 
990 void cf_spring_trap(object *trap, object *victim) {
991  int type;
992 
993  if (trap)
994  cfapiObject_activate_rune(&type, trap, victim);
995 }
996 
1001 int cf_object_check_trigger(object *op, object *cause) {
1002  int type, value;
1003 
1004  cfapiObject_check_trigger(&type, op, cause, &value);
1005  assert(type == CFAPI_INT);
1006  return value;
1007 }
1008 
1013 void cf_map_trigger_connected(objectlink *ol, object *cause, int state) {
1014  int type;
1015 
1016  cfapiMap_trigger_connected(&type, ol, cause, state);
1017  assert(type == CFAPI_NONE);
1018 }
1019 
1020 int cf_object_out_of_map(object *op, int x, int y) {
1021  int type, value;
1022 
1023  cfapiObject_out_of_map(&type, op->map, x, y, &value);
1024  assert(type == CFAPI_INT);
1025  return value;
1026 }
1027 
1028 void cf_object_drop(object *op, object *author) {
1029  int type;
1030 
1031  cfapiObject_drop(&type, op, author);
1032 }
1033 
1034 void cf_object_say(object *op, char *msg) {
1035  int type, value;
1036 
1037  cfapiObject_say(&type, op, msg, &value);
1038  assert(type == CFAPI_INT);
1039 }
1040 
1041 object *cf_object_insert_object(object *op, object *container) {
1042  int type;
1043  object *value;
1044 
1045  cfapiObject_insert(&type, op, 3, container, &value);
1046  assert(type == CFAPI_POBJECT);
1047  return value;
1048 }
1049 
1054 char *cf_get_maps_directory(const char *name, char *buf, int size) {
1055  int type;
1056 
1057  cfapiMap_create_path(&type, 0, name, buf, size);
1058  assert(type == CFAPI_STRING);
1059  return buf;
1060 }
1061 
1066 object *cf_create_object(void) {
1067  int type;
1068  object *value;
1069 
1070  cfapiObject_create(&type, 0, &value);
1071  assert(type == CFAPI_POBJECT);
1072  return value;
1073 }
1074 
1078 object *cf_create_object_by_name(const char *name) {
1079  int type;
1080  object *value;
1081 
1082  cfapiObject_create(&type, 1, name, &value);
1083  assert(type == CFAPI_POBJECT);
1084  return value;
1085 }
1086 
1087 void cf_system_register_global_event(int event, const char *name, f_plug_event hook) {
1088  int type;
1089 
1090  cfapiSystem_register_global_event(&type, event, name, hook);
1091  assert(type == CFAPI_NONE);
1092 }
1093 
1094 void cf_system_unregister_global_event(int event, const char *name) {
1095  int type;
1096 
1097  cfapiSystem_unregister_global_event(&type, event, name);
1098  assert(type == CFAPI_NONE);
1099 }
1100 
1115 const char *cf_get_directory(int id) {
1116  int type;
1117  const char *ret;
1118 
1119  cfapiSystem_directory(&type, id, &ret);
1120  assert(type == CFAPI_STRING);
1121  return ret;
1122 }
1123 
1128 const char *cf_re_cmp(const char *str, const char *regexp) {
1129  int type;
1130  const char *result;
1131 
1132  cfapiSystem_re_cmp(&type, str, regexp, &result);
1133  assert(type == CFAPI_STRING);
1134  return result;
1135 }
1136 
1141 void cf_fix_object(object *op) {
1142  int type;
1143 
1144  if (op)
1145  cfapiObject_fix(&type, op);
1146 }
1147 
1152 sstring cf_add_string(const char *str) {
1153  int type;
1154  sstring ret;
1155 
1156  if (!str)
1157  return NULL;
1158  cfapiSystem_add_string(&type, str, &ret);
1159  assert(type == CFAPI_SSTRING);
1160  return ret;
1161 }
1162 
1168  int type;
1169 
1170  if (str)
1171  cfapiSystem_remove_string(&type, str);
1172 }
1173 
1174 sstring cf_find_string(const char *str) {
1175  int type;
1176  sstring ret;
1177 
1178  if (!str)
1179  return NULL;
1180 
1181  cfapiSystem_find_string(&type, str, &ret);
1182  assert(type == CFAPI_SSTRING);
1183  return ret;
1184 }
1185 
1186 char *cf_query_name(object *ob, char *name, int size) {
1187  int type;
1188 
1189  cfapiObject_get_property(&type, ob, CFAPI_OBJECT_PROP_NAME, name, size);
1190  assert(type == CFAPI_STRING);
1191  return name;
1192 }
1193 
1195  int type;
1196  sstring value;
1197 
1199  assert(type == CFAPI_SSTRING);
1200  return value;
1201 }
1202 
1203 char *cf_query_base_name(object *ob, int plural, char *name, int size) {
1204  int type;
1205 
1206  cfapiObject_get_property(&type, ob, CFAPI_OBJECT_PROP_BASE_NAME, name, size);
1207  assert(type == CFAPI_STRING);
1208  return name;
1209 }
1210 
1212  int type;
1213  sstring value;
1214 
1216  assert(type == CFAPI_SSTRING);
1217  return value;
1218 }
1219 
1220 void cf_object_set_weight(object *ob, int weight) {
1221  int type;
1222 
1224  assert(type == CFAPI_INT);
1225 }
1226 
1227 void cf_object_set_weight_limit(object *ob, int weight_limit) {
1228  int type;
1229 
1230  cfapiObject_set_property(&type, ob, CFAPI_OBJECT_PROP_WEIGHT_LIMIT, weight_limit);
1231  assert(type == CFAPI_INT);
1232 }
1233 
1234 int cf_object_get_weight(object *ob) {
1235  int type, weight;
1236 
1238  assert(type == CFAPI_INT);
1239  return weight;
1240 }
1241 
1243  int type, limit;
1244 
1246  assert(type == CFAPI_INT);
1247  return limit;
1248 }
1249 
1253 int cf_object_set_nrof(object *ob, int nrof) {
1254  int type;
1255 
1256  if (nrof < 0)
1257  return -1;
1258 
1260  return 0;
1261 }
1262 
1263 int cf_object_get_nrof(object *ob) {
1264  int type, nrof;
1265 
1267  return nrof;
1268 }
1269 
1270 int cf_object_get_flag(object *ob, int flag) {
1271  int type;
1272  int rv;
1273 
1274  cfapiObject_get_property(&type, ob, CFAPI_OBJECT_PROP_FLAGS, flag, &rv);
1275  if (rv != 0)
1276  return 1;
1277  else
1278  return 0;
1279 }
1280 
1281 void cf_object_set_flag(object *ob, int flag, int value) {
1282  int type;
1283 
1284  cfapiObject_set_property(&type, ob, CFAPI_OBJECT_PROP_FLAGS, flag, value ? 1 : 0);
1285 }
1286 
1291 object *cf_object_insert_in_ob(object *op, object *where) {
1292  int type;
1293  object *value;
1294 
1295  if (!cf_object_get_flag(op, FLAG_REMOVED)) {
1296  cfapiObject_remove(&type, op);
1297  }
1298 
1299  cfapiObject_insert(&type, op, 3, where, &value);
1300  assert(type == CFAPI_POBJECT);
1301  return value;
1302 }
1303 
1308 object *cf_map_insert_object_there(object *op, mapstruct *m, object *originator, int flag) {
1309  int type;
1310  object *value;
1311 
1312  cfapiObject_insert(&type, op, 1, m, originator, flag, &value);
1313  assert(type == CFAPI_POBJECT);
1314  return value;
1315 }
1316 
1322 object *cf_map_insert_object(mapstruct *where, object *op, int x, int y) {
1323  int type;
1324  object *value;
1325 
1326  cfapiObject_insert(&type, op, 0, where, NULL, 0 , x, y, &value);
1327  assert(type == CFAPI_POBJECT);
1328  return value;
1329 }
1330 
1344 object *cf_map_insert_object_around(mapstruct *where, object *op, int x, int y) {
1345  int type;
1346  object *value;
1347 
1348  cfapiObject_insert(&type, op, 2, where, NULL, 0 , x, y, &value);
1349  assert(type == CFAPI_POBJECT);
1350  return value;
1351 }
1352 
1353 int cf_object_teleport(object *op, mapstruct *map, int x, int y) {
1354  int type, value;
1355 
1356  cfapiObject_teleport(&type, op, map, x, y, &value);
1357  assert(type == CFAPI_INT);
1358  return value;
1359 }
1360 
1364 object *cf_map_find_by_archetype_name(const char *str, mapstruct *map, int nx, int ny) {
1365  int type;
1366  object *value;
1367 
1368  cfapiMap_find_by_archetype_name(&type, str, map, nx, ny, &value);
1369  assert(type == CFAPI_POBJECT);
1370  return value;
1371 }
1372 
1375 }
1376 
1379 }
1380 
1383 }
1384 
1387 }
1388 
1391 }
1392 
1395 }
1396 
1399 }
1400 
1403 }
1404 
1407 }
1408 
1413 int cf_map_change_light(mapstruct *m, int change) {
1414  int type, value;
1415 
1416  cfapiMap_change_light(&type, m, change, &value);
1417  assert(type == CFAPI_INT);
1418  return value;
1419 }
1420 
1421 void cf_object_update(object *op, int flags) {
1422  int type;
1423 
1424  cfapiObject_update(&type, op, flags);
1425 }
1426 
1427 void cf_object_pickup(object *op, object *what) {
1428  int type;
1429 
1430  cfapiObject_pickup(&type, op, what);
1431  assert(type == CFAPI_NONE);
1432 }
1433 
1439 char *cf_strdup_local(const char *str) {
1440  int type;
1441  char *dup;
1442 
1443  if (str == NULL)
1444  return NULL;
1445  cfapiSystem_strdup_local(&type, str, &dup);
1446  assert(type == CFAPI_STRING);
1447  return dup;
1448 }
1449 
1454 int cf_map_get_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny) {
1455  int type, value;
1456 
1457  cfapiMap_get_property(&type, oldmap, CFAPI_MAP_PROP_FLAGS, newmap, x, y, nx, ny, &value);
1458  assert(type == CFAPI_INT);
1459  return value;
1460 }
1461 
1466 int cf_random_map_set_variable(RMParms *rp, const char *buf) {
1467  int type, ret;
1468 
1469  cfapiSet_random_map_variable(&type, rp, buf, &ret);
1470  assert(type == CFAPI_INT);
1471  return ret;
1472 }
1473 
1478 mapstruct *cf_random_map_generate(const char *OutFileName, RMParms *RP, char **use_layout) {
1479  int type;
1480  mapstruct *map;
1481 
1482  cfapiGenerate_random_map(&type, OutFileName, RP, use_layout, &map);
1483  assert(type == CFAPI_PMAP);
1484  return map;
1485 }
1486 
1491 int cf_find_animation(const char *name) {
1492  int type, anim;
1493 
1494  cfapiSystem_find_animation(&type, name, &anim);
1495  assert(type == CFAPI_INT);
1496  return anim;
1497 }
1498 
1503 int cf_find_face(const char *name, int error) {
1504  int type, anim;
1505 
1506  cfapiSystem_find_face(&type, name, error, &anim);
1507  assert(type == CFAPI_INT);
1508  return anim;
1509 }
1510 
1515 void cf_log(LogLevel logLevel, const char *format, ...) {
1516  int type;
1517  /* Copied from common/logger.c */
1518  char buf[20480]; /* This needs to be really really big - larger than any other buffer, since that buffer may
1519  need to be put in this one. */
1520  va_list ap;
1521 
1522  va_start(ap, format);
1523  buf[0] = '\0';
1524  vsprintf(buf, format, ap);
1525  va_end(ap);
1526 
1527  cfapiSystem_log(&type, logLevel, buf);
1528  assert(type == CFAPI_NONE);
1529 }
1530 
1535 void cf_log_plain(LogLevel logLevel, const char *message) {
1536  int type;
1537 
1538  cfapiSystem_log(&type, logLevel, message);
1539  assert(type == CFAPI_NONE);
1540 }
1541 
1543  int type;
1544 
1545  cfapiSystem_get_time(&type, tod);
1546  assert(type == CFAPI_NONE);
1547 }
1548 
1549 const char *cf_get_season_name(int index) {
1550  int type;
1551  char *result;
1552 
1553  cfapiSystem_get_season_name(&type, index, &result);
1554  assert(type == CFAPI_STRING);
1555  return result;
1556 }
1557 
1558 const char *cf_get_month_name(int index) {
1559  int type;
1560  char *result;
1561 
1562  cfapiSystem_get_month_name(&type, index, &result);
1563  assert(type == CFAPI_STRING);
1564  return result;
1565 }
1566 
1567 const char *cf_get_weekday_name(int index) {
1568  int type;
1569  char *result;
1570 
1571  cfapiSystem_get_weekday_name(&type, index, &result);
1572  assert(type == CFAPI_STRING);
1573  return result;
1574 }
1575 
1576 const char *cf_get_periodofday_name(int index) {
1577  int type;
1578  char *result;
1579 
1580  cfapiSystem_get_periodofday_name(&type, index, &result);
1581  assert(type == CFAPI_STRING);
1582  return result;
1583 }
1584 
1597 int cf_timer_create(object *ob, long delay, int mode) {
1598  int type, timer;
1599 
1600  cfapiSystem_timer_create(&type, ob, delay, mode, &timer);
1601  assert(type == CFAPI_INT);
1602  return timer;
1603 }
1604 
1613 int cf_timer_destroy(int id) {
1614  int type, code;
1615 
1616  cfapiSystem_timer_destroy(&type, id, &code);
1617  assert(type == CFAPI_INT);
1618  return code;
1619 }
1620 
1630 const char *cf_object_get_key(object *op, const char *keyname) {
1631  int type;
1632  const char *value;
1633 
1634  cfapiObject_get_key(&type, op, keyname, &value);
1635  assert(type == CFAPI_SSTRING);
1636  return value;
1637 }
1638 
1652 int cf_object_set_key(object *op, const char *keyname, const char *value, int add_key) {
1653  int type, ret;
1654 
1655  cfapiObject_set_key(&type, op, keyname, value, add_key, &ret);
1656  assert(type == CFAPI_INT);
1657  return ret;
1658 }
1659 
1664 int cf_object_change_abil(object *op, object *tmp) {
1665  int type, ret;
1666 
1667  cfapiObject_change_abil(&type, op, tmp, &ret);
1668  assert(type == CFAPI_INT);
1669  return ret;
1670 }
1671 
1672 /* Archetype-related functions */
1673 
1680  int type;
1681  archetype *value;
1682 
1683  cfapiArchetype_get_property(&type, NULL, CFAPI_ARCH_PROP_NEXT, &value);
1684  assert(type == CFAPI_PARCH);
1685  return value;
1686 }
1687 
1696  int type;
1697  sstring name;
1698 
1700  assert(type == CFAPI_SSTRING);
1701  return name;
1702 }
1703 
1713  int type;
1714  archetype *value;
1715 
1716  cfapiArchetype_get_property(&type, arch, CFAPI_ARCH_PROP_NEXT, &value);
1717  assert(type == CFAPI_PARCH);
1718  return value;
1719 }
1720 
1729  int type;
1730  archetype *value;
1731 
1732  cfapiArchetype_get_property(&type, arch, CFAPI_ARCH_PROP_MORE, &value);
1733  assert(type == CFAPI_PARCH);
1734  return value;
1735 }
1736 
1745  int type;
1746  archetype *value;
1747 
1748  cfapiArchetype_get_property(&type, arch, CFAPI_ARCH_PROP_HEAD, &value);
1749  assert(type == CFAPI_PARCH);
1750  return value;
1751 }
1752 
1761  int type;
1762  object *value;
1763 
1764  cfapiArchetype_get_property(&type, arch, CFAPI_ARCH_PROP_CLONE, &value);
1765  assert(type == CFAPI_POBJECT);
1766  return value;
1767 }
1768 
1769 /* Party-related functions */
1770 
1777  int type;
1778  partylist *value;
1779 
1780  cfapiParty_get_property(&type, NULL, CFAPI_PARTY_PROP_NEXT, &value);
1781  assert(type == CFAPI_PPARTY);
1782  return value;
1783 }
1784 
1791 const char *cf_party_get_name(partylist *party) {
1792  int type;
1793  sstring value;
1794 
1795  cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_NAME, &value);
1796  assert(type == CFAPI_SSTRING);
1797  return value;
1798 }
1799 
1808  int type;
1809  partylist *value;
1810 
1811  cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_NEXT, &value);
1812  assert(type == CFAPI_PPARTY);
1813  return value;
1814 }
1815 
1823 const char *cf_party_get_password(partylist *party) {
1824  int type;
1825  sstring value;
1826 
1827  cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_PASSWORD, &value);
1828  assert(type == CFAPI_SSTRING);
1829  return value;
1830 }
1831 
1840  int type;
1841  player *value;
1842 
1843  cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_PLAYER, NULL, &value);
1844  assert(type == CFAPI_PPLAYER);
1845  return value;
1846 }
1847 
1858  int type;
1859  player *value;
1860 
1861  cfapiParty_get_property(&type, party, CFAPI_PARTY_PROP_PLAYER, op, &value);
1862  assert(type == CFAPI_PPLAYER);
1863  return value;
1864 }
1865 
1872  int type;
1873  region *value;
1874 
1875  cfapiRegion_get_property(&type, NULL, CFAPI_REGION_PROP_NEXT, &value);
1876  assert(type == CFAPI_PREGION);
1877  return value;
1878 }
1879 
1887 const char *cf_region_get_name(region *reg) {
1888  int type;
1889  sstring value;
1890 
1891  cfapiRegion_get_property(&type, reg, CFAPI_REGION_PROP_NAME, &value);
1892  assert(type == CFAPI_SSTRING);
1893  return value;
1894 }
1895 
1904  int type;
1905  region *value;
1906 
1907  cfapiRegion_get_property(&type, reg, CFAPI_REGION_PROP_NEXT, &value);
1908  assert(type == CFAPI_PREGION);
1909  return value;
1910 }
1911 
1920  int type;
1921  region *value;
1922 
1924  assert(type == CFAPI_PREGION);
1925  return value;
1926 }
1927 
1935 const char *cf_region_get_longname(region *reg) {
1936  int type;
1937  sstring value;
1938 
1940  assert(type == CFAPI_SSTRING);
1941  return value;
1942 }
1943 
1951 const char *cf_region_get_message(region *reg) {
1952  int type;
1953  sstring value;
1954 
1956  assert(type == CFAPI_SSTRING);
1957  return value;
1958 }
1959 
1968  int type, value;
1969 
1971  assert(type == CFAPI_INT);
1972  return value;
1973 }
1974 
1983  int type, value;
1984 
1986  assert(type == CFAPI_INT);
1987  return value;
1988 }
1989 
1997 const char *cf_region_get_jail_path(region *reg) {
1998  int type;
1999  sstring value;
2000 
2002  assert(type == CFAPI_SSTRING);
2003  return value;
2004 }
2005 
2006 /* Friendlylist functions. */
2007 
2014  int type;
2015  object *value;
2016 
2017  cfapiFriendlylist_get_next(&type, NULL, &value);
2018  assert(type == CFAPI_POBJECT);
2019  return value;
2020 }
2021 
2029 object *cf_friendlylist_get_next(object *ob) {
2030  int type;
2031  object *value;
2032 
2033  cfapiFriendlylist_get_next(&type, ob, &value);
2034  assert(type == CFAPI_POBJECT);
2035  return value;
2036 }
2037 
2038 /* Quest-related functions */
2039 
2044 int cf_quest_get_player_state(object *pl, sstring quest_code) {
2045  int type, ret;
2046 
2047  cfapiPlayer_quest(&type, CFAPI_PLAYER_QUEST_GET_STATE, pl, quest_code, &ret);
2048  assert(type == CFAPI_INT);
2049 
2050  return ret;
2051 }
2052 
2057 void cf_quest_start(object *pl, sstring quest_code, int state) {
2058  int type;
2059 
2060  cfapiPlayer_quest(&type, CFAPI_PLAYER_QUEST_START, pl, quest_code, state);
2061  assert(type == CFAPI_NONE);
2062 }
2063 
2068 void cf_quest_set_player_state(object *pl, sstring quest_code, int state) {
2069  int type;
2070 
2071  cfapiPlayer_quest(&type, CFAPI_PLAYER_QUEST_SET_STATE, pl, quest_code, state);
2072  assert(type == CFAPI_NONE);
2073 }
2074 
2079 int cf_quest_was_completed(object *pl, sstring quest_code) {
2080  int type, ret;
2081 
2082  cfapiPlayer_quest(&type, CFAPI_PLAYER_QUEST_WAS_COMPLETED, pl, quest_code, &ret);
2083  assert(type == CFAPI_INT);
2084 
2085  return ret;
2086 }
object * cf_map_insert_object_around(mapstruct *where, object *op, int x, int y)
static f_plug_api cfapiObject_perm_exp
partylist * cf_object_get_partylist_property(object *op, int propcode)
void cf_object_update(object *op, int flags)
region * cf_region_get_parent(region *reg)
#define CFAPI_PLAYER_QUEST_GET_STATE
Definition: plugin.h:292
#define CFAPI_PARTY_PROP_PASSWORD
Definition: plugin.h:323
Definition: player.h:92
int cf_player_arrest(object *who)
object * cf_object_find_by_arch_name(const object *who, const char *name)
static f_plug_api cfapiObject_find_by_arch_name
Definition: plugin_common.c:88
#define CFAPI_OBJECT_PROP_ANIMATION
Definition: plugin.h:270
const char * cf_get_directory(int id)
#define CFAPI_OBJECT_PROP_NAME
Definition: plugin.h:182
object * cf_player_get_marked_item(object *op)
const char * cf_object_get_key(object *op, const char *keyname)
#define CFAPI_PREGION
Definition: plugin.h:118
#define CFAPI_PLAYER_PROP_TITLE
Definition: plugin.h:289
void cf_player_knowledge_give(object *op, const char *knowledge)
void cf_map_trigger_connected(objectlink *ol, object *cause, int state)
#define CFAPI_MAP_PROP_ENTER_Y
Definition: plugin.h:309
static f_plug_api cfapiSystem_register_global_event
Definition: plugin_common.c:44
Definition: object.h:444
#define CFAPI_REGION_PROP_MESSAGE
Definition: plugin.h:330
#define CFAPI_MAP_PROP_FLAGS
Definition: plugin.h:296
#define CFAPI_MAP_PROP_DARKNESS
Definition: plugin.h:305
void cf_object_free_drop_inventory(object *ob)
void cf_object_set_flag(object *ob, int flag, int value)
#define CFAPI_OBJECT_PROP_WEIGHT
Definition: plugin.h:218
static f_plug_api cfapiMap_change_light
#define CFAPI_OBJECT_PROP_FACE
Definition: plugin.h:269
static f_plug_api cfapiSystem_log
Definition: plugin_common.c:50
int cf_map_get_width(mapstruct *map)
static f_plug_api cfapiObject_pay_amount
Definition: plugin_common.c:84
static f_plug_api cfapiSystem_find_face
Definition: plugin_common.c:49
const char * cf_get_weekday_name(int index)
static f_plug_api cfapiMap_get_object_at
Definition: plugin_common.c:98
static f_plug_api cfapiObject_drain
Definition: plugin_common.c:62
#define CFAPI_MAP_PROP_DIFFICULTY
Definition: plugin.h:297
#define CFAPI_MAP_PROP_HEIGHT
Definition: plugin.h:307
void cf_spring_trap(object *trap, object *victim)
void cf_object_set_object_property(object *op, int propcode, object *value)
player * cf_party_get_first_player(partylist *party)
sstring cf_object_get_sstring_property(object *op, int propcode)
void cf_object_set_long_property(object *op, int propcode, long value)
object * cf_object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
object * cf_object_insert_object(object *op, object *container)
static f_plug_api cfapiPlayer_find
void cf_object_set_int64_property(object *op, int propcode, int64_t value)
void cf_object_say(object *op, char *msg)
static f_plug_api cfapiObject_change_exp
int64_t cf_object_perm_exp(object *op)
long cf_object_get_long_property(object *op, long propcode)
unsigned char MoveType
Definition: define.h:432
static f_plug_api cfapiObject_get_key
static f_plug_api cfapiObject_say
Definition: plugin_common.c:93
object * cf_archetype_get_clone(archetype *arch)
#define CFAPI_REGION_PROP_JAIL_X
Definition: plugin.h:331
mapstruct * cf_get_empty_map(int sizex, int sizey)
#define CFAPI_ARCH_PROP_MORE
Definition: plugin.h:318
int cf_object_set_animation(object *op, const char *animation)
#define CFAPI_INT16
Definition: plugin.h:119
int cf_player_knowledge_has(object *op, const char *knowledge)
int64_t cf_object_get_int64_property(object *op, int propcode)
object * cf_create_object_by_name(const char *name)
static f_plug_api cfapiObject_distance
Definition: plugin_common.c:73
int cf_region_get_jail_x(region *reg)
static f_plug_api cfapiObject_remove
Definition: plugin_common.c:66
void cf_object_change_exp(object *op, int64_t exp, const char *skill_name, int flag)
static f_plug_api cfapiObject_fix
Definition: plugin_common.c:63
#define CFAPI_OBJECT_PROP_FLAGS
Definition: plugin.h:248
static f_plug_api cfapiObject_check_trigger
Definition: plugin_common.c:78
int cf_map_get_enter_x(mapstruct *map)
#define CFAPI_SINT64
Definition: plugin.h:121
const char * cf_region_get_message(region *reg)
#define CFAPI_OBJECT_PROP_NAME_PLURAL
Definition: plugin.h:183
mapstruct * cf_map_has_been_loaded(const char *name)
partylist * cf_player_get_party(object *op)
static f_plug_api cfapiObject_set_key
int cf_object_check_trigger(object *op, object *cause)
mapstruct * cf_map_get_first(void)
int cf_object_set_face(object *op, const char *face)
region * cf_region_get_first(void)
#define CFAPI_OBJECT_PROP_MESSAGE
Definition: plugin.h:188
void cf_player_set_marked_item(object *op, object *ob)
void cf_object_set_weight_limit(object *ob, int weight_limit)
#define CFAPI_MAP_PROP_RESET_TIMEOUT
Definition: plugin.h:302
static f_plug_api cfapiObject_move
#define CFAPI_PLAYER_QUEST_START
Definition: plugin.h:291
#define CFAPI_DOUBLE
Definition: plugin.h:113
object * cf_map_get_object_at(mapstruct *m, int x, int y)
#define CFAPI_REGION_PROP_NEXT
Definition: plugin.h:327
void cf_player_set_party(object *op, partylist *party)
static f_plug_api cfapiSystem_get_time
Definition: plugin_common.c:51
object * cf_object_get_object_property(object *op, int propcode)
#define CFAPI_MAP_PROP_NEXT
Definition: plugin.h:311
mapstruct * cf_map_get_map_property(mapstruct *map, int propcode)
void cf_fix_object(object *op)
static f_plug_api cfapiObject_remove_depletion
static f_plug_api cfapiObject_describe
Definition: plugin_common.c:61
Definition: object.h:467
#define CFAPI_PMAP
Definition: plugin.h:111
void cf_object_set_resistance(object *op, int rtype, int16_t value)
void cf_object_set_string_property(object *op, int propcode, const char *value)
int cf_object_apply(object *op, object *tmp, int aflag)
int16_t cf_object_get_resistance(object *op, int rtype)
#define CFAPI_POBJECT
Definition: plugin.h:110
static f_plug_api cfapiObject_find_archetype_inside
Definition: plugin_common.c:87
#define CFAPI_REGION_PROP_JAIL_PATH
Definition: plugin.h:333
#define FLAG_REMOVED
Definition: define.h:232
const char * cf_party_get_password(partylist *party)
const char * cf_get_periodofday_name(int index)
static f_plug_api cfapiSystem_find_animation
Definition: plugin_common.c:48
struct titlestruct title
static f_plug_api cfapiObject_pay_item
Definition: plugin_common.c:85
int cf_object_get_int_property(object *op, int propcode)
static f_plug_api cfapiObject_merge
Definition: plugin_common.c:72
static f_plug_api cfapiRegion_get_property
#define CFAPI_NONE
Definition: plugin.h:105
static f_plug_api cfapiSystem_get_weekday_name
int cf_map_get_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
int cf_map_get_players(mapstruct *map)
void cf_map_set_string_property(mapstruct *map, int propcode, const char *value)
#define CFAPI_FLOAT
Definition: plugin.h:112
static f_plug_api cfapiSystem_timer_create
Definition: plugin_common.c:52
#define CFAPI_PARCH
Definition: plugin.h:114
static f_plug_api cfapiMap_set_property
Definition: plugin_common.c:95
void cf_object_apply_below(object *pl)
archetype * cf_archetype_get_more(archetype *arch)
int cf_random_map_set_variable(RMParms *rp, const char *buf)
#define CFAPI_MAP_PROP_PLAYERS
Definition: plugin.h:303
static f_plug_api cfapiObject_query_money
Definition: plugin_common.c:79
static f_plug_api cfapiSystem_remove_string
Definition: plugin_common.c:45
void cf_object_pickup(object *op, object *what)
static f_plug_api cfapiObject_out_of_map
Definition: plugin_common.c:90
static f_plug_api cfapiObject_give_skill
Definition: plugin_common.c:64
partylist * cf_party_get_next(partylist *party)
void cf_log(LogLevel logLevel, const char *format,...)
static f_plug_api cfapiObject_set_property
Definition: plugin_common.c:58
#define CFAPI_PLAYER_PROP_IP
Definition: plugin.h:282
region * cf_region_get_next(region *reg)
void cf_object_set_weight(object *ob, int weight)
int cf_map_change_light(mapstruct *m, int change)
int cf_map_get_reset_timeout(mapstruct *map)
#define CFAPI_PARTY_PROP_PLAYER
Definition: plugin.h:324
static f_plug_api cfapiObject_apply_below
int cf_find_animation(const char *name)
char * cf_object_get_string_property(object *op, int propcode, char *buf, int size)
#define CFAPI_STRING
Definition: plugin.h:109
sstring cf_add_string(const char *str)
signed short int16_t
Definition: win32.h:160
#define CFAPI_MAP_PROP_RESET_TIME
Definition: plugin.h:301
#define CFAPI_ARCH_PROP_HEAD
Definition: plugin.h:317
int cf_object_pay_item(object *op, object *pl)
static f_plug_api cfapiObject_clear
Definition: plugin_common.c:75
object * cf_object_check_for_spell(object *op, const char *name)
static f_plug_api cfapiObject_split
Definition: plugin_common.c:71
struct mapdef * map
Definition: object.h:297
Definition: map.h:276
const char * cf_region_get_jail_path(region *reg)
sstring cf_query_name_pl(object *ob)
static f_plug_api cfapiObject_reset
Definition: plugin_common.c:76
#define CFAPI_ARCH_PROP_NEXT
Definition: plugin.h:316
static f_plug_api cfapiObject_get_property
Definition: plugin_common.c:57
int cf_timer_destroy(int id)
object * cf_object_clone(object *op, int clonetype)
static f_plug_api cfapiObject_user_event
const char * cf_get_season_name(int index)
void cf_cost_string_from_value(uint64_t cost, int largest_coin, char *buffer, int length)
void cf_system_unregister_global_event(int event, const char *name)
int cf_timer_create(object *ob, long delay, int mode)
double cf_object_get_double_property(object *op, int propcode)
static f_plug_api cfapiArchetype_get_property
int cf_object_get_weight_limit(object *ob)
static f_plug_api cfapiMap_message
Definition: plugin_common.c:97
int cf_object_get_weight(object *ob)
int cf_object_query_money(const object *op)
int cf_object_teleport(object *op, mapstruct *map, int x, int y)
static f_plug_api cfapiObject_delete
Definition: plugin_common.c:67
#define CFAPI_OBJECT_PROP_WEIGHT_LIMIT
Definition: plugin.h:219
object * cf_identify(object *op)
#define CFAPI_PLAYER_QUEST_SET_STATE
Definition: plugin.h:293
#define CFAPI_LONG
Definition: plugin.h:107
object * cf_object_find_by_name(const object *who, const char *name)
char * cf_get_maps_directory(const char *name, char *buf, int size)
#define CFAPI_SSTRING
Definition: plugin.h:122
char * cf_query_name(object *ob, char *name, int size)
int cf_object_set_nrof(object *ob, int nrof)
int cf_object_transfer(object *op, int x, int y, int randomly, object *originator)
#define CFAPI_PPLAYER
Definition: plugin.h:116
int cf_region_get_jail_y(region *reg)
object * cf_object_insert_in_ob(object *op, object *where)
void * value
Definition: hashtable.h:12
object * cf_map_insert_object(mapstruct *where, object *op, int x, int y)
#define CFAPI_REGION_PROP_JAIL_Y
Definition: plugin.h:332
static f_plug_api cfapiSystem_timer_destroy
Definition: plugin_common.c:53
char * cf_player_get_title(object *op, char *title, int size)
int cf_map_get_reset_time(mapstruct *map)
int cf_object_set_key(object *op, const char *keyname, const char *value, int add_key)
static f_plug_api cfapiSystem_unregister_global_event
Definition: plugin_common.c:46
int cf_find_face(const char *name, int error)
static f_plug_api cfapiObject_drop
Definition: plugin_common.c:91
unsigned __int64 uint64_t
Definition: win32.h:167
static f_plug_api cfapiMap_get_property
Definition: plugin_common.c:94
void cf_player_set_title(object *op, const char *title)
#define CFAPI_REGION_PROP_LONGNAME
Definition: plugin.h:329
static f_plug_api cfapiSystem_get_periodofday_name
const char * cf_region_get_longname(region *reg)
int cf_init_plugin(f_plug_api getHooks)
static f_plug_api cfapiPlayer_can_pay
static f_plug_api cfapiSystem_re_cmp
Definition: plugin_common.c:55
#define CFAPI_PARTY_PROP_NAME
Definition: plugin.h:321
static f_plug_api cfapiObject_transmute
Definition: plugin_common.c:65
#define CFAPI_PLAYER_PROP_PARTY
Definition: plugin.h:284
LogLevel
Definition: logger.h:10
int cf_player_move(player *pl, int dir)
archetype * cf_archetype_get_next(archetype *arch)
int cf_object_remove_depletion(object *op, int level)
void cf_object_set_int_property(object *op, int propcode, int value)
player * cf_party_get_next_player(partylist *party, player *op)
int(* f_plug_event)(int *type,...)
Definition: plugin.h:132
signed __int64 int64_t
Definition: win32.h:168
static const flag_definition flags[]
sstring cf_map_get_sstring_property(mapstruct *map, int propcode)
static f_plug_api cfapiObject_find_by_name
Definition: plugin_common.c:89
static f_plug_api cfapiObject_apply
Definition: plugin_common.c:59
int cf_object_get_flag(object *ob, int flag)
static f_plug_api cfapiObject_cast
Definition: plugin_common.c:80
const char * sstring
Definition: global.h:40
void cf_object_set_movetype_property(object *op, int propcode, MoveType value)
static f_plug_api cfapiObject_insert
Definition: plugin_common.c:70
static f_plug_api cfapiParty_get_property
unsigned int uint32_t
Definition: win32.h:162
archetype * cf_archetype_get_head(archetype *arch)
static f_plug_api cfapiObject_activate_rune
Definition: plugin_common.c:77
#define CFAPI_OBJECT_PROP_BASE_NAME
Definition: plugin.h:239
#define CFAPI_REGION_PROP_PARENT
Definition: plugin.h:328
mapstruct * cf_random_map_generate(const char *OutFileName, RMParms *RP, char **use_layout)
#define CFAPI_INT
Definition: plugin.h:106
static f_plug_api cfapiObject_pickup
int cf_quest_get_player_state(object *pl, sstring quest_code)
static f_plug_api cfapiMap_get_map
Definition: plugin_common.c:96
static f_plug_api cfapiMap_has_been_loaded
#define CFAPI_ARCH_PROP_NAME
Definition: plugin.h:315
static f_plug_api cfapiMap_trigger_connected
int cf_map_get_int_property(mapstruct *map, int property)
int cf_quest_was_completed(object *pl, sstring quest_code)
object * cf_map_find_by_archetype_name(const char *str, mapstruct *map, int nx, int ny)
void cf_object_forget_spell(object *op, object *sp)
void cf_map_set_int_property(mapstruct *map, int propcode, int value)
const char * cf_region_get_name(region *reg)
static f_plug_api cfapiObject_transfer
Definition: plugin_common.c:86
float cf_object_get_float_property(object *op, int propcode)
void cf_quest_start(object *pl, sstring quest_code, int state)
static f_plug_api cfapiObject_check_spell
Definition: plugin_common.c:83
sstring cf_archetype_get_name(archetype *arch)
int cf_object_get_nrof(object *ob)
static f_plug_api cfapiObject_teleport
Definition: tod.h:34
int cf_map_get_darkness(mapstruct *map)
region * cf_map_get_region_property(mapstruct *map, int propcode)
MoveType cf_object_get_movetype_property(object *op, int propcode)
void cf_object_remove(object *op)
int cf_object_out_of_map(object *op, int x, int y)
const char * cf_party_get_name(partylist *party)
int cf_object_change_abil(object *op, object *tmp)
#define CFAPI_MOVETYPE
Definition: plugin.h:123
sstring cf_player_get_ip(object *op)
static f_plug_api cfapiCost_string_from_value
static f_plug_api cfapiObject_update
Definition: plugin_common.c:74
#define CFAPI_MAP_PROP_WIDTH
Definition: plugin.h:306
const char * cf_re_cmp(const char *str, const char *regexp)
int cf_object_move_to(object *op, int x, int y)
static f_plug_api cfapiObject_learn_spell
Definition: plugin_common.c:81
#define CFAPI_PLAYER_QUEST_WAS_COMPLETED
Definition: plugin.h:294
#define CFAPI_PARTY_PROP_NEXT
Definition: plugin.h:322
int cf_object_cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
void cf_object_drop(object *op, object *author)
object * cf_friendlylist_get_next(object *ob)
object * cf_object_present_archname_inside(object *op, char *whatstr)
void cf_get_time(timeofday_t *tod)
#define CFAPI_OBJECT_PROP_NROF
Definition: plugin.h:194
int cf_object_pay_amount(object *pl, uint64_t to_pay)
sstring cf_object_get_msg(object *ob)
static f_plug_api cfapiObject_create
Definition: plugin_common.c:69
int cf_map_get_enter_y(mapstruct *map)
#define CFAPI_ARCH_PROP_CLONE
Definition: plugin.h:319
#define GET_HOOK(x, y, z)
#define CFAPI_PLAYER_PROP_MARKED_ITEM
Definition: plugin.h:283
static f_plug_api cfapiFriendlylist_get_next
void cf_object_set_float_property(object *op, int propcode, float value)
int cf_object_user_event(object *op, object *activator, object *third, const char *message, int fix)
player * cf_player_find(const char *plname)
mapstruct * cf_object_get_map_property(object *op, int propcode)
int cf_object_move(object *op, int dir, object *originator)
mapstruct * cf_map_get_map(const char *name, int flags)
static f_plug_api cfapiSet_random_map_variable
static f_plug_api cfapiSystem_get_season_name
object * cf_map_insert_object_there(object *op, mapstruct *m, object *originator, int flag)
static f_plug_api cfapiSystem_directory
Definition: plugin_common.c:54
#define CFAPI_OBJECT_PROP_RESIST
Definition: plugin.h:200
char * cf_query_base_name(object *ob, int plural, char *name, int size)
void cf_map_message(mapstruct *m, const char *msg, int color)
sstring cf_find_string(const char *str)
static f_plug_api cfapiPlayer_quest
static f_plug_api cfapiMap_find_by_archetype_name
Definition: plugin_common.c:99
Definition: map.h:325
static f_plug_api cfapiPlayer_message
object * cf_object_change_map(object *op, mapstruct *m, object *originator, int flag, int x, int y)
archetype * cf_archetype_get_first(void)
void cf_player_message(object *op, char *txt, int flags)
static f_plug_api cfapiPlayer_knowledge
object * cf_create_object(void)
void cf_object_learn_spell(object *op, object *spell, int special_prayer)
void cf_system_register_global_event(int event, const char *name, f_plug_event hook)
archetype * cf_object_get_archetype_property(object *op, int propcode)
static f_plug_api cfapiObject_identify
Definition: plugin_common.c:60
static f_plug_api cfapiSystem_strdup_local
Definition: plugin_common.c:47
static f_plug_api cfapiObject_clone
Definition: plugin_common.c:68
static f_plug_api cfapiGenerate_random_map
void cf_log_plain(LogLevel logLevel, const char *message)
static f_plug_api cfapiSystem_get_month_name
partylist * cf_party_get_first(void)
void cf_free_string(sstring str)
static f_plug_api cfapiMap_create_path
#define CFAPI_MAP_PROP_ENTER_X
Definition: plugin.h:308
const char * cf_get_month_name(int index)
char * cf_strdup_local(const char *str)
object * cf_friendlylist_get_first(void)
void cf_quest_set_player_state(object *pl, sstring quest_code, int state)
int cf_player_can_pay(object *pl)
static f_plug_api cfapiObject_forget_spell
Definition: plugin_common.c:82
void(* f_plug_api)(int *type,...)
Definition: plugin.h:126
static f_plug_api cfapiSystem_add_string
Definition: plugin_common.c:42
static f_plug_api cfapiSystem_find_string
Definition: plugin_common.c:43
#define CFAPI_REGION_PROP_NAME
Definition: plugin.h:326
static f_plug_api cfapiObject_change_abil
Definition: plugin_common.c:92
int cf_map_get_height(mapstruct *map)
#define CFAPI_PPARTY
Definition: plugin.h:117
int cf_map_get_difficulty(mapstruct *map)