2021-06-20 18:32:57 +00:00
|
|
|
accessing
|
|
|
|
fromDictionary: aDictionary
|
|
|
|
| optionsTable |
|
2021-11-17 16:14:12 +00:00
|
|
|
name := aDictionary at: 'Name' ifAbsent: [ name := aDictionary at: 'Display name' ].
|
|
|
|
intro := aDictionary at: 'Description'.
|
2021-06-20 18:32:57 +00:00
|
|
|
optionsTable := aDictionary at: 'Table'.
|
|
|
|
optionsTable doWithIndex: [:opt :i | | key value prevKey |
|
|
|
|
(i = 1)
|
|
|
|
ifTrue: [key := 1 to: (opt at: 'Chance') asInteger]
|
|
|
|
ifFalse: [
|
|
|
|
prevKey := ((optionsTable at: (i-1)) at: 'Chance').
|
|
|
|
key := (prevKey asInteger + 1) to: (opt at: 'Chance') asInteger.
|
|
|
|
].
|
|
|
|
value := (opt at: 'Description') capitalized.
|
|
|
|
self options at: key put: value .
|
|
|
|
].
|