feat: track KIM resets #1528
@ -7,6 +7,8 @@ export const clearDialogueHistoryController: RequestHandler = async (req, res) =
 | 
				
			|||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
    const request = JSON.parse(String(req.body)) as IClearDialogueRequest;
 | 
					    const request = JSON.parse(String(req.body)) as IClearDialogueRequest;
 | 
				
			||||||
    if (inventory.DialogueHistory && inventory.DialogueHistory.Dialogues) {
 | 
					    if (inventory.DialogueHistory && inventory.DialogueHistory.Dialogues) {
 | 
				
			||||||
 | 
					        inventory.DialogueHistory.Resets ??= 0;
 | 
				
			||||||
 | 
					        inventory.DialogueHistory.Resets += 1;
 | 
				
			||||||
        for (const dialogueName of request.Dialogues) {
 | 
					        for (const dialogueName of request.Dialogues) {
 | 
				
			||||||
            const index = inventory.DialogueHistory.Dialogues.findIndex(x => x.DialogueName == dialogueName);
 | 
					            const index = inventory.DialogueHistory.Dialogues.findIndex(x => x.DialogueName == dialogueName);
 | 
				
			||||||
            if (index != -1) {
 | 
					            if (index != -1) {
 | 
				
			||||||
 | 
				
			|||||||
@ -797,6 +797,7 @@ dialogueSchema.set("toJSON", {
 | 
				
			|||||||
const dialogueHistorySchema = new Schema<IDialogueHistoryDatabase>(
 | 
					const dialogueHistorySchema = new Schema<IDialogueHistoryDatabase>(
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        YearIteration: { type: Number, required: true },
 | 
					        YearIteration: { type: Number, required: true },
 | 
				
			||||||
 | 
					        Resets: Number,
 | 
				
			||||||
        Dialogues: { type: [dialogueSchema], required: false }
 | 
					        Dialogues: { type: [dialogueSchema], required: false }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    { _id: false }
 | 
					    { _id: false }
 | 
				
			||||||
 | 
				
			|||||||
@ -1074,11 +1074,13 @@ export interface IEndlessXpProgress {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export interface IDialogueHistoryClient {
 | 
					export interface IDialogueHistoryClient {
 | 
				
			||||||
    YearIteration: number;
 | 
					    YearIteration: number;
 | 
				
			||||||
 | 
					    Resets?: number; // added in 38.5.0
 | 
				
			||||||
    Dialogues?: IDialogueClient[];
 | 
					    Dialogues?: IDialogueClient[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IDialogueHistoryDatabase {
 | 
					export interface IDialogueHistoryDatabase {
 | 
				
			||||||
    YearIteration: number;
 | 
					    YearIteration: number;
 | 
				
			||||||
 | 
					    Resets?: number;
 | 
				
			||||||
    Dialogues?: IDialogueDatabase[];
 | 
					    Dialogues?: IDialogueDatabase[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user