From c9ac14befb14ecc064becede3143bd96728994a7 Mon Sep 17 00:00:00 2001 From: PRO100KatYT <67335438+PRO100KatYT@users.noreply.github.com> Date: Fri, 17 May 2024 06:41:59 +0200 Subject: [PATCH] =?UTF-8?q?Add=20LEGO=C2=A9=20Kits,=20Jam=20Tracks,=20Cars?= =?UTF-8?q?=20and=20Instruments.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 75 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/index.js b/index.js index 341c81d..e83adc8 100644 --- a/index.js +++ b/index.js @@ -2,45 +2,60 @@ const { default: request } = require("axios"); const fs = require("fs"); let athena = require("./athena_template.json"); -console.log("Fortnite Athena Profile Generator by Lawin v1.0.2\n"); -request.get("https://fortnite-api.com/v2/cosmetics/br").then(resp => { +const fixedBackendValues = { + "AthenaEmoji": "AthenaDance", + "AthenaSpray": "AthenaDance", + "AthenaToy": "AthenaDance", + "AthenaPetCarrier": "AthenaBackpack", + "AthenaPet": "AthenaBackpack", + "SparksDrum": "SparksDrums", + "SparksMic": "SparksMicrophone" +} + +console.log("Fortnite Athena Profile Generator by Lawin v1.0.3\n"); +request.get("https://fortnite-api.com/v2/cosmetics").then(resp => { let data = resp.data.data; console.log("[GEN] Starting to generate...\n"); - data.forEach(item => { - if (item.id.toLowerCase().includes("random")) return; + for (var mode in data) { + if (mode == "lego") continue; // Adding lego characters to the profile is unnecessary - // Credits to PRO100KatYT for backendValue fixes - if (item.type.backendValue == "AthenaEmoji" || item.type.backendValue == "AthenaSpray" || item.type.backendValue == "AthenaToy") item.type.backendValue = "AthenaDance"; - if (item.type.backendValue == "AthenaPetCarrier") item.type.backendValue = "AthenaBackpack"; + data[mode].forEach(item => { + if (item.id.toLowerCase().includes("random")) return; - let id = `${item.type.backendValue}:${item.id}`; - let variants = []; + if (mode == "tracks") item.type = {"backendValue": "SparksSong"}; - if (item.variants) { - item.variants.forEach(obj => { - variants.push({ - "channel": obj.channel || "", - "active": obj.options[0].tag || "", - "owned": obj.options.map(variant => variant.tag || "") + // Credits to PRO100KatYT for backendValue fixes + if (fixedBackendValues.hasOwnProperty(item.type.backendValue)) item.type.backendValue = fixedBackendValues[item.type.backendValue]; + + let id = `${item.type.backendValue}:${item.id}`; + let variants = []; + + if (item.variants) { + item.variants.forEach(obj => { + variants.push({ + "channel": obj.channel || "", + "active": obj.options[0].tag || "", + "owned": obj.options.map(variant => variant.tag || "") + }) }) - }) - } + } - athena.items[id] = { - "templateId": id, - "attributes": { - "max_level_bonus": 0, - "level": 1, - "item_seen": true, - "xp": 0, - "variants": variants, - "favorite": false - }, - "quantity": 1 - } - }) + athena.items[id] = { + "templateId": id, + "attributes": { + "max_level_bonus": 0, + "level": 1, + "item_seen": true, + "xp": 0, + "variants": variants, + "favorite": false + }, + "quantity": 1 + } + }) + } fs.writeFileSync("./athena.json", JSON.stringify(athena, null, 2)); const stats = fs.statSync("./athena.json");