def _setup_dialog_rows(
        self,
        sim_info: SimInfo,
        _dialog: UiOutfitPicker,
        outfit_list: Iterator[Tuple[OutfitCategory, int]]=()
    ):
        self.log.debug('Adding rows.')
        sim_id = CommonSimUtils.get_sim_id(sim_info)
        added_rows = False
        current_outfit = CommonOutfitUtils.get_current_outfit(sim_info)
        for (outfit_category, outfit_index) in outfit_list:
            # noinspection PyTypeChecker
            if not CommonOutfitUtils.has_outfit(sim_info, (outfit_category, outfit_index)) and not CommonOutfitUtils.has_outfit(sim_info, (int(outfit_category), outfit_index)):
                self.log.format_with_message('Sim does not have outfit.', sim=sim_info, outfit_category_and_index=(outfit_category, outfit_index))
                continue
            added_rows = True
            _dialog.add_row(
                OutfitPickerRow(
                    sim_id,
                    outfit_category,
                    outfit_index,
                    is_enable=True,
                    is_selected=(outfit_category, outfit_index) == current_outfit,
                    tag=(outfit_category, outfit_index)
                )
            )

        for row in self.rows:
            _dialog.add_row(row)

        if not added_rows and len(self.rows) == 0:
            raise AssertionError('No rows have been provided. Add rows to the dialog before attempting to display it.')
 def on_started(self, interaction_sim: Sim,
                interaction_target: Sim) -> bool:
     target_sim_info = CommonSimUtils.get_sim_info(interaction_target)
     bathing_outfit_category_and_index = (OutfitCategory.BATHING, 0)
     if not CommonOutfitUtils.has_outfit(target_sim_info,
                                         bathing_outfit_category_and_index):
         if not CommonOutfitUtils.generate_outfit(
                 target_sim_info, bathing_outfit_category_and_index):
             self.log.format_with_message(
                 'Failed to generate the bathing outfit for Sim.',
                 sim=target_sim_info)
             return False
     CommonOutfitUtils.set_current_outfit(
         target_sim_info, bathing_outfit_category_and_index)
     return True
Ejemplo n.º 3
0
    def _regenerate_every_outfit(self, sim_info: SimInfo) -> bool:
        result = False
        for occult_base_sim_info in CommonOccultUtils.get_sim_info_for_all_occults_gen(
                sim_info, (OccultType.MERMAID, )):
            for outfit_category in CommonOutfitUtils.get_all_outfit_categories(
            ):
                for outfit_index in range(
                        get_maximum_outfits_for_category(outfit_category)):
                    if not CommonOutfitUtils.has_outfit(
                            occult_base_sim_info,
                        (outfit_category, outfit_index)):
                        continue

                    if CommonOutfitUtils.generate_outfit(
                            occult_base_sim_info,
                            outfit_category_and_index=(outfit_category,
                                                       outfit_index)):
                        result = True

        if result:
            CommonOutfitUtils.update_outfits(sim_info)
        return result