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

# Quests

Manages quests players take on, their progress and their clear rewards.




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

Pick one of three quests (**Forest patrol**, **Cave expedition**, **Dragon hunt**), start it, and clear it for a reward. Starting a quest spends stamina, and clearing it pays free coins, with a bonus on top the first time only. Only one quest can be in progress at a time.

## How to try it

1. Check each quest's cost and reward under **Pick a quest (one at a time)**. **Forest patrol**, for example, costs 10 stamina and pays 10 coins, plus 100 more on the first clear.
1. Press **Start** on a quest. Stamina in **Your stamina** drops by the quest's cost, and the running quest appears under **Running**, as in `Running: Forest patrol (10 stamina spent)`.
1. While a quest is running, pressing **Start** on another quest is refused by GS2.
1. Press **Complete** under **Your quest in progress**. The clear reward and the first-clear bonus are paid into **Free balance** under **Where the coins land**, and the quest is marked **Cleared**.
1. Start and clear the same quest again: this time only the clear reward is paid, with no first-clear bonus. If you run short of stamina, **Recover** restores 5.

Stamina tops out at 50 and recovers 5 every minute on its own. **Dragon hunt** costs 30 stamina.

## GS2 services used

- [GS2-Quest](/microservices/quest/): The GS2-Quest group `main` defines the three quests with their start cost in stamina, clear reward and first-clear reward. **Start** and **Complete** are GS2-Quest's own client calls; it keeps one progress per player and records which quests have been cleared.
- [GS2-Stamina](/microservices/stamina/): GS2-Stamina holds the stamina meter (50 at most, recovering 5 every minute); starting a quest deducts its cost through `Gs2Stamina:ConsumeStaminaByUserId`.
- [GS2-Money2](/microservices/money2/): A GS2-Money2 wallet receives the reward coins; clear and first-clear rewards are paid in as free coins through `Gs2Money2:DepositByUserId`.
- [GS2-Exchange](/microservices/exchange/): A GS2-Exchange rate model defines **Recover**, a transaction that restores 5 stamina.

## Use it in GS2 Studio

In GS2 Studio's Simple mode, open **Add features** and press **Add** on **Quests** 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/micro-economy-quest/packages/micro-economy-quest
```

- Owner: `gs2io`
- Repository: `gs2-studio-package`
- Subdirectory: `micro-economy-quest/packages/micro-economy-quest`

## Source code

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



