chore: replace unlockAllMissions config with an account cheats button #2241

Merged
Sainan merged 2 commits from unlock-all-missions into main 2025-06-22 06:37:21 -07:00
Showing only changes of commit 1159e16f12 - Show all commits

View File

@ -111,11 +111,9 @@ function doLogin() {
window.registerSubmit = false; window.registerSubmit = false;
} }
function revalidateAuthz(succ_cb) { async function revalidateAuthz() {
getWebSocket().then(() => { await getWebSocket();
// We have a websocket connection, so authz should be good. // We have a websocket connection, so authz should be good.
succ_cb();
});
} }
function logout() { function logout() {
@ -135,7 +133,7 @@ function doLogout() {
function renameAccount() { function renameAccount() {
const newname = window.prompt(loc("code_changeNameConfirm")); const newname = window.prompt(loc("code_changeNameConfirm"));
if (newname) { if (newname) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
fetch("/custom/renameAccount?" + window.authz + "&newname=" + newname).then(() => { fetch("/custom/renameAccount?" + window.authz + "&newname=" + newname).then(() => {
$(".displayname").text(newname); $(".displayname").text(newname);
updateLocElements(); updateLocElements();
@ -146,7 +144,7 @@ function renameAccount() {
function deleteAccount() { function deleteAccount() {
if (window.confirm(loc("code_deleteAccountConfirm"))) { if (window.confirm(loc("code_deleteAccountConfirm"))) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
fetch("/custom/deleteAccount?" + window.authz).then(() => { fetch("/custom/deleteAccount?" + window.authz).then(() => {
logout(); logout();
single.loadRoute("/webui/"); // Show login screen single.loadRoute("/webui/"); // Show login screen
@ -646,7 +644,7 @@ function updateInventory() {
a.href = "#"; a.href = "#";
a.onclick = function (event) { a.onclick = function (event) {
event.preventDefault(); event.preventDefault();
revalidateAuthz(() => { revalidateAuthz().then(() => {
const promises = []; const promises = [];
if (item.XP < maxXP) { if (item.XP < maxXP) {
promises.push(addGearExp(category, item.ItemId.$oid, maxXP - item.XP)); promises.push(addGearExp(category, item.ItemId.$oid, maxXP - item.XP));
@ -1236,7 +1234,7 @@ function doAcquireEquipment(category) {
.focus(); .focus();
return; return;
} }
revalidateAuthz(() => { revalidateAuthz().then(() => {
const req = $.post({ const req = $.post({
url: "/custom/addItems?" + window.authz, url: "/custom/addItems?" + window.authz,
contentType: "application/json", contentType: "application/json",
@ -1363,7 +1361,7 @@ function doAcquireModularEquipment(category, WeaponType) {
} }
}); });
if (category == "KubrowPets") Parts.unshift(WeaponType); if (category == "KubrowPets") Parts.unshift(WeaponType);
revalidateAuthz(() => { revalidateAuthz().then(() => {
const req = $.post({ const req = $.post({
url: "/api/modularWeaponCrafting.php?" + window.authz, url: "/api/modularWeaponCrafting.php?" + window.authz,
contentType: "application/octet-stream", contentType: "application/octet-stream",
@ -1416,7 +1414,7 @@ $("input[list]").on("input", function () {
}); });
function dispatchAddItemsRequestsBatch(requests) { function dispatchAddItemsRequestsBatch(requests) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
const req = $.post({ const req = $.post({
url: "/custom/addItems?" + window.authz, url: "/custom/addItems?" + window.authz,
contentType: "application/json", contentType: "application/json",
@ -1460,7 +1458,7 @@ function addMissingEvolutionProgress() {
} }
function maxRankAllEvolutions() { function maxRankAllEvolutions() {
revalidateAuthz(() => { revalidateAuthz().then(() => {
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1"); const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
req.done(data => { req.done(data => {
const requests = []; const requests = [];
@ -1484,7 +1482,7 @@ function maxRankAllEvolutions() {
} }
function maxRankAllEquipment(categories) { function maxRankAllEquipment(categories) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1"); const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
req.done(data => { req.done(data => {
window.itemListPromise.then(itemMap => { window.itemListPromise.then(itemMap => {
@ -1558,7 +1556,7 @@ function addGearExp(category, oid, xp) {
} }
function sendBatchGearExp(data) { function sendBatchGearExp(data) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post({ $.post({
url: "/custom/addXp?" + window.authz, url: "/custom/addXp?" + window.authz,
contentType: "application/json", contentType: "application/json",
@ -1571,7 +1569,7 @@ function sendBatchGearExp(data) {
} }
function renameGear(category, oid, name) { function renameGear(category, oid, name) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
if (category == "KubrowPets") { if (category == "KubrowPets") {
$.post({ $.post({
url: "/api/renamePet.php?" + window.authz + "&webui=1", url: "/api/renamePet.php?" + window.authz + "&webui=1",
@ -1599,7 +1597,7 @@ function renameGear(category, oid, name) {
function disposeOfGear(category, oid) { function disposeOfGear(category, oid) {
if (category == "KubrowPets") { if (category == "KubrowPets") {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post({ $.post({
url: "/api/releasePet.php?" + window.authz, url: "/api/releasePet.php?" + window.authz,
contentType: "application/octet-stream", contentType: "application/octet-stream",
@ -1621,7 +1619,7 @@ function disposeOfGear(category, oid) {
Count: 0 Count: 0
} }
]; ];
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post({ $.post({
url: "/api/sell.php?" + window.authz, url: "/api/sell.php?" + window.authz,
contentType: "text/plain", contentType: "text/plain",
@ -1643,7 +1641,7 @@ function disposeOfItems(category, type, count) {
Count: count Count: count
} }
]; ];
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post({ $.post({
url: "/api/sell.php?" + window.authz, url: "/api/sell.php?" + window.authz,
contentType: "text/plain", contentType: "text/plain",
@ -1653,7 +1651,7 @@ function disposeOfItems(category, type, count) {
} }
function gildEquipment(category, oid) { function gildEquipment(category, oid) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post({ $.post({
url: "/api/gildWeapon.php?" + window.authz + "&ItemId=" + oid + "&Category=" + category, url: "/api/gildWeapon.php?" + window.authz + "&ItemId=" + oid + "&Category=" + category,
contentType: "application/octet-stream", contentType: "application/octet-stream",
@ -1667,7 +1665,7 @@ function gildEquipment(category, oid) {
} }
function maturePet(oid, revert) { function maturePet(oid, revert) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post({ $.post({
url: "/api/maturePet.php?" + window.authz, url: "/api/maturePet.php?" + window.authz,
contentType: "application/octet-stream", contentType: "application/octet-stream",
@ -1682,7 +1680,7 @@ function maturePet(oid, revert) {
} }
function setEvolutionProgress(requests) { function setEvolutionProgress(requests) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
const req = $.post({ const req = $.post({
url: "/custom/setEvolutionProgress?" + window.authz, url: "/custom/setEvolutionProgress?" + window.authz,
contentType: "application/json", contentType: "application/json",
@ -1702,7 +1700,7 @@ function doAcquireMiscItems() {
} }
const count = parseInt($("#miscitem-count").val()); const count = parseInt($("#miscitem-count").val());
if (count != 0) { if (count != 0) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post({ $.post({
url: "/custom/addItems?" + window.authz, url: "/custom/addItems?" + window.authz,
contentType: "application/json", contentType: "application/json",
@ -1743,7 +1741,7 @@ function doAcquireRiven() {
return; return;
} }
const uniqueName = "/Lotus/Upgrades/Mods/Randomized/" + $("#addriven-type").val(); const uniqueName = "/Lotus/Upgrades/Mods/Randomized/" + $("#addriven-type").val();
revalidateAuthz(() => { revalidateAuthz().then(() => {
// Add riven type to inventory // Add riven type to inventory
$.post({ $.post({
url: "/custom/addItems?" + window.authz, url: "/custom/addItems?" + window.authz,
@ -1790,7 +1788,7 @@ $("#addriven-fingerprint").on("input", () => {
}); });
function setFingerprint(ItemType, ItemId, fingerprint) { function setFingerprint(ItemType, ItemId, fingerprint) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post({ $.post({
url: "/api/artifacts.php?" + window.authz, url: "/api/artifacts.php?" + window.authz,
contentType: "text/plain", contentType: "text/plain",
@ -1818,7 +1816,7 @@ function doAcquireMod() {
} }
const count = parseInt($("#mod-count").val()); const count = parseInt($("#mod-count").val());
if (count != 0) { if (count != 0) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post({ $.post({
url: "/custom/addItems?" + window.authz, url: "/custom/addItems?" + window.authz,
contentType: "application/json", contentType: "application/json",
@ -1895,7 +1893,7 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
); );
} else { } else {
if ((await res.text()) == "Log-in expired") { if ((await res.text()) == "Log-in expired") {
revalidateAuthz(() => { revalidateAuthz().then(() => {
if (single.getCurrentPath() == "/webui/cheats") { if (single.getCurrentPath() == "/webui/cheats") {
single.loadRoute("/webui/cheats"); single.loadRoute("/webui/cheats");
} }
@ -1912,7 +1910,7 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
}); });
function doUnlockAllFocusSchools() { function doUnlockAllFocusSchools() {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1").done(async data => { $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1").done(async data => {
const missingFocusUpgrades = { const missingFocusUpgrades = {
"/Lotus/Upgrades/Focus/Attack/AttackFocusAbility": true, "/Lotus/Upgrades/Focus/Attack/AttackFocusAbility": true,
@ -1963,13 +1961,13 @@ function unlockFocusSchool(upgradeType) {
} }
function doHelminthUnlockAll() { function doHelminthUnlockAll() {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post("/api/infestedFoundry.php?" + window.authz + "&mode=custom_unlockall"); $.post("/api/infestedFoundry.php?" + window.authz + "&mode=custom_unlockall");
}); });
} }
function doIntrinsicsUnlockAll() { function doIntrinsicsUnlockAll() {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.get("/custom/unlockAllIntrinsics?" + window.authz); $.get("/custom/unlockAllIntrinsics?" + window.authz);
}); });
} }
@ -1981,7 +1979,7 @@ function doAddAllMods() {
} }
modsAll.delete("/Lotus/Upgrades/Mods/Fusers/LegendaryModFuser"); modsAll.delete("/Lotus/Upgrades/Mods/Fusers/LegendaryModFuser");
revalidateAuthz(() => { revalidateAuthz().then(() => {
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1"); const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
req.done(data => { req.done(data => {
for (const modOwned of data.RawUpgrades) { for (const modOwned of data.RawUpgrades) {
@ -2013,7 +2011,7 @@ function doAddAllMods() {
} }
function doRemoveUnrankedMods() { function doRemoveUnrankedMods() {
revalidateAuthz(() => { revalidateAuthz().then(() => {
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1"); const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
req.done(inventory => { req.done(inventory => {
window.itemListPromise.then(itemMap => { window.itemListPromise.then(itemMap => {
@ -2038,7 +2036,7 @@ function doRemoveUnrankedMods() {
} }
function doAddMissingMaxRankMods() { function doAddMissingMaxRankMods() {
revalidateAuthz(() => { revalidateAuthz().then(() => {
fetch("/custom/addMissingMaxRankMods?" + window.authz).then(() => { fetch("/custom/addMissingMaxRankMods?" + window.authz).then(() => {
updateInventory(); updateInventory();
}); });
@ -2060,7 +2058,7 @@ function doPushArchonCrystalUpgrade() {
$("[list='datalist-archonCrystalUpgrades']").addClass("is-invalid").focus(); $("[list='datalist-archonCrystalUpgrades']").addClass("is-invalid").focus();
return; return;
} }
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.get( $.get(
"/custom/pushArchonCrystalUpgrade?" + "/custom/pushArchonCrystalUpgrade?" +
window.authz + window.authz +
@ -2078,7 +2076,7 @@ function doPushArchonCrystalUpgrade() {
} }
function doPopArchonCrystalUpgrade(type) { function doPopArchonCrystalUpgrade(type) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.get( $.get(
"/custom/popArchonCrystalUpgrade?" + "/custom/popArchonCrystalUpgrade?" +
window.authz + window.authz +
@ -2093,7 +2091,7 @@ function doPopArchonCrystalUpgrade(type) {
} }
function doImport() { function doImport() {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post({ $.post({
url: "/custom/import?" + window.authz, url: "/custom/import?" + window.authz,
contentType: "application/json", contentType: "application/json",
@ -2110,7 +2108,7 @@ function doImport() {
function doChangeSupportedSyndicate() { function doChangeSupportedSyndicate() {
const uniqueName = document.getElementById("changeSyndicate").value; const uniqueName = document.getElementById("changeSyndicate").value;
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.get("/api/setSupportedSyndicate.php?" + window.authz + "&syndicate=" + uniqueName).done(function () { $.get("/api/setSupportedSyndicate.php?" + window.authz + "&syndicate=" + uniqueName).done(function () {
updateInventory(); updateInventory();
}); });
@ -2118,7 +2116,7 @@ function doChangeSupportedSyndicate() {
} }
function doAddCurrency(currency) { function doAddCurrency(currency) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post({ $.post({
url: "/custom/addCurrency?" + window.authz, url: "/custom/addCurrency?" + window.authz,
contentType: "application/json", contentType: "application/json",
@ -2133,7 +2131,7 @@ function doAddCurrency(currency) {
} }
function doQuestUpdate(operation, itemType) { function doQuestUpdate(operation, itemType) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post({ $.post({
url: "/custom/manageQuests?" + window.authz + "&operation=" + operation + "&itemType=" + itemType, url: "/custom/manageQuests?" + window.authz + "&operation=" + operation + "&itemType=" + itemType,
contentType: "application/json" contentType: "application/json"
@ -2144,7 +2142,7 @@ function doQuestUpdate(operation, itemType) {
} }
function doBulkQuestUpdate(operation) { function doBulkQuestUpdate(operation) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post({ $.post({
url: "/custom/manageQuests?" + window.authz + "&operation=" + operation, url: "/custom/manageQuests?" + window.authz + "&operation=" + operation,
contentType: "application/json" contentType: "application/json"
@ -2242,7 +2240,7 @@ function handleModularSelection(category) {
} }
function setBooster(ItemType, ExpiryDate, callback) { function setBooster(ItemType, ExpiryDate, callback) {
revalidateAuthz(() => { revalidateAuthz().then(() => {
$.post({ $.post({
url: "/custom/setBooster?" + window.authz, url: "/custom/setBooster?" + window.authz,
contentType: "application/json", contentType: "application/json",