diff --git a/Pendragon6thEdition/package.json b/Pendragon6thEdition/package.json index 5dcc43ae74c..a232c55540d 100644 --- a/Pendragon6thEdition/package.json +++ b/Pendragon6thEdition/package.json @@ -1,6 +1,6 @@ { "name": "pendragon6thedition", - "version": "3.2.0", + "version": "3.2.1", "description": "You need to run npm start to get the compilers going.", "dependencies": { "20": "^3.1.9", diff --git a/Pendragon6thEdition/pendragon.html b/Pendragon6thEdition/pendragon.html index 999c7539406..5f4280f26a1 100644 --- a/Pendragon6thEdition/pendragon.html +++ b/Pendragon6thEdition/pendragon.html @@ -1,4 +1,4 @@ -

^

^

^

/
/
/
/
/
/
/
/
/
/
/
/
/

^

^
p

^
p

^
p

^
p

^

^

/
/
/
/
/
/
/
/
/
/
/
/
/

^

^

p

^

^

^

^

p

p

^
p

^
p

^

^

^

^

ACCEPTING DROP FROM COMPENDIUM
{{#header}}{{header}}{{/header}}
{{#luck}}
{{luck}}
{{#calamity}}
{{calamity}}
{{/calamity}}
{{/luck}} +

^

^

^

/
/
/
/
/
/
/
/
/
/
/
/
/

^

^
p

^
p

^
p

^
p

^

^

/
/
/
/
/
/
/
/
/
/
/
/
/

^

^

p

^

^

^

^

p

p

^
p

^
p

^

^

^

^

ACCEPTING DROP FROM COMPENDIUM
{{#header}}{{header}}{{/header}}
{{#luck}}
{{luck}}
{{#calamity}}
{{calamity}}
{{/calamity}}
{{/luck}} {{#dice}}
{{dice}}
{{/dice}} {{#threshold}}
{{threshold}}
{{/threshold}} {{#dice}}
{{#rollGreater() threshold 19}} @@ -255,7 +255,7 @@ const versioningAttr = "latest_versioning_upgrade"; on("sheet:opened", () => { - //setAttrs({ latest_versioning_upgrade: 2.5 }); used for testing versioning + // setAttrs({ latest_versioning_upgrade: 3.2 }); //used for testing versioning getAttrs([versioningAttr], (v) => { versioning(parseFloat(v[versioningAttr]) || 1); }); @@ -279,7 +279,10 @@ let update = {}; map.forEach((e) => { const rowId = getReprowid(e); - update[`${rowId}_target_value`] = v[`${e}`] ? v[`${e}`] : 0; + + if (v[`${e}`]) { + update[`${rowId}_target_value`] = v[`${e}`]; + } }); setAttrs(update); }); @@ -328,6 +331,39 @@ renameSectionAttr("repeating_arms", "equipment"); }; +const versionThreeTwoOne = () => { + const section = "repeating_passions"; + getSectionIDs(section, (ids) => { + const map = ids.map((id) => + ["name", "target_value"].map((e) => `${section}_${id}_${e}`) + ); + + map.forEach((e) => { + getAttrs(e, (v) => { + const name = v[`${e[0]}`]; + const targetValue = v[`${e[1]}`]; + if (targetValue === 0) { + getSectionIDs("repeating_passion", (oldIds) => { + const oldMap = oldIds.map((id) => + ["name", "passion"].map((e) => `repeating_passion_${id}_${e}`) + ); + + oldMap.forEach((oldE) => { + getAttrs(oldE, (oldV) => { + if (oldV[`${oldE[0]}`] === name) { + setAttrs({ + [`${e[1]}`]: oldV[`${oldE[1]}`], + }); + } + }); + }); + }); + } + }); + }); + }); +}; + const versionThreeZero = () => { const renameRepeatingSectionName = (section, newName, targetValue) => { const attrs = ["name", "target_value", "check"]; @@ -438,10 +474,10 @@ versionThreeTwo(); versioning(3.2); break; - case version < 3.2: - updateMessage(3.2); - versionThreeTwo(); - versioning(3.2); + case version < 3.21: + updateMessage(3.21); + versionThreeTwoOne(); + versioning(3.21); break; default: console.log( diff --git a/Pendragon6thEdition/src/js/versioning.js b/Pendragon6thEdition/src/js/versioning.js index fab62d9bd7a..9c9dae334c1 100644 --- a/Pendragon6thEdition/src/js/versioning.js +++ b/Pendragon6thEdition/src/js/versioning.js @@ -1,7 +1,7 @@ const versioningAttr = "latest_versioning_upgrade"; on("sheet:opened", () => { - //setAttrs({ latest_versioning_upgrade: 2.5 }); used for testing versioning + // setAttrs({ latest_versioning_upgrade: 3.2 }); //used for testing versioning getAttrs([versioningAttr], (v) => { versioning(parseFloat(v[versioningAttr]) || 1); }); @@ -25,7 +25,10 @@ const renameSectionAttrTargetValue = (section, attribute) => { let update = {}; map.forEach((e) => { const rowId = getReprowid(e); - update[`${rowId}_target_value`] = v[`${e}`] ? v[`${e}`] : 0; + + if (v[`${e}`]) { + update[`${rowId}_target_value`] = v[`${e}`]; + } }); setAttrs(update); }); @@ -74,6 +77,39 @@ const versionTwoFiveThree = () => { renameSectionAttr("repeating_arms", "equipment"); }; +const versionThreeTwoOne = () => { + const section = "repeating_passions"; + getSectionIDs(section, (ids) => { + const map = ids.map((id) => + ["name", "target_value"].map((e) => `${section}_${id}_${e}`) + ); + + map.forEach((e) => { + getAttrs(e, (v) => { + const name = v[`${e[0]}`]; + const targetValue = v[`${e[1]}`]; + if (targetValue === 0) { + getSectionIDs("repeating_passion", (oldIds) => { + const oldMap = oldIds.map((id) => + ["name", "passion"].map((e) => `repeating_passion_${id}_${e}`) + ); + + oldMap.forEach((oldE) => { + getAttrs(oldE, (oldV) => { + if (oldV[`${oldE[0]}`] === name) { + setAttrs({ + [`${e[1]}`]: oldV[`${oldE[1]}`], + }); + } + }); + }); + }); + } + }); + }); + }); +}; + const versionThreeZero = () => { const renameRepeatingSectionName = (section, newName, targetValue) => { const attrs = ["name", "target_value", "check"]; @@ -184,6 +220,11 @@ const versioning = async (version) => { versionThreeTwo(); versioning(3.2); break; + case version < 3.21: + updateMessage(3.21); + versionThreeTwoOne(); + versioning(3.21); + break; default: console.log( `%c Pendragon 6th Edition is update to date.`, diff --git a/Pendragon6thEdition/src/pendragon.pug b/Pendragon6thEdition/src/pendragon.pug index 050a0f2b646..1d6bf14b714 100644 --- a/Pendragon6thEdition/src/pendragon.pug +++ b/Pendragon6thEdition/src/pendragon.pug @@ -1,5 +1,5 @@ //- Semantic Versioning MAJOR.MINORPATCH -input(name='attr_version' type='hidden' value='3.2') +input(name='attr_version' type='hidden' value='3.21') //- Do not manually change this. Hidden attribute used by versioning script input(name='attr_latest_versioning_upgrade' type='hidden' value='3')