From 7c454b41c2050a10edded16bd31c2bcf473213bc Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Fri, 8 Dec 2023 12:45:43 -0500 Subject: [PATCH] Starting main character creation. --- .../FirelightsCharacter.class/README.md | 0 .../FirelightsCharacter.class/properties.json | 16 ++++++++++++++++ .../FirelightsGame.class/instance/characters.st | 3 +++ .../FirelightsGame.class/instance/namesOracle.st | 3 +++ .../instance/newMainCharacter.st | 4 ++++ .../FirelightsGame.class/properties.json | 3 ++- .../SfOracle.class/instance/fromRepository.st | 3 +++ .../instance/loadCharacterNames.st | 14 ++++++++++++++ .../SfOracle.class/instance/printOn..st | 4 +++- 9 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 RoloLudo.package/FirelightsCharacter.class/README.md create mode 100644 RoloLudo.package/FirelightsCharacter.class/properties.json create mode 100644 RoloLudo.package/FirelightsGame.class/instance/characters.st create mode 100644 RoloLudo.package/FirelightsGame.class/instance/namesOracle.st create mode 100644 RoloLudo.package/FirelightsGame.class/instance/newMainCharacter.st create mode 100644 RoloLudo.package/SfOracle.class/instance/fromRepository.st create mode 100644 RoloLudo.package/SfOracle.class/instance/loadCharacterNames.st diff --git a/RoloLudo.package/FirelightsCharacter.class/README.md b/RoloLudo.package/FirelightsCharacter.class/README.md new file mode 100644 index 0000000..e69de29 diff --git a/RoloLudo.package/FirelightsCharacter.class/properties.json b/RoloLudo.package/FirelightsCharacter.class/properties.json new file mode 100644 index 0000000..1e9866f --- /dev/null +++ b/RoloLudo.package/FirelightsCharacter.class/properties.json @@ -0,0 +1,16 @@ +{ + "commentStamp" : "", + "super" : "Object", + "category" : "RoloLudo", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ + "name", + "pronouns", + "relics", + "approaches" + ], + "name" : "FirelightsCharacter", + "type" : "normal" +} \ No newline at end of file diff --git a/RoloLudo.package/FirelightsGame.class/instance/characters.st b/RoloLudo.package/FirelightsGame.class/instance/characters.st new file mode 100644 index 0000000..43e6750 --- /dev/null +++ b/RoloLudo.package/FirelightsGame.class/instance/characters.st @@ -0,0 +1,3 @@ +accessing +characters + ^ characters ifNil: [ characters := OrderedCollection new] \ No newline at end of file diff --git a/RoloLudo.package/FirelightsGame.class/instance/namesOracle.st b/RoloLudo.package/FirelightsGame.class/instance/namesOracle.st new file mode 100644 index 0000000..4e1067f --- /dev/null +++ b/RoloLudo.package/FirelightsGame.class/instance/namesOracle.st @@ -0,0 +1,3 @@ +accessing +namesOracle + ^ SfOracle new \ No newline at end of file diff --git a/RoloLudo.package/FirelightsGame.class/instance/newMainCharacter.st b/RoloLudo.package/FirelightsGame.class/instance/newMainCharacter.st new file mode 100644 index 0000000..15caf5a --- /dev/null +++ b/RoloLudo.package/FirelightsGame.class/instance/newMainCharacter.st @@ -0,0 +1,4 @@ +accessing +newMainCharacter + self characters ifEmpty: [ self characters add: FirelightsCharacter new]. + ^ self characters first. \ No newline at end of file diff --git a/RoloLudo.package/FirelightsGame.class/properties.json b/RoloLudo.package/FirelightsGame.class/properties.json index 8b83b09..f769e72 100644 --- a/RoloLudo.package/FirelightsGame.class/properties.json +++ b/RoloLudo.package/FirelightsGame.class/properties.json @@ -10,7 +10,8 @@ "dice", "wordMap", "oracles", - "wiki" + "wiki", + "characters" ], "name" : "FirelightsGame", "type" : "normal" diff --git a/RoloLudo.package/SfOracle.class/instance/fromRepository.st b/RoloLudo.package/SfOracle.class/instance/fromRepository.st new file mode 100644 index 0000000..1d8ddf8 --- /dev/null +++ b/RoloLudo.package/SfOracle.class/instance/fromRepository.st @@ -0,0 +1,3 @@ +accessing +fromRepository + ^ STONJSON fromString: 'https://raw.githubusercontent.com/rsek/dataforged/main/src/starforged/oracles.json' asUrl retrieveContents \ No newline at end of file diff --git a/RoloLudo.package/SfOracle.class/instance/loadCharacterNames.st b/RoloLudo.package/SfOracle.class/instance/loadCharacterNames.st new file mode 100644 index 0000000..7ee58b3 --- /dev/null +++ b/RoloLudo.package/SfOracle.class/instance/loadCharacterNames.st @@ -0,0 +1,14 @@ +accessing +loadCharacterNames + | dataSlice response | + dataSlice := (self fromRepository second at: 'Oracles') sixth. + self name: (dataSlice at: 'Display' at: 'Title'). + self intro: (dataSlice at: 'Description'). + response := OrderedDictionary new. + #('givenNames' 'callsigns' 'familyNames') doWithIndex: [ :key :i | + response + at: key + put: ((((dataSlice at: 'Oracles') at: i) at: 'Table') collect: [ :each | each at: 'Result' ]). + ]. + self options: response. + ^ self \ No newline at end of file diff --git a/RoloLudo.package/SfOracle.class/instance/printOn..st b/RoloLudo.package/SfOracle.class/instance/printOn..st index 9d8e44b..89baaf0 100644 --- a/RoloLudo.package/SfOracle.class/instance/printOn..st +++ b/RoloLudo.package/SfOracle.class/instance/printOn..st @@ -1,5 +1,7 @@ accessing printOn: aStream + | currentName | + currentName := self name ifNil: ['Unammed']. super printOn: aStream. aStream - nextPutAll: '( ', self name, ' )'. \ No newline at end of file + nextPutAll: '( ', currentName, ' )'. \ No newline at end of file