def __init__(self, schema, event, condition=None): try: self.npc = schema['npc'] except KeyError: raise SchemaError("{0} schema missing required field " "``npc``".format(type(self))) try: self.event_id = schema['event_id'] except KeyError: raise SchemaError("{0} schema missing required field " "``event_id``".format(type(self))) super().__init__(schema, condition)
def __init__(self, schema, event, condition=None): super().__init__(schema, condition) try: self.choices = schema['choices'] except KeyError: raise SchemaError("{0} schema missing required field " "``choices``".format(type(self))) self.initialized = True
def __init__(self, schema, event, condition=None): super().__init__(schema, condition) path_prefix = None for key in schema: if key in self.supported_scopes: if path_prefix: keys = schema.keys() del keys['flag_id'] del keys['type'] raise SchemaError("unable to load event clear_flag - a " "flag cannot be cleared on multiple " "scopes at the same time [{0}]".format( ', '.join(keys))) path_prefix = 'world.{0}.{1}'.format(key, schema[key]) self.scope = {key: schema[key]} if not path_prefix: path_prefix = 'pc' try: self.flag_id = schema['flag_id'] except KeyError: raise SchemaError("{0} schema missing required field " "``flag_id``".format(type(self))) self.flag_state_path = '.'.join([path_prefix, 'flags', self.flag_id]) self.initialized = True