> For the complete documentation index, see [llms.txt](https://axiomemu.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://axiomemu.gitbook.io/docs/data/plugins/resetsystem.md).

# Reset System

The Reset System allows characters to reset their level in exchange for rewards, creating an extended progression system beyond the level cap.

## File Location

```
Data/Plugins/Characters/ResetSystem.xml
```

## Reset Types

| Type         | Command                 | Purpose                              |
| ------------ | ----------------------- | ------------------------------------ |
| Reset        | `/reset`                | Standard level reset                 |
| Grand Reset  | `/grandreset` or `/gr`  | Meta-reset after accumulating resets |
| Master Reset | `/masterreset` or `/mr` | Master level reset                   |

## Configuration Structure

```xml
<ResetSystem Enabled="true">
    <Settings>
        <!-- What happens during reset -->
    </Settings>
    <ItemRequirements>
        <!-- Items consumed during reset -->
    </ItemRequirements>
    <Rewards>
        <!-- What players receive -->
    </Rewards>
    <Requirements>
        <!-- Conditions to perform reset -->
    </Requirements>
</ResetSystem>
```

## Sections

### Root Element

```xml
<ResetSystem Enabled="true">
```

| Attribute | Type | Default | Description                      |
| --------- | ---- | ------- | -------------------------------- |
| `Enabled` | bool | false   | Enable/disable the entire plugin |

### Settings

Defines what happens when a reset is performed.

```xml
<Setting Index="0" ResetStats="true" ResetCommand="true"
         ResetLevelUpPoints="true" TeleportToBaseMap="true" />
```

| Attribute            | Type | Default  | Description                                                                                                                                                                                         |
| -------------------- | ---- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Index`              | int  | Required | Unique identifier for this setting group                                                                                                                                                            |
| `ResetStats`         | bool | true     | Reset STR/AGI/VIT/ENE/CMD to class defaults                                                                                                                                                         |
| `ResetCommand`       | bool | true     | Reset Command stat (for Dark Lord)                                                                                                                                                                  |
| `ResetLevelUpPoints` | bool | true     | `true` clears the character's unspent level-up points on reset. `false` preserves them - the character keeps whatever points they had not yet distributed, and reset reward points are added on top |
| `ResetInventory`     | bool | false    | Clear inventory (except equipped)                                                                                                                                                                   |
| `ResetSkills`        | bool | false    | Clear learned skills                                                                                                                                                                                |
| `ResetSkillTree`     | bool | false    | Clear master skill tree                                                                                                                                                                             |
| `TeleportToBaseMap`  | bool | true     | Teleport to class starting location                                                                                                                                                                 |

{% hint style="danger" %}
**ResetInventory** is dangerous! Players will lose all non-equipped items. Use with extreme caution.
{% endhint %}

### ItemRequirements

Defines items that must be consumed for reset.

```xml
<ItemReq Index="0" ItemType="-1" Count="0" />
<ItemReq Index="1" ItemType="14" ItemIndex="13" Count="10" />
```

| Attribute    | Type | Default  | Description                           |
| ------------ | ---- | -------- | ------------------------------------- |
| `Index`      | int  | Required | Unique identifier                     |
| `ItemType`   | int  | -1       | Item category (-1 = no item required) |
| `ItemIndex`  | int  | -1       | Item index within category            |
| `ItemLevel`  | int  | -1       | Required item level (-1 = any)        |
| `LifeOption` | int  | -1       | Require life option (-1 = any)        |
| `Skill`      | int  | -1       | Require skill option (-1 = any)       |
| `Luck`       | int  | -1       | Require luck option (-1 = any)        |
| `Excellent`  | int  | -1       | Require excellent (-1 = any)          |
| `Durability` | int  | -1       | Required durability (-1 = any)        |
| `Count`      | int  | 0        | Number of items required              |

**Example**: `ItemType="14" ItemIndex="13"` = Jewel of Bless

### Rewards

Defines what players receive after reset.

```xml
<Reward Index="0" PointsType="LEVEL_POINTS_MULTI_RESET"
        LevelUpPoints="500" GrandResetBonusPoints="15000"
        WCoins="500" BagIndex="100" />
```

| Attribute                | Type | Default       | Description                   |
| ------------------------ | ---- | ------------- | ----------------------------- |
| `Index`                  | int  | Required      | Unique identifier             |
| `PointsType`             | enum | LEVEL\_POINTS | How points are calculated     |
| `LevelUpPoints`          | int  | 0             | Base points per reset         |
| `GrandResetBonusPoints`  | int  | 0             | Bonus points per grand reset  |
| `MasterResetBonusPoints` | int  | 0             | Bonus points per master reset |
| `WCoins`                 | int  | 0             | WCoins awarded                |
| `WPCoins`                | int  | 0             | WPCoins awarded               |
| `GoblinPoints`           | int  | 0             | Goblin Points awarded         |
| `BagIndex`               | int  | -1            | Item bag to drop (-1 = none)  |

#### PointsType Values

| Value                            | Formula               | Use Case                  |
| -------------------------------- | --------------------- | ------------------------- |
| `LEVEL_POINTS`                   | Fixed points          | Same points every reset   |
| `LEVEL_POINTS_MULTI_RESET`       | Points × Reset#       | Scaling with resets       |
| `LEVEL_POINTS_MULTI_GRAND_RESET` | Points × GrandReset#  | Scaling with grand resets |
| `MASTER_LEVEL_POINTS`            | Fixed master points   | Master reset rewards      |
| `MASTER_LEVEL_POINTS_MULTI`      | Points × MasterReset# | Scaling master rewards    |

**Example Calculations:**

**Regular Reset:**

* Settings: `PointsType="LEVEL_POINTS_MULTI_RESET"`, `LevelUpPoints="500"`, `GrandResetBonusPoints="15000"`
* Player performing their **10th regular reset** (going from 9→10) with 2 existing Grand Resets:
  * Base points: 500 × 10 = 5,000
  * Grand Reset bonus: 15000 × 2 = 30,000
  * **Total: 35,000 points**

**Grand Reset:**

* Settings: `PointsType="LEVEL_POINTS_MULTI_GRAND_RESET"`, `LevelUpPoints="15000"`
* Player performing their **2nd Grand Reset** (going from 1→2) with 100 regular resets:
  * Base points: 15000 × 2 = 30,000
  * Grand Reset bonus: 0 (not applied to Grand Reset type)
  * **Total: 30,000 points**
  * Note: Regular reset count is zeroed AFTER the rewards are calculated

### Requirements

Defines conditions and costs for performing resets.

```xml
<Requirement Index="0" Type="RESET" AccountLevel="*"
             SettingsIndex="0" RequiredLevel="400"
             ResetRange="000-999" ZenType="REMOVE_MULTI" ZenValue="100000"
             ItemReqIndex="1" RewardIndex="0" />
```

| Attribute                 | Type   | Default    | Description                                    |
| ------------------------- | ------ | ---------- | ---------------------------------------------- |
| `Index`                   | int    | Required   | Unique identifier                              |
| `Type`                    | enum   | RESET      | RESET, GRAND\_RESET, or MASTER\_RESET          |
| `AccountLevel`            | string | `*`        | Account level filter (\*, AL0-AL3)             |
| `SettingsIndex`           | int    | 0          | Which Settings to apply                        |
| `RequiredLevel`           | int    | 1          | Level needed for reset                         |
| `RequiredResets`          | int    | 0          | Resets needed (for grand reset)                |
| `RequiredMasterLevel`     | int    | 0          | Master level needed                            |
| `RequiredGrandResets`     | int    | 0          | Grand resets needed (gate requirement)         |
| `RequiredMasterResets`    | int    | 0          | Master resets needed (gate requirement)        |
| `ResetRange`              | string | 000-999    | Valid reset count range                        |
| `ZenType`                 | enum   | NO\_REMOVE | How zen is consumed                            |
| `ZenValue`                | int64  | 0          | Base zen cost (64-bit; can exceed 2.1 billion) |
| `WCoins`                  | int    | 0          | WCoins cost                                    |
| `WPCoins`                 | int    | 0          | WPCoins cost                                   |
| `GoblinPoints`            | int    | 0          | GoblinPoints cost                              |
| `ItemReqIndex`            | string | -          | Item requirement indices (comma-separated)     |
| `RewardIndex`             | string | -          | Reward indices (comma-separated)               |
| `ResetResetsOnGrandReset` | bool   | false      | Zero reset count on grand reset                |

### AutoReset

Optional top-level `<AutoReset>` block. `Enabled` is the master switch that allows or disallows the automatic-reset feature. When it is on, players can turn on auto reset from the Reset window in the client (there is an auto-reset button alongside the manual reset and stat-distribution controls), and each character's tick handler attempts a reset on its own once the character qualifies. This block also controls how often that attempt runs.

```xml
<AutoReset Enabled="true" TickIntervalMs="5000" JitterMs="2000">
    <AccountLevel Index="0" Allowed="1" />
    <AccountLevel Index="1" Allowed="1" />
    <AccountLevel Index="2" Allowed="1" />
    <AccountLevel Index="3" Allowed="1" />
</AutoReset>
```

| Attribute        | Type | Default | Description                                                                                                        |
| ---------------- | ---- | ------- | ------------------------------------------------------------------------------------------------------------------ |
| `Enabled`        | bool | false   | Master switch for the AutoReset feature. When `false`, the client UI toggle is rejected with result `1` (disabled) |
| `TickIntervalMs` | int  | 5000    | Server-side polling interval (ms) per character. Clamped to a minimum of `1000`                                    |
| `JitterMs`       | int  | 2000    | Random additional delay (ms) added per tick to spread load across characters                                       |

The `<AccountLevel>` children gate which account tiers may toggle AutoReset on. `Index` is the AccountLevel (`0` = Free, `1`-`3` = VIP tiers). `Allowed="0"` rejects the toggle with result `2` for that tier. Unspecified tiers default to allowed.

When AutoReset is on, the per-character tick re-runs the same `ExecuteReset` pipeline that `/reset` uses, so all `<Requirements>` / `<Caps>` checks still apply.

### Caps

Top-level `<Caps>` block. One entry per reset type — the cap applies to every `<Requirement>` of that `Type`, no matter how many `AccountLevel` / `ResetRange` slices are defined.

```xml
<Caps>
  <Reset       MaxTotal="10000" MaxPerDay="-1" MaxPerWeek="-1" MaxPerMonth="-1" />
  <GrandReset  MaxTotal="-1"    MaxPerDay="-1" MaxPerWeek="-1" MaxPerMonth="-1" />
  <MasterReset MaxTotal="-1"    MaxPerDay="-1" MaxPerWeek="-1" MaxPerMonth="-1" />
</Caps>
```

| Attribute     | Type | Default | Description                                                                                                                                                              |
| ------------- | ---- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `MaxTotal`    | int  | -1      | Lifetime cap. `-1` (or omitted) = unlimited. Compared against the character's lifetime count for this type (`Reset` / `GrandReset` / `MasterReset` on the character row) |
| `MaxPerDay`   | int  | -1      | Cap per calendar day. `-1` = unlimited                                                                                                                                   |
| `MaxPerWeek`  | int  | -1      | Cap per ISO week. `-1` = unlimited                                                                                                                                       |
| `MaxPerMonth` | int  | -1      | Cap per calendar month. `-1` = unlimited                                                                                                                                 |

Period counters live per-character in `dbo.ResetSystemSettings` together with a per-type last-reset timestamp. On every cap check (and at login) the plugin compares the stored timestamp against the current local time and zeroes any counter whose backing period has rolled over.

To unlock more lifetime resets server-wide, raise `MaxTotal` on the matching `<Caps>` child and reload. No per-character cleanup needed — the lifetime check reads the existing `Reset` / `GrandReset` / `MasterReset` count on the character row.

#### ZenType Values

| Value          | Behavior              | Example                                                       |
| -------------- | --------------------- | ------------------------------------------------------------- |
| `NO_REMOVE`    | No zen cost           | Free reset                                                    |
| `REMOVE_FLAT`  | Fixed cost            | Always 1,000,000 zen                                          |
| `REMOVE_MULTI` | Cost × (Current# + 1) | Player with 9 resets doing 10th: 100,000 × 10 = 1,000,000 zen |

{% hint style="info" %}
**REMOVE\_MULTI calculation**: Uses the NEW reset number (current + 1) for cost. A player with 9 resets performing their 10th reset will pay `ZenValue × 10`.
{% endhint %}

#### ResetRange

Format: `MIN-MAX`

Limits which reset counts this requirement applies to:

* `000-099` - Applies to resets 0-99
* `100-999` - Applies to resets 100+

## Important Behavior

{% hint style="info" %}
**Best-Match Algorithm**: When multiple requirements with the same Type could match a player, the plugin picks the most specific one using a scoring system:

1. Specific AccountLevel over wildcard (`*`) - adds 1000 points
2. RequiredGrandResets - adds 100 points per grand reset in the requirement
3. Narrower ResetRange - adds `1000 - (ResetRangeMax - ResetRangeMin)` points

Gate requirements `RequiredGrandResets` and `RequiredMasterResets` both filter candidates (player must meet or exceed them to qualify), but only `RequiredGrandResets` affects the score. The current reset count is also checked against `ResetRange` before scoring.
{% endhint %}

{% hint style="info" %}
**Unspent Points Are Preserved When `ResetLevelUpPoints="false"`**: If a `Setting` has `ResetLevelUpPoints="false"`, a character's not-yet-distributed level-up points survive the reset - the reset reward points are added to whatever they already had rather than replacing them. With `ResetLevelUpPoints="true"` (default), unspent points are cleared first and only the reward points remain.
{% endhint %}

{% hint style="info" %}
**Points Calculation Timing**: Points are calculated based on the NEW reset count (after incrementing). For example:

* **Regular Reset**: If player has 9 resets and performs their 10th, points are calculated as `LevelUpPoints × 10`
* **Grand Reset**: The reset count is zeroed AFTER calculation, so the final reset count before zeroing is used for `LEVEL_POINTS_MULTI_RESET`
* **Persistent Bonuses**: `GrandResetBonusPoints` and `MasterResetBonusPoints` are ONLY applied to regular resets (Type="RESET"), not to grand or master resets. They use the current (not incremented) grand/master reset counts.
  {% endhint %}

## Examples

{% tabs %}
{% tab title="Standard Server" %}

```xml
<ResetSystem Enabled="true">
    <Settings>
        <Setting Index="0" ResetStats="true" ResetCommand="true"
                 ResetLevelUpPoints="true" TeleportToBaseMap="true" />
    </Settings>
    <ItemRequirements>
        <ItemReq Index="0" ItemType="-1" Count="0" />
    </ItemRequirements>
    <Rewards>
        <Reward Index="0" PointsType="LEVEL_POINTS_MULTI_RESET"
                LevelUpPoints="500" WCoins="100" />
    </Rewards>
    <Requirements>
        <Requirement Index="0" Type="RESET" AccountLevel="*"
                     SettingsIndex="0" RequiredLevel="400"
                     ResetRange="000-999" ZenType="REMOVE_MULTI"
                     ZenValue="100000" RewardIndex="0" />
    </Requirements>
</ResetSystem>
```

{% endtab %}

{% tab title="With Grand Reset" %}

```xml
<ResetSystem Enabled="true">
    <Settings>
        <Setting Index="0" ResetStats="true" TeleportToBaseMap="true" />
    </Settings>
    <ItemRequirements>
        <ItemReq Index="0" ItemType="-1" Count="0" />
        <ItemReq Index="1" ItemType="14" ItemIndex="13" Count="10" />
    </ItemRequirements>
    <Rewards>
        <Reward Index="0" PointsType="LEVEL_POINTS_MULTI_RESET"
                LevelUpPoints="500" GrandResetBonusPoints="15000" />
        <Reward Index="1" PointsType="LEVEL_POINTS_MULTI_GRAND_RESET"
                LevelUpPoints="15000" WCoins="500" BagIndex="101" />
    </Rewards>
    <Requirements>
        <!-- Regular Reset -->
        <Requirement Index="0" Type="RESET" SettingsIndex="0"
                     RequiredLevel="400" ResetRange="000-999"
                     ZenType="REMOVE_MULTI" ZenValue="100000"
                     ItemReqIndex="1" RewardIndex="0" />
        <!-- Grand Reset at 100 resets -->
        <Requirement Index="10" Type="GRAND_RESET" SettingsIndex="0"
                     RequiredResets="100" ResetResetsOnGrandReset="true"
                     ZenType="NO_REMOVE" RewardIndex="1" />
    </Requirements>
</ResetSystem>
```

{% endtab %}

{% tab title="VIP Tiers" %}

```xml
<Requirements>
    <!-- Free players: harder requirements -->
    <Requirement Index="0" Type="RESET" AccountLevel="AL0"
                 RequiredLevel="400" ZenType="REMOVE_MULTI"
                 ZenValue="200000" RewardIndex="0" />

    <!-- VIP players: easier requirements -->
    <Requirement Index="1" Type="RESET" AccountLevel="AL1"
                 RequiredLevel="350" ZenType="REMOVE_MULTI"
                 ZenValue="100000" RewardIndex="1" />
</Requirements>
```

{% endtab %}
{% endtabs %}

## Common Issues

{% hint style="warning" %}
**Points Not Scaling**: Verify `PointsType` is set to a MULTI variant if you want points to increase with resets.
{% endhint %}

{% hint style="warning" %}
**Grand Reset Not Zeroing Resets**: Set `ResetResetsOnGrandReset="true"` on the grand reset requirement.
{% endhint %}

{% hint style="danger" %}
**No Matching Requirement**: If the player's current state doesn't match any Requirement entry, reset will fail. Check `ResetRange` and `AccountLevel` filters.
{% endhint %}

## Chat Commands

| Command                 | Action                |
| ----------------------- | --------------------- |
| `/reset`                | Perform regular reset |
| `/grandreset` or `/gr`  | Perform grand reset   |
| `/masterreset` or `/mr` | Perform master reset  |

Command matching is case-insensitive and requires an exact match (no arguments after the command). A client-side Reset Panel window can also trigger the same pipeline without a chat command.

## Related Configuration

* [common.dat](/docs/gameserver/common-dat.md) - provides the `AccountLevel` values matched by `AccountLevel="AL0".."AL3"`
* [command.dat](/docs/gameserver/command-dat.md) - Command (Leadership) stat baseline restored when `ResetCommand="true"`
* [Item configuration](/docs/data/item/item.md) - item identity used by `ItemReq` `ItemType`/`ItemIndex`
