Replaced Wishlist property in profile with pure dictionary

This commit is contained in:
Chomp
2025-08-06 12:47:28 +01:00
parent 7ece60ac54
commit cdc9cd59e2
5 changed files with 9 additions and 14 deletions
@@ -13,7 +13,6 @@ using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Servers;
using SPTarkov.Server.Core.Services;
using SPTarkov.Server.Core.Utils;
using SPTarkov.Server.Core.Utils.Json;
using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel;
namespace SPTarkov.Server.Core.Controllers;
@@ -82,8 +81,8 @@ public class GameController(
return;
}
fullProfile.CharacterData!.PmcData!.WishList ??= new DictionaryOrList<MongoId, int>(new Dictionary<MongoId, int>(), []);
fullProfile.CharacterData.ScavData!.WishList ??= new DictionaryOrList<MongoId, int>(new Dictionary<MongoId, int>(), []);
fullProfile.CharacterData!.PmcData!.WishList ??= new();
fullProfile.CharacterData.ScavData!.WishList ??= new();
if (fullProfile.DialogueRecords is not null)
{
@@ -4,7 +4,6 @@ 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;
@@ -20,10 +19,10 @@ public class WishlistController(EventOutputHolder eventOutputHolder)
/// <returns></returns>
public ItemEventRouterResponse AddToWishList(PmcData pmcData, AddToWishlistRequest request, MongoId sessionId)
{
pmcData.WishList ??= new DictionaryOrList<MongoId, int>(new Dictionary<MongoId, int>(), []);
pmcData.WishList ??= new();
foreach (var item in request.Items)
{
pmcData.WishList.Dictionary.Add(item.Key, item.Value);
pmcData.WishList.Add(item.Key, item.Value);
}
return eventOutputHolder.GetOutput(sessionId);
@@ -40,7 +39,7 @@ public class WishlistController(EventOutputHolder eventOutputHolder)
{
foreach (var itemId in request.Items)
{
pmcData.WishList.Dictionary.Remove(itemId);
pmcData.WishList.Remove(itemId);
}
return eventOutputHolder.GetOutput(sessionId);
@@ -55,7 +54,7 @@ public class WishlistController(EventOutputHolder eventOutputHolder)
/// <returns></returns>
public ItemEventRouterResponse ChangeWishListItemCategory(PmcData pmcData, ChangeWishlistItemCategoryRequest request, MongoId sessionId)
{
pmcData.WishList.Dictionary[request.Item] = request.Category.Value;
pmcData.WishList[request.Item] = request.Category.Value;
return eventOutputHolder.GetOutput(sessionId);
}
@@ -12,7 +12,6 @@ using SPTarkov.Server.Core.Servers;
using SPTarkov.Server.Core.Services;
using SPTarkov.Server.Core.Utils;
using SPTarkov.Server.Core.Utils.Cloners;
using SPTarkov.Server.Core.Utils.Json;
using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel;
namespace SPTarkov.Server.Core.Generators;
@@ -109,7 +108,7 @@ public class PlayerScavGenerator(
scavData.Quests = existingScavDataClone.Quests ?? [];
scavData.TaskConditionCounters = existingScavDataClone.TaskConditionCounters ?? new Dictionary<MongoId, TaskConditionCounter>();
scavData.Notes = existingScavDataClone.Notes ?? new Notes { DataNotes = [] };
scavData.WishList = existingScavDataClone.WishList ?? new DictionaryOrList<MongoId, int>(new Dictionary<MongoId, int>(), []);
scavData.WishList = existingScavDataClone.WishList ?? new();
scavData.Encyclopedia = pmcDataClone.Encyclopedia ?? new Dictionary<MongoId, bool>();
// Add additional items to player scav as loot
@@ -3,7 +3,6 @@ using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Notes;
using SPTarkov.Server.Core.Models.Eft.Ragfair;
using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Utils.Json;
using SPTarkov.Server.Core.Utils.Json.Converters;
namespace SPTarkov.Server.Core.Models.Eft.Common.Tables;
@@ -105,7 +104,7 @@ public record BotBase
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
[JsonPropertyName("WishList")]
[JsonConverter(typeof(ArrayToObjectFactoryConverter))]
public DictionaryOrList<MongoId, int>? WishList { get; set; }
public Dictionary<MongoId, int>? WishList { get; set; }
[JsonPropertyName("moneyTransferLimitData")]
public MoneyTransferLimits MoneyTransferLimitData { get; set; }
@@ -14,7 +14,6 @@ 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;
@@ -68,7 +67,7 @@ public class CreateProfileService(
pmcData.CoopExtractCounts = [];
pmcData.Achievements = [];
pmcData.WishList = new DictionaryOrList<MongoId, int>([], []);
pmcData.WishList = new();
// 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