# SocketItemOption

This configuration file defines the bonuses provided by seed spheres inserted into socket items, including individual seed effects, set bonuses for element combinations, and global package bonuses.

## File Location

```
GameServer/Data/Item/SocketItemOption.xml
```

## Dependencies

| Depends On         | Purpose                              |
| ------------------ | ------------------------------------ |
| SocketItemType.xml | Defines which items can have sockets |

## Structure Overview

The file has three sections:

1. **Options** - Individual seed sphere effects
2. **BonusOptions** - Set bonuses when specific element sequences are matched
3. **PackageOptions** - Global bonuses based on total element type counts

## Options Section

Defines the effect of each seed sphere type.

```xml
<Options>
    <Option Index="0" Type="1" SubIndex="0"
            Name="Attack power increase" Rate="20"
            Value1="17" Value2="19" Value3="21" Value4="23" Value5="25"/>
</Options>
```

### Option Attributes

| Attribute  | Type   | Description                            |
| ---------- | ------ | -------------------------------------- |
| `Index`    | int    | Seed option ID (see eSocketItemOption) |
| `Type`     | int    | Element type (1-6)                     |
| `SubIndex` | int    | Sub-index within element type          |
| `Name`     | string | Display name                           |
| `Rate`     | int    | Selection weight when generating       |
| `Value1-5` | int    | Bonus value per sphere level (1-5)     |

### Element Types

| Type | Element   | Theme              |
| ---- | --------- | ------------------ |
| 1    | Fire      | Attack/Damage      |
| 2    | Water     | Defense/Block      |
| 3    | Ice       | Skill/Hunt         |
| 4    | Wind      | Recovery/Stats     |
| 5    | Lightning | Critical/Excellent |
| 6    | Earth     | Base Stats         |

### Seed Options (eSocketItemOption)

#### Fire Element (Type 1) - Attack

| Index | Name                             | Value Type |
| ----- | -------------------------------- | ---------- |
| 0     | Attack power increase (by level) | Flat       |
| 1     | Attack speed increase            | Flat       |
| 2     | Minimum attack power increase    | Flat       |
| 3     | Maximum attack power increase    | Flat       |
| 4     | Attack power increase            | Flat       |
| 5     | AG consumption decrease          | Percentage |

#### Water Element (Type 2) - Defense

| Index | Name                       | Value Type |
| ----- | -------------------------- | ---------- |
| 10    | Block rating increase      | Percentage |
| 11    | Defense increase           | Flat       |
| 12    | Shield protection increase | Flat       |
| 13    | Damage reduction           | Percentage |
| 14    | Damage reflection          | Percentage |

#### Ice Element (Type 3) - Skill/Hunt

| Index | Name                         | Value Type         |
| ----- | ---------------------------- | ------------------ |
| 16    | Monster attack HP recovery   | Divisor (HP/Value) |
| 17    | Monster attack MP recovery   | Divisor (MP/Value) |
| 18    | Skill attack increase        | Flat               |
| 19    | Attack success rate increase | Flat               |
| 20    | Item durability increase     | Percentage         |

{% hint style="info" %}
**HP/MP Recovery**: Values 16-17 use division. Lower Value = MORE recovery. Value of 4 at sphere level 5 means recover HP/4 per kill.
{% endhint %}

#### Wind Element (Type 4) - Recovery

| Index | Name                 | Value Type |
| ----- | -------------------- | ---------- |
| 21    | HP recovery increase | Flat       |
| 22    | Maximum HP increase  | Percentage |
| 23    | Maximum MP increase  | Percentage |
| 24    | MP recovery increase | Flat       |
| 25    | Maximum AG increase  | Flat       |
| 26    | AG recovery increase | Flat       |

#### Lightning Element (Type 5) - Critical

| Index | Name                           | Value Type |
| ----- | ------------------------------ | ---------- |
| 29    | Excellent damage increase      | Flat       |
| 30    | Excellent damage rate increase | Percentage |
| 31    | Critical damage increase       | Flat       |
| 32    | Critical damage rate increase  | Percentage |

#### Earth Element (Type 6) - Stats

| Index | Name               | Value Type |
| ----- | ------------------ | ---------- |
| 34    | Strength increase  | Flat       |
| 35    | Dexterity increase | Flat       |
| 36    | Vitality increase  | Flat       |
| 37    | Energy increase    | Flat       |

## BonusOptions Section

Grants bonus effects when sockets contain a specific element sequence.

```xml
<BonusOptions>
    <BonusOption Index="0" MinItemSection="0" MaxItemSection="4"
                 Name="Attack power bonus" Value="11"
                 ReqOptionType1="1" ReqOptionType2="5" ReqOptionType3="3"
                 ReqOptionType4="0" ReqOptionType5="0"/>
</BonusOptions>
```

### BonusOption Attributes

| Attribute          | Type   | Description                                             |
| ------------------ | ------ | ------------------------------------------------------- |
| `Index`            | int    | Bonus option ID                                         |
| `MinItemSection`   | int    | Minimum item category                                   |
| `MaxItemSection`   | int    | Maximum item category                                   |
| `Name`             | string | Display name                                            |
| `Value`            | int    | Bonus value                                             |
| `ReqOptionType1-5` | int    | Required element types in sequence (0 = no requirement) |

### Bonus Types

| Index | Item Types    | Name               | Required Elements      |
| ----- | ------------- | ------------------ | ---------------------- |
| 0     | Weapons (0-4) | Attack power bonus | Fire → Lightning → Ice |
| 1     | Weapons (0-4) | Skill damage bonus | Lightning → Ice → Fire |
| 2     | Staff (5)     | Magic power bonus  | Fire → Lightning → Ice |
| 3     | Staff (5)     | Skill damage bonus | Lightning → Ice → Fire |
| 4     | Armor (6-12)  | Defense bonus      | Water → Earth → Wind   |
| 5     | Armor (6-12)  | Max HP bonus       | Earth → Wind → Water   |

## PackageOptions Section

Grants global bonuses based on total element type counts across all equipped socket items.

```xml
<PackageOptions>
    <PackageOption Index="0" Name="Double damage rate" Value="3"
                   ReqOptionTypeCount1="1" ReqOptionTypeCount2="1"
                   ReqOptionTypeCount3="1" ReqOptionTypeCount4="1"
                   ReqOptionTypeCount5="1" ReqOptionTypeCount6="0"/>
</PackageOptions>
```

### PackageOption Attributes

| Attribute               | Type   | Description                     |
| ----------------------- | ------ | ------------------------------- |
| `Index`                 | int    | Package option ID               |
| `Name`                  | string | Display name                    |
| `Value`                 | int    | Bonus value                     |
| `ReqOptionTypeCount1-6` | int    | Required count per element type |

### Package Options

| Index | Name                    | Required Elements                           |
| ----- | ----------------------- | ------------------------------------------- |
| 0     | Double damage rate +3%  | 1 Fire, 1 Water, 1 Ice, 1 Wind, 1 Lightning |
| 1     | Ignore defense rate +1% | 1 Fire, 1 Water, 3 Ice, 1 Wind, 1 Lightning |

## Examples

{% tabs %}
{% tab title="Fire Seed" %}

```xml
<!-- Attack power increase by level - sphere level 5 = +25 -->
<Option Index="0" Type="1" SubIndex="0"
        Name="Attack power increase" Rate="20"
        Value1="17" Value2="19" Value3="21" Value4="23" Value5="25"/>
```

Higher sphere level = higher bonus. Use in weapon sockets.
{% endtab %}

{% tab title="Weapon Bonus" %}

```xml
<!-- Weapon with Fire+Lightning+Ice = +11 Attack -->
<BonusOption Index="0" MinItemSection="0" MaxItemSection="4"
             Name="Attack power bonus" Value="11"
             ReqOptionType1="1" ReqOptionType2="5" ReqOptionType3="3"
             ReqOptionType4="0" ReqOptionType5="0"/>
```

Requires 3 specific seeds in order: Fire(1), Lightning(5), Ice(3).
{% endtab %}

{% tab title="Package Bonus" %}

```xml
<!-- Need 1 of each element type (except Earth) for +3% double damage -->
<PackageOption Index="0" Name="Double damage rate" Value="3"
               ReqOptionTypeCount1="1" ReqOptionTypeCount2="1"
               ReqOptionTypeCount3="1" ReqOptionTypeCount4="1"
               ReqOptionTypeCount5="1" ReqOptionTypeCount6="0"/>
```

Counts all seeds across all equipped socket items.
{% endtab %}
{% endtabs %}

## Important Behavior

{% hint style="info" %}
**Sphere Level**: Seeds have levels 1-5. Higher level spheres provide better bonuses (Value1 through Value5). The sphere level is determined when the seed is created.
{% endhint %}

{% hint style="info" %}
**Bonus Sequence Matching**: BonusOptions check seeds in socket order. Sockets must contain the exact element sequence to trigger the bonus.
{% endhint %}

{% hint style="info" %}
**Package Global Count**: PackageOptions count ALL seeds across ALL equipped socket items, not per-item.
{% endhint %}

{% hint style="warning" %}
**Rate for Selection**: The Rate attribute is used for weighted random selection when generating seeds, not for drop rate calculation.
{% endhint %}

## Common Issues

{% hint style="warning" %}
**Bonus Not Triggering**: Check element sequence is exact match in order. Fire-Ice-Lightning is different from Lightning-Ice-Fire.
{% endhint %}

{% hint style="warning" %}
**Wrong Item Section**: BonusOptions filter by item section. Weapon bonuses (0-4) won't apply to armor (6-12).
{% endhint %}

{% hint style="danger" %}
**Division Options**: Indices 16-17 divide stats by value. Higher Value = LESS recovery. Don't confuse with additive bonuses.
{% endhint %}
