Some check on actor types
This commit is contained in:
@@ -254,6 +254,10 @@ export class ActorL5r5e extends Actor {
|
||||
* @return {boolean}
|
||||
*/
|
||||
get isPrepared() {
|
||||
if (!["character", "npc"].includes(this.data.type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const cfg = {
|
||||
character: game.settings.get("l5r5e", "initiative-prepared-character"),
|
||||
adversary: game.settings.get("l5r5e", "initiative-prepared-adversary"),
|
||||
|
||||
@@ -39,6 +39,11 @@ export class CombatL5r5e extends Combat {
|
||||
for (const combatantId of ids) {
|
||||
const combatant = game.combat.combatants.find((c) => c.id === combatantId);
|
||||
|
||||
// Skip non character types (army)
|
||||
if (!["character", "npc"].includes(combatant.actor.data.type)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip if combatant already have a initiative value
|
||||
if (!messageOptions.rerollInitiative && (!combatant || !combatant.actor)) {
|
||||
return;
|
||||
|
||||
@@ -168,12 +168,18 @@ export class GmMonitor extends FormApplication {
|
||||
return;
|
||||
}
|
||||
|
||||
const actor = game.actors.filter((e) => e.id === data.id);
|
||||
const actor = game.actors.find((e) => e.id === data.id);
|
||||
if (!actor) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.object.actors.push(actor[0]);
|
||||
// No armies allowed !
|
||||
if (actor.data.type === "army") {
|
||||
console.log(`L5R5E | Armies are not supported !`);
|
||||
return;
|
||||
}
|
||||
|
||||
this.object.actors.push(actor);
|
||||
|
||||
return this._saveActorsIds();
|
||||
}
|
||||
|
||||
@@ -195,6 +195,12 @@ export class GmToolbox extends FormApplication {
|
||||
const type = $(event.currentTarget).data("type");
|
||||
|
||||
for await (const actor of game.actors.contents) {
|
||||
// Only characters types
|
||||
if (!["character", "npc"].includes(actor.data.type)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Manage left/right button
|
||||
if (!isAll && (actor.data.type !== "character" || !actor.hasPlayerOwner)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -43,21 +43,22 @@ export const RegisterHandlebars = function () {
|
||||
/* ------------------------------------ */
|
||||
/* Utility */
|
||||
/* ------------------------------------ */
|
||||
/**
|
||||
* Json - Display a object in textarea (for debug)
|
||||
*/
|
||||
// Json - Display a object in textarea (for debug)
|
||||
Handlebars.registerHelper("json", function (...objects) {
|
||||
objects.pop(); // remove this function call
|
||||
return new Handlebars.SafeString(objects.map((e) => `<textarea>${JSON.stringify(e)}</textarea>`));
|
||||
});
|
||||
|
||||
/**
|
||||
* Add props "checked" if a and b are equal ({{radioChecked a b}}
|
||||
*/
|
||||
// Add props "checked" if a and b are equal ({{radioChecked a b}}
|
||||
Handlebars.registerHelper("radioChecked", function (a, b) {
|
||||
return a === b ? new Handlebars.SafeString('checked="checked"') : "";
|
||||
});
|
||||
|
||||
// Add a setter
|
||||
Handlebars.registerHelper("setVar", function (varName, varValue, options) {
|
||||
options.data.root[varName] = varValue;
|
||||
});
|
||||
|
||||
/**
|
||||
* Utility conditional, usable in nested expression
|
||||
* {{#ifCond (ifCond advancement.type '==' 'technique') '||' (ifCond item.data.technique_type '==' 'kata')}}
|
||||
|
||||
@@ -40,24 +40,31 @@ export const PreloadTemplates = async function () {
|
||||
`${tpl}items/armor/armor-sheet.html`,
|
||||
`${tpl}items/bond/bond-entry.html`,
|
||||
`${tpl}items/bond/bond-sheet.html`,
|
||||
`${tpl}items/bond/bond-text.html`,
|
||||
`${tpl}items/item/items.html`,
|
||||
`${tpl}items/item/item-entry.html`,
|
||||
`${tpl}items/item/item-value.html`,
|
||||
`${tpl}items/item/item-sheet.html`,
|
||||
`${tpl}items/item/item-infos.html`,
|
||||
`${tpl}items/item/item-text.html`,
|
||||
`${tpl}items/item-pattern/item-pattern-entry.html`,
|
||||
`${tpl}items/item-pattern/item-pattern-sheet.html`,
|
||||
`${tpl}items/item-pattern/item-pattern-text.html`,
|
||||
`${tpl}items/peculiarity/peculiarity-entry.html`,
|
||||
`${tpl}items/peculiarity/peculiarity-sheet.html`,
|
||||
`${tpl}items/peculiarity/peculiarity-text.html`,
|
||||
`${tpl}items/property/properties.html`,
|
||||
`${tpl}items/property/property-entry.html`,
|
||||
`${tpl}items/property/property-sheet.html`,
|
||||
`${tpl}items/signature-scroll/signature-scroll-entry.html`,
|
||||
`${tpl}items/signature-scroll/signature-scroll-sheet.html`,
|
||||
`${tpl}items/signature-scroll/signature-scroll-text.html`,
|
||||
`${tpl}items/technique/technique-entry.html`,
|
||||
`${tpl}items/technique/technique-sheet.html`,
|
||||
`${tpl}items/technique/technique-text.html`,
|
||||
`${tpl}items/title/title-entry.html`,
|
||||
`${tpl}items/title/title-sheet.html`,
|
||||
`${tpl}items/title/title-text.html`,
|
||||
`${tpl}items/weapon/weapons.html`,
|
||||
`${tpl}items/weapon/weapon-entry.html`,
|
||||
`${tpl}items/weapon/weapon-sheet.html`,
|
||||
|
||||
Reference in New Issue
Block a user