def __call__(self, sim_infos, host_sim_info=None):
     npc_infos = []
     selectable_and_resident_infos = []
     for sim_info in sim_infos:
         if sim_info.is_npc and not sim_info.lives_here:
             npc_infos.append(sim_info)
         else:
             selectable_and_resident_infos.append(sim_info)
     if npc_infos:
         player_lot_id = services.active_household_lot_id()
         active_lot_id = services.active_lot_id()
         if active_lot_id == player_lot_id:
             if self.player_sim_lot is not None:
                 self.player_sim_lot(npc_infos, host_sim_info)
                 if services.get_zone_situation_manager().is_player_greeted():
                     if self.npc_lot_greeted is not None:
                         self.npc_lot_greeted(npc_infos, host_sim_info)
                         if self.npc_lot_ungreeted is not None:
                             self.npc_lot_ungreeted(npc_infos, host_sim_info)
                 elif self.npc_lot_ungreeted is not None:
                     self.npc_lot_ungreeted(npc_infos, host_sim_info)
         elif services.get_zone_situation_manager().is_player_greeted():
             if self.npc_lot_greeted is not None:
                 self.npc_lot_greeted(npc_infos, host_sim_info)
                 if self.npc_lot_ungreeted is not None:
                     self.npc_lot_ungreeted(npc_infos, host_sim_info)
         elif self.npc_lot_ungreeted is not None:
             self.npc_lot_ungreeted(npc_infos, host_sim_info)
     for sim_info in selectable_and_resident_infos:
         while sim_info.get_sim_instance() is None:
             op = distributor.ops.TravelBringToZone([sim_info.sim_id, 0, services.current_zone().id, 0])
             distributor.system.Distributor.instance().add_op_with_no_owner(op)
 def _can_start_walkby(cls, lot_id: int):
     if not super()._can_start_walkby(lot_id):
         return False
     active_lot_id = services.active_household_lot_id()
     if active_lot_id is None:
         return False
     return lot_id == active_lot_id
 def __call__(self, npc_infos):
     situation_manager = services.get_zone_situation_manager()
     player_lot_id = services.active_household_lot_id()
     active_lot_id = services.active_lot_id()
     for sim_info in npc_infos:
         npc = sim_info.get_sim_instance()
         if npc is None:
             pass
         greeted_status = situation_manager.get_npc_greeted_status_during_zone_fixup(
             sim_info)
         if active_lot_id == player_lot_id:
             logger.debug('Player lot greeted {} during zone fixup',
                          sim_info,
                          owner='sscholl')
             self.player_lot_greeted((sim_info, ))
         elif greeted_status == GreetedStatus.WAITING_TO_BE_GREETED:
             logger.debug(
                 'NPC lot waiting to be greeted {} during zone fixup',
                 sim_info,
                 owner='sscholl')
             self.npc_lot_ungreeted((sim_info, ))
         elif greeted_status == GreetedStatus.GREETED:
             logger.debug('NPC lot greeted {} during zone fixup',
                          sim_info,
                          owner='sscholl')
             self.npc_lot_greeted((sim_info, ))
         else:
             logger.debug('No option for {} during zone fixup',
                          sim_info,
                          owner='sscholl')
 def can_start_walkby(cls, lot_id):
     if services.get_zone_situation_manager(
     ).is_situation_with_tags_running(cls.can_start_walkby_limiting_tags):
         return False
     active_lot_id = services.active_household_lot_id()
     if active_lot_id is None:
         return False
     return lot_id == active_lot_id
Exemple #5
0
def request_club_invite(club_id: int, _connection=None):
    sim_info = services.active_sim_info()
    if sim_info is None:
        return
    club_service = services.get_club_service()
    if club_service is None:
        return
    club = club_service.get_club_by_id(club_id)
    if club is None:
        return
    if any(club_member.is_selectable for club_member in club.members):
        club.show_club_notification(
            sim_info,
            ClubTunables.CLUB_GATHERING_DIALOG_REQUEST_INVITE_ACTIVE_SIM)
    elif club in club_service.clubs_to_gatherings_map:
        club.show_club_notification(
            sim_info,
            ClubTunables.CLUB_GATHERING_DIALOG_REQUEST_INVITE_CURRENT_LOT)
    else:
        club_hangout_zone_id = club.get_hangout_zone_id()
        if club.hangout_setting == ClubHangoutSetting.HANGOUT_LOT:
            current_region = services.current_region()
            hangout_region = get_region_instance_from_zone_id(
                club_hangout_zone_id)
            if not current_region.is_region_compatible(hangout_region):
                club.show_club_notification(
                    sim_info,
                    ClubTunables.
                    CLUB_GATHERING_DIALOG_REQUEST_INVITE_UNAVAILABLE,
                    target_sim_id=club.leader.sim_id)
                return
        elif not club_hangout_zone_id:
            if services.active_lot_id() == services.active_household_lot_id():

                def on_response(dialog):
                    if dialog.accepted:
                        club_service.start_gathering(
                            club,
                            host_sim_id=sim_info.sim_id,
                            invited_sims=(sim_info, ),
                            ignore_zone_validity=True)

                club.show_club_notification(
                    sim_info,
                    ClubTunables.CLUB_GATHERING_DIALOG_REQUEST_INVITE_NO_LOT,
                    target_sim_id=club.leader.sim_id,
                    on_response=on_response)
            else:
                club.show_club_notification(
                    sim_info,
                    ClubTunables.
                    CLUB_GATHERING_DIALOG_REQUEST_INVITE_NO_LOT_NOT_HOME,
                    target_sim_id=club.leader.sim_id)
            return
        club.show_club_gathering_dialog(
            sim_info,
            flavor_text=ClubTunables.CLUB_GATHERING_DIALOG_TEXT_REQUEST_INVITE,
            start_source=ClubGatheringStartSource.APPLY_FOR_INVITE)
 def __call__(self, npc_infos):
     situation_manager = services.get_zone_situation_manager()
     player_lot_id = services.active_household_lot_id()
     active_lot_id = services.active_lot_id()
     for sim_info in npc_infos:
         npc = sim_info.get_sim_instance()
         if npc is None:
             pass
         greeted_status = situation_manager.get_npc_greeted_status_during_zone_fixup(sim_info)
         if active_lot_id == player_lot_id:
             logger.debug('Player lot greeted {} during zone fixup', sim_info, owner='sscholl')
             self.player_lot_greeted((sim_info,))
         elif greeted_status == GreetedStatus.WAITING_TO_BE_GREETED:
             logger.debug('NPC lot waiting to be greeted {} during zone fixup', sim_info, owner='sscholl')
             self.npc_lot_ungreeted((sim_info,))
         elif greeted_status == GreetedStatus.GREETED:
             logger.debug('NPC lot greeted {} during zone fixup', sim_info, owner='sscholl')
             self.npc_lot_greeted((sim_info,))
         else:
             logger.debug('No option for {} during zone fixup', sim_info, owner='sscholl')
Exemple #7
0
 def _handle_curfew_message_callback(self, handle):
     active_lot = services.active_lot()
     if active_lot.lot_id != services.active_household_lot_id():
         from_sim = None
         for sim_info in services.active_household():
             if sim_info.is_young_adult_or_older:
                 if not sim_info.is_instanced():
                     from_sim = sim_info
                     break
         if from_sim is None:
             return
         for sim_info in services.active_household():
             if sim_info.get_sim_instance() is None:
                 continue
             resolver = DoubleSimResolver(sim_info, from_sim)
             if not CurfewService.CURFEW_WARNING_SIM_TESTS.run_tests(
                     resolver):
                 continue
             dialog = self.CURFEW_WARNING_TEXT_MESSAGE_DIALOG(
                 sim_info, target_sim_id=from_sim.id, resolver=resolver)
             dialog.show_dialog()
 def __call__(self, sim_infos, host_sim_info=None):
     npc_infos = []
     selectable_and_resident_infos = []
     for sim_info in sim_infos:
         if sim_info.is_npc and not sim_info.lives_here:
             npc_infos.append(sim_info)
         else:
             selectable_and_resident_infos.append(sim_info)
     if npc_infos:
         player_lot_id = services.active_household_lot_id()
         active_lot_id = services.active_lot_id()
         if active_lot_id == player_lot_id:
             if self.player_sim_lot is not None:
                 self.player_sim_lot(npc_infos, host_sim_info)
                 if services.get_zone_situation_manager().is_player_greeted(
                 ):
                     if self.npc_lot_greeted is not None:
                         self.npc_lot_greeted(npc_infos, host_sim_info)
                         if self.npc_lot_ungreeted is not None:
                             self.npc_lot_ungreeted(npc_infos,
                                                    host_sim_info)
                 elif self.npc_lot_ungreeted is not None:
                     self.npc_lot_ungreeted(npc_infos, host_sim_info)
         elif services.get_zone_situation_manager().is_player_greeted():
             if self.npc_lot_greeted is not None:
                 self.npc_lot_greeted(npc_infos, host_sim_info)
                 if self.npc_lot_ungreeted is not None:
                     self.npc_lot_ungreeted(npc_infos, host_sim_info)
         elif self.npc_lot_ungreeted is not None:
             self.npc_lot_ungreeted(npc_infos, host_sim_info)
     for sim_info in selectable_and_resident_infos:
         while sim_info.get_sim_instance() is None:
             op = distributor.ops.TravelBringToZone(
                 [sim_info.sim_id, 0,
                  services.current_zone().id, 0])
             distributor.system.Distributor.instance().add_op_with_no_owner(
                 op)
 def is_validity_overridden(self):
     return self._validity_household_id_override == services.active_household_id() and services.active_household_lot_id() == services.active_lot_id()
 def check_collection_complete(self,
                               collection_id,
                               is_base_collection=True):
     collection_data = ObjectCollectionData.get_collection_data(
         collection_id)
     collection_count = len(collection_data.object_list)
     (collected_count, bonus_collected_count
      ) = self.get_num_collected_items_per_collection_id(collection_id)
     if not (collection_count and collected_count):
         return
     client = services.client_manager().get_client_by_household(self._owner)
     if client is not None and client.active_sim is not None:
         message_owner_info = client.active_sim.sim_info
     else:
         message_owner_info = None
     if collection_data.first_collected_notification is not None and message_owner_info is not None and collected_count + bonus_collected_count == 1:
         dialog = collection_data.first_collected_notification(
             message_owner_info, None)
         dialog.show_dialog()
     if is_base_collection and collection_count == collected_count:
         if client is not None:
             with telemetry_helper.begin_hook(
                     collection_telemetry_writer,
                     TELEMETRY_HOOK_COLLECTION_COMPLETE,
                     household=client.household) as hook:
                 hook.write_int(TELEMETRY_COLLECTION_ID, collection_id)
             _sting = ObjectCollectionData.COLLECTION_COMPLETED_STING(
                 client.active_sim)
             _sting.start()
         if message_owner_info is not None:
             dialog = collection_data.completed_award_notification(
                 message_owner_info, None)
             dialog.show_dialog()
             if collection_data.screen_slam is not None:
                 collection_data.screen_slam.send_screen_slam_message(
                     message_owner_info, collection_data.collection_name)
         lot = services.active_lot()
         if lot is not None and collection_data.completed_award is not None:
             award_object = None
             if lot.lot_id == services.active_household_lot_id():
                 award_object = lot.create_object_in_hidden_inventory(
                     collection_data.completed_award)
             else:
                 award_object = create_object(
                     collection_data.completed_award,
                     loc_type=ItemLocation.HOUSEHOLD_INVENTORY)
                 build_buy.move_object_to_household_inventory(
                     award_object,
                     failure_flags=HouseholdInventoryFlags.FORCE_OWNERSHIP)
             if award_object is not None:
                 key = sims4.resources.Key(sims4.resources.Types.OBJCATALOG,
                                           award_object.definition.id)
                 self.owner.add_build_buy_unlock(key)
         household = services.household_manager().get(self._owner.id)
         if household is not None:
             household.funds.add(
                 collection_data.completed_award_money,
                 Consts_pb2.TELEMETRY_MONEY_ASPIRATION_REWARD, None)
     elif client is not None:
         _sting = ObjectCollectionData.COLLECTION_COLLECTED_STING(
             client.active_sim)
         _sting.start()