Items

Your own item types, and changes to the game's items. A registered type is a miscellaneous item that borrows an existing item's look, gets a stable GUID from its id, and works with all inventory, stash and ground item calls. Overrides change a game item's weight, price, stats and the most units a player can hold, for all players. The server's item-config.json in the resources folder sets the same at startup: { "<item GUID or name>": { "weight": kg, "price": price, "max": units, <stat>: value } }. The event playerCustomItemUse fires when a usable type is used.

items.register()

Items.register(id, definition)

Creates a custom item type and returns its GUID. Registering it identically again returns the same GUID. The limit is 4096 types.

items.model()

Items.model(item)

The mesh an item class has on the ground: its own model from the game's item tables, or for clothing and armour, the drop model. It is a path under objects/, or '' if the tables give none, as with DLC badges that only pin to a cap. Most of them, all .cgf files, are props too, so Prop.spawn can show an item alone, held still with physics 'none'. Throws a TypeError for an unknown class.

items.info()

Items.info(item)

What kind of item a class is. It has `category`, as from Inventory.classes, such as meleeWeapon, missileWeapon, armor or food. A weapon also has `weaponClass` from the game's table: dagger, sword, sabre, axe, longsword, mace, flail, halberd, shield, shieldBroken, huntingSword, torch, bow, crossbowLight, crossbowMedium, crossbowHeavy or rifle, otherwise null. It also has the attack modifiers `attackModSlash`, `attackModStab` and `attackModSmash`, otherwise 0. Use the modifiers to find out what a weapon can do, since the game's tables class a broken axe as a mace, with no slash. Null for an unknown class. A registered type is a misc item with no weapon class.

items.override()

Items.override(item, fields)

Changes a game item for all players and returns its effective values.

items.clearOverride()

Items.clearOverride(item)

Restores an item's game values, and returns whether it had an override.

items.effective()

Items.effective(item)

An item's values on this server, or null for an unknown item.

items.overrides()

Items.overrides()

The effective values of all overridden items.

items.setEquippedWeightPercent()

Items.setEquippedWeightPercent(percent)

Sets the percentage of what players wear that counts toward their load. Player.setEquippedWeightPercent overrides it for one player.

items.equippedWeightPercent()

Items.equippedWeightPercent()

The percentage of what players wear that counts toward their load, under the server's rule. 100 by default.