| 1 |
root |
1.1 |
/*****************************************************************************/ |
| 2 |
|
|
/* Crossfire Plugin Interface Common Parts */ |
| 3 |
|
|
/* Version: 2.0beta8 (also known as "Alexander") */ |
| 4 |
|
|
/* Contact: yann.chachkoff@myrealbox.com */ |
| 5 |
|
|
/*****************************************************************************/ |
| 6 |
|
|
/* That code is placed under the GNU General Public Licence (GPL) */ |
| 7 |
|
|
/* (C)2001-2005 by Chachkoff Yann (Feel free to deliver your complaints) */ |
| 8 |
|
|
/*****************************************************************************/ |
| 9 |
|
|
/* CrossFire, A Multiplayer game for X-windows */ |
| 10 |
|
|
/* */ |
| 11 |
|
|
/* Copyright (C) 2000 Mark Wedel */ |
| 12 |
|
|
/* Copyright (C) 1992 Frank Tore Johansen */ |
| 13 |
|
|
/* */ |
| 14 |
|
|
/* This program is free software; you can redistribute it and/or modify */ |
| 15 |
|
|
/* it under the terms of the GNU General Public License as published by */ |
| 16 |
|
|
/* the Free Software Foundation; either version 2 of the License, or */ |
| 17 |
|
|
/* (at your option) any later version. */ |
| 18 |
|
|
/* */ |
| 19 |
|
|
/* This program is distributed in the hope that it will be useful, */ |
| 20 |
|
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 21 |
|
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
| 22 |
|
|
/* GNU General Public License for more details. */ |
| 23 |
|
|
/* */ |
| 24 |
|
|
/* You should have received a copy of the GNU General Public License */ |
| 25 |
|
|
/* along with this program; if not, write to the Free Software */ |
| 26 |
|
|
/* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 27 |
|
|
/* */ /*****************************************************************************/ |
| 28 |
|
|
#ifndef PLUGIN_COMMON_H |
| 29 |
|
|
#define PLUGIN_COMMON_H |
| 30 |
|
|
|
| 31 |
|
|
#ifdef WIN32 |
| 32 |
|
|
#define CF_PLUGIN __declspec(dllexport) |
| 33 |
|
|
#else |
| 34 |
|
|
#define CF_PLUGIN |
| 35 |
|
|
#endif |
| 36 |
|
|
|
| 37 |
|
|
#include <plugin.h> |
| 38 |
|
|
|
| 39 |
|
|
#define PLUGIN_ERROR_INT 0x0FFFFF |
| 40 |
|
|
|
| 41 |
|
|
extern int cf_init_plugin( f_plug_api getHooks ); |
| 42 |
|
|
extern void cf_system_register_global_event( int event, const char* name, f_plug_api hook ); |
| 43 |
|
|
|
| 44 |
|
|
/* General functions */ |
| 45 |
|
|
extern char* cf_add_string( char* str ); |
| 46 |
|
|
extern void cf_free_string( char* str ); |
| 47 |
|
|
extern char* cf_strdup_local(char* txt); |
| 48 |
|
|
extern char* cf_get_maps_directory( char* str ); |
| 49 |
|
|
extern int cf_find_animation(char* txt); |
| 50 |
|
|
|
| 51 |
|
|
/* Objects */ |
| 52 |
|
|
extern void* cf_object_set_int_property(object* op, int propcode, int value); |
| 53 |
|
|
extern void* cf_object_get_property(object* op, int propcode); |
| 54 |
|
|
extern void cf_free_object( object* ob ); |
| 55 |
|
|
extern void cf_fix_object( object* pl ); |
| 56 |
|
|
extern char* cf_query_name( object* ob ); |
| 57 |
|
|
extern char* cf_query_name_pl( object* ob ); |
| 58 |
|
|
extern char* cf_query_base_name( object* ob, int plural ); |
| 59 |
|
|
extern object* cf_insert_ob_in_ob( object* ob, object* where ); |
| 60 |
|
|
extern const char* cf_object_get_msg( object* ); |
| 61 |
|
|
extern void cf_object_set_weight( object* ob, int weight ); |
| 62 |
|
|
extern int cf_object_get_weight( object* ob ); |
| 63 |
|
|
extern void cf_object_set_weight_limit( object* ob, int weight ); |
| 64 |
|
|
extern int cf_object_get_weight_limit( object* ob ); |
| 65 |
|
|
extern int cf_object_set_nrof( object*, int nrof ); |
| 66 |
|
|
extern int cf_object_get_nrof( object* ); |
| 67 |
|
|
extern int cf_object_get_flag( object* ob, int flag ); |
| 68 |
|
|
extern void cf_object_set_flag( object* ob, int flag, int value ); |
| 69 |
|
|
extern object* cf_object_insert_in_ob( object* ob, object* where ); |
| 70 |
|
|
extern void* cf_object_set_string_property(object* op, int propcode, char* value); |
| 71 |
|
|
extern void cf_object_activate_rune( object* op , object* victim); |
| 72 |
|
|
extern int cf_object_check_trigger( object* op, object* cause ); |
| 73 |
|
|
extern int cf_object_query_money( object* op); |
| 74 |
|
|
extern int cf_object_query_cost( object* op, object* who, int flags); |
| 75 |
|
|
extern void* cf_object_set_string_property(object* op, int propcode, char* value); |
| 76 |
|
|
extern int cf_object_cast_spell(object* caster, object* ctoo, int dir, object* sp, char* flags); |
| 77 |
|
|
extern void cf_object_learn_spell(object* op, object* sp); |
| 78 |
|
|
extern void cf_object_forget_spell(object* op, object* sp); |
| 79 |
|
|
extern object* cf_object_check_for_spell(object* op, char* spellname); |
| 80 |
|
|
extern int cf_object_cast_ability(object* caster, object* ctoo, int dir, object* sp, char* flags); |
| 81 |
|
|
extern int cf_object_pay_amount(object* op, uint64 amount); |
| 82 |
|
|
extern int cf_object_pay_item(object* op, object* buyer); |
| 83 |
|
|
extern void* cf_object_set_long_property(object* op, int propcode, long value); |
| 84 |
|
|
extern int cf_object_transfer(object* op,int x,int y,int r,object* orig); |
| 85 |
|
|
extern int cf_object_out_of_map( object* op, int x, int y); |
| 86 |
|
|
extern void cf_object_drop( object* op, object* author); |
| 87 |
|
|
extern void cf_object_take( object* op, object* author); |
| 88 |
|
|
extern void cf_object_say( object* op, char* msg); |
| 89 |
|
|
extern void cf_object_speak( object* op, char* msg); |
| 90 |
|
|
extern object* cf_object_insert_object(object* op, object* container); |
| 91 |
|
|
extern object* cf_object_present_archname_inside(object* op, char* whatstr); |
| 92 |
|
|
extern void cf_object_apply(object* op, object* author, int flags); |
| 93 |
|
|
extern void cf_object_remove(object* op); |
| 94 |
|
|
extern void cf_object_free(object* op); |
| 95 |
|
|
extern object* cf_create_object(void); |
| 96 |
|
|
extern object* cf_create_object_by_name( const char* name ); |
| 97 |
|
|
extern int cf_object_change_map(object* op, int x, int y, mapstruct* map); |
| 98 |
|
|
extern int cf_object_teleport( object* ob, mapstruct* map, int x, int y ); |
| 99 |
|
|
extern void cf_object_update( object* op, int flags); |
| 100 |
|
|
extern void cf_object_pickup( object* op, object* what); |
| 101 |
|
|
extern char* cf_object_get_key(object* op, char* keyname); |
| 102 |
|
|
extern void cf_object_set_key(object* op, char* keyname, char* value); |
| 103 |
elmex |
1.3 |
extern sint16 cf_object_get_resistance(object* op, int rtype); |
| 104 |
root |
1.4 |
extern void cf_object_move(object* op, int dir, object*originator); |
| 105 |
root |
1.1 |
extern void cf_object_apply_below(object* op); |
| 106 |
|
|
extern object* cf_object_clone(object* op, int clonetype); |
| 107 |
|
|
|
| 108 |
|
|
/* Maps */ |
| 109 |
|
|
extern void* cf_map_get_property(mapstruct* map, int propcode); |
| 110 |
|
|
extern void* cf_map_set_int_property(mapstruct* map, int propcode, int value); |
| 111 |
|
|
extern mapstruct* cf_map_get_map( char* name ); |
| 112 |
|
|
extern mapstruct* cf_map_get_first(void); |
| 113 |
|
|
extern void cf_map_message(mapstruct* m, char* msg, int color); |
| 114 |
|
|
extern object* cf_map_get_object_at(mapstruct* m, int x, int y); |
| 115 |
|
|
extern object* cf_map_insert_object(mapstruct* where, object* op, int x, int y); |
| 116 |
|
|
extern object* cf_map_present_arch_by_name(const char* str, mapstruct* map, int nx, int ny); |
| 117 |
|
|
extern int cf_map_get_flags( mapstruct* map, mapstruct** nmap, sint16 x, sint16 y, sint16* nx, sint16* ny ); |
| 118 |
|
|
extern object* cf_map_insert_object_there(mapstruct* where, object* op, object* originator, int flags); |
| 119 |
|
|
extern int cf_map_get_difficulty(mapstruct* map); |
| 120 |
|
|
extern int cf_map_get_reset_time(mapstruct* map); |
| 121 |
|
|
extern int cf_map_get_reset_timeout(mapstruct* map); |
| 122 |
|
|
extern int cf_map_get_players(mapstruct* map); |
| 123 |
|
|
extern int cf_map_get_darkness(mapstruct* map); |
| 124 |
|
|
extern int cf_map_get_width(mapstruct* map); |
| 125 |
|
|
extern int cf_map_get_height(mapstruct* map); |
| 126 |
|
|
extern int cf_map_get_enter_x(mapstruct* map); |
| 127 |
|
|
extern int cf_map_get_enter_y(mapstruct* map); |
| 128 |
|
|
extern int cf_map_get_temperature(mapstruct* map); |
| 129 |
|
|
extern int cf_map_get_pressure(mapstruct* map); |
| 130 |
|
|
extern int cf_map_get_humidity(mapstruct* map); |
| 131 |
|
|
extern int cf_map_get_windspeed(mapstruct* map); |
| 132 |
|
|
extern int cf_map_get_winddir(mapstruct* map); |
| 133 |
|
|
extern int cf_map_get_sky(mapstruct* map); |
| 134 |
|
|
extern int cf_map_get_wpartx(mapstruct* map); |
| 135 |
|
|
extern int cf_map_get_wparty(mapstruct* map); |
| 136 |
|
|
|
| 137 |
|
|
/* Players */ |
| 138 |
|
|
extern char* cf_player_get_ip(object* op); |
| 139 |
|
|
extern object* cf_player_get_marked_item(object* op); |
| 140 |
|
|
extern void cf_player_set_marked_item(object* op, object* ob); |
| 141 |
|
|
extern player* cf_player_find(char* txt); |
| 142 |
|
|
extern void cf_player_message(object* op, char* txt, int flags); |
| 143 |
|
|
extern object* cf_player_send_inventory(object* op); |
| 144 |
|
|
extern void cf_player_move(player* pl, int dir); |
| 145 |
|
|
extern partylist* cf_player_get_party(object* op); |
| 146 |
|
|
extern void cf_player_set_party(object* op, partylist* party); |
| 147 |
|
|
|
| 148 |
|
|
/* Archetypes */ |
| 149 |
|
|
extern archetype* cf_archetype_get_first(void); |
| 150 |
|
|
extern const char* cf_archetype_get_name(archetype* arch); |
| 151 |
|
|
extern archetype* cf_archetype_get_next(archetype* arch); |
| 152 |
|
|
extern archetype* cf_archetype_get_more(archetype* arch); |
| 153 |
|
|
extern archetype* cf_archetype_get_head(archetype* arch); |
| 154 |
|
|
extern object* cf_archetype_get_clone(archetype* arch); |
| 155 |
|
|
|
| 156 |
|
|
/* Parties */ |
| 157 |
|
|
extern partylist* cf_party_get_first(void); |
| 158 |
|
|
extern const char* cf_party_get_name(partylist* party); |
| 159 |
|
|
extern partylist* cf_party_get_next(partylist* party); |
| 160 |
|
|
extern const char* cf_party_get_password(partylist* party); |
| 161 |
|
|
extern player* cf_party_get_first_player(partylist* party); |
| 162 |
|
|
extern player* cf_party_get_next_player(partylist* party, player* op); |
| 163 |
elmex |
1.3 |
|
| 164 |
|
|
/* Regions */ |
| 165 |
|
|
extern region* cf_region_get_first(void); |
| 166 |
|
|
extern const char* cf_region_get_name(region* reg); |
| 167 |
|
|
extern region* cf_region_get_next(region* reg); |
| 168 |
|
|
extern region* cf_region_get_parent(region* reg); |
| 169 |
|
|
extern const char* cf_region_get_longname(region* reg); |
| 170 |
|
|
extern const char* cf_region_get_message(region* reg); |
| 171 |
root |
1.1 |
|
| 172 |
|
|
/* temp */ |
| 173 |
|
|
extern f_plug_api cfapi_object_get_property; |
| 174 |
|
|
extern f_plug_api cfapi_object_set_property; |
| 175 |
|
|
extern f_plug_api cfapi_object_apply; |
| 176 |
|
|
extern f_plug_api cfapi_object_remove; |
| 177 |
|
|
|
| 178 |
|
|
#ifdef WIN32 |
| 179 |
|
|
|
| 180 |
|
|
struct timezone { |
| 181 |
|
|
int tz_minuteswest; |
| 182 |
|
|
int tz_dsttime; |
| 183 |
|
|
}; |
| 184 |
|
|
int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info); |
| 185 |
|
|
|
| 186 |
|
|
#endif |
| 187 |
|
|
|
| 188 |
|
|
#endif /* PLUGIN_COMMON_H */ |