# EncounterJournal export format

This document fixes the field order inside each row of the JSON / Lua
export. Same order in JSON arrays and Lua tables; the only difference is
the surrounding container syntax.

## `tiers`

Array. Stable order: `sort_order ASC, id ASC`.

```text
[ id, name, flags, sort_order ]
```

## `instances` — keyed by `instance_id`

```text
[
  name,
  description,
  button_icon,
  small_button_icon,
  background,
  lore_background,
  map_id,
  area_id,
  sort_order,
  flags,
  id,
  world_map_area_id
]
```

## `tierInstances` — keyed by `tier_id`

```text
[ instance_id, instance_id, ... ]
```

Stable order: `tier_instance.sort_order ASC, instance_id ASC`.

## `encounters` — keyed by `instance_id`

Array of rows; stable order `sort_order ASC, id ASC`.

```text
[
  id,
  name,
  description,
  map_position_x,
  map_position_y,
  floor_index,
  world_map_area_id,
  first_section_id,
  instance_id,
  difficulty_mask,
  flags,
  sort_order
]
```

## `creatures` — keyed by `encounter_id`

Array of rows; stable order `sort_order ASC, id ASC`.

```text
[
  name,
  description,
  creature_display_id,
  icon,
  encounter_id,
  sort_order,
  id,
  creature_id,
  difficulty_mask
]
```

## `sections` — keyed by `section_id`

Single row per key.

```text
[
  id,
  name,
  description,
  creature_display_id,
  description_spell_id,
  icon_spell_id,
  encounter_id,
  next_section_id,
  sub_section_id,
  parent_section_id,
  flags,
  icon_flags,
  sort_order,
  type,
  difficulty_mask,
  creature_id
]
```

## `items` — keyed by `encounter_id`

Array of rows; stable order `sort_order ASC, id ASC`.

```text
[
  item_id,
  encounter_id,
  difficulty_mask,
  faction_mask,
  flags,
  id,
  class_mask
]
```

> Item name / icon / quality are intentionally **not** part of this
> payload. The MoonWellClient EncounterJournal addon resolves them via
> the regular `GetItemInfo` API; if you need an offline cache, generate
> a separate `ItemCache.lua` from `item_template`.
