# Items and slots

Everything an avatar wears or holds is an item: a shirt, a hat, a pair of glasses, a guitar, a costume. Each item
has a 128-bit id and fills one or more of the avatar's slots; putting an item on takes off whatever shares a slot
with it. The [offline catalogue](../guides/catalogue.md) names every item, and the item's files (its meshes,
textures and clips) are read at run time from your [sources](sources.md).

```sh
sona catalogue search hoodie --body man --limit 5 --catalogue sona-catalogue.bin
sona avatar dress seed:atlas "Blue full-zip hoodie" --catalogue sona-catalogue.bin -o me.txt
sona avatar show me.txt --catalogue sona-catalogue.bin
```

These run the `sona` tool ([the tool and `seed:` avatars](sources.md)) with the offline catalogue, which comes with a
download asked for with `&catalogue=1` ([installing](../install.md#the-offline-catalogue)).

## Item ids

An id is 32 hex digits, written as a GUID: `00000008-006e-0001-c1c8-f109a19cb2e0`. The first eight digits are the
slots it fills, as a mask (below): `00000008` is a shirt, `00000208` a long-sleeved top (shirt and wristwear),
`00800018` a costume (shirt, trousers and the costume bit). `sona_slot_of` reads the mask from an id and says how the
item is worn, and `sona_guid_parse` and `sona_guid_format` turn the text into the 16 bytes a manifest holds and back.

The catalogue's lookups take an id in any case, with or without dashes or braces.

## Slots

| Slot | Mask | Holds |
|---|---|---|
| hair | `0x4` | the hair |
| shirt | `0x8` | tops |
| trousers | `0x10` | trousers, skirts, shorts |
| shoes | `0x20` | shoes and boots |
| headwear | `0x40` | hats, helmets, hoods |
| gloves | `0x80` | gloves |
| glasses | `0x100` | glasses and masks |
| wristwear | `0x200` | watches and bands |
| earrings | `0x400` | earrings |
| ring | `0x800` | rings |
| prop | `0x1000` | a held or worn object |
| costume | `0x800000` | a costume, with the slots it covers |

The face's parts are slots too (eyes `0x2000`, eyebrows `0x4000`, mouth `0x8000`, facial hair `0x10000`, facial
features `0x20000`, eye shadow `0x40000`, nose `0x80000`, chin `0x100000`, ears `0x200000`), as are the body's shape
(`0x1000000`) and its animation (`0x400000`). The command line takes a slot by its name or its mask
(`sona avatar undress me.txt hat`, `--slots 0x40`).

A manifest holds 13 worn slots. Three are required: an avatar always wears a shirt, trousers and shoes, so taking
one off puts back the last one worn (the manifest keeps them), or the body's default.

## Bodies

Most clothes are made for one body, the man's or the woman's; props and many hats fit both. The catalogue says which
(`sona_item_info.gender`: 1 the man's, 2 the woman's, 3 both), and its `gender` query lists what the editor offers
each body. Changing an avatar's body swaps each item for its variant on the new body, as 360sona.com's editor does,
and `sona outfit check` reports an item worn on the wrong body.

## What the catalogue says about an item

`sona_catalogue_get` fills a `sona_item_info`: its id, name, game and type (`"Shirt/Hoodie"`), the body it is
made for, its section (the editor's grouping: `"shirt"`, `"carryable"`), its slot mask, where wearing puts it, its
colours and its flags.

| Flag | Means |
|---|---|
| `SONA_ITEM_OFFERED` | The editor lists it |
| `SONA_ITEM_NAMED` | It has a name a person can read |
| `SONA_ITEM_STOCK` | Built in: every avatar has it |
| `SONA_ITEM_AWARD` | Earned in a game |

The catalogue holds names and facts only: no models, textures or pictures. Names come in 26 languages
([catalogue languages](../guides/catalogue-languages.md)).

## Props

A prop is an item on a joint: in a hand, on the back, at the feet. A console avatar holds one prop;
`SONA_EDIT_STACK_PROPS` keeps more than one in a manifest, and a game can attach up to `SONA_PROP_MAX` (8) meshes of
its own to each avatar the same way ([props](../guides/props.md)). Many stock props come with a clip of their own
that the avatar performs.

## Custom items

Your own clothes and props are items too: a `.sonaitem` file with its own id, made from a stock template you paint
or from your own skinned mesh, signed with your creator key. They wear and draw like any other item, in your game
only; a console does not take an avatar that wears one. [Custom items](../guides/custom-items.md).

## Filters

A content filter leaves out what a game does not want shown (licensed brands, logos, items for an older audience)
from searches, random avatars and the editor, and swaps it on avatars that arrive wearing it
([content filters](../guides/filters.md)).

## Related

- [Manifests](manifests.md): the 1,000 bytes that hold the worn items.
- [The offline catalogue](../guides/catalogue.md): searching and listing items.
- [Item previews](../guides/item-preview.md): a picture of one item on its own.
