import DialogueHistory

This commit is contained in:
Sainan 2025-01-20 08:32:39 +01:00
parent eb039fe969
commit 58156b0457
2 changed files with 27 additions and 1 deletions

View File

@ -8,6 +8,10 @@ import {
import { IMongoDate } from "../types/commonTypes";
import {
equipmentKeys,
IDialogueClient,
IDialogueDatabase,
IDialogueHistoryClient,
IDialogueHistoryDatabase,
IInfestedFoundryClient,
IInfestedFoundryDatabase,
IInventoryClient,
@ -85,6 +89,23 @@ const convertInfestedFoundry = (client: IInfestedFoundryClient): IInfestedFoundr
};
};
const convertDialogue = (client: IDialogueClient): IDialogueDatabase => {
return {
...client,
AvailableDate: convertDate(client.AvailableDate),
AvailableGiftDate: convertDate(client.AvailableGiftDate),
RankUpExpiry: convertDate(client.RankUpExpiry),
BountyChemExpiry: convertDate(client.BountyChemExpiry)
};
};
const convertDialogueHistory = (client: IDialogueHistoryClient): IDialogueHistoryDatabase => {
return {
YearIteration: client.YearIteration,
Dialogues: client.Dialogues ? client.Dialogues.map(convertDialogue) : undefined
};
};
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
for (const key of equipmentKeys) {
if (client[key]) {
@ -150,6 +171,9 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
if (client.InfestedFoundry) {
db.InfestedFoundry = convertInfestedFoundry(client.InfestedFoundry);
}
if (client.DialogueHistory) {
db.DialogueHistory = convertDialogueHistory(client.DialogueHistory);
}
};
const convertLoadOutConfig = (client: ILoadoutConfigClient): ILoadoutConfigDatabase => {

View File

@ -31,6 +31,7 @@ export interface IInventoryDatabase
| "OperatorLoadOuts"
| "AdultOperatorLoadOuts"
| "InfestedFoundry"
| "DialogueHistory"
| TEquipmentKey
> {
accountOwnerId: Types.ObjectId;
@ -50,6 +51,7 @@ export interface IInventoryDatabase
OperatorLoadOuts: IOperatorConfigDatabase[];
AdultOperatorLoadOuts: IOperatorConfigDatabase[];
InfestedFoundry?: IInfestedFoundryDatabase;
DialogueHistory?: IDialogueHistoryDatabase;
Suits: IEquipmentDatabase[];
LongGuns: IEquipmentDatabase[];
@ -334,7 +336,7 @@ export interface IInventoryClient extends IDailyAffiliations {
Harvestable: boolean;
DeathSquadable: boolean;
EndlessXP?: IEndlessXpProgress[];
DialogueHistory?: IDialogueHistoryDatabase;
DialogueHistory?: IDialogueHistoryClient;
}
export interface IAffiliation {