(xp: number)
| 9 | } |
| 10 | |
| 11 | function levelForXp(xp: number): number { |
| 12 | let level = 0; |
| 13 | let total = 0; |
| 14 | for (const threshold of levelThresholds) { |
| 15 | total += threshold; |
| 16 | if (xp < total) { |
| 17 | break; |
| 18 | } |
| 19 | level++; |
| 20 | } |
| 21 | return level; |
| 22 | } |
| 23 | |
| 24 | function xpForNextLevel(xp: number): number { |
| 25 | let total = 0; |