feat(webui): acquiring gear items via "Add Items" (#340)
This commit is contained in:
		
							parent
							
								
									5597db6761
								
							
						
					
					
						commit
						c415fdd9ff
					
				@ -1,7 +1,13 @@
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { MinItem, items, getEnglishString } from "@/src/services/itemDataService";
 | 
					import { MinItem, items, getEnglishString } from "@/src/services/itemDataService";
 | 
				
			||||||
import badItems from "@/static/json/exclude-mods.json";
 | 
					import badItems from "@/static/json/exclude-mods.json";
 | 
				
			||||||
import { ExportArcanes, ExportResources, ExportWarframes, ExportWeapons } from "warframe-public-export-plus";
 | 
					import {
 | 
				
			||||||
 | 
					    ExportArcanes,
 | 
				
			||||||
 | 
					    ExportGear,
 | 
				
			||||||
 | 
					    ExportResources,
 | 
				
			||||||
 | 
					    ExportWarframes,
 | 
				
			||||||
 | 
					    ExportWeapons
 | 
				
			||||||
 | 
					} from "warframe-public-export-plus";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface ListedItem {
 | 
					interface ListedItem {
 | 
				
			||||||
    uniqueName: string;
 | 
					    uniqueName: string;
 | 
				
			||||||
@ -31,7 +37,7 @@ const getItemListsController: RequestHandler = (_req, res) => {
 | 
				
			|||||||
                });
 | 
					                });
 | 
				
			||||||
            } else if (!item.excludeFromCodex) {
 | 
					            } else if (!item.excludeFromCodex) {
 | 
				
			||||||
                miscitems.push({
 | 
					                miscitems.push({
 | 
				
			||||||
                    uniqueName,
 | 
					                    uniqueName: "MiscItems:" + uniqueName,
 | 
				
			||||||
                    name: getEnglishString(item.name)
 | 
					                    name: getEnglishString(item.name)
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -39,7 +45,13 @@ const getItemListsController: RequestHandler = (_req, res) => {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    for (const [uniqueName, item] of Object.entries(ExportResources)) {
 | 
					    for (const [uniqueName, item] of Object.entries(ExportResources)) {
 | 
				
			||||||
        miscitems.push({
 | 
					        miscitems.push({
 | 
				
			||||||
            uniqueName,
 | 
					            uniqueName: "MiscItems:" + uniqueName,
 | 
				
			||||||
 | 
					            name: getEnglishString(item.name)
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    for (const [uniqueName, item] of Object.entries(ExportGear)) {
 | 
				
			||||||
 | 
					        miscitems.push({
 | 
				
			||||||
 | 
					            uniqueName: "Consumables:" + uniqueName,
 | 
				
			||||||
            name: getEnglishString(item.name)
 | 
					            name: getEnglishString(item.name)
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -512,17 +512,18 @@ function disposeOfItems(category, type, count) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function doAcquireMiscItems() {
 | 
					function doAcquireMiscItems() {
 | 
				
			||||||
    const uniqueName = getKey(document.getElementById("miscitem-type"));
 | 
					    const data = getKey(document.getElementById("miscitem-type"));
 | 
				
			||||||
    if (!uniqueName) {
 | 
					    if (!data) {
 | 
				
			||||||
        $("#miscitem-type").addClass("is-invalid").focus();
 | 
					        $("#miscitem-type").addClass("is-invalid").focus();
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    const [category, uniqueName] = data.split(":");
 | 
				
			||||||
    revalidateAuthz(() => {
 | 
					    revalidateAuthz(() => {
 | 
				
			||||||
        $.post({
 | 
					        $.post({
 | 
				
			||||||
            url: "/api/missionInventoryUpdate.php?" + window.authz,
 | 
					            url: "/api/missionInventoryUpdate.php?" + window.authz,
 | 
				
			||||||
            contentType: "text/plain",
 | 
					            contentType: "text/plain",
 | 
				
			||||||
            data: JSON.stringify({
 | 
					            data: JSON.stringify({
 | 
				
			||||||
                MiscItems: [
 | 
					                [category]: [
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        ItemType: uniqueName,
 | 
					                        ItemType: uniqueName,
 | 
				
			||||||
                        ItemCount: parseInt($("#miscitem-count").val())
 | 
					                        ItemCount: parseInt($("#miscitem-count").val())
 | 
				
			||||||
@ -535,8 +536,8 @@ function doAcquireMiscItems() {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$("#miscitem-name").on("input", () => {
 | 
					$("#miscitem-type").on("input", () => {
 | 
				
			||||||
    $("#miscitem-name").removeClass("is-invalid");
 | 
					    $("#miscitem-type").removeClass("is-invalid");
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function doAcquireRiven() {
 | 
					function doAcquireRiven() {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user