mirror of
https://github.com/Lawin0129/LawinServer.git
synced 2026-01-14 11:19:16 +01:00
Research system and Upgrades system STW
This commit is contained in:
226
index.js
226
index.js
@@ -4567,6 +4567,232 @@ express.post("/fortnite/api/game/v2/profile/*/client/UpgradeAlteration", async (
|
|||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Reset research levels STW
|
||||||
|
express.post("/fortnite/api/game/v2/profile/*/client/RespecResearch", 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 (profile.stats.attributes.research_levels) {
|
||||||
|
profile.stats.attributes.research_levels.technology = 0;
|
||||||
|
profile.stats.attributes.research_levels.fortitude = 0;
|
||||||
|
profile.stats.attributes.research_levels.offense = 0;
|
||||||
|
profile.stats.attributes.research_levels.resistance = 0;
|
||||||
|
|
||||||
|
StatChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StatChanged == true) {
|
||||||
|
profile.rvn += 1;
|
||||||
|
profile.commandRevision += 1;
|
||||||
|
|
||||||
|
ApplyProfileChanges.push({
|
||||||
|
"changeType": "statModified",
|
||||||
|
"name": "research_levels",
|
||||||
|
"value": profile.stats.attributes.research_levels
|
||||||
|
})
|
||||||
|
|
||||||
|
fs.writeFileSync(`./profiles/${req.query.profileId || "campaign"}.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 || "campaign",
|
||||||
|
"profileChangesBaseRevision": BaseRevision,
|
||||||
|
"profileChanges": ApplyProfileChanges,
|
||||||
|
"profileCommandRevision": profile.commandRevision || 0,
|
||||||
|
"serverTime": new Date().toISOString(),
|
||||||
|
"responseVersion": 1
|
||||||
|
})
|
||||||
|
res.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Reset upgrade levels STW
|
||||||
|
express.post("/fortnite/api/game/v2/profile/*/client/RespecUpgrades", 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;
|
||||||
|
|
||||||
|
for (var key in profile.items) {
|
||||||
|
if (profile.items[key].templateId.toLowerCase().startsWith("homebasenode:skilltree_")) {
|
||||||
|
profile.items[key].quantity = 0;
|
||||||
|
|
||||||
|
ApplyProfileChanges.push({
|
||||||
|
"changeType": "itemQuantityChanged",
|
||||||
|
"itemId": key,
|
||||||
|
"quantity": profile.items[key].quantity
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StatChanged = true;
|
||||||
|
|
||||||
|
if (StatChanged == true) {
|
||||||
|
profile.rvn += 1;
|
||||||
|
profile.commandRevision += 1;
|
||||||
|
|
||||||
|
fs.writeFileSync(`./profiles/${req.query.profileId || "campaign"}.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 || "campaign",
|
||||||
|
"profileChangesBaseRevision": BaseRevision,
|
||||||
|
"profileChanges": ApplyProfileChanges,
|
||||||
|
"profileCommandRevision": profile.commandRevision || 0,
|
||||||
|
"serverTime": new Date().toISOString(),
|
||||||
|
"responseVersion": 1
|
||||||
|
})
|
||||||
|
res.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Upgrade research levels STW
|
||||||
|
express.post("/fortnite/api/game/v2/profile/*/client/PurchaseResearchStatUpgrade", 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 (profile.stats.attributes.research_levels && req.body.statId) {
|
||||||
|
profile.stats.attributes.research_levels[req.body.statId] += 1;
|
||||||
|
|
||||||
|
StatChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StatChanged == true) {
|
||||||
|
profile.rvn += 1;
|
||||||
|
profile.commandRevision += 1;
|
||||||
|
|
||||||
|
ApplyProfileChanges.push({
|
||||||
|
"changeType": "statModified",
|
||||||
|
"name": "research_levels",
|
||||||
|
"value": profile.stats.attributes.research_levels
|
||||||
|
})
|
||||||
|
|
||||||
|
fs.writeFileSync(`./profiles/${req.query.profileId || "campaign"}.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 || "campaign",
|
||||||
|
"profileChangesBaseRevision": BaseRevision,
|
||||||
|
"profileChanges": ApplyProfileChanges,
|
||||||
|
"profileCommandRevision": profile.commandRevision || 0,
|
||||||
|
"serverTime": new Date().toISOString(),
|
||||||
|
"responseVersion": 1
|
||||||
|
})
|
||||||
|
res.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Upgrade levels STW
|
||||||
|
express.post("/fortnite/api/game/v2/profile/*/client/PurchaseOrUpgradeHomebaseNode", 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;
|
||||||
|
var CreateHomebaseNode = true;
|
||||||
|
|
||||||
|
if (req.body.nodeId) {
|
||||||
|
for (var key in profile.items) {
|
||||||
|
if (profile.items[key].templateId.toLowerCase() == req.body.nodeId.toLowerCase()) {
|
||||||
|
profile.items[key].quantity += 1;
|
||||||
|
|
||||||
|
ApplyProfileChanges.push({
|
||||||
|
"changeType": "itemQuantityChanged",
|
||||||
|
"itemId": key,
|
||||||
|
"quantity": profile.items[key].quantity
|
||||||
|
})
|
||||||
|
|
||||||
|
CreateHomebaseNode = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CreateHomebaseNode == true) {
|
||||||
|
const ID = makeid();
|
||||||
|
|
||||||
|
profile.items[ID] = {
|
||||||
|
"templateId": req.body.nodeId,
|
||||||
|
"attributes": {
|
||||||
|
"item_seen": false
|
||||||
|
},
|
||||||
|
"quantity": 1
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplyProfileChanges.push({
|
||||||
|
"changeType": "itemAdded",
|
||||||
|
"itemId": ID,
|
||||||
|
"item": profile.items[ID]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StatChanged = true;
|
||||||
|
|
||||||
|
if (StatChanged == true) {
|
||||||
|
profile.rvn += 1;
|
||||||
|
profile.commandRevision += 1;
|
||||||
|
|
||||||
|
fs.writeFileSync(`./profiles/${req.query.profileId || "campaign"}.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 || "campaign",
|
||||||
|
"profileChangesBaseRevision": BaseRevision,
|
||||||
|
"profileChanges": ApplyProfileChanges,
|
||||||
|
"profileCommandRevision": profile.commandRevision || 0,
|
||||||
|
"serverTime": new Date().toISOString(),
|
||||||
|
"responseVersion": 1
|
||||||
|
})
|
||||||
|
res.end();
|
||||||
|
});
|
||||||
|
|
||||||
// Set active hero loadout STW
|
// Set active hero loadout STW
|
||||||
express.post("/fortnite/api/game/v2/profile/*/client/SetActiveHeroLoadout", async (req, res) => {
|
express.post("/fortnite/api/game/v2/profile/*/client/SetActiveHeroLoadout", async (req, res) => {
|
||||||
const profile = require(`./profiles/${req.query.profileId || "campaign"}.json`);
|
const profile = require(`./profiles/${req.query.profileId || "campaign"}.json`);
|
||||||
|
|||||||
@@ -3220,7 +3220,7 @@
|
|||||||
"xp": 0,
|
"xp": 0,
|
||||||
"favorite": false
|
"favorite": false
|
||||||
},
|
},
|
||||||
"quantity": 10
|
"quantity": 10000
|
||||||
},
|
},
|
||||||
"e83235f3-7a27-407c-9140-a37b1066f67c": {
|
"e83235f3-7a27-407c-9140-a37b1066f67c": {
|
||||||
"templateId": "Quest:plankertonquest_filler_4_d2",
|
"templateId": "Quest:plankertonquest_filler_4_d2",
|
||||||
|
|||||||
@@ -756,7 +756,7 @@
|
|||||||
"xp": 0,
|
"xp": 0,
|
||||||
"favorite": false
|
"favorite": false
|
||||||
},
|
},
|
||||||
"quantity": 10
|
"quantity": 10000
|
||||||
},
|
},
|
||||||
"bb5e6cc5-8083-412e-a391-3b434462f4a6": {
|
"bb5e6cc5-8083-412e-a391-3b434462f4a6": {
|
||||||
"templateId": "Token:campaignaccess",
|
"templateId": "Token:campaignaccess",
|
||||||
|
|||||||
Reference in New Issue
Block a user