This is the description of fields of the object structure, and what they are used to.
The struct living and struct key_value have their own pages.
The term Shared Strings has it's own page, too.
See also page Objects .
These Object Fields are for now sorted alphabetically here .
Whenever =field= gets changed, please do it in the sorted pages in the :arch:arch_attributes:* namespace.
fill in the blanks :) add sharedstring info
make a script to either do object.h → this page, or this page → object.h
IMHO one should put this data into object.h, in doxygen format, and make a script to do object.h → this page — Alex Schultz 2007/01/03 12:50
The items in crossfire are called either Archetypes or Objects.
These items can have many shapes, as for player's inventory items,
monsters, NPCs, map building, climate, magics, skills, and probably more.
One main structure handling these Objects is
typedef struct obj { /* 160 lines of fields here */ } object;
At the top of this structure the commentary says
/**
* Main Crossfire structure, one ingame object.
*
* Note that the ordering of this structure is sort of relevant -
* object_copy() copies everything over beyond 'name' using memcpy.
* Thus, values that need to be copied need to be located beyond that
* point.
*
* However, if you're keeping a pointer of some sort, you probably
* don't just want it copied, so you'll need to add to common/object.c,
* e.g. copy-object
*
* I've tried to clean up this structure a bit (in terms of formatting)
* by making it more consistent. I've also tried to locate some of the fields
* more logically together (put the item related ones together, the monster
* related ones, etc.
* This structure is best viewed with about a 100 width screen.
* MSW 2002-07-05
*
* See the @ref page_object "documentation page" for more details.
*/
and that it is better left “unsorted” beyond 'name' .
typedef struct obj { /* These variables are not changed by object_copy() */ struct pl *contr; /**< Pointer to the player which control this object */ struct obj *next; /**< Pointer to the next object in the free/used list */ struct obj *prev; /**< Pointer to the previous object in the free/used list*/ struct obj *active_next; /**< Next object in the 'active' list * This is used in process_events * so that the entire object list does not * need to be gone through.*/ struct obj *active_prev; /**< Previous object in the 'active list * This is used in process_events * so that the entire object list does not * need to be gone through. */ struct obj *below; /**< Pointer to the object stacked below this one */ struct obj *above; /**< Pointer to the object stacked above this one */ /* Note: stacked in the *same *environment*/ struct obj *inv; /**< Pointer to the first object in the inventory */ struct obj *container; /**< Current container being used. I think this * is only used by the player right now. */ struct obj *env; /**< Pointer to the object which is the environment. * This is typically the container that the object is in. */ struct obj *more; /**< Pointer to the rest of a large body of objects */ struct obj *head; /**< Points to the main object of a large body */ struct mapdef *map; /**< Pointer to the map in which this object is present */ tag_t count; /**< Unique object number for this object */ struct struct_dialog_information *dialog_information; /**< Parsed dialog information for this object. * Valid if FLAG_DIALOG_PARSED is set (but can be NULL). */ /* These get an extra add_refcount(), after having been copied by memcpy(). * All fields beow this point are automatically copied by memcpy. If * adding something that needs a refcount updated, make sure you modify * object_copy() to do so. Everything below here also gets cleared * by object_clear() */ sstring artifact; /**< If set, the item is the artifact with this name and the matching type. */ const char *name; /**< The name of the object, obviously... */ const char *name_pl; /**< The plural name of the object */ const char *anim_suffix; /**< Used to determine combined animations */ const char *title; /**< Of foo, etc */ const char *race; /**< Human, goblin, dragon, etc */ const char *slaying; /**< Which race to do double damage to. * If this is an exit, this is the filename */ const char *skill; /**< Name of the skill this object uses/grants */ const char *msg; /**< If this is a book/sign/magic mouth/etc */ const char *lore; /**< Obscure information about this object, * to get put into books and the like. */ sint16 x, y; /**< Position in the map for this object */ sint16 ox, oy; /**< For debugging: Where it was last inserted */ float speed; /**< The overall speed of this object */ float speed_left; /**< How much speed is left to spend this round */ float weapon_speed; /**< The overall speed of this object */ float weapon_speed_left; /**< How much speed is left to spend this round */ const New_Face *face; /**< Face with colors */ uint32 nrof; /**< How many of the objects */ sint8 direction; /**< Means the object is moving that way. */ sint8 facing; /**< Object is oriented/facing that way. */ /* This next big block are basically used for monsters and equipment */ uint8 type; /**< PLAYER, BULLET, etc. See define.h */ uint8 subtype; /**< Subtype of object */ uint16 client_type; /**< Public type information. see doc/Developers/objects */ sint16 resist[NROFATTACKS]; /**< Resistance adjustments for attacks */ uint32 attacktype; /**< Bitmask of attacks this object does */ uint32 path_attuned; /**< Paths the object is attuned to */ uint32 path_repelled; /**< Paths the object is repelled from */ uint32 path_denied; /**< Paths the object is denied access to */ const char *materialname; /**< Specific material name */ uint16 material; /**< What materials this object consist of */ sint8 magic; /**< Any magical bonuses to this item */ uint8 state; /**< How the object was last drawn (animation) */ sint32 value; /**< How much money it is worth (or contains) */ sint16 level; /**< Level of creature or object */ /* Note that the last_.. values are sometimes used for non obvious * meanings by some objects, eg, sp penalty, permanent exp. */ sint32 last_eat; /**< How long since we last ate */ sint32 last_heal; /**< Last healed. Depends on constitution */ sint32 last_sp; /**< As last_heal, but for spell points */ sint16 last_grace; /**< As last_sp, except for grace */ sint16 invisible; /**< How much longer the object will be invis */ uint8 pick_up; /**< See crossfire.doc */ sint8 item_power; /**< Power rating of the object */ sint8 gen_sp_armour; /**< Sp regen penalty this object has (was last_heal)*/ sint8 glow_radius; /**< indicates the glow radius of the object */ sint32 weight; /**< Attributes of the object */ sint32 weight_limit; /**< Weight-limit of object */ sint32 carrying; /**< How much weight this object contains */ living stats; /**< Str, Con, Dex, etc */ sint64 perm_exp; /**< Permanent exp */ struct obj *current_weapon; /**< Pointer to the weapon currently used */ uint32 weapontype; /**< Type of weapon */ sint8 body_info[NUM_BODY_LOCATIONS]; /**< Body info as loaded from the file */ sint8 body_used[NUM_BODY_LOCATIONS]; /**< Calculated value based on items equipped */ /* See the doc/Developers/objects for more info about body locations */ /* Following mostly refers to fields only used for monsters */ struct obj *owner; /**< Pointer to the object which controls this one. * Owner should not be referred to directly - * object_get_owner() should be used instead. */ tag_t ownercount; /**< What count the owner had (in case owner has been freed) */ struct obj *enemy; /**< Monster/player to follow even if not closest */ struct obj *attacked_by; /**< This object start to attack us! only player & monster */ tag_t attacked_by_count; /**< The tag of attacker, so we can be sure */ uint16 run_away; /**< Monster runs away if it's hp goes below this percentage. */ struct treasureliststruct *randomitems; /**< Items to be generated */ struct obj *chosen_skill; /**< The skill chosen to use */ uint32 hide; /**< The object is hidden, not invisible */ /* changes made by kholland@sunlab.cit.cornell.edu */ /* allows different movement patterns for attackers */ sint32 move_status; /**< What stage in attack mode */ uint16 attack_movement;/**< What kind of attack movement */ uint8 will_apply; /**< See crossfire.doc and @ref WILL_APPLY_xxx */ sint8 sound_chance; /**< Probability, 0 to 100, of the object emitting a sound. */ struct obj *spellitem; /**< Spell ability monster is choosing to use */ double expmul; /**< needed experience = (calc_exp*expmul) - means some * races/classes can need less/more exp to gain levels */ /* Spell related information, may be useful elsewhere * Note that other fields are used - these files are basically * only used in spells. */ sint16 casting_time; /**< Time left before spell goes off */ sint16 duration; /**< How long the spell lasts */ uint8 duration_modifier; /**< how level modifies duration */ sint8 range; /**< Range of the spell */ uint8 range_modifier; /**< How going up in level effects range */ uint8 dam_modifier; /**< How going up in level effects damage */ struct obj *spell; /**< Spell that was being cast */ char *spellarg; /* Following are values used by any object */ struct archt *arch; /**< Pointer to archetype */ struct archt *other_arch; /**< Pointer used for various things - mostly used for what * this objects turns into or what this object creates */ uint32 flags[4]; /**< Various flags */ uint16 animation_id; /**< An index into the animation array */ uint8 anim_speed; /**< Ticks between animation-frames */ uint8 last_anim; /**< Last sequence used to draw face */ uint16 temp_animation_id; /**< An index into the temporary animation array */ uint8 temp_anim_speed; /**< Ticks between temporary animation-frames */ sint32 elevation; /**< Elevation of this terrain - used in weather code */ uint8 smoothlevel; /**< how to smooth this square around*/ uint8 map_layer; /**< What level to draw this on the map */ MoveType move_type; /**< Type of movement this object uses */ MoveType move_block; /**< What movement types this blocks */ MoveType move_allow; /**< What movement types explicitly allowed */ MoveType move_on; /**< Move types affected moving on to this space */ MoveType move_off; /**< Move types affected moving off this space */ MoveType move_slow; /**< Movement types this slows down */ float move_slow_penalty; /**< How much this slows down the object */ const char *custom_name; /**< Custom name assigned by player */ key_value *key_values; /**< Fields not explictly known by the loader. */ sint16 *discrete_damage; /**< damage values, based on each attacktype. */ tag_t *spell_tags; } object;
Type: pl *
Comment: Pointer to the player which control this object.
Meaning: Will only be set for the player's object itself, and not items in inventory.
Type: obj *
Comment: Pointer to the next object in the free/used list.
Meaning: Should not be used much.
check server/c_object.c:840
,
line for (tmp=op→below; tmp!=NULL; tmp=tmp→next)
sounds suspicious (should probably be tmp→below
).
Type: obj *
Comment: Pointer to the next object in the free/used list.
Meaning: Should not be used much.
Type: obj *
Comment: Next object in the 'active' list. This is used in process_events() so that the entire object list does not need to be gone through.
Meaning: Should not be used much.
Type: obj *
Comment: Previous object in the 'active list This is used in process_events so that the entire object list does not need to be gone through.
Meaning: Should not be used much.
Type: obj *
Comment: Pointer to the object stacked below this one.
Meaning: Will link items on a same spot, or in the same container.
Type: obj *
Comment: Pointer to the object stacked above this one.
Meaning: Will link items on a same spot, or in the same container.
Type: obj *
Comment: Pointing to the first item in inventory.
Meaning:
Other items are available through below chaining.
Type: obj *
Comment: Current container being used. I think this is only used by the player right now.
Meaning:
Type: obj *
Comment: Pointer to the object which is the environment. This is typically the container that the object is in.
Meaning:
Type: obj *
Comment: Pointer to the rest of a large body of objects
Meaning:
Type: obj *
Comment: Points to the main object of a large body
Meaning: Large bodies are archetypes that occupy more than one tile on a map ( monsters, buildings ) .
Type: mapdef *
Comment: Pointer to the map in which this object is present
Meaning:
Type: tag_t
Comment: Unique object number for this object
Meaning:
Type: struct_dialog_information *
Comment: Parsed dialog information for this object. Valid if FLAG_DIALOG_PARSED is set (but can be NULL).
Meaning: NEW introduced since ?
Needs to be unsorted.
/* These get an extra add_refcount(), after having been copied by memcpy(). * All fields beow this point are automatically copied by memcpy. If * adding something that needs a refcount updated, make sure you modify * object_copy() to do so. Everything below here also gets cleared * by object_clear() */
Type: sstring
Comment: If set, the item is the artifact with this name and the matching type.
Meaning: NEW introduced since ?
Type: const char * (shared string)
Comment: The name of the object, obviously…
Meaning:
Type: const char * (shared string)
Comment: The plural name of the object.
Meaning: Shared string.
Type: const char
Comment: Used to determine combined animations
When a player or a monster attacks or uses a skill, if this suffix is defined on the weapon (combat) or the skill (skill use), the server tries to find an animation named “[player_or_monster_animation]_[anim_suffix]”.
For instance, for a Fenx using an animation “fenx_player” who uses a sword (anim_suffix “sword”), when attacking, the “fenx_player_sword” animation will be used if it exists.
If no suffix is defined or the animation doesn't exist, then nothing happens, else the animation is applied until it finished.
Type: const char * (shared string)
Comment: Of foo, etc.
Meaning:
Type: const char * (shared string)
Comment: Human, goblin, dragon, etc.
Meaning: For “living” things.
For SPELL with SP_RAISE_DEAD subtype, if set, then this is the name of a treasurelist of possible races in which the character will be reincarnated into
Type: const char * (shared string)
Comment: Which race to do double damage to. If this is an exit, this is the filename.
Meaning:
many more uses
Type: const char * (shared string)
Comment: Name of the skill this object uses/grants
Meaning:
Type: const char * (shared string)
Comment: If this is a book/sign/magic mouth/etc
Meaning:
check other uses.
Type: const char * (shared string)
Comment: Obscure information about this object, to get put into books and the like.
Meaning:
Type: sint16
Comment: Position 'x' in the map for this object
Meaning:
Type: sint16
Comment: Position 'y' in the map for this object
Meaning:
Type: sint16
Comment: For debugging: Where it was last inserted
Meaning:
Type: sint16
Comment: For debugging: Where it was last inserted
Meaning:
Type: float
Comment: The overall speed of this object
Meaning:
Type: float
Comment: How much speed is left to spend this round
Meaning:
Type: float
Comment: The overall speed of this object
Meaning:
Type: float
Comment: How much speed is left to spend this round
Meaning:
Type: const New_Face *
Comment: Face with colors
Meaning:
Type: uint32
Comment: How many of the objects
Meaning:
Type: sint8
Comment: Means the object is moving that way.
Meaning:
Type: sint8
Comment: Object is oriented/facing that way.
Meaning:
Type: uint8
Comment: Subtype of object
Meaning:
Type: uint16
Comment: Public type information. see doc/Developers/objects
Meaning:
Type: sint16[NROFATTACKS]
Comment: Resistance adjustments for attack
Meaning:
Type: uint32
Comment: Bitmask of attacks this object does
Meaning:
Type: uint32
Comment: Paths the object is attuned to
Meaning:
Type: uint32
Comment: Paths the object is repelled from
Meaning:
Type: uint32
Comment: Paths the object is denied access to
Meaning:
Type: const char * (shared string)
Coment: Specific material name
Meaning:
Type: uint16
Comment: What materials this object consist of
Meaning:
Type: sint8
Comment: Any magical bonuses to this item
Meaning:
Type: uint8
Comment: How the object was last drawn (animation)
Meaning:
Type: sint32
Comment: How much money it is worth (or contains)
Meaning:
Type: sint16
Comment: Level of creature or object
Meaning: Mainly the skill level which a character has to have to successfully cast magic upon monster-with-level .
Type: sint16
Comment: How long since we last ate
Meaning:
Type: sint32
Comment: Last healed. Depends on constitution
Meaning:
Type: sint32
Comment: As last_heal, but for spell points
Meaning:
Type: sint16
Comment: As last_sp, except for grace
Meaning:
Type: sint16
Comment: How much longer the object will be invis
Meaning:
Type: uint8
Comment: See crossfire.doc
Meaning:
Type: sint8
Comment: Power rating of the object
Meaning: The character has a limited item power maximum to be able to apply magical items.
If the sum of the item_power of all applied items reaches the allowed maximum,
no more magical item with item_power > 0 can be wielded / worn.
Type: sint8
Comment: Sp regen penalty this object has (was last_heal)
Meaning:
Type: sint8
Comment: indicates the glow radius of the object
Meaning:
Type: sint32
Comment: Attributes of the object
Meaning:
Type: sint32
Comment: Weight-limit of object
Meaning:
Type: sint32
Comment: How much weight this object contains
Meaning:
Type: sint64
Comment: Permanent exp
Meaning:
Type: const char * (shared string)
Comment:
Meaning: Not anymore included since when ?
Type: obj *
Comment: Pointer to the weapon currently used
Meaning:
Type: uint32
Comment: Type of weapon
Meaning:
Type: uint32
Comment:
Meaning: Not included anymore since when ?
Type: sint8[NUM_BODY_LOCATIONS]
Comment: Body info as loaded from the file
Meaning:
Type: sint8[NUM_BODY_LOCATIONS]
Comment: Calculated value based on items equipped
Meaning:
Type: obj *
Comment: Pointer to the object which controls this one. Owner should not be referred to directly - object_get_owner() should be used instead.
Meaning:
Type: tag_t
Comment: What count the owner had (in case owner has been freed)
Meaning:
Type: obj *
Comment: Monster/player to follow even if not closest
Meaning:
Type: obj *
Comment: This object start to attack us! only player & monster
Meaning:
Type: tag_t
Comment: The tag of attacker, so we can be sure
Meaning:
Type: uint16
Comment: Monster runs away if it's hp goes below this percentage.
Meaning:
Type: treasureliststruct *
Comment: Items to be generated
Meaning:
Type: obj *
Comment: The skill chosen to use
Meaning:
Type: uint32
Comment: The object is hidden, not invisible
Meaning:
Type: sint32
Comment: What stage in attack mode
Meaning:
Type: uint16
Comment: What kind of attack movement
Meaning:
Type: uint8
Comment: See crossfire.doc and @ref WILL_APPLY_xxx
Meaning:
Type: sint8
Comment: Probability, 0 to 100, of the object emitting a sound.
Meaning: NEW since when ?
Type: obj *
Comment: Spell ability monster is choosing to use
Meaning:
Type: double
Comment: needed experience = (calc_exp*expmul) - means some races/classes can need less/more exp to gain levels
Meaning:
Type: sint16
Comment: Time left before spell goes off
Meaning:
Type: sint16
Comment: How long the spell lasts
Meaning:
Type: uint8
Comment: how level modifies duration
Meaning:
Type: sint8
Comment: Range of the spell
Meaning:
Type: uint8
Comment: How going up in level effects range
Meaning:
Type: uint8
Comment: How going up in level effects damage
Meaning:
Type: obj *
Comment: Spell that was being cast
Meaning:
Type: char *
Comment: No comment available
Meaning:
Type: uint16
Comment:
Meaning: Not included anymore ?
Type: archt *
Comment: Pointer to archetype
Meaning:
Type: archt *
Comment: Pointer used for various things - mostly used for what this objects turns into or what this object creates
Meaning:
Type: uint32[4]
Comment: Various flags
Meaning:
Type: uint16
Comment: An index into the animation array
Meaning:
Type: uint8
Comment: Ticks between animation-frames
Meaning:
Type: uint8
Comment: Last sequence used to draw face
Meaning:
Type: uint16
Comment: An index into the temporary animation array
Meaning:
Type: uint8
Comment: Ticks between temporary animation-frames
Meaning:
Type: sint32
Comment: Elevation of this terrain - used in weather code
Meaning:
Type: uint8
Comment: how to smooth this square around
Meaning:
Type: uint8
Comment: What level to draw this on the map
Meaning:
Type: MoveType
Comment: Type of movement this object uses
Meaning:
Type: MoveType
Comment: What movement types this blocks
Meaning: Prevents a character or monster from moving onto a tile occupied by the object.
Each part of a multi-tile object may have an unique setting, unlike many other modifiers
that are omitted or ignored in non-head parts.
See also move_block on the objects page.
Type: MoveType
Comment: What movement types explicitly allowed
Meaning:
Type: MoveType
Comment: Move types affected moving on to this space
Meaning:
Type: MoveType
Comment: Move types affected moving off this space
Meaning:
Type: MoveType
Comment: Movement types this slows down
Meaning:
Type: float
Comment: How much this slows down the object
Meaning:
Type: const char * (shared string)
Comment: Custom name assigned by player
Meaning:
Type: key_value *
Comment: Fields not explictly known by the loader.
Meaning:
Type: uint8
Comment:
Meaning: Not included anymore ?
Type: sint8
Meaning:
Type: sint8
Meaning:
Type: sint8
Meaning:
Type: sint8
Meaning:
Type: sint8
Meaning:
Type: sint8
Meaning:
Type: sint8
Meaning:
Type: sint8
Meaning:
Type: sint8
Meaning:
Type: sint16
Meaning:
Type: sint16
Meaning:
Type: sint16
Meaning:
Type: sint16
Meaning:
Type: sint16
Meaning:
Type: sint16
Meaning:
Type: sint64
Meaning:
Type: sint16
Meaning:
Type: sint16
Meaning:
Type: sint8
Meaning:
Those fields are not part of the object
or Stats
structures, but used through the key/value mechanism.
Those control the price the item should have. They are a ratio from the item's raw value, and are applied without any bargaining / charism / shop specialization effect.
Values should be a valid float (as recognized by atof
).
If price_adjustment is set, it will override the other 2 keys. Else any of the 2 can be not set without any side effect.
For god-given items, name of the god that gave the item. Used to remove them if player switches cult.
Specified god has blessed the item. Used to avoid accumulating blessings.
Player owning the item, so other players can't bless it.
If set, the item can't be applied by another player unless he has enough experience (see item_willpower).
For GENERATOR ( real flag) objects, a key to copy to generated monsters, so they can be tracked.
For GENERATOR ( ditto) objects, the maximum number of generated monsters allowed at the same time.
Name of the generator , used for generator_code value.
If unset will use generator's name, else generator
.
Should be the name of an archetype. When containing object is applied,
this specific object is generated, and inserted at the same place as the containing object.
Used mostly for giving empty bottles when drinking stuff.
If set incombination with item_owner, an item will refuse to be applied by another player who doesn't have at least that much experience.
For TRANSPORT ( real type), the maximum players can board at the same time.
For TRANSPORT, face to use when it's full.
Control the max speed of the TRANSPORT, based on the formula speed = base_speed - (base_speed * weight the transport is carrying * weight_speed_ratio) / (transport's weight_limit * 100
Those are used by spell effects, to store when player should be warned of effect expiration. Player will get a message when spell's duration reaches the first value, then the second. Will be set by the code automatically, should be a number parsable via atoi().