diff --git a/RoloLudo.package/Firelights.class/instance/loadOraclesFromWikiTemplate.st b/RoloLudo.package/Firelights.class/instance/loadOraclesFromWikiTemplate.st new file mode 100644 index 0000000..885fde9 --- /dev/null +++ b/RoloLudo.package/Firelights.class/instance/loadOraclesFromWikiTemplate.st @@ -0,0 +1,18 @@ +accessing +loadOraclesFromWikiTemplate + | oraclesTiddler rows | + oraclesTiddler := self wiki templateWiki tiddlers + detect: [:tiddler | (tiddler title) = 'Tablas Generadoras' ]. + rows := oraclesTiddler text lines allButFirst collect: [:each | each splitOn: '|']. + ^ rows collect: [:row | | tempDice | + tempDice := (row second splitOn: '"') second. + tempDice := tempDice splitOn: Character space. + tempDice := { tempDice first asNumber . tempDice second asNumber }. + OrderedDictionary new + at: 'dice' put: tempDice; + at: 'region' put: row third; + at: 'theme' put: row fourth; + at: 'event' put: row fifth; + at: 'past' put: row sixth; + yourself. + ] \ No newline at end of file diff --git a/RoloLudo.package/Firelights.class/instance/oracles..st b/RoloLudo.package/Firelights.class/instance/oracles..st new file mode 100644 index 0000000..ab68ee6 --- /dev/null +++ b/RoloLudo.package/Firelights.class/instance/oracles..st @@ -0,0 +1,3 @@ +accessing +oracles: aDictionary + oracles := aDictionary \ No newline at end of file diff --git a/RoloLudo.package/Firelights.class/instance/oracles.st b/RoloLudo.package/Firelights.class/instance/oracles.st index d8c0eed..489031c 100644 --- a/RoloLudo.package/Firelights.class/instance/oracles.st +++ b/RoloLudo.package/Firelights.class/instance/oracles.st @@ -1,3 +1,3 @@ accessing oracles - ^ oracles ifNil: [ oracles := self populateOracles] \ No newline at end of file + ^ oracles ifNil: [ oracles := self loadOraclesFromWikiTemplate] \ No newline at end of file diff --git a/RoloLudo.package/Firelights.class/instance/populateOracles.st b/RoloLudo.package/Firelights.class/instance/populateOracles.st deleted file mode 100644 index 117da2d..0000000 --- a/RoloLudo.package/Firelights.class/instance/populateOracles.st +++ /dev/null @@ -1,6 +0,0 @@ -accessing -populateOracles - | oraclesTiddler | - oraclesTiddler := self wiki templateWiki tiddlers - detect: [:tiddler | (tiddler title) = 'Tablas Generadoras' ]. - ^ oraclesTiddler text lines allButFirst collect: [:each | each splitOn: '|'] \ No newline at end of file