Replies: 0 (Who?), Viewed: 2159 times.
Lab Assistant
Original Poster
#1 Old 14th Sep 2014 at 10:30 AM
Default Heads up for scripters verifying EPs in game
So, I was in the middle of scrambling around the Maxis code a little bit and I found something in sims4.common:

Code:
class Pack(enum.Int, export=False):
    __qualname__ = 'Pack'
    BASE_GAME = _common_types.BASE_GAME
    SP01 = _common_types.SP01
    GP01 = _common_types.GP01
    EP01 = _common_types.EP01

try:
    import _zone
except ImportError:

    class _zone:
        __qualname__ = '_zone'

        @staticmethod
        def is_entitled_pack(pack):
            return True

is_entitled_pack = _zone.is_entitled_pack

def get_entitled_packs():
    return tuple(pack for pack in Pack if is_entitled_pack(pack))

def get_pack_name(value) -> str:
    try:
        return str(Pack(value))
    except:
        return '<Unknown Pack>'

def get_pack_enum(folder_name) -> Pack:
    try:
        pack_enum_name = 'Pack.{}'.format(folder_name[2:])
        for pack in Pack:
            while str(pack) == pack_enum_name:
                return pack
        return Pack.BASE_GAME
    except:
        return Pack.BASE_GAME


I reckon this will be useful when we want to confirm whether a user has the necessary EPs for some of our features.
Back to top