> For the complete documentation index, see [llms.txt](/llms.txt)

# Equipment

Manages the weapons and gear a player owns, grouped by category.




**About this demo**

The demo signs in automatically with an anonymous account. The account is shared across every demo in the showroom, so items and currency you get in one demo carry over to the others. Loading takes a moment. If the frame is too small, open the demo in a new tab.

## Overview

Take equipment from a catalog of three pieces (`iron-sword`, `oak-staff`, `steel-shield`) and put it in your bag. Every piece you take becomes its own row in your list and uses one slot of the bag. When the bag fills up you can expand it, and you can discard pieces you no longer want.

## How to try it

1. Press **Take** next to an equipment name under **Take equipment**; that piece is added to **Your equipment** as a new row.
1. Take the same piece again and it is added as a separate row. The gauge and the `used/max` reading in **Equipment bag** go up by one each time (the bag starts with 4 slots).
1. Once every slot is in use, pressing **Take** no longer gives you anything.
1. Press **Expand** under **Equipment bag** to add 2 slots. The button is disabled once the bag reaches its ceiling of 10.
1. Press **Discard** on a row in **Your equipment** to throw away one piece of that kind and free a slot.

## GS2 services used

- [GS2-Inventory](/microservices/inventory/): GS2-Inventory's inventory model defines the bag (4 slots to start, 10 at most) and an item model for each of the three pieces, and holds the equipment the player owns. Each piece stacks to one and multiple stacks are allowed, so two of the same sword are two rows.
- [GS2-Exchange](/microservices/exchange/): GS2-Exchange rate models define what each button does: **Take** acquires a piece, **Discard** consumes one, and **Expand** adds capacity (`Gs2Inventory:AddCapacityByUserId`), each run server-side as a free transaction.

## Use it in GS2 Studio

In GS2 Studio's Simple mode, open **Add features** and press **Add** on **Equipment** to bring this feature into your own project. To point at the package directly, choose **Add from GitHub** and enter the package below.

```text
https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-equipment/packages/foundation-economy-equipment
```

- Owner: `gs2io`
- Repository: `gs2-studio-package`
- Subdirectory: `foundation-economy-equipment/packages/foundation-economy-equipment`

## Source code

- Demo project: <https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-equipment/live-demo>
- Feature package: <https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-equipment>



