Skip to main content

level_from_cumulative

Function level_from_cumulative 

Source
pub fn level_from_cumulative(total_xp: f64, cumulative: &[f64]) -> LevelProgress
Expand description

Resolve experience into a LevelProgress against a table of cumulative experience thresholds.

cumulative must be sorted ascending and hold the total experience required to reach each successive level (the value at index i is the cost of reaching level i + 1).