From 360a59a585ac218e1c841be9701f1236f4f4226a Mon Sep 17 00:00:00 2001 From: CWX Date: Sun, 1 Jun 2025 23:43:50 +0100 Subject: [PATCH] only return dialogues that have messages, and on new dialogues, return empty object as does live --- .../Controllers/DialogueController.cs | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs b/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs index 0227f2f6..ce17f4d6 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs @@ -125,7 +125,14 @@ public class DialogueController( var data = new List(); foreach (var dialogueId in _dialogueHelper.GetDialogsForProfile(sessionId)) { - data.Add(GetDialogueInfo(dialogueId.Key, sessionId)); + var dialogueInfo = GetDialogueInfo(dialogueId.Key, sessionId); + + if (dialogueInfo is null) + { + continue; + } + + data.Add(dialogueInfo); } return data; @@ -137,13 +144,18 @@ public class DialogueController( /// Dialog id /// Session Id /// DialogueInfo - public virtual DialogueInfo GetDialogueInfo( + public virtual DialogueInfo? GetDialogueInfo( string? dialogueId, string sessionId) { var dialogs = _dialogueHelper.GetDialogsForProfile(sessionId); var dialogue = dialogs!.GetValueOrDefault(dialogueId); + if (!dialogue.Messages.Any()) + { + return null; + } + var result = new DialogueInfo { Id = dialogueId, @@ -214,6 +226,16 @@ public class DialogueController( var fullProfile = _saveServer.GetProfile(sessionId); var dialogue = GetDialogByIdFromProfile(fullProfile, request); + if (!dialogue.Messages.Any()) + { + return new GetMailDialogViewResponseData + { + Messages = [], + Profiles = [], + HasMessagesWithRewards = false + }; + } + // Dialog was opened, remove the little [1] on screen dialogue.New = 0;