From 9f189f2e158e91d63e5904712c1241e529c03c8d Mon Sep 17 00:00:00 2001 From: rootdarkarchon Date: Sat, 7 Feb 2026 19:45:31 +0100 Subject: [PATCH] Adjustments for Int/Cha progression in Hideout (#737) * Fixup of some skill handling in hideout * fix format * add limited backwards compat and fix repair int value * more logging and fixes * fix charisma gain from repair * revert divisor into multiplier * run csharpier format * undo formating/unnecessary files * add debug guards --------- Co-authored-by: rootdarkarchon --- .../SPT_Data/configs/repair.json | 8 ++---- .../Controllers/HideoutController.cs | 3 +++ .../Controllers/InsuranceController.cs | 5 +++- .../Helpers/ProfileHelper.cs | 6 +++++ .../Models/Spt/Config/RepairConfig.cs | 5 ++-- .../Services/RepairService.cs | 27 ++++++++++++++----- 6 files changed, 38 insertions(+), 16 deletions(-) diff --git a/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/repair.json b/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/repair.json index ac2155f0..bea9e5d0 100644 --- a/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/repair.json +++ b/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/repair.json @@ -3,12 +3,8 @@ "applyRandomizeDurabilityLoss": true, "armorKitSkillPointGainPerRepairPointMultiplier": 0.05, "repairKitIntellectGainMultiplier": { - "weapon": 0.045, - "armor": 0.03 - }, - "maxIntellectGainPerRepair": { - "kit": 0.6, - "trader": 0.6 + "weapon": 0.111, + "armor": 0.077 }, "weaponTreatment": { "critSuccessChance": 0.1, diff --git a/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs b/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs index c770bf01..dcbeb709 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs @@ -687,6 +687,9 @@ public class HideoutController( ); pmcData.Hideout.Production[request.RecipeId].SptIsScavCase = true; + // reward charisma based on skill progress rate for each scav production start + profileHelper.AddSkillPointsToPlayer(pmcData, SkillTypes.Charisma, 1, true); + return output; } diff --git a/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs b/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs index 00ec9e5b..e2b61a70 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs @@ -774,7 +774,10 @@ public class InsuranceController( } } - profileHelper.AddSkillPointsToPlayer(pmcData, SkillTypes.Charisma, itemsToInsureCount * 0.01); + // give charisma skill points based on the total price of the insured items divded by 200000rub, multiplied by skill progress rate + double intSkillPoints = (itemsToPay.Sum(c => c.Count ?? 0) / 200000); + logger.Debug($"Insured {itemsToPay.Sum(c => c.Count ?? 0)} value, granting {intSkillPoints} {SkillTypes.Charisma} skill points."); + profileHelper.AddSkillPointsToPlayer(pmcData, SkillTypes.Charisma, intSkillPoints, true); return output; } diff --git a/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs index 2cf2017b..9b8c2ece 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs @@ -7,6 +7,7 @@ using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; +using SPTarkov.Server.Core.Models.Spt.Logging; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; @@ -509,6 +510,11 @@ public class ProfileHelper( profileSkill.PointsEarnedDuringSession += pointsToAddToSkill; + if (logger.IsLogEnabled(LogLevel.Debug)) + { + logger.Debug($"Added: {pointsToAddToSkill} points to skill: {skill}, new progress value is: {profileSkill.Progress}"); + } + profileSkill.LastAccess = timeUtil.GetTimeStamp(); } diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RepairConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RepairConfig.cs index c2330b41..3ec79693 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RepairConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RepairConfig.cs @@ -26,8 +26,9 @@ public record RepairConfig : BaseConfig /// /// How much INT can be given to player per repair action /// - [JsonPropertyName("maxIntellectGainPerRepair")] - public required MaxIntellectGainValues MaxIntellectGainPerRepair { get; set; } + [Obsolete("Only for backwards compatibility, does nothing")] + [JsonIgnore] + public MaxIntellectGainValues MaxIntellectGainPerRepair { get; set; } = new(); [JsonPropertyName("weaponTreatment")] public required WeaponTreatmentRepairValues WeaponTreatment { get; set; } diff --git a/Libraries/SPTarkov.Server.Core/Services/RepairService.cs b/Libraries/SPTarkov.Server.Core/Services/RepairService.cs index 137d0fed..edbc2cc9 100644 --- a/Libraries/SPTarkov.Server.Core/Services/RepairService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/RepairService.cs @@ -191,12 +191,26 @@ public class RepairService( profileHelper.AddSkillPointsToPlayer(pmcData, vestSkillToLevel, pointsToAddToVestSkill.GetValueOrDefault(0)); } + // Handle trader repair - gives charisma based on (repair cost/10 * skill progress rate) + if (!repairDetails.RepairedByKit.GetValueOrDefault(true) && repairDetails.RepairCost.HasValue) + { + var charismaFromRepair = repairDetails.RepairCost.Value / 10000; + logger.Debug($"Added: {charismaFromRepair} {SkillTypes.Charisma}"); + profileHelper.AddSkillPointsToPlayer(pmcData, SkillTypes.Charisma, charismaFromRepair, true); + } + // Handle giving INT to player - differs if using kit/trader and weapon vs armor var intellectGainedFromRepair = GetIntellectGainedFromRepair(repairDetails); if (intellectGainedFromRepair > 0) { - logger.Debug($"Added: {intellectGainedFromRepair} intellect skill"); - profileHelper.AddSkillPointsToPlayer(pmcData, SkillTypes.Intellect, intellectGainedFromRepair); + if (logger.IsLogEnabled(LogLevel.Debug)) + { + logger.Debug( + $"Added: {intellectGainedFromRepair} {SkillTypes.Intellect}, {intellectGainedFromRepair * 0.1} {SkillTypes.Charisma}" + ); + } + profileHelper.AddSkillPointsToPlayer(pmcData, SkillTypes.Intellect, intellectGainedFromRepair, true); + profileHelper.AddSkillPointsToPlayer(pmcData, SkillTypes.Charisma, intellectGainedFromRepair * 0.1, true); } } @@ -204,12 +218,11 @@ public class RepairService( { if (repairDetails.RepairedByKit.GetValueOrDefault(false)) { - // Weapons/armor have different multipliers + // Weapons/armor have different divisors var intRepairMultiplier = itemHelper.IsOfBaseclass(repairDetails.RepairedItem.Template, BaseClasses.WEAPON) ? RepairConfig.RepairKitIntellectGainMultiplier.Weapon : RepairConfig.RepairKitIntellectGainMultiplier.Armor; - // Limit gain to a max value defined in config.maxIntellectGainPerRepair if (repairDetails.RepairPoints is null) { logger.Error( @@ -217,11 +230,11 @@ public class RepairService( ); } - return Math.Min(repairDetails.RepairPoints.Value * intRepairMultiplier, RepairConfig.MaxIntellectGainPerRepair.Kit); + return repairDetails.RepairAmount.Value * intRepairMultiplier; } - // Trader repair - Not as accurate as kit, needs data from live - return Math.Min(repairDetails.RepairAmount.Value / 10, RepairConfig.MaxIntellectGainPerRepair.Trader); + // Trader repair does not give INT + return 0; } ///