=head1 CROSSFIRE+ OBJECT AND INTERNALS DOCUMENTATION Here is all information about the object types Crossfire+ supports at the moment. This is not a complete documentation (yet) and browsing the source is still recommended to learn about the objects that aren't documented here. This documentation is in a sketchy state. It's mostly used to collect notes about the internal behaviour of the objects. =head2 About archetypes and objects Field denotes an attribute of an archetype. This is an example of an archetype: Object button_trigger name button type 30 face button_sma.111 anim button_sma.111 button_sma.112 mina is_animated 0 exp 30 no_pick 1 walk_on 1 walk_off 1 editable 48 visibility 50 weight 1 end This archetype has the name 'button_trigger' and the objects that inherit from this archetype have the name 'button'. The next field 'type' decides the main behaviour of this archetype. For a comprehensive list of types see include/define.h. For this case you might find a line like: #define TRIGGER_BUTTON        30 The server internally works with objects that 'inherit' attributes from an archetype. They have a similar set of attributes. The following documentation will also document the meaning of code internal attributes of objects. These attributes are marked as '(internal)' and can't or shouldn't be set by an archetype. If the internal names differs the external name (for the archetypes) for the attribute is written behind it. =head2 Description of generic archetype and object attributes These are the fields that most of the objects have and/or their default behaviour. =over 4 =item name The name of the object. =item name_pl The name of a collection of these objects (the plural of the name). =item face The graphical appearance of this object. =item invisible If the is greater than 0 the object is invisible. For players this field reflects the duration of the invisibility and is decreased every tick by 1. For non-player objects this field is not changed by server ticks. =item speed If this field is greater than MIN_ACTIVE_SPEED (~0.0001) the object is placed on the active object list and will be processed each tick (see also speed_left!). If the speed field drops below the MIN_ACTIVE_SPEED the object is removed from the active object list and it won't experience any processing per tick. =item speed_left If this field is greater than 0 and the object is on the active list (mostly means it's speed is also greater than 0): - speed_left is decreased by 1 - and this object is processed and experiences a server tick. If the object is on the active list and speed_left is lower or equal to 0 the absolute value of the speed field is added to speed_left on the end of the tick. This means: the lower the speed field is (but still above MIN_ACTIVE_SPEED) the more seldom the object is processed. And the higher the speed field is the more often the object is processed. =item no_drop (0|1) Sets the flag FLAG_NO_DROP. See Flags section below. =item applied (0|1) Sets the flag FLAG_APPLIED. See Flags section below. =item is_used_up (0|1) Sets the flag FLAG_IS_USED_UP. See Flags section below. =item auto_apply (0|1) Sets the flag FLAG_AUTO_APPLY. See Flags section below. =item no_steal (0|1) Sets the flag FLAG_NO_STEAL. See Flags section below. =item activate_on_push (0|1) (default: 1) Sets the flag FLAG_ACTIVATE_ON_PUSH. See Flags section below. =item activate_on_release (0|1) (default: 1) Sets the flag FLAG_ACTIVATE_ON_RELEASE. See Flags section below. =item editable (more than deprecated) This field had a special meaning for crossedit, which used parts of the server code for editing. Wherever you see this attribute being set in an archetype ignore it and/or remove it. No code interprets this field anymore. =back =head3 Flags Here are the effects of the flags described. =over 4 =item FLAG_NO_DROP An object can't be picked up and dropped. =item FLAG_APPLIED This flag mostly states whether this object has been 'applied' by the player. For objects that are applied by the code or have this flag set in the archetype it mostly means 'this object is active'. For example the player adjustments of the hp/sp/grace fields and inheritance of flags from objects in his inventory is toggled by this flag. =item FLAG_IS_USED_UP This flag controls whether an object is 'used up'. If it is set the 'food' field of the object is decreased by 1 each tick, and if it is lower or equal 0 after tha it is removed. If also the flag FLAG_APPLIED is set, the 'duration' field controls whether this object is removed or not, see the Force type below for the meaning of the duration field in this context. If FLAG_APPLIED is not set the object is destroyed. =item FLAG_IS_A_TEMPLATE (internal use) This flag is set on the inventory of generators like CREATORs and CONVERTERs, or other objects that have the flags FLAG_GENERATOR and FLAG_CONTENT_ON_GEN set. =item FLAG_AUTO_APPLY This flag has currently only meaning for the TREASURE type, see below. =item FLAG_ACTIVATE_ON_PUSH This flag has only meaning for objects that can be linked together with the 'connected' field and controls wether the object should be activated when the connection is 'pushed' or it is 'released'. This flag is by default on. =item FLAG_ACTIVATE_ON_RELEASE This flag has only meaning for objects that can be linked together with the 'connected' field and controls wether the object should be activated when the connection is 'pushed' or it is 'released'. This flag is by default on. =item FLAG_NO_STEAL When this flag is set this object can't be stolen. The flag will be resetted once the object is placed on a map. When this flag is set on a monster it can defent attempts of stealing (but in this context the flag is only used internally). =back =head2 Description of type specific attributes The beginning of the headers of the following subsection are the server internal names for the objects types, see include/define.h. =head3 TRANSPORT - type 2 - Player transports This type is implemented by the transport extension and has currently no special attributes that affect it. =head3 ROD - type 3 - Rods that fire spells Rods contain spells and can be fired by a player. =over 4 =item level This attribute is used for calculating the spell level that can be fired with this rod, it's also the maximum level of the spell that can be fired. The level of the spell that is being fired depends mostly on the 'use magic item' skill level of the player and 1/10 of the level of the rod is added as bonus. =item hp The amount of spellpoints this rod has left. =item maxhp The maximum amount of spellpoints this rod has. =item skill This field determines which skill you need to apply this object. =back =head3 TREASURE - type 4 - Treasures This type of objects are for random treasure generation in maps. If this object is applied by a player it will replace itself with it's inventory. If it is automatically applied generate a treasure and replace itself with the generated treasure. Chests are also of this type, their treasures are generated by the auto apply code on map instantiation. =over 4 =item hp The number of treasures to generate. =item exp If FLAG_AUTO_APPLY is not set the exp field has no further meaning and the difficulty for the treasurecode only depends on the maps difficulty, otherwise the exp field has the following meaning: If this field is not 0 it is passed as the difficulty to the treasure generation code to determine how good, how much worth a treasure is or what bonuses it is given by the treasure code. If this field is not set or 0 the difficulty of the map is passed to the treasure generation code. =item randomitems The treasurelist to use to generate the treasure which is put in the treasure objects inventory. =back =head3 POTION - type 5 - Potions for drinking and other nastynesses These objects contain a spell and will emit it on apply, which most of the time has the meaning of 'drinking'. If no resistancy field, stat field or attacktype is set and no spell is put in the potion by the sp field or the randomitems the potion will become an artifact and the artifact code decides which kind of potion will be generated. If the potion has FLAG_CURSED or FLAG_DAMNED set the usage of this potion will yield an explosion and hurt the player. =over 4 =item Str, Dex, Con, Int, Wis, Cha, Pow These stat fields determine how many stat points the player gets when he applies this potion. If FLAG_CURSED or FLAG_DAMNED is set the player will loose that many stat points. =item sp If this field is set and the randomitems field is not set the field is interpreted as spell number, please look the right number up in common/loader.C. If this field is set the randomitems field will be unset by the map loading code. =item attacktype This field has some special meaning in potions, currently the bits for AT_DEPLETE and AT_GODPOWER control whethere this is a restoration potion or improvement potion. See include/attackinc.h for the bits of these types. If AT_DEPLETE is set the player will be restored and the ARCH_DEPLETION will be removed from him. If the potion has FLAG_CURSED or FLAG_DAMNED set the player will be drained a random stat by inserting an ARCH_DEPLETION into him. If AT_GODPOWER is enabled the player will gain +1 maxvalue in his hp, sp or grace stat. When the potion has FLAG_CURSED or FLAG_DAMNED set he will loose one in one of these stats. =item resist_ If this stat is set and no spell is in the potion the potion will create a force that give the player this specific resistancy. The forces type will be changed to POTION_EFFECT (see POTION_EFFECT type below) and the potion will last 10 times longer than the default force archetype FORCE_NAME (at the moment of this writing spell/force.arc). =item randomitems The inventory/spell of the potion will be created by calling the treasure code with the treasurelist specified here. (I guess it's highly undefined what happens if there is not a spell in the potions inventory). =item on_use_yield When this object is applied an instance of will be created. =item subtypes see include/spells.h for possible potion subtypes, there are currently 4: =over 4 =item POT_SPELL Unused, default behaiour of a potion. =item POT_DUST This potion can be thrown to cast the spell that it has in it's inventory, the behaviour is not defined if there is not a spell in the inventory and the server will log an error. =item POT_FIGURINE Unused, default behaiour of a potion. =item POT_BALM Unused, default behaiour of a potion. =back =back =head3 FOOD - type 6 - Eatable stuff This is for objects that are representing general eatables like beef or bread. The main difference between FOOD, FLESH and DRINK is that they give different messages. The specialty of FLESH is that it inherits the resistancies of the monsters it was generated in and will let dragons raise their resistancies with that. If the monster has the POISON attacktype the FLESH will change into POISON. If a player runs low on food he will grab for FOOD, DRINK and POISON and if he doesn't find any of that he will start eating FLESH. =over 4 =item title If the food has a title or is cursed it is considered 'special', which means that the fields Str, Dex, Con, Int, Wis, Pow, resist_, hp and sp are interpreted and have further effects on the player. The higher the food field is the longer the improvement of the player lasts (except for hp and sp). =item food This is the amount of food points the player gets when he eats this. =item on_use_yield When this object is applied an instance of will be created. =back =head3 POISON - type 7 - Poisonous stuff This type is for objects that can poison the player when drinking. When applied it will hit the attacked with AT_POISON and will create a POISONING object in the one who was hit. =over 4 =item level This field affects the propability of poisoning. The higher the level difference between the one who is hit and the poision the mose propable it is the attacked one will be poisoned. =item slaying On poison this field has the usual meaning of 'slaying', when the ones race matches the slaying field the damage done by the poison is multiplied by 3. =item hp This is the amount of damage the player will receive from applying this. The attacktype AT_POISON will be used to hit the player and the damage will determine the strenght, duration and depletion of stats of the poisoning. The created POISONING object which is being placed in the one who was attacked will get the damage from this field (which is maybe adjusted by slaying or the resistancies). =item food 1/4 of will be drained from the players food. =item on_use_yield When this object is applied an instance of will be created. =back =head3 WEAPON - type 15 - Weapons This type is for general hack and slash weapons like swords, maces and daggers and and .... =over 4 =item weapontype decides what attackmessages are generated, see include/define.h =item attacktype bitfield which decides the attacktype of the damage, see include/attackinc.h =item dam amount of damage being done with the attacktype =item item_power the itempower of this weapon. =item name the name of the weapon. =item level (internal) The improvement state of the weapon. If this field is greater than 0 the 'name' field starts with the characters name who improved this weapon. =item last_eat (internal) seems to be the amount of improvements of a weapon, the formular for equipping a weapon seems to be (server/apply.C:check_weapon_power): ((who->level / 5) + 5) >= op->last_eat =item last_sp the weapon speed (see magic description) =item food addition to food regeneration of the player =item hp addition to health regeneration =item sp addition to mana regeneration =item grace addititon to grace regeneration =item gen_sp_armour the players gen_sp_armour field (which is per default 10) is added the amount. gen_sp_armour seems to be a factor with which gen_sp in do_some_living() is multiplied: gen_sp *= 10/ meaning: values > 10 of gen_sp_armour limits the amout of regenerated spellpoints. generally this field on weapons is in ranges of 1-30 and decides the slowdown of the sp regeneration. =item body_ the part of the body you need to use this weapon, possible values should be looked up in common/item.C at body_locations. =item resist_ this is the factor with which the difference of the players resistancy and 100% is multiplied, something like this: additional_resistancy = (100 - current_resistanct) * (/100) if is negative it is added to the total vulnerabilities, and later the total resistance is decided by: 'total resistance = total protections - total vulnerabilities' see also common/living.C:fix_player =item patch_(attuned|repelled|denied) this field modifies the pathes the player is attuned to, see include/spells.h PATH_* for the pathes. =item luck this luck is added to the players luck =item move_type if the weapon has a move_type set the player inherits it's move_type =item exp the added_speed and bonus_speed of the player is raised by /3. if < 0 then the added_speed is decreased by =item weight the weight of the weapon =item magic the magic field affects the amounts of the following fields: - wc : the players wc is adjusted by: player->wc -= (wc + magic) - ac : the players ac is lowered by (ac + magic) if (player->ac + magic) > 0 - dam: the players dam is adjusted by: player->dam += (dam + magic) - weapon speed (last_sp): weapon_speed is calculated by: (last_sp * 2 - magic) / 2 (minium is 0) =item ac the amount of ac points the player's ac is decreased =item wc the amount of wc points the player's wc is decreased =back =head4 Player inherits following flags from weapons: FLAG_LIFESAVE FLAG_REFL_SPELL FLAG_REFL_MISSILE FLAG_STEALTH FLAG_XRAYS FLAG_BLIND FLAG_SEE_IN_DARK FLAG_UNDEAD =head3 DRINK - type 54 - Drinkable stuff See FOOD description. =head3 CHECK_INV - type 64 - Inventory checkers This object checks whether the player has a specific item in his inventory when he moves above the inventory checker. If the player has the item (or not, which can be controlled with a flag) a connection will be triggered. If you set move_block you can deny players and monsters to reach the space where the inventory checker is on, see 'move_block' description below. The conditions specified by hp, slaying and race are concationated with OR. So matching one of those conditions is enough. =over 4 =item move_block If you set this field to block a movetype the move code will block any moves onto the space with the inventory checker, IF the moving object doesn't have (or has - if last_sp = 0) the item that the checker is searching for. =item last_sp (0|1) If last_sp is 1 'having' the item that is being checked for will activate the connection or make the space with the checker non-blocking. If last_sp is 0 'not having' the item will activate the connection or make the space with the checker non-blocking. =item last_heal (0|1) If last_heal is 1 the matching item will be removed if the inventory checker activates a connection and finds the item in the inventory. (A inventory checker that blocks a space won't remove anything from inventories) =item hp If this field is not 0 the inventory checker will search for an object with the type id . =item slaying If this field is set the inventory checker will search for an object that has the same string in the slaying field (for example a key string of a key). =item race If this field is set the inventory checker will search for an object which has the archetype name that matches . =item connected This is the connection that will be activated. =back =head3 FLESH - type 72 - Organs and body parts See FOOD description. =head3 HOLE - type 94 - Holes Holes are holes in the ground where objects can fall through. When the hole opens and/or is completly open all objects above it fall through (more precisely: if their head is above the hole). Trapdoors can only transfer the one who falls through to other coordinates on the B map. =over 4 =item maxsp (0|1) This field negates the state of the connection: When maxsp is 1 the pit will open/close when the connection is deactivated. Otherwise it will open/close when the connection is activated. This field only has effect when the connection is triggered. So if you put a closed hole on a map, and the connection is deactivated, and maxsp is 1 the hole will remain closed until the connection was triggered once. =item connected This is the connection id, which lets the hole opening or closing when activated. The flags FLAG_ACTIVATE_ON_PUSH and FLAG_ACTIVATE_ON_RELEASE control at which connection state the object is activated. For example: if FLAG_ACTIVATE_ON_RELEASE is set to 0 the hole won't react when the connection is released. =item wc (internal) This is an internal flag. If it is greater than 0 it means that the hole is not yet fully open. More preciesly: this field is the animation-step and if it is set to the 'closed' step of the animation the hole is closed and if it is on the 'open' animation step (wc = 0), the hole is open. =item sp The destination y coordinates on the same map. =item hp The destination x coordinates on the same map. =back =head3 POISONING - type 105 - The poisoning of players and monsters This type is doing the actual damage to the ones who were attacked via AT_POISON (or drank POISON). The duration is handled via the FLAG_IS_USED_UP mechanism (please look there for details). =over 4 =item dam Each time the poisoning is processed (which is determined by the speed and speed_left fields, see the general object attributes above) it hits the player with damage and the AT_INTERNAL attacktype (means: it will simply hit the player with no strings attached). =item food Just a note: The posion is removed when food == 1 and not when the whole duration is up, because the POISONING code has to remove the poison-effects from the player before the FLAG_IS_USED_UP mechanism deletes the POISONING object. =back =head3 FORCE - type 114 - Forces Forces are a very 'thin' type. They don't have much behaviour other than disappearing after a time and/or affecting the player if they are in his inventory. Forces only take effect on the player if they have set FLAG_APPLIED. Whether the duration field is processed or not a tick is controlled via the speed and speed_left field. Look above at the generic description of these fields. NOTE: Setting FLAG_IS_USED_UP on an force will also consider the 'food' field like stated above in the FLAG_IS_USED_UP description. BUT: If the food field reaches 0 before duration and FLAG_APPLIED is set, the force will last for 'duration'. If the FLAG_APPLIED is not set the force is removed when food reaches 0. Generally this means: FLAG_IS_USED_UP doesn't have good semantics on forces. =over 4 =item duration While this field is greater than 0 the force/object is not destroyed. It is decreased each tick by 1. If it reaches 0 the force/object is destroyed. This field can have this meaning for B object if that object has FLAG_IS_USED_UP and FLAG_APPLIED set. See the description of FLAG_IS_USED_UP what happens then. =back =head3 POTION_EFFECT - type 115 - Potion effects (resistancies) This object is generated by the POTION code when the potion is a resistance giving potion. It has mainly the same behaviour as a FORCE. The specialty of the potion effect is that the resistancy it gives is absolute, so if you drin a resistancy potion of fire+60 you will get 60% resistancy to fire. Multiple potion effects only give you the maximum of their resistancy.