mirror of
https://github.com/Lawin0129/LawinServer.git
synced 2026-01-13 02:42:22 +01:00
Locker V4 support with V3 backwards compatibility.
This commit is contained in:
@@ -47,20 +47,20 @@ express.get("/eulatracking/api/shared/agreements/fn*", async (req, res) => {
|
||||
|
||||
express.get("/fortnite/api/game/v2/friendcodes/*/epic", async (req, res) => {
|
||||
res.json([{
|
||||
"codeId": "L4WINS3RV3R",
|
||||
"codeType": "CodeToken:FounderFriendInvite",
|
||||
"dateCreated": "2024-04-02T21:37:00.420Z"
|
||||
},
|
||||
{
|
||||
"codeId": "playeereq",
|
||||
"codeType": "CodeToken:FounderFriendInvite_XBOX",
|
||||
"dateCreated": "2024-04-02T21:37:00.420Z"
|
||||
},
|
||||
{
|
||||
"codeId": "lawinscodelol",
|
||||
"codeType": "CodeToken:MobileInvite",
|
||||
"dateCreated": "2024-04-02T21:37:00.420Z"
|
||||
}])
|
||||
"codeId": "L4WINS3RV3R",
|
||||
"codeType": "CodeToken:FounderFriendInvite",
|
||||
"dateCreated": "2024-04-02T21:37:00.420Z"
|
||||
},
|
||||
{
|
||||
"codeId": "playeereq",
|
||||
"codeType": "CodeToken:FounderFriendInvite_XBOX",
|
||||
"dateCreated": "2024-04-02T21:37:00.420Z"
|
||||
},
|
||||
{
|
||||
"codeId": "lawinscodelol",
|
||||
"codeType": "CodeToken:MobileInvite",
|
||||
"dateCreated": "2024-04-02T21:37:00.420Z"
|
||||
}])
|
||||
})
|
||||
|
||||
express.get("/launcher/api/public/distributionpoints/", async (req, res) => {
|
||||
|
||||
186
structure/mcp.js
186
structure/mcp.js
@@ -8098,6 +8098,192 @@ express.post("/fortnite/api/game/v2/profile/*/client/PutModularCosmeticLoadout",
|
||||
res.end();
|
||||
});
|
||||
|
||||
// Get BR Locker 4
|
||||
express.get("/api/locker/v3/:deploymentId/account/:accountId/items", async (req, res) => {
|
||||
const profile = require("./../profiles/athena.json");
|
||||
var StatChanged = false;
|
||||
|
||||
if (!profile.stats.attributes.hasOwnProperty("loadout_presets")) {
|
||||
profile.stats.attributes.loadout_presets = {};
|
||||
|
||||
StatChanged = true;
|
||||
}
|
||||
|
||||
var response = {
|
||||
"activeLoadouts": [],
|
||||
"loadoutPresets": []
|
||||
};
|
||||
|
||||
for (var CosmeticLoadout in profile.stats.attributes.loadout_presets) {
|
||||
for (var Loadout in profile.stats.attributes.loadout_presets[CosmeticLoadout]) {
|
||||
var LoadoutID = profile.stats.attributes.loadout_presets[CosmeticLoadout][Loadout];
|
||||
var LoadoutItem = profile.items[LoadoutID];
|
||||
var date = new Date().toISOString();
|
||||
|
||||
var loadoutToAdd = {
|
||||
"deploymentId": req.params.deploymentId,
|
||||
"accountId": req.params.accountId,
|
||||
"loadoutType": LoadoutItem.templateId,
|
||||
"loadoutShuffleType": "DISABLED",
|
||||
"athenaItemId": LoadoutID,
|
||||
"creationTime": date,
|
||||
"updatedTime": date,
|
||||
"loadoutSlots": []
|
||||
}
|
||||
|
||||
var slots = LoadoutItem.attributes.slots;
|
||||
for (var slot in slots) {
|
||||
var slotToAdd = {
|
||||
"slotTemplate": slots[slot].slot_template,
|
||||
"equippedItemId": slots[slot].equipped_item,
|
||||
"itemCustomizations": []
|
||||
}
|
||||
|
||||
for (var customization in slots[slot].customization_info) {
|
||||
customization = slots[slot].customization_info[customization];
|
||||
var customizationToAdd = {
|
||||
"channelTag": customization.channel_tag,
|
||||
"variantTag": customization.variant_tag,
|
||||
"additionalData": customization.additional_data
|
||||
}
|
||||
slotToAdd.itemCustomizations.push(customizationToAdd)
|
||||
}
|
||||
loadoutToAdd.loadoutSlots.push(slotToAdd)
|
||||
}
|
||||
response.activeLoadouts.push(loadoutToAdd)
|
||||
}
|
||||
}
|
||||
|
||||
if (StatChanged == true) {
|
||||
profile.rvn += 1;
|
||||
profile.commandRevision += 1;
|
||||
|
||||
fs.writeFileSync("./../profiles/athena.json", JSON.stringify(profile, null, 2));
|
||||
}
|
||||
|
||||
res.json(response)
|
||||
res.end();
|
||||
});
|
||||
|
||||
// Set BR Locker 4
|
||||
express.put("/api/locker/v3/:deploymentId/loadout/:loadoutType/account/:accountId/active-loadout", async (req, res) => {
|
||||
const profile = require("./../profiles/athena.json");
|
||||
var StatChanged = false;
|
||||
|
||||
var date = new Date().toISOString();
|
||||
var response = {
|
||||
"deploymentId": req.params.deploymentId,
|
||||
"accountId": req.params.accountId,
|
||||
"loadoutType": req.body.loadoutType,
|
||||
"loadoutShuffleType": "DISABLED",
|
||||
"athenaItemId": req.body.athenaItemId,
|
||||
"creationTime": date,
|
||||
"updatedTime": date,
|
||||
"loadoutSlots": req.body.loadoutSlots
|
||||
}
|
||||
|
||||
// Format the body data to Locker V3
|
||||
var loadoutData = {
|
||||
"slots": []
|
||||
}
|
||||
for (var slot in req.body.loadoutSlots) {
|
||||
slot = req.body.loadoutSlots[slot];
|
||||
var slotToAdd = {}
|
||||
if (slot.slotTemplate)
|
||||
slotToAdd.slot_template = slot.slotTemplate;
|
||||
if (slot.equippedItemId)
|
||||
slotToAdd.equipped_item = slot.equippedItemId;
|
||||
|
||||
for (var customization in slot.itemCustomizations) {
|
||||
customization = slot.itemCustomizations[customization];
|
||||
var customizationToAdd = {}
|
||||
if (customization.channelTag)
|
||||
customizationToAdd.channel_tag = customization.channelTag;
|
||||
if (customization.variantTag)
|
||||
customizationToAdd.variant_tag = customization.variantTag;
|
||||
if (customization.additionalData)
|
||||
customizationToAdd.additional_data = customization.additionalData;
|
||||
if (!slotToAdd.hasOwnProperty("customization_info"))
|
||||
slotToAdd.customization_info = [];
|
||||
|
||||
slotToAdd.customization_info.push(customizationToAdd)
|
||||
}
|
||||
loadoutData.slots.push(slotToAdd)
|
||||
}
|
||||
|
||||
if (!profile.stats.attributes.hasOwnProperty("loadout_presets")) {
|
||||
profile.stats.attributes.loadout_presets = {};
|
||||
|
||||
StatChanged = true;
|
||||
}
|
||||
|
||||
if (!profile.stats.attributes.loadout_presets.hasOwnProperty(req.body.loadoutType)) {
|
||||
const NewLoadoutID = functions.MakeID();
|
||||
|
||||
profile.items[NewLoadoutID] = {
|
||||
"templateId": req.body.loadoutType,
|
||||
"attributes": {},
|
||||
"quantity": 1
|
||||
}
|
||||
|
||||
profile.stats.attributes.loadout_presets[req.body.loadoutType] = {
|
||||
[req.body.presetIndex]: NewLoadoutID
|
||||
};
|
||||
|
||||
StatChanged = true;
|
||||
}
|
||||
|
||||
var LoadoutGUID = [];
|
||||
|
||||
try {
|
||||
LoadoutGUID = profile.stats.attributes.loadout_presets[req.body.loadoutType][req.body.presetIndex];
|
||||
profile.items[LoadoutGUID].attributes = loadoutData;
|
||||
|
||||
StatChanged = true;
|
||||
|
||||
} catch (err) {}
|
||||
|
||||
// Apply the edit style changes to the item attributes too
|
||||
for (var slot in loadoutData.slots) {
|
||||
if (loadoutData.slots[slot].hasOwnProperty("customization_info")) {
|
||||
for (var item in profile.items) {
|
||||
if (profile.items[item].templateId.toLowerCase() == loadoutData.slots[slot].equipped_item.toLowerCase()) {
|
||||
for (var customization in loadoutData.slots[slot].customization_info) {
|
||||
var bFound = false;
|
||||
for (var profileCustomization in profile.items[item].attributes.variants) {
|
||||
if (loadoutData.slots[slot].customization_info[customization].channel_tag == profile.items[item].attributes.variants[profileCustomization].channel) {
|
||||
profile.items[item].attributes.variants[profileCustomization].active = `${loadoutData.slots[slot].customization_info[customization].variant_tag}.${loadoutData.slots[slot].customization_info[customization].additional_data}`;
|
||||
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bFound == false) {
|
||||
profile.items[item].attributes.variants.push({
|
||||
"channel": loadoutData.slots[slot].customization_info[customization].channel_tag,
|
||||
"active": `${loadoutData.slots[slot].customization_info[customization].variant_tag}.${loadoutData.slots[slot].customization_info[customization].additional_data}`,
|
||||
"owned": []
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
StatChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StatChanged == true) {
|
||||
profile.rvn += 1;
|
||||
profile.commandRevision += 1;
|
||||
|
||||
fs.writeFileSync("./../profiles/athena.json", JSON.stringify(profile, null, 2));
|
||||
}
|
||||
|
||||
res.json(response)
|
||||
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`);
|
||||
|
||||
@@ -78,9 +78,15 @@ express.post("/auth/v1/oauth/token", async (req, res) => {
|
||||
"token_type": "bearer",
|
||||
"expires_in": 28800,
|
||||
"expires_at": "9999-12-31T23:59:59.999Z",
|
||||
"nonce": "lawinserver",
|
||||
"features": ["AntiCheat", "Connect", "Ecom", "Inventories", "LockerService"],
|
||||
"deployment_id": "lawinsdeploymentidlol",
|
||||
"organization_id": "lawinsorganizationidlol",
|
||||
"organization_user_id": "lawinsorganisationuseridlol",
|
||||
"product_id": "prod-fn",
|
||||
"product_user_id": "lawinsproductuseridlol",
|
||||
"product_user_id_created": false,
|
||||
"id_token": "lawinsidtokenlol",
|
||||
"sandbox_id": "fn"
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user