From 86a023619f6bae990ffd0513d4d4e01c4d143301 Mon Sep 17 00:00:00 2001 From: PRO100KatYT <67335438+PRO100KatYT@users.noreply.github.com> Date: Fri, 24 May 2024 22:55:38 +0200 Subject: [PATCH] Added Set Active Archetype mcp operation --- structure/mcp.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/structure/mcp.js b/structure/mcp.js index e71543d..b82a941 100644 --- a/structure/mcp.js +++ b/structure/mcp.js @@ -7969,6 +7969,59 @@ express.post("/fortnite/api/game/v2/profile/*/client/PutModularCosmeticLoadout", res.end(); }); +// Set Active Archetype (e.g. main vehicle in v30.00+) +express.post("/fortnite/api/game/v2/profile/*/client/SetActiveArchetype", async (req, res) => { + const profile = require(`./../profiles/${req.query.profileId || "athena"}.json`); + + // do not change any of these or you will end up breaking it + var ApplyProfileChanges = []; + var BaseRevision = profile.rvn || 0; + var QueryRevision = req.query.rvn || -1; + var StatChanged = false; + + if (req.body.archetypeGroup && req.body.archetype) { + if (!profile.stats.attributes.hasOwnProperty("loadout_archetype_values")) { + profile.stats.attributes.loadout_archetype_values = {} + } + + profile.stats.attributes.loadout_archetype_values[req.body.archetypeGroup] = req.body.archetype; + + StatChanged = true; + } + + if (StatChanged == true) { + profile.rvn += 1; + profile.commandRevision += 1; + + ApplyProfileChanges.push({ + "changeType": "statModified", + "name": "loadout_archetype_values", + "value": profile.stats.attributes.loadout_archetype_values + }) + + fs.writeFileSync(`./profiles/${req.query.profileId || "athena"}.json`, JSON.stringify(profile, null, 2)); + } + + // this doesn't work properly on version v12.20 and above but whatever + if (QueryRevision != BaseRevision) { + ApplyProfileChanges = [{ + "changeType": "fullProfileUpdate", + "profile": profile + }]; + } + + res.json({ + "profileRevision": profile.rvn || 0, + "profileId": req.query.profileId || "athena", + "profileChangesBaseRevision": BaseRevision, + "profileChanges": ApplyProfileChanges, + "profileCommandRevision": profile.commandRevision || 0, + "serverTime": new Date().toISOString(), + "responseVersion": 1 + }) + res.end(); +}); + // Set hero variants STW express.post("/fortnite/api/game/v2/profile/*/client/SetHeroCosmeticVariants", async (req, res) => { const profile = require(`./../profiles/${req.query.profileId || "campaign"}.json`);