Grabbed dndbeyond's source code
``` ~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js ```
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
import { HelperUtils } from '../Helper';
|
||||
import { generateEntityContextKey, generateEntityKey, generateUniqueKey } from './generators';
|
||||
/**
|
||||
*
|
||||
* @param charValue
|
||||
*/
|
||||
export function getUniqueKey(charValue) {
|
||||
return generateUniqueKey(getTypeId(charValue), getValueId(charValue), getValueTypeId(charValue), getContextId(charValue), getContextTypeId(charValue));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param charValue
|
||||
*/
|
||||
export function getEntityContextKey(charValue) {
|
||||
return generateEntityContextKey(getValueId(charValue), getValueTypeId(charValue), getContextId(charValue), getContextTypeId(charValue));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param charValue
|
||||
*/
|
||||
export function getEntityKey(charValue) {
|
||||
return generateEntityKey(getValueId(charValue), getValueTypeId(charValue));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param charValue
|
||||
*/
|
||||
export function getContextId(charValue) {
|
||||
return charValue.contextId;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param charValue
|
||||
*/
|
||||
export function getContextTypeId(charValue) {
|
||||
return charValue.contextTypeId;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param charValue
|
||||
*/
|
||||
export function getNotes(charValue) {
|
||||
var _a;
|
||||
return (_a = charValue === null || charValue === void 0 ? void 0 : charValue.notes) !== null && _a !== void 0 ? _a : null;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param charValue
|
||||
*/
|
||||
export function getTypeId(charValue) {
|
||||
return charValue.typeId;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param charValue
|
||||
*/
|
||||
export function getValue(charValue) {
|
||||
var _a;
|
||||
return (_a = charValue === null || charValue === void 0 ? void 0 : charValue.value) !== null && _a !== void 0 ? _a : null;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param charValue
|
||||
*/
|
||||
export function getValueId(charValue) {
|
||||
return charValue.valueId;
|
||||
}
|
||||
/**
|
||||
* temporary to handle transition for ids/entityTypeIds from numbers to strings
|
||||
* @param charValue
|
||||
*/
|
||||
export function getValueIntId(charValue) {
|
||||
if (charValue.valueId !== null) {
|
||||
return HelperUtils.parseInputInt(charValue.valueId, -1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param charValue
|
||||
*/
|
||||
export function getValueTypeId(charValue) {
|
||||
return charValue.valueTypeId;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
export var AdjustmentTypeEnum;
|
||||
(function (AdjustmentTypeEnum) {
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["OVERRIDE_AC"] = 1] = "OVERRIDE_AC";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["MAGIC_BONUS_AC"] = 2] = "MAGIC_BONUS_AC";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["MISC_BONUS_AC"] = 3] = "MISC_BONUS_AC";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["OVERRIDE_BASE_ARMOR"] = 4] = "OVERRIDE_BASE_ARMOR";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["OVERRIDE_PASSIVE_PERCEPTION"] = 5] = "OVERRIDE_PASSIVE_PERCEPTION";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["OVERRIDE_PASSIVE_INVESTIGATION"] = 6] = "OVERRIDE_PASSIVE_INVESTIGATION";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["OVERRIDE_PASSIVE_INSIGHT"] = 7] = "OVERRIDE_PASSIVE_INSIGHT";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["NAME_OVERRIDE"] = 8] = "NAME_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["NOTES"] = 9] = "NOTES";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["FIXED_VALUE_BONUS"] = 10] = "FIXED_VALUE_BONUS";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["FIXED_VALUE_OVERRIDE"] = 11] = "FIXED_VALUE_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["TO_HIT_BONUS"] = 12] = "TO_HIT_BONUS";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["TO_HIT_OVERRIDE"] = 13] = "TO_HIT_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["SAVE_DC_BONUS"] = 14] = "SAVE_DC_BONUS";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["SAVE_DC_OVERRIDE"] = 15] = "SAVE_DC_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["DISPLAY_AS_ATTACK"] = 16] = "DISPLAY_AS_ATTACK";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["IS_PROFICIENT"] = 17] = "IS_PROFICIENT";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["IS_OFFHAND"] = 18] = "IS_OFFHAND";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["COST_OVERRIDE"] = 19] = "COST_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["IS_SILVER"] = 20] = "IS_SILVER";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["IS_ADAMANTINE"] = 21] = "IS_ADAMANTINE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["WEIGHT_OVERRIDE"] = 22] = "WEIGHT_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["SKILL_OVERRIDE"] = 23] = "SKILL_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["SKILL_MISC_BONUS"] = 24] = "SKILL_MISC_BONUS";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["SKILL_MAGIC_BONUS"] = 25] = "SKILL_MAGIC_BONUS";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["SKILL_PROFICIENCY_LEVEL"] = 26] = "SKILL_PROFICIENCY_LEVEL";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["SKILL_STAT_OVERRIDE"] = 27] = "SKILL_STAT_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["IS_PACT_WEAPON"] = 28] = "IS_PACT_WEAPON";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["IS_HEXBLADE"] = 29] = "IS_HEXBLADE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["DICE_TYPE_OVERRIDE"] = 30] = "DICE_TYPE_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["DICE_COUNT_OVERRIDE"] = 31] = "DICE_COUNT_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["ARMOR_PROFICIENCY_LEVEL"] = 32] = "ARMOR_PROFICIENCY_LEVEL";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["WEAPON_PROFICIENCY_LEVEL"] = 33] = "WEAPON_PROFICIENCY_LEVEL";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["TOOL_PROFICIENCY_LEVEL"] = 34] = "TOOL_PROFICIENCY_LEVEL";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["LANGUAGE_PROFICIENCY_LEVEL"] = 35] = "LANGUAGE_PROFICIENCY_LEVEL";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["SENSE_OVERRIDE"] = 36] = "SENSE_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["MOVEMENT_OVERRIDE"] = 37] = "MOVEMENT_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["SAVING_THROW_OVERRIDE"] = 38] = "SAVING_THROW_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["SAVING_THROW_MISC_BONUS"] = 39] = "SAVING_THROW_MISC_BONUS";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["SAVING_THROW_MAGIC_BONUS"] = 40] = "SAVING_THROW_MAGIC_BONUS";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["SAVING_THROW_PROFICIENCY_LEVEL"] = 41] = "SAVING_THROW_PROFICIENCY_LEVEL";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["CREATURE_AC"] = 42] = "CREATURE_AC";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["CREATURE_HIT_POINTS"] = 43] = "CREATURE_HIT_POINTS";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["CREATURE_TYPE_OVERRIDE"] = 44] = "CREATURE_TYPE_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["CREATURE_ALIGNMENT"] = 45] = "CREATURE_ALIGNMENT";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["CREATURE_SIZE"] = 46] = "CREATURE_SIZE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["CREATURE_NOTES"] = 47] = "CREATURE_NOTES";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["IS_DEDICATED_WEAPON"] = 48] = "IS_DEDICATED_WEAPON";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["CAPACITY_OVERRIDE"] = 49] = "CAPACITY_OVERRIDE";
|
||||
AdjustmentTypeEnum[AdjustmentTypeEnum["CAPACITY_WEIGHT_OVERRIDE"] = 50] = "CAPACITY_WEIGHT_OVERRIDE";
|
||||
})(AdjustmentTypeEnum || (AdjustmentTypeEnum = {}));
|
||||
export const ProficiencyAdjustmentTypeEnum = [
|
||||
AdjustmentTypeEnum.IS_PROFICIENT,
|
||||
AdjustmentTypeEnum.SKILL_PROFICIENCY_LEVEL,
|
||||
AdjustmentTypeEnum.ARMOR_PROFICIENCY_LEVEL,
|
||||
AdjustmentTypeEnum.WEAPON_PROFICIENCY_LEVEL,
|
||||
AdjustmentTypeEnum.TOOL_PROFICIENCY_LEVEL,
|
||||
AdjustmentTypeEnum.LANGUAGE_PROFICIENCY_LEVEL,
|
||||
AdjustmentTypeEnum.SAVING_THROW_PROFICIENCY_LEVEL,
|
||||
];
|
||||
@@ -0,0 +1,66 @@
|
||||
import { groupBy, keyBy } from 'lodash';
|
||||
import { getEntityContextKey, getTypeId, getUniqueKey } from './accessors';
|
||||
/**
|
||||
*
|
||||
* @param typeId
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
* @returns
|
||||
*/
|
||||
export function generateUniqueKey(typeId, valueId = null, valueTypeId = null, contextId = null, contextTypeId = null) {
|
||||
return `${typeId}-${valueId}-${valueTypeId}-${contextId}-${contextTypeId}`;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
* @returns
|
||||
*/
|
||||
export function generateEntityContextKey(valueId = null, valueTypeId = null, contextId = null, contextTypeId = null) {
|
||||
if (valueId === null) {
|
||||
return 'null';
|
||||
}
|
||||
return `${valueId}-${valueTypeId}-${contextId}-${contextTypeId}`;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @returns
|
||||
*/
|
||||
export function generateEntityKey(valueId = null, valueTypeId = null) {
|
||||
if (valueId === null) {
|
||||
return 'null';
|
||||
}
|
||||
return `${valueId}-${valueTypeId}`;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param values
|
||||
*/
|
||||
export function generateCharacterValueLookup(values) {
|
||||
return keyBy(values, (value) => getUniqueKey(value));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param values
|
||||
*/
|
||||
export function generateCharacterEntityValueLookup(values) {
|
||||
const groups = groupBy(values, (value) => getEntityContextKey(value));
|
||||
const lookup = {};
|
||||
Object.keys(groups).forEach((groupKey) => {
|
||||
lookup[groupKey] = keyBy(groups[groupKey], 'typeId');
|
||||
});
|
||||
return lookup;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param values
|
||||
*/
|
||||
export function generateCharacterTypeValueLookup(values) {
|
||||
return groupBy(values, (value) => getTypeId(value));
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export function hack__toString(number) {
|
||||
var _a;
|
||||
return (_a = number === null || number === void 0 ? void 0 : number.toString()) !== null && _a !== void 0 ? _a : null;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import * as ValueAccessors from './accessors';
|
||||
import * as ValueConstants from './constants';
|
||||
import * as ValueGenerators from './generators';
|
||||
import * as ValueHacks from './hacks';
|
||||
import * as ValueTypings from './typings';
|
||||
import * as ValueUtils from './utils';
|
||||
import * as ValueValidators from './validators';
|
||||
export * from './constants';
|
||||
export * from './typings';
|
||||
export { ValueAccessors, ValueGenerators, ValueHacks, ValueUtils, ValueValidators };
|
||||
export default Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ValueAccessors), ValueConstants), ValueGenerators), ValueHacks), ValueTypings), ValueUtils), ValueValidators);
|
||||
@@ -0,0 +1,291 @@
|
||||
import { keyBy } from 'lodash';
|
||||
import { TypeScriptUtils } from '../../utils';
|
||||
import { getNotes, getValue, getValueId, getValueIntId } from './accessors';
|
||||
import { AdjustmentTypeEnum } from './constants';
|
||||
import { generateEntityContextKey, generateUniqueKey } from './generators';
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param typeId
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
* @returns
|
||||
*/
|
||||
export function getData(valueLookup, typeId, valueId = null, valueTypeId = null, contextId = null, contextTypeId = null) {
|
||||
const key = generateUniqueKey(typeId, valueId, valueTypeId, contextId, contextTypeId);
|
||||
if (valueLookup.hasOwnProperty(key)) {
|
||||
return valueLookup[key];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param typeIds
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
* @returns
|
||||
*/
|
||||
export function getDataLookup(valueLookup, typeIds, valueId = null, valueTypeId = null, contextId = null, contextTypeId = null) {
|
||||
const data = typeIds
|
||||
.map((typeId) => getData(valueLookup, typeId, valueId, valueTypeId, contextId, contextTypeId))
|
||||
.filter(TypeScriptUtils.isNotNullOrUndefined);
|
||||
return keyBy(data, 'typeId');
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param entityValueLookup
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
* @returns
|
||||
*/
|
||||
export function getEntityData(entityValueLookup, valueId, valueTypeId, contextId = null, contextTypeId = null) {
|
||||
const key = generateEntityContextKey(valueId, valueTypeId, contextId, contextTypeId);
|
||||
if (entityValueLookup.hasOwnProperty(key)) {
|
||||
return entityValueLookup[key];
|
||||
}
|
||||
return {};
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param typeValueLookup
|
||||
* @param typeId
|
||||
* @returns
|
||||
*/
|
||||
export function getTypeData(typeValueLookup, typeId) {
|
||||
if (typeId === null) {
|
||||
return [];
|
||||
}
|
||||
if (typeValueLookup.hasOwnProperty(typeId)) {
|
||||
return typeValueLookup[typeId];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param typeValueLookup
|
||||
* @param typeId
|
||||
* @returns
|
||||
*/
|
||||
export function getTypeValues(typeValueLookup, typeId) {
|
||||
return getTypeData(typeValueLookup, typeId)
|
||||
.map((charValue) => getValue(charValue))
|
||||
.filter(TypeScriptUtils.isNotNullOrUndefined);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param typeValueLookup
|
||||
* @param typeId
|
||||
* @returns
|
||||
*/
|
||||
export function getTypeValueIds(typeValueLookup, typeId) {
|
||||
return getTypeData(typeValueLookup, typeId)
|
||||
.map((charValue) => getValueId(charValue))
|
||||
.filter(TypeScriptUtils.isNotNullOrUndefined);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param typeValueLookup
|
||||
* @param typeId
|
||||
* @returns
|
||||
*/
|
||||
export function getTypeValueIntIds(typeValueLookup, typeId) {
|
||||
return getTypeData(typeValueLookup, typeId)
|
||||
.map((charValue) => getValueIntId(charValue))
|
||||
.filter(TypeScriptUtils.isNotNullOrUndefined);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param typeId
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param defaultValue
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
* @returns
|
||||
*/
|
||||
export function getKeyValue(valueLookup, typeId, valueId = null, valueTypeId = null, defaultValue = null, contextId = null, contextTypeId = null) {
|
||||
const charValue = getData(valueLookup, typeId, valueId, valueTypeId, contextId, contextTypeId);
|
||||
if (charValue !== null) {
|
||||
return getValue(charValue);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param typeId
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param defaultValue
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
* @returns
|
||||
*/
|
||||
export function getKeyNotes(valueLookup, typeId, valueId = null, valueTypeId = null, defaultValue = null, contextId = null, contextTypeId = null) {
|
||||
const charValue = getData(valueLookup, typeId, valueId, valueTypeId, contextId, contextTypeId);
|
||||
if (charValue !== null) {
|
||||
return getNotes(charValue);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param typeId
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param defaultValue
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
*/
|
||||
export function getTypedKeyValue(valueLookup, typeId, valueId = null, valueTypeId = null, defaultValue = null, contextId = null, contextTypeId = null) {
|
||||
return getKeyValue(valueLookup, typeId, valueId, valueTypeId, defaultValue, contextId, contextTypeId);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param characterValue
|
||||
* @param defaultValue
|
||||
*/
|
||||
export function getCharacterValueValue(characterValue, defaultValue = null) {
|
||||
const value = getValue(characterValue);
|
||||
if (value === null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param characterValue
|
||||
* @param defaultValue
|
||||
*/
|
||||
export function getTypedCharacterValueValue(characterValue, defaultValue = null) {
|
||||
return getCharacterValueValue(characterValue, defaultValue);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param defaultValue
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
*/
|
||||
export function getSavingThrowMiscBonusValue(valueLookup, valueId = null, valueTypeId = null, defaultValue = 0, contextId = null, contextTypeId = null) {
|
||||
return getTypedKeyValue(valueLookup, AdjustmentTypeEnum.SAVING_THROW_MISC_BONUS, valueId, valueTypeId, defaultValue, contextId, contextTypeId);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param defaultValue
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
*/
|
||||
export function getSavingThrowMagicBonusValue(valueLookup, valueId = null, valueTypeId = null, defaultValue = 0, contextId = null, contextTypeId = null) {
|
||||
return getTypedKeyValue(valueLookup, AdjustmentTypeEnum.SAVING_THROW_MAGIC_BONUS, valueId, valueTypeId, defaultValue, contextId, contextTypeId);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param defaultValue
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
*/
|
||||
export function getSavingThrowOverrideValue(valueLookup, valueId = null, valueTypeId = null, defaultValue = null, contextId = null, contextTypeId = null) {
|
||||
return getTypedKeyValue(valueLookup, AdjustmentTypeEnum.SAVING_THROW_OVERRIDE, valueId, valueTypeId, defaultValue, contextId, contextTypeId);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param defaultValue
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
*/
|
||||
export function getSavingThrowProficiencyLevelValue(valueLookup, valueId = null, valueTypeId = null, defaultValue = null, contextId = null, contextTypeId = null) {
|
||||
return getTypedKeyValue(valueLookup, AdjustmentTypeEnum.SAVING_THROW_PROFICIENCY_LEVEL, valueId, valueTypeId, defaultValue, contextId, contextTypeId);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param defaultValue
|
||||
*/
|
||||
export function getOverridePassivePerceptionValue(valueLookup, defaultValue = null) {
|
||||
return getTypedKeyValue(valueLookup, AdjustmentTypeEnum.OVERRIDE_PASSIVE_PERCEPTION, undefined, undefined, defaultValue);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param defaultValue
|
||||
*/
|
||||
export function getOverridePassiveInvestigationValue(valueLookup, defaultValue = null) {
|
||||
return getTypedKeyValue(valueLookup, AdjustmentTypeEnum.OVERRIDE_PASSIVE_INVESTIGATION, undefined, undefined, defaultValue);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param defaultValue
|
||||
*/
|
||||
export function getOverridePassiveInsightValue(valueLookup, defaultValue = null) {
|
||||
return getTypedKeyValue(valueLookup, AdjustmentTypeEnum.OVERRIDE_PASSIVE_INSIGHT, undefined, undefined, defaultValue);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param defaultValue
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
*/
|
||||
export function getIsOffhand(valueLookup, valueId = null, valueTypeId = null, defaultValue = null, contextId = null, contextTypeId = null) {
|
||||
return getTypedKeyValue(valueLookup, AdjustmentTypeEnum.IS_OFFHAND, valueId, valueTypeId, defaultValue, contextId, contextTypeId);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param defaultValue
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
*/
|
||||
export function getFixedValueBonus(valueLookup, valueId = null, valueTypeId = null, defaultValue = null, contextId = null, contextTypeId = null) {
|
||||
return getTypedKeyValue(valueLookup, AdjustmentTypeEnum.FIXED_VALUE_BONUS, valueId, valueTypeId, defaultValue, contextId, contextTypeId);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param defaultValue
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
*/
|
||||
export function getToHitBonus(valueLookup, valueId = null, valueTypeId = null, defaultValue = null, contextId = null, contextTypeId = null) {
|
||||
return getTypedKeyValue(valueLookup, AdjustmentTypeEnum.TO_HIT_BONUS, valueId, valueTypeId, defaultValue, contextId, contextTypeId);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param valueLookup
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param defaultValue
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
*/
|
||||
export function getToHitOverride(valueLookup, valueId = null, valueTypeId = null, defaultValue = null, contextId = null, contextTypeId = null) {
|
||||
return getTypedKeyValue(valueLookup, AdjustmentTypeEnum.TO_HIT_OVERRIDE, valueId, valueTypeId, defaultValue, contextId, contextTypeId);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { ValueUtils } from './index';
|
||||
/**
|
||||
*
|
||||
* @param customizationTypes
|
||||
* @param valueLookup
|
||||
* @param valueId
|
||||
* @param valueTypeId
|
||||
* @param contextId
|
||||
* @param contextTypeId
|
||||
*/
|
||||
export function validateHasCustomization(customizationTypes, valueLookup, valueId = null, valueTypeId = null, contextId = null, contextTypeId = null) {
|
||||
return customizationTypes.some((typeId) => {
|
||||
const value = ValueUtils.getKeyValue(valueLookup, typeId, valueId, valueTypeId, null, contextId, contextTypeId);
|
||||
if (value !== null && value !== '') {
|
||||
return true;
|
||||
}
|
||||
const notes = ValueUtils.getKeyNotes(valueLookup, typeId, valueId, valueTypeId, null, contextId, contextTypeId);
|
||||
if (notes !== null && notes !== '') {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user