110 lines
3.9 KiB
Rust
110 lines
3.9 KiB
Rust
use cursebreaker_parser::{FastTravelDatabase, FastTravelType};
|
|
use std::env;
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
// Load all fast travel types from the directory
|
|
let cb_assets_path = env::var("CB_ASSETS_PATH").unwrap_or_else(|_| "/home/connor/repos/CBAssets".to_string());
|
|
let ft_db = FastTravelDatabase::load_from_directory(&format!("{}/Data/XMLs", cb_assets_path))?;
|
|
|
|
println!("=== Fast Travel Database Statistics ===");
|
|
println!("Total locations: {}", ft_db.len());
|
|
println!("Regular locations: {}", ft_db.count_by_type(FastTravelType::Location));
|
|
println!("Canoe locations: {}", ft_db.count_by_type(FastTravelType::Canoe));
|
|
println!("Portal locations: {}", ft_db.count_by_type(FastTravelType::Portal));
|
|
println!();
|
|
|
|
// Show regular locations
|
|
println!("=== Regular Fast Travel Locations ===");
|
|
let locations = ft_db.get_locations();
|
|
for loc in locations.iter().take(5) {
|
|
println!(" [{}] {} (unlocked: {})", loc.id, loc.name, loc.unlocked);
|
|
if let Some(ref connections) = loc.connections {
|
|
println!(" Connections: {}", connections);
|
|
}
|
|
}
|
|
println!("... and {} more", locations.len().saturating_sub(5));
|
|
println!();
|
|
|
|
// Show canoe locations
|
|
println!("=== Canoe Fast Travel Locations ===");
|
|
let canoe_locs = ft_db.get_canoe_locations();
|
|
for loc in &canoe_locs {
|
|
println!(" [{}] {}", loc.id, loc.name);
|
|
if let Some(ref checks) = loc.checks {
|
|
println!(" Requirements: {}", checks);
|
|
}
|
|
}
|
|
println!("Total: {}", canoe_locs.len());
|
|
println!();
|
|
|
|
// Show portals
|
|
println!("=== Portal Fast Travel Locations ===");
|
|
let portals = ft_db.get_portals();
|
|
for portal in portals.iter().take(5) {
|
|
println!(" [{}] {}", portal.id, portal.name);
|
|
if let Some((x, y, z)) = portal.get_position() {
|
|
println!(" Position: ({:.2}, {:.2}, {:.2})", x, y, z);
|
|
}
|
|
}
|
|
println!("... and {} more", portals.len().saturating_sub(5));
|
|
println!();
|
|
|
|
// Show unlocked locations
|
|
println!("=== Unlocked Locations ===");
|
|
let unlocked = ft_db.get_unlocked_locations();
|
|
for loc in unlocked.iter().take(10) {
|
|
println!(" [{}] {}", loc.id, loc.name);
|
|
}
|
|
println!("Total unlocked: {}", unlocked.len());
|
|
println!();
|
|
|
|
// Show locations with requirements
|
|
println!("=== Locations with Requirements ===");
|
|
let with_reqs = ft_db.get_locations_with_requirements();
|
|
for loc in &with_reqs {
|
|
println!(" [{}] {} - {}", loc.id, loc.name, loc.checks.as_ref().unwrap());
|
|
}
|
|
println!("Total with requirements: {}", with_reqs.len());
|
|
println!();
|
|
|
|
// Show locations requiring specific trait
|
|
println!("=== Locations requiring Trait 273 ===");
|
|
let trait_locs = ft_db.get_locations_requiring_trait(273);
|
|
for loc in &trait_locs {
|
|
println!(" [{}] {}", loc.id, loc.name);
|
|
}
|
|
println!("Total: {}", trait_locs.len());
|
|
println!();
|
|
|
|
// Show connected locations
|
|
println!("=== Connected Locations (examples) ===");
|
|
let connected = ft_db.get_connected_locations();
|
|
for loc in connected.iter().take(5) {
|
|
println!(
|
|
" [{}] {} connects to: {}",
|
|
loc.id,
|
|
loc.name,
|
|
loc.connections.as_ref().unwrap()
|
|
);
|
|
}
|
|
println!("Total connected: {}", connected.len());
|
|
println!();
|
|
|
|
// Find a specific location by ID
|
|
if let Some(loc) = ft_db.get_by_id(4) {
|
|
println!("=== Location Details (ID 4) ===");
|
|
println!("Name: {}", loc.name);
|
|
println!("Type: {}", loc.travel_type);
|
|
println!("Position: {}", loc.position);
|
|
if let Some(ref checks) = loc.checks {
|
|
println!("Requirements: {}", checks);
|
|
println!("Parsed checks:");
|
|
for (check_type, value) in loc.parse_checks() {
|
|
println!(" - {} = {}", check_type, value);
|
|
}
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
}
|