56 object *tmp, *best = NULL;
57 int match_val = 0, tmpmatch;
68 if (tmpmatch > match_val) {
99 if (*params ==
'\0') {
101 "Usage: use_skill <skill name>");
118 if (*params ==
'\0') {
120 "Usage: ready_skill <skill name>");
127 "You have no knowledge of the skill %s",
143 const char *missing_message) {
146 do_skill(op, op, skop, op->
facing, *params ==
'\0' ? NULL : params);
207 object *inv = op->
inv;
210 if (*params ==
'\0') {
215 while (*params ==
' ')
217 if (!strncmp(params,
"-a ", 3)) {
221 if (!strncmp(params,
"-u ", 3)) {
225 if (!strncmp(params,
"-o ", 3)) {
229 if (!strncmp(params,
"-b ", 3)) {
239 while (*params ==
' ')
249 "Could not find any match to the %s.",
277 "The %s is not active.",
283 "You can't put the %s into itself.",
290 "You can put only %s into the %s.",
296 "You can't put the key into %s.",
303 new_weight = sack->
carrying+(nrof ? nrof : 1)
308 "That won't fit in the %s!",
334 object *env = tmp->
env;
335 uint32_t weight, effective_weight_limit;
336 const int tmp_nrof =
NROF(tmp);
350 "You are levitating, you can't reach the ground!");
358 "The object disappears in a puff of smoke! It must have been an illusion.");
365 if (nrof > tmp_nrof || nrof == 0)
369 weight = tmp->
weight*nrof;
377 "That item is too heavy for you to pick up.");
384 if (nrof != tmp_nrof) {
387 tmp =
object_split(tmp, nrof, failure,
sizeof(failure));
406 snprintf(buf,
sizeof(buf),
"%s will cost you %s.", name, value);
409 snprintf(buf,
sizeof(buf),
"You pick up the %s.", name);
448 if (env && env != pl && env != op)
462 object *tmp = NULL, *tmp1;
470 "You can't pick up the %s.",
478 "There is nothing to pick up here.");
531 object *container = NULL;
546 }
else if (!container) {
561 if (tmp->
env == alt) {
582 "This object cannot be put into containers!");
650 if (!params && !tmp) {
655 "You can't pick up a %s.",
663 "There is nothing to pick up.");
667 "You were unable to take one of the items.");
670 "You were unable to take %d of the items.",
693 object *sack2, *orig = sack;
701 "The %s is not a container.",
708 "You cannot put the %s in the %s.",
709 name_tmp, name_sack);
725 "You move the items from %s into %s.",
726 name_tmp, name_sack);
745 "You can not put a %s into a %s",
764 if (nrof && tmp->
nrof != nrof) {
767 tmp =
object_split(tmp, nrof, failure,
sizeof(failure));
777 if (sack->
nrof > 1) {
791 "You put the %s in %s.",
792 name_tmp, name_sack);
851 if (nrof && tmp->
nrof != nrof) {
854 tmp =
object_split(tmp, nrof, failure,
sizeof(failure));
868 "You drop the %s. The gods who lent it to you retrieve it.",
889 && op->
contr->last_save_time+SAVE_INTERVAL <= time(NULL)) {
891 op->
contr->last_save_time = time(NULL);
896 tmp_tag = tmp->
count;
924 void drop(
object *op,
object *tmp) {
949 "You don't have anything to drop.");
954 "This item is locked");
989 if (op->
inv == NULL) {
1011 if (*params ==
'\0') {
1014 && curinv->type !=
MONEY 1015 && curinv->type !=
FOOD 1016 && curinv->type !=
KEY 1018 && curinv->type !=
GEM 1019 && !curinv->invisible
1026 }
else if (strcmp(params,
"weapons") == 0) {
1029 && (curinv->type ==
WEAPON || curinv->type ==
BOW || curinv->type ==
ARROW)) {
1035 }
else if (strcmp(params,
"armor") == 0 || strcmp(params,
"armour") == 0) {
1044 }
else if (strcmp(params,
"food") == 0) {
1047 && (curinv->type ==
FOOD || curinv->type ==
DRINK)) {
1053 }
else if (strcmp(params,
"flesh") == 0) {
1056 && (curinv->type ==
FLESH)) {
1062 }
else if (strcmp(params,
"misc") == 0) {
1066 switch (curinv->type) {
1115 if (*params ==
'\0') {
1134 "Nothing to drop.");
1137 "One item couldn't be dropped because it was locked.");
1138 else if (missed > 1)
1140 "%d items couldn't be dropped because they were locked.",
1166 if (!container->
inv)
1179 if (inv->below == next)
1203 if (*params ==
'\0') {
1209 if (strcmp(params,
"all") == 0) {
1225 "This is not a container!");
1240 if (*params ==
'\0') {
1254 "Could not find an object that matches %s",
1322 if (*params ==
'\0') {
1326 "You have no marked object.");
1338 "Could not find an object that matches %s",
1369 "It is an undead force.");
1372 "It is likely more powerful than you.");
1375 "It is likely less powerful than you.");
1378 "It is probably as powerful as you.");
1382 "You smell an acrid odor.");
1391 "It is critically wounded.");
1396 "It is in a bad shape.");
1406 "It is somewhat hurt.");
1411 "It is in excellent shape.");
1416 "It looks very ill.");
1429 if (
probe == NULL) {
1438 probe->level = level;
1439 if (level / 10 >
probe->duration)
1440 probe->duration = level / 10;
1455 int i, exp = 0, conn;
1459 int id_attempted = 0;
1460 char prefix[
MAX_BUF] =
"That is";
1470 LOG(
llevError,
"Attempted to examine item %d with type %d, which is invalid", tmp->
count, tmp->
type);
1482 "You discover mystic forces on %s", tmp->
nrof <= 1?
"that item":
"those items" );
1492 "You have a bad feeling about %s", tmp->
nrof <= 1?
"that item":
"those items" );
1539 switch (id_attempted) {
1541 snprintf(prefix,
MAX_BUF,
"You lack the skill to understand %s:", tmp->
nrof <= 1?
"that fully; it is":
"those fully, they are");
1544 snprintf(prefix,
MAX_BUF,
"You fail to understand %s:", tmp->
nrof <= 1?
"that fully; it is":
"those fully, they are");
1555 "%s %s", prefix, buf);
1563 switch (tmp->
type) {
1569 if (!tmp->
skill)
break;
1574 "Unfortunately the scroll is damaged and unreadable.");
1619 if (tmp->
msg != NULL)
1620 snprintf(buf,
sizeof(buf),
"Something is written in it.");
1624 if (tmp->
race != NULL) {
1628 snprintf(buf,
sizeof(buf),
"It can hold only %s.", tmp->
race);
1644 "It is made of: %s.",
1653 "%s %s (%d)", tmp->
nrof > 1 ?
"They go" :
"It goes",
1657 "%s %s", tmp->
nrof > 1 ?
"They go" :
"It goes",
1662 "%s %s", tmp->
nrof > 1 ?
"They go" :
"It goes",
1669 snprintf(buf,
sizeof(buf), tmp->
nrof > 1 ?
"They weigh %3.3f kg." :
"It weighs %3.3f kg.", tmp->
weight*((
float)(tmp->
nrof ? tmp->
nrof : 1)/1000.0));
1678 snprintf(buf,
sizeof(buf),
"You reckon %s worth %s.", tmp->
nrof > 1 ?
"they are" :
"it is", value);
1685 snprintf(buf,
sizeof(buf),
"%s would cost you %s.", tmp->
nrof > 1 ?
"They" :
"It", value);
1689 snprintf(buf,
sizeof(buf),
"You are offered %s for %s.", value, tmp->
nrof > 1 ?
"them" :
"it");
1703 "This is a buildable item.");
1708 if (tmp_inv->type ==
FORCE && tmp_inv->slaying != NULL
1709 && strcmp(tmp_inv->slaying, op->
map->
path) == 0
1710 && tmp_inv->msg != NULL
1711 && tmp_inv->path_attuned == (
uint32_t) conn) {
1744 "The object has a story:");
1768 int items = 0, length;
1771 if (inv == NULL && op == NULL) {
1773 "Inventory of what object?");
1784 "You carry nothing.");
1808 "[fixed]%s- %-*.*s (%5d) %-8s",
1809 in, length, length, name, tmp->count, weight);
1812 "[fixed]%s- %-*.*s %-8s",
1813 in, length+8, length+8, name, weight);
1819 41,
"Total weight :", weight);
1839 "Pickup is %s.", (old & PU_INHIBIT) ?
"active" :
"inhibited");
1846 i&PU_NEWMODE ? 1 : 0);
1849 i&PU_DEBUG ? 1 : 0);
1858 "%d <= x pickup weight/value RATIO (0==off)",
1958 static const char *names[] = {
1959 "debug",
"inhibit",
"stop",
"food",
"drink",
1960 "valuables",
"bow",
"arrow",
"helmet",
"shield",
1961 "armour",
"boots",
"gloves",
"cloak",
"key",
1962 "missile",
"melee",
"magical",
"potion",
"spellbook",
1963 "skillscroll",
"readables",
"magicdevice",
"notcursed",
"jewels",
1964 "flesh",
"container", NULL
1973 if (*params ==
'\0') {
1985 while (*params ==
' ')
1988 if (*params ==
'+' || *params ==
'-' || *params ==
'!') {
1991 for (mode = 0; names[mode]; mode++) {
1992 if (!strcmp(names[mode], params+1)) {
1999 else if (*params ==
'-')
2013 "Pickup: invalid item %s\n",
2018 if (sscanf(params,
"%u", &i) != 1) {
2022 "Usage: pickup <0-7> or <value_density> .");
2042 "Mode: Don't pick up.");
2047 "Mode: Pick up one item.");
2052 "Mode: Pick up one item and stop.");
2057 "Mode: Stop before picking up.");
2062 "Mode: Pick up all items.");
2067 "Mode: Pick up all items and stop.");
2072 "Mode: Pick up all magic items.");
2077 "Mode: Pick up all coins and gems");
2094 if (*params ==
'\0') {
2097 "Example: search magic+1 " 2098 "Would automatically pick up all " 2099 "items containing the word 'magic+1'.");
2104 "Search mode turned off.");
2108 if ((
int)strlen(params) >=
MAX_BUF) {
2110 "Search string too long.");
2115 "Searching for '%s'.",
2138 object *item = NULL;
2143 if (*params !=
'\0') {
2145 while (
' ' == *params)
2149 itemnumber = atoi(params);
2150 if (itemnumber != 0) {
2160 "Tried to rename an invalid item.");
2163 while (isdigit(*params) ||
' ' == *params)
2165 }
else if (
'<' == *params) {
2167 closebrace = strchr(params,
'>');
2174 if (closebrace-params > 127) {
2176 "Old name too long (up to 127 characters allowed)!");
2180 snprintf(buf,
sizeof(buf),
"%.*s", (
int)(closebrace-(params+1)), params+1);
2186 "Could not find a matching item to rename.");
2191 params = closebrace+1;
2192 while (
' ' == *params)
2199 "No marked item to rename.");
2205 if (!strncmp(params,
"to ", 3)) {
2207 while (
' ' == *params)
2209 if (
'<' != *params) {
2211 "Syntax error, expecting < at start of new name!");
2214 closebrace = strchr(params+1,
'>');
2217 "Syntax error, expecting > at end of new name!");
2222 if (closebrace-params > 127) {
2224 "New name too long (up to 127 characters allowed)!");
2229 snprintf(buf,
sizeof(buf),
"%.*s", (
int)(closebrace-(params+1)), params+1);
2232 for (counter = 0; counter < strlen(buf); counter++) {
2233 if (isalnum(buf[counter]))
2235 if (
' ' == buf[counter])
2237 if (
'\'' == buf[counter])
2239 if (
'+' == buf[counter])
2241 if (
'_' == buf[counter])
2243 if (
'-' == buf[counter])
2250 "Invalid new name!");
2255 if (strlen(params)) {
2257 "Syntax error, expected 'to <' after old name!");
2268 "No marked item to rename.");
2279 "This item has no custom name.");
2286 "You stop calling your %s with weird names.",
2292 "You keep calling your %s %s.",
2302 "Your %s will now be called %s.",
2326 if (*params ==
'\0' || strlen(params) == 0) {
2335 "Can't find any matching item.");
2342 "Unlocked %s.", name);
2346 "Locked %s.", name);
2366 object *first, *second;
2375 strlcpy(copy, params,
sizeof(copy));
2376 with = strstr(copy,
" with ");
2383 with = with+strlen(
" with ");
2396 transformation = NULL;
2406 if (transformation->
yield)
2407 generated->
nrof = transformation->
yield;
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
object * object_find_by_type_and_name(const object *who, int type, const char *name)
void apply_by_living_below(object *pl)
void sell_item(object *op, object *pl)
static object * find_best_object_match(object *pl, const char *params)
#define NUM_BODY_LOCATIONS
int apply_special(object *who, object *op, int aflags)
static void do_skill_by_number(object *op, int skill_subtype, const char *params, const char *missing_message)
#define MSG_TYPE_COMMAND_INVENTORY
#define INS_BELOW_ORIGINATOR
int change_skill(object *who, object *new_skill, int flag)
void command_search_items(object *op, const char *params)
void put_object_in_sack(object *op, object *sack, object *tmp, uint32_t nrof)
void pick_up(object *op, object *alt)
bool shop_contains(object *ob)
void command_lock_item(object *op, const char *params)
#define MSG_TYPE_COMMAND_FAILURE
void command_take(object *op, const char *params)
void stringbuffer_trim_whitespace(StringBuffer *sb)
int identify_object_with_skill(object *tmp, object *pl, object *skill, int print_on_success)
#define FLAG_NO_FIX_PLAYER
int save_player(object *op, int flag)
StringBuffer * stringbuffer_new(void)
void inventory(object *op, object *inv)
void free_string(sstring str)
#define MSG_TYPE_COMMAND_EXAMINE
void esrv_update_item(int flags, object *pl, object *op)
#define MSG_TYPE_SPELL_INFO
static uint32_t NROF(const object *const ob)
void query_base_name(const object *op, int plural, char *buf, size_t size)
recipe * find_recipe_for_tool(const char *tool, recipe *from)
void command_throw(object *op, const char *params)
void query_weight(const object *op, char *buf, size_t size)
#define MSG_TYPE_SKILL_MISSING
#define object_was_destroyed(op, old_tag)
body_locations_struct body_locations[NUM_BODY_LOCATIONS]
object * stop_item(object *op)
uint32_t get_weight_limit(int stat)
static void pick_up_object(object *pl, object *op, object *tmp, int nrof)
void command_dropall(object *op, const char *params)
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
void command_rskill(object *pl, const char *params)
#define FOR_OB_AND_BELOW_FINISH()
void command_empty(object *op, const char *params)
void command_rename_item(object *op, const char *params)
const typedata * get_typedata(int itemtype)
int probe(object *op, object *caster, object *spell_ob, int dir, int level)
void knowledge_item_can_be_used_alchemy(object *op, const object *item)
void object_free_drop_inventory(object *ob)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
void command_examine(object *op, const char *params)
int apply_by_living(object *pl, object *op, int aflag, int quiet)
void examine(object *op, object *tmp)
void command_search(object *op, const char *params)
int is_identified(const object *op)
object * create_archetype(const char *name)
void stringbuffer_append_string(StringBuffer *sb, const char *str)
int detect_curse_on_item(object *pl, object *tmp, object *skill)
uint64_t shop_price_buy(const object *obj, object *who)
int object_can_pick(const object *who, const object *item)
object * object_insert_in_ob(object *op, object *where)
char * cost_approx_str(const object *obj, object *who)
#define MSG_TYPE_COMMAND_SUCCESS
#define MSG_TYPE_COMMAND_ERROR
const char * materialname
static bool IS_PLAYER(object *op)
void command_drop(object *op, const char *params)
archetype * get_archetype_by_skill_name(const char *skill, int type)
object * object_present_in_ob(uint8_t type, const object *op)
char * cost_str(uint64_t cost)
void command_apply(object *op, const char *params)
int do_skill(object *op, object *part, object *skill, int dir, const char *string)
object * object_insert_in_map(object *op, mapstruct *m, object *originator, int flag)
static void empty_container(object *container, object *pl)
#define FREE_AND_CLEAR_STR(xyz)
void knowledge_show_monster_detail(object *op, const char *name)
static void set_pickup_mode(const object *op, int i)
#define QUERY_FLAG(xyz, p)
#define CLEAR_FLAG(xyz, p)
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
int strncasecmp(const char *s1, const char *s2, int n)
uint64_t shop_price_sell(const object *obj, object *who)
void command_pickup(object *op, const char *params)
char * ob_describe(const object *op, const object *observer, int use_media_tags, char *buf, size_t size)
int set_object_face_main(object *op)
int sack_can_hold(const object *pl, const object *sack, const object *op, uint32_t nrof)
int8_t body_info[NUM_BODY_LOCATIONS]
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
int detect_magic_on_item(object *pl, object *tmp, object *skill)
#define object_decrease_nrof_by_one(xyz)
#define FREE_AND_COPY(sv, nv)
void command_use(object *op, const char *params)
#define FLAG_IS_BUILDABLE
static void display_new_pickup(const object *op, int old)
#define MSG_TYPE_COMMAND_INFO
int transport_can_hold(const object *transport, const object *op, int nrof)
object * object_merge(object *op, object *top)
void query_short_name(const object *op, char *buf, size_t size)
object * object_get_player_container(object *op)
int execute_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
int object_matches_string(object *pl, object *op, const char *name)
#define FOR_OB_AND_BELOW_PREPARE(op_)
void command_disarm(object *op, const char *params)
sstring add_string(const char *str)
void esrv_send_pickup(player *pl)
static object * find_best_apply_object_match(object *start, object *pl, const char *params, int aflag)
void LOG(LogLevel logLevel, const char *format,...)
object * find_marked_object(object *op)
void query_name(const object *op, char *buf, size_t size)
object * drop_object(object *op, object *tmp, uint32_t nrof)
#define FOR_BELOW_PREPARE(op_, it_)
#define SK_SUBTRACT_SKILL_EXP
object * find_skill_by_number(object *who, int skillno)
int use_skill(object *op, const char *string)
int is_identifiable_type(const object *op)
#define FLAG_NO_SKILL_IDENT
void command_uskill(object *pl, const char *params)
void fix_object(object *op)
object * find_skill_by_name(object *who, const char *name)
char * stringbuffer_finish(StringBuffer *sb)
size_t strlcpy(char *dst, const char *src, size_t size)
#define FOR_BELOW_FINISH()
void command_mark(object *op, const char *params)
#define FOR_INV_PREPARE(op_, it_)
void object_remove(object *op)
void examine_monster(object *op, object *tmp, int level)
void drop(object *op, object *tmp)