feat: zanuka capture #1416

Merged
Sainan merged 3 commits from zanuka into main 2025-04-01 02:29:30 -07:00
4 changed files with 85 additions and 4 deletions

View File

@ -83,7 +83,8 @@ import {
INemesisClient, INemesisClient,
IInfNode, IInfNode,
IDiscoveredMarker, IDiscoveredMarker,
IWeeklyMission IWeeklyMission,
ILockedWeaponGroupDatabase
} from "../../types/inventoryTypes/inventoryTypes"; } from "../../types/inventoryTypes/inventoryTypes";
import { IOid } from "../../types/commonTypes"; import { IOid } from "../../types/commonTypes";
import { import {
@ -1147,6 +1148,17 @@ const alignmentSchema = new Schema<IAlignment>(
{ _id: false } { _id: false }
); );
const lockedWeaponGroupSchema = new Schema<ILockedWeaponGroupDatabase>(
{
s: Schema.Types.ObjectId,
p: Schema.Types.ObjectId,
l: Schema.Types.ObjectId,
m: Schema.Types.ObjectId,
sn: Schema.Types.ObjectId
},
{ _id: false }
);
const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>( const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
{ {
accountOwnerId: Schema.Types.ObjectId, accountOwnerId: Schema.Types.ObjectId,
@ -1488,7 +1500,9 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
EchoesHexConquestActiveFrameVariants: { type: [String], default: undefined }, EchoesHexConquestActiveFrameVariants: { type: [String], default: undefined },
EchoesHexConquestActiveStickers: { type: [String], default: undefined }, EchoesHexConquestActiveStickers: { type: [String], default: undefined },
BrandedSuits: { type: [Schema.Types.ObjectId], default: undefined } // G3 + Zanuka
BrandedSuits: { type: [Schema.Types.ObjectId], default: undefined },
LockedWeaponGroup: { type: lockedWeaponGroupSchema, default: undefined }
}, },
{ timestamps: { createdAt: "Created", updatedAt: false } } { timestamps: { createdAt: "Created", updatedAt: false } }
); );
@ -1523,6 +1537,15 @@ inventorySchema.set("toJSON", {
if (inventoryDatabase.BrandedSuits) { if (inventoryDatabase.BrandedSuits) {
inventoryResponse.BrandedSuits = inventoryDatabase.BrandedSuits.map(toOid); inventoryResponse.BrandedSuits = inventoryDatabase.BrandedSuits.map(toOid);
} }
if (inventoryDatabase.LockedWeaponGroup) {
inventoryResponse.LockedWeaponGroup = {
s: toOid(inventoryDatabase.LockedWeaponGroup.s),
l: inventoryDatabase.LockedWeaponGroup.l ? toOid(inventoryDatabase.LockedWeaponGroup.l) : undefined,
p: inventoryDatabase.LockedWeaponGroup.p ? toOid(inventoryDatabase.LockedWeaponGroup.p) : undefined,
m: inventoryDatabase.LockedWeaponGroup.m ? toOid(inventoryDatabase.LockedWeaponGroup.m) : undefined,
sn: inventoryDatabase.LockedWeaponGroup.sn ? toOid(inventoryDatabase.LockedWeaponGroup.sn) : undefined
};
}
} }
}); });

View File

@ -47,6 +47,7 @@ import kuriaMessage100 from "@/static/fixed_responses/kuriaMessages/oneHundredPe
import conservationAnimals from "@/static/fixed_responses/conservationAnimals.json"; import conservationAnimals from "@/static/fixed_responses/conservationAnimals.json";
import { getInfNodes } from "@/src/helpers/nemesisHelpers"; import { getInfNodes } from "@/src/helpers/nemesisHelpers";
import { Loadout } from "../models/inventoryModels/loadoutModel"; import { Loadout } from "../models/inventoryModels/loadoutModel";
import { ILoadoutConfigDatabase } from "../types/saveLoadoutTypes";
const getRotations = (rotationCount: number): number[] => { const getRotations = (rotationCount: number): number[] => {
if (rotationCount === 0) return [0]; if (rotationCount === 0) return [0];
@ -95,7 +96,8 @@ export const addMissionInventoryUpdates = async (
inventoryUpdates.MissionFailed && inventoryUpdates.MissionFailed &&
inventoryUpdates.MissionStatus == "GS_FAILURE" && inventoryUpdates.MissionStatus == "GS_FAILURE" &&
inventoryUpdates.EndOfMatchUpload && inventoryUpdates.EndOfMatchUpload &&
inventoryUpdates.ObjectiveReached inventoryUpdates.ObjectiveReached &&
!inventoryUpdates.LockedWeaponGroup
) { ) {
const loadout = (await Loadout.findById(inventory.LoadOutPresets, "NORMAL"))!; const loadout = (await Loadout.findById(inventory.LoadOutPresets, "NORMAL"))!;
const config = loadout.NORMAL.id(inventory.CurrentLoadOutIds[0].$oid)!; const config = loadout.NORMAL.id(inventory.CurrentLoadOutIds[0].$oid)!;
@ -397,6 +399,35 @@ export const addMissionInventoryUpdates = async (
} }
break; break;
} }
case "LockedWeaponGroup": {
inventory.LockedWeaponGroup = {
s: new Types.ObjectId(value.s.$oid),
l: value.l ? new Types.ObjectId(value.l.$oid) : undefined,
p: value.p ? new Types.ObjectId(value.p.$oid) : undefined,
m: value.m ? new Types.ObjectId(value.m.$oid) : undefined,
sn: value.sn ? new Types.ObjectId(value.sn.$oid) : undefined
};
break;
}
case "UnlockWeapons": {
inventory.LockedWeaponGroup = undefined;
break;
}
case "CurrentLoadOutIds": {
const loadout = await Loadout.findOne({ loadoutOwnerId: inventory.accountOwnerId });
if (loadout) {
for (const [loadoutId, loadoutConfig] of Object.entries(value.LoadOuts.NORMAL)) {
const { ItemId, ...loadoutConfigItemIdRemoved } = loadoutConfig;
const loadoutConfigDatabase: ILoadoutConfigDatabase = {
_id: new Types.ObjectId(ItemId.$oid),
...loadoutConfigItemIdRemoved
};
loadout.NORMAL.id(loadoutId)!.overwrite(loadoutConfigDatabase);
}
await loadout.save();
}
break;
}
default: default:
// Equipment XP updates // Equipment XP updates
if (equipmentKeys.includes(key as TEquipmentKey)) { if (equipmentKeys.includes(key as TEquipmentKey)) {

View File

@ -45,6 +45,7 @@ export interface IInventoryDatabase
| "Nemesis" | "Nemesis"
| "EntratiVaultCountResetDate" | "EntratiVaultCountResetDate"
| "BrandedSuits" | "BrandedSuits"
| "LockedWeaponGroup"
| TEquipmentKey | TEquipmentKey
>, >,
InventoryDatabaseEquipment { InventoryDatabaseEquipment {
@ -75,6 +76,7 @@ export interface IInventoryDatabase
Nemesis?: INemesisDatabase; Nemesis?: INemesisDatabase;
EntratiVaultCountResetDate?: Date; EntratiVaultCountResetDate?: Date;
BrandedSuits?: Types.ObjectId[]; BrandedSuits?: Types.ObjectId[];
LockedWeaponGroup?: ILockedWeaponGroupDatabase;
} }
export interface IQuestKeyDatabase { export interface IQuestKeyDatabase {
@ -349,6 +351,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
EchoesHexConquestActiveFrameVariants?: string[]; EchoesHexConquestActiveFrameVariants?: string[];
EchoesHexConquestActiveStickers?: string[]; EchoesHexConquestActiveStickers?: string[];
BrandedSuits?: IOid[]; BrandedSuits?: IOid[];
LockedWeaponGroup?: ILockedWeaponGroupClient;
} }
export interface IAffiliation { export interface IAffiliation {
@ -1149,3 +1152,19 @@ export interface ISongChallenge {
Song: string; Song: string;
Difficulties: number[]; Difficulties: number[];
} }
export interface ILockedWeaponGroupClient {
s: IOid;
p?: IOid;
l?: IOid;
m?: IOid;
sn?: IOid;
}
export interface ILockedWeaponGroupDatabase {
s: Types.ObjectId;
p?: Types.ObjectId;
l?: Types.ObjectId;
m?: Types.ObjectId;
sn?: Types.ObjectId;
}

View File

@ -17,7 +17,9 @@ import {
ILoreFragmentScan, ILoreFragmentScan,
IUpgradeClient, IUpgradeClient,
ICollectibleEntry, ICollectibleEntry,
IDiscoveredMarker IDiscoveredMarker,
ILockedWeaponGroupClient,
ILoadOutPresets
} from "./inventoryTypes/inventoryTypes"; } from "./inventoryTypes/inventoryTypes";
export interface IAffiliationChange { export interface IAffiliationChange {
@ -108,6 +110,12 @@ export type IMissionInventoryUpdateRequest = {
Count: number; Count: number;
}[]; }[];
DiscoveredMarkers?: IDiscoveredMarker[]; DiscoveredMarkers?: IDiscoveredMarker[];
LockedWeaponGroup?: ILockedWeaponGroupClient; // sent when captured by zanuka
UnlockWeapons?: boolean; // sent when recovered weapons from zanuka capture
IncHarvester?: boolean; // sent when recovered weapons from zanuka capture
CurrentLoadOutIds?: {
LoadOuts: ILoadOutPresets; // sent when recovered weapons from zanuka capture
};
} & { } & {
[K in TEquipmentKey]?: IEquipmentClient[]; [K in TEquipmentKey]?: IEquipmentClient[];
}; };