feat: acquisition of CrewShipWeapons
This commit is contained in:
parent
ead7b67efc
commit
cf62320857
@ -6,6 +6,7 @@ import {
|
||||
ExportDrones,
|
||||
ExportGear,
|
||||
ExportMisc,
|
||||
ExportRailjackWeapons,
|
||||
ExportRecipes,
|
||||
ExportRelics,
|
||||
ExportResources,
|
||||
@ -160,6 +161,12 @@ const getItemListsController: RequestHandler = (req, response) => {
|
||||
name: getString(item.name, lang)
|
||||
});
|
||||
}
|
||||
for (const [uniqueName, item] of Object.entries(ExportRailjackWeapons)) {
|
||||
res.miscitems.push({
|
||||
uniqueName: uniqueName,
|
||||
name: getString(item.name, lang)
|
||||
});
|
||||
}
|
||||
|
||||
res.mods = [];
|
||||
for (const [uniqueName, upgrade] of Object.entries(ExportUpgrades)) {
|
||||
|
@ -75,7 +75,8 @@ import {
|
||||
ICollectibleEntry,
|
||||
IIncentiveState,
|
||||
ISongChallenge,
|
||||
ILibraryPersonalProgress
|
||||
ILibraryPersonalProgress,
|
||||
ICrewShipWeaponDatabase
|
||||
} from "../../types/inventoryTypes/inventoryTypes";
|
||||
import { IOid } from "../../types/commonTypes";
|
||||
import {
|
||||
@ -1037,6 +1038,25 @@ const alignmentSchema = new Schema<IAlignment>(
|
||||
{ _id: false }
|
||||
);
|
||||
|
||||
const crewShipWeaponSchema2 = new Schema<ICrewShipWeaponDatabase>(
|
||||
{
|
||||
ItemType: String
|
||||
},
|
||||
{ id: false }
|
||||
);
|
||||
|
||||
crewShipWeaponSchema2.virtual("ItemId").get(function () {
|
||||
return { $oid: this._id.toString() } satisfies IOid;
|
||||
});
|
||||
|
||||
crewShipWeaponSchema2.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_document, returnedObject) {
|
||||
delete returnedObject._id;
|
||||
delete returnedObject.__v;
|
||||
}
|
||||
});
|
||||
|
||||
const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
||||
{
|
||||
accountOwnerId: Schema.Types.ObjectId,
|
||||
@ -1157,7 +1177,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
||||
|
||||
//Default RailJack
|
||||
CrewShipAmmo: [typeCountSchema],
|
||||
CrewShipWeapons: [Schema.Types.Mixed],
|
||||
CrewShipWeapons: [crewShipWeaponSchema2],
|
||||
CrewShipWeaponSkins: [upgradeSchema],
|
||||
|
||||
//NPC Crew and weapon
|
||||
@ -1404,6 +1424,7 @@ export type InventoryDocumentProps = {
|
||||
WeaponSkins: Types.DocumentArray<IWeaponSkinDatabase>;
|
||||
QuestKeys: Types.DocumentArray<IQuestKeyDatabase>;
|
||||
Drones: Types.DocumentArray<IDroneDatabase>;
|
||||
CrewShipWeapons: Types.DocumentArray<ICrewShipWeaponDatabase>;
|
||||
CrewShipWeaponSkins: Types.DocumentArray<IUpgradeDatabase>;
|
||||
} & { [K in TEquipmentKey]: Types.DocumentArray<IEquipmentDatabase> };
|
||||
|
||||
|
@ -26,7 +26,8 @@ import {
|
||||
ILibraryDailyTaskInfo,
|
||||
ICalendarProgress,
|
||||
IDroneClient,
|
||||
IUpgradeClient
|
||||
IUpgradeClient,
|
||||
ICrewShipWeaponClient
|
||||
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
import { IGenericUpdate } from "../types/genericUpdate";
|
||||
import {
|
||||
@ -54,6 +55,7 @@ import {
|
||||
ExportGear,
|
||||
ExportKeys,
|
||||
ExportMisc,
|
||||
ExportRailjackWeapons,
|
||||
ExportRecipes,
|
||||
ExportResources,
|
||||
ExportSentinels,
|
||||
@ -386,6 +388,12 @@ export const addItem = async (
|
||||
};
|
||||
}
|
||||
}
|
||||
if (typeName in ExportRailjackWeapons) {
|
||||
// I'm not sure if these use a slot. Maybe CrewShipSalvageBin?
|
||||
return {
|
||||
InventoryChanges: addCrewShipWeapon(inventory, typeName)
|
||||
};
|
||||
}
|
||||
if (typeName in ExportMisc.creditBundles) {
|
||||
const creditsTotal = ExportMisc.creditBundles[typeName] * quantity;
|
||||
inventory.RegularCredits += creditsTotal;
|
||||
@ -859,6 +867,7 @@ export const addCustomization = (
|
||||
inventoryChanges: IInventoryChanges = {}
|
||||
): IInventoryChanges => {
|
||||
const flavourItemIndex = inventory.FlavourItems.push({ ItemType: customizationName }) - 1;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
inventoryChanges.FlavourItems ??= [];
|
||||
(inventoryChanges.FlavourItems as IFlavourItem[]).push(
|
||||
inventory.FlavourItems[flavourItemIndex].toJSON<IFlavourItem>()
|
||||
@ -872,6 +881,7 @@ export const addSkin = (
|
||||
inventoryChanges: IInventoryChanges = {}
|
||||
): IInventoryChanges => {
|
||||
const index = inventory.WeaponSkins.push({ ItemType: typeName }) - 1;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
inventoryChanges.WeaponSkins ??= [];
|
||||
(inventoryChanges.WeaponSkins as IWeaponSkinClient[]).push(
|
||||
inventory.WeaponSkins[index].toJSON<IWeaponSkinClient>()
|
||||
@ -879,12 +889,27 @@ export const addSkin = (
|
||||
return inventoryChanges;
|
||||
};
|
||||
|
||||
const addCrewShipWeapon = (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
typeName: string,
|
||||
inventoryChanges: IInventoryChanges = {}
|
||||
): IInventoryChanges => {
|
||||
const index = inventory.CrewShipWeapons.push({ ItemType: typeName, _id: new Types.ObjectId() }) - 1;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
inventoryChanges.CrewShipWeapons ??= [];
|
||||
(inventoryChanges.CrewShipWeapons as ICrewShipWeaponClient[]).push(
|
||||
inventory.CrewShipWeapons[index].toJSON<ICrewShipWeaponClient>()
|
||||
);
|
||||
return inventoryChanges;
|
||||
};
|
||||
|
||||
const addCrewShipWeaponSkin = (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
typeName: string,
|
||||
inventoryChanges: IInventoryChanges = {}
|
||||
): IInventoryChanges => {
|
||||
const index = inventory.CrewShipWeaponSkins.push({ ItemType: typeName }) - 1;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
inventoryChanges.CrewShipWeaponSkins ??= [];
|
||||
(inventoryChanges.CrewShipWeaponSkins as IUpgradeClient[]).push(
|
||||
inventory.CrewShipWeaponSkins[index].toJSON<IUpgradeClient>()
|
||||
|
@ -31,6 +31,7 @@ export interface IInventoryDatabase
|
||||
| "WeaponSkins"
|
||||
| "Upgrades"
|
||||
| "CrewShipSalvagedWeaponSkins"
|
||||
| "CrewShipWeapons"
|
||||
| "CrewShipWeaponSkins"
|
||||
| "AdultOperatorLoadOuts"
|
||||
| "OperatorLoadOuts"
|
||||
@ -56,6 +57,7 @@ export interface IInventoryDatabase
|
||||
WeaponSkins: IWeaponSkinDatabase[];
|
||||
Upgrades: IUpgradeDatabase[];
|
||||
CrewShipSalvagedWeaponSkins: IUpgradeDatabase[];
|
||||
CrewShipWeapons: ICrewShipWeaponDatabase[];
|
||||
CrewShipWeaponSkins: IUpgradeDatabase[];
|
||||
AdultOperatorLoadOuts: IOperatorConfigDatabase[];
|
||||
OperatorLoadOuts: IOperatorConfigDatabase[];
|
||||
@ -289,8 +291,8 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
|
||||
PlayerSkills: IPlayerSkills;
|
||||
CrewShipAmmo: IConsumable[];
|
||||
CrewShipSalvagedWeaponSkins: IUpgradeClient[];
|
||||
CrewShipWeapons: ICrewShipWeapon[];
|
||||
CrewShipSalvagedWeapons: ICrewShipWeapon[];
|
||||
CrewShipWeapons: ICrewShipWeaponClient[];
|
||||
CrewShipSalvagedWeapons: IEquipmentClient[];
|
||||
CrewShipWeaponSkins: IUpgradeClient[];
|
||||
TradeBannedUntil?: IMongoDate;
|
||||
PlayedParkourTutorial: boolean;
|
||||
@ -489,11 +491,23 @@ export interface IFlavourItem {
|
||||
|
||||
export type IMiscItem = ITypeCount;
|
||||
|
||||
// inventory.CrewShips[0].Weapon
|
||||
export interface ICrewShipWeapon {
|
||||
PILOT: ICrewShipPilotWeapon;
|
||||
PORT_GUNS: ICrewShipPortGuns;
|
||||
}
|
||||
|
||||
// inventory.CrewShipWeapons
|
||||
export interface ICrewShipWeaponClient {
|
||||
ItemType: string;
|
||||
ItemId: IOid;
|
||||
}
|
||||
|
||||
export interface ICrewShipWeaponDatabase {
|
||||
ItemType: string;
|
||||
_id: Types.ObjectId;
|
||||
}
|
||||
|
||||
export interface ICrewShipPilotWeapon {
|
||||
PRIMARY_A: IEquipmentSelection;
|
||||
SECONDARY_A: IEquipmentSelection;
|
||||
|
Loading…
x
Reference in New Issue
Block a user