# Commands

# Shop Commands

Core's NPC shops use the `/ksnpcshop` command (since Core 2.9.0).

:::note[/ksnpcshop and /ksshop]
Core still registers its old name `/ksshop` with the same subcommands. When the [Player Shops](https://wiki.kyuubisoft.com/hytale/player-shops/) mod is installed, that mod takes over `/ksshop` for player shops, so always use `/ksnpcshop` for NPC shops — in chat, in dialogs and in commands you hand out. On servers without the Player Shops mod, `/ksshop open|sell|list` keeps working as before.
:::

## Player Commands

### `/ksnpcshop open <shopId>`

Opens a shop by its ID.

| Parameter | Description |
|-----------|-------------|
| `shopId` | The unique identifier of the shop (the JSON file name without `.json`). |

**Example:**
```
/ksnpcshop open blacksmith
/ksnpcshop open daily_deals
```

The command refuses with a message when the shop does not exist, when the shop is set to open only at its NPC (`openVia: "npc"`), or when the shop needs a permission the player does not have.

---

### `/ksnpcshop sell <shopId>`

Opens a shop directly on its **Sell** tab, where players sell items from their inventory.

**Example:**
```
/ksnpcshop sell general_store
```

:::info
Selling only works if the shop has `"sellEnabled": true`. Otherwise the command answers "Selling is not enabled at this shop."
:::

---

### `/ksnpcshop list`

Lists all registered shops.

**Output:**
```
=== Available Shops (3) ===
  - blacksmith (Blacksmith, 8 items)
  - daily_deals (Daily Deals, 12 items)
  - example_shop (Example Shop, 6 items)
```

Each line shows the shop ID, its title and the number of entries.

## NPC-Bound Shops

Shops can also be opened at an NPC (Citizen). Interacting with the NPC opens the shop window directly — no command needed. The NPC stops moving while the shop is open and walks on when the player closes it.

| Citizen field | Description |
|---|---|
| `shopId` | Opens the shop on its "Buy" tab when the player interacts with the NPC. |
| `sellShopId` | Opens the shop directly on its "Sell" tab. |

You can link NPCs in the [Shop Editor](https://wiki.kyuubisoft.com/hytale/shop-system/admin-panel/) (Settings → **Link NPC**) or in the NPC management window. A dialog answer can open a shop too, with the dialog action **Open shop** (`open_shop`) or a dialog command `ksnpcshop open <shopId>`.

:::info
A shop with `openVia: "command"` does not open at its NPC; the player gets a message instead. A shop with `openVia: "npc"` only opens at its NPC.
:::

## Command Reference

| Command | Description | Access |
|---------|-------------|--------|
| `/ksnpcshop open <shopId>` | Open a specific shop | All players (see [Permissions](https://wiki.kyuubisoft.com/hytale/shop-system/permissions/)) |
| `/ksnpcshop sell <shopId>` | Open a shop on its "Sell" tab | All players |
| `/ksnpcshop list` | List all shops | All players |

There is no admin command for NPC shops. Admins edit shops in the shop editor, which opens from the `/ksadmin` hub (tile **NPC Shops**), or in the JSON files followed by `/ksadmin reload`.

:::tip
Shops opened by command use the same purchase logic as NPC shops. Currency checks, purchase limits and the inventory check apply no matter how the shop was opened.
:::