Make variant equipping unproblematic

This commit is contained in:
Lawin0129
2021-12-26 20:36:36 +00:00
parent c9ac4fff49
commit 314d35f2b0

View File

@@ -5153,20 +5153,19 @@ express.post("/fortnite/api/game/v2/profile/*/client/EquipBattleRoyaleCustomizat
var StatChanged = false; var StatChanged = false;
var VariantChanged = false; var VariantChanged = false;
const ReturnVariantsAsString = JSON.stringify(req.body.variantUpdates || []) try {
if (req.body.variantUpdates && ReturnVariantsAsString.includes("active")) { const ReturnVariantsAsString = JSON.stringify(req.body.variantUpdates || [])
if (profile.items[req.body.itemToSlot].attributes.variants.length == 0) {
profile.items[req.body.itemToSlot].attributes.variants = req.body.variantUpdates || []; if (ReturnVariantsAsString.includes("active")) {
} if (profile.items[req.body.itemToSlot].attributes.variants.length == 0) {
for (var i = 0; i < profile.items[req.body.itemToSlot].attributes.variants.length; i++) { profile.items[req.body.itemToSlot].attributes.variants = req.body.variantUpdates || [];
try {
profile.items[req.body.itemToSlot].attributes.variants[i].active = req.body.variantUpdates[i].active || "";
} catch (err) {
profile.items[req.body.itemToSlot].attributes.variants[i].active = profile.items[req.body.itemToSlot].attributes.variants[i].active;
} }
for (var i = 0; i < profile.items[req.body.itemToSlot].attributes.variants.length; i++) {
profile.items[req.body.itemToSlot].attributes.variants[i].active = req.body.variantUpdates[i].active || "";
}
VariantChanged = true;
} }
VariantChanged = true; } catch (err) {}
}
if (req.body.slotName) { if (req.body.slotName) {
@@ -5246,7 +5245,7 @@ express.post("/fortnite/api/game/v2/profile/*/client/EquipBattleRoyaleCustomizat
} }
if (StatChanged == true) { if (StatChanged == true) {
var Category = `favorite_${req.body.slotName.toLowerCase() || "character"}` var Category = (`favorite_${req.body.slotName || "character"}`).toLowerCase()
if (Category == "favorite_itemwrap") { if (Category == "favorite_itemwrap") {
Category += "s" Category += "s"
@@ -5434,11 +5433,11 @@ express.post("/fortnite/api/game/v2/profile/*/client/SetCosmeticLockerSlot", asy
const seasondata = require("./season.json"); const seasondata = require("./season.json");
seasonchecker(req, seasondata); seasonchecker(req, seasondata);
profile.stats.attributes.season_num = seasondata.season; profile.stats.attributes.season_num = seasondata.season;
if (seasondata.season == 2) { if (seasondata.season == 2) {
profile.stats.attributes.book_level = 70; profile.stats.attributes.book_level = 70;
} else { } else {
profile.stats.attributes.book_level = 100; profile.stats.attributes.book_level = 100;
} }
} }
// do not change any of these or you will end up breaking it // do not change any of these or you will end up breaking it
@@ -5446,42 +5445,36 @@ express.post("/fortnite/api/game/v2/profile/*/client/SetCosmeticLockerSlot", asy
var BaseRevision = profile.rvn || 0; var BaseRevision = profile.rvn || 0;
var QueryRevision = req.query.rvn || -1; var QueryRevision = req.query.rvn || -1;
var StatChanged = false; var StatChanged = false;
var VariantChanged = false;
const ReturnVariantsAsString = JSON.stringify(req.body.variantUpdates || []) try {
if (req.body.variantUpdates && ReturnVariantsAsString.includes("active")) { const ReturnVariantsAsString = JSON.stringify(req.body.variantUpdates || [])
var new_variants = [
{
"variants": []
}
];
if (profile.profileId == "athena") { if (ReturnVariantsAsString.includes("active")) {
if (profile.items[req.body.itemToSlot].attributes.variants.length == 0) { var new_variants = [
profile.items[req.body.itemToSlot].attributes.variants = req.body.variantUpdates || []; {
} "variants": []
for (var i = 0; i < profile.items[req.body.itemToSlot].attributes.variants.length; i++) { }
try { ];
if (profile.profileId == "athena") {
if (profile.items[req.body.itemToSlot].attributes.variants.length == 0) {
profile.items[req.body.itemToSlot].attributes.variants = req.body.variantUpdates || [];
}
for (var i = 0; i < profile.items[req.body.itemToSlot].attributes.variants.length; i++) {
profile.items[req.body.itemToSlot].attributes.variants[i].active = req.body.variantUpdates[i].active || ""; profile.items[req.body.itemToSlot].attributes.variants[i].active = req.body.variantUpdates[i].active || "";
} catch (err) {
profile.items[req.body.itemToSlot].attributes.variants[i].active = profile.items[req.body.itemToSlot].attributes.variants[i].active;
} }
} }
}
for (var i = 0; i < req.body.variantUpdates.length; i++) { for (var i = 0; i < req.body.variantUpdates.length; i++) {
try {
new_variants[0].variants.push({ new_variants[0].variants.push({
"channel": req.body.variantUpdates[i].channel, "channel": req.body.variantUpdates[i].channel,
"active": req.body.variantUpdates[i].active "active": req.body.variantUpdates[i].active
}) })
profile.items[req.body.lockerItem].attributes.locker_slots_data.slots[req.body.category].activeVariants = new_variants; 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;
} }
} }
} } catch (err) {}
if (req.body.category && req.body.lockerItem) { if (req.body.category && req.body.lockerItem) {