ck3save

Crates.iock3save
lib.rsck3save
version0.4.3
sourcesrc
created_at2020-09-07 13:52:05.5738
updated_at2022-10-24 12:20:11.361541
descriptionErgonomically work with all CK3 saves (regular and ironman)
homepage
repositoryhttps://github.com/rakaly/ck3save.git
max_upload_size
id285716
size170,359
Nick Babcock (nickbabcock)

documentation

README

ci Version

CK3 Save

CK3 Save is a library to ergonomically work with Crusader Kings III (CK3) saves (ironman + regular).

use ck3save::{
    models::{Gamestate, HeaderBorrowed},
    Ck3File, Encoding, EnvTokens,
};

let data = std::fs::read("assets/saves/Jarl_Ivar_of_the_Isles_867_01_01.ck3")?;
let file = Ck3File::from_slice(&data)?;
assert_eq!(file.encoding(), Encoding::TextZip);

let meta = file.parse_metadata()?;
let header: HeaderBorrowed = meta.deserializer().build(&EnvTokens)?;

let mut zip_sink = Vec::new();
let parsed_file = file.parse(&mut zip_sink)?;
let save: Gamestate = parsed_file.deserializer().build(&EnvTokens)?;
assert_eq!(save.meta_data.version, String::from("1.0.2"));
assert_eq!(header.meta_data.version, String::from("1.0.2"));

Ironman

By default, ironman saves will not be decoded properly.

To enable support, one must supply an environment variable (CK3_IRONMAN_TOKENS) that points to a newline delimited text file of token descriptions. For instance:

0xffff my_test_token
0xeeee my_test_token2

In order to comply with legal restrictions, I cannot share the list of tokens. I am also restricted from divulging how the list of tokens can be derived.

Commit count: 170

cargo fmt