From b8d6191db04efa0a259d7015ffc084e156a2cc9b Mon Sep 17 00:00:00 2001 From: Bruno Mendes Date: Sat, 17 Sep 2022 14:29:10 -0300 Subject: [PATCH] Changes to be committed: modified: tormenta20.html --- Tormenta21/tormenta20.html | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Tormenta21/tormenta20.html b/Tormenta21/tormenta20.html index f0df076b27..eda752c271 100644 --- a/Tormenta21/tormenta20.html +++ b/Tormenta21/tormenta20.html @@ -1798,6 +1798,14 @@ }); }); + //Trigger CalculoPesoMoeda + on("sheet:opened change:ts", function(e){ + repeatingSumModified("carga","equipment",["equipquantity","equipslot"], ""); + }); + on("sheet:opened change:to", function(e){ + repeatingSumModified("carga","equipment",["equipquantity","equipslot"], ""); + }); + //Bonus em perícia por nível on("sheet:opened change:charnivel", function(e){ getAttrs(["charnivel"], function(v){ @@ -1895,6 +1903,16 @@ if (!Array.isArray(fields)) fields = [fields]; getSectionIDs(`repeating_${section}`, idArray => { const attrArray = idArray.reduce( (m,id) => [...m, ...(fields.map(field => `repeating_${section}_${id}_${field}`))],[]); + + let pesoMoeda = 0; + getAttrs(["ts", "to"], function(v){ + let tibar = parseInt(v.ts); + let tibouro = parseInt(v.to); + pesoMoeda = Math.floor((tibar + tibouro)/1000); + }); + + console.log('Peso Moeda:' + pesoMoeda); + getAttrs(["for", ...attrArray], v => { console.log("===== values of v: "+ JSON.stringify(v) +" ====="); // getValue: if not a number, returns 1 if it is 'on' (checkbox), otherwise returns 0.. @@ -1905,10 +1923,10 @@ let cargalimit = for_mod > 0 ? 10 + (2 * for_mod) : 10 + parseInt(for_mod); let cargamax = cargalimit * 2; - + let setObj = {} - let finalTotal = sumTotal * multiplier; + let finalTotal = (sumTotal * multiplier) + pesoMoeda; finalTotal = finalTotal.toString() + appendText;