# Shopkeeper

## Overview

The Shopkeeper is a central game mechanic that allows players to purchase items during the preparation phase. Items are organized into categories, making it easy for players to find and purchase what they need.

***

## Items

The items are located in the `/items/` folder. Each item has its own file with a separate configuration. Each file contains modules, which determine how the item functions in the Shopkeeper.

***

## Categories

The shop organizes items into the following categories:

* **Permanent/Upgrades**: Items like swords and armor that persist and can be upgraded
* **Consumables**: Items that can be purchased repeatedly (e.g., Golden Apples, Ender Pearls)
* **Eggs**: Special items that spawn minions when right-clicked on the ground
* **TNT**: Throwable explosives activated by left-clicking

***

## Creating Items

1. Access the `/items/` directory.
2. Identify an existing item file to use as a template.
3. Duplicate the template file.
4. Rename the duplicate file for your new item.
5. Adjust the configuration to customize your item.

***

## Item Modules

Items are configured using various modules that control their behavior and properties:

<table><thead><tr><th width="224">Module</th><th>Description</th></tr></thead><tbody><tr><td>Mythic</td><td>Controls whether the item is part of the mythic item pool</td></tr><tr><td>Purchase</td><td>Defines buying conditions like cost and unlock requirements</td></tr><tr><td>Upgrade</td><td>Configures upgrade paths and tiers for items</td></tr><tr><td>Enchant</td><td>Handles enchantment application and limitations</td></tr><tr><td>Command</td><td>Handles command execution upon purchasing items</td></tr><tr><td>Equipment-builder</td><td>Specifies inventory placement and item properties</td></tr></tbody></table>

### Configuration

#### Mythic Module

```yaml
mythic:
  is-mythic: true
```

#### Purchase Module

```yaml
purchase:
  gold-cost: 750
  round-unlock: 1
  consumable: true
  category: "SUMMONS"
```

#### Upgrade Module

```yaml
upgrade:
  shared-id: "chestplate"
  upgrade-tier: 2
```

{% hint style="info" %}
Items with the same `shared-id` form an upgrade path.

Higher `upgrade-tier` values represent better versions of the item.
{% endhint %}

#### Enchant Module

```yaml
# Example 1
enchant:
  is-enchant: true
  max-purchases: 2
  cost-increase-per-purchase: 25
  apply-to:
    - BOW
  apply-enchants:
    - "enchant{PUNCH} power{1}"
    
# Example 2
enchant:
  is-enchant: true
  apply-to:
    LEATHER_BOOTS:
      - "enchant{FEATHER_FALLING} power{4}"
    CHAINMAIL_BOOTS:
      - "enchant{FEATHER_FALLING} power{4}"
    IRON_BOOTS:
      - "enchant{FEATHER_FALLING} power{4}"
    DIAMOND_BOOTS:
      - "enchant{FEATHER_FALLING} power{4}"
    NETHERITE_BOOTS:
      - "enchant{FEATHER_FALLING} power{4}"
    LEATHER_CHESTPLATE:
      - "enchant{PROTECTION} power{1}"
    CHAINMAIL_CHESTPLATE:
      - "enchant{PROTECTION} power{1}"
    IRON_CHESTPLATE:
      - "enchant{PROTECTION} power{1}"
    DIAMOND_CHESTPLATE:
      - "enchant{PROTECTION} power{1}"
    NETHERITE_CHESTPLATE:
      - "enchant{PROTECTION} power{1}"
```

{% hint style="info" %}
`cost-increase-per-purchase` is a percentage indicating how much the item's price will increase on subsequent purchases. Here's an example with a value of 25:

* Level 1: 500 Gold
* Level 2: 625 Gold
* Level 3: 750 Gold
{% endhint %}

#### Equipment Builder Module

```yaml
equipment-builder:
  39:
    ignore-slot: false
    lore:
      - "&8Permanent"
    type: IRON_HELMET
    amount: 1
    damage: 0
    model: 0
    glint: false
    head: ""
    attributes:
      - "attribute{ARMOR} operation{ADD_NUMBER} value{2.5}"
      - "attribute{ARMOR_TOUGHNESS} operation{ADD_NUMBER} value{1.0}"
    potions:
    tags:
      - "key;value"
    enchants:
```

## Item Examples

### Iron Sword

```yaml
purchase:
  gold-cost: 500
  round-unlock: 5
  consumable: false
  category: "WEAPONS"

upgrade:
  shared-id: "sword"
  upgrade-tier: 2

equipment-builder:
  0:
    ignore-slot: false
    lore:
      - "&8Permanent"
    type: IRON_SWORD
    amount: 1
    damage: 0
    model: 0
    glint: false
    head: ""
    attributes:
      - "attribute{ATTACK_DAMAGE} operation{ADD_NUMBER} value{5.0}"
      - "attribute{ATTACK_SPEED} operation{ADD_NUMBER} value{-2.6}"
    potions:
    tags:
      - "key;value"
    enchants:
```

### Potion

```yaml
purchase:
  gold-cost: 500
  round-unlock: 1
  consumable: true
  category: "POTIONS"

equipment-builder:
  0:
    ignore-slot: true
    lore:
      - "&8Consumable"
    type: SPLASH_POTION
    amount: 1
    damage: 0
    model: 0
    glint: false
    head: ""
    potions:
      - "effect{HASTE} duration{200} amplifier{0} ambient{false} particles{true}"
    tags:
      - "key;value"
    enchants:
```

### Breeze Egg

```yaml
purchase:
  gold-cost: 750
  round-unlock: 1
  consumable: true
  category: "SUMMONS"

equipment-builder:
  0:
    ignore-slot: true
    lore:
      - "&8Consumable"
    type: BREEZE_SPAWN_EGG
    amount: 1
    damage: 0
    model: 0
    glint: false
    head: ""
    potions:
    tags:
      - "key;value"
    enchants:
```

### Sharpness Enchant

```yaml
purchase:
  gold-cost: 500
  round-unlock: 1
  category: "ENCHANTS"

enchant:
  is-enchant: true
  max-purchases: 5
  cost-increase-per-purchase: 25
  apply-to:
    - WOODEN_SWORD
    - STONE_SWORD
    - IRON_SWORD
    - DIAMOND_SWORD
    - NETHERITE_SWORD
  enchants:
    - "enchant{SHARPNESS} power{1}"

equipment-builder:
  0:
    ignore-slot: false
    name: "Sword: Sharpness {ENCHANT_LEVEL}"
    lore:
      - ""
      - "&7Add &d🌟 Sharpness &7to &fSwords"
      - ""
      - "&7Max Enchant: &b{MAX_ENCHANT_LEVEL}"
      - "&7Can be purchased multiple times."
    type: ENCHANTED_BOOK
    amount: 1
    damage: 0
    model: 0
    glint: false
    head: ""
    potions:
    tags:
      - "key;value"
    enchants:
```

### Random Augment

```yaml
mythic:
  is-mythic: true

enchant:
  is-enchant: true

command:
  - "console->al player {PLAYER} ROLL_AUGMENT PRISMATIC"

equipment-builder:
  0:
    ignore-slot: false
    name: "&cRandom Augment"
    lore:
      - ""
      - "&7Roll &f{ICON_CARDS}&7."
    type: PAPER
    amount: 1
    damage: 0
    model: 11205302
    glint: false
    head: ""
    potions:
    tags:
      - "key;value"
    enchants:
    
```

### ItemsAdder

```yaml
purchase:
  gold-cost: 500
  round-unlock: 5
  consumable: false
  category: "WEAPONS"

upgrade:
  shared-id: "sword"
  upgrade-tier: 2

equipment-builder:
  0:
    ignore-slot: false
    custom: "namespace:id"
```
