Updated profile SkillTypes property to use string to enum converter
Updated surrounding properties to not be null Updated related code to reflect nullability change
This commit is contained in:
@@ -192,7 +192,7 @@ public class InventoryController(
|
||||
continue;
|
||||
}
|
||||
|
||||
profileSkill.Progress = mailEvent.Value;
|
||||
profileSkill.Progress = (double)mailEvent.Value;
|
||||
logger.Success($"Set profile skill: {mailEvent.Entity} to: {mailEvent.Value}");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1138,7 +1138,7 @@ public class HideoutHelper(
|
||||
// If the level is 51 we need to round it at 50 so on elite you dont get 25.5%
|
||||
// at level 1 you already get 0.5%, so it goes up until level 50. For some reason the wiki
|
||||
// says that it caps at level 51 with 25% but as per dump data that is incorrect apparently
|
||||
var roundedLevel = Math.Floor(hideoutManagementSkill.Progress / 100 ?? 0D);
|
||||
var roundedLevel = Math.Floor(hideoutManagementSkill.Progress / 100);
|
||||
roundedLevel = roundedLevel == 51 ? roundedLevel - 1 : roundedLevel;
|
||||
|
||||
return roundedLevel
|
||||
@@ -1164,7 +1164,7 @@ public class HideoutHelper(
|
||||
// If the level is 51 we need to round it at 50 so on elite you dont get 25.5%
|
||||
// at level 1 you already get 0.5%, so it goes up until level 50. For some reason the wiki
|
||||
// says that it caps at level 51 with 25% but as per dump data that is incorrect apparently
|
||||
var roundedLevel = Math.Floor(profileSkill.Progress / 100 ?? 0D);
|
||||
var roundedLevel = Math.Floor(profileSkill.Progress / 100);
|
||||
roundedLevel = roundedLevel == 51 ? roundedLevel - 1 : roundedLevel;
|
||||
|
||||
return roundedLevel * valuePerLevel / 100;
|
||||
@@ -1309,7 +1309,7 @@ public class HideoutHelper(
|
||||
var bonus = GetDogtagCombatSkillBonusPercent(pmcData, activeDogtags) * hideoutManagementSkillBonusPercent;
|
||||
|
||||
// Update bonus value to above calcualted value
|
||||
combatBonusProfile.Value = Math.Round(bonus ?? 0, 2);
|
||||
combatBonusProfile.Value = Math.Round(bonus, 2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -135,7 +135,7 @@ public class PrestigeHelper(
|
||||
case RewardType.Skill:
|
||||
if (Enum.TryParse(reward.Target, out SkillTypes result))
|
||||
{
|
||||
profileHelper.AddSkillPointsToPlayer(newProfile.CharacterData.PmcData, result, reward.Value);
|
||||
profileHelper.AddSkillPointsToPlayer(newProfile.CharacterData.PmcData, result, reward.Value.GetValueOrDefault(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -478,7 +478,7 @@ public class ProfileHelper(
|
||||
public void AddSkillPointsToPlayer(
|
||||
PmcData pmcProfile,
|
||||
SkillTypes skill,
|
||||
double? pointsToAddToSkill,
|
||||
double pointsToAddToSkill,
|
||||
bool useSkillProgressRateMultiplier = false
|
||||
)
|
||||
{
|
||||
@@ -516,7 +516,6 @@ public class ProfileHelper(
|
||||
profileSkill.Progress += pointsToAddToSkill;
|
||||
profileSkill.Progress = Math.Min(profileSkill?.Progress ?? 0D, 5100); // Prevent skill from ever going above level 51 (5100)
|
||||
|
||||
profileSkill.PointsEarnedDuringSession ??= 0;
|
||||
profileSkill.PointsEarnedDuringSession += pointsToAddToSkill;
|
||||
|
||||
profileSkill.LastAccess = timeUtil.GetTimeStamp();
|
||||
|
||||
@@ -140,7 +140,7 @@ public class QuestHelper(
|
||||
logger.Debug($"currentLevelRemainingProgress: {currentLevelRemainingProgress}");
|
||||
}
|
||||
|
||||
var progressToAdd = Math.Min(remainingProgress, currentLevelRemainingProgress ?? 0);
|
||||
var progressToAdd = Math.Min(remainingProgress, currentLevelRemainingProgress);
|
||||
var adjustedProgressToAdd = 10 / (currentLevel + 1) * progressToAdd;
|
||||
if (logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
|
||||
@@ -138,7 +138,7 @@ public class QuestRewardHelper(
|
||||
var hideoutManagementBonusMultiplier = hideoutManagementSkill != null ? 2 + hideoutManagementSkill.Progress / 1000 : 1;
|
||||
|
||||
// e.g 15% * 1.4
|
||||
return moneyRewardBonusPercent + hideoutManagementBonusMultiplier ?? 1;
|
||||
return moneyRewardBonusPercent + hideoutManagementBonusMultiplier;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -71,7 +71,11 @@ public class RewardHelper(
|
||||
{
|
||||
case RewardType.Skill:
|
||||
// This needs to use the passed in profileData, as it could be the scav profile
|
||||
profileHelper.AddSkillPointsToPlayer(profileData, Enum.Parse<SkillTypes>(reward.Target), reward.Value);
|
||||
profileHelper.AddSkillPointsToPlayer(
|
||||
profileData,
|
||||
Enum.Parse<SkillTypes>(reward.Target),
|
||||
reward.Value.GetValueOrDefault(0)
|
||||
);
|
||||
break;
|
||||
case RewardType.Experience:
|
||||
profileHelper.AddExperienceToPmc(sessionId.Value, int.Parse(reward.Value.ToString())); // this must occur first as the output object needs to take the modified profile exp value
|
||||
|
||||
@@ -447,7 +447,7 @@ public record Skills
|
||||
|
||||
public IEnumerable<MasterySkill>? Mastering { get; set; }
|
||||
|
||||
public double? Points { get; set; }
|
||||
public double Points { get; set; }
|
||||
}
|
||||
|
||||
public record MasterySkill
|
||||
@@ -455,9 +455,9 @@ public record MasterySkill
|
||||
[JsonExtensionData]
|
||||
public Dictionary<string, object>? ExtensionData { get; set; }
|
||||
|
||||
public string? Id { get; set; }
|
||||
public string Id { get; set; }
|
||||
|
||||
public double? Progress { get; set; }
|
||||
public double Progress { get; set; }
|
||||
}
|
||||
|
||||
public record CommonSkill
|
||||
@@ -465,13 +465,14 @@ public record CommonSkill
|
||||
[JsonExtensionData]
|
||||
public Dictionary<string, object>? ExtensionData { get; set; }
|
||||
|
||||
public double? PointsEarnedDuringSession { get; set; }
|
||||
public double PointsEarnedDuringSession { get; set; }
|
||||
|
||||
public long? LastAccess { get; set; }
|
||||
public long LastAccess { get; set; }
|
||||
|
||||
public SkillTypes? Id { get; set; }
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public SkillTypes Id { get; set; }
|
||||
|
||||
public double? Progress { get; set; }
|
||||
public double Progress { get; set; }
|
||||
|
||||
[JsonPropertyName("max")]
|
||||
public int? Max { get; set; }
|
||||
|
||||
@@ -183,7 +183,7 @@ public class RepairService(
|
||||
var pointsToAddToVestSkill = repairDetails.RepairPoints * _repairConfig.ArmorKitSkillPointGainPerRepairPointMultiplier;
|
||||
|
||||
logger.Debug($"Added: {pointsToAddToVestSkill} {vestSkillToLevel} skill");
|
||||
profileHelper.AddSkillPointsToPlayer(pmcData, vestSkillToLevel, pointsToAddToVestSkill);
|
||||
profileHelper.AddSkillPointsToPlayer(pmcData, vestSkillToLevel, pointsToAddToVestSkill.GetValueOrDefault(0));
|
||||
}
|
||||
|
||||
// Handle giving INT to player - differs if using kit/trader and weapon vs armor
|
||||
|
||||
Reference in New Issue
Block a user