UNPKG

splatoon3api

Version:

A simple Method to get current and next Splatoon 3 maps, Salmonrun Schedules and Splatnet gear

36 lines (35 loc) 1.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = parseChallenges; const utils_1 = require("../utils"); function parseChallenges(json, translation) { let data = []; json.data.eventSchedules.nodes.forEach((event) => { var _a, _b, _c, _d; let eventData = { name: (_a = translation.events[event.leagueMatchSetting.leagueMatchEvent.id]) === null || _a === void 0 ? void 0 : _a.name, desc: (_b = translation.events[event.leagueMatchSetting.leagueMatchEvent.id]) === null || _b === void 0 ? void 0 : _b.desc, eventRule: (_c = translation.events[event.leagueMatchSetting.leagueMatchEvent.id]) === null || _c === void 0 ? void 0 : _c.regulation, gameRule: (_d = translation.rules[event.leagueMatchSetting.vsRule.id]) === null || _d === void 0 ? void 0 : _d.name, gameRuleImg: (0, utils_1.getImageFromRuleId)(event.leagueMatchSetting.vsRule.id), stages: [], timePeriods: [], }; event.leagueMatchSetting.vsStages.forEach((stage) => { var _a; eventData.stages.push({ name: (_a = translation.stages[stage.id]) === null || _a === void 0 ? void 0 : _a.name, image: stage.image.url, }); }); event.timePeriods.forEach((period) => { eventData.timePeriods.push({ startTime: period.startTime, endTime: period.endTime, }); }); data.push(eventData); }); return data; } ;