From d4b9edb1619fd6dfac35b9a93ab99a9b3b065b87 Mon Sep 17 00:00:00 2001 From: Chomp Date: Fri, 17 Jan 2025 10:31:39 +0000 Subject: [PATCH] Stubbed out `Migrate310xProfile` --- Core/Controllers/GameController.cs | 22 +++++++++++++++++++++- Core/Services/CreateProfileService.cs | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Core/Controllers/GameController.cs b/Core/Controllers/GameController.cs index c76cf9c5..60cad5e5 100644 --- a/Core/Controllers/GameController.cs +++ b/Core/Controllers/GameController.cs @@ -44,6 +44,8 @@ public class GameController protected GiftService _giftService; protected RaidTimeAdjustmentService _raidTimeAdjustmentService; protected ProfileActivityService _profileActivityService; + protected CreateProfileService _createProfileService; + protected ApplicationContext _applicationContext; //protected PreSptModLoader preSptModLoader protected ICloner _cloner; @@ -74,6 +76,7 @@ public class GameController GiftService giftService, RaidTimeAdjustmentService raidTimeAdjustmentService, ProfileActivityService profileActivityService, + CreateProfileService createProfileService, ApplicationContext applicationContext, ICloner cloner ) @@ -97,6 +100,7 @@ public class GameController _giftService = giftService; _raidTimeAdjustmentService = raidTimeAdjustmentService; _profileActivityService = profileActivityService; + _createProfileService = createProfileService; _applicationContext = applicationContext; _cloner = cloner; @@ -136,7 +140,7 @@ public class GameController if (fullProfile.FriendProfileIds == null) fullProfile.FriendProfileIds = new(); - if (fullProfile.SptData.Version.Contains("3.9.") && !fullProfile.SptData.Migrations.Any(m => m.Key == "39x")) + if (fullProfile.SptData.Version.Contains("3.9.") && fullProfile.SptData.Migrations.All(m => m.Key != "39x")) { _inventoryHelper.ValidateInventoryUsesMongoIds(fullProfile.CharacterData.PmcData.Inventory.Items); Migrate39xProfile(fullProfile); @@ -146,6 +150,17 @@ public class GameController _logger.Info($"Migration of 3.9.x profile: {fullProfile.ProfileInfo.Username} completed successfully"); } + //3.10 migrations + if (fullProfile.SptData.Version.Contains("3.10.") && fullProfile.SptData.Migrations.All(m => m.Key != "310x")) + { + Migrate310xProfile(fullProfile); + + // Flag as migrated + fullProfile.SptData.Migrations["310x"] = _timeUtil.GetTimeStamp(); + + _logger.Success($"Migration of 3.10.x profile: ${ fullProfile.ProfileInfo.Username} completed successfully"); + } + // with our method of converting type from array for this prop, we *might* not need this? // if (Array.isArray(fullProfile.characters.pmc.WishList)) { // fullProfile.characters.pmc.WishList = {}; @@ -205,6 +220,11 @@ public class GameController throw new NotImplementedException(); } + private void Migrate310xProfile(SptProfile fullProfile) + { + throw new NotImplementedException(); + } + /// /// Handles migrating profiles from older SPT versions /// diff --git a/Core/Services/CreateProfileService.cs b/Core/Services/CreateProfileService.cs index d2ba6f9e..089a6d18 100644 --- a/Core/Services/CreateProfileService.cs +++ b/Core/Services/CreateProfileService.cs @@ -272,7 +272,7 @@ public class CreateProfileService } } - private void AddCustomisationUnlocksToProfile(SptProfile fullProfile) + public void AddCustomisationUnlocksToProfile(SptProfile fullProfile) { // Some game versions have additional dogtag variants, add them switch (GetGameEdition(fullProfile))