From 29a8d52f0f40b2556863453641aafc7d6bfc5f22 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Wed, 29 Nov 2023 11:24:01 -0500 Subject: [PATCH] Collecting oracles from template wiki. --- .../instance/loadOraclesFromWikiTemplate.st | 18 ++++++++++++++++++ .../Firelights.class/instance/oracles..st | 3 +++ .../Firelights.class/instance/oracles.st | 2 +- .../instance/populateOracles.st | 6 ------ 4 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 RoloLudo.package/Firelights.class/instance/loadOraclesFromWikiTemplate.st create mode 100644 RoloLudo.package/Firelights.class/instance/oracles..st delete mode 100644 RoloLudo.package/Firelights.class/instance/populateOracles.st 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