94 lines
3.2 KiB
Rust
94 lines
3.2 KiB
Rust
use cursebreaker_parser::MapDatabase;
|
|
use std::env;
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
// Load the Maps.xml file
|
|
let cb_assets_path = env::var("CB_ASSETS_PATH").unwrap_or_else(|_| "/home/connor/repos/CBAssets".to_string());
|
|
let map_db = MapDatabase::load_from_xml(&format!("{}/Data/XMLs/Maps/Maps.xml", cb_assets_path))?;
|
|
|
|
println!("=== Map Database Statistics ===");
|
|
println!("Total maps loaded: {}", map_db.len());
|
|
println!("Total named maps: {}", map_db.get_named_maps().len());
|
|
println!("Total indoor maps: {}", map_db.get_indoor_maps().len());
|
|
println!("Total isolated maps: {}", map_db.get_isolated_maps().len());
|
|
println!();
|
|
|
|
// Show map bounds
|
|
if let Some(((min_x, min_y), (max_x, max_y))) = map_db.get_map_bounds() {
|
|
println!("=== Map Grid Bounds ===");
|
|
println!("X range: {} to {}", min_x, max_x);
|
|
println!("Y range: {} to {}", min_y, max_y);
|
|
println!();
|
|
}
|
|
|
|
// Show some specific maps
|
|
println!("=== Sample Maps ===");
|
|
|
|
if let Some(map) = map_db.get_by_scene_id("3,10") {
|
|
println!("Map at 3,10:");
|
|
println!(" Name: {}", if map.name.is_empty() { "(unnamed)" } else { &map.name });
|
|
println!(" Music: {}", map.music);
|
|
println!(" Ambience: {}", map.ambience);
|
|
println!(" Indoor: {}", map.indoors);
|
|
if let Some(ref fog_color) = map.fog_color {
|
|
println!(" Fog color: {}", fog_color);
|
|
}
|
|
println!();
|
|
}
|
|
|
|
// Show Haywind maps
|
|
println!("=== Maps named 'Haywind' ===");
|
|
let haywind_maps = map_db.get_by_name("Haywind");
|
|
for map in &haywind_maps {
|
|
println!(" Scene ID: {} (Music: {})", map.scene_id, map.music);
|
|
}
|
|
println!("Total: {}", haywind_maps.len());
|
|
println!();
|
|
|
|
// Show Thornhill City maps
|
|
println!("=== Maps named 'Thornhill City' ===");
|
|
let thornhill_maps = map_db.get_by_name("Thornhill City");
|
|
for map in þhill_maps {
|
|
println!(" Scene ID: {} (Music: {})", map.scene_id, map.music);
|
|
}
|
|
println!("Total: {}", thornhill_maps.len());
|
|
println!();
|
|
|
|
// Show all unique map names (first 20)
|
|
println!("=== Unique Map Names (first 20) ===");
|
|
let mut names = map_db.get_all_map_names();
|
|
names.sort();
|
|
for name in names.iter().take(20) {
|
|
println!(" {}", name);
|
|
}
|
|
println!("... and {} more", names.len().saturating_sub(20));
|
|
println!();
|
|
|
|
// Show maps with respawn locations
|
|
println!("=== Maps with Respawn Locations ===");
|
|
let respawn_maps = map_db.get_maps_with_respawn();
|
|
for map in respawn_maps.iter().take(5) {
|
|
println!(
|
|
" {} -> respawns at {}",
|
|
map.scene_id,
|
|
map.respawn_map.as_ref().unwrap_or(&"?".to_string())
|
|
);
|
|
}
|
|
println!("Total maps with respawn: {}", respawn_maps.len());
|
|
println!();
|
|
|
|
// Show connected maps
|
|
println!("=== Connected Maps (examples) ===");
|
|
let connected = map_db.get_connected_maps();
|
|
for map in connected.iter().take(5) {
|
|
println!(
|
|
" {} connects to: {}",
|
|
map.scene_id,
|
|
map.connected_maps.as_ref().unwrap_or(&"?".to_string())
|
|
);
|
|
}
|
|
println!("Total connected maps: {}", connected.len());
|
|
|
|
Ok(())
|
|
}
|