diff --git a/system/scripts/actor.js b/system/scripts/actor.js index 08708c0..ce612b8 100644 --- a/system/scripts/actor.js +++ b/system/scripts/actor.js @@ -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"), diff --git a/system/scripts/combat.js b/system/scripts/combat.js index 37d1020..47aeeb8 100644 --- a/system/scripts/combat.js +++ b/system/scripts/combat.js @@ -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; diff --git a/system/scripts/gm/gm-monitor.js b/system/scripts/gm/gm-monitor.js index b69bd66..58b0ac5 100644 --- a/system/scripts/gm/gm-monitor.js +++ b/system/scripts/gm/gm-monitor.js @@ -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(); } diff --git a/system/scripts/gm/gm-toolbox.js b/system/scripts/gm/gm-toolbox.js index 46feaa7..e73c046 100644 --- a/system/scripts/gm/gm-toolbox.js +++ b/system/scripts/gm/gm-toolbox.js @@ -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; } diff --git a/system/scripts/handlebars.js b/system/scripts/handlebars.js index 6f05ee0..587d62f 100644 --- a/system/scripts/handlebars.js +++ b/system/scripts/handlebars.js @@ -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) => ``)); }); - /** - * 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')}} diff --git a/system/scripts/preloadTemplates.js b/system/scripts/preloadTemplates.js index 7d9a4b3..66ed359 100644 --- a/system/scripts/preloadTemplates.js +++ b/system/scripts/preloadTemplates.js @@ -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`, diff --git a/system/templates/actors/actor-export.html b/system/templates/actors/actor-export.html new file mode 100644 index 0000000..1867902 --- /dev/null +++ b/system/templates/actors/actor-export.html @@ -0,0 +1,233 @@ +
+
+

+ {{data.name}} +

+
+
+ {{#if data.img}}

{{/if}} + + {{!-- Sheet Header --}} + + +{{!-- a faire : Spé Skill/Ecoles pour les pnj --}} + {{!-- Skills Tab : Skills --}} +

{{localize 'l5r5e.skills.title'}}

+ + + {{!-- Skills Tab : Techniques --}} +

{{localize 'l5r5e.techniques.title'}}

+ + + {{!-- Skills Tab : Signature Scrolls --}} +

{{localize 'l5r5e.advancements.signature_scroll' }}

+ + + + {{!-- Narrative : Advantages --}} +

{{localize 'l5r5e.social.advantages'}}

+ + + {{!-- Narrative : Disadvantages --}} +

{{localize 'l5r5e.social.disadvantages'}}

+ + + {{!-- Narrative : Bonds --}} +

{{localize 'l5r5e.social.bonds'}}

+ + + + {{!-- Inventory Tab --}} + {{!-- items list --}} +

{{localize 'l5r5e.equipment'}}

+ + + {{!-- item patterns list --}} +

{{localize 'l5r5e.advancements.item_pattern'}}

+ + + + {{!-- Experience Tab --}} +

{{localize 'l5r5e.experience'}}

+ + + {{!-- School progression --}} +

{{#if data.data.identity.school_curriculum_journal.name}}{{data.data.identity.school_curriculum_journal.name}}{{else}}{{localize 'l5r5e.school'}}{{/if}}

+ + + + + + + + {{#each data.advancementsListByRank as |rankObject|}} + + {{#each rankObject.list as |advancement|}} + + + + + + + {{/each}} + {{/each}} +
{{localize 'l5r5e.name'}}{{localize 'l5r5e.school'}}{{localize 'l5r5e.advancements.spent'}}{{localize 'l5r5e.rank'}}
{{localize 'l5r5e.rank'}} {{rankObject.rank}}
{{advancement.name}}{{#if advancement.data.in_curriculum}}✓{{/if}}{{advancement.data.xp_used}}{{advancement.data.rank}}
+ + {{!-- Others progression (does not count in school xp) --}} + {{#if data.advancementsOthers}} +

{{localize 'l5r5e.advancements.title'}}

+ + + + + + + {{#each data.advancementsOthers as |advancement|}} + + + + + + {{/each}} +
{{localize 'l5r5e.name'}}{{localize 'l5r5e.advancements.spent'}}{{localize 'l5r5e.rank'}}
{{advancement.name}}{{advancement.data.xp_used}}{{advancement.data.rank}}
+ {{/if}} + + + {{!-- 20Q --}} + {{#ifCond data.data.twenty_questions.template '==' 'pow'}} + {{setVar "suffix" "pow"}} + {{else}} + {{setVar "suffix" ""}} + {{/ifCond}} +

{{localize 'l5r5e.twenty_questions.title'}}

+ + +
+