Пример #1
0
        public static ArkDinoEntry Convert(UAssetFileBlueprint f, UAssetCacheBlock cache, Dictionary <string, PropertyReader> dinoEntries)
        {
            //Open reader
            PropertyReader reader = new PropertyReader(f.GetFullProperties(cache));

            //Get the dino settings
            UAssetFileBlueprint settingsFileAdult = ArkDinoFood.GetAdultFile(f, cache);
            UAssetFileBlueprint settingsFileBaby  = ArkDinoFood.GetBabyFile(f, cache);

            //Get time
            int time = (int)Math.Round((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);

            //Get status component
            UAssetFileBlueprint statusComponent = ArkDinoEntryStatus.GetFile(f, cache);
            PropertyReader      statusReader    = new PropertyReader(statusComponent.GetFullProperties(cache));

            //Use name tag to find entry
            string tag = reader.GetPropertyStringOrName("DinoNameTag");

            if (!dinoEntries.ContainsKey(tag))
            {
                throw new Exception($"Could not find dino entry for '{f.classname}' (tag '{tag}')");
            }
            PropertyReader entry = dinoEntries[tag];

            //Now, load the material used for the dino image
            UAssetFileMaterial entryMaterial = entry.GetProperty <ObjectProperty>("DinoMaterial").GetReferencedFileMaterial();

            UAssetFileMaterial.TextureParameterValue entryMaterialTexture = entryMaterial.textureParameters[0];
            ClassnamePathnamePair entryTexture = entryMaterialTexture.prop.GetReferencedFile();

            //Read
            ArkDinoEntry e = new ArkDinoEntry
            {
                screen_name                       = reader.GetPropertyString("DescriptiveName", null),
                colorizationIntensity             = reader.GetPropertyFloat("ColorizationIntensity", 1),
                babyGestationSpeed                = reader.GetPropertyFloat("BabyGestationSpeed", -1),
                extraBabyGestationSpeedMultiplier = reader.GetPropertyFloat("ExtraBabyGestationSpeedMultiplier", -1),
                babyAgeSpeed                      = reader.GetPropertyFloat("BabyAgeSpeed", null),
                extraBabyAgeMultiplier            = reader.GetPropertyFloat("ExtraBabyAgeSpeedMultiplier", -1),
                useBabyGestation                  = reader.GetPropertyBool("bUseBabyGestation", false),
                statusComponent                   = ArkDinoEntryStatus.Convert(statusComponent, statusReader),
                adultFoods    = ArkDinoFood.Convert(settingsFileAdult, cache),
                childFoods    = ArkDinoFood.Convert(settingsFileBaby, cache),
                classname     = f.classname,
                blueprintPath = "N/A",
                captureTime   = time,
                icon          = ImageTool.QueueImage(entryTexture, ImageTool.ImageModifications.None),
                icon_white    = ImageTool.QueueImage(entryTexture, ImageTool.ImageModifications.White)
            };

            //Finally, read stats
            ArkStatsRipper.DoRipStats(statusReader, e);

            return(e);
        }
Пример #2
0
        public static DinosaurEntry Convert(UAssetFileBlueprint f, UAssetCacheBlock cache, DeltaExportPatch patch, PropertyReader primalDataReader, Dictionary <string, PropertyReader> dinoEntries)
        {
            //Open reader
            PropertyReader reader = new PropertyReader(f.GetFullProperties(cache));

            //Get the dino settings
            UAssetFileBlueprint settingsFileAdult = ArkDinoFoodConverter.GetAdultFile(f, cache);
            UAssetFileBlueprint settingsFileBaby  = ArkDinoFoodConverter.GetBabyFile(f, cache);

            //Get status component
            UAssetFileBlueprint statusComponent = ArkDinoEntryStatusConverter.GetFile(f, cache);
            PropertyReader      statusReader    = new PropertyReader(statusComponent.GetFullProperties(cache));

            //Use name tag to find entry
            string         tag   = reader.GetPropertyStringOrName("DinoNameTag");
            PropertyReader entry = dinoEntries[tag];

            //Now, load the material used for the dino image
            UAssetFileMaterial entryMaterial = entry.GetProperty <ObjectProperty>("DinoMaterial").GetReferencedFileMaterial();

            UAssetFileMaterial.TextureParameterValue entryMaterialTexture = entryMaterial.textureParameters[0];
            ClassnamePathnamePair entryTexture = entryMaterialTexture.prop.GetReferencedFile();

            //Read
            DinosaurEntry e = new DinosaurEntry
            {
                screen_name                       = reader.GetPropertyString("DescriptiveName", null),
                colorizationIntensity             = reader.GetPropertyFloat("ColorizationIntensity", 1),
                babyGestationSpeed                = reader.GetPropertyFloat("BabyGestationSpeed", -1),
                extraBabyGestationSpeedMultiplier = reader.GetPropertyFloat("ExtraBabyGestationSpeedMultiplier", -1),
                babyAgeSpeed                      = reader.GetPropertyFloat("BabyAgeSpeed", null),
                extraBabyAgeMultiplier            = reader.GetPropertyFloat("ExtraBabyAgeSpeedMultiplier", -1),
                useBabyGestation                  = reader.GetPropertyBool("bUseBabyGestation", false),
                statusComponent                   = ArkDinoEntryStatusConverter.Convert(statusComponent, statusReader),
                adultFoods = ArkDinoFoodConverter.Convert(settingsFileAdult, cache),
                childFoods = ArkDinoFoodConverter.Convert(settingsFileBaby, cache),
                classname  = DeltaDataExtractor.Program.TrimArkClassname(f.classname),
                icon       = ImageTool.QueueImage(entryTexture, ImageTool.ImageModifications.None, patch),
            };

            //Finally, read stats
            ArkStatsRipper.DoRipStats(statusReader, e);

            return(e);
        }
Пример #3
0
        public static ItemEntry ConvertEntry(UAssetFileBlueprint bp, UAssetCacheBlock cache, DeltaExportPatch patch)
        {
            //Open reader
            PropertyReader reader = new PropertyReader(bp.GetFullProperties(cache));

            //Get primary icon
            DeltaAsset icon;

            if (reader.GetProperty <ObjectProperty>("ItemIcon") != null)
            {
                icon = ImageTool.QueueImage(reader.GetProperty <ObjectProperty>("ItemIcon").GetReferencedFile(), ImageTool.ImageModifications.None, patch);
            }
            else
            {
                icon = DeltaAsset.MISSING_ICON;
            }

            //Get broken icon
            DeltaAsset brokenIcon;

            if (reader.GetProperty <ObjectProperty>("BrokenImage") != null)
            {
                brokenIcon = ImageTool.QueueImage(reader.GetProperty <ObjectProperty>("BrokenImage").GetReferencedFile(), ImageTool.ImageModifications.None, patch);
            }
            else
            {
                brokenIcon = DeltaAsset.MISSING_ICON;
            }

            //Get the array of UseItemAddCharacterStatusValues
            ArrayProperty statusValuesArray = reader.GetProperty <ArrayProperty>("UseItemAddCharacterStatusValues");
            Dictionary <string, ItemEntry_ConsumableAddStatusValue> statusValues = new Dictionary <string, ItemEntry_ConsumableAddStatusValue>();

            if (statusValuesArray != null)
            {
                foreach (var i in statusValuesArray.props)
                {
                    StructProperty sv   = (StructProperty)i;
                    var            svp  = ((PropListStruct)sv.data).propsList;
                    var            svpr = new PropertyReader(svp);
                    string         type = svpr.GetProperty <ByteProperty>("StatusValueType").enumValue;
                    ItemEntry_ConsumableAddStatusValue sve = ArkItemEntry_ConsumableAddStatusValueReader.Convert(svpr, type);
                    statusValues.Add(type, sve);
                }
            }

            //Create
            ItemEntry e = new ItemEntry
            {
                hideFromInventoryDisplay = reader.GetPropertyBool("bHideFromInventoryDisplay", false),
                useItemDurability        = reader.GetPropertyBool("bUseItemDurability", false),
                isTekItem           = reader.GetPropertyBool("bTekItem", false),
                allowUseWhileRiding = reader.GetPropertyBool("bAllowUseWhileRiding", false),
                name            = reader.GetPropertyString("DescriptiveNameBase", null),
                description     = reader.GetPropertyString("ItemDescription", null),
                spoilingTime    = reader.GetPropertyFloat("SpolingTime", 0),
                baseItemWeight  = reader.GetPropertyFloat("BaseItemWeight", 0),
                useCooldownTime = reader.GetPropertyFloat("MinimumUseInterval", 0),
                baseCraftingXP  = reader.GetPropertyFloat("BaseCraftingXP", 0),
                baseRepairingXP = reader.GetPropertyFloat("BaseRepairingXP", 0),
                maxItemQuantity = reader.GetPropertyInt("MaxItemQuantity", 0),
                classname       = DeltaDataExtractor.Program.TrimArkClassname(bp.classname),
                icon            = icon,
                broken_icon     = brokenIcon,
                addStatusValues = statusValues
            };

            return(e);
        }