XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

feat: install arcane U18 (#3621)

Closes #3599 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3621 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: dutlist <ameloninsidelemon@noreply.localhost> Co-committed-by: dutlist <ameloninsidelemon@noreply.localhost>

93a0d0c6
dutlist <ameloninsidelemon@noreply.localhost>
提交于

代码差异

13 个文件 +67 -6
Modified src/constants/gameToBuildVersion.ts +1 -0
@@ -41,6 +41,7 @@ const gameToBuildVersion = {
41 41 "22.0.0": "2017.10.12.17.04",
42 42 "20.4.0": "2017.05.05.15.41",
43 43 "19.5.0": "2016.12.21.19.13",
44 "19.4.1": "2016.12.16.14.33",
44 45 "18.22.1": "2016.09.30.12.04",
45 46 "18.18.0": "2016.08.19.17.12",
46 47 "18.16.0": "2016.07.08.16.56",
Modified src/controllers/api/arcaneCommonController.ts +12 -4
@@ -1,14 +1,16 @@
1 1 import type { RequestHandler } from "express";
2 2 import { getJSONfromString } from "../../helpers/stringHelpers.ts";
3 import { getAccountIdForRequest } from "../../services/loginService.ts";
4 import { getInventory, addMods } from "../../services/inventoryService.ts";
3 import { getAccountForRequest } from "../../services/loginService.ts";
4 import { getInventory, addMods, addMiscItem } from "../../services/inventoryService.ts";
5 5 import type { IOid } from "../../types/commonTypes.ts";
6 6 import { logger } from "../../utils/logger.ts";
7 7 import { JSONParse } from "json-with-bigint";
8 import gameToBuildVersion from "../../constants/gameToBuildVersion.ts";
9 import { version_compare } from "../../helpers/inventoryHelpers.ts";
8 10
9 11 export const arcaneCommonController: RequestHandler = async (req, res) => {
10 const accountId = await getAccountIdForRequest(req);
11 const inventory = await getInventory(accountId);
12 const account = await getAccountForRequest(req);
13 const inventory = await getInventory(account._id.toString());
12 14 const body = String(req.body);
13 15
14 16 const parsed: unknown = JSONParse(body.substring(0, body.lastIndexOf("}") + 1));
@@ -52,11 +54,17 @@ export const arcaneCommonController: RequestHandler = async (req, res) => {
52 54 item.UpgradeFingerprint = undefined;
53 55 item.UpgradeType = undefined;
54 56 addMods(inventory, [{ ItemType: arcaneType, ItemCount: numToRefund }]);
57 if (account.BuildLabel && version_compare(account.BuildLabel, gameToBuildVersion["19.4.1"]) <= 0) {
58 addMiscItem(inventory, "/Lotus/Types/Recipes/CosmeticUnenhancerItem", -1);
59 }
55 60 res.json({ arcaneType, numToRefund });
56 61 } else {
57 62 logger.debug(`data provided to ${req.path}: ${String(req.body)}`);
58 63 throw new Error(`unknown legacy arcaneCommon operationType: ${json.operationType}`);
59 64 }
65 } else {
66 logger.debug(`data provided to ${req.path}: ${String(req.body)}`);
67 throw new Error(`Failed to find item with OID ${json.skinId}`);
60 68 }
61 69 await inventory.save();
62 70 return;
Modified src/controllers/api/inventoryController.ts +30 -0
@@ -528,6 +528,17 @@ export const getInventoryResponse = async (
528 528 }
529 529 }
530 530
531 if (version_compare(buildLabel, gameToBuildVersion["38.5.0"]) < 0) {
532 for (const category of equipmentKeys) {
533 for (const item of inventoryResponse[category]) {
534 delete item.IsNew;
535 }
536 }
537 for (const item of inventoryResponse.WeaponSkins) {
538 delete item.IsNew;
539 }
540 }
541
531 542 // Old versions crash when faced with an unrecognised CollectibleType, so filter this array.
532 543 if (inventoryResponse.CollectibleSeries && version_compare(buildLabel, gameToBuildVersion["33.0.0"]) < 0) {
533 544 inventoryResponse.CollectibleSeries = inventoryResponse.CollectibleSeries.filter(
@@ -535,6 +546,13 @@ export const getInventoryResponse = async (
535 546 );
536 547 }
537 548
549 // U28.1 introduced Steel Path
550 if (version_compare(buildLabel, "2020.07.08.00.00") < 0) {
551 for (const mission of inventoryResponse.Missions) {
552 delete mission.Tier;
553 }
554 }
555
538 556 if (version_compare(buildLabel, gameToBuildVersion["24.4.0"]) < 0) {
539 557 // Builds before U24.4.0 handle equipment features differently
540 558 for (const category of equipmentKeys) {
@@ -580,6 +598,18 @@ export const getInventoryResponse = async (
580 598 }
581 599 }
582 600
601 for (const item of inventoryResponse.WeaponSkins) {
602 toLegacyOid(item.ItemId);
603 }
604
605 for (const ship of inventoryResponse.Ships) {
606 toLegacyOid(ship.ItemId);
607 }
608
609 for (const item of inventoryResponse.RawUpgrades) {
610 if (item.LastAdded) toLegacyOid(item.LastAdded);
611 }
612
583 613 if (version_compare(buildLabel, "2014.02.05.00.00") < 0) {
584 614 // Pre-U12 builds store mods in an array called Cards, and have no concept of RawUpgrades
585 615 inventoryResponse.Cards = [];
Modified src/services/inventoryService.ts +14 -0
@@ -1163,6 +1163,20 @@ export const addItem = async (
1163 1163 return { LevelKeys: levelKeyChanges };
1164 1164 }
1165 1165 break;
1166 case "Recipes":
1167 if (typeName == "/Lotus/Types/Recipes/CosmeticUnenhancerItem") {
1168 const miscItemChanges = [
1169 {
1170 ItemType: typeName,
1171 ItemCount: quantity
1172 } satisfies IMiscItem
1173 ];
1174 addMiscItems(inventory, miscItemChanges);
1175 return {
1176 MiscItems: miscItemChanges
1177 };
1178 }
1179 break;
1166 1180 }
1167 1181 break;
1168 1182 case "Weapons": {
Modified src/types/inventoryTypes/inventoryTypes.ts +2 -2
@@ -1093,7 +1093,7 @@ export interface IShipInventory {
1093 1093 ItemType: string;
1094 1094 ShipExterior: IShipCustomization;
1095 1095 AirSupportPower: string;
1096 ItemId: IOid;
1096 ItemId: IOidWithLegacySupport;
1097 1097 }
1098 1098
1099 1099 export interface ISpectreLoadout {
@@ -1135,7 +1135,7 @@ export interface IWeaponSkinDatabase {
1135 1135 }
1136 1136
1137 1137 export interface IWeaponSkinClient extends Omit<IWeaponSkinDatabase, "_id"> {
1138 ItemId: IOid;
1138 ItemId: IOidWithLegacySupport;
1139 1139 }
1140 1140
1141 1141 export interface IWebFlags {
Modified static/webui/script.js +1 -0
@@ -568,6 +568,7 @@ function fetchItemList() {
568 568 });
569 569
570 570 data.miscitems.push(
571 { uniqueName: "/Lotus/Types/Recipes/CosmeticUnenhancerItem", name: loc("code_cosmeticUnenhancer") },
571 572 {
572 573 uniqueName: "/Lotus/Types/Items/Research/DojoColors/GenericDojoColorPigment",
573 574 name: loc("code_pigment")
Modified static/webui/translations/de.js +1 -0
@@ -76,6 +76,7 @@ dict = {
76 76 code_setInactive: `Quest inaktiv setzen`,
77 77 code_completed: `Abgeschlossen`,
78 78 code_active: `Aktiv`,
79 code_cosmeticUnenhancer: `Arkana Destillator`,
79 80 code_pigment: `Pigment`,
80 81 code_bossNavCode: `Lephantis Nav-Koordinaten`,
81 82 code_lawOfRetribution: `DAS GESETZ DER VERGELTUNG`,
Modified static/webui/translations/en.js +1 -0
@@ -75,6 +75,7 @@ dict = {
75 75 code_setInactive: `Make the quest inactive`,
76 76 code_completed: `Completed`,
77 77 code_active: `Active`,
78 code_cosmeticUnenhancer: `Arcane Distiller`,
78 79 code_pigment: `Pigment`,
79 80 code_bossNavCode: `Lephantis Nav Coordinate`,
80 81 code_lawOfRetribution: `THE LAW OF RETRIBUTION`,
Modified static/webui/translations/es.js +1 -0
@@ -76,6 +76,7 @@ dict = {
76 76 code_setInactive: `Marcar la misión como inactiva`,
77 77 code_completed: `Completada`,
78 78 code_active: `Activa`,
79 code_cosmeticUnenhancer: `Destilador Arcano`,
79 80 code_pigment: `Pigmento`,
80 81 code_bossNavCode: `Coordenadas de Navegación de Lephantis`,
81 82 code_lawOfRetribution: `LA LEY DE LA RETRIBUCIÓN`,
Modified static/webui/translations/fr.js +1 -0
@@ -76,6 +76,7 @@ dict = {
76 76 code_setInactive: `Rendre la quête inactive`,
77 77 code_completed: `Complétée`,
78 78 code_active: `Active`,
79 code_cosmeticUnenhancer: `Arcane Distiller`,
79 80 code_pigment: `Pigment`,
80 81 code_bossNavCode: `Coord. Nav de Lephantis`,
81 82 code_lawOfRetribution: `LE DROIT DE RÉTRIBUTION`,
Modified static/webui/translations/ru.js +1 -0
@@ -76,6 +76,7 @@ dict = {
76 76 code_setInactive: `Сделать квест неактивным`,
77 77 code_completed: `Завершено`,
78 78 code_active: `Активный`,
79 code_cosmeticUnenhancer: `Мистический дистиллятор`,
79 80 code_pigment: `Пигмент`,
80 81 code_bossNavCode: `Координаты Лефантиса`,
81 82 code_lawOfRetribution: `ЗАКОН ВОЗДАЯНИЯ`,
Modified static/webui/translations/uk.js +1 -0
@@ -76,6 +76,7 @@ dict = {
76 76 code_setInactive: `Зробити пригоду неактивною`,
77 77 code_completed: `Завершено`,
78 78 code_active: `Активний`,
79 code_cosmeticUnenhancer: `Перегінник містифікаторів`,
79 80 code_pigment: `Барвник`,
80 81 code_bossNavCode: `Навкоордината Лефантиса`,
81 82 code_lawOfRetribution: `ЗАКОН ВІДПЛАТИ`,
Modified static/webui/translations/zh.js +1 -0