diff --git a/ARKBreedingStats/Form1.collection.cs b/ARKBreedingStats/Form1.collection.cs index f9ba3d77..8e97ab62 100644 --- a/ARKBreedingStats/Form1.collection.cs +++ b/ARKBreedingStats/Form1.collection.cs @@ -842,7 +842,7 @@ private Creature ImportExportGunFiles(string[] filePaths, bool addCreatures, out foreach (var filePath in filePaths) { - var c = ImportExportGun.LoadCreature(filePath, out lastError, out serverMultipliersHash); + var c = ImportExportGun.LoadCreature(filePath, out lastError, out serverMultipliersHash, out _); if (c != null) { newCreatures.Add(c); diff --git a/ARKBreedingStats/Form1.exportGun.cs b/ARKBreedingStats/Form1.exportGun.cs index 43fa0fbb..3dbfce26 100644 --- a/ARKBreedingStats/Form1.exportGun.cs +++ b/ARKBreedingStats/Form1.exportGun.cs @@ -111,7 +111,7 @@ private void AsbServerDataSent(ProgressReportAsbServer data) if (string.IsNullOrEmpty(data.ServerHash)) { // import creature - var creature = ImportExportGun.LoadCreatureFromJson(data.JsonText, null, out resultText, out _); + var creature = ImportExportGun.LoadCreatureFromJson(data.JsonText, null, out resultText, out _, out _); if (creature == null) { SetMessageLabelText(resultText, MessageBoxIcon.Error); diff --git a/ARKBreedingStats/Form1.importSave.cs b/ARKBreedingStats/Form1.importSave.cs index 908c0e74..d3d5b8cb 100644 --- a/ARKBreedingStats/Form1.importSave.cs +++ b/ARKBreedingStats/Form1.importSave.cs @@ -107,6 +107,7 @@ private async Task RunSavegameImport(string fileLocation, string conveni switch (uri.Scheme) { case "ftp": + case "ftps": string errorMessage; (workingCopyFilePath, errorMessage) = await CopyFtpFileAsync(uri, uriFileRegex, convenientName ?? serverName ?? fileLocation, workingCopyFolderPath); @@ -202,8 +203,12 @@ private async Task RunSavegameImport(string fileLocation, string conveni } } var client = new AsyncFtpClient(ftpUri.Host, credentials.Username, credentials.Password, ftpUri.Port); - client.Config.EncryptionMode = FtpEncryptionMode.Auto; - client.Config.ValidateAnyCertificate = true; + if (ftpUri.Scheme == "ftps") + { + client.Config.EncryptionMode = FtpEncryptionMode.Auto; + client.Config.ValidateAnyCertificate = true; + } + string ftpPath = null; try diff --git a/ARKBreedingStats/Properties/AssemblyInfo.cs b/ARKBreedingStats/Properties/AssemblyInfo.cs index 77f82808..15e7a43f 100644 --- a/ARKBreedingStats/Properties/AssemblyInfo.cs +++ b/ARKBreedingStats/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // Revision // [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("0.61.2.0")] +[assembly: AssemblyFileVersion("0.61.3.0")] [assembly: NeutralResourcesLanguage("en")] diff --git a/ARKBreedingStats/_manifest.json b/ARKBreedingStats/_manifest.json index 353419d1..a42d31eb 100644 --- a/ARKBreedingStats/_manifest.json +++ b/ARKBreedingStats/_manifest.json @@ -4,7 +4,7 @@ "ARK Smart Breeding": { "Id": "ARK Smart Breeding", "Category": "main", - "version": "0.61.2.0" + "version": "0.61.3.0" }, "SpeciesColorImages": { "Id": "SpeciesColorImages", diff --git a/ARKBreedingStats/importExportGun/ImportExportGun.cs b/ARKBreedingStats/importExportGun/ImportExportGun.cs index 5ea11a29..3615563f 100644 --- a/ARKBreedingStats/importExportGun/ImportExportGun.cs +++ b/ARKBreedingStats/importExportGun/ImportExportGun.cs @@ -16,10 +16,12 @@ internal static class ImportExportGun /// /// Load creature from file created with the export gun (mod). /// Supports .sav files (ASE) and .json files (ASA). + /// The out parameter statValues contains the stat values of the export file. /// - public static Creature LoadCreature(string filePath, out string resultText, out string serverMultipliersHash, bool allowUnknownSpecies = false) + public static Creature LoadCreature(string filePath, out string resultText, out string serverMultipliersHash, out double[] statValues, bool allowUnknownSpecies = false) { resultText = null; + statValues = null; serverMultipliersHash = null; if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath)) return null; @@ -42,7 +44,7 @@ public static Creature LoadCreature(string filePath, out string resultText, out break; } - var creature = LoadCreatureFromJson(jsonText, resultText, out resultText, out serverMultipliersHash, filePath, allowUnknownSpecies); + var creature = LoadCreatureFromJson(jsonText, resultText, out resultText, out serverMultipliersHash, out statValues, filePath, allowUnknownSpecies); if (creature == null) return null; creature.domesticatedAt = File.GetLastWriteTime(filePath); return creature; @@ -62,9 +64,10 @@ public static Creature LoadCreature(string filePath, out string resultText, out return null; } - public static Creature LoadCreatureFromJson(string jsonText, string resultSoFar, out string resultText, out string serverMultipliersHash, string filePath = null, bool allowUnknownSpecies = false) + public static Creature LoadCreatureFromJson(string jsonText, string resultSoFar, out string resultText, out string serverMultipliersHash, out double[] statValues, string filePath = null, bool allowUnknownSpecies = false) { resultText = resultSoFar; + statValues = null; serverMultipliersHash = null; if (string.IsNullOrEmpty(jsonText)) { @@ -86,18 +89,19 @@ public static Creature LoadCreatureFromJson(string jsonText, string resultSoFar, serverMultipliersHash = exportedCreature.ServerMultipliersHash; - return ConvertExportGunToCreature(exportedCreature, out resultText, allowUnknownSpecies); + return ConvertExportGunToCreature(exportedCreature, out resultText, out statValues, allowUnknownSpecies); } - private static Creature ConvertExportGunToCreature(ExportGunCreatureFile ec, out string error, bool allowUnknownSpecies = false) + private static Creature ConvertExportGunToCreature(ExportGunCreatureFile ec, out string error, out double[] statValues, bool allowUnknownSpecies = false) { error = null; + statValues = null; if (ec == null) return null; var species = Values.V.SpeciesByBlueprint(ec.BlueprintPath, true); if (species == null) { - error = $"blueprintpath {ec.BlueprintPath} couldn't be found, maybe you need to load a mod values file."; + error = $"Unknown species. The blueprintpath {ec.BlueprintPath} couldn't be found, maybe you need to load a mod values file."; if (!allowUnknownSpecies) return null; } @@ -105,12 +109,14 @@ private static Creature ConvertExportGunToCreature(ExportGunCreatureFile ec, out var wildLevels = new int[Stats.StatsCount]; var domLevels = new int[Stats.StatsCount]; var mutLevels = new int[Stats.StatsCount]; + statValues = new double[Stats.StatsCount]; var si = 0; foreach (var s in ec.Stats) { wildLevels[si] = s.Wild; domLevels[si] = s.Tamed; mutLevels[si] = s.Mutated; + statValues[si] = s.Value; si++; } @@ -122,6 +128,7 @@ private static Creature ConvertExportGunToCreature(ExportGunCreatureFile ec, out && string.IsNullOrEmpty(ec.OwningPlayerName) && string.IsNullOrEmpty(ec.ImprinterName) && ec.OwningPlayerID == 0 + && ec.TameEffectiveness == 0 ; var isBred = !string.IsNullOrEmpty(ec.ImprinterName) diff --git a/ARKBreedingStats/multiplierTesting/StatsMultiplierTesting.cs b/ARKBreedingStats/multiplierTesting/StatsMultiplierTesting.cs index 716b741e..83d2a0f4 100644 --- a/ARKBreedingStats/multiplierTesting/StatsMultiplierTesting.cs +++ b/ARKBreedingStats/multiplierTesting/StatsMultiplierTesting.cs @@ -606,13 +606,14 @@ private void ProcessDroppedFiles(string[] files) string lastError = null; string serverMultipliersHash = null; Creature creature = null; + double[] statValues = null; if (!creatureImported) - creature = ImportExportGun.LoadCreature(filePath, out lastError, out serverMultipliersHash, true); + creature = ImportExportGun.LoadCreature(filePath, out lastError, out serverMultipliersHash, out statValues, true); if (creature != null) { - creatureImported = true; - SetCreatureValuesAndLevels(creature); + SetCreatureValuesAndLevels(creature, statValues); results.Add($"imported creature values and levels from {filePath}{(string.IsNullOrEmpty(lastError) ? string.Empty : $". {lastError}")}"); + creatureImported = true; } else if (lastError != null) { @@ -648,15 +649,15 @@ private void SetCreatureValueValues(CreatureValues cv) SetCreatureValues(cv.statValues, null, null, cv.level, (cv.tamingEffMax - cv.tamingEffMin) / 2, cv.imprintingBonus, cv.isTamed, cv.isBred, cv.Species); } - private void SetCreatureValuesAndLevels(Creature cr) + private void SetCreatureValuesAndLevels(Creature cr, double[] statValues = null) { - var levelsWildAndMutated = cr.levelsWild; + var levelsWildAndMutated = cr.levelsWild.ToArray(); if (cr.levelsMutated != null) { for (int si = 0; si < Stats.StatsCount; si++) levelsWildAndMutated[si] = cr.levelsWild[si] + cr.levelsMutated[si]; } - SetCreatureValues(cr.valuesDom, levelsWildAndMutated, cr.levelsDom, cr.Level, cr.tamingEff, cr.imprintingBonus, cr.isDomesticated, cr.isBred, cr.Species); + SetCreatureValues(statValues ?? cr.valuesDom, levelsWildAndMutated, cr.levelsDom, cr.Level, cr.tamingEff, cr.imprintingBonus, cr.isDomesticated, cr.isBred, cr.Species); } private void SetServerMultipliers(ExportGunServerFile esm) diff --git a/ARKBreedingStats/values/Values.cs b/ARKBreedingStats/values/Values.cs index ed9be196..6cb0058e 100644 --- a/ARKBreedingStats/values/Values.cs +++ b/ARKBreedingStats/values/Values.cs @@ -158,11 +158,11 @@ private void InitializeSpeciesAndColors(bool undefinedColorAsa = false) { foreach (Species sp in _V.species) { - if (specialFoodData.ContainsKey(sp.name)) + if (sp.taming != null && specialFoodData.TryGetValue(sp.name, out var customFoodData)) { - sp.taming.eats = specialFoodData[sp.name].eats; - sp.taming.eatsAlsoPostTame = specialFoodData[sp.name].eatsAlsoPostTame; - sp.taming.specialFoodValues = specialFoodData[sp.name].specialFoodValues; + sp.taming.eats = customFoodData.eats; + sp.taming.eatsAlsoPostTame = customFoodData.eatsAlsoPostTame; + sp.taming.specialFoodValues = customFoodData.specialFoodValues; } //if (sp.IsDomesticable && !specialFoodData.ContainsKey(sp.name)) speciesWoFoodData.Add(sp.name); }