/*****************************************************************************/ /* Crossfire plugin support - (C) 2001 by Yann Chachkoff. */ /* This code is placed under the GPL. */ /*****************************************************************************/ /*****************************************************************************/ /* Headers needed. */ /*****************************************************************************/ #ifndef PLUGIN_H_ #define PLUGIN_H_ /*****************************************************************************/ /* This one does not exist under Win32. */ /*****************************************************************************/ #include #define MODULEAPI #include #include #ifdef HAVE_TIME_H #include #endif #include <../random_maps/random_map.h> #include <../random_maps/rproto.h> /*****************************************************************************/ /* This one does not exist under Win32. */ /*****************************************************************************/ #include #define NR_EVENTS 42 #include #define CFAPI_NONE 0 #define CFAPI_INT 1 #define CFAPI_LONG 2 #define CFAPI_CHAR 3 #define CFAPI_STRING 4 #define CFAPI_POBJECT 5 #define CFAPI_PMAP 6 #define CFAPI_FLOAT 7 #define CFAPI_DOUBLE 8 #define CFAPI_PARCH 9 #define CFAPI_FUNC 10 #define CFAPI_PPLAYER 11 #define CFAPI_PPARTY 12 #define CFAPI_PREGION 13 #define CFAPI_INT16 14 typedef void* (*f_plug_api) (int* type, ...); typedef int (*f_plug_postinit) (void); typedef int (*f_plug_init)(const char* iversion, f_plug_api gethooksptr); #define LIBPTRTYPE void* typedef struct _crossfire_plugin { f_plug_api eventfunc; /* Event Handler function */ f_plug_api propfunc; /* Plugin getProperty function */ f_plug_postinit closefunc; /* Plugin Termination function */ LIBPTRTYPE libptr; /* Pointer to the plugin library */ char id[MAX_BUF]; /* Plugin identification string */ char fullname[MAX_BUF]; /* Plugin full name */ f_plug_api gevent[NR_EVENTS]; /* Global events registered */ struct _crossfire_plugin *next; struct _crossfire_plugin *prev; } crossfire_plugin; extern int plugin_number; extern crossfire_plugin* plugins_list; #define plugins_dlopen(fname) dlopen(fname,RTLD_NOW|RTLD_GLOBAL) #define plugins_dlclose(lib) dlclose(lib) #define plugins_dlsym(lib,name) dlsym(lib,name) #define plugins_dlerror() dlerror() /* OBJECT-RELATED HOOKS */ #define CFAPI_OBJECT_PROP_OB_ABOVE 1 #define CFAPI_OBJECT_PROP_OB_BELOW 2 #define CFAPI_OBJECT_PROP_NEXT_ACTIVE_OB 3 #define CFAPI_OBJECT_PROP_PREV_ACTIVE_OB 4 #define CFAPI_OBJECT_PROP_INVENTORY 5 #define CFAPI_OBJECT_PROP_ENVIRONMENT 6 #define CFAPI_OBJECT_PROP_HEAD 7 #define CFAPI_OBJECT_PROP_CONTAINER 8 #define CFAPI_OBJECT_PROP_MAP 9 #define CFAPI_OBJECT_PROP_COUNT 10 #define CFAPI_OBJECT_PROP_REFCOUNT 11 #define CFAPI_OBJECT_PROP_NAME 12 #define CFAPI_OBJECT_PROP_NAME_PLURAL 13 #define CFAPI_OBJECT_PROP_TITLE 14 #define CFAPI_OBJECT_PROP_RACE 15 #define CFAPI_OBJECT_PROP_SLAYING 16 #define CFAPI_OBJECT_PROP_SKILL 17 #define CFAPI_OBJECT_PROP_MESSAGE 18 #define CFAPI_OBJECT_PROP_LORE 19 #define CFAPI_OBJECT_PROP_X 20 #define CFAPI_OBJECT_PROP_Y 21 #define CFAPI_OBJECT_PROP_SPEED 22 #define CFAPI_OBJECT_PROP_SPEED_LEFT 23 #define CFAPI_OBJECT_PROP_NROF 24 #define CFAPI_OBJECT_PROP_DIRECTION 25 #define CFAPI_OBJECT_PROP_FACING 26 #define CFAPI_OBJECT_PROP_TYPE 27 #define CFAPI_OBJECT_PROP_SUBTYPE 28 #define CFAPI_OBJECT_PROP_CLIENT_TYPE 29 #define CFAPI_OBJECT_PROP_RESIST 30 #define CFAPI_OBJECT_PROP_ATTACK_TYPE 31 #define CFAPI_OBJECT_PROP_PATH_ATTUNED 32 #define CFAPI_OBJECT_PROP_PATH_REPELLED 33 #define CFAPI_OBJECT_PROP_PATH_DENIED 34 #define CFAPI_OBJECT_PROP_MATERIAL 35 #define CFAPI_OBJECT_PROP_MATERIAL_NAME 36 #define CFAPI_OBJECT_PROP_MAGIC 37 #define CFAPI_OBJECT_PROP_VALUE 38 #define CFAPI_OBJECT_PROP_LEVEL 39 #define CFAPI_OBJECT_PROP_LAST_HEAL 40 #define CFAPI_OBJECT_PROP_LAST_SP 41 #define CFAPI_OBJECT_PROP_LAST_GRACE 42 #define CFAPI_OBJECT_PROP_LAST_EAT 43 #define CFAPI_OBJECT_PROP_INVISIBLE_TIME 44 #define CFAPI_OBJECT_PROP_PICK_UP 45 #define CFAPI_OBJECT_PROP_ITEM_POWER 46 #define CFAPI_OBJECT_PROP_GEN_SP_ARMOUR 47 #define CFAPI_OBJECT_PROP_WEIGHT 48 #define CFAPI_OBJECT_PROP_WEIGHT_LIMIT 49 #define CFAPI_OBJECT_PROP_CARRYING 50 #define CFAPI_OBJECT_PROP_GLOW_RADIUS 51 #define CFAPI_OBJECT_PROP_PERM_EXP 52 #define CFAPI_OBJECT_PROP_CURRENT_WEAPON 53 #define CFAPI_OBJECT_PROP_ENEMY 54 #define CFAPI_OBJECT_PROP_ATTACKED_BY 55 #define CFAPI_OBJECT_PROP_RUN_AWAY 56 #define CFAPI_OBJECT_PROP_CHOSEN_SKILL 57 #define CFAPI_OBJECT_PROP_HIDDEN 58 #define CFAPI_OBJECT_PROP_MOVE_STATUS 59 #define CFAPI_OBJECT_PROP_MOVE_TYPE 60 #define CFAPI_OBJECT_PROP_SPELL_ITEM 61 #define CFAPI_OBJECT_PROP_EXP_MULTIPLIER 62 #define CFAPI_OBJECT_PROP_ARCHETYPE 63 #define CFAPI_OBJECT_PROP_OTHER_ARCH 64 #define CFAPI_OBJECT_PROP_CUSTOM_NAME 65 #define CFAPI_OBJECT_PROP_ANIM_SPEED 66 #define CFAPI_OBJECT_PROP_FRIENDLY 67 #define CFAPI_OBJECT_PROP_SHORT_NAME 68 #define CFAPI_OBJECT_PROP_BASE_NAME 69 #define CFAPI_OBJECT_PROP_MAGICAL 70 #define CFAPI_OBJECT_PROP_LUCK 71 #define CFAPI_OBJECT_PROP_EXP 72 #define CFAPI_OBJECT_PROP_OWNER 73 #define CFAPI_OBJECT_PROP_PRESENT 74 #define CFAPI_OBJECT_PROP_CHEATER 75 #define CFAPI_OBJECT_PROP_MERGEABLE 76 #define CFAPI_OBJECT_PROP_PICKABLE 77 #define CFAPI_OBJECT_PROP_FLAGS 78 #define CFAPI_OBJECT_PROP_STR 79 #define CFAPI_OBJECT_PROP_DEX 80 #define CFAPI_OBJECT_PROP_CON 81 #define CFAPI_OBJECT_PROP_WIS 82 #define CFAPI_OBJECT_PROP_INT 83 #define CFAPI_OBJECT_PROP_POW 84 #define CFAPI_OBJECT_PROP_CHA 85 #define CFAPI_OBJECT_PROP_WC 86 #define CFAPI_OBJECT_PROP_AC 87 #define CFAPI_OBJECT_PROP_HP 88 #define CFAPI_OBJECT_PROP_SP 89 #define CFAPI_OBJECT_PROP_GP 90 #define CFAPI_OBJECT_PROP_FP 91 #define CFAPI_OBJECT_PROP_MAXHP 92 #define CFAPI_OBJECT_PROP_MAXSP 93 #define CFAPI_OBJECT_PROP_MAXGP 94 #define CFAPI_OBJECT_PROP_DAM 95 #define CFAPI_OBJECT_PROP_GOD 96 #define CFAPI_OBJECT_PROP_ARCH_NAME 97 #define CFAPI_OBJECT_PROP_INVISIBLE 98 #define CFAPI_OBJECT_PROP_FACE 99 #define CFAPI_OBJECT_ANIMATION 100 #define CFAPI_PLAYER_PROP_IP 150 #define CFAPI_PLAYER_PROP_MARKED_ITEM 151 #define CFAPI_PLAYER_PROP_PARTY 152 #define CFAPI_MAP_PROP_FLAGS 0 #define CFAPI_MAP_PROP_DIFFICULTY 1 #define CFAPI_MAP_PROP_PATH 2 #define CFAPI_MAP_PROP_TMPNAME 3 #define CFAPI_MAP_PROP_NAME 4 #define CFAPI_MAP_PROP_RESET_TIME 5 #define CFAPI_MAP_PROP_RESET_TIMEOUT 6 #define CFAPI_MAP_PROP_PLAYERS 7 #define CFAPI_MAP_PROP_LIGHT 8 #define CFAPI_MAP_PROP_DARKNESS 9 #define CFAPI_MAP_PROP_WIDTH 10 #define CFAPI_MAP_PROP_HEIGHT 11 #define CFAPI_MAP_PROP_ENTER_X 12 #define CFAPI_MAP_PROP_ENTER_Y 13 #define CFAPI_MAP_PROP_TEMPERATURE 14 #define CFAPI_MAP_PROP_PRESSURE 15 #define CFAPI_MAP_PROP_HUMIDITY 16 #define CFAPI_MAP_PROP_WINDSPEED 17 #define CFAPI_MAP_PROP_WINDDIR 18 #define CFAPI_MAP_PROP_SKY 19 #define CFAPI_MAP_PROP_WPARTX 20 #define CFAPI_MAP_PROP_WPARTY 21 #define CFAPI_MAP_PROP_MESSAGE 22 #define CFAPI_MAP_PROP_NEXT 23 #define CFAPI_MAP_PROP_REGION 24 #define CFAPI_ARCH_PROP_NAME 0 #define CFAPI_ARCH_PROP_NEXT 1 #define CFAPI_ARCH_PROP_HEAD 2 #define CFAPI_ARCH_PROP_MORE 3 #define CFAPI_ARCH_PROP_CLONE 4 #define CFAPI_PARTY_PROP_NAME 0 #define CFAPI_PARTY_PROP_NEXT 1 #define CFAPI_PARTY_PROP_PASSWORD 2 #define CFAPI_PARTY_PROP_PLAYER 3 #define CFAPI_REGION_PROP_NAME 0 #define CFAPI_REGION_PROP_NEXT 1 #define CFAPI_REGION_PROP_PARENT 2 #define CFAPI_REGION_PROP_LONGNAME 3 #define CFAPI_REGION_PROP_MESSAGE 4 /*****************************************************************************/ /* Exportable functions. Any plugin should define all those. */ /* initPlugin is called when the plugin initialization process starts.*/ /* endPlugin is called before the plugin gets unloaded from memory. */ /* getPluginProperty is currently unused. */ /* registerHook is used to transmit hook pointers from server to plugin.*/ /* triggerEvent is called whenever an event occurs. */ /*****************************************************************************/ /*extern MODULEAPI CFParm* initPlugin(CFParm* PParm); extern MODULEAPI CFParm* endPlugin(CFParm* PParm); extern MODULEAPI CFParm* getPluginProperty(CFParm* PParm); extern MODULEAPI CFParm* registerHook(CFParm* PParm); extern MODULEAPI CFParm* triggerEvent(CFParm* PParm); */ typedef struct _hook_entry { f_plug_api func; int fid; char fname[256]; } hook_entry; #endif /*PLUGIN_H_*/