Skip to main content

Module assembly_kit

Module assembly_kit 

Source
Expand description

Assembly Kit integration for importing official table definitions.

This module provides functionality to parse and import table structure information from Creative Assembly’s official Assembly Kit tools. This allows RPFM’s schemas to stay synchronized with the official game data formats.

§Assembly Kit Versions

Different Total War games use different Assembly Kit formats:

  • Version 0: Empire Total War and Napoleon Total War

    • Uses .xsd XML schema files
    • Simpler structure without relationship metadata
  • Version 1: Shogun 2 Total War

    • Uses XML files with TWaD_ prefix
    • Includes localisable field information
  • Version 2: Rome 2 and later (including Warhammer series, Three Kingdoms, Troy, etc.)

    • Enhanced XML format with full relationship metadata
    • Separate relationship and localisable fields files
    • Field-level metadata (descriptions, highlight flags for unused fields)

§Main Functionality

§Schema Updates

The primary function update_schema_from_raw_files() processes Assembly Kit files to:

  • Update field types, keys, and default values
  • Import foreign key relationships
  • Detect localisable (translatable) fields
  • Mark unused fields (via highlight flags)
  • Extract hardcoded lookup data from description fields

§File Parsing

The module can parse several Assembly Kit file types:

  • Table definitions (TWaD_*.xml or *.xsd): Field structure and types
  • Localisable fields (TExc_LocalisableFields.xml): Translation-ready fields
  • Relationships (TWaD_relationships.xml): Foreign key relationships
  • Table data: Sample data for generating hardcoded lookups

§Submodules

§Example Usage

use rpfm_lib::integrations::assembly_kit::update_schema_from_raw_files;
use rpfm_lib::schema::Schema;
use rpfm_lib::games::supported_games::{SupportedGames, KEY_WARHAMMER_3};
use std::path::Path;
use std::collections::HashMap;

let mut schema = Schema::load(Path::new("schemas/warhammer_3.ron"), None)?;
let supported_games = SupportedGames::default();
let game_info = supported_games.game(&KEY_WARHAMMER_3).unwrap();
let ass_kit_path = Path::new("C:/Program Files/Steam/steamapps/common/Total War WARHAMMER III/assembly_kit");
let schema_path = Path::new("schemas/warhammer_3.ron");
let tables_to_check = HashMap::new(); // Load vanilla tables here

let unfound_fields = update_schema_from_raw_files(
    &mut schema,
    game_info,
    ass_kit_path,
    schema_path,
    &[],
    &tables_to_check,
)?;

Modules§

localisable_fields
Localisable fields parsing for Assembly Kit integration.
table_data
Assembly Kit table data parsing and conversion.
table_definition
Assembly Kit table definition parsing and schema generation.

Functions§

get_raw_data_paths
Returns paths to all table data files in an Assembly Kit directory.
get_raw_definition_paths
Returns paths to all table definition files in an Assembly Kit directory.
get_raw_extra_relationships_path
Returns the path to the extra relationships metadata file.
get_raw_localisable_fields_path
Returns the path to the localisable fields metadata file.
update_schema_from_raw_files
Updates an existing schema with metadata from Assembly Kit files.