예제 #1
0
    def process_bvc_struct(self, data):
        """
        Given a serialized BVC/BVSC/etc structure, return a value.
        """

        return self.process_bvc(BVC.from_data_struct(data))
예제 #2
0
    def get_extra_anoints(self, balance_name):
        """
        Given a `balance_name`, return a list of tuples, each with two elements:
          1) The GPartExpansion object providing extra anointments (or None)
          2) A list of anointments which that GPartExpansion is adding to the object.
        """

        # First, if we haven't read in the GPartExpansion data and created our lookup
        # object, do that.
        if not self.balance_to_extra_anoints:

            self.balance_to_extra_anoints = {}

            for expansion_name in [
                    '/Game/PatchDLC/Raid1/Gear/_GearExtension/GParts/GPartExpansion_Grenades_Raid1',
                    '/Game/PatchDLC/Raid1/Gear/_GearExtension/GParts/GPartExpansion_Shields_Raid1',
                    '/Game/PatchDLC/Raid1/Gear/_GearExtension/GParts/GPartExpansion_Weapons_Raid1',
                    # Cartels expansions have become part of the base game, add those in.
                    '/Game/PatchDLC/Event2/Gear/_Design/_GearExtension/GParts/GPartExpansion_Grenades_Event2',
                    '/Game/PatchDLC/Event2/Gear/_Design/_GearExtension/GParts/GPartExpansion_Shields_Event2',
                    '/Game/PatchDLC/Event2/Gear/_Design/_GearExtension/GParts/GPartExpansion_Weapons_Event2',
                    # Designer's Cut expansion (yep, just weapons)
                    '/Game/PatchDLC/Ixora/Gear/_GearExtension/GParts/GPartExpansion_Weapons_Ixora',
                    # These objects do exist, but they don't actually add any parts, so whatever.
                    # The BloodyHarvest ones *do* add them, but only during the event, so we're ignoring
                    # those too.
                    #'/Game/PatchDLC/BloodyHarvest/Gear/_Design/_GearExtension/GParts/GPartExpansion_Grenades_BloodyHarvest',
                    #'/Game/PatchDLC/BloodyHarvest/Gear/_Design/_GearExtension/GParts/GPartExpansion_Shields_BloodyHarvest',
                    #'/Game/PatchDLC/BloodyHarvest/Gear/_Design/_GearExtension/GParts/GPartExpansion_Weapons_BloodyHarvest',
                    #'/Game/PatchDLC/Dandelion/Gear/_GearExtension/GParts/GPartExpansion_Grenades_Dandelion',
                    #'/Game/PatchDLC/Dandelion/Gear/_GearExtension/GParts/GPartExpansion_Shields_Dandelion',
                    #'/Game/PatchDLC/Dandelion/Gear/_GearExtension/GParts/GPartExpansion_Weapons_Dandelion',
                    #'/Game/PatchDLC/Hibiscus/Gear/_GearExtension/GParts/GPartExpansion_Grenades_Hibiscus',
                    #'/Game/PatchDLC/Hibiscus/Gear/_GearExtension/GParts/GPartExpansion_Shields_Hibiscus',
                    #'/Game/PatchDLC/Hibiscus/Gear/_GearExtension/GParts/GPartExpansion_Weapons_Hibiscus',
                    #'/Game/PatchDLC/Geranium/Gear/_GearExtension/GParts/GPartExpansion_Weapons_Geranium',
                    #'/Game/PatchDLC/Geranium/Gear/_GearExtension/GParts/GPartExpansion_Shields_Geranium',
                    #'/Game/PatchDLC/Geranium/Gear/_GearExtension/GParts/GPartExpansion_Grenades_Geranium',
            ]:

                # Construct a list of anointments which this GPartExpansion provides
                extra_anoints = []
                expansion_data = self.get_exports(
                    expansion_name, 'InventoryGenericPartExpansionData')[0]
                for part in expansion_data['GenericParts']['Parts']:
                    extra_anoints.append(
                        (part['PartData'][1],
                         BVC.from_data_struct(part['Weight'])))

                # Grab a list of balance collections which define the gear this expansion acts on.
                bal_collections = [
                    expansion_data['InventoryBalanceCollection'][1]
                ]
                for (extra,
                     extra_data) in self.get_refs_to_data(bal_collections[0]):
                    if extra_data \
                            and extra_data[0]['export_type'] == 'InventoryBalanceCollectionData' \
                            and extra_data[0]['ParentCollection'][1] == bal_collections[0]:
                        bal_collections.append(extra)

                # Now loop through all balances and populate our dict
                for bal_collection in bal_collections:
                    collection = self.get_exports(
                        bal_collection, 'InventoryBalanceCollectionData')[0]
                    if 'InventoryBalanceList' in collection:
                        for bal in collection['InventoryBalanceList']:
                            this_balance = bal['asset_path_name'].split('.')[0]
                            if this_balance not in self.balance_to_extra_anoints:
                                self.balance_to_extra_anoints[
                                    this_balance] = []
                            self.balance_to_extra_anoints[this_balance].append(
                                (expansion_name, extra_anoints))

        # Now, return the appropriate value
        if balance_name in self.balance_to_extra_anoints:
            return self.balance_to_extra_anoints[balance_name]
        else:
            return []