From 8c6300d4e2bfc8a9874e299588a2be82db900a06 Mon Sep 17 00:00:00 2001
From: Chinosu <46995931+Chinosu@users.noreply.github.com>
Date: Sat, 18 Jan 2025 19:08:42 +1100
Subject: [PATCH] Add all missing mods
---
static/webui/index.html | 3 ++-
static/webui/script.js | 32 ++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/static/webui/index.html b/static/webui/index.html
index 5d037980..3d690e16 100644
--- a/static/webui/index.html
+++ b/static/webui/index.html
@@ -320,7 +320,8 @@
-
+
+
diff --git a/static/webui/script.js b/static/webui/script.js
index 68dd9db1..f9e6e851 100644
--- a/static/webui/script.js
+++ b/static/webui/script.js
@@ -1077,6 +1077,38 @@ function doHelminthUnlockAll() {
});
}
+function doAddAllMods() {
+ const mods = [];
+ for (const child of document.getElementById("datalist-mods").children) {
+ mods.push(child.getAttribute("data-key"));
+ }
+
+ // Batch to avoid PayloadTooLargeError
+ const batchSize = 500;
+ const batches = [];
+ for (let i = 0; i < mods.length; i += batchSize) {
+ batches.push(mods.slice(i, i + batchSize));
+ }
+
+ batches.forEach(batch => {
+ revalidateAuthz(() => {
+ $.post({
+ url: "/api/missionInventoryUpdate.php?" + window.authz,
+ contentType: "text/plain",
+ data: JSON.stringify({
+ RawUpgrades: batch.map(mod => ({
+ ItemType: mod,
+ ItemCount: 21 // Needed to fully upgrade certain arcanes
+ }))
+ })
+ }).done(function () {
+ document.getElementById("mod-to-acquire").value = "";
+ updateInventory();
+ });
+ });
+ });
+}
+
// Powersuit Route
single.getRoute("#powersuit-route").on("beforeload", function () {