@@ -185,15 +185,29 @@ export class ProgressionService {
185185 parentLocationId ,
186186 contractSession . gameVersion ,
187187 )
188+ const subPackageId =
189+ contractSession . gameVersion === "h1"
190+ ? ( contract . Metadata . Difficulty ?? "normal" )
191+ : ( sniperUnlockable ?? undefined )
188192 const locationData = this . getMasteryProgressionForLocation (
189193 userProfile ,
190194 parentLocationId ,
191- contractSession . gameVersion === "h1"
192- ? ( contract . Metadata . Difficulty ?? "normal" )
193- : ( sniperUnlockable ?? undefined ) ,
195+ subPackageId ,
194196 )
195197
196- const maxLevel = masteryData ?. MaxLevel || DEFAULT_MASTERY_MAXLEVEL
198+ // subpackages (e.g. H2016 professional mode) may override the max
199+ // level and the amount of XP required per level.
200+ const subPackage = subPackageId
201+ ? masteryData ?. SubPackages ?. find (
202+ ( pkg ) => pkg . Id === subPackageId ,
203+ )
204+ : undefined
205+
206+ const maxLevel =
207+ subPackage ?. MaxLevel ||
208+ masteryData ?. MaxLevel ||
209+ DEFAULT_MASTERY_MAXLEVEL
210+ const xpPerLevel = subPackage ?. XpPerLevel ?? masteryData ?. XpPerLevel
197211 const isEvergreenContract = contract . Metadata . Type === "evergreen"
198212
199213 if ( masteryData ) {
@@ -207,18 +221,15 @@ export class ProgressionService {
207221 ? xpRequiredForEvergreenLevel ( maxLevel )
208222 : sniperUnlockable
209223 ? xpRequiredForSniperLevel ( maxLevel )
210- : xpRequiredForLevel (
211- maxLevel ,
212- masteryData . XpPerLevel ,
213- ) ,
224+ : xpRequiredForLevel ( maxLevel , xpPerLevel ) ,
214225 )
215226
216227 locationData . Level = clampValue (
217228 isEvergreenContract
218229 ? evergreenLevelForXp ( locationData . Xp )
219230 : sniperUnlockable
220231 ? sniperLevelForXp ( locationData . Xp )
221- : levelForXp ( locationData . Xp , masteryData . XpPerLevel ) ,
232+ : levelForXp ( locationData . Xp , xpPerLevel ) ,
222233 1 ,
223234 maxLevel ,
224235 )
0 commit comments