mirror of
https://github.com/Lawin0129/LawinServer.git
synced 2026-01-14 11:19:16 +01:00
Proper variant equipping for SetCosmeticLockerSlot (this now means variants work on stw!)
This commit is contained in:
95
index.js
95
index.js
@@ -2464,7 +2464,14 @@ express.post("/fortnite/api/game/v2/profile/*/client/SetCosmeticLockerSlot", asy
|
|||||||
var VariantChanged = false;
|
var VariantChanged = false;
|
||||||
|
|
||||||
const ReturnVariantsAsString = JSON.stringify(req.body.variantUpdates || [])
|
const ReturnVariantsAsString = JSON.stringify(req.body.variantUpdates || [])
|
||||||
if (req.body.variantUpdates && ReturnVariantsAsString.includes("active") && profile.profileId != "campaign") {
|
if (req.body.variantUpdates && ReturnVariantsAsString.includes("active")) {
|
||||||
|
var new_variants = [
|
||||||
|
{
|
||||||
|
"variants": []
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
if (profile.profileId == "athena") {
|
||||||
if (profile.items[req.body.itemToSlot].attributes.variants.length == 0) {
|
if (profile.items[req.body.itemToSlot].attributes.variants.length == 0) {
|
||||||
profile.items[req.body.itemToSlot].attributes.variants = req.body.variantUpdates || [];
|
profile.items[req.body.itemToSlot].attributes.variants = req.body.variantUpdates || [];
|
||||||
}
|
}
|
||||||
@@ -2475,7 +2482,20 @@ express.post("/fortnite/api/game/v2/profile/*/client/SetCosmeticLockerSlot", asy
|
|||||||
profile.items[req.body.itemToSlot].attributes.variants[i].active = profile.items[req.body.itemToSlot].attributes.variants[i].active;
|
profile.items[req.body.itemToSlot].attributes.variants[i].active = profile.items[req.body.itemToSlot].attributes.variants[i].active;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VariantChanged = true;
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < req.body.variantUpdates.length; i++) {
|
||||||
|
try {
|
||||||
|
new_variants[0].variants.push({
|
||||||
|
"channel": req.body.variantUpdates[i].channel,
|
||||||
|
"active": req.body.variantUpdates[i].active
|
||||||
|
})
|
||||||
|
|
||||||
|
profile.items[req.body.lockerItem].attributes.locker_slots_data.slots[req.body.category].activeVariants = new_variants;
|
||||||
|
} catch (err) {
|
||||||
|
profile.items[req.body.lockerItem].attributes.locker_slots_data.slots[req.body.category].activeVariants = profile.items[req.body.lockerItem].attributes.locker_slots_data[req.body.category].activeVariants;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.body.category && req.body.lockerItem) {
|
if (req.body.category && req.body.lockerItem) {
|
||||||
@@ -2566,15 +2586,6 @@ express.post("/fortnite/api/game/v2/profile/*/client/SetCosmeticLockerSlot", asy
|
|||||||
"attributeValue": profile.items[req.body.lockerItem].attributes.locker_slots_data
|
"attributeValue": profile.items[req.body.lockerItem].attributes.locker_slots_data
|
||||||
})
|
})
|
||||||
|
|
||||||
if (VariantChanged == true) {
|
|
||||||
ApplyProfileChanges.push({
|
|
||||||
"changeType": "itemAttrChanged",
|
|
||||||
"itemId": req.body.itemToSlot,
|
|
||||||
"attributeName": "variants",
|
|
||||||
"attributeValue": profile.items[req.body.itemToSlot].attributes.variants
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync(`./profiles/${req.query.profileId || "athena"}.json`, JSON.stringify(profile, null, 2), function(err) {
|
fs.writeFileSync(`./profiles/${req.query.profileId || "athena"}.json`, JSON.stringify(profile, null, 2), function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log('error:', err)
|
console.log('error:', err)
|
||||||
@@ -2603,6 +2614,68 @@ express.post("/fortnite/api/game/v2/profile/*/client/SetCosmeticLockerSlot", asy
|
|||||||
res.end();
|
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`);
|
||||||
|
|
||||||
|
// 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.outfitVariants && req.body.backblingVariants && req.body.heroItem) {
|
||||||
|
profile.items[req.body.heroItem].attributes.outfitvariants = req.body.outfitVariants;
|
||||||
|
profile.items[req.body.heroItem].attributes.backblingvariants = req.body.backblingVariants;
|
||||||
|
StatChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StatChanged == true) {
|
||||||
|
profile.rvn += 1;
|
||||||
|
profile.commandRevision += 1;
|
||||||
|
|
||||||
|
ApplyProfileChanges.push({
|
||||||
|
"changeType": "itemAttrChanged",
|
||||||
|
"itemId": req.body.heroItem,
|
||||||
|
"attributeName": "outfitvariants",
|
||||||
|
"attributeValue": profile.items[req.body.heroItem].attributes.outfitvariants
|
||||||
|
})
|
||||||
|
|
||||||
|
ApplyProfileChanges.push({
|
||||||
|
"changeType": "itemAttrChanged",
|
||||||
|
"itemId": req.body.heroItem,
|
||||||
|
"attributeName": "backblingvariants",
|
||||||
|
"attributeValue": profile.items[req.body.heroItem].attributes.backblingvariants
|
||||||
|
})
|
||||||
|
|
||||||
|
fs.writeFileSync(`./profiles/${req.query.profileId || "campaign"}.json`, JSON.stringify(profile, null, 2), function(err) {
|
||||||
|
if (err) {
|
||||||
|
console.log('error:', err)
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 || "campaign",
|
||||||
|
"profileChangesBaseRevision": BaseRevision,
|
||||||
|
"profileChanges": ApplyProfileChanges,
|
||||||
|
"profileCommandRevision": profile.commandRevision || 0,
|
||||||
|
"serverTime": new Date().toISOString(),
|
||||||
|
"responseVersion": 1
|
||||||
|
})
|
||||||
|
res.status(200);
|
||||||
|
res.end();
|
||||||
|
});
|
||||||
|
|
||||||
// any mcp request that doesn't have something assigned to it
|
// any mcp request that doesn't have something assigned to it
|
||||||
express.post("/fortnite/api/game/v2/profile/*/client/*", async (req, res) => {
|
express.post("/fortnite/api/game/v2/profile/*/client/*", async (req, res) => {
|
||||||
const profile = require(`./profiles/${req.query.profileId || "athena"}.json`);
|
const profile = require(`./profiles/${req.query.profileId || "athena"}.json`);
|
||||||
|
|||||||
Reference in New Issue
Block a user