Fix & some changes

This commit is contained in:
Lawin
2025-01-03 17:28:06 +00:00
parent e9a496ae24
commit 9423ce1519
3 changed files with 59 additions and 54 deletions

View File

@@ -1,5 +1,6 @@
const { default: request } = require("axios"); const { default: request } = require("axios");
const fs = require("fs"); const fs = require("fs");
const path = require("path");
let athena = require("./athena_template.json"); let athena = require("./athena_template.json");
const fixedBackendValues = { const fixedBackendValues = {
@@ -10,71 +11,73 @@ const fixedBackendValues = {
"AthenaPet": "AthenaBackpack", "AthenaPet": "AthenaBackpack",
"SparksDrum": "SparksDrums", "SparksDrum": "SparksDrums",
"SparksMic": "SparksMicrophone" "SparksMic": "SparksMicrophone"
} };
console.log("Fortnite Athena Profile Generator by Lawin v1.0.3\n"); console.log("Fortnite Athena Profile Generator by Lawin v1.0.4\n");
request.get("https://fortnite-api.com/v2/cosmetics").then(resp => { request.get("https://fortnite-api.com/v2/cosmetics").then(resp => {
let data = resp.data.data; let data = resp.data.data;
console.log("[GEN] Starting to generate...\n"); console.log("[GEN] Starting to generate...");
for (var mode in data) { for (let mode of Object.keys(data)) {
if (mode == "lego") continue; // Adding lego characters to the profile is unnecessary if ((mode == "lego") || (mode == "beans")) continue;
data[mode].forEach(item => { for (let item of data[mode]) {
if (item.id.toLowerCase().includes("random")) return; if (item.id.toLowerCase().includes("random")) continue;
if (mode == "tracks") item.type = {"backendValue": "SparksSong"}; if (mode == "tracks") item.type = { "backendValue": "SparksSong" };
// Credits to PRO100KatYT for backendValue fixes // Credits to PRO100KatYT for backendValue fixes
if (fixedBackendValues.hasOwnProperty(item.type.backendValue)) item.type.backendValue = fixedBackendValues[item.type.backendValue]; if (Object.keys(fixedBackendValues).includes(item.type.backendValue)) item.type.backendValue = fixedBackendValues[item.type.backendValue];
let id = `${item.type.backendValue}:${item.id}`; let id = `${item.type.backendValue}:${item.id}`;
let variants = []; let variants = [];
if (item.variants) { if (item.variants) {
item.variants.forEach(obj => { for (let obj of item.variants) {
variants.push({ variants.push({
"channel": obj.channel || "", channel: (obj.channel) || "",
"active": obj.options[0].tag || "", active: (obj.options?.[0]?.tag) || "",
"owned": obj.options.map(variant => variant.tag || "") owned: (obj.options?.map?.(variant => (variant?.tag || ""))) || ""
}) });
}) }
} }
athena.items[id] = { athena.items[id] = {
"templateId": id, templateId: id,
"attributes": { attributes: {
"max_level_bonus": 0, max_level_bonus: 0,
"level": 1, level: 1,
"item_seen": true, item_seen: true,
"xp": 0, xp: 0,
"variants": variants, variants: variants,
"favorite": false favorite: false
}, },
"quantity": 1 quantity: 1
} };
}) }
} }
fs.writeFileSync("./athena.json", JSON.stringify(athena, null, 2)); const athenaPath = path.join(__dirname, "athena.json");
const stats = fs.statSync("./athena.json");
console.log("[GEN] Successfully generated and saved into", `${__dirname}\\athena.json`, `(${size(stats.size)})`); fs.writeFileSync(athenaPath, JSON.stringify(athena, null, 2));
}) const stats = fs.statSync(athenaPath);
console.log(`[GEN] Successfully generated and saved into ${athenaPath} (${size(stats.size)})`);
});
function size(bytes) { function size(bytes) {
const sizes = ["Bytes", "KB", "MB", "GB", "TB"] const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
if (bytes == 0) { if (bytes == 0) {
return "N/A" return "N/A";
} }
const i = Number(Math.floor(Math.log(bytes) / Math.log(1024))) const i = Number(Math.floor(Math.log(bytes) / Math.log(1024)));
if (i == 0) { if (i == 0) {
return bytes + " " + sizes[i] return bytes + " " + sizes[i];
} }
return (bytes / Math.pow(1024, i)).toFixed(1) + " " + sizes[i] return (bytes / Math.pow(1024, i)).toFixed(1) + " " + sizes[i];
} }

36
package-lock.json generated
View File

@@ -1,15 +1,15 @@
{ {
"name": "athenaprofilegenerator", "name": "athenaprofilegenerator",
"version": "1.0.2", "version": "1.0.4",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "athenaprofilegenerator", "name": "athenaprofilegenerator",
"version": "1.0.2", "version": "1.0.4",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"axios": "^1.3.3" "axios": "^1.7.9"
} }
}, },
"node_modules/asynckit": { "node_modules/asynckit": {
@@ -18,11 +18,12 @@
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
}, },
"node_modules/axios": { "node_modules/axios": {
"version": "1.3.3", "version": "1.7.9",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.3.3.tgz", "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
"integrity": "sha512-eYq77dYIFS77AQlhzEL937yUBSepBfPIe8FcgEDN35vMNZKMrs81pgnyrQpwfy4NF4b4XWX1Zgx7yX+25w8QJA==", "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
"license": "MIT",
"dependencies": { "dependencies": {
"follow-redirects": "^1.15.0", "follow-redirects": "^1.15.6",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"proxy-from-env": "^1.1.0" "proxy-from-env": "^1.1.0"
} }
@@ -47,15 +48,16 @@
} }
}, },
"node_modules/follow-redirects": { "node_modules/follow-redirects": {
"version": "1.15.2", "version": "1.15.9",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
"funding": [ "funding": [
{ {
"type": "individual", "type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh" "url": "https://github.com/sponsors/RubenVerborgh"
} }
], ],
"license": "MIT",
"engines": { "engines": {
"node": ">=4.0" "node": ">=4.0"
}, },
@@ -110,11 +112,11 @@
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
}, },
"axios": { "axios": {
"version": "1.3.3", "version": "1.7.9",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.3.3.tgz", "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
"integrity": "sha512-eYq77dYIFS77AQlhzEL937yUBSepBfPIe8FcgEDN35vMNZKMrs81pgnyrQpwfy4NF4b4XWX1Zgx7yX+25w8QJA==", "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
"requires": { "requires": {
"follow-redirects": "^1.15.0", "follow-redirects": "^1.15.6",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"proxy-from-env": "^1.1.0" "proxy-from-env": "^1.1.0"
} }
@@ -133,9 +135,9 @@
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
}, },
"follow-redirects": { "follow-redirects": {
"version": "1.15.2", "version": "1.15.9",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ=="
}, },
"form-data": { "form-data": {
"version": "4.0.0", "version": "4.0.0",

View File

@@ -1,10 +1,10 @@
{ {
"name": "athenaprofilegenerator", "name": "athenaprofilegenerator",
"version": "1.0.2", "version": "1.0.4",
"description": "A fortnite athena profile generator made for fortnite backends (LawinServer, etc...)", "description": "A fortnite athena profile generator made for fortnite backends (LawinServer, etc...)",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"axios": "^1.3.3" "axios": "^1.7.9"
}, },
"scripts": { "scripts": {
"start": "node index.js", "start": "node index.js",