Esempio n. 1
0
 def render_POST(self, content, session):
     preview = {}
     source = Blank()
     source.name = content.source
     if content.self_source:
         target = source
     else:
         target = Blank()
         target.name = content.target
     broadcast_map = BroadcastMap()
     broadcast_map.populate(content.map)
     broadcast = Broadcast(broadcast_map, source, target)
     for broadcast_type in broadcast_types:
         preview[broadcast_type['id']] = broadcast.substitute(broadcast_type['id'])
     return preview
Esempio n. 2
0
 def enter_env(self, new_env, enter_action=None):
     entry_msg = Broadcast(getattr(enter_action, 'entry_msg', self.entry_msg), self, silent=True)
     entry_msg.target = getattr(enter_action, 'from_name', None)
     new_env.entity_enters(self, enter_action, entry_msg)
     new_instance = getattr(self.env, 'instance', None)
     if self.instance != new_instance:
         if self.instance:
             self.instance.remove_entity(self)
             del self.instance_id
         if new_instance:
             new_instance.add_entity(self)
             self.instance_id = new_instance.instance_id
     if self.instance:
         self.instance_room_id = self.env.dbo_id
     elif self.env.dbo_id:
         self.room_id = self.env.dbo_id
     self.env.first_look(self)
Esempio n. 3
0
 def preview(self):
     content = self._content()
     broadcast = Broadcast(
         BroadcastMap(**content.b_map), content.source, content.source if content.self_source else content.target
     )
     return {broadcast_type["id"]: broadcast.substitute(broadcast_type["id"]) for broadcast_type in broadcast_types}
Esempio n. 4
0
 def broadcast(self, **kwargs):
     broadcast = Broadcast(**kwargs)
     broadcast.source = self
     if self.env:
         self.env.receive_broadcast(broadcast)