# Shop & Achievements

# Shop & Achievements

The Mod Editor includes dedicated pages for managing the Token Shop and Achievement definitions.

## Token Shop

The shop editor manages items that players can purchase with quest tokens.

### Shop Overview

At the top you see:

- **Total item count** in the shop
- **Currency ID** -- the token type used for purchases (e.g. `quest_token`)
- **Search bar** -- filter items by ID or name

### Item Table

Each shop item displays in a table with columns:

| Column | Description |
|--------|-------------|
| **Item** | Item ID (monospaced), display name, and category badge |
| **Cost** | Token price |
| **Qty** | Quantity given per purchase |
| **Weight** | Sort weight in the shop UI |

Custom items (marked `C`) can be removed with the X button.

### Adding a Shop Item

1. Click **+ Add Item**
2. **Item ID** -- type or use the autocomplete to find valid item IDs from your server
3. **Cost** -- set the token price
4. **Quantity** -- how many the player receives per purchase
5. Click **Add to Shop**

:::info
The autocomplete pulls item IDs from your server's `/ksdev` export. If you have not imported reference data, you can still type IDs manually.
:::

---

## Achievements

Achievements are organized into three categories, each in a separate tab:

| Tab | Description |
|-----|-------------|
| **Standard** | General gameplay achievements |
| **MMO** | Multiplayer and social achievements |
| **RPG** | Character progression achievements |

### Achievement List

The left sidebar shows achievements for the selected category. Each entry displays:

- **Achievement ID**
- **Source badge** -- `C` for custom, `M` for modified
- **Trigger summary** -- abbreviated trigger types and targets

Use the **Search** bar to filter by ID, or click **+ New Achievement** to create one.

### General Properties

When you select an achievement, the detail panel shows:

- **ID** -- unique identifier (not editable after creation)
- **Icon Item** -- item displayed as the achievement icon (with autocomplete)
- **Category** -- combat, gathering, crafting, exploration, social, or progression
- **Difficulty** -- easy, normal, hard, or legendary
- **Name Key / Description Key** -- i18n localization keys
- **Requires** -- prerequisite achievement ID (must be completed first)
- **Title Reward** -- an optional title granted on completion, with color
- **Hidden** -- whether the achievement is hidden until unlocked

### Triggers

Triggers define what the player must do to earn the achievement. Each trigger has:

- **Type** -- one of: `kills`, `blocks_mined`, `blocks_chopped`, `blocks_dug`, `blocks_placed`, `blocks_harvested`, `items_collected`, `items_crafted`, `flowers_picked`, `interact_npc`, `zone_discovered`, `distance_traveled`, `playtime_minutes`, `damage_dealt`, `damage_taken`
- **Count** -- how many times the action must be performed
- **Target** -- the specific entity, block, or item (with autocomplete for applicable types). Comma-separated for multiple targets.

:::tip
Some trigger types like `distance_traveled` and `playtime_minutes` do not require a target -- the target field is automatically hidden for these.
:::

### Rewards

Each achievement can grant one or more rewards:

| Reward Type | Fields |
|-------------|--------|
| **item** | Item ID (autocomplete) + amount |
| **quest_tokens** | Amount of quest tokens |
| **currency** | Amount of currency |
| **mmo_xp** | Amount of MMO experience |
| **lootbag** | Lootbag ID |
| **title** | Title text |
| **command** | Server command + executor (console or player) |

### Base vs. Custom

- **BASE** achievements are read-only. Click **Clone to Custom** to make an editable copy.
- **CUSTOM** achievements are fully editable with all fields unlocked.

### Creating an Achievement

Select the target category tab, click **+ New Achievement**, enter a unique ID, and configure triggers, rewards, and properties in the detail panel.

:::warning
Achievement IDs must be unique across all three categories. The editor checks for duplicates globally.
:::