mirror of
https://github.com/Kornstalx/5etools-mirror-2.github.io.git
synced 2025-10-28 20:45:35 -05:00
26 lines
1.0 KiB
JavaScript
26 lines
1.0 KiB
JavaScript
export class DmScreenUtil {
|
|
// FIXME(Future) switch to a better interface than `data`
|
|
static $getPanelDataElements ({board, type, selector = ".dm__data-anchor"}) {
|
|
return board.getPanelsByType(type)
|
|
.flatMap(it => it.tabDatas.filter(td => td.type === type).map(td => td.$content.find(selector)));
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
static async pGetScaledCreature ({name, source, scaledCr, scaledSummonSpellLevel, scaledSummonClassLevel}) {
|
|
const mon = await DataLoader.pCacheAndGet(
|
|
UrlUtil.PG_BESTIARY,
|
|
source,
|
|
UrlUtil.URL_TO_HASH_BUILDER[UrlUtil.PG_BESTIARY]({name: name, source: source}),
|
|
);
|
|
|
|
if (scaledCr == null && scaledSummonSpellLevel == null && scaledSummonClassLevel == null) return mon;
|
|
|
|
if (scaledCr != null) return ScaleCreature.scale(mon, scaledCr);
|
|
if (scaledSummonSpellLevel != null) return ScaleSpellSummonedCreature.scale(mon, scaledCr);
|
|
if (scaledSummonClassLevel != null) return ScaleClassSummonedCreature.scale(mon, scaledCr);
|
|
|
|
throw new Error(`Should never occur!`);
|
|
}
|
|
}
|