61 lines
1.6 KiB
Rust
61 lines
1.6 KiB
Rust
mod common;
|
|
|
|
use std::sync::atomic::Ordering;
|
|
|
|
use arena_tracker_core::{
|
|
ChampionState, Error, Scope, SeasonScope, Statistics, Tracker, default_seasons, load_seasons,
|
|
};
|
|
use common::{
|
|
CATALOG, FakeChampions, FakeHistory, SELF_PUUID, jan_2026, open_tracker, played_match,
|
|
recorded_account,
|
|
};
|
|
|
|
fn statistics(tracker: &Tracker) -> Statistics {
|
|
let scope = Scope {
|
|
season: SeasonScope::Season(common::S1.into()),
|
|
format: None,
|
|
};
|
|
tracker.statistics(SELF_PUUID, &scope).unwrap()
|
|
}
|
|
|
|
fn row_names(stats: &Statistics) -> Vec<&str> {
|
|
stats
|
|
.rows
|
|
.iter()
|
|
.map(|r| r.champion.name.as_str())
|
|
.collect()
|
|
}
|
|
|
|
/// A tracker on the same database file as `open_tracker`, whose history is empty.
|
|
fn reopen(dir: &std::path::Path, champions: FakeChampions) -> Tracker {
|
|
Tracker::open(
|
|
&dir.join("arena.db"),
|
|
Box::new(FakeHistory::new(recorded_account(), vec![])),
|
|
)
|
|
.unwrap()
|
|
.with_seasons(common::seasons())
|
|
.with_champions(Box::new(champions), dir.join("portraits"))
|
|
}
|
|
|
|
fn cards_dir(dir: &std::path::Path) -> std::path::PathBuf {
|
|
dir.join("portraits").join("cards")
|
|
}
|
|
|
|
fn card_files(dir: &std::path::Path) -> Vec<String> {
|
|
let mut names: Vec<String> = std::fs::read_dir(cards_dir(dir))
|
|
.unwrap()
|
|
.map(|e| e.unwrap().file_name().into_string().unwrap())
|
|
.collect();
|
|
names.sort();
|
|
names
|
|
}
|
|
|
|
#[path = "champions/cards.rs"]
|
|
mod cards;
|
|
#[path = "champions/catalog.rs"]
|
|
mod catalog;
|
|
#[path = "champions/seasons.rs"]
|
|
mod seasons;
|
|
#[path = "champions/splashes.rs"]
|
|
mod splashes;
|