Adds status bars to character sheet
This commit is contained in:
+7
-4
@@ -9,6 +9,13 @@ import { M5Item } from "./module/items/M5Item"
|
||||
Hooks.once("init", async () => {
|
||||
Logger.log("M5 | Initialisierung Midgard 5")
|
||||
|
||||
Handlebars.registerHelper("times", (n: number, block) => {
|
||||
var accum = ""
|
||||
for(let i = 0; i < n; ++i)
|
||||
accum += block.fn(i)
|
||||
return accum
|
||||
})
|
||||
|
||||
Handlebars.registerHelper("array", (arr: any[], index: number) => {
|
||||
return arr[index]
|
||||
})
|
||||
@@ -34,15 +41,11 @@ Hooks.once("init", async () => {
|
||||
|
||||
Handlebars.registerHelper("skillBonus", (actorId: string, skill: M5Skill) => {
|
||||
const actor = (game as Game).actors.get(actorId) as M5Character
|
||||
if (!actor || !skill)
|
||||
console.log("Handlebars.skillBonus", actor, skill)
|
||||
return actor.skillBonus(skill).toString()
|
||||
})
|
||||
|
||||
Handlebars.registerHelper("skillEw", (actorId: string, skill: M5Skill) => {
|
||||
const actor = (game as Game).actors.get(actorId) as M5Character
|
||||
if (!actor || !skill)
|
||||
console.log("Handlebars.skillEw", actor, skill)
|
||||
return actor.skillEw(skill).toString()
|
||||
})
|
||||
|
||||
|
||||
@@ -45,6 +45,30 @@ export default class M5CharacterSheet extends ActorSheet {
|
||||
override activateListeners(html: JQuery) {
|
||||
super.activateListeners(html)
|
||||
|
||||
html.find(".update-lp").on("click", async (event) => {
|
||||
const valueStr = event.target.dataset["value"]
|
||||
const value = parseInt(valueStr)
|
||||
this.actor.update({
|
||||
data: {
|
||||
lp: {
|
||||
value: value + 1
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
html.find(".update-ap").on("click", async (event) => {
|
||||
const valueStr = event.target.dataset["value"]
|
||||
const value = parseInt(valueStr)
|
||||
this.actor.update({
|
||||
data: {
|
||||
ap: {
|
||||
value: value + 1
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
html.find(".roll-attribute-button").on("click", async (event) => {
|
||||
const attributeStr = event.target.dataset["attribute"]
|
||||
const roll = M5Roll.fromAttribute(this.actor, attributeStr)
|
||||
|
||||
@@ -90,6 +90,47 @@
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.health-bar {
|
||||
height: 2rem;
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 1px;
|
||||
padding: 1px;
|
||||
//align-items: stretch;
|
||||
|
||||
input {
|
||||
flex: 0 0 3rem;
|
||||
text-align: center;
|
||||
height: 100%;
|
||||
background-color: rgba(109, 108, 102, 1);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-weight: bold;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.lp-bar-item-empty,
|
||||
.ap-bar-item-empty {
|
||||
flex-grow: 1;
|
||||
background-color: rgb(201, 201, 201);
|
||||
}
|
||||
|
||||
.lp-bar-item {
|
||||
flex-grow: 1;
|
||||
background-color: rgb(57, 234, 139);
|
||||
}
|
||||
|
||||
.ap-bar-item {
|
||||
flex-grow: 1;
|
||||
background-color: rgb(57, 163, 234);
|
||||
}
|
||||
|
||||
.negative-bar-item {
|
||||
flex-grow: 1;
|
||||
background-color: rgb(234, 57, 57);
|
||||
}
|
||||
}
|
||||
|
||||
.attributes {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
Reference in New Issue
Block a user