pub struct ArcadeStats {
pub diagnostics_run: u32,
pub fixes_applied: u32,
pub perfect_health_streak: u32,
pub processes_killed: u32,
pub env_files_created: u32,
pub total_arcade_plays: u32,
pub best_arcade_score: u32,
pub last_diagnostic_time_ms: Option<u32>,
pub times_run: HashMap<u32, u32>,
}Expand description
Lifetime usage counters that drive badge unlocks.
use limitless_cli::modules::achievements::ArcadeStats;
let mut stats = ArcadeStats::default();
stats.record_diagnostic_at(4200, 3);
stats.record_fix();
stats.record_arcade_game(800);
assert_eq!(stats.diagnostics_run, 1);
assert_eq!(stats.last_diagnostic_time_ms, Some(4200));
assert_eq!(stats.times_run.get(&3), Some(&1));
assert_eq!(stats.best_arcade_score, 800);Fields§
§diagnostics_run: u32Total diagnostic scans run.
fixes_applied: u32Total fixes applied.
perfect_health_streak: u32Consecutive runs where every check passed.
processes_killed: u32Ghost processes killed.
env_files_created: u32.env files created.
total_arcade_plays: u32Games played in SyntaxBreaker.
best_arcade_score: u32Best SyntaxBreaker score.
last_diagnostic_time_ms: Option<u32>Duration (ms) of the most recent diagnostic scan, for
BadgeCondition::SpeedRunner. None until the first scan.
times_run: HashMap<u32, u32>Map of local hour → number of runs started at that hour, for
BadgeCondition::NightOwl.
Implementations§
Source§impl ArcadeStats
impl ArcadeStats
Sourcepub fn record_diagnostic(&mut self, duration_ms: u32)
pub fn record_diagnostic(&mut self, duration_ms: u32)
Records a diagnostic scan, its duration, and the current UTC hour.
Local-hour bookkeeping on non-UTC machines uses the configured offset;
record_diagnostic_at is the
deterministic variant used by tests.
Sourcepub fn record_diagnostic_at(&mut self, duration_ms: u32, hour: u32)
pub fn record_diagnostic_at(&mut self, duration_ms: u32, hour: u32)
Records a diagnostic scan with an explicit hour-of-day.
Sourcepub fn record_perfect_health(&mut self)
pub fn record_perfect_health(&mut self)
Marks the current run as happy, extending the perfect-health streak.
Sourcepub fn reset_perfect_health(&mut self)
pub fn reset_perfect_health(&mut self)
Ends a streak (a run with a failing check).
Sourcepub fn record_fix(&mut self)
pub fn record_fix(&mut self)
Records an applied fix.
Sourcepub fn record_process_killed(&mut self)
pub fn record_process_killed(&mut self)
Records a killed ghost process.
Sourcepub fn record_env_created(&mut self)
pub fn record_env_created(&mut self)
Records a created .env file.
Sourcepub fn record_arcade_game(&mut self, score: u32)
pub fn record_arcade_game(&mut self, score: u32)
Records a finished SyntaxBreaker game, keeping the best score.