use sylpheed_formats::{game_data, localization::TextIndex, PakArchive};
fn main(){
    let disc=std::env::var("SYLPHEED_DISC").unwrap();
    let pak=PakArchive::open(format!("{disc}/dat/GP_MAIN_GAME_E.pak")).unwrap();
    let text=TextIndex::build(&pak);
    for n in 1..=16u32{
        let sid=format!("S{n:02}");
        // primary objective across phases (first that resolves)
        let obj:Vec<String>=(1..=3).flat_map(|p|text.objectives(&sid,p)).map(|s|s.to_string()).collect();
        let lose:Vec<String>=(1..=3).flat_map(|p|text.lose_conditions(&sid,p)).map(|s|s.to_string()).collect();
        let full_obj=obj.join(" ");
        let full_lose=lose.into_iter().take(2).collect::<Vec<_>>().join(" ");
        println!("{sid}\t{full_obj}\t{full_lose}");
    }
}
