From c6c072c115b7388e191dfb4a0714cbd92a979e96 Mon Sep 17 00:00:00 2001
From: Batziy <55130783+Batziy@users.noreply.github.com>
Date: Mon, 26 Sep 2022 16:38:40 +0200
Subject: [PATCH 1/3] Weapon Roll
Moved the weapon roll HTML code to a HTML file instead of building it in JS
---
module/sheets/WitcherActorSheet.js | 107 ++++------------------------
templates/sheets/weapon-attack.html | 106 +++++++++++++++++++++++++++
2 files changed, 118 insertions(+), 95 deletions(-)
diff --git a/module/sheets/WitcherActorSheet.js b/module/sheets/WitcherActorSheet.js
index 8eae615c..bae7c74b 100644
--- a/module/sheets/WitcherActorSheet.js
+++ b/module/sheets/WitcherActorSheet.js
@@ -2096,65 +2096,6 @@ export default class WitcherActorSheet extends ActorSheet {
speaker: {alias: this.actor.name},
flavor: `
${game.i18n.localize("WITCHER.Dialog.NoAmmunation")}`
+ noAmmo = 1;
}
- else {
- let ammunationOption = ``
- ammunitions.forEach(element => {
- ammunationOption += `
`;
+ else {
+ ammunitions.forEach(element => {
+ ammunitionOption += `
`;
});
- content += `
`
}
}
-
+
+ let data = {item, attackSkill, displayDmgFormula, noAmmo, ammunitionOption, ammunitions}
+ const dialogTemplate = await renderTemplate("systems/TheWitcherTRPG/templates/sheets/weapon-attack.html", data)
new Dialog({
title: `${game.i18n.localize("WITCHER.Dialog.attackWith")}: ${item.name}`,
- content,
+ content: dialogTemplate,
buttons: {
Roll: {
label: `${game.i18n.localize("WITCHER.Dialog.ButtonRoll")}`,
diff --git a/templates/sheets/weapon-attack.html b/templates/sheets/weapon-attack.html
index e69de29b..b0933c24 100644
--- a/templates/sheets/weapon-attack.html
+++ b/templates/sheets/weapon-attack.html
@@ -0,0 +1,106 @@
+
\ No newline at end of file
From 136805ce76fa0d80b0b9a7fa16484b6ac972e303 Mon Sep 17 00:00:00 2001
From: Batziy <55130783+Batziy@users.noreply.github.com>
Date: Wed, 5 Oct 2022 09:32:20 +0200
Subject: [PATCH 3/3] Fixed
---
module/sheets/WitcherActorSheet.js | 8 ++++----
templates/sheets/weapon-attack.html | 26 +++++++++++++-------------
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/module/sheets/WitcherActorSheet.js b/module/sheets/WitcherActorSheet.js
index 72d98c19..b16f30c6 100644
--- a/module/sheets/WitcherActorSheet.js
+++ b/module/sheets/WitcherActorSheet.js
@@ -2130,7 +2130,7 @@ export default class WitcherActorSheet extends ActorSheet {
let noAmmo = 0
let ammunitionOption = ``
if (item.system.usingAmmo){
- ammunitions= this.actor.items.filter(function(item) {return item.type=="weapon" && item.system.isAmmo});
+ ammunitions = this.actor.items.filter(function(item) {return item.type=="weapon" && item.system.isAmmo});
let quantity = ammunitions.sum("quantity")
if (quantity <= 0) {
noAmmo = 1;
@@ -2142,7 +2142,7 @@ export default class WitcherActorSheet extends ActorSheet {
}
}
- let Mymelebonus=this.actor.system.attackStats.meleeBonus
+ let Mymelebonus = this.actor.system.attackStats.meleeBonus
let data = {item, attackSkill, displayDmgFormula, isMeleeAttack, noAmmo, ammunitionOption, ammunitions, Mymelebonus}
const myDialogOptions ={width: 500}
const dialogTemplate = await renderTemplate("systems/TheWitcherTRPG/templates/sheets/weapon-attack.html", data)
@@ -2218,7 +2218,7 @@ export default class WitcherActorSheet extends ActorSheet {
if (isRicochet) { attFormula += "-5"; }
if (isBlinded) { attFormula += "-3"; }
if (isSilhouetted) { attFormula += "+2"; }
- if (customAim>0) { attFormula += `+${customAim}`}
+ if (customAim > 0) { attFormula += `+${customAim}`}
let modifiers;
@@ -2435,7 +2435,7 @@ export default class WitcherActorSheet extends ActorSheet {
}
}
}
- },myDialogOptions).render(true)
+ }, myDialogOptions).render(true)
}
diff --git a/templates/sheets/weapon-attack.html b/templates/sheets/weapon-attack.html
index 1e32189a..13047725 100644
--- a/templates/sheets/weapon-attack.html
+++ b/templates/sheets/weapon-attack.html
@@ -90,7 +90,7 @@
{{localize "WITCHER.Dialog.attackUse"}} {{attackSkill}}
{{/if}}
-