Created ProfileExtensions
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using SPTarkov.DI.Annotations;
|
using SPTarkov.DI.Annotations;
|
||||||
|
using SPTarkov.Server.Core.Extensions;
|
||||||
using SPTarkov.Server.Core.Helpers;
|
using SPTarkov.Server.Core.Helpers;
|
||||||
using SPTarkov.Server.Core.Models.Eft.Common;
|
using SPTarkov.Server.Core.Models.Eft.Common;
|
||||||
using SPTarkov.Server.Core.Models.Eft.Game;
|
using SPTarkov.Server.Core.Models.Eft.Game;
|
||||||
@@ -135,9 +136,12 @@ public class GameController(
|
|||||||
|
|
||||||
if (pmcProfile.Hideout is not null)
|
if (pmcProfile.Hideout is not null)
|
||||||
{
|
{
|
||||||
_profileFixerService.AddMissingHideoutBonusesToProfile(pmcProfile);
|
_profileFixerService.AddMissingHideoutBonusesToProfile(
|
||||||
|
pmcProfile,
|
||||||
|
_databaseService.GetHideout().Areas
|
||||||
|
);
|
||||||
_hideoutHelper.SetHideoutImprovementsToCompleted(pmcProfile);
|
_hideoutHelper.SetHideoutImprovementsToCompleted(pmcProfile);
|
||||||
_hideoutHelper.UnlockHideoutWallInProfile(pmcProfile);
|
pmcProfile.UnlockHideoutWallInProfile();
|
||||||
|
|
||||||
// Handle if player has been inactive for a long time, catch up on hideout update before the user goes to his hideout
|
// Handle if player has been inactive for a long time, catch up on hideout update before the user goes to his hideout
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using SPTarkov.Server.Core.Models.Eft.Profile;
|
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
|
||||||
|
using SPTarkov.Server.Core.Models.Eft.Profile;
|
||||||
|
using SPTarkov.Server.Core.Models.Enums;
|
||||||
|
|
||||||
namespace SPTarkov.Server.Core.Extensions
|
namespace SPTarkov.Server.Core.Extensions
|
||||||
{
|
{
|
||||||
@@ -15,5 +17,215 @@ namespace SPTarkov.Server.Core.Extensions
|
|||||||
fullProfile.VitalityData.Energy = energy;
|
fullProfile.VitalityData.Energy = energy;
|
||||||
fullProfile.VitalityData.Temperature = temperature;
|
fullProfile.VitalityData.Temperature = temperature;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a list of suit ids to a profiles suit list, no duplicates
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fullProfile">Profile to add clothing to</param>
|
||||||
|
/// <param name="clothingIds">Clothing Ids to add to profile</param>
|
||||||
|
public static void AddSuitsToProfile(this SptProfile fullProfile, List<string> clothingIds)
|
||||||
|
{
|
||||||
|
fullProfile.CustomisationUnlocks ??= [];
|
||||||
|
|
||||||
|
foreach (var suitId in clothingIds)
|
||||||
|
{
|
||||||
|
if (
|
||||||
|
!fullProfile.CustomisationUnlocks.Exists(customisation =>
|
||||||
|
customisation.Id == suitId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Clothing item doesn't exist in profile, add it
|
||||||
|
fullProfile.CustomisationUnlocks.Add(
|
||||||
|
new CustomisationStorage
|
||||||
|
{
|
||||||
|
Id = suitId,
|
||||||
|
Source = CustomisationSource.UNLOCKED_IN_GAME,
|
||||||
|
Type = CustomisationType.SUITE,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add customisations to game profiles based on game edition
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fullProfile">Profile to add customisations to</param>
|
||||||
|
public static void AddCustomisationUnlocksToProfile(this SptProfile fullProfile)
|
||||||
|
{
|
||||||
|
// Some game versions have additional customisation unlocks
|
||||||
|
var gameEdition = fullProfile.GetGameEdition();
|
||||||
|
|
||||||
|
switch (gameEdition)
|
||||||
|
{
|
||||||
|
case GameEditions.EDGE_OF_DARKNESS:
|
||||||
|
// Gets EoD tags
|
||||||
|
fullProfile.CustomisationUnlocks.Add(
|
||||||
|
new CustomisationStorage
|
||||||
|
{
|
||||||
|
Id = "6746fd09bafff85008048838",
|
||||||
|
Source = CustomisationSource.DEFAULT,
|
||||||
|
Type = CustomisationType.DOG_TAG,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
fullProfile.CustomisationUnlocks.Add(
|
||||||
|
new CustomisationStorage
|
||||||
|
{
|
||||||
|
Id = "67471938bafff850080488b7",
|
||||||
|
Source = CustomisationSource.DEFAULT,
|
||||||
|
Type = CustomisationType.DOG_TAG,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case GameEditions.UNHEARD:
|
||||||
|
// Gets EoD+Unheard tags
|
||||||
|
fullProfile.CustomisationUnlocks.Add(
|
||||||
|
new CustomisationStorage
|
||||||
|
{
|
||||||
|
Id = "6746fd09bafff85008048838",
|
||||||
|
Source = CustomisationSource.DEFAULT,
|
||||||
|
Type = CustomisationType.DOG_TAG,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
fullProfile.CustomisationUnlocks.Add(
|
||||||
|
new CustomisationStorage
|
||||||
|
{
|
||||||
|
Id = "67471938bafff850080488b7",
|
||||||
|
Source = CustomisationSource.DEFAULT,
|
||||||
|
Type = CustomisationType.DOG_TAG,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
fullProfile.CustomisationUnlocks.Add(
|
||||||
|
new CustomisationStorage
|
||||||
|
{
|
||||||
|
Id = "67471928d17d6431550563b5",
|
||||||
|
Source = CustomisationSource.DEFAULT,
|
||||||
|
Type = CustomisationType.DOG_TAG,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
fullProfile.CustomisationUnlocks.Add(
|
||||||
|
new CustomisationStorage
|
||||||
|
{
|
||||||
|
Id = "6747193f170146228c0d2226",
|
||||||
|
Source = CustomisationSource.DEFAULT,
|
||||||
|
Type = CustomisationType.DOG_TAG,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Unheard Clothing (Cultist Hood)
|
||||||
|
fullProfile.CustomisationUnlocks.Add(
|
||||||
|
new CustomisationStorage
|
||||||
|
{
|
||||||
|
Id = "666841a02537107dc508b704",
|
||||||
|
Source = CustomisationSource.DEFAULT,
|
||||||
|
Type = CustomisationType.SUITE,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Unheard background
|
||||||
|
fullProfile.CustomisationUnlocks.Add(
|
||||||
|
new CustomisationStorage
|
||||||
|
{
|
||||||
|
Id = "675850ba33627edb710b0592",
|
||||||
|
Source = CustomisationSource.DEFAULT,
|
||||||
|
Type = CustomisationType.ENVIRONMENT,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var pretigeLevel = fullProfile?.CharacterData?.PmcData?.Info?.PrestigeLevel;
|
||||||
|
if (pretigeLevel is not null)
|
||||||
|
{
|
||||||
|
if (pretigeLevel >= 1)
|
||||||
|
{
|
||||||
|
fullProfile.CustomisationUnlocks.Add(
|
||||||
|
new CustomisationStorage
|
||||||
|
{
|
||||||
|
Id = "674dbf593bee1152d407f005",
|
||||||
|
Source = CustomisationSource.DEFAULT,
|
||||||
|
Type = CustomisationType.DOG_TAG,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pretigeLevel >= 2)
|
||||||
|
{
|
||||||
|
fullProfile.CustomisationUnlocks.Add(
|
||||||
|
new CustomisationStorage
|
||||||
|
{
|
||||||
|
Id = "675dcfea7ae1a8792107ca99",
|
||||||
|
Source = CustomisationSource.DEFAULT,
|
||||||
|
Type = CustomisationType.DOG_TAG,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dev profile additions
|
||||||
|
if (fullProfile.ProfileInfo.Edition.ToLower().Contains("developer"))
|
||||||
|
// CyberTark background
|
||||||
|
{
|
||||||
|
fullProfile.CustomisationUnlocks.Add(
|
||||||
|
new CustomisationStorage
|
||||||
|
{
|
||||||
|
Id = "67585108def253bd97084552",
|
||||||
|
Source = CustomisationSource.DEFAULT,
|
||||||
|
Type = CustomisationType.ENVIRONMENT,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the game edition of a profile chosen on creation in Launcher
|
||||||
|
/// </summary>
|
||||||
|
public static string GetGameEdition(this SptProfile fullProfile)
|
||||||
|
{
|
||||||
|
var edition = fullProfile.CharacterData?.PmcData?.Info?.GameVersion;
|
||||||
|
if (edition is not null)
|
||||||
|
{
|
||||||
|
return edition;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edge case - profile not created yet, fall back to what launcher has set
|
||||||
|
var launcherEdition = fullProfile.ProfileInfo.Edition;
|
||||||
|
switch (launcherEdition.ToLower())
|
||||||
|
{
|
||||||
|
case "edge of darkness":
|
||||||
|
return GameEditions.EDGE_OF_DARKNESS;
|
||||||
|
case "unheard":
|
||||||
|
return GameEditions.UNHEARD;
|
||||||
|
default:
|
||||||
|
return GameEditions.STANDARD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add the given number of extra repeatable quests for the given type of repeatable to the users profile
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fullProfile">Profile to add the extra repeatable to</param>
|
||||||
|
/// <param name="repeatableId">The ID of the type of repeatable to increase</param>
|
||||||
|
/// <param name="rewardValue">The number of extra repeatables to add</param>
|
||||||
|
public static void AddExtraRepeatableQuest(
|
||||||
|
this SptProfile fullProfile,
|
||||||
|
string repeatableId,
|
||||||
|
double rewardValue
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fullProfile.SptData.ExtraRepeatableQuests ??= new Dictionary<string, double>();
|
||||||
|
|
||||||
|
if (!fullProfile.SptData.ExtraRepeatableQuests.TryAdd(repeatableId, 0))
|
||||||
|
{
|
||||||
|
fullProfile.SptData.ExtraRepeatableQuests[repeatableId] += rewardValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
using SPTarkov.Server.Core.Models.Eft.Common;
|
||||||
|
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
|
||||||
|
using SPTarkov.Server.Core.Models.Enums;
|
||||||
|
|
||||||
|
namespace SPTarkov.Server.Core.Extensions
|
||||||
|
{
|
||||||
|
public static class ProfileExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Return all quest items current in the supplied profile
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="profile">Profile to get quest items from</param>
|
||||||
|
/// <returns>List of item objects</returns>
|
||||||
|
public static List<Item> GetQuestItemsInProfile(this PmcData profile)
|
||||||
|
{
|
||||||
|
return profile
|
||||||
|
?.Inventory?.Items.Where(i => i.ParentId == profile.Inventory.QuestRaidItems)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="profile">Profile to upgrade wall in</param>
|
||||||
|
public static void UnlockHideoutWallInProfile(this PmcData profile)
|
||||||
|
{
|
||||||
|
var profileHideoutAreas = profile.Hideout.Areas;
|
||||||
|
var waterCollector = profileHideoutAreas.FirstOrDefault(x =>
|
||||||
|
x.Type == HideoutAreas.WaterCollector
|
||||||
|
);
|
||||||
|
var medStation = profileHideoutAreas.FirstOrDefault(x =>
|
||||||
|
x.Type == HideoutAreas.MedStation
|
||||||
|
);
|
||||||
|
var wall = profileHideoutAreas.FirstOrDefault(x =>
|
||||||
|
x.Type == HideoutAreas.EmergencyWall
|
||||||
|
);
|
||||||
|
|
||||||
|
// No collector or med station, skip
|
||||||
|
if (waterCollector is null && medStation is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If med-station > level 1 AND water collector > level 1 AND wall is level 0
|
||||||
|
if (waterCollector?.Level >= 1 && medStation?.Level >= 1 && wall?.Level <= 0)
|
||||||
|
{
|
||||||
|
wall.Level = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Does the provided profile contain any condition counters
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="profile"> Profile to check for condition counters </param>
|
||||||
|
/// <returns> Profile has condition counters </returns>
|
||||||
|
public static bool ProfileHasConditionCounters(this PmcData profile)
|
||||||
|
{
|
||||||
|
if (profile.TaskConditionCounters is null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return profile.TaskConditionCounters.Count > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1494,32 +1494,6 @@ public class HideoutHelper(
|
|||||||
pmcData.Hideout.Production[BitcoinFarm].Products = [];
|
pmcData.Hideout.Production[BitcoinFarm].Products = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="profileData">Profile to upgrade wall in</param>
|
|
||||||
public void UnlockHideoutWallInProfile(PmcData profileData)
|
|
||||||
{
|
|
||||||
var profileHideoutAreas = profileData.Hideout.Areas;
|
|
||||||
var waterCollector = profileHideoutAreas.FirstOrDefault(x =>
|
|
||||||
x.Type == HideoutAreas.WaterCollector
|
|
||||||
);
|
|
||||||
var medStation = profileHideoutAreas.FirstOrDefault(x => x.Type == HideoutAreas.MedStation);
|
|
||||||
var wall = profileHideoutAreas.FirstOrDefault(x => x.Type == HideoutAreas.EmergencyWall);
|
|
||||||
|
|
||||||
// No collector or med station, skip
|
|
||||||
if (waterCollector is null && medStation is null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If med-station > level 1 AND water collector > level 1 AND wall is level 0
|
|
||||||
if (waterCollector?.Level >= 1 && medStation?.Level >= 1 && wall?.Level <= 0)
|
|
||||||
{
|
|
||||||
wall.Level = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Hideout improvement is flagged as complete
|
/// Hideout improvement is flagged as complete
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using SPTarkov.DI.Annotations;
|
using SPTarkov.DI.Annotations;
|
||||||
|
using SPTarkov.Server.Core.Extensions;
|
||||||
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
|
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
|
||||||
using SPTarkov.Server.Core.Models.Eft.Profile;
|
using SPTarkov.Server.Core.Models.Eft.Profile;
|
||||||
using SPTarkov.Server.Core.Models.Enums;
|
using SPTarkov.Server.Core.Models.Enums;
|
||||||
@@ -176,11 +177,7 @@ public class PrestigeHelper
|
|||||||
}
|
}
|
||||||
case RewardType.ExtraDailyQuest:
|
case RewardType.ExtraDailyQuest:
|
||||||
{
|
{
|
||||||
_profileHelper.AddExtraRepeatableQuest(
|
newProfile.AddExtraRepeatableQuest(reward.Target, (double)reward.Value);
|
||||||
newProfile,
|
|
||||||
reward.Target,
|
|
||||||
(double)reward.Value
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -685,18 +685,6 @@ public class ProfileHelper(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return all quest items current in the supplied profile
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="profile">Profile to get quest items from</param>
|
|
||||||
/// <returns>List of item objects</returns>
|
|
||||||
public List<Item> GetQuestItemsInProfile(PmcData profile)
|
|
||||||
{
|
|
||||||
return profile
|
|
||||||
?.Inventory?.Items.Where(i => i.ParentId == profile.Inventory.QuestRaidItems)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a favorites list in the format expected by the GetOtherProfile call
|
/// Return a favorites list in the format expected by the GetOtherProfile call
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -790,26 +778,6 @@ public class ProfileHelper(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add the given number of extra repeatable quests for the given type of repeatable to the users profile
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fullProfile">Profile to add the extra repeatable to</param>
|
|
||||||
/// <param name="repeatableId">The ID of the type of repeatable to increase</param>
|
|
||||||
/// <param name="rewardValue">The number of extra repeatables to add</param>
|
|
||||||
public void AddExtraRepeatableQuest(
|
|
||||||
SptProfile fullProfile,
|
|
||||||
string repeatableId,
|
|
||||||
double rewardValue
|
|
||||||
)
|
|
||||||
{
|
|
||||||
fullProfile.SptData.ExtraRepeatableQuests ??= new Dictionary<string, double>();
|
|
||||||
|
|
||||||
if (!fullProfile.SptData.ExtraRepeatableQuests.TryAdd(repeatableId, 0))
|
|
||||||
{
|
|
||||||
fullProfile.SptData.ExtraRepeatableQuests[repeatableId] += rewardValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a profile template by the account and side
|
/// Get a profile template by the account and side
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using SPTarkov.DI.Annotations;
|
using SPTarkov.DI.Annotations;
|
||||||
|
using SPTarkov.Server.Core.Extensions;
|
||||||
using SPTarkov.Server.Core.Models.Common;
|
using SPTarkov.Server.Core.Models.Common;
|
||||||
using SPTarkov.Server.Core.Models.Eft.Common;
|
using SPTarkov.Server.Core.Models.Eft.Common;
|
||||||
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
|
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
|
||||||
@@ -192,7 +193,7 @@ public class TraderHelper(
|
|||||||
if (clothing?.Count > 0)
|
if (clothing?.Count > 0)
|
||||||
// Force suit ids into profile
|
// Force suit ids into profile
|
||||||
{
|
{
|
||||||
AddSuitsToProfile(fullProfile, clothing.Select(suit => suit.SuiteId).ToList());
|
fullProfile.AddSuitsToProfile(clothing.Select(suit => suit.SuiteId).ToList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,36 +247,6 @@ public class TraderHelper(
|
|||||||
return rawProfileTemplate.InitialStanding["default"];
|
return rawProfileTemplate.InitialStanding["default"];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add a list of suit ids to a profiles suit list, no duplicates
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fullProfile">Profile to add clothing to</param>
|
|
||||||
/// <param name="clothingIds">Clothing Ids to add to profile</param>
|
|
||||||
public void AddSuitsToProfile(SptProfile fullProfile, List<string> clothingIds)
|
|
||||||
{
|
|
||||||
fullProfile.CustomisationUnlocks ??= [];
|
|
||||||
|
|
||||||
foreach (var suitId in clothingIds)
|
|
||||||
{
|
|
||||||
if (
|
|
||||||
!fullProfile.CustomisationUnlocks.Exists(customisation =>
|
|
||||||
customisation.Id == suitId
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Clothing item doesn't exist in profile, add it
|
|
||||||
fullProfile.CustomisationUnlocks.Add(
|
|
||||||
new CustomisationStorage
|
|
||||||
{
|
|
||||||
Id = suitId,
|
|
||||||
Source = CustomisationSource.UNLOCKED_IN_GAME,
|
|
||||||
Type = CustomisationType.SUITE,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Alter a traders unlocked status
|
/// Alter a traders unlocked status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using SPTarkov.DI.Annotations;
|
using SPTarkov.DI.Annotations;
|
||||||
|
using SPTarkov.Server.Core.Extensions;
|
||||||
using SPTarkov.Server.Core.Generators;
|
using SPTarkov.Server.Core.Generators;
|
||||||
using SPTarkov.Server.Core.Helpers;
|
using SPTarkov.Server.Core.Helpers;
|
||||||
using SPTarkov.Server.Core.Models.Eft.Common;
|
using SPTarkov.Server.Core.Models.Eft.Common;
|
||||||
@@ -122,9 +123,9 @@ public class CreateProfileService(
|
|||||||
CustomisationUnlocks = [],
|
CustomisationUnlocks = [],
|
||||||
};
|
};
|
||||||
|
|
||||||
AddCustomisationUnlocksToProfile(profileDetails);
|
profileDetails.AddCustomisationUnlocksToProfile();
|
||||||
|
|
||||||
_traderHelper.AddSuitsToProfile(profileDetails, profileTemplateClone.Suits);
|
profileDetails.AddSuitsToProfile(profileTemplateClone.Suits);
|
||||||
|
|
||||||
_profileFixerService.CheckForAndFixPmcProfileIssues(profileDetails.CharacterData.PmcData);
|
_profileFixerService.CheckForAndFixPmcProfileIssues(profileDetails.CharacterData.PmcData);
|
||||||
|
|
||||||
@@ -339,173 +340,6 @@ public class CreateProfileService(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add customisations to game profiles based on game edition
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fullProfile">Profile to add customisations to</param>
|
|
||||||
public void AddCustomisationUnlocksToProfile(SptProfile fullProfile)
|
|
||||||
{
|
|
||||||
// Some game versions have additional customisation unlocks
|
|
||||||
var gameEdition = GetGameEdition(fullProfile);
|
|
||||||
if (gameEdition is null)
|
|
||||||
{
|
|
||||||
_logger.Error(
|
|
||||||
$"Unable to get Game edition of profile: {fullProfile.ProfileInfo.ProfileId}, skipping customisation unlocks"
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (gameEdition)
|
|
||||||
{
|
|
||||||
case GameEditions.EDGE_OF_DARKNESS:
|
|
||||||
// Gets EoD tags
|
|
||||||
fullProfile.CustomisationUnlocks.Add(
|
|
||||||
new CustomisationStorage
|
|
||||||
{
|
|
||||||
Id = "6746fd09bafff85008048838",
|
|
||||||
Source = CustomisationSource.DEFAULT,
|
|
||||||
Type = CustomisationType.DOG_TAG,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
fullProfile.CustomisationUnlocks.Add(
|
|
||||||
new CustomisationStorage
|
|
||||||
{
|
|
||||||
Id = "67471938bafff850080488b7",
|
|
||||||
Source = CustomisationSource.DEFAULT,
|
|
||||||
Type = CustomisationType.DOG_TAG,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case GameEditions.UNHEARD:
|
|
||||||
// Gets EoD+Unheard tags
|
|
||||||
fullProfile.CustomisationUnlocks.Add(
|
|
||||||
new CustomisationStorage
|
|
||||||
{
|
|
||||||
Id = "6746fd09bafff85008048838",
|
|
||||||
Source = CustomisationSource.DEFAULT,
|
|
||||||
Type = CustomisationType.DOG_TAG,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
fullProfile.CustomisationUnlocks.Add(
|
|
||||||
new CustomisationStorage
|
|
||||||
{
|
|
||||||
Id = "67471938bafff850080488b7",
|
|
||||||
Source = CustomisationSource.DEFAULT,
|
|
||||||
Type = CustomisationType.DOG_TAG,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
fullProfile.CustomisationUnlocks.Add(
|
|
||||||
new CustomisationStorage
|
|
||||||
{
|
|
||||||
Id = "67471928d17d6431550563b5",
|
|
||||||
Source = CustomisationSource.DEFAULT,
|
|
||||||
Type = CustomisationType.DOG_TAG,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
fullProfile.CustomisationUnlocks.Add(
|
|
||||||
new CustomisationStorage
|
|
||||||
{
|
|
||||||
Id = "6747193f170146228c0d2226",
|
|
||||||
Source = CustomisationSource.DEFAULT,
|
|
||||||
Type = CustomisationType.DOG_TAG,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Unheard Clothing (Cultist Hood)
|
|
||||||
fullProfile.CustomisationUnlocks.Add(
|
|
||||||
new CustomisationStorage
|
|
||||||
{
|
|
||||||
Id = "666841a02537107dc508b704",
|
|
||||||
Source = CustomisationSource.DEFAULT,
|
|
||||||
Type = CustomisationType.SUITE,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Unheard background
|
|
||||||
fullProfile.CustomisationUnlocks.Add(
|
|
||||||
new CustomisationStorage
|
|
||||||
{
|
|
||||||
Id = "675850ba33627edb710b0592",
|
|
||||||
Source = CustomisationSource.DEFAULT,
|
|
||||||
Type = CustomisationType.ENVIRONMENT,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
var pretigeLevel = fullProfile?.CharacterData?.PmcData?.Info?.PrestigeLevel;
|
|
||||||
if (pretigeLevel is not null)
|
|
||||||
{
|
|
||||||
if (pretigeLevel >= 1)
|
|
||||||
{
|
|
||||||
fullProfile.CustomisationUnlocks.Add(
|
|
||||||
new CustomisationStorage
|
|
||||||
{
|
|
||||||
Id = "674dbf593bee1152d407f005",
|
|
||||||
Source = CustomisationSource.DEFAULT,
|
|
||||||
Type = CustomisationType.DOG_TAG,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pretigeLevel >= 2)
|
|
||||||
{
|
|
||||||
fullProfile.CustomisationUnlocks.Add(
|
|
||||||
new CustomisationStorage
|
|
||||||
{
|
|
||||||
Id = "675dcfea7ae1a8792107ca99",
|
|
||||||
Source = CustomisationSource.DEFAULT,
|
|
||||||
Type = CustomisationType.DOG_TAG,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dev profile additions
|
|
||||||
if (fullProfile.ProfileInfo.Edition.ToLower().Contains("developer"))
|
|
||||||
// CyberTark background
|
|
||||||
{
|
|
||||||
fullProfile.CustomisationUnlocks.Add(
|
|
||||||
new CustomisationStorage
|
|
||||||
{
|
|
||||||
Id = "67585108def253bd97084552",
|
|
||||||
Source = CustomisationSource.DEFAULT,
|
|
||||||
Type = CustomisationType.ENVIRONMENT,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the game edition of a profile chosen on creation in Launcher
|
|
||||||
/// </summary>
|
|
||||||
private string? GetGameEdition(SptProfile profile)
|
|
||||||
{
|
|
||||||
var edition = profile.CharacterData?.PmcData?.Info?.GameVersion;
|
|
||||||
if (edition is not null)
|
|
||||||
{
|
|
||||||
return edition;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Edge case - profile not created yet, fall back to what launcher has set
|
|
||||||
var launcherEdition = profile.ProfileInfo.Edition;
|
|
||||||
switch (launcherEdition.ToLower())
|
|
||||||
{
|
|
||||||
case "edge of darkness":
|
|
||||||
return GameEditions.EDGE_OF_DARKNESS;
|
|
||||||
case "unheard":
|
|
||||||
return GameEditions.UNHEARD;
|
|
||||||
default:
|
|
||||||
return GameEditions.STANDARD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Iterate over all quests in player profile, inspect rewards for the quests current state (accepted/completed)
|
/// Iterate over all quests in player profile, inspect rewards for the quests current state (accepted/completed)
|
||||||
/// and send rewards to them in mail
|
/// and send rewards to them in mail
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using SPTarkov.DI.Annotations;
|
using SPTarkov.DI.Annotations;
|
||||||
|
using SPTarkov.Server.Core.Extensions;
|
||||||
using SPTarkov.Server.Core.Generators;
|
using SPTarkov.Server.Core.Generators;
|
||||||
using SPTarkov.Server.Core.Helpers;
|
using SPTarkov.Server.Core.Helpers;
|
||||||
using SPTarkov.Server.Core.Models.Eft.Common;
|
using SPTarkov.Server.Core.Models.Eft.Common;
|
||||||
@@ -763,7 +764,7 @@ public class LocationLifecycleService
|
|||||||
// Copy scav fence values to PMC profile
|
// Copy scav fence values to PMC profile
|
||||||
pmcProfile.TradersInfo[Traders.FENCE] = scavProfile.TradersInfo[Traders.FENCE];
|
pmcProfile.TradersInfo[Traders.FENCE] = scavProfile.TradersInfo[Traders.FENCE];
|
||||||
|
|
||||||
if (ProfileHasConditionCounters(scavProfile))
|
if (scavProfile.ProfileHasConditionCounters())
|
||||||
// Scav quest progress needs to be moved to pmc so player can see it in menu / hand them in
|
// Scav quest progress needs to be moved to pmc so player can see it in menu / hand them in
|
||||||
{
|
{
|
||||||
MigrateScavQuestProgressToPmcProfile(scavProfile, pmcProfile);
|
MigrateScavQuestProgressToPmcProfile(scavProfile, pmcProfile);
|
||||||
@@ -876,21 +877,6 @@ public class LocationLifecycleService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Does the provided profile contain any condition counters
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="profile"> Profile to check for condition counters </param>
|
|
||||||
/// <returns> Profile has condition counters </returns>
|
|
||||||
protected bool ProfileHasConditionCounters(PmcData profile)
|
|
||||||
{
|
|
||||||
if (profile.TaskConditionCounters is null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return profile.TaskConditionCounters.Count > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles PMC Profile after the raid
|
/// Handles PMC Profile after the raid
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -919,7 +905,7 @@ public class LocationLifecycleService
|
|||||||
|
|
||||||
// MUST occur BEFORE inventory actions (setInventory()) occur
|
// MUST occur BEFORE inventory actions (setInventory()) occur
|
||||||
// Player died, get quest items they lost for use later
|
// Player died, get quest items they lost for use later
|
||||||
var lostQuestItems = _profileHelper.GetQuestItemsInProfile(postRaidProfile);
|
var lostQuestItems = postRaidProfile.GetQuestItemsInProfile();
|
||||||
|
|
||||||
// Update inventory
|
// Update inventory
|
||||||
_inRaidHelper.SetInventory(sessionId, pmcProfile, postRaidProfile, isSurvived, isTransfer);
|
_inRaidHelper.SetInventory(sessionId, pmcProfile, postRaidProfile, isSurvived, isTransfer);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using SPTarkov.DI.Annotations;
|
|||||||
using SPTarkov.Server.Core.Helpers;
|
using SPTarkov.Server.Core.Helpers;
|
||||||
using SPTarkov.Server.Core.Models.Eft.Common;
|
using SPTarkov.Server.Core.Models.Eft.Common;
|
||||||
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
|
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
|
||||||
|
using SPTarkov.Server.Core.Models.Eft.Hideout;
|
||||||
using SPTarkov.Server.Core.Models.Eft.Profile;
|
using SPTarkov.Server.Core.Models.Eft.Profile;
|
||||||
using SPTarkov.Server.Core.Models.Enums;
|
using SPTarkov.Server.Core.Models.Enums;
|
||||||
using SPTarkov.Server.Core.Models.Spt.Config;
|
using SPTarkov.Server.Core.Models.Spt.Config;
|
||||||
@@ -961,10 +962,12 @@ public class ProfileFixerService(
|
|||||||
/// Iterate over players hideout areas and find what's built, look for missing bonuses those areas give and add them if missing
|
/// Iterate over players hideout areas and find what's built, look for missing bonuses those areas give and add them if missing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pmcProfile"> Profile to update </param>
|
/// <param name="pmcProfile"> Profile to update </param>
|
||||||
public void AddMissingHideoutBonusesToProfile(PmcData pmcProfile)
|
/// <param name="dbHideoutAreas"></param>
|
||||||
|
public void AddMissingHideoutBonusesToProfile(
|
||||||
|
PmcData pmcProfile,
|
||||||
|
List<HideoutArea>? dbHideoutAreas
|
||||||
|
)
|
||||||
{
|
{
|
||||||
var dbHideoutAreas = _databaseService.GetHideout().Areas;
|
|
||||||
|
|
||||||
foreach (var profileArea in pmcProfile.Hideout?.Areas ?? [])
|
foreach (var profileArea in pmcProfile.Hideout?.Areas ?? [])
|
||||||
{
|
{
|
||||||
var areaType = profileArea.Type;
|
var areaType = profileArea.Type;
|
||||||
|
|||||||
Reference in New Issue
Block a user