forked from OpenWF/SpaceNinjaServer
		
	fix(webui): properly handle unique level caps (#837)
This commit is contained in:
		
							parent
							
								
									7b78f5a997
								
							
						
					
					
						commit
						1ba3378574
					
				@ -4,6 +4,7 @@ import {
 | 
				
			|||||||
    ExportArcanes,
 | 
					    ExportArcanes,
 | 
				
			||||||
    ExportAvionics,
 | 
					    ExportAvionics,
 | 
				
			||||||
    ExportGear,
 | 
					    ExportGear,
 | 
				
			||||||
 | 
					    ExportMisc,
 | 
				
			||||||
    ExportRecipes,
 | 
					    ExportRecipes,
 | 
				
			||||||
    ExportResources,
 | 
					    ExportResources,
 | 
				
			||||||
    ExportSentinels,
 | 
					    ExportSentinels,
 | 
				
			||||||
@ -163,6 +164,7 @@ const getItemListsController: RequestHandler = (req, response) => {
 | 
				
			|||||||
    response.json({
 | 
					    response.json({
 | 
				
			||||||
        badItems,
 | 
					        badItems,
 | 
				
			||||||
        archonCrystalUpgrades,
 | 
					        archonCrystalUpgrades,
 | 
				
			||||||
 | 
					        uniqueLevelCaps: ExportMisc.uniqueLevelCaps,
 | 
				
			||||||
        ...res
 | 
					        ...res
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -126,6 +126,7 @@ function setLanguage(lang) {
 | 
				
			|||||||
    updateInventory();
 | 
					    updateInventory();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					let uniqueLevelCaps = {};
 | 
				
			||||||
function fetchItemList() {
 | 
					function fetchItemList() {
 | 
				
			||||||
    window.itemListPromise = new Promise(resolve => {
 | 
					    window.itemListPromise = new Promise(resolve => {
 | 
				
			||||||
        const req = $.get("/custom/getItemLists?lang=" + window.lang);
 | 
					        const req = $.get("/custom/getItemLists?lang=" + window.lang);
 | 
				
			||||||
@ -167,6 +168,8 @@ function fetchItemList() {
 | 
				
			|||||||
                        option.value = name;
 | 
					                        option.value = name;
 | 
				
			||||||
                        document.getElementById("datalist-" + type).appendChild(option);
 | 
					                        document.getElementById("datalist-" + type).appendChild(option);
 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
 | 
					                } else if (type == "uniqueLevelCaps") {
 | 
				
			||||||
 | 
					                    uniqueLevelCaps = items;
 | 
				
			||||||
                } else if (type != "badItems") {
 | 
					                } else if (type != "badItems") {
 | 
				
			||||||
                    items.forEach(item => {
 | 
					                    items.forEach(item => {
 | 
				
			||||||
                        if (item.uniqueName in data.badItems) {
 | 
					                        if (item.uniqueName in data.badItems) {
 | 
				
			||||||
@ -235,14 +238,16 @@ function updateInventory() {
 | 
				
			|||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        const td = document.createElement("td");
 | 
					                        const td = document.createElement("td");
 | 
				
			||||||
                        td.classList = "text-end text-nowrap";
 | 
					                        td.classList = "text-end text-nowrap";
 | 
				
			||||||
                        const maxXP =
 | 
					                        let maxXP = Math.pow(uniqueLevelCaps[item.ItemType] ?? 30, 2) * 1000;
 | 
				
			||||||
                            category == "Suits" ||
 | 
					                        if (
 | 
				
			||||||
                            category == "SpaceSuits" ||
 | 
					                            category != "Suits" &&
 | 
				
			||||||
                            category == "Sentinels" ||
 | 
					                            category != "SpaceSuits" &&
 | 
				
			||||||
                            category == "Hoverboards" ||
 | 
					                            category != "Sentinels" &&
 | 
				
			||||||
                            category == "MechSuits"
 | 
					                            category != "Hoverboards" &&
 | 
				
			||||||
                                ? 1_600_000
 | 
					                            category != "MechSuits"
 | 
				
			||||||
                                : 800_000;
 | 
					                        ) {
 | 
				
			||||||
 | 
					                            maxXP /= 2;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        if (
 | 
					                        if (
 | 
				
			||||||
                            item.XP < maxXP &&
 | 
					                            item.XP < maxXP &&
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user