> For the complete documentation index, see [llms.txt](https://axiomemu.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://axiomemu.gitbook.io/docs/data/item/itemvalue.md).

# ItemValue

This configuration file defines custom prices for items, including support for alternative currencies (WCoinC, WCoinP, GoblinPoints).

## File Location

```
Data/Item/ItemValue.xml
```

## Dependencies

| Depends On                                    | Purpose                                                                     |
| --------------------------------------------- | --------------------------------------------------------------------------- |
| [Item.xml](/docs/data/item/item.md)           | Item definitions and default prices (Money attribute)                       |
| [ItemStack.xml](/docs/data/item/itemstack.md) | Determines whether an item is stackable, which affects how Value is totaled |

See also: [ItemMove.xml](/docs/data/item/itemmove.md) for per-item sell/trade/drop restrictions, [ItemOption.xml](/docs/data/item/itemoption.md) for the stat effects of excellent Grades referenced here.

## How It Works

1. When an item is priced (NPC buy, NPC sell, personal store listing, or inventory value refresh), the server looks up a matching entry in ItemValue.
2. Matching walks every entry with the same `Index` and picks the first one where `Level` and `Grade` either match exactly or are wildcards. See "Match Priority" below for the exact order.
3. When a match is found, `Value`, the three currency toggles, and `SellPrice` are copied onto the item. Sell price defaults to `Value / 3` when `SellPrice="0"`.
4. For stackable items (see [ItemStack.xml](/docs/data/item/itemstack.md)), the NPC buy total is `Value * StackCount`. Bolts (Index 2055) and Arrows (Index 2063) are treated as non-stackable for pricing and always use a single `Value`.
5. If no entry matches, the default buy/sell price calculated from the `Money` attribute in [Item.xml](/docs/data/item/item.md) is used (sell = Money / 3).

## Structure

```xml
<Item Index="7181" Level="*" Grade="*" Value="90000000"
      WCoinC="0" WCoinP="0" GoblinPoint="0" SellPrice="100"
      Name="Jewel of Bless"/>
```

## Attributes

| Attribute     | Type   | Description                                                              |
| ------------- | ------ | ------------------------------------------------------------------------ |
| `Index`       | int    | Item index (Category \* 512 + Type)                                      |
| `Level`       | string | `*` for any level, or `0`-`15` for a specific +level                     |
| `Grade`       | string | `*` for any grade, or the item's excellent-option bitmask value to match |
| `Value`       | int64  | Buy price (per-unit for stackables, except Bolts/Arrows)                 |
| `WCoinC`      | int    | 1 = price is in WCoinC, 0 = not used                                     |
| `WCoinP`      | int    | 1 = price is in WCoinP, 0 = not used                                     |
| `GoblinPoint` | int    | 1 = price is in GoblinPoints, 0 = not used                               |
| `SellPrice`   | int64  | Sell price override in the selected currency (`0` = use `Value / 3`)     |
| `Name`        | string | Item name (optional, for reference)                                      |

### Currency Priority

When multiple currency toggles are set to 1:

```
GoblinPoint > WCoinP > WCoinC > Zen
```

If all toggles are 0, price is in Zen.

## Examples

{% tabs %}
{% tab title="Zen Price" %}

```xml
<!-- Jewel of Bless: Buy 90M Zen, Sell 100 Zen -->
<Item Index="7181" Level="*" Grade="*" Value="90000000"
      WCoinC="0" WCoinP="0" GoblinPoint="0" SellPrice="100"
      Name="Jewel of Bless"/>
```

All currency toggles = 0 means Zen is used.
{% endtab %}

{% tab title="WCoin Price" %}

```xml
<!-- Buy with WCoinC -->
<Item Index="26" Level="0" Grade="*" Value="30"
      WCoinC="1" WCoinP="0" GoblinPoint="0" SellPrice="7"
      Name="Sword"/>

<!-- Buy with WCoinP -->
<Item Index="6693" Level="*" Grade="*" Value="50"
      WCoinC="0" WCoinP="1" GoblinPoint="0" SellPrice="0"
      Name="Horn of Fenrir"/>
```

{% endtab %}

{% tab title="GoblinPoint Price" %}

```xml
<!-- Buy with GoblinPoints -->
<Item Index="7168" Level="0" Grade="*" Value="12"
      WCoinC="0" WCoinP="0" GoblinPoint="1" SellPrice="6"
      Name="Sword"/>
```

{% endtab %}

{% tab title="Level-Specific Pricing" %}

```xml
<!-- Different prices per item level -->
<Item Index="2055" Level="0" Grade="*" Value="100" ... Name="Bolt"/>
<Item Index="2055" Level="1" Grade="*" Value="1400" ... Name="Bolt"/>
<Item Index="2055" Level="2" Grade="*" Value="2200" ... Name="Bolt"/>
<Item Index="2055" Level="3" Grade="*" Value="3000" ... Name="Bolt"/>
```

Higher level = higher price.
{% endtab %}

{% tab title="Grade-Specific Pricing" %}

```xml
<!-- Different prices for excellent options -->
<Item Index="6659" Level="*" Grade="0" Value="960000" ... Name="Horn of Dinorant"/>
<Item Index="6659" Level="*" Grade="1" Value="1260000" ... Name="Horn of Dinorant"/>
<Item Index="6659" Level="*" Grade="3" Value="1560000" ... Name="Horn of Dinorant"/>
```

Grade = NewOption (excellent) value. Higher grade = more valuable.
{% endtab %}
{% endtabs %}

## Important Behavior

{% hint style="info" %}
**Default Sell Price**: If SellPrice="0", the sell price is automatically calculated as Value / 3.
{% endhint %}

{% hint style="info" %}
**Match Priority**: The server walks the entry list twice for each lookup.

1. First pass: accept the first entry matching the Index where either the `Level` and `Grade` both match the item exactly, OR the Level matches exactly and the Grade is `*`, OR the Grade matches exactly and the Level is `*`.
2. Second pass: if nothing matched, accept the first entry matching the Index where both `Level` and `Grade` are either exact or `*` (this is how a fully wildcarded `Level="*" Grade="*"` entry is reached).

Within each pass, XML ordering decides ties. Put the most specific overrides near the top of the file and keep the fully wildcarded fallback near the bottom.
{% endhint %}

{% hint style="info" %}
**Unlisted Items**: Items not in this file use their default calculated prices from the `Money` attribute in [Item.xml](/docs/data/item/item.md).
{% endhint %}

{% hint style="info" %}
**Stackable Multiplier**: When a stackable item (defined in [ItemStack.xml](/docs/data/item/itemstack.md)) is priced, the NPC buy total is `Value * StackCount`. Bolts (Index 2055) and Arrows (Index 2063) are the two explicit exceptions and always use a flat `Value` regardless of stack size.
{% endhint %}

{% hint style="warning" %}
**Currency Toggle Priority**: If multiple toggles are set to 1, only the highest priority currency is used. Don't set multiple toggles unless intentional.
{% endhint %}

## Common Issues

{% hint style="warning" %}
**Wrong Price Applied**: Check Level and Grade matching. Use `*` wildcards to match all values of that attribute.
{% endhint %}

{% hint style="warning" %}
**Currency Not Working**: Verify the currency system is enabled in ServerInfo.xml. Check that only one currency toggle is set to 1.
{% endhint %}

{% hint style="danger" %}
**Index Calculation**: Ensure Index = Category \* 512 + Type matches the item in Item.xml.
{% endhint %}
