feat: handle QueuedDialogues in saveDialogue #1524
@ -21,7 +21,7 @@ export const saveDialogueController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
        if (!inventory.DialogueHistory) {
 | 
					        if (!inventory.DialogueHistory) {
 | 
				
			||||||
            throw new Error("bad inventory state");
 | 
					            throw new Error("bad inventory state");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (request.QueuedDialogues.length != 0 || request.OtherDialogueInfos.length != 0) {
 | 
					        if (request.OtherDialogueInfos.length != 0) {
 | 
				
			||||||
            logger.error(`saveDialogue request not fully handled: ${String(req.body)}`);
 | 
					            logger.error(`saveDialogue request not fully handled: ${String(req.body)}`);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        inventory.DialogueHistory.Dialogues ??= [];
 | 
					        inventory.DialogueHistory.Dialogues ??= [];
 | 
				
			||||||
@ -36,6 +36,7 @@ export const saveDialogueController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
                        AvailableGiftDate: new Date(0),
 | 
					                        AvailableGiftDate: new Date(0),
 | 
				
			||||||
                        RankUpExpiry: new Date(0),
 | 
					                        RankUpExpiry: new Date(0),
 | 
				
			||||||
                        BountyChemExpiry: new Date(0),
 | 
					                        BountyChemExpiry: new Date(0),
 | 
				
			||||||
 | 
					                        QueuedDialogues: [],
 | 
				
			||||||
                        Gifts: [],
 | 
					                        Gifts: [],
 | 
				
			||||||
                        Booleans: [],
 | 
					                        Booleans: [],
 | 
				
			||||||
                        Completed: [],
 | 
					                        Completed: [],
 | 
				
			||||||
@ -45,7 +46,7 @@ export const saveDialogueController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        dialogue.Rank = request.Rank;
 | 
					        dialogue.Rank = request.Rank;
 | 
				
			||||||
        dialogue.Chemistry = request.Chemistry;
 | 
					        dialogue.Chemistry = request.Chemistry;
 | 
				
			||||||
        //dialogue.QueuedDialogues = request.QueuedDialogues;
 | 
					        dialogue.QueuedDialogues = request.QueuedDialogues;
 | 
				
			||||||
        for (const bool of request.Booleans) {
 | 
					        for (const bool of request.Booleans) {
 | 
				
			||||||
            dialogue.Booleans.push(bool);
 | 
					            dialogue.Booleans.push(bool);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -77,7 +78,7 @@ interface SaveCompletedDialogueRequest {
 | 
				
			|||||||
    Rank: number;
 | 
					    Rank: number;
 | 
				
			||||||
    Chemistry: number;
 | 
					    Chemistry: number;
 | 
				
			||||||
    CompletionType: number;
 | 
					    CompletionType: number;
 | 
				
			||||||
    QueuedDialogues: string[]; // unsure
 | 
					    QueuedDialogues: string[];
 | 
				
			||||||
    Booleans: string[];
 | 
					    Booleans: string[];
 | 
				
			||||||
    ResetBooleans: string[];
 | 
					    ResetBooleans: string[];
 | 
				
			||||||
    Data: ICompletedDialogue;
 | 
					    Data: ICompletedDialogue;
 | 
				
			||||||
 | 
				
			|||||||
@ -773,7 +773,7 @@ const dialogueSchema = new Schema<IDialogueDatabase>(
 | 
				
			|||||||
        AvailableGiftDate: Date,
 | 
					        AvailableGiftDate: Date,
 | 
				
			||||||
        RankUpExpiry: Date,
 | 
					        RankUpExpiry: Date,
 | 
				
			||||||
        BountyChemExpiry: Date,
 | 
					        BountyChemExpiry: Date,
 | 
				
			||||||
        //QueuedDialogues: ???
 | 
					        QueuedDialogues: { type: [String], default: [] },
 | 
				
			||||||
        Gifts: { type: [dialogueGiftSchema], default: [] },
 | 
					        Gifts: { type: [dialogueGiftSchema], default: [] },
 | 
				
			||||||
        Booleans: { type: [String], default: [] },
 | 
					        Booleans: { type: [String], default: [] },
 | 
				
			||||||
        Completed: { type: [completedDialogueSchema], default: [] },
 | 
					        Completed: { type: [completedDialogueSchema], default: [] },
 | 
				
			||||||
 | 
				
			|||||||
@ -1089,7 +1089,7 @@ export interface IDialogueClient {
 | 
				
			|||||||
    AvailableGiftDate: IMongoDate;
 | 
					    AvailableGiftDate: IMongoDate;
 | 
				
			||||||
    RankUpExpiry: IMongoDate;
 | 
					    RankUpExpiry: IMongoDate;
 | 
				
			||||||
    BountyChemExpiry: IMongoDate;
 | 
					    BountyChemExpiry: IMongoDate;
 | 
				
			||||||
    //QueuedDialogues: any[];
 | 
					    QueuedDialogues: string[];
 | 
				
			||||||
    Gifts: IDialogueGift[];
 | 
					    Gifts: IDialogueGift[];
 | 
				
			||||||
    Booleans: string[];
 | 
					    Booleans: string[];
 | 
				
			||||||
    Completed: ICompletedDialogue[];
 | 
					    Completed: ICompletedDialogue[];
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user