# ESO – Skill Affinity (Damage Type) Hex Values

## Affinity values

<table id="bkmrk-value-hex-byte-affin"><thead><tr><th>Value</th><th>Hex byte</th><th>Affinity</th></tr></thead><tbody><tr><td>1</td><td><code>01</code></td><td>Ferus</td></tr><tr><td>2</td><td><code>02</code></td><td>Flora</td></tr><tr><td>3</td><td><code>03</code></td><td>Aquan</td></tr><tr><td>4</td><td><code>04</code></td><td>Pyros</td></tr><tr><td>5</td><td><code>05</code></td><td>Terra</td></tr></tbody></table>

On the server, a skill's affinity is set by passing one of these numbers to `Skill::SetDamagetype(int)` in `libskill.so`.

## How it appears in the code

The value sits in the instruction just before the call to `Skill::SetDamagetype`. Most skills push it directly:

<table id="bkmrk-bytes-meaning-affini"><thead><tr><th>Bytes</th><th>Meaning</th><th>Affinity</th></tr></thead><tbody><tr><td><code>6A 01</code></td><td>push 1</td><td>Ferus</td></tr><tr><td><code>6A 02</code></td><td>push 2</td><td>Flora</td></tr><tr><td><code>6A 03</code></td><td>push 3</td><td>Aquan</td></tr><tr><td><code>6A 04</code></td><td>push 4</td><td>Pyros</td></tr><tr><td><code>6A 05</code></td><td>push 5</td><td>Terra</td></tr></tbody></table>

Sometimes the value is loaded into a register first and then pushed, for example:

- `BA 02 00 00 00` = set EDX to 2 (Flora)
- `B8 04 00 00 00` = set EAX to 4 (Pyros)

In each case, the byte right after the opcode (`6A`, `BA` or `B8`) is the affinity.

## Finding a skill's affinity

1. Open `libskill.so` in a disassembler (IDA, Ghidra or similar). The file keeps its function names, so skills are easy to find by name.
2. Go to the skill's damage function and find the call to `Skill::SetDamagetype`.
3. Look at the instruction just before that call. The number it pushes or loads is the skill's affinity (see the tables above).

## Changing a skill's affinity

1. Stop the server.
2. Back up `libskill.so`.
3. Open `libskill.so` in a hex editor and go to the file offset of that value byte.
4. Replace the byte with `01`–`05` from the affinity table.
5. Save, upload the file to the server, and start it.

> Change only that single byte, so the instruction keeps its length.
> 
> Some skills share their damage code with other skills. Changing the byte in shared code changes the affinity of every skill that uses it. Check that the function belongs to only the skill you want to change.