57 {
"body_range",
"in your range slot",
"in a human's range slot" },
58 {
"body_arm",
"on your arm",
"on a human's arm" },
59 {
"body_torso",
"on your body",
"on a human's torso" },
60 {
"body_head",
"on your head",
"on a human's head" },
61 {
"body_neck",
"around your neck",
"around a human's neck" },
62 {
"body_skill",
"in your skill slot",
"in a human's skill slot" },
63 {
"body_finger",
"on your finger",
"on a human's finger" },
64 {
"body_shoulder",
"around your shoulders",
"around a human's shoulders" },
65 {
"body_foot",
"on your feet",
"on a human's feet" },
66 {
"body_hand",
"on your hands",
"on a human's hands" },
67 {
"body_wrist",
"around your wrists",
"around a human's wrist" },
68 {
"body_waist",
"around your waist",
"around a human's waist" },
69 {
"body_leg",
"around your legs",
"around a human's legs" },
81 { 0,
"none",
"none", 0, 0 },
82 {
PLAYER,
"player",
"players", 0, 0 },
83 {
TRANSPORT,
"transport",
"transports", 0, 0 },
85 {
TREASURE,
"treasure",
"treasure", 0, 0 },
90 {
CLOCK,
"clock",
"clocks", 0, 0 },
95 {
PEDESTAL,
"pedestal",
"pedestals", 0, 0 },
96 {
ALTAR,
"altar",
"altars", 0, 0 },
97 {
LOCKED_DOOR,
"locked door",
"locked doors", 0, 0 },
98 {
SPECIAL_KEY,
"special key",
"special keys", 0, 0 },
99 {
MAP,
"map",
"maps", 0, 0 },
100 {
DOOR,
"door",
"doors", 0, 0 },
101 {
KEY,
"key",
"keys", 0, 0 },
102 {
TIMED_GATE,
"timed_gate",
"timed_gates", 0, 0 },
103 {
TRIGGER,
"trigger",
"triggers", 0, 0 },
104 {
GRIMREAPER,
"grimreaper",
"grimreapers", 0, 0 },
105 {
MAGIC_EAR,
"magic ear",
"magic ears", 0, 0 },
111 {
MONEY,
"money",
"money", 0, 0 },
112 {
CLASS,
"class",
"classes", 0, 0 },
114 {
PLAYERMOVER,
"player mover",
"player movers", 0, 0 },
115 {
TELEPORTER,
"teleporter",
"teleporters", 0, 0 },
116 {
CREATOR,
"creator",
"creators", 0, 0 },
117 {
SKILL,
"skill",
"skills", 0, 0 },
118 {
EARTHWALL,
"earthwall",
"earthwalls", 0, 0 },
119 {
GOLEM,
"golem",
"golems", 0, 0 },
120 {
THROWN_OBJ,
"projectile",
"projectiles", 0, 0 },
121 {
BLINDNESS,
"blindness",
"blindness", 0, 0 },
122 {
GOD,
"god",
"gods", 0, 0 },
123 {
DETECTOR,
"detector",
"detectors", 0, 0 },
125 {
DEAD_OBJECT,
"dead object",
"dead objects", 0, 0 },
127 {
MARKER,
"marker",
"markers", 0, 0 },
128 {
HOLY_ALTAR,
"holy altar",
"holy altars", 0, 0 },
130 {
BATTLEGROUND,
"battleground",
"battlegrounds", 0, 0 },
131 {
PEACEMAKER,
"peacemaker",
"peacemakers", 0, 0 },
133 {
FIREWALL,
"firewall",
"firewalls", 0, 0 },
134 {
CHECK_INV,
"inventory checker",
"inventory checkers", 0, 0 },
135 {
MOOD_FLOOR,
"mood floor",
"mood floors", 0, 0 },
136 {
EXIT,
"exit",
"exits", 0, 0 },
137 {
ENCOUNTER,
"encounter",
"encounters", 0, 0 },
138 {
SHOP_FLOOR,
"shop floor",
"shop floors", 0, 0 },
139 {
SHOP_MAT,
"shop mat",
"shop mats", 0, 0 },
141 {
FLOOR,
"floor",
"floors", 0, 0 },
144 {
SKILL_TOOL,
"skill tool",
"skill tools", 0, 0 },
145 {
LIGHTER,
"lighter",
"lighters", 0, 0 },
146 {
WALL,
"wall",
"walls", 0, 0 },
147 {
MISC_OBJECT,
"bric-a-brac",
"bric-a-brac", 0, 0 },
148 {
MONSTER,
"monster",
"monsters", 0, 0 },
149 {
LAMP,
"lamp",
"lamps", 0, 0 },
150 {
DUPLICATOR,
"duplicator",
"duplicators", 0, 0 },
153 {
SPINNER,
"spinner",
"spinners", 0, 0 },
154 {
GATE,
"gate",
"gates", 0, 0 },
155 {
BUTTON,
"button",
"buttons", 0, 0 },
156 {
CF_HANDLE,
"cf handle",
"cf handles", 0, 0 },
157 {
HOLE,
"hole",
"holes", 0, 0 },
158 {
TRAPDOOR,
"trapdoor",
"trapdoors", 0, 0 },
159 {
SIGN,
"sign",
"signs", 0, 0 },
162 {
SPELL,
"spell",
"spells", 0, 0 },
163 {
SPELL_EFFECT,
"spell effect",
"spell effects", 0, 0 },
164 {
CONVERTER,
"converter",
"converters", 0, 0 },
166 {
POISONING,
"poisoning",
"poisonings", 0, 0 },
167 {
SAVEBED,
"savebed",
"savebeds", 0, 0 },
170 {
DIRECTOR,
"director",
"directors", 0, 0 },
172 {
FORCE,
"force",
"forces", 0, 0 },
179 {
DEEP_SWAMP,
"deep swamp",
"deep swamps", 0, 0 },
182 {
RUNE,
"rune",
"runes", 0, 0 },
183 {
TRAP,
"trap",
"traps", 0, 0 },
185 {
CORPSE,
"corpse",
"corpses", 0, 0 },
186 {
DISEASE,
"disease",
"diseases", 0, 0 },
187 {
SYMPTOM,
"symptom",
"symptoms", 0, 0 },
188 {
BUILDER,
"item builder",
"item builders", 0, 0 },
189 {
MATERIAL,
"building material",
"building materials", 0, 0 },
191 {
LIGHTABLE,
"lightable",
"lightables", 0, 0 },
216 if (ench > (
int)(
sizeof(enc_to_item_power)/
sizeof(*enc_to_item_power)-1))
218 return enc_to_item_power[ench];
222 std::bitset<32> xs = x;
332 if (item_types[i].number == itemtype)
333 return &item_types[i];
352 if (!strcmp(item_types[i].name, name))
353 return &item_types[i];
355 if (!strcmp(item_types[i].name_pl, name)) {
356 LOG(
llevInfo,
"get_typedata_by_name: I have been sent the plural %s, the singular form %s is preffered\n", name, item_types[i].name);
357 return &item_types[i];
385 if (use_media_tags) {
389 if (op->
resist[tmpvar] == 100 || op->
resist[tmpvar] == -100) {
397 if (use_media_tags) {
398 if (op->
resist[tmpvar] == 100 || op->
resist[tmpvar] == -100) {
424 snprintf(buf, size,
" ");
426 snprintf(buf, size,
"%6.1f", i/1000.0);
428 snprintf(buf, size,
"%4d ", i/1000);
457 for (attr = 0; attr <
NUM_STATS; attr++) {
521 if (op->
name == NULL) {
522 snprintf(buf, size,
"(null)");
553 snprintf(buf+len, size-len,
" (lvl %d)", op->
level);
554 len += strlen(buf+len);
578 snprintf(buf+len, size-len,
" %+d", op->
magic);
579 len += strlen(buf+len);
695 if ((!plural && !op->
name)
697 strncpy(buf,
"(null)", size);
702 strncpy(buf, op->
name, size);
735 snprintf(buf+len, size-len,
" (lvl %d)", op->
level);
736 len += strlen(buf+len);
760 snprintf(buf+strlen(buf), size-strlen(buf),
" %+d", op->
magic);
1044 for (attr = 0; attr <
NUM_STATS; attr++) {
1244 if (op->
title != NULL)
1457 }
else if (op->
arch) {
1478 }
else if (op->
env) {
1509 const int number =
NROF(obj);
1511 uint64_t val = (uint64_t)obj->
value * number;
1516 float ratio = atof(key);
1532 if (!identified && obj->
arch) {
1551 if (obj->
arch != NULL && identified) {
1553 val *= pow(1.15, diff);
const char *const change_resist_msg[NROFATTACKS]
These are the descriptions of the resistances displayed when a player puts on/takes off an item...
#define FLAG_KNOWN_BLESSED
Item is known to be blessed.
#define NUM_BODY_LOCATIONS
Number of body locations.
int16_t gen_hp
Bonuses to regeneration speed of hp.
#define FLAG_SEE_IN_DARK
if set ob not effected by darkness
#define WEAPON_SPEED(xyz)
#define FLAG_DAMNED
The object is very cursed.
#define FLAG_UNPAID
Object hasn't been paid for yet.
#define UP_OBJ_FACE
Only thing that changed was the face.
char * stringbuffer_finish(StringBuffer *sb)
Deallocate the string buffer instance and return the string.
see doc/Developers/objects
Spell-related defines: spellpath, subtypes, ...
int8_t item_power
Power rating of the object.
const char *const short_stat_name[NUM_STATS]
Short name of stats.
This represents one animation.
struct archetype * arch
Pointer to archetype.
int calc_item_power(const object *op)
This takes an object 'op' and figures out what its item_power rating should be.
StringBuffer * describe_item(const object *op, const object *owner, int use_media_tags, StringBuffer *buf)
Describes an item, in all its details.
#define FLAG_HITBACK
Object will hit back when hit.
Eneq((at)csd.uu.se): Id for close_container archetype.
#define FLAG_USE_SCROLL
(Monster) can read scroll
void animate_object(object *op, int dir)
Updates the face-variable of an object.
#define ARMOUR_SPELLS(xyz)
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
#define FABS(x)
Decstations have trouble with fabs()...
int identifyskill
Skill used to identify this object class.
const typedata * get_typedata(int itemtype)
#define FLAG_USE_ARMOUR
(Monster) can wear armour/shield/helmet
#define FLAG_FRIENDLY
Will help players.
size_t stringbuffer_length(StringBuffer *sb)
Return the current length of the buffer.
sstring slaying
Which race to do double damage to.
static uint32_t NROF(const object *const ob)
Returns ob->nrof, unless it is 0, in which case return 1.
int32_t value
How much money it is worth (or contains)
int8_t luck
Affects thaco and ac from time to time.
Object for applying character class modifications to someone.
#define FLAG_STEALTH
Will wake monsters with less range.
int16_t y
Position in the map for this object.
int8_t magic
Any magical bonuses to this item.
#define FLAG_USE_WEAPON
(Monster) can wield weapons
int is_dragon_pl(const object *op)
Checks if player is a dragon.
#define FLAG_BLESSED
Item has a blessing, opposite of cursed/damned.
int get_power_from_ench(int ench)
sstring add_refcount(sstring str)
Like add_string(), but the string is already a shared string.
StringBuffer * stringbuffer_new(void)
Create a new string buffer.
Duplicator/multiplier object.
uint32_t path_repelled
Paths the object is repelled from.
#define FLAG_REFLECTING
Object reflects from walls (lightning)
animal 'body parts' -b.t.
Global type definitions and header inclusions.
Link an object type with skill needed to identify, and general name.
struct player * contr
Pointer to the player which control this object.
StringBuffer * describe_spellpath_attenuation(const char *attenuation, int value, StringBuffer *buf)
Describe the specified path attenuation.
#define FLAG_USE_RING
(Monster) can use rings, boots, gauntlets, etc
StringBuffer * describe_attacktype(const char *attack, int value, StringBuffer *buf)
Describe the specified attack type.
peterm: detector is an object which notices the presense of another object and is triggered like butt...
uint8_t anim_speed
Ticks between animation-frames.
int32_t weight
Attributes of the object.
#define FLAG_KNOWN_MAGICAL
The object is known to be magical.
#define FLAG_SEE_INVISIBLE
Will see invisible player.
Allows the use of a skill.
#define FLAG_UNDEAD
Monster is undead.
const Face * try_find_face(const char *name, const Face *error)
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
Generic item builder, see subtypes below.
int is_magical(const object *op)
Checks whether object is magical.
int16_t level
Level of creature or object.
int is_identifiable_type(const object *op)
Return true if this item's type is one that cares about whether or not it's been identified – e...
Floor tile -> native layer 0.
#define FLAG_CLIENT_ANIM_SYNC
Let client animate this, synchronized.
void query_weight(const object *op, char *buf, size_t size)
Formats the item's weight.
#define FLAG_ALIVE
Object can fight (or be fought)
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
#define FLAG_REFL_SPELL
Spells (some) will reflect from object.
object * identify(object *op)
Identifies an item.
void safe_strcat(char *dest, const char *orig, size_t *curlen, size_t maxlen)
Simple function we use below to keep adding to the same string but also make sure we don't overwrite ...
battleground, by Andreas Vogl
inserts an invisible, weightless force into a player with a specified string.
#define MOVE_SWIM
Swimming object.
float speed
Frequency of object 'moves' relative to server tick rate.
int32_t carrying
How much weight this object contains.
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
Append a formatted string to a string buffer instance.
int16_t digestion
Any bonuses/penalties to digestion.
#define FLAG_CAN_USE_SKILL
The monster can use skills.
#define MOVE_FLY_LOW
Low flying object.
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.
#define FLAG_UNAGGRESSIVE
Monster doesn't attack players.
inserts an invisible, weightless force into a player with a specified string WHEN TRIGGERED...
#define QUERY_FLAG(xyz, p)
const char *const resist_color[NROFATTACKS]
Colors to add to the resistances for media tags.
#define FLAG_USE_RANGE
(Monster) can apply and use range items
void object_give_identified_properties(object *op)
Ensure op has all its "identified" properties set.
void query_name(const object *op, char *buf, size_t size)
Describes an item.
StringBuffer * describe_resistance(const object *op, int newline, int use_media_tags, StringBuffer *buf)
Generates the visible naming for resistances.
#define FLAG_IDENTIFIED
Item is identifiable (e.g.
const Animations * animation
Animation of this item, NULL if not animated.
int atnr_is_dragon_enabled(int attacknr)
Determine if the attacktype represented by the specified attack-number is enabled for dragon players...
#define ARMOUR_SPEED(xyz)
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
#define GET_MAP_TOP(M, X, Y)
Gets the top object on a map.
const Face * face
Face with colors.
int8_t glow_radius
indicates the glow radius of the object
StringBuffer * describe_monster(const object *op, int use_media_tags, StringBuffer *buf)
Describes a monster.
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...
uint8_t last_anim
Last sequence used to draw face.
#define FLAG_XRAYS
X-ray vision.
int16_t dam
How much damage this object does when hitting.
uint32_t path_denied
Paths the object is denied access to.
#define FLAG_BEEN_APPLIED
Object was ever applied, for identification purposes.
living stats
Str, Con, Dex, etc.
#define FLAG_CAST_SPELL
(Monster) can learn and cast spells
Object owned by a player which can convert a monster into a peaceful being incapable of attack...
uint64_t price_base(const object *obj)
Price an item based on its value or archetype value, type, identification/BUC status, and other heuristics.
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.
static const int item_types_size
Number of items in item_types array.
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.
#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...
#define FLAG_CURSED
The object is cursed.
struct treasurelist * randomitems
Items to be generated.
const typedata * get_typedata_by_name(const char *name)
#define FLAG_ANIMATE
The object looks at archetype for faces.
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.
Mark Wedel (mark@pyramid.com) Shop inventories.
object * container
Current container being used.
#define FREE_AND_COPY(sv, nv)
Release the shared string if not NULL, and make it a reference to nv.
treasure * next
Next treasure-item in a linked list.
Also see SKILL_TOOL (74) below.
int16_t gen_grace
Bonuses to regeneration speed of grace.
Animations * try_find_animation(const char *name)
MoveType move_type
Type of movement this object uses.
sstring name
The name of the object, obviously...
int calc_item_enhancement(const object *op)
int8_t get_attr_value(const living *stats, int attr)
Gets the value of a stat.
sstring title
Of foo, etc.
uint32_t nrof
Number of objects.
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
#define CLEAR_FLAG(xyz, p)
treasure * items
Items in this list, linked.
uint8_t type
PLAYER, BULLET, etc.
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
#define FLAG_APPLIED
Object is ready for use by living.
#define FLAG_LIFESAVE
Saves a players' life once, then destr.
static const typedata item_types[]
The following is a large table of item types, the fields are: item number, item name, item name (plural), and two numbers that are the skills used to identify them.
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.
int16_t gen_sp
Bonuses to regeneration speed of sp.
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 FLAG_MAKE_INVIS
(Item) gives invisibility when applied
treasure is one element in a linked list, which together consist of a complete treasure-list.
static StringBuffer * ring_desc(const object *op, int use_media_tags, StringBuffer *buf)
Describes a ring or amulet, or a skill.
#define MIN_ACTIVE_SPEED
Cut off point of when an object is put on the active list or not.
static int bits_set(uint32_t x)
uint32_t attacktype
Bitmask of attacks this object does.
#define FLAG_MONSTER
Will attack players.
See Monster (Grimreaper).
#define MOVE_FLY_HIGH
High flying object.
A force, holding the effect of a resistance potion.
#define FLAG_CLIENT_ANIM_RANDOM
Client animate this, randomized.
const char *const resist_plus[NROFATTACKS]
Attack types to show to the player.
int32_t food
How much food in stomach.
metals, minerals, dragon scales
Structure containing object statistics.
struct archetype * item
Which item this link can be.
A buffer that will be expanded as content is added to it.
object * object_get_player_container(object *op)
Finds the player carrying an object.
int8_t wc
Weapon Class, lower WC increases probability of hitting.
void object_update(object *op, int action)
object_update() updates the array which represents the map.
#define FLAG_NO_SKILL_IDENT
If set, item cannot be identified w/ a skill.
#define FLAG_REFL_MISSILE
Arrows will reflect from object.
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 FLAG_INV_LOCKED
Item will not be dropped from inventory.
object * map_find_by_type(mapstruct *m, int x, int y, uint8_t type)
Searches for any objects with a matching type variable at the given map and coordinates.
object clone
An object from which to do object_copy()
#define FLAG_USE_BOW
(Monster) can apply and fire bows
uint32_t path_attuned
Paths the object is attuned to.
int32_t last_eat
How long since we last ate.
static const int enc_to_item_power[]
This curve may be too steep.
#define FLAG_IS_TURNABLE
Object can change face with direction.