Replaced hashutil.generate with new MongoId()

This commit is contained in:
Chomp
2025-07-02 12:47:00 +01:00
parent 371c9d58f0
commit a8308248d6
25 changed files with 85 additions and 88 deletions
@@ -350,7 +350,7 @@ public class HideoutController(
// Add key/value to `hideoutAreaStashes` dictionary - used to link hideout area to inventory stash by its id
var childAreaTypeKey = ((int)childDbArea.Type).ToString();
if (pmcData.Inventory.HideoutAreaStashes.GetValueOrDefault(childAreaTypeKey) is null)
if (!pmcData.Inventory.HideoutAreaStashes.ContainsKey(childAreaTypeKey))
{
pmcData.Inventory.HideoutAreaStashes[childAreaTypeKey] = childDbArea.Id;
}
@@ -158,8 +158,8 @@ public class BotInventoryGenerator(
QuestRaidItems = questRaidItemsId,
QuestStashItems = questStashItemsId,
SortingTable = sortingTableId,
HideoutAreaStashes = new Dictionary<string, string>(),
FastPanel = new Dictionary<string, string>(),
HideoutAreaStashes = new Dictionary<string, MongoId>(),
FastPanel = new Dictionary<string, MongoId>(),
FavoriteItems = [],
HideoutCustomizationStashId = hideoutCustomizationStashId,
};
@@ -1,12 +1,12 @@
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Helpers;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Models.Spt.Config;
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.Cloners;
namespace SPTarkov.Server.Core.Generators;
@@ -14,7 +14,6 @@ namespace SPTarkov.Server.Core.Generators;
[Injectable]
public class FenceBaseAssortGenerator(
ISptLogger<FenceBaseAssortGenerator> logger,
HashUtil hashUtil,
DatabaseService databaseService,
HandbookHelper handbookHelper,
ItemHelper itemHelper,
@@ -92,7 +91,7 @@ public class FenceBaseAssortGenerator(
{
new()
{
Id = hashUtil.Generate(),
Id = new MongoId(),
Template = rootItemDb.Id,
ParentId = "hideout",
SlotId = "hideout",
@@ -305,7 +304,7 @@ public class FenceBaseAssortGenerator(
var mod = new Item
{
Id = hashUtil.Generate(),
Id = new MongoId(),
Template = plateTpl,
ParentId = armor[0].Id,
SlotId = requiredSlot.Name,
@@ -342,7 +341,7 @@ public class FenceBaseAssortGenerator(
armor.Add(
new Item
{
Id = hashUtil.Generate(),
Id = new MongoId(),
Template = plateSlot.Props.Filters[0].Plate, // `Plate` property appears to be the 'default' item for slot
ParentId = armor[0].Id,
SlotId = plateSlot.Name,
@@ -1136,7 +1136,7 @@ public class LocationLootGenerator(
itemWithMods.Add(
new Item
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Template = chosenTpl,
Upd = new Upd { StackObjectsCount = stackCount },
}
@@ -2,6 +2,7 @@ using System.Globalization;
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Extensions;
using SPTarkov.Server.Core.Helpers;
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.Notes;
@@ -22,7 +23,6 @@ public class PlayerScavGenerator(
ISptLogger<PlayerScavGenerator> _logger,
RandomUtil _randomUtil,
DatabaseService _databaseService,
HashUtil _hashUtil,
ItemHelper _itemHelper,
BotGeneratorHelper _botGeneratorHelper,
SaveServer _saveServer,
@@ -176,7 +176,7 @@ public class PlayerScavGenerator(
{
new()
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Template = itemTemplate.Id,
Upd = _botGeneratorHelper.GenerateExtraPropertiesForItem(itemTemplate),
},
@@ -19,7 +19,6 @@ namespace SPTarkov.Server.Core.Generators;
public class ScavCaseRewardGenerator(
ISptLogger<ScavCaseRewardGenerator> _logger,
RandomUtil _randomUtil,
HashUtil _hashUtil,
ItemHelper _itemHelper,
PresetHelper _presetHelper,
DatabaseService _databaseService,
@@ -376,7 +375,7 @@ public class ScavCaseRewardGenerator(
[
new()
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Template = rewardItemDb.Id,
Upd = null,
},
@@ -1,24 +1,18 @@
using System.Collections.Frozen;
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Servers;
using SPTarkov.Server.Core.Services;
using SPTarkov.Server.Core.Utils;
namespace SPTarkov.Server.Core.Helpers;
[Injectable]
public class BotWeaponGeneratorHelper(
ISptLogger<BotWeaponGeneratorHelper> _logger,
DatabaseServer _databaseServer,
ItemHelper _itemHelper,
RandomUtil _randomUtil,
HashUtil _hashUtil,
WeightedRandomHelper _weightedRandomHelper,
BotGeneratorHelper _botGeneratorHelper,
ServerLocalisationService _serverLocalisationService
BotGeneratorHelper _botGeneratorHelper
)
{
private static readonly FrozenSet<string> _magCheck =
@@ -99,7 +93,7 @@ public class BotWeaponGeneratorHelper(
TemplateItem magTemplate
)
{
List<Item> magazine = [new() { Id = _hashUtil.Generate(), Template = magazineTpl }];
List<Item> magazine = [new() { Id = new MongoId(), Template = magazineTpl }];
_itemHelper.FillMagazineWithCartridge(magazine, magTemplate, ammoTpl, 1);
@@ -128,7 +122,7 @@ public class BotWeaponGeneratorHelper(
var ammoItems = _itemHelper.SplitStack(
new Item
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Template = ammoTpl,
Upd = new Upd { StackObjectsCount = cartridgeCount },
}
@@ -10,7 +10,6 @@ using SPTarkov.Server.Core.Models.Eft.Profile;
using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Services;
using SPTarkov.Server.Core.Utils;
using SPTarkov.Server.Core.Utils.Cloners;
namespace SPTarkov.Server.Core.Helpers.Dialogue.Commando.SptCommands.GiveCommand;
@@ -18,8 +17,6 @@ namespace SPTarkov.Server.Core.Helpers.Dialogue.Commando.SptCommands.GiveCommand
[Injectable]
public class GiveSptCommand(
ISptLogger<GiveSptCommand> _logger,
HashUtil _hashUtil,
DatabaseService _databaseService,
ItemHelper _itemHelper,
PresetHelper _presetHelper,
ItemFilterService _itemFilterService,
@@ -245,9 +242,7 @@ public class GiveSptCommand(
for (var i = 0; i < quantity; i++)
{
List<Item> ammoBoxArray = [];
ammoBoxArray.Add(
new Item { Id = _hashUtil.Generate(), Template = checkedItem.Value.Id }
);
ammoBoxArray.Add(new Item { Id = new MongoId(), Template = checkedItem.Value.Id });
// DO NOT generate the ammo box cartridges, the mail service does it for us! :)
// _itemHelper.addCartridgesToAmmoBox(ammoBoxArray, checkedItem[1]);
itemsToSend.AddRange(ammoBoxArray);
@@ -262,7 +257,7 @@ public class GiveSptCommand(
itemsToSend.Add(
new Item
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Template = checkedItem.Value.Id,
Upd = _itemHelper.GenerateUpdForItem(checkedItem.Value),
}
@@ -273,7 +268,7 @@ public class GiveSptCommand(
{
var itemToSend = new Item
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Template = checkedItem.Value.Id,
Upd = _itemHelper.GenerateUpdForItem(checkedItem.Value),
};
@@ -1,6 +1,7 @@
using System.Text.RegularExpressions;
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Helpers.Dialog.Commando.SptCommands;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Eft.Dialog;
using SPTarkov.Server.Core.Models.Eft.Profile;
@@ -139,7 +140,7 @@ public class ProfileSptCommand(
[
new Item
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Template = Money.ROUBLES,
Upd = new Upd { StackObjectsCount = 1 },
ParentId = _hashUtil.Generate(),
@@ -157,7 +158,7 @@ public class ProfileSptCommand(
{
var profileChangeEvent = new ProfileChangeEvent
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Type = "SkillPoints",
Value = level * 100,
Entity = skill.ToString(),
@@ -170,7 +171,7 @@ public class ProfileSptCommand(
var exp = _profileHelper.GetExperience(level);
var profileChangeEvent = new ProfileChangeEvent
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Type = "ProfileLevel",
Value = exp,
Entity = null,
@@ -182,7 +183,7 @@ public class ProfileSptCommand(
{
var profileChangeEvent = new ProfileChangeEvent
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Type = "ExamineAllItems",
Value = null,
Entity = null,
@@ -1,6 +1,7 @@
using System.Text.RegularExpressions;
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Helpers.Dialog.Commando.SptCommands;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Eft.Dialog;
using SPTarkov.Server.Core.Models.Eft.Profile;
@@ -107,7 +108,7 @@ public class TraderSptCommand(
[
new Item
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Template = Money.ROUBLES,
Upd = new Upd { StackObjectsCount = 1 },
ParentId = _hashUtil.Generate(),
@@ -129,7 +130,7 @@ public class TraderSptCommand(
{
return new ProfileChangeEvent
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Type = profileChangeEventType.ToString(),
Value = quantity,
Entity = dbTraderId,
@@ -1,5 +1,6 @@
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Extensions;
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.Hideout;
@@ -104,7 +105,7 @@ public class HideoutHelper(
production.SptRequiredTools.Add(
new Item
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Template = toolItem.Template,
Upd = toolItem.Upd,
}
@@ -1228,7 +1229,7 @@ public class HideoutHelper(
btcProd.Products.Add(
new Item
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Template = ItemTpl.BARTER_PHYSICAL_BITCOIN,
Upd = new Upd { StackObjectsCount = 1 },
}
@@ -1419,7 +1420,7 @@ public class HideoutHelper(
[
new Item
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Template = ItemTpl.BARTER_PHYSICAL_BITCOIN,
Upd = new Upd { StackObjectsCount = 1 },
},
@@ -1,6 +1,7 @@
using SPTarkov.Common.Extensions;
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Extensions;
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.Spt.Config;
@@ -174,7 +175,7 @@ public class InRaidHelper(
}
// Remove contents of fast panel
pmcData.Inventory.FastPanel = new Dictionary<string, string>();
pmcData.Inventory.FastPanel = new Dictionary<string, MongoId>();
}
/// <summary>
@@ -1326,7 +1326,7 @@ public class InventoryHelper(
);
if (!wasMovedToFastPanelAccessibleContainer)
{
pmcData.Inventory.FastPanel[fastPanelSlot[0].ToString()] = "";
pmcData.Inventory.FastPanel[fastPanelSlot.ToString()] = "";
}
}
@@ -972,16 +972,16 @@ public class ItemHelper(
)
{
// Blacklist
var itemIdBlacklist = new HashSet<string>();
var itemIdBlacklist = new HashSet<MongoId>();
itemIdBlacklist.UnionWith(
new List<string>
new List<MongoId>
{
inventory.Equipment,
inventory.QuestRaidItems,
inventory.QuestStashItems,
inventory.SortingTable,
inventory.Stash,
inventory.HideoutCustomizationStashId,
inventory.Equipment.Value,
inventory.QuestRaidItems.Value,
inventory.QuestStashItems.Value,
inventory.SortingTable.Value,
inventory.Stash.Value,
inventory.HideoutCustomizationStashId.Value,
}
);
itemIdBlacklist.UnionWith(inventory.HideoutAreaStashes.Values);
@@ -989,7 +989,7 @@ public class ItemHelper(
// Add insured items ids to blacklist
if (insuredItems is not null)
{
itemIdBlacklist.UnionWith(insuredItems.Select(x => x.ItemId));
itemIdBlacklist.UnionWith(insuredItems.Select(x => x.ItemId.Value));
}
foreach (var item in inventory.Items)
@@ -1079,28 +1079,28 @@ public class ItemHelper(
)
{
// Blacklist
var itemIdBlacklist = new HashSet<string>();
var itemIdBlacklist = new HashSet<MongoId>();
if (pmcData != null)
{
itemIdBlacklist.UnionWith(
new List<string>
new List<MongoId>
{
pmcData.Inventory.Equipment,
pmcData.Inventory.QuestRaidItems,
pmcData.Inventory.QuestStashItems,
pmcData.Inventory.SortingTable,
pmcData.Inventory.Stash,
pmcData.Inventory.HideoutCustomizationStashId,
pmcData.Inventory.Equipment.Value,
pmcData.Inventory.QuestRaidItems.Value,
pmcData.Inventory.QuestStashItems.Value,
pmcData.Inventory.SortingTable.Value,
pmcData.Inventory.Stash.Value,
pmcData.Inventory.HideoutCustomizationStashId.Value,
}
);
itemIdBlacklist.UnionWith(pmcData.Inventory.HideoutAreaStashes.Keys);
itemIdBlacklist.UnionWith(pmcData.Inventory.HideoutAreaStashes.Values);
}
// Add insured items ids to blacklist
if (insuredItems is not null)
{
itemIdBlacklist.UnionWith(insuredItems.Select(x => x.ItemId));
itemIdBlacklist.UnionWith(insuredItems.Select(x => x.ItemId.Value));
}
foreach (var item in originalItems)
@@ -1,5 +1,6 @@
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Extensions;
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.Hideout;
@@ -16,7 +17,6 @@ namespace SPTarkov.Server.Core.Helpers;
[Injectable]
public class RewardHelper(
ISptLogger<RewardHelper> _logger,
HashUtil _hashUtil,
TimeUtil _timeUtil,
ItemHelper _itemHelper,
DatabaseService _databaseService,
@@ -354,7 +354,7 @@ public class RewardHelper(
// This has all the original id relations since we reset the id to the original after the splitStack
var itemsClone = new List<Item> { _cloner.Clone(target) };
// Here we generate a new id for the root item
target.Id = _hashUtil.Generate();
target.Id = new MongoId();
// Add cloned mods to root item array
var clonedMods = _cloner.Clone(mods);
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
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;
@@ -434,39 +435,40 @@ public record BotBaseInventory
public List<Item>? Items { get; set; }
[JsonPropertyName("equipment")]
public string? Equipment { get; set; }
public MongoId? Equipment { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
[JsonPropertyName("stash")]
public string? Stash { get; set; }
public MongoId? Stash { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
[JsonPropertyName("sortingTable")]
public string? SortingTable { get; set; }
public MongoId? SortingTable { get; set; }
[JsonPropertyName("questRaidItems")]
public string? QuestRaidItems { get; set; }
public MongoId? QuestRaidItems { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
[JsonPropertyName("questStashItems")]
public string? QuestStashItems { get; set; }
public MongoId? QuestStashItems { get; set; }
/// <summary>
/// Key is hideout area enum numeric as string e.g. "24", value is area _id
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
[JsonPropertyName("hideoutAreaStashes")]
public Dictionary<string, string>? HideoutAreaStashes { get; set; }
// TODO: key should be EAreaType enum
public Dictionary<string, MongoId>? HideoutAreaStashes { get; set; }
[JsonPropertyName("fastPanel")]
public Dictionary<string, string>? FastPanel { get; set; }
public Dictionary<string, MongoId>? FastPanel { get; set; }
[JsonPropertyName("favoriteItems")]
public List<string>? FavoriteItems { get; set; }
public List<MongoId>? FavoriteItems { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
[JsonPropertyName("hideoutCustomizationStashId")]
public string? HideoutCustomizationStashId { get; set; }
public MongoId? HideoutCustomizationStashId { get; set; }
}
public record Skills
@@ -802,7 +804,7 @@ public record InsuredItem
public string? TId { get; set; }
[JsonPropertyName("itemId")]
public string? ItemId { get; set; }
public MongoId? ItemId { get; set; }
}
public record Hideout
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
namespace SPTarkov.Server.Core.Models.Eft.Inventory;
@@ -8,7 +9,7 @@ public record SetFavoriteItems : InventoryBaseActionRequestData
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("items")]
public List<string>? Items { get; set; }
public List<MongoId>? Items { get; set; }
[JsonPropertyName("timestamp")]
public long? Timestamp { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
namespace SPTarkov.Server.Core.Models.Eft.Profile;
@@ -45,7 +46,7 @@ public record GetOtherProfileResponse
public string CustomizationStash { get; set; }
[JsonPropertyName("hideoutAreaStashes")]
public Dictionary<string, string> HideoutAreaStashes { get; set; }
public Dictionary<string, MongoId> HideoutAreaStashes { get; set; }
[JsonPropertyName("items")]
public List<Item> Items { get; set; }
@@ -1,4 +1,5 @@
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.Prestige;
@@ -364,7 +365,7 @@ public record MessageItems
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("stash")]
public string? Stash { get; set; }
public MongoId? Stash { get; set; }
[JsonPropertyName("data")]
public List<Item>? Data { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Eft.Profile;
using SPTarkov.Server.Core.Models.Enums;
@@ -95,7 +96,7 @@ public record ProfileChangeEvent
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("_id")]
public string? Id { get; set; }
public MongoId? Id { get; set; }
[JsonPropertyName("Type")]
public string Type { get; set; }
@@ -183,7 +183,7 @@ public class AirdropService(
{
var airdropContainer = new Item
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Template = string.Empty, // Chosen below later
Upd = new Upd { SpawnedInSession = true, StackObjectsCount = 1 },
};
@@ -68,7 +68,7 @@ public class BtrDeliveryService(
// This is to stop items being duplicated by being returned from both item delivery and insurance
var deliveredItemIds = items.Select(item => item.Id);
pmcData.InsuredItems = pmcData
.InsuredItems.Where(insuredItem => !deliveredItemIds.Contains(insuredItem.ItemId))
.InsuredItems.Where(insuredItem => !deliveredItemIds.Contains(insuredItem.ItemId.Value))
.ToList();
if (_saveServer.GetProfile(sessionId).BtrDeliveryList == null)
@@ -423,7 +423,7 @@ public class CircleOfCultistService(
[
new()
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Template = randomItemTplFromPool,
ParentId = cultistCircleStashId,
SlotId = CircleOfCultistSlotId,
@@ -511,7 +511,7 @@ public class CircleOfCultistService(
[
new()
{
Id = _hashUtil.Generate(),
Id = new MongoId(),
Template = rewardTpl,
ParentId = cultistCircleStashId,
SlotId = CircleOfCultistSlotId,
@@ -265,7 +265,7 @@ public class CreateProfileService(
if (item.Id == oldEquipmentId)
{
item.Id = pmcData.Inventory.Equipment;
item.Id = pmcData.Inventory.Equipment.Value;
}
}
}
@@ -298,7 +298,7 @@ public class CreateProfileService(
pmcData.Inventory.Items.Add(
new Item
{
Id = pmcData.Inventory.HideoutCustomizationStashId,
Id = pmcData.Inventory.HideoutCustomizationStashId.Value,
Template = ItemTpl.HIDEOUTAREACONTAINER_CUSTOMIZATION,
}
);
@@ -309,7 +309,7 @@ public class CreateProfileService(
pmcData.Inventory.Items.Add(
new Item
{
Id = pmcData.Inventory.SortingTable,
Id = pmcData.Inventory.SortingTable.Value,
Template = ItemTpl.SORTINGTABLE_SORTING_TABLE,
}
);
@@ -320,7 +320,7 @@ public class CreateProfileService(
pmcData.Inventory.Items.Add(
new Item
{
Id = pmcData.Inventory.QuestStashItems,
Id = pmcData.Inventory.QuestStashItems.Value,
Template = ItemTpl.STASH_QUESTOFFLINE,
}
);
@@ -331,7 +331,7 @@ public class CreateProfileService(
pmcData.Inventory.Items.Add(
new Item
{
Id = pmcData.Inventory.QuestRaidItems,
Id = pmcData.Inventory.QuestRaidItems.Value,
Template = ItemTpl.STASH_QUESTRAID,
}
);
@@ -89,7 +89,7 @@ public class ProfileFixerService(
}
// Otherwise we need to generate a new unique stash ID for this message's attachments
message.Items.Stash = _hashUtil.Generate();
message.Items.Stash = new MongoId();
message.Items.Data = message.Items.Data.AdoptOrphanedItems(message.Items.Stash);
// Because `adoptOrphanedItems` sets the slotId to `hideout`, we need to re-set it to `main` to work with mail
@@ -144,7 +144,7 @@ public class ProfileFixerService(
var itemToAdjust = pmcProfile.Inventory.Items.FirstOrDefault(x =>
x.Id == mappingKvP.Key
);
itemToAdjust.Id = _hashUtil.Generate();
itemToAdjust.Id = new MongoId();
_logger.Warning(
$"Replace duplicate item Id: {mappingKvP.Key} with {itemToAdjust.Id}"
);