[Ironsworn] Migrating Legacy Vows (#8657)
* added migration for legacy vows * added new changelog explainer * added html for explainer * removed console.log
This commit is contained in:
+1232
-1162
File diff suppressed because it is too large
Load Diff
@@ -13,8 +13,9 @@ mixin summaryPage
|
||||
fieldset.repeating_vow
|
||||
+repeatingVow()
|
||||
else
|
||||
each vow in legacyVows
|
||||
+vowLegacy(vow)
|
||||
div.hide-element
|
||||
each vow in legacyVows
|
||||
+vowLegacy(vow)
|
||||
fieldset.repeating_vow
|
||||
+repeatingVow()
|
||||
h3.divide(data-i18n='page-summary-debilities')=locals['page-summary-debilities']
|
||||
|
||||
@@ -13,7 +13,8 @@ mixin vowsPage(sheetType)
|
||||
fieldset.repeating_vow
|
||||
+repeatingVow()
|
||||
else
|
||||
each vow in legacyVows
|
||||
+vowLegacy(vow)
|
||||
div.hide-element
|
||||
each vow in legacyVows
|
||||
+vowLegacy(vow)
|
||||
fieldset.repeating_vow
|
||||
+repeatingVow()
|
||||
@@ -1,8 +1,8 @@
|
||||
input.changelog.hide-element(type='checkbox' name='attr_changelog_2.0.0')
|
||||
input.changelog.hide-element(type='checkbox' name='attr_changelog_2.2.0')
|
||||
.changelog
|
||||
.copy
|
||||
h3 <strong>Version 2 Release</strong>
|
||||
div As part of the version 2 release, a new landing page was added for selecting either the character sheet, or the new shared sheet. If this was previously a character sheet, you can just select the "CHARACTER" option.
|
||||
h3 <strong>Version 2.2 Release</strong>
|
||||
div The old static vows have now been migrated to the repeating vows (all the data should be there). If there are any issues, all of the old vow information is still available from the Abilities / Attributes section.
|
||||
div.center <strong>(All your data will be retained)</strong>
|
||||
label.close-changelog
|
||||
input(type='checkbox' name=`attr_close_changelog` class='hide-element')
|
||||
|
||||
@@ -25,22 +25,17 @@ function updateVow (mark, vowArray, number) {
|
||||
function chosenDifficulty (rank) {
|
||||
switch (rank) {
|
||||
case 1:
|
||||
return 12
|
||||
break;
|
||||
return 12;
|
||||
case 2:
|
||||
return 8
|
||||
break;
|
||||
return 8;
|
||||
case 3:
|
||||
return 4
|
||||
break;
|
||||
return 4;
|
||||
case 4:
|
||||
return 2
|
||||
break;
|
||||
return 2;
|
||||
case 5:
|
||||
return 1
|
||||
break;
|
||||
return 1;
|
||||
default:
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,6 @@ on('change:stat_mode_button', function(eventinfo) {
|
||||
|
||||
on('change:close_changelog', function() {
|
||||
setAttrs({
|
||||
'changelog_2.0.0': 'on',
|
||||
'changelog_2.2.0': 'on',
|
||||
});
|
||||
});
|
||||
|
||||
@@ -39,22 +39,17 @@ function updateProgress (mark, progressArray) {
|
||||
function chosenDifficulty (rank) {
|
||||
switch (rank) {
|
||||
case 1:
|
||||
return 12
|
||||
break;
|
||||
return 12;
|
||||
case 2:
|
||||
return 8
|
||||
break;
|
||||
return 8;
|
||||
case 3:
|
||||
return 4
|
||||
break;
|
||||
return 4;
|
||||
case 4:
|
||||
return 2
|
||||
break;
|
||||
return 2;
|
||||
case 5:
|
||||
return 1
|
||||
break;
|
||||
return 1;
|
||||
default:
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,88 @@
|
||||
on('remove:repeating_vow remove:repeating_bonds remove:repeating_progress remove:repeating_sites remove:repeating_assets', function() {
|
||||
const timestamp = Number(new Date())
|
||||
on("remove:repeating_vow remove:repeating_bonds remove:repeating_progress remove:repeating_sites remove:repeating_assets", function() {
|
||||
const timestamp = Number(new Date());
|
||||
setAttrs({ repeat_delete: timestamp });
|
||||
});
|
||||
|
||||
on('change:repeating_vow:menace-show-button', function(eventinfo) {
|
||||
on("change:repeating_vow:menace-show-button", function(eventinfo) {
|
||||
setAttrs({
|
||||
'repeating_vow_menace-show': eventinfo.newValue
|
||||
"repeating_vow_menace-show": eventinfo.newValue
|
||||
});
|
||||
});
|
||||
|
||||
function fillRepeatingVow (vowNumber) {
|
||||
const repeatingAttrs = [
|
||||
"vow_name",
|
||||
"threat-name",
|
||||
`menace-show-button`,
|
||||
"menace-show",
|
||||
"menace-1",
|
||||
"menace-2",
|
||||
"menace-3",
|
||||
"menace-4",
|
||||
"menace-5",
|
||||
"menace-6",
|
||||
"menace-7",
|
||||
"menace-8",
|
||||
"menace-9",
|
||||
"menace-10",
|
||||
"rank",
|
||||
"progress_0",
|
||||
"progress_1",
|
||||
"progress_2",
|
||||
"progress_3",
|
||||
"progress_4",
|
||||
"progress_5",
|
||||
"progress_6",
|
||||
"progress_7",
|
||||
"progress_8",
|
||||
"progress_9"
|
||||
];
|
||||
const legacyAttrs = [
|
||||
`vow${vowNumber}_name`,
|
||||
`vow${vowNumber}_threat-name`,
|
||||
`vow${vowNumber}_menace-show-button`,
|
||||
`vow${vowNumber}_menace-show`,
|
||||
`vow${vowNumber}-1-threat`,
|
||||
`vow${vowNumber}-2-threat`,
|
||||
`vow${vowNumber}-3-threat`,
|
||||
`vow${vowNumber}-4-threat`,
|
||||
`vow${vowNumber}-5-threat`,
|
||||
`vow${vowNumber}-6-threat`,
|
||||
`vow${vowNumber}-7-threat`,
|
||||
`vow${vowNumber}-8-threat`,
|
||||
`vow${vowNumber}-9-threat`,
|
||||
`vow${vowNumber}-10-threat`,
|
||||
`vow${vowNumber}_rank`,
|
||||
`vow${vowNumber}-0`,
|
||||
`vow${vowNumber}-1`,
|
||||
`vow${vowNumber}-2`,
|
||||
`vow${vowNumber}-3`,
|
||||
`vow${vowNumber}-4`,
|
||||
`vow${vowNumber}-5`,
|
||||
`vow${vowNumber}-6`,
|
||||
`vow${vowNumber}-7`,
|
||||
`vow${vowNumber}-8`,
|
||||
`vow${vowNumber}-9`
|
||||
];
|
||||
getAttrs(legacyAttrs, function(vow) {
|
||||
const newrowid = generateRowID();
|
||||
var newAttrs = {};
|
||||
repeatingAttrs.forEach(function (attr, index) {
|
||||
newAttrs[`repeating_vow_${newrowid}_${attr}`] = vow[legacyAttrs[index]];
|
||||
})
|
||||
setAttrs(newAttrs);
|
||||
});
|
||||
}
|
||||
|
||||
on("sheet:opened", function() {
|
||||
getAttrs(["vows_migrated"], function(migrationCheck) {
|
||||
if (migrationCheck.vows_migrated == true) {
|
||||
return true
|
||||
} else {
|
||||
for (currentVow = 1; currentVow <= 5; currentVow++) {
|
||||
fillRepeatingVow(currentVow);
|
||||
}
|
||||
setAttrs({vows_migrated: true});
|
||||
};
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ironsworn",
|
||||
"version": "2.1.0",
|
||||
"version": "2.2.0",
|
||||
"description": "Roll20 character sheet for the RPG ironsworn",
|
||||
"main": "Ironsworn.html",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user