From 05f044bc7c41033058f7d05deec2718e36d7b1bf Mon Sep 17 00:00:00 2001 From: sladecraven Date: Fri, 1 Jul 2022 16:30:21 +0200 Subject: [PATCH] Foundry v10 version --- module/actor/actor-sheet.js | 2 ++ module/actor/actor.js | 25 +++++++++++++++---- module/controllers/bol-rolls.js | 2 +- module/item/item-sheet.js | 1 + module/system/bol-utility.js | 4 +-- templates/actor/parts/tabs/actor-actions.hbs | 2 +- templates/actor/parts/tabs/actor-biodata.hbs | 18 ++++++------- .../actor/parts/tabs/actor-equipment.hbs | 10 ++++---- .../actor/parts/tabs/actor-spellalchemy.hbs | 10 ++++---- templates/actor/parts/tabs/actor-stats.hbs | 20 +++++++-------- .../actor/parts/tabs/creature-actions.hbs | 10 ++++---- templates/actor/parts/tabs/creature-stats.hbs | 10 ++++---- templates/chat/rolls/defense-request-card.hbs | 2 +- .../properties/feature/career-properties.hbs | 6 ++--- .../feature/fightoption-properties.hbs | 2 +- .../properties/item/equipment-properties.hbs | 4 +-- .../properties/item/protection-properties.hbs | 4 +-- .../properties/item/weapon-properties.hbs | 6 ++--- 18 files changed, 78 insertions(+), 60 deletions(-) diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 12d1935..a6c4469 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -139,6 +139,8 @@ export class BoLActorSheet extends ActorSheet { formData.owner = this.document.isOwner formData.editScore = this.options.editScore formData.useBougette = BoLUtility.getUseBougette() + formData.charType = this.actor.getCharType() + formData.villainy = this.actor.getVillainy() formData.isSorcerer = this.actor.isSorcerer() formData.isAlchemist = this.actor.isAlchemist() diff --git a/module/actor/actor.js b/module/actor/actor.js index 53bda5f..dde119c 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -11,14 +11,29 @@ export class BoLActor extends Actor { prepareData() { if (this.type === 'character') { - this.chartype = 'player'; - this.villainy = false; + this.chartype = 'player' + this.villainy = false } if (this.type === 'encounter') { - this.chartype = 'tough'; - this.villainy = true; + this.chartype = 'tough' + this.villainy = true } - super.prepareData(); + super.prepareData() + } + + /* -------------------------------------------- */ + getCharType() { + if (this.type === 'character') { + return 'player' + } + return 'tough' + } + /* -------------------------------------------- */ + getVillainy() { + if (this.type === 'character') { + return false + } + return true } /* -------------------------------------------- */ diff --git a/module/controllers/bol-rolls.js b/module/controllers/bol-rolls.js index 3a24c76..09ca6fb 100644 --- a/module/controllers/bol-rolls.js +++ b/module/controllers/bol-rolls.js @@ -92,7 +92,7 @@ export class BoLRoll { targetId: target?.id, fightOption: fightOption, careerBonus: 0, - defenderId: target?.data?.actorId, + defenderId: target?.actor.id, attribute: attribute, aptitude: aptitude, attrValue: attribute.value, diff --git a/module/item/item-sheet.js b/module/item/item-sheet.js index bd1b4c8..7439f6d 100644 --- a/module/item/item-sheet.js +++ b/module/item/item-sheet.js @@ -26,6 +26,7 @@ export class BoLItemSheet extends ItemSheet { data.item = itemData data.category = itemData.system.category data.isGM = game.user.isGM; + data.itemProperties = this.item.itemProperties; // Dynamic default data fix/adapt if (itemData.type == "item") { diff --git a/module/system/bol-utility.js b/module/system/bol-utility.js index 5d9be6b..baae321 100644 --- a/module/system/bol-utility.js +++ b/module/system/bol-utility.js @@ -414,8 +414,8 @@ export class BoLUtility { } // Build and send the defense message to the relevant people (ie GM + defender) let defender = game.actors.get(attackDef.defenderId) - let defenderWeapons = defender.weapons - console.log("DEF WEP", attackDef) + console.log("DEF WEP", attackDef, defender) + let defenderWeapons = defender.weapons || [] this.attackStore[attackDef.id] = attackDef // Store ! ChatMessage.create({ alias: defender.name, diff --git a/templates/actor/parts/tabs/actor-actions.hbs b/templates/actor/parts/tabs/actor-actions.hbs index 80c74ee..76c1195 100644 --- a/templates/actor/parts/tabs/actor-actions.hbs +++ b/templates/actor/parts/tabs/actor-actions.hbs @@ -12,7 +12,7 @@
  • {{#if ../weapon}}{{/if}}{{item.name}}{{#if ../weapon}}{{/if}}

    - {{#if ../protection}}
    {{item.system.properties.soak.formula}} / {{item.data.properties.soak.value}}
    {{/if}} + {{#if ../protection}}
    {{item.system.properties.soak.formula}} / {{item.system.properties.soak.value}}
    {{/if}} {{#if ../blocking}}
    {{item.system.properties.blocking.malus}}
    {{/if}} {{#if ../weapon}}
    {{item.system.properties.damage}}+{{item.system.properties.damageModifiers}}x{{item.system.properties.damageMultiplier}} diff --git a/templates/actor/parts/tabs/actor-biodata.hbs b/templates/actor/parts/tabs/actor-biodata.hbs index 60a054a..ff82309 100644 --- a/templates/actor/parts/tabs/actor-biodata.hbs +++ b/templates/actor/parts/tabs/actor-biodata.hbs @@ -1,29 +1,29 @@
      - {{#if (ne data.type "creature")}} + {{#if (ne actor.type "creature")}}
    1. {{localize "BOL.ui.biosize"}}
      -
      +
      {{localize "BOL.ui.bioweight"}}
      -
      +
      {{localize "BOL.ui.bioage"}}
      -
      +
    2. {{localize "BOL.ui.biohair"}}
      -
      +
      {{localize "BOL.ui.bioeyes"}}
      -
      +
    3. {{localize "BOL.ui.biosigns"}}
      -
      +
    4. {{else}}
    5. Taille
      - {{#if item.data.properties.stackable}} + {{#if item.system.properties.stackable}}   {{item.system.quantity}}  @@ -254,7 +254,7 @@ {{item.name}}
      - {{#if item.data.properties.equipable}} + {{#if item.system.properties.equipable}} {{localize (concat "BOL.equipmentSlots." item.system.properties.slot)}} {{/if}} @@ -312,7 +312,7 @@ {{/if}}
      - {{#if item.data.properties.stackable}} + {{#if item.system.properties.stackable}}   {{item.system.quantity}}  diff --git a/templates/actor/parts/tabs/actor-spellalchemy.hbs b/templates/actor/parts/tabs/actor-spellalchemy.hbs index 16d75fc..b95e340 100644 --- a/templates/actor/parts/tabs/actor-spellalchemy.hbs +++ b/templates/actor/parts/tabs/actor-spellalchemy.hbs @@ -14,10 +14,10 @@ {{item.name}}
      - {{item.data.properties.circle}} + {{item.system.properties.circle}}
      - {{item.data.properties.difficulty}} + {{item.system.properties.difficulty}}
      @@ -44,13 +44,13 @@ {{item.name}}
      - {{localize (concat "BOL.alchemyItem." item.data.properties.alchemytype)}} + {{localize (concat "BOL.alchemyItem." item.system.properties.alchemytype)}}
      - {{item.data.properties.difficulty}} + {{item.system.properties.difficulty}}
      - {{item.data.properties.pccurrent}} / {{item.data.properties.pccost}} + {{item.system.properties.pccurrent}} / {{item.system.properties.pccost}}
      diff --git a/templates/actor/parts/tabs/actor-stats.hbs b/templates/actor/parts/tabs/actor-stats.hbs index 95564c3..e977f1f 100644 --- a/templates/actor/parts/tabs/actor-stats.hbs +++ b/templates/actor/parts/tabs/actor-stats.hbs @@ -2,7 +2,7 @@ {{#each attributes as |attribute id|}}

      -
      +
      @@ -25,7 +25,7 @@ {{#each aptitudes as |aptitude id|}}

      -
      +
      @@ -50,29 +50,29 @@ {{#if @root.isAlchemist}}

      - - {{#if (eq @root.data.type 'player')}} + + {{#if (eq @root.chartype 'player')}} {{#if (exists bonus)}} - + {{else}} {{/if}} {{/if}} - +
      {{/if}} {{else}}

      - - {{#if (eq @root.data.type 'player')}} + + {{#if (eq @root.chartype 'player')}} {{#if (exists bonus)}} - + {{else}} {{/if}} {{/if}} - +
      {{/if}} {{/each}} diff --git a/templates/actor/parts/tabs/creature-actions.hbs b/templates/actor/parts/tabs/creature-actions.hbs index 5a28186..a116ca0 100644 --- a/templates/actor/parts/tabs/creature-actions.hbs +++ b/templates/actor/parts/tabs/creature-actions.hbs @@ -12,12 +12,12 @@
    6. {{#if ../weapon}}{{/if}}{{item.name}}{{#if ../weapon}}{{/if}}

      - {{#if ../protection}}
      {{item.data.properties.soak.formula}} / {{item.data.properties.soak.value}}
      {{/if}} - {{#if ../blocking}}
      {{item.data.properties.blocking.malus}}
      {{/if}} - {{#if ../weapon}}{{/if}} - {{#if ../ranged}}
      {{item.data.properties.range}}
      {{else}}
      {{/if}} + {{#if ../protection}}
      {{item.system.properties.soak.formula}} / {{item.system.properties.soak.value}}
      {{/if}} + {{#if ../blocking}}
      {{item.system.properties.blocking.malus}}
      {{/if}} + {{#if ../weapon}}{{/if}} + {{#if ../ranged}}
      {{item.system.properties.range}}
      {{else}}
      {{/if}} {{#if ../options}}
      - {{#if item.data.properties.activated}} + {{#if item.system.properties.activated}} {{localize "BOL.ui.toactivated"}} {{else}} {{localize "BOL.ui.todeactivated"}} diff --git a/templates/actor/parts/tabs/creature-stats.hbs b/templates/actor/parts/tabs/creature-stats.hbs index 2a93ffe..656a113 100644 --- a/templates/actor/parts/tabs/creature-stats.hbs +++ b/templates/actor/parts/tabs/creature-stats.hbs @@ -1,9 +1,9 @@
      - {{#each data.attributes as |attribute id|}} + {{#each attributes as |attribute id|}} {{#if (ne id "appeal")}}

      -
      +
      @@ -15,7 +15,7 @@
      {{localize "BOL.aptitudes.def"}}
      -
      +
      @@ -26,7 +26,7 @@

      - - + +
      diff --git a/templates/chat/rolls/defense-request-card.hbs b/templates/chat/rolls/defense-request-card.hbs index ccfe33d..3ac7c24 100644 --- a/templates/chat/rolls/defense-request-card.hbs +++ b/templates/chat/rolls/defense-request-card.hbs @@ -8,7 +8,7 @@ -{{#if defender.data.data.resources.hero.value}} +{{#if defender.system.resources.hero.value}} {{#each defenderWeapons as |weapon idx|}} diff --git a/templates/item/parts/properties/feature/career-properties.hbs b/templates/item/parts/properties/feature/career-properties.hbs index c9169e2..23b4c05 100644 --- a/templates/item/parts/properties/feature/career-properties.hbs +++ b/templates/item/parts/properties/feature/career-properties.hbs @@ -5,13 +5,13 @@
      - +
      - +
      - +
      diff --git a/templates/item/parts/properties/feature/fightoption-properties.hbs b/templates/item/parts/properties/feature/fightoption-properties.hbs index 26cba3a..8111e68 100644 --- a/templates/item/parts/properties/feature/fightoption-properties.hbs +++ b/templates/item/parts/properties/feature/fightoption-properties.hbs @@ -3,7 +3,7 @@
      - {{#select item.system.properties.fightoptiontype}} {{#each config.fightOptionTypes as |item id|}} diff --git a/templates/item/parts/properties/item/equipment-properties.hbs b/templates/item/parts/properties/item/equipment-properties.hbs index 41aac28..e5f7d7f 100644 --- a/templates/item/parts/properties/item/equipment-properties.hbs +++ b/templates/item/parts/properties/item/equipment-properties.hbs @@ -43,7 +43,7 @@

      -{{#if data.properties.equipable}} +{{#if item.system.properties.equipable}}
      @@ -66,7 +66,7 @@
      {{/if}} -{{#if data.properties.stackable}} +{{#if item.system.properties.stackable}}
      diff --git a/templates/item/parts/properties/item/protection-properties.hbs b/templates/item/parts/properties/item/protection-properties.hbs index d4f5c70..b2220ca 100644 --- a/templates/item/parts/properties/item/protection-properties.hbs +++ b/templates/item/parts/properties/item/protection-properties.hbs @@ -42,7 +42,7 @@
      {{/if}} -{{#if data.properties.helm}} +{{#if item.system.properties.helm}}
      @@ -51,7 +51,7 @@
      {{/if}} -{{#if data.properties.shield}} +{{#if item.system.properties.shield}}
      diff --git a/templates/item/parts/properties/item/weapon-properties.hbs b/templates/item/parts/properties/item/weapon-properties.hbs index d867689..70770dd 100644 --- a/templates/item/parts/properties/item/weapon-properties.hbs +++ b/templates/item/parts/properties/item/weapon-properties.hbs @@ -37,12 +37,12 @@ - {{#if data.properties.ranged}} + {{#if item.system.properties.ranged}} {{/if}} - {{#if data.properties.melee}} + {{#if item.system.properties.melee}} @@ -53,7 +53,7 @@

      -{{#if (not data.properties.onlymodifier)}} +{{#if (not item.system.properties.onlymodifier)}}