feat: handle QueuedDialogues in saveDialogue (#1524)

Reviewed-on: OpenWF/SpaceNinjaServer#1524
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
Sainan 2025-04-09 15:30:59 -07:00 committed by Sainan
parent 02a4d2b30a
commit 74f9d1567f
3 changed files with 6 additions and 5 deletions

View File

@ -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;

View File

@ -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: [] },

View File

@ -1091,7 +1091,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[];