Importing truths from JSON and exporting assets to WikiText.
This commit is contained in:
parent
f9c43d1db1
commit
f1d39f2fc6
@ -0,0 +1,10 @@
|
|||||||
|
converting
|
||||||
|
abilitiesAsWikiText
|
||||||
|
| output |
|
||||||
|
output := '' writeStream.
|
||||||
|
output
|
||||||
|
nextPutAll: '<ul style="list-style-type:none;">'; cr;
|
||||||
|
nextPutAll: (self abilitiesAsWikiTextFor: self currentAbilities);
|
||||||
|
nextPutAll: (self abilitiesAsWikiTextFor: self pendingAbilities);
|
||||||
|
nextPutAll: '</ul>'.
|
||||||
|
^ output contents
|
@ -0,0 +1,12 @@
|
|||||||
|
utilities
|
||||||
|
abilitiesAsWikiTextFor: abilitiesSubset
|
||||||
|
|
||||||
|
| aStream |
|
||||||
|
aStream := '' writeStream.
|
||||||
|
abilitiesSubset do: [:abi|
|
||||||
|
aStream
|
||||||
|
nextPutAll: ' <li> ⬢'; cr;
|
||||||
|
nextPutAll: ' ';
|
||||||
|
nextPutAll: abi; cr;
|
||||||
|
nextPutAll: ' </li>'; cr ].
|
||||||
|
^ aStream contents
|
6
RoloLudo.package/SfAsset.class/instance/asTiddler.st
Normal file
6
RoloLudo.package/SfAsset.class/instance/asTiddler.st
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
converting
|
||||||
|
asTiddler
|
||||||
|
^ Tiddler new
|
||||||
|
title: self name;
|
||||||
|
tags: 'Starforged ' , self category;
|
||||||
|
text: self abilitiesAsWikiText
|
@ -0,0 +1,3 @@
|
|||||||
|
converting
|
||||||
|
currentAbilities
|
||||||
|
^ self abilities at: 'enabled'
|
@ -0,0 +1,3 @@
|
|||||||
|
converting
|
||||||
|
pendingAbilities
|
||||||
|
^ self abilities at: 'disabled'
|
6
RoloLudo.package/SfAsset.class/instance/printOn..st
Normal file
6
RoloLudo.package/SfAsset.class/instance/printOn..st
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
printing
|
||||||
|
printOn: aStream
|
||||||
|
super printOn: aStream.
|
||||||
|
aStream
|
||||||
|
nextPutAll: ' ( ' , self name , ' | ';
|
||||||
|
nextPutAll: self category, ' )'
|
0
RoloLudo.package/SfTruth.class/README.md
Normal file
0
RoloLudo.package/SfTruth.class/README.md
Normal file
3
RoloLudo.package/SfTruth.class/instance/character..st
Normal file
3
RoloLudo.package/SfTruth.class/instance/character..st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
character: optionsPhrase
|
||||||
|
character := optionsPhrase
|
@ -0,0 +1,6 @@
|
|||||||
|
accessing
|
||||||
|
fromDictionary: aDictionary
|
||||||
|
name := aDictionary at: 'Name'.
|
||||||
|
character := aDictionary at: 'Character'.
|
||||||
|
(aDictionary at: 'Truths') collect: [:truth | self options add: ((SfTruthOption new fromDictionary: truth))].
|
||||||
|
self refineOptionIntervals.
|
3
RoloLudo.package/SfTruth.class/instance/name..st
Normal file
3
RoloLudo.package/SfTruth.class/instance/name..st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
name: aString
|
||||||
|
name := aString
|
3
RoloLudo.package/SfTruth.class/instance/name.st
Normal file
3
RoloLudo.package/SfTruth.class/instance/name.st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
name
|
||||||
|
^ name
|
3
RoloLudo.package/SfTruth.class/instance/options..st
Normal file
3
RoloLudo.package/SfTruth.class/instance/options..st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
options: anOrderedCollection
|
||||||
|
options := anOrderedCollection
|
3
RoloLudo.package/SfTruth.class/instance/options.st
Normal file
3
RoloLudo.package/SfTruth.class/instance/options.st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
options
|
||||||
|
^ options ifNil: [ options := OrderedCollection new ]
|
5
RoloLudo.package/SfTruth.class/instance/printOn..st
Normal file
5
RoloLudo.package/SfTruth.class/instance/printOn..st
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
accessing
|
||||||
|
printOn: aStream
|
||||||
|
super printOn: aStream.
|
||||||
|
aStream
|
||||||
|
nextPutAll: ' ( ', self name, ' ) '
|
@ -0,0 +1,13 @@
|
|||||||
|
accessing
|
||||||
|
refineOptionIntervals
|
||||||
|
| endings |
|
||||||
|
endings := self options collect: [:opt | opt chance ].
|
||||||
|
endings doWithIndex: [:end :i |
|
||||||
|
|
||||||
|
(i = 1)
|
||||||
|
ifTrue: [(self options at: i) chance: (1 to: end)]
|
||||||
|
ifFalse: [
|
||||||
|
(self options at: i) chance: (((endings at: (i-1)) + 1) to: (endings at: i))
|
||||||
|
]
|
||||||
|
|
||||||
|
].
|
15
RoloLudo.package/SfTruth.class/properties.json
Normal file
15
RoloLudo.package/SfTruth.class/properties.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"commentStamp" : "",
|
||||||
|
"super" : "Object",
|
||||||
|
"category" : "RoloLudo",
|
||||||
|
"classinstvars" : [ ],
|
||||||
|
"pools" : [ ],
|
||||||
|
"classvars" : [ ],
|
||||||
|
"instvars" : [
|
||||||
|
"options",
|
||||||
|
"name",
|
||||||
|
"character"
|
||||||
|
],
|
||||||
|
"name" : "SfTruth",
|
||||||
|
"type" : "normal"
|
||||||
|
}
|
0
RoloLudo.package/SfTruthExamples.class/README.md
Normal file
0
RoloLudo.package/SfTruthExamples.class/README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
accessing
|
||||||
|
emptyTruth
|
||||||
|
<gtExample>
|
||||||
|
| testSfTruth |
|
||||||
|
testSfTruth := SfTruth new.
|
||||||
|
self assert: testSfTruth isEmpty.
|
||||||
|
^ testSfTruth
|
11
RoloLudo.package/SfTruthExamples.class/properties.json
Normal file
11
RoloLudo.package/SfTruthExamples.class/properties.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"commentStamp" : "",
|
||||||
|
"super" : "Object",
|
||||||
|
"category" : "RoloLudo",
|
||||||
|
"classinstvars" : [ ],
|
||||||
|
"pools" : [ ],
|
||||||
|
"classvars" : [ ],
|
||||||
|
"instvars" : [ ],
|
||||||
|
"name" : "SfTruthExamples",
|
||||||
|
"type" : "normal"
|
||||||
|
}
|
0
RoloLudo.package/SfTruthOption.class/README.md
Normal file
0
RoloLudo.package/SfTruthOption.class/README.md
Normal file
3
RoloLudo.package/SfTruthOption.class/instance/brief..st
Normal file
3
RoloLudo.package/SfTruthOption.class/instance/brief..st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
brief: shortText
|
||||||
|
brief := shortText
|
3
RoloLudo.package/SfTruthOption.class/instance/brief.st
Normal file
3
RoloLudo.package/SfTruthOption.class/instance/brief.st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
brief
|
||||||
|
^ brief
|
3
RoloLudo.package/SfTruthOption.class/instance/chance..st
Normal file
3
RoloLudo.package/SfTruthOption.class/instance/chance..st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
chance: integerInterval
|
||||||
|
chance := integerInterval
|
3
RoloLudo.package/SfTruthOption.class/instance/chance.st
Normal file
3
RoloLudo.package/SfTruthOption.class/instance/chance.st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
chance
|
||||||
|
^ chance
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
details: longerText
|
||||||
|
details := longerText
|
@ -0,0 +1,9 @@
|
|||||||
|
accessing
|
||||||
|
fromDictionary: aDictionary
|
||||||
|
brief := aDictionary at: 'Description'.
|
||||||
|
details := aDictionary at: 'Details'.
|
||||||
|
questStarter := aDictionary at: 'Quest Starter'.
|
||||||
|
subtable := aDictionary at: 'Table' ifAbsent: [ subtable := nil ].
|
||||||
|
"Because of JSON original data this only puts the end of the chance interval.
|
||||||
|
This needs to be refined at 'container' object SfTruth."
|
||||||
|
chance := aDictionary at: 'Chance'
|
@ -0,0 +1,6 @@
|
|||||||
|
accessing
|
||||||
|
printOn: aStream
|
||||||
|
super printOn: aStream.
|
||||||
|
aStream
|
||||||
|
nextPutAll: ' ( ', self brief, ' )'
|
||||||
|
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
subtable: aDictionary
|
||||||
|
subtable := aDictionary
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
subtable
|
||||||
|
^ subtable ifNil: [ subtable := OrderedDictionary new]
|
17
RoloLudo.package/SfTruthOption.class/properties.json
Normal file
17
RoloLudo.package/SfTruthOption.class/properties.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"commentStamp" : "",
|
||||||
|
"super" : "Object",
|
||||||
|
"category" : "RoloLudo",
|
||||||
|
"classinstvars" : [ ],
|
||||||
|
"pools" : [ ],
|
||||||
|
"classvars" : [ ],
|
||||||
|
"instvars" : [
|
||||||
|
"brief",
|
||||||
|
"details",
|
||||||
|
"subtable",
|
||||||
|
"questStarter",
|
||||||
|
"chance"
|
||||||
|
],
|
||||||
|
"name" : "SfTruthOption",
|
||||||
|
"type" : "normal"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user