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,34 @@
|
||||
import { HelperUtils } from '../Helper';
|
||||
import { getType } from './accessors';
|
||||
import { InfusionTypeEnum } from './constants';
|
||||
/**
|
||||
* This is a temporary workaround til we have item definition game data service. Once we can
|
||||
* load item definitions as needed, we can fully calculate requiresItemChoice at the
|
||||
* same time as we generate the infusion
|
||||
* @param infusion
|
||||
* @param itemId
|
||||
* @param itemCanBeAddedLookup
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function hack__requiresItemChoice(infusion, itemId = null, itemCanBeAddedLookup = {}) {
|
||||
if (getType(infusion) !== InfusionTypeEnum.REPLICATE) {
|
||||
return true;
|
||||
}
|
||||
return !this.hack__itemCanBeAddedToInventory(infusion, itemId, itemCanBeAddedLookup);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param infusion
|
||||
* @param itemId
|
||||
* @param itemCanBeAddedLookup
|
||||
*/
|
||||
export function hack__itemCanBeAddedToInventory(infusion, itemId, itemCanBeAddedLookup) {
|
||||
if (getType(infusion) !== InfusionTypeEnum.REPLICATE) {
|
||||
return true;
|
||||
}
|
||||
const fallback = false;
|
||||
if (itemId === null) {
|
||||
return fallback;
|
||||
}
|
||||
return HelperUtils.lookupDataOrFallback(itemCanBeAddedLookup, itemId, fallback);
|
||||
}
|
||||
Reference in New Issue
Block a user