Crossfire Server, Trunk
|
#include "global.h"
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "living.h"
#include "loader.h"
#include "shop.h"
#include "skills.h"
#include "sproto.h"
Go to the source code of this file.
Data Structures | |
struct | matcher_params |
Typedefs | |
typedef int(* | item_matcher) (object *who, matcher_params *params, object *item) |
Enumerations | |
enum | ex_autoid_result { EX_ID_ABORT, EX_ID_NO_SKILL, EX_ID_FAILED } |
Functions | |
void | command_apply (object *op, const char *params) |
void | command_disarm (object *op, const char *params) |
void | command_drop (object *op, const char *params) |
void | command_dropall (object *op, const char *params) |
void | command_empty (object *op, const char *params) |
void | command_examine (object *op, const char *params) |
void | command_lock_item (object *op, const char *params) |
void | command_mark (object *op, const char *params) |
void | command_pickup (object *op, const char *params) |
void | command_rename_item (object *op, const char *params) |
void | command_rskill (object *pl, const char *params) |
void | command_search (object *op, const char *params) |
void | command_search_items (object *op, const char *params) |
void | command_take (object *op, const char *params) |
void | command_throw (object *op, const char *params) |
void | command_use (object *op, const char *params) |
void | command_uskill (object *pl, const char *params) |
static void | display_new_pickup (const object *op, int old) |
static void | do_skill_by_number (object *op, int skill_subtype, const char *params, const char *missing_message) |
void | drop (object *op, object *tmp) |
object * | drop_object (object *op, object *tmp, uint32_t nrof) |
static void | empty_container (object *container, object *pl) |
void | examine (object *op, object *tmp) |
ex_autoid_result | examine_autoidentify (object *op, object *tmp) |
bool | examine_fluff (object *op, object *tmp, bool output) |
void | examine_monster (object *op, object *tmp, int level) |
void | examine_rod_charge_level (object *op, object *tmp) |
void | examine_wand_charge_level (object *op, object *tmp) |
void | examine_weight_and_material (object *op, object *tmp) |
static object * | find_best_apply_object_match (object *start, object *pl, const char *params, int aflag) |
static object * | find_best_object_match (object *pl, const char *params) |
object * | find_marked_object (object *op) |
static int | get_pickup_mode_index (const char *name) |
void | inventory (object *op, object *inv) |
static item_matcher | make_matcher (object *who, const char *params, matcher_params *mp) |
static int | matcher_all (object *who, matcher_params *params, object *item) |
static int | matcher_name (object *who, matcher_params *params, object *item) |
static int | matcher_number (object *who, matcher_params *params, object *item) |
static int | matcher_pickup_type (object *who, matcher_params *params, object *item) |
int | object_matches_pickup_mode (const object *item, int mode) |
void | pick_up (object *op, object *alt) |
static void | pick_up_object (object *pl, object *op, object *tmp, int nrof) |
void | put_object_in_sack (object *op, object *sack, object *tmp, uint32_t nrof) |
int | sack_can_hold (const object *pl, const object *sack, const object *op, uint32_t nrof) |
static void | set_pickup_mode (const object *op, int i) |
Variables | |
static const uint32_t | pickup_modes [] |
static const char * | pickup_names [] |
Object commands, including picking/dropping, locking, etc.
Definition in file c_object.cpp.
typedef int(* item_matcher) (object *who, matcher_params *params, object *item) |
Prototype for a function checking if an object matches some parameters.
who | object wanting to match another object. |
params | what to match against. |
item | object to check for a match. |
Definition at line 731 of file c_object.cpp.
enum ex_autoid_result |
Enumerator | |
---|---|
EX_ID_ABORT | |
EX_ID_NO_SKILL | |
EX_ID_FAILED |
Definition at line 1693 of file c_object.cpp.
void command_apply | ( | object * | op, |
const char * | params | ||
) |
'apply' command.
op | player. |
params | what to apply. |
Definition at line 251 of file c_object.cpp.
References AP_APPLY, AP_NULL, AP_OPEN, AP_UNAPPLY, apply_by_living(), apply_by_living_below(), draw_ext_info_format(), find_best_apply_object_match(), commongive::inv, say::item, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, give::op, and roll-o-matic::params.
Referenced by commands_init().
void command_disarm | ( | object * | op, |
const char * | params | ||
) |
'disarm' command.
op | player. |
params | unused. |
Definition at line 224 of file c_object.cpp.
References do_skill_by_number(), give::op, roll-o-matic::params, and SK_DISARM_TRAPS.
Referenced by commands_init().
void command_drop | ( | object * | op, |
const char * | params | ||
) |
'drop' command.
op | player. |
params | what to drop. |
Definition at line 1354 of file c_object.cpp.
References CLEAR_FLAG, draw_ext_info(), draw_ext_info_format(), drop(), esrv_update_item(), fix_object(), FLAG_INV_LOCKED, FLAG_NO_DROP, FLAG_NO_FIX_PLAYER, FOR_INV_FINISH, FOR_INV_PREPARE, make_matcher(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, give::op, roll-o-matic::params, PLAYER, QUERY_FLAG, SET_FLAG, Ice::tmp, and UPD_WEIGHT.
Referenced by commands_init(), and do_test().
void command_dropall | ( | object * | op, |
const char * | params | ||
) |
Command to drop all items that have not been locked.
op | player. |
params | optional specifier, like 'armour', 'weapon' and such. |
Definition at line 1230 of file c_object.cpp.
References AMULET, ARMOUR, ARMOUR_IMPROVER, ARROW, BOOK, BOOTS, BOW, BRACERS, CLEAR_FLAG, CLOAK, CONTAINER, disinfect::count, draw_ext_info(), DRINK, drop(), esrv_update_item(), fix_object(), FLAG_APPLIED, FLAG_INV_LOCKED, FLAG_NO_FIX_PLAYER, FLESH, FOOD, FOR_INV_FINISH, FOR_INV_PREPARE, GEM, GIRDLE, GLOVES, HELMET, KEY, MONEY, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, give::op, roll-o-matic::params, PLAYER, POTION, QUERY_FLAG, RING, ROD, SCROLL, SET_FLAG, SHIELD, SPECIAL_KEY, SPELLBOOK, UPD_WEIGHT, WAND, WEAPON, and WEAPON_IMPROVER.
Referenced by commands_init().
void command_empty | ( | object * | op, |
const char * | params | ||
) |
'empty' command.
op | player. |
params | item specifier. |
Definition at line 1450 of file c_object.cpp.
References CONTAINER, draw_ext_info(), empty_container(), find_best_object_match(), FOR_INV_FINISH, FOR_INV_PREPARE, commongive::inv, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, give::op, roll-o-matic::params, and object::type.
Referenced by commands_init().
void command_examine | ( | object * | op, |
const char * | params | ||
) |
'examine' command.
op | player. |
params | optional item specifier. |
Definition at line 1489 of file c_object.cpp.
References draw_ext_info_format(), examine(), find_best_object_match(), FOR_BELOW_FINISH, FOR_BELOW_PREPARE, LOOK_OBJ, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, give::op, roll-o-matic::params, and Ice::tmp.
Referenced by commands_init().
void command_lock_item | ( | object * | op, |
const char * | params | ||
) |
Alternate way to lock/unlock items (command line).
op | player |
params | sent command line. |
Definition at line 2710 of file c_object.cpp.
References CLEAR_FLAG, draw_ext_info(), draw_ext_info_format(), esrv_update_item(), find_best_object_match(), FLAG_INV_LOCKED, HUGE_BUF, say::item, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_FAILURE, give::name, NDI_UNIQUE, object_merge(), give::op, roll-o-matic::params, QUERY_FLAG, query_short_name(), SET_FLAG, Ice::tmp, and UPD_FLAGS.
Referenced by commands_init().
void command_mark | ( | object * | op, |
const char * | params | ||
) |
'mark' command, to mark an item for some effects (enchant armor, ...).
op | player. |
params | If empty, we print out the currently marked object. Otherwise, try to find a matching object - try best match first. |
Definition at line 1567 of file c_object.cpp.
References object::count, draw_ext_info(), draw_ext_info_format(), find_best_object_match(), find_marked_object(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, give::name, NDI_UNIQUE, give::op, roll-o-matic::params, and query_name().
Referenced by commands_init().
void command_pickup | ( | object * | op, |
const char * | params | ||
) |
'pickup' command.
op | player. |
params | pickup mode. Can be empty to display the current mode. |
Definition at line 2361 of file c_object.cpp.
References display_new_pickup(), draw_ext_info(), draw_ext_info_format(), get_pickup_mode_index(), npc_dialog::index, llevDebug, LOG(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, give::op, roll-o-matic::params, pickup_modes, PU_NEWMODE, and set_pickup_mode().
Referenced by commands_init().
void command_rename_item | ( | object * | op, |
const char * | params | ||
) |
Changing the custom name of an item
Syntax is: rename <what object> to <new name>
Names are considered for all purpose having a length <=127 (max length sent to client by server).
op | player. |
params | how to rename. |
Definition at line 2524 of file c_object.cpp.
References buf, CUSTOM_NAME_FIELD, draw_ext_info(), draw_ext_info_format(), esrv_update_item(), find_best_object_match(), find_marked_object(), FOR_INV_FINISH, FOR_INV_PREPARE, commongive::inv, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, give::name, NDI_UNIQUE, object_get_value(), object_merge(), object_set_value(), give::op, roll-o-matic::params, query_base_name(), sstring, Ice::tmp, UPD_NAME, and VERY_BIG_BUF.
Referenced by commands_init().
void command_rskill | ( | object * | pl, |
const char * | params | ||
) |
'ready_skill' command.
pl | player. |
params | skill name. |
Definition at line 161 of file c_object.cpp.
References change_skill(), draw_ext_info(), draw_ext_info_format(), find_skill_by_name(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_SKILL, MSG_TYPE_SKILL_MISSING, NDI_UNIQUE, roll-o-matic::params, and altar_valkyrie::pl.
Referenced by commands_init().
void command_search | ( | object * | op, |
const char * | params | ||
) |
'search' command.
op | player. |
params | unused. |
Definition at line 212 of file c_object.cpp.
References do_skill_by_number(), give::op, roll-o-matic::params, and SK_FIND_TRAPS.
Referenced by commands_init().
void command_search_items | ( | object * | op, |
const char * | params | ||
) |
'search-items' command.
op | player. |
params | options. |
Definition at line 2479 of file c_object.cpp.
References draw_ext_info(), draw_ext_info_format(), FALSE, fix_object(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, give::op, roll-o-matic::params, Settings::search_items, and settings.
Referenced by commands_init(), and kill_player_not_permadeath().
void command_take | ( | object * | op, |
const char * | params | ||
) |
This takes (picks up) an item.
op | player who issued the command. |
params | string to match against the item name. |
Definition at line 845 of file c_object.cpp.
References CLEAR_FLAG, draw_ext_info(), draw_ext_info_format(), esrv_update_item(), fix_object(), FLAG_NO_FIX_PLAYER, FOR_BELOW_FINISH, FOR_BELOW_PREPARE, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, is_valid_types_gen::found, make_matcher(), matcher_params::missed, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_FAILURE, NDI_UNIQUE, give::op, roll-o-matic::params, pick_up(), PLAYER, SET_FLAG, Ice::tmp, and UPD_WEIGHT.
Referenced by commands_init(), do_test(), and knowledge_alchemy_attempt().
void command_throw | ( | object * | op, |
const char * | params | ||
) |
'throw' command.
A little special because we do want to pass the full params along as it includes the object to throw.
op | player. |
params | what to throw. |
Definition at line 239 of file c_object.cpp.
References do_skill_by_number(), give::op, roll-o-matic::params, and SK_THROWING.
Referenced by commands_init().
void command_use | ( | object * | op, |
const char * | params | ||
) |
Try to use an item on another. Items are checked for key/values matching.
op | player. |
params | sent string, with all parameters. |
Definition at line 2753 of file c_object.cpp.
References object::arch, recipe::arch_name, create_archetype(), draw_ext_info(), draw_ext_info_format(), find_best_object_match(), find_recipe_for_tool(), recipe::ingred, recipe::ingred_count, IS_PLAYER(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_FAILURE, linked_char::name, object::name, archetype::name, NDI_UNIQUE, object::nrof, object_decrease_nrof_by_one, object_insert_in_ob(), give::op, roll-o-matic::params, strlcpy(), and recipe::yield.
Referenced by commands_init().
void command_uskill | ( | object * | pl, |
const char * | params | ||
) |
'use_skill' command.
pl | player. |
params | skill to use, and optional parameters. |
Definition at line 144 of file c_object.cpp.
References draw_ext_info(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, roll-o-matic::params, altar_valkyrie::pl, and use_skill().
Referenced by commands_init().
|
static |
Utility function to display the pickup mode for a player.
op | must be a player. |
old | previous pickup mode. |
Definition at line 2232 of file c_object.cpp.
References draw_ext_info(), draw_ext_info_format(), esrv_send_pickup(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO, NDI_UNIQUE, give::op, PU_ARMOUR, PU_ARROW, PU_BOOTS, PU_BOW, PU_CLOAK, PU_CONTAINER, PU_CURSED, PU_DEBUG, PU_DRINK, PU_FLESH, PU_FOOD, PU_GLOVES, PU_HELMET, PU_INHIBIT, PU_JEWELS, PU_KEY, PU_MAGIC_DEVICE, PU_MAGICAL, PU_MELEEWEAPON, PU_MISSILEWEAPON, PU_NEWMODE, PU_NOT_CURSED, PU_POTION, PU_RATIO, PU_READABLES, PU_SHIELD, PU_SKILLSCROLL, PU_SPELLBOOK, PU_STOP, and PU_VALUABLES.
Referenced by command_pickup().
|
static |
Attempt to use a skill from its subtype. If multiple skills share the same, the first found is used.
op | who is applying a skill. |
skill_subtype | skill subtype. |
params | additional parameters to the skill. |
missing_message | message to display if op doesn't know the skill. |
Definition at line 188 of file c_object.cpp.
References do_skill(), draw_ext_info(), find_skill_by_number(), MSG_TYPE_SKILL, MSG_TYPE_SKILL_MISSING, NDI_UNIQUE, give::op, and roll-o-matic::params.
Referenced by command_disarm(), command_search(), and command_throw().
Drop an item, either on the floor or in a container.
op | who is dropping an item. |
tmp | what object to drop. |
Definition at line 1168 of file c_object.cpp.
References draw_ext_info(), drop_object(), FLAG_INV_LOCKED, FLAG_NO_DROP, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, object_free_drop_inventory(), object_remove(), give::op, PLAYER, put_object_in_sack(), QUERY_FLAG, and Ice::tmp.
Referenced by apply_handle_yield(), cfapi_object_drop(), command_drop(), command_dropall(), and empty_container().
Try to drop an object on the floor.
This function was part of drop, now is own function.
op | who is dropping the item. |
tmp | item to drop. |
nrof | if is non zero, then nrof objects is tried to be dropped. |
Definition at line 1073 of file c_object.cpp.
References AP_NO_MERGE, AP_UNAPPLY, apply_special(), draw_ext_info(), draw_ext_info_format(), esrv_update_item(), EVENT_DROP, events_execute_object_event(), fix_object(), FLAG_APPLIED, FLAG_NO_DROP, FLAG_NO_FIX_PLAYER, FLAG_REMOVED, FLAG_STARTEQUIP, FLAG_UNPAID, INS_BELOW_ORIGINATOR, MAX_BUF, MONEY, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, give::name, NDI_UNIQUE, object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), object_split(), object_was_destroyed, give::op, PLAYER, QUERY_FLAG, query_name(), save_player(), SCRIPT_FIX_ALL, sell_item(), shop_contains(), Ice::tmp, and UPD_WEIGHT.
Referenced by drop(), esrv_move_object(), and transport_type_apply().
Put all contents of the container on the ground below the player or in opened container, except locked items.
container | what to empty. |
pl | player to drop for. |
Definition at line 1412 of file c_object.cpp.
References draw_ext_info_format(), drop(), esrv_update_item(), FLAG_INV_LOCKED, FOR_INV_FINISH, FOR_INV_PREPARE, commongive::inv, object::inv, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_SUCCESS, give::name, NDI_UNIQUE, give::next, altar_valkyrie::pl, QUERY_FLAG, query_name(), and UPD_WEIGHT.
Referenced by command_empty().
Player examines some object. The item may be identified automatically if the player has the correct skill for that.
op | player. |
tmp | object to examine. |
Definition at line 1985 of file c_object.cpp.
References body_locations, BOOK, buf, CLOSE_CON, CONTAINER, cost_approx_str(), cost_str(), CUSTOM_NAME_FIELD, draw_ext_info(), draw_ext_info_format(), EX_ID_ABORT, EX_ID_FAILED, EX_ID_NO_SKILL, examine_autoidentify(), examine_fluff(), examine_monster(), examine_rod_charge_level(), examine_wand_charge_level(), examine_weight_and_material(), FLAG_IS_BUILDABLE, FLAG_IS_LINKED, FLAG_MONSTER, FLAG_NO_PICK, FLAG_STARTEQUIP, FLAG_UNPAID, FOR_INV_FINISH, FOR_INV_PREPARE, FORCE, get_button_value(), is_identified(), knowledge_item_can_be_used_alchemy(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, NDI_UNIQUE, body_locations_struct::nonuse_name, NUM_BODY_LOCATIONS, ob_describe(), object_get_value(), give::op, castle_read::prefix, QUERY_FLAG, ROD, shop_contains(), shop_price_buy(), shop_price_sell(), sstring, Ice::tmp, body_locations_struct::use_name, autojail::value, VERY_BIG_BUF, and WAND.
Referenced by command_examine(), examine_cmd(), and knowledge_alchemy_attempt().
ex_autoid_result examine_autoidentify | ( | object * | op, |
object * | tmp | ||
) |
When the player examines an unidentified object, try to ID it if they have the requisite skills.
op | player. |
tmp | object to examine. |
Definition at line 1710 of file c_object.cpp.
References change_exp(), CLEAR_FLAG, detect_curse_on_item(), detect_magic_on_item(), draw_ext_info_format(), EX_ID_ABORT, EX_ID_FAILED, EX_ID_NO_SKILL, find_skill_by_number(), FLAG_IS_CAULDRON, FLAG_NO_SKILL_IDENT, get_typedata(), identify_object_with_skill(), typedata::identifyskill, typedata::identifyskill2, llevError, LOG(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, NDI_UNIQUE, object_can_pick(), give::op, QUERY_FLAG, SK_DET_CURSE, SK_DET_MAGIC, SK_SUBTRACT_SKILL_EXP, object::skill, and Ice::tmp.
Referenced by examine().
Emit the "fluff", the non-mechanical flavour text, for a given item. For most items this does nothing, but if it has a msg, that will be output, and if it contains an embedded spell or skill with a msg, it'll show that too.
op | player. |
tmp | object to examine. |
output | if true, output the text. If false, only return true/false indicating whether text would have been output. |
Definition at line 1873 of file c_object.cpp.
References archetype::clone, draw_ext_info(), draw_ext_info_format(), get_archetype_by_skill_name(), is_identifiable_type(), is_identified(), navar-midane_pickup::msg, object::msg, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, MSG_TYPE_SPELL, MSG_TYPE_SPELL_INFO, NDI_BLUE, NDI_GOLD, NDI_UNIQUE, give::op, POTION, ROD, SCROLL, SKILL, SKILL_TOOL, SKILLSCROLL, SPELLBOOK, stringbuffer_append_string(), stringbuffer_finish(), stringbuffer_new(), stringbuffer_trim_whitespace(), Ice::tmp, and WAND.
Referenced by examine().
Player examine a monster.
op | player. |
tmp | monster being examined. |
level | level of the probe, to have a persistant marker for some duration. |
Definition at line 1614 of file c_object.cpp.
References add_string(), AT_ACID, object::attacktype, create_archetype(), draw_ext_info(), fix_object(), FLAG_APPLIED, FLAG_PROBE, FLAG_UNDEAD, FORCE, FORCE_NAME, free_string(), HEAD, living::hp, knowledge_add_probe_monster(), object::level, level, living::maxhp, mon, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, NDI_UNIQUE, object_find_by_type_and_name(), object_insert_in_ob(), object_present_in_ob(), give::op, POISONING, probe(), QUERY_FLAG, SET_FLAG, object::stats, and Ice::tmp.
Referenced by examine(), and probe().
Output charge information for a rod.
op | player. |
tmp | object to examine. |
Definition at line 1841 of file c_object.cpp.
References draw_ext_info(), is_identified(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, NDI_UNIQUE, give::op, SP_level_spellpoint_cost(), SPELL_HIGHEST, and Ice::tmp.
Referenced by examine().
Output charge information for a wand or staff.
op | player. |
tmp | object to examine. |
Definition at line 1812 of file c_object.cpp.
References draw_ext_info(), is_identified(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, NDI_UNIQUE, give::op, and Ice::tmp.
Referenced by examine().
Output weight and material information for an examined object.
op | player. |
tmp | object to examine. |
Definition at line 1786 of file c_object.cpp.
References draw_ext_info_format(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, NDI_UNIQUE, give::op, altar_valkyrie::pl, and Ice::tmp.
Referenced by examine().
|
static |
Search from start and through below for what matches best with params. we use object_matches_string above - this gives us consistent behaviour between many commands. Return the best match, or NULL if no match.
start | first object to start searching at. |
pl | what object we're searching for. |
params | what to search for. |
aflag | Either 0 or AP_APPLY or AP_UNAPPLY. Used with apply -u, and apply -a to only unapply applied, or apply unapplied objects. |
Definition at line 101 of file c_object.cpp.
References AP_APPLY, AP_UNAPPLY, FLAG_APPLIED, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, object_matches_string(), roll-o-matic::params, altar_valkyrie::pl, player_can_find(), QUERY_FLAG, and Ice::tmp.
Referenced by command_apply(), and find_best_object_match().
Shortcut to find_best_apply_object_match(pl->inv, pl, params, AF_NULL);
pl | who to search an item for. |
params | what to search for. |
Definition at line 132 of file c_object.cpp.
References AP_NULL, find_best_apply_object_match(), roll-o-matic::params, and altar_valkyrie::pl.
Referenced by command_empty(), command_examine(), command_lock_item(), command_mark(), command_rename_item(), and command_use().
Return the object the player has marked with the 'mark' command below. If no match is found (or object has changed), we return NULL. We leave it up to the calling function to print messages if nothing is found.
op | object. Should be a player. |
Definition at line 1520 of file c_object.cpp.
References give::op.
Referenced by animate_weapon(), apply_map_builder(), armour_improver_type_apply(), cast_item_curse_or_bless(), cfapi_object_get_property(), command_mark(), command_rename_item(), find_throw_ob(), identify_altar_type_move_on(), lightable_type_apply(), lighter_type_apply(), recharge(), weapon_improver_type_apply(), and write_on_item().
|
static |
Return the pickup index in pickup_names and pickup_modes associated with the specified name. The name may be the start of a mode if no ambiguity exists, that is 'me' means 'melee', but 'm' will not match anything.
name | mode to get the index of. |
Definition at line 58 of file c_object.cpp.
References give::name, and pickup_names.
Referenced by command_pickup(), and make_matcher().
Prints object's inventory.
op | who to print for. |
inv | if NULL then print op's inventory, else print the inventory of inv. |
Definition at line 2167 of file c_object.cpp.
References CONTAINER, draw_ext_info(), draw_ext_info_format(), FLAG_APPLIED, FLAG_WIZ, FOR_INV_FINISH, FOR_INV_PREPARE, commongive::inv, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_INVENTORY, give::name, NDI_UNIQUE, give::op, QUERY_FLAG, query_name(), query_weight(), and Ice::tmp.
Referenced by command_inventory(), and look_at().
|
static |
Parse parameters and sets up an item matcher based on them.
who | object wanting to match another object. | |
params | matching parameters. | |
[out] | mp | parsed parameters. |
Definition at line 806 of file c_object.cpp.
References draw_ext_info_format(), get_pickup_mode_index(), matcher_params::item_must_be_pickable, matcher_params::item_to_pick, matcher_all(), matcher_name(), matcher_number(), matcher_pickup_type(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, matcher_params::name, NDI_UNIQUE, roll-o-matic::params, pickup_modes, matcher_params::pickup_type, and autojail::who.
Referenced by command_drop(), and command_take().
|
static |
Function allowing all objects.
who | unused. |
params | unused. |
item | unused. |
Definition at line 740 of file c_object.cpp.
References roll-o-matic::params, nlohmann::detail::void(), and autojail::who.
Referenced by make_matcher().
|
static |
Check if an item matches a string.
who | object wanting to match another object. |
params | what to match against. |
item | object to check for a match. |
Definition at line 774 of file c_object.cpp.
References FLAG_IS_FLOOR, object_can_pick(), object_matches_string(), roll-o-matic::params, QUERY_FLAG, and autojail::who.
Referenced by make_matcher().
|
static |
Check if an item is the one at the desired position.
who | unused. |
params | what to match against. |
item | unused. |
Definition at line 754 of file c_object.cpp.
References object_can_pick(), roll-o-matic::params, and autojail::who.
Referenced by make_matcher().
|
static |
Check if an item matches a pickup type.
who | object wanting to match another object. |
params | what to match against. |
item | object to check for a match. |
Definition at line 794 of file c_object.cpp.
References object_matches_pickup_mode(), roll-o-matic::params, nlohmann::detail::void(), and autojail::who.
Referenced by make_matcher().
int object_matches_pickup_mode | ( | const object * | item, |
int | mode | ||
) |
Checks if an item matches a specific pickup mode.
item | item to check. |
mode | one value of Pickup modes, not a combination of modes. |
Definition at line 656 of file c_object.cpp.
References AMULET, ARMOUR, ARMOUR_IMPROVER, ARROW, BOOK, BOOTS, BOW, CLOAK, CONTAINER, DRINK, FLAG_IS_THROWN, FLAG_KNOWN_CURSED, FLAG_KNOWN_MAGICAL, FLESH, FOOD, GEM, GLOVES, HELMET, KEY, MONEY, POISON, POTION, PU_ARMOUR, PU_ARROW, PU_BOOTS, PU_BOW, PU_CLOAK, PU_CONTAINER, PU_CURSED, PU_DRINK, PU_FLESH, PU_FOOD, PU_GLOVES, PU_HELMET, PU_JEWELS, PU_KEY, PU_MAGIC_DEVICE, PU_MAGICAL, PU_MELEEWEAPON, PU_MISSILEWEAPON, PU_POTION, PU_READABLES, PU_SHIELD, PU_SKILLSCROLL, PU_SPELLBOOK, PU_VALUABLES, QUERY_FLAG, RING, ROD, SCROLL, SHIELD, SKILL_TOOL, SKILLSCROLL, SPECIAL_KEY, SPELLBOOK, WAND, WEAPON, and WEAPON_IMPROVER.
Referenced by check_pick(), and matcher_pickup_type().
Try to pick up an item.
op | object trying to pick up. |
alt | optional object op is trying to pick. If NULL, try to pick first item under op. |
Definition at line 519 of file c_object.cpp.
References CONTAINER, disinfect::count, draw_ext_info(), draw_ext_info_format(), FLAG_APPLIED, FLAG_STARTEQUIP, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, INS_NO_MERGE, llevDebug, LOG(), MIMIC, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, object::name, NDI_UNIQUE, object_can_pick(), object_insert_in_map(), give::op, pick_up_object(), PLAYER, QUERY_FLAG, object::race, sack_can_hold(), stop_item(), Ice::tmp, and object::type.
Referenced by attempt_steal(), cast_create_missile(), cfapi_object_pickup(), check_pick(), command_take(), and esrv_move_object().
Try to pick up some item.
pl | object (player or monster) picking up. |
op | object to put tmp into. |
tmp | object to pick up. |
nrof | number of tmp to pick up (0 means all of them). |
Definition at line 379 of file c_object.cpp.
References buf, cost_str(), draw_ext_info(), env, esrv_update_item(), EVENT_PICKUP, events_execute_object_event(), FALSE, fix_object(), FLAG_FREED, FLAG_NO_DROP, FLAG_REMOVED, FLAG_UNPAID, FLAG_WAS_WIZ, FLAG_WIZ, get_weight_limit(), HUGE_BUF, disinfect::map, MAX_BUF, Settings::max_stat, MIN, MOVE_FLYING, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_FAILURE, MSG_TYPE_COMMAND_SUCCESS, give::name, NDI_UNIQUE, NROF(), object_free_drop_inventory(), object_get_player_container(), object_insert_in_map_at(), object_insert_in_ob(), object_remove(), object_split(), give::op, altar_valkyrie::pl, PLAYER, QUERY_FLAG, query_name(), Settings::real_wiz, SCRIPT_FIX_ALL, SET_FLAG, settings, shop_price_buy(), CFweardisguise::tag, Ice::tmp, UPD_WEIGHT, autojail::value, diamondslots::x, and diamondslots::y.
Referenced by pick_up().
Something tries to put an object into another.
This function was part of drop(), now is own function.
op | who is moving the item. |
sack | where to put the object. |
tmp | what to put into sack. |
nrof | if non zero, then nrof objects is tried to put into sack, else everything is put. |
Definition at line 937 of file c_object.cpp.
References AP_NO_MERGE, AP_UNAPPLY, apply_special(), CLEAR_FLAG, CONTAINER, draw_ext_info(), draw_ext_info_format(), object::env, esrv_update_item(), fix_object(), FLAG_APPLIED, FLAG_NO_FIX_PLAYER, FLAG_STARTEQUIP, FOR_INV_FINISH, FOR_INV_PREPARE, object::map, MAX_BUF, object::move_off, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_FAILURE, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, object::nrof, object_insert_in_map_at(), object_insert_in_ob(), object_remove(), object_split(), give::op, PLAYER, QUERY_FLAG, query_name(), sack_can_hold(), set_object_face_main(), Ice::tmp, TRANSPORT, transport_can_hold(), object::type, UPD_WEIGHT, object::x, and object::y.
Referenced by drop(), esrv_move_object(), knowledge_alchemy_attempt(), and START_TEST().
Check if an item op can be put into a sack. If pl exists then tell a player the reason of failure.
pl | player. |
sack | container to try to put into. |
op | what to put in the sack. |
nrof | number of objects (op) we want to put in. We specify it separately instead of using op->nrof because often times, a player may have specified a certain number of objects to drop, so we can pass that number, and not need to use split_ob() and stuff. |
Definition at line 317 of file c_object.cpp.
References object::carrying, CONTAINER, draw_ext_info_format(), FLAG_APPLIED, living::food, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, give::name, NDI_UNIQUE, give::op, altar_valkyrie::pl, QUERY_FLAG, query_name(), object::race, object::slaying, SPECIAL_KEY, object::stats, living::Str, and object::weight_limit.
Referenced by esrv_move_object(), pick_up(), and put_object_in_sack().
|
static |
Sets the 'old' pickup mode.
op | player. |
i | new pickup mode. |
Definition at line 2426 of file c_object.cpp.
References draw_ext_info(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, and give::op.
Referenced by command_pickup().
|
static |
Value in Pickup modes associated with pickup_names.
Definition at line 43 of file c_object.cpp.
Referenced by command_pickup(), and make_matcher().
|
static |
Valid names for pickup types.
Definition at line 33 of file c_object.cpp.
Referenced by get_pickup_mode_index().