diff --git a/Delta Green 2/deltagreen.html b/Delta Green 2/deltagreen.html index d3caf904d67c..f3cf84ee8e8e 100644 --- a/Delta Green 2/deltagreen.html +++ b/Delta Green 2/deltagreen.html @@ -5483,7 +5483,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

} setAttrs(update, {silent:true},()=>{ - + console.info('update',update) }); startRoll(`${rollValue} {{isSkill=[[${_isSkill}]]}}`, (results)=> { @@ -5517,7 +5517,8 @@

{{#subheader}}({{subheader}}%){{/subheader}}

console.log('inside repeating section'); setAttrs(update,{silent:true},()=>{ - console.log('Bonds updated on open'); + console.info('update',update); + console.log('Bonds updated on open'); }); }); }); @@ -5910,7 +5911,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

// UPDATE TO VERSION 2.0 const version_170_200 = () => { let codeversion=2.0; - let update={}; + const update={}; update['version']=codeversion; getAttrs(["motivations","character_name","name","sanity_points","violence_3","helplessness_3","violence_2","helplessness_2", "sanity_points_old","sanity_points","breaking_point_old","breaking_point_old"],function(v){ @@ -5956,7 +5957,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

// UPDATE TO VERSION 2.0 const version_200_201 = () => { let codeversion=2.01; - let update={}; + const update={}; console.log('version:',codeversion); update['version']=codeversion; @@ -5979,8 +5980,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

}); getAttrs(repfields,(values) => { console.info('fullarray',values); - var update = {}; - + ids.forEach(id => { const repsecid= `repeating_${section}_${id}_`; @@ -6023,7 +6023,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

const value_ammo = Math.max(parseInt(values[`${repsecid}ammo`],10) || 0,0) ; if (value_ammo>0){ update[`${repsecid}ammo_total`]=value_ammo; - update[`${repsecid}hasammo`]=1; + update[`${repsecid}hasammo`]='active'; update[`${repsecid}ammo`]=value_ammo; } else { update[`${repsecid}hasammo`]=0; @@ -6065,47 +6065,48 @@

{{#subheader}}({{subheader}}%){{/subheader}}

const version_201_202 = () => { let codeversion=2.02; - let update={}; + const update={}; console.log('verion:',codeversion); update['version']=codeversion; getAttrs(["sheet_type"], values => { + var names=[]; + var rank=[]; + if (values.sheet_type==='npc'){ update['sheet_type']='npc'; getSectionIDs(`skills`, ids => { - var names=[]; - var rank=[]; ids.forEach(id => { names.push(`repeating_skills_${id}_name`); rank.push(`repeating_skills_${id}_rank`); }); - // make it into an object with keys = names and values = rank - - - getAttrs(names.concat(rank), values => { - const update={}; - var ids_to_remove=[]; // for the ids that I copy in the named skills - names.forEach((name,idx) => { - const skillname=values[name].toLowerCase().replace(/ /g, "_"); - const rankvalue=values[rank[idx]]; - const id_value=name.split('_')[2]; - if (arrays['_skills'].includes(skillname)){ - update[`${skillname}`]=rankvalue; - update[`${skillname}_visible`]='visible'; - ids_to_remove.push(id_value); - } - }); - console.info('update npc skills',update); - setAttrs(update, {silent:true}, () => { - console.log('updated skills'); - ids_to_remove.forEach(id => { - removeRepeatingRow(`repeating_skills_${id}`); - }); - console.log('removed repeating skills'); - versioning(codeversion); - }); + }); + }; + // make it into an object with keys = names and values = ran + + + getAttrs(names.concat(rank), values => { + var ids_to_remove=[]; // for the ids that I copy in the named skills + names.forEach((name,idx) => { + const skillname=values[name].toLowerCase().replace(/ /g, "_"); + const rankvalue=values[rank[idx]]; + const id_value=name.split('_')[2]; + if (arrays['_skills'].includes(skillname)){ + update[`${skillname}`]=rankvalue; + update[`${skillname}_visible`]='visible'; + ids_to_remove.push(id_value); + } + }); + console.info('update npc skills',update); + + setAttrs(update, {silent:true}, () => { + console.log('updated skills'); + ids_to_remove.forEach(id => { + removeRepeatingRow(`repeating_skills_${id}`); }); + console.log('removed repeating skills'); + versioning(codeversion); + }); }); - }; }); } @@ -6127,7 +6128,8 @@

{{#subheader}}({{subheader}}%){{/subheader}}

update['repeating_bonds_'+id+'_color'] = BondButtonColor(score); }); setAttrs(update, {silent:true}, () => { - console.log('Bond color updated'); + console.info('update',update); + console.log('Bond color updated'); }); }); @@ -6205,7 +6207,8 @@

{{#subheader}}({{subheader}}%){{/subheader}}

Object.assign(update, updateRepeatingRolls(section, attrName, id, character_id)); }); setAttrs(update, {silent:true}, () => { - console.log('Repeating and Normal Rolls updated'); + console.info('update',update); + console.log('Repeating and Normal Rolls updated'); }); }); @@ -6229,7 +6232,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

} setAttrs(update, {silent:true}, () => { - + console.info('update',update); }); }); }; @@ -6312,7 +6315,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

update=check_for_failed_skill(rollName,outcome.isSuccess,isSkill); setAttrs(update,{silent:false}, () => { - + console.info('update',update); }); }); @@ -6351,7 +6354,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

finishRoll(results.rollId,newroll); setAttrs(update,{silent:false}, () => { - + console.info('update',update); }); }); }; @@ -6531,7 +6534,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

const update={}; update[names['ammo']]=newroll['current_ammo']; setAttrs(update, () => { - + console.info('update',update); }); } }); @@ -6958,7 +6961,8 @@

{{#subheader}}({{subheader}}%){{/subheader}}

finishRoll(results.rollId,newroll); setAttrs(update, {silent:true}, () => { - updatebreakingpoints() // I need to update the breaking points in the callback + console.info('update',update); + updatebreakingpoints() // I need to update the breaking points in the callback }); }); @@ -7283,7 +7287,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

update[`${repsecid}_cost_text`] = `${String(costs_text).toUpperCase()}`; setAttrs(update, {silent:true}, () => { - + console.info('update',update); }); }); }; @@ -7314,7 +7318,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

on(`clicked:reset_global_modifier`, () => { const update={'global_modifier_number':''}; setAttrs(update, {silent:true}, () => { - + console.info('update',update); }); }); @@ -7616,7 +7620,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

update[`${vitality}_points`]=value; setAttrs(update, {silent:false}, ()=>{ - + console.info('update',update); }); }); }); @@ -7639,7 +7643,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

update[input]=0; if (section !=='skills') {update[skillspan]=update[input];} setAttrs(update,{silent:true},()=>{ - + console.info('update',update); }); } @@ -7648,7 +7652,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

update[input]=number; if (section !=='skills') {update[skillspan]=update[input];} setAttrs(update,{silent:true},()=>{ - + console.info('update',update); }); } @@ -7659,7 +7663,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

const number= setMinMax(values[skillname]); if (section !=='skills') {update[skillspan]=number;} setAttrs(update,{silent:true},()=>{ - + console.info('update',update); }); }); }; @@ -7679,6 +7683,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

const number=setMinMax(value[input]); update[input]=number; setAttrs(update,{silent:true},()=>{ + console.info('update',update); }); }); }); @@ -7701,6 +7706,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

const number=parseRoll(value[input]); update[input]=number; setAttrs(update,{silent:true},()=>{ + console.info('update',update); }); }); }); @@ -7715,6 +7721,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

const update={}; update[sanity]=value; setAttrs(update, {silent:true}, () => { + console.info('update',update); console.info(`Sanity points updated`); }); }); @@ -7749,7 +7756,8 @@

{{#subheader}}({{subheader}}%){{/subheader}}

} setAttrs(update,{silent:true},()=>{ - console.log('Shotgun or Blast Radius updated'); + console.info('update',update); + console.log('Shotgun or Blast Radius updated'); }); }); @@ -7775,7 +7783,8 @@

{{#subheader}}({{subheader}}%){{/subheader}}

} setAttrs(update, {silent:true}, () => { - console.log('Willpower Settings updated'); + console.info('update',update); + console.log('Willpower Settings updated'); }); }); }); @@ -7787,7 +7796,8 @@

{{#subheader}}({{subheader}}%){{/subheader}}

update[eventInfo.sourceAttribute]=newValue; setAttrs(update,{silent:true},()=>{ - console.log('Repeating Skills updated on change'); + console.info('update',update); + console.log('Repeating Skills updated on change'); }); }); @@ -7806,6 +7816,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

update={sanity_points_max: 99-newvalue, unnatural: newvalue}; setAttrs(update,{silent:true},()=>{ + console.info('update',update); console.log('Sanity points updated'); }); }); @@ -7873,7 +7884,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

const update = {}; update['breaking_point_reset'] = Math.min(Math.max(0,breaking_point_reset),99); setAttrs(update, {silent:true}, () => { - + console.info('update',update); }); }); }); @@ -7887,7 +7898,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

const modifier = parseInt(values['global_modifier_number']) || 0; const update = {global_modifier_number:modifier}; setAttrs(update, {silent:true}, () => { - + console.info('update',update); }); }); }); @@ -7898,9 +7909,10 @@

{{#subheader}}({{subheader}}%){{/subheader}}

on(`change:repeating_weapons:armor_piercing`, () => { getAttrs(['repeating_weapons_armor_piercing'], (values) => { - const update = {}; - update_armor_piercing(values.repeating_weapons_armor_piercing,update); - setAttrs(update, {silent:true}, () => { + const update = {}; + update_armor_piercing(values.repeating_weapons_armor_piercing,update); + setAttrs(update, {silent:true}, () => { + console.info('update',update); }); }); }); @@ -7912,6 +7924,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

update[`repeating_weapons_hasammo`] = ammo_total > 0 ? 'active' : '0'; setAttrs(update, {silent:true}, () => { + console.info('update',update); }); }); @@ -7920,6 +7933,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

const update = {}; update[`repeating_weapons_ammo`] = ammo; setAttrs(update, {silent:true}, () => { + console.info('update',update) }); }); @@ -7951,7 +7965,8 @@

{{#subheader}}({{subheader}}%){{/subheader}}

const update={}; update[`${adaptation}_adapted`]= value===2 ? 1 : 0; setAttrs(update, {silent:true}, () => { - update[`${adaptation}_adapted`] == 1 ? console.log(`${adaptation} adapted`) : console.log(`${adaptation} not adapted`); + console.info('update',update); + update[`${adaptation}_adapted`] == 1 ? console.log(`${adaptation} adapted`) : console.log(`${adaptation} not adapted`); }); }); }); @@ -7970,7 +7985,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

setAttrs(update, {silent:true}, () => { - + console.info('update',update); }); }); }); @@ -8290,6 +8305,7 @@

{{#subheader}}({{subheader}}%){{/subheader}}

const bpmax=parseInt(results.results.breaking_point_max.result)||0; update[`${repsecid}_has_breaking_points`]=bp{ + console.info('update',update); console.log(`Updated ${repsecid} with ${character_identification}`); }); finishRoll(results.rollId); @@ -8315,8 +8331,4 @@

{{#subheader}}({{subheader}}%){{/subheader}}

}; }); }); - - - - - + \ No newline at end of file diff --git a/Delta Green 2/src/js/sheetworkers.dev.js b/Delta Green 2/src/js/sheetworkers.dev.js index c83ab6451020..8633eb7ccb30 100644 --- a/Delta Green 2/src/js/sheetworkers.dev.js +++ b/Delta Green 2/src/js/sheetworkers.dev.js @@ -139,7 +139,9 @@ var definesanroll = function definesanroll(san, sold, bnew, bold, sanflags, char setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); startRoll("".concat(rollValue, " {{isSkill=[[").concat(_isSkill, "]]}}"), function (results) { var sanity_old = results.results.sanity_old.result; var sanity_new = results.results.sanity_new.result; @@ -170,6 +172,7 @@ var setBondsLocalVariables = function setBondsLocalVariables() { setAttrs(update, { silent: true }, function () { + console.info('update', update); console.log('Bonds updated on open'); }); }); diff --git a/Delta Green 2/src/js/sheetworkers.js b/Delta Green 2/src/js/sheetworkers.js index 21d4eb3b1982..c92eaf49e31e 100644 --- a/Delta Green 2/src/js/sheetworkers.js +++ b/Delta Green 2/src/js/sheetworkers.js @@ -100,7 +100,7 @@ const definesanroll=(san,sold,bnew,bold,sanflags,character_name,San2_disorder={} } setAttrs(update, {silent:true},()=>{ - + console.info('update',update) }); startRoll(`${rollValue} {{isSkill=[[${_isSkill}]]}}`, (results)=> { @@ -134,7 +134,8 @@ const setBondsLocalVariables = () => { console.log('inside repeating section'); setAttrs(update,{silent:true},()=>{ - console.log('Bonds updated on open'); + console.info('update',update); + console.log('Bonds updated on open'); }); }); }); diff --git a/Delta Green 2/src/js/sheetworkers_handlersheet.dev.js b/Delta Green 2/src/js/sheetworkers_handlersheet.dev.js index 31ae8a02fdfd..0c55403d8410 100644 --- a/Delta Green 2/src/js/sheetworkers_handlersheet.dev.js +++ b/Delta Green 2/src/js/sheetworkers_handlersheet.dev.js @@ -33,6 +33,7 @@ var update_repeating_agents = function update_repeating_agents(repsecid, charact setAttrs(update, { silent: true }, function () { + console.info('update', update); console.log("Updated ".concat(repsecid, " with ").concat(character_identification)); }); finishRoll(results.rollId); diff --git a/Delta Green 2/src/js/sheetworkers_handlersheet.js b/Delta Green 2/src/js/sheetworkers_handlersheet.js index 7ee893da1eff..5e595b354f71 100644 --- a/Delta Green 2/src/js/sheetworkers_handlersheet.js +++ b/Delta Green 2/src/js/sheetworkers_handlersheet.js @@ -32,6 +32,7 @@ const update_repeating_agents = (repsecid,character_identification) => { const bpmax=parseInt(results.results.breaking_point_max.result)||0; update[`${repsecid}_has_breaking_points`]=bp{ + console.info('update',update); console.log(`Updated ${repsecid} with ${character_identification}`); }); finishRoll(results.rollId); diff --git a/Delta Green 2/src/js/sheetworkers_onchange.dev.js b/Delta Green 2/src/js/sheetworkers_onchange.dev.js index 5a50cd0237f6..fbf1dbe6eb25 100644 --- a/Delta Green 2/src/js/sheetworkers_onchange.dev.js +++ b/Delta Green 2/src/js/sheetworkers_onchange.dev.js @@ -39,7 +39,9 @@ arrays['_colored_derivative'].forEach(function (vitality) { update["".concat(vitality, "_points")] = value; setAttrs(update, { silent: false - }, function () {}); + }, function () { + console.info('update', update); + }); }); }); }); @@ -66,7 +68,9 @@ _skill_percent.forEach(function (_skill_sec_percent) { setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); } if (isInNumericalForm) { @@ -79,7 +83,9 @@ _skill_percent.forEach(function (_skill_sec_percent) { setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); } if (isInLinkingForm) { @@ -94,7 +100,9 @@ _skill_percent.forEach(function (_skill_sec_percent) { setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); }); } @@ -117,7 +125,9 @@ _only_number.forEach(function (_sect_object) { update[input] = number; setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); }); }); }); @@ -140,7 +150,9 @@ _number_or_roll.forEach(function (_sect_object) { update[input] = number; setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); }); }); }); @@ -158,6 +170,7 @@ arrays['_sanity_loss'].forEach(function (sanity) { setAttrs(update, { silent: true }, function () { + console.info('update', update); console.info("Sanity points updated"); }); }); @@ -195,6 +208,7 @@ _shotgun_or_blast_radius.forEach(function (main) { setAttrs(update, { silent: true }, function () { + console.info('update', update); console.log('Shotgun or Blast Radius updated'); }); }); @@ -225,6 +239,7 @@ arrays['_settings_wp'].forEach(function (wp_setting) { setAttrs(update, { silent: true }, function () { + console.info('update', update); console.log('Willpower Settings updated'); }); }); @@ -237,6 +252,7 @@ on("change:repeating_skills:rank", function (eventInfo) { setAttrs(update, { silent: true }, function () { + console.info('update', update); console.log('Repeating Skills updated on change'); }); }); @@ -260,6 +276,7 @@ on("change:unnatural", function (eventInfo) { setAttrs(update, { silent: true }, function () { + console.info('update', update); console.log('Sanity points updated'); }); }); @@ -327,7 +344,9 @@ on("change:breaking_point_reset", function (eventInfo) { update['breaking_point_reset'] = Math.min(Math.max(0, breaking_point_reset), 99); setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); }); }); on("clicked:breaking_point_resets", function () { @@ -341,7 +360,9 @@ on("change:global_modifier_number", function () { }; setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); }); }); on("change:repeating_skills remove:repeating_skills", function () { @@ -353,7 +374,9 @@ on("change:repeating_weapons:armor_piercing", function () { update_armor_piercing(values.repeating_weapons_armor_piercing, update); setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); }); }); on("change:repeating_weapons:ammo_total remove:repeating_weapons", function (values) { @@ -364,7 +387,9 @@ on("change:repeating_weapons:ammo_total remove:repeating_weapons", function (val update["repeating_weapons_hasammo"] = ammo_total > 0 ? 'active' : '0'; setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); }); on("change:repeating_weapons:ammo", function (values) { var ammo = Math.max(0, parseInt(values.newValue) || 0); @@ -372,7 +397,9 @@ on("change:repeating_weapons:ammo", function (values) { update["repeating_weapons_ammo"] = ammo; setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); }); _bond_attributes.forEach(function (attrName) { @@ -405,6 +432,7 @@ arrays['_adaptation'].forEach(function (adaptation) { setAttrs(update, { silent: true }, function () { + console.info('update', update); update["".concat(adaptation, "_adapted")] == 1 ? console.log("".concat(adaptation, " adapted")) : console.log("".concat(adaptation, " not adapted")); }); }); @@ -428,7 +456,9 @@ on("change:useKey", function () { console.log("useKey: ".concat(val)); setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); }); }); // === Update repeating skills on change diff --git a/Delta Green 2/src/js/sheetworkers_onchange.js b/Delta Green 2/src/js/sheetworkers_onchange.js index a3128c1ad548..54a117191654 100644 --- a/Delta Green 2/src/js/sheetworkers_onchange.js +++ b/Delta Green 2/src/js/sheetworkers_onchange.js @@ -28,7 +28,7 @@ arrays['_colored_derivative'].forEach(vitality => { update[`${vitality}_points`]=value; setAttrs(update, {silent:false}, ()=>{ - + console.info('update',update); }); }); }); @@ -51,7 +51,7 @@ arrays['_colored_derivative'].forEach(vitality => { update[input]=0; if (section !=='skills') {update[skillspan]=update[input];} setAttrs(update,{silent:true},()=>{ - + console.info('update',update); }); } @@ -60,7 +60,7 @@ arrays['_colored_derivative'].forEach(vitality => { update[input]=number; if (section !=='skills') {update[skillspan]=update[input];} setAttrs(update,{silent:true},()=>{ - + console.info('update',update); }); } @@ -71,7 +71,7 @@ arrays['_colored_derivative'].forEach(vitality => { const number= setMinMax(values[skillname]); if (section !=='skills') {update[skillspan]=number;} setAttrs(update,{silent:true},()=>{ - + console.info('update',update); }); }); }; @@ -91,6 +91,7 @@ _only_number.forEach(_sect_object => { const number=setMinMax(value[input]); update[input]=number; setAttrs(update,{silent:true},()=>{ + console.info('update',update); }); }); }); @@ -113,6 +114,7 @@ _number_or_roll.forEach(_sect_object => { const number=parseRoll(value[input]); update[input]=number; setAttrs(update,{silent:true},()=>{ + console.info('update',update); }); }); }); @@ -127,6 +129,7 @@ arrays['_sanity_loss'].forEach(sanity => { const update={}; update[sanity]=value; setAttrs(update, {silent:true}, () => { + console.info('update',update); console.info(`Sanity points updated`); }); }); @@ -161,7 +164,8 @@ _shotgun_or_blast_radius.forEach(main => { } setAttrs(update,{silent:true},()=>{ - console.log('Shotgun or Blast Radius updated'); + console.info('update',update); + console.log('Shotgun or Blast Radius updated'); }); }); @@ -187,7 +191,8 @@ arrays['_settings_wp'].forEach(wp_setting => { } setAttrs(update, {silent:true}, () => { - console.log('Willpower Settings updated'); + console.info('update',update); + console.log('Willpower Settings updated'); }); }); }); @@ -199,7 +204,8 @@ on(`change:repeating_skills:rank`, (eventInfo) => { update[eventInfo.sourceAttribute]=newValue; setAttrs(update,{silent:true},()=>{ - console.log('Repeating Skills updated on change'); + console.info('update',update); + console.log('Repeating Skills updated on change'); }); }); @@ -218,6 +224,7 @@ on(`change:unnatural`, function(eventInfo) { update={sanity_points_max: 99-newvalue, unnatural: newvalue}; setAttrs(update,{silent:true},()=>{ + console.info('update',update); console.log('Sanity points updated'); }); }); @@ -285,7 +292,7 @@ on(`change:breaking_point_reset`,(eventInfo)=>{ const update = {}; update['breaking_point_reset'] = Math.min(Math.max(0,breaking_point_reset),99); setAttrs(update, {silent:true}, () => { - + console.info('update',update); }); }); }); @@ -299,7 +306,7 @@ on(`change:global_modifier_number`, () => { const modifier = parseInt(values['global_modifier_number']) || 0; const update = {global_modifier_number:modifier}; setAttrs(update, {silent:true}, () => { - + console.info('update',update); }); }); }); @@ -310,9 +317,10 @@ on(`change:repeating_skills remove:repeating_skills`, () => { on(`change:repeating_weapons:armor_piercing`, () => { getAttrs(['repeating_weapons_armor_piercing'], (values) => { - const update = {}; - update_armor_piercing(values.repeating_weapons_armor_piercing,update); - setAttrs(update, {silent:true}, () => { + const update = {}; + update_armor_piercing(values.repeating_weapons_armor_piercing,update); + setAttrs(update, {silent:true}, () => { + console.info('update',update); }); }); }); @@ -324,6 +332,7 @@ on(`change:repeating_weapons:ammo_total remove:repeating_weapons`, (values) => { update[`repeating_weapons_hasammo`] = ammo_total > 0 ? 'active' : '0'; setAttrs(update, {silent:true}, () => { + console.info('update',update); }); }); @@ -332,6 +341,7 @@ on(`change:repeating_weapons:ammo`, (values) => { const update = {}; update[`repeating_weapons_ammo`] = ammo; setAttrs(update, {silent:true}, () => { + console.info('update',update) }); }); @@ -363,7 +373,8 @@ arrays['_adaptation'].forEach(adaptation => { const update={}; update[`${adaptation}_adapted`]= value===2 ? 1 : 0; setAttrs(update, {silent:true}, () => { - update[`${adaptation}_adapted`] == 1 ? console.log(`${adaptation} adapted`) : console.log(`${adaptation} not adapted`); + console.info('update',update); + update[`${adaptation}_adapted`] == 1 ? console.log(`${adaptation} adapted`) : console.log(`${adaptation} not adapted`); }); }); }); @@ -382,7 +393,7 @@ on(`change:useKey`, () => { setAttrs(update, {silent:true}, () => { - + console.info('update',update); }); }); }); diff --git a/Delta Green 2/src/js/sheetworkers_onclicked.dev.js b/Delta Green 2/src/js/sheetworkers_onclicked.dev.js index 1f2b1fb7ed49..a2257ab8321e 100644 --- a/Delta Green 2/src/js/sheetworkers_onclicked.dev.js +++ b/Delta Green 2/src/js/sheetworkers_onclicked.dev.js @@ -14,7 +14,9 @@ on("clicked:reset_global_modifier", function () { }; setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); }); $20(selector).on("click", function (e) { var roll = e.htmlAttributes.name.match(/^attr_(.*)_r$/)[1]; diff --git a/Delta Green 2/src/js/sheetworkers_onclicked.js b/Delta Green 2/src/js/sheetworkers_onclicked.js index 11786dafdd3e..072079d5b744 100644 --- a/Delta Green 2/src/js/sheetworkers_onclicked.js +++ b/Delta Green 2/src/js/sheetworkers_onclicked.js @@ -1,7 +1,7 @@ on(`clicked:reset_global_modifier`, () => { const update={'global_modifier_number':''}; setAttrs(update, {silent:true}, () => { - + console.info('update',update); }); }); diff --git a/Delta Green 2/src/js/sheetworkers_parseinput.dev.js b/Delta Green 2/src/js/sheetworkers_parseinput.dev.js index d6dc32199ed6..0f807df221b3 100644 --- a/Delta Green 2/src/js/sheetworkers_parseinput.dev.js +++ b/Delta Green 2/src/js/sheetworkers_parseinput.dev.js @@ -33,6 +33,7 @@ var changeBondButtonColorOnOpen = function changeBondButtonColorOnOpen() { setAttrs(update, { silent: true }, function () { + console.info('update', update); console.log('Bond color updated'); }); }); diff --git a/Delta Green 2/src/js/sheetworkers_parseinput.js b/Delta Green 2/src/js/sheetworkers_parseinput.js index 1ddbfb4e4aad..c85f8f14332b 100644 --- a/Delta Green 2/src/js/sheetworkers_parseinput.js +++ b/Delta Green 2/src/js/sheetworkers_parseinput.js @@ -18,7 +18,8 @@ const changeBondButtonColorOnOpen = () => { update['repeating_bonds_'+id+'_color'] = BondButtonColor(score); }); setAttrs(update, {silent:true}, () => { - console.log('Bond color updated'); + console.info('update',update); + console.log('Bond color updated'); }); }); diff --git a/Delta Green 2/src/js/sheetworkers_ritual_activation.dev.js b/Delta Green 2/src/js/sheetworkers_ritual_activation.dev.js index 79e3404f3425..4961ca82da7a 100644 --- a/Delta Green 2/src/js/sheetworkers_ritual_activation.dev.js +++ b/Delta Green 2/src/js/sheetworkers_ritual_activation.dev.js @@ -52,6 +52,7 @@ var paythecost = function paythecost(sanity_loss, other_costs) { setAttrs(update, { silent: true }, function () { + console.info('update', update); updatebreakingpoints(); // I need to update the breaking points in the callback }); }); @@ -426,6 +427,8 @@ var ritual_rolls_info = function ritual_rolls_info(repsecid) { update["".concat(repsecid, "_cost_text")] = "".concat(String(costs_text).toUpperCase()); setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); }); }; \ No newline at end of file diff --git a/Delta Green 2/src/js/sheetworkers_ritual_activation.js b/Delta Green 2/src/js/sheetworkers_ritual_activation.js index f1d1e62c8124..58da084c5b62 100644 --- a/Delta Green 2/src/js/sheetworkers_ritual_activation.js +++ b/Delta Green 2/src/js/sheetworkers_ritual_activation.js @@ -45,7 +45,8 @@ const paythecost=(sanity_loss,other_costs,fraction=1) => { finishRoll(results.rollId,newroll); setAttrs(update, {silent:true}, () => { - updatebreakingpoints() // I need to update the breaking points in the callback + console.info('update',update); + updatebreakingpoints() // I need to update the breaking points in the callback }); }); @@ -370,7 +371,7 @@ const ritual_rolls_info = (repsecid) => { update[`${repsecid}_cost_text`] = `${String(costs_text).toUpperCase()}`; setAttrs(update, {silent:true}, () => { - + console.info('update',update); }); }); }; diff --git a/Delta Green 2/src/js/sheetworkers_rolls.dev.js b/Delta Green 2/src/js/sheetworkers_rolls.dev.js index dd7d4a0e2f0e..b3e0c1801521 100644 --- a/Delta Green 2/src/js/sheetworkers_rolls.dev.js +++ b/Delta Green 2/src/js/sheetworkers_rolls.dev.js @@ -83,6 +83,7 @@ var updateRepeatingRollsonOpen = function updateRepeatingRollsonOpen(update, cha setAttrs(update, { silent: true }, function () { + console.info('update', update); console.log('Repeating and Normal Rolls updated'); }); }); @@ -104,7 +105,9 @@ var changeRepeatingRolls = function changeRepeatingRolls(section, attrName, id) setAttrs(update, { silent: true - }, function () {}); + }, function () { + console.info('update', update); + }); }); }; @@ -178,7 +181,9 @@ var rollSkillAndStats = function rollSkillAndStats(rollValue, rollName, isSkill) update = check_for_failed_skill(rollName, outcome.isSuccess, isSkill); setAttrs(update, { silent: false - }, function () {}); + }, function () { + console.info('update', update); + }); }); }; @@ -210,7 +215,9 @@ var rollBonds = function rollBonds(rollValue, _value, _names, _parameters) { finishRoll(results.rollId, newroll); setAttrs(update, { silent: false - }, function () {}); + }, function () { + console.info('update', update); + }); }); }; @@ -398,7 +405,9 @@ var clicked_repeating_damages = function clicked_repeating_damages(parameters, n if (trackAmmo == 1) { var _update = {}; _update[names['ammo']] = newroll['current_ammo']; - setAttrs(_update, function () {}); + setAttrs(_update, function () { + console.info('update', _update); + }); } }); }); diff --git a/Delta Green 2/src/js/sheetworkers_rolls.js b/Delta Green 2/src/js/sheetworkers_rolls.js index d5204c6bd34b..01804603260c 100644 --- a/Delta Green 2/src/js/sheetworkers_rolls.js +++ b/Delta Green 2/src/js/sheetworkers_rolls.js @@ -69,7 +69,8 @@ const updateRepeatingRollsonOpen = (update,character_id) => { Object.assign(update, updateRepeatingRolls(section, attrName, id, character_id)); }); setAttrs(update, {silent:true}, () => { - console.log('Repeating and Normal Rolls updated'); + console.info('update',update); + console.log('Repeating and Normal Rolls updated'); }); }); @@ -93,7 +94,7 @@ const changeRepeatingRolls = (section,attrName,id) => { } setAttrs(update, {silent:true}, () => { - + console.info('update',update); }); }); }; @@ -176,7 +177,7 @@ const rollSkillAndStats=(rollValue,rollName,isSkill) => { update=check_for_failed_skill(rollName,outcome.isSuccess,isSkill); setAttrs(update,{silent:false}, () => { - + console.info('update',update); }); }); @@ -215,7 +216,7 @@ const rollBonds=(rollValue,_value,_names,_parameters) => { finishRoll(results.rollId,newroll); setAttrs(update,{silent:false}, () => { - + console.info('update',update); }); }); }; @@ -395,7 +396,7 @@ const clicked_repeating_damages = (parameters,names,type_prefix='damage') => { const update={}; update[names['ammo']]=newroll['current_ammo']; setAttrs(update, () => { - + console.info('update',update); }); } }); diff --git a/Delta Green 2/src/js/sheetworkers_versioning.dev.js b/Delta Green 2/src/js/sheetworkers_versioning.dev.js index 857f173523b2..5dc3d050ff21 100644 --- a/Delta Green 2/src/js/sheetworkers_versioning.dev.js +++ b/Delta Green 2/src/js/sheetworkers_versioning.dev.js @@ -192,7 +192,6 @@ var version_200_201 = function version_200_201() { }); getAttrs(repfields, function (values) { console.info('fullarray', values); - var update = {}; ids.forEach(function (id) { var repsecid = "repeating_".concat(section, "_").concat(id, "_"); /// bond update @@ -239,7 +238,7 @@ var version_200_201 = function version_200_201() { if (value_ammo > 0) { update["".concat(repsecid, "ammo_total")] = value_ammo; - update["".concat(repsecid, "hasammo")] = 1; + update["".concat(repsecid, "hasammo")] = 'active'; update["".concat(repsecid, "ammo")] = value_ammo; } else { update["".concat(repsecid, "hasammo")] = 0; @@ -288,46 +287,46 @@ var version_201_202 = function version_201_202() { console.log('verion:', codeversion); update['version'] = codeversion; getAttrs(["sheet_type"], function (values) { + var names = []; + var rank = []; + if (values.sheet_type === 'npc') { update['sheet_type'] = 'npc'; getSectionIDs("skills", function (ids) { - var names = []; - var rank = []; ids.forEach(function (id) { names.push("repeating_skills_".concat(id, "_name")); rank.push("repeating_skills_".concat(id, "_rank")); - }); // make it into an object with keys = names and values = rank + }); + }); + } - getAttrs(names.concat(rank), function (values) { - var update = {}; - var ids_to_remove = []; // for the ids that I copy in the named skills + ; // make it into an object with keys = names and values = ran - names.forEach(function (name, idx) { - var skillname = values[name].toLowerCase().replace(/ /g, "_"); - var rankvalue = values[rank[idx]]; - var id_value = name.split('_')[2]; + getAttrs(names.concat(rank), function (values) { + var ids_to_remove = []; // for the ids that I copy in the named skills - if (arrays['_skills'].includes(skillname)) { - update["".concat(skillname)] = rankvalue; - update["".concat(skillname, "_visible")] = 'visible'; - ids_to_remove.push(id_value); - } - }); - console.info('update npc skills', update); - setAttrs(update, { - silent: true - }, function () { - console.log('updated skills'); - ids_to_remove.forEach(function (id) { - removeRepeatingRow("repeating_skills_".concat(id)); - }); - console.log('removed repeating skills'); - versioning(codeversion); - }); + names.forEach(function (name, idx) { + var skillname = values[name].toLowerCase().replace(/ /g, "_"); + var rankvalue = values[rank[idx]]; + var id_value = name.split('_')[2]; + + if (arrays['_skills'].includes(skillname)) { + update["".concat(skillname)] = rankvalue; + update["".concat(skillname, "_visible")] = 'visible'; + ids_to_remove.push(id_value); + } + }); + console.info('update npc skills', update); + setAttrs(update, { + silent: true + }, function () { + console.log('updated skills'); + ids_to_remove.forEach(function (id) { + removeRepeatingRow("repeating_skills_".concat(id)); }); + console.log('removed repeating skills'); + versioning(codeversion); }); - } - - ; + }); }); }; \ No newline at end of file diff --git a/Delta Green 2/src/js/sheetworkers_versioning.js b/Delta Green 2/src/js/sheetworkers_versioning.js index 8acb3aef10a0..3cbbc78063c3 100644 --- a/Delta Green 2/src/js/sheetworkers_versioning.js +++ b/Delta Green 2/src/js/sheetworkers_versioning.js @@ -104,7 +104,7 @@ const version_150_170 = () => { // UPDATE TO VERSION 2.0 const version_170_200 = () => { let codeversion=2.0; - let update={}; + const update={}; update['version']=codeversion; getAttrs(["motivations","character_name","name","sanity_points","violence_3","helplessness_3","violence_2","helplessness_2", "sanity_points_old","sanity_points","breaking_point_old","breaking_point_old"],function(v){ @@ -150,7 +150,7 @@ const version_170_200 = () => { // UPDATE TO VERSION 2.0 const version_200_201 = () => { let codeversion=2.01; - let update={}; + const update={}; console.log('version:',codeversion); update['version']=codeversion; @@ -173,8 +173,7 @@ const version_200_201 = () => { }); getAttrs(repfields,(values) => { console.info('fullarray',values); - var update = {}; - + ids.forEach(id => { const repsecid= `repeating_${section}_${id}_`; @@ -217,7 +216,7 @@ const version_200_201 = () => { const value_ammo = Math.max(parseInt(values[`${repsecid}ammo`],10) || 0,0) ; if (value_ammo>0){ update[`${repsecid}ammo_total`]=value_ammo; - update[`${repsecid}hasammo`]=1; + update[`${repsecid}hasammo`]='active'; update[`${repsecid}ammo`]=value_ammo; } else { update[`${repsecid}hasammo`]=0; @@ -259,46 +258,47 @@ const version_200_201 = () => { const version_201_202 = () => { let codeversion=2.02; - let update={}; + const update={}; console.log('verion:',codeversion); update['version']=codeversion; getAttrs(["sheet_type"], values => { + var names=[]; + var rank=[]; + if (values.sheet_type==='npc'){ update['sheet_type']='npc'; getSectionIDs(`skills`, ids => { - var names=[]; - var rank=[]; ids.forEach(id => { names.push(`repeating_skills_${id}_name`); rank.push(`repeating_skills_${id}_rank`); }); - // make it into an object with keys = names and values = rank - - - getAttrs(names.concat(rank), values => { - const update={}; - var ids_to_remove=[]; // for the ids that I copy in the named skills - names.forEach((name,idx) => { - const skillname=values[name].toLowerCase().replace(/ /g, "_"); - const rankvalue=values[rank[idx]]; - const id_value=name.split('_')[2]; - if (arrays['_skills'].includes(skillname)){ - update[`${skillname}`]=rankvalue; - update[`${skillname}_visible`]='visible'; - ids_to_remove.push(id_value); - } - }); - console.info('update npc skills',update); - setAttrs(update, {silent:true}, () => { - console.log('updated skills'); - ids_to_remove.forEach(id => { - removeRepeatingRow(`repeating_skills_${id}`); - }); - console.log('removed repeating skills'); - versioning(codeversion); - }); + }); + }; + // make it into an object with keys = names and values = ran + + + getAttrs(names.concat(rank), values => { + var ids_to_remove=[]; // for the ids that I copy in the named skills + names.forEach((name,idx) => { + const skillname=values[name].toLowerCase().replace(/ /g, "_"); + const rankvalue=values[rank[idx]]; + const id_value=name.split('_')[2]; + if (arrays['_skills'].includes(skillname)){ + update[`${skillname}`]=rankvalue; + update[`${skillname}_visible`]='visible'; + ids_to_remove.push(id_value); + } + }); + console.info('update npc skills',update); + + setAttrs(update, {silent:true}, () => { + console.log('updated skills'); + ids_to_remove.forEach(id => { + removeRepeatingRow(`repeating_skills_${id}`); }); + console.log('removed repeating skills'); + versioning(codeversion); + }); }); - }; }); } \ No newline at end of file