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",
 | 
			
		||||
        "express": "^5",
 | 
			
		||||
        "mongoose": "^8.9.4",
 | 
			
		||||
        "warframe-public-export-plus": "^0.5.36",
 | 
			
		||||
        "warframe-public-export-plus": "^0.5.37",
 | 
			
		||||
        "warframe-riven-info": "^0.1.2",
 | 
			
		||||
        "winston": "^3.17.0",
 | 
			
		||||
        "winston-daily-rotate-file": "^5.0.0"
 | 
			
		||||
@ -4093,9 +4093,9 @@
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/warframe-public-export-plus": {
 | 
			
		||||
      "version": "0.5.36",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.36.tgz",
 | 
			
		||||
      "integrity": "sha512-FYZECqBSnynl6lQvcQyEqpnGW9l84wzusekhtwKjvg3280CYdn7g5x0Q9tOMhj1jpc/1tuY+akHtHa94sPtqKw=="
 | 
			
		||||
      "version": "0.5.37",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.37.tgz",
 | 
			
		||||
      "integrity": "sha512-atpTQ0IV0HF17rO2+Z+Vdv8nnnUxh5HhkcXBjc5iwY8tlvRgRWwHemq4PdA1bxR4tYFU5xoYjlgDe5D8ZfM4ew=="
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/warframe-riven-info": {
 | 
			
		||||
      "version": "0.1.2",
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,7 @@
 | 
			
		||||
    "copyfiles": "^2.4.1",
 | 
			
		||||
    "express": "^5",
 | 
			
		||||
    "mongoose": "^8.9.4",
 | 
			
		||||
    "warframe-public-export-plus": "^0.5.36",
 | 
			
		||||
    "warframe-public-export-plus": "^0.5.37",
 | 
			
		||||
    "warframe-riven-info": "^0.1.2",
 | 
			
		||||
    "winston": "^3.17.0",
 | 
			
		||||
    "winston-daily-rotate-file": "^5.0.0"
 | 
			
		||||
 | 
			
		||||
@ -1084,7 +1084,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
			
		||||
        //Default RailJack
 | 
			
		||||
        CrewShipAmmo: [typeCountSchema],
 | 
			
		||||
        CrewShipWeapons: [Schema.Types.Mixed],
 | 
			
		||||
        CrewShipWeaponSkins: [Schema.Types.Mixed],
 | 
			
		||||
        CrewShipWeaponSkins: [upgradeSchema],
 | 
			
		||||
 | 
			
		||||
        //NPC Crew and weapon
 | 
			
		||||
        CrewMembers: [Schema.Types.Mixed],
 | 
			
		||||
@ -1323,6 +1323,7 @@ export type InventoryDocumentProps = {
 | 
			
		||||
    WeaponSkins: Types.DocumentArray<IWeaponSkinDatabase>;
 | 
			
		||||
    QuestKeys: Types.DocumentArray<IQuestKeyDatabase>;
 | 
			
		||||
    Drones: Types.DocumentArray<IDroneDatabase>;
 | 
			
		||||
    CrewShipWeaponSkins: Types.DocumentArray<IUpgradeDatabase>;
 | 
			
		||||
} & { [K in TEquipmentKey]: Types.DocumentArray<IEquipmentDatabase> };
 | 
			
		||||
 | 
			
		||||
// eslint-disable-next-line @typescript-eslint/ban-types
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,8 @@ import {
 | 
			
		||||
    IKubrowPetEggClient,
 | 
			
		||||
    ILibraryAvailableDailyTaskInfo,
 | 
			
		||||
    ICalendarProgress,
 | 
			
		||||
    IDroneClient
 | 
			
		||||
    IDroneClient,
 | 
			
		||||
    IUpgradeClient
 | 
			
		||||
} from "@/src/types/inventoryTypes/inventoryTypes";
 | 
			
		||||
import { IGenericUpdate } from "../types/genericUpdate";
 | 
			
		||||
import {
 | 
			
		||||
@ -254,8 +255,11 @@ export const addItem = async (
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    if (typeName in ExportCustoms) {
 | 
			
		||||
        const inventoryChanges = addSkin(inventory, typeName);
 | 
			
		||||
        return { InventoryChanges: inventoryChanges };
 | 
			
		||||
        if (ExportCustoms[typeName].productCategory == "CrewShipWeaponSkins") {
 | 
			
		||||
            return { InventoryChanges: addCrewShipWeaponSkin(inventory, typeName) };
 | 
			
		||||
        } else {
 | 
			
		||||
            return { InventoryChanges: addSkin(inventory, typeName) };
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    if (typeName in ExportFlavour) {
 | 
			
		||||
        const inventoryChanges = addCustomization(inventory, typeName);
 | 
			
		||||
@ -812,6 +816,19 @@ export const addSkin = (
 | 
			
		||||
    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 = (
 | 
			
		||||
    inventory: TInventoryDatabaseDocument,
 | 
			
		||||
    typeName: string,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user