# Admin Window

Since version 2.1.0 everything about Quests is managed in one **admin window** in the KyuubiSoft look. It replaces the old admin panel with its seven tabs completely.

:::note
The admin window is new in 2.1.0 and has not been tested in game yet.
:::

---

## Opening the window

| Way in | What opens |
|--------|------------|
| `/ksquestadmin panel` | The admin window |
| `/ksquestadmin npcprofile [citizenId]` | The window on the NPC profiles tab, optionally on that NPC |
| `/ksadmin` hub | The Quests tile ("questbook") opens the window |
| `showcase_quests` NPC | Opens the window when you talk to it |
| Core NPC management | **Quest profile …** on the Talk tab opens that NPC's profile; **Back** (also on the **Create profile** page) returns to that NPC on the Talk tab. If no way back is known, **Back** opens Core's NPC management on that NPC's Talk tab. |

Every way in needs `ks.quest.admin`. Anything that runs as the server console needs `ks.core.admin.dialog.console` on top. See [Permissions](./permissions).

On a server in Core's **showcase mode**, visitors may open and browse the window read-only. Saving, exports and tests stay admin-only. Player data stays hidden from visitors: the Players tab shows "Player data is hidden", also for visitors who hold the admin right.

---

## How editing works

- **Every change is a draft.** Nothing is written while you edit. The footer shows the draft ("Draft · 5 changes"), a list of all changes (each one can be reverted on its own), **Discard** and **Save**.
- **Esc keeps the draft** for 30 minutes and offers it again the next time you open the window. Closing with the X asks first when there are unsaved changes.
- **Errors block saving** and open the check list with **Go to**. Warnings do not block.
- **Saving applies at once.** No reload is needed. Chapters, triggers and texts are rebuilt and swapped in together, so players never see half-loaded content.
- **Every save makes a backup set** and writes atomically. If writing or the reload fails, everything is rolled back. The last 20 backup sets are kept.
- **Undo last save** loads the state before the last save as a new draft. Renames are reversed, and player progress follows when you save it.
- **Two admins at once:** if another admin saved the same objects in the meantime, the window asks "Save anyway?". Other changes are merged.
- The window writes your changes into the files in `custom/`, and only what differs from the shipped content. Shipped files are never edited.

A **global search** at the top finds quests, chapters, NPCs, facts and settings.

---

## Navigation

The left column has three groups, each entry with a counter:

| Group | Entries |
|-------|---------|
| **Content** | Quests · Chapters · Pools · NPC profiles · Token shop |
| **Players** | Players · Statistics |
| **Settings** | Rewards & economy · Features · Questbook & HUD · General |

---

## Quests

![The quest list of the admin window](../../../../assets/quest-system/quests-admin-list.png)

The list of all quests with:

- **Search** by name, ID, NPC or chapter.
- **Filters** for type, chapter, source (shipped, custom, pack) and status, and three sort orders (important first, A–Z, file order).
- A **language completeness** mark per quest.
- **New quest** from 6 templates, **Duplicate** (all languages are copied), **Delete** with restore, and **Rename** with "Used in": the window lists every quest, chapter, NPC profile, Core dialog and player that refers to the quest and offers to move or remove those references.

### Quest editor

| Section | What you set |
|---------|--------------|
| **Basics** | Type, category, difficulty, icon |
| **Texts** | Name, description and objective texts per language. A missing language shows the English fallback in grey and is never saved as a translation |
| **Objectives** | 20 objective types, each with a matching picker (blocks, mobs, items, NPCs, zones, damage causes, commands, level) |
| **Rewards** | 11 reward types with the final values after the tier factor. Achievements and titles have a picker, lootbags show their contents, and missing plugins are pointed out |
| **Flow** | Chapter chain, follow-up quest, fact on completion, requirements, trigger (first join, zone enter, NPC talk, quest complete, dialog complete, dialog choice) and repeat options including a cooldown |
| **NPC phases** | Which NPC offers the quest and which one takes it in |

A **player preview** shows the quest as players see it. **Test for me** has three buttons: **Start for me** (prerequisites skipped), **Nearly done** (every objective one step from the end) and **Reset**. Tests always use the saved version of the quest.

The check warns when a quest can be repeated right away without a cooldown.

### Check view

About 75 rules (errors, warnings and hints) check the draft or all content, for example unknown items, NPCs or quests, objective types that never count, empty pools or broken chapter chains. Every finding has **Go to**.

---

## Chapters

- The **story path** with a marker per chapter.
- The **quest chain** of a chapter with reordering and **Insert quest**.
- **Unlock rules** in three modes (open from the start, after another chapter, by a fact) with a plain-text summary.
- **Quick fixes** "Match chain" and "Match order", which only change the affected chapters.
- **Chapter rewards** with the same reward builder as the quest editor (no tier factor for chapters).
- **Auto-start**: when on, the next quest of the chain starts right after the previous one, and the quest givers' offer texts are skipped.
- **Delete** with "Used in".

See [Chapters](./chapters).

---

## Pools

Daily and weekly pools side by side, grouped by quest family:

- A **weight** per tier with "chance approx. %".
- **Weight 0** means "never drawn". A missing weight still counts as 1. A pool where every weight is 0 draws nothing and logs one warning.
- A **"Not in pool"** list with every daily or weekly quest that is in no pool.
- A **rotation preview**.

See [Daily & Weekly Pools](./daily-weekly-pools).

---

## NPC profiles

The quest giver side of each NPC:

- A list of all profiles, with **Profile without NPC**, **Give to another NPC** and **Who uses this NPC?** (which quests it gives out and takes in, "talk to" and "deliver to" objectives, and triggers).
- **Quest entries** with phase cards (offer, active, complete).
- Default, "not ready" and proximity texts per language. Shared texts apply everywhere, and every NPC can have its own text.
- A **node editor** for dialogs. Actions per node: nothing, accept quest, turn in quest, set fact, or a console command (console commands need the console permission).
- **Phase preview** for a chosen player and **Test dialog**, which runs no actions.
- **Open in Core's dialog editor** opens the NPC's first Core dialog; closing it returns to the profile and keeps the draft. The button only shows when the installed Core offers the editor.

See [NPC Quest Profiles](./npc-quest-profiles).

---

## Token shop

The Quest Token Shop is a Core NPC shop (`quest_token_shop`). This entry opens Core's shop editor, which needs `ks.admin`. Without it the entry says so and stays in the Quests window.

---

## Players

Online and offline players, found by name or UUID. Per player: quest data, tokens, streak, facts, active quests with progress per objective, chronicle and a log.

**Actions** (each with a server check and an optional reason for the log):

| Action | What it does |
|--------|--------------|
| Start quest | Starts a quest normally, or force-starts it |
| Tokens | Gives or takes quest tokens |
| Set streak | Sets the quest streak |
| Set fact | Sets, changes or deletes a story fact |
| Correct progress | Fixes the progress of an objective |
| Force complete | Completes a quest, with or without rewards |
| Reset | Resets a quest for the player |
| Release again | Makes a finished quest available again |
| Deliver now | Hands out a reward that waits because the inventory was full |

- **Offline players:** actions are queued and run once at the player's next login. Until then they can be cancelled in the log. A queued action stays queued if the player leaves again right after logging in.
- **Every action is logged** (who, when, what) and can be reverted.
- **View questbook** opens the player's questbook read only. For an online player it shows the live data. For an offline player (since 2.1.1) it shows the saved state: the header says so, all actions and settings are hidden, and nothing is written. While an offline book is open, the token balance stays empty if tokens are paid through an economy plugin, and quests that need a level, a skill or a permission count as not available.

---

## Statistics

Live values per quest with average time, best time and abandon rate, plus a list of **problem quests**: high abandon rate, never started, or a daily or weekly that is in no pool. Each has a link to the quest. **Export** writes the statistics to `exports/`.

---

## Settings

Four tabs. No value or default was changed when the window was introduced.

| Tab | Contents |
|-----|----------|
| **Rewards & economy** | Quest tokens per daily and weekly quest, all-dailies bonus, reroll (free per day and week, paid per day and week, price), tiers with names per language, factor and colour, the quest streak with up to 12 milestones |
| **Features** | The optional 2.0 features, all off by default: reward currency (quest tokens or economy) and rate, token shop in coins, show the quest streak in the questbook, pay streak rewards, all-dailies bonus, an own limit for paid weekly rerolls, reset announcement in chat |
| **Questbook & HUD** | Questbook item, quest tracker defaults, notifications, proximity hint at quest NPCs |
| **General** | Time zone, reset times with a preview of the next resets (and daylight saving notes), quests per player, languages (add a language), loading of the shipped content, backups, export and import with a preview |

The settings tabs also list the old `config.json` values that have no effect any more. Their values stay in the file. See [Configuration](./configuration#options-without-effect).

Players set their own tracker options in the Questbook or in `/kssettings`; the window only sets the defaults.

---

## Exports

Exports from the window and from `/ksquestadmin export` go to `exports/` only. Old panel exports in `custom/` (`export_quests_…`, `export_chapters_…`, `export_stats_…`) are moved once to `exports/legacy-panel/` at start, because they overrode later changes on every restart.