Fixed server error on adding item to wishlist

This commit is contained in:
Chomp
2025-07-07 09:53:43 +01:00
parent 266b6bcc10
commit 39e4a6e676
2 changed files with 7 additions and 1 deletions
@@ -1,8 +1,10 @@
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common;
using SPTarkov.Server.Core.Models.Eft.ItemEvent;
using SPTarkov.Server.Core.Models.Eft.Wishlist;
using SPTarkov.Server.Core.Routers;
using SPTarkov.Server.Core.Utils.Json;
namespace SPTarkov.Server.Core.Controllers;
@@ -19,9 +21,10 @@ public class WishlistController(EventOutputHolder _eventOutputHolder)
public ItemEventRouterResponse AddToWishList(
PmcData pmcData,
AddToWishlistRequest request,
string sessionId
MongoId sessionId
)
{
pmcData.WishList ??= new DictionaryOrList<MongoId, int>(new Dictionary<MongoId, int>(), []);
foreach (var item in request.Items)
{
pmcData.WishList.Dictionary.Add(item.Key, item.Value);
@@ -14,6 +14,7 @@ using SPTarkov.Server.Core.Routers;
using SPTarkov.Server.Core.Servers;
using SPTarkov.Server.Core.Utils;
using SPTarkov.Server.Core.Utils.Cloners;
using SPTarkov.Server.Core.Utils.Json;
namespace SPTarkov.Server.Core.Services;
@@ -72,6 +73,8 @@ public class CreateProfileService(
pmcData.CoopExtractCounts = new Dictionary<string, int>();
pmcData.Achievements = new Dictionary<MongoId, long>();
pmcData.WishList = new DictionaryOrList<MongoId, int>(new Dictionary<MongoId, int>(), []);
// Process handling if the account has been forced to wipe
// BSG keeps both the achievements, prestige level and the total in-game time in a wipe
if (account.CharacterData.PmcData.Achievements is not null)