Exemplo n.º 1
0
    def pay_bill(self):
        if self._current_payment_owed:
            for status in self._utility_delinquency.values():
                while status:
                    play_tunable_audio(self.AUDIO.delinquency_removed_sfx)
                    break
            play_tunable_audio(self.AUDIO.bills_paid_sfx)
        self._current_payment_owed = None
        self._clear_delinquency_status()
        self._set_up_bill_timer()

        def remove_from_inventory(inventory):
            for obj in [
                    obj for obj in inventory
                    if obj.definition is self.BILL_OBJECT
            ]:
                obj.destroy(source=inventory, cause='Paying bills.')

        lot = self._get_lot()
        if lot is not None:
            for (_, inventory) in lot.get_all_object_inventories_gen():
                remove_from_inventory(inventory)
        for sim_info in self._household:
            sim = sim_info.get_sim_instance()
            while sim is not None:
                remove_from_inventory(sim.inventory_component)
        self._put_bill_in_hidden_inventory = False
Exemplo n.º 2
0
 def show_dialog(self, on_response=None, **kwargs):
     if self.audio_sting is not None:
         play_tunable_audio(self.audio_sting, None)
     if on_response is not None:
         self.add_listener(on_response)
     pythonutils.try_highwater_gc()
     services.ui_dialog_service().dialog_show(self, self.phone_ring_type, **kwargs)
Exemplo n.º 3
0
 def show_dialog(self, on_response=None, **kwargs):
     if self.audio_sting is not None:
         play_tunable_audio(self.audio_sting, None)
     if on_response is not None:
         self.add_listener(on_response)
     pythonutils.try_highwater_gc()
     services.ui_dialog_service().dialog_show(self, self.phone_ring_type,
                                              **kwargs)
Exemplo n.º 4
0
 def start(self):
     if self.dialog_on_activation is not None:
         resolver = GlobalResolver()
         if self.dialog_on_activation.tests.run_tests(resolver):
             dialog = self.dialog_on_activation.dialog(None,
                                                       resolver=resolver)
             dialog.show_dialog()
     if self.audio_sting is not None:
         play_tunable_audio(self.audio_sting)
     if self.sim_info_loots is not None:
         services.narrative_service().add_sliced_sim_info_loots(
             self.sim_info_loots.loots,
             self.sim_info_loots.save_lock_tooltip)
Exemplo n.º 5
0
 def _send_notification(self, notification):
     if not self.bill_notifications_enabled:
         return
     client = services.client_manager().get_client_by_household(self._household)
     if client is not None:
         active_sim = client.active_sim
         if active_sim is not None:
             remaining_time = max(int(self._shutoff_handle.get_remaining_time().in_hours()), 0)
             dialog = notification(active_sim, None)
             dialog.show_dialog(additional_tokens=(remaining_time, self._current_payment_owed))
     current_time = services.time_service().sim_now
     if self._warning_handle is not None and self._warning_handle.finishing_time <= current_time:
         alarms.cancel_alarm(self._warning_handle)
         self._warning_handle = None
         play_tunable_audio(self.AUDIO.delinquency_warning_sfx)
Exemplo n.º 6
0
 def _shut_off_utility(self, utility):
     if self._current_payment_owed == None:
         self._clear_delinquency_status()
         logger.error('Household {} is getting a utility shut off without actually owing any money. Resetting delinquency status.', self._household, owner='tastle')
         return
     shutoff_notification = self.UTILITY_INFO[utility].shutoff_notification
     self._send_notification(shutoff_notification)
     if self._shutoff_handle is not None:
         alarms.cancel_alarm(self._shutoff_handle)
         self._shutoff_handle = None
     self._utility_delinquency[utility] = True
     self._set_next_delinquency_timers()
     self._cancel_delinquent_interactions(utility)
     if utility == Utilities.POWER:
         self._stop_all_power_utilities()
     play_tunable_audio(self.AUDIO.delinquency_activation_sfx)
Exemplo n.º 7
0
 def send_screen_slam_message(self, sim_info, *localization_tokens):
     msg = protocolbuffers.UI_pb2.UiScreenSlam()
     msg.type = self.screen_slam_size
     msg.size = self.screen_slam_size
     msg.name = self.text(*(token for token in itertools.chain(localization_tokens)))
     if sim_info is not None:
         msg.sim_id = sim_info.sim_id
     if self.icon is not None:
         msg.icon.group = self.icon.group
         msg.icon.instance = self.icon.instance
         msg.icon.type = self.icon.type
     if self.title is not None:
         msg.title = self.title(*(token for token in itertools.chain(localization_tokens)))
     if self.active_sim_only and sim_info is not None and sim_info.is_selected or not self.active_sim_only:
         distributor.shared_messages.add_message_if_player_controlled_sim(sim_info, protocolbuffers.Consts_pb2.MSG_UI_SCREEN_SLAM, msg, False)
         if self.audio_sting is not None:
             play_tunable_audio(self.audio_sting)
Exemplo n.º 8
0
 def send_screen_slam_message(self, sim_info, *localization_tokens):
     msg = protocolbuffers.UI_pb2.UiScreenSlam()
     self.display_type.populate_screenslam_message(msg)
     if self.text is not None:
         msg.name = self.text(*(token for token in itertools.chain(localization_tokens)))
     if sim_info is not None:
         msg.sim_id = sim_info.sim_id
     if self.icon is not None:
         msg.icon.group = self.icon.group
         msg.icon.instance = self.icon.instance
         msg.icon.type = self.icon.type
     if self.title is not None:
         msg.title = self.title(*(token for token in itertools.chain(localization_tokens)))
     if self.active_sim_only and sim_info is not None and sim_info.is_selected or not self.active_sim_only:
         distributor.shared_messages.add_message_if_player_controlled_sim(sim_info, protocolbuffers.Consts_pb2.MSG_UI_SCREEN_SLAM, msg, False)
         if self.audio_sting is not None:
             play_tunable_audio(self.audio_sting)
Exemplo n.º 9
0
 def _do_behavior(self):
     subject = self.interaction.get_participant(self.subject)
     if subject is not None or not self.stop_audio_on_end:
         self._sound = play_tunable_audio(self.audio_sting, subject)
     else:
         logger.error(
             'Expecting to start and stop a TunableAudioSting during {} on a subject that is None.'
             .format(self.interaction),
             owner='rmccord')
Exemplo n.º 10
0
 def _shut_off_utility(self, utility):
     if self._current_payment_owed == None:
         self._clear_delinquency_status()
         logger.error(
             'Household {} is getting a utility shut off without actually owing any money. Resetting delinquency status.',
             self._household,
             owner='tastle')
         return
     shutoff_notification = self.UTILITY_INFO[utility].shutoff_notification
     self._send_notification(shutoff_notification)
     if self._shutoff_handle is not None:
         alarms.cancel_alarm(self._shutoff_handle)
         self._shutoff_handle = None
     self._utility_delinquency[utility] = True
     self._set_next_delinquency_timers()
     self._cancel_delinquent_interactions(utility)
     if utility == Utilities.POWER:
         self._stop_all_power_utilities()
     play_tunable_audio(self.AUDIO.delinquency_activation_sfx)
Exemplo n.º 11
0
 def on_spawn_sims_for_zone_spin_up(self, client):
     current_zone = services.current_zone()
     for sim_id in tuple(self._sims_traveled_to_zone):
         if sim_id == 0:
             self._sims_traveled_to_zone.remove(sim_id)
         sim_info = self.get(sim_id)
         if sim_info is None:
             logger.error('sim id {} for traveling did not spawn because sim info does not exist.', sim_id, owner='msantander')
         self._spawn_sim(sim_info, startup_location=None)
         while sim_info.get_current_outfit()[0] == OutfitCategory.SLEEP:
             random_everyday_outfit = sim_info.sim_outfits.get_random_outfit([OutfitCategory.EVERYDAY])
             sim_info.set_current_outfit(random_everyday_outfit)
     if self._sims_traveled_to_zone:
         play_tunable_audio(TravelTuning.TRAVEL_SUCCESS_AUDIO_STING)
     else:
         play_tunable_audio(TravelTuning.NEW_GAME_AUDIO_STING)
     current_zone_owner_household_id = current_zone.lot.owner_household_id
     if current_zone_owner_household_id != 0:
         zone_owner_household = services.household_manager().get(current_zone_owner_household_id)
         if zone_owner_household is not None:
             zone_household_is_active_household = client.household.id == zone_owner_household.id
             any_members_spawned = self._spawn_lot_owner_household(zone_owner_household, zone_household_is_active_household)
             if zone_household_is_active_household and not any_members_spawned:
                 self._clear_return_sim_to_home_lot_alarm_handles()
                 while True:
                     for sim_info in zone_owner_household.sim_info_gen():
                         while not sim_info.is_dead:
                             logger.debug('Force spawn household sim:{}', sim_info, owner='sscholl')
                             self._spawn_sim(sim_info, startup_location=None)
     for sim_info in self._sim_infos_saved_in_zone:
         result = self._should_spawn_zone_saved_sim(sim_info)
         logger.debug('Should spawn zone sim:{} {}', sim_info, bool(result), owner='sscholl')
         while result:
             self._spawn_sim(sim_info, startup_location=result.startup_location)
     for sim_info in self._sim_infos_saved_in_open_street:
         result = self._should_spawn_open_street_saved_sim(sim_info)
         logger.debug('Should spawn open street sim:{} {}', sim_info, bool(result), owner='sscholl')
         while result:
             self._spawn_sim(sim_info, startup_location=result.startup_location)
             if len(self._sims_traveled_to_zone) > 0 and (client.household is not None and client.household.get_sim_info_by_id(sim_info.sim_id)) and sim_info.sim_id not in self._sims_traveled_to_zone:
                 self._sim_ids_to_push_go_home.append(sim_info.sim_id)
     self._on_spawn_sim_for_zone_spin_up_completed(client)
Exemplo n.º 12
0
 def _send_notification(self, notification):
     if not self.bill_notifications_enabled:
         return
     client = services.client_manager().get_client_by_household(
         self._household)
     if client is not None:
         active_sim = client.active_sim
         if active_sim is not None:
             remaining_time = max(
                 int(self._shutoff_handle.get_remaining_time().in_hours()),
                 0)
             dialog = notification(active_sim, None)
             dialog.show_dialog(
                 additional_tokens=(remaining_time,
                                    self._current_payment_owed))
     current_time = services.time_service().sim_now
     if self._warning_handle is not None and self._warning_handle.finishing_time <= current_time:
         alarms.cancel_alarm(self._warning_handle)
         self._warning_handle = None
         play_tunable_audio(self.AUDIO.delinquency_warning_sfx)
Exemplo n.º 13
0
 def _handle_promotion(self):
     self._pending_promotion = True
     previous_level_tuning = self.current_level_tuning
     previous_salary = self.get_hourly_pay()
     previous_highest_level = self._sim_info.career_tracker.get_highest_level_reached(self.guid64)
     try:
         yield None
     finally:
         if self.current_level_tuning is not previous_level_tuning:
             self._pending_promotion = False
             if self.user_level > previous_highest_level and self.current_level_tuning.promotion_reward is not None:
                 reward_payout = self.current_level_tuning.promotion_reward.give_reward(self._sim_info)
                 reward_text = LocalizationHelperTuning.get_bulleted_list(None, *(reward.get_display_text() for reward in reward_payout))
             else:
                 reward_text = None
             (_, next_work_time, _) = self.get_next_work_time()
             salary = self.get_hourly_pay()
             salary_increase = salary - previous_salary
             level_text = self.current_level_tuning.promotion_notification_text(self._sim_info)
             is_not_school = not self.get_is_school()
             if reward_text is None:
                 self.send_career_message(self.career_messages.promote_career_rewardless_notification, next_work_time, salary, salary_increase, level_text, display_career_info=is_not_school)
             else:
                 self.send_career_message(self.career_messages.promote_career_notification, next_work_time, salary, salary_increase, level_text, reward_text, display_career_info=is_not_school)
             promotion_sting = self.current_level_tuning.promotion_audio_sting
             if promotion_sting is not None:
                 play_tunable_audio(promotion_sting)
             if self.current_level_tuning.screen_slam is not None:
                 self.current_level_tuning.screen_slam.send_screen_slam_message(self._sim_info, self._sim_info, self.current_level_tuning.title(self._sim_info), self.user_level, self.current_track_tuning.career_name(self._sim_info))
             if self.has_outfit():
                 self._sim_info.refresh_current_outfit()
             else:
                 new_outfit = self._sim_info._outfits.get_outfit_for_clothing_change(None, OutfitChangeReason.DefaultOutfit, resolver=SingleSimResolver(self._sim_info))
                 self._sim_info.set_current_outfit(new_outfit)
             with telemetry_helper.begin_hook(career_telemetry_writer, TELEMETRY_HOOK_CAREER_PROMOTION, sim=self._sim_info) as hook:
                 hook.write_int(TELEMETRY_CAREER_ID, self.guid64)
                 hook.write_int(TELEMETRY_CAREER_LEVEL, self._user_level)
                 hook.write_guid(TELEMETRY_TRACK_ID, self._current_track.guid64)
                 hook.write_int(TELEMETRY_TRACK_LEVEL, self._level)
Exemplo n.º 14
0
 def on_spawn_sims_for_zone_spin_up(self, client):
     traveled_sim_infos = []
     for sim_id in tuple(self._sims_traveled_to_zone):
         if sim_id == 0:
             self._sims_traveled_to_zone.remove(sim_id)
         else:
             sim_info = self.get(sim_id)
             if sim_info is None:
                 logger.error('sim id {} for traveling did not spawn because sim info does not exist.', sim_id, owner='msantander')
             else:
                 traveled_sim_infos.append(sim_info)
     narrative_service = services.narrative_service()
     if not narrative_service.should_suppress_travel_sting():
         lot_tuning = world.lot_tuning.LotTuningMaps.get_lot_tuning()
         if lot_tuning is not None and lot_tuning.audio_sting is not None:
             sting = lot_tuning.audio_sting(None)
             sting.start()
         elif traveled_sim_infos:
             play_tunable_audio(TravelTuning.TRAVEL_SUCCESS_AUDIO_STING)
         else:
             play_tunable_audio(TravelTuning.NEW_GAME_AUDIO_STING)
     services.current_zone().venue_service.process_traveled_and_persisted_and_resident_sims_during_zone_spin_up(traveled_sim_infos, self._sim_infos_saved_in_zone, self._sim_infos_saved_in_plex_group, self._sim_infos_saved_in_open_street, self._sim_infos_injected_into_zone)
Exemplo n.º 15
0
    def pay_bill(self):
        if self._current_payment_owed:
            for status in self._utility_delinquency.values():
                while status:
                    play_tunable_audio(self.AUDIO.delinquency_removed_sfx)
                    break
            play_tunable_audio(self.AUDIO.bills_paid_sfx)
        self._current_payment_owed = None
        self._clear_delinquency_status()
        self._set_up_bill_timer()

        def remove_from_inventory(inventory):
            for obj in [obj for obj in inventory if obj.definition is self.BILL_OBJECT]:
                obj.destroy(source=inventory, cause='Paying bills.')

        lot = self._get_lot()
        if lot is not None:
            for (_, inventory) in lot.get_all_object_inventories_gen():
                remove_from_inventory(inventory)
        for sim_info in self._household:
            sim = sim_info.get_sim_instance()
            while sim is not None:
                remove_from_inventory(sim.inventory_component)
        self._put_bill_in_hidden_inventory = False
Exemplo n.º 16
0
 def on_spawn_sims_for_zone_spin_up(self, client):
     current_zone = services.current_zone()
     for sim_id in tuple(self._sims_traveled_to_zone):
         if sim_id == 0:
             self._sims_traveled_to_zone.remove(sim_id)
         sim_info = self.get(sim_id)
         if sim_info is None:
             logger.error(
                 'sim id {} for traveling did not spawn because sim info does not exist.',
                 sim_id,
                 owner='msantander')
         self._spawn_sim(sim_info, startup_location=None)
         while sim_info.get_current_outfit()[0] == OutfitCategory.SLEEP:
             random_everyday_outfit = sim_info.sim_outfits.get_random_outfit(
                 [OutfitCategory.EVERYDAY])
             sim_info.set_current_outfit(random_everyday_outfit)
     if self._sims_traveled_to_zone:
         play_tunable_audio(TravelTuning.TRAVEL_SUCCESS_AUDIO_STING)
     else:
         play_tunable_audio(TravelTuning.NEW_GAME_AUDIO_STING)
     current_zone_owner_household_id = current_zone.lot.owner_household_id
     if current_zone_owner_household_id != 0:
         zone_owner_household = services.household_manager().get(
             current_zone_owner_household_id)
         if zone_owner_household is not None:
             zone_household_is_active_household = client.household.id == zone_owner_household.id
             any_members_spawned = self._spawn_lot_owner_household(
                 zone_owner_household, zone_household_is_active_household)
             if zone_household_is_active_household and not any_members_spawned:
                 self._clear_return_sim_to_home_lot_alarm_handles()
                 while True:
                     for sim_info in zone_owner_household.sim_info_gen():
                         while not sim_info.is_dead:
                             logger.debug('Force spawn household sim:{}',
                                          sim_info,
                                          owner='sscholl')
                             self._spawn_sim(sim_info,
                                             startup_location=None)
     for sim_info in self._sim_infos_saved_in_zone:
         result = self._should_spawn_zone_saved_sim(sim_info)
         logger.debug('Should spawn zone sim:{} {}',
                      sim_info,
                      bool(result),
                      owner='sscholl')
         while result:
             self._spawn_sim(sim_info,
                             startup_location=result.startup_location)
     for sim_info in self._sim_infos_saved_in_open_street:
         result = self._should_spawn_open_street_saved_sim(sim_info)
         logger.debug('Should spawn open street sim:{} {}',
                      sim_info,
                      bool(result),
                      owner='sscholl')
         while result:
             self._spawn_sim(sim_info,
                             startup_location=result.startup_location)
             if len(self._sims_traveled_to_zone) > 0 and (
                     client.household is not None and
                     client.household.get_sim_info_by_id(sim_info.sim_id)
             ) and sim_info.sim_id not in self._sims_traveled_to_zone:
                 self._sim_ids_to_push_go_home.append(sim_info.sim_id)
     self._on_spawn_sim_for_zone_spin_up_completed(client)
 def _post_performance_wrap_callout(self, _):
     play_tunable_audio(self.thats_a_wrap_audio)
     self._post_performance_state_alarm = alarms.add_alarm(self, self.post_performance_time_between_wrap_and_lights(), self._post_performance_state_change)
Exemplo n.º 18
0
 def _apply_to_subject_and_target(self, subject, target, resolver):
     play_tunable_audio(self._audio)
Exemplo n.º 19
0
	def show_dialog (self, **kwargs):
		if self.audio_sting is not None:
			play_tunable_audio(self.audio_sting, None)
		if self.phone_ring_type == PhoneRingType.ALARM:
			return super().show_dialog(caller_id = self._owner().id, **kwargs)
		return super().show_dialog(caller_id = self._target_sim_id, **kwargs)