first commit
This commit is contained in:
38
module.js
Normal file
38
module.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
function createHealthDisplay() {
|
||||||
|
// Create a new application to display the health overview
|
||||||
|
class HealthOverview extends Application {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
static get defaultOptions() {
|
||||||
|
return mergeObject(super.defaultOptions, {
|
||||||
|
title: "Party Health Overview",
|
||||||
|
template: "modules/kyles-health-module/templates/health-overview.html",
|
||||||
|
width: 400,
|
||||||
|
height: "auto",
|
||||||
|
resizable: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getData() {
|
||||||
|
const actors = game.actors.filter(a => a.hasPlayerOwner);
|
||||||
|
let data = actors.map(actor => {
|
||||||
|
let hp = actor.system.attributes.hp;
|
||||||
|
return {
|
||||||
|
name: actor.name,
|
||||||
|
current: hp.value,
|
||||||
|
max: hp.max,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
actors: data
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new HealthOverview().render(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run the function
|
||||||
|
createHealthDisplay();
|
||||||
23
module.json
Normal file
23
module.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"name": "kyles-health-module",
|
||||||
|
"title": "Kyle's Health Module",
|
||||||
|
"description": "A module to display a party-wide health overview for ease of management by a healer or GM.",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"author": "Kyle",
|
||||||
|
"minimumCoreVersion": "0.12.0",
|
||||||
|
"compatibleCoreVersion": "0.12.0",
|
||||||
|
"scripts": [],
|
||||||
|
"styles": [],
|
||||||
|
"esmodules": ["module.js"],
|
||||||
|
"languages": [],
|
||||||
|
"packs": [],
|
||||||
|
"system": [],
|
||||||
|
"crossOrigin": "anonymous",
|
||||||
|
"url": "https://your.website.or.github.io/health-overview",
|
||||||
|
"manifest": "https://your.website.or.github.io/health-overview/module.json",
|
||||||
|
"download": "https://your.website.or.github.io/health-overview/health-overview.zip",
|
||||||
|
"license": "LICENSE FILE OR URL",
|
||||||
|
"readme": "README FILE OR URL",
|
||||||
|
"bugs": "Where users can report issues, such as a GitHub issues page",
|
||||||
|
"dependencies": []
|
||||||
|
}
|
||||||
9
templates/health-overview.html
Normal file
9
templates/health-overview.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<div>
|
||||||
|
{{#each actors}}
|
||||||
|
<div class="actor-health">
|
||||||
|
<strong>{{this.name}}</strong>
|
||||||
|
<progress value="{{this.current}}" max="{{this.max}}"></progress>
|
||||||
|
{{this.current}} / {{this.max}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user