kartrider.js
Version:
KartRider Nexon API Node.js library
37 lines (36 loc) • 1.37 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Match = void 0;
class Match {
constructor(client, data) {
const hasMetaData = "metadata" in client;
this.matchType = hasMetaData ? client.metadata.getMetaData({ type: 'gameType', hash: data.matchType }) : { id: data.matchType };
this.channelName = data.channelName;
this.track = hasMetaData ? client.metadata.getMetaData({ type: 'track', hash: data.trackId }) : { id: data.trackId };
this.matchResult = data.matchResult;
this.startTime = new Date(data.startTime + "Z");
this.endTime = new Date(data.endTime + "Z");
this.id = data.matchId;
}
get gameSpeed() {
if (this.channelName.includes("Infinit"))
return "무한";
else if (this.channelName.includes("Fastest2Enchant"))
return "가장빠름";
else if (this.channelName.includes("Fastest"))
return "매우빠름";
else if (this.channelName.includes("Fast"))
return "빠름";
return "보통";
}
get isTeam() {
return this.channelName.includes('Team');
}
get isSpecialMode() {
return this.channelName.includes('_');
}
get playTime() {
return (this.endTime.getTime() - this.startTime.getTime());
}
}
exports.Match = Match;