Exemplo n.º 1
0
 def send_selectable_sims_update(self):
     msg = Sims_pb2.UpdateSelectableSims()
     for sim_info in self._selectable_sims:
         with ProtocolBufferRollback(msg.sims) as new_sim:
             new_sim.id = sim_info.sim_id
             if sim_info.career_tracker is None:
                 logger.error(
                     'CareerTracker is None for selectable Sim {}'.format(
                         sim_info))
             else:
                 career = sim_info.career_tracker.get_currently_at_work_career(
                 )
                 new_sim.at_work = career is not None and not career.is_at_active_event
             new_sim.is_selectable = sim_info.is_enabled_in_skewer
             (selector_visual_type,
              career_category) = self._get_selector_visual_type(sim_info)
             new_sim.selector_visual_type = selector_visual_type
             if career_category is not None:
                 new_sim.career_category = career_category
             new_sim.can_care_for_toddler_at_home = sim_info.can_care_for_toddler_at_home
             if not sim_info.is_instanced(
                     allow_hidden_flags=ALL_HIDDEN_REASONS):
                 new_sim.instance_info.zone_id = sim_info.zone_id
                 new_sim.instance_info.world_id = sim_info.world_id
                 new_sim.firstname = sim_info.first_name
                 new_sim.lastname = sim_info.last_name
                 zone_data_proto = services.get_persistence_service(
                 ).get_zone_proto_buff(sim_info.zone_id)
                 if zone_data_proto is not None:
                     new_sim.instance_info.zone_name = zone_data_proto.name
     distributor = Distributor.instance()
     distributor.add_op_with_no_owner(
         GenericProtocolBufferOp(Operation.SELECTABLE_SIMS_UPDATE, msg))
Exemplo n.º 2
0
 def send_selectable_sims_update(self):
     msg = Sims_pb2.UpdateSelectableSims()
     for sim_info in self._selectable_sims:
         with ProtocolBufferRollback(msg.sims) as new_sim:
             new_sim.id = sim_info.sim_id
             new_sim.at_work = sim_info.career_tracker.currently_at_work
             new_sim.is_selectable = sim_info.is_enabled_in_skewer
             (selector_visual_type, career_category) = self._get_selector_visual_type(sim_info)
             new_sim.selector_visual_type = selector_visual_type
             if career_category is not None:
                 new_sim.career_category = career_category
             while not sim_info.is_instanced(allow_hidden_flags=ALL_HIDDEN_REASONS):
                 new_sim.instance_info.zone_id = sim_info.zone_id
                 new_sim.instance_info.world_id = sim_info.world_id
                 new_sim.firstname = sim_info.first_name
                 new_sim.lastname = sim_info.last_name
                 zone_data_proto = services.get_persistence_service().get_zone_proto_buff(sim_info.zone_id)
                 while zone_data_proto is not None:
                     new_sim.instance_info.zone_name = zone_data_proto.name
     distributor = Distributor.instance()
     distributor.add_op_with_no_owner(GenericProtocolBufferOp(Operation.SELECTABLE_SIMS_UPDATE, msg))