Beispiel #1
0
    def __init__(self, player):
        self.player = player

        self.attribute_types = {}
        cache_key = "AttributeType.all()"
        all_attr_types = instance_cache.get(cache_key)
        if not all_attr_types:
            all_attr_types = AttributeType.all().fetch(1000)
            instance_cache.set(cache_key, all_attr_types)
        for attribute_type in all_attr_types:
            self.attribute_types[attribute_type.name] = attribute_type

        self.update()
Beispiel #2
0
 def run_script(self,actor,target):
     ''' script(Thespian,Thespian) -> None
         outputs are all via side-effects of Thespian.add_effect()
     '''
     cache_key = 'AttributeType.all()'
     all_attr_types = instance_cache.get(cache_key)
     if not all_attr_types:
         all_attr_types = AttributeType.all().fetch(100)
         instance_cache.set(cache_key,all_attr_types)
     global_ctx = {'__builtins__':None}
     local_ctx = {
         'actor': actor,
         'target': target,
         'attribute_types' : all_attr_types,
     }
     local_ctx = dict(base_ctx.items() + local_ctx.items())
     exec self.compiled_script in global_ctx, local_ctx