ddnet
Version:
A typescript npm package for interacting with data from ddnet.org
61 lines • 1.67 kB
JavaScript
import { timeString } from '../../util.js';
import { Player } from '../players/Player.js';
/**
* Represents a player's highest amount of finishes on a map.
*/
export class MaxFinish {
/**
* The obtained rank.
*/
rank;
/**
* The name of the player which achieved this rank.
*/
player;
/**
* The amount of times this map has been finished by the player.
*/
count;
/**
* Total time from all runs in seconds.
*/
timeSeconds;
/**
* Total time from all runs in DDNet time string format. (ex. 02:47:23)
*/
timeString;
/**
* Could be the timestamp of the first time this map was finished.
* @remarks I haven't figured out what minTimestamp is supposed to represent.
*/
minTimestamp;
/**
* Could be the timestamp of the last time this map was finished.
* @remarks I haven't figured out what minTimestamp is supposed to represent.
*/
maxTimestamp;
constructor(data) {
this.rank = data.rank;
this.player = data.player;
this.count = data.count;
this.timeSeconds = data.time;
this.timeString = timeString(this.timeSeconds);
this.minTimestamp = data.minTimestamp;
this.maxTimestamp = data.maxTimestamp;
}
/**
* Returns a new {@link Player} object from this rank.
*/
async toPlayer() {
return await Player.new(this.player);
}
/**
* Returns the name of the player and finish count.
*
* @example "Sans3108 | 69"
*/
toString() {
return `${this.player} | ${this.count}`;
}
}
//# sourceMappingURL=MaxFinish.js.map