From The Mana World
(replaced customitem with item_instance) |
(added anti stacking precaution to stat modifiers) |
||
Line 20: | Line 20: | ||
{{sqltablerow | absolute | INTEGER | | | linear attribute modifier}} | {{sqltablerow | absolute | INTEGER | | | linear attribute modifier}} | ||
{{sqltablerow | multiplier | FLOAT | | | attribute multiplier in case of character attribute. Elemental damage multiplier in case of element attribute.}} | {{sqltablerow | multiplier | FLOAT | | | attribute multiplier in case of character attribute. Elemental damage multiplier in case of element attribute.}} | ||
{{sqltablerow | stackgroup | INTEGER | | | Stack group of the modifier effect. Every item may only have one effect from each stack group (with the exception of stack group 0) to avoid having multiple effects which are not supposed to stack. A weapon enchantment from a player would, for example, come from a specific stack group number which translates to "player weapon attack buff" making it impossible to apply it multiple times to the same weapon. | |||
{{sqltablerow | time | INTEGER | | | time when the modifier wears off (for temporary enchantments)}} | {{sqltablerow | time | INTEGER | | | time when the modifier wears off (for temporary enchantments)}} | ||
{{endsqltable}} | {{endsqltable}} | ||
Line 52: | Line 53: | ||
;tmw.create_item_instance(archetype-id, color, name, inscription, durability, initial-durability, weight, value, runeslots): Creates a custom item in the server database. Returns the ID of the item. | ;tmw.create_item_instance(archetype-id, color, name, inscription, durability, initial-durability, weight, value, runeslots): Creates a custom item in the server database. Returns the ID of the item. | ||
;tmw.change_item_instance(id, archetype-id, color, name, inscription, durability, initial-durability, weight, value, runeslots): Changes the values of a custom item in the server database. Every argument may be NULL to leave it as it is. | ;tmw.change_item_instance(id, archetype-id, color, name, inscription, durability, initial-durability, weight, value, runeslots): Changes the values of a custom item in the server database. Every argument may be NULL to leave it as it is. | ||
;tmw.add_modifier_to_item_instance(id, attribute, absolute, multiplier, time): Adds a modifier to an item. | ;tmw.add_modifier_to_item_instance(id, attribute, absolute, multiplier, stack, time): Adds a modifier to an item. | ||
;tmw.add_rune_to_item_instance(id, spell): Adds a spell rune to an item. | ;tmw.add_rune_to_item_instance(id, spell): Adds a spell rune to an item. | ||
;tmw.get_item_instance(id): Returns a table with the attributes of the item. | ;tmw.get_item_instance(id): Returns a table with the attributes of the item. |
Revision as of 18:41, 7 May 2009
Database
Layout for the SQL table to store customized equipment
|
Stat modifiers during item creation. Also includes elemental modifiers.
|
Spell runes engraved in the item.
|
Custom variables for use in item scripts
|
Netcode
- Item IDs are 32 bit unsigned integers
- Item IDs 1 - 65.535 are non-customized generic items which may exist multiple times
- Item IDs 65.536 - 4.294.967.296 are unique equipment items which may only exist once in the game.
- When sending the inventory data to a character, every high id is followed by its archetype-id and colorization string. All other information about the item can be requested on demand with an additional message.
- When sending look information about other characters the archetype-id and the colorisation are transfered
- Colorisations are sent in a compressed format:
- 1 Byte bitfield of the used colorisation channels. For each channel:
- 1 Byte for number of entries in the color ramp. for every entry:
- 3 Byte for red, green and blue component of color
- 1 Byte for number of entries in the color ramp. for every entry:
- 1 Byte bitfield of the used colorisation channels. For each channel:
Script API
- tmw.create_item_instance(archetype-id, color, name, inscription, durability, initial-durability, weight, value, runeslots)
- Creates a custom item in the server database. Returns the ID of the item.
- tmw.change_item_instance(id, archetype-id, color, name, inscription, durability, initial-durability, weight, value, runeslots)
- Changes the values of a custom item in the server database. Every argument may be NULL to leave it as it is.
- tmw.add_modifier_to_item_instance(id, attribute, absolute, multiplier, stack, time)
- Adds a modifier to an item.
- tmw.add_rune_to_item_instance(id, spell)
- Adds a spell rune to an item.
- tmw.get_item_instance(id)
- Returns a table with the attributes of the item.
- tmw.get_item_instance_modifiers(id)
- Returns a table of tables with the modifier data of the item.
- tmw.get_item_instance_runes(id)
- Returns a table of tables with the rune data of the item.
- tmw.get_item_instance_var(id, key)
- Returns the string stored in "key" in the var table of the item
- tmw.set_item_instance_var(id, key, value)
- Sets the string stored in "key" in the var table of the item.
(function names not checked for consistency with the rest of the api)