``` ~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js ```
22 lines
720 B
JavaScript
22 lines
720 B
JavaScript
import { ClassAccessors } from '../Class';
|
|
import { DataOriginTypeEnum } from '../DataOrigin';
|
|
import { getLevelDivisor } from './accessors';
|
|
export function deriveContextLevelChallengeMax(rule, dataOrigin, xpInfo) {
|
|
if (!getLevelDivisor(rule)) {
|
|
return null;
|
|
}
|
|
let levelDivisor = getLevelDivisor(rule);
|
|
if (levelDivisor === null) {
|
|
levelDivisor = 1;
|
|
}
|
|
if (dataOrigin) {
|
|
switch (dataOrigin.type) {
|
|
case DataOriginTypeEnum.CLASS_FEATURE:
|
|
return Math.floor(ClassAccessors.getLevel(dataOrigin.parent) / levelDivisor);
|
|
default:
|
|
// not implemented
|
|
}
|
|
}
|
|
return Math.floor(xpInfo.currentLevel / levelDivisor);
|
|
}
|