use sylpheed_formats::{game_data, PakArchive};
use std::collections::BTreeMap;
fn main(){
    let disc=std::env::var("SYLPHEED_DISC").unwrap();
    let pak=PakArchive::open(format!("{disc}/dat/GP_MAIN_GAME_E.pak")).unwrap();
    let chars=game_data::load_characters(&pak);
    let mut byfac:BTreeMap<String,Vec<String>>=Default::default();
    for c in &chars{ byfac.entry(c.faction.clone().unwrap_or("·".into())).or_default().push(format!("{}({})",c.id.clone().unwrap_or_default().trim_start_matches("Character"),c.faces.len())); }
    println!("{} characters across {} factions:",chars.len(),byfac.len());
    for (f,mut v) in byfac{ v.sort(); println!("  [{f}] {}", v.join(" ")); }
}
