ddnet
Version:
A typescript npm package for interacting with data from ddnet.org
87 lines (86 loc) • 1.98 kB
TypeScript
import { RankAvailableRegion, Type } from '../../util.js';
import { Map } from '../maps/Map.js';
import { Player } from '../players/Player.js';
import { Rank } from '../players/Rank.js';
/**
* Represents a finish.
*/
export declare class Finish {
/**
* The timestamp of this finish.
*/
timestamp: number;
/**
* The name of the finished map.
*/
mapName: string;
/**
* The time of this finish in seconds.
*/
timeSeconds: number;
/**
* The string formatted time of this finish.
*
* @example "03:23"
*/
timeString: string;
/**
* The rank obtained.
*/
rank: Rank;
/**
* The region of this finish.
*/
region: RankAvailableRegion;
/**
* The finish player(s).
*/
players: {
name: string;
toPlayer: () => Promise<Player>;
}[];
/**
* Construct a new {@link Finish} instance.
*/
constructor(data: {
timestamp: number;
mapName: string;
timeSeconds: number;
rank: Rank;
region: RankAvailableRegion;
players: string[];
});
/**
* Returns a new {@link Map} object from the {@link mapName} of this finish.
*/
toMap(
/**
* The region to pull ranks from in the `toMap` function from the returned value. Omit for global ranks.
*/
rankSource?: RankAvailableRegion | null,
/**
* Wether to bypass the cache.
*/
force?: boolean): Promise<Map>;
/**
* Returns the names of the players and their finish time.
*
* @example "Sans3108 | 03:23"
*/
toString(): string;
}
/**
* Represents a player recent finish.
*/
export declare class RecentFinish extends Finish {
/**
* The type of the map.
*/
mapType: Type;
/**
* Construct a new {@link RecentFinish} instance.
*/
constructor(data: ConstructorParameters<typeof Finish>[0] & {
mapType: Type;
});
}