fix: acquisition of CrewShipWeaponSkins (#1019)
Reviewed-on: OpenWF/SpaceNinjaServer#1019 Co-authored-by: Sainan <sainan@calamity.inc> Co-committed-by: Sainan <sainan@calamity.inc>
This commit is contained in:
		
							parent
							
								
									2b8da4af60
								
							
						
					
					
						commit
						d7628d46e9
					
				
							
								
								
									
										8
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -12,7 +12,7 @@
 | 
				
			|||||||
        "copyfiles": "^2.4.1",
 | 
					        "copyfiles": "^2.4.1",
 | 
				
			||||||
        "express": "^5",
 | 
					        "express": "^5",
 | 
				
			||||||
        "mongoose": "^8.9.4",
 | 
					        "mongoose": "^8.9.4",
 | 
				
			||||||
        "warframe-public-export-plus": "^0.5.36",
 | 
					        "warframe-public-export-plus": "^0.5.37",
 | 
				
			||||||
        "warframe-riven-info": "^0.1.2",
 | 
					        "warframe-riven-info": "^0.1.2",
 | 
				
			||||||
        "winston": "^3.17.0",
 | 
					        "winston": "^3.17.0",
 | 
				
			||||||
        "winston-daily-rotate-file": "^5.0.0"
 | 
					        "winston-daily-rotate-file": "^5.0.0"
 | 
				
			||||||
@ -4093,9 +4093,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/warframe-public-export-plus": {
 | 
					    "node_modules/warframe-public-export-plus": {
 | 
				
			||||||
      "version": "0.5.36",
 | 
					      "version": "0.5.37",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.36.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.37.tgz",
 | 
				
			||||||
      "integrity": "sha512-FYZECqBSnynl6lQvcQyEqpnGW9l84wzusekhtwKjvg3280CYdn7g5x0Q9tOMhj1jpc/1tuY+akHtHa94sPtqKw=="
 | 
					      "integrity": "sha512-atpTQ0IV0HF17rO2+Z+Vdv8nnnUxh5HhkcXBjc5iwY8tlvRgRWwHemq4PdA1bxR4tYFU5xoYjlgDe5D8ZfM4ew=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/warframe-riven-info": {
 | 
					    "node_modules/warframe-riven-info": {
 | 
				
			||||||
      "version": "0.1.2",
 | 
					      "version": "0.1.2",
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,7 @@
 | 
				
			|||||||
    "copyfiles": "^2.4.1",
 | 
					    "copyfiles": "^2.4.1",
 | 
				
			||||||
    "express": "^5",
 | 
					    "express": "^5",
 | 
				
			||||||
    "mongoose": "^8.9.4",
 | 
					    "mongoose": "^8.9.4",
 | 
				
			||||||
    "warframe-public-export-plus": "^0.5.36",
 | 
					    "warframe-public-export-plus": "^0.5.37",
 | 
				
			||||||
    "warframe-riven-info": "^0.1.2",
 | 
					    "warframe-riven-info": "^0.1.2",
 | 
				
			||||||
    "winston": "^3.17.0",
 | 
					    "winston": "^3.17.0",
 | 
				
			||||||
    "winston-daily-rotate-file": "^5.0.0"
 | 
					    "winston-daily-rotate-file": "^5.0.0"
 | 
				
			||||||
 | 
				
			|||||||
@ -1084,7 +1084,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
				
			|||||||
        //Default RailJack
 | 
					        //Default RailJack
 | 
				
			||||||
        CrewShipAmmo: [typeCountSchema],
 | 
					        CrewShipAmmo: [typeCountSchema],
 | 
				
			||||||
        CrewShipWeapons: [Schema.Types.Mixed],
 | 
					        CrewShipWeapons: [Schema.Types.Mixed],
 | 
				
			||||||
        CrewShipWeaponSkins: [Schema.Types.Mixed],
 | 
					        CrewShipWeaponSkins: [upgradeSchema],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //NPC Crew and weapon
 | 
					        //NPC Crew and weapon
 | 
				
			||||||
        CrewMembers: [Schema.Types.Mixed],
 | 
					        CrewMembers: [Schema.Types.Mixed],
 | 
				
			||||||
@ -1323,6 +1323,7 @@ export type InventoryDocumentProps = {
 | 
				
			|||||||
    WeaponSkins: Types.DocumentArray<IWeaponSkinDatabase>;
 | 
					    WeaponSkins: Types.DocumentArray<IWeaponSkinDatabase>;
 | 
				
			||||||
    QuestKeys: Types.DocumentArray<IQuestKeyDatabase>;
 | 
					    QuestKeys: Types.DocumentArray<IQuestKeyDatabase>;
 | 
				
			||||||
    Drones: Types.DocumentArray<IDroneDatabase>;
 | 
					    Drones: Types.DocumentArray<IDroneDatabase>;
 | 
				
			||||||
 | 
					    CrewShipWeaponSkins: Types.DocumentArray<IUpgradeDatabase>;
 | 
				
			||||||
} & { [K in TEquipmentKey]: Types.DocumentArray<IEquipmentDatabase> };
 | 
					} & { [K in TEquipmentKey]: Types.DocumentArray<IEquipmentDatabase> };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/ban-types
 | 
					// eslint-disable-next-line @typescript-eslint/ban-types
 | 
				
			||||||
 | 
				
			|||||||
@ -25,7 +25,8 @@ import {
 | 
				
			|||||||
    IKubrowPetEggClient,
 | 
					    IKubrowPetEggClient,
 | 
				
			||||||
    ILibraryAvailableDailyTaskInfo,
 | 
					    ILibraryAvailableDailyTaskInfo,
 | 
				
			||||||
    ICalendarProgress,
 | 
					    ICalendarProgress,
 | 
				
			||||||
    IDroneClient
 | 
					    IDroneClient,
 | 
				
			||||||
 | 
					    IUpgradeClient
 | 
				
			||||||
} from "@/src/types/inventoryTypes/inventoryTypes";
 | 
					} from "@/src/types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
import { IGenericUpdate } from "../types/genericUpdate";
 | 
					import { IGenericUpdate } from "../types/genericUpdate";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
@ -254,8 +255,11 @@ export const addItem = async (
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (typeName in ExportCustoms) {
 | 
					    if (typeName in ExportCustoms) {
 | 
				
			||||||
        const inventoryChanges = addSkin(inventory, typeName);
 | 
					        if (ExportCustoms[typeName].productCategory == "CrewShipWeaponSkins") {
 | 
				
			||||||
        return { InventoryChanges: inventoryChanges };
 | 
					            return { InventoryChanges: addCrewShipWeaponSkin(inventory, typeName) };
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return { InventoryChanges: addSkin(inventory, typeName) };
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (typeName in ExportFlavour) {
 | 
					    if (typeName in ExportFlavour) {
 | 
				
			||||||
        const inventoryChanges = addCustomization(inventory, typeName);
 | 
					        const inventoryChanges = addCustomization(inventory, typeName);
 | 
				
			||||||
@ -812,6 +816,19 @@ export const addSkin = (
 | 
				
			|||||||
    return inventoryChanges;
 | 
					    return inventoryChanges;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const addCrewShipWeaponSkin = (
 | 
				
			||||||
 | 
					    inventory: TInventoryDatabaseDocument,
 | 
				
			||||||
 | 
					    typeName: string,
 | 
				
			||||||
 | 
					    inventoryChanges: IInventoryChanges = {}
 | 
				
			||||||
 | 
					): IInventoryChanges => {
 | 
				
			||||||
 | 
					    const index = inventory.CrewShipWeaponSkins.push({ ItemType: typeName }) - 1;
 | 
				
			||||||
 | 
					    inventoryChanges.CrewShipWeaponSkins ??= [];
 | 
				
			||||||
 | 
					    (inventoryChanges.CrewShipWeaponSkins as IUpgradeClient[]).push(
 | 
				
			||||||
 | 
					        inventory.CrewShipWeaponSkins[index].toJSON<IUpgradeClient>()
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					    return inventoryChanges;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const addCrewShip = (
 | 
					const addCrewShip = (
 | 
				
			||||||
    inventory: TInventoryDatabaseDocument,
 | 
					    inventory: TInventoryDatabaseDocument,
 | 
				
			||||||
    typeName: string,
 | 
					    typeName: string,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user