├── _config.yml
├── ARKBreedingStats
├── json
│ ├── sortNames.txt
│ ├── imagePacks.json
│ ├── canHaveWildLevelExceptions.json
│ ├── creatureNamesM.txt
│ ├── variantsDefaultUnselected.txt
│ ├── creatureNamesU.txt
│ ├── ignoreSpeciesClasses.json
│ ├── speciesSpecificExtractionFails.json
│ ├── values
│ │ └── ATLAS
│ │ │ └── _manifestCustom.json
│ ├── creatureNamesF.txt
│ ├── kibbles.json
│ ├── serverMultipliers.json
│ └── aliases.json
├── Resources
│ ├── pen.png
│ ├── kofi.png
│ ├── lock.png
│ ├── open.gif
│ ├── failure.wav
│ ├── newTribe.png
│ ├── settings.png
│ ├── success.wav
│ ├── topstat.wav
│ ├── unlocked.png
│ ├── updated.wav
│ ├── indifferent.wav
│ ├── newMutation.wav
│ ├── newPlayer.png
│ ├── newtopstat.wav
│ └── ARKSmartBreeding.ico
├── ARKSmartBreeding.ico
├── miscClasses
│ └── FtpCredentials.cs
├── library
│ ├── Player.cs
│ ├── Note.cs
│ ├── Tribe.cs
│ └── TopLevels.cs
├── uiControls
│ ├── TroughControl.cs
│ ├── TextBoxSuggest.cs
│ ├── ButtonAddTime.cs
│ ├── MultiSetterTag.cs
│ ├── TroughControl.Designer.cs
│ ├── ScrollForm.cs
│ ├── StatGraphs.cs
│ ├── TagSelectorList.Designer.cs
│ ├── ColorPickerWindow.cs
│ ├── PopupMessage.cs
│ ├── ScrollForm.Designer.cs
│ ├── RegionColorChooser.Designer.cs
│ ├── MultiSetterTag.Designer.cs
│ ├── StatSelector.Designer.cs
│ ├── ColorPickerWindow.Designer.cs
│ ├── ArkVersionDialog.cs
│ ├── TagSelector.cs
│ ├── ParentInheritance.cs
│ ├── TagSelectorList.cs
│ ├── Trough.cs
│ ├── StatPotential.cs
│ ├── StatDisplay.cs
│ ├── TagSelector.Designer.cs
│ ├── StatSelector.cs
│ └── nud.cs
├── Asb.cs
├── NamePatterns
│ ├── PatternTemplates.cs
│ ├── PatternTemplate.cs
│ ├── NamePatternEntry.cs
│ └── NameList.cs
├── ocr
│ ├── PatternMatching
│ │ ├── Coords.cs
│ │ ├── TrainingSettings.cs
│ │ ├── TextData.cs
│ │ ├── OcrUtils.cs
│ │ ├── RecognizedCharData.cs
│ │ ├── ImageUtils.cs
│ │ ├── CoordsData.cs
│ │ └── DirectBitmap.cs
│ └── HammingWeight.cs
├── testCases
│ ├── ExtractionTestCases.cs
│ └── ExtractionTestCase.cs
├── AsbServer
│ ├── ServerSendName.cs
│ └── ProgressReportAsbServer.cs
├── oldLibraryFormat
│ ├── TimerListEntryOld.cs
│ ├── IncubationTimerEntryOld.cs
│ └── CreatureValuesOld.cs
├── utils
│ ├── Logging.cs
│ ├── ArkWiki.cs
│ ├── Hashes.cs
│ ├── ExceptionMessages.cs
│ ├── RepositoryInfo.cs
│ ├── LevelColorBar.cs
│ ├── MessageBoxes.cs
│ ├── CustomListBoxDrawing.cs
│ ├── Themes.cs
│ ├── ExtensionMethods.cs
│ ├── ControlExtensions.cs
│ ├── ColorModeColors.cs
│ └── Debouncer.cs
├── SpeciesImages
│ ├── FileHashList.cs
│ ├── ImageCompositions.cs
│ ├── Poses.cs
│ └── CreatureImageParameters.cs
├── species
│ ├── Kibble.cs
│ ├── ColorPattern.cs
│ ├── SpeciesStat.cs
│ ├── TamingFood.cs
│ ├── CreatureColors.cs
│ ├── BreedingData.cs
│ ├── BreedingPair.cs
│ ├── ColorRegion.cs
│ ├── CanHaveWildLevelExceptions.cs
│ ├── ARKColor.cs
│ └── TamingData.cs
├── Updater
│ ├── ValueModule.cs
│ └── AsbManifest.cs
├── StatsOptions
│ ├── StatOptionsBase.cs
│ ├── TopStatsSettings
│ │ └── ConsiderTopStats.cs
│ ├── StatsOptions.cs
│ └── StatsOptionsForm.cs
├── settings
│ ├── FtpCredentials.cs
│ ├── ATImportFileLocation.cs
│ ├── FtpProgress.cs
│ ├── ATImportExportedFolderLoactionDialog.cs
│ ├── ATImportFileLocationDialog.cs
│ └── customSoundChooser.cs
├── _manifest.json
├── duplicates
│ ├── MergingDuplicatesUI.cs
│ └── MergingDuplicatesWindow.cs
├── Properties
│ ├── DataSources
│ │ └── ARKBreedingStats.settings.ATImportFileLocation.datasource
│ └── AssemblyInfo.cs
├── StatResult.cs
├── DiceCoefficient.cs
├── Pedigree
│ └── IPedigreeCreature.cs
├── _manifest.tt
├── Settings.cs
├── mods
│ └── ModInfo.cs
├── OffspringPossibilities.Designer.cs
├── Kibbles.cs
├── importExportGun
│ ├── ExportGunFileExtensions.cs
│ └── ExportGunServerFile.cs
├── raising
│ ├── ParentStatValues.cs
│ └── Raising.cs
├── BreedingPlanning
│ └── CurrentBreedingPair.cs
├── TimerListEntry.cs
├── importExported
│ └── FileWatcherExports.cs
├── values
│ └── TamingFoodData.cs
└── IncubationTimerEntry.cs
├── setup.iss
├── docs
├── img
│ ├── labels.jpg
│ ├── taming.png
│ ├── extractor.png
│ ├── library.png
│ ├── pedigree.png
│ ├── raising.png
│ ├── H-Pedigree.png
│ └── breedingplan.png
└── _config.yml
├── ASB-Updater
├── FodyWeavers.xml
├── asb-updater.ico
├── App.xaml.cs
├── App.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ └── Resources.Designer.cs
├── App.xaml
└── MainWindow.xaml
├── .gitmodules
├── .github
└── FUNDING.yml
├── LICENSE
├── .gitattributes
└── ARKBreedingStats.sln.DotSettings
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-midnight
--------------------------------------------------------------------------------
/ARKBreedingStats/json/sortNames.txt:
--------------------------------------------------------------------------------
1 | ^Aberrant (.*)$@$1a
--------------------------------------------------------------------------------
/setup.iss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/setup.iss
--------------------------------------------------------------------------------
/docs/img/labels.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/docs/img/labels.jpg
--------------------------------------------------------------------------------
/docs/img/taming.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/docs/img/taming.png
--------------------------------------------------------------------------------
/docs/img/extractor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/docs/img/extractor.png
--------------------------------------------------------------------------------
/docs/img/library.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/docs/img/library.png
--------------------------------------------------------------------------------
/docs/img/pedigree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/docs/img/pedigree.png
--------------------------------------------------------------------------------
/docs/img/raising.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/docs/img/raising.png
--------------------------------------------------------------------------------
/docs/img/H-Pedigree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/docs/img/H-Pedigree.png
--------------------------------------------------------------------------------
/ASB-Updater/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ASB-Updater/asb-updater.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ASB-Updater/asb-updater.ico
--------------------------------------------------------------------------------
/docs/img/breedingplan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/docs/img/breedingplan.png
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/pen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/pen.png
--------------------------------------------------------------------------------
/ARKBreedingStats/ARKSmartBreeding.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/ARKSmartBreeding.ico
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/kofi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/kofi.png
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/lock.png
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/open.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/open.gif
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/failure.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/failure.wav
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/newTribe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/newTribe.png
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/settings.png
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/success.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/success.wav
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/topstat.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/topstat.wav
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/unlocked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/unlocked.png
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/updated.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/updated.wav
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/indifferent.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/indifferent.wav
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/newMutation.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/newMutation.wav
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/newPlayer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/newPlayer.png
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/newtopstat.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/newtopstat.wav
--------------------------------------------------------------------------------
/ARKBreedingStats/json/imagePacks.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "url": "https://raw.github.com/arkutils/species-images/main/images/"
4 | }
5 | ]
6 |
--------------------------------------------------------------------------------
/ARKBreedingStats/json/canHaveWildLevelExceptions.json:
--------------------------------------------------------------------------------
1 | {
2 | "Basilisk": 8,
3 | "Karkinos": 8,
4 | "Maeguana": 8,
5 | "Maewing": 8
6 | }
7 |
--------------------------------------------------------------------------------
/ARKBreedingStats/Resources/ARKSmartBreeding.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cadon/ARKStatsExtractor/HEAD/ARKBreedingStats/Resources/ARKSmartBreeding.ico
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "ArkSavegameToolkit"]
2 | path = ArkSavegameToolkit
3 | url = https://github.com/cadon/ArkSavegameToolkit.git
4 | branch = master
5 |
--------------------------------------------------------------------------------
/ASB-Updater/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace ASB_Updater
4 | {
5 | public partial class App : Application
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/ASB-Updater/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-midnight
2 | title: ARK Smart Breeding
3 | description: "A tool for the game ARK: Survival Evolved. Extracts possible levelups of creatures to get the levels to plan the best breeding."
4 |
--------------------------------------------------------------------------------
/ASB-Updater/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ARKBreedingStats/json/creatureNamesM.txt:
--------------------------------------------------------------------------------
1 | Austin
2 | Bran
3 | Cosmo
4 | Dearborn
5 | Eclipse
6 | Fuzz
7 | Gazoo
8 | Hercules
9 | Indy
10 | Jiggles
11 | Lightning
12 | Marble
13 | Noah
14 | Pepper
15 | Rancher
16 | Sparkler
17 | Tweeter
18 | Whiskers
19 | Zion
--------------------------------------------------------------------------------
/ARKBreedingStats/miscClasses/FtpCredentials.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.miscClasses
2 | {
3 | public class FtpCredentials
4 | {
5 | public string Username { get; set; }
6 |
7 | public string Password { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/ARKBreedingStats/library/Player.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.Library
2 | {
3 | public class Player
4 | {
5 | public string PlayerName;
6 | public string Tribe;
7 | public int Level;
8 | public int Rank;
9 | public string Note;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/ARKBreedingStats/json/variantsDefaultUnselected.txt:
--------------------------------------------------------------------------------
1 | Alpha
2 | Beta
3 | Boss
4 | Corrupted
5 | Escort
6 | FinalBattle
7 | Gamma
8 | Gauntlet
9 | Gauntlet2
10 | Hunt
11 | LifeLabyrinth
12 | Mega
13 | Minion
14 | Mission
15 | Race
16 | Race2
17 | Retrieve
18 | Sport
19 | Summoned
20 | TekCave
21 | Unused
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/TroughControl.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 |
3 | namespace ARKBreedingStats.uiControls
4 | {
5 | public partial class TroughControl : UserControl
6 | {
7 | public TroughControl()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/ARKBreedingStats/Asb.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats
2 | {
3 | public static class Asb
4 | {
5 | ///
6 | /// Source of an action.
7 | ///
8 | public enum TriggerSource
9 | {
10 | User,
11 | FileWatcher
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ARKBreedingStats/NamePatterns/PatternTemplates.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace ARKBreedingStats.NamePatterns
4 | {
5 | [JsonObject]
6 | public struct PatternTemplates
7 | {
8 | public string Format;
9 | public string Version;
10 | public PatternTemplate[] Patterns;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/ARKBreedingStats/json/creatureNamesU.txt:
--------------------------------------------------------------------------------
1 | Acorn
2 | Bailey
3 | Blaze
4 | Casey
5 | Caramel
6 | Dara
7 | Echo
8 | Fluffy
9 | Goldy
10 | Harper
11 | Indie
12 | Java
13 | Kiwi
14 | Lake
15 | Marley
16 | Max
17 | Ninja
18 | Olive
19 | Onyx
20 | Phoenix
21 | Quinn
22 | Riley
23 | Sable
24 | Scout
25 | Smokey
26 | Sunny
27 | Tiny
28 | Waffles
--------------------------------------------------------------------------------
/ARKBreedingStats/library/Note.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.Library
2 | {
3 | public class Note
4 | {
5 | public string Title;
6 | public string Text;
7 |
8 | public Note() { }
9 |
10 | public Note(string title)
11 | {
12 | Title = title;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/ARKBreedingStats/ocr/PatternMatching/Coords.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.ocr.PatternMatching
2 | {
3 | public class Coords
4 | {
5 | public Coords(int x, int y)
6 | {
7 | X = x;
8 | Y = y;
9 | }
10 |
11 | public int X { get; }
12 |
13 | public int Y { get; }
14 | }
15 | }
--------------------------------------------------------------------------------
/ARKBreedingStats/json/ignoreSpeciesClasses.json:
--------------------------------------------------------------------------------
1 | [
2 | "Raft_BP_C",
3 | "MotorRaft_BP_C",
4 | "Barge_BP_C",
5 | "CPCanoeBoat_eco_C",
6 | "IRaft_BP_C",
7 | "GalleonRaft_BP_C",
8 | "CogRaft_BP_C",
9 | "TekHoverSkiff_Character_BP_C",
10 | "BP_HoverSkiff_C",
11 | "TargetActor_C",
12 | "Canoe_BP_C",
13 | "Zeppelin_Character_BP"
14 | ]
15 |
--------------------------------------------------------------------------------
/ARKBreedingStats/testCases/ExtractionTestCases.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Xml.Serialization;
4 |
5 | namespace ARKBreedingStats.testCases
6 | {
7 | [Serializable]
8 | public class ExtractionTestCases
9 | {
10 | [XmlArray]
11 | public List testCases = new List();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ARKBreedingStats/json/speciesSpecificExtractionFails.json:
--------------------------------------------------------------------------------
1 | {
2 | "Gigantoraptor": "The Gigantoraptor is impossible to extract if they've both been obtained from the taming minigame and been imprinted since. It's too many unknown variables. Importing them before imprinting works, although you might need to force ASB into Tamed mode during import. Alternatively their offspring should import fine."
3 | }
4 |
--------------------------------------------------------------------------------
/ARKBreedingStats/ocr/PatternMatching/TrainingSettings.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 |
3 | namespace ARKBreedingStats.ocr.PatternMatching
4 | {
5 | public class TrainingSettings
6 | {
7 | [DefaultValue(true)]
8 | public bool IsTrainingEnabled = true;
9 | public bool SkipName;
10 | public bool SkipTribe;
11 | public bool SkipOwner;
12 | }
13 | }
--------------------------------------------------------------------------------
/ARKBreedingStats/AsbServer/ServerSendName.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.AsbServer
2 | {
3 | ///
4 | /// Contains properties for sending a creature name via server connection.
5 | ///
6 | internal class ServerSendName
7 | {
8 | public string CreatureName;
9 | public string ConnectionToken;
10 | public string ExportId;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/ARKBreedingStats/json/values/ATLAS/_manifestCustom.json:
--------------------------------------------------------------------------------
1 | {
2 | "format": "1.14-flyerspeed",
3 | "files": {
4 | "ATLAS_values.json": {
5 | "version": "410.11.10518855",
6 | "format": "1.14-flyerspeed",
7 | "mod": {
8 | "id": "ATLAS",
9 | "tag": "ATLAS",
10 | "title": "ATLAS"
11 | }
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/ASB-Updater/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/ARKBreedingStats/library/Tribe.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.Library
2 | {
3 | public class Tribe
4 | {
5 | public string TribeName = "";
6 | public Relation TribeRelation = Tribe.Relation.Neutral;
7 | public string Note = "";
8 |
9 | public enum Relation
10 | {
11 | Neutral,
12 | Allied,
13 | Friendly,
14 | Hostile
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ARKBreedingStats/json/creatureNamesF.txt:
--------------------------------------------------------------------------------
1 | Aurora
2 | Bess
3 | Bones
4 | Breeze
5 | Casey
6 | Casia
7 | Catlin
8 | Chromy
9 | Chuckles
10 | Cosmo
11 | Cupcake
12 | Danele
13 | Daphne
14 | Durva
15 | Electra
16 | Ellie
17 | Elora
18 | Flare
19 | Ginger
20 | Hope
21 | Indigo
22 | Jackie
23 | Layka
24 | Myst
25 | Nectar
26 | Oracle
27 | Pandora
28 | Peachy
29 | Peanuts
30 | Princess
31 | Raye
32 | Sabre
33 | Shellbie
34 | Shine
35 | Tia
36 | Vanity
37 | Wilde
38 | Zara
--------------------------------------------------------------------------------
/ARKBreedingStats/oldLibraryFormat/TimerListEntryOld.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 |
4 | namespace ARKBreedingStats
5 | {
6 | [Serializable]
7 | [XmlType(TypeName = "TimerListEntry")]
8 | public class TimerListEntryOld
9 | {
10 | public DateTime time;
11 | public string name;
12 | public string sound;
13 | public string group;
14 | public Guid creatureGuid = Guid.Empty;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ARKBreedingStats/NamePatterns/PatternTemplate.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace ARKBreedingStats.NamePatterns
4 | {
5 | ///
6 | /// A name pattern for a specific usage with explanation, can be selected by the user from a template list.
7 | ///
8 | [JsonObject]
9 | public class PatternTemplate
10 | {
11 | public string Pattern;
12 | public string Title;
13 | public string Description;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/TextBoxSuggest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace ARKBreedingStats.uiControls
5 | {
6 | public class TextBoxSuggest : TextBox
7 | {
8 | public TextBoxSuggest()
9 | {
10 | Enter += TextBoxSuggest_Enter;
11 | }
12 |
13 | private void TextBoxSuggest_Enter(object sender, EventArgs e)
14 | {
15 | BeginInvoke((Action)SelectAll);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/ARKBreedingStats/utils/Logging.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace ARKBreedingStats.utils
5 | {
6 | internal class Logging
7 | {
8 | internal static void Log(string text, string logFileName = null)
9 | {
10 | if (string.IsNullOrEmpty(logFileName))
11 | logFileName = "log.txt";
12 | File.AppendAllText(logFileName, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}: {text}{Environment.NewLine}");
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/ARKBreedingStats/SpeciesImages/FileHashList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace ARKBreedingStats.SpeciesImages
5 | {
6 | [JsonObject]
7 | internal class FileHashList
8 | {
9 | [JsonProperty("files")]
10 | public Dictionary Files;
11 | }
12 |
13 | [JsonObject]
14 | internal class SpeciesImageFileInfo
15 | {
16 | [JsonProperty("hash")]
17 | public string Hash;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/ARKBreedingStats/species/Kibble.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace ARKBreedingStats.species
5 | {
6 | [Serializable]
7 | public class Kibble : Dictionary
8 | {
9 | public string RecipeAsText()
10 | {
11 | string result = "";
12 |
13 | foreach (string s in Keys)
14 | {
15 | result += $"\n {this[s]} × {s}";
16 | }
17 |
18 | return result;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ARKBreedingStats/Updater/ValueModule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace ARKBreedingStats.Updater
5 | {
6 | ///
7 | /// Generic class for data in a module with format and version.
8 | ///
9 | [JsonObject]
10 | public class ValueModule where T : class
11 | {
12 | public Version Format;
13 | public Version Version;
14 | ///
15 | /// Data of the module.
16 | ///
17 | public T Data;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/ARKBreedingStats/species/ColorPattern.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.species
2 | {
3 | ///
4 | /// Info about color region pattern. This is used if a species has multiple color region patterns.
5 | ///
6 | public class ColorPattern
7 | {
8 | ///
9 | /// Color region that represents a pattern id (and not a color id).
10 | ///
11 | public int selectRegion;
12 | ///
13 | /// Number of patterns.
14 | ///
15 | public int count;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ARKBreedingStats/NamePatterns/NamePatternEntry.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace ARKBreedingStats.NamePatterns
5 | {
6 | ///
7 | /// A keyword or function for using in NamePatterns.
8 | ///
9 | internal class NamePatternEntry : Panel
10 | {
11 | internal string FilterString;
12 |
13 | internal NamePatternEntry()
14 | {
15 | //BorderStyle = BorderStyle.FixedSingle;
16 | Height = 30;
17 | Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/ARKBreedingStats/StatsOptions/StatOptionsBase.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.StatsOptions
2 | {
3 | public abstract class StatOptionsBase
4 | {
5 | public abstract void Initialize();
6 |
7 | public abstract void PrepareForSaving(bool isRoot);
8 |
9 | ///
10 | /// If true don't use values of parent but overrides of this object.
11 | ///
12 | public bool OverrideParent;
13 |
14 | ///
15 | /// Contains data and doesn't depend on parent data.
16 | ///
17 | public abstract bool DefinesData();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/ARKBreedingStats/settings/FtpCredentials.cs:
--------------------------------------------------------------------------------
1 | using ARKBreedingStats.miscClasses;
2 | using System.Windows.Forms;
3 |
4 | namespace ARKBreedingStats.settings
5 | {
6 | public partial class FtpCredentialsForm : Form
7 | {
8 | public FtpCredentialsForm()
9 | {
10 | InitializeComponent();
11 | }
12 |
13 | public FtpCredentials Credentials => new FtpCredentials
14 | {
15 | Username = textBox_Username.Text,
16 | Password = textBox_Password.Text
17 | };
18 |
19 | public bool SaveCredentials => checkBox_SaveCredentials.Checked;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ARKBreedingStats/utils/ArkWiki.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 |
3 | namespace ARKBreedingStats.utils
4 | {
5 | ///
6 | /// Links to the ARK wiki.
7 | ///
8 | public static class ArkWiki
9 | {
10 | private const string WikiBaseUrl = "https://ark.wiki.gg/wiki/";
11 |
12 | public static string WikiUrl(string pageName) => $"{WikiBaseUrl}{pageName}";
13 |
14 | ///
15 | /// Opens the page in the Ark wiki with the default browser.
16 | ///
17 | public static void OpenPage(string pageName) => Process.Start(WikiUrl(pageName));
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/ARKBreedingStats/json/kibbles.json:
--------------------------------------------------------------------------------
1 | {"ver":"316.0","kibble":{"Basic":{"Extra Small Egg":1,"Mejoberry":5,"Amarberry":10,"Tintoberry":10,"Cooked Meat":1,"Fiber":5,"Water":1},"Simple":{"Small Egg":1,"Mejoberry":5,"Rockarrot":2,"Cooked Fish Meat":1,"Fiber":5,"Water":1},"Regular":{"Medium Egg":1,"Longrass":2,"Savoroot":2,"Cooked Meat Jerky":1,"Fiber":5,"Water":1},"Superior":{"Large Egg":1,"Citronal":2,"Rare Mushroom":2,"Prime Meat Jerky":1,"Sap":1,"Fiber":5,"Water":1},"Exceptional":{"Extra Large Egg":1,"Mejoberry":10,"Rare Flower":1,"Focal Chili":1,"Fiber":5,"Water":1},"Extraordinary":{"Special Egg":1,"Mejoberry":10,"Giant Bee Honey":1,"Lazarus Chowder":1,"Fiber":5,"Water":1}}}
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [coldino]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: cadaei
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/ARKBreedingStats/ocr/PatternMatching/TextData.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace ARKBreedingStats.ocr.PatternMatching
4 | {
5 | ///
6 | /// Represents all the possible patterns for a specific string, usually one character.
7 | ///
8 | public class TextData
9 | {
10 | ///
11 | /// The text represented by the Patterns.
12 | ///
13 | public string Text { get; set; }
14 |
15 | ///
16 | /// All the known patterns for the Text.
17 | ///
18 | public List Patterns { get; set; } = new List();
19 | }
20 | }
--------------------------------------------------------------------------------
/ARKBreedingStats/_manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "format": "1.0",
3 | "modules":{
4 | "ARK Smart Breeding": {
5 | "Id": "ARK Smart Breeding",
6 | "Category": "main",
7 | "version": "0.71.2.0"
8 | },
9 | "NamePatternTemplates": {
10 | "Id": "NamePatternTemplates",
11 | "Category": "Name Pattern Templates",
12 | "Name": "Name Pattern Templates",
13 | "Description": "Templates for naming patterns",
14 | "Url": "https://raw.githubusercontent.com/cadon/ARKStatsExtractor/refs/heads/master/ARKBreedingStats/json/namePatternTemplates.json",
15 | "LocalPath": "json/namePatternTemplates.json",
16 | "version": "2024.8.3"
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/ButtonAddTime.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace ARKBreedingStats.uiControls
5 | {
6 | class ButtonAddTime : Button
7 | {
8 | public TimeSpan timeSpan;
9 |
10 | public delegate void addTimerEventHandler(TimeSpan timeSpan);
11 |
12 | public event addTimerEventHandler addTimer;
13 |
14 | public ButtonAddTime()
15 | {
16 | timeSpan = new TimeSpan(0, 1, 0);
17 | Click += ButtonAddTime_Click;
18 | }
19 |
20 | private void ButtonAddTime_Click(object sender, EventArgs e)
21 | {
22 | addTimer(timeSpan);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/ARKBreedingStats/duplicates/MergingDuplicatesUI.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace ARKBreedingStats.duplicates
5 | {
6 | public partial class MergingDuplicatesUI : UserControl
7 | {
8 | private MergingDuplicates mergingDuplicates;
9 |
10 | public MergingDuplicatesUI()
11 | {
12 | InitializeComponent();
13 | mergingDuplicates = new MergingDuplicates();
14 | }
15 |
16 | private void btUseLeft_Click(object sender, EventArgs e) { }
17 |
18 | private void btUseRight_Click(object sender, EventArgs e) { }
19 |
20 | private void btKeepBoth_Click(object sender, EventArgs e) { }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/ARKBreedingStats/Properties/DataSources/ARKBreedingStats.settings.ATImportFileLocation.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | ARKBreedingStats.settings.ATImportFileLocation, ARK Smart Breeding, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/ARKBreedingStats/utils/Hashes.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace ARKBreedingStats.utils
4 | {
5 | internal static class Hashes
6 | {
7 | ///
8 | /// Combines a sequence of hash codes into a single hash code, preserving the order of the input hashes.
9 | ///
10 | public static int CombineOrderedHashes(IEnumerable hashes)
11 | {
12 | if (hashes == null) return 0;
13 | unchecked
14 | {
15 | var combinedHash = 17;
16 | foreach (var hash in hashes)
17 | combinedHash = combinedHash * 31 + hash;
18 |
19 | return combinedHash;
20 | }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ARKBreedingStats/ocr/PatternMatching/OcrUtils.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 |
3 | namespace ARKBreedingStats.ocr.PatternMatching
4 | {
5 | // TODO class needed? or remove?
6 | public static class OcrUtils
7 | {
8 | public static string BoolArrayToString(bool[,] arr)
9 | {
10 | var xSize = arr.GetLength(0);
11 | var ySize = arr.GetLength(1);
12 | StringBuilder sb = new StringBuilder(xSize * ySize);
13 | for (var y = 0; y < ySize; y++)
14 | {
15 | for (var x = 0; x < xSize; x++)
16 | {
17 | sb.Append(arr[x, y] ? '1' : '0');
18 | }
19 | sb.AppendLine();
20 | }
21 |
22 | return $"\r\n{sb}\r\n";
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/MultiSetterTag.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace ARKBreedingStats.uiControls
5 | {
6 | public partial class MultiSetterTag : UserControl
7 | {
8 | public MultiSetterTag()
9 | {
10 | InitializeComponent();
11 | }
12 |
13 | public MultiSetterTag(string tag)
14 | {
15 | InitializeComponent();
16 | cbTagChecked.Text = tag;
17 | cbTagChecked.ForeColor = SystemColors.GrayText;
18 | }
19 |
20 | public CheckState TagCheckState
21 | {
22 | get => cbTagChecked.CheckState;
23 | set => cbTagChecked.CheckState = value;
24 | }
25 |
26 | public string TagName => cbTagChecked.Text;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/ARKBreedingStats/StatResult.cs:
--------------------------------------------------------------------------------
1 | using ARKBreedingStats.miscClasses;
2 |
3 | namespace ARKBreedingStats
4 | {
5 | public class StatResult
6 | {
7 | public readonly int LevelWild;
8 | public readonly int LevelMut;
9 | public readonly int LevelDom;
10 | public readonly MinMaxDouble Te;
11 | public bool CurrentlyNotValid = false; // set to true if result violates other chosen result
12 |
13 | public StatResult(int levelWild, int levelDom, MinMaxDouble? te = null, int levelMut = 0)
14 | {
15 | LevelWild = levelWild;
16 | LevelMut = levelMut;
17 | LevelDom = levelDom;
18 | Te = te ?? new MinMaxDouble(-1);
19 | }
20 |
21 | public override string ToString() => $"w: {LevelWild}, m: {LevelMut}, d: {LevelDom}, TE: {Te.Mean:.000}";
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ARKBreedingStats/utils/ExceptionMessages.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ARKBreedingStats.utils
4 | {
5 | ///
6 | /// Displays exception message and its inner exceptions if existing.
7 | ///
8 | public static class ExceptionMessages
9 | {
10 | ///
11 | /// Exception message with inner exceptions
12 | ///
13 | public static string WithInner(Exception ex) =>
14 | ex.Message
15 | + "\n\n" + ex.GetType() + " in " + ex.Source
16 | + "\n\nMethod throwing the error: " + ex.TargetSite.DeclaringType?.FullName + "." +
17 | ex.TargetSite.Name
18 | + "\n\nStackTrace:\n" + ex.StackTrace
19 | + (ex.InnerException != null
20 | ? "\n\nInner Exception:\n" + WithInner(ex.InnerException)
21 | : string.Empty);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ARKBreedingStats/AsbServer/ProgressReportAsbServer.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using ARKBreedingStats.Library;
3 |
4 | namespace ARKBreedingStats.AsbServer
5 | {
6 | ///
7 | /// Info of progress reports while listening to an AsbServer.
8 | ///
9 | internal class ProgressReportAsbServer
10 | {
11 | public string JsonText;
12 | public string ServerHash;
13 | public string Message;
14 | public string ServerToken;
15 | ///
16 | /// Identification used to send an answer to the user.
17 | ///
18 | public string SendId;
19 | public bool IsError;
20 | public bool StoppedListening;
21 | public string ClipboardText;
22 | public TaskCompletionSource TaskNameGenerated;
23 | public CreatureFlags SetFlag;
24 | public long creatureId;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/ARKBreedingStats/species/SpeciesStat.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace ARKBreedingStats.species
5 | {
6 | [JsonObject]
7 | public class SpeciesStat
8 | {
9 | public double BaseValue;
10 | public double IncPerWildLevel;
11 | public double IncPerMutatedLevel;
12 | public double IncPerTamedLevel;
13 | public double AddWhenTamed;
14 | public double MultAffinity;
15 | ///
16 | /// If true adding a level will increase the stat value as a percentage of the stat value so far.
17 | /// If false adding a level will increase the stat value by a fixed value.
18 | /// This is true for most stats.
19 | ///
20 | public bool IncreaseStatAsPercentage = true;
21 | public double ValueCap;
22 |
23 | public double ApplyCap(double statValue) => Math.Min(statValue, ValueCap);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/ARKBreedingStats/ocr/PatternMatching/RecognizedCharData.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace ARKBreedingStats.ocr.PatternMatching
4 | {
5 | public class RecognizedCharData
6 | {
7 | public RecognizedCharData(int x, int y, byte yOffset)
8 | {
9 | Coords = new Coords(x, y);
10 | YOffset = yOffset;
11 | }
12 |
13 | ///
14 | /// Coordinates of the pattern in the containing bitmap.
15 | ///
16 | public Coords Coords { get; }
17 |
18 | ///
19 | /// Y offset if the pattern doesn't start at the top.
20 | ///
21 | public byte YOffset;
22 |
23 | public bool[,] Pattern { get; set; }
24 |
25 | public string Text;
26 |
27 | public override string ToString() => Text;
28 | //public override string ToString() => OcrUtils.BoolArrayToString(Pattern);
29 | }
30 | }
--------------------------------------------------------------------------------
/ARKBreedingStats/species/TamingFood.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace ARKBreedingStats.species
4 | {
5 | [JsonObject]
6 | public class TamingFood
7 | {
8 | ///
9 | /// Amount of affinity raise if one piece of this food is eaten.
10 | ///
11 | [JsonProperty("a")]
12 | public double affinity;
13 | ///
14 | /// Amount of food one of this food gives.
15 | ///
16 | [JsonProperty("f")]
17 | public double foodValue;
18 | ///
19 | /// When taming, some foods can only be feed in higher quantities, this indicates that amount.
20 | ///
21 | [JsonProperty("q")]
22 | public int quantity = 1;
23 |
24 | ///
25 | /// If the food data is not completely confirmed or tested, this is true.
26 | ///
27 | [JsonProperty("u")]
28 | public bool Unconfirmed;
29 | }
30 | }
--------------------------------------------------------------------------------
/ARKBreedingStats/DiceCoefficient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ARKBreedingStats
4 | {
5 | public static class DiceCoefficient
6 | {
7 | // https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient
8 |
9 | public static double diceCoefficient(string input, string compareTo)
10 | {
11 | string[] ibg = biGrams(input);
12 | string[] cbg = biGrams(compareTo);
13 | int matches = 0;
14 |
15 | foreach (string s in ibg)
16 | {
17 | if (Array.IndexOf(cbg, s) != -1) matches++;
18 | }
19 |
20 | return 2d * matches / (ibg.Length + cbg.Length);
21 | }
22 |
23 | private static string[] biGrams(string input)
24 | {
25 | input = "$" + input + "%";
26 | var bg = new string[input.Length - 1];
27 | for (int i = 0; i < input.Length - 1; i++)
28 | bg[i] = input.Substring(i, 2);
29 | return bg;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/ARKBreedingStats/Pedigree/IPedigreeCreature.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using ARKBreedingStats.Library;
3 | using ARKBreedingStats.uiControls;
4 |
5 | namespace ARKBreedingStats.Pedigree
6 | {
7 | public interface IPedigreeCreature
8 | {
9 | event PedigreeCreature.CreatureChangedEventHandler CreatureClicked;
10 |
11 | ///
12 | /// Edit the creature. Boolean parameter determines if the creature is virtual.
13 | ///
14 | event Action CreatureEdit;
15 |
16 | ///
17 | /// Display the best breeding partners for the given creature.
18 | ///
19 | event Action BestBreedingPartners;
20 |
21 | ///
22 | /// Display the creature in the pedigree.
23 | ///
24 | event Action DisplayInPedigree;
25 |
26 | ///
27 | /// Recalculate the breeding plan, e.g. if the cooldown was reset.
28 | ///
29 | event Action RecalculateBreedingPlan;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/ARKBreedingStats/species/CreatureColors.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 |
3 | namespace ARKBreedingStats.species
4 | {
5 | ///
6 | /// Static helper class to get ArkColor properties.
7 | ///
8 | public static class CreatureColors
9 | {
10 | ///
11 | /// Returns the name of a color by id.
12 | ///
13 | ///
14 | ///
15 | public static string CreatureColorName(byte colorId) => values.Values.V.Colors.ById(colorId).Name;
16 |
17 | ///
18 | /// Returns the Color struct of an ArkColor by id.
19 | ///
20 | ///
21 | ///
22 | public static Color CreatureColor(byte colorId) => values.Values.V.Colors.ById(colorId).Color;
23 |
24 | ///
25 | /// Returns the ArkColor by id.
26 | ///
27 | public static ArkColor CreatureArkColor(byte colorId) => values.Values.V.Colors.ById(colorId);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 cadon
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/ARKBreedingStats/species/BreedingData.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace ARKBreedingStats.species
4 | {
5 | [JsonObject(MemberSerialization.OptIn)]
6 | public class BreedingData
7 | {
8 | [JsonProperty]
9 | public double gestationTime;
10 | ///
11 | /// GestationTime with the according multipliers applied.
12 | ///
13 | public double gestationTimeAdjusted;
14 | [JsonProperty]
15 | public double incubationTime;
16 | public double incubationTimeAdjusted;
17 | [JsonProperty]
18 | public double maturationTime;
19 | public double maturationTimeAdjusted;
20 | [JsonProperty]
21 | public double matingTime;
22 | public double matingTimeAdjusted;
23 | [JsonProperty]
24 | public double matingCooldownMin;
25 | public double matingCooldownMinAdjusted;
26 | [JsonProperty]
27 | public double matingCooldownMax;
28 | public double matingCooldownMaxAdjusted;
29 | [JsonProperty]
30 | public double eggTempMin;
31 | [JsonProperty]
32 | public double eggTempMax;
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/ARKBreedingStats/species/BreedingPair.cs:
--------------------------------------------------------------------------------
1 | using ARKBreedingStats.BreedingPlanning;
2 | using ARKBreedingStats.Library;
3 |
4 | namespace ARKBreedingStats.species
5 | {
6 | public class BreedingPair
7 | {
8 | public readonly Creature Mother;
9 | public readonly Creature Father;
10 | public Score BreedingScore;
11 | ///
12 | /// Probability of at least one mutation for the offspring.
13 | ///
14 | public double MutationProbability;
15 | ///
16 | /// The highest possible offspring is over the level limit if all possible dom levels are applied (server setting).
17 | ///
18 | public bool HighestOffspringOverLevelLimit;
19 |
20 | public BreedingPair(Creature mother, Creature father, Score breedingScore, double mutationProbability, bool highestOffspringOverLevelLimit)
21 | {
22 | Mother = mother;
23 | Father = father;
24 | BreedingScore = breedingScore;
25 | MutationProbability = mutationProbability;
26 | HighestOffspringOverLevelLimit = highestOffspringOverLevelLimit;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ARKBreedingStats/utils/RepositoryInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 |
3 | namespace ARKBreedingStats.utils
4 | {
5 | ///
6 | /// Information regarding the repository of this project.
7 | ///
8 | internal static class RepositoryInfo
9 | {
10 | internal const string RepositoryUrl = "https://github.com/cadon/ARKStatsExtractor/";
11 |
12 | private static string WikiPageLink(string pageName) => $"{RepositoryUrl}wiki/{pageName}";
13 |
14 | ///
15 | /// Opens the page in the repository wiki with the default browser.
16 | ///
17 | internal static void OpenWikiPage(string pageName) => Process.Start(WikiPageLink(pageName));
18 |
19 | ///
20 | /// Invite link for the ARK Smart Breeding discord link.
21 | ///
22 | internal const string DiscordServerInviteLink = "https://discord.gg/qCYYbQK";
23 |
24 | ///
25 | /// Link of the export gun mod.
26 | ///
27 | internal const string ExportGunModPage = "https://www.curseforge.com/ark-survival-ascended/mods/ark-smart-breeding-export-gun";
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ASB-Updater/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ASB_Updater.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/ARKBreedingStats/utils/LevelColorBar.cs:
--------------------------------------------------------------------------------
1 | using ARKBreedingStats.StatsOptions;
2 | using System.Windows.Forms;
3 |
4 | namespace ARKBreedingStats.utils
5 | {
6 | internal static class LevelColorBar
7 | {
8 | internal static void SetLevelBar(Panel panel, StatLevelColors statColors, int maxBarLength, int level, bool useCustomOdd = true, bool mutationLevel = false)
9 | {
10 | const int minBarWidthForNonZeroValues = 3;
11 | if (statColors == null) return;
12 | var range = statColors.GetLevelRange(level, out var lowerBound, useCustomOdd, mutationLevel);
13 | if (range < 1) range = 1;
14 | var lengthPercentage = 100d * (level - lowerBound) / range; // in percentage of the max bar width
15 |
16 | var length = 0;
17 | if (lengthPercentage > 0)
18 | {
19 | if (lengthPercentage > 100) lengthPercentage = 100;
20 | length = (int)((maxBarLength - minBarWidthForNonZeroValues) * lengthPercentage / 100 + minBarWidthForNonZeroValues);
21 | }
22 |
23 | panel.Width = length;
24 | panel.BackColor = statColors.GetLevelColor(level, useCustomOdd, mutationLevel);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/ARKBreedingStats/_manifest.tt:
--------------------------------------------------------------------------------
1 | <#@ template debug="false" hostspecific="true" language="C#" #>
2 | <#@ assembly name="System.Core" #>
3 | <#@ import namespace="System.Linq" #>
4 | <#@ import namespace="System.Text" #>
5 | <#@ import namespace="System.Collections.Generic" #>
6 | <#@ import namespace="System.IO" #>
7 | <#@ import namespace="System.Text.RegularExpressions" #>
8 | <#@ output extension=".json" #>
9 | <#
10 | string appVersion = Regex.Match(File.ReadAllText(Host.ResolvePath("Properties/AssemblyInfo.cs")), "AssemblyFileVersion\\(\"([^\"]*)\"").Groups[1].Value;
11 | #>
12 | {
13 | "format": "1.0",
14 | "modules":{
15 | "ARK Smart Breeding": {
16 | "Id": "ARK Smart Breeding",
17 | "Category": "main",
18 | "version": "<#= appVersion #>"
19 | },
20 | "NamePatternTemplates": {
21 | "Id": "NamePatternTemplates",
22 | "Category": "Name Pattern Templates",
23 | "Name": "Name Pattern Templates",
24 | "Description": "Templates for naming patterns",
25 | "Url": "https://raw.githubusercontent.com/cadon/ARKStatsExtractor/refs/heads/master/ARKBreedingStats/json/namePatternTemplates.json",
26 | "LocalPath": "json/namePatternTemplates.json",
27 | "version": "2024.8.3"
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ARKBreedingStats/StatsOptions/TopStatsSettings/ConsiderTopStats.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace ARKBreedingStats.StatsOptions.TopStatsSettings
4 | {
5 | ///
6 | /// Setting which stats are considered in top stats calculation.
7 | ///
8 | [JsonObject(MemberSerialization.OptIn)]
9 | public class ConsiderTopStats : StatOptionsBase
10 | {
11 | [JsonProperty("top", DefaultValueHandling = DefaultValueHandling.Ignore)]
12 | public bool ConsiderStat;
13 |
14 | ///
15 | /// Override parent setting.
16 | ///
17 | [JsonProperty("ovr", DefaultValueHandling = DefaultValueHandling.Ignore)]
18 | public bool OverrideParentBool;
19 |
20 | public override void Initialize()
21 | {
22 | OverrideParent = OverrideParentBool;
23 | }
24 |
25 | public override void PrepareForSaving(bool isRoot)
26 | {
27 | OverrideParentBool = OverrideParent || isRoot;
28 | }
29 |
30 | public override bool DefinesData() => true;
31 |
32 | public static ConsiderTopStats GetDefault() => new ConsiderTopStats
33 | {
34 | OverrideParent = true,
35 | ConsiderStat = true
36 | };
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/TroughControl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.uiControls
2 | {
3 | partial class TroughControl
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | components = new System.ComponentModel.Container();
32 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
33 | }
34 |
35 | #endregion
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/ARKBreedingStats/Updater/AsbManifest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace ARKBreedingStats.Updater
5 | {
6 | ///
7 | /// Contains infos about the versions of different parts of this application
8 | ///
9 | [JsonObject(MemberSerialization.OptIn)]
10 | internal class AsbManifest
11 | {
12 | ///
13 | /// Must be present and a supported value.
14 | ///
15 | [JsonProperty]
16 | private string format;
17 |
18 | ///
19 | /// Returns true if the format of the manifest file is supported by this application.
20 | ///
21 | internal static bool IsFormatSupported(string format) => !string.IsNullOrEmpty(format) && format == "1.0";
22 |
23 | ///
24 | /// Dictionary of app-modules. The key is the id of the module.
25 | ///
26 | [JsonProperty]
27 | public Dictionary modules;
28 |
29 | //internal static AsbManifest FromJsonString(string json) => JsonConvert.DeserializeObject(json);
30 | internal static AsbManifest FromJsonFile(string filePath) => FileService.LoadJsonFile(filePath, out AsbManifest manifest, out _) ? manifest : null;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/ARKBreedingStats/duplicates/MergingDuplicatesWindow.cs:
--------------------------------------------------------------------------------
1 | using ARKBreedingStats.Library;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Windows.Forms;
5 |
6 | namespace ARKBreedingStats.duplicates
7 | {
8 | public partial class MergingDuplicatesWindow : Form
9 | {
10 | private readonly MergingDuplicates mergingDuplicates;
11 | public delegate void RefreshLibraryEventHandler();
12 | #pragma warning disable 67
13 | public event RefreshLibraryEventHandler RefreshLibrary;
14 | #pragma warning restore 67
15 |
16 | public MergingDuplicatesWindow()
17 | {
18 | InitializeComponent();
19 | mergingDuplicates = new MergingDuplicates
20 | {
21 | ProgressBar = progressBar1
22 | };
23 | }
24 |
25 | public void CheckForDuplicates(List creatureList)
26 | {
27 | mergingDuplicates.CheckForDuplicates(creatureList);
28 | }
29 |
30 | private void btUseLeft_Click(object sender, EventArgs e)
31 | {
32 |
33 | }
34 |
35 | private void btUseRight_Click(object sender, EventArgs e)
36 | {
37 |
38 | }
39 |
40 | private void btKeepBoth_Click(object sender, EventArgs e)
41 | {
42 |
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/ARKBreedingStats/Settings.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.Properties {
2 |
3 |
4 | // This class allows you to handle specific events on the settings class:
5 | // The SettingChanging event is raised before a setting's value is changed.
6 | // The PropertyChanged event is raised after a setting's value is changed.
7 | // The SettingsLoaded event is raised after the setting values are loaded.
8 | // The SettingsSaving event is raised before the setting values are saved.
9 | internal sealed partial class Settings {
10 |
11 | public Settings() {
12 | // // To add event handlers for saving and changing settings, uncomment the lines below:
13 | //
14 | // this.SettingChanging += this.SettingChangingEventHandler;
15 | //
16 | // this.SettingsSaving += this.SettingsSavingEventHandler;
17 | //
18 | }
19 |
20 | private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
21 | // Add code to handle the SettingChangingEvent event here.
22 | }
23 |
24 | private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
25 | // Add code to handle the SettingsSaving event here.
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/ARKBreedingStats/oldLibraryFormat/IncubationTimerEntryOld.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 |
4 | namespace ARKBreedingStats
5 | {
6 | [Serializable]
7 | [XmlType(TypeName = "IncubationTimerEntry")]
8 | public class IncubationTimerEntryOld
9 | {
10 | public bool timerIsRunning;
11 | [XmlIgnore]
12 | public TimeSpan incubationDuration;
13 | public DateTime incubationEnd;
14 | public Guid motherGuid;
15 | public Guid fatherGuid;
16 |
17 | public IncubationTimerEntryOld()
18 | {
19 | incubationDuration = new TimeSpan();
20 | incubationEnd = new DateTime();
21 | }
22 |
23 | // XmlSerializer does not support TimeSpan, so use this property for serialization instead.
24 | [System.ComponentModel.Browsable(false)]
25 | [XmlElement(DataType = "duration", ElementName = "incubationDuration")]
26 | public string incubationDurationString
27 | {
28 | get
29 | {
30 | return System.Xml.XmlConvert.ToString(incubationDuration);
31 | }
32 | set
33 | {
34 | incubationDuration = string.IsNullOrEmpty(value) ?
35 | TimeSpan.Zero : System.Xml.XmlConvert.ToTimeSpan(value);
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/ScrollForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 |
5 | namespace ARKBreedingStats.uiControls
6 | {
7 | ///
8 | /// Invisible form for scrolling while holding the left mouse button.
9 | ///
10 | public partial class ScrollForm : Form
11 | {
12 | ///
13 | /// Mouse was moved to coordinates.
14 | ///
15 | public event Action Moved;
16 |
17 | private Point _centerOffset;
18 |
19 | public ScrollForm()
20 | {
21 | InitializeComponent();
22 | Capture = true;
23 | }
24 |
25 | public void SetLocation(Point p)
26 | {
27 | Location = p;
28 | _centerOffset = PointToScreen(new Point(Width / 2, Height / 2));
29 | _centerOffset = new Point(-_centerOffset.X, -_centerOffset.Y);
30 | }
31 |
32 | private void ScrollForm_MouseUp(object sender, MouseEventArgs e) => Close();
33 |
34 | private void ScrollForm_MouseLeave(object sender, EventArgs e) => Close();
35 |
36 | private void ScrollForm_MouseMove(object sender, MouseEventArgs e)
37 | {
38 | if (Moved == null) return;
39 | var p = Cursor.Position;
40 | p.Offset(_centerOffset);
41 | Moved(p.X, p.Y);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/ARKBreedingStats/settings/ATImportFileLocation.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.settings
2 | {
3 |
4 | public class ATImportFileLocation
5 | {
6 | public string ConvenientName { get; }
7 | public string ServerName { get; }
8 | public string FileLocation { get; }
9 | public bool ImportWithQuickImport { get; set; }
10 |
11 | public ATImportFileLocation() { }
12 |
13 | public ATImportFileLocation(string convenientName, string serverName, string fileLocation, bool quickImport = false)
14 | {
15 | ConvenientName = convenientName;
16 | ServerName = serverName;
17 | FileLocation = fileLocation;
18 | ImportWithQuickImport = quickImport;
19 | }
20 |
21 | public static ATImportFileLocation CreateFromString(string path)
22 | {
23 | string[] pathParts = path.Split('|');
24 |
25 | return pathParts.Length == 3 ?
26 | new ATImportFileLocation(pathParts[0], pathParts[1], pathParts[2])
27 | : pathParts.Length == 4 ?
28 | new ATImportFileLocation(pathParts[0], pathParts[1], pathParts[2], pathParts[3] == "True")
29 | : new ATImportFileLocation(path, string.Empty, path);
30 | }
31 |
32 | public override string ToString() => $"{ConvenientName}|{ServerName}|{FileLocation}|{ImportWithQuickImport}";
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/ARKBreedingStats/ocr/PatternMatching/ImageUtils.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Drawing.Imaging;
3 |
4 | namespace ARKBreedingStats.ocr.PatternMatching
5 | {
6 | public static class ImageUtils
7 | {
8 | ///
9 | /// Creates a boolean 2 dim array representing the passed image depending on the threshold.
10 | ///
11 | public static bool[,] GetBooleanArrayOfImage(Image img, byte whiteThreshold)
12 | {
13 | var w = img.Width;
14 | var h = img.Height;
15 |
16 | var arr = new bool[w, h];
17 |
18 | var bmpData = ((Bitmap)img).LockBits(new Rectangle(0, 0, img.Width, img.Height), ImageLockMode.ReadOnly, img.PixelFormat);
19 | var bBytes = img.PixelFormat == PixelFormat.Format32bppArgb ? 4 : 3;
20 | unsafe
21 | {
22 | byte* scan0 = (byte*)bmpData.Scan0.ToPointer();
23 |
24 | for (var x = 0; x < w; x++)
25 | {
26 | for (var y = 0; y < h; y++)
27 | {
28 | byte* b = scan0 + y * bmpData.Stride + x * bBytes;
29 |
30 | if (ArkOcr.HslLightness(b[0], b[1], b[2]) >= whiteThreshold)
31 | arr[x, y] = true;
32 | }
33 | }
34 | }
35 | ((Bitmap)img).UnlockBits(bmpData);
36 |
37 | return arr;
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/ARKBreedingStats/settings/FtpProgress.cs:
--------------------------------------------------------------------------------
1 | using FluentFTP;
2 | using System;
3 | using System.Diagnostics;
4 | using System.Threading;
5 | using System.Windows.Forms;
6 |
7 | namespace ARKBreedingStats.settings
8 | {
9 | public partial class FtpProgressForm : Form, IProgress
10 | {
11 | public FtpProgressForm(CancellationTokenSource cancellationTokenSource)
12 | {
13 | InitializeComponent();
14 | FormClosing += (sender, args) => cancellationTokenSource.Cancel();
15 | }
16 |
17 | public string StatusText
18 | {
19 | get => StatusLabel.Text;
20 | set => StatusLabel.Text = value;
21 | }
22 |
23 | public string FileName { get; set; }
24 | private readonly Stopwatch _stopwatch = new Stopwatch();
25 |
26 | public void Report(FtpProgress value)
27 | {
28 | if (value.Progress < 100 && _stopwatch.IsRunning && _stopwatch.ElapsedMilliseconds < 250)
29 | {
30 | // only update the progress every 250ms unless setting it to 100%
31 | return;
32 | }
33 |
34 | var statusText = $"Downloading {FileName}\r\n{value.Progress:F0}% complete\r\n{value.TransferSpeedToString()}";
35 | StatusLabel.Invoke(new Action(() => StatusLabel.Text = statusText));
36 | _stopwatch.Restart();
37 | }
38 |
39 | private void button_Cancel_Click(object sender, EventArgs e) => Close();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/ARKBreedingStats/species/ColorRegion.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System.Collections.Generic;
3 |
4 | namespace ARKBreedingStats.species
5 | {
6 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)]
7 | public class ColorRegion
8 | {
9 | [JsonProperty]
10 | public string name;
11 |
12 | ///
13 | /// List of natural occurring color names.
14 | ///
15 | [JsonProperty]
16 | public List colors;
17 |
18 | ///
19 | /// This region is not visible in game if true.
20 | ///
21 | [JsonProperty]
22 | public bool invisible;
23 |
24 | ///
25 | /// List of natural occurring ARKColors.
26 | ///
27 | public List naturalColors;
28 |
29 | public ColorRegion()
30 | {
31 | name = Loc.S("Unknown");
32 | }
33 |
34 | ///
35 | /// Sets the ARKColor objects for the natural occurring colors.
36 | ///
37 | internal void Initialize(ArkColors arkColors)
38 | {
39 | if (colors == null) return;
40 | naturalColors = new List();
41 | foreach (var c in colors)
42 | {
43 | ArkColor cl = arkColors.ByName(c);
44 | if (cl.Id != 0 && !naturalColors.Contains(cl))
45 | naturalColors.Add(cl);
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/ARKBreedingStats/mods/ModInfo.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 | using System.Runtime.Serialization;
4 |
5 | namespace ARKBreedingStats.mods
6 | {
7 | ///
8 | /// Contains infos about a mod and its version
9 | ///
10 | [JsonObject(MemberSerialization.OptIn)]
11 | public class ModInfo
12 | {
13 | [JsonProperty("version")]
14 | private string _version;
15 | public Version Version;
16 | [JsonProperty("format")]
17 | public string Format;
18 | [JsonProperty("mod")]
19 | public Mod Mod;
20 | ///
21 | /// Indicates if the according json-file is downloaded.
22 | ///
23 | public bool LocallyAvailable;
24 | ///
25 | /// If true the modInfo is available online. If not it's probably manually created.
26 | ///
27 | public bool OnlineAvailable;
28 | ///
29 | /// Only used in the mod selector, is not reliable else.
30 | ///
31 | public bool CurrentlyInLibrary;
32 |
33 | [OnDeserialized]
34 | private void SetVersion(StreamingContext _) => Version = Utils.TryParseVersionAlsoWithOnlyMajor(_version);
35 |
36 | public override string ToString() =>
37 | (Mod?.Title ?? "unknown mod")
38 | + (OnlineAvailable
39 | ? (!LocallyAvailable ? " (DL)" : string.Empty)
40 | : string.IsNullOrEmpty(Mod?.FileName) ? string.Empty : " (Custom)");
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/ARKBreedingStats/SpeciesImages/ImageCompositions.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using System.Linq;
4 | using ARKBreedingStats.species;
5 | using ARKBreedingStats.utils;
6 |
7 | namespace ARKBreedingStats.SpeciesImages
8 | {
9 | internal static class ImageCompositions
10 | {
11 | ///
12 | /// Key is simple species name or blueprint path.
13 | ///
14 | private static Dictionary _speciesImageCompositions;
15 |
16 | public static ImageComposition GetComposition(Species species)
17 | => _speciesImageCompositions == null ? null
18 | : _speciesImageCompositions.TryGetValue(species.blueprintPath, out var comp) ? comp
19 | : _speciesImageCompositions.TryGetValue(species.name, out comp) ? comp
20 | : null;
21 |
22 | public static void LoadCompositions()
23 | {
24 | var filePath = FileService.GetJsonPath("imageCompositions.json");
25 | if (!File.Exists(filePath)) return;
26 | if (!FileService.LoadJsonFile(filePath, out Dictionary comps,
27 | out var errorMessage))
28 | {
29 | _speciesImageCompositions = null;
30 | MessageBoxes.ShowMessageBox(errorMessage, "Error when loading species image compositions.");
31 | return;
32 | }
33 |
34 | _speciesImageCompositions = comps?.Any() == true ? comps : null;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/ARKBreedingStats/OffspringPossibilities.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats
2 | {
3 | partial class OffspringPossibilities
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.SuspendLayout();
32 | //
33 | // OffspringPossibilities
34 | //
35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | this.Name = "OffspringPossibilities";
38 | this.Size = new System.Drawing.Size(300, 200);
39 | this.ResumeLayout(false);
40 |
41 | }
42 |
43 | #endregion
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/ARKBreedingStats/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ARK Smart Breeding")]
9 | [assembly: AssemblyDescription("Extracts stats of creatures of the game ARK: Survival Evolved, saves them in a library, suggests breeding pairs and shows them in a list or pedigree.")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ARK Smart Breeding")]
13 | [assembly: AssemblyCopyright("Copyright © 2015 – 2025, main developer cadon")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("991563ce-6b2c-40ae-bc80-a14f090a4d26")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | [assembly: AssemblyVersion("1.0.0.0")]
33 | [assembly: AssemblyFileVersion("0.71.2.0")]
34 | [assembly: NeutralResourcesLanguage("en")]
35 |
36 |
--------------------------------------------------------------------------------
/ARKBreedingStats/Kibbles.cs:
--------------------------------------------------------------------------------
1 | using ARKBreedingStats.species;
2 | using Newtonsoft.Json;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 |
7 | namespace ARKBreedingStats
8 | {
9 | [JsonObject(MemberSerialization.OptIn)]
10 | public class Kibbles
11 | {
12 | [JsonProperty]
13 | private string ver = "0.0";
14 |
15 | [JsonProperty]
16 | public Dictionary kibble = new Dictionary();
17 |
18 | public Version version = new Version(0, 0);
19 | private static Kibbles _K;
20 | public static Kibbles K => _K ?? (_K = new Kibbles());
21 |
22 | public bool LoadValues(out string errorMessage)
23 | {
24 | _K.version = new Version(0, 0);
25 |
26 | string filePath = FileService.GetJsonPath(FileService.KibblesJson);
27 | if (!File.Exists(filePath))
28 | {
29 | errorMessage = $"Kibble file {FileService.KibblesJson} not found. This tool will not show kibble recipes without this file.";
30 | }
31 | else if (FileService.LoadJsonFile(filePath, out Kibbles tempK, out string errorMessageFileLoading))
32 | {
33 | _K = tempK;
34 | _K.version = new Version(_K.ver);
35 | errorMessage = null;
36 | return true;
37 | }
38 | else
39 | {
40 | errorMessage = $"File {FileService.KibblesJson} couldn\'t be opened or read.\nErrormessage:\n\n{errorMessageFileLoading}";
41 | }
42 | return false;
43 | }
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/StatGraphs.cs:
--------------------------------------------------------------------------------
1 | using ARKBreedingStats.species;
2 | using System.Windows.Forms.DataVisualization.Charting;
3 |
4 | namespace ARKBreedingStats.uiControls
5 | {
6 | internal class StatGraphs : Chart
7 | {
8 | readonly Series serie;
9 |
10 | public StatGraphs()
11 | {
12 | serie = new Series("Stat")
13 | {
14 | ChartType = SeriesChartType.Column
15 | };
16 | Series.Add(serie);
17 | ChartAreas.Add("Stat");
18 | ChartAreas[0].AxisX.Minimum = 0;
19 | }
20 |
21 | public void SetGraph(Species species, int statIndex, int wildLevels, int mutatedLevel, int domLevels, bool tamed, double TE, double imprinting)
22 | {
23 | if (species != null && statIndex >= 0 && statIndex < 12)
24 | {
25 | SpeciesStat stat = species.stats[statIndex];
26 | serie.Points.Clear();
27 | serie.Points.AddXY("Base", stat.BaseValue);
28 | serie.Points.AddXY("Wild", StatValueCalculation.CalculateValue(species, statIndex, wildLevels, mutatedLevel, 0, false, 0, 0));
29 | serie.Points.AddXY("Tamed", StatValueCalculation.CalculateValue(species, statIndex, wildLevels, mutatedLevel, 0, true, TE, 0));
30 | serie.Points.AddXY("Dom", StatValueCalculation.CalculateValue(species, statIndex, wildLevels, mutatedLevel, domLevels, true, TE, 0));
31 | serie.Points.AddXY("Impr", StatValueCalculation.CalculateValue(species, statIndex, wildLevels, mutatedLevel, domLevels, true, TE, imprinting));
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/TagSelectorList.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.uiControls
2 | {
3 | partial class TagSelectorList
4 | {
5 | ///
6 | /// Erforderliche Designervariable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Verwendete Ressourcen bereinigen.
12 | ///
13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Vom Komponenten-Designer generierter Code
24 |
25 | ///
26 | /// Erforderliche Methode für die Designerunterstützung.
27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.SuspendLayout();
32 | //
33 | // TagSelectorList
34 | //
35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | this.AutoScroll = true;
38 | this.Name = "TagSelectorList";
39 | this.Size = new System.Drawing.Size(261, 382);
40 | this.ResumeLayout(false);
41 |
42 | }
43 |
44 | #endregion
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/ARKBreedingStats/StatsOptions/StatsOptions.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace ARKBreedingStats.StatsOptions
4 | {
5 | ///
6 | /// Options for stats of species, e.g. breeding stat weights, graph representation and top stat considerations.
7 | ///
8 | [JsonObject(MemberSerialization.OptIn)]
9 | public class StatsOptions where T : StatOptionsBase
10 | {
11 | ///
12 | /// Name of the stats options, usually a species name or a group.
13 | ///
14 | [JsonProperty]
15 | public string Name;
16 |
17 | public override string ToString() => string.IsNullOrEmpty(Name) ? $"<{Loc.S("default")}>" : new string(' ', HierarchyLevel * 2) + Name;
18 |
19 | ///
20 | /// Name of the parent setting.
21 | ///
22 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
23 | public string ParentName;
24 |
25 | public StatsOptions ParentOptions;
26 |
27 | ///
28 | /// One option per stat.
29 | ///
30 | [JsonProperty]
31 | public T[] StatOptions;
32 |
33 | ///
34 | /// List of species these settings are valid.
35 | /// Possible values are the blueprint path and shorter defined names, e.g. Species.name, Species.DescriptiveName.
36 | ///
37 | [JsonProperty("sp", DefaultValueHandling = DefaultValueHandling.Ignore)]
38 | public string[] AffectedSpecies;
39 |
40 | ///
41 | /// Used for UI layout.
42 | ///
43 | public int HierarchyLevel;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/ColorPickerWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace ARKBreedingStats.uiControls
5 | {
6 | public partial class ColorPickerWindow : Form
7 | {
8 | public bool isShown;
9 | public ColorPickerControl Cp;
10 |
11 | public ColorPickerWindow()
12 | {
13 | InitializeComponent();
14 | Cp = ColorPickerControl1;
15 | Cp.Window = this;
16 | Cp.CancelButtonVisible(true);
17 | Load += ColorPickerWindow_Load;
18 | Cp.UserMadeSelection += ColorPickerHideWindow;
19 | Cp.HeightChanged += SetWindowHeight;
20 | Cp.MouseLeave += ColorPickerWindow_MouseLeave;
21 |
22 | TopMost = true;
23 | }
24 |
25 | private void SetWindowHeight(int height) => Height = height;
26 |
27 | private void ColorPickerWindow_Load(object sender, EventArgs e)
28 | {
29 | int y = Cursor.Position.Y - Height;
30 | if (y < 20) y = 20;
31 | SetDesktopLocation(Cursor.Position.X - 20, y);
32 | }
33 |
34 | private void ColorPickerWindow_MouseLeave(object sender, EventArgs e)
35 | {
36 | // mouse left, close
37 | if (!ClientRectangle.Contains(PointToClient(MousePosition)) || PointToClient(MousePosition).X == 0 || PointToClient(MousePosition).Y == 0)
38 | {
39 | ColorPickerHideWindow(false);
40 | }
41 | }
42 |
43 | private void ColorPickerHideWindow(bool colorChosen)
44 | {
45 | isShown = false;
46 | DialogResult = colorChosen ? DialogResult.OK : DialogResult.Cancel;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/ARKBreedingStats/testCases/ExtractionTestCase.cs:
--------------------------------------------------------------------------------
1 | using ARKBreedingStats.species;
2 | using ARKBreedingStats.values;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Xml.Serialization;
7 |
8 | namespace ARKBreedingStats.testCases
9 | {
10 | [Serializable]
11 | public class ExtractionTestCase
12 | {
13 | public string testName;
14 | public string speciesName;
15 | public string speciesBlueprintPath;
16 | public double[] statValues;
17 | public int[] levelsWild;
18 | public int[] levelsDom;
19 | public int[] levelsMut;
20 | public bool postTamed;
21 | public bool bred;
22 | public double tamingEff;
23 | public double imprintingBonus;
24 | public ServerMultipliers serverMultipliers;
25 | public bool AtlasSettings;
26 | public int maxWildLevel;
27 | public bool allowMoreThanHundredPercentImprinting;
28 | [XmlArray]
29 | private List modIDs;
30 | public int modListHash;
31 | [XmlIgnore]
32 | public int totalLevel => levelsWild[Stats.Torpidity] + 1 + levelsDom.Sum();
33 |
34 | public Species Species
35 | {
36 | set
37 | {
38 | speciesName = value?.name ?? string.Empty;
39 | speciesBlueprintPath = value?.blueprintPath ?? string.Empty;
40 | }
41 | }
42 |
43 | public List ModIDs
44 | {
45 | set
46 | {
47 | modIDs = value ?? new List();
48 | modListHash = Library.CreatureCollection.CalculateModListHash(modIDs);
49 | }
50 | get { return modIDs; }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/ARKBreedingStats/importExportGun/ExportGunFileExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.importExportGun
2 | {
3 | internal static class ExportGunFileExtensions
4 | {
5 | public static bool IsWild(this ExportGunCreatureFile ec)
6 | // wild creatures have a TE of 100 %, so don't use that here
7 | => string.IsNullOrEmpty(ec.DinoName)
8 | && string.IsNullOrEmpty(ec.TribeName)
9 | && string.IsNullOrEmpty(ec.OwningPlayerName)
10 | && string.IsNullOrEmpty(ec.ImprinterName)
11 | && ec.OwningPlayerID == 0
12 | ;
13 |
14 | public static bool IsBred(this ExportGunCreatureFile ec)
15 | => !string.IsNullOrEmpty(ec.ImprinterName) || (ec.DinoImprintingQuality > 0 && ec.TameEffectiveness > 0.9999);
16 |
17 |
18 | public static string Owner(this ExportGunCreatureFile ec)
19 | => !string.IsNullOrEmpty(ec.OwningPlayerName) ? ec.OwningPlayerName
20 | : !string.IsNullOrEmpty(ec.ImprinterName) ? ec.ImprinterName
21 | : ec.TamerString;
22 |
23 | ///
24 | /// Returns the stat value of this creature considering the offset for percentage based stats (i.e. 0 levels will return in most cases 1 == 100 %).
25 | /// If a stat is percentage based, Ark and this object internally store it as offset from 100 % (i.e. 0 levels equals in most cases 0 %).
26 | /// ASB expects the absolute value (i.e. 0 levels have an expected value in most cases of 100 %).
27 | ///
28 | public static float GetStatValue(this ExportGunCreatureFile ec, int statIndex)
29 | => ec == null ? 0 : ec.Stats[statIndex].Value + (Stats.IsPercentage(statIndex) ? 1 : 0);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/ARKBreedingStats/raising/ParentStatValues.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace ARKBreedingStats.raising
5 | {
6 | public partial class ParentStatValues : UserControl
7 | {
8 | public ParentStatValues()
9 | {
10 | InitializeComponent();
11 | labelM.TextAlign = ContentAlignment.MiddleRight;
12 | labelF.TextAlign = ContentAlignment.MiddleRight;
13 | }
14 |
15 | public string StatName
16 | {
17 | set => label1.Text = value;
18 | }
19 |
20 | internal void SetValues(double motherValue = -1, double fatherValue = -1, int highlight = 0, int bestLevel = -1, int bestLevelPercent = 0)
21 | {
22 | labelM.Text = motherValue >= 0 ? motherValue.ToString("N1") : "-";
23 | labelF.Text = fatherValue >= 0 ? fatherValue.ToString("N1") : "-";
24 | lbBest.Text = motherValue > fatherValue ? labelM.Text : labelF.Text;
25 | lbBestLevel.Text = bestLevel >= 0 ? $" [Lv {bestLevel}]" : "";
26 | lbBestLevel.BackColor = bestLevel >= 0 ? Utils.GetColorFromPercent(bestLevelPercent, 0.5) : SystemColors.Window;
27 | switch (highlight)
28 | {
29 | case 1:
30 | labelM.ForeColor = Color.DarkBlue;
31 | labelF.ForeColor = Color.DarkRed;
32 | break;
33 | case 2:
34 | labelF.ForeColor = Color.DarkBlue;
35 | labelM.ForeColor = Color.DarkRed;
36 | break;
37 | default:
38 | labelM.ForeColor = Color.Black;
39 | labelF.ForeColor = Color.Black;
40 | break;
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/ARKBreedingStats/oldLibraryFormat/CreatureValuesOld.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 |
4 | namespace ARKBreedingStats.oldLibraryFormat
5 | {
6 | ///
7 | /// Outdated, only used to convert.
8 | /// This class is used to store creature-values of creatures that couldn't be extracted, to store their values temporarily until the issue is solved.
9 | ///
10 | [Serializable]
11 | [XmlType(TypeName = "CreatureValues")]
12 | public class CreatureValuesOld
13 | {
14 | public string species; // the speciesName
15 | public Guid guid;
16 | public long ARKID;
17 | public string name;
18 | public Library.Sex sex;
19 | public double[] statValues = new double[Stats.StatsCount];
20 | public int[] levelsWild = new int[Stats.StatsCount];
21 | public int[] levelsDom = new int[Stats.StatsCount];
22 | public int level = 0;
23 | public double tamingEffMin, tamingEffMax;
24 | public double imprintingBonus;
25 | public bool isTamed, isBred;
26 | public string owner = "";
27 | public string imprinterName = "";
28 | public string tribe = "";
29 | public string server = "";
30 | public long fatherArkId; // used when importing creatures, parents are indicated by this id
31 | public long motherArkId;
32 | public Guid motherGuid;
33 | public Guid fatherGuid;
34 | public DateTime growingUntil = new DateTime(0);
35 | public DateTime cooldownUntil = new DateTime(0);
36 | public DateTime domesticatedAt = new DateTime(0);
37 | public bool neutered = false;
38 | public int mutationCounter, mutationCounterMother, mutationCounterFather;
39 | public int[] colorIDs = new int[6];
40 |
41 | public CreatureValuesOld() { }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/PopupMessage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 |
5 | namespace ARKBreedingStats.uiControls
6 | {
7 | internal class PopupMessage : Form
8 | {
9 | private Label _label;
10 |
11 | public PopupMessage()
12 | {
13 | Width = 600;
14 | Height = 400;
15 | FormBorderStyle = FormBorderStyle.None;
16 | ShowInTaskbar = false;
17 | BackColor = Color.LightGray;
18 | Padding = new Padding(2);
19 | StartPosition = FormStartPosition.CenterParent;
20 |
21 | var lClose = new Label
22 | {
23 | Text = Loc.S("click to close"),
24 | Dock = DockStyle.Bottom,
25 | TextAlign = ContentAlignment.MiddleCenter,
26 | BackColor = Color.LightSalmon
27 | };
28 | Controls.Add(lClose);
29 | lClose.Click += CloseClick;
30 |
31 | _label = new Label
32 | {
33 | Dock = DockStyle.Fill,
34 | ForeColor = Color.Gainsboro,
35 | BackColor = Color.Black,
36 | TextAlign = ContentAlignment.MiddleCenter
37 | };
38 | Controls.Add(_label);
39 | _label.Click += CloseClick;
40 | }
41 |
42 | public PopupMessage(string message, float fontSize = 8.25f) : this()
43 | {
44 | if (fontSize != 8.25f)
45 | _label.Font = new Font(_label.Font.FontFamily, fontSize);
46 | _label.Text = message;
47 | }
48 |
49 | public static void Show(Form parent, string message, float fontSize = 8.25f)
50 | {
51 | new PopupMessage(message, fontSize).ShowDialog(parent);
52 | }
53 |
54 | private void CloseClick(object sender, EventArgs e) => Close();
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/ARKBreedingStats/settings/ATImportExportedFolderLoactionDialog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace ARKBreedingStats.settings
5 | {
6 | public partial class ATImportExportedFolderLocationDialog : Form
7 | {
8 |
9 | public ATImportExportedFolderLocation ATImportExportedFolderLocation
10 | {
11 | get => new ATImportExportedFolderLocation(textBox_ConvenientName.Text,
12 | textBox_ownerSuffix.Text,
13 | textBox_FolderPath.Text,
14 | TbSetDefaultForLibraries.Text);
15 | set
16 | {
17 | textBox_ConvenientName.Text = value.ConvenientName;
18 | textBox_ownerSuffix.Text = value.OwnerSuffix;
19 | textBox_FolderPath.Text = value.FolderPath;
20 | TbSetDefaultForLibraries.Text = value.SetDefaultForLibraryFiles == null ? string.Empty
21 | : string.Join("; ", value.SetDefaultForLibraryFiles);
22 | }
23 | }
24 |
25 | public ATImportExportedFolderLocationDialog(ATImportExportedFolderLocation folderPath = null)
26 | {
27 | InitializeComponent();
28 | if (folderPath != null)
29 | {
30 | ATImportExportedFolderLocation = folderPath;
31 | }
32 | }
33 |
34 | private void button_FileSelect_Click(object sender, EventArgs e)
35 | {
36 | using (FolderBrowserDialog dlg = new FolderBrowserDialog())
37 | {
38 | string previousLocation = ATImportExportedFolderLocation.FolderPath;
39 | dlg.RootFolder = Environment.SpecialFolder.Desktop;
40 | if (!string.IsNullOrWhiteSpace(previousLocation))
41 | dlg.SelectedPath = previousLocation;
42 | if (dlg.ShowDialog() == DialogResult.OK)
43 | {
44 | textBox_FolderPath.Text = dlg.SelectedPath;
45 | }
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/ARKBreedingStats/importExportGun/ExportGunServerFile.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace ARKBreedingStats.importExportGun
4 | {
5 | ///
6 | /// Server multipliers as exported by the export gun mod.
7 | ///
8 | [JsonObject]
9 | internal class ExportGunServerFile
10 | {
11 | public int Version { get; set; }
12 | public double[] WildLevel { get; set; }
13 | public double[] TameLevel { get; set; }
14 | public double[] TameAdd { get; set; }
15 | public double[] TameAff { get; set; }
16 | public double WildLevelStepSize { get; set; }
17 | public double MaxWildLevel { get; set; }
18 | public int DestroyTamesOverLevelClamp { get; set; }
19 | public double TamingSpeedMultiplier { get; set; } = 1;
20 | public double WildDinoTorporDrainMultiplier { get; set; } = 1;
21 | public double DinoCharacterFoodDrainMultiplier { get; set; } = 1;
22 | public double WildDinoCharacterFoodDrainMultiplier { get; set; } = 1;
23 | public double TamedDinoCharacterFoodDrainMultiplier { get; set; } = 1;
24 | public double MatingSpeedMultiplier { get; set; } = 1;
25 | public double MatingIntervalMultiplier { get; set; } = 1;
26 | public double EggHatchSpeedMultiplier { get; set; } = 1;
27 | public double BabyMatureSpeedMultiplier { get; set; } = 1;
28 | public double BabyCuddleIntervalMultiplier { get; set; } = 1;
29 | public double BabyImprintAmountMultiplier { get; set; } = 1;
30 | public double BabyImprintingStatScaleMultiplier { get; set; } = 1;
31 | public double BabyFoodConsumptionSpeedMultiplier { get; set; } = 1;
32 | public bool AllowSpeedLeveling { get; set; }
33 | public bool AllowFlyerSpeedLeveling { get; set; }
34 | public bool UseSingleplayerSettings { get; set; }
35 | public string SessionName { get; set; }
36 |
37 | ///
38 | /// ASE or ASA
39 | ///
40 | public string Game { get; set; }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/ARKBreedingStats/ocr/HammingWeight.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.ocr
2 | {
3 | ///
4 | /// Lookup table to count set bits of a number.
5 | ///
6 | public static class HammingWeight
7 | {
8 | // Hamming-weight lookup-table, https://en.wikipedia.org/wiki/Hamming_weight
9 |
10 | private static byte[] _bitCounts = new byte[byte.MaxValue + 1];
11 |
12 | private static bool _hammingIsInitialized;
13 |
14 | ///
15 | /// Returns the number of 1-bits in an uint. E.g. 3 == 0b11 => 2, 4 == 0b100 => 1, 7 == 0b111 => 3.
16 | ///
17 | private static byte BitsSetCountWegner(uint input)
18 | {
19 | byte count;
20 | for (count = 0; input != 0; count++)
21 | {
22 | input &= input - 1; // turn off the rightmost 1-bit
23 | }
24 | return count;
25 | }
26 |
27 | ///
28 | /// Initialized bit counts if not yet done.
29 | ///
30 | public static void InitializeBitCounts()
31 | {
32 | if (_hammingIsInitialized) return;
33 |
34 | //// for ushort
35 | //_bitCounts = new byte[ushort.MaxValue + 1];
36 | //_bitCounts[ushort.MaxValue] = 16;
37 |
38 | // for byte
39 | _bitCounts = new byte[byte.MaxValue + 1];
40 | _bitCounts[byte.MaxValue] = 8;
41 |
42 | //for (uint i = 0; i < ushort.MaxValue; i++)
43 | for (uint i = 0; i < byte.MaxValue; i++)
44 | _bitCounts[i] = BitsSetCountWegner(i);
45 |
46 | _hammingIsInitialized = true;
47 | }
48 |
49 | ///
50 | /// Returns the number of set bits in the passed value.
51 | /// To compare two integers pass with xor ^
52 | ///
53 | public static int SetBitCount(byte i) => _bitCounts[i];
54 | //public static int SetBitCount(uint i) => _bitCounts[i & 0xFFFF] + _bitCounts[(i >> 16) & 0xFFFF];
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/ARKBreedingStats/utils/MessageBoxes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using ARKBreedingStats.uiControls;
4 |
5 | namespace ARKBreedingStats.utils
6 | {
7 | internal static class MessageBoxes
8 | {
9 | ///
10 | /// Displays a messageBox with the application name and version.
11 | ///
12 | ///
13 | /// If empty, a word depending on the MessageBoxIcon will be used.
14 | ///
15 | internal static void ShowMessageBox(string message, string title = null, MessageBoxIcon icon = MessageBoxIcon.Error, bool displayCopyMessageButton = false)
16 | {
17 | if (string.IsNullOrEmpty(title))
18 | {
19 | switch (icon)
20 | {
21 | case MessageBoxIcon.Warning:
22 | title = "Warning";
23 | break;
24 | case MessageBoxIcon.Information:
25 | title = "Info";
26 | break;
27 | default:
28 | title = Loc.S("error");
29 | break;
30 | }
31 | }
32 |
33 | if (displayCopyMessageButton)
34 | CustomMessageBox.Show(message, title, "OK", icon: icon, showCopyToClipboard: true);
35 | else
36 | MessageBox.Show(message, $"{title} - {Utils.ApplicationNameVersion}", MessageBoxButtons.OK, icon);
37 | }
38 |
39 | ///
40 | /// Displays an error message with info about the exception and the application name and version.
41 | ///
42 | internal static void ExceptionMessageBox(Exception ex, string messageBeforeException = null, string title = null) =>
43 | ShowMessageBox((string.IsNullOrEmpty(messageBeforeException) ? string.Empty : messageBeforeException + "\n\n") + ExceptionMessages.WithInner(ex), title, displayCopyMessageButton: true);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/ARKBreedingStats/library/TopLevels.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 |
3 | namespace ARKBreedingStats.library
4 | {
5 | ///
6 | /// Top levels per species.
7 | ///
8 | public class TopLevels
9 | {
10 | private readonly int[][] _levels;
11 | ///
12 | /// The minimum total level for a creature to have at least all current top levels.
13 | /// Offspring with less than that level miss at least one top level.
14 | ///
15 | public int MinLevelForTopCreature = -1;
16 |
17 | public TopLevels()
18 | {
19 | _levels = GetUninitialized();
20 | }
21 |
22 | public TopLevels(bool allZeros)
23 | {
24 | _levels = allZeros ? GetZeros() : GetUninitialized();
25 | }
26 |
27 | public int[] WildLevelsHighest
28 | {
29 | get => _levels[0];
30 | set => _levels[0] = value;
31 | }
32 | public int[] WildLevelsLowest
33 | {
34 | get => _levels[1];
35 | set => _levels[1] = value;
36 | }
37 | public int[] MutationLevelsHighest
38 | {
39 | get => _levels[2];
40 | set => _levels[2] = value;
41 | }
42 | public int[] MutationLevelsLowest
43 | {
44 | get => _levels[3];
45 | set => _levels[3] = value;
46 | }
47 |
48 | private int[][] GetZeros() => new[]
49 | {
50 | Enumerable.Repeat(0, Stats.StatsCount).ToArray(),
51 | Enumerable.Repeat(0, Stats.StatsCount).ToArray(),
52 | Enumerable.Repeat(0, Stats.StatsCount).ToArray(),
53 | Enumerable.Repeat(0, Stats.StatsCount).ToArray()
54 | };
55 |
56 | private int[][] GetUninitialized() => new[]
57 | {
58 | Enumerable.Repeat(0, Stats.StatsCount).ToArray(),
59 | Enumerable.Repeat(int.MaxValue, Stats.StatsCount).ToArray(),
60 | Enumerable.Repeat(0, Stats.StatsCount).ToArray(),
61 | Enumerable.Repeat(int.MaxValue, Stats.StatsCount).ToArray()
62 | };
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/ARKBreedingStats/species/CanHaveWildLevelExceptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using ARKBreedingStats.utils;
5 | using Newtonsoft.Json;
6 |
7 | namespace ARKBreedingStats.species
8 | {
9 | ///
10 | /// Usually a species has a defined set of stats which it can have wild levels and mutations.
11 | /// For some species these stats got changed.
12 | /// This can lead to issues when extracting a creature that has levels in these and the current definition doesn't allow this.
13 | /// This class contains the stats where creatures can have wild levels in a previous version of the game.
14 | ///
15 | [JsonObject(MemberSerialization.OptIn)]
16 | internal static class CanHaveWildLevelExceptions
17 | {
18 | [JsonProperty] public static Dictionary SpeciesStatBits;
19 |
20 | public static void LoadDefinitions()
21 | {
22 | const string fileName = "canHaveWildLevelExceptions.json";
23 | var filePath = FileService.GetJsonPath(fileName);
24 | if (!File.Exists(filePath))
25 | return;
26 |
27 | try
28 | {
29 | FileService.LoadJsonFile(filePath, out SpeciesStatBits, out var errorMessage);
30 | if (!string.IsNullOrEmpty(errorMessage))
31 | MessageBoxes.ShowMessageBox(errorMessage, "error when loading wild level exception file");
32 | }
33 | catch (Exception ex)
34 | {
35 | {
36 | MessageBoxes.ExceptionMessageBox(ex);
37 | }
38 | }
39 | }
40 |
41 | ///
42 | /// Returns the bit flags of stats that can have wild levels despite the current definitions doesn't contain them.
43 | ///
44 | public static int GetWildLevelExceptions(string speciesName)
45 | {
46 | if (SpeciesStatBits == null || string.IsNullOrEmpty(speciesName)) return 0;
47 | if (SpeciesStatBits.TryGetValue(speciesName, out var levelBits))
48 | return levelBits;
49 | return 0;
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/ARKBreedingStats/utils/CustomListBoxDrawing.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 | using System.Drawing;
3 | using static System.Windows.Forms.VisualStyles.VisualStyleElement.Header;
4 |
5 | namespace ARKBreedingStats.utils
6 | {
7 | internal static class CustomListBoxDrawing
8 | {
9 | ///
10 | /// Adds support for drawing separator lines if the item.ToString() == "---".
11 | ///
12 | ///
13 | public static void SupportSeparatorLines(this ListBox lb)
14 | {
15 | lb.DrawMode = DrawMode.OwnerDrawVariable;
16 | lb.MeasureItem += Lb_MeasureItem;
17 | lb.DrawItem += Lb_DrawItem;
18 | }
19 |
20 | public const string SeparatorString = "---";
21 |
22 | private static void Lb_MeasureItem(object sender, MeasureItemEventArgs e)
23 | {
24 | if (e.Index < 0 || !(sender is ListBox lb)) return;
25 | if (lb.Items[e.Index].ToString() == SeparatorString)
26 | e.ItemHeight = 5;
27 | else
28 | e.ItemHeight = TextRenderer.MeasureText(lb.Items[e.Index].ToString(), lb.Font).Height;
29 | }
30 |
31 | private static void Lb_DrawItem(object sender, DrawItemEventArgs e)
32 | {
33 | if (e.Index < 0 || !(sender is ListBox lb)) return;
34 |
35 | e.DrawBackground();
36 | var itemText = lb.Items[e.Index].ToString();
37 | Brush textBrush = new SolidBrush(e.ForeColor);
38 |
39 | if (itemText == SeparatorString)
40 | {
41 | // Draw separator line
42 | using (var pen = new Pen(Color.Gray, 1))
43 | {
44 | var midY = e.Bounds.Top + (e.Bounds.Height / 2);
45 | e.Graphics.DrawLine(pen, e.Bounds.Left + 5, midY, e.Bounds.Right - 5, midY);
46 | }
47 | }
48 | else
49 | {
50 | // Draw normal text
51 | e.Graphics.DrawString(itemText, e.Font, textBrush, e.Bounds.Left, e.Bounds.Top);
52 | }
53 |
54 | e.DrawFocusRectangle();
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/ScrollForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.uiControls
2 | {
3 | partial class ScrollForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.SuspendLayout();
32 | //
33 | // ScrollForm
34 | //
35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | this.BackColor = System.Drawing.Color.Black;
38 | this.ClientSize = new System.Drawing.Size(800, 800);
39 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
40 | this.Name = "ScrollForm";
41 | this.ShowInTaskbar = false;
42 | this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
43 | this.Text = "ScrollForm";
44 | this.TopMost = true;
45 | this.TransparencyKey = System.Drawing.Color.Black;
46 | this.MouseLeave += new System.EventHandler(this.ScrollForm_MouseLeave);
47 | this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ScrollForm_MouseMove);
48 | this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ScrollForm_MouseUp);
49 | this.ResumeLayout(false);
50 |
51 | }
52 |
53 | #endregion
54 | }
55 | }
--------------------------------------------------------------------------------
/ARKBreedingStats/BreedingPlanning/CurrentBreedingPair.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using ARKBreedingStats.Library;
3 | using Newtonsoft.Json;
4 |
5 | namespace ARKBreedingStats.BreedingPlanning
6 | {
7 | ///
8 | /// Represents a pair currently breeding.
9 | ///
10 | [JsonObject(MemberSerialization.OptIn)]
11 | public class CurrentBreedingPair
12 | {
13 | private Creature _mother;
14 | private Creature _father;
15 | [JsonProperty] public Guid GuidMother;
16 | [JsonProperty] public Guid GuidFather;
17 |
18 | public Creature Mother
19 | {
20 | get => _mother;
21 | set
22 | {
23 | _mother = value;
24 | GuidMother = value?.guid ?? Guid.Empty;
25 | }
26 | }
27 |
28 | public Creature Father
29 | {
30 | get => _father;
31 | set
32 | {
33 | _father = value;
34 | GuidFather = value?.guid ?? Guid.Empty;
35 | }
36 | }
37 |
38 | public DateTime StartedBreedingAt;
39 |
40 | public CurrentBreedingPair(Creature mother, Creature father)
41 | {
42 | Mother = mother;
43 | Father = father;
44 | StartedBreedingAt = DateTime.UtcNow;
45 | }
46 |
47 | public override int GetHashCode()
48 | {
49 | return GuidMother.GetHashCode() ^ GuidFather.GetHashCode();
50 | }
51 |
52 | public override bool Equals(object obj)
53 | {
54 | return obj is CurrentBreedingPair cbp
55 | && GuidFather == cbp.GuidFather
56 | && GuidMother == cbp.GuidMother;
57 | }
58 |
59 | public static bool operator ==(CurrentBreedingPair a, CurrentBreedingPair b)
60 | {
61 | if (ReferenceEquals(a, b)) return true;
62 | if (a is null || b is null) return false;
63 | return (a.GuidMother == b.GuidMother && a.GuidFather == b.GuidFather)
64 | || (a.GuidMother == b.GuidFather && a.GuidFather == b.GuidMother);
65 | }
66 |
67 | public static bool operator !=(CurrentBreedingPair a, CurrentBreedingPair b) => !(a == b);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/ARKBreedingStats/ocr/PatternMatching/CoordsData.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace ARKBreedingStats.ocr.PatternMatching
4 | {
5 | internal class CoordsData
6 | {
7 | public CoordsData(int minX, int maxX, int minY, int maxY)
8 | {
9 | MinY = minY;
10 | MaxY = maxY;
11 | MinX = minX;
12 | MaxX = maxX;
13 | }
14 |
15 | public List Coords { get; } = new List();
16 |
17 | public void Add(int x, int y)
18 | {
19 | if (x > MaxX)
20 | {
21 | MaxX = x;
22 | }
23 | else if (x < MinX)
24 | {
25 | MinX = x;
26 | }
27 |
28 | if (y > MaxY)
29 | {
30 | MaxY = y;
31 | }
32 | else if (y < MinY)
33 | {
34 | MinY = y;
35 | }
36 |
37 | Coords.Add(new Coords(x, y));
38 | }
39 |
40 | public int MinX { get; private set; }
41 | public int MaxX { get; private set; }
42 | private int MinY { get; set; }
43 | private int MaxY { get; set; }
44 |
45 | public RecognizedCharData ToRecognizedCharData()
46 | {
47 | var xSize = MaxX - MinX + 1;
48 | var ySize = MaxY - MinY + 1;
49 | var boolArr = new bool[xSize, ySize];
50 |
51 | foreach (var c in Coords)
52 | {
53 | var x = c.X - MinX;
54 | var y = c.Y - MinY;
55 | boolArr[x, y] = true;
56 | }
57 |
58 | return new RecognizedCharData(MinX, MinY, (byte)MinY)
59 | {
60 | Pattern = boolArr
61 | };
62 | }
63 |
64 | public void ToDebugConsole()
65 | {
66 | var xSize = MaxX - MinX + 1;
67 | var ySize = MaxY - MinY + 1;
68 | var boolArr = new bool[xSize, ySize];
69 |
70 | foreach (var c in Coords)
71 | {
72 | var x = c.X - MinX;
73 | var y = c.Y - MinY;
74 | boolArr[x, y] = true;
75 | }
76 |
77 | Boolean2DimArrayConverter.ToDebugLog(boolArr);
78 | }
79 | }
80 | }
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/RegionColorChooser.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.uiControls
2 | {
3 | partial class RegionColorChooser
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
32 | this.SuspendLayout();
33 | //
34 | // flowLayoutPanel1
35 | //
36 | this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
37 | this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
38 | this.flowLayoutPanel1.Name = "flowLayoutPanel1";
39 | this.flowLayoutPanel1.Size = new System.Drawing.Size(188, 45);
40 | this.flowLayoutPanel1.TabIndex = 32;
41 | //
42 | // RegionColorChooser
43 | //
44 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
45 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
46 | this.Controls.Add(this.flowLayoutPanel1);
47 | this.Margin = new System.Windows.Forms.Padding(0);
48 | this.Name = "RegionColorChooser";
49 | this.Size = new System.Drawing.Size(188, 45);
50 | this.ResumeLayout(false);
51 |
52 | }
53 |
54 | #endregion
55 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/MultiSetterTag.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.uiControls
2 | {
3 | partial class MultiSetterTag
4 | {
5 | ///
6 | /// Erforderliche Designervariable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Verwendete Ressourcen bereinigen.
12 | ///
13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Vom Komponenten-Designer generierter Code
24 |
25 | ///
26 | /// Erforderliche Methode für die Designerunterstützung.
27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.cbTagChecked = new System.Windows.Forms.CheckBox();
32 | this.SuspendLayout();
33 | //
34 | // cbTagChecked
35 | //
36 | this.cbTagChecked.AutoSize = true;
37 | this.cbTagChecked.Location = new System.Drawing.Point(3, 3);
38 | this.cbTagChecked.Name = "cbTagChecked";
39 | this.cbTagChecked.Size = new System.Drawing.Size(15, 14);
40 | this.cbTagChecked.TabIndex = 1;
41 | this.cbTagChecked.ThreeState = true;
42 | this.cbTagChecked.UseVisualStyleBackColor = true;
43 | //
44 | // MultiSetterTag
45 | //
46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
48 | this.Controls.Add(this.cbTagChecked);
49 | this.Name = "MultiSetterTag";
50 | this.Size = new System.Drawing.Size(202, 19);
51 | this.ResumeLayout(false);
52 | this.PerformLayout();
53 |
54 | }
55 |
56 | #endregion
57 | private System.Windows.Forms.CheckBox cbTagChecked;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/ASB-Updater/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
28 |
29 |
30 |
35 |
36 |
37 |
38 |
39 |
44 |
50 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/StatSelector.Designer.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace ARKBreedingStats.uiControls
3 | {
4 | partial class StatSelector
5 | {
6 | ///
7 | /// Required designer variable.
8 | ///
9 | private System.ComponentModel.IContainer components = null;
10 |
11 | ///
12 | /// Clean up any resources being used.
13 | ///
14 | /// true if managed resources should be disposed; otherwise, false.
15 | protected override void Dispose(bool disposing)
16 | {
17 | if (disposing && (components != null))
18 | {
19 | components.Dispose();
20 | }
21 | base.Dispose(disposing);
22 | }
23 |
24 | #region Component Designer generated code
25 |
26 | ///
27 | /// Required method for Designer support - do not modify
28 | /// the contents of this method with the code editor.
29 | ///
30 | private void InitializeComponent()
31 | {
32 | this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
33 | this.SuspendLayout();
34 | //
35 | // flowLayoutPanel1
36 | //
37 | this.flowLayoutPanel1.AutoSize = true;
38 | this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
39 | this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
40 | this.flowLayoutPanel1.Name = "flowLayoutPanel1";
41 | this.flowLayoutPanel1.Size = new System.Drawing.Size(271, 30);
42 | this.flowLayoutPanel1.TabIndex = 0;
43 | this.flowLayoutPanel1.WrapContents = false;
44 | //
45 | // StatSelector
46 | //
47 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
48 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
49 | this.AutoSize = true;
50 | this.Controls.Add(this.flowLayoutPanel1);
51 | this.Name = "StatSelector";
52 | this.Size = new System.Drawing.Size(271, 30);
53 | this.ResumeLayout(false);
54 | this.PerformLayout();
55 |
56 | }
57 |
58 | #endregion
59 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/ARKBreedingStats/SpeciesImages/Poses.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using ARKBreedingStats.species;
4 | using ARKBreedingStats.utils;
5 |
6 | namespace ARKBreedingStats.SpeciesImages
7 | {
8 | ///
9 | /// Pose id of species images.
10 | ///
11 | internal static class Poses
12 | {
13 | ///
14 | /// Key is blueprint path of species, value is pose number.
15 | ///
16 | internal static Dictionary SelectedPoses;
17 |
18 | private const string Filename = "selectedPoses.json";
19 |
20 | internal static void LoadPoses()
21 | {
22 | if (FileService.LoadJsonFileIfAvailable(FileService.GetJsonPath(Filename),
23 | out Dictionary ps, out var errorMessage)
24 | && ps.Any())
25 | SelectedPoses = ps;
26 | if (!string.IsNullOrEmpty(errorMessage))
27 | MessageBoxes.ShowMessageBox("Error when loading species image poses.\n\n" + errorMessage);
28 | }
29 |
30 | internal static void SavePoses()
31 | {
32 | var filePath = FileService.GetJsonPath(Filename);
33 | var keys = SelectedPoses?.Keys.ToArray();
34 | if (keys?.Any() != true)
35 | {
36 | FileService.TryDeleteFile(filePath);
37 | return;
38 | }
39 |
40 | foreach (var bp in keys)
41 | {
42 | if (SelectedPoses.TryGetValue(bp, out var p) && p == 0)
43 | SelectedPoses.Remove(bp);
44 | }
45 |
46 | if (SelectedPoses?.Any() != true)
47 | {
48 | FileService.TryDeleteFile(filePath);
49 | return;
50 | }
51 |
52 | if (!FileService.SaveJsonFile(filePath, SelectedPoses, out var errorMessage))
53 | MessageBoxes.ShowMessageBox("Error when saving species image poses.\n\n" + errorMessage);
54 | }
55 |
56 | internal static void SetPose(Species species, int pose)
57 | {
58 | if (SelectedPoses == null) SelectedPoses = new Dictionary();
59 | SelectedPoses[species.blueprintPath] = pose;
60 | }
61 |
62 | internal static int GetPose(Species species) =>
63 | SelectedPoses?.TryGetValue(species.blueprintPath, out var p) == true ? p : 0;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/ARKBreedingStats/TimerListEntry.cs:
--------------------------------------------------------------------------------
1 | using ARKBreedingStats.Library;
2 | using Newtonsoft.Json;
3 | using System;
4 |
5 | namespace ARKBreedingStats
6 | {
7 | [JsonObject(MemberSerialization.OptIn)]
8 | public class TimerListEntry
9 | {
10 | [JsonProperty]
11 | public DateTime time;
12 | [JsonProperty]
13 | public TimeSpan leftTime;
14 | [JsonProperty]
15 | public bool timerIsRunning;
16 | [JsonProperty]
17 | public string name;
18 | [JsonProperty]
19 | public string sound;
20 | [JsonProperty]
21 | public string group;
22 | public System.Windows.Forms.ListViewItem lvi;
23 | public bool showInOverlay;
24 | [JsonProperty]
25 | public Guid creatureGuid;
26 | private Creature _creature;
27 |
28 | public TimerListEntry()
29 | {
30 | timerIsRunning = true;
31 | }
32 |
33 | public Creature creature
34 | {
35 | get => _creature;
36 | set
37 | {
38 | _creature = value;
39 | creatureGuid = value?.guid ?? Guid.Empty;
40 | }
41 | }
42 |
43 | private void StartTimer()
44 | {
45 | if (!timerIsRunning)
46 | {
47 | timerIsRunning = true;
48 | time = DateTime.Now.Add(leftTime);
49 | lvi.SubItems[1].Text = time.ToString();
50 | }
51 | }
52 |
53 | private void PauseTimer()
54 | {
55 | if (timerIsRunning)
56 | {
57 | timerIsRunning = false;
58 | leftTime = time.Subtract(DateTime.Now);
59 | lvi.SubItems[1].Text = Loc.S("paused");
60 | }
61 | }
62 |
63 | public void StartStopTimer(bool start)
64 | {
65 | if (start)
66 | StartTimer();
67 | else PauseTimer();
68 | }
69 |
70 | // Serializer does not support TimeSpan directly, so use this property for serialization instead.
71 | [System.ComponentModel.Browsable(false)]
72 | [JsonProperty("timerDuration")]
73 | public string timerDurationString
74 | {
75 | get => System.Xml.XmlConvert.ToString(leftTime);
76 | set => leftTime = string.IsNullOrEmpty(value) ?
77 | TimeSpan.Zero : System.Xml.XmlConvert.ToTimeSpan(value);
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/ARKBreedingStats/utils/Themes.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace ARKBreedingStats.utils
5 | {
6 | ///
7 | /// Used for color themes.
8 | ///
9 | internal static class Themes
10 | {
11 | private static Color _foreColor;
12 | private static Color _backColor;
13 |
14 | internal static void SetColors(this Control control, Color backColor, Color foreColor)
15 | {
16 | _foreColor = foreColor;
17 | _backColor = backColor;
18 | control.SetControlColors(backColor, foreColor);
19 | }
20 |
21 | private static void SetControlColors(this Control control, Color backColor, Color foreColor)
22 | {
23 | control.BackColor = backColor;
24 | control.ForeColor = foreColor;
25 |
26 | foreach (Control c in control.Controls)
27 | c.SetControlColors(backColor, foreColor);
28 | }
29 |
30 | ///
31 | /// Set DrawMode of all tabControls to OwnerDrawFixed to draw them manually
32 | ///
33 | ///
34 | internal static void InitializeTabControls(this Control control)
35 | {
36 | if (control is TabControl tc)
37 | {
38 | tc.DrawMode = TabDrawMode.OwnerDrawFixed;
39 | tc.DrawItem += TabControl_DrawItem;
40 | }
41 |
42 | foreach (Control c in control.Controls)
43 | c.InitializeTabControls();
44 | }
45 |
46 | private static void TabControl_DrawItem(object sender, DrawItemEventArgs e)
47 | {
48 | var tc = (TabControl)sender;
49 | using (Brush bb = new SolidBrush(_backColor))
50 | using (Brush fb = new SolidBrush(_foreColor))
51 | {
52 | e.Graphics.FillRectangle(bb, e.Bounds);
53 | SizeF sz = e.Graphics.MeasureString(tc.TabPages[e.Index].Text, e.Font);
54 | e.Graphics.DrawString(tc.TabPages[e.Index].Text, e.Font, fb, e.Bounds.Left + (e.Bounds.Width - sz.Width) / 2, e.Bounds.Top + (e.Bounds.Height - sz.Height) / 2 + 1);
55 |
56 | Rectangle rect = e.Bounds;
57 | rect.Offset(0, 1);
58 | rect.Inflate(0, -1);
59 | e.Graphics.DrawRectangle(Pens.DarkGray, rect);
60 | e.DrawFocusRectangle();
61 | }
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/ARKBreedingStats/SpeciesImages/CreatureImageParameters.cs:
--------------------------------------------------------------------------------
1 | using ARKBreedingStats.Library;
2 | using System.Collections.Generic;
3 | using ARKBreedingStats.species;
4 |
5 | namespace ARKBreedingStats.SpeciesImages
6 | {
7 | ///
8 | /// Properties to uniquely identify a creature image.
9 | ///
10 | internal struct CreatureImageParameters
11 | {
12 | public Species Species;
13 | public string SpeciesName;
14 | ///
15 | /// Mod id or game name (ASA or ASE).
16 | ///
17 | public string ModName;
18 | public string CreatureSex;
19 | public string Pattern;
20 | public string Pose;
21 | ///
22 | /// Parameters combined. The file names are based on this.
23 | ///
24 | public string BaseParameters;
25 |
26 | public CreatureImageParameters(Species species, string game, Sex sex, int patternId, int pose)
27 | {
28 | Species = species;
29 | SpeciesName = species.name;
30 | ModName = species.Mod?.Id;
31 | if (string.IsNullOrEmpty(ModName))
32 | ModName = game;
33 | if (!string.IsNullOrEmpty(ModName))
34 | ModName = "_" + ModName;
35 | CreatureSex = sex == Sex.Female ? "_sf" : sex == Sex.Male ? "_sm" : string.Empty;
36 | Pattern = patternId >= 0 ? "_p" + patternId : string.Empty;
37 | Pose = pose >= 0 ? "_v" + pose : string.Empty; // v like variant
38 | // the file names are based on this.
39 | // it needs to have the following pattern [_][_s(m|f)][_]
40 | BaseParameters = $"{SpeciesName}{ModName}{CreatureSex}{Pattern}{Pose}";
41 | }
42 |
43 | ///
44 | /// Possible file names for this creature parameters without extension.
45 | ///
46 | public List GetPossibleSpeciesImageNames(string speciesName) => new List
47 | {
48 | speciesName + ModName + CreatureSex + Pattern + Pose,
49 | speciesName + ModName + Pattern + Pose,
50 | speciesName + CreatureSex + Pattern + Pose,
51 | speciesName + Pattern + Pose,
52 | speciesName + ModName + CreatureSex + Pattern,
53 | speciesName + ModName + Pattern,
54 | speciesName + CreatureSex + Pattern,
55 | speciesName + Pattern
56 | };
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/ARKBreedingStats/json/serverMultipliers.json:
--------------------------------------------------------------------------------
1 | {
2 | "format": "1.13",
3 | "version": "1.0",
4 | "serverMultiplierDictionary": {
5 | "official": {
6 | "statMultipliers": [
7 | [
8 | 0.14,
9 | 0.44,
10 | 0.2,
11 | 1
12 | ],
13 | null,
14 | null,
15 | null,
16 | null,
17 | null,
18 | null,
19 | null,
20 | [
21 | 0.14,
22 | 0.44,
23 | 0.17,
24 | 1
25 | ],
26 | null,
27 | null,
28 | null
29 | ]
30 | },
31 | "singleplayer": {
32 | "statMultipliers": [
33 | [
34 | 3.57142857,
35 | 2.27272727,
36 | 2.125,
37 | 1
38 | ],
39 | null,
40 | null,
41 | null,
42 | null,
43 | null,
44 | null,
45 | null,
46 | [
47 | 3.57142857,
48 | 2.27272727,
49 | 2.35294118,
50 | 1
51 | ],
52 | null,
53 | null,
54 | null
55 | ],
56 | "TamingSpeedMultiplier": 2.5,
57 | "MatingIntervalMultiplier": 0.125,
58 | "EggHatchSpeedMultiplier": 10,
59 | "BabyMatureSpeedMultiplier": 36.799,
60 | "BabyCuddleIntervalMultiplier": 0.167
61 | },
62 | "Small Tribes": {
63 | "TamingSpeedMultiplier": 3,
64 | "MatingIntervalMultiplier": 0.5,
65 | "EggHatchSpeedMultiplier": 2,
66 | "BabyMatureSpeedMultiplier": 2
67 | },
68 | "ARKpocalypse": {
69 | "TamingSpeedMultiplier": 3,
70 | "MatingIntervalMultiplier": 0.5,
71 | "EggHatchSpeedMultiplier": 3,
72 | "BabyMatureSpeedMultiplier": 3
73 | },
74 | "Classic PvP": {
75 | "TamingSpeedMultiplier": 2,
76 | "MatingIntervalMultiplier": 0.5,
77 | "EggHatchSpeedMultiplier": 2,
78 | "BabyMatureSpeedMultiplier": 2
79 | },
80 | "Conquest": {
81 | "TamingSpeedMultiplier": 2,
82 | "MatingIntervalMultiplier": 0.5,
83 | "EggHatchSpeedMultiplier": 2,
84 | "BabyMatureSpeedMultiplier": 2
85 | },
86 | "all 1": {
87 | "statMultipliers": [
88 | null,
89 | null,
90 | null,
91 | null,
92 | null,
93 | null,
94 | null,
95 | null,
96 | null,
97 | null,
98 | null,
99 | null
100 | ]
101 | }
102 | }
103 | }
--------------------------------------------------------------------------------
/ASB-Updater/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using System.Windows;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ASB Updater")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ASB Updater")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | //In order to begin building localizable applications, set
23 | //CultureYouAreCodingWith in your .csproj file
24 | //inside a . For example, if you are using US english
25 | //in your source files, set the to en-US. Then uncomment
26 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
27 | //the line below to match the UICulture setting in the project file.
28 |
29 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
30 |
31 |
32 | [assembly: ThemeInfo(
33 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
34 | //(used if a resource is not found in the page,
35 | // or application resource dictionaries)
36 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
37 | //(used if a resource is not found in the page,
38 | // app, or any theme specific resource dictionaries)
39 | )]
40 |
41 |
42 | // Version information for an assembly consists of the following four values:
43 | //
44 | // Major Version
45 | // Minor Version
46 | // Build Number
47 | // Revision
48 | //
49 | // You can specify all the values or you can default the Build and Revision Numbers
50 | // by using the '*' as shown below:
51 | // [assembly: AssemblyVersion("1.0.*")]
52 | [assembly: AssemblyVersion("1.0.0.0")]
53 | [assembly: AssemblyFileVersion("1.3.0.0")]
54 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/ColorPickerWindow.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.uiControls
2 | {
3 | partial class ColorPickerWindow
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.ColorPickerControl1 = new ARKBreedingStats.uiControls.ColorPickerControl();
32 | this.SuspendLayout();
33 | //
34 | // ColorPickerControl1
35 | //
36 | this.ColorPickerControl1.Dock = System.Windows.Forms.DockStyle.Fill;
37 | this.ColorPickerControl1.Location = new System.Drawing.Point(0, 0);
38 | this.ColorPickerControl1.Name = "ColorPickerControl1";
39 | this.ColorPickerControl1.Padding = new System.Windows.Forms.Padding(1);
40 | this.ColorPickerControl1.Size = new System.Drawing.Size(467, 414);
41 | this.ColorPickerControl1.TabIndex = 0;
42 | //
43 | // ColorPickerWindow
44 | //
45 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
46 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
47 | this.ClientSize = new System.Drawing.Size(467, 414);
48 | this.Controls.Add(this.ColorPickerControl1);
49 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
50 | this.Name = "ColorPickerWindow";
51 | this.ShowInTaskbar = false;
52 | this.Text = "ColorPickerWindow";
53 | this.ResumeLayout(false);
54 |
55 | }
56 |
57 | #endregion
58 |
59 | private ColorPickerControl ColorPickerControl1;
60 | }
61 | }
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/ArkVersionDialog.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace ARKBreedingStats.uiControls
5 | {
6 | internal class ArkVersionDialog : Form
7 | {
8 | public Ark.Game GameVersion;
9 | public bool UseSelectionAsDefault => _cbUseAsDefault?.Checked != false;
10 | private CheckBox _cbUseAsDefault;
11 |
12 | public ArkVersionDialog()
13 | {
14 | StartPosition = FormStartPosition.CenterParent;
15 | Text = Utils.ApplicationNameVersion;
16 | FormBorderStyle = FormBorderStyle.FixedToolWindow;
17 |
18 | const int margin = 20;
19 | const int buttonWidth = 160;
20 | const int buttonHeight = 50;
21 |
22 | Width = 3 * margin + 2 * buttonWidth + 15;
23 | Height = 5 * margin + buttonHeight + 30;
24 |
25 | var lb = new Label
26 | {
27 | Text = "Game version of new library",
28 | Width = Width,
29 | TextAlign = ContentAlignment.TopCenter,
30 | Top = margin
31 | };
32 |
33 | var btAse = new Button
34 | {
35 | Text = "ARK: Survival Evolved",
36 | Width = buttonWidth,
37 | Height = buttonHeight,
38 | Top = 2 * margin,
39 | Left = margin
40 | };
41 | var btAsa = new Button
42 | {
43 | Text = "ARK: Survival Ascended",
44 | Width = buttonWidth,
45 | Height = buttonHeight,
46 | Top = 2 * margin,
47 | Left = 2 * margin + buttonWidth
48 | };
49 | btAse.Click += (s, e) => Close(Ark.Game.Ase);
50 | btAsa.Click += (s, e) => Close(Ark.Game.Asa);
51 |
52 | _cbUseAsDefault = new CheckBox
53 | {
54 | Text = "Remember selection (can be changed in the settings)",
55 | AutoSize = true,
56 | Left = margin,
57 | Top = 3 * margin + buttonHeight
58 | };
59 |
60 | Controls.AddRange(new Control[] { btAse, btAsa, _cbUseAsDefault, lb });
61 | }
62 |
63 | public ArkVersionDialog(Form owner) : this()
64 | {
65 | Owner = owner;
66 | }
67 |
68 | private void Close(Ark.Game arkGame)
69 | {
70 | GameVersion = arkGame;
71 | Close();
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/ARKBreedingStats/json/aliases.json:
--------------------------------------------------------------------------------
1 | {
2 | "Ant": "Titanomyrma",
3 | "Ape": "Gigantopithecus",
4 | "Araneomorphus": "Araneo",
5 | "Argy": "Argentavis",
6 | "Armadillo": "Doedicurus",
7 | "Arthropleura": "Arthropluera",
8 | "Bat": "Onyc",
9 | "Beaver": "Castoroides",
10 | "Bigfoot": "Gigantopithecus",
11 | "Camel": "Morellatops (ScorchedEarth)",
12 | "Camelsaurus": "Morellatops (ScorchedEarth)",
13 | "Compsognathus": "Compy",
14 | "Crab": "Karkinos (Aberration)",
15 | "Crocodile": "Sarco",
16 | "Deer": "Megaloceros",
17 | "Direbear": "Dire Bear",
18 | "Dolphin": "Ichthyosaurus",
19 | "Dragonfly": "Meganeura",
20 | "Duck": "Hesperornis",
21 | "Eagle": "Argentavis",
22 | "Eel": "Electrophorus",
23 | "Elk": "Megaloceros",
24 | "Fish": "Coelacanth",
25 | "Fluffy Rex": "Yutyrannus",
26 | "Frog": "Beelzebufo",
27 | "Golem": "Rock Elemental (ScorchedEarth)",
28 | "Goose": "Hesperornis",
29 | "Gorilla": "Gigantopithecus",
30 | "Horse": "Equus",
31 | "Hyena": "Hyaenodon",
32 | "Jelly Fish": "Cnidaria",
33 | "Kangaroo": "Procoptodon",
34 | "Lizard": "Megalania",
35 | "Lobster": "Eurypterid",
36 | "Mantaray": "Manta",
37 | "Monkey": "Mesopithecus",
38 | "Moose": "Megaloceros",
39 | "Moth": "Lymantria (ScorchedEarth)",
40 | "Onychonycteris": "Onyc",
41 | "Pachycephalosaur": "Pachy",
42 | "Paraceratherium": "Paracer",
43 | "Parachute Bird": "Archaeopteryx",
44 | "Parasaurolophus": "Parasaur",
45 | "Pelican": "Pelagornis",
46 | "Penguin": "Kairuku",
47 | "Pig": "Daeodon",
48 | "Plesiosaurus": "Plesiosaur",
49 | "Ptero": "Pteranodon",
50 | "Quetzalcoatl": "Quetzal",
51 | "Quetzalcoatlus": "Quetzal",
52 | "Rhinoceros": "Woolly Rhino",
53 | "Roo": "Procoptodon",
54 | "Sabre": "Sabertooth",
55 | "Sabretooth": "Sabertooth",
56 | "Salamander": "Diplocaulus",
57 | "Sarcosuchus": "Sarco",
58 | "Scorpion": "Pulmonoscorpius",
59 | "Seagull": "Ichthyornis",
60 | "Shark": "Megalodon",
61 | "Sheep": "Ovis",
62 | "Snail": "Achatina",
63 | "Snake": "Titanoboa",
64 | "Spider": "Araneo",
65 | "Spinosaur": "Spino",
66 | "Spinosaurus": "Spino",
67 | "Spitter": "Dilo",
68 | "Squid": "Tusoteuthis",
69 | "Stag": "Megaloceros",
70 | "Tapy": "Tapejara",
71 | "Thief": "Pegomastax",
72 | "Tickle Chicken": "Therizinosaur",
73 | "Titanboa": "Titanoboa",
74 | "Titanosaurus": "Titanosaur",
75 | "Toad": "Beelzebufo",
76 | "Trex": "Rex",
77 | "Trike": "Triceratops",
78 | "Turtle": "Carbonemys",
79 | "Tyrannosaur": "Rex",
80 | "Tyrannosaurus Rex": "Rex",
81 | "Tyrannosaurus": "Rex",
82 | "Utahraptor": "Raptor",
83 | "Whale": "Basilosaurus"
84 | }
--------------------------------------------------------------------------------
/ARKBreedingStats/NamePatterns/NameList.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 |
5 | namespace ARKBreedingStats.NamePatterns
6 | {
7 | ///
8 | /// Loads a list of names from a file.
9 | ///
10 | internal static class NameList
11 | {
12 | ///
13 | /// Contains all name lists, key is the fileName suffix.
14 | ///
15 | private static readonly Dictionary NameLists = new Dictionary();
16 | private static readonly Dictionary ListFileCheckedAt = new Dictionary();
17 |
18 | ///
19 | /// Returns a name from a list. If the file wasn't checked recently, it's checked and reloaded.
20 | ///
21 | public static string GetName(int nameIndex = 0, string listSuffix = null)
22 | {
23 | if (nameIndex < 0) return null;
24 | var nameList = GetNameList(listSuffix);
25 | if (nameList == null || nameList.Length == 0) return null;
26 |
27 | if (nameIndex >= nameList.Length)
28 | nameIndex %= nameList.Length;
29 | return nameList[nameIndex];
30 | }
31 |
32 | ///
33 | /// Returns a name list.
34 | ///
35 | public static string[] GetNameList(string listSuffix = null)
36 | {
37 | if (listSuffix == null) listSuffix = string.Empty;
38 | string[] list;
39 | if (!ListFileCheckedAt.TryGetValue(listSuffix, out var checkedAt)
40 | || (DateTime.Now - checkedAt).TotalSeconds > 10
41 | || !NameLists.TryGetValue(listSuffix, out list))
42 | {
43 | list = LoadList(listSuffix, checkedAt);
44 | }
45 | return list;
46 | }
47 |
48 | private static string[] LoadList(string listSuffix, DateTime checkedAt)
49 | {
50 | var filePath = FileService.GetJsonPath("creatureNames" + listSuffix + ".txt");
51 |
52 | if (!File.Exists(filePath)) return null;
53 | try
54 | {
55 | if (new FileInfo(filePath).LastWriteTime > checkedAt)
56 | {
57 | var list = File.ReadAllLines(filePath);
58 | NameLists[listSuffix] = list;
59 | }
60 | ListFileCheckedAt[listSuffix] = DateTime.Now;
61 | return NameLists[listSuffix];
62 | }
63 | catch { }
64 | return null;
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/TagSelector.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 | using ARKBreedingStats.utils;
5 |
6 | namespace ARKBreedingStats.uiControls
7 | {
8 | public partial class TagSelector : UserControl
9 | {
10 | private tagStatus status;
11 | private ToolTip tt;
12 |
13 | public delegate void TagStatusChangedEventHandler();
14 |
15 | public event TagStatusChangedEventHandler OnTagChanged;
16 |
17 | public TagSelector()
18 | {
19 | InitializeComponent();
20 | status = tagStatus.indifferent;
21 | button1.Text = "○";
22 | button1.BackColor = SystemColors.Control;
23 | tt = new ToolTip();
24 | Disposed += TagSelector_Disposed;
25 | }
26 |
27 | private void TagSelector_Disposed(object sender, EventArgs e) => tt.RemoveAllAndDispose();
28 |
29 | private void button1_Click(object sender, EventArgs e)
30 | {
31 | if (status == tagStatus.indifferent)
32 | setStatus(tagStatus.include);
33 | else if (status == tagStatus.include)
34 | setStatus(tagStatus.exclude);
35 | else
36 | setStatus(tagStatus.indifferent);
37 | OnTagChanged?.Invoke();
38 | }
39 |
40 | private void setStatus(tagStatus s)
41 | {
42 | if (s == tagStatus.include)
43 | {
44 | status = tagStatus.include;
45 | button1.Text = "✓";
46 | button1.BackColor = Color.LightGreen;
47 | }
48 | else if (s == tagStatus.exclude)
49 | {
50 | status = tagStatus.exclude;
51 | button1.Text = "✕";
52 | button1.BackColor = Color.LightSalmon;
53 | }
54 | else
55 | {
56 | status = tagStatus.indifferent;
57 | button1.Text = "○";
58 | button1.BackColor = SystemColors.Control;
59 | }
60 | }
61 |
62 | public tagStatus Status
63 | {
64 | get => status;
65 | set => setStatus(value);
66 | }
67 |
68 | public string TagName
69 | {
70 | get => label1.Text;
71 | set
72 | {
73 | label1.Text = value;
74 | tt.SetToolTip(label1, value);
75 | }
76 | }
77 |
78 | public enum tagStatus
79 | {
80 | indifferent,
81 | include,
82 | exclude
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/ARKBreedingStats/settings/ATImportFileLocationDialog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Windows.Forms;
4 | using ARKBreedingStats.utils;
5 |
6 | namespace ARKBreedingStats.settings
7 | {
8 | public partial class ATImportFileLocationDialog : Form
9 | {
10 |
11 | public ATImportFileLocation AtImportFileLocation
12 | {
13 | get => new ATImportFileLocation(textBox_ConvenientName.Text,
14 | textBox_ServerName.Text, textBox_FileLocation.Text.Trim());
15 | set
16 | {
17 | textBox_ConvenientName.Text = value.ConvenientName;
18 | textBox_ServerName.Text = value.ServerName;
19 | textBox_FileLocation.Text = value.FileLocation;
20 | }
21 | }
22 |
23 | public ATImportFileLocationDialog(ATImportFileLocation fileLocation = null)
24 | {
25 | InitializeComponent();
26 | if (fileLocation != null)
27 | {
28 | AtImportFileLocation = fileLocation;
29 | }
30 | }
31 |
32 | private void button_FileSelect_Click(object sender, EventArgs e)
33 | {
34 | using (OpenFileDialog dlg = new OpenFileDialog())
35 | {
36 | if (!string.IsNullOrWhiteSpace(textBox_FileLocation.Text))
37 | {
38 | dlg.InitialDirectory = Path.GetDirectoryName(textBox_FileLocation.Text);
39 | }
40 | else if (ArkInstallationPath.GetListOfExportFolders(out var folders, out _))
41 | {
42 | foreach (var f in folders)
43 | {
44 | var savesFolderPath = Directory.GetParent(f.path)?.Parent?.FullName;
45 | if (savesFolderPath != null && Directory.Exists(savesFolderPath))
46 | {
47 | dlg.InitialDirectory = savesFolderPath;
48 | break;
49 | }
50 | }
51 | }
52 |
53 | dlg.FileName = Path.GetFileName(textBox_FileLocation.Text);
54 | dlg.Filter = "ARK savegame (*.ark)|*.ark|All files (*.*)|*.*";
55 | if (dlg.ShowDialog() == DialogResult.OK)
56 | {
57 | textBox_FileLocation.Text = dlg.FileName;
58 | }
59 | }
60 | }
61 |
62 | private void LlFtpHelp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
63 | {
64 | RepositoryInfo.OpenWikiPage("Ftp-access");
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/ARKBreedingStats/utils/ExtensionMethods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 |
5 | namespace ARKBreedingStats.utils
6 | {
7 | public static class ExtensionMethods
8 | {
9 | ///
10 | /// Returns the float precision of a given number.
11 | ///
12 | ///
13 | ///
14 | public static float FloatPrecision(this float x)
15 | {
16 | // Handle NaNs
17 | if (float.IsNaN(x))
18 | return x;
19 |
20 | // Return the correct EPSILON either side of zero
21 | float v;
22 | if (x == 0.0f)
23 | {
24 | v = BitConverter.ToSingle(BitConverter.GetBytes((UInt32)1), 0);
25 | return (x > 0) ? v : -v;
26 | }
27 |
28 | // Move one value to the next larger possible value
29 | UInt32 i = BitConverter.ToUInt32(BitConverter.GetBytes(x), 0) + 1;
30 | v = BitConverter.ToSingle(BitConverter.GetBytes(i), 0);
31 |
32 | return v - x;
33 | }
34 |
35 | ///
36 | /// Sets the Image property of the PictureBox to the passed Bitmap and disposes the previous Bitmap.
37 | ///
38 | public static void SetImageAndDisposeOld(this PictureBox pb, Bitmap bmp)
39 | {
40 | var oldBmp = pb.Image as Bitmap;
41 | pb.Image = bmp;
42 | oldBmp?.Dispose();
43 | }
44 |
45 | ///
46 | /// Returns the value part of this color (HSV model).
47 | ///
48 | public static float GetValue(this Color c) => (float)Math.Max(c.R, Math.Max(c.G, c.B)) / byte.MaxValue;
49 |
50 | ///
51 | /// Returns the hsv values of this color.
52 | ///
53 | public static (float h, float s, float v) GetHsv(this Color c) => (c.GetHue(), c.GetSaturation(), c.GetValue());
54 |
55 | ///
56 | /// Call when parent of tooltip is closed to avoid memory leak.
57 | ///
58 | ///
59 | public static void RemoveAllAndDispose(this ToolTip tt)
60 | {
61 | tt.RemoveAll();
62 | tt.Dispose();
63 | }
64 |
65 | ///
66 | /// Returns the area of the Bitmap object in a RectangleF.
67 | ///
68 | public static RectangleF GetBounds(this Bitmap bmp)
69 | => bmp == null ? RectangleF.Empty : new RectangleF(0, 0, bmp.Width, bmp.Height);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/ARKBreedingStats/utils/ControlExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Runtime.InteropServices;
4 | using System.Windows.Forms;
5 | using Acornima.Ast;
6 |
7 | namespace ARKBreedingStats.utils
8 | {
9 | public static class ControlExtensions
10 | {
11 | ///
12 | /// Prevents flickering of ListViews.
13 | ///
14 | ///
15 | ///
16 | public static void DoubleBuffered(this Control control, bool enable)
17 | {
18 | var doubleBufferPropertyInfo = control.GetType().GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
19 | doubleBufferPropertyInfo?.SetValue(control, enable, null);
20 | }
21 |
22 | [DllImport("user32.dll")]
23 | private static extern int SendMessage(IntPtr hWnd, int wMsg, bool wParam, int lParam);
24 |
25 | private const int WM_SETREDRAW = 11;
26 |
27 | public static void SuspendDrawing(this Control control)
28 | {
29 | SendMessage(control.Handle, WM_SETREDRAW, false, 0);
30 | }
31 |
32 | public static void ResumeDrawing(this Control control)
33 | {
34 | SendMessage(control.Handle, WM_SETREDRAW, true, 0);
35 | control.Refresh();
36 | }
37 |
38 | public static void SuspendDrawingAndLayout(this Control control)
39 | {
40 | control.SuspendDrawing();
41 | control.SuspendLayout();
42 | }
43 |
44 | public static void ResumeDrawingAndLayout(this Control control)
45 | {
46 | control.ResumeLayout();
47 | control.ResumeDrawing();
48 | }
49 |
50 | ///
51 | /// Sets the passed color as BackColor for the Control, then sets either black or white as the ForeColor, depending on the lightness of the backColor.
52 | ///
53 | public static void SetBackColorAndAccordingForeColor(this Control control, System.Drawing.Color backColor)
54 | {
55 | control.BackColor = backColor;
56 | control.ForeColor = Utils.ForeColor(backColor);
57 | }
58 |
59 | ///
60 | /// Sets the passed color as BackColor for the ListViewSubItem, then sets either black or white as the ForeColor, depending on the lightness of the backColor.
61 | ///
62 | public static void SetBackColorAndAccordingForeColor(this ListViewItem.ListViewSubItem control, System.Drawing.Color backColor)
63 | {
64 | control.BackColor = backColor;
65 | control.ForeColor = Utils.ForeColor(backColor);
66 | }
67 | }
68 | }
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/ARKBreedingStats/species/ARKColor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 |
4 | namespace ARKBreedingStats.species
5 | {
6 | ///
7 | /// Class that represents a color in ARK.
8 | /// It contains the ingame name, a Color object and the linear color values.
9 | ///
10 | public class ArkColor
11 | {
12 | public readonly string Name;
13 | public Color Color;
14 | ///
15 | /// Linear color values.
16 | ///
17 | public readonly double[] LinearRgba;
18 | ///
19 | /// Color Id in Ark.
20 | ///
21 | public byte Id;
22 |
23 | public bool IsDye;
24 |
25 | public ArkColor()
26 | {
27 | Id = 0;
28 | Name = Loc.S("noColor");
29 | Color = Color.LightGray;
30 | LinearRgba = null;
31 | }
32 |
33 | public ArkColor(string name, double[] linearColorValues, bool isDye)
34 | {
35 | Name = name;
36 | IsDye = isDye;
37 | if (linearColorValues.Length > 3)
38 | {
39 | Color = Color.FromArgb(LinearColorComponentToColorComponentClamped(linearColorValues[0]),
40 | LinearColorComponentToColorComponentClamped(linearColorValues[1]),
41 | LinearColorComponentToColorComponentClamped(linearColorValues[2]));
42 |
43 | LinearRgba = new[] {
44 | linearColorValues[0],
45 | linearColorValues[1],
46 | linearColorValues[2],
47 | linearColorValues[3]
48 | };
49 | }
50 | else
51 | {
52 | // color is invalid and will be ignored.
53 | LinearRgba = null;
54 | }
55 | }
56 |
57 | ///
58 | /// Convert the color definition of the unreal engine to default RGB-values
59 | ///
60 | ///
61 | ///
62 | private static int LinearColorComponentToColorComponentClamped(double lc)
63 | {
64 | //int v = (int)(255.999f * (lc <= 0.0031308f ? lc * 12.92f : Math.Pow(lc, 1.0f / 2.4f) * 1.055f - 0.055f)); // this formula is only used since UE4.15
65 | // ARK uses this simplified formula
66 | int v = (int)(255.999f * Math.Pow(lc, 1f / 2.2f));
67 | if (v > 255) return 255;
68 | if (v < 0) return 0;
69 | return v;
70 | }
71 |
72 | public override string ToString() => $"{Name}{(IsDye ? " (Dye)" : string.Empty)} ({Color})";
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/ParentInheritance.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using System.Windows.Forms;
4 | using ARKBreedingStats.Library;
5 | using ARKBreedingStats.Pedigree;
6 | using ARKBreedingStats.species;
7 |
8 | namespace ARKBreedingStats.uiControls
9 | {
10 | public partial class ParentInheritance : UserControl
11 | {
12 | private readonly List[] _lines;
13 |
14 | public ParentInheritance()
15 | {
16 | InitializeComponent();
17 | _lines = new[] { new List(), null, null };
18 | GbParents.Paint += ParentStats_Paint;
19 | }
20 |
21 | private void ParentStats_Paint(object sender, PaintEventArgs e)
22 | {
23 | if (ControlOffspring.Creature != null && _lines[0].Any())
24 | PedigreeControl.DrawLines(e.Graphics, _lines);
25 | }
26 |
27 | internal void SetCreatures(Creature offspring = null, Creature mother = null, Creature father = null)
28 | {
29 | if (offspring == null || (mother == null && father == null))
30 | {
31 | Visible = false;
32 | return;
33 | }
34 | Visible = true;
35 |
36 | var enabledColorRegions = offspring.Species?.EnabledColorRegions;
37 | if (enabledColorRegions != null)
38 | {
39 | ControlOffspring.enabledColorRegions = enabledColorRegions;
40 | ControlMother.enabledColorRegions = enabledColorRegions;
41 | ControlFather.enabledColorRegions = enabledColorRegions;
42 | }
43 |
44 | SetSpecies(offspring.Species);
45 |
46 | SetCreature(ControlOffspring, offspring);
47 | SetCreature(ControlMother, mother);
48 | SetCreature(ControlFather, father);
49 |
50 | void SetCreature(PedigreeCreature pc, Creature c)
51 | {
52 | if (c == null)
53 | pc.Visible = false;
54 | else
55 | {
56 | pc.Creature = c;
57 | pc.Visible = true;
58 | }
59 | }
60 |
61 | _lines[0].Clear();
62 | PedigreeCreation.CreateGeneInheritanceLines(offspring, mother, father, _lines, 6, 55);
63 |
64 | Invalidate();
65 | }
66 |
67 | public void SetLocalizations()
68 | {
69 | GbParents.Text = Loc.S("Parents");
70 | }
71 |
72 | private void SetSpecies(Species species) => pedigreeCreatureHeaders.SetCustomStatNames(species?.statNames);
73 |
74 | internal void UpdateColors(byte[] colorIds) => ControlOffspring.UpdateColors(colorIds);
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/ARKBreedingStats/species/TamingData.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System.Collections.Generic;
3 |
4 | namespace ARKBreedingStats.species
5 | {
6 | ///
7 | /// Info about taming a creature
8 | ///
9 | [JsonObject]
10 | public class TamingData
11 | {
12 | ///
13 | /// If true, a creature of this species can be knocked out to tame it.
14 | ///
15 | public bool violent;
16 | ///
17 | /// If true, a creature of this species can be tamed while awake.
18 | ///
19 | public bool nonViolent;
20 | public double tamingIneffectiveness;
21 | ///
22 | /// Names of food the species eats during taming.
23 | ///
24 | public string[] eats;
25 | ///
26 | /// If a food has non default values for this species, it's defined here.
27 | ///
28 | public Dictionary specialFoodValues;
29 | ///
30 | /// Food a species eats after being tamed, additionally to the taming food in eats.
31 | ///
32 | public string[] eatsAlsoPostTame;
33 | ///
34 | /// Base value of needed affinity.
35 | ///
36 | public double affinityNeeded0;
37 | ///
38 | /// Increase of needed affinity per level.
39 | ///
40 | public double affinityIncreasePL;
41 | public double torporDepletionPS0;
42 | public double foodConsumptionBase;
43 | ///
44 | /// Multiplier during taming
45 | ///
46 | public double foodConsumptionMult;
47 | ///
48 | /// Multiplier when tamed.
49 | /// Multiply with foodConsumptionBase when maturation is at 0 %, when at 100 % maturation multiply with const 0.000155, in between interpolate linearly.
50 | /// This value is the product of the ue properties BabyDinoConsumingFoodRateMultiplier and ExtraBabyDinoConsumingFoodRateMultiplier.
51 | ///
52 | public double babyFoodConsumptionMult;
53 | ///
54 | /// Extra multiplier for food consumption once a creature is mature. Only few species use this, e.g. Giganotosaurus, Carcharodontosaurus, Titanosaur and Titans.
55 | ///
56 | public double adultFoodConsumptionMult = 1;
57 | ///
58 | /// Factor for affinity if tamed awake.
59 | ///
60 | public double wakeAffinityMult;
61 | ///
62 | /// Factor of food depletion if tamed awake.
63 | ///
64 | public double wakeFoodDeplMult;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/ARKBreedingStats.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | NEXT_LINE
3 | NEXT_LINE
4 | NEXT_LINE
5 | 0
6 | NEXT_LINE
7 | NEXT_LINE
8 | NEXT_LINE
9 | NEXT_LINE
10 | True
11 | True
12 | True
13 | True
14 | NEXT_LINE
15 | True
16 | True
17 | True
18 | True
--------------------------------------------------------------------------------
/ARKBreedingStats/utils/ColorModeColors.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 |
3 | namespace ARKBreedingStats.utils
4 | {
5 | ///
6 | /// Contains colors dependent on the color mode. Used for color blind mode.
7 | ///
8 | internal static class ColorModeColors
9 | {
10 | internal static Color Success;
11 | internal static Color Neutral;
12 | internal static Color NonUnique;
13 | internal static Color Error;
14 |
15 | internal static void SetColors(AsbColorMode colorMode = AsbColorMode.Regular)
16 | {
17 | switch (colorMode)
18 | {
19 | case AsbColorMode.Deuteranopia:
20 | Success = Color.FromArgb(111, 157, 255);
21 | Neutral = Color.White;
22 | NonUnique = Color.FromArgb(200, 123, 60);
23 | Error = Color.FromArgb(255, 200, 50);
24 | break;
25 | case AsbColorMode.Protanopia:
26 | Success = Color.FromArgb(111, 157, 255);
27 | Neutral = Color.White;
28 | NonUnique = Color.FromArgb(200, 123, 60);
29 | Error = Color.FromArgb(255, 200, 50);
30 | break;
31 | case AsbColorMode.Tritanopia:
32 | Success = Color.FromArgb(140, 241, 255);
33 | Neutral = Color.White;
34 | NonUnique = Color.FromArgb(255, 199, 214);
35 | Error = Color.FromArgb(255, 112, 119);
36 | break;
37 | case AsbColorMode.Monochromacy:
38 | Success = Color.FromArgb(218, 218, 218);
39 | Neutral = Color.White;
40 | NonUnique = Color.FromArgb(176, 176, 176);
41 | Error = Color.FromArgb(132, 132, 132);
42 | break;
43 | default:
44 | Success = Color.FromArgb(180, 255, 128);
45 | Neutral = Color.White;
46 | NonUnique = Color.FromArgb(255, 255, 127);
47 | Error = Color.LightCoral;
48 | break;
49 | }
50 | }
51 |
52 | internal enum AsbColorMode
53 | {
54 | Regular,
55 | ///
56 | /// No green
57 | ///
58 | Deuteranopia,
59 | ///
60 | /// No red
61 | ///
62 | Protanopia,
63 | ///
64 | /// No blue
65 | ///
66 | Tritanopia,
67 | ///
68 | /// Only lightness
69 | ///
70 | Monochromacy
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/ARKBreedingStats/importExported/FileWatcherExports.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Windows.Forms;
4 |
5 | namespace ARKBreedingStats.importExported
6 | {
7 | public class FileWatcherExports : IDisposable
8 | {
9 | private readonly FileSystemWatcher _fileWatcherExport;
10 | private readonly Action _callbackNewFile;
11 | private string _lastFilePath;
12 | private DateTime _lastChangedTime;
13 |
14 | public FileWatcherExports(string folderToWatch, Action callbackNewFile, Control synchronizingObject)
15 | {
16 | _callbackNewFile = callbackNewFile;
17 |
18 | _fileWatcherExport = new FileSystemWatcher
19 | {
20 | NotifyFilter = NotifyFilters.LastWrite,
21 | SynchronizingObject = synchronizingObject
22 | };
23 | _fileWatcherExport.Created += OnChanged;
24 | _fileWatcherExport.Changed += OnChanged;
25 | SetWatchFolder(folderToWatch);
26 | }
27 |
28 | public void SetWatchFolder(string folderToWatch)
29 | {
30 | if (Directory.Exists(folderToWatch))
31 | {
32 | _fileWatcherExport.Path = folderToWatch;
33 | Watching = true;
34 | }
35 | else { Watching = false; }
36 | }
37 |
38 | public bool Watching
39 | {
40 | set => _fileWatcherExport.EnableRaisingEvents = value;
41 | }
42 |
43 |
44 | private void OnChanged(object source, FileSystemEventArgs e)
45 | {
46 | if (_callbackNewFile == null) return;
47 | var filePath = e.FullPath;
48 | var lastWriteTime = new FileInfo(filePath).LastWriteTimeUtc;
49 | if (filePath == _lastFilePath && lastWriteTime == _lastChangedTime)
50 | return; // event was already processed. Some file changes raise multiple events
51 |
52 | _lastFilePath = filePath;
53 | _lastChangedTime = lastWriteTime;
54 | _callbackNewFile.Invoke(filePath, this);
55 | }
56 |
57 | #region Disposing
58 |
59 | private bool _disposed;
60 |
61 | public void Dispose()
62 | {
63 | Dispose(true);
64 | GC.SuppressFinalize(this);
65 | }
66 |
67 | protected virtual void Dispose(bool disposing)
68 | {
69 | if (_disposed) return;
70 |
71 | if (disposing)
72 | {
73 | _fileWatcherExport.Created -= OnChanged;
74 | _fileWatcherExport.Changed -= OnChanged;
75 | _fileWatcherExport.Dispose();
76 | }
77 |
78 | _disposed = true;
79 | }
80 |
81 | #endregion
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/TagSelectorList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 |
5 | namespace ARKBreedingStats.uiControls
6 | {
7 | public partial class TagSelectorList : UserControl
8 | {
9 | private readonly List tagSelectors;
10 | private readonly List tagStrings;
11 | public event TagSelector.TagStatusChangedEventHandler OnTagChanged;
12 |
13 | public TagSelectorList()
14 | {
15 | InitializeComponent();
16 | tagSelectors = new List();
17 | tagStrings = new List();
18 | }
19 |
20 | public List tags
21 | {
22 | set
23 | {
24 | foreach (Control c in Controls)
25 | c.Dispose();
26 | Controls.Clear();
27 | tagSelectors.Clear();
28 | int i = 0;
29 | foreach (string t in value)
30 | {
31 | TagSelector ts = new TagSelector
32 | {
33 | TagName = t,
34 | Location = new Point(3, 3 + i * 29),
35 | Width = Width - 6
36 | };
37 | ts.OnTagChanged += OnTagChanged;
38 | Controls.Add(ts);
39 | tagSelectors.Add(ts);
40 | tagStrings.Add(t);
41 | i++;
42 | }
43 | }
44 | }
45 |
46 | public TagSelector.tagStatus TagStatus(string tag)
47 | {
48 | int i = tagStrings.IndexOf(tag);
49 | return i >= 0 ? tagSelectors[i].Status : TagSelector.tagStatus.indifferent;
50 | }
51 |
52 | public void setTagStatus(string tag, TagSelector.tagStatus status)
53 | {
54 | int i = tagStrings.IndexOf(tag);
55 | if (i >= 0)
56 | tagSelectors[i].Status = status;
57 | }
58 |
59 | public List excludingTags
60 | {
61 | get
62 | {
63 | List l = new List();
64 | foreach (TagSelector ts in tagSelectors)
65 | if (ts.Status == TagSelector.tagStatus.exclude)
66 | l.Add(ts.TagName);
67 | return l;
68 | }
69 | }
70 |
71 | public List includingTags
72 | {
73 | get
74 | {
75 | List l = new List();
76 | foreach (TagSelector ts in tagSelectors)
77 | if (ts.Status == TagSelector.tagStatus.include)
78 | l.Add(ts.TagName);
79 | return l;
80 | }
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/Trough.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using ARKBreedingStats.species;
3 |
4 | namespace ARKBreedingStats.uiControls
5 | {
6 | public class Trough
7 | {
8 | //public readonly Dictionary> foodStacks = new Dictionary>();
9 | //public readonly Dictionary spoilTimers = new Dictionary();
10 | //private int ticks;
11 | //
12 | //public void Tick()
13 | //{
14 | // ticks++;
15 | // // subtract one item from each stack if spoiled
16 | // foreach (KeyValuePair s in spoilTimers)
17 | // {
18 | // if (s.Value % ticks == 0 && foodStacks.ContainsKey(s.Key))
19 | // {
20 | // for (int i = 0; i < foodStacks[s.Key].Count; i++)
21 | // {
22 | // foodStacks[s.Key][i]--;
23 | // if (foodStacks[s.Key][i] == 0)
24 | // foodStacks[s.Key].RemoveAt(i--);
25 | // }
26 | // }
27 | // }
28 | //}
29 |
30 | ///
31 | /// Calculates the needed food from a specific maturation to a specific maturation.
32 | ///
33 | public static bool FoodAmountFromUntil(Species species, double babyFoodConsumptionSpeedMultiplier, double dinoFoodDrainMultiplier, double tamedDinoFoodDrainMultiplier, double fromMaturation, double untilMaturation, out double totalFood)
34 | {
35 | totalFood = 0;
36 | if (fromMaturation == untilMaturation) return true;
37 | if (species?.taming == null || species.breeding == null || fromMaturation > untilMaturation || untilMaturation > 1) return false;
38 |
39 | // food rate in hunger units/s
40 | // min food rate at maturation 100 %
41 | var minFoodRate = species.taming.foodConsumptionBase * dinoFoodDrainMultiplier * tamedDinoFoodDrainMultiplier;
42 | // max food rate at maturation 0 %
43 | var maxFoodRate = minFoodRate * species.taming.babyFoodConsumptionMult * babyFoodConsumptionSpeedMultiplier;
44 | var foodRateDecay = minFoodRate - maxFoodRate;
45 |
46 | // to get the current food rate for a maturation value: maxFoodRate + maturation * foodRateDecay
47 | var foodRateStart = maxFoodRate + fromMaturation * foodRateDecay;
48 | var foodRateEnd = maxFoodRate + untilMaturation * foodRateDecay;
49 |
50 | // calculate area of rectangle and triangle on top to get the total food needed
51 | totalFood = species.breeding.maturationTimeAdjusted * ((untilMaturation - fromMaturation) * (foodRateEnd + 0.5 * Math.Abs(foodRateStart - foodRateEnd)));
52 |
53 | return true;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/ARKBreedingStats/ocr/PatternMatching/DirectBitmap.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Drawing.Imaging;
4 | using System.Linq;
5 | using System.Runtime.InteropServices;
6 |
7 | namespace ARKBreedingStats.ocr.PatternMatching
8 | {
9 | public class DirectBitmap : IDisposable
10 | {
11 | public Bitmap Bitmap { get; }
12 | public int[] Bits { get; }
13 | public bool Disposed { get; private set; }
14 | public int Height { get; }
15 | public int Width { get; }
16 |
17 | protected GCHandle BitsHandle { get; }
18 |
19 | public float GetMeaningfulPixelsCoefficient => (float)PixelsWithData / (Height * Width);
20 |
21 | internal int PixelsWithData { get; set; }
22 |
23 | public DirectBitmap(int width, int height)
24 | {
25 | Width = width;
26 | Height = height;
27 | Bits = new int[width * height];
28 | BitsHandle = GCHandle.Alloc(Bits, GCHandleType.Pinned);
29 | Bitmap = new Bitmap(width, height, width * 4, PixelFormat.Format32bppPArgb, BitsHandle.AddrOfPinnedObject());
30 | }
31 |
32 | public void SetPixel(int x, int y, Color color)
33 | {
34 | int index = x + (y * Width);
35 | int col = color.ToArgb();
36 |
37 | Bits[index] = col;
38 | }
39 |
40 | public Color GetPixel(int x, int y)
41 | {
42 | int index = x + (y * Width);
43 | int col = Bits[index];
44 | Color result = Color.FromArgb(col);
45 |
46 | return result;
47 | }
48 |
49 | internal Bitmap ToBitmap()
50 | {
51 | return (Bitmap)Bitmap.Clone();
52 | }
53 |
54 | public void Dispose()
55 | {
56 | if (Disposed) return;
57 | Bitmap.Dispose();
58 | BitsHandle.Free();
59 | Disposed = true;
60 | }
61 |
62 | public Color GetDominantColor()
63 | {
64 | long[] total = { 0, 0, 0 };
65 | for (int i = 0; i < Width; i++)
66 | {
67 | for (int j = 0; j < Height; j++)
68 | {
69 | int index = i + j * Width;
70 | var color = Color.FromArgb(Bits[index]);
71 | total[0] += color.R;
72 | total[1] += color.G;
73 | total[2] += color.B;
74 | }
75 | }
76 |
77 | var area = Width * Height;
78 | total[0] /= area;
79 | total[1] /= area;
80 | total[2] /= area;
81 | return Color.FromArgb((int)total[0], (int)total[1], (int)total[2]);
82 | }
83 |
84 | public override int GetHashCode()
85 | {
86 | return Bits.Aggregate(Bits.Length, (current, t) => unchecked(current * 31 + t));
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/ARKBreedingStats/settings/customSoundChooser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Windows.Forms;
5 | using ARKBreedingStats.utils;
6 |
7 | namespace ARKBreedingStats.settings
8 | {
9 | public partial class customSoundChooser : UserControl
10 | {
11 | private string soundFile;
12 | private string title;
13 | private System.Media.SoundPlayer soundplayer;
14 |
15 | public customSoundChooser()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void buttonFileChooser_Click(object sender, EventArgs e)
21 | {
22 | using (var fileSelect = new OpenFileDialog
23 | {
24 | Filter = "Wav Files (wav)|*.wav"
25 | })
26 | {
27 | if (fileSelect.ShowDialog() == DialogResult.OK)
28 | SoundFile = fileSelect.FileName;
29 | else if (MessageBox.Show("Set to default sound?", "To default?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
30 | {
31 | soundFile = "";
32 | soundplayer = null;
33 | Title = title;
34 | }
35 | }
36 | }
37 |
38 | private void buttonPlay_Click(object sender, EventArgs e)
39 | {
40 | if (soundplayer == null) System.Media.SystemSounds.Hand.Play();
41 | else
42 | {
43 | try { soundplayer.Play(); }
44 | catch
45 | {
46 | MessageBoxes.ShowMessageBox("Unsupported sound-format. Only PCM-WAV is supported.", $"Unsupported sound-format");
47 | }
48 | }
49 | }
50 |
51 | public string SoundFile
52 | {
53 | get => soundFile;
54 | set
55 | {
56 | if (value == null)
57 | {
58 | soundFile = "";
59 | soundplayer = null;
60 | }
61 | else
62 | {
63 | List exts = new List { ".WAV" };//, ".MID", ".MIDI", ".WMA", ".MP3", ".OGG" };
64 | if (File.Exists(value) && exts.IndexOf(Path.GetExtension(value).ToUpperInvariant()) >= 0)
65 | {
66 | soundFile = value;
67 | soundplayer = new System.Media.SoundPlayer(soundFile);
68 | Title = title;
69 | }
70 | }
71 | }
72 | }
73 |
74 | public string Title
75 | {
76 | set
77 | {
78 | title = value;
79 | labelName.Text = title + (soundFile == "" ? "" : "(" + Path.GetFileName(soundFile) + ")");
80 | }
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/StatPotential.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using ARKBreedingStats.species;
3 | using System.Drawing;
4 | using System.Windows.Forms;
5 | using ARKBreedingStats.utils;
6 |
7 | namespace ARKBreedingStats.uiControls
8 | {
9 | public partial class StatPotential : UserControl
10 | {
11 | private readonly int _statIndex;
12 | public int MaxDomLevel;
13 | public int LevelGraphMax;
14 | private readonly bool _percent;
15 | private readonly ToolTip _tt = new ToolTip();
16 |
17 | public StatPotential()
18 | {
19 | InitializeComponent();
20 | Disposed += (s, e) => _tt.RemoveAllAndDispose();
21 | }
22 | public StatPotential(int stat, bool percent)
23 | {
24 | InitializeComponent();
25 | _statIndex = stat;
26 | _percent = percent;
27 | label1.Text = Utils.StatName(_statIndex, true);
28 | }
29 |
30 | public void SetLevel(Species species, int wildLevel, int mutationLevels)
31 | {
32 | if (LevelGraphMax <= 0) return;
33 | const int controlWidth = 60;
34 | var wildMutSumLevel = Math.Max(0, wildLevel + mutationLevels);
35 | labelWildLevels.Width = controlWidth + controlWidth * (wildMutSumLevel > LevelGraphMax ? LevelGraphMax : wildMutSumLevel) / LevelGraphMax;
36 | labelImprinting.Width = controlWidth;
37 | labelDomLevels.Width = controlWidth;
38 | labelImprinting.Location = new Point(33 + labelWildLevels.Width, 0);
39 | labelDomLevels.Location = new Point(35 + labelWildLevels.Width + labelImprinting.Width, 0);
40 | if (wildLevel < 0 || mutationLevels < 0)
41 | {
42 | labelWildLevels.Text = "?";
43 | labelImprinting.Text = "?";
44 | labelDomLevels.Text = "?";
45 | }
46 | else
47 | {
48 | var suffix = _percent ? "%" : string.Empty;
49 | labelWildLevels.Text = StatValueCalculation.CalculateValue(species, _statIndex, wildLevel, mutationLevels, 0, true, 1, 0) * (_percent ? 100 : 1) + suffix;
50 | labelImprinting.Text = StatValueCalculation.CalculateValue(species, _statIndex, wildLevel, mutationLevels, 0, true, 1, 1) * (_percent ? 100 : 1) + suffix;
51 | labelDomLevels.Text = StatValueCalculation.CalculateValue(species, _statIndex, wildLevel, mutationLevels, MaxDomLevel, true, 1, 1) * (_percent ? 100 : 1) + suffix;
52 | }
53 | _tt.SetToolTip(labelWildLevels, labelWildLevels.Text);
54 | _tt.SetToolTip(labelImprinting, labelImprinting.Text);
55 | _tt.SetToolTip(labelDomLevels, labelDomLevels.Text);
56 | }
57 |
58 | public void SetLocalization()
59 | {
60 | label1.Text = Utils.StatName(_statIndex, true);
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/ARKBreedingStats/values/TamingFoodData.cs:
--------------------------------------------------------------------------------
1 | using ARKBreedingStats.species;
2 | using Newtonsoft.Json;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Windows.Forms;
7 |
8 | namespace ARKBreedingStats.values
9 | {
10 | ///
11 | /// Contains the default food data for taming.
12 | ///
13 | [JsonObject(MemberSerialization.OptIn)]
14 | class TamingFoodData
15 | {
16 | [JsonProperty]
17 | private string format; // must be present and a supported value
18 | [JsonProperty]
19 | private string version;
20 |
21 | private static bool IsValidFormat(string formatVersion) => formatVersion == "1.13";
22 |
23 | ///
24 | /// The key is the species name, so it can be used for modded species with the same name, they often have the same taming-data.
25 | /// The value is a dictionary with the food name as key and TamingFood info as value.
26 | ///
27 | [JsonProperty]
28 | public Dictionary tamingFoodData = new Dictionary();
29 |
30 | ///
31 | /// Food with not completely confirmed or tested values. It will display a warning in the app.
32 | ///
33 | [JsonProperty]
34 | public string[] UnconfirmedFoods;
35 |
36 | ///
37 | /// Loads the default food data.
38 | ///
39 | ///
40 | ///
41 | public static bool TryLoadDefaultFoodData(out Dictionary tamingFoodData)
42 | {
43 | tamingFoodData = null;
44 | string filePath = FileService.GetJsonPath(FileService.TamingFoodData);
45 | string errorMessage = $"File not found: {filePath}";
46 |
47 | if (File.Exists(filePath) && FileService.LoadJsonFile(filePath, out TamingFoodData readData, out errorMessage))
48 | {
49 | if (IsValidFormat(readData.format))
50 | {
51 | tamingFoodData = readData.tamingFoodData;
52 | return tamingFoodData != null;
53 | }
54 | }
55 | else
56 | {
57 | if (MessageBox.Show($"The default food data file {FileService.TamingFoodData} couldn't be loaded:\n{errorMessage}\n\n" +
58 | "The taming info will be incomplete without that file.\n\n" +
59 | "Do you want to visit the releases page to redownload it?",
60 | $"{Loc.S("error")} - {Utils.ApplicationNameVersion}", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
61 | System.Diagnostics.Process.Start(Updater.Updater.ReleasesUrl);
62 | }
63 |
64 | return false;
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/StatDisplay.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Windows.Forms;
5 | using ARKBreedingStats.StatsOptions;
6 | using ARKBreedingStats.utils;
7 |
8 | namespace ARKBreedingStats.uiControls
9 | {
10 | public partial class StatDisplay : UserControl
11 | {
12 | private readonly bool _isPercent;
13 | private readonly int _statIndex;
14 | private readonly ToolTip _tt;
15 | public int BarMaxLevel = 45;
16 | private bool _statNamesAreDefault;
17 | public StatLevelColors LevelColors;
18 |
19 | public StatDisplay()
20 | {
21 | InitializeComponent();
22 | }
23 |
24 | public StatDisplay(int statIndex, bool isPercent, ToolTip tt) : this()
25 | {
26 | _statIndex = statIndex;
27 | _isPercent = isPercent;
28 | _tt = tt;
29 | _tt.InitialDelay = 300;
30 | }
31 |
32 | public void SetCustomStatNames(Dictionary customStatNames)
33 | {
34 | if (customStatNames == null && _statNamesAreDefault) return;
35 |
36 | _statNamesAreDefault = customStatNames == null;
37 |
38 | labelName.Text = Utils.StatName(_statIndex, true, customStatNames);
39 | _tt.SetToolTip(labelName, Utils.StatName(_statIndex, false, customStatNames));
40 | }
41 |
42 | public void SetNumbers(int levelWild, int levelMut, int levelDom, double valueBreeding, double valueDom)
43 | {
44 | const int barMaxLength = 164;
45 | LevelColorBar.SetLevelBar(panelBarWildLevels, LevelColors, barMaxLength, levelWild);
46 | LevelColorBar.SetLevelBar(panelBarMutLevels, LevelColors, barMaxLength, levelMut, mutationLevel: true);
47 |
48 | if (levelWild < 0)
49 | {
50 | labelWildLevel.Text = Loc.S("na");
51 | labelWildLevel.ForeColor = Color.LightGray;
52 | }
53 | else
54 | {
55 | labelWildLevel.Text = levelWild.ToString();
56 | labelWildLevel.ForeColor = SystemColors.ControlText;
57 | }
58 | labelMutLevel.Text = levelMut == 0 ? string.Empty : levelMut.ToString();
59 | labelLevelDom.Text = levelDom.ToString();
60 | labelBreedingValue.Text = valueBreeding > 0 ? (_isPercent ? Math.Round(100 * valueBreeding, 1).ToString("N1") + " %" : valueBreeding.ToString("N1")) : "?";
61 | labelDomValue.Text = valueDom > 0 ? (_isPercent ? Math.Round(100 * valueDom, 1).ToString("N1") + " %" : valueDom.ToString("N1")) : "?";
62 | }
63 |
64 | public bool ShowBars
65 | {
66 | set
67 | {
68 | panelBarWildLevels.Visible = value;
69 | panelBarMutLevels.Visible = value;
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/ARKBreedingStats/StatsOptions/StatsOptionsForm.cs:
--------------------------------------------------------------------------------
1 | using ARKBreedingStats.StatsOptions.LevelColorSettings;
2 | using System;
3 | using System.Drawing;
4 | using System.Windows.Forms;
5 | using ARKBreedingStats.StatsOptions.TopStatsSettings;
6 | using ARKBreedingStats.utils;
7 |
8 | namespace ARKBreedingStats.StatsOptions
9 | {
10 | internal class StatsOptionsForm : Form
11 | {
12 | private static StatsOptionsForm _displayedForm;
13 | protected readonly ToolTip Tt = new ToolTip();
14 |
15 | public static void ShowWindow(Form parent,
16 | StatsOptionsSettings levelColorSettings,
17 | StatsOptionsSettings topStatsSettings,
18 | int selectTabPageIndex = 0
19 | )
20 | {
21 | if (_displayedForm != null)
22 | {
23 | _displayedForm.BringToFront();
24 | return;
25 | }
26 |
27 | var f = new StatsOptionsForm
28 | {
29 | FormBorderStyle = FormBorderStyle.SizableToolWindow,
30 | Width = Properties.Settings.Default.LevelColorWindowRectangle.Width,
31 | Height = Properties.Settings.Default.LevelColorWindowRectangle.Height,
32 | StartPosition = FormStartPosition.Manual,
33 | Location = new Point(Properties.Settings.Default.LevelColorWindowRectangle.X, Properties.Settings.Default.LevelColorWindowRectangle.Y),
34 | Text = "Stats options"
35 | };
36 |
37 | // stat settings tab
38 | var tabs = new TabControl();
39 | tabs.Dock = DockStyle.Fill;
40 |
41 | if (levelColorSettings != null)
42 | AddAndDock(new LevelGraphOptionsControl(levelColorSettings, f.Tt), levelColorSettings.SettingsName);
43 | if (topStatsSettings != null)
44 | AddAndDock(new ConsiderTopStatsControl(topStatsSettings, f.Tt), topStatsSettings.SettingsName);
45 |
46 | void AddAndDock(Control c, string tabName)
47 | {
48 | var tabPage = new TabPage(tabName);
49 | c.Dock = DockStyle.Fill;
50 | tabPage.Controls.Add(c);
51 | tabs.Controls.Add(tabPage);
52 | }
53 |
54 | f.Controls.Add(tabs);
55 | tabs.SelectedIndex = selectTabPageIndex;
56 | _displayedForm = f;
57 | f.Closed += F_Closed;
58 | f.Show(parent);
59 | }
60 |
61 | private static void F_Closed(object sender, EventArgs e)
62 | {
63 | if (_displayedForm == null) return;
64 | Properties.Settings.Default.LevelColorWindowRectangle =
65 | new Rectangle(_displayedForm.Left, _displayedForm.Top, _displayedForm.Width, _displayedForm.Height);
66 | _displayedForm.Tt.RemoveAllAndDispose();
67 | _displayedForm = null;
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/ARKBreedingStats/raising/Raising.cs:
--------------------------------------------------------------------------------
1 | using ARKBreedingStats.Library;
2 | using ARKBreedingStats.species;
3 | using System;
4 |
5 | namespace ARKBreedingStats.raising
6 | {
7 | public static class Raising
8 | {
9 | public delegate void createIncubationEventHandler(Creature mother, Creature father, TimeSpan incubationDuration, bool incubationStarted);
10 |
11 | ///
12 | /// Retrieves the times for raising, i.e. for incubation, baby-phase, total maturation, and mating interval.
13 | ///
14 | ///
15 | public static bool GetRaisingTimes(Species species, out TimeSpan matingTime, out string incubationMode, out TimeSpan incubation, out TimeSpan baby, out TimeSpan maturation, out TimeSpan nextMatingMin, out TimeSpan nextMatingMax)
16 | {
17 | matingTime = new TimeSpan();
18 | incubation = new TimeSpan();
19 | baby = new TimeSpan();
20 | maturation = new TimeSpan();
21 | nextMatingMin = new TimeSpan();
22 | nextMatingMax = new TimeSpan();
23 | incubationMode = null;
24 |
25 | if (species?.breeding == null)
26 | return false;
27 |
28 | nextMatingMin = new TimeSpan(0, 0, (int)(species.breeding.matingCooldownMinAdjusted));
29 | nextMatingMax = new TimeSpan(0, 0, (int)(species.breeding.matingCooldownMaxAdjusted));
30 |
31 | incubationMode = species.breeding.gestationTimeAdjusted == 0 ? "Incubation" : "Gestation";
32 |
33 | matingTime = new TimeSpan(0, 0, (int)(species.breeding.matingTimeAdjusted));
34 | incubation = new TimeSpan(0, 0, (int)(species.breeding.incubationTimeAdjusted + species.breeding.gestationTimeAdjusted));
35 | baby = new TimeSpan(0, 0, (int)(.1f * species.breeding.maturationTimeAdjusted));
36 | maturation = new TimeSpan(0, 0, (int)(species.breeding.maturationTimeAdjusted));
37 | return true;
38 | }
39 |
40 | ///
41 | /// Retrieves the needed temperature range for the eggs of a species.
42 | ///
43 | ///
44 | ///
45 | public static string EggTemperature(Species species)
46 | {
47 | if (species?.breeding == null
48 | || (species.breeding.eggTempMin == 0
49 | && species.breeding.eggTempMax == 0)
50 | )
51 | return null;
52 |
53 | bool celsius = Properties.Settings.Default.celsius;
54 | return "Egg-Temperature: "
55 | + (celsius ? species.breeding.eggTempMin : Math.Round(species.breeding.eggTempMin * 1.8 + 32, 1)) + " – "
56 | + (celsius ? species.breeding.eggTempMax : Math.Round(species.breeding.eggTempMax * 1.8 + 32, 1))
57 | + (celsius ? " °C" : " °F");
58 | }
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/ARKBreedingStats/utils/Debouncer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Threading;
3 | using Timer = System.Timers.Timer;
4 |
5 | namespace ARKBreedingStats.utils
6 | {
7 | ///
8 | /// Used to fire an event only if it's not called for a specific amount of time.
9 | ///
10 | public class Debouncer
11 | {
12 | private Timer _timer;
13 | private Type _argsType;
14 |
15 | ///
16 | /// Call to debounce the action with the given interval.
17 | ///
18 | /// Interval in ms
19 | /// Action to perform after interval elapsed without another debounce call
20 | /// Dispatcher to use, usually the one of the UI thread
21 | public void Debounce(int interval, Action action, Dispatcher dispatcher)
22 | {
23 | _timer?.Stop();
24 | if (interval <= 0)
25 | {
26 | _timer = null;
27 | dispatcher.BeginInvoke(action, null);
28 | return;
29 | }
30 |
31 | _timer = new Timer(interval) { AutoReset = false };
32 | _timer.Elapsed += (s, o) =>
33 | {
34 | if (_timer == null)
35 | return;
36 |
37 | _timer.Stop();
38 | _timer = null;
39 |
40 | dispatcher.BeginInvoke(action, null);
41 | };
42 | _timer.Start();
43 | }
44 |
45 | ///
46 | /// Call to debounce the action with the given interval.
47 | ///
48 | /// Interval in ms
49 | /// Action to perform after interval elapsed without another debounce call
50 | /// Dispatcher to use, usually the one of the UI thread
51 | /// Arguments for the action
52 | public void Debounce(int interval, Action action, Dispatcher dispatcher, T args)
53 | {
54 | _timer?.Stop();
55 | if (interval <= 0)
56 | {
57 | _timer = null;
58 | dispatcher.BeginInvoke(action, args);
59 | return;
60 | }
61 |
62 | _timer = new Timer(interval) { AutoReset = false };
63 | _timer.Elapsed += (s, o) =>
64 | {
65 | if (_timer == null)
66 | return;
67 |
68 | _timer.Stop();
69 | _timer = null;
70 |
71 | dispatcher.BeginInvoke(action, args);
72 | };
73 | _timer.Start();
74 | }
75 |
76 | ///
77 | /// Cancels the debouncing, the action won't be executed.
78 | ///
79 | public void Cancel()
80 | {
81 | _timer?.Stop();
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/ARKBreedingStats/IncubationTimerEntry.cs:
--------------------------------------------------------------------------------
1 | using ARKBreedingStats.Library;
2 | using Newtonsoft.Json;
3 | using System;
4 |
5 | namespace ARKBreedingStats
6 | {
7 | [JsonObject(MemberSerialization.OptIn)]
8 | public class IncubationTimerEntry
9 | {
10 | [JsonProperty]
11 | public bool timerIsRunning;
12 | public TimeSpan incubationDuration;
13 | [JsonProperty]
14 | public DateTime incubationEnd;
15 | private Creature _mother;
16 | private Creature _father;
17 | [JsonProperty]
18 | public Guid motherGuid;
19 | [JsonProperty]
20 | public Guid fatherGuid;
21 | public string kind; // contains "Egg" or "Gestation", depending on the species
22 | public bool expired;
23 | public bool ShowInOverlay;
24 |
25 | public IncubationTimerEntry() { }
26 |
27 | public IncubationTimerEntry(Creature mother, Creature father, TimeSpan incubationDuration, bool incubationStarted)
28 | {
29 | Mother = mother;
30 | Father = father;
31 | this.incubationDuration = incubationDuration;
32 | incubationEnd = new DateTime();
33 | if (incubationStarted)
34 | StartTimer();
35 | }
36 |
37 | private void StartTimer()
38 | {
39 | if (!timerIsRunning)
40 | {
41 | timerIsRunning = true;
42 | incubationEnd = DateTime.Now.Add(incubationDuration);
43 | }
44 | }
45 |
46 | private void PauseTimer()
47 | {
48 | if (timerIsRunning)
49 | {
50 | timerIsRunning = false;
51 | incubationDuration = incubationEnd.Subtract(DateTime.Now);
52 | }
53 | }
54 |
55 | public void StartStopTimer(bool start)
56 | {
57 | if (start)
58 | StartTimer();
59 | else PauseTimer();
60 | }
61 |
62 | public Creature Mother
63 | {
64 | get => _mother;
65 | set
66 | {
67 | motherGuid = value?.guid ?? Guid.Empty;
68 | _mother = value;
69 | }
70 | }
71 |
72 | public Creature Father
73 | {
74 | get => _father;
75 | set
76 | {
77 | fatherGuid = value?.guid ?? Guid.Empty;
78 | _father = value;
79 | }
80 | }
81 |
82 | // Serializer does not support TimeSpan directly, so use this property for serialization instead.
83 | [System.ComponentModel.Browsable(false)]
84 | [JsonProperty("incubationDuration")]
85 | public string incubationDurationString
86 | {
87 | get => System.Xml.XmlConvert.ToString(incubationDuration);
88 | set => incubationDuration = string.IsNullOrEmpty(value) ?
89 | TimeSpan.Zero : System.Xml.XmlConvert.ToTimeSpan(value);
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/TagSelector.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ARKBreedingStats.uiControls
2 | {
3 | partial class TagSelector
4 | {
5 | ///
6 | /// Erforderliche Designervariable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Verwendete Ressourcen bereinigen.
12 | ///
13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Vom Komponenten-Designer generierter Code
24 |
25 | ///
26 | /// Erforderliche Methode für die Designerunterstützung.
27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.button1 = new System.Windows.Forms.Button();
33 | this.SuspendLayout();
34 | //
35 | // label1
36 | //
37 | this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
38 | this.label1.Location = new System.Drawing.Point(0, 0);
39 | this.label1.Name = "label1";
40 | this.label1.Padding = new System.Windows.Forms.Padding(0, 3, 28, 0);
41 | this.label1.Size = new System.Drawing.Size(187, 29);
42 | this.label1.TabIndex = 0;
43 | //
44 | // button1
45 | //
46 | this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
47 | this.button1.Location = new System.Drawing.Point(161, 3);
48 | this.button1.Name = "button1";
49 | this.button1.Size = new System.Drawing.Size(23, 23);
50 | this.button1.TabIndex = 1;
51 | this.button1.Text = "×";
52 | this.button1.UseVisualStyleBackColor = true;
53 | this.button1.Click += new System.EventHandler(this.button1_Click);
54 | //
55 | // TagSelector
56 | //
57 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
58 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
59 | this.Controls.Add(this.button1);
60 | this.Controls.Add(this.label1);
61 | this.Name = "TagSelector";
62 | this.Size = new System.Drawing.Size(187, 29);
63 | this.ResumeLayout(false);
64 |
65 | }
66 |
67 | #endregion
68 |
69 | private System.Windows.Forms.Label label1;
70 | private System.Windows.Forms.Button button1;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/ASB-Updater/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ASB_Updater.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASB_Updater.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/StatSelector.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using ARKBreedingStats.species;
4 | using ARKBreedingStats.utils;
5 |
6 | namespace ARKBreedingStats.uiControls
7 | {
8 | ///
9 | /// Allows to select a stat.
10 | ///
11 | public partial class StatSelector : UserControl
12 | {
13 | public event Action StatIndexSelected;
14 | private Species _selectedSpecies;
15 | private ToolTip _tt;
16 |
17 | public StatSelector()
18 | {
19 | InitializeComponent();
20 |
21 | _tt = new ToolTip();
22 |
23 | var r = new RadioButton
24 | {
25 | Tag = -1,
26 | Text = "×",
27 | Appearance = Appearance.Button,
28 | AutoSize = true
29 | };
30 | r.CheckedChanged += RadioButtonCheckedChanged;
31 | flowLayoutPanel1.Controls.Add(r);
32 |
33 | foreach (var si in Stats.DisplayOrder)
34 | {
35 | if (si == Stats.Torpidity) continue;
36 | r = new RadioButton
37 | {
38 | Tag = si,
39 | Text = Utils.StatName(si, true),
40 | Appearance = Appearance.Button,
41 | AutoSize = true,
42 | Visible = false
43 | };
44 | r.CheckedChanged += RadioButtonCheckedChanged;
45 | flowLayoutPanel1.Controls.Add(r);
46 | }
47 |
48 | Disposed += (s, e) => _tt.RemoveAllAndDispose();
49 | }
50 |
51 | private void RadioButtonCheckedChanged(object sender, EventArgs e)
52 | {
53 | if (!(sender is RadioButton r && r.Checked && r.Tag is int statIndex)) return;
54 | StatIndexSelected?.Invoke(statIndex);
55 | }
56 |
57 | ///
58 | /// Call this method if the language or species was changed (some species have custom stat names).
59 | ///
60 | public void SetStatNames(Species species)
61 | {
62 | if (species == _selectedSpecies) return;
63 | _selectedSpecies = species;
64 | var statNames = species.statNames;
65 |
66 | foreach (Control c in flowLayoutPanel1.Controls)
67 | {
68 | if (!(c is RadioButton r && r.Tag is int statIndex)) continue;
69 | if (statIndex == -1)
70 | {
71 | _tt.SetToolTip(c, Loc.S("clear"));
72 | continue;
73 | }
74 |
75 | if (!species.UsesStat(statIndex))
76 | {
77 | c.Visible = false;
78 | continue;
79 | }
80 |
81 | c.Visible = true;
82 | c.Text = Utils.StatName(statIndex, true, statNames);
83 | _tt.SetToolTip(c, Utils.StatName(statIndex, false, statNames));
84 | }
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/ARKBreedingStats/uiControls/nud.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 |
5 | namespace ARKBreedingStats.uiControls
6 | {
7 | class Nud : NumericUpDown
8 | {
9 | private bool _brightForeColor;
10 | private decimal _NeutralNumber;
11 |
12 | protected override void OnEnter(EventArgs e)
13 | {
14 | base.OnEnter(e);
15 | Select(0, Text.Length);
16 | }
17 |
18 | ///
19 | /// Sets the value after checking it's < Maximum and > Minimum. If it's out of range, the closest valid value is set
20 | ///
21 | public decimal ValueSave
22 | {
23 | set
24 | {
25 | if (value > Maximum) value = Maximum;
26 | if (value < Minimum) value = Minimum;
27 | Value = value;
28 | }
29 | }
30 |
31 | ///
32 | /// Sets the value after checking it's < Maximum and > Minimum. If it's out of range, the closest valid value is set
33 | ///
34 | public double ValueSaveDouble
35 | {
36 | set => ValueSave = (decimal)value;
37 | }
38 |
39 | public double ValueDouble => (double)Value;
40 |
41 | protected override void OnValueChanged(EventArgs e)
42 | {
43 | base.OnValueChanged(e);
44 |
45 | UpdateForeColor();
46 | }
47 |
48 | public override Color BackColor
49 | {
50 | get => base.BackColor;
51 | set
52 | {
53 | base.BackColor = value;
54 | _brightForeColor = Utils.ForeColor(BackColor).GetBrightness() == 1;
55 | UpdateForeColor();
56 | }
57 | }
58 |
59 | ///
60 | /// If the control displays this number, it will be dimmed. That way controls with changed numbers will be more visible.
61 | ///
62 | public decimal NeutralNumber
63 | {
64 | get => _NeutralNumber;
65 | set
66 | {
67 | _NeutralNumber = value;
68 | UpdateForeColor();
69 | }
70 | }
71 |
72 | private void UpdateForeColor()
73 | {
74 | if (Value == NeutralNumber)
75 | {
76 | ForeColor = _brightForeColor ? Color.LightGray : SystemColors.GrayText;
77 | }
78 | else
79 | {
80 | ForeColor = _brightForeColor ? Color.White : SystemColors.WindowText;
81 | }
82 | }
83 |
84 | ///
85 | /// Highlights the control if the value is not the neutral value.
86 | ///
87 | ///
88 | public void SetExtraHighlightNonDefault(bool highlight)
89 | {
90 | BackColor = highlight && Value != NeutralNumber ? Color.FromArgb(190, 40, 20) : SystemColors.Window;
91 | UpdateForeColor();
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------