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

# Character Dex

Keeps a dex of every character species the player has ever obtained.




**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

A dex of four characters (`knight`, `mage`, `archer`, `healer`). Pressing **Recruit** acquires the character and files it in the dex in a single transaction, and the dex keeps the moment it first arrived. Once a character is in the dex it stays there, and its **Recruit** button is no longer shown.

## How to try it

1. **Character dex** lists the four characters. A character you have not obtained shows **Not yet** under **Acquired**.
1. Press **Recruit** on a character you do not have yet; you get one of that character and it is filed in the dex at the same time.
1. On that row, **Not yet** and **Recruit** disappear and **Acquired at** shows when the character first arrived.
1. Recruit all four to complete the dex.

Recruited characters go into the same inventory the **Characters** demo uses, so they also show up in the other character demos opened in the same browser.

## GS2 services used

- [GS2-Dictionary](/microservices/dictionary/): GS2-Dictionary's `CharacterDictionary` namespace defines an entry model per character, and records which characters the player has ever obtained and when each first arrived.
- [GS2-Exchange](/microservices/exchange/): A GS2-Exchange rate model defines **Recruit**: it acquires the character (`Gs2Inventory:AcquireItemSetByUserId`) and adds the dex entry (`Gs2Dictionary:AddEntriesByUserId`) together as one free transaction run server-side.
- [GS2-Inventory](/microservices/inventory/): GS2-Inventory's `Character` inventory holds the characters obtained by recruiting.

## Use it in GS2 Studio

In GS2 Studio's Simple mode, open **Add features** and press **Add** on **Character Dex** 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-character-dictionary/packages/foundation-economy-character-dictionary
```

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

## Source code

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



