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 <root.darkarchon@outlook.com>
This commit is contained in:
rootdarkarchon
2026-02-07 19:45:31 +01:00
committed by GitHub
parent 537ffad7f6
commit 9f189f2e15
6 changed files with 38 additions and 16 deletions
@@ -3,12 +3,8 @@
"applyRandomizeDurabilityLoss": true, "applyRandomizeDurabilityLoss": true,
"armorKitSkillPointGainPerRepairPointMultiplier": 0.05, "armorKitSkillPointGainPerRepairPointMultiplier": 0.05,
"repairKitIntellectGainMultiplier": { "repairKitIntellectGainMultiplier": {
"weapon": 0.045, "weapon": 0.111,
"armor": 0.03 "armor": 0.077
},
"maxIntellectGainPerRepair": {
"kit": 0.6,
"trader": 0.6
}, },
"weaponTreatment": { "weaponTreatment": {
"critSuccessChance": 0.1, "critSuccessChance": 0.1,
@@ -687,6 +687,9 @@ public class HideoutController(
); );
pmcData.Hideout.Production[request.RecipeId].SptIsScavCase = true; 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; return output;
} }
@@ -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; return output;
} }
@@ -7,6 +7,7 @@ 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;
using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Spt.Config;
using SPTarkov.Server.Core.Models.Spt.Logging;
using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Servers;
using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Services;
@@ -509,6 +510,11 @@ public class ProfileHelper(
profileSkill.PointsEarnedDuringSession += pointsToAddToSkill; 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(); profileSkill.LastAccess = timeUtil.GetTimeStamp();
} }
@@ -26,8 +26,9 @@ public record RepairConfig : BaseConfig
/// <summary> /// <summary>
/// How much INT can be given to player per repair action /// How much INT can be given to player per repair action
/// </summary> /// </summary>
[JsonPropertyName("maxIntellectGainPerRepair")] [Obsolete("Only for backwards compatibility, does nothing")]
public required MaxIntellectGainValues MaxIntellectGainPerRepair { get; set; } [JsonIgnore]
public MaxIntellectGainValues MaxIntellectGainPerRepair { get; set; } = new();
[JsonPropertyName("weaponTreatment")] [JsonPropertyName("weaponTreatment")]
public required WeaponTreatmentRepairValues WeaponTreatment { get; set; } public required WeaponTreatmentRepairValues WeaponTreatment { get; set; }
@@ -191,12 +191,26 @@ public class RepairService(
profileHelper.AddSkillPointsToPlayer(pmcData, vestSkillToLevel, pointsToAddToVestSkill.GetValueOrDefault(0)); 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 // Handle giving INT to player - differs if using kit/trader and weapon vs armor
var intellectGainedFromRepair = GetIntellectGainedFromRepair(repairDetails); var intellectGainedFromRepair = GetIntellectGainedFromRepair(repairDetails);
if (intellectGainedFromRepair > 0) if (intellectGainedFromRepair > 0)
{ {
logger.Debug($"Added: {intellectGainedFromRepair} intellect skill"); if (logger.IsLogEnabled(LogLevel.Debug))
profileHelper.AddSkillPointsToPlayer(pmcData, SkillTypes.Intellect, intellectGainedFromRepair); {
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)) if (repairDetails.RepairedByKit.GetValueOrDefault(false))
{ {
// Weapons/armor have different multipliers // Weapons/armor have different divisors
var intRepairMultiplier = itemHelper.IsOfBaseclass(repairDetails.RepairedItem.Template, BaseClasses.WEAPON) var intRepairMultiplier = itemHelper.IsOfBaseclass(repairDetails.RepairedItem.Template, BaseClasses.WEAPON)
? RepairConfig.RepairKitIntellectGainMultiplier.Weapon ? RepairConfig.RepairKitIntellectGainMultiplier.Weapon
: RepairConfig.RepairKitIntellectGainMultiplier.Armor; : RepairConfig.RepairKitIntellectGainMultiplier.Armor;
// Limit gain to a max value defined in config.maxIntellectGainPerRepair
if (repairDetails.RepairPoints is null) if (repairDetails.RepairPoints is null)
{ {
logger.Error( 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 // Trader repair does not give INT
return Math.Min(repairDetails.RepairAmount.Value / 10, RepairConfig.MaxIntellectGainPerRepair.Trader); return 0;
} }
/// <summary> /// <summary>