-
Notifications
You must be signed in to change notification settings - Fork 0
/
shadowdark-5e.mjs
63 lines (53 loc) · 2.26 KB
/
shadowdark-5e.mjs
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import {applications} from "../../systems/dnd5e/dnd5e.mjs";
Hooks.once('setup', () => {
console.log("shadowdark5e | setup");
class ActorSheetShadowdark5e extends applications.actor.ActorSheet5eCharacter {
async getData(options) {
let result = await super.getData();
let xp = result.system.details.xp;
xp.max = result.system.details.level * 10;
xp.pct = Math.clamped(100 * xp.value/xp.max, 0, 100);
return result;
}
async _renderInner(...args) {
const selectorsToRemove = [
'[data-tab="biography"]',
'.proficiency',
'.attribute.hit-dice',
'.attribute.movement',
'.skills-list',
'.denomination.ep',
'[name="system.currency.ep"]',
'.counter.flexrow.death-saves',
'.counter.flexrow.exhaustion',
'[data-filter="action"]',
'[data-filter="bonus"]',
'[data-filter="reaction"]',
'[data-filter="ritual"]',
]
let html = await super._renderInner(...args)
selectorsToRemove.forEach(selector => html.find(selector).remove());
html.find('.counter.flexrow.inspiration').children('h4').html("Luck");
html.find('[data-trait="languages"]').parent().siblings().remove();
html.find('.tab.features').children('.inventory-filters').remove();
return html
}
}
Actors.registerSheet("shadowdark", ActorSheetShadowdark5e, {
types: ["character"],
makeDefault: true,
label: "SHADOWDARK.SheetClassCharacter"
})
const styleSheets = document.styleSheets;
for (let i = 0; i < styleSheets.length; i++) {
const rules = styleSheets[i].cssRules;
for (let j = 0; j<rules.length; j++) {
if (rules[j].constructor.name == 'CSSStyleRule' && rules[j].selectorText == '.dnd5e.sheet.actor.character') {
console.log("shadowdark5e | Shrinking minimum sheet width")
rules[j].styleMap.set('min-width', '500px');
return;
}
}
}
console.log("shadowdark5e | Couldn't find actor sheet css");
});