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

This commit is contained in:
Sainan 2024-06-16 12:24:15 +02:00 committed by GitHub
parent 8f8d58ade6
commit c9b570059e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 14 deletions

View File

@ -78,14 +78,12 @@ const inventoryController: RequestHandler = async (request: Request, response: R
}
}
if (
typeof config.spoofMasteryRank === "number" &&
config.spoofMasteryRank >= 0 &&
config.spoofMasteryRank <= 5030
) {
if (typeof config.spoofMasteryRank === "number" && config.spoofMasteryRank >= 0) {
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 = [];
let numFrames = getExpRequiredForMr(config.spoofMasteryRank) / 6000;
let numFrames = getExpRequiredForMr(Math.min(config.spoofMasteryRank, 5030)) / 6000;
while (numFrames-- > 0) {
inventoryResponse.XPInfo.push({
ItemType: "/Lotus/Powersuits/Mag/Mag",
@ -93,6 +91,7 @@ const inventoryController: RequestHandler = async (request: Request, response: R
});
}
}
}
response.json(inventoryResponse);
};

View File

@ -123,7 +123,7 @@ window.itemListPromise = new Promise(resolve => {
});
function updateInventory() {
const req = $.get("/api/inventory.php?" + window.authz);
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
req.done(data => {
window.itemListPromise.then(itemMap => {
document.getElementById("warframe-list").innerHTML = "";
@ -539,7 +539,7 @@ function doAcquireRiven() {
})
}).done(function () {
// 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) {
if (rawUpgrade.ItemType === uniqueName) {
// Add fingerprint to riven