Skip to content

Commit

Permalink
Merge pull request #12275 from aureyia/oracles-fix
Browse files Browse the repository at this point in the history
[Ironsworn: Starforged] [Fix] Oracles missed due to data restructure
  • Loading branch information
mperes committed Nov 6, 2023
2 parents f3418ae + c5e2244 commit 8d953a1
Show file tree
Hide file tree
Showing 8 changed files with 23,989 additions and 9,119 deletions.
29,888 changes: 20,854 additions & 9,034 deletions Ironsworn-Starforged/Ironsworn-starforged.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
//- mixin oracleRollButton()
//- - console.log("Processing oracle", oracle.Name)
//- if rollButton === true && oracle.Tables
//- +oracleMultiBtn(oracle)
//- else if rollButton === true && oracle.Table
//- +oracleSingleButton(oracle)
mixin oracleListGroupItem(id, buttonLabel)
+oracleRollBtn(id, buttonLabel)

mixin oracleSubOraclesListGroupItem(id, buttonLabel, oracles)
-
let counter = 0;Label
let options = [];
oracles.forEach((oracle) => {
let tableLabel = oracle['Name'];
options.push(`${tableLabel},${counter}`);
counter++;
let count = 0
const options = oracles.map((table) => {
if (table.Oracles) {
const subOracleOptions = table.Oracles.map((oracle) => {
return `${oracle['Name']},${count++}`
})
return `${table['Name']},?{${table['Name']}|${subOracleOptions.join('|')}}`
} else {
return `${table['Name']},${count++}`
}
})
console.log('opt 1', options)
- const rollQuery = `{{tableChoice=[[(?{Choose Table|${options.join('|')}})]]}}`
+oracleRollBtn(id, buttonLabel, rollQuery)

Expand Down Expand Up @@ -47,11 +44,21 @@ mixin oracleRollBtn(id, buttonLabel, rollQuery="")
.btn-content.oracle-name=buttonLabel.replace(/ - /i, ": ")

mixin oracleMultiBtn(oracle, btnText, indexOffset=0)
- const labelText = oracle['Name']
- const options = oracle.Oracles.map((table, index) => { return `${table['Name']},${index+indexOffset}` })
- console.log('opt 2', options)
- const rollQuery = `{{tableChoice=[[(?{Choose Table|${options.join('|')}})]]}} {{header=${labelText}}}`
- const id = oracle.$id
-
const labelText = oracle['Name']
const options = oracle.Oracles.map((table, index) => {
if (table.Oracles) {
const subOracleOptions = table.Oracles.map((oracle, index) => {
return `${oracle['Name']},${index}`
})
return `?{Type|${subOracleOptions.join('|')}}`
} else {
return `${table['Name']},${index+indexOffset}`
}
})
console.log('opt 2', options)
const rollQuery = `{{tableChoice=[[(?{Choose Table|${options.join('|')}})]]}} {{header=${labelText}}}`
const id = oracle.$id
label.roll-label.embedded-btn=btnText||labelText
button.hide-element(
type='roll'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ mixin oracleRollGroup(group)
+oracleSubOraclesListGroupItem(oracle.$id, buttonLabel, oracle.Oracles)
else
+oracleRollBtn(oracle.$id, oracle.Name)
if group.Categories
each category in group.Categories
- const header = `${group.Name} - ${category.Name}`
.oracle
if (category.Oracles)
- let buttonLabel = category.Name
+oracleSubOraclesListGroupItem(category.$id, buttonLabel, category.Oracles)
else
+oracleRollBtn(category.$id, category.Name)
//- if group.Subcategories
//- each subCategory in group.Subcategories
//- - const buttonLabel = subCategory['Display name']||subCategory.Name
Expand Down
4 changes: 2 additions & 2 deletions Ironsworn-Starforged/src/app/pages/character/oracles.pug
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ mixin oraclesPage
if group.Name !== 'Move'
each oracle in group.Oracles
+oraclePreview(oracle, group['Display name']||group.Name)
if group.Subcategories
each subcategory in group.Subcategories
if group.Categories
each subcategory in group.Categories
+oraclePreview(subcategory, group['Display name']||group.Name)
14 changes: 8 additions & 6 deletions Ironsworn-Starforged/src/app/roll-templates/oracles/builder.pug
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,18 @@ mixin oracleTemplate(oracle)
|
| {{/rollTotal() tableChoice #{counter}}}
- counter++
else if subCatOracle.Tables
each subCatOracleSubTable in subCatOracle.Tables
if subCatOracle.Oracles
each subSubCatOracle in subCatOracle.Oracles
|
| {{#rollTotal() tableChoice #{counter}}}
each row, index in subCatOracleSubTable.Table
+oracleRoll(id, subCatOracleSubTable.Table, row, index)
each row, index in subSubCatOracle.Table
+oracleRoll(id, subSubCatOracle.Table, row, index)
|
| {{/rollTotal() tableChoice #{counter}}}
- counter++



|
| {{/#{id}}}

Expand All @@ -73,6 +75,6 @@ rolltemplate(class=`sheet-rolltemplate-starforged_oracles`)
each category in oracles
each oracle in category.Oracles
+oracleTemplate(oracle)
if category.Subcategories
each subCategory in category.Subcategories
if category.Categories
each subCategory in category.Categories
+oracleTemplate(subCategory)
Loading

0 comments on commit 8d953a1

Please sign in to comment.