-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaspects_string.js
33 lines (29 loc) · 987 Bytes
/
aspects_string.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { rites, ables } from "./filtered_data.js"
import { fragments } from "./fragments.js"
export function aspectString(aspects, key, usePower = true) {
if (usePower)
Object.keys(fragments).forEach(aspect => fragments[aspect].forEach((fragment, power) => {
if (key === fragment)
aspects.add(`<sprite name=${aspect}> ${(Number(power) + 1) * 2}`);
}))
else
Object.keys(fragments).forEach(aspect => {
if (key.includes(aspect))
aspects.add(`<sprite name=${aspect}>`);
});
dict(ables, key, aspects);
dict(rites, key, aspects);
}
export function dict(dictonary, key, aspectsLine = new Set()) {
let string;
dictonary.elements.forEach(rkey => {
if (rkey.id === key) {
string = rkey.label.trim();
if (key === "fascination" || key === "dread" || key.startsWith("curse_"))
string = ` <b><i>${string}</i></b>`;
else string = ` <i>${string}</i>`;
aspectsLine.add(string);
}
});
return string;
}