This commit is contained in:
TheGiddyLimit
2024-01-01 19:34:49 +00:00
parent 332769043f
commit 8117ebddc5
1748 changed files with 2544409 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
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!`);
}
}