mirror of
https://github.com/Lawin0129/LawinServer.git
synced 2026-01-13 02:42:22 +01:00
Added Quest Replacement for StW
This commit is contained in:
159
index.js
159
index.js
@@ -1652,6 +1652,156 @@ express.post("/fortnite/api/game/v2/profile/*/client/SetPinnedQuests", async (re
|
||||
res.end();
|
||||
});
|
||||
|
||||
// Replace STW Quests
|
||||
express.post("/fortnite/api/game/v2/profile/*/client/FortRerollDailyQuest", async (req, res) => {
|
||||
const profile = require(`./profiles/${req.query.profileId || "campaign"}.json`);
|
||||
const QuestIDS = require("./responses/stwquests.json");
|
||||
|
||||
// do not change any of these or you will end up breaking it
|
||||
var ApplyProfileChanges = [];
|
||||
var Notifications = [];
|
||||
var BaseRevision = profile.rvn || 0;
|
||||
var QueryRevision = req.query.rvn || -1;
|
||||
var StatChanged = false;
|
||||
|
||||
const NewQuestID = makeid();
|
||||
const randomNumber = Math.floor(Math.random() * QuestIDS.length);
|
||||
|
||||
if (req.body.questId && profile.stats.attributes.quest_manager.dailyQuestRerolls >= 1) {
|
||||
profile.stats.attributes.quest_manager.dailyQuestRerolls -= 1;
|
||||
delete profile.items[req.body.questId]
|
||||
profile.items[NewQuestID] = {
|
||||
"templateId": QuestIDS[randomNumber],
|
||||
"attributes": {
|
||||
"creation_time": new Date().toISOString(),
|
||||
"completion_complete": 0,
|
||||
"level": -1,
|
||||
"item_seen": false,
|
||||
"playlists": [],
|
||||
"sent_new_notification": false,
|
||||
"challenge_bundle_id": "",
|
||||
"xp_reward_scalar": 1,
|
||||
"challenge_linked_quest_given": "",
|
||||
"quest_pool": "",
|
||||
"quest_state": "Active",
|
||||
"bucket": "",
|
||||
"last_state_change_time": new Date().toISOString(),
|
||||
"challenge_linked_quest_parent": "",
|
||||
"max_level_bonus": 0,
|
||||
"xp": 0,
|
||||
"quest_rarity": "uncommon",
|
||||
"favorite": false
|
||||
},
|
||||
"quantity": 1
|
||||
};
|
||||
StatChanged = true;
|
||||
}
|
||||
|
||||
if (StatChanged == true) {
|
||||
profile.rvn += 1;
|
||||
profile.commandRevision += 1;
|
||||
|
||||
ApplyProfileChanges.push({
|
||||
"changeType": "statModified",
|
||||
"name": "quest_manager",
|
||||
"value": profile.stats.attributes.quest_manager
|
||||
})
|
||||
|
||||
ApplyProfileChanges.push({
|
||||
"changeType": "itemAdded",
|
||||
"itemId": NewQuestID,
|
||||
"item": profile.items[NewQuestID]
|
||||
})
|
||||
|
||||
ApplyProfileChanges.push({
|
||||
"changeType": "itemRemoved",
|
||||
"itemId": req.body.questId
|
||||
})
|
||||
|
||||
Notifications.push({
|
||||
"type": "dailyQuestReroll",
|
||||
"primary": true,
|
||||
"newQuestId": QuestIDS[randomNumber]
|
||||
})
|
||||
|
||||
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,
|
||||
"notifications": Notifications,
|
||||
"profileCommandRevision": profile.commandRevision || 0,
|
||||
"serverTime": new Date().toISOString(),
|
||||
"responseVersion": 1
|
||||
})
|
||||
res.end();
|
||||
});
|
||||
|
||||
// Mark New Quest Notification Sent
|
||||
express.post("/fortnite/api/game/v2/profile/*/client/MarkNewQuestNotificationSent", 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.itemIds) {
|
||||
for (var i = 0; i < req.body.itemIds.length; i++) {
|
||||
var id = req.body.itemIds[i];
|
||||
|
||||
profile.items[id].attributes.sent_new_notification = true
|
||||
|
||||
ApplyProfileChanges.push({
|
||||
"changeType": "itemAttrChanged",
|
||||
"itemId": id,
|
||||
"attributeName": "sent_new_notification",
|
||||
"attributeValue": true
|
||||
})
|
||||
}
|
||||
|
||||
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();
|
||||
});
|
||||
|
||||
// Claim STW daily reward
|
||||
express.post("/fortnite/api/game/v2/profile/*/client/ClaimLoginReward", async (req, res) => {
|
||||
const profile = require(`./profiles/${req.query.profileId || "campaign"}.json`);
|
||||
@@ -1669,6 +1819,9 @@ express.post("/fortnite/api/game/v2/profile/*/client/ClaimLoginReward", async (r
|
||||
profile.stats.attributes.daily_rewards.totalDaysLoggedIn += 1;
|
||||
profile.stats.attributes.daily_rewards.lastClaimDate = DateFormat;
|
||||
profile.stats.attributes.daily_rewards.additionalSchedules.founderspackdailyrewardtoken.rewardsClaimed += 1;
|
||||
if (profile.stats.attributes.quest_manager.dailyQuestRerolls == 0) {
|
||||
profile.stats.attributes.quest_manager.dailyQuestRerolls += 1
|
||||
}
|
||||
StatChanged = true;
|
||||
}
|
||||
|
||||
@@ -1682,6 +1835,12 @@ express.post("/fortnite/api/game/v2/profile/*/client/ClaimLoginReward", async (r
|
||||
"value": profile.stats.attributes.daily_rewards
|
||||
})
|
||||
|
||||
ApplyProfileChanges.push({
|
||||
"changeType": "statModified",
|
||||
"name": "quest_manager",
|
||||
"value": profile.stats.attributes.quest_manager
|
||||
})
|
||||
|
||||
fs.writeFileSync(`./profiles/${req.query.profileId || "campaign"}.json`, JSON.stringify(profile, null, 2));
|
||||
}
|
||||
|
||||
|
||||
1
responses/stwquests.json
Normal file
1
responses/stwquests.json
Normal file
@@ -0,0 +1 @@
|
||||
["Quest:Daily_DestroyTVs", "Quest:Daily_DestroyTransformers", "Quest:Daily_DestroyServerRacks", "Quest:Daily_DestroySeesaws", "Quest:Daily_DestroyPropaneTanks", "Quest:Daily_DestroyGnomes", "Quest:Daily_DestroyFireTrucks", "Quest:Daily_DestroyBears", "Quest:Daily_DestroyArcadeMachines", "Quest:Daily_PartyOf50", "Quest:Daily_Mission_Specialist_TwinePeaks", "Quest:Daily_Mission_Specialist_Stonewood", "Quest:Daily_Mission_Specialist_Soldier", "Quest:Daily_Mission_Specialist_Plankerton", "Quest:Daily_Mission_Specialist_Outlander", "Quest:Daily_Mission_Specialist_Ninja", "Quest:Daily_Mission_Specialist_Constructor", "Quest:Daily_Mission_Specialist_CannyValley", "Quest:Daily_HuskExtermination_Soldier", "Quest:Daily_HuskExtermination_Outlander", "Quest:Daily_HuskExtermination_Ninja", "Quest:Daily_HuskExtermination_Constructor", "Quest:Daily_HuskExtermination_AnyHero", "Quest:Daily_High_Priority", "Quest:Daily_GateCrasher", "Quest:Daily_DataRetrieval", "Quest:Daily_ALittleVanThatCould"]
|
||||
Reference in New Issue
Block a user