def get_valid_motives(self, sim_info: SimInfo) -> Tuple[str]:
     """ Retrieve a collection of all valid motives. """
     motives: Tuple[str] = tuple()
     if CommonOccultUtils.is_vampire(sim_info):
         motives += (CMMotive.SOCIAL, CMMotive.FUN, CMMotive.HYGIENE,
                     CMMotive.VAMPIRE_THIRST, CMMotive.VAMPIRE_POWER)
     elif CommonOccultUtils.is_robot(sim_info):
         motives += (CMMotive.SOCIAL, CMMotive.FUN,
                     CMMotive.SERVO_DURABILITY, CMMotive.SERVO_CHARGE)
     elif CommonOccultUtils.is_plant_sim(sim_info):
         motives += (
             CMMotive.SOCIAL,
             CMMotive.FUN,
             CMMotive.HYGIENE,
             CMMotive.HUNGER,
             CMMotive.ENERGY,
             CMMotive.PLANT_SIM_WATER,
         )
     else:
         motives += (CMMotive.SOCIAL, CMMotive.FUN, CMMotive.HYGIENE,
                     CMMotive.HUNGER, CMMotive.ENERGY, CMMotive.BLADDER)
     if CommonSpeciesUtils.is_pet(sim_info):
         motives += (CMMotive.BOWEL, )
     trimmed_result: List[str] = list()
     for motive in motives:
         trimmed_result.append(motive.replace('CMMotive.', '').lower())
     return tuple(trimmed_result)
    def determine_current_occult_type(sim_info: SimInfo) -> 'CommonOccultType':
        """determine_current_occult_type(sim_info)

        Determine the type of Occult a Sim is currently appearing as.
        i.e. A mermaid with their tail out would currently be a MERMAID. But a Mermaid Sim with no tail out would currently be a CommonOccultType.NONE

        :param sim_info: An instance of a Sim.
        :type sim_info: SimInfo
        :return: The CommonOccultType the Sim is currently appearing as, or CommonOccultType.NONE if they are not appearing as any Occult or are appearing as their HUMAN disguise/occult.
        :rtype: CommonOccultType
        """
        from sims4communitylib.utils.sims.common_occult_utils import CommonOccultUtils
        if CommonOccultUtils.is_currently_a_mermaid(
                sim_info) or CommonOccultUtils.is_mermaid_in_mermaid_form(
                    sim_info):
            return CommonOccultType.MERMAID
        elif CommonOccultUtils.is_robot(sim_info):
            return CommonOccultType.ROBOT
        elif CommonOccultUtils.is_currently_a_vampire(sim_info):
            return CommonOccultType.VAMPIRE
        elif CommonOccultUtils.is_currently_a_witch(sim_info):
            return CommonOccultType.WITCH
        elif CommonOccultUtils.is_currently_an_alien(sim_info):
            return CommonOccultType.ALIEN
        elif CommonOccultUtils.is_plant_sim(sim_info):
            return CommonOccultType.PLANT_SIM
        elif CommonOccultUtils.is_ghost(sim_info):
            return CommonOccultType.GHOST
        elif CommonOccultUtils.is_skeleton(sim_info):
            return CommonOccultType.SKELETON
        return CommonOccultType.NON_OCCULT
    def determine_occult_type(sim_info: SimInfo) -> 'CommonOccultType':
        """determine_occult_type(sim_info)

        Determine the type of Occult a Sim is.

        :param sim_info: An instance of a Sim.
        :type sim_info: SimInfo
        :return: The CommonOccultType that represents what a Sim is.
        :rtype: CommonOccultType
        """
        from sims4communitylib.utils.sims.common_occult_utils import CommonOccultUtils
        if CommonOccultUtils.is_robot(sim_info):
            return CommonOccultType.ROBOT
        elif CommonOccultUtils.is_alien(sim_info):
            return CommonOccultType.ALIEN
        elif CommonOccultUtils.is_ghost(sim_info):
            return CommonOccultType.GHOST
        elif CommonOccultUtils.is_mermaid(sim_info):
            return CommonOccultType.MERMAID
        elif CommonOccultUtils.is_plant_sim(sim_info):
            return CommonOccultType.PLANT_SIM
        elif CommonOccultUtils.is_skeleton(sim_info):
            return CommonOccultType.SKELETON
        elif CommonOccultUtils.is_vampire(sim_info):
            return CommonOccultType.VAMPIRE
        elif CommonOccultUtils.is_witch(sim_info):
            return CommonOccultType.WITCH
        return CommonOccultType.NON_OCCULT
Example #4
0
    def run(
        self,
        sim_info: SimInfo,
        on_completed: Callable[[bool],
                               None] = CommonFunctionUtils.noop) -> bool:
        if CommonOccultUtils.is_robot(sim_info):
            on_completed(False)
            return False

        def _on_ok_selected(_: Any):
            # trait_Humanoid_Robots_MainTrait
            trait_id = CommonTraitId.OCCULT_ROBOT
            result = CommonTraitUtils.add_trait(sim_info, trait_id)
            on_completed(result)

        def _on_cancel_selected(_: Any):
            on_completed(False)

        confirmation = CommonOkCancelDialog(
            S4CMStringId.CONFIRMATION,
            S4CMSimControlMenuStringId.BECOME_SERVO_CONFIRMATION_DESCRIPTION,
        )
        confirmation.show(on_ok_selected=_on_ok_selected,
                          on_cancel_selected=_on_cancel_selected)
        return True
 def get_motive_string(self, sim_info: SimInfo, motive_name: str) -> int:
     """ Retrieve a String for a motive. """
     if motive_name == CMMotive.HYGIENE and CommonOccultUtils.is_mermaid(
             sim_info):
         return CMStringId.HYDRATION
     if motive_name not in CMMotiveUtils._MOTIVE_STRING_MAPPINGS:
         return -1
     return CMMotiveUtils._MOTIVE_STRING_MAPPINGS[motive_name]
Example #6
0
 def run(self, sim_info: SimInfo, on_completed: Callable[[bool], None]=CommonFunctionUtils.noop) -> bool:
     if not CommonOccultUtils.is_witch(sim_info):
         on_completed(False)
         return False
     # loot_WitchOccult_RemoveOccult
     remove_loot_id = 215274
     result = CommonSimLootActionUtils.apply_loot_actions_by_id_to_duo_sims(remove_loot_id, sim_info, sim_info)
     on_completed(result)
     return result
Example #7
0
 def run(self, sim_info: SimInfo, on_completed: Callable[[bool], None]=CommonFunctionUtils.noop) -> bool:
     if CommonOccultUtils.is_witch(sim_info):
         on_completed(False)
         return False
     # loot_WitchOccult_AddOccult
     add_loot_id = 215080
     result = CommonSimLootActionUtils.apply_loot_actions_by_id_to_sim(add_loot_id, sim_info)
     on_completed(result)
     return result
Example #8
0
 def run(
     self,
     sim_info: SimInfo,
     on_completed: Callable[[bool],
                            None] = CommonFunctionUtils.noop) -> bool:
     if not CommonOccultUtils.is_robot(sim_info):
         on_completed(False)
         return False
     # trait_Humanoid_Robots_MainTrait
     trait_id = CommonTraitId.OCCULT_ROBOT
     result = CommonTraitUtils.remove_trait(sim_info, trait_id)
     on_completed(result)
     return result
    def get_plant_sim_water_level(sim_info: SimInfo) -> float:
        """get_plant_sim_water_level(sim_info)

        Retrieve the plant sim water level of a Sim.

        :param sim_info: The Sim to get the level of.
        :type sim_info: SimInfo
        :return: The current level of the Motive of the Sim or `-1.0` if the Sim is not a Plant Sim.
        :rtype: float
        """
        if not CommonOccultUtils.is_plant_sim(sim_info):
            return -1.0
        return CommonSimMotiveUtils._get_motive_level(sim_info, CommonMotiveId.PLANT_SIM_WATER)
    def get_vampire_thirst_level(sim_info: SimInfo) -> float:
        """get_vampire_thirst_level(sim_info)

        Retrieve the vampire thirst level of a Sim.

        :param sim_info: The Sim to get the level of.
        :type sim_info: SimInfo
        :return: The current level of the Motive of the Sim or `-1.0` if the Sim is not a Vampire.
        :rtype: float
        """
        if not CommonOccultUtils.is_vampire(sim_info):
            return -1.0
        return CommonSimMotiveUtils._get_motive_level(sim_info, CommonMotiveId.VAMPIRE_THIRST)
Example #11
0
 def run(
     self,
     sim_info: SimInfo,
     on_completed: Callable[[bool],
                            None] = CommonFunctionUtils.noop) -> bool:
     if CommonOccultUtils.is_vampire(sim_info):
         on_completed(False)
         return False
     # loot_VampireCreation_NewVampire
     add_loot_id = 149538
     result = CommonSimLootActionUtils.apply_loot_actions_by_id_to_sim(
         add_loot_id, sim_info)
     on_completed(result)
     return result
Example #12
0
 def run(
     self,
     sim_info: SimInfo,
     on_completed: Callable[[bool],
                            None] = CommonFunctionUtils.noop) -> bool:
     if CommonOccultUtils.is_mermaid(sim_info):
         on_completed(False)
         return False
     # loot_Mermaid_DebugAdd
     add_loot_id = 205399
     result = CommonSimLootActionUtils.apply_loot_actions_by_id_to_sim(
         add_loot_id, sim_info)
     on_completed(result)
     return result
Example #13
0
 def run(
     self,
     sim_info: SimInfo,
     on_completed: Callable[[bool],
                            None] = CommonFunctionUtils.noop) -> bool:
     if not CommonOccultUtils.is_skeleton(sim_info):
         on_completed(False)
         return False
     # loot_Skeleton_Remove
     remove_loot_id = 175975
     result = CommonSimLootActionUtils.apply_loot_actions_by_id_to_sim(
         remove_loot_id, sim_info)
     on_completed(result)
     return result
Example #14
0
 def run(
     self,
     sim_info: SimInfo,
     on_completed: Callable[[bool],
                            None] = CommonFunctionUtils.noop) -> bool:
     if not CommonOccultUtils.is_plant_sim(sim_info):
         on_completed(False)
         return False
     loot_action_ids: Tuple[int] = (
         # loot_Trait_PlantSims_TraitRemove
         162846, )
     result = CommonSimLootActionUtils.apply_loot_actions_by_ids_to_sim(
         loot_action_ids, sim_info)
     on_completed(result)
     return result
Example #15
0
 def run(
     self,
     sim_info: SimInfo,
     on_completed: Callable[[bool],
                            None] = CommonFunctionUtils.noop) -> bool:
     if not CommonOccultUtils.is_vampire(sim_info):
         on_completed(False)
         return False
     loot_action_ids: Tuple[int] = (
         # loot_VampireCure_RemoveVampirism
         150170,
         # loot_Life_ResetProgress
         31238)
     result = CommonSimLootActionUtils.apply_loot_actions_by_ids_to_sim(
         loot_action_ids, sim_info)
     on_completed(result)
     return result
Example #16
0
 def run(
     self,
     sim_info: SimInfo,
     on_completed: Callable[[bool],
                            None] = CommonFunctionUtils.noop) -> bool:
     if not CommonOccultUtils.is_mermaid(sim_info):
         on_completed(False)
         return False
     from sims4communitylib.utils.sims.common_trait_utils import CommonTraitUtils
     trait_ids: Tuple[int] = (
         CommonTraitId.OCCULT_MERMAID_MERMAID_FORM,
         CommonTraitId.OCCULT_MERMAID_DISCOVERED,
         CommonTraitId.OCCULT_MERMAID_TEMPORARY_DISCOVERED,
         CommonTraitId.OCCULT_MERMAID_TYAE,
         CommonTraitId.OCCULT_MERMAID,
     )
     result = CommonTraitUtils.remove_trait(sim_info, *trait_ids)
     on_completed(result)
     return result
Example #17
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
Example #18
0
 def get_vampire_thirst_level(sim_info: SimInfo) -> float:
     """ Retrieve the vampire thirst level of a Sim. """
     if not CommonOccultUtils.is_vampire(sim_info):
         return -1.0
     return CommonSimMotiveUtils._get_motive_level(
         sim_info, CommonMotiveId.VAMPIRE_THIRST)
Example #19
0
 def get_plant_sim_water_level(sim_info: SimInfo) -> float:
     """ Retrieve the plant sim water level of a Sim. """
     if not CommonOccultUtils.is_plant_sim(sim_info):
         return -1.0
     return CommonSimMotiveUtils._get_motive_level(
         sim_info, CommonMotiveId.PLANT_SIM_WATER)