Compare commits

...

4 Commits

Author SHA1 Message Date
b9009b5102 feat(webui): force category to add items (raw)
also closes #2786
2025-10-25 09:04:07 +02:00
60e87543aa fixup: skipAllDialogue for the prince 2025-10-24 10:43:05 +02:00
c4c17f24d7 chore: add nightcap stuff for skipAllDialogues (#2930)
Reviewed-on: OpenWF/SpaceNinjaServer#2930
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
2025-10-23 23:21:46 -07:00
43fa1978c0 feat(webui): remove IsNew (#2926)
Closes #2917

Reviewed-on: OpenWF/SpaceNinjaServer#2926
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>
2025-10-23 23:21:37 -07:00
14 changed files with 193 additions and 11 deletions

View File

@ -1,14 +1,91 @@
import { getAccountIdForRequest } from "../../services/loginService.ts";
import { getInventory, addItem } from "../../services/inventoryService.ts";
import {
getInventory,
addItem,
addMiscItem,
addMods,
addShipDecorations,
addPowerSuit,
addEquipment,
addMechSuit,
addSentinel,
addSentinelWeapon,
addCustomization,
addSkin,
productCategoryToInventoryBin,
occupySlot
} from "../../services/inventoryService.ts";
import type { RequestHandler } from "express";
import { broadcastInventoryUpdate } from "../../services/wsService.ts";
import { InventorySlot } from "../../types/inventoryTypes/inventoryTypes.ts";
export const addItemsController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req);
const requests = req.body as IAddItemRequest[];
const inventory = await getInventory(accountId);
const productCategory = (req.query.productCategory as string) || "";
for (const request of requests) {
await addItem(inventory, request.ItemType, request.ItemCount, true, undefined, request.Fingerprint, true);
switch (productCategory) {
case "MiscItems":
addMiscItem(inventory, request.ItemType, request.ItemCount);
break;
case "RawUpgrades":
addMods(inventory, [request]);
break;
case "ShipDecorations":
addShipDecorations(inventory, [request]);
break;
case "Suits":
await addPowerSuit(inventory, request.ItemType);
occupySlot(inventory, InventorySlot.SUITS, true);
break;
case "MechSuits":
await addMechSuit(inventory, request.ItemType);
occupySlot(inventory, InventorySlot.MECHSUITS, true);
break;
case "Sentinels":
addSentinel(inventory, request.ItemType, true);
break;
case "SentinelWeapons":
addSentinelWeapon(inventory, request.ItemType, true);
break;
case "FlavourItems":
addCustomization(inventory, request.ItemType);
break;
case "WeaponSkins":
addSkin(inventory, request.ItemType);
break;
case "LongGuns":
case "Pistols":
case "Melee":
case "SpaceSuits":
case "SpaceGuns":
case "SpaceMelee":
addEquipment(inventory, productCategory, request.ItemType);
occupySlot(inventory, productCategoryToInventoryBin(productCategory) ?? InventorySlot.WEAPONS, true);
break;
default:
await addItem(
inventory,
request.ItemType,
request.ItemCount,
true,
undefined,
request.Fingerprint,
true
);
break;
}
}
await inventory.save();
res.end();

View File

@ -0,0 +1,24 @@
import { getInventory } from "../../services/inventoryService.ts";
import { getAccountIdForRequest } from "../../services/loginService.ts";
import type { RequestHandler } from "express";
import { equipmentKeys } from "../../types/inventoryTypes/inventoryTypes.ts";
import { broadcastInventoryUpdate } from "../../services/wsService.ts";
export const removeIsNewController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req);
const filteredEquipmentKeys = equipmentKeys.filter(k => k !== "CrewShipWeapons" && k !== "CrewShipSalvagedWeapons");
const inventory = await getInventory(accountId, [...filteredEquipmentKeys, "WeaponSkins"].join(" "));
for (const key of filteredEquipmentKeys) {
if (key in inventory) {
for (const equipment of inventory[key]) {
if (equipment.IsNew) equipment.IsNew = false;
}
}
}
for (const equipment of inventory.WeaponSkins) {
if (equipment.IsNew) equipment.IsNew = false;
}
await inventory.save();
res.end();
broadcastInventoryUpdate(req);
};

View File

@ -22,6 +22,7 @@ import { unlockAllScansController } from "../controllers/custom/unlockAllScansCo
import { unlockAllShipFeaturesController } from "../controllers/custom/unlockAllShipFeaturesController.ts";
import { unlockAllCapturaScenesController } from "../controllers/custom/unlockAllCapturaScenesController.ts";
import { removeCustomizationController } from "../controllers/custom/removeCustomizationController.ts";
import { removeIsNewController } from "../controllers/custom/removeIsNewController.ts";
import { abilityOverrideController } from "../controllers/custom/abilityOverrideController.ts";
import { createAccountController } from "../controllers/custom/createAccountController.ts";
@ -73,6 +74,7 @@ customRouter.get("/unlockAllScans", unlockAllScansController);
customRouter.get("/unlockAllShipFeatures", unlockAllShipFeaturesController);
customRouter.get("/unlockAllCapturaScenes", unlockAllCapturaScenesController);
customRouter.get("/removeCustomization", removeCustomizationController);
customRouter.get("/removeIsNew", removeIsNewController);
customRouter.post("/abilityOverride", abilityOverrideController);
customRouter.post("/createAccount", createAccountController);

View File

@ -941,7 +941,7 @@ export const applyDefaultUpgrades = (
};
//TODO: maybe genericMethod for all the add methods, they share a lot of logic
const addSentinel = (
export const addSentinel = (
inventory: TInventoryDatabaseDocument,
sentinelName: string,
premiumPurchase: boolean,
@ -972,11 +972,11 @@ const addSentinel = (
return inventoryChanges;
};
const addSentinelWeapon = (
export const addSentinelWeapon = (
inventory: TInventoryDatabaseDocument,
typeName: string,
premiumPurchase: boolean,
inventoryChanges: IInventoryChanges
inventoryChanges: IInventoryChanges = {}
): void => {
// Sentinel weapons also occupy a slot in the sentinels bin
combineInventoryChanges(inventoryChanges, occupySlot(inventory, InventorySlot.SENTINELS, premiumPurchase));

View File

@ -136,5 +136,7 @@
"ConquestSetupIntro",
"EntratiLabConquestHardModeUnlocked",
"/Lotus/Language/Npcs/KonzuPostNewWar",
"/Lotus/Language/SolarisVenus/EudicoPostNewWar"
"/Lotus/Language/SolarisVenus/EudicoPostNewWar",
"/Lotus/Language/NokkoColony/NokkoVendorName",
"NokkoVisions_FirstVisit"
]

View File

@ -116,9 +116,31 @@
</div>
<div class="tab-pane" id="typeName-tab-content">
<form class="card-body" onsubmit="addItemByItemType();return false;">
<p data-loc="inventory_addItemByItemType_warning"></p>
<p>
<span data-loc="inventory_addItemByItemType_warning"></span>
<span data-loc="inventory_addItemByItemType_productCategory"></span>
</p>
<div class="input-group">
<input class="form-control" id="typeName-type" />
<input class="form-control" id="typeName-count" type="number" value="1" disabled />
<input class="form-control w-50" id="typeName-type" />
<select class="form-control" id="typeName-productCategory" data-default="">
<option value="" data-loc="notSpecified"></option>
<option value="MiscItems">MiscItems</option>
<option value="RawUpgrades">RawUpgrades</option>
<option value="ShipDecorations">ShipDecorations</option>
<option value="Suits">Suits</option>
<option value="LongGuns">LongGuns</option>
<option value="Pistols">Pistols</option>
<option value="Melee">Melee</option>
<option value="SpaceSuits">SpaceSuits</option>
<option value="SpaceGuns">SpaceGuns</option>
<option value="SpaceMelee">SpaceMelee</option>
<option value="MechSuits">MechSuits</option>
<option value="Sentinels">Sentinels</option>
<option value="SentinelWeapons">SentinelWeapons</option>
<option value="FlavourItems">FlavourItems</option>
<option value="WeaponSkins">WeaponSkins</option>
</select>
<button class="btn btn-primary" type="submit" data-loc="general_addButton"></button>
</div>
</form>
@ -558,6 +580,7 @@
<button class="btn btn-primary" onclick="debounce(addMissingEquipment, ['ShipDecorations']);" data-loc="inventory_bulkAddShipDecorations"></button>
<button class="btn btn-primary" onclick="debounce(addMissingEquipment, ['WeaponSkins']);" data-loc="inventory_bulkAddWeaponSkins"></button>
<button class="btn btn-primary" onclick="debounce(addMissingEvolutionProgress);" data-loc="inventory_bulkAddEvolutionProgress"></button>
<button class="btn btn-primary" onclick="removeIsNew();" data-loc="inventory_removeIsNew"></button>
</div>
<div class="mb-2 d-flex flex-wrap gap-2">
<button class="btn btn-success" onclick="debounce(maxRankAllEquipment, ['Suits']);" data-loc="inventory_bulkRankUpSuits"></button>

View File

@ -773,6 +773,9 @@ function updateInventory() {
document.getElementById("typeName-tab").classList.remove("active");
document.getElementById("typeName-tab-content").classList.remove("active", "show");
document.getElementById("typeName-type").value = "";
document.getElementById("typeName-productCategory").value = "";
document.getElementById("typeName-count").value = 1;
document.getElementById("typeName-count").disabled = true;
document.getElementById("miscItems-tab").classList.add("active");
document.getElementById("miscItems-tab-content").classList.add("active", "show");
@ -2177,6 +2180,15 @@ function removeCustomization(uniqueName) {
});
}
function removeIsNew() {
revalidateAuthz().then(() => {
const req = $.get("/custom/removeIsNew?" + window.authz);
req.done(() => {
updateInventory();
});
});
}
function getRequiredParts(category, WeaponType) {
switch (category) {
case "Hoverboards":
@ -2956,27 +2968,48 @@ function removeCountItems(uniqueName, count) {
});
}
document.getElementById("typeName-productCategory").onchange = function () {
const productCategory = document.getElementById("typeName-productCategory").value;
const ItemCount = document.getElementById("typeName-count");
if (["MiscItems", "RawUpgrades", "ShipDecorations"].includes(productCategory)) {
ItemCount.disabled = false;
} else {
ItemCount.disabled = true;
ItemCount.value = 1;
}
};
function addItemByItemType() {
const ItemType = document.getElementById("typeName-type").value;
const productCategory = document.getElementById("typeName-productCategory");
const ItemCount = document.getElementById("typeName-count");
// Must start with "/Lotus/", contain only letters AZ, digits 09, no "//", and not end with "/"
if (!ItemType || !/^\/Lotus\/(?:[A-Za-z0-9]+(?:\/[A-Za-z0-9]+)*)$/.test(ItemType)) {
$("#typeName-type").addClass("is-invalid").focus();
return;
}
let url = "/custom/addItems?" + window.authz;
if (productCategory.value) {
url += "&productCategory=" + productCategory.value;
}
revalidateAuthz().then(() => {
$.post({
url: "/custom/addItems?" + window.authz,
url,
contentType: "application/json",
data: JSON.stringify([
{
ItemType,
ItemCount: 1
ItemCount: ItemCount.value
}
])
})
.done(function (_, _, jqXHR) {
.done(function (_, __, jqXHR) {
if (jqXHR.status === 200) {
updateInventory();
productCategory.value = "";
ItemCount.disabled = true;
ItemCount.value = 1;
}
})
.fail(function () {

View File

@ -98,6 +98,7 @@ dict = {
inventory_addItems: `Gegenstände hinzufügen`,
inventory_addItemByItemType: `Roh`,
inventory_addItemByItemType_warning: `Verwende diese Funktion auf eigene Gefahr. Sie kann dein Inventar beschädigen und du musst Gegenstände manuell entfernen, falls etwas schiefgeht.`,
inventory_addItemByItemType_productCategory: `[UNTRANSLATED] You can also specify <code>productCategory</code>, some of which will allow you to change the number of items added.`,
inventory_suits: `Warframes`,
inventory_longGuns: `Primärwaffen`,
inventory_pistols: `Sekundärwaffen`,
@ -135,6 +136,7 @@ dict = {
inventory_bulkRankUpSentinelWeapons: `Alle Wächter-Waffen auf Max. Rang`,
inventory_bulkRankUpEvolutionProgress: `Alle Incarnon-Entwicklungsfortschritte auf Max. Rang`,
inventory_maxPlexus: `Plexus auf Max. Rang`,
inventory_removeIsNew: `[UNTRANSLATED] Remove New Equipment Exclamation Icon`,
quests_list: `Quests`,
quests_completeAll: `Alle Quests abschließen`,
@ -307,6 +309,7 @@ dict = {
worldState_incompatibleWith: `Inkompatibel mit:`,
enabled: `Aktiviert`,
disabled: `Deaktiviert`,
notSpecified: `[UNTRANSLATED] Not specified`,
worldState_we1: `Wochenende 1`,
worldState_we2: `Wochenende 2`,
worldState_we3: `Wochenende 3`,

View File

@ -97,6 +97,7 @@ dict = {
inventory_addItems: `Add Items`,
inventory_addItemByItemType: `Raw`,
inventory_addItemByItemType_warning: `Use this feature at your own risk. It may break your inventory, and you will need to remove items manually if something goes wrong.`,
inventory_addItemByItemType_productCategory: `You can also specify <code>productCategory</code>, some of which will allow you to change the number of items added.`,
inventory_suits: `Warframes`,
inventory_longGuns: `Primary Weapons`,
inventory_pistols: `Secondary Weapons`,
@ -134,6 +135,7 @@ dict = {
inventory_bulkRankUpSentinelWeapons: `Max Rank All Sentinel Weapons`,
inventory_bulkRankUpEvolutionProgress: `Max Rank All Incarnon Evolution Progress`,
inventory_maxPlexus: `Max Rank Plexus`,
inventory_removeIsNew: `Remove New Equipment Exclamation Icon`,
quests_list: `Quests`,
quests_completeAll: `Complete All Quests`,
@ -306,6 +308,7 @@ dict = {
worldState_incompatibleWith: `Incompatible with:`,
enabled: `Enabled`,
disabled: `Disabled`,
notSpecified: `Not specified`,
worldState_we1: `Weekend 1`,
worldState_we2: `Weekend 2`,
worldState_we3: `Weekend 3`,

View File

@ -98,6 +98,7 @@ dict = {
inventory_addItems: `Agregar objetos`,
inventory_addItemByItemType: `Sin refinar`,
inventory_addItemByItemType_warning: `Usa esta función bajo tu propio riesgo. Podría dañar tu inventario, y tendrías que eliminar los objetos manualmente si algo sale mal.`,
inventory_addItemByItemType_productCategory: `[UNTRANSLATED] You can also specify <code>productCategory</code>, some of which will allow you to change the number of items added.`,
inventory_suits: `Warframes`,
inventory_longGuns: `Armas primarias`,
inventory_pistols: `Armas secundarias`,
@ -135,6 +136,7 @@ dict = {
inventory_bulkRankUpSentinelWeapons: `Maximizar rango de todas las armas de centinela`,
inventory_bulkRankUpEvolutionProgress: `Maximizar todo el progreso de evolución Incarnon`,
inventory_maxPlexus: `Rango máximo de Plexus`,
inventory_removeIsNew: `[UNTRANSLATED] Remove New Equipment Exclamation Icon`,
quests_list: `Misiones`,
quests_completeAll: `Completar todas las misiones`,
@ -307,6 +309,7 @@ dict = {
worldState_incompatibleWith: `No compatible con:`,
enabled: `Activado`,
disabled: `Desactivado`,
notSpecified: `[UNTRANSLATED] Not specified`,
worldState_we1: `Semana 1`,
worldState_we2: `Semana 2`,
worldState_we3: `Semana 3`,

View File

@ -98,6 +98,7 @@ dict = {
inventory_addItems: `Ajouter des items`,
inventory_addItemByItemType: `Brut`,
inventory_addItemByItemType_warning: `Cette fonctionnalité comporte des risques. Il faudra rajouter les items manuellement si l'inventaire est compris.`,
inventory_addItemByItemType_productCategory: `[UNTRANSLATED] You can also specify <code>productCategory</code>, some of which will allow you to change the number of items added.`,
inventory_suits: `Warframes`,
inventory_longGuns: `Armes principales`,
inventory_pistols: `Armes secondaires`,
@ -135,6 +136,7 @@ dict = {
inventory_bulkRankUpSentinelWeapons: `Toutes les armes de Sentinelles au rang max`,
inventory_bulkRankUpEvolutionProgress: `Toutes les évolutions Incarnon au rang max`,
inventory_maxPlexus: `Plexus au rang max`,
inventory_removeIsNew: `[UNTRANSLATED] Remove New Equipment Exclamation Icon`,
quests_list: `Quêtes`,
quests_completeAll: `Compléter toutes les quêtes`,
@ -307,6 +309,7 @@ dict = {
worldState_incompatibleWith: `Incompatible avec :`,
enabled: `Activé`,
disabled: `Désactivé`,
notSpecified: `[UNTRANSLATED] Not specified`,
worldState_we1: `Weekend 1`,
worldState_we2: `Weekend 2`,
worldState_we3: `Weekend 3`,

View File

@ -98,6 +98,7 @@ dict = {
inventory_addItems: `Добавить предметы`,
inventory_addItemByItemType: `Необработанные данные`,
inventory_addItemByItemType_warning: `Используйте эту функцию на свой страх и риск. Она может повредить ваш инвентарь, и в случае проблем вам придётся удалять предметы вручную.`,
inventory_addItemByItemType_productCategory: `Вы также можете указать <code>productCategory</code>, некоторые из них позволят вам изменить количество добавленных преметов.`,
inventory_suits: `Варфреймы`,
inventory_longGuns: `Основное оружие`,
inventory_pistols: `Вторичное оружие`,
@ -135,6 +136,7 @@ dict = {
inventory_bulkRankUpSentinelWeapons: `Макс. ранг всего оружия Стражей`,
inventory_bulkRankUpEvolutionProgress: `Макс. ранг всех эволюций Инкарнонов`,
inventory_maxPlexus: `Макс. ранг Плексуса`,
inventory_removeIsNew: `Удалить значок восклицательного знака нового снаряжения`,
quests_list: `Квесты`,
quests_completeAll: `Завершить все квесты`,
@ -307,6 +309,7 @@ dict = {
worldState_incompatibleWith: `Несовместимо с:`,
enabled: `Включено`,
disabled: `Отключено`,
notSpecified: `Не указано`,
worldState_we1: `Выходные 1`,
worldState_we2: `Выходные 2`,
worldState_we3: `Выходные 3`,

View File

@ -98,6 +98,7 @@ dict = {
inventory_addItems: `Додати предмети`,
inventory_addItemByItemType: `Необроблені дані`,
inventory_addItemByItemType_warning: `Використовуйте цю функцію на власний ризик. Вона може пошкодити ваше спорядження, і вам доведеться видаляти предмети вручну, якщо щось піде не так.`,
inventory_addItemByItemType_productCategory: `[UNTRANSLATED] You can also specify <code>productCategory</code>, some of which will allow you to change the number of items added.`,
inventory_suits: `Ворфрейми`,
inventory_longGuns: `Основна зброя`,
inventory_pistols: `Допоміжна зброя`,
@ -135,6 +136,7 @@ dict = {
inventory_bulkRankUpSentinelWeapons: `Макс. рівень всієї зброї Вартових`,
inventory_bulkRankUpEvolutionProgress: `Макс. рівень всіх еволюцій Інкарнонів`,
inventory_maxPlexus: `Макс. рівень Плексу`,
inventory_removeIsNew: `[UNTRANSLATED] Remove New Equipment Exclamation Icon`,
quests_list: `Пригоди`,
quests_completeAll: `Закінчити всі пригоди`,
@ -307,6 +309,7 @@ dict = {
worldState_incompatibleWith: `Несумісне з:`,
enabled: `Увімкнено`,
disabled: `Вимкнено`,
notSpecified: `[UNTRANSLATED] Not specified`,
worldState_we1: `Вихідні 1`,
worldState_we2: `Вихідні 2`,
worldState_we3: `Вихідні 3`,

View File

@ -98,6 +98,7 @@ dict = {
inventory_addItems: `添加物品`,
inventory_addItemByItemType: `[UNTRANSLATED] Raw`,
inventory_addItemByItemType_warning: `[UNTRANSLATED] Use this feature at your own risk. It may break your inventory, and you will need to remove items manually if something goes wrong.`,
inventory_addItemByItemType_productCategory: `[UNTRANSLATED] You can also specify <code>productCategory</code>, some of which will allow you to change the number of items added.`,
inventory_suits: `战甲`,
inventory_longGuns: `主要武器`,
inventory_pistols: `次要武器`,
@ -135,6 +136,7 @@ dict = {
inventory_bulkRankUpSentinelWeapons: `所有守护武器升满级`,
inventory_bulkRankUpEvolutionProgress: `所有灵化之源进度最大等级`,
inventory_maxPlexus: `最大深控等级`,
inventory_removeIsNew: `[UNTRANSLATED] Remove New Equipment Exclamation Icon`,
quests_list: `系列任务`,
quests_completeAll: `完成所有任务`,
@ -307,6 +309,7 @@ dict = {
worldState_incompatibleWith: `不兼容的活动:`,
enabled: `启用`,
disabled: `关闭/取消配置`,
notSpecified: `[UNTRANSLATED] Not specified`,
worldState_we1: `活动阶段:第一周`,
worldState_we2: `活动阶段:第二周`,
worldState_we3: `活动阶段:第三周`,