34 "debug",
"inhibit",
"stop",
"food",
"drink",
35 "valuables",
"bow",
"arrow",
"helmet",
"shield",
36 "armour",
"boots",
"gloves",
"cloak",
"key",
37 "missile",
"melee",
"magical",
"potion",
"spellbook",
38 "skillscroll",
"readables",
"magicdevice",
"notcursed",
"jewels",
39 "flesh",
"container",
"cursed", NULL
60 size_t len = strlen(name);
75 return best != -2 ? best : -1;
102 object *tmp, *best = NULL;
103 int match_val = 0, tmpmatch;
114 if (tmpmatch > match_val) {
115 match_val = tmpmatch;
145 if (*params ==
'\0') {
147 "Usage: use_skill <skill name>");
164 if (*params ==
'\0') {
166 "Usage: ready_skill <skill name>");
173 "You have no knowledge of the skill %s",
189 const char *missing_message) {
192 do_skill(op, op, skop, op->
facing, *params ==
'\0' ? NULL : params);
253 object *inv = op->
inv;
256 if (*params ==
'\0') {
261 while (*params ==
' ')
263 if (!strncmp(params,
"-a ", 3)) {
267 if (!strncmp(params,
"-u ", 3)) {
271 if (!strncmp(params,
"-o ", 3)) {
275 if (!strncmp(params,
"-b ", 3)) {
285 while (*params ==
' ')
295 "Could not find any match to the %s.",
302 bool csv_contains(std::string list, std::string item, std::string delim) {
305 pos = list.find(delim);
306 auto match = list.substr(0, pos);
310 if (pos == std::string::npos)
312 list.erase(0, pos + 1);
335 uint32_t weight, effective_weight_limit;
336 const int tmp_nrof =
NROF(tmp);
339 int16_t x = tmp->
x, y = tmp->
y;
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));
407 snprintf(buf,
sizeof(buf),
"%s will cost you %s.", name, value);
409 snprintf(buf,
sizeof(buf),
"%s will cost you %s. You place it in your %s.", name, value, op->
name);
414 snprintf(buf,
sizeof(buf),
"You pick up the %s.", name);
416 snprintf(buf,
sizeof(buf),
"You pick up the %s and put it in your %s.", name, op->
name);
457 if (env && env != pl && env != op)
472 object *tmp = NULL, *tmp1;
480 "You can't pick up the %s.",
488 "There is nothing to pick up here.");
541 object *container = NULL;
556 }
else if (!container) {
571 if (tmp->
env == alt) {
592 "This object cannot be put into containers!");
759 memset(mp, 0,
sizeof(*mp));
760 if (params[0] ==
'\0') {
765 if (params[0] ==
'#') {
773 if (params[0] ==
'*') {
774 if (params[1] ==
'\0') {
785 strncpy(mp->
name, params,
sizeof(mp->
name) - 1);
831 if ((*matcher)(op, &mp, tmp)) {
838 if (params[0] ==
'\0' && !did_one) {
843 "You can't pick up a %s.",
851 "There is nothing to pick up.");
856 "You were unable to take one of the items.");
859 "You were unable to take %d of the items.",
890 object *sack2, *orig = sack;
898 "The %s is not a container.",
905 "You cannot put the %s in the %s.",
906 name_tmp, name_sack);
922 "You move the items from %s into %s.",
923 name_tmp, name_sack);
942 "You can not put a %s into a %s",
961 if (nrof && tmp->
nrof != nrof) {
964 tmp =
object_split(tmp, nrof, failure,
sizeof(failure));
974 if (sack->
nrof > 1) {
988 "You put the %s in %s.",
989 name_tmp, name_sack);
1047 if (nrof && tmp->
nrof != nrof) {
1050 tmp =
object_split(tmp, nrof, failure,
sizeof(failure));
1064 "You drop the %s. The gods who lent it to you retrieve it.",
1077 #ifdef SAVE_INTERVAL 1085 && op->
contr->last_save_time+SAVE_INTERVAL <= time(NULL)) {
1087 op->
contr->last_save_time = time(NULL);
1092 tmp_tag = tmp->
count;
1120 void drop(
object *op,
object *tmp) {
1145 "You don't have anything to drop.");
1150 "This item is locked");
1185 if (op->
inv == NULL) {
1188 "Nothing to drop!");
1207 if (*params ==
'\0') {
1210 && curinv->type !=
MONEY 1211 && curinv->type !=
FOOD 1212 && curinv->type !=
KEY 1214 && curinv->type !=
GEM 1215 && !curinv->invisible
1222 }
else if (strcmp(params,
"weapons") == 0) {
1225 && (curinv->type ==
WEAPON || curinv->type ==
BOW || curinv->type ==
ARROW)) {
1231 }
else if (strcmp(params,
"armor") == 0 || strcmp(params,
"armour") == 0) {
1240 }
else if (strcmp(params,
"food") == 0) {
1243 && (curinv->type ==
FOOD || curinv->type ==
DRINK)) {
1249 }
else if (strcmp(params,
"flesh") == 0) {
1252 && (curinv->type ==
FLESH)) {
1258 }
else if (strcmp(params,
"misc") == 0) {
1262 switch (curinv->type) {
1310 if (*params ==
'\0') {
1327 if ((*matcher)(op, &mp, tmp)) {
1338 "Nothing to drop.");
1341 "One item couldn't be dropped because it was locked.");
1342 else if (missed > 1)
1344 "%d items couldn't be dropped because they were locked.",
1368 if (!container->
inv)
1381 if (inv->below == next)
1405 if (*params ==
'\0') {
1411 if (strcmp(params,
"all") == 0) {
1427 "This is not a container!");
1442 if (*params ==
'\0') {
1456 "Could not find an object that matches %s",
1524 if (*params ==
'\0') {
1528 "You have no marked object.");
1540 "Could not find an object that matches %s",
1571 "It is an undead force.");
1574 "It is likely more powerful than you.");
1577 "It is likely less powerful than you.");
1580 "It is probably as powerful as you.");
1584 "You smell an acrid odor.");
1593 "It is critically wounded.");
1598 "It is in a bad shape.");
1608 "It is somewhat hurt.");
1613 "It is in excellent shape.");
1618 "It looks very ill.");
1631 if (
probe == NULL) {
1641 if (level / 10 >
probe->duration)
1642 probe->duration = level / 10;
1671 "You discover mystic forces on %s", tmp->
nrof <= 1?
"that item":
"those items" );
1682 "You have a bad feeling about %s", tmp->
nrof <= 1?
"that item":
"those items" );
1688 LOG(
llevError,
"Attempted to examine item %d with type %d, which is invalid\n", tmp->
count, tmp->
type);
1692 bool have_skill =
false;
1739 bool pl = tmp->
nrof > 1;
1740 float weight = (tmp->
nrof ? tmp->
nrof : 1) * ((
float)tmp->
weight/1000.0);
1744 "%s made of %s and %s %3.3f kg.",
1746 pl ?
"weigh" :
"weighs", weight);
1749 "%s made of %s.", pl ?
"They are" :
"It is", tmp->
materialname);
1750 }
else if (weight) {
1752 "%s %3.3f kg.", pl ?
"They weigh" :
"it weighs", weight);
1768 desc =
"It is completely depleted.";
1770 desc =
"It is nearly depleted.";
1772 desc =
"It is very low on power.";
1774 desc =
"It is low on power.";
1776 desc =
"It is well charged.";
1778 desc =
"It is fully charged.";
1780 desc =
"It is overflowing with power.";
1802 if (castings <= 1) {
1803 desc =
"It is nearly depleted.";
1804 }
else if (castings <= 3) {
1805 desc =
"It hums with power.";
1807 desc =
"It crackles with power.";
1838 if (tmp->
msg && strncasecmp(tmp->
msg,
"@match", 6)) {
1839 if (!output)
return true;
1848 switch (tmp->
type) {
1856 if (!tmp->
skill)
break;
1862 "Unfortunately, it is damaged beyond %s.",
1867 if (!output)
return true;
1869 "%s lets you %s a skill:",
1870 tmp->
nrof > 1 ?
"These objects" :
"This object",
1894 if (!output)
return true;
1896 "%s holds%s a spell:",
1897 tmp->
nrof > 1 ?
"These objects" :
"This object",
1911 if (!output)
return true;
1913 "%s a story:", tmp->
nrof > 1 ?
"These objects have" :
"This object has");
1947 "You examine the %s more closely.", tmp->
nrof > 1 ? tmp->
name_pl : tmp->
name);
1958 snprintf(prefix,
MAX_BUF,
"%s:", tmp->
nrof<=1 ?
"That is" :
"Those are");
1962 snprintf(prefix,
MAX_BUF,
"You lack the skill to understand %s:",
1963 tmp->
nrof<=1 ?
"that fully; it is" :
"those fully; they are");
1966 snprintf(prefix,
MAX_BUF,
"You fail to understand %s:",
1967 tmp->
nrof<=1 ?
"that fully; it is" :
"those fully; they are");
1980 "%s %s", prefix, buf);
1991 switch (tmp->
type) {
2001 if (tmp->
msg != NULL)
2002 snprintf(buf,
sizeof(buf),
"Something is written in it.");
2019 "%s %s (%d).", tmp->
nrof > 1 ?
"They go" :
"It goes",
2023 "%s %s.", tmp->
nrof > 1 ?
"They go" :
"It goes",
2028 "%s %s.", tmp->
nrof > 1 ?
"They go" :
"It goes",
2038 snprintf(buf,
sizeof(buf),
"You reckon %s worth %s.", tmp->
nrof > 1 ?
"they are" :
"it is", value);
2046 snprintf(buf,
sizeof(buf),
"%s is selling this item.", seller);
2051 snprintf(buf,
sizeof(buf),
"%s would cost you %s.", tmp->
nrof > 1 ?
"They" :
"It", value);
2055 snprintf(buf,
sizeof(buf),
"You are offered %s for %s.", value, tmp->
nrof > 1 ?
"them" :
"it");
2069 bool has_link =
false;
2072 if (tmp_inv->type ==
FORCE && tmp_inv->slaying != NULL
2073 && strcmp(tmp_inv->slaying, op->
map->
path) == 0
2074 && tmp_inv->msg != NULL
2075 && tmp_inv->path_attuned == (uint32_t) conn) {
2080 "This is a buildable item, connected with: %s",
2088 "This is a buildable item.");
2096 "Examine again for more details.");
2119 int items = 0, length;
2122 if (inv == NULL && op == NULL) {
2124 "Inventory of what object?");
2135 "You carry nothing.");
2159 "[fixed]%s- %-*.*s (%5d) %-8s",
2160 in, length, length, name, tmp->count, weight);
2163 "[fixed]%s- %-*.*s %-8s",
2164 in, length+8, length+8, name, weight);
2170 41,
"Total weight :", weight);
2190 "Pickup is now %s.", (old & PU_INHIBIT) ?
"active" :
"inhibited");
2197 i&PU_NEWMODE ? 1 : 0);
2200 i&PU_DEBUG ? 1 : 0);
2209 "%d <= x pickup weight/value RATIO (0==off)",
2314 if (*params ==
'\0') {
2326 while (*params ==
' ')
2329 if (*params ==
'+' || *params ==
'-' || *params ==
'!') {
2339 else if (*params ==
'-')
2352 "Pickup: invalid item %s\n",
2357 if (sscanf(params,
"%u", &i) != 1) {
2361 "Usage: pickup <0-7> or <value_density> .");
2381 "Mode: Don't pick up.");
2386 "Mode: Pick up one item.");
2391 "Mode: Pick up one item and stop.");
2396 "Mode: Stop before picking up.");
2401 "Mode: Pick up all items.");
2406 "Mode: Pick up all items and stop.");
2411 "Mode: Pick up all magic items.");
2416 "Mode: Pick up all coins and gems");
2433 if (!params || *params ==
'\0') {
2436 "Example: search magic+1 " 2437 "Would automatically pick up all " 2438 "items containing the word 'magic+1'.");
2443 "Search mode turned off.");
2447 if ((
int)strlen(params) >=
MAX_BUF) {
2449 "Search string too long.");
2454 "Searching for '%s'.",
2477 object *item = NULL;
2479 const char *closebrace;
2482 if (*params !=
'\0') {
2484 while (
' ' == *params)
2488 itemnumber = atoi(params);
2489 if (itemnumber != 0) {
2491 if (inv->count == itemnumber && !inv->invisible) {
2498 "Tried to rename an invalid item.");
2501 while (isdigit(*params) ||
' ' == *params)
2503 }
else if (
'<' == *params) {
2505 closebrace = strchr(params,
'>');
2512 if (closebrace-params > 127) {
2514 "Old name too long (up to 127 characters allowed)!");
2518 snprintf(buf,
sizeof(buf),
"%.*s", (
int)(closebrace-(params+1)), params+1);
2524 "Could not find a matching item to rename.");
2529 params = closebrace+1;
2530 while (
' ' == *params)
2537 "No marked item to rename.");
2543 if (!strncmp(params,
"to ", 3)) {
2545 while (
' ' == *params)
2547 if (
'<' != *params) {
2549 "Syntax error, expecting < at start of new name!");
2552 closebrace = strchr(params+1,
'>');
2555 "Syntax error, expecting > at end of new name!");
2560 if (closebrace-params > 127) {
2562 "New name too long (up to 127 characters allowed)!");
2567 snprintf(buf,
sizeof(buf),
"%.*s", (
int)(closebrace-(params+1)), params+1);
2570 for (counter = 0; counter < strlen(buf); counter++) {
2571 if (isalnum(buf[counter]))
2573 if (
' ' == buf[counter])
2575 if (
'\'' == buf[counter])
2577 if (
'+' == buf[counter])
2579 if (
'_' == buf[counter])
2581 if (
'-' == buf[counter])
2588 "Invalid new name!");
2593 if (strlen(params)) {
2595 "Syntax error, expected 'to <' after old name!");
2606 "No marked item to rename.");
2617 "This item has no custom name.");
2624 "You stop calling your %s with weird names.",
2628 if (custom_name != NULL && strcmp(custom_name, buf) == 0) {
2631 "You keep calling your %s %s.",
2641 "Your %s will now be called %s.",
2665 if (*params ==
'\0' || strlen(params) == 0) {
2674 "Can't find any matching item.");
2681 "Unlocked %s.", name);
2685 "Locked %s.", name);
2705 object *first, *second;
2714 strlcpy(copy, params,
sizeof(copy));
2715 with = strstr(copy,
" with ");
2722 with = with+strlen(
" with ");
2735 transformation = NULL;
2745 if (transformation->
yield)
2746 generated->
nrof = transformation->
yield;
#define AP_UNAPPLY
Item is to be remvoed.
void apply_by_living_below(object *pl)
Attempt to apply the object 'below' the player.
void sell_item(object *op, object *pl)
Player is selling an item.
#define FLAG_NO_DROP
Object can't be dropped.
#define NUM_BODY_LOCATIONS
Number of body locations.
int apply_special(object *who, object *op, int aflags)
Apply an object.
void command_throw(object *op, const char *params)
'throw' command.
#define FLAG_UNPAID
Object hasn't been paid for yet.
char * stringbuffer_finish(StringBuffer *sb)
Deallocate the string buffer instance and return the string.
#define MSG_TYPE_COMMAND_INVENTORY
Inventory listing.
#define FLAG_IS_LINKED
The object is linked with other objects.
see doc/Developers/objects
#define INS_BELOW_ORIGINATOR
Insert new object immediately below originator.
int change_skill(object *who, object *new_skill, int flag)
This changes the object's skill to new_skill.
uint8_t max_stat
Maximum stat value - 255 should be sufficient.
struct archetype * arch
Pointer to archetype.
int item_must_be_pickable
If non zero, then the item number is increased only if the item is pickable.
#define FLAG_IS_BUILDABLE
Can build on item.
bool player_can_find(object *op, object *ob)
Return true if player 'op' can see object 'op' for purpose of locating items for partial item matchin...
Eneq((at)csd.uu.se): Id for close_container archetype.
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
object_split(ob,nr) splits up ob into two parts.
static int matcher_all(object *who, matcher_params *params, object *item)
Function allowing all objects.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
int identifyskill
Skill used to identify this object class.
static int matcher_number(object *who, matcher_params *params, object *item)
Check if an item is the one at the desired position.
recipe * find_recipe_for_tool(const char *tool, recipe *from)
Find a recipe for a specified tool.
const typedata * get_typedata(int itemtype)
#define MSG_TYPE_COMMAND_FAILURE
Failed result from command.
static item_matcher make_matcher(object *who, const char *params, matcher_params *mp)
Parse parameters and sets up an item matcher based on them.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
#define EVENT_PICKUP
Object picked up.
#define FLAG_IS_FLOOR
Can't see what's underneath this object.
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
int identify_object_with_skill(object *tmp, object *pl, object *skill, int print_on_success)
Helper function for do_skill_ident, so that we can loop over inventory AND objects on the ground conv...
#define MSG_TYPE_SPELL
Spell related info.
#define FLAG_NO_FIX_PLAYER
fix_object() won't be called
#define LOOK_OBJ(ob)
This returns TRUE if the object is something that should be displayed in the look window...
int save_player(object *op, int flag)
Saves a player to disk.
bool csv_contains(std::string list, std::string item, std::string delim)
Split list by comma, then see if item matches anything in the list.
object * below
Pointer to the object stacked below this one.
uint32_t count
Any numbers typed before a command.
#define HUGE_BUF
Used for messages - some can be quite long.
object * drop_object(object *op, object *tmp, uint32_t nrof)
Try to drop an object on the floor.
#define MSG_TYPE_COMMAND_EXAMINE
Player examining something.
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
void examine_wand_charge_level(object *op, object *tmp)
Output charge information for a wand or staff.
#define MSG_TYPE_SPELL_INFO
random info about spell, not related to failure/success
sstring slaying
Which race to do double damage to.
#define NDI_BLUE
Actually, it is Dodger Blue.
static uint32_t NROF(const object *const ob)
Returns ob->nrof, unless it is 0, in which case return 1.
sstring add_string(const char *str)
Share a string.
int32_t value
How much money it is worth (or contains)
char name[MAX_BUF]
Name to match for.
void stringbuffer_trim_whitespace(StringBuffer *sb)
Trim trailing whitespace from a stringbuffer.
object * above
Pointer to the object stacked above this one.
int16_t SP_level_spellpoint_cost(object *caster, object *spell, int flags)
Scales the spellpoint cost of a spell by it's increased effectiveness.
method_ret ob_examine(const object *op, const object *observer, int use_media_tags, char *buf, size_t size)
Get examine text for OP as seen by OBSERVER.
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Changes experience to a player/monster.
#define MSG_TYPE_SKILL_MISSING
Don't have the skill.
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.
int16_t y
Position in the map for this object.
uint32_t mode
Mode of player for pickup.
void drop(object *op, object *tmp)
Drop an item, either on the floor or in a container.
uint32_t get_weight_limit(int stat)
static int matcher_pickup_type(object *who, matcher_params *params, object *item)
Check if an item matches a pickup type.
StringBuffer * stringbuffer_new(void)
Create a new string buffer.
linked_char * ingred
List of ingredients.
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
object * stop_item(object *op)
An item (ARROW or such) stops moving.
void inventory(object *op, object *inv)
Prints object's inventory.
animal 'body parts' -b.t.
Global type definitions and header inclusions.
Link an object type with skill needed to identify, and general name.
#define AP_APPLY
Item is to be applied.
struct player * contr
Pointer to the player which control this object.
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Sends message to player(s).
void command_apply(object *op, const char *params)
'apply' command.
#define FOR_OB_AND_BELOW_FINISH()
Finishes FOR_OB_AND_BELOW_PREPARE().
#define FLAG_REMOVED
Object is not in any map or invenory.
int32_t weight
Attributes of the object.
void command_dropall(object *op, const char *params)
Command to drop all items that have not been locked.
#define FLAG_KNOWN_MAGICAL
The object is known to be magical.
static std::shared_ptr< inja::Environment > env
Rendering environment.
bool pick_up(object *op, object *alt)
Try to pick up an item.
char method_ret
Define some standard return values for callbacks which don't need to return any other results...
Allows the use of a skill.
#define FLAG_UNDEAD
Monster is undead.
void examine_weight_and_material(object *op, object *tmp)
Output weight and material information for an examined object.
int probe(object *op, object *caster, object *spell_ob, int dir, int level)
Try to get information about a living thing.
#define AP_OPEN
Item is a container to be fully opened.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
void knowledge_item_can_be_used_alchemy(object *op, const object *item)
Displays known alchemy recipes an item can be used in.
uint32_t update_look
If true, we need to send the look window.
int16_t level
Level of creature or object.
int object_matches_string(object *pl, object *op, const char *name)
This is a subset of the parse_id command.
int(* item_matcher)(object *who, matcher_params *params, object *item)
Prototype for a function checking if an object matches some parameters.
#define MSG_TYPE_COMMAND
Responses to commands, eg, who.
int apply_by_living(object *pl, object *op, int aflag, int quiet)
Living thing is applying an object.
void query_weight(const object *op, char *buf, size_t size)
Formats the item's weight.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
int detect_curse_on_item(object *pl, object *tmp, object *skill)
Runs a 'detect curse' check on a given item.
uint64_t shop_price_buy(const object *obj, object *who)
Adjust the value of an item to be bought based on the player's bargaining skill and charisma...
sstring materialname
Specific material name.
sstring name
More definite name, like "generate_kobold".
object * object_insert_in_map(object *op, mapstruct *m, object *originator, int flag)
This function inserts the object in the two-way linked list which represents what is on a map...
char * cost_approx_str(const object *obj, object *who)
Return a textual cost approximation in a newly-allocated string.
void command_examine(object *op, const char *params)
'examine' command.
#define MSG_TYPE_COMMAND_SUCCESS
Successful result from command.
#define MSG_TYPE_COMMAND_ERROR
Bad syntax/can't use command.
Defines for loader.l / loader.c.
uint8_t search_items
Search_items command.
int32_t carrying
How much weight this object contains.
char * ob_describe(const object *op, const object *observer, int use_media_tags, char *buf, size_t size)
Returns the description (short item name) of an object, as seen by the given observer.
int item_to_pick
Index of the item to pick, 1-based.
char path[HUGE_BUF]
Filename of the map.
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
static bool IS_PLAYER(object *op)
object * env
Pointer to the object which is the environment.
void stringbuffer_append_string(StringBuffer *sb, const char *str)
Append a string to a string buffer instance.
tag_t last_examined
Tag of most recently 'examined object.
#define QUERY_FLAG(xyz, p)
void query_name(const object *op, char *buf, size_t size)
Describes an item.
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
#define MOVE_FLYING
Combo of fly_low and fly_high.
socket_struct * socket
Socket information for this player.
sstring msg
If this is a book/sign/magic mouth/etc.
static int matcher_name(object *who, matcher_params *params, object *item)
Check if an item matches a string.
sstring race
Human, goblin, dragon, etc.
#define FLAG_PROBE
Object displays HP information to player.
#define AP_NULL
Nothing specific.
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
int yield
Maximum number of items produced by the recipe.
static void do_skill_by_number(object *op, int skill_subtype, const char *params, const char *missing_message)
Attempt to use a skill from its subtype.
int item_number
Index of the checked item, 1-based.
void examine(object *op, object *tmp)
Player examines some object.
char * cost_str(uint64_t cost)
int is_identified(const object *op)
Return true if the item is identified, either because it is of a type that doesn't ever need identifi...
uint32_t mark_count
Count of marked object.
#define FLAG_IS_CAULDRON
container can make alchemical stuff
int do_skill(object *op, object *part, object *skill, int dir, const char *string)
Main skills use function-similar in scope to cast_spell().
uint8_t real_wiz
Use mud-like wizards.
struct Settings settings
Global settings.
sstring lore
Obscure information about this object, to get put into books and the like.
object * object_present_in_ob(uint8_t type, const object *op)
Searches for any objects with a matching type variable in the inventory of the given object...
void examine_rod_charge_level(object *op, object *tmp)
Output charge information for a rod.
const char * use_name
Name used when describing an item we can use.
uint32_t tag_t
Object tag, unique during the whole game.
void command_rskill(object *pl, const char *params)
'ready_skill' command.
#define HEAD(op)
Returns the head part of an object.
int object_matches_pickup_mode(const object *item, int mode)
Checks if an item matches a specific pickup mode.
#define FLAG_WIZ
Object has special privilegies.
living stats
Str, Con, Dex, etc.
#define MAX_BUF
Used for all kinds of things.
int16_t invisible
How much longer the object will be invis.
const char * nonuse_name
Name to describe objects we can't use.
archetype * get_archetype_by_skill_name(const char *skill, int type)
Retrieves an archetype by skill name and type.
size_t strlcpy(char *dst, const char *src, size_t size)
Portable implementation of strlcpy(3).
can add a skill to player's inventory -bt.
struct mapstruct * map
Pointer to the map in which this object is present.
Skill-related defines, including subtypes.
uint64_t shop_price_sell(const object *obj, object *who)
Adjust the value of an item to be sold based on the player's bargaining skill and charisma...
object * mark
Marked object.
bool examine_fluff(object *op, object *tmp, bool output)
Emit the "fluff", the non-mechanical flavour text, for a given item.
int object_can_pick(const object *who, const object *item)
Finds out if an object can be picked up.
#define FLAG_IS_THROWN
Object is designed to be thrown.
static const char * pickup_names[]
Valid names for pickup types.
int identifyskill2
Second skill used to identify this object class.
void command_search(object *op, const char *params)
'search' command.
bool shop_contains(object *ob)
Check if an object is in a shop.
int8_t facing
Object is oriented/facing that way.
object * object_find_by_type_and_name(const object *who, int type, const char *name)
Find object in inventory by type and name.
void knowledge_add_probe_monster(object *op, object *mon)
Display monster details, then add to a player's knowledge if not already.
#define FLAG_KNOWN_CURSED
The object is known to be cursed.
object * object_merge(object *op, object *top)
This function goes through all objects below and including top, and merges op to the first matching o...
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...
#define AP_NO_MERGE
Don't try to merge object after (un)applying it.
static int get_pickup_mode_index(const char *name)
Return the pickup index in pickup_names and pickup_modes associated with the specified name...
int8_t body_info[NUM_BODY_LOCATIONS]
Body info as loaded from the file.
sstring name_pl
The plural name of the object.
void query_base_name(const object *op, int plural, char *buf, size_t size)
Query a short name for the item.
void command_disarm(object *op, const char *params)
'disarm' command.
#define INS_NO_MERGE
Don't try to merge with other items.
int detect_magic_on_item(object *pl, object *tmp, object *skill)
Runs a 'detect magic' check on a given item.
object * container
Current container being used.
#define object_decrease_nrof_by_one(xyz)
static void set_pickup_mode(const object *op, int i)
Sets the 'old' pickup mode.
Also see SKILL_TOOL (74) below.
void command_empty(object *op, const char *params)
'empty' command.
void examine_monster(object *op, object *tmp, int level)
Player examine a monster.
MoveType move_type
Type of movement this object uses.
sstring name
The name of the object, obviously...
Only for debugging purposes.
uint32_t nrof
Number of objects.
sstring name
Usually monster-name/combination.
MoveType move_off
Move types affected moving off this space.
void command_use(object *op, const char *params)
Try to use an item on another.
static object * find_best_object_match(object *pl, const char *params)
Shortcut to find_best_apply_object_match(pl->inv, pl, params, AF_NULL);.
int set_object_face_main(object *op)
Makes an object's face the main face, which is supposed to be the "closed" one.
void command_drop(object *op, const char *params)
'drop' command.
#define MSG_TYPE_COMMAND_INFO
Generic info: resistances, etc.
#define CLEAR_FLAG(xyz, p)
uint8_t type
PLAYER, BULLET, etc.
static void empty_container(object *container, object *pl)
Put all contents of the container on the ground below the player or in opened container, except locked items.
char search_str[MAX_BUF]
Item we are looking for.
int transport_can_hold(const object *transport, const object *op, int nrof)
Can transport hold object op? This is a pretty trivial function, but in the future, possible transport may have more restrictions or weight reduction like containers.
#define FLAG_APPLIED
Object is ready for use by living.
body_locations_struct body_locations[NUM_BODY_LOCATIONS]
The ordering of this is actually doesn't make a difference However, for ease of use, new entries should go at the end so those people that debug the code that get used to something being in the location 4 don't get confused.
int object_set_value(object *op, const char *key, const char *value, int add_key)
Updates the key in op to value.
object * inv
Pointer to the first object in the inventory.
#define FOR_OB_AND_BELOW_PREPARE(op_)
Constructs a loop iterating over an object and all objects below it in the same pile.
#define FLAG_STARTEQUIP
Object was given to player at start.
void command_take(object *op, const char *params)
This takes (picks up) an item.
char ** arch_name
Possible archetypes of the final product made.
void command_rename_item(object *op, const char *params)
Changing the custom name of an item.
static object * find_best_apply_object_match(object *start, object *pl, const char *params, int aflag)
Search from start and through below for what matches best with params.
object * find_marked_object(object *op)
Return the object the player has marked with the 'mark' command below.
sstring skill
Name of the skill this object uses/grants.
uint32_t attacktype
Bitmask of attacks this object does.
#define FLAG_MONSTER
Will attack players.
void esrv_send_pickup(player *pl)
Sends the "pickup" state to pl if client wants it requested.
#define MSG_TYPE_SKILL
Messages related to skill use.
int events_execute_object_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
Execute an event on the specified object.
int pickup_type
Value in Pickup modes to match against.
#define NDI_UNIQUE
Print immediately, don't buffer.
#define FLAG_WAS_WIZ
Player was once a wiz.
int32_t food
How much food in stomach.
Structure containing object statistics.
void put_object_in_sack(object *op, object *sack, object *tmp, uint32_t nrof)
Something tries to put an object into another.
void command_search_items(object *op, const char *params)
'search-items' command.
static void pick_up_object(object *pl, object *op, object *tmp, int nrof)
Try to pick up some item.
A buffer that will be expanded as content is added to it.
int16_t maxhp
Max hit points.
#define FOR_BELOW_PREPARE(op_, it_)
Constructs a loop iterating over all objects below an object.
#define SK_SUBTRACT_SKILL_EXP
Used when removing exp.
object * object_get_player_container(object *op)
Finds the player carrying an object.
object * find_skill_by_number(object *who, int skillno)
This returns the first skill pointer of the given subtype (the one that accumulates exp...
int missed
How many items were missed when matching.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
void command_uskill(object *pl, const char *params)
'use_skill' command.
int use_skill(object *op, const char *string)
Similar to invoke command, it executes the skill in the direction that the user is facing...
int ingred_count
Number of items in ingred.
tag_t count
Unique object number for this object.
void command_lock_item(object *op, const char *params)
Alternate way to lock/unlock items (command line).
#define FLAG_NO_PICK
Object can't be picked up.
#define FLAG_NO_SKILL_IDENT
If set, item cannot be identified w/ a skill.
void command_mark(object *op, const char *params)
'mark' command, to mark an item for some effects (enchant armor, ...).
void query_short_name(const object *op, char *buf, size_t size)
query_short_name(object) is similar to query_name(), but doesn't contain any information about object...
#define AT_ACID
Random equipped item might corrode when hit (64)
static void display_new_pickup(const object *op, int old)
Utility function to display the pickup mode for a player.
#define FLAG_INV_LOCKED
Item will not be dropped from inventory.
object * find_skill_by_name(object *who, const char *name)
This returns the skill pointer of the given name (the one that accumulates exp, has the level...
object clone
An object from which to do object_copy()
void command_pickup(object *op, const char *params)
'pickup' command.
bool object_value_set(const object *op, const char *const key)
Determine if an extra value is set.
#define FOR_BELOW_FINISH()
Finishes FOR_BELOW_PREPARE().
#define CUSTOM_NAME_FIELD
Key in an object for the player-assigned custom name.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
#define EVENT_DROP
Object dropped on the floor.
static const uint32_t pickup_modes[]
Value in Pickup modes associated with pickup_names.
#define FLAG_FREED
Object is in the list of free objects.