From 18aca7d5146c033e1548b325fdc9ad28dc4688bc Mon Sep 17 00:00:00 2001 From: DrakiaXYZ <565558+DrakiaXYZ@users.noreply.github.com> Date: Sun, 24 Aug 2025 00:58:08 -0700 Subject: [PATCH] Store data passed back from SaveDialogueState call (#568) * Store data passed back from SaveDialogueState call This makes the rest area game playable, though variables still don't save * Woops, bad casing --------- Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com> --- .../Callbacks/InventoryCallbacks.cs | 3 ++- .../Controllers/InventoryController.cs | 13 +++++++++++++ .../Eft/Inventory/SaveDialogueStateRequest.cs | 8 ++++---- .../Models/Eft/Profile/SptProfile.cs | 7 +++++++ .../Routers/ItemEvents/InventoryItemEventRouter.cs | 1 + 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/InventoryCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/InventoryCallbacks.cs index 18f1975c..d7abf6a5 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/InventoryCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/InventoryCallbacks.cs @@ -379,6 +379,7 @@ public class InventoryCallbacks(InventoryController inventoryController, QuestCo ItemEventRouterResponse output ) { - throw new NotImplementedException(); + inventoryController.SetDialogueProgress(pmcData, request, sessionId, output); + return output; } } diff --git a/Libraries/SPTarkov.Server.Core/Controllers/InventoryController.cs b/Libraries/SPTarkov.Server.Core/Controllers/InventoryController.cs index 028256ce..930995e2 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/InventoryController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/InventoryController.cs @@ -136,6 +136,19 @@ public class InventoryController( itemToAdjust.Upd.PinLockState = request.State; } + /// + /// Handle /client/game/profile/items/moving SaveDialogueState + /// + /// Player's PMC profile + /// + /// Session/Player id + /// + public void SetDialogueProgress(PmcData pmcData, SaveDialogueStateRequest request, MongoId sessionId, ItemEventRouterResponse output) + { + var fullProfile = profileHelper.GetFullProfile(sessionId); + fullProfile.DialogueProgress = request.DialogueProgress; + } + /// /// Handle /client/game/profile/items/moving SetFavoriteItems /// diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/SaveDialogueStateRequest.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/SaveDialogueStateRequest.cs index f1fe7034..007279d0 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/SaveDialogueStateRequest.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/SaveDialogueStateRequest.cs @@ -5,17 +5,17 @@ namespace SPTarkov.Server.Core.Models.Eft.Inventory; public record SaveDialogueStateRequest : InventoryBaseActionRequestData { [JsonPropertyName("nodePathTraveled")] - public List NodePathTraveled { get; set; } + public List? DialogueProgress { get; set; } } public class NodePathTraveled { [JsonPropertyName("traderId")] - public string TraderId { get; set; } + public string? TraderId { get; set; } [JsonPropertyName("dialogueId")] - public string DialogueId { get; set; } + public string? DialogueId { get; set; } [JsonPropertyName("nodeId")] - public string NodeId { get; set; } + public string? NodeId { get; set; } } diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/SptProfile.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/SptProfile.cs index dca28509..fd0d3064 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/SptProfile.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/SptProfile.cs @@ -2,6 +2,7 @@ using System.Text.Json.Serialization; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; +using SPTarkov.Server.Core.Models.Eft.Inventory; using SPTarkov.Server.Core.Models.Eft.Prestige; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Dialog; @@ -58,6 +59,12 @@ public record SptProfile /// [JsonPropertyName("customisationUnlocks")] public List? CustomisationUnlocks { get; set; } + + /// + /// Stores the most recently sent dialog progress result from the client + /// + [JsonPropertyName("dialogueProgress")] + public List? DialogueProgress { get; set; } } public record TraderPurchaseData diff --git a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/InventoryItemEventRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/InventoryItemEventRouter.cs index 2d3a3d39..1b3fa704 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/InventoryItemEventRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/InventoryItemEventRouter.cs @@ -42,6 +42,7 @@ public class InventoryItemEventRouter(InventoryCallbacks inventoryCallbacks, Hid new(ItemEventActions.SET_FAVORITE_ITEMS, false), new(ItemEventActions.QUEST_FAIL, false), new(ItemEventActions.PIN_LOCK, false), + new(ItemEventActions.SAVE_DIALOGUE_STATE, false), }; }