返回提交历史
Modified
src/controllers/api/inventoryController.ts
+5
-1
Modified
static/webui/script.js
+31
-29
XFEstudio/SpaceNinjaServer
fix(webui): ignore BuildLabel (#3005)
WebUI is designed to work with the modern inventory format. It simply doesn't work with the legacy oid. Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3005 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
e1add8bf
代码差异
2 个文件
+36
-30
@@ -271,7 +271,11 @@ export const inventoryController: RequestHandler = async (request, response) =>
271
271
await inventory.save();
272
272
273
273
response.json(
274
await getInventoryResponse(inventory, "xpBasedLevelCapDisabled" in request.query, account.BuildLabel)
274
await getInventoryResponse(
275
inventory,
276
"xpBasedLevelCapDisabled" in request.query,
277
"ignoreBuildLabel" in request.query ? undefined : account.BuildLabel
278
)
275
279
);
276
280
};
277
281
@@ -734,7 +734,7 @@ const accountCheats = document.querySelectorAll("#account-cheats input[id]");
734
734
735
735
// Assumes that caller revalidates authz
736
736
function updateInventory() {
737
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
737
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1&ignoreBuildLabel=1");
738
738
req.done(data => {
739
739
window.itemListPromise.then(itemMap => {
740
740
window.didInitialInventoryUpdate = true;
@@ -2719,7 +2719,7 @@ function addMissingEvolutionProgress() {
2719
2719
2720
2720
function maxRankAllEvolutions() {
2721
2721
revalidateAuthz().then(() => {
2722
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
2722
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1&ignoreBuildLabel=1");
2723
2723
req.done(data => {
2724
2724
const requests = [];
2725
2725
@@ -2743,7 +2743,7 @@ function maxRankAllEvolutions() {
2743
2743
2744
2744
function maxRankAllEquipment(categories) {
2745
2745
revalidateAuthz().then(() => {
2746
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
2746
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1&ignoreBuildLabel=1");
2747
2747
req.done(data => {
2748
2748
window.itemListPromise.then(itemMap => {
2749
2749
const batchData = {};
@@ -3077,7 +3077,7 @@ function doAcquireRiven() {
3077
3077
])
3078
3078
}).done(function () {
3079
3079
// Get riven's assigned id
3080
$.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1").done(data => {
3080
$.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1&ignoreBuildLabel=1").done(data => {
3081
3081
for (const rawUpgrade of data.RawUpgrades) {
3082
3082
if (rawUpgrade.ItemType === uniqueName) {
3083
3083
// Add fingerprint to riven
@@ -3301,33 +3301,35 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
3301
3301
3302
3302
function doUnlockAllFocusSchools() {
3303
3303
revalidateAuthz().then(() => {
3304
$.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1").done(async data => {
3305
const missingFocusUpgrades = {
3306
"/Lotus/Upgrades/Focus/Attack/AttackFocusAbility": true,
3307
"/Lotus/Upgrades/Focus/Tactic/TacticFocusAbility": true,
3308
"/Lotus/Upgrades/Focus/Ward/WardFocusAbility": true,
3309
"/Lotus/Upgrades/Focus/Defense/DefenseFocusAbility": true,
3310
"/Lotus/Upgrades/Focus/Power/PowerFocusAbility": true
3311
};
3312
if (data.FocusUpgrades) {
3313
for (const focusUpgrade of data.FocusUpgrades) {
3314
if (focusUpgrade.ItemType in missingFocusUpgrades) {
3315
delete missingFocusUpgrades[focusUpgrade.ItemType];
3304
$.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1&ignoreBuildLabel=1").done(
3305
async data => {
3306
const missingFocusUpgrades = {
3307
"/Lotus/Upgrades/Focus/Attack/AttackFocusAbility": true,
3308
"/Lotus/Upgrades/Focus/Tactic/TacticFocusAbility": true,
3309
"/Lotus/Upgrades/Focus/Ward/WardFocusAbility": true,
3310
"/Lotus/Upgrades/Focus/Defense/DefenseFocusAbility": true,
3311
"/Lotus/Upgrades/Focus/Power/PowerFocusAbility": true
3312
};
3313
if (data.FocusUpgrades) {
3314
for (const focusUpgrade of data.FocusUpgrades) {
3315
if (focusUpgrade.ItemType in missingFocusUpgrades) {
3316
delete missingFocusUpgrades[focusUpgrade.ItemType];
3317
}
3316
3318
}
3317
3319
}
3318
}
3319
for (const upgradeType of Object.keys(missingFocusUpgrades)) {
3320
await unlockFocusSchool(upgradeType);
3321
}
3322
if (Object.keys(missingFocusUpgrades).length == 0) {
3323
toast(loc("code_focusAllUnlocked"));
3324
} else {
3325
toast(loc("code_focusUnlocked").split("|COUNT|").join(Object.keys(missingFocusUpgrades).length));
3326
if (ws_is_open) {
3327
window.ws.send(JSON.stringify({ sync_inventory: true }));
3320
for (const upgradeType of Object.keys(missingFocusUpgrades)) {
3321
await unlockFocusSchool(upgradeType);
3322
}
3323
if (Object.keys(missingFocusUpgrades).length == 0) {
3324
toast(loc("code_focusAllUnlocked"));
3325
} else {
3326
toast(loc("code_focusUnlocked").split("|COUNT|").join(Object.keys(missingFocusUpgrades).length));
3327
if (ws_is_open) {
3328
window.ws.send(JSON.stringify({ sync_inventory: true }));
3329
}
3328
3330
}
3329
3331
}
3330
});
3332
);
3331
3333
});
3332
3334
}
3333
3335
@@ -3445,7 +3447,7 @@ function doAddAllMods() {
3445
3447
modsAll.delete("/Lotus/Upgrades/Mods/Fusers/LegendaryModFuser");
3446
3448
3447
3449
revalidateAuthz().then(() => {
3448
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
3450
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1&ignoreBuildLabel=1");
3449
3451
req.done(data => {
3450
3452
for (const modOwned of data.RawUpgrades) {
3451
3453
if ((modOwned.ItemCount ?? 1) > 0) {
@@ -3477,7 +3479,7 @@ function doAddAllMods() {
3477
3479
3478
3480
function doRemoveUnrankedMods() {
3479
3481
revalidateAuthz().then(() => {
3480
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
3482
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1&ignoreBuildLabel=1");
3481
3483
req.done(inventory => {
3482
3484
window.itemListPromise.then(itemMap => {
3483
3485
$.post({