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

fix: acquisition of CrewShipWeaponSkins (#1019)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1019 Co-authored-by: Sainan <sainan@calamity.inc> Co-committed-by: Sainan <sainan@calamity.inc>

d7628d46
Sainan <sainan@calamity.inc>
提交于

代码差异

4 个文件 +27 -9
Modified package-lock.json +4 -4
@@ -12,7 +12,7 @@
12 12 "copyfiles": "^2.4.1",
13 13 "express": "^5",
14 14 "mongoose": "^8.9.4",
15 "warframe-public-export-plus": "^0.5.36",
15 "warframe-public-export-plus": "^0.5.37",
16 16 "warframe-riven-info": "^0.1.2",
17 17 "winston": "^3.17.0",
18 18 "winston-daily-rotate-file": "^5.0.0"
@@ -4093,9 +4093,9 @@
4093 4093 }
4094 4094 },
4095 4095 "node_modules/warframe-public-export-plus": {
4096 "version": "0.5.36",
4097 "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.36.tgz",
4098 "integrity": "sha512-FYZECqBSnynl6lQvcQyEqpnGW9l84wzusekhtwKjvg3280CYdn7g5x0Q9tOMhj1jpc/1tuY+akHtHa94sPtqKw=="
4096 "version": "0.5.37",
4097 "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.37.tgz",
4098 "integrity": "sha512-atpTQ0IV0HF17rO2+Z+Vdv8nnnUxh5HhkcXBjc5iwY8tlvRgRWwHemq4PdA1bxR4tYFU5xoYjlgDe5D8ZfM4ew=="
4099 4099 },
4100 4100 "node_modules/warframe-riven-info": {
4101 4101 "version": "0.1.2",
Modified package.json +1 -1
@@ -17,7 +17,7 @@
17 17 "copyfiles": "^2.4.1",
18 18 "express": "^5",
19 19 "mongoose": "^8.9.4",
20 "warframe-public-export-plus": "^0.5.36",
20 "warframe-public-export-plus": "^0.5.37",
21 21 "warframe-riven-info": "^0.1.2",
22 22 "winston": "^3.17.0",
23 23 "winston-daily-rotate-file": "^5.0.0"
Modified src/models/inventoryModels/inventoryModel.ts +2 -1
@@ -1084,7 +1084,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1084 1084 //Default RailJack
1085 1085 CrewShipAmmo: [typeCountSchema],
1086 1086 CrewShipWeapons: [Schema.Types.Mixed],
1087 CrewShipWeaponSkins: [Schema.Types.Mixed],
1087 CrewShipWeaponSkins: [upgradeSchema],
1088 1088
1089 1089 //NPC Crew and weapon
1090 1090 CrewMembers: [Schema.Types.Mixed],
@@ -1323,6 +1323,7 @@ export type InventoryDocumentProps = {
1323 1323 WeaponSkins: Types.DocumentArray<IWeaponSkinDatabase>;
1324 1324 QuestKeys: Types.DocumentArray<IQuestKeyDatabase>;
1325 1325 Drones: Types.DocumentArray<IDroneDatabase>;
1326 CrewShipWeaponSkins: Types.DocumentArray<IUpgradeDatabase>;
1326 1327 } & { [K in TEquipmentKey]: Types.DocumentArray<IEquipmentDatabase> };
1327 1328
1328 1329 // eslint-disable-next-line @typescript-eslint/ban-types
Modified src/services/inventoryService.ts +20 -3
@@ -25,7 +25,8 @@ import {
25 25 IKubrowPetEggClient,
26 26 ILibraryAvailableDailyTaskInfo,
27 27 ICalendarProgress,
28 IDroneClient
28 IDroneClient,
29 IUpgradeClient
29 30 } from "@/src/types/inventoryTypes/inventoryTypes";
30 31 import { IGenericUpdate } from "../types/genericUpdate";
31 32 import {
@@ -254,8 +255,11 @@ export const addItem = async (
254 255 }
255 256 }
256 257 if (typeName in ExportCustoms) {
257 const inventoryChanges = addSkin(inventory, typeName);
258 return { InventoryChanges: inventoryChanges };
258 if (ExportCustoms[typeName].productCategory == "CrewShipWeaponSkins") {
259 return { InventoryChanges: addCrewShipWeaponSkin(inventory, typeName) };
260 } else {
261 return { InventoryChanges: addSkin(inventory, typeName) };
262 }
259 263 }
260 264 if (typeName in ExportFlavour) {
261 265 const inventoryChanges = addCustomization(inventory, typeName);
@@ -812,6 +816,19 @@ export const addSkin = (
812 816 return inventoryChanges;
813 817 };
814 818
819 const addCrewShipWeaponSkin = (
820 inventory: TInventoryDatabaseDocument,
821 typeName: string,
822 inventoryChanges: IInventoryChanges = {}
823 ): IInventoryChanges => {
824 const index = inventory.CrewShipWeaponSkins.push({ ItemType: typeName }) - 1;
825 inventoryChanges.CrewShipWeaponSkins ??= [];
826 (inventoryChanges.CrewShipWeaponSkins as IUpgradeClient[]).push(
827 inventory.CrewShipWeaponSkins[index].toJSON<IUpgradeClient>()
828 );
829 return inventoryChanges;
830 };
831
815 832 const addCrewShip = (
816 833 inventory: TInventoryDatabaseDocument,
817 834 typeName: string,