more tooltips and color for "Gm Monitor"

This commit is contained in:
Vlyan
2021-08-14 13:17:17 +02:00
parent c426e457ff
commit f4de1e9fc8
11 changed files with 219 additions and 117 deletions

View File

@@ -96,7 +96,17 @@ export class ActorL5r5e extends Actor {
}
// Now using updateDocuments
return Actor.updateDocuments([data], context);
return Actor.updateDocuments([data], context).then(() => {
// Notify the "Gm Monitor" if this actor is watched
if (game.settings.get("l5r5e", "gm-monitor-actors").find((e) => e === this.id)) {
game.l5r5e.sockets.refreshAppId("l5r5e-gm-monitor");
if (game.user.isGM) {
Object.values(ui.windows)
.find((e) => e.id === "l5r5e-gm-monitor")
?.refresh();
}
}
});
}
/** @override */
@@ -201,4 +211,28 @@ export class ActorL5r5e extends Actor {
}
return tpl;
}
/**
* Return true if a weapon is equipped
* @return {boolean}
*/
haveWeaponEquipped() {
return this.items.some((e) => e.type === "weapon" && !!e.data.data.equipped);
}
/**
* Return true if a weapon is readied
* @return {boolean}
*/
haveWeaponReadied() {
return this.items.some((e) => e.type === "weapon" && !!e.data.data.equipped && !!e.data.data.readied);
}
/**
* Return true if a armor is equipped
* @return {boolean}
*/
haveArmorEquipped() {
return this.items.some((e) => e.type === "armor" && !!e.data.data.equipped);
}
}