From 7974897c03645829d9a5da46086bc3fca2620516 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Fri, 11 Mar 2022 14:00:14 +0100 Subject: [PATCH] Review sheet and headers --- modules/pegasus-actor-sheet.js | 22 ++++++++++++++------- modules/pegasus-combat.js | 12 ++++++++---- modules/pegasus-utility.js | 4 +--- system.json | 2 +- templates/actor-sheet.html | 30 ++++++++++++++++++++--------- templates/item-weapon-sheet.html | 4 ++-- templates/partial-actor-status.html | 7 ++++--- 7 files changed, 52 insertions(+), 29 deletions(-) diff --git a/modules/pegasus-actor-sheet.js b/modules/pegasus-actor-sheet.js index b61ba21..4d50655 100644 --- a/modules/pegasus-actor-sheet.js +++ b/modules/pegasus-actor-sheet.js @@ -84,10 +84,17 @@ export class PegasusActorSheet extends ActorSheet { } /* -------------------------------------------- */ - async rollIDR( diceValue) { + async rollIDR( itemId, diceValue) { + let item = this.actor.data.items.get( itemId) ?? {name: "Unknown"} let myRoll = new Roll(diceValue+"x").roll({ async: false }) - //await PegasusUtility.showDiceSoNice(myRoll, game.settings.get("core", "rollMode")) - myRoll.toMessage() + await PegasusUtility.showDiceSoNice(myRoll, game.settings.get("core", "rollMode")) + let chatData = { + user: game.user.id, + rollMode: game.settings.get("core", "rollMode"), + whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')), + content: `${this.actor.name} has roll IDR for ${item.name} : ${myRoll.total}` + } + ChatMessage.create(chatData) } /* -------------------------------------------- */ @@ -191,12 +198,12 @@ export class PegasusActorSheet extends ActorSheet { } ); html.find('.ammo-minus').click(event => { - const li = $(event.currentTarget).parents(".item"); + const li = $(event.currentTarget).parents(".item") this.actor.incDecAmmo( li.data("item-id"), -1 ); } ); html.find('.ammo-plus').click(event => { - const li = $(event.currentTarget).parents(".item"); - this.actor.incDecAmmo( li.data("item-id"), +1 ); + const li = $(event.currentTarget).parents(".item") + this.actor.incDecAmmo( li.data("item-id"), +1 ) } ); html.find('.momentum-minus').click(event => { @@ -240,7 +247,8 @@ export class PegasusActorSheet extends ActorSheet { }); html.find('.roll-idr').click((event) => { const diceValue = $(event.currentTarget).data("dice-value") - this.rollIDR( diceValue) + const li = $(event.currentTarget).parents(".item") + this.rollIDR( li.data("item-id"), diceValue) }) html.find('.roll-spec').click((event) => { diff --git a/modules/pegasus-combat.js b/modules/pegasus-combat.js index 9cae3f0..fed4ca7 100644 --- a/modules/pegasus-combat.js +++ b/modules/pegasus-combat.js @@ -20,15 +20,19 @@ export class PegasusCombat extends Combat { _onUpdate(changed, options, userId) { } + /* -------------------------------------------- */ + static async checkTurnPosition() { + while (game.combat.turn > 0) { + await game.combat.previousTurn() + } + } + /* -------------------------------------------- */ static async decInitBy10( combatantId, value) { const combatant = game.combat.combatants.get(combatantId) let initValue = combatant.initiative + value await game.combat.setInitiative(combatantId, initValue) - while (game.combat.turn > 0) { - await game.combat.previousTurn() - } - console.log("COMBAT", game.combat ) + setTimeout( this.checkTurnPosition, 400) // The setInitiative is no more blocking for unknown reason } } diff --git a/modules/pegasus-utility.js b/modules/pegasus-utility.js index a868eb8..75e2191 100644 --- a/modules/pegasus-utility.js +++ b/modules/pegasus-utility.js @@ -499,20 +499,18 @@ export class PegasusUtility { diceFormulaTab.push(this.getFoundryDiceFromLevel(diceGroup.level)) } let diceFormula = '{' + diceFormulaTab.join(', ') + '}kh'; - console.log(diceFormula); // Performs roll let myRoll = rollData.roll; if (!myRoll) { // New rolls only of no rerolls myRoll = new Roll(diceFormula).roll({ async: false }); - console.log("ROLL : ", diceFormula); + console.log("ROLL : ", diceFormula) await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode")); rollData.roll = myRoll } // Final score and keep data rollData.finalScore = myRoll.total + dicePool[0].statmod; - console.log("ROLLLL!!!!", rollData); if (rollData.damages) { let dmgFormula = this.getFoundryDiceFromLevel(rollData.damages.value) diff --git a/system.json b/system.json index 1ffee4f..91c9a13 100644 --- a/system.json +++ b/system.json @@ -183,6 +183,6 @@ "templateVersion": 87, "title": "Pegasus RPG", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", - "version": "0.5.5", + "version": "0.5.6", "background" : "./images/ui/pegasus_welcome_page.webp" } diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index f359de7..024582e 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -359,6 +359,9 @@ + + + @@ -391,6 +394,8 @@ + {{upperFirst power.data.action}} + {{#if power.data.dmgroll}} {{upper power.data.dmgstatistic}} @@ -475,7 +480,7 @@ - + {{#each moneys as |money key|}} @@ -531,7 +536,7 @@ - + {{#each weapons as |weapon key|}} @@ -541,9 +546,16 @@ - -/+) - + + {{#if (gt weapon.data.ammomax 0)}} + + {{else}} + + + {{/if}} + {{#if (count weapon.data.effects)}} {{#if weapon.data.activated}} @@ -584,7 +596,7 @@ - + @@ -596,7 +608,7 @@ - + {{#each armors as |armor key|}} @@ -653,7 +665,7 @@ - + {{#each shields as |shield key|}} @@ -710,7 +722,7 @@ - + {{#each containersTree as |equip key|}} diff --git a/templates/item-weapon-sheet.html b/templates/item-weapon-sheet.html index 4acd7f0..3341e46 100644 --- a/templates/item-weapon-sheet.html +++ b/templates/item-weapon-sheet.html @@ -97,11 +97,11 @@ -
  • +
  • -
  • +
  • diff --git a/templates/partial-actor-status.html b/templates/partial-actor-status.html index a2c0c9c..7fd3734 100644 --- a/templates/partial-actor-status.html +++ b/templates/partial-actor-status.html @@ -2,8 +2,8 @@
  • - +
  • {{#each data.secondary as |stat2 key|}}
  • @@ -18,8 +18,8 @@ - +
  • {{/each}}
  • @@ -27,8 +27,9 @@ - + + /{{data.nrg.absolutemax}}