# Requirements

A **Requirement** is a condition that must be met before something can happen. "Player must be level 10", "Player must have 5 iron ore", "Player must have the Blacksmithing profession", and "Player's health must be above 50%" are all examples of requirements.

Requirements appear alongside triggers in many places throughout Spark. For example, a quest might require the player to be a certain level before they can accept it. An NPC interaction might only be available if the player has a specific item. A crafting recipe might require certain materials in the inventory.

## Requirement Entries

In the Spark Editor under the **Requirements** tab, each requirement entry has:

| Field                 | Description                                      |
| --------------------- | ------------------------------------------------ |
| `requirementType`     | Which type of condition to check                 |
| `requirementTypeData` | Configuration specific to that requirement type  |
| `failureMessage`      | Message shown to the player when the check fails |

## Requirement Groups

Requirements are organized into **Requirement Groups** that define how multiple checks combine:

| Logic         | Behavior                            |
| ------------- | ----------------------------------- |
| **And**       | All requirements must pass          |
| **Or**        | At least one must pass              |
| **Nand**      | At least one must fail              |
| **Nor**       | All must fail                       |
| **Xor**       | Exactly one must pass               |
| **Threshold** | At least N must pass (configurable) |

Each check within a group can also be **inverted**, which negates its result.

## All Requirement Types

### Core Requirements

| Requirement Type                         | Plugin    | Description                                                         |
| ---------------------------------------- | --------- | ------------------------------------------------------------------- |
| **RuleValueRequirementType**             | Rules     | Checks if a rule on the entity has a specific value (true or false) |
| **DistanceToCoordinatesRequirementType** | Playables | Checks if the entity is within a certain distance of coordinates    |

### Plugin Requirements

| Requirement Type                            | Plugin      | Description                                                           |
| ------------------------------------------- | ----------- | --------------------------------------------------------------------- |
| **HasClassRequirementType**                 | Classes     | Checks if the entity has a specific class (main or secondary)         |
| **HasSecondaryClassRequirementType**        | Classes     | Checks if the entity has a specific secondary class                   |
| **MainClassRequirementType**                | Classes     | Checks if the entity's main class matches                             |
| **HasStatusRequirementType**                | Combat      | Checks if the entity has a specific status effect                     |
| **ResourceStatRequirementType**             | Combat      | Checks a resource stat value (e.g., health, mana) against a threshold |
| **ValueStatRequirementType**                | Combat      | Checks a value stat (e.g., strength, agility) against a threshold     |
| **HasCraftingRecipeRequirementType**        | Crafting    | Checks if a crafting recipe is unlocked                               |
| **CurrencyAmountRequirementType**           | Currency    | Checks if the entity has enough of a currency                         |
| **HasEmptyInventorySlotRequirementType**    | Items       | Checks if the inventory has at least one empty slot                   |
| **HasEquipmentSlotEquippedRequirementType** | Items       | Checks if a specific equipment slot has an item equipped              |
| **HasItemEquippedRequirementType**          | Items       | Checks if a specific item is equipped                                 |
| **HasItemInInventoryRequirementType**       | Items       | Checks if a specific item is in the inventory                         |
| **HasWeaponTypeEquippedRequirementType**    | Items       | Checks if a weapon of a specific type is equipped                     |
| **ProgressionLevelRequirementType**         | Progression | Checks if the entity has reached a specific level                     |
| **QuestStatusRequirementType**              | Quests      | Checks the status of a quest (active, completed, etc.)                |

## Where Requirements Are Used

Requirements appear in many places across Spark:

* **Quest acceptance**: Conditions the player must meet to accept a quest
* **NPC interactions**: Conditions for an interaction option to be available
* **Interactable objects**: Conditions for allowing interaction
* **Ability usage**: Conditions for casting an ability (e.g., enough mana, correct weapon type)
* **Crafting**: Conditions beyond just having materials
* **Spellbook auto-add**: Conditions for abilities to appear on the ability bar


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sparkframework.dev/documentation/user-guide/core-systems/requirements.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
