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 { TypeScriptUtils } from '../../utils';
|
||||
import { InfusionAccessors } from '../Infusion';
|
||||
import { NoteGenerators } from '../Note';
|
||||
import { getEnvironmentTags, getInfusion, getNotes, getTags } from './accessors';
|
||||
export function getTagNoteComponents(creature) {
|
||||
const tags = getTags(creature);
|
||||
return NoteGenerators.createGroup(tags.map((tag) => NoteGenerators.createPlainText(tag)), ', ');
|
||||
}
|
||||
export function getEnvironmentNoteComponents(creature) {
|
||||
const envTags = getEnvironmentTags(creature);
|
||||
return NoteGenerators.createGroup(envTags.map((tag) => NoteGenerators.createPlainText(tag)), ', ');
|
||||
}
|
||||
function getUserNoteComponent(creature) {
|
||||
const notes = getNotes(creature);
|
||||
if (notes) {
|
||||
return NoteGenerators.createPlainText(notes);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function getInfusionNoteComponent(creature) {
|
||||
const infusion = getInfusion(creature);
|
||||
if (infusion) {
|
||||
return NoteGenerators.createPlainText(`Infusion: ${InfusionAccessors.getName(infusion)}`);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
export function getNoteComponents(creature, ruleData) {
|
||||
const notes = [];
|
||||
notes.push(getUserNoteComponent(creature));
|
||||
notes.push(getInfusionNoteComponent(creature));
|
||||
notes.push(getTagNoteComponents(creature));
|
||||
notes.push(getEnvironmentNoteComponents(creature));
|
||||
return notes.filter(TypeScriptUtils.isNotNullOrUndefined);
|
||||
}
|
||||
Reference in New Issue
Block a user