示例#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
        private static List <ArkDinoFood> ConvertMultiplier(UAssetFileBlueprint f, UAssetCacheBlock cache, ArrayProperty p)
        {
            //Convert each entry
            List <ArkDinoFood> output = new List <ArkDinoFood>();

            foreach (var s in p.props)
            {
                StructProperty      data      = (StructProperty)s;
                PropListStruct      sdata     = (PropListStruct)data.data;
                PropertyReader      reader    = new PropertyReader(sdata.propsList);
                UAssetFileBlueprint foodClass = reader.GetProperty <ObjectProperty>("FoodItemParent").GetReferencedFileBlueprint();
                ArkDinoFood         food      = new ArkDinoFood
                {
                    classname = foodClass.classname,
                    foodEffectivenessMultiplier     = reader.GetPropertyFloat("FoodEffectivenessMultiplier", null),
                    affinityOverride                = reader.GetPropertyFloat("AffinityOverride", null),
                    affinityEffectivenessMultiplier = reader.GetPropertyFloat("AffinityEffectivenessMultiplier", null),
                    foodCategory = reader.GetPropertyInt("FoodItemCategory", null),
                    priority     = reader.GetPropertyFloat("UntamedFoodConsumptionPriority", null)
                };
                output.Add(food);
            }
            return(output);
        }