Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public static ArkDinoEntryStatus Convert(UAssetFileBlueprint f, PropertyReader reader)
 {
     return(new ArkDinoEntryStatus
     {
         baseFoodConsumptionRate = reader.GetPropertyFloat("BaseFoodConsumptionRate", null),
         babyDinoConsumingFoodRateMultiplier = reader.GetPropertyFloat("BabyDinoConsumingFoodRateMultiplier", 25.5f),
         extraBabyDinoConsumingFoodRateMultiplier = reader.GetPropertyFloat("ExtraBabyDinoConsumingFoodRateMultiplier", 20),
         foodConsumptionMultiplier = reader.GetPropertyFloat("FoodConsumptionMultiplier", 1),
         tamedBaseHealthMultiplier = reader.GetPropertyFloat("TamedBaseHealthMultiplier", 1)
     });
 }
Exemplo n.º 3
0
 public static ItemEntry_ConsumableAddStatusValue Convert(PropertyReader reader, string type)
 {
     return(new ItemEntry_ConsumableAddStatusValue
     {
         baseAmountToAdd = reader.GetPropertyFloat("BaseAmountToAdd", null),
         percentOfMaxStatusValue = reader.GetPropertyBool("bPercentOfMaxStatusValue", null),
         percentOfCurrentStatusValue = reader.GetPropertyBool("bPercentOfCurrentStatusValue", null),
         useItemQuality = reader.GetPropertyBool("bUseItemQuality", null),
         addOverTime = reader.GetPropertyBool("bAddOverTime", null),
         setValue = reader.GetPropertyBool("bSetValue", null),
         setAdditionalValue = reader.GetPropertyBool("bSetAdditionalValue", null),
         addOverTimeSpeed = reader.GetPropertyFloat("AddOverTimeSpeed", null),
         itemQualityAddValueMultiplier = reader.GetPropertyFloat("ItemQualityAddValueMultiplier", null),
         statusValueType = type
     });
 }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        public static void DoRipStats(PropertyReader reader, DinosaurEntry entry)
        {
            //Create arrays
            entry.baseLevel                 = new float[12];
            entry.increasePerWildLevel      = new float[12];
            entry.increasePerTamedLevel     = new float[12];
            entry.additiveTamingBonus       = new float[12];
            entry.multiplicativeTamingBonus = new float[12];

            //Loop through ARK indexes
            for (int i = 0; i <= 11; i++)
            {
                //Calculate multipliers
                bool  can_level = true;// (i == 2) || (reader.GetPropertyByte("CanLevelUpValue", CANLEVELUP_VALUES[i], i) == 1);
                int   add_one   = IS_PERCENT_STAT[i];
                float zero_mult = can_level ? 1 : 0;
                float ETHM      = reader.GetPropertyFloat("ExtraTamedHealthMultiplier", EXTRA_MULTS_VALUES[i], i);

                //Add stat data
                entry.baseLevel[i]                 = MathF.Round(reader.GetPropertyFloat("MaxStatusValues", BASE_VALUES[i], i) + add_one, ROUND_PERCISION);
                entry.increasePerWildLevel[i]      = MathF.Round(reader.GetPropertyFloat("AmountMaxGainedPerLevelUpValue", IW_VALUES[i], i) * zero_mult, ROUND_PERCISION);
                entry.increasePerTamedLevel[i]     = MathF.Round(reader.GetPropertyFloat("AmountMaxGainedPerLevelUpValueTamed", 0, i) * ETHM * zero_mult, ROUND_PERCISION);
                entry.additiveTamingBonus[i]       = MathF.Round(reader.GetPropertyFloat("TamingMaxStatAdditions", 0, i), ROUND_PERCISION);
                entry.multiplicativeTamingBonus[i] = MathF.Round(reader.GetPropertyFloat("TamingMaxStatMultipliers", 0, i), ROUND_PERCISION);
            }
        }
Exemplo n.º 6
0
        public static void DoRipStats(PropertyReader reader, ArkDinoEntry entry)
        {
            /*entry.baseLevel = ReadStatsArray("MaxStatusValues", reader, entry, DEFAULT_BASE_LEVEL);
             * entry.increasePerWildLevel = ReadStatsArray("AmountMaxGainedPerLevelUpValue", reader, entry, DEFAULT_INCREASE_PER_WILD_LEVEL);
             * entry.increasePerTamedLevel = ReadStatsArray("AmountMaxGainedPerLevelUpValueTamed", reader, entry, DEFAULT_INCREASE_PER_TAMED_LEVEL);
             * entry.additiveTamingBonus = ReadStatsArray("TamingMaxStatAdditions", reader, entry, DEFAULT_TAMING_MAX_STAT_ADDITIONS);
             * entry.multiplicativeTamingBonus = ReadStatsArray("TamingMaxStatMultipliers", reader, entry, DEFAULT_TAMING_MAX_STAT_MULTIPLY);*/

            //Create dicts
            entry.baseLevel                 = new Dictionary <DinoStatTypeIndex, float>();
            entry.increasePerWildLevel      = new Dictionary <DinoStatTypeIndex, float>();
            entry.increasePerTamedLevel     = new Dictionary <DinoStatTypeIndex, float>();
            entry.additiveTamingBonus       = new Dictionary <DinoStatTypeIndex, float>();
            entry.multiplicativeTamingBonus = new Dictionary <DinoStatTypeIndex, float>();

            //Loop through ARK indexes
            for (int i = 0; i <= 11; i++)
            {
                //Convert to our standard stat
                DinoStatTypeIndex stat = (DinoStatTypeIndex)i;

                //Calculate multipliers
                bool  can_level = true;// (i == 2) || (reader.GetPropertyByte("CanLevelUpValue", CANLEVELUP_VALUES[i], i) == 1);
                int   add_one   = IS_PERCENT_STAT[i];
                float zero_mult = can_level ? 1 : 0;
                float ETHM      = reader.GetPropertyFloat("ExtraTamedHealthMultiplier", EXTRA_MULTS_VALUES[i], i);

                //Add stat data
                entry.baseLevel.Add(stat, MathF.Round(reader.GetPropertyFloat("MaxStatusValues", BASE_VALUES[i], i) + add_one, ROUND_PERCISION));
                entry.increasePerWildLevel.Add(stat, MathF.Round(reader.GetPropertyFloat("AmountMaxGainedPerLevelUpValue", IW_VALUES[i], i) * zero_mult, ROUND_PERCISION));
                entry.increasePerTamedLevel.Add(stat, MathF.Round(reader.GetPropertyFloat("AmountMaxGainedPerLevelUpValueTamed", 0, i) * ETHM * zero_mult, ROUND_PERCISION));
                entry.additiveTamingBonus.Add(stat, MathF.Round(reader.GetPropertyFloat("TamingMaxStatAdditions", 0, i), ROUND_PERCISION));
                entry.multiplicativeTamingBonus.Add(stat, MathF.Round(reader.GetPropertyFloat("TamingMaxStatMultipliers", 0, i), ROUND_PERCISION));
            }
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
 static Dictionary <DinoStatTypeIndex, float> ReadStatsArray(string name, PropertyReader reader, ArkDinoEntry entry, Dictionary <DinoStatTypeIndex, float> defaults)
 {
     return(new Dictionary <DinoStatTypeIndex, float>
     {
         { DinoStatTypeIndex.Health, reader.GetPropertyFloat(name, defaults[DinoStatTypeIndex.Health], (int)DinoStatTypeIndex.Health) },
         { DinoStatTypeIndex.Stamina, reader.GetPropertyFloat(name, defaults[DinoStatTypeIndex.Stamina], (int)DinoStatTypeIndex.Stamina) },
         { DinoStatTypeIndex.Torpidity, reader.GetPropertyFloat(name, defaults[DinoStatTypeIndex.Torpidity], (int)DinoStatTypeIndex.Torpidity) },
         { DinoStatTypeIndex.Oxygen, reader.GetPropertyFloat(name, defaults[DinoStatTypeIndex.Oxygen], (int)DinoStatTypeIndex.Oxygen) },
         { DinoStatTypeIndex.Food, reader.GetPropertyFloat(name, defaults[DinoStatTypeIndex.Food], (int)DinoStatTypeIndex.Food) },
         { DinoStatTypeIndex.Water, reader.GetPropertyFloat(name, defaults[DinoStatTypeIndex.Water], (int)DinoStatTypeIndex.Water) },
         { DinoStatTypeIndex.Temperature, reader.GetPropertyFloat(name, defaults[DinoStatTypeIndex.Temperature], (int)DinoStatTypeIndex.Temperature) },
         { DinoStatTypeIndex.Weight, reader.GetPropertyFloat(name, defaults[DinoStatTypeIndex.Weight], (int)DinoStatTypeIndex.Weight) },
         { DinoStatTypeIndex.MeleeDamage, reader.GetPropertyFloat(name, defaults[DinoStatTypeIndex.MeleeDamage], (int)DinoStatTypeIndex.MeleeDamage) },
         { DinoStatTypeIndex.Speed, reader.GetPropertyFloat(name, defaults[DinoStatTypeIndex.Speed], (int)DinoStatTypeIndex.Speed) },
         { DinoStatTypeIndex.TemperatureFortitude, reader.GetPropertyFloat(name, defaults[DinoStatTypeIndex.TemperatureFortitude], (int)DinoStatTypeIndex.TemperatureFortitude) },
         { DinoStatTypeIndex.CraftingSpeed, reader.GetPropertyFloat(name, defaults[DinoStatTypeIndex.CraftingSpeed], (int)DinoStatTypeIndex.CraftingSpeed) }
     });
 }