# XP System

## 📊 XP System

The Nova AI XP System is the core mechanic that powers the leveling progression. This page explains how XP is earned, calculated, and applied to your level.

### 🎮 Earning XP

XP (Experience Points) is awarded when you use bot commands. Different commands award different amounts of XP based on their complexity and value.

#### 📋 XP Sources

| Activity Type        | XP Range | Probability | Examples              |
| -------------------- | -------- | ----------- | --------------------- |
| Chatbot Interactions | 20-40    | 100%        | Chatting with the AI  |
| Fishing/Mining       | 15-30 XP | 75%         | `/fish`, `/mine`      |
| Gambling Commands    | 10-20 XP | 50%         | `/coinflip`, `/slots` |

#### 🎲 Probability Factor

Not every command execution guarantees XP. Each command has a probability percentage that determines the chance of receiving XP. This randomness adds an element of surprise and prevents XP farming.

#### 🔄 XP Cooldowns

While not explicitly implemented, the probability system naturally creates an effective cooldown, as rapid command usage doesn't guarantee XP for every action.

### 🚀 XP Boosters

The system includes two types of XP boosters that can increase the amount of XP earned:

#### ⭐ Premium Boost

Premium users receive a permanent +50% XP boost on all commands.

**Example:**

* Base XP from command: 20 XP
* With Premium: 30 XP (+50%)

#### 🔋 XP Booster Item

The XP Booster is a temporary item available in the shop that provides +50% XP for 12 hours.

**Example:**

* Base XP from command: 20 XP
* With XP Booster: 30 XP (+50%)

#### 💎 Stacking Boosters

Premium status and XP Booster items stack multiplicatively:

**Example:**

* Base XP from command: 20 XP
* With Premium (+50%): 30 XP
* With Premium AND XP Booster: 45 XP (+125% total)

### 📈 Level Calculation

The system uses an exponential curve to determine level progression:

#### 🧮 XP Formula

The XP required for each level follows this pattern:

```
Level 1 → 2: 50 XP
Level 2 → 3: 75 XP (50 * 1.5)
Level 3 → 4: 113 XP (75 * 1.5)
Level n → n+1: previous_level_XP * 1.5
```

#### 📊 XP Table

| Level | XP Required | Cumulative XP |
| ----- | ----------- | ------------- |
| 1     | 0           | 0             |
| 2     | 50          | 50            |
| 3     | 75          | 125           |
| 4     | 113         | 238           |
| 5     | 169         | 407           |
| 10    | 854         | 2,828         |
| 15    | 2,440       | 11,419        |
| 20    | 6,966       | 38,474        |
| 25    | 19,890      | 129,686       |
| 30    | 56,796      | 437,262       |
| 50    | 3,767,367   | 56,510,499    |

#### 📉 Level Determination

The system calculates your current level based on your total accumulated XP:

1. Start at level 1
2. Check if total XP exceeds the requirement for the next level
3. If yes, increment level and repeat
4. If no, current level is determined

### 🔍 XP Tracking

Your XP progress is visualized in several ways:

#### 📊 Progress Bar

The profile command displays a visual progress bar showing your advancement toward the next level:

```
Level 15 | ████████░░░░░░░░░░ | 500/2440 XP (20.5%)
```

#### 🎯 Level-Up Notifications

When you earn enough XP to level up, you'll receive a notification:

```
🌟 Level Up! 🌟
Congratulations @User! You've leveled up!

Level Progress
Level 14 → Level 15
```

If the level up also results in a rank change, the notification will include that information as well.

###

### 🛠️ Technical Implementation

The XP system is implemented using a decorator pattern:

This decorator automatically handles:

* Random XP amount determination
* Probability check
* XP booster application
* Level up detection
* Notification sending

#### 💬 Chatbot XP

In addition to commands, users can earn XP simply by chatting with the AI bot. Every message sent to the bot has a chance to award XP, encouraging natural conversation and engagement.
