Blades in the Dark v1.8
This commit is contained in:
@@ -4,6 +4,11 @@ This is a character sheet for Blades in the Dark for use on Roll20.
|
||||
|
||||
## Changelog
|
||||
|
||||
### 1.8
|
||||
* Extra rows of claims can now be added
|
||||
* Corrected minor typos
|
||||
* Internal changes to the sheet upgrade process to make it more robust for ancient sheets
|
||||
|
||||
### 1.7
|
||||
* Change to auto-generated abilities/items/friends: they will now be deleted if you change playbook/crew type, unless they have been changed at some point
|
||||
* Small CSS adjustments
|
||||
|
||||
@@ -504,7 +504,7 @@
|
||||
<li><input type="text" name="attr_gatherinfo1" placeholder="What do they intend to do?" data-i18n-placeholder="gatherinfo_what_do_they_intend"/></li>
|
||||
<li><input type="text" name="attr_gatherinfo2" placeholder="How can I get them to [X]?" data-i18n-placeholder="gatherinfo_how_can_I_get_them"/></li>
|
||||
<li><input type="text" name="attr_gatherinfo3" placeholder="What are they really feeling?" data-i18n-placeholder="gatherinfo_what_are_they_really"/></li>
|
||||
<li><input type="text" name="attr_gatherinfo4" placeholder="What should I lookout for?" data-i18n-placeholder="gatherinfo_gatherinfo_what_should_I_look"/></li>
|
||||
<li><input type="text" name="attr_gatherinfo4" placeholder="What should I lookout for?" data-i18n-placeholder="gatherinfo_what_should_I_look"/></li>
|
||||
<li><input type="text" name="attr_gatherinfo5" placeholder="Where's the weakness here?" data-i18n-placeholder="gatherinfo_wheres_the_weakness"/></li>
|
||||
<li><input type="text" name="attr_gatherinfo6" placeholder="How can I find [X]?" data-i18n-placeholder="gatherinfo_how_can_I_find"/></li>
|
||||
<li data-i18n="gatherinfo_whats_going_on">What's really going on here?</li>
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Claims -->
|
||||
<div class="sheet-col100 sheet-def-margin sheet-claims">
|
||||
<div class="sheet-col100 sheet-def-margin sheet-claims sheet-white-repcontrol">
|
||||
<div class="sheet-col100 sheet-claimsrow">
|
||||
<input type="checkbox" name="attr_claim_1_check" class="sheet-hidden"/>
|
||||
<div class="sheet-col18 sheet-claimbox">
|
||||
@@ -386,6 +386,97 @@
|
||||
<textarea spellcheck="false" name="attr_claim_15_desc" class="sheet-claim-desc"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<fieldset class="repeating_claim">
|
||||
<div class="sheet-col100 sheet-claims-seprow">
|
||||
<div class="sheet-claims-vertsep">
|
||||
<input type="checkbox" name="attr_claim_bridge_top_1" class="sheet-checkbox sheet-claimbridge"/>
|
||||
<span></span>
|
||||
</div>
|
||||
<div class="sheet-claims-horisep"></div>
|
||||
<div class="sheet-claims-vertsep">
|
||||
<input type="checkbox" name="attr_claim_bridge_top_2" class="sheet-checkbox sheet-claimbridge"/>
|
||||
<span></span>
|
||||
</div>
|
||||
<div class="sheet-claims-horisep"></div>
|
||||
<div class="sheet-claims-vertsep">
|
||||
<input type="checkbox" name="attr_claim_bridge_top_3" class="sheet-checkbox sheet-claimbridge"/>
|
||||
<span></span>
|
||||
</div>
|
||||
<div class="sheet-claims-horisep"></div>
|
||||
<div class="sheet-claims-vertsep">
|
||||
<input type="checkbox" name="attr_claim_bridge_top_4" class="sheet-checkbox sheet-claimbridge"/>
|
||||
<span></span>
|
||||
</div>
|
||||
<div class="sheet-claims-horisep"></div>
|
||||
<div class="sheet-claims-vertsep">
|
||||
<input type="checkbox" name="attr_claim_bridge_top_5" class="sheet-checkbox sheet-claimbridge"/>
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sheet-col100 sheet-claimsrow">
|
||||
<input type="checkbox" name="attr_claim_1_check" class="sheet-hidden"/>
|
||||
<div class="sheet-col18 sheet-claimbox">
|
||||
<div>
|
||||
<input type="checkbox" name="attr_claim_1_check" class="sheet-checkbox sheet-squarebox-small"/>
|
||||
<span></span>
|
||||
</div>
|
||||
<textarea spellcheck="false" name="attr_claim_1_name" class="sheet-label" ></textarea>
|
||||
<textarea spellcheck="false" name="attr_claim_1_desc" class="sheet-claim-desc"></textarea>
|
||||
</div>
|
||||
<div class="sheet-claims-horisep">
|
||||
<input type="checkbox" name="attr_claim_bridge_1_2" class="sheet-checkbox sheet-claimbridge"/>
|
||||
<span></span>
|
||||
</div>
|
||||
<input type="checkbox" name="attr_claim_2_check" class="sheet-hidden"/>
|
||||
<div class="sheet-col18 sheet-claimbox">
|
||||
<div>
|
||||
<input type="checkbox" name="attr_claim_2_check" class="sheet-checkbox sheet-squarebox-small"/>
|
||||
<span></span>
|
||||
</div>
|
||||
<textarea spellcheck="false" name="attr_claim_2_name" class="sheet-label" ></textarea>
|
||||
<textarea spellcheck="false" name="attr_claim_2_desc" class="sheet-claim-desc"></textarea>
|
||||
</div>
|
||||
<div class="sheet-claims-horisep">
|
||||
<input type="checkbox" name="attr_claim_bridge_2_3" class="sheet-checkbox sheet-claimbridge"/>
|
||||
<span></span>
|
||||
</div>
|
||||
<input type="checkbox" name="attr_claim_3_check" class="sheet-hidden"/>
|
||||
<div class="sheet-col18 sheet-claimbox">
|
||||
<div>
|
||||
<input type="checkbox" name="attr_claim_3_check" class="sheet-checkbox sheet-squarebox-small"/>
|
||||
<span></span>
|
||||
</div>
|
||||
<textarea spellcheck="false" name="attr_claim_3_name" class="sheet-label" ></textarea>
|
||||
<textarea spellcheck="false" name="attr_claim_3_desc" class="sheet-claim-desc"></textarea>
|
||||
</div>
|
||||
<div class="sheet-claims-horisep">
|
||||
<input type="checkbox" name="attr_claim_bridge_3_4" class="sheet-checkbox sheet-claimbridge"/>
|
||||
<span></span>
|
||||
</div>
|
||||
<input type="checkbox" name="attr_claim_4_check" class="sheet-hidden"/>
|
||||
<div class="sheet-col18 sheet-claimbox">
|
||||
<div>
|
||||
<input type="checkbox" name="attr_claim_4_check" class="sheet-checkbox sheet-squarebox-small"/>
|
||||
<span></span>
|
||||
</div>
|
||||
<textarea spellcheck="false" name="attr_claim_4_name" class="sheet-label" ></textarea>
|
||||
<textarea spellcheck="false" name="attr_claim_4_desc" class="sheet-claim-desc"></textarea>
|
||||
</div>
|
||||
<div class="sheet-claims-horisep">
|
||||
<input type="checkbox" name="attr_claim_bridge_4_5" class="sheet-checkbox sheet-claimbridge"/>
|
||||
<span></span>
|
||||
</div>
|
||||
<input type="checkbox" name="attr_claim_5_check" class="sheet-hidden"/>
|
||||
<div class="sheet-col18 sheet-claimbox">
|
||||
<div>
|
||||
<input type="checkbox" name="attr_claim_5_check" class="sheet-checkbox sheet-squarebox-small"/>
|
||||
<span></span>
|
||||
</div>
|
||||
<textarea spellcheck="false" name="attr_claim_5_name" class="sheet-label" ></textarea>
|
||||
<textarea spellcheck="false" name="attr_claim_5_desc" class="sheet-claim-desc"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<!-- Heat and Coin -->
|
||||
<div class="sheet-col100 sheet-def-margin">
|
||||
|
||||
@@ -1325,7 +1325,7 @@ input.sheet-radiobox.sheet-last + span {
|
||||
}
|
||||
.sheet-white-repcontrol button.repcontrol_edit, .sheet-white-repcontrol button.repcontrol_add {
|
||||
background-color: white;
|
||||
margin-top: 12px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.sheet-small-repcontrol button.repcontrol_edit, .sheet-small-repcontrol button.repcontrol_add,
|
||||
.sheet-white-repcontrol button.repcontrol_edit, .sheet-white-repcontrol button.repcontrol_add {
|
||||
@@ -1945,6 +1945,18 @@ div.sheet-cohort-condition4 {
|
||||
input:checked + .sheet-claimbox {
|
||||
background-color:#c1c4c5;
|
||||
}
|
||||
.sheet-claims div.repcontrol {
|
||||
float: left;
|
||||
width: 100%;
|
||||
}
|
||||
.sheet-claims div.repcontainer {
|
||||
float: left;
|
||||
line-height: 0;
|
||||
}
|
||||
.sheet-claims div.repitem {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
}
|
||||
/* STRICTURES */
|
||||
.sheet-strictures div {
|
||||
font-size: 88%;
|
||||
|
||||
@@ -1320,8 +1320,9 @@ var setDiceFromTotal = (name, numDice, upToFive, value) => {
|
||||
}
|
||||
setAttrs(setting);
|
||||
},
|
||||
fillRepeatingSectionFromData = (sectionName, dataList, autoGenerated) => {
|
||||
fillRepeatingSectionFromData = (sectionName, dataList, autoGenerated, callback) => {
|
||||
'use strict';
|
||||
callback = callback || (() => {});
|
||||
getSectionIDs(`repeating_${sectionName}`, idList => {
|
||||
let rowNameAttributes = idList.map(id => `repeating_${sectionName}_${id}_name`);
|
||||
getAttrs(rowNameAttributes, v => {
|
||||
@@ -1347,7 +1348,7 @@ var setDiceFromTotal = (name, numDice, upToFive, value) => {
|
||||
}, newAttrs);
|
||||
})
|
||||
.reduce((m, o) => Object.assign(m, o), {});
|
||||
setAttrs(setting);
|
||||
setAttrs(setting, {}, callback);
|
||||
});
|
||||
});
|
||||
},
|
||||
@@ -1362,7 +1363,8 @@ var setDiceFromTotal = (name, numDice, upToFive, value) => {
|
||||
});
|
||||
});
|
||||
},
|
||||
deleteAutogenRows = sectionName => {
|
||||
deleteAutogenRows = (sectionName, callback) => {
|
||||
callback = callback || (() => {});
|
||||
getSectionIDs(`repeating_${sectionName}`, idList => {
|
||||
getAttrs(idList.map(id => `repeating_${sectionName}_${id}_autogen`), v => {
|
||||
idList.forEach(id => {
|
||||
@@ -1370,6 +1372,7 @@ var setDiceFromTotal = (name, numDice, upToFive, value) => {
|
||||
removeRepeatingRow(`repeating_${sectionName}_${id}`);
|
||||
}
|
||||
});
|
||||
callback();
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -1402,12 +1405,9 @@ on('change:crew_type change:playbook', event => {
|
||||
if (crewData.hasOwnProperty(sourceName)) {
|
||||
data = crewData[sourceName].base;
|
||||
baseData = crewAttributes;
|
||||
deleteAutogenRows('contact');
|
||||
deleteAutogenRows('crewability');
|
||||
deleteAutogenRows('upgrade');
|
||||
fillRepeatingSectionFromData('contact', crewData[sourceName].contacts, true);
|
||||
fillRepeatingSectionFromData('crewability', crewData[sourceName].abilities, true);
|
||||
fillRepeatingSectionFromData('upgrade', crewData[sourceName].upgrades, true);
|
||||
deleteAutogenRows('contact', () => fillRepeatingSectionFromData('contact', crewData[sourceName].contacts, true));
|
||||
deleteAutogenRows('crewability', () => fillRepeatingSectionFromData('crewability', crewData[sourceName].abilities, true));
|
||||
deleteAutogenRows('upgrade', () => fillRepeatingSectionFromData('upgrade', crewData[sourceName].upgrades, true));
|
||||
}
|
||||
break;
|
||||
case 'playbook':
|
||||
@@ -1415,12 +1415,9 @@ on('change:crew_type change:playbook', event => {
|
||||
if (playbookData.hasOwnProperty(sourceName)) {
|
||||
data = playbookData[sourceName].base;
|
||||
baseData = playbookAttributes;
|
||||
deleteAutogenRows('friend');
|
||||
deleteAutogenRows('ability');
|
||||
deleteAutogenRows('playbookitem');
|
||||
fillRepeatingSectionFromData('playbookitem', playbookData[sourceName].items, true);
|
||||
fillRepeatingSectionFromData('friend', playbookData[sourceName].friends, true);
|
||||
fillRepeatingSectionFromData('ability', playbookData[sourceName].abilities, true);
|
||||
deleteAutogenRows('friend', () => fillRepeatingSectionFromData('friend', playbookData[sourceName].friends, true));
|
||||
deleteAutogenRows('ability', () => fillRepeatingSectionFromData('ability', playbookData[sourceName].abilities, true));
|
||||
deleteAutogenRows('playbookitem', () => fillRepeatingSectionFromData('playbookitem', playbookData[sourceName].items, true));
|
||||
}
|
||||
};
|
||||
/* Change unset attributes to default */
|
||||
@@ -1702,361 +1699,368 @@ on('sheet:opened', () => {
|
||||
});
|
||||
/* Setup and upgrades */
|
||||
getAttrs(['version'], v => {
|
||||
// Setup initial rows in repeating sections and generate standard items
|
||||
if (!v.version) {
|
||||
let setting = initialRows.reduce((memo, sectionName) => {
|
||||
memo[`repeating_${sectionName}_${generateRowID()}_autogen`] = 1;
|
||||
return memo;
|
||||
}, {});
|
||||
setAttrs(setting);
|
||||
fillRepeatingSectionFromData('item', itemData);
|
||||
setAttrs(defaultValues);
|
||||
}
|
||||
// Upgrade to 0.7: Convert legacy faction repeating section to text
|
||||
if (v.version && v.version.split('.')[0] === '0' && parseInt(v.version.split('.')[1]) < 7) {
|
||||
getSectionIDs('repeating_faction', list => {
|
||||
let sectionList = ['faction1', 'faction2'].concat(list.map(str => `repeating_faction_${str}`)),
|
||||
attrList = [].concat(...sectionList.map(str => [`${str}_name`, `${str}_status`, `${str}_description`]));
|
||||
getAttrs(attrList, v => {
|
||||
let output = sectionList.map(str => {
|
||||
return 'Name: ' + v[`${str}_name`] + '\n' +
|
||||
'Status: ' + (v[`${str}_status`] || '') + '\n' +
|
||||
'Notes: ' + (v[`${str}_description`] || '') + '\n';
|
||||
}).join('\n');
|
||||
setAttrs({
|
||||
faction_notes: output
|
||||
let upgradeSheet = version => {
|
||||
const versionMajor = version && parseInt(version.split('.')[0]),
|
||||
versionMinor = version && parseInt(version.split('.')[1]);
|
||||
// Setup initial rows in repeating sections and generate standard items
|
||||
if (!version) {
|
||||
let setting = initialRows.reduce((memo, sectionName) => {
|
||||
memo[`repeating_${sectionName}_${generateRowID()}_autogen`] = 1;
|
||||
return memo;
|
||||
}, {});
|
||||
setAttrs(setting);
|
||||
fillRepeatingSectionFromData('item', itemData);
|
||||
setAttrs(defaultValues);
|
||||
console.log('Initialising new sheet');
|
||||
}
|
||||
// Upgrade to 0.7: Convert legacy faction repeating section to text
|
||||
else if (versionMajor === 0 && versionMinor < 7) {
|
||||
getSectionIDs('repeating_faction', list => {
|
||||
let sectionList = ['faction1', 'faction2'].concat(list.map(str => `repeating_faction_${str}`)),
|
||||
attrList = [].concat(...sectionList.map(str => [`${str}_name`, `${str}_status`, `${str}_description`]));
|
||||
getAttrs(attrList, v => {
|
||||
let output = sectionList.map(str => {
|
||||
return 'Name: ' + v[`${str}_name`] + '\n' +
|
||||
'Status: ' + (v[`${str}_status`] || '') + '\n' +
|
||||
'Notes: ' + (v[`${str}_description`] || '') + '\n';
|
||||
}).join('\n');
|
||||
setAttrs({
|
||||
faction_notes: output
|
||||
});
|
||||
list.forEach(id => removeRepeatingRow(`repeating_faction_${id}`));
|
||||
upgradeSheet('0.7');
|
||||
console.log('Updating to 0.7');
|
||||
});
|
||||
setAttrs({
|
||||
faction1_name: '',
|
||||
faction1_status: '',
|
||||
faction1_description: '',
|
||||
faction1_expand: '',
|
||||
faction2_name: '',
|
||||
faction2_status: '',
|
||||
faction2_description: '',
|
||||
faction2_expand: ''
|
||||
});
|
||||
list.forEach(id => removeRepeatingRow(`repeating_faction_${id}`));
|
||||
});
|
||||
});
|
||||
}
|
||||
// Upgrade to 0.9: Convert ability/friend/crewability/contact first row
|
||||
if (v.version && v.version.split('.')[0] === '0' && parseInt(v.version.split('.')[1]) < 9) {
|
||||
let attrs = ['ability1_check', 'ability1_name', 'ability1_description',
|
||||
'friend1_status', 'friend1_name',
|
||||
'crew_ability1_check', 'crew_ability1_name', 'crew_ability1_description',
|
||||
'contact1_check', 'contact1_name'
|
||||
];
|
||||
getAttrs(attrs, v => {
|
||||
fillRepeatingSectionFromData('ability', [{
|
||||
check: v.ability1_check,
|
||||
description: v.ability1_description,
|
||||
name: v.ability1_name
|
||||
}]);
|
||||
fillRepeatingSectionFromData('friend', [{
|
||||
name: v.friend1_name,
|
||||
status: v.friend1_status
|
||||
}]);
|
||||
fillRepeatingSectionFromData('crewability', [{
|
||||
check: v.crew_ability1_check,
|
||||
description: v.crew_ability1_description,
|
||||
name: v.crew_ability1_name
|
||||
}]);
|
||||
fillRepeatingSectionFromData('contact', [{
|
||||
check: v.contact1_check,
|
||||
name: v.contact1_name
|
||||
}]);
|
||||
});
|
||||
}
|
||||
// Upgrade to 1.0: Make sure that resistance values are calculated correctly.
|
||||
if (v.version && parseInt(v.version.split('.')[0]) < 1) {
|
||||
Object.keys(actionData).forEach(calculateResistance);
|
||||
calculateVice();
|
||||
}
|
||||
// Upgrade to 1.4: Convert playbook items and repeating items
|
||||
if (v.version && (parseInt(v.version.split('.')[0]) < 1 || (parseInt(v.version.split('.')[0]) === 1 && parseInt(v.version.split('.')[1]) < 4))) {
|
||||
let indices = [...Array(10).keys()], // [0:9]
|
||||
allAttrs = [
|
||||
...indices.map(n => `item_${n}_check`),
|
||||
...indices.map(n => `item_${n}_desc`),
|
||||
'item_0_check_b',
|
||||
'item_0_check_c',
|
||||
'item_1_check_b'
|
||||
];
|
||||
getAttrs(allAttrs, v => {
|
||||
let items = [];
|
||||
if (v['item_0_desc']) {
|
||||
items.push({
|
||||
check_1: v['item_0_check'] || '0',
|
||||
name: v['item_0_desc'],
|
||||
numboxes: '1'
|
||||
});
|
||||
items.push({
|
||||
check_1: v['item_0_check_b'] || '0',
|
||||
name: v['item_0_desc'],
|
||||
numboxes: '1'
|
||||
});
|
||||
items.push({
|
||||
check_1: v['item_0_check_c'] || '0',
|
||||
name: v['item_0_desc'],
|
||||
numboxes: '1'
|
||||
});
|
||||
}
|
||||
if (v['item_1_desc']) {
|
||||
items.push({
|
||||
bold: 'on',
|
||||
check_1: v['item_1_check'] || '0',
|
||||
check_2: v['item_1_check_b'] || '0',
|
||||
name: v['item_1_desc'],
|
||||
numboxes: '2'
|
||||
});
|
||||
}
|
||||
['2', '3', '5', '6'].forEach(index => {
|
||||
if (v[`item_${index}_desc`]) {
|
||||
}
|
||||
// Upgrade to 0.9: Convert ability/friend/crewability/contact first row
|
||||
else if (versionMajor === 0 && versionMinor < 9) {
|
||||
let upgradeFunction = _.after(4, () => upgradeSheet('0.9')),
|
||||
attrs = ['ability1_check', 'ability1_name', 'ability1_description',
|
||||
'friend1_status', 'friend1_name',
|
||||
'crew_ability1_check', 'crew_ability1_name', 'crew_ability1_description',
|
||||
'contact1_check', 'contact1_name'
|
||||
];
|
||||
getAttrs(attrs, v => {
|
||||
fillRepeatingSectionFromData('ability', [{
|
||||
check: v.ability1_check || '0',
|
||||
description: v.ability1_description || '',
|
||||
name: v.ability1_name || ''
|
||||
}], false, upgradeFunction);
|
||||
fillRepeatingSectionFromData('friend', [{
|
||||
name: v.friend1_name || '',
|
||||
status: v.friend1_status || ''
|
||||
}], false, upgradeFunction);
|
||||
fillRepeatingSectionFromData('crewability', [{
|
||||
check: v.crew_ability1_check || '0',
|
||||
description: v.crew_ability1_description || '',
|
||||
name: v.crew_ability1_name || ''
|
||||
}], false, upgradeFunction);
|
||||
fillRepeatingSectionFromData('contact', [{
|
||||
check: v.contact1_check || '0',
|
||||
name: v.contact1_name || ''
|
||||
}], false, upgradeFunction);
|
||||
console.log('Updating to 0.9');
|
||||
});
|
||||
}
|
||||
// Upgrade to 1.0: Make sure that resistance values are calculated correctly.
|
||||
else if (versionMajor === 0) {
|
||||
Object.keys(actionData).forEach(calculateResistance);
|
||||
calculateVice();
|
||||
upgradeSheet('1.0');
|
||||
console.log('Updating to 1.0');
|
||||
}
|
||||
// Upgrade to 1.4: Convert playbook items and repeating items
|
||||
else if (versionMajor === 1 && versionMinor < 4) {
|
||||
let upgradeFunction = _.after(2, () => upgradeSheet('1.4')),
|
||||
indices = [...Array(10).keys()], // [0:9]
|
||||
allAttrs = [
|
||||
...indices.map(n => `item_${n}_check`),
|
||||
...indices.map(n => `item_${n}_desc`),
|
||||
'item_0_check_b',
|
||||
'item_0_check_c',
|
||||
'item_1_check_b'
|
||||
];
|
||||
getAttrs(allAttrs, v => {
|
||||
let items = [];
|
||||
if (v['item_0_desc']) {
|
||||
items.push({
|
||||
bold: (['2', '3'].includes(index) ? 'on' : '0'),
|
||||
check_1: v[`item_${index}_check`] || '0',
|
||||
name: v[`item_${index}_desc`],
|
||||
check_1: v['item_0_check'] || '0',
|
||||
name: v['item_0_desc'],
|
||||
numboxes: '1'
|
||||
});
|
||||
items.push({
|
||||
check_1: v['item_0_check_b'] || '0',
|
||||
name: v['item_0_desc'],
|
||||
numboxes: '1'
|
||||
});
|
||||
items.push({
|
||||
check_1: v['item_0_check_c'] || '0',
|
||||
name: v['item_0_desc'],
|
||||
numboxes: '1'
|
||||
});
|
||||
}
|
||||
});
|
||||
['4', '7', '8', '9'].forEach(index => {
|
||||
if (v[`item_${index}_desc`]) {
|
||||
if (v['item_1_desc']) {
|
||||
items.push({
|
||||
bold: ((index === '4') ? 'on' : '0'),
|
||||
check_1: v[`item_${index}_check`] || '0',
|
||||
name: v[`item_${index}_desc`],
|
||||
numboxes: '0'
|
||||
bold: 'on',
|
||||
check_1: v['item_1_check'] || '0',
|
||||
check_2: v['item_1_check_b'] || '0',
|
||||
name: v['item_1_desc'],
|
||||
numboxes: '2'
|
||||
});
|
||||
}
|
||||
});
|
||||
items.forEach(obj => {
|
||||
obj['boxes_chosen'] = 'on';
|
||||
});
|
||||
fillRepeatingSectionFromData('playbookitem', items);
|
||||
});
|
||||
getSectionIDs('repeating_item', idArray => {
|
||||
let allAttrs = [
|
||||
...idArray.map(id => `repeating_item_${id}_desc`),
|
||||
...idArray.map(id => `repeating_item_${id}_check`),
|
||||
...idArray.map(id => `repeating_item_${id}_check_b`)
|
||||
];
|
||||
getAttrs(allAttrs, v => {
|
||||
let setting = {};
|
||||
idArray.forEach(id => {
|
||||
setting[`repeating_item_${id}_boxes_chosen`] = 'on';
|
||||
setting[`repeating_item_${id}_numboxes`] = '2';
|
||||
setting[`repeating_item_${id}_name`] = v[`repeating_item_${id}_desc`] || '';
|
||||
setting[`repeating_item_${id}_check_1`] = v[`repeating_item_${id}_check`] || '0';
|
||||
setting[`repeating_item_${id}_check_2`] = v[`repeating_item_${id}_check_b`] || '0';
|
||||
['2', '3', '5', '6'].forEach(index => {
|
||||
if (v[`item_${index}_desc`]) {
|
||||
items.push({
|
||||
bold: (['2', '3'].includes(index) ? 'on' : '0'),
|
||||
check_1: v[`item_${index}_check`] || '0',
|
||||
name: v[`item_${index}_desc`],
|
||||
numboxes: '1'
|
||||
});
|
||||
}
|
||||
});
|
||||
setAttrs(setting);
|
||||
['4', '7', '8', '9'].forEach(index => {
|
||||
if (v[`item_${index}_desc`]) {
|
||||
items.push({
|
||||
bold: ((index === '4') ? 'on' : '0'),
|
||||
check_1: v[`item_${index}_check`] || '0',
|
||||
name: v[`item_${index}_desc`],
|
||||
numboxes: '0'
|
||||
});
|
||||
}
|
||||
});
|
||||
items.forEach(obj => {
|
||||
obj['boxes_chosen'] = 'on';
|
||||
});
|
||||
fillRepeatingSectionFromData('playbookitem', items, false, upgradeFunction);
|
||||
});
|
||||
});
|
||||
}
|
||||
// Upgrade to 1.5: Convert items
|
||||
if (v.version && (parseInt(v.version.split('.')[0]) < 1 || (parseInt(v.version.split('.')[0]) === 1 && parseInt(v.version.split('.')[1]) < 5))) {
|
||||
let indices = [...Array(25).keys()].slice(10),
|
||||
allAttrs = [
|
||||
...indices.map(n => `item_${n}_check`),
|
||||
...indices.map(n => `item_${n}_desc`),
|
||||
'item_14_check_b',
|
||||
'item_16_check_b',
|
||||
'item_16_check_c',
|
||||
'item_16_check_d',
|
||||
'item_16_check_e',
|
||||
'item_18_check_b',
|
||||
'item_22_check_b'
|
||||
];
|
||||
getAttrs(allAttrs, v => {
|
||||
let items = [{
|
||||
check_1: (v['item_10_check'] || '0'),
|
||||
name: (v['item_10_desc'] || 'A Blade or Two'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_11_check'] || '0'),
|
||||
name: (v['item_11_desc'] || 'Throwing Knives'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_12_check'] || '0'),
|
||||
name: (v['item_12_desc'] || 'A Pistol'),
|
||||
numboxes: '1',
|
||||
short: 'on'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_13_check'] || '0'),
|
||||
name: (v['item_13_desc'] || 'A 2nd Pistol'),
|
||||
numboxes: '1',
|
||||
short: 'on'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_14_check'] || '0'),
|
||||
check_2: (v['item_14_check_b'] || '0'),
|
||||
name: (v['item_14_desc'] || 'A Large Weapon'),
|
||||
numboxes: '2'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_15_check'] || '0'),
|
||||
name: (v['item_15_desc'] || 'An Unusual Weapon'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_16_check'] || '0'),
|
||||
check_2: (v['item_16_check_b'] || '0'),
|
||||
name: (v['item_16_desc'] || 'Armor'),
|
||||
numboxes: '2',
|
||||
short: 'on'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_16_check_c'] || '0'),
|
||||
check_2: (v['item_16_check_d'] || '0'),
|
||||
check_3: (v['item_16_check_e'] || '0'),
|
||||
name: (v['item_16_desc_b'] || '+Heavy'),
|
||||
numboxes: '3',
|
||||
short: 'on'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_17_check'] || '0'),
|
||||
name: (v['item_17_desc'] || 'Burglary Gear'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_18_check'] || '0'),
|
||||
name: (v['item_18_desc'] || 'Climbing Gear'),
|
||||
numboxes: '2'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_19_check'] || '0'),
|
||||
name: (v['item_19_desc'] || 'Arcane Implements'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_20_check'] || '0'),
|
||||
name: (v['item_20_desc'] || 'Documents'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_21_check'] || '0'),
|
||||
name: (v['item_21_desc'] || 'Subterfuge Supplies'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_22_check'] || '0'),
|
||||
check_2: (v['item_22_check_b'] || '0'),
|
||||
name: (v['item_22_desc'] || 'Demolition Tools'),
|
||||
numboxes: '2'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_23_check'] || '0'),
|
||||
name: (v['item_23_desc'] || 'Tinkering Tools'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_24_check'] || '0'),
|
||||
name: (v['item_24_desc'] || 'Lantern'),
|
||||
numboxes: '1'
|
||||
}
|
||||
];
|
||||
items.forEach(obj => {
|
||||
obj['boxes_chosen'] = 'on';
|
||||
});
|
||||
fillRepeatingSectionFromData('item', items);
|
||||
});
|
||||
}
|
||||
// Upgrade to 1.6: Set defaults, convert upgrade names
|
||||
if (v.version && (parseInt(v.version.split('.')[0]) < 1 || (parseInt(v.version.split('.')[0]) === 1 && parseInt(v.version.split('.')[1]) < 6))) {
|
||||
let upgradeNums = [...Array(25).keys()].slice(1).filter(x => x !== 19),
|
||||
upgradeAttrs = [
|
||||
...upgradeNums.map(x => `upgrade_${x}_desc`),
|
||||
...upgradeNums.map(x => `upgrade_${x}_check`),
|
||||
'upgrade_1_check_b',
|
||||
'upgrade_1_check_c',
|
||||
'upgrade_2_tall',
|
||||
'upgrade_3_tall',
|
||||
'upgrade_6_check_b',
|
||||
'upgrade_8_check_b',
|
||||
'upgrade_14_check_b',
|
||||
'upgrade_16_check_b',
|
||||
'upgrade_24_check_b',
|
||||
'upgrade_24_check_c',
|
||||
'upgrade_24_check_d',
|
||||
...Object.keys(defaultValues)
|
||||
];
|
||||
getAttrs(upgradeAttrs, v => {
|
||||
// Repeating / specific upgrades
|
||||
let upgrades = [{
|
||||
check_1: v['upgrade_1_check'] || '0',
|
||||
check_2: v['upgrade_1_check_b'] || '0',
|
||||
check_3: v['upgrade_1_check_c'] || '0',
|
||||
name: v['upgrade_1_desc'] || '',
|
||||
numboxes: '3'
|
||||
}, {
|
||||
check_1: v['upgrade_2_check'] || '0',
|
||||
name: v['upgrade_2_desc'] || '',
|
||||
numboxes: '1',
|
||||
tall: v['upgrade_2_tall'] || '0'
|
||||
}, {
|
||||
check_1: v['upgrade_3_check'] || '0',
|
||||
name: v['upgrade_3_desc'] || '',
|
||||
numboxes: '1',
|
||||
tall: v['upgrade_3_tall'] || '0'
|
||||
}, {
|
||||
check_1: v['upgrade_4_check'] || '0',
|
||||
name: v['upgrade_4_desc'] || '',
|
||||
numboxes: '1'
|
||||
}, {
|
||||
check_1: v['upgrade_5_check'] || '0',
|
||||
name: v['upgrade_5_desc'] || '',
|
||||
numboxes: '1'
|
||||
}];
|
||||
upgrades.forEach(obj => {
|
||||
obj['boxes_chosen'] = 'on';
|
||||
});
|
||||
getSectionIDs('upgrade', idList => {
|
||||
getSectionIDs('repeating_item', idArray => {
|
||||
let allAttrs = [
|
||||
...idList.map(x => `repeating_upgrade_${x}_desc`),
|
||||
...idList.map(x => `repeating_upgrade_${x}_check`),
|
||||
...idList.map(x => `repeating_upgrade_${x}_check_b`)
|
||||
...idArray.map(id => `repeating_item_${id}_desc`),
|
||||
...idArray.map(id => `repeating_item_${id}_check`),
|
||||
...idArray.map(id => `repeating_item_${id}_check_b`)
|
||||
];
|
||||
getAttrs(allAttrs, v => {
|
||||
let setting = {};
|
||||
idList.forEach(id => {
|
||||
setting[`repeating_upgrade_${id}_name`] = v[`repeating_upgrade_${id}_desc`] || '';
|
||||
setting[`repeating_upgrade_${id}_check_1`] = v[`repeating_upgrade_${id}_check`] || '';
|
||||
setting[`repeating_upgrade_${id}_check_2`] = v[`repeating_upgrade_${id}_check_b`] || '';
|
||||
setting[`repeating_upgrade_${id}_numboxes`] = '2';
|
||||
setting[`repeating_upgrade_${id}_boxes_chosen`] = 'on';
|
||||
idArray.forEach(id => {
|
||||
setting[`repeating_item_${id}_boxes_chosen`] = 'on';
|
||||
setting[`repeating_item_${id}_numboxes`] = '2';
|
||||
setting[`repeating_item_${id}_name`] = v[`repeating_item_${id}_desc`] || '';
|
||||
setting[`repeating_item_${id}_check_1`] = v[`repeating_item_${id}_check`] || '0';
|
||||
setting[`repeating_item_${id}_check_2`] = v[`repeating_item_${id}_check_b`] || '0';
|
||||
});
|
||||
setAttrs(setting);
|
||||
fillRepeatingSectionFromData('upgrade', upgrades);
|
||||
setAttrs(setting, {}, upgradeFunction);
|
||||
console.log('Updating to 1.4');
|
||||
});
|
||||
});
|
||||
// Common upgrades
|
||||
let setting = {};
|
||||
upgradeNums.slice(5).forEach(index => {
|
||||
setting[`upgrade_${index}_name`] = v[`upgrade_${index}_desc`] || '';
|
||||
setting[`upgrade_${index}_check_1`] = v[`upgrade_${index}_check`] || '0';
|
||||
}
|
||||
// Upgrade to 1.5: Convert items
|
||||
else if (versionMajor === 1 && versionMinor < 5) {
|
||||
let indices = [...Array(25).keys()].slice(10),
|
||||
allAttrs = [
|
||||
...indices.map(n => `item_${n}_check`),
|
||||
...indices.map(n => `item_${n}_desc`),
|
||||
'item_14_check_b',
|
||||
'item_16_check_b',
|
||||
'item_16_check_c',
|
||||
'item_16_check_d',
|
||||
'item_16_check_e',
|
||||
'item_18_check_b',
|
||||
'item_22_check_b'
|
||||
];
|
||||
getAttrs(allAttrs, v => {
|
||||
let items = [{
|
||||
check_1: (v['item_10_check'] || '0'),
|
||||
name: (v['item_10_desc'] || 'A Blade or Two'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_11_check'] || '0'),
|
||||
name: (v['item_11_desc'] || 'Throwing Knives'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_12_check'] || '0'),
|
||||
name: (v['item_12_desc'] || 'A Pistol'),
|
||||
numboxes: '1',
|
||||
short: 'on'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_13_check'] || '0'),
|
||||
name: (v['item_13_desc'] || 'A 2nd Pistol'),
|
||||
numboxes: '1',
|
||||
short: 'on'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_14_check'] || '0'),
|
||||
check_2: (v['item_14_check_b'] || '0'),
|
||||
name: (v['item_14_desc'] || 'A Large Weapon'),
|
||||
numboxes: '2'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_15_check'] || '0'),
|
||||
name: (v['item_15_desc'] || 'An Unusual Weapon'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_16_check'] || '0'),
|
||||
check_2: (v['item_16_check_b'] || '0'),
|
||||
name: (v['item_16_desc'] || 'Armor'),
|
||||
numboxes: '2',
|
||||
short: 'on'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_16_check_c'] || '0'),
|
||||
check_2: (v['item_16_check_d'] || '0'),
|
||||
check_3: (v['item_16_check_e'] || '0'),
|
||||
name: (v['item_16_desc_b'] || '+Heavy'),
|
||||
numboxes: '3',
|
||||
short: 'on'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_17_check'] || '0'),
|
||||
name: (v['item_17_desc'] || 'Burglary Gear'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_18_check'] || '0'),
|
||||
name: (v['item_18_desc'] || 'Climbing Gear'),
|
||||
numboxes: '2'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_19_check'] || '0'),
|
||||
name: (v['item_19_desc'] || 'Arcane Implements'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_20_check'] || '0'),
|
||||
name: (v['item_20_desc'] || 'Documents'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_21_check'] || '0'),
|
||||
name: (v['item_21_desc'] || 'Subterfuge Supplies'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_22_check'] || '0'),
|
||||
check_2: (v['item_22_check_b'] || '0'),
|
||||
name: (v['item_22_desc'] || 'Demolition Tools'),
|
||||
numboxes: '2'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_23_check'] || '0'),
|
||||
name: (v['item_23_desc'] || 'Tinkering Tools'),
|
||||
numboxes: '1'
|
||||
},
|
||||
{
|
||||
check_1: (v['item_24_check'] || '0'),
|
||||
name: (v['item_24_desc'] || 'Lantern'),
|
||||
numboxes: '1'
|
||||
}
|
||||
];
|
||||
items.forEach(obj => {
|
||||
obj['boxes_chosen'] = 'on';
|
||||
});
|
||||
fillRepeatingSectionFromData('item', items, false, () => upgradeSheet('1.5'));
|
||||
console.log('Updating to 1.5');
|
||||
});
|
||||
setting[`upgrade_6_check_2`] = v[`upgrade_6_check_b`] || '0';
|
||||
setting[`upgrade_8_check_2`] = v[`upgrade_8_check_b`] || '0';
|
||||
setting[`upgrade_14_check_2`] = v[`upgrade_14_check_b`] || '0';
|
||||
setting[`upgrade_16_check_2`] = v[`upgrade_16_check_b`] || '0';
|
||||
setting[`upgrade_24_check_2`] = v[`upgrade_24_check_b`] || '0';
|
||||
setting[`upgrade_24_check_3`] = v[`upgrade_24_check_c`] || '0';
|
||||
setting[`upgrade_24_check_4`] = v[`upgrade_24_check_d`] || '0';
|
||||
Object.keys(defaultValues).forEach(k => {
|
||||
setting[k] = v[k] || setting[k] || defaultValues[k];
|
||||
}
|
||||
// Upgrade to 1.6: Set defaults, convert upgrade names
|
||||
else if (versionMajor === 1 && versionMinor < 6) {
|
||||
let upgradeFunction = _.after(3, () => upgradeSheet('1.6')),
|
||||
upgradeNums = [...Array(25).keys()].slice(1).filter(x => x !== 19),
|
||||
upgradeAttrs = [
|
||||
...upgradeNums.map(x => `upgrade_${x}_desc`),
|
||||
...upgradeNums.map(x => `upgrade_${x}_check`),
|
||||
'upgrade_1_check_b',
|
||||
'upgrade_1_check_c',
|
||||
'upgrade_2_tall',
|
||||
'upgrade_3_tall',
|
||||
'upgrade_6_check_b',
|
||||
'upgrade_8_check_b',
|
||||
'upgrade_14_check_b',
|
||||
'upgrade_16_check_b',
|
||||
'upgrade_24_check_b',
|
||||
'upgrade_24_check_c',
|
||||
'upgrade_24_check_d',
|
||||
...Object.keys(defaultValues)
|
||||
];
|
||||
getAttrs(upgradeAttrs, v => {
|
||||
// Repeating / specific upgrades
|
||||
let upgrades = [{
|
||||
check_1: v['upgrade_1_check'] || '0',
|
||||
check_2: v['upgrade_1_check_b'] || '0',
|
||||
check_3: v['upgrade_1_check_c'] || '0',
|
||||
name: v['upgrade_1_desc'] || '',
|
||||
numboxes: '3'
|
||||
}, {
|
||||
check_1: v['upgrade_2_check'] || '0',
|
||||
name: v['upgrade_2_desc'] || '',
|
||||
numboxes: '1',
|
||||
tall: v['upgrade_2_tall'] || '0'
|
||||
}, {
|
||||
check_1: v['upgrade_3_check'] || '0',
|
||||
name: v['upgrade_3_desc'] || '',
|
||||
numboxes: '1',
|
||||
tall: v['upgrade_3_tall'] || '0'
|
||||
}, {
|
||||
check_1: v['upgrade_4_check'] || '0',
|
||||
name: v['upgrade_4_desc'] || '',
|
||||
numboxes: '1'
|
||||
}, {
|
||||
check_1: v['upgrade_5_check'] || '0',
|
||||
name: v['upgrade_5_desc'] || '',
|
||||
numboxes: '1'
|
||||
}];
|
||||
upgrades.forEach(obj => {
|
||||
obj['boxes_chosen'] = 'on';
|
||||
});
|
||||
getSectionIDs('upgrade', idList => {
|
||||
let allAttrs = [
|
||||
...idList.map(x => `repeating_upgrade_${x}_desc`),
|
||||
...idList.map(x => `repeating_upgrade_${x}_check`),
|
||||
...idList.map(x => `repeating_upgrade_${x}_check_b`)
|
||||
];
|
||||
getAttrs(allAttrs, v => {
|
||||
let setting = {};
|
||||
idList.forEach(id => {
|
||||
setting[`repeating_upgrade_${id}_name`] = v[`repeating_upgrade_${id}_desc`] || '';
|
||||
setting[`repeating_upgrade_${id}_check_1`] = v[`repeating_upgrade_${id}_check`] || '';
|
||||
setting[`repeating_upgrade_${id}_check_2`] = v[`repeating_upgrade_${id}_check_b`] || '';
|
||||
setting[`repeating_upgrade_${id}_numboxes`] = '2';
|
||||
setting[`repeating_upgrade_${id}_boxes_chosen`] = 'on';
|
||||
});
|
||||
setAttrs(setting, {}, upgradeFunction);
|
||||
fillRepeatingSectionFromData('upgrade', upgrades, false, upgradeFunction);
|
||||
});
|
||||
});
|
||||
// Common upgrades
|
||||
let setting = {};
|
||||
upgradeNums.slice(5).forEach(index => {
|
||||
setting[`upgrade_${index}_name`] = v[`upgrade_${index}_desc`] || '';
|
||||
setting[`upgrade_${index}_check_1`] = v[`upgrade_${index}_check`] || '0';
|
||||
});
|
||||
setting[`upgrade_6_check_2`] = v[`upgrade_6_check_b`] || '0';
|
||||
setting[`upgrade_8_check_2`] = v[`upgrade_8_check_b`] || '0';
|
||||
setting[`upgrade_14_check_2`] = v[`upgrade_14_check_b`] || '0';
|
||||
setting[`upgrade_16_check_2`] = v[`upgrade_16_check_b`] || '0';
|
||||
setting[`upgrade_24_check_2`] = v[`upgrade_24_check_b`] || '0';
|
||||
setting[`upgrade_24_check_3`] = v[`upgrade_24_check_c`] || '0';
|
||||
setting[`upgrade_24_check_4`] = v[`upgrade_24_check_d`] || '0';
|
||||
Object.keys(defaultValues).forEach(k => {
|
||||
setting[k] = v[k] || setting[k] || defaultValues[k];
|
||||
});
|
||||
setAttrs(setting, {}, upgradeFunction);
|
||||
console.log('Updating to 1.6');
|
||||
});
|
||||
setAttrs(setting);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
upgradeSheet(v.version);
|
||||
// Set version number
|
||||
setAttrs({
|
||||
version: '1.7',
|
||||
character_sheet: 'Blades in the Dark v1.7'
|
||||
version: '1.8',
|
||||
character_sheet: 'Blades in the Dark v1.8'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user