예제 #1
0
 def from_data(cls, file: File, data: Dict[str, Any],
               translations: Dict[str, Dict[str, Any]],
               game_contents: GameContents) -> 'Legacy':
     lg = game_contents.get_legacy(data['id'])
     lg.file = file
     lg.label = get(data, 'label', translations=translations)
     lg.description = get(data, 'description', translations=translations)
     lg.start_description = get(data,
                                'startdescription',
                                translations=translations)
     lg.image = get(data, 'image')
     lg.from_ending = get(data, 'fromEnding')
     lg.excludes_on_ending = [
         LegacyExcludes(legacy=lg, exclude=game_contents.get_legacy(l))
         for l in get(data, 'excludesOnEnding', [])
     ]
     lg.available_without_ending_match = get(data,
                                             'availableWithoutEndingMatch',
                                             False, to_bool)
     lg.starting_verb_id = get(data, 'startingVerbId')
     lg.effects = LegacyEffect.from_data(get(data, 'effects', {}),
                                         game_contents)
     return lg
예제 #2
0
 def from_data(
         cls,
         file: File,
         data: Dict[str, Any],
         game_contents: GameContents
 ) -> 'Legacy':
     lg = game_contents.get_legacy(data['id'])
     lg.file = file
     lg.label = get(data, 'label')
     lg.description = get(data, 'description')
     lg.start_description = get(data, 'startdescription')
     lg.image = get(data, 'image')
     lg.from_ending = get(data, 'fromEnding')
     lg.available_without_ending_match = get(
         data, 'availableWithoutEndingMatch', False, to_bool
     )
     lg.effects = LegacyEffect.from_data(
         get(data, 'effects', {}), game_contents
     )
     return lg