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