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 { IMongoDate } from "../types/commonTypes";
import { import {
equipmentKeys, equipmentKeys,
IDialogueClient,
IDialogueDatabase,
IDialogueHistoryClient,
IDialogueHistoryDatabase,
IInfestedFoundryClient, IInfestedFoundryClient,
IInfestedFoundryDatabase, IInfestedFoundryDatabase,
IInventoryClient, 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 => { export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
for (const key of equipmentKeys) { for (const key of equipmentKeys) {
if (client[key]) { if (client[key]) {
@ -150,6 +171,9 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
if (client.InfestedFoundry) { if (client.InfestedFoundry) {
db.InfestedFoundry = convertInfestedFoundry(client.InfestedFoundry); db.InfestedFoundry = convertInfestedFoundry(client.InfestedFoundry);
} }
if (client.DialogueHistory) {
db.DialogueHistory = convertDialogueHistory(client.DialogueHistory);
}
}; };
const convertLoadOutConfig = (client: ILoadoutConfigClient): ILoadoutConfigDatabase => { const convertLoadOutConfig = (client: ILoadoutConfigClient): ILoadoutConfigDatabase => {

View File

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