Deconstructed dict KvP to improve readabiltiy + string to mongoId conversions
This commit is contained in:
@@ -42,9 +42,9 @@ public class BtrDeliveryCallbacks(
|
||||
protected void ProcessDeliveries()
|
||||
{
|
||||
// Process each installed profile.
|
||||
foreach (var sessionId in saveServer.GetProfiles())
|
||||
foreach (var (sessionId, _) in saveServer.GetProfiles())
|
||||
{
|
||||
ProcessDeliveryByProfile(sessionId.Key);
|
||||
ProcessDeliveryByProfile(sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,9 +55,9 @@ public class DialogueController(
|
||||
public void Update()
|
||||
{
|
||||
var profiles = saveServer.GetProfiles();
|
||||
foreach (var kvp in profiles)
|
||||
foreach (var (sessionId, _) in profiles)
|
||||
{
|
||||
RemoveExpiredItemsFromMessages(kvp.Key);
|
||||
RemoveExpiredItemsFromMessages(sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1299,13 +1299,13 @@ public class HideoutController(
|
||||
)
|
||||
{
|
||||
var ongoingProductions = pmcData.Hideout.Production;
|
||||
string? prodId = null;
|
||||
foreach (var production in ongoingProductions)
|
||||
MongoId? prodId = null;
|
||||
foreach (var (ongoingProdId, ongoingProduction) in ongoingProductions)
|
||||
// Production or ScavCase
|
||||
{
|
||||
if (production.Value.RecipeId == request.RecipeId)
|
||||
if (ongoingProduction?.RecipeId == request.RecipeId)
|
||||
{
|
||||
prodId = production.Key; // Set to objects key
|
||||
prodId = ongoingProdId; // Set to objects key
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1345,10 +1345,10 @@ public class HideoutController(
|
||||
output.ProfileChanges[sessionID].Production.Remove(request.RecipeId);
|
||||
|
||||
// Flag as complete - will be cleaned up later by hideoutController.update()
|
||||
pmcData.Hideout.Production[prodId].SptIsComplete = true;
|
||||
pmcData.Hideout.Production[prodId.Value].SptIsComplete = true;
|
||||
|
||||
// Crafting complete, flag
|
||||
pmcData.Hideout.Production[prodId].InProgress = false;
|
||||
pmcData.Hideout.Production[prodId.Value].InProgress = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1784,11 +1784,11 @@ public class HideoutController(
|
||||
return eventOutputHolder.GetOutput(sessionId);
|
||||
}
|
||||
|
||||
foreach (var poseKvP in request.Poses)
|
||||
foreach (var (poseKey, poseValue) in request.Poses)
|
||||
{
|
||||
// Nullguard
|
||||
pmcData.Hideout.MannequinPoses ??= [];
|
||||
pmcData.Hideout.MannequinPoses[poseKvP.Key] = poseKvP.Value;
|
||||
pmcData.Hideout.MannequinPoses[poseKey] = poseValue;
|
||||
}
|
||||
|
||||
return eventOutputHolder.GetOutput(sessionId);
|
||||
|
||||
@@ -50,9 +50,9 @@ public class InsuranceController(
|
||||
public void ProcessReturn()
|
||||
{
|
||||
// Process each installed profile.
|
||||
foreach (var sessionId in saveServer.GetProfiles())
|
||||
foreach (var (sessionId, _) in saveServer.GetProfiles())
|
||||
{
|
||||
ProcessReturnByProfile(sessionId.Key);
|
||||
ProcessReturnByProfile(sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,17 +444,17 @@ public class InsuranceController(
|
||||
HashSet<MongoId> toDelete
|
||||
)
|
||||
{
|
||||
foreach (var parentObj in mainParentToAttachmentsMap)
|
||||
foreach (var (key, attachments) in mainParentToAttachmentsMap)
|
||||
{
|
||||
// Skip processing if parentId is already marked for deletion, as all attachments for that parent will
|
||||
// already be marked for deletion as well.
|
||||
if (toDelete.Contains(parentObj.Key))
|
||||
if (toDelete.Contains(key))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Log the parent item's name.
|
||||
itemsMap.TryGetValue(parentObj.Key, out var parentItem);
|
||||
itemsMap.TryGetValue(key, out var parentItem);
|
||||
var parentName = itemHelper.GetItemName(parentItem.Template);
|
||||
if (logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
@@ -462,7 +462,7 @@ public class InsuranceController(
|
||||
}
|
||||
|
||||
// Process the attachments for this individual parent item.
|
||||
ProcessAttachmentByParent(parentObj.Value, insuredTraderId.Value, toDelete);
|
||||
ProcessAttachmentByParent(attachments, insuredTraderId.Value, toDelete);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,17 +39,17 @@ public class LauncherV2Controller(
|
||||
/// Returns all available profile types and descriptions for creation.
|
||||
/// - This is also localised.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>dict of profile names + description</returns>
|
||||
public Dictionary<string, string> Types()
|
||||
{
|
||||
var result = new Dictionary<string, string>();
|
||||
var dbProfiles = databaseService.GetProfileTemplates();
|
||||
|
||||
foreach (var profileKvP in dbProfiles)
|
||||
foreach (var (templateName, template) in dbProfiles)
|
||||
{
|
||||
result.TryAdd(
|
||||
profileKvP.Key,
|
||||
serverLocalisationService.GetText(profileKvP.Value.DescriptionLocaleKey)
|
||||
templateName,
|
||||
serverLocalisationService.GetText(template.DescriptionLocaleKey)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -200,6 +200,7 @@ public record QuestCondition
|
||||
|
||||
/// <summary>
|
||||
/// Can be: string[] or string
|
||||
/// Can be mongoId or string e.g. event_labyrinth_06_mech_place_01
|
||||
/// </summary>
|
||||
[JsonPropertyName("target")]
|
||||
[JsonConverter(typeof(ListOrTConverterFactory))]
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ public record HideoutCustomizationSetMannequinPoseRequest : InventoryBaseActionR
|
||||
public Dictionary<string, object>? ExtensionData { get; set; }
|
||||
|
||||
[JsonPropertyName("poses")]
|
||||
public Dictionary<string, MongoId>? Poses { get; set; }
|
||||
public Dictionary<MongoId, MongoId>? Poses { get; set; }
|
||||
|
||||
[JsonPropertyName("timestamp")]
|
||||
public double? Timestamp { get; set; }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using SPTarkov.Server.Core.Models.Common;
|
||||
using SPTarkov.Server.Core.Models.Eft.Inventory;
|
||||
|
||||
namespace SPTarkov.Server.Core.Models.Eft.Wishlist;
|
||||
@@ -9,5 +10,5 @@ public record AddToWishlistRequest : InventoryBaseActionRequestData
|
||||
public Dictionary<string, object>? ExtensionData { get; set; }
|
||||
|
||||
[JsonPropertyName("items")]
|
||||
public Dictionary<string, int>? Items { get; set; }
|
||||
public Dictionary<MongoId, int>? Items { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using SPTarkov.Server.Core.Models.Common;
|
||||
using SPTarkov.Server.Core.Models.Eft.Inventory;
|
||||
|
||||
namespace SPTarkov.Server.Core.Models.Eft.Wishlist;
|
||||
@@ -9,5 +10,5 @@ public record RemoveFromWishlistRequest : InventoryBaseActionRequestData
|
||||
public Dictionary<string, object>? ExtensionData { get; set; }
|
||||
|
||||
[JsonPropertyName("items")]
|
||||
public List<string>? Items { get; set; }
|
||||
public List<MongoId>? Items { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user