Crossfire Server, Branch 1.12
R12190
|
#include <plugin.h>
Go to the source code of this file.
Defines | |
#define | CF_PLUGIN |
#define | PLUGIN_ERROR_INT 0x0FFFFF |
Functions | |
sstring | cf_add_string (const char *str) |
Wrapper for add_string(). | |
object * | cf_archetype_get_clone (archetype *arch) |
Get clone of archetype. | |
archetype * | cf_archetype_get_first (void) |
Get first archetype. | |
archetype * | cf_archetype_get_head (archetype *arch) |
Get head of archetype. | |
archetype * | cf_archetype_get_more (archetype *arch) |
Get next part of archetype. | |
sstring | cf_archetype_get_name (archetype *arch) |
Get archetype's name. | |
archetype * | cf_archetype_get_next (archetype *arch) |
Get next archetype in linked list. | |
object * | cf_create_object (void) |
Wrapper for get_object(). | |
object * | cf_create_object_by_name (const char *name) |
Wrapper for create_archetype() and create_archetype_by_object_name(). | |
int | cf_find_animation (const char *txt) |
Wrapper for find_animation(). | |
int | cf_find_face (const char *name, int error) |
Wrapper for find_face(). | |
sstring | cf_find_string (const char *str) |
void | cf_fix_object (object *op) |
Wrapper for fix_object(). | |
void | cf_free_string (sstring str) |
Wrapper for free_string(). | |
object * | cf_friendlylist_get_first (void) |
Get first object on friendly list. | |
object * | cf_friendlylist_get_next (object *ob) |
Get next object on friendly list. | |
const char * | cf_get_directory (int id) |
Gets a directory Crossfire uses. | |
mapstruct * | cf_get_empty_map (int sizex, int sizey) |
Wrapper for get_empty_map(). | |
char * | cf_get_maps_directory (const char *name, char *buf, int size) |
Wrapper for create_pathname(). | |
const char * | cf_get_month_name (int index) |
const char * | cf_get_periodofday_name (int index) |
const char * | cf_get_season_name (int index) |
void | cf_get_time (timeofday_t *tod) |
const char * | cf_get_weekday_name (int index) |
int | cf_init_plugin (f_plug_api getHooks) |
void | cf_log (LogLevel logLevel, const char *format,...) |
Wrapper for LOG(). | |
void | cf_log_plain (LogLevel logLevel, const char *message) |
Wrapper for LOG() that uses directly a buffer, without format. | |
int | cf_map_change_light (mapstruct *m, int change) |
Wrapper for change_map_light(). | |
int | cf_map_get_darkness (mapstruct *map) |
int | cf_map_get_difficulty (mapstruct *map) |
int | cf_map_get_enter_x (mapstruct *map) |
int | cf_map_get_enter_y (mapstruct *map) |
mapstruct * | cf_map_get_first (void) |
Gives access to first_map. | |
int | cf_map_get_flags (mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny) |
Wrapper for get_map_flags(). | |
int | cf_map_get_height (mapstruct *map) |
int | cf_map_get_int_property (mapstruct *map, int property) |
int | cf_map_get_light (mapstruct *map) |
mapstruct * | cf_map_get_map (const char *name, int flags) |
Wrapper for ready_map_name(). | |
mapstruct * | cf_map_get_map_property (mapstruct *map, int propcode) |
object * | cf_map_get_object_at (mapstruct *m, int x, int y) |
Wrapper for GET_MAP_OB(). | |
int | cf_map_get_players (mapstruct *map) |
region * | cf_map_get_region_property (mapstruct *map, int propcode) |
int | cf_map_get_reset_time (mapstruct *map) |
int | cf_map_get_reset_timeout (mapstruct *map) |
sstring | cf_map_get_sstring_property (mapstruct *map, int propcode) |
int | cf_map_get_width (mapstruct *map) |
mapstruct * | cf_map_has_been_loaded (const char *name) |
Wrapper for has_been_loaded(). | |
object * | cf_map_insert_object (mapstruct *where, object *op, int x, int y) |
Wrapper for insert_ob_in_map_at(). | |
object * | cf_map_insert_object_there (object *op, mapstruct *m, object *originator, int flag) |
Wrapper for insert_ob_in_map(). | |
void | cf_map_message (mapstruct *m, const char *msg, int color) |
Partial wrapper for ext_info_map(). | |
object * | cf_map_present_arch_by_name (const char *str, mapstruct *map, int nx, int ny) |
Kinda wrapper for arch_present(). | |
void | cf_map_set_int_property (mapstruct *map, int propcode, int value) |
void | cf_map_set_string_property (mapstruct *map, int propcode, const char *value) |
void | cf_map_trigger_connected (objectlink *ol, object *cause, int state) |
Wrapper for trigger_connected(). | |
int | cf_object_apply (object *op, object *author, int flags) |
Wrapper for manual_apply(). | |
void | cf_object_apply_below (object *pl) |
Wrapper for player_apply_below(). | |
int | cf_object_cast_ability (object *caster, object *ctoo, int dir, object *sp, char *flags) |
Should there be a difference nowadays between that and cast_spell ? | |
int | cf_object_cast_spell (object *op, object *caster, int dir, object *spell_ob, char *stringarg) |
Wrapper for cast_spell(). | |
int | cf_object_change_abil (object *op, object *tmp) |
Wrapper for change_abil(). | |
void | cf_object_change_exp (object *op, sint64 exp, const char *skill_name, int flag) |
Wrapper for change_exp(). | |
object * | cf_object_change_map (object *op, mapstruct *m, object *originator, int flag, int x, int y) |
Wrapper for insert_ob_in_map_at(). | |
object * | cf_object_check_for_spell (object *op, const char *name) |
Wrapper for check_spell_known(). | |
int | cf_object_check_trigger (object *op, object *cause) |
Wrapper for check_trigger(). | |
object * | cf_object_clone (object *op, int clonetype) |
Clone an object. | |
void | cf_object_drop (object *op, object *author) |
void | cf_object_forget_spell (object *op, object *sp) |
Wrapper for do_forget_spell(), except takes an object, not a string. | |
void | cf_object_free (object *ob) |
Wrapper for free_object(). | |
archetype * | cf_object_get_archetype_property (object *op, int propcode) |
double | cf_object_get_double_property (object *op, int propcode) |
int | cf_object_get_flag (object *ob, int flag) |
float | cf_object_get_float_property (object *op, int propcode) |
sint64 | cf_object_get_int64_property (object *op, int propcode) |
int | cf_object_get_int_property (object *op, int propcode) |
const char * | cf_object_get_key (object *op, const char *keyname) |
Gets value for specified key, equivalent of get_ob_key_value(). | |
long | cf_object_get_long_property (object *op, long propcode) |
mapstruct * | cf_object_get_map_property (object *op, int propcode) |
MoveType | cf_object_get_movetype_property (object *op, int propcode) |
const char * | cf_object_get_msg (object *) |
int | cf_object_get_nrof (object *) |
object * | cf_object_get_object_property (object *op, int propcode) |
partylist * | cf_object_get_partylist_property (object *op, int propcode) |
sint16 | cf_object_get_resistance (object *op, int rtype) |
sstring | cf_object_get_sstring_property (object *op, int propcode) |
char * | cf_object_get_string_property (object *op, int propcode, char *buf, int size) |
int | cf_object_get_weight (object *ob) |
int | cf_object_get_weight_limit (object *ob) |
object * | cf_object_insert_in_ob (object *op, object *where) |
Wrapper for insert_ob_in_ob(). | |
object * | cf_object_insert_object (object *op, object *container) |
void | cf_object_learn_spell (object *op, object *spell, int special_prayer) |
Wrapper for do_learn_spell(). | |
int | cf_object_move (object *op, int dir, object *originator) |
int | cf_object_move_to (object *op, int x, int y) |
Wrapper for move_to(). | |
int | cf_object_out_of_map (object *op, int x, int y) |
int | cf_object_pay_amount (object *pl, uint64 to_pay) |
Wrapper for pay_for_amount(). | |
int | cf_object_pay_item (object *op, object *pl) |
Wrapper for pay_for_item(). | |
void | cf_object_pickup (object *op, object *what) |
object * | cf_object_present_archname_inside (object *op, char *whatstr) |
Kinda wrapper for present_arch_in_ob(). | |
int | cf_object_query_cost (const object *tmp, object *who, int flag) |
Wrapper for query_cost(). | |
int | cf_object_query_money (const object *op) |
Wrapper for query_money(). | |
void | cf_object_remove (object *op) |
Wrapper for remove_ob(). | |
void | cf_object_say (object *op, char *msg) |
void | cf_object_set_flag (object *ob, int flag, int value) |
void | cf_object_set_float_property (object *op, int propcode, float value) |
void | cf_object_set_int64_property (object *op, int propcode, sint64 value) |
void | cf_object_set_int_property (object *op, int propcode, int value) |
int | cf_object_set_key (object *op, const char *keyname, const char *value, int add_key) |
Sets a value for specified key, equivalent to set_ob_key_value(). | |
void | cf_object_set_long_property (object *op, int propcode, long value) |
void | cf_object_set_movetype_property (object *op, int propcode, MoveType value) |
int | cf_object_set_nrof (object *, int nrof) |
void | cf_object_set_object_property (object *op, int propcode, object *value) |
void | cf_object_set_resistance (object *op, int rtype, sint16 value) |
void | cf_object_set_string_property (object *op, int propcode, const char *value) |
void | cf_object_set_weight (object *ob, int weight) |
void | cf_object_set_weight_limit (object *ob, int weight) |
int | cf_object_teleport (object *ob, mapstruct *map, int x, int y) |
int | cf_object_transfer (object *op, int x, int y, int randomly, object *originator) |
Wrapper for transfer_ob(). | |
void | cf_object_update (object *op, int flags) |
int | cf_object_user_event (object *op, object *activator, object *third, const char *message, int fix) |
partylist * | cf_party_get_first (void) |
Get first party. | |
player * | cf_party_get_first_player (partylist *party) |
Get first player in party. | |
const char * | cf_party_get_name (partylist *party) |
partylist * | cf_party_get_next (partylist *party) |
Get next party in party list. | |
player * | cf_party_get_next_player (partylist *party, player *op) |
Get next player in party. | |
const char * | cf_party_get_password (partylist *party) |
Get party's password. | |
int | cf_player_can_pay (object *op) |
Wrapper for can_pay(). | |
player * | cf_player_find (const char *plname) |
Wrapper for find_player_partial_name(). | |
sstring | cf_player_get_ip (object *op) |
object * | cf_player_get_marked_item (object *op) |
partylist * | cf_player_get_party (object *op) |
sstring | cf_player_get_title (object *op) |
void | cf_player_message (object *op, char *txt, int flags) |
int | cf_player_move (player *pl, int dir) |
void | cf_player_set_marked_item (object *op, object *ob) |
void | cf_player_set_party (object *op, partylist *party) |
void | cf_player_set_title (object *op, const char *title) |
char * | cf_query_base_name (object *ob, int plural, char *name, int size) |
char * | cf_query_name (object *ob, char *name, int size) |
sstring | cf_query_name_pl (object *ob) |
mapstruct * | cf_random_map_generate (const char *OutFileName, RMParms *RP, char **use_layout) |
Wrapper for generate_random_map(). | |
int | cf_random_map_set_variable (RMParms *rp, const char *buf) |
Wrapper for set_random_map_variable(). | |
const char * | cf_re_cmp (const char *str, const char *regexp) |
Wrapper for re_cmp(). | |
region * | cf_region_get_first (void) |
Get first region in region list. | |
const char * | cf_region_get_longname (region *reg) |
Get longname of region. | |
const char * | cf_region_get_message (region *reg) |
Get message of region. | |
const char * | cf_region_get_name (region *reg) |
Get name of region. | |
region * | cf_region_get_next (region *reg) |
Get next region in region list. | |
region * | cf_region_get_parent (region *reg) |
Get parent of region. | |
void | cf_spring_trap (object *trap, object *victim) |
Wrapper for spring_trap(). | |
char * | cf_strdup_local (const char *str) |
Wrapper for strdup_local(). | |
void | cf_system_register_global_event (int event, const char *name, f_plug_api hook) |
void | cf_system_unregister_global_event (int event, const char *name) |
int | cf_timer_create (object *ob, long delay, int mode) |
Creates a timer, equivalent of calling cftimer_create(). | |
int | cf_timer_destroy (int id) |
Destroys specified timer, equivalent of calling cftimer_destroy(). |
#define CF_PLUGIN |
Definition at line 35 of file plugin_common.h.
#define PLUGIN_ERROR_INT 0x0FFFFF |
Definition at line 40 of file plugin_common.h.
sstring cf_add_string | ( | const char * | str | ) |
Wrapper for add_string().
This will add 'str' to the hash table.
If there's no entry for this string, a copy will be allocated, and a pointer to that is returned.
str | string to share. |
Definition at line 998 of file plugin_common.c.
References CFAPI_SSTRING, and cfapiSystem_add_string.
Referenced by compilePython(), get_npc(), initapplyobject(), initpickupobject(), and start_animation().
object* cf_archetype_get_clone | ( | archetype * | arch | ) |
Get clone of archetype.
arch | archetype, mustn't be NULL. |
Definition at line 1584 of file plugin_common.c.
References CFAPI_ARCH_PROP_CLONE, CFAPI_POBJECT, and cfapiArchetype_get_property.
Referenced by Crossfire_Archetype_GetClone().
archetype* cf_archetype_get_first | ( | void | ) |
Get first archetype.
Definition at line 1503 of file plugin_common.c.
References CFAPI_ARCH_PROP_NEXT, CFAPI_PARCH, and cfapiArchetype_get_property.
Referenced by getArchetypes().
archetype* cf_archetype_get_head | ( | archetype * | arch | ) |
Get head of archetype.
arch | archetype, mustn't be NULL. |
Definition at line 1568 of file plugin_common.c.
References CFAPI_ARCH_PROP_HEAD, CFAPI_PARCH, and cfapiArchetype_get_property.
Referenced by Crossfire_Archetype_GetHead().
archetype* cf_archetype_get_more | ( | archetype * | arch | ) |
Get next part of archetype.
arch | archetype, mustn't be NULL. |
Definition at line 1552 of file plugin_common.c.
References CFAPI_ARCH_PROP_MORE, CFAPI_PARCH, and cfapiArchetype_get_property.
Referenced by Crossfire_Archetype_GetMore().
sstring cf_archetype_get_name | ( | archetype * | arch | ) |
Get archetype's name.
arch | archetype, mustn't be NULL. |
Definition at line 1519 of file plugin_common.c.
References CFAPI_ARCH_PROP_NAME, CFAPI_SSTRING, and cfapiArchetype_get_property.
Referenced by Crossfire_Archetype_GetName(), and Crossfire_Archetype_GetNewObject().
archetype* cf_archetype_get_next | ( | archetype * | arch | ) |
Get next archetype in linked list.
arch | archetype for which we want the next. Can be NULL, in which case it is equivalent to calling cf_archetype_get_first(). |
Definition at line 1536 of file plugin_common.c.
References CFAPI_ARCH_PROP_NEXT, CFAPI_PARCH, and cfapiArchetype_get_property.
Referenced by Crossfire_Archetype_GetNext(), and getArchetypes().
object* cf_create_object | ( | void | ) |
Wrapper for get_object().
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it.
If there are no free objects, expand_objects() is called to get more.
Definition at line 912 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiObject_create.
Referenced by createCFObject().
object* cf_create_object_by_name | ( | const char * | name | ) |
Wrapper for create_archetype() and create_archetype_by_object_name().
Definition at line 924 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiObject_create.
Referenced by createCFObjectByName(), Crossfire_Archetype_GetNewObject(), Crossfire_Object_CreateInside(), eventListener(), get_npc(), and Map_CreateObject().
int cf_find_animation | ( | const char * | name | ) |
Wrapper for find_animation().
Finds the animation id that matches name.
Will LOG() an error if not found.
name | the animation's name. |
Definition at line 1315 of file plugin_common.c.
References CFAPI_INT, and cfapiSystem_find_animation.
Referenced by findAnimation(), and Object_SetAnim().
int cf_find_face | ( | const char * | name, |
int | error | ||
) |
Wrapper for find_face().
This returns an the face number of face 'name'.
Number is constant during an invocation, but not necessarily between versions (this is because the faces are arranged in alphabetical order, so if a face is removed or added, all faces after that will now have a different number.
name | face to search for |
error | value to return if face was not found. |
Definition at line 1327 of file plugin_common.c.
References CFAPI_INT, and cfapiSystem_find_face.
Referenced by findFace(), and Object_SetFace().
sstring cf_find_string | ( | const char * | str | ) |
Definition at line 1020 of file plugin_common.c.
References CFAPI_SSTRING, and cfapiSystem_find_string.
Referenced by find_by_name().
void cf_fix_object | ( | object * | op | ) |
Wrapper for fix_object().
Updates all abilities given by applied objects in the inventory of the given object.
This functions starts from base values (archetype or player object) and then adjusts them according to what the player/monster has equipped.
Note that a player always has stats reset to their initial value.
July 95 - inserted stuff to handle new skills/exp system - b.t. spell system split, grace points now added to system --peterm
November 2006: max armor speed is always taken into account, no exception.
op | object to reset. |
Definition at line 987 of file plugin_common.c.
References cfapiObject_fix.
Referenced by Crossfire_Object_Fix().
void cf_free_string | ( | sstring | str | ) |
Wrapper for free_string().
This will reduce the refcount, and if it has reached 0, str will be freed.
str | string to release, which *must *have been returned from a previous add_string(). |
Definition at line 1013 of file plugin_common.c.
References cfapiSystem_remove_string.
Referenced by compilePython(), runapplyobject(), rundropobject(), runpickupobject(), and start_animation().
object* cf_friendlylist_get_first | ( | void | ) |
Get first object on friendly list.
Definition at line 1791 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiFriendlylist_get_next.
Referenced by getFriendlyList().
object* cf_friendlylist_get_next | ( | object * | ob | ) |
Get next object on friendly list.
ob | object we want the next of. If NULL then equivalent of cf_friendlylist_get_first(). |
Definition at line 1807 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiFriendlylist_get_next.
Referenced by getFriendlyList().
const char* cf_get_directory | ( | int | id | ) |
Gets a directory Crossfire uses.
id | what directory to return:
|
Definition at line 961 of file plugin_common.c.
References CFAPI_STRING, and cfapiSystem_directory.
Referenced by getConfigDirectory(), getDataDirectory(), getLocalDirectory(), getMapDirectory(), getPlayerDirectory(), getTempDirectory(), getUniqueDirectory(), and postInitPlugin().
mapstruct* cf_get_empty_map | ( | int | sizex, |
int | sizey | ||
) |
Wrapper for get_empty_map().
Creates and returns a map of the specific size.
Used in random map code and the editor.
sizex | |
sizey | map size. |
Definition at line 777 of file plugin_common.c.
References CFAPI_PMAP, and cfapiMap_get_map.
Referenced by createMap().
char* cf_get_maps_directory | ( | const char * | name, |
char * | buf, | ||
int | size | ||
) |
Wrapper for create_pathname().
This makes a path absolute outside the world of Crossfire.
In other words, it prepends LIBDIR/MAPDIR/ to the given path and returns the pointer to a static array containing the result. it really should be called create_mapname
name | path of the map. |
buf | buffer that will contain the full path. |
size | buffer's length. |
Definition at line 900 of file plugin_common.c.
References CFAPI_STRING, and cfapiMap_create_path.
Referenced by cfpython_globalEventListener(), cfpython_runPluginCommand(), eventListener(), and postInitPlugin().
const char* cf_get_month_name | ( | int | index | ) |
Definition at line 1382 of file plugin_common.c.
References CFAPI_STRING, and cfapiSystem_get_month_name.
Referenced by getMonthName().
const char* cf_get_periodofday_name | ( | int | index | ) |
Definition at line 1400 of file plugin_common.c.
References CFAPI_STRING, and cfapiSystem_get_periodofday_name.
Referenced by getPeriodofdayName().
const char* cf_get_season_name | ( | int | index | ) |
Definition at line 1373 of file plugin_common.c.
References CFAPI_STRING, and cfapiSystem_get_season_name.
Referenced by getSeasonName().
void cf_get_time | ( | timeofday_t * | tod | ) |
Definition at line 1366 of file plugin_common.c.
References CFAPI_NONE, and cfapiSystem_get_time.
Referenced by get_newspaper_content(), getTime(), and store_time().
const char* cf_get_weekday_name | ( | int | index | ) |
Definition at line 1391 of file plugin_common.c.
References CFAPI_STRING, and cfapiSystem_get_weekday_name.
Referenced by getWeekdayName().
int cf_init_plugin | ( | f_plug_api | getHooks | ) |
Definition at line 134 of file plugin_common.c.
References cfapiArchetype_get_property, cfapiFriendlylist_get_next, cfapiGenerate_random_map, cfapiMap_change_light, cfapiMap_create_path, cfapiMap_get_map, cfapiMap_get_object_at, cfapiMap_get_property, cfapiMap_has_been_loaded, cfapiMap_message, cfapiMap_present_arch_by_name, cfapiMap_set_property, cfapiMap_trigger_connected, cfapiObject_activate_rune, cfapiObject_apply, cfapiObject_apply_below, cfapiObject_cast, cfapiObject_change_abil, cfapiObject_change_exp, cfapiObject_check_spell, cfapiObject_check_trigger, cfapiObject_clear, cfapiObject_clone, cfapiObject_create, cfapiObject_delete, cfapiObject_describe, cfapiObject_distance, cfapiObject_drain, cfapiObject_drop, cfapiObject_find, cfapiObject_find_archetype_inside, cfapiObject_fix, cfapiObject_forget_spell, cfapiObject_get_key, cfapiObject_get_property, cfapiObject_give_skill, cfapiObject_identify, cfapiObject_insert, cfapiObject_learn_spell, cfapiObject_merge, cfapiObject_move, cfapiObject_out_of_map, cfapiObject_pay_amount, cfapiObject_pay_item, cfapiObject_pickup, cfapiObject_query_cost, cfapiObject_query_money, cfapiObject_remove, cfapiObject_reset, cfapiObject_say, cfapiObject_set_key, cfapiObject_set_property, cfapiObject_split, cfapiObject_teleport, cfapiObject_transfer, cfapiObject_transmute, cfapiObject_update, cfapiObject_user_event, cfapiParty_get_property, cfapiPlayer_can_pay, cfapiPlayer_find, cfapiPlayer_message, cfapiRegion_get_property, cfapiSet_random_map_variable, cfapiSystem_add_string, cfapiSystem_directory, cfapiSystem_find_animation, cfapiSystem_find_face, cfapiSystem_find_string, cfapiSystem_get_month_name, cfapiSystem_get_periodofday_name, cfapiSystem_get_season_name, cfapiSystem_get_time, cfapiSystem_get_weekday_name, cfapiSystem_log, cfapiSystem_re_cmp, cfapiSystem_register_global_event, cfapiSystem_remove_string, cfapiSystem_strdup_local, cfapiSystem_timer_create, cfapiSystem_timer_destroy, cfapiSystem_unregister_global_event, and GET_HOOK.
Referenced by initPlugin().
Wrapper for LOG().
Logs a message to stderr, or to file.
Or discards the message if it is of no importance, and none have asked to hear messages of that logLevel.
See include/logger.h for possible logLevels. Messages with llevInfo and llevError are always printed, regardless of debug mode.
logLevel | level of the message |
format | message to log. Works like printf() and such |
Definition at line 1339 of file plugin_common.c.
References CFAPI_NONE, and cfapiSystem_log.
Referenced by add_npc_to_random_map(), add_npcs_to_map(), animate_one(), cfpython_globalEventListener(), cfpython_runPluginCommand(), check_tables(), closePlugin(), compilePython(), do_kills(), do_sql(), eventListener(), get_newspaper_content(), get_npc(), globalEventListener(), initghosted(), initPlugin(), initsay(), initteleport(), initvisible(), initwizard(), is_animated_player(), log_message(), Map_Check(), Map_TriggerConnected(), parse_animation_block(), postInitPlugin(), runcamera(), runfire(), runmovement(), runsay(), runstop(), runturn(), and start_animation().
void cf_log_plain | ( | LogLevel | logLevel, |
const char * | message | ||
) |
Wrapper for LOG() that uses directly a buffer, without format.
Definition at line 1359 of file plugin_common.c.
References CFAPI_NONE, and cfapiSystem_log.
int cf_map_change_light | ( | mapstruct * | m, |
int | change | ||
) |
Wrapper for change_map_light().
Used to change map light level (darkness) up or down.
It should now be possible to change a value by more than 1.
Move this from los.c to map.c since this is more related to maps than los. postive values make it darker, negative make it brighter
Will inform players on the map.
m | map to change. |
change | delta of light. |
Definition at line 1237 of file plugin_common.c.
References CFAPI_INT, and cfapiMap_change_light.
Referenced by Map_ChangeLight().
int cf_map_get_darkness | ( | mapstruct * | map | ) |
Definition at line 1213 of file plugin_common.c.
References cf_map_get_int_property(), and CFAPI_MAP_PROP_DARKNESS.
Referenced by Map_GetDarkness().
int cf_map_get_difficulty | ( | mapstruct * | map | ) |
Definition at line 1197 of file plugin_common.c.
References cf_map_get_int_property(), and CFAPI_MAP_PROP_DIFFICULTY.
Referenced by Map_GetDifficulty().
int cf_map_get_enter_x | ( | mapstruct * | map | ) |
Definition at line 1225 of file plugin_common.c.
References cf_map_get_int_property(), and CFAPI_MAP_PROP_ENTER_X.
Referenced by Map_GetEnterY().
int cf_map_get_enter_y | ( | mapstruct * | map | ) |
Definition at line 1229 of file plugin_common.c.
References cf_map_get_int_property(), and CFAPI_MAP_PROP_ENTER_Y.
mapstruct* cf_map_get_first | ( | void | ) |
Gives access to first_map.
Definition at line 804 of file plugin_common.c.
References cf_map_get_map_property(), and CFAPI_MAP_PROP_NEXT.
Referenced by getMaps().
int cf_map_get_flags | ( | mapstruct * | oldmap, |
mapstruct ** | newmap, | ||
sint16 | x, | ||
sint16 | y, | ||
sint16 * | nx, | ||
sint16 * | ny | ||
) |
Wrapper for get_map_flags().
This rolls up wall, blocks_magic, blocks_view, etc, all into one function that just returns a P_.
. value (see map.h) it will also do map translation for tiled maps, returning new values into newmap, nx, and ny. Any and all of those values can be null, in which case if a new map is needed (returned by a P_NEW_MAP value, another call to get_map_from_coord is needed. The case of not passing values is if we're just checking for the existence of something on those spaces, but don't expect to insert/remove anything from those spaces.
oldmap | map for which we want information. |
newmap | if not NULL, will contain the actual map checked if not oldmap. |
x | |
y | coordinates to check |
nx | |
ny | if not NULL, will contain the actual coordinates checked. |
Definition at line 1278 of file plugin_common.c.
References CFAPI_INT, CFAPI_MAP_PROP_FLAGS, and cfapiMap_get_property.
Referenced by Map_Check().
int cf_map_get_height | ( | mapstruct * | map | ) |
Definition at line 1221 of file plugin_common.c.
References cf_map_get_int_property(), and CFAPI_MAP_PROP_HEIGHT.
Referenced by find_by_name(), and Map_GetHeight().
int cf_map_get_int_property | ( | mapstruct * | map, |
int | property | ||
) |
Definition at line 230 of file plugin_common.c.
References CFAPI_INT, and cfapiMap_get_property.
Referenced by cf_map_get_darkness(), cf_map_get_difficulty(), cf_map_get_enter_x(), cf_map_get_enter_y(), cf_map_get_height(), cf_map_get_players(), cf_map_get_reset_time(), cf_map_get_reset_timeout(), cf_map_get_width(), Map_GetEnterX(), and Map_GetUnique().
int cf_map_get_light | ( | mapstruct * | map | ) |
mapstruct* cf_map_get_map | ( | const char * | name, |
int | flags | ||
) |
Wrapper for ready_map_name().
Makes sure the given map is loaded and swapped in.
name | path name of the map. |
flags |
|
Definition at line 764 of file plugin_common.c.
References CFAPI_PMAP, and cfapiMap_get_map.
Referenced by readyMap(), and runteleport().
mapstruct* cf_map_get_map_property | ( | mapstruct * | map, |
int | propcode | ||
) |
Definition at line 255 of file plugin_common.c.
References CFAPI_PMAP, and cfapiMap_get_property.
Referenced by cf_map_get_first(), getMaps(), and Map_Next().
object* cf_map_get_object_at | ( | mapstruct * | m, |
int | x, | ||
int | y | ||
) |
Wrapper for GET_MAP_OB().
Gets the bottom object on a map.
Not multitile aware.
Definition at line 559 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiMap_get_object_at.
Referenced by eventListener(), and Map_GetFirstObjectAt().
int cf_map_get_players | ( | mapstruct * | map | ) |
Definition at line 1209 of file plugin_common.c.
References cf_map_get_int_property(), and CFAPI_MAP_PROP_PLAYERS.
Referenced by Map_GetPlayers().
region* cf_map_get_region_property | ( | mapstruct * | map, |
int | propcode | ||
) |
Definition at line 264 of file plugin_common.c.
References CFAPI_PREGION, and cfapiMap_get_property.
Referenced by eventListener(), and Map_GetRegion().
int cf_map_get_reset_time | ( | mapstruct * | map | ) |
Definition at line 1201 of file plugin_common.c.
References cf_map_get_int_property(), and CFAPI_MAP_PROP_RESET_TIME.
Referenced by Map_GetResetTime().
int cf_map_get_reset_timeout | ( | mapstruct * | map | ) |
Definition at line 1205 of file plugin_common.c.
References cf_map_get_int_property(), and CFAPI_MAP_PROP_RESET_TIMEOUT.
Referenced by Map_GetResetTimeout().
sstring cf_map_get_sstring_property | ( | mapstruct * | map, |
int | propcode | ||
) |
Definition at line 246 of file plugin_common.c.
References CFAPI_SSTRING, and cfapiMap_get_property.
Referenced by Map_GetMessage(), Map_GetName(), Map_GetPath(), Map_GetTempName(), and Map_TriggerConnected().
int cf_map_get_width | ( | mapstruct * | map | ) |
Definition at line 1217 of file plugin_common.c.
References cf_map_get_int_property(), and CFAPI_MAP_PROP_WIDTH.
Referenced by find_by_name(), and Map_GetWidth().
mapstruct* cf_map_has_been_loaded | ( | const char * | name | ) |
Wrapper for has_been_loaded().
Checks whether map has been loaded.
name | path of the map to search. Can be NULL. |
Definition at line 790 of file plugin_common.c.
References CFAPI_PMAP, and cfapiMap_has_been_loaded.
Referenced by add_npc_to_random_map(), and getMapHasBeenLoaded().
object* cf_map_insert_object | ( | mapstruct * | where, |
object * | op, | ||
int | x, | ||
int | y | ||
) |
Wrapper for insert_ob_in_map_at().
Definition at line 1168 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiObject_insert.
Referenced by Map_CreateObject(), and Map_Insert().
object* cf_map_insert_object_there | ( | object * | op, |
mapstruct * | m, | ||
object * | originator, | ||
int | flag | ||
) |
Wrapper for insert_ob_in_map().
This function inserts the object in the two-way linked list which represents what is on a map.
It will update player count if the op is a player.
Player ground window will be updated if needed.
op | object to insert. Must be removed. Its coordinates must be valid for the map. |
m | map to insert into. Must not be NULL. |
originator | player, monster or other object that caused 'op' to be inserted into 'm'. May be NULL. |
flag | bitmask about special things to do (or not do) when this function is called. See the object.h file for the INS_xxx values. Passing 0 for flag gives proper default values, so flag really only needs to be set if special handling is needed. |
Definition at line 1154 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiObject_insert.
Referenced by runghosted().
void cf_map_message | ( | mapstruct * | m, |
const char * | msg, | ||
int | color | ||
) |
Partial wrapper for ext_info_map().
Definition at line 571 of file plugin_common.c.
References cfapiMap_message.
Referenced by Map_Message(), and runmessage().
object* cf_map_present_arch_by_name | ( | const char * | str, |
mapstruct * | map, | ||
int | nx, | ||
int | ny | ||
) |
Kinda wrapper for arch_present().
Definition at line 1188 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiMap_present_arch_by_name.
Referenced by Map_Check().
void cf_map_set_int_property | ( | mapstruct * | map, |
int | propcode, | ||
int | value | ||
) |
Definition at line 274 of file plugin_common.c.
References CFAPI_INT, and cfapiMap_set_property.
void cf_map_set_string_property | ( | mapstruct * | map, |
int | propcode, | ||
const char * | value | ||
) |
Definition at line 281 of file plugin_common.c.
References CFAPI_STRING, and cfapiMap_set_property.
Referenced by Map_SetPath().
void cf_map_trigger_connected | ( | objectlink * | ol, |
object * | cause, | ||
int | state | ||
) |
Wrapper for trigger_connected().
Trigger every object in an objectlink.
This was originally part of push_button but has been extracted to make it possible to trigger the connected object on a map from a plugin without requiring a source object. This method will take care of calling EVENT_TRIGGER of all elligible object in list (see state parameter)
ol | the objectlink to trigger. This can be acquire from map |
cause | the object that cause this path to trigger, may be NULL |
state | which object to apply. 0=all object with FLAG_ACTIVATE_ON_PUSH other=all object with FLAG_ACTIVATE_ON_RELEASE |
Definition at line 859 of file plugin_common.c.
References CFAPI_NONE, and cfapiMap_trigger_connected.
Referenced by Map_TriggerConnected().
int cf_object_apply | ( | object * | op, |
object * | tmp, | ||
int | aflag | ||
) |
Wrapper for manual_apply().
Main apply handler.
Checks for unpaid items before applying.
op | ::object causing tmp to be applied. |
tmp | ::object being applied. |
aflag | special (always apply/unapply) flags. Nothing is done with them in this function - they are passed to apply_special(). |
Definition at line 472 of file plugin_common.c.
References cfapiObject_apply.
Referenced by Crossfire_Object_Apply(), and runapplyobject().
void cf_object_apply_below | ( | object * | pl | ) |
Wrapper for player_apply_below().
Attempt to apply the object 'below' the player.
If the player has an open container, we use that for below, otherwise we use the ground.
pl | player. |
Definition at line 483 of file plugin_common.c.
References cfapiObject_apply_below.
Referenced by runapply().
int cf_object_cast_ability | ( | object * | caster, |
object * | ctoo, | ||
int | dir, | ||
object * | sp, | ||
char * | flags | ||
) |
Should there be a difference nowadays between that and cast_spell ?
Definition at line 636 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_cast.
Referenced by Crossfire_Object_CastAbility().
int cf_object_cast_spell | ( | object * | op, |
object * | caster, | ||
int | dir, | ||
object * | spell_ob, | ||
char * | stringarg | ||
) |
Wrapper for cast_spell().
Main dispatch when someone casts a spell.
Will decrease mana/gr points, check for skill, confusion and such.
Note that this function is really a dispatch routine that calls other functions - it just blindly returns what ever value those functions return. So if your writing a new function that is called from this, it should also return 1 on success, 0 on failure.
if it is a player casting the spell (op->type == PLAYER, op == caster), this function will decrease the mana/grace appropriately. For other objects, the caller should do what it considers appropriate.
op | creature that is owner of the object that is casting the spell - eg, the player or monster. |
caster | actual object (wand, potion) casting the spell. can be same as op. |
dir | direction to cast in. Note in some cases, if the spell is self only, dir really doesn't make a difference. |
spell_ob | spell object that is being cast. From that, we can determine what to do. * |
stringarg | any options that are being used. It can be NULL. Almost certainly, only players will set it. It is basically used as optional parameters to a spell (eg, item to create, information for marking runes, etc. |
Definition at line 624 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_cast.
Referenced by Crossfire_Object_Cast().
int cf_object_change_abil | ( | object * | op, |
object * | tmp | ||
) |
Wrapper for change_abil().
Permanently alters an object's stats/flags based on another object.
Definition at line 1488 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_change_abil.
Referenced by Crossfire_Object_ChangeAbil().
void cf_object_change_exp | ( | object * | op, |
sint64 | exp, | ||
const char * | skill_name, | ||
int | flag | ||
) |
Wrapper for change_exp().
Changes experience to a player/monster.
This does bounds checking to make sure we don't overflow the max exp.
The exp passed is typically not modified much by this function - it is assumed the caller has modified the exp as needed. skill_name is the skill that should get the exp added. flag is what to do if player doesn't have the skill. these last two values are only used for players.
op | victim to alter. |
exp | experience to gain (positive) or lose (negative). |
skill_name | skill to change. Can be NULL. |
flag |
|
Definition at line 448 of file plugin_common.c.
References CFAPI_NONE, and cfapiObject_change_exp.
Referenced by Crossfire_Object_AddExp().
object* cf_object_change_map | ( | object * | op, |
mapstruct * | m, | ||
object * | originator, | ||
int | flag, | ||
int | x, | ||
int | y | ||
) |
Wrapper for insert_ob_in_map_at().
Same as insert_ob_in_map() except it handle separate coordinates and do a clean job preparing multi-part monsters.
op | object to insert. |
m | map to insert into. |
originator | what caused op to be inserted. |
flag | Combination of INS_xxx values. |
x | |
y | coordinates to insert at. |
Definition at line 546 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiObject_transfer.
Referenced by Object_SetMap().
object* cf_object_check_for_spell | ( | object * | op, |
const char * | name | ||
) |
Wrapper for check_spell_known().
Checks to see if player knows the spell.
If the name is the same as an existing spell, we presume they know it.
op | object we're looking into. |
name | spell name. Doesn't need to be a shared string. |
Definition at line 670 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiObject_check_spell.
Referenced by Crossfire_Object_KnowSpell().
int cf_object_check_trigger | ( | object * | op, |
object * | cause | ||
) |
Wrapper for check_trigger().
cause == NULL: nothing has moved, we have been called from animate_trigger().
TRIGGER_ALTAR: Returns 1 if 'cause' was destroyed, 0 if not.
TRIGGER: Returns 1 if handle could be moved, 0 if not.
TRIGGER_BUTTON, TRIGGER_PEDESTAL: Returns 0.
.Definition at line 847 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_check_trigger.
Referenced by Crossfire_Object_CheckTrigger().
object* cf_object_clone | ( | object * | op, |
int | clonetype | ||
) |
Clone an object.
op | what to clone. |
clonetype |
|
Definition at line 587 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiObject_clone.
Referenced by runghosted().
void cf_object_drop | ( | object * | op, |
object * | author | ||
) |
Definition at line 874 of file plugin_common.c.
References cfapiObject_drop.
Referenced by Crossfire_Object_Drop(), and rundropobject().
void cf_object_forget_spell | ( | object * | op, |
object * | sp | ||
) |
Wrapper for do_forget_spell(), except takes an object, not a string.
Definition at line 660 of file plugin_common.c.
References cfapiObject_forget_spell.
Referenced by Crossfire_Object_ForgetSpell().
void cf_object_free | ( | object * | ob | ) |
Wrapper for free_object().
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
The IS_FREED() flag is set in the object. The object must have been removed by remove_ob() first for this function to succeed.
Inventory will be dropped on the ground if in a map, else freed too.
ob | object to free. Will become invalid when function returns. |
Definition at line 501 of file plugin_common.c.
References cfapiObject_delete.
Referenced by add_npc_to_point(), add_npc_to_zone(), Crossfire_Object_Remove(), eventListener(), and runghosted().
archetype* cf_object_get_archetype_property | ( | object * | op, |
int | propcode | ||
) |
Definition at line 391 of file plugin_common.c.
References CFAPI_PARCH, and cfapiObject_get_property.
Referenced by Object_GetArchetype().
double cf_object_get_double_property | ( | object * | op, |
int | propcode | ||
) |
Definition at line 407 of file plugin_common.c.
References CFAPI_DOUBLE, and cfapiObject_get_property.
Referenced by Object_GetExpMul().
int cf_object_get_flag | ( | object * | ob, |
int | flag | ||
) |
Definition at line 1116 of file plugin_common.c.
References CFAPI_OBJECT_PROP_FLAGS, and cfapiObject_get_property.
Referenced by cf_object_insert_in_ob(), Crossfire_Object_InsertInto(), Crossfire_Object_Remove(), Object_GetAlive(), Object_GetAnimated(), Object_GetApplied(), Object_GetBeenApplied(), Object_GetBlind(), Object_GetBlocksView(), Object_GetCanCastSpell(), Object_GetCanSeeInDark(), Object_GetCanSeeInvisible(), Object_GetCanUseArmour(), Object_GetCanUseBow(), Object_GetCanUseHorn(), Object_GetCanUseRing(), Object_GetCanUseRod(), Object_GetCanUseScroll(), Object_GetCanUseSkill(), Object_GetCanUseWand(), Object_GetCanUseWeapon(), Object_GetConfused(), Object_GetCursed(), Object_GetDamned(), Object_GetDM(), Object_GetFloor(), Object_GetFriendly(), Object_GetGenerator(), Object_GetGodGiven(), Object_GetHasXRays(), Object_GetHitBack(), Object_GetIdentified(), Object_GetKnownCursed(), Object_GetKnownMagical(), Object_GetLifesaver(), Object_GetMakeInvisible(), Object_GetMonster(), Object_GetNoDamage(), Object_GetOnlyAttack(), Object_GetPickable(), Object_GetRandomMovement(), Object_GetReflectMissiles(), Object_GetReflectSpells(), Object_GetRollable(), Object_GetRunAway(), Object_GetScared(), Object_GetSleeping(), Object_GetSplitting(), Object_GetStandStill(), Object_GetStealthy(), Object_GetThrown(), Object_GetTurnable(), Object_GetUnaggressive(), Object_GetUndead(), Object_GetUnique(), Object_GetUnpaid(), Object_GetUsedUp(), and Object_GetWasDM().
float cf_object_get_float_property | ( | object * | op, |
int | propcode | ||
) |
Definition at line 383 of file plugin_common.c.
References CFAPI_FLOAT, and cfapiObject_get_property.
Referenced by Object_GetMoveSlowPenalty(), Object_GetSpeed(), and Object_GetSpeedLeft().
sint64 cf_object_get_int64_property | ( | object * | op, |
int | propcode | ||
) |
Definition at line 356 of file plugin_common.c.
References CFAPI_SINT64, and cfapiObject_get_property.
Referenced by Object_GetExp(), and Object_GetPermExp().
int cf_object_get_int_property | ( | object * | op, |
int | propcode | ||
) |
Definition at line 311 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_get_property.
Referenced by is_suitable_exit(), Object_GetAC(), Object_GetAnim(), Object_GetAnimSpeed(), Object_GetAttackMovement(), Object_GetAttackType(), Object_GetCha(), Object_GetCon(), Object_GetCount(), Object_GetDam(), Object_GetDex(), Object_GetDirection(), Object_GetDuration(), Object_GetFace(), Object_GetFacing(), Object_GetFood(), Object_GetGlowRadius(), Object_GetGrace(), Object_GetHP(), Object_GetInt(), Object_GetInvisible(), Object_GetIsPet(), Object_GetLastEat(), Object_GetLastGrace(), Object_GetLastSP(), Object_GetLevel(), Object_GetLuck(), Object_GetMaxGrace(), Object_GetMaxHP(), Object_GetMaxSP(), Object_GetNoSave(), Object_GetPow(), Object_GetQuantity(), Object_GetSP(), Object_GetStr(), Object_GetSubtype(), Object_GetType(), Object_GetWC(), Object_GetWeight(), Object_GetWeightLimit(), Object_GetWis(), Object_GetX(), Object_GetY(), Player_GetBedX(), and Player_GetBedY().
const char* cf_object_get_key | ( | object * | op, |
const char * | keyname | ||
) |
Gets value for specified key, equivalent of get_ob_key_value().
op | ::object for which we search a key. |
keyname | key to look for. Not required to be a shared string. |
Definition at line 1454 of file plugin_common.c.
References CFAPI_SSTRING, and cfapiObject_get_key.
Referenced by Crossfire_Object_ReadKey(), and eventListener().
long cf_object_get_long_property | ( | object * | op, |
long | propcode | ||
) |
Definition at line 318 of file plugin_common.c.
References CFAPI_LONG, and cfapiObject_get_property.
Referenced by Object_GetValue().
mapstruct* cf_object_get_map_property | ( | object * | op, |
int | propcode | ||
) |
Definition at line 348 of file plugin_common.c.
References CFAPI_PMAP, and cfapiObject_get_property.
Referenced by Object_GetMap().
MoveType cf_object_get_movetype_property | ( | object * | op, |
int | propcode | ||
) |
Definition at line 332 of file plugin_common.c.
References CFAPI_MOVETYPE, and cfapiObject_get_property.
Referenced by Object_GetMoveAllow(), Object_GetMoveBlock(), Object_GetMoveOff(), Object_GetMoveOn(), Object_GetMoveSlow(), and Object_GetMoveType().
const char* cf_object_get_msg | ( | object * | ) |
Definition at line 1057 of file plugin_common.c.
References CFAPI_OBJECT_PROP_MESSAGE, CFAPI_SSTRING, and cfapiObject_get_property.
int cf_object_get_nrof | ( | object * | ) |
Definition at line 1109 of file plugin_common.c.
References CFAPI_OBJECT_PROP_NROF, and cfapiObject_get_property.
object* cf_object_get_object_property | ( | object * | op, |
int | propcode | ||
) |
Definition at line 340 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiObject_get_property.
Referenced by add_death(), eventListener(), getPlayers(), Object_GetAbove(), Object_GetBelow(), Object_GetEnemy(), Object_GetEnv(), Object_GetInventory(), and Object_GetOwner().
partylist* cf_object_get_partylist_property | ( | object * | op, |
int | propcode | ||
) |
Definition at line 399 of file plugin_common.c.
References CFAPI_PPARTY, and cfapiObject_get_property.
Referenced by cf_player_get_party().
sint16 cf_object_get_resistance | ( | object * | op, |
int | rtype | ||
) |
Definition at line 289 of file plugin_common.c.
References CFAPI_INT16, CFAPI_OBJECT_PROP_RESIST, and cfapiObject_get_property.
Referenced by Crossfire_Object_GetResist().
sstring cf_object_get_sstring_property | ( | object * | op, |
int | propcode | ||
) |
Definition at line 415 of file plugin_common.c.
References CFAPI_SSTRING, and cfapiObject_get_property.
Referenced by is_suitable_exit(), Object_GetArchName(), Object_GetGod(), Object_GetMessage(), Object_GetRace(), Object_GetSkill(), Object_GetSlaying(), and Object_GetTitle().
char* cf_object_get_string_property | ( | object * | op, |
int | propcode, | ||
char * | buf, | ||
int | size | ||
) |
Definition at line 423 of file plugin_common.c.
References CFAPI_STRING, and cfapiObject_get_property.
Referenced by Player_GetBedMap().
int cf_object_get_weight | ( | object * | ob | ) |
Definition at line 1080 of file plugin_common.c.
References CFAPI_INT, CFAPI_OBJECT_PROP_WEIGHT, and cfapiObject_get_property.
int cf_object_get_weight_limit | ( | object * | ob | ) |
Definition at line 1088 of file plugin_common.c.
References CFAPI_INT, CFAPI_OBJECT_PROP_WEIGHT_LIMIT, and cfapiObject_get_property.
object* cf_object_insert_in_ob | ( | object * | op, |
object * | where | ||
) |
Wrapper for insert_ob_in_ob().
This function inserts the object op in the linked list inside the object environment.
It will send to client where is a player.
op | object to insert. Must be removed and not NULL. Must not be multipart. May become invalid after return, so use return value of the function. |
where | object to insert into. Must not be NULL. Should be the head part. |
Definition at line 1137 of file plugin_common.c.
References cf_object_get_flag(), CFAPI_POBJECT, cfapiObject_insert, cfapiObject_remove, and FLAG_REMOVED.
Referenced by Crossfire_Object_InsertInto().
object* cf_object_insert_object | ( | object * | op, |
object * | container | ||
) |
Definition at line 887 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiObject_insert.
Referenced by Crossfire_Object_CreateInside(), eventListener(), and get_npc().
void cf_object_learn_spell | ( | object * | op, |
object * | spell, | ||
int | special_prayer | ||
) |
Wrapper for do_learn_spell().
Actually makes op learn spell.
Informs player of new spell and binding.
op | player who'll learn the spell. |
spell | spell to learn. |
special_prayer | 1 for god-given prayer, 0 else. |
Definition at line 648 of file plugin_common.c.
References CFAPI_NONE, and cfapiObject_learn_spell.
Referenced by Crossfire_Object_LearnSpell().
int cf_object_move | ( | object * | op, |
int | dir, | ||
object * | originator | ||
) |
Definition at line 461 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_move.
Referenced by Crossfire_Object_Move(), eventListener(), and runmovement().
int cf_object_move_to | ( | object * | op, |
int | x, | ||
int | y | ||
) |
Wrapper for move_to().
Move an object one square toward a specified destination on the same map.
The move takes into account blocked squares for op, and things like that. No check is done to know if the object has enough speed to move.
op | object to move |
x | |
y | destination coordinates |
Definition at line 534 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_transfer.
Referenced by runmoveto().
int cf_object_out_of_map | ( | object * | op, |
int | x, | ||
int | y | ||
) |
Definition at line 866 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_out_of_map.
Referenced by Crossfire_Object_GetOutOfMap().
int cf_object_pay_amount | ( | object * | pl, |
uint64 | to_pay | ||
) |
Wrapper for pay_for_amount().
Takes the amount of money from the the player inventory and from it's various pouches using the pay_from_container() function.
to_pay | amount to pay. |
pl | player paying. |
Definition at line 612 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_pay_amount.
Referenced by Crossfire_Object_PayAmount().
int cf_object_pay_item | ( | object * | op, |
object * | pl | ||
) |
Wrapper for pay_for_item().
DAMN: This is now a wrapper for pay_from_container, which is called for the player, then for each active container that can hold money until op is paid for.
Change will be left wherever the last of the price was paid from.
op | object to buy. |
pl | player buying. |
Definition at line 600 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_pay_item.
Referenced by Crossfire_Object_Pay().
void cf_object_pickup | ( | object * | op, |
object * | what | ||
) |
Definition at line 1251 of file plugin_common.c.
References CFAPI_NONE, and cfapiObject_pickup.
Referenced by Crossfire_Object_Take(), runpickup(), and runpickupobject().
object* cf_object_present_archname_inside | ( | object * | op, |
char * | whatstr | ||
) |
Kinda wrapper for present_arch_in_ob().
Definition at line 509 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiObject_find_archetype_inside.
Referenced by Crossfire_Object_CheckInventory().
int cf_object_query_cost | ( | const object * | tmp, |
object * | who, | ||
int | flag | ||
) |
Wrapper for query_cost().
Return the price of an item for a character.
Price will vary based on the shop's specialization ration, the player's approval rate, ...
Added F_TRUE flag to define.h to mean that the price should not be adjusted by players charisma. With F_TRUE, it returns the amount that the item is worth, if it was sold, but unadjusted by charisma. This is needed for alchemy, to to determine what value of gold nuggets should be given (the gold nuggets, when sold, will have the adjustment by charisma done at that time). NULL could have been passed as the who parameter, but then the adjustment for expensive items (>10000) would not be done.
Added F_APPROX flag, which means that the price returned should be wrong by an amount related to the player's bargaining skill.
Added F_SHOP flag to mean that the specialisation of the shop on the player's current map should be taken into account when determining the price. Shops that specialise in what is being traded will give better prices than those that do not.
CF 0.91.4 - This function got changed around a bit. Now the number of object is multiplied by the value early on. This fixes problems with items worth very little. What happened before is that various divisions took place, the value got rounded to 0 (Being an int), and thus remained 0.
Mark Wedel (mwedel@pyramid.com)
tmp | object we're querying the price of. |
who | who is inquiring. Can be NULL, only meaningful if player. |
flag | combination of F_xxx flags. |
Definition at line 824 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_query_cost.
Referenced by Crossfire_Object_QueryCost().
int cf_object_query_money | ( | const object * | op | ) |
Wrapper for query_money().
Finds out how much money the player is carrying, including what is in containers.
op | item to get money for. Must be a player or a container. |
Definition at line 812 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_query_money.
Referenced by Object_GetMoney().
void cf_object_remove | ( | object * | op | ) |
Wrapper for remove_ob().
This function removes the object op from the linked list of objects which it is currently tied to.
When this function is done, the object will have no environment. If the object previously had an environment, the x and y coordinates will be updated to the previous environment.
Will inform the client of the removal if needed.
op | object to remove. Must not be removed yet, else abort() is called. |
Definition at line 492 of file plugin_common.c.
References cfapiObject_remove.
Referenced by Crossfire_Object_InsertInto(), Crossfire_Object_Remove(), eventListener(), runghosted(), and start_animation().
void cf_object_say | ( | object * | op, |
char * | msg | ||
) |
Definition at line 880 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_say.
Referenced by Crossfire_Object_Say(), and runsay().
void cf_object_set_flag | ( | object * | ob, |
int | flag, | ||
int | value | ||
) |
Definition at line 1127 of file plugin_common.c.
References CFAPI_OBJECT_PROP_FLAGS, and cfapiObject_set_property.
Referenced by animate_one(), eventListener(), get_npc(), Object_SetAnimated(), Object_SetApplied(), Object_SetBlind(), Object_SetBlocksView(), Object_SetCanSeeInDark(), Object_SetCanSeeInvisible(), Object_SetConfused(), Object_SetCursed(), Object_SetDamned(), Object_SetFriendly(), Object_SetGodGiven(), Object_SetHasXRays(), Object_SetHitBack(), Object_SetIdentified(), Object_SetKnownCursed(), Object_SetKnownMagical(), Object_SetLifesaver(), Object_SetMakeInvisible(), Object_SetNoDamage(), Object_SetOnlyAttack(), Object_SetPickable(), Object_SetRandomMovement(), Object_SetReflectMissiles(), Object_SetReflectSpells(), Object_SetRollable(), Object_SetRunAway(), Object_SetScared(), Object_SetSleeping(), Object_SetStandStill(), Object_SetStealthy(), Object_SetTurnable(), Object_SetUnaggressive(), Object_SetUndead(), Object_SetUnique(), Object_SetUnpaid(), and Object_SetUsedUp().
void cf_object_set_float_property | ( | object * | op, |
int | propcode, | ||
float | value | ||
) |
Definition at line 371 of file plugin_common.c.
References CFAPI_FLOAT, and cfapiObject_set_property.
Referenced by Object_SetSpeed(), and Object_SetSpeedLeft().
void cf_object_set_int64_property | ( | object * | op, |
int | propcode, | ||
sint64 | value | ||
) |
Definition at line 377 of file plugin_common.c.
References CFAPI_SINT64, and cfapiObject_set_property.
Referenced by Object_SetExp().
void cf_object_set_int_property | ( | object * | op, |
int | propcode, | ||
int | value | ||
) |
Definition at line 305 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_set_property.
Referenced by Object_SetAC(), Object_SetAnim(), Object_SetAnimSpeed(), Object_SetAttackMovement(), Object_SetAttackType(), Object_SetCha(), Object_SetCon(), Object_SetDam(), Object_SetDex(), Object_SetDirection(), Object_SetDuration(), Object_SetFace(), Object_SetFacing(), Object_SetFood(), Object_SetGlowRadius(), Object_SetGrace(), Object_SetHP(), Object_SetInt(), Object_SetInvisible(), Object_SetIsPet(), Object_SetLastEat(), Object_SetLastGrace(), Object_SetLastSP(), Object_SetMaxGrace(), Object_SetMaxHP(), Object_SetMaxSP(), Object_SetPow(), Object_SetSP(), Object_SetStr(), Object_SetWC(), Object_SetWeight(), Object_SetWeightLimit(), Object_SetWis(), Player_SetBedX(), Player_SetBedY(), and runturn().
int cf_object_set_key | ( | object * | op, |
const char * | keyname, | ||
const char * | value, | ||
int | add_key | ||
) |
Sets a value for specified key, equivalent to set_ob_key_value().
op | ::object which will contain the key/value |
keyname | key |
value | value |
add_key | if 0, key is only updated if it exists, else it's updated or added. |
Definition at line 1476 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_set_key.
Referenced by Crossfire_Object_WriteKey(), eventListener(), and get_npc().
void cf_object_set_long_property | ( | object * | op, |
int | propcode, | ||
long | value | ||
) |
Definition at line 365 of file plugin_common.c.
References CFAPI_LONG, and cfapiObject_set_property.
Referenced by Object_SetNoSave(), and Object_SetValue().
void cf_object_set_movetype_property | ( | object * | op, |
int | propcode, | ||
MoveType | value | ||
) |
Definition at line 326 of file plugin_common.c.
References CFAPI_MOVETYPE, and cfapiObject_set_property.
int cf_object_set_nrof | ( | object * | ob, |
int | nrof | ||
) |
Definition at line 1099 of file plugin_common.c.
References CFAPI_OBJECT_PROP_NROF, and cfapiObject_set_property.
Referenced by Object_SetQuantity().
void cf_object_set_object_property | ( | object * | op, |
int | propcode, | ||
object * | value | ||
) |
Definition at line 437 of file plugin_common.c.
References CFAPI_POBJECT, and cfapiObject_set_property.
Referenced by Object_SetEnemy(), and Object_SetOwner().
void cf_object_set_resistance | ( | object * | op, |
int | rtype, | ||
sint16 | value | ||
) |
Definition at line 297 of file plugin_common.c.
References CFAPI_INT16, CFAPI_OBJECT_PROP_RESIST, and cfapiObject_set_property.
Referenced by Crossfire_Object_SetResist().
void cf_object_set_string_property | ( | object * | op, |
int | propcode, | ||
const char * | value | ||
) |
Definition at line 431 of file plugin_common.c.
References CFAPI_STRING, and cfapiObject_set_property.
Referenced by add_exit_to_item(), eventListener(), get_newspaper_content(), Object_SetGod(), Object_SetMessage(), Object_SetName(), Object_SetNamePl(), Object_SetRace(), Object_SetSkill(), Object_SetSlaying(), Object_SetTitle(), and Player_SetBedMap().
void cf_object_set_weight | ( | object * | ob, |
int | weight | ||
) |
Definition at line 1066 of file plugin_common.c.
References CFAPI_INT, CFAPI_OBJECT_PROP_WEIGHT, and cfapiObject_set_property.
void cf_object_set_weight_limit | ( | object * | ob, |
int | weight | ||
) |
Definition at line 1073 of file plugin_common.c.
References CFAPI_INT, CFAPI_OBJECT_PROP_WEIGHT_LIMIT, and cfapiObject_set_property.
int cf_object_teleport | ( | object * | ob, |
mapstruct * | map, | ||
int | x, | ||
int | y | ||
) |
Definition at line 1177 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_teleport.
Referenced by add_npc_to_point(), add_npc_to_zone(), Crossfire_Object_Teleport(), and runteleport().
int cf_object_transfer | ( | object * | op, |
int | x, | ||
int | y, | ||
int | randomly, | ||
object * | originator | ||
) |
Wrapper for transfer_ob().
Move an object (even linked objects) to another spot on the same map.
Does nothing if there is no free spot.
op | what to move. |
x | |
y | new coordinates. |
randomly | if true, use find_free_spot() to find the destination, otherwise use find_first_free_spot(). |
originator | what is causing op to move. |
1 | op was destroyed. |
0 | op was moved. |
Definition at line 522 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_transfer.
Referenced by Crossfire_Object_Reposition().
void cf_object_update | ( | object * | op, |
int | flags | ||
) |
Definition at line 1245 of file plugin_common.c.
References cfapiObject_update.
Referenced by animate_one().
int cf_object_user_event | ( | object * | op, |
object * | activator, | ||
object * | third, | ||
const char * | message, | ||
int | fix | ||
) |
Definition at line 238 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_user_event.
Referenced by Crossfire_Object_Event().
partylist* cf_party_get_first | ( | void | ) |
Get first party.
Definition at line 1600 of file plugin_common.c.
References CFAPI_PARTY_PROP_NEXT, CFAPI_PPARTY, and cfapiParty_get_property.
Referenced by getParties().
player* cf_party_get_first_player | ( | partylist * | party | ) |
Get first player in party.
party | party, mustn't be NULL. |
Definition at line 1663 of file plugin_common.c.
References CFAPI_PARTY_PROP_PLAYER, CFAPI_PPLAYER, and cfapiParty_get_property.
Referenced by Crossfire_Party_GetPlayers().
const char* cf_party_get_name | ( | partylist * | party | ) |
party | party, mustn't be NULL. |
Definition at line 1615 of file plugin_common.c.
References CFAPI_PARTY_PROP_NAME, CFAPI_SSTRING, and cfapiParty_get_property.
Referenced by Crossfire_Party_GetName().
partylist* cf_party_get_next | ( | partylist * | party | ) |
Get next party in party list.
party | party, can be NULL in which case behaves like cf_party_get_first(). |
Definition at line 1631 of file plugin_common.c.
References CFAPI_PARTY_PROP_NEXT, CFAPI_PPARTY, and cfapiParty_get_property.
Referenced by Crossfire_Party_GetNext(), and getParties().
player* cf_party_get_next_player | ( | partylist * | party, |
player * | op | ||
) |
Get next player in party.
party | party, mustn't be NULL. |
op | player we want the next of. Can be NULL, in this case behaves like cf_party_get_first_player(). |
Definition at line 1681 of file plugin_common.c.
References CFAPI_PARTY_PROP_PLAYER, CFAPI_PPLAYER, and cfapiParty_get_property.
Referenced by Crossfire_Party_GetPlayers().
const char* cf_party_get_password | ( | partylist * | party | ) |
Get party's password.
party | party, mustn't be NULL. |
Definition at line 1647 of file plugin_common.c.
References CFAPI_PARTY_PROP_PASSWORD, CFAPI_SSTRING, and cfapiParty_get_property.
Referenced by Crossfire_Party_GetPassword().
int cf_player_can_pay | ( | object * | pl | ) |
Wrapper for can_pay().
Checks all unpaid items in op's inventory, adds up all the money they have, and checks that they can actually afford what they want to buy.
Prints appropriate messages to the player.
pl | player trying to bug. |
1 | player could buy the items. |
0 | some items can't be bought. |
Definition at line 752 of file plugin_common.c.
References CFAPI_INT, and cfapiPlayer_can_pay.
Referenced by Crossfire_Player_CanPay().
player* cf_player_find | ( | const char * | plname | ) |
Wrapper for find_player_partial_name().
Find a player by a partial name.
plname | name to match. |
Definition at line 690 of file plugin_common.c.
References CFAPI_PPLAYER, and cfapiPlayer_find.
Referenced by findPlayer().
sstring cf_player_get_ip | ( | object * | op | ) |
Definition at line 714 of file plugin_common.c.
References CFAPI_PLAYER_PROP_IP, CFAPI_SSTRING, and cfapiObject_get_property.
Referenced by Player_GetIP().
object* cf_player_get_marked_item | ( | object * | op | ) |
Definition at line 723 of file plugin_common.c.
References CFAPI_PLAYER_PROP_MARKED_ITEM, CFAPI_POBJECT, and cfapiObject_get_property.
Referenced by Player_GetMarkedItem().
partylist* cf_player_get_party | ( | object * | op | ) |
Definition at line 738 of file plugin_common.c.
References cf_object_get_partylist_property(), and CFAPI_PLAYER_PROP_PARTY.
Referenced by Player_GetParty().
sstring cf_player_get_title | ( | object * | op | ) |
Definition at line 699 of file plugin_common.c.
References CFAPI_PLAYER_PROP_TITLE, CFAPI_SSTRING, and cfapiObject_get_property.
Referenced by Player_GetTitle().
void cf_player_message | ( | object * | op, |
char * | txt, | ||
int | flags | ||
) |
Definition at line 679 of file plugin_common.c.
References CFAPI_NONE, and cfapiPlayer_message.
Referenced by Crossfire_Player_Message(), and runnotice().
int cf_player_move | ( | player * | pl, |
int | dir | ||
) |
Definition at line 454 of file plugin_common.c.
References CFAPI_INT, and cfapiObject_move.
Referenced by runghosted(), and runmovement().
void cf_player_set_marked_item | ( | object * | op, |
object * | ob | ||
) |
Definition at line 732 of file plugin_common.c.
References CFAPI_PLAYER_PROP_MARKED_ITEM, and cfapiObject_set_property.
Referenced by Player_SetMarkedItem().
void cf_player_set_party | ( | object * | op, |
partylist * | party | ||
) |
Definition at line 742 of file plugin_common.c.
References CFAPI_PLAYER_PROP_PARTY, and cfapiObject_set_property.
Referenced by Player_SetParty().
void cf_player_set_title | ( | object * | op, |
const char * | title | ||
) |
Definition at line 708 of file plugin_common.c.
References CFAPI_PLAYER_PROP_TITLE, and cfapiObject_set_property.
Referenced by Player_SetTitle().
char* cf_query_base_name | ( | object * | ob, |
int | plural, | ||
char * | name, | ||
int | size | ||
) |
Definition at line 1049 of file plugin_common.c.
References CFAPI_OBJECT_PROP_BASE_NAME, CFAPI_STRING, and cfapiObject_get_property.
char* cf_query_name | ( | object * | ob, |
char * | name, | ||
int | size | ||
) |
Definition at line 1032 of file plugin_common.c.
References CFAPI_OBJECT_PROP_NAME, CFAPI_STRING, and cfapiObject_get_property.
Referenced by Crossfire_Object_QueryName(), and Object_GetName().
sstring cf_query_name_pl | ( | object * | ob | ) |
Definition at line 1040 of file plugin_common.c.
References CFAPI_OBJECT_PROP_NAME_PLURAL, CFAPI_SSTRING, and cfapiObject_get_property.
Referenced by Object_GetNamePl().
mapstruct* cf_random_map_generate | ( | const char * | OutFileName, |
RMParms * | RP, | ||
char ** | use_layout | ||
) |
Wrapper for generate_random_map().
Main random map routine.
Generates a random map based on specified parameters.
OutFileName | the path the map should have. |
RP | parameters for generation. |
use_layout | if not NULL, this should be a suitable layout. |
Definition at line 1302 of file plugin_common.c.
References CFAPI_PMAP, and cfapiGenerate_random_map.
int cf_random_map_set_variable | ( | RMParms * | rp, |
const char * | buf | ||
) |
Wrapper for set_random_map_variable().
Definition at line 1290 of file plugin_common.c.
References CFAPI_INT, and cfapiSet_random_map_variable.
const char* cf_re_cmp | ( | const char * | str, |
const char * | regexp | ||
) |
Wrapper for re_cmp().
re-cmp - get regular expression match.
str | string that will be matched against the regexp. |
regexp | regular expression. |
Definition at line 974 of file plugin_common.c.
References CFAPI_STRING, and cfapiSystem_re_cmp.
Referenced by matchString().
region* cf_region_get_first | ( | void | ) |
Get first region in region list.
Definition at line 1695 of file plugin_common.c.
References CFAPI_PREGION, CFAPI_REGION_PROP_NEXT, and cfapiRegion_get_property.
Referenced by getRegions().
const char* cf_region_get_longname | ( | region * | reg | ) |
Get longname of region.
reg | region. Mustn't be NULL. |
Definition at line 1759 of file plugin_common.c.
References CFAPI_REGION_PROP_LONGNAME, CFAPI_SSTRING, and cfapiRegion_get_property.
Referenced by Crossfire_Region_GetLongname().
const char* cf_region_get_message | ( | region * | reg | ) |
Get message of region.
reg | region. Mustn't be NULL. |
Definition at line 1775 of file plugin_common.c.
References CFAPI_REGION_PROP_MESSAGE, CFAPI_SSTRING, and cfapiRegion_get_property.
Referenced by Crossfire_Region_GetMessage().
const char* cf_region_get_name | ( | region * | reg | ) |
Get name of region.
reg | region. Mustn't be NULL. |
Definition at line 1711 of file plugin_common.c.
References CFAPI_REGION_PROP_NAME, CFAPI_SSTRING, and cfapiRegion_get_property.
Referenced by Crossfire_Region_GetName().
region* cf_region_get_next | ( | region * | reg | ) |
Get next region in region list.
reg | region. Can be NULL in which case equivalent of cf_region_get_first(). |
Definition at line 1727 of file plugin_common.c.
References CFAPI_PREGION, CFAPI_REGION_PROP_NEXT, and cfapiRegion_get_property.
Referenced by Crossfire_Region_GetNext(), and getRegions().
region* cf_region_get_parent | ( | region * | reg | ) |
Get parent of region.
reg | region. Mustn't be NULL. |
Definition at line 1743 of file plugin_common.c.
References CFAPI_PREGION, CFAPI_REGION_PROP_PARENT, and cfapiRegion_get_property.
Referenced by Crossfire_Region_GetParent().
void cf_spring_trap | ( | object * | trap, |
object * | victim | ||
) |
Wrapper for spring_trap().
This function generalizes attacks by runes/traps.
This ought to make it possible for runes to attack from the inventory, it'll spring the trap on the victim.
trap | trap that activates. |
victim | victim of the trap. |
Definition at line 836 of file plugin_common.c.
References cfapiObject_activate_rune.
Referenced by Crossfire_Object_ActivateRune().
char* cf_strdup_local | ( | const char * | str | ) |
Wrapper for strdup_local().
A replacement of strdup(), since it's not defined at some unix variants.
str | string to duplicate. |
Definition at line 1263 of file plugin_common.c.
References CFAPI_STRING, and cfapiSystem_strdup_local.
Referenced by initdropobject(), initnotice(), initsay(), initteleport(), registerCommand(), and start_animation().
void cf_system_register_global_event | ( | int | event, |
const char * | name, | ||
f_plug_api | hook | ||
) |
Definition at line 933 of file plugin_common.c.
References CFAPI_NONE, and cfapiSystem_register_global_event.
Referenced by postInitPlugin(), and registerGEvent().
void cf_system_unregister_global_event | ( | int | event, |
const char * | name | ||
) |
Definition at line 940 of file plugin_common.c.
References CFAPI_NONE, and cfapiSystem_unregister_global_event.
Referenced by unregisterGEvent().
int cf_timer_create | ( | object * | ob, |
long | delay, | ||
int | mode | ||
) |
Creates a timer, equivalent of calling cftimer_create().
ob | ::object that will get called. Should handle EVENT_TIMER. |
delay | delay, seconds or ticks. |
mode | timer mode, TIMER_MODE_SECONDS or TIMER_MODE_CYCLES |
Definition at line 1421 of file plugin_common.c.
References CFAPI_INT, and cfapiSystem_timer_create.
Referenced by Crossfire_Object_CreateTimer().
int cf_timer_destroy | ( | int | id | ) |
Destroys specified timer, equivalent of calling cftimer_destroy().
id | timer to destroy |
Definition at line 1437 of file plugin_common.c.
References CFAPI_INT, and cfapiSystem_timer_destroy.
Referenced by destroyTimer().