# New Item Rarity

This guide will help you understand:

* How rare items are rolled when a monster dies
* What influences your chance of getting a rare item
* Why certain mobs (like Elites or Insane bosses) are more rewarding
* And how to **maximize your chances of finding Legendary gear**

### 🧱 Overview: What is Item Rarity?

When you loot monsters in EO, some items may drop with special **rarity tiers** that give **random bonus attributes**. The higher the rarity, the **more stats** an item can roll:

| Rarity        | Stats | Color  | Broadcast |
| ------------- | ----- | ------ | --------- |
| **Common**    | 1     | Gray   | ❌         |
| **Uncommon**  | 2     | Green  | ❌         |
| **Rare**      | 3     | Blue   | ❌         |
| **Epic**      | 4     | Purple | ✅         |
| **Legendary** | 5     | Yellow | ✅         |

These bonus stats are powerful, randomized, and scale with gear tier.

#### ✅ Which Items Can Have Rarity?

Not every item can be rare. The system only rolls rarity on **combat gear**:

✅ Eligible: Swords, axes, clubs, bows, crossbows, wands, rods, **spellbooks** (can have all normal stats except "Defense"), helmet, chest, legs, boots, rings, necklaces and quivers.

❌ Not Eligible: Stackables, Items with charges or transformEquipId, Tools, containers, utility items

```lua
--Code Ref
isItemEligibleForRarity(itemId)
```

### 🎯 Target Rarity Frequencies

This table reflects how often a rarity **should** appear on **average** (based on monsters killed, not items dropped).

```lua
TARGET_RARITY_CHANCES = {
    ["common"]    = 35,     -- ~2.86%
    ["uncommon"]  = 100,    -- 1%
    ["rare"]      = 350,    -- ~0.29%
    ["epic"]      = 1000,   -- 0.1%
    ["legendary"] = 2500,   -- 0.04%
}
```

❗ This table is **not scaled** — it's used to **adjust actual rarity rolls** to match the intended drop rate based on how much loot the monster has.

### 🔐 Rarity Thresholds (Max Caps)

Even after scaling, rarity is capped based on where the monster is found.

#### 📦 Dungeon Creatures & Bosses

```lua
RARITY_MAX_CHANCES = {
    ["common"] = 30000, -- 30%
    ["uncommon"] = 18000, -- 18%
    ["rare"] = 10000, -- 10%
    ["epic"] = 6500, -- 6.5%
    ["legendary"] = 3000, -- 3%
}
```

#### 🌲 Open World Monsters

```lua
OPEN_WORLD_RARITY_MAX_CHANCES = {
    ["common"] = 40000, -- 40%
    ["uncommon"] = 25000,  --25%
    ["rare"] = 15000, -- 15%
    ["epic"] = 10000, -- 10%
    ["legendary"] = 4000, -- 4%
}
```

### 🌍 World Boss Tiers

World Bosses use their **own scaling rarity table**, which is then **boosted by monster level** via the `expChance()` function.

```lua
WORLD_BOSSES_TIERS = {
    ["common"]    = 100000, -- 100%
    ["uncommon"]  = 40000, -- 40%
    ["rare"]      = 15000, -- 15%
    ["epic"]      = 6000, -- 6%
    ["legendary"] = 2000, -- 2%
}
```

{% hint style="info" %}
These values are **scaled dynamically** using monster level to provide higher odds for stronger World Bosses.
{% endhint %}

### 🧪 How the System Works (Dissected)

The magic happens in this core function:

```lua
function getLocalRarityChance(itemId, mName, tiers, mLevel, inDungeon)
```

Let’s walk through the steps one by one:

1. Determine the Rarity Threshold

```lua
maxChances = OPEN_WORLD_RARITY_MAX_CHANCES
if inDungeon then
  maxChances = RARITY_MAX_CHANCES
end
```

2. Fetch the Monster's Loot Table

```lua
local mType = MonsterType(mName)
local mLoot = mType:getLootById()
```

Then we get the **drop chance of the current item**, and the **total drop chance** of all eligible items from this monster:

```lua
local dropChance = getMonsterDropChance(mName, mLoot)
```

3. Drop Table Dilution Scaling

This is key:

```lua
local scaleFactor = 100000 / dropChance
```

This **inversely scales rarity chances** based on how many eligible items a monster drops.

✅ **Fewer eligible items** → higher rarity chance\
❌ **Lots of eligible items** → lower chance per item

This makes **small loot tables more rewarding**.

{% hint style="info" %}
🔥 **Elite monsters** benefit from this: since they drop more, they naturally get better chances per item.
{% endhint %}

4. Monster Level Scaling

```lua
local mLevelScaling = scaledChanceByMonsterLevel(mLevel)
```

This uses a level-based multiplier:

<table data-full-width="false"><thead><tr><th>Monster Tier</th><th>Rarity Scaling Multiplier</th><th data-hidden></th></tr></thead><tbody><tr><td>Elite</td><td>1.025</td><td></td></tr><tr><td>Champion</td><td>1.05</td><td></td></tr><tr><td>Overlord</td><td>1.075</td><td></td></tr><tr><td>Insane I</td><td>1.1</td><td></td></tr><tr><td>Insane II</td><td>1.2</td><td></td></tr><tr><td>Insane III</td><td>1.3</td><td></td></tr><tr><td>Insane IV</td><td>1.4</td><td></td></tr><tr><td>Insane V</td><td>1.5</td><td></td></tr><tr><td>Insane VI</td><td>1.6</td><td></td></tr><tr><td>Insane VII</td><td>1.7</td><td></td></tr><tr><td>Insane VIII</td><td>1.8</td><td></td></tr><tr><td>Insane IX</td><td>1.9</td><td></td></tr><tr><td>Insane X</td><td>2</td><td></td></tr></tbody></table>

5. Rarity Tier Roll (Core Loop)

Now we apply all the above and roll the rarity tier:

```lua
for _, tier in pairs(modifiedTable) do
    newChance = math.ceil(tier.chance[1] * scaleFactor * mLevelScaling)
    
    if TARGET_RARITY_CHANCES[tier.prefix] then
        targetChance = (1 / TARGET_RARITY_CHANCES[tier.prefix]) / (dropChance / 100000) * 100000

        -- Clamp to max cap or target
        if not inDungeon or (inDungeon and not isBoss) then
            newChance = math.min(newChance, targetChance)
        end

        newChance = math.min(newChance, maxChances[tier.prefix] * mLevelScaling)
    end

    tier.chance[1] = newChance
end

```

#### ✅ Final Output

The function returns a **custom rarity tier table** for this specific item, adjusted by:

* Loot dilution
* Monster level
* Area caps
* Intended target rarity frequency

This final rarity roll is used in:

```lua
assign_loot_Stat(...)
```

### 🧠 Tips for Players

#### 🏹 Want more legendaries?

* Fight **high-level monsters**
* Prioritize **Elite**, **Superior**, or **Insane** variants
* Hunt in the **open world** where thresholds are higher
* **Higher Insane Dungeon Bosses (VIII, IX, and X)** have significantly boosted scaling — they're some of the **best sources** for Epic and Legendary gear
* **Stack player rarity boosts** (e.g. scrolls, bonuses)
* World Bosses are excellent — personal loot + strong scaling


---

# 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://wiki.eternalodyssey.net/new-item-rarity.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.
