public static List <DinosaurEntry> ExtractDinos(UAssetCacheBlock cache, List <ArkAsset> assets, DeltaExportPatch patch, PropertyReader primalDataReader, Dictionary <string, PropertyReader> dinoEntries) { //Loop through assets and import them List <DinosaurEntry> dinos = new List <DinosaurEntry>(); foreach (var a in assets) { //Open file UAssetFileBlueprint f; try { f = UAssetFileBlueprint.OpenFile(a.filename, false, a.name, a.installation.contentFolder); } catch (Exception ex) { continue; } //Convert file try { //Create a dino entry DinosaurEntry entry = ArkDinoEntryConverter.Convert(f, cache, patch, primalDataReader, dinoEntries); dinos.Add(entry); } catch (Exception ex) { continue; } } return(dinos); }
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); } }
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); }