public function getLevelProgression(Skill $s) { if ($s->hasXp()) { $targetXp = self::$table[$s->level + 1]; $startXp = self::$table[$s->level]; $distance = $targetXp - $startXp; $xpLeft = $targetXp - $s->xp; return $distance / $xpLeft; } trigger_error('User is not ranked in this skill.'); return 0; }