@@ -384,7 +384,7 @@ private bool LoadCollectionFile(string filePath, bool keepCurrentCreatures = fal
384
384
385
385
if ( string . IsNullOrEmpty ( filePath ) || ! File . Exists ( filePath ) )
386
386
{
387
- MessageBoxes . ShowMessageBox ( $ "Save file with name \" { filePath } \" does not exist!", $ "File not found") ;
387
+ MessageBoxes . ShowMessageBox ( $ "Couldn't load file with name\n { filePath } \n it does not exist!", "File not found" ) ;
388
388
return false ;
389
389
}
390
390
@@ -404,6 +404,7 @@ private bool LoadCollectionFile(string filePath, bool keepCurrentCreatures = fal
404
404
Thread . Sleep ( delayOnRetry ) ;
405
405
continue ;
406
406
}
407
+
407
408
try
408
409
{
409
410
if ( Path . GetExtension ( filePath ) . ToLower ( ) == ".xml" )
@@ -413,7 +414,8 @@ private bool LoadCollectionFile(string filePath, bool keepCurrentCreatures = fal
413
414
{
414
415
// use xml-serializer for old library-format
415
416
XmlSerializer reader = new XmlSerializer ( typeof ( oldLibraryFormat . CreatureCollectionOld ) ) ;
416
- var creatureCollectionOld = ( oldLibraryFormat . CreatureCollectionOld ) reader . Deserialize ( fileStream ) ;
417
+ var creatureCollectionOld =
418
+ ( oldLibraryFormat . CreatureCollectionOld ) reader . Deserialize ( fileStream ) ;
417
419
418
420
List < Mod > mods = null ;
419
421
// first check if additional values are used, and if the according values-file is already available.
@@ -422,40 +424,49 @@ private bool LoadCollectionFile(string filePath, bool keepCurrentCreatures = fal
422
424
{
423
425
// usually the old filename is equal to the mod-tag
424
426
bool modFound = false ;
425
- string modTag = Path . GetFileNameWithoutExtension ( creatureCollectionOld . additionalValues ) . Replace ( " " , "" ) . ToLower ( ) . Replace ( "gaiamod" , "gaia" ) ;
427
+ string modTag = Path . GetFileNameWithoutExtension ( creatureCollectionOld . additionalValues )
428
+ . Replace ( " " , "" ) . ToLower ( ) . Replace ( "gaiamod" , "gaia" ) ;
426
429
foreach ( KeyValuePair < string , ModInfo > tmi in Values . V . modsManifest . modsByTag )
427
430
{
428
431
if ( tmi . Key . ToLower ( ) == modTag )
429
432
{
430
433
modFound = true ;
431
434
432
- MessageBox . Show ( "The library contains creatures of modded species. For a correct file-conversion the correct mod-values file is needed.\n \n "
435
+ MessageBox . Show (
436
+ "The library contains creatures of modded species. For a correct file-conversion the correct mod-values file is needed.\n \n "
433
437
+ "If the mod-value file is not loaded, the conversion may assign wrong species to your creatures.\n "
434
438
+ "If the mod-value file is not available locally, it will be tried to download it." ,
435
- $ "Mod values needed - { Utils . ApplicationNameVersion } ", MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
439
+ $ "Mod values needed - { Utils . ApplicationNameVersion } ", MessageBoxButtons . OK ,
440
+ MessageBoxIcon . Information ) ;
436
441
437
442
if ( Values . V . loadedModsHash != Values . NoModsHash )
438
443
LoadStatAndKibbleValues ( false ) ; // reset values to default
439
- LoadModValueFiles ( new List < string > { tmi . Value . mod . FileName } , true , true , out mods ) ;
444
+ LoadModValueFiles ( new List < string > { tmi . Value . mod . FileName } , true , true ,
445
+ out mods ) ;
440
446
break ;
441
447
}
442
448
}
449
+
443
450
if ( ! modFound
444
- && MessageBox . Show ( "The additional-values file in the library you're loading is unknown. You should first get a values-file in the new format for that mod.\n "
451
+ && MessageBox . Show (
452
+ "The additional-values file in the library you're loading is unknown. You should first get a values-file in the new format for that mod.\n "
445
453
+ "If you're loading the library the conversion of some modded species to the new format may fail and the according creatures have to be imported again later.\n \n "
446
454
+ $ "File:\n { filePath } \n "
447
455
+ $ "unknown mod-file: { modTag } \n \n "
448
- + "Do you want to load the library and risk losing creatures?" , $ "Unknown mod-file - { Utils . ApplicationNameVersion } ",
456
+ + "Do you want to load the library and risk losing creatures?" ,
457
+ $ "Unknown mod-file - { Utils . ApplicationNameVersion } ",
449
458
MessageBoxButtons . YesNo , MessageBoxIcon . Warning ) != DialogResult . Yes )
450
459
return false ;
451
460
}
452
461
453
- _creatureCollection = oldLibraryFormat . FormatConverter . ConvertXml2Asb ( creatureCollectionOld , filePath ) ;
462
+ _creatureCollection =
463
+ oldLibraryFormat . FormatConverter . ConvertXml2Asb ( creatureCollectionOld , filePath ) ;
454
464
_creatureCollection . ModList = mods ?? new List < Mod > ( 0 ) ;
455
465
456
466
if ( _creatureCollection == null ) throw new Exception ( "Conversion failed" ) ;
457
467
458
- string fileNameWOExt = Path . Combine ( Path . GetDirectoryName ( filePath ) , Path . GetFileNameWithoutExtension ( filePath ) ) ;
468
+ string fileNameWOExt = Path . Combine ( Path . GetDirectoryName ( filePath ) ,
469
+ Path . GetFileNameWithoutExtension ( filePath ) ) ;
459
470
// check if new fileName is not yet existing
460
471
filePath = fileNameWOExt + CollectionFileExtension ;
461
472
if ( File . Exists ( filePath ) )
@@ -472,19 +483,24 @@ private bool LoadCollectionFile(string filePath, bool keepCurrentCreatures = fal
472
483
else
473
484
{
474
485
// new json-format
475
- if ( FileService . LoadJsonFile ( filePath , out CreatureCollection readCollection , out string errorMessage ) )
486
+ if ( FileService . LoadJsonFile ( filePath , out CreatureCollection readCollection ,
487
+ out string errorMessage ) )
476
488
{
477
489
if ( ! Version . TryParse ( readCollection . FormatVersion , out Version ccVersion )
478
- || ! Version . TryParse ( CreatureCollection . CurrentLibraryFormatVersion , out Version currentVersion )
479
- || ccVersion > currentVersion )
490
+ || ! Version . TryParse ( CreatureCollection . CurrentLibraryFormatVersion ,
491
+ out Version currentVersion )
492
+ || ccVersion > currentVersion )
480
493
{
481
- throw new FormatException ( $ "Unsupported format version: { readCollection . FormatVersion ?? "null" } ") ;
494
+ throw new FormatException (
495
+ $ "Unsupported format version: { readCollection . FormatVersion ?? "null" } ") ;
482
496
}
497
+
483
498
_creatureCollection = readCollection ;
484
499
}
485
500
else
486
501
{
487
- MessageBoxes . ShowMessageBox ( $ "Error while trying to read the library-file\n { filePath } \n \n { errorMessage } ") ;
502
+ MessageBoxes . ShowMessageBox (
503
+ $ "Error while trying to read the library-file\n { filePath } \n \n { errorMessage } ") ;
488
504
return false ;
489
505
}
490
506
}
@@ -499,15 +515,23 @@ private bool LoadCollectionFile(string filePath, bool keepCurrentCreatures = fal
499
515
catch ( FormatException ex )
500
516
{
501
517
// This FormatVersion is not understood, abort
502
- MessageBoxes . ShowMessageBox ( "This library format is unsupported in this version of ARK Smart Breeding." +
503
- $ "\n \n { ex . Message } \n \n Try updating to a newer version.") ;
518
+ MessageBoxes . ShowMessageBox (
519
+ "This library format is unsupported in this version of ARK Smart Breeding." +
520
+ $ "\n \n { ex . Message } \n \n Try updating to a newer version.") ;
504
521
if ( ( DateTime . Now - Properties . Settings . Default . lastUpdateCheck ) . TotalMinutes < 10 )
505
522
CheckForUpdates ( ) ;
506
523
return false ;
507
524
}
508
525
catch ( InvalidOperationException ex )
509
526
{
510
- MessageBoxes . ExceptionMessageBox ( ex , $ "The library-file\n { filePath } \n couldn't be opened, we thought you should know.") ;
527
+ MessageBoxes . ExceptionMessageBox ( ex ,
528
+ $ "The library-file\n { filePath } \n couldn't be opened, we thought you should know.") ;
529
+ return false ;
530
+ }
531
+ catch ( Exception ex )
532
+ {
533
+ MessageBoxes . ExceptionMessageBox ( ex ,
534
+ $ "The library-file\n { filePath } \n couldn't be opened, an unexpected exception occurred.") ;
511
535
return false ;
512
536
}
513
537
finally
@@ -1015,7 +1039,8 @@ private void DetermineLevelStatusAndSoundFeedback(Creature c, bool playImportSou
1015
1039
var species = c . Species ;
1016
1040
_topLevels . TryGetValue ( species , out var topLevels ) ;
1017
1041
var statWeights = breedingPlan1 . StatWeighting . GetWeightingForSpecies ( species ) ;
1018
- LevelStatusFlags . DetermineLevelStatus ( species , topLevels , statWeights ,
1042
+ var considerAsTopStat = StatsOptionsConsiderTopStats . GetStatsOptions ( species ) . StatOptions ;
1043
+ LevelStatusFlags . DetermineLevelStatus ( species , topLevels , statWeights , considerAsTopStat ,
1019
1044
c . levelsWild , c . levelsMutated , c . valuesBreeding , out _ , out _ ) ;
1020
1045
1021
1046
if ( playImportSound )
@@ -1043,11 +1068,19 @@ private void CopyTopCreatureStatsToClipboard(object sender, EventArgs e)
1043
1068
var si = Stats . DisplayOrder [ s ] ;
1044
1069
if ( si == Stats . Torpidity ) continue ;
1045
1070
var level = sp . Key . UsesStat ( si )
1046
- ? ( statWeights . Item1 [ si ] < 0 ? sp . Value . WildLevelsLowest [ si ] : sp . Value . WildLevelsHighest [ si ] ) : - 1 ;
1047
- if ( level < 0 ) continue ;
1048
- maxLevel += level ;
1049
- columns [ s + 1 ] . Add ( level . ToString ( ) ) ;
1071
+ ? ( statWeights . Item1 [ si ] < 0 ? sp . Value . WildLevelsLowest [ si ] : sp . Value . WildLevelsHighest [ si ] )
1072
+ : - 1 ;
1073
+ if ( level >= 0 )
1074
+ {
1075
+ maxLevel += level ;
1076
+ columns [ s + 1 ] . Add ( level . ToString ( ) ) ;
1077
+ }
1078
+ else
1079
+ {
1080
+ columns [ s + 1 ] . Add ( string . Empty ) ;
1081
+ }
1050
1082
}
1083
+
1051
1084
columns [ Stats . StatsCount + 1 ] . Add ( maxLevel . ToString ( ) ) ;
1052
1085
}
1053
1086
0 commit comments