XPCalculator
MMO\rpg\xp · 1 symbol · generated 5 Oct 2026
XPCalculator
XPCalculator.php:12Ties an objective's configuration (curve type + params, level cap, tiers) to the design doc's formulas: level cost, cumulative XP, starting level from a 0-1 skill score, and per-action XP with streak / diminishing- returns handling.
- Namespace
MMO\rpg\xp- See
docs/XPsystem.md
Index
| config | ||
| actionXp($params) | XP_action = xpBase * quantity * difficulty * streakMultiplier * diminishingFactor streakMultiplier = min(1 + 0.05 * streakDays, 2.0) diminishingFactor = 1 / (1 + 0.5 * sameDayRepeats) | |
| applyInactivityDecay($totalXp, $inactiveDays, $graceDays, $halfLifeDays, $floorXp) | Inactivity decay — the practical counterpart to the Regression curve. | |
| cumulativeXp($n) | ||
| defaultTiers() static | ||
| levelFromTotalXp($totalXp, $lMax) | Resolve a total XP total into current level / progress into the next level. | |
| levelTable($lMax) | Full level-by-level table from 1 to $lMax, with tier labels. | |
| startingLevel($skillScore, $lMax) | L_start = round(S * L_max), S in [0,1]. | |
| tierForLevel($level, $lMax) | ||
| xpForLevel($n) | ||
| __construct($config) |
Properties1
config
- Type
- array
Methods10
actionXp($params)
XPCalculator.php:110XP_action = xpBase * quantity * difficulty * streakMultiplier * diminishingFactor streakMultiplier = min(1 + 0.05 * streakDays, 2.0) diminishingFactor = 1 / (1 + 0.5 * sameDayRepeats)
applyInactivityDecay($totalXp, $inactiveDays, $graceDays, $halfLifeDays, $floorXp)
XPCalculator.php:141Inactivity decay — the practical counterpart to the Regression curve.
cumulativeXp($n)
XPCalculator.php:24defaultTiers()
staticXPCalculator.php:59| returns | array |
levelFromTotalXp($totalXp, $lMax)
XPCalculator.php:77Resolve a total XP total into current level / progress into the next level.
levelTable($lMax)
XPCalculator.php:33Full level-by-level table from 1 to $lMax, with tier labels.
startingLevel($skillScore, $lMax)
XPCalculator.php:71L_start = round(S * L_max), S in [0,1].
tierForLevel($level, $lMax)
XPCalculator.php:49xpForLevel($n)
XPCalculator.php:19__construct($config)
XPCalculator.php:15| $config | array |