Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Book export JSON format

export:books writes, per language discovered in the strings archive:

  • One JSON file per book, under <output-directory>/localized/<language>/, named <owningPlugin>_<localId>_<editorId>.json (e.g. skyrim.esm_0F3AC2_Book0EditorId.json); see BookFileExporter.GetFileName.
  • One index.json in that same directory, listing every book exported for that language; see BookIndexWriter.

Once per export, it also writes <output-directory>/export.json, the export manifest: what describes the whole export rather than one language, such as its load order.

All are written with System.Text.Json source generation (Pipelines/Books/BookExportJsonContext.cs), camelCase property names, indented. Source generation (not reflection-based JsonSerializer.Serialize<T>) is required here because the project publishes with PublishAot=true.

The authoritative C# shapes are Pipelines/Books/BookExportModel.cs (BookExportModel, BookTeachesModel, BookKeywordModel, BookLocationModel), Pipelines/Books/BookIndexWriter.cs (BookIndexEntryModel), Pipelines/Books/ExportManifestWriter.cs (ExportManifestModel), Pipelines/Books/LoadOrderModel.cs and Pipelines/Books/ExportMetaModel.cs. The TypeScript below mirrors them for consumers outside this repo (the static site); keep both in sync by hand, there is no generation step tying them together.

Per-book file

Every FormId is a GlobalFormId string, "owningPlugin:localId", such as "skyrim.esm:0F3AC2". A *Source field names the plugin that last set the matching field, or null when none did.

interface BookExport {
  formId: string;
  /** Lowercased file name of the plugin that defines the book, e.g. "skyrim.esm". */
  owningPlugin: string;
  /** Hex id local to owningPlugin, e.g. "0F3AC2". */
  localId: string;

  editorId: string | null;
  title: string | null;
  /** DESC text. When DESC is blank once markup is stripped and menuArtFormId is set, a generated
   * placeholder naming the menu art record instead, see contentIsPlaceholder. */
  content: string | null;
  /** True when content is the generated placeholder. Always false when menuArtFormId is null. */
  contentIsPlaceholder: boolean;
  /** ICON: inventory icon path, relative to the game's Textures folder. */
  inventoryImage: string | null;
  /** DATA gold value: the base price, not a vendor's price, see export heuristics. */
  value: number | null;
  /** DATA type: "book" (0) or "note" (255). null without DATA or outside the spec. */
  type: "book" | "note" | null;
  /** DATA flag 0x02. null without DATA. */
  cannotBeTaken: boolean | null;
  /** DATA weight. null without DATA. */
  weight: number | null;
  /** What reading the book teaches. null when it teaches nothing. */
  teaches: BookTeaches | null;
  /** CNAM: the short inventory text, localized. null when absent or string id 0. */
  description: string | null;
  /** KWDA, in record order. [] when the book has none. */
  keywords: BookKeyword[];
  /** INAM: the record (a STAT in vanilla) whose model shows the book's art. */
  menuArtFormId: string | null;
  /** The menu art record's EditorId and MODL path, when the load order has it. */
  menuArtEditorId: string | null;
  menuArtModelPath: string | null;
  /** Every texture of the menu art model, converted to PNG. [] when there is none or nothing
   * resolves. */
  menuArtImages: MenuArtImage[];

  editorIdSource: string | null;
  titleSource: string | null;
  /** Who set DESC, even when content shows the placeholder. */
  contentSource: string | null;
  inventoryImageSource: string | null;
  valueSource: string | null;
  menuArtFormIdSource: string | null;
  /** DATA: type, cannotBeTaken, weight and teaches, replaced together. */
  dataSource: string | null;
  descriptionSource: string | null;
  keywordsSource: string | null;

  /** Every place the book is placed or reachable from. */
  locations: BookLocation[];
  /** Every leveled list that can produce the book, see below. */
  leveledLists: BookLeveledList[];
  /** The scripts of the book's VMAD. [] without VMAD. */
  scripts: BookScript[];
  scriptsSource: string | null;
}

interface MenuArtImage {
  /** Relative to the export's textures/ folder, e.g. "menuart/fishmapeastmarch01.png". */
  path: string;
  /** The texture's file name matches the model's: the object's own artwork, not shared paper.
   * At most one per array. Prefer it when showing one image. */
  isNameMatch: boolean;
  /** The texture's file name without folder or extension, e.g. "LargeNote01". */
  name: string;
}

interface BookTeaches {
  /** "skill": DATA flag 0x01. "spell": flag 0x04, which wins when both are set. */
  kind: "skill" | "spell";
  /** The SPEL, or the skill's AVIF in Skyrim.esm. */
  formId: string;
  /** null when the load order doesn't have the record. */
  editorId: string | null;
  /** Localized FULL, e.g. "Smithing". null when the record or its string is missing. */
  name: string | null;
  /** The skill's actor value name, the same in every language, e.g. "Marksman" for Archery.
   * null for a spell. */
  actorValue: string | null;
}

interface BookKeyword {
  formId: string;
  /** null when the load order doesn't have the KYWD. Keywords have no localized name. */
  editorId: string | null;
}

interface BookLocation {
  /** "direct": a REFR of the book itself.
   * "container": reachable from a placed CONT's items, nested leveled lists included.
   * "npc": reachable from a placed NPC's inventory, the NPC in no vendor faction.
   * "vendor": sold by a placed NPC of a vendor faction, from its inventory or its faction's chest,
   *   or found in a placed vendor chest.
   * Only "direct" is a guarantee, see export heuristics. */
  source: "direct" | "container" | "npc" | "vendor";
  /** The container's or NPC's EditorId. null for "direct". */
  sourceEditorId: string | null;
  /** The placed reference itself (book, container or NPC), not its base record. */
  refFormId: string;

  /** null for an interior cell. */
  worldspaceEditorId: string | null;
  cellEditorId: string | null;
  isInterior: boolean;
  /** Exterior cell grid. null for an interior cell. */
  gridX: number | null;
  gridY: number | null;

  /** Position in game units, cell-local for an interior. */
  x: number;
  y: number;
  z: number;

  /** The reference's Persistent flag: often quest-related, not always. */
  isPersistent: boolean;
  /** The reference carries a VMAD. Its contents aren't read. */
  hasScript: boolean;
}

interface BookLeveledList {
  formId: string;
  editorId: string | null;
  /** The book's LVLO entry in this list, only when the book is a direct entry; the first one
   * when it is listed several times. null when reached through a nested list. */
  level: number | null;
  count: number | null;
}

leveledLists is every LVLI that can produce the book, through nested lists included, whether or not anything placed uses the list. locations only follows lists reachable from a placed CONT or NPC_, so a book can have leveled lists and no location, or the other way round.

interface BookScript {
  /** The script's name, without extension. */
  name: string;
  /** VMAD script status byte, raw, from VMAD version 4. null on older data. */
  status: number | null;
  properties: BookScriptProperty[];
}

interface BookScriptProperty {
  name: string;
  /** Which value field is set; the nine others are null. */
  type: "object" | "string" | "int32" | "float" | "bool" |
        "objectArray" | "stringArray" | "int32Array" | "floatArray" | "boolArray";
  /** VMAD property status byte, raw, from VMAD version 4. */
  status: number | null;
  stringValue: string | null;
  int32Value: number | null;
  floatValue: number | null;
  boolValue: boolean | null;
  objectValue: BookScriptObjectValue | null;
  stringArrayValue: string[] | null;
  int32ArrayValue: number[] | null;
  floatArrayValue: number[] | null;
  boolArrayValue: boolean[] | null;
  objectArrayValue: BookScriptObjectValue[] | null;
}

interface BookScriptObjectValue {
  /** null when the FormId doesn't resolve, see data problems: the property is kept. */
  formId: string | null;
  /** Only when formId is null: the file-local FormId in hex, e.g. "000C583E". */
  rawFormId: string | null;
  /** The quest alias the reference is bound to. null for a plain reference (VMAD's 0xFFFF). */
  aliasId: number | null;
}

Per-language index: index.json

interface LanguageIndex {
  books: BookIndexEntry[];
  fonts: FontIndexEntry[];
}

interface BookIndexEntry {
  formId: string;
  editorId: string | null;
  title: string | null;
  /** File name only (same directory as index.json), e.g. "skyrim.esm_0F3AC2_Book0EditorId.json". */
  fileName: string;
  /** Total entries in that book's `locations` array, all sources combined. */
  locationCount: number;
  /** True if at least one of that book's locations has source "direct". */
  hasDirectLocation: boolean;
}

interface FontIndexEntry {
  /** The font's DefineFontName, e.g. "Daedric". */
  name: string;
  /** The markup faces whose fontconfig map name is this font's name, e.g. ["$DaedricFont"].
   * [] when none matches, see font-export.md. A face should appear under one font at most; this
   * isn't enforced. */
  styles: string[];
  /** TTF file path, relative to index.json's own directory, e.g. "fonts/Daedric.ttf". */
  path: string;
}

fonts is one entry per font converted from that language’s fontlib SWFs. See Font export for why every embedded font is exported.

Export manifest: export.json

What describes the whole export rather than one language. Written once per export, at the root of the output directory, next to localized/ and textures/; see Pipelines/Books/ExportManifestWriter.cs.

interface ExportManifest {
  loadOrder: LoadOrder;
  /** What the export ran with. Optional: an older export has none. */
  meta?: ExportMeta;
}

interface LoadOrder {
  /** The --load-order value the export ran with: "se", "ae" or "custom". */
  name: string;
  /** Plugin file names read, in load order. A plugin of the load order missing from Data is left out. */
  plugins: string[];
  /** BSA file names opened, in load order. An archive missing from Data is left out. */
  archives: string[];
}

loadOrder lists the files the export actually read, not the files the load order asked for. See Load order and merging for how the lists are built.

Export meta

meta records the command and the options an export ran with. export.json carries it, and so does each map manifest of the map export format, never maps.json.

interface ExportMeta {
  /** The exporter command, e.g. "export:books". */
  command: string;
  /** Option name as typed on the command line, to its value as text, in the command's order. */
  options: { [name: string]: string };
}
RuleBehavior
Options listedEvery option with a value, given or defaulted. A flag not given is "false"
Left outThe arguments and the path options (--output-directory): they name folders of your machine
Changing no output fileLeft out: --clean, and --stats of export:books
Not listed--verbose and --help, which belong to the whole CLI
Repeated optionIts values joined with , , e.g. "Tamriel, Sovngarde"

A consumer shows the values as they are and doesn’t parse them. Commands/ExportMeta.cs builds it.