Skip to content

Add AdjustSkillExpForLowLevels to AddSkillPointsToPlayer#738

Merged
ArchangelWTF merged 7 commits intosp-tarkov:developfrom
rootdarkarchon:develop
Feb 13, 2026
Merged

Add AdjustSkillExpForLowLevels to AddSkillPointsToPlayer#738
ArchangelWTF merged 7 commits intosp-tarkov:developfrom
rootdarkarchon:develop

Conversation

@rootdarkarchon
Copy link
Contributor

This PR aims to add scaled skill leveling for hideout actions to mimic the clients and live Tarkov's behavior.
As the internal progress per level is always 100, but the visual on the UI changes in the first 10 levels (starts at 10, +10 per level), it is necessary to scale the internal progression when provided with skill progression values.
Expectation is calling AddSkillPointsToPlayer with 0.4 pointsToAddToSkill should increase the progression on the UI for the player by 0.4. Currently this is not done, leading the leveling of levels 1-10 take as long as any other level beyond that for skills provided through the SPT server.

It is based on the unused QuestHelper.AdjustSkillExpForLowLevels, which has been moved to ProfileHelper, refactored and the original unused function removed.

Unit tests were added with exhaustive examples for adding skill points within 1-11, multi-level boundaries for each level between 1-11 and skill point assignments leading to multiple level jumps.

@qodo-free-for-open-source-projects
Copy link

qodo-free-for-open-source-projects bot commented Feb 12, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Use adjusted skill points for session
Suggestion Impact:The commit introduces an adjustedSkillProgress variable from AdjustSkillExpForLowLevels and uses it to increment both profileSkill.Progress and profileSkill.PointsEarnedDuringSession, fixing the inconsistency where session points used the unadjusted value.

code diff:

+        if (InventoryConfig.SkillGainMultipliers.TryGetValue(skill.ToString(), out var multiplier))
+        {
+            pointsToAddToSkill *= multiplier;
+        }
+
+        var adjustedSkillProgress = AdjustSkillExpForLowLevels(profileSkill.Progress, pointsToAddToSkill);
+        profileSkill.Progress += adjustedSkillProgress;
         profileSkill.Progress = Math.Min(profileSkill.Progress, 5100); // Prevent skill from ever going above level 51 (5100)
 
-        profileSkill.PointsEarnedDuringSession += pointsToAddToSkill;
+        profileSkill.PointsEarnedDuringSession += adjustedSkillProgress;
 

Store the adjusted skill points in a variable and use it to update both
profileSkill.Progress and profileSkill.PointsEarnedDuringSession to ensure data
consistency.

Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs [520-523]

-profileSkill.Progress += AdjustSkillExpForLowLevels(profileSkill.Progress, pointsToAddToSkill);
+var adjustedPoints = AdjustSkillExpForLowLevels(profileSkill.Progress, pointsToAddToSkill);
+profileSkill.Progress += adjustedPoints;
 profileSkill.Progress = Math.Min(profileSkill.Progress, 5100); // Prevent skill from ever going above level 51 (5100)
 
-profileSkill.PointsEarnedDuringSession += pointsToAddToSkill;
+profileSkill.PointsEarnedDuringSession += adjustedPoints;
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies a bug where PointsEarnedDuringSession is incremented with the wrong value, leading to inconsistent data. Applying this fix is crucial for correct skill progression tracking.

Medium
Learned
best practice
Remove redundant dictionary lookup
Suggestion Impact:Updated the code to capture the multiplier via TryGetValue (out var multiplier) and use it directly, eliminating the second dictionary lookup.

code diff:

-        if (InventoryConfig.SkillGainMultipliers.TryGetValue(skill.ToString(), out _))
-        {
-            pointsToAddToSkill *= InventoryConfig.SkillGainMultipliers[skill.ToString()];
-        }
-
-        profileSkill.Progress += AdjustSkillExpForLowLevels(profileSkill.Progress, pointsToAddToSkill);
+        if (InventoryConfig.SkillGainMultipliers.TryGetValue(skill.ToString(), out var multiplier))
+        {
+            pointsToAddToSkill *= multiplier;
+        }

Avoid the second dictionary lookup by capturing the multiplier via TryGetValue
and using the out variable directly.

Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs [515-518]

-if (InventoryConfig.SkillGainMultipliers.TryGetValue(skill.ToString(), out _))
+if (InventoryConfig.SkillGainMultipliers.TryGetValue(skill.ToString(), out var multiplier))
 {
-    pointsToAddToSkill *= InventoryConfig.SkillGainMultipliers[skill.ToString()];
+    pointsToAddToSkill *= multiplier;
 }
Suggestion importance[1-10]: 6

__

Why:
Relevant best practice - When accessing dictionary values, use TryGetValue with the out parameter result to avoid redundant lookups.

Low
  • Update

@ArchangelWTF ArchangelWTF merged commit effb5cc into sp-tarkov:develop Feb 13, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants