diff options
| author | Karan Jayachandra <karan.jayachandra@nxp.com> | 2025-11-11 17:50:02 +0100 |
|---|---|---|
| committer | Karan Jayachandra <karan.jayachandra@nxp.com> | 2025-11-11 17:50:02 +0100 |
| commit | 0e9e28c2595c1ec46d8601efa6f4d377ee70cb27 (patch) | |
| tree | aa57be9270ca05d8f8f7f497e6409ead84ed99cd /player.mjs | |
| parent | 5dcf65616f82cb9b652f6913c93e26ff50983fdf (diff) | |
First version of proposal
Diffstat (limited to 'player.mjs')
| -rw-r--r-- | player.mjs | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,9 +1,10 @@ export class Player { - constructor(id, name, level, status) { + constructor(id, name, level, status, totalPlayed) { this.id = id; this.name = name; this.level = typeof level !== 'undefined' ? level : 1; this.status = typeof status !== 'undefined' ? status : false; + this.totalPlayed = typeof totalPlayed !== 'undefined' ? status : 0; } toggle() { this.status = !this.status; @@ -31,7 +32,7 @@ function randomStatus() { export function generatePlayers() { let players = []; for (let i = 0; i < 71; i++) { - players.push(new Player(i, "Player " + i, randomLevel(), randomStatus())); + players.push(new Player(i, "Player " + i, randomLevel(), randomStatus(), 0)); } return players; } @@ -41,7 +42,7 @@ function parseLineToPlayer(data) { var id = Number(info[0].trim()); var name = info[1].trim() + " " + info[2].trim(); var level = Number(info[3].trim()); - return new Player(id, name, level, false); + return new Player(id, name, level, false, 0); } export function csvToPlayers(csv) { |
