Crossfire Server, Trunk
R22010
|
#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) |
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) |
void | examine_monster (object *op, object *tmp, int level) |
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.c.
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 719 of file c_object.c.
void command_apply | ( | object * | op, |
const char * | params | ||
) |
'apply' command.
op | player. |
params | what to apply. |
Definition at line 250 of file c_object.c.
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(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, and NDI_UNIQUE.
void command_disarm | ( | object * | op, |
const char * | params | ||
) |
'disarm' command.
op | player. |
params | unused. |
Definition at line 223 of file c_object.c.
References do_skill_by_number(), and SK_DISARM_TRAPS.
void command_drop | ( | object * | op, |
const char * | params | ||
) |
'drop' command.
op | player. |
params | what to drop. |
Definition at line 1342 of file c_object.c.
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, QUERY_FLAG, SET_FLAG, and UPD_WEIGHT.
Referenced by 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 1218 of file c_object.c.
References CLEAR_FLAG, draw_ext_info(), drop(), esrv_update_item(), fix_object(), FLAG_APPLIED, FLAG_INV_LOCKED, FLAG_NO_FIX_PLAYER, FOR_INV_FINISH, FOR_INV_PREPARE, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, QUERY_FLAG, SET_FLAG, and UPD_WEIGHT.
void command_empty | ( | object * | op, |
const char * | params | ||
) |
'empty' command.
op | player. |
params | item specifier. |
Definition at line 1439 of file c_object.c.
References draw_ext_info(), empty_container(), find_best_object_match(), FOR_INV_FINISH, FOR_INV_PREPARE, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, and NDI_UNIQUE.
void command_examine | ( | object * | op, |
const char * | params | ||
) |
'examine' command.
op | player. |
params | optional item specifier. |
Definition at line 1478 of file c_object.c.
References draw_ext_info_format(), examine(), find_best_object_match(), FOR_BELOW_FINISH, FOR_BELOW_PREPARE, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, and NDI_UNIQUE.
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 2544 of file c_object.c.
References CLEAR_FLAG, draw_ext_info(), draw_ext_info_format(), esrv_update_item(), find_best_object_match(), FLAG_INV_LOCKED, HUGE_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_FAILURE, NDI_UNIQUE, object_merge(), QUERY_FLAG, query_short_name(), SET_FLAG, and UPD_FLAGS.
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 1556 of file c_object.c.
References 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, NDI_UNIQUE, and query_name().
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 2195 of file c_object.c.
References display_new_pickup(), draw_ext_info(), draw_ext_info_format(), get_pickup_mode_index(), llevDebug, LOG(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, pickup_modes, PU_NEWMODE, and set_pickup_mode().
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 2358 of file c_object.c.
References buf, draw_ext_info(), draw_ext_info_format(), esrv_update_item(), find_best_object_match(), find_marked_object(), FOR_INV_FINISH, FOR_INV_PREPARE, FREE_AND_CLEAR_STR, FREE_AND_COPY, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, object_merge(), query_base_name(), snprintf, UPD_NAME, and VERY_BIG_BUF.
void command_rskill | ( | object * | pl, |
const char * | params | ||
) |
'ready_skill' command.
pl | player. |
params | skill name. |
Definition at line 160 of file c_object.c.
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, and NDI_UNIQUE.
void command_search | ( | object * | op, |
const char * | params | ||
) |
'search' command.
op | player. |
params | unused. |
Definition at line 211 of file c_object.c.
References do_skill_by_number(), and SK_FIND_TRAPS.
void command_search_items | ( | object * | op, |
const char * | params | ||
) |
'search-items' command.
op | player. |
params | options. |
Definition at line 2313 of file c_object.c.
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, Settings::search_items, and settings.
Referenced by 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 833 of file c_object.c.
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, make_matcher(), matcher_params::missed, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_FAILURE, NDI_UNIQUE, pick_up(), SET_FLAG, and UPD_WEIGHT.
Referenced by 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 238 of file c_object.c.
References do_skill_by_number(), and SK_THROWING.
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 2587 of file c_object.c.
References recipestruct::arch_name, create_archetype(), draw_ext_info(), draw_ext_info_format(), find_best_object_match(), find_recipe_for_tool(), recipestruct::ingred, recipestruct::ingred_count, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_FAILURE, linked_char::name, NDI_UNIQUE, object_decrease_nrof_by_one, object_insert_in_ob(), strlcpy(), and recipestruct::yield.
void command_uskill | ( | object * | pl, |
const char * | params | ||
) |
'use_skill' command.
pl | player. |
params | skill to use, and optional parameters. |
Definition at line 143 of file c_object.c.
References draw_ext_info(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, and use_skill().
|
static |
Utility function to display the pickup mode for a player.
op | must be a player. |
old | previous pickup mode. |
Definition at line 2070 of file c_object.c.
References draw_ext_info(), draw_ext_info_format(), esrv_send_pickup(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_INFO, NDI_UNIQUE, PU_ARMOUR, PU_ARROW, PU_BOOTS, PU_BOW, PU_CLOAK, PU_CONTAINER, 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 187 of file c_object.c.
References do_skill(), draw_ext_info(), find_skill_by_number(), MSG_TYPE_SKILL, MSG_TYPE_SKILL_MISSING, and NDI_UNIQUE.
Referenced by command_disarm(), command_search(), and command_throw().
void drop | ( | object * | op, |
object * | tmp | ||
) |
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 1156 of file c_object.c.
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(), put_object_in_sack(), and QUERY_FLAG.
Referenced by apply_handle_yield(), cfapi_object_drop(), command_drop(), command_dropall(), and empty_container().
object* drop_object | ( | object * | op, |
object * | tmp, | ||
uint32_t | nrof | ||
) |
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 1061 of file c_object.c.
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, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), object_split(), QUERY_FLAG, query_name(), save_player(), SCRIPT_FIX_ALL, sell_item(), shop_contains(), and UPD_WEIGHT.
Referenced by drop(), esrv_move_object(), and transport_type_apply().
|
static |
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 1401 of file c_object.c.
References draw_ext_info_format(), drop(), esrv_update_item(), FLAG_INV_LOCKED, FOR_INV_FINISH, FOR_INV_PREPARE, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, QUERY_FLAG, query_name(), and UPD_WEIGHT.
Referenced by command_empty().
void examine | ( | object * | op, |
object * | tmp | ||
) |
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 1691 of file c_object.c.
References body_locations, buf, change_exp(), CLEAR_FLAG, cost_approx_str(), cost_str(), detect_curse_on_item(), detect_magic_on_item(), draw_ext_info(), draw_ext_info_format(), examine_monster(), find_skill_by_number(), FLAG_IDENTIFIED, FLAG_IS_BUILDABLE, FLAG_IS_CAULDRON, FLAG_IS_LINKED, FLAG_MONSTER, FLAG_NO_PICK, FLAG_NO_SKILL_IDENT, FLAG_STARTEQUIP, FLAG_UNPAID, FOR_INV_FINISH, FOR_INV_PREPARE, get_archetype_by_skill_name(), get_button_value(), get_typedata(), identify_object_with_skill(), typedata::identifyskill, typedata::identifyskill2, is_identifiable_type(), is_identified(), knowledge_item_can_be_used_alchemy(), llevError, LOG(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, MSG_TYPE_SPELL, MSG_TYPE_SPELL_INFO, NDI_BLUE, NDI_UNIQUE, ob_describe(), object_can_pick(), QUERY_FLAG, shop_contains(), shop_price_buy(), shop_price_sell(), SK_DET_CURSE, SK_DET_MAGIC, SK_SUBTRACT_SKILL_EXP, snprintf, stringbuffer_append_string(), stringbuffer_finish(), stringbuffer_new(), stringbuffer_trim_whitespace(), strncasecmp(), and VERY_BIG_BUF.
Referenced by command_examine(), examine_cmd(), and knowledge_alchemy_attempt().
void examine_monster | ( | object * | op, |
object * | tmp, | ||
int | level | ||
) |
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 1603 of file c_object.c.
References add_string(), AT_ACID, create_archetype(), draw_ext_info(), fix_object(), FLAG_APPLIED, FLAG_PROBE, FLAG_UNDEAD, FORCE_NAME, free_string(), knowledge_show_monster_detail(), level, mon, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, NDI_UNIQUE, object_find_by_type_and_name(), object_insert_in_ob(), object_present_in_ob(), probe(), QUERY_FLAG, and SET_FLAG.
Referenced by examine(), and probe().
|
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 100 of file c_object.c.
References AP_APPLY, AP_UNAPPLY, FLAG_APPLIED, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, object_matches_string(), and QUERY_FLAG.
Referenced by command_apply(), and find_best_object_match().
|
static |
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 131 of file c_object.c.
References AP_NULL, and find_best_apply_object_match().
Referenced by command_empty(), command_examine(), command_lock_item(), command_mark(), command_rename_item(), and command_use().
object* find_marked_object | ( | object * | op | ) |
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 1509 of file c_object.c.
Referenced by animate_weapon(), apply_map_builder(), armour_improver_type_apply(), cast_item_curse_or_curse(), cfapi_object_get_property(), command_mark(), command_rename_item(), find_throw_ob(), identify_altar_type_move_on(), 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.c.
References pickup_names, and set_pickup_mode().
Referenced by command_pickup(), and make_matcher().
void inventory | ( | object * | op, |
object * | inv | ||
) |
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 2005 of file c_object.c.
References draw_ext_info(), draw_ext_info_format(), FLAG_APPLIED, FLAG_WIZ, FOR_INV_FINISH, FOR_INV_PREPARE, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_INVENTORY, NDI_UNIQUE, QUERY_FLAG, query_name(), and query_weight().
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 794 of file c_object.c.
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, pickup_modes, and matcher_params::pickup_type.
Referenced by command_drop(), and command_take().
|
static |
Function allowing all objects.
who | unused. |
params | unused. |
item | unused. |
Definition at line 728 of file c_object.c.
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 762 of file c_object.c.
References FLAG_IS_FLOOR, matcher_params::missed, matcher_params::name, object_can_pick(), object_matches_string(), and QUERY_FLAG.
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 742 of file c_object.c.
References matcher_params::item_must_be_pickable, matcher_params::item_number, matcher_params::item_to_pick, and object_can_pick().
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 782 of file c_object.c.
References object_matches_pickup_mode(), and matcher_params::pickup_type.
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 646 of file c_object.c.
References FLAG_IS_THROWN, FLAG_KNOWN_CURSED, FLAG_KNOWN_MAGICAL, PU_ARMOUR, PU_ARROW, PU_BOOTS, PU_BOW, PU_CLOAK, PU_CONTAINER, 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, and QUERY_FLAG.
Referenced by check_pick(), and matcher_pickup_type().
void pick_up | ( | object * | op, |
object * | alt | ||
) |
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 509 of file c_object.c.
References draw_ext_info(), draw_ext_info_format(), FLAG_APPLIED, FLAG_STARTEQUIP, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, llevDebug, LOG(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, object_can_pick(), object_insert_in_map(), pick_up_object(), QUERY_FLAG, sack_can_hold(), and stop_item().
Referenced by attempt_steal(), cast_create_missile(), cfapi_object_pickup(), check_pick(), command_take(), and esrv_move_object().
|
static |
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 378 of file c_object.c.
References buf, cost_str(), draw_ext_info(), 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, MAX_BUF, Settings::max_stat, MIN, MOVE_FLYING, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_FAILURE, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, object_free_drop_inventory(), object_get_player_container(), object_insert_in_map_at(), object_insert_in_ob(), object_remove(), object_split(), QUERY_FLAG, query_name(), Settings::real_wiz, SCRIPT_FIX_ALL, SET_FLAG, settings, shop_price_buy(), snprintf, and UPD_WEIGHT.
Referenced by pick_up().
void put_object_in_sack | ( | object * | op, |
object * | sack, | ||
object * | tmp, | ||
uint32_t | nrof | ||
) |
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 925 of file c_object.c.
References AP_NO_MERGE, AP_UNAPPLY, apply_special(), CLEAR_FLAG, draw_ext_info(), draw_ext_info_format(), esrv_update_item(), fix_object(), FLAG_APPLIED, FLAG_NO_FIX_PLAYER, FLAG_STARTEQUIP, FOR_INV_FINISH, FOR_INV_PREPARE, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_FAILURE, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, object_insert_in_map_at(), object_insert_in_ob(), object_remove(), object_split(), QUERY_FLAG, query_name(), sack_can_hold(), set_object_face_main(), transport_can_hold(), and UPD_WEIGHT.
Referenced by drop(), esrv_move_object(), knowledge_alchemy_attempt(), and START_TEST().
int sack_can_hold | ( | const object * | pl, |
const object * | sack, | ||
const object * | op, | ||
uint32_t | nrof | ||
) |
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 316 of file c_object.c.
References draw_ext_info_format(), FLAG_APPLIED, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, QUERY_FLAG, and query_name().
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 2260 of file c_object.c.
References draw_ext_info(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_SUCCESS, and NDI_UNIQUE.
Referenced by command_pickup(), and get_pickup_mode_index().
|
static |
Value in Pickup modes associated with pickup_names.
Definition at line 43 of file c_object.c.
Referenced by command_pickup(), and make_matcher().
|
static |
Valid names for pickup types.
Definition at line 33 of file c_object.c.
Referenced by get_pickup_mode_index().