# 380ItemType

This configuration file defines which items can receive 380-level enhancement options and maps them to specific option types from 380ItemOption.xml.

## File Location

```
GameServer/Data/Item/380ItemType.xml
```

## Dependencies

| Depends On        | Purpose                                    |
| ----------------- | ------------------------------------------ |
| Item.xml          | Item definitions by Category/Type          |
| 380ItemOption.xml | Option type definitions and default values |

## How It Works

1. Player obtains a 380-enhanced item (via item flag `m_ItemOptionEx & 0x80`)
2. Server looks up item in 380ItemType by Category/Type
3. Retrieves OptionIndex1/2 (option types) and OptionValue1/2 (values)
4. If OptionValue is `*` (-1 internally), uses default Value from 380ItemOption.xml
5. Applies bonuses to player stats (PvP-focused bonuses)

## Structure

```xml
<Item380TypeList>
    <Item Category="0" Type="22" OptionIndex1="2" OptionValue1="*" OptionIndex2="1" OptionValue2="*"/>
</Item380TypeList>
```

## Attributes

| Attribute      | Type   | Description                                                    |
| -------------- | ------ | -------------------------------------------------------------- |
| `Category`     | int    | Item category (0-14, though only 0-11 used in standard config) |
| `Type`         | int    | Item type index within category                                |
| `OptionIndex1` | int    | First option type (see Option Types table below)               |
| `OptionValue1` | string | First option value (`*` = use default from 380ItemOption)      |
| `OptionIndex2` | int    | Second option type (0 = none, or index from Option Types)      |
| `OptionValue2` | string | Second option value (`*` = use default)                        |

### Item Index Calculation

```
ItemIndex = Category * 512 + Type
```

### Category Reference

| Category | Item Type      |
| -------- | -------------- |
| 0        | Swords         |
| 1        | Axes           |
| 2        | Maces/Scepters |
| 3        | Spears         |
| 4        | Bows/Crossbows |
| 5        | Staffs         |
| 6        | Shields        |
| 7        | Helms          |
| 8        | Armor          |
| 9        | Pants          |
| 10       | Gloves         |
| 11       | Boots          |

### Option Types (e380ItemOption)

| Index | Name                         | Effect                     |
| ----- | ---------------------------- | -------------------------- |
| 1     | Add Attack Success Rate PvP  | +value attack rate in PvP  |
| 2     | Add Damage PvP               | +value damage in PvP       |
| 3     | Add Defense Success Rate PvP | +value defense rate in PvP |
| 4     | Add Defense PvP              | +value defense in PvP      |
| 5     | Add Max HP                   | +value maximum HP          |
| 6     | Add Max SD                   | +value maximum SD          |
| 7     | Set SD Recovery Type         | Sets SD recovery mode      |
| 8     | Add SD Recovery Rate         | +value SD recovery rate    |

## Standard Option Assignments

| Equipment Slot    | OptionIndex1         | OptionIndex2         |
| ----------------- | -------------------- | -------------------- |
| Weapons (Cat 0-5) | 2 (Damage PvP)       | 1 (Attack Rate PvP)  |
| Helms (Cat 7)     | 8 (SD Recovery Rate) | 3 (Defense Rate PvP) |
| Armor (Cat 8)     | 7 (SD Recovery Type) | 3 (Defense Rate PvP) |
| Pants (Cat 9)     | 4 (Defense PvP)      | 3 (Defense Rate PvP) |
| Gloves (Cat 10)   | 5 (Max HP)           | 3 (Defense Rate PvP) |
| Boots (Cat 11)    | 6 (Max SD)           | 3 (Defense Rate PvP) |

## Examples

{% tabs %}
{% tab title="Weapon" %}

```xml
<!-- Rune Blade (Section 0, Type 22) - PvP damage bonuses -->
<Item Category="0" Type="22" OptionIndex1="2" OptionValue1="*" OptionIndex2="1" OptionValue2="*"/>
```

* OptionIndex1=2: Add Damage PvP (default value from 380ItemOption)
* OptionIndex2=1: Add Attack Success Rate PvP (default value)
  {% endtab %}

{% tab title="Armor Piece" %}

```xml
<!-- Dark Phoenix Helm (Section 7, Type 29) - SD recovery bonuses -->
<Item Category="7" Type="29" OptionIndex1="8" OptionValue1="*" OptionIndex2="3" OptionValue2="*"/>
```

* OptionIndex1=8: Add SD Recovery Rate
* OptionIndex2=3: Add Defense Success Rate PvP
  {% endtab %}

{% tab title="Custom Value Override" %}

```xml
<!-- Custom weapon with specific values instead of defaults -->
<Item Category="0" Type="22" OptionIndex1="2" OptionValue1="15" OptionIndex2="1" OptionValue2="10"/>
```

* OptionValue1=15: +15 Damage PvP (overrides default)
* OptionValue2=10: +10 Attack Rate PvP (overrides default)
  {% endtab %}
  {% endtabs %}

## Important Behavior

{% hint style="info" %}
**Wildcard Value**: Using `*` for OptionValue tells the server to use the default Value from 380ItemOption.xml for that option index. This allows centralized value management.
{% endhint %}

{% hint style="info" %}
**380 Item Flag**: Items must have the 380 flag set (`m_ItemOptionEx & 0x80`) to activate these bonuses. The flag is typically set during item creation or enhancement.
{% endhint %}

{% hint style="info" %}
**Two Options Per Item**: Each 380 item can have exactly two option slots. Both are applied when the item is equipped.
{% endhint %}

{% hint style="warning" %}
**PvP Focus**: Most 380 options (indices 1-4) only affect PvP combat. Options 5-8 affect general gameplay (HP, SD, recovery).
{% endhint %}

## Common Issues

{% hint style="warning" %}
**Item Not Getting 380 Options**: Verify item has the 380 flag set AND is listed in this file with matching Category/Type.
{% endhint %}

{% hint style="warning" %}
**Wrong Category/Type**: Values must exactly match Item.xml. Use ItemIndex = Category \* 512 + Type to verify.
{% endhint %}

{% hint style="danger" %}
**Invalid OptionIndex**: Using an OptionIndex not defined in 380ItemOption.xml will result in no bonus being applied.
{% endhint %}
