improve: don't fake XPInfo if we don't have to #303

Merged
Sainan merged 1 commits from MR-Spoofer®-Next-Generation™ into main 2024-06-16 03:24:15 -07:00
2 changed files with 13 additions and 14 deletions

View File

@ -78,14 +78,12 @@ const inventoryController: RequestHandler = async (request: Request, response: R
} }
} }
if ( if (typeof config.spoofMasteryRank === "number" && config.spoofMasteryRank >= 0) {
typeof config.spoofMasteryRank === "number" &&
config.spoofMasteryRank >= 0 &&
config.spoofMasteryRank <= 5030
) {
inventoryResponse.PlayerLevel = config.spoofMasteryRank; inventoryResponse.PlayerLevel = config.spoofMasteryRank;
if (!("xpBasedLevelCapDisabled" in request.query)) {
// This client has not been patched to accept any mastery rank, need to fake the XP.
inventoryResponse.XPInfo = []; inventoryResponse.XPInfo = [];
let numFrames = getExpRequiredForMr(config.spoofMasteryRank) / 6000; let numFrames = getExpRequiredForMr(Math.min(config.spoofMasteryRank, 5030)) / 6000;
while (numFrames-- > 0) { while (numFrames-- > 0) {
inventoryResponse.XPInfo.push({ inventoryResponse.XPInfo.push({
ItemType: "/Lotus/Powersuits/Mag/Mag", ItemType: "/Lotus/Powersuits/Mag/Mag",
@ -93,6 +91,7 @@ const inventoryController: RequestHandler = async (request: Request, response: R
}); });
} }
} }
}
response.json(inventoryResponse); response.json(inventoryResponse);
}; };

View File

@ -121,7 +121,7 @@ window.itemListPromise = new Promise(resolve => {
}); });
function updateInventory() { function updateInventory() {
const req = $.get("/api/inventory.php?" + window.authz); const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
req.done(data => { req.done(data => {
window.itemListPromise.then(itemMap => { window.itemListPromise.then(itemMap => {
document.getElementById("warframe-list").innerHTML = ""; document.getElementById("warframe-list").innerHTML = "";
@ -537,7 +537,7 @@ function doAcquireRiven() {
}) })
}).done(function () { }).done(function () {
// Get riven's assigned id // Get riven's assigned id
$.get("/api/inventory.php?" + window.authz).done(data => { $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1").done(data => {
for (const rawUpgrade of data.RawUpgrades) { for (const rawUpgrade of data.RawUpgrades) {
if (rawUpgrade.ItemType === uniqueName) { if (rawUpgrade.ItemType === uniqueName) {
// Add fingerprint to riven // Add fingerprint to riven