diff --git a/ARKBreedingStats/ARKBreedingStats.csproj b/ARKBreedingStats/ARKBreedingStats.csproj index 2c8f217f1..61ec1af37 100644 --- a/ARKBreedingStats/ARKBreedingStats.csproj +++ b/ARKBreedingStats/ARKBreedingStats.csproj @@ -103,11 +103,21 @@ AddDummyCreaturesSettings.cs + + + + + Component + + + Form + + - + - + @@ -124,6 +134,9 @@ + + Component + Form @@ -145,10 +158,10 @@ Hatching.cs - + UserControl - + HueControl.cs @@ -173,13 +186,13 @@ ScrollForm.cs - + UserControl - + StatLevelGraphOptionsControl.cs - + Component @@ -188,12 +201,6 @@ StatSelector.cs - - Form - - - StatsOptionsWindow.cs - @@ -734,6 +741,9 @@ + + PreserveNewest + TextTemplatingFileGenerator _manifest.json @@ -765,7 +775,7 @@ Hatching.cs - + HueControl.cs @@ -777,15 +787,12 @@ ScrollForm.cs - + StatLevelGraphOptionsControl.cs StatSelector.cs - - StatsOptionsWindow.cs - VariantSelector.cs @@ -1051,7 +1058,10 @@ - 50.0.1 + 51.0.0 + + + 4.0.1 3.3.4 diff --git a/ARKBreedingStats/AboutBox1.Designer.cs b/ARKBreedingStats/AboutBox1.Designer.cs index 91cdd025e..efdd10b53 100644 --- a/ARKBreedingStats/AboutBox1.Designer.cs +++ b/ARKBreedingStats/AboutBox1.Designer.cs @@ -32,10 +32,17 @@ private void InitializeComponent() this.labelVersion = new System.Windows.Forms.Label(); this.labelCopyright = new System.Windows.Forms.Label(); this.textBoxContributors = new System.Windows.Forms.TextBox(); - this.okButton = new System.Windows.Forms.Button(); this.linkLabel = new System.Windows.Forms.LinkLabel(); + this.okButton = new System.Windows.Forms.Button(); this.labelDescription = new System.Windows.Forms.Label(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.TbDependencies = new System.Windows.Forms.TextBox(); this.tableLayoutPanel.SuspendLayout(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage2.SuspendLayout(); this.SuspendLayout(); // // tableLayoutPanel @@ -46,10 +53,10 @@ private void InitializeComponent() this.tableLayoutPanel.Controls.Add(this.labelProductName, 0, 0); this.tableLayoutPanel.Controls.Add(this.labelVersion, 0, 1); this.tableLayoutPanel.Controls.Add(this.labelCopyright, 0, 2); - this.tableLayoutPanel.Controls.Add(this.textBoxContributors, 0, 5); this.tableLayoutPanel.Controls.Add(this.linkLabel, 0, 3); this.tableLayoutPanel.Controls.Add(this.okButton, 1, 6); this.tableLayoutPanel.Controls.Add(this.labelDescription, 0, 4); + this.tableLayoutPanel.Controls.Add(this.tabControl1, 0, 5); this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel.Location = new System.Drawing.Point(9, 9); this.tableLayoutPanel.Name = "tableLayoutPanel"; @@ -61,6 +68,7 @@ private void InitializeComponent() this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel.Size = new System.Drawing.Size(513, 549); this.tableLayoutPanel.TabIndex = 0; // @@ -106,30 +114,17 @@ private void InitializeComponent() // textBoxContributors // this.textBoxContributors.AcceptsReturn = true; - this.tableLayoutPanel.SetColumnSpan(this.textBoxContributors, 2); this.textBoxContributors.Dock = System.Windows.Forms.DockStyle.Fill; this.textBoxContributors.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textBoxContributors.Location = new System.Drawing.Point(6, 153); + this.textBoxContributors.Location = new System.Drawing.Point(3, 3); this.textBoxContributors.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); this.textBoxContributors.Multiline = true; this.textBoxContributors.Name = "textBoxContributors"; this.textBoxContributors.ReadOnly = true; this.textBoxContributors.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.textBoxContributors.Size = new System.Drawing.Size(504, 353); + this.textBoxContributors.Size = new System.Drawing.Size(493, 321); this.textBoxContributors.TabIndex = 23; this.textBoxContributors.TabStop = false; - this.textBoxContributors.Text = "Contributors"; - // - // okButton - // - this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.okButton.Location = new System.Drawing.Point(435, 523); - this.okButton.Name = "okButton"; - this.okButton.Size = new System.Drawing.Size(75, 23); - this.okButton.TabIndex = 24; - this.okButton.Text = "&OK"; - this.okButton.Click += new System.EventHandler(this.okButton_Click); // // linkLabel // @@ -146,6 +141,17 @@ private void InitializeComponent() this.linkLabel.Text = "ARK Smart Breeding: Check for more info and new versions"; this.linkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel_LinkClicked); // + // okButton + // + this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.okButton.Location = new System.Drawing.Point(435, 523); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(75, 23); + this.okButton.TabIndex = 24; + this.okButton.Text = "&OK"; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // // labelDescription // this.labelDescription.AutoSize = true; @@ -156,6 +162,55 @@ private void InitializeComponent() this.labelDescription.TabIndex = 26; this.labelDescription.Text = "Description"; // + // tabControl1 + // + this.tableLayoutPanel.SetColumnSpan(this.tabControl1, 2); + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControl1.Location = new System.Drawing.Point(3, 153); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(507, 353); + this.tabControl1.TabIndex = 27; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.textBoxContributors); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(499, 327); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Contributors"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.TbDependencies); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(499, 327); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Dependencies"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // TbDependencies + // + this.TbDependencies.AcceptsReturn = true; + this.TbDependencies.Dock = System.Windows.Forms.DockStyle.Fill; + this.TbDependencies.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.TbDependencies.Location = new System.Drawing.Point(3, 3); + this.TbDependencies.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); + this.TbDependencies.Multiline = true; + this.TbDependencies.Name = "TbDependencies"; + this.TbDependencies.ReadOnly = true; + this.TbDependencies.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.TbDependencies.Size = new System.Drawing.Size(493, 321); + this.TbDependencies.TabIndex = 24; + this.TbDependencies.TabStop = false; + // // AboutBox1 // this.AcceptButton = this.okButton; @@ -174,6 +229,11 @@ private void InitializeComponent() this.Text = "AboutBox1"; this.tableLayoutPanel.ResumeLayout(false); this.tableLayoutPanel.PerformLayout(); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage1.PerformLayout(); + this.tabPage2.ResumeLayout(false); + this.tabPage2.PerformLayout(); this.ResumeLayout(false); } @@ -188,5 +248,9 @@ private void InitializeComponent() private System.Windows.Forms.Button okButton; private System.Windows.Forms.LinkLabel linkLabel; private System.Windows.Forms.Label labelDescription; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.TextBox TbDependencies; } } diff --git a/ARKBreedingStats/AboutBox1.cs b/ARKBreedingStats/AboutBox1.cs index 2fef6cd99..fdbee9d93 100644 --- a/ARKBreedingStats/AboutBox1.cs +++ b/ARKBreedingStats/AboutBox1.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Reflection; using System.Windows.Forms; using ARKBreedingStats.utils; @@ -16,6 +17,12 @@ public AboutBox1() labelCopyright.Text = AssemblyCopyright; labelDescription.Text = AssemblyDescription; textBoxContributors.Text = Contributors; + const string noticeFileName = "NOTICE.txt"; + var dependenciesFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, + noticeFileName); + TbDependencies.Text = File.Exists(dependenciesFilePath) + ? File.ReadAllText(dependenciesFilePath) + : "see " + "https://raw.githubusercontent.com/cadon/ARKStatsExtractor/dev/ARKBreedingStats/" + noticeFileName; } #region Assemblyattributaccessoren @@ -24,16 +31,16 @@ public string AssemblyTitle { get { - object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); + var attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); if (attributes.Length > 0) { - AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; - if (titleAttribute.Title != "") + var titleAttribute = (AssemblyTitleAttribute)attributes[0]; + if (!string.IsNullOrEmpty(titleAttribute.Title)) { return titleAttribute.Title; } } - return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); + return Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); } } @@ -90,7 +97,7 @@ private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs System.Diagnostics.Process.Start(RepositoryInfo.RepositoryUrl); } - private string Contributors => @"Thanks for contributions, help and support to + private const string Contributors = @"Thanks for contributions, help and support to * NakramR: coding, library, OCR, overlay * Flachdachs: save file extractor, installer-version, style @@ -105,7 +112,7 @@ private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs * Warstone: Kibble recipes * tsebring: naming-generator * maxime-paquatte: custom timer sounds -* hallipr: FTP save file import +* hallipr: FTP save file import and Javascript name pattern support * EmkioA: Cryopod import, listView tweaks * dunger: fixes * Myrmecoleon: extra species color region images diff --git a/ARKBreedingStats/CreatureInfoInput.cs b/ARKBreedingStats/CreatureInfoInput.cs index b7345f33a..bf60ff690 100644 --- a/ARKBreedingStats/CreatureInfoInput.cs +++ b/ARKBreedingStats/CreatureInfoInput.cs @@ -138,6 +138,10 @@ internal void UpdateParentInheritances(Creature creature) private void buttonAdd2Library_Click(object sender, EventArgs e) { + // keep selected parents + Mother = Mother; + Father = Father; + Add2LibraryClicked?.Invoke(this); } diff --git a/ARKBreedingStats/Form1.Designer.cs b/ARKBreedingStats/Form1.Designer.cs index 164d41d40..974f1d210 100644 --- a/ARKBreedingStats/Form1.Designer.cs +++ b/ARKBreedingStats/Form1.Designer.cs @@ -60,6 +60,8 @@ private void InitializeComponent() this.lbImprintedCount = new System.Windows.Forms.Label(); this.BtSetImprinting100Tester = new System.Windows.Forms.Button(); this.labelImprintingTester = new System.Windows.Forms.Label(); + this.numericUpDownImprintingBonusTester = new ARKBreedingStats.uiControls.Nud(); + this.NumericUpDownTestingTE = new ARKBreedingStats.uiControls.Nud(); this.labelTesterTE = new System.Windows.Forms.Label(); this.groupBoxPossibilities = new System.Windows.Forms.GroupBox(); this.listViewPossibilities = new System.Windows.Forms.ListView(); @@ -74,11 +76,14 @@ private void InitializeComponent() this.cbExactlyImprinting = new System.Windows.Forms.CheckBox(); this.labelImprintingBonus = new System.Windows.Forms.Label(); this.lbImprintingCuddleCountExtractor = new System.Windows.Forms.Label(); + this.numericUpDownImprintingBonusExtractor = new ARKBreedingStats.uiControls.Nud(); this.panelExtrTE = new System.Windows.Forms.Panel(); this.labelTE = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); + this.numericUpDownUpperTEffBound = new ARKBreedingStats.uiControls.Nud(); this.label3 = new System.Windows.Forms.Label(); + this.numericUpDownLowerTEffBound = new ARKBreedingStats.uiControls.Nud(); this.lbLevel = new System.Windows.Forms.Label(); this.lbBreedingValueTester = new System.Windows.Forms.Label(); this.lbTesterWildLevel = new System.Windows.Forms.Label(); @@ -136,6 +141,12 @@ private void InitializeComponent() this.editSortingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.applyChangedSortingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpAboutSpeciesSortingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.appSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.showSettingsFileInExplorerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.loadAppSettingsFromFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveAppSettingsTToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator29 = new System.Windows.Forms.ToolStripSeparator(); + this.showStatsOptionsFileInExplorerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.serverToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.listenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.currentTokenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -166,7 +177,9 @@ private void InitializeComponent() this.tabPageStatTesting = new System.Windows.Forms.TabPage(); this.CbLinkWildMutatedLevelsTester = new System.Windows.Forms.CheckBox(); this.pictureBoxColorRegionsTester = new System.Windows.Forms.PictureBox(); + this.statPotentials1 = new ARKBreedingStats.uiControls.StatPotentials(); this.gbStatChart = new System.Windows.Forms.GroupBox(); + this.radarChart1 = new ARKBreedingStats.RadarChart(); this.panelWildTamedBredTester = new System.Windows.Forms.Panel(); this.rbBredTester = new System.Windows.Forms.RadioButton(); this.rbTamedTester = new System.Windows.Forms.RadioButton(); @@ -186,6 +199,7 @@ private void InitializeComponent() this.lbCurrentCreature = new System.Windows.Forms.Label(); this.labelCurrentTesterCreature = new System.Windows.Forms.Label(); this.lbTestingInfo = new System.Windows.Forms.Label(); + this.creatureInfoInputTester = new ARKBreedingStats.CreatureInfoInput(); this.tabPageExtractor = new System.Windows.Forms.TabPage(); this.LbAsa = new System.Windows.Forms.Label(); this.LbBlueprintPath = new System.Windows.Forms.Label(); @@ -193,6 +207,7 @@ private void InitializeComponent() this.llOnlineHelpExtractionIssues = new System.Windows.Forms.LinkLabel(); this.PbCreatureColorsExtractor = new System.Windows.Forms.PictureBox(); this.groupBoxRadarChartExtractor = new System.Windows.Forms.GroupBox(); + this.radarChartExtractor = new ARKBreedingStats.RadarChart(); this.lbImprintingFailInfo = new System.Windows.Forms.Label(); this.groupBoxTamingInfo = new System.Windows.Forms.GroupBox(); this.labelTamingInfo = new System.Windows.Forms.Label(); @@ -205,6 +220,10 @@ private void InitializeComponent() this.btExtractLevels = new System.Windows.Forms.Button(); this.cbQuickWildCheck = new System.Windows.Forms.CheckBox(); this.labelErrorHelp = new System.Windows.Forms.Label(); + this.creatureAnalysis1 = new ARKBreedingStats.uiControls.CreatureAnalysis(); + this.parentInheritanceExtractor = new ARKBreedingStats.uiControls.ParentInheritance(); + this.numericUpDownLevel = new ARKBreedingStats.uiControls.Nud(); + this.creatureInfoInputExtractor = new ARKBreedingStats.CreatureInfoInput(); this.tabPageLibrary = new System.Windows.Forms.TabPage(); this.tableLayoutPanelLibrary = new System.Windows.Forms.TableLayoutPanel(); this.listViewLibrary = new System.Windows.Forms.ListView(); @@ -301,26 +320,39 @@ private void InitializeComponent() this.listBoxSpeciesLib = new System.Windows.Forms.ListBox(); this.tabPage3 = new System.Windows.Forms.TabPage(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); - this.checkedListBoxConsiderStatTop = new System.Windows.Forms.CheckedListBox(); - this.buttonRecalculateTops = new System.Windows.Forms.Button(); this.label17 = new System.Windows.Forms.Label(); + this.buttonRecalculateTops = new System.Windows.Forms.Button(); this.tabPageLibRadarChart = new System.Windows.Forms.TabPage(); + this.radarChartLibrary = new ARKBreedingStats.RadarChart(); + this.creatureBoxListView = new ARKBreedingStats.CreatureBox(); this.tabPageLibraryInfo = new System.Windows.Forms.TabPage(); this.tlpLibraryInfo = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.CbLibraryInfoUseFilter = new System.Windows.Forms.CheckBox(); this.BtCopyLibraryColorToClipboard = new System.Windows.Forms.Button(); + this.libraryInfoControl1 = new ARKBreedingStats.uiControls.LibraryInfoControl(); this.tabPagePedigree = new System.Windows.Forms.TabPage(); + this.pedigree1 = new ARKBreedingStats.Pedigree.PedigreeControl(); this.tabPageTaming = new System.Windows.Forms.TabPage(); + this.tamingControl1 = new ARKBreedingStats.TamingControl(); this.tabPageBreedingPlan = new System.Windows.Forms.TabPage(); + this.breedingPlan1 = new ARKBreedingStats.BreedingPlanning.BreedingPlan(); this.tabPageHatching = new System.Windows.Forms.TabPage(); + this.hatching1 = new ARKBreedingStats.uiControls.Hatching(); this.tabPageRaising = new System.Windows.Forms.TabPage(); + this.raisingControl1 = new ARKBreedingStats.raising.RaisingControl(); this.tabPageTimer = new System.Windows.Forms.TabPage(); + this.timerList1 = new ARKBreedingStats.TimerControl(); this.tabPagePlayerTribes = new System.Windows.Forms.TabPage(); + this.tribesControl1 = new ARKBreedingStats.TribesControl(); this.tabPageNotes = new System.Windows.Forms.TabPage(); + this.notesControl1 = new ARKBreedingStats.NotesControl(); this.TabPageOCR = new System.Windows.Forms.TabPage(); + this.ocrControl1 = new ARKBreedingStats.ocr.OCRControl(); this.tabPageExtractionTests = new System.Windows.Forms.TabPage(); + this.extractionTestControl1 = new ARKBreedingStats.testCases.ExtractionTestControl(); this.tabPageMultiplierTesting = new System.Windows.Forms.TabPage(); + this.statsMultiplierTesting1 = new ARKBreedingStats.multiplierTesting.StatsMultiplierTesting(); this.btReadValuesFromArk = new System.Windows.Forms.Button(); this.cbEventMultipliers = new System.Windows.Forms.CheckBox(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); @@ -358,6 +390,7 @@ private void InitializeComponent() this.panelToolBar = new System.Windows.Forms.Panel(); this.btImportLastExported = new System.Windows.Forms.Button(); this.pbSpecies = new System.Windows.Forms.PictureBox(); + this.tbSpeciesGlobal = new ARKBreedingStats.uiControls.TextBoxSuggest(); this.cbGuessSpecies = new System.Windows.Forms.CheckBox(); this.cbToggleOverlay = new System.Windows.Forms.CheckBox(); this.lbListening = new System.Windows.Forms.Label(); @@ -370,40 +403,18 @@ private void InitializeComponent() this.collapseMutationsLevelsASEToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator27 = new System.Windows.Forms.ToolStripSeparator(); this.resetColumnOrderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.statPotentials1 = new ARKBreedingStats.uiControls.StatPotentials(); - this.radarChart1 = new ARKBreedingStats.RadarChart(); - this.numericUpDownImprintingBonusTester = new ARKBreedingStats.uiControls.Nud(); - this.NumericUpDownTestingTE = new ARKBreedingStats.uiControls.Nud(); - this.creatureInfoInputTester = new ARKBreedingStats.CreatureInfoInput(); - this.radarChartExtractor = new ARKBreedingStats.RadarChart(); - this.numericUpDownImprintingBonusExtractor = new ARKBreedingStats.uiControls.Nud(); - this.numericUpDownUpperTEffBound = new ARKBreedingStats.uiControls.Nud(); - this.numericUpDownLowerTEffBound = new ARKBreedingStats.uiControls.Nud(); - this.creatureAnalysis1 = new ARKBreedingStats.uiControls.CreatureAnalysis(); - this.parentInheritanceExtractor = new ARKBreedingStats.uiControls.ParentInheritance(); - this.numericUpDownLevel = new ARKBreedingStats.uiControls.Nud(); - this.creatureInfoInputExtractor = new ARKBreedingStats.CreatureInfoInput(); - this.radarChartLibrary = new ARKBreedingStats.RadarChart(); - this.creatureBoxListView = new ARKBreedingStats.CreatureBox(); - this.libraryInfoControl1 = new ARKBreedingStats.uiControls.LibraryInfoControl(); - this.pedigree1 = new ARKBreedingStats.Pedigree.PedigreeControl(); - this.tamingControl1 = new ARKBreedingStats.TamingControl(); - this.breedingPlan1 = new ARKBreedingStats.BreedingPlanning.BreedingPlan(); - this.hatching1 = new ARKBreedingStats.uiControls.Hatching(); - this.raisingControl1 = new ARKBreedingStats.raising.RaisingControl(); - this.timerList1 = new ARKBreedingStats.TimerControl(); - this.tribesControl1 = new ARKBreedingStats.TribesControl(); - this.notesControl1 = new ARKBreedingStats.NotesControl(); - this.ocrControl1 = new ARKBreedingStats.ocr.OCRControl(); - this.extractionTestControl1 = new ARKBreedingStats.testCases.ExtractionTestControl(); - this.statsMultiplierTesting1 = new ARKBreedingStats.multiplierTesting.StatsMultiplierTesting(); this.speciesSelector1 = new ARKBreedingStats.SpeciesSelector(); - this.tbSpeciesGlobal = new ARKBreedingStats.uiControls.TextBoxSuggest(); + this.BtRecalculateTopStatsAfterChange = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownImprintingBonusTester)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NumericUpDownTestingTE)).BeginInit(); this.groupBoxPossibilities.SuspendLayout(); this.groupBoxDetailsExtractor.SuspendLayout(); this.panelExtrImpr.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownImprintingBonusExtractor)).BeginInit(); this.panelExtrTE.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownUpperTEffBound)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLowerTEffBound)).BeginInit(); this.menuStrip1.SuspendLayout(); this.panelSums.SuspendLayout(); this.panelWildTamedBred.SuspendLayout(); @@ -411,6 +422,7 @@ private void InitializeComponent() this.tabPageStatTesting.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxColorRegionsTester)).BeginInit(); this.gbStatChart.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.radarChart1)).BeginInit(); this.panelWildTamedBredTester.SuspendLayout(); this.groupBox2.SuspendLayout(); this.flowLayoutPanelStatIOsTester.SuspendLayout(); @@ -420,10 +432,12 @@ private void InitializeComponent() this.tabPageExtractor.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PbCreatureColorsExtractor)).BeginInit(); this.groupBoxRadarChartExtractor.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.radarChartExtractor)).BeginInit(); this.groupBoxTamingInfo.SuspendLayout(); this.gbStatsExtractor.SuspendLayout(); this.flowLayoutPanelStatIOsExtractor.SuspendLayout(); this.panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLevel)).BeginInit(); this.tabPageLibrary.SuspendLayout(); this.tableLayoutPanelLibrary.SuspendLayout(); this.contextMenuStripLibrary.SuspendLayout(); @@ -433,6 +447,7 @@ private void InitializeComponent() this.tabPage3.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.tabPageLibRadarChart.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.radarChartLibrary)).BeginInit(); this.tabPageLibraryInfo.SuspendLayout(); this.tlpLibraryInfo.SuspendLayout(); this.tableLayoutPanel3.SuspendLayout(); @@ -452,15 +467,6 @@ private void InitializeComponent() this.panelToolBar.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbSpecies)).BeginInit(); this.contextMenuStripLibraryHeader.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.radarChart1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownImprintingBonusTester)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NumericUpDownTestingTE)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.radarChartExtractor)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownImprintingBonusExtractor)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownUpperTEffBound)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLowerTEffBound)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLevel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.radarChartLibrary)).BeginInit(); this.SuspendLayout(); // // aboutToolStripMenuItem @@ -669,6 +675,52 @@ private void InitializeComponent() this.labelImprintingTester.TabIndex = 5; this.labelImprintingTester.Text = "% Imprinting Bonus"; // + // numericUpDownImprintingBonusTester + // + this.numericUpDownImprintingBonusTester.DecimalPlaces = 5; + this.numericUpDownImprintingBonusTester.Enabled = false; + this.numericUpDownImprintingBonusTester.ForeColor = System.Drawing.SystemColors.GrayText; + this.numericUpDownImprintingBonusTester.Location = new System.Drawing.Point(6, 45); + this.numericUpDownImprintingBonusTester.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.numericUpDownImprintingBonusTester.Name = "numericUpDownImprintingBonusTester"; + this.numericUpDownImprintingBonusTester.NeutralNumber = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.numericUpDownImprintingBonusTester.Size = new System.Drawing.Size(69, 20); + this.numericUpDownImprintingBonusTester.TabIndex = 4; + this.numericUpDownImprintingBonusTester.ValueChanged += new System.EventHandler(this.numericUpDownImprintingBonusTester_ValueChanged); + // + // NumericUpDownTestingTE + // + this.NumericUpDownTestingTE.DecimalPlaces = 2; + this.NumericUpDownTestingTE.ForeColor = System.Drawing.SystemColors.WindowText; + this.NumericUpDownTestingTE.Location = new System.Drawing.Point(6, 19); + this.NumericUpDownTestingTE.Minimum = new decimal(new int[] { + 1, + 0, + 0, + -2147483648}); + this.NumericUpDownTestingTE.Name = "NumericUpDownTestingTE"; + this.NumericUpDownTestingTE.NeutralNumber = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.NumericUpDownTestingTE.Size = new System.Drawing.Size(60, 20); + this.NumericUpDownTestingTE.TabIndex = 0; + this.NumericUpDownTestingTE.Value = new decimal(new int[] { + 80, + 0, + 0, + 0}); + this.NumericUpDownTestingTE.ValueChanged += new System.EventHandler(this.NumericUpDownTestingTE_ValueChanged); + // // labelTesterTE // this.labelTesterTE.AutoSize = true; @@ -802,6 +854,27 @@ private void InitializeComponent() this.lbImprintingCuddleCountExtractor.TabIndex = 50; this.lbImprintingCuddleCountExtractor.Text = "(0×)"; // + // numericUpDownImprintingBonusExtractor + // + this.numericUpDownImprintingBonusExtractor.DecimalPlaces = 5; + this.numericUpDownImprintingBonusExtractor.ForeColor = System.Drawing.SystemColors.GrayText; + this.numericUpDownImprintingBonusExtractor.Location = new System.Drawing.Point(3, 3); + this.numericUpDownImprintingBonusExtractor.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.numericUpDownImprintingBonusExtractor.Name = "numericUpDownImprintingBonusExtractor"; + this.numericUpDownImprintingBonusExtractor.NeutralNumber = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.numericUpDownImprintingBonusExtractor.Size = new System.Drawing.Size(77, 20); + this.numericUpDownImprintingBonusExtractor.TabIndex = 0; + this.numericUpDownImprintingBonusExtractor.ValueChanged += new System.EventHandler(this.numericUpDownImprintingBonusExtractor_ValueChanged); + this.numericUpDownImprintingBonusExtractor.Enter += new System.EventHandler(this.numericUpDown_Enter); + // // panelExtrTE // this.panelExtrTE.Controls.Add(this.labelTE); @@ -841,6 +914,25 @@ private void InitializeComponent() this.label1.TabIndex = 5; this.label1.Text = "%"; // + // numericUpDownUpperTEffBound + // + this.numericUpDownUpperTEffBound.ForeColor = System.Drawing.SystemColors.WindowText; + this.numericUpDownUpperTEffBound.Location = new System.Drawing.Point(147, 3); + this.numericUpDownUpperTEffBound.Name = "numericUpDownUpperTEffBound"; + this.numericUpDownUpperTEffBound.NeutralNumber = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.numericUpDownUpperTEffBound.Size = new System.Drawing.Size(45, 20); + this.numericUpDownUpperTEffBound.TabIndex = 3; + this.numericUpDownUpperTEffBound.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.numericUpDownUpperTEffBound.Enter += new System.EventHandler(this.numericUpDown_Enter); + // // label3 // this.label3.AutoSize = true; @@ -850,6 +942,25 @@ private void InitializeComponent() this.label3.TabIndex = 2; this.label3.Text = "-"; // + // numericUpDownLowerTEffBound + // + this.numericUpDownLowerTEffBound.ForeColor = System.Drawing.SystemColors.WindowText; + this.numericUpDownLowerTEffBound.Location = new System.Drawing.Point(80, 3); + this.numericUpDownLowerTEffBound.Name = "numericUpDownLowerTEffBound"; + this.numericUpDownLowerTEffBound.NeutralNumber = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.numericUpDownLowerTEffBound.Size = new System.Drawing.Size(45, 20); + this.numericUpDownLowerTEffBound.TabIndex = 1; + this.numericUpDownLowerTEffBound.Value = new decimal(new int[] { + 80, + 0, + 0, + 0}); + this.numericUpDownLowerTEffBound.Enter += new System.EventHandler(this.numericUpDown_Enter); + // // lbLevel // this.lbLevel.AutoSize = true; @@ -1196,7 +1307,8 @@ private void InitializeComponent() this.extraDataToolStripMenuItem, this.toolStripSeparator23, this.openJsonDataFolderToolStripMenuItem, - this.speciesSortingToolStripMenuItem}); + this.speciesSortingToolStripMenuItem, + this.appSettingsToolStripMenuItem}); this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; this.settingsToolStripMenuItem.Size = new System.Drawing.Size(61, 20); this.settingsToolStripMenuItem.Text = "Settings"; @@ -1312,6 +1424,51 @@ private void InitializeComponent() this.helpAboutSpeciesSortingToolStripMenuItem.Text = "Help about species sorting"; this.helpAboutSpeciesSortingToolStripMenuItem.Click += new System.EventHandler(this.helpAboutSpeciesSortingToolStripMenuItem_Click); // + // appSettingsToolStripMenuItem + // + this.appSettingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.showSettingsFileInExplorerToolStripMenuItem, + this.loadAppSettingsFromFileToolStripMenuItem, + this.saveAppSettingsTToolStripMenuItem, + this.toolStripSeparator29, + this.showStatsOptionsFileInExplorerToolStripMenuItem}); + this.appSettingsToolStripMenuItem.Name = "appSettingsToolStripMenuItem"; + this.appSettingsToolStripMenuItem.Size = new System.Drawing.Size(226, 22); + this.appSettingsToolStripMenuItem.Text = "App settings"; + // + // showSettingsFileInExplorerToolStripMenuItem + // + this.showSettingsFileInExplorerToolStripMenuItem.Name = "showSettingsFileInExplorerToolStripMenuItem"; + this.showSettingsFileInExplorerToolStripMenuItem.Size = new System.Drawing.Size(251, 22); + this.showSettingsFileInExplorerToolStripMenuItem.Text = "Show settings file in explorer"; + this.showSettingsFileInExplorerToolStripMenuItem.Click += new System.EventHandler(this.showSettingsFileInExplorerToolStripMenuItem_Click); + // + // loadAppSettingsFromFileToolStripMenuItem + // + this.loadAppSettingsFromFileToolStripMenuItem.Name = "loadAppSettingsFromFileToolStripMenuItem"; + this.loadAppSettingsFromFileToolStripMenuItem.Size = new System.Drawing.Size(251, 22); + this.loadAppSettingsFromFileToolStripMenuItem.Text = "Import app settings from file"; + this.loadAppSettingsFromFileToolStripMenuItem.Click += new System.EventHandler(this.loadAppSettingsFromFileToolStripMenuItem_Click); + // + // saveAppSettingsTToolStripMenuItem + // + this.saveAppSettingsTToolStripMenuItem.Name = "saveAppSettingsTToolStripMenuItem"; + this.saveAppSettingsTToolStripMenuItem.Size = new System.Drawing.Size(251, 22); + this.saveAppSettingsTToolStripMenuItem.Text = "Export app settings to file"; + this.saveAppSettingsTToolStripMenuItem.Click += new System.EventHandler(this.saveAppSettingsTToolStripMenuItem_Click); + // + // toolStripSeparator29 + // + this.toolStripSeparator29.Name = "toolStripSeparator29"; + this.toolStripSeparator29.Size = new System.Drawing.Size(248, 6); + // + // showStatsOptionsFileInExplorerToolStripMenuItem + // + this.showStatsOptionsFileInExplorerToolStripMenuItem.Name = "showStatsOptionsFileInExplorerToolStripMenuItem"; + this.showStatsOptionsFileInExplorerToolStripMenuItem.Size = new System.Drawing.Size(251, 22); + this.showStatsOptionsFileInExplorerToolStripMenuItem.Text = "Show StatsOptions file in explorer"; + this.showStatsOptionsFileInExplorerToolStripMenuItem.Click += new System.EventHandler(this.showStatsOptionsFileInExplorerToolStripMenuItem_Click); + // // serverToolStripMenuItem // this.serverToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -1599,6 +1756,13 @@ private void InitializeComponent() this.pictureBoxColorRegionsTester.TabStop = false; this.pictureBoxColorRegionsTester.Click += new System.EventHandler(this.pictureBoxColorRegionsTester_Click); // + // statPotentials1 + // + this.statPotentials1.Location = new System.Drawing.Point(860, 9); + this.statPotentials1.Name = "statPotentials1"; + this.statPotentials1.Size = new System.Drawing.Size(293, 433); + this.statPotentials1.TabIndex = 12; + // // gbStatChart // this.gbStatChart.Controls.Add(this.radarChart1); @@ -1609,6 +1773,16 @@ private void InitializeComponent() this.gbStatChart.TabStop = false; this.gbStatChart.Text = "Stat-Chart"; // + // radarChart1 + // + this.radarChart1.Image = ((System.Drawing.Image)(resources.GetObject("radarChart1.Image"))); + this.radarChart1.Location = new System.Drawing.Point(6, 19); + this.radarChart1.Name = "radarChart1"; + this.radarChart1.Size = new System.Drawing.Size(200, 200); + this.radarChart1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.radarChart1.TabIndex = 10; + this.radarChart1.TabStop = false; + // // panelWildTamedBredTester // this.panelWildTamedBredTester.Controls.Add(this.rbBredTester); @@ -1805,6 +1979,43 @@ private void InitializeComponent() this.lbTestingInfo.TabIndex = 37; this.lbTestingInfo.Text = "Preview or edit levels of a creature."; // + // creatureInfoInputTester + // + this.creatureInfoInputTester.AlreadyExistingCreature = null; + this.creatureInfoInputTester.ColorIdsAlsoPossible = null; + this.creatureInfoInputTester.CooldownUntil = null; + this.creatureInfoInputTester.CreatureFlags = ARKBreedingStats.Library.CreatureFlags.None; + this.creatureInfoInputTester.CreatureName = ""; + this.creatureInfoInputTester.CreatureNote = ""; + this.creatureInfoInputTester.CreatureOwner = ""; + this.creatureInfoInputTester.CreatureServer = ""; + this.creatureInfoInputTester.CreatureSex = ARKBreedingStats.Library.Sex.Unknown; + this.creatureInfoInputTester.CreatureStatus = ARKBreedingStats.Library.CreatureStatus.Available; + this.creatureInfoInputTester.CreatureTribe = ""; + this.creatureInfoInputTester.DomesticatedAt = new System.DateTime(2014, 12, 31, 0, 0, 0, 0); + this.creatureInfoInputTester.Father = null; + this.creatureInfoInputTester.GrowingUntil = null; + this.creatureInfoInputTester.Location = new System.Drawing.Point(373, 184); + this.creatureInfoInputTester.LockServer = false; + this.creatureInfoInputTester.Mother = null; + this.creatureInfoInputTester.MutationCounterFather = 0; + this.creatureInfoInputTester.MutationCounterMother = 0; + this.creatureInfoInputTester.Name = "creatureInfoInputTester"; + this.creatureInfoInputTester.OwnerLock = false; + this.creatureInfoInputTester.RegionColors = new byte[] { + ((byte)(0)), + ((byte)(0)), + ((byte)(0)), + ((byte)(0)), + ((byte)(0)), + ((byte)(0))}; + this.creatureInfoInputTester.Size = new System.Drawing.Size(262, 590); + this.creatureInfoInputTester.TabIndex = 4; + this.creatureInfoInputTester.TribeLock = false; + this.creatureInfoInputTester.Add2LibraryClicked += new System.Action(this.creatureInfoInputTester_Add2Library_Clicked); + this.creatureInfoInputTester.Save2LibraryClicked += new System.Action(this.creatureInfoInputTester_Save2Library_Clicked); + this.creatureInfoInputTester.ParentListRequested += new System.Action(this.CreatureInfoInput_ParentListRequested); + // // tabPageExtractor // this.tabPageExtractor.AutoScroll = true; @@ -1901,15 +2112,26 @@ private void InitializeComponent() this.groupBoxRadarChartExtractor.TabStop = false; this.groupBoxRadarChartExtractor.Text = "Stat-Chart"; // - // lbImprintingFailInfo + // radarChartExtractor // - this.lbImprintingFailInfo.BackColor = System.Drawing.Color.MistyRose; - this.lbImprintingFailInfo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.lbImprintingFailInfo.ForeColor = System.Drawing.Color.Maroon; - this.lbImprintingFailInfo.Location = new System.Drawing.Point(641, 612); - this.lbImprintingFailInfo.Name = "lbImprintingFailInfo"; - this.lbImprintingFailInfo.Size = new System.Drawing.Size(443, 88); - this.lbImprintingFailInfo.TabIndex = 49; + this.radarChartExtractor.Dock = System.Windows.Forms.DockStyle.Fill; + this.radarChartExtractor.Image = ((System.Drawing.Image)(resources.GetObject("radarChartExtractor.Image"))); + this.radarChartExtractor.Location = new System.Drawing.Point(3, 16); + this.radarChartExtractor.Name = "radarChartExtractor"; + this.radarChartExtractor.Size = new System.Drawing.Size(144, 144); + this.radarChartExtractor.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.radarChartExtractor.TabIndex = 10; + this.radarChartExtractor.TabStop = false; + // + // lbImprintingFailInfo + // + this.lbImprintingFailInfo.BackColor = System.Drawing.Color.MistyRose; + this.lbImprintingFailInfo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.lbImprintingFailInfo.ForeColor = System.Drawing.Color.Maroon; + this.lbImprintingFailInfo.Location = new System.Drawing.Point(641, 612); + this.lbImprintingFailInfo.Name = "lbImprintingFailInfo"; + this.lbImprintingFailInfo.Size = new System.Drawing.Size(443, 88); + this.lbImprintingFailInfo.TabIndex = 49; this.lbImprintingFailInfo.Text = "If the creature is imprinted the extraction may fail because the game sometimes \"" + "forgets\" to increase some stat-values during the imprinting-process. Usually it " + "works after a server-restart."; @@ -2028,6 +2250,81 @@ private void InitializeComponent() this.labelErrorHelp.TabIndex = 40; this.labelErrorHelp.Text = resources.GetString("labelErrorHelp.Text"); // + // creatureAnalysis1 + // + this.creatureAnalysis1.Location = new System.Drawing.Point(903, 265); + this.creatureAnalysis1.Name = "creatureAnalysis1"; + this.creatureAnalysis1.Size = new System.Drawing.Size(346, 199); + this.creatureAnalysis1.TabIndex = 55; + // + // parentInheritanceExtractor + // + this.parentInheritanceExtractor.Location = new System.Drawing.Point(903, 470); + this.parentInheritanceExtractor.Name = "parentInheritanceExtractor"; + this.parentInheritanceExtractor.Size = new System.Drawing.Size(337, 182); + this.parentInheritanceExtractor.TabIndex = 52; + // + // numericUpDownLevel + // + this.numericUpDownLevel.ForeColor = System.Drawing.SystemColors.WindowText; + this.numericUpDownLevel.Location = new System.Drawing.Point(244, 9); + this.numericUpDownLevel.Maximum = new decimal(new int[] { + 100000, + 0, + 0, + 0}); + this.numericUpDownLevel.Name = "numericUpDownLevel"; + this.numericUpDownLevel.NeutralNumber = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.numericUpDownLevel.Size = new System.Drawing.Size(56, 20); + this.numericUpDownLevel.TabIndex = 2; + this.numericUpDownLevel.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDownLevel.ValueChanged += new System.EventHandler(this.numericUpDownLevel_ValueChanged); + this.numericUpDownLevel.Enter += new System.EventHandler(this.numericUpDown_Enter); + // + // creatureInfoInputExtractor + // + this.creatureInfoInputExtractor.AlreadyExistingCreature = null; + this.creatureInfoInputExtractor.ColorIdsAlsoPossible = null; + this.creatureInfoInputExtractor.CooldownUntil = null; + this.creatureInfoInputExtractor.CreatureFlags = ARKBreedingStats.Library.CreatureFlags.None; + this.creatureInfoInputExtractor.CreatureName = ""; + this.creatureInfoInputExtractor.CreatureNote = ""; + this.creatureInfoInputExtractor.CreatureOwner = ""; + this.creatureInfoInputExtractor.CreatureServer = ""; + this.creatureInfoInputExtractor.CreatureSex = ARKBreedingStats.Library.Sex.Unknown; + this.creatureInfoInputExtractor.CreatureStatus = ARKBreedingStats.Library.CreatureStatus.Available; + this.creatureInfoInputExtractor.CreatureTribe = ""; + this.creatureInfoInputExtractor.DomesticatedAt = new System.DateTime(2014, 12, 31, 0, 0, 0, 0); + this.creatureInfoInputExtractor.Father = null; + this.creatureInfoInputExtractor.GrowingUntil = null; + this.creatureInfoInputExtractor.Location = new System.Drawing.Point(373, 184); + this.creatureInfoInputExtractor.LockServer = false; + this.creatureInfoInputExtractor.Mother = null; + this.creatureInfoInputExtractor.MutationCounterFather = 0; + this.creatureInfoInputExtractor.MutationCounterMother = 0; + this.creatureInfoInputExtractor.Name = "creatureInfoInputExtractor"; + this.creatureInfoInputExtractor.OwnerLock = false; + this.creatureInfoInputExtractor.RegionColors = new byte[] { + ((byte)(0)), + ((byte)(0)), + ((byte)(0)), + ((byte)(0)), + ((byte)(0)), + ((byte)(0))}; + this.creatureInfoInputExtractor.Size = new System.Drawing.Size(262, 590); + this.creatureInfoInputExtractor.TabIndex = 7; + this.creatureInfoInputExtractor.TribeLock = false; + this.creatureInfoInputExtractor.Add2LibraryClicked += new System.Action(this.creatureInfoInputExtractor_Add2Library_Clicked); + this.creatureInfoInputExtractor.ParentListRequested += new System.Action(this.CreatureInfoInput_ParentListRequested); + // // tabPageLibrary // this.tabPageLibrary.Controls.Add(this.tableLayoutPanelLibrary); @@ -2118,6 +2415,7 @@ private void InitializeComponent() this.listViewLibrary.View = System.Windows.Forms.View.Details; this.listViewLibrary.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.libraryListView_ColumnClick); this.listViewLibrary.SelectedIndexChanged += new System.EventHandler(this.listViewLibrary_SelectedIndexChanged); + this.listViewLibrary.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewLibrary_KeyDown); this.listViewLibrary.KeyUp += new System.Windows.Forms.KeyEventHandler(this.listViewLibrary_KeyUp); // // columnHeaderName @@ -2453,7 +2751,7 @@ private void InitializeComponent() this.toolStripSeparator14, this.toolStripMenuItemRemove}); this.contextMenuStripLibrary.Name = "contextMenuStripLibrary"; - this.contextMenuStripLibrary.Size = new System.Drawing.Size(303, 502); + this.contextMenuStripLibrary.Size = new System.Drawing.Size(303, 480); this.contextMenuStripLibrary.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripLibrary_Opening); // // toolStripMenuItemEdit @@ -2801,40 +3099,19 @@ private void InitializeComponent() // this.tableLayoutPanel2.ColumnCount = 1; this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel2.Controls.Add(this.checkedListBoxConsiderStatTop, 0, 1); - this.tableLayoutPanel2.Controls.Add(this.buttonRecalculateTops, 0, 2); + this.tableLayoutPanel2.Controls.Add(this.BtRecalculateTopStatsAfterChange, 0, 2); this.tableLayoutPanel2.Controls.Add(this.label17, 0, 0); + this.tableLayoutPanel2.Controls.Add(this.buttonRecalculateTops, 0, 1); this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.RowCount = 3; - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F)); - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 29F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.Size = new System.Drawing.Size(175, 322); this.tableLayoutPanel2.TabIndex = 0; // - // checkedListBoxConsiderStatTop - // - this.checkedListBoxConsiderStatTop.CheckOnClick = true; - this.checkedListBoxConsiderStatTop.Dock = System.Windows.Forms.DockStyle.Fill; - this.checkedListBoxConsiderStatTop.FormattingEnabled = true; - this.checkedListBoxConsiderStatTop.Location = new System.Drawing.Point(3, 35); - this.checkedListBoxConsiderStatTop.Name = "checkedListBoxConsiderStatTop"; - this.checkedListBoxConsiderStatTop.Size = new System.Drawing.Size(169, 255); - this.checkedListBoxConsiderStatTop.TabIndex = 3; - // - // buttonRecalculateTops - // - this.buttonRecalculateTops.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonRecalculateTops.Location = new System.Drawing.Point(3, 296); - this.buttonRecalculateTops.Name = "buttonRecalculateTops"; - this.buttonRecalculateTops.Size = new System.Drawing.Size(169, 23); - this.buttonRecalculateTops.TabIndex = 2; - this.buttonRecalculateTops.Text = "Apply"; - this.buttonRecalculateTops.UseVisualStyleBackColor = true; - this.buttonRecalculateTops.Click += new System.EventHandler(this.buttonRecalculateTops_Click); - // // label17 // this.label17.AutoSize = true; @@ -2844,6 +3121,16 @@ private void InitializeComponent() this.label17.TabIndex = 4; this.label17.Text = "Select the stats considered for the TopStat-Calculation and Coloring"; // + // buttonRecalculateTops + // + this.buttonRecalculateTops.Location = new System.Drawing.Point(3, 29); + this.buttonRecalculateTops.Name = "buttonRecalculateTops"; + this.buttonRecalculateTops.Size = new System.Drawing.Size(169, 23); + this.buttonRecalculateTops.TabIndex = 2; + this.buttonRecalculateTops.Text = "Open stats settings"; + this.buttonRecalculateTops.UseVisualStyleBackColor = true; + this.buttonRecalculateTops.Click += new System.EventHandler(this.ButtonOpenTopStatsSettingsClick); + // // tabPageLibRadarChart // this.tabPageLibRadarChart.Controls.Add(this.radarChartLibrary); @@ -2855,6 +3142,27 @@ private void InitializeComponent() this.tabPageLibRadarChart.Text = "Chart"; this.tabPageLibRadarChart.UseVisualStyleBackColor = true; // + // radarChartLibrary + // + this.radarChartLibrary.Dock = System.Windows.Forms.DockStyle.Top; + this.radarChartLibrary.Image = ((System.Drawing.Image)(resources.GetObject("radarChartLibrary.Image"))); + this.radarChartLibrary.Location = new System.Drawing.Point(3, 3); + this.radarChartLibrary.Name = "radarChartLibrary"; + this.radarChartLibrary.Size = new System.Drawing.Size(175, 287); + this.radarChartLibrary.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.radarChartLibrary.TabIndex = 0; + this.radarChartLibrary.TabStop = false; + // + // creatureBoxListView + // + this.creatureBoxListView.Location = new System.Drawing.Point(3, 3); + this.creatureBoxListView.Name = "creatureBoxListView"; + this.creatureBoxListView.Size = new System.Drawing.Size(189, 406); + this.creatureBoxListView.TabIndex = 0; + this.creatureBoxListView.Changed += new System.Action(this.UpdateDisplayedCreatureValues); + this.creatureBoxListView.GiveParents += new System.Action(this.CreatureBoxListView_FindParents); + this.creatureBoxListView.SelectCreature += new System.Action(this.SelectCreatureInLibrary); + // // tabPageLibraryInfo // this.tabPageLibraryInfo.Controls.Add(this.tlpLibraryInfo); @@ -2918,6 +3226,14 @@ private void InitializeComponent() this.BtCopyLibraryColorToClipboard.UseVisualStyleBackColor = true; this.BtCopyLibraryColorToClipboard.Click += new System.EventHandler(this.BtCopyLibraryColorToClipboard_Click); // + // libraryInfoControl1 + // + this.libraryInfoControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.libraryInfoControl1.Location = new System.Drawing.Point(3, 39); + this.libraryInfoControl1.Name = "libraryInfoControl1"; + this.libraryInfoControl1.Size = new System.Drawing.Size(1858, 736); + this.libraryInfoControl1.TabIndex = 3; + // // tabPagePedigree // this.tabPagePedigree.Controls.Add(this.pedigree1); @@ -2929,6 +3245,16 @@ private void InitializeComponent() this.tabPagePedigree.Text = "Pedigree"; this.tabPagePedigree.UseVisualStyleBackColor = true; // + // pedigree1 + // + this.pedigree1.AutoScroll = true; + this.pedigree1.Dock = System.Windows.Forms.DockStyle.Fill; + this.pedigree1.LeftColumnWidth = 203; + this.pedigree1.Location = new System.Drawing.Point(3, 3); + this.pedigree1.Name = "pedigree1"; + this.pedigree1.Size = new System.Drawing.Size(1864, 778); + this.pedigree1.TabIndex = 0; + // // tabPageTaming // this.tabPageTaming.Controls.Add(this.tamingControl1); @@ -2940,6 +3266,24 @@ private void InitializeComponent() this.tabPageTaming.Text = "Taming"; this.tabPageTaming.UseVisualStyleBackColor = true; // + // tamingControl1 + // + this.tamingControl1.AutoScroll = true; + this.tamingControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tamingControl1.Location = new System.Drawing.Point(3, 3); + this.tamingControl1.Name = "tamingControl1"; + this.tamingControl1.Size = new System.Drawing.Size(1864, 778); + this.tamingControl1.TabIndex = 0; + this.tamingControl1.WeaponDamages = new double[] { + 100D, + 100D, + 100D, + 100D, + 100D, + 100D, + 100D}; + this.tamingControl1.WeaponDamagesEnabled = 3; + // // tabPageBreedingPlan // this.tabPageBreedingPlan.Controls.Add(this.breedingPlan1); @@ -2951,6 +3295,17 @@ private void InitializeComponent() this.tabPageBreedingPlan.Text = "Breeding Plan"; this.tabPageBreedingPlan.UseVisualStyleBackColor = true; // + // breedingPlan1 + // + this.breedingPlan1.AutoScroll = true; + this.breedingPlan1.CurrentSpecies = null; + this.breedingPlan1.Dock = System.Windows.Forms.DockStyle.Fill; + this.breedingPlan1.Location = new System.Drawing.Point(3, 3); + this.breedingPlan1.MutationLimit = 0; + this.breedingPlan1.Name = "breedingPlan1"; + this.breedingPlan1.Size = new System.Drawing.Size(1864, 778); + this.breedingPlan1.TabIndex = 0; + // // tabPageHatching // this.tabPageHatching.Controls.Add(this.hatching1); @@ -2962,6 +3317,14 @@ private void InitializeComponent() this.tabPageHatching.Text = "Hatching"; this.tabPageHatching.UseVisualStyleBackColor = true; // + // hatching1 + // + this.hatching1.Dock = System.Windows.Forms.DockStyle.Fill; + this.hatching1.Location = new System.Drawing.Point(3, 3); + this.hatching1.Name = "hatching1"; + this.hatching1.Size = new System.Drawing.Size(1864, 778); + this.hatching1.TabIndex = 0; + // // tabPageRaising // this.tabPageRaising.Controls.Add(this.raisingControl1); @@ -2973,6 +3336,15 @@ private void InitializeComponent() this.tabPageRaising.Text = "Raising"; this.tabPageRaising.UseVisualStyleBackColor = true; // + // raisingControl1 + // + this.raisingControl1.AutoScroll = true; + this.raisingControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.raisingControl1.Location = new System.Drawing.Point(3, 3); + this.raisingControl1.Name = "raisingControl1"; + this.raisingControl1.Size = new System.Drawing.Size(1864, 778); + this.raisingControl1.TabIndex = 0; + // // tabPageTimer // this.tabPageTimer.Controls.Add(this.timerList1); @@ -2984,6 +3356,15 @@ private void InitializeComponent() this.tabPageTimer.Text = "Timer"; this.tabPageTimer.UseVisualStyleBackColor = true; // + // timerList1 + // + this.timerList1.Dock = System.Windows.Forms.DockStyle.Fill; + this.timerList1.Location = new System.Drawing.Point(3, 3); + this.timerList1.Name = "timerList1"; + this.timerList1.Size = new System.Drawing.Size(1864, 778); + this.timerList1.TabIndex = 0; + this.timerList1.TimerAlertsCSV = ""; + // // tabPagePlayerTribes // this.tabPagePlayerTribes.Controls.Add(this.tribesControl1); @@ -2995,6 +3376,14 @@ private void InitializeComponent() this.tabPagePlayerTribes.Text = "Player"; this.tabPagePlayerTribes.UseVisualStyleBackColor = true; // + // tribesControl1 + // + this.tribesControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tribesControl1.Location = new System.Drawing.Point(3, 3); + this.tribesControl1.Name = "tribesControl1"; + this.tribesControl1.Size = new System.Drawing.Size(1864, 778); + this.tribesControl1.TabIndex = 0; + // // tabPageNotes // this.tabPageNotes.Controls.Add(this.notesControl1); @@ -3006,6 +3395,14 @@ private void InitializeComponent() this.tabPageNotes.Text = "Notes"; this.tabPageNotes.UseVisualStyleBackColor = true; // + // notesControl1 + // + this.notesControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.notesControl1.Location = new System.Drawing.Point(3, 3); + this.notesControl1.Name = "notesControl1"; + this.notesControl1.Size = new System.Drawing.Size(1864, 778); + this.notesControl1.TabIndex = 0; + // // TabPageOCR // this.TabPageOCR.Controls.Add(this.ocrControl1); @@ -3017,6 +3414,14 @@ private void InitializeComponent() this.TabPageOCR.Text = "Experimental OCR"; this.TabPageOCR.UseVisualStyleBackColor = true; // + // ocrControl1 + // + this.ocrControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.ocrControl1.Location = new System.Drawing.Point(3, 3); + this.ocrControl1.Name = "ocrControl1"; + this.ocrControl1.Size = new System.Drawing.Size(1864, 778); + this.ocrControl1.TabIndex = 2; + // // tabPageExtractionTests // this.tabPageExtractionTests.Controls.Add(this.extractionTestControl1); @@ -3028,6 +3433,14 @@ private void InitializeComponent() this.tabPageExtractionTests.Text = "Extraction Tests"; this.tabPageExtractionTests.UseVisualStyleBackColor = true; // + // extractionTestControl1 + // + this.extractionTestControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.extractionTestControl1.Location = new System.Drawing.Point(3, 3); + this.extractionTestControl1.Name = "extractionTestControl1"; + this.extractionTestControl1.Size = new System.Drawing.Size(1864, 778); + this.extractionTestControl1.TabIndex = 0; + // // tabPageMultiplierTesting // this.tabPageMultiplierTesting.Controls.Add(this.statsMultiplierTesting1); @@ -3039,6 +3452,15 @@ private void InitializeComponent() this.tabPageMultiplierTesting.Text = "Multiplier Testing"; this.tabPageMultiplierTesting.UseVisualStyleBackColor = true; // + // statsMultiplierTesting1 + // + this.statsMultiplierTesting1.AllowDrop = true; + this.statsMultiplierTesting1.Dock = System.Windows.Forms.DockStyle.Fill; + this.statsMultiplierTesting1.Location = new System.Drawing.Point(3, 3); + this.statsMultiplierTesting1.Name = "statsMultiplierTesting1"; + this.statsMultiplierTesting1.Size = new System.Drawing.Size(1864, 778); + this.statsMultiplierTesting1.TabIndex = 0; + // // btReadValuesFromArk // this.btReadValuesFromArk.Location = new System.Drawing.Point(262, 3); @@ -3411,6 +3833,18 @@ private void InitializeComponent() this.pbSpecies.TabStop = false; this.pbSpecies.Click += new System.EventHandler(this.pbSpecies_Click); // + // tbSpeciesGlobal + // + this.tbSpeciesGlobal.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Append; + this.tbSpeciesGlobal.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource; + this.tbSpeciesGlobal.Location = new System.Drawing.Point(104, 3); + this.tbSpeciesGlobal.Name = "tbSpeciesGlobal"; + this.tbSpeciesGlobal.Size = new System.Drawing.Size(152, 20); + this.tbSpeciesGlobal.TabIndex = 8; + this.tbSpeciesGlobal.Click += new System.EventHandler(this.tbSpeciesGlobal_Click); + this.tbSpeciesGlobal.Enter += new System.EventHandler(this.tbSpeciesGlobal_Enter); + this.tbSpeciesGlobal.KeyUp += new System.Windows.Forms.KeyEventHandler(this.TbSpeciesGlobal_KeyUp); + // // cbGuessSpecies // this.cbGuessSpecies.AutoSize = true; @@ -3523,385 +3957,6 @@ private void InitializeComponent() this.resetColumnOrderToolStripMenuItem.Text = "Reset column order"; this.resetColumnOrderToolStripMenuItem.Click += new System.EventHandler(this.resetColumnOrderToolStripMenuItem_Click); // - // statPotentials1 - // - this.statPotentials1.Location = new System.Drawing.Point(860, 9); - this.statPotentials1.Name = "statPotentials1"; - this.statPotentials1.Size = new System.Drawing.Size(293, 433); - this.statPotentials1.TabIndex = 12; - // - // radarChart1 - // - this.radarChart1.Image = ((System.Drawing.Image)(resources.GetObject("radarChart1.Image"))); - this.radarChart1.Location = new System.Drawing.Point(6, 19); - this.radarChart1.Name = "radarChart1"; - this.radarChart1.Size = new System.Drawing.Size(200, 200); - this.radarChart1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.radarChart1.TabIndex = 10; - this.radarChart1.TabStop = false; - // - // numericUpDownImprintingBonusTester - // - this.numericUpDownImprintingBonusTester.DecimalPlaces = 5; - this.numericUpDownImprintingBonusTester.Enabled = false; - this.numericUpDownImprintingBonusTester.ForeColor = System.Drawing.SystemColors.GrayText; - this.numericUpDownImprintingBonusTester.Location = new System.Drawing.Point(6, 45); - this.numericUpDownImprintingBonusTester.Maximum = new decimal(new int[] { - 1000, - 0, - 0, - 0}); - this.numericUpDownImprintingBonusTester.Name = "numericUpDownImprintingBonusTester"; - this.numericUpDownImprintingBonusTester.NeutralNumber = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.numericUpDownImprintingBonusTester.Size = new System.Drawing.Size(69, 20); - this.numericUpDownImprintingBonusTester.TabIndex = 4; - this.numericUpDownImprintingBonusTester.ValueChanged += new System.EventHandler(this.numericUpDownImprintingBonusTester_ValueChanged); - // - // NumericUpDownTestingTE - // - this.NumericUpDownTestingTE.DecimalPlaces = 2; - this.NumericUpDownTestingTE.ForeColor = System.Drawing.SystemColors.WindowText; - this.NumericUpDownTestingTE.Location = new System.Drawing.Point(6, 19); - this.NumericUpDownTestingTE.Minimum = new decimal(new int[] { - 1, - 0, - 0, - -2147483648}); - this.NumericUpDownTestingTE.Name = "NumericUpDownTestingTE"; - this.NumericUpDownTestingTE.NeutralNumber = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.NumericUpDownTestingTE.Size = new System.Drawing.Size(60, 20); - this.NumericUpDownTestingTE.TabIndex = 0; - this.NumericUpDownTestingTE.Value = new decimal(new int[] { - 80, - 0, - 0, - 0}); - this.NumericUpDownTestingTE.ValueChanged += new System.EventHandler(this.NumericUpDownTestingTE_ValueChanged); - // - // creatureInfoInputTester - // - this.creatureInfoInputTester.AlreadyExistingCreature = null; - this.creatureInfoInputTester.ColorIdsAlsoPossible = null; - this.creatureInfoInputTester.CooldownUntil = null; - this.creatureInfoInputTester.CreatureFlags = ARKBreedingStats.Library.CreatureFlags.None; - this.creatureInfoInputTester.CreatureName = ""; - this.creatureInfoInputTester.CreatureNote = ""; - this.creatureInfoInputTester.CreatureOwner = ""; - this.creatureInfoInputTester.CreatureServer = ""; - this.creatureInfoInputTester.CreatureSex = ARKBreedingStats.Library.Sex.Unknown; - this.creatureInfoInputTester.CreatureStatus = ARKBreedingStats.Library.CreatureStatus.Available; - this.creatureInfoInputTester.CreatureTribe = ""; - this.creatureInfoInputTester.DomesticatedAt = new System.DateTime(2014, 12, 31, 0, 0, 0, 0); - this.creatureInfoInputTester.Father = null; - this.creatureInfoInputTester.GrowingUntil = null; - this.creatureInfoInputTester.Location = new System.Drawing.Point(373, 184); - this.creatureInfoInputTester.LockServer = false; - this.creatureInfoInputTester.Mother = null; - this.creatureInfoInputTester.MutationCounterFather = 0; - this.creatureInfoInputTester.MutationCounterMother = 0; - this.creatureInfoInputTester.Name = "creatureInfoInputTester"; - this.creatureInfoInputTester.OwnerLock = false; - this.creatureInfoInputTester.RegionColors = new byte[] { - ((byte)(0)), - ((byte)(0)), - ((byte)(0)), - ((byte)(0)), - ((byte)(0)), - ((byte)(0))}; - this.creatureInfoInputTester.Size = new System.Drawing.Size(262, 590); - this.creatureInfoInputTester.TabIndex = 4; - this.creatureInfoInputTester.TribeLock = false; - this.creatureInfoInputTester.Add2LibraryClicked += new System.Action(this.creatureInfoInputTester_Add2Library_Clicked); - this.creatureInfoInputTester.Save2LibraryClicked += new System.Action(this.creatureInfoInputTester_Save2Library_Clicked); - this.creatureInfoInputTester.ParentListRequested += new System.Action(this.CreatureInfoInput_ParentListRequested); - // - // radarChartExtractor - // - this.radarChartExtractor.Dock = System.Windows.Forms.DockStyle.Fill; - this.radarChartExtractor.Image = ((System.Drawing.Image)(resources.GetObject("radarChartExtractor.Image"))); - this.radarChartExtractor.Location = new System.Drawing.Point(3, 16); - this.radarChartExtractor.Name = "radarChartExtractor"; - this.radarChartExtractor.Size = new System.Drawing.Size(144, 144); - this.radarChartExtractor.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; - this.radarChartExtractor.TabIndex = 10; - this.radarChartExtractor.TabStop = false; - // - // numericUpDownImprintingBonusExtractor - // - this.numericUpDownImprintingBonusExtractor.DecimalPlaces = 5; - this.numericUpDownImprintingBonusExtractor.ForeColor = System.Drawing.SystemColors.GrayText; - this.numericUpDownImprintingBonusExtractor.Location = new System.Drawing.Point(3, 3); - this.numericUpDownImprintingBonusExtractor.Maximum = new decimal(new int[] { - 1000, - 0, - 0, - 0}); - this.numericUpDownImprintingBonusExtractor.Name = "numericUpDownImprintingBonusExtractor"; - this.numericUpDownImprintingBonusExtractor.NeutralNumber = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.numericUpDownImprintingBonusExtractor.Size = new System.Drawing.Size(77, 20); - this.numericUpDownImprintingBonusExtractor.TabIndex = 0; - this.numericUpDownImprintingBonusExtractor.ValueChanged += new System.EventHandler(this.numericUpDownImprintingBonusExtractor_ValueChanged); - this.numericUpDownImprintingBonusExtractor.Enter += new System.EventHandler(this.numericUpDown_Enter); - // - // numericUpDownUpperTEffBound - // - this.numericUpDownUpperTEffBound.ForeColor = System.Drawing.SystemColors.WindowText; - this.numericUpDownUpperTEffBound.Location = new System.Drawing.Point(147, 3); - this.numericUpDownUpperTEffBound.Name = "numericUpDownUpperTEffBound"; - this.numericUpDownUpperTEffBound.NeutralNumber = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.numericUpDownUpperTEffBound.Size = new System.Drawing.Size(45, 20); - this.numericUpDownUpperTEffBound.TabIndex = 3; - this.numericUpDownUpperTEffBound.Value = new decimal(new int[] { - 100, - 0, - 0, - 0}); - this.numericUpDownUpperTEffBound.Enter += new System.EventHandler(this.numericUpDown_Enter); - // - // numericUpDownLowerTEffBound - // - this.numericUpDownLowerTEffBound.ForeColor = System.Drawing.SystemColors.WindowText; - this.numericUpDownLowerTEffBound.Location = new System.Drawing.Point(80, 3); - this.numericUpDownLowerTEffBound.Name = "numericUpDownLowerTEffBound"; - this.numericUpDownLowerTEffBound.NeutralNumber = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.numericUpDownLowerTEffBound.Size = new System.Drawing.Size(45, 20); - this.numericUpDownLowerTEffBound.TabIndex = 1; - this.numericUpDownLowerTEffBound.Value = new decimal(new int[] { - 80, - 0, - 0, - 0}); - this.numericUpDownLowerTEffBound.Enter += new System.EventHandler(this.numericUpDown_Enter); - // - // creatureAnalysis1 - // - this.creatureAnalysis1.Location = new System.Drawing.Point(903, 265); - this.creatureAnalysis1.Name = "creatureAnalysis1"; - this.creatureAnalysis1.Size = new System.Drawing.Size(346, 199); - this.creatureAnalysis1.TabIndex = 55; - // - // parentInheritanceExtractor - // - this.parentInheritanceExtractor.Location = new System.Drawing.Point(903, 470); - this.parentInheritanceExtractor.Name = "parentInheritanceExtractor"; - this.parentInheritanceExtractor.Size = new System.Drawing.Size(337, 182); - this.parentInheritanceExtractor.TabIndex = 52; - // - // numericUpDownLevel - // - this.numericUpDownLevel.ForeColor = System.Drawing.SystemColors.WindowText; - this.numericUpDownLevel.Location = new System.Drawing.Point(244, 9); - this.numericUpDownLevel.Maximum = new decimal(new int[] { - 100000, - 0, - 0, - 0}); - this.numericUpDownLevel.Name = "numericUpDownLevel"; - this.numericUpDownLevel.NeutralNumber = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.numericUpDownLevel.Size = new System.Drawing.Size(56, 20); - this.numericUpDownLevel.TabIndex = 2; - this.numericUpDownLevel.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.numericUpDownLevel.Enter += new System.EventHandler(this.numericUpDown_Enter); - // - // creatureInfoInputExtractor - // - this.creatureInfoInputExtractor.AlreadyExistingCreature = null; - this.creatureInfoInputExtractor.ColorIdsAlsoPossible = null; - this.creatureInfoInputExtractor.CooldownUntil = null; - this.creatureInfoInputExtractor.CreatureFlags = ARKBreedingStats.Library.CreatureFlags.None; - this.creatureInfoInputExtractor.CreatureName = ""; - this.creatureInfoInputExtractor.CreatureNote = ""; - this.creatureInfoInputExtractor.CreatureOwner = ""; - this.creatureInfoInputExtractor.CreatureServer = ""; - this.creatureInfoInputExtractor.CreatureSex = ARKBreedingStats.Library.Sex.Unknown; - this.creatureInfoInputExtractor.CreatureStatus = ARKBreedingStats.Library.CreatureStatus.Available; - this.creatureInfoInputExtractor.CreatureTribe = ""; - this.creatureInfoInputExtractor.DomesticatedAt = new System.DateTime(2014, 12, 31, 0, 0, 0, 0); - this.creatureInfoInputExtractor.Father = null; - this.creatureInfoInputExtractor.GrowingUntil = null; - this.creatureInfoInputExtractor.Location = new System.Drawing.Point(373, 184); - this.creatureInfoInputExtractor.LockServer = false; - this.creatureInfoInputExtractor.Mother = null; - this.creatureInfoInputExtractor.MutationCounterFather = 0; - this.creatureInfoInputExtractor.MutationCounterMother = 0; - this.creatureInfoInputExtractor.Name = "creatureInfoInputExtractor"; - this.creatureInfoInputExtractor.OwnerLock = false; - this.creatureInfoInputExtractor.RegionColors = new byte[] { - ((byte)(0)), - ((byte)(0)), - ((byte)(0)), - ((byte)(0)), - ((byte)(0)), - ((byte)(0))}; - this.creatureInfoInputExtractor.Size = new System.Drawing.Size(262, 590); - this.creatureInfoInputExtractor.TabIndex = 7; - this.creatureInfoInputExtractor.TribeLock = false; - this.creatureInfoInputExtractor.Add2LibraryClicked += new System.Action(this.creatureInfoInputExtractor_Add2Library_Clicked); - this.creatureInfoInputExtractor.ParentListRequested += new System.Action(this.CreatureInfoInput_ParentListRequested); - // - // radarChartLibrary - // - this.radarChartLibrary.Dock = System.Windows.Forms.DockStyle.Top; - this.radarChartLibrary.Image = ((System.Drawing.Image)(resources.GetObject("radarChartLibrary.Image"))); - this.radarChartLibrary.Location = new System.Drawing.Point(3, 3); - this.radarChartLibrary.Name = "radarChartLibrary"; - this.radarChartLibrary.Size = new System.Drawing.Size(175, 287); - this.radarChartLibrary.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.radarChartLibrary.TabIndex = 0; - this.radarChartLibrary.TabStop = false; - // - // creatureBoxListView - // - this.creatureBoxListView.Location = new System.Drawing.Point(3, 3); - this.creatureBoxListView.Name = "creatureBoxListView"; - this.creatureBoxListView.Size = new System.Drawing.Size(189, 406); - this.creatureBoxListView.TabIndex = 0; - this.creatureBoxListView.Changed += new System.Action(this.UpdateDisplayedCreatureValues); - this.creatureBoxListView.GiveParents += new System.Action(this.CreatureBoxListView_FindParents); - this.creatureBoxListView.SelectCreature += new System.Action(this.SelectCreatureInLibrary); - // - // libraryInfoControl1 - // - this.libraryInfoControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.libraryInfoControl1.Location = new System.Drawing.Point(3, 39); - this.libraryInfoControl1.Name = "libraryInfoControl1"; - this.libraryInfoControl1.Size = new System.Drawing.Size(1858, 736); - this.libraryInfoControl1.TabIndex = 3; - // - // pedigree1 - // - this.pedigree1.AutoScroll = true; - this.pedigree1.Dock = System.Windows.Forms.DockStyle.Fill; - this.pedigree1.LeftColumnWidth = 203; - this.pedigree1.Location = new System.Drawing.Point(3, 3); - this.pedigree1.Name = "pedigree1"; - this.pedigree1.Size = new System.Drawing.Size(1864, 778); - this.pedigree1.TabIndex = 0; - // - // tamingControl1 - // - this.tamingControl1.AutoScroll = true; - this.tamingControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tamingControl1.Location = new System.Drawing.Point(3, 3); - this.tamingControl1.Name = "tamingControl1"; - this.tamingControl1.Size = new System.Drawing.Size(1864, 778); - this.tamingControl1.TabIndex = 0; - this.tamingControl1.WeaponDamages = new double[] { - 100D, - 100D, - 100D, - 100D, - 100D, - 100D, - 100D}; - this.tamingControl1.WeaponDamagesEnabled = 3; - // - // breedingPlan1 - // - this.breedingPlan1.AutoScroll = true; - this.breedingPlan1.CurrentSpecies = null; - this.breedingPlan1.Dock = System.Windows.Forms.DockStyle.Fill; - this.breedingPlan1.Location = new System.Drawing.Point(3, 3); - this.breedingPlan1.MutationLimit = 0; - this.breedingPlan1.Name = "breedingPlan1"; - this.breedingPlan1.Size = new System.Drawing.Size(1864, 778); - this.breedingPlan1.TabIndex = 0; - // - // hatching1 - // - this.hatching1.Dock = System.Windows.Forms.DockStyle.Fill; - this.hatching1.Location = new System.Drawing.Point(3, 3); - this.hatching1.Name = "hatching1"; - this.hatching1.Size = new System.Drawing.Size(1864, 778); - this.hatching1.TabIndex = 0; - // - // raisingControl1 - // - this.raisingControl1.AutoScroll = true; - this.raisingControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.raisingControl1.Location = new System.Drawing.Point(3, 3); - this.raisingControl1.Name = "raisingControl1"; - this.raisingControl1.Size = new System.Drawing.Size(1864, 778); - this.raisingControl1.TabIndex = 0; - // - // timerList1 - // - this.timerList1.Dock = System.Windows.Forms.DockStyle.Fill; - this.timerList1.Location = new System.Drawing.Point(3, 3); - this.timerList1.Name = "timerList1"; - this.timerList1.Size = new System.Drawing.Size(1864, 778); - this.timerList1.TabIndex = 0; - this.timerList1.TimerAlertsCSV = ""; - // - // tribesControl1 - // - this.tribesControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tribesControl1.Location = new System.Drawing.Point(3, 3); - this.tribesControl1.Name = "tribesControl1"; - this.tribesControl1.Size = new System.Drawing.Size(1864, 778); - this.tribesControl1.TabIndex = 0; - // - // notesControl1 - // - this.notesControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.notesControl1.Location = new System.Drawing.Point(3, 3); - this.notesControl1.Name = "notesControl1"; - this.notesControl1.Size = new System.Drawing.Size(1864, 778); - this.notesControl1.TabIndex = 0; - // - // ocrControl1 - // - this.ocrControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.ocrControl1.Location = new System.Drawing.Point(3, 3); - this.ocrControl1.Name = "ocrControl1"; - this.ocrControl1.Size = new System.Drawing.Size(1864, 778); - this.ocrControl1.TabIndex = 2; - // - // extractionTestControl1 - // - this.extractionTestControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.extractionTestControl1.Location = new System.Drawing.Point(3, 3); - this.extractionTestControl1.Name = "extractionTestControl1"; - this.extractionTestControl1.Size = new System.Drawing.Size(1864, 778); - this.extractionTestControl1.TabIndex = 0; - // - // statsMultiplierTesting1 - // - this.statsMultiplierTesting1.AllowDrop = true; - this.statsMultiplierTesting1.Dock = System.Windows.Forms.DockStyle.Fill; - this.statsMultiplierTesting1.Location = new System.Drawing.Point(3, 3); - this.statsMultiplierTesting1.Name = "statsMultiplierTesting1"; - this.statsMultiplierTesting1.Size = new System.Drawing.Size(1864, 778); - this.statsMultiplierTesting1.TabIndex = 0; - // // speciesSelector1 // this.speciesSelector1.Dock = System.Windows.Forms.DockStyle.Fill; @@ -3912,17 +3967,16 @@ private void InitializeComponent() this.speciesSelector1.SplitterDistance = 500; this.speciesSelector1.TabIndex = 0; // - // tbSpeciesGlobal + // BtRecalculateTopStatsAfterChange // - this.tbSpeciesGlobal.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Append; - this.tbSpeciesGlobal.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource; - this.tbSpeciesGlobal.Location = new System.Drawing.Point(104, 3); - this.tbSpeciesGlobal.Name = "tbSpeciesGlobal"; - this.tbSpeciesGlobal.Size = new System.Drawing.Size(152, 20); - this.tbSpeciesGlobal.TabIndex = 8; - this.tbSpeciesGlobal.Click += new System.EventHandler(this.tbSpeciesGlobal_Click); - this.tbSpeciesGlobal.Enter += new System.EventHandler(this.tbSpeciesGlobal_Enter); - this.tbSpeciesGlobal.KeyUp += new System.Windows.Forms.KeyEventHandler(this.TbSpeciesGlobal_KeyUp); + this.BtRecalculateTopStatsAfterChange.Dock = System.Windows.Forms.DockStyle.Top; + this.BtRecalculateTopStatsAfterChange.Location = new System.Drawing.Point(3, 58); + this.BtRecalculateTopStatsAfterChange.Name = "BtRecalculateTopStatsAfterChange"; + this.BtRecalculateTopStatsAfterChange.Size = new System.Drawing.Size(169, 52); + this.BtRecalculateTopStatsAfterChange.TabIndex = 5; + this.BtRecalculateTopStatsAfterChange.Text = "Recalculate top stats after change"; + this.BtRecalculateTopStatsAfterChange.UseVisualStyleBackColor = true; + this.BtRecalculateTopStatsAfterChange.Click += new System.EventHandler(this.BtRecalculateTopStatsAfterChange_Click); // // Form1 // @@ -3951,12 +4005,17 @@ private void InitializeComponent() this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyUp); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownImprintingBonusTester)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NumericUpDownTestingTE)).EndInit(); this.groupBoxPossibilities.ResumeLayout(false); this.groupBoxDetailsExtractor.ResumeLayout(false); this.panelExtrImpr.ResumeLayout(false); this.panelExtrImpr.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownImprintingBonusExtractor)).EndInit(); this.panelExtrTE.ResumeLayout(false); this.panelExtrTE.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownUpperTEffBound)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLowerTEffBound)).EndInit(); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.panelSums.ResumeLayout(false); @@ -3968,6 +4027,7 @@ private void InitializeComponent() this.tabPageStatTesting.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxColorRegionsTester)).EndInit(); this.gbStatChart.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.radarChart1)).EndInit(); this.panelWildTamedBredTester.ResumeLayout(false); this.panelWildTamedBredTester.PerformLayout(); this.groupBox2.ResumeLayout(false); @@ -3982,11 +4042,13 @@ private void InitializeComponent() this.tabPageExtractor.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.PbCreatureColorsExtractor)).EndInit(); this.groupBoxRadarChartExtractor.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.radarChartExtractor)).EndInit(); this.groupBoxTamingInfo.ResumeLayout(false); this.gbStatsExtractor.ResumeLayout(false); this.flowLayoutPanelStatIOsExtractor.ResumeLayout(false); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLevel)).EndInit(); this.tabPageLibrary.ResumeLayout(false); this.tableLayoutPanelLibrary.ResumeLayout(false); this.contextMenuStripLibrary.ResumeLayout(false); @@ -3997,6 +4059,7 @@ private void InitializeComponent() this.tableLayoutPanel2.ResumeLayout(false); this.tableLayoutPanel2.PerformLayout(); this.tabPageLibRadarChart.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.radarChartLibrary)).EndInit(); this.tabPageLibraryInfo.ResumeLayout(false); this.tlpLibraryInfo.ResumeLayout(false); this.tableLayoutPanel3.ResumeLayout(false); @@ -4020,15 +4083,6 @@ private void InitializeComponent() this.panelToolBar.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbSpecies)).EndInit(); this.contextMenuStripLibraryHeader.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.radarChart1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownImprintingBonusTester)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NumericUpDownTestingTE)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.radarChartExtractor)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownImprintingBonusExtractor)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownUpperTEffBound)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLowerTEffBound)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLevel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.radarChartLibrary)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -4114,7 +4168,6 @@ private void InitializeComponent() private System.Windows.Forms.ColumnHeader columnHeaderTopness; private System.Windows.Forms.TabPage tabPage3; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; - private System.Windows.Forms.CheckedListBox checkedListBoxConsiderStatTop; private System.Windows.Forms.Button buttonRecalculateTops; private System.Windows.Forms.Label label17; private CreatureInfoInput creatureInfoInputExtractor; @@ -4399,5 +4452,12 @@ private void InitializeComponent() private System.Windows.Forms.Button BtSetImprinting100Extractor; private System.Windows.Forms.Button BtSetImprinting0Extractor; private System.Windows.Forms.Button BtSetImprinting100Tester; + private System.Windows.Forms.ToolStripMenuItem appSettingsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem showSettingsFileInExplorerToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem loadAppSettingsFromFileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveAppSettingsTToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator29; + private System.Windows.Forms.ToolStripMenuItem showStatsOptionsFileInExplorerToolStripMenuItem; + private System.Windows.Forms.Button BtRecalculateTopStatsAfterChange; } } diff --git a/ARKBreedingStats/Form1.cs b/ARKBreedingStats/Form1.cs index fea4f963d..a79d44494 100644 --- a/ARKBreedingStats/Form1.cs +++ b/ARKBreedingStats/Form1.cs @@ -15,10 +15,11 @@ using System.IO.Compression; using System.Linq; using System.Windows.Forms; -using ARKBreedingStats.importExportGun; using ARKBreedingStats.mods; using ARKBreedingStats.NamePatterns; using ARKBreedingStats.StatsOptions; +using ARKBreedingStats.StatsOptions.LevelColorSettings; +using ARKBreedingStats.StatsOptions.TopStatsSettings; using ARKBreedingStats.utils; using static ARKBreedingStats.settings.Settings; using Color = System.Drawing.Color; @@ -58,11 +59,6 @@ public delegate void SetMessageLabelTextEventHandler(string text = null, Message private bool _updateTorporInTester; private bool _filterListAllowed; - /// - /// The stat indices that are considered for color highlighting and topness calculation. - /// - private readonly bool[] _considerStatHighlight = new bool[Stats.StatsCount]; - private DateTime _lastAutoSaveBackup; private Creature _creatureTesterEdit; private int _hiddenLevelsCreatureTester; @@ -92,7 +88,8 @@ public delegate void SetMessageLabelTextEventHandler(string text = null, Message private static double[] _lastOcrValues; private Species _lastOcrSpecies; - private readonly StatsOptionsSettings _statsLevelColors = new StatsOptionsSettings("statsLevelColors.json"); + internal static readonly StatsOptionsSettings StatsLevelColors = new StatsOptionsSettings("statsLevelColors.json", "Level colors"); + internal static readonly StatsOptionsSettings StatsTopStats = new StatsOptionsSettings("statsTopStats.json", "Consider for top stats"); public Form1() { @@ -110,17 +107,6 @@ public Form1() // Properties.Settings.Default.Reset(); // #endif - // the eol is changed during the loading of the settings, the \r is removed. re-add it. - var namingPatterns = Properties.Settings.Default.NamingPatterns; - if (namingPatterns != null) - { - for (int i = 0; i < namingPatterns.Length; i++) - { - if (!string.IsNullOrEmpty(namingPatterns[i])) - namingPatterns[i] = namingPatterns[i].Replace("\r", string.Empty).Replace("\n", "\r\n"); - } - } - _tt = new ToolTip(); InitLocalization(); InitializeComponent(); @@ -181,6 +167,8 @@ public Form1() ocrControl1.OcrLabelSetsChanged += InitializeOcrLabelSets; ocrControl1.OcrLabelSelectedSetChanged += SetCurrentOcrLabelSet; + StatsLevelColors.SettingsChanged += StatsLevelColors_SettingsChanged; + openSettingsToolStripMenuItem.ShortcutKeyDisplayString = new KeysConverter() .ConvertTo(Keys.Control, typeof(string))?.ToString().Replace("None", ","); @@ -209,7 +197,6 @@ public Form1() statIo.InputValueChanged += StatIOQuickWildLevelCheck; statIo.LevelChanged += ExtractorStatLevelChanged; statIo.Click += StatIO_Click; - _considerStatHighlight[s] = (Properties.Settings.Default.consideredStats & (1 << s)) != 0; _statIOs[s] = statIo; _testingIOs[s] = statIoTesting; @@ -220,8 +207,6 @@ public Form1() { flowLayoutPanelStatIOsExtractor.Controls.Add(_statIOs[si]); flowLayoutPanelStatIOsTester.Controls.Add(_testingIOs[si]); - checkedListBoxConsiderStatTop.Items.Add(Utils.StatName(si), - _considerStatHighlight[si]); } _timerGlobal.Interval = 1000; @@ -237,12 +222,13 @@ public Form1() var libraryContextMenuItems = new ToolStripMenuItem[namePatternCount]; for (int i = 0; i < namePatternCount; i++) { - var mi = new ToolStripMenuItem { Text = $"Pattern {i + 1}{(i == 0 ? " (used for auto import)" : string.Empty)}", Tag = i }; + var displayedPatternIndex = i + 1; + var mi = new ToolStripMenuItem { Text = $"Pattern {displayedPatternIndex}{(i == 0 ? " (used for auto import)" : string.Empty)}", Tag = i }; mi.Click += MenuOpenNamePattern; namePatternMenuItems[i] = mi; // library context menu - mi = new ToolStripMenuItem { Text = $"Pattern {i + 1}", Tag = i }; + mi = new ToolStripMenuItem { Text = $"Pattern {i + 1} (NumPad{displayedPatternIndex})", Tag = i }; mi.Click += GenerateCreatureNames; libraryContextMenuItems[i] = mi; } @@ -252,32 +238,6 @@ public Form1() nameGeneratorToolStripMenuItem.DropDownItems.AddRange(namePatternMenuItems); toolStripMenuItemGenerateCreatureName.DropDownItems.AddRange(libraryContextMenuItems); - // conversion of global color level settings to specific options. Remove around 2024-09 - if (Properties.Settings.Default.ChartHueEvenMax != int.MaxValue) - { - var defaultSettings = _statsLevelColors.StatsOptionsDict[string.Empty].StatOptions; - for (var s = 0; s < Stats.StatsCount; s++) - { - defaultSettings[s].LevelGraphRepresentation.LowerColor = Utils.ColorFromHue(Properties.Settings.Default.ChartHueEvenMin); - defaultSettings[s].LevelGraphRepresentation.UpperColor = Utils.ColorFromHue(Properties.Settings.Default.ChartHueEvenMax); - defaultSettings[s].LevelGraphRepresentation.ColorGradientReversed = Properties.Settings.Default.ChartHueEvenMax < Properties.Settings.Default.ChartHueEvenMin; - - if (Properties.Settings.Default.HighlightEvenOdd) - { - defaultSettings[s].LevelGraphRepresentationOdd = new LevelGraphRepresentation - { - LowerColor = Utils.ColorFromHue(Properties.Settings.Default.ChartHueOddMin), - UpperColor = Utils.ColorFromHue(Properties.Settings.Default.ChartHueOddMax), - ColorGradientReversed = Properties.Settings.Default.ChartHueOddMax < Properties.Settings.Default.ChartHueOddMin, - }; - defaultSettings[s].UseDifferentColorsForOddLevels = true; - } - } - - Properties.Settings.Default.ChartHueEvenMax = int.MaxValue; - } - // end of level color settings conversion - _reactOnCreatureSelectionChange = true; } @@ -289,87 +249,9 @@ private void Form1_Load(object sender, EventArgs e) Utils.SetWindowRectangle(this, Properties.Settings.Default.MainWindowRect, Properties.Settings.Default.MainWindowMaximized); - // Load column-widths, display-indices and sort-order of the TimerControlListView - - LoadListViewSettings(timerList1.ListViewTimers, nameof(Properties.Settings.Default.TCLVColumnWidths), - nameof(Properties.Settings.Default.TCLVColumnDisplayIndices), - nameof(Properties.Settings.Default.TCLVSortCol), nameof(Properties.Settings.Default.TCLVSortAsc)); - if (Properties.Settings.Default.PedigreeWidthLeftColum > 20) - pedigree1.LeftColumnWidth = Properties.Settings.Default.PedigreeWidthLeftColum; - - LoadListViewSettings(pedigree1.ListViewCreatures, nameof(Properties.Settings.Default.PedigreeListViewColumnWidths)); - - // Load column-widths, display-indices and sort-order of the listViewLibrary - // new columns were added, reset widths and order, old settings don't match the new indices - if ((Properties.Settings.Default.columnWidths?.Length ?? 0) < 40) - { - resetColumnOrderToolStripMenuItem_Click(null, null); - toolStripMenuItemResetLibraryColumnWidths_Click(null, null); - } - else - LoadListViewSettings(listViewLibrary, nameof(Properties.Settings.Default.columnWidths), nameof(Properties.Settings.Default.libraryColumnDisplayIndices)); - - if (Properties.Settings.Default.LibraryShowMutationLevelColumns) - toolStripMenuItemMutationColumns.Checked = true; - else - ToggleLibraryMutationLevelColumns(false); - - _creatureListSorter.SortColumnIndex = Properties.Settings.Default.listViewSortCol; - _creatureListSorter.Order = Properties.Settings.Default.listViewSortAsc - ? SortOrder.Ascending - : SortOrder.Descending; - - LoadListViewSettings(tribesControl1.ListViewPlayers, nameof(Properties.Settings.Default.PlayerListColumnWidths), nameof(Properties.Settings.Default.PlayerListColumnDisplayIndices), - nameof(Properties.Settings.Default.PlayerListSortColumn), nameof(Properties.Settings.Default.PlayerListSortAsc)); - - _creatureListSorter.UseNaturalSort = Properties.Settings.Default.UseNaturalSort; - _creatureListSorter.IgnoreSpacesBetweenWords = Properties.Settings.Default.NaturalSortIgnoreSpaces; - - CbLibraryInfoUseFilter.Checked = Properties.Settings.Default.LibraryColorInfoUseFilter; - showTokenPopupOnListeningToolStripMenuItem.Checked = Properties.Settings.Default.DisplayPopupForServerToken; - - // load stat weights - double[][] custWd = Properties.Settings.Default.customStatWeights; - var customStatWeightsOddEven = Properties.Settings.Default.CustomStatWeightsOddEven; - - // backwards compatibility - var customStatWeightOddEven = Properties.Settings.Default.CustomStatWeightOddEven; - if (customStatWeightOddEven != null) - { - customStatWeightsOddEven = new StatValueEvenOdd[customStatWeightOddEven.Length][]; - for (var i = 0; i < customStatWeightOddEven.Length; i++) - { - customStatWeightsOddEven[i] = customStatWeightOddEven[i].Select(w => - w == 1 ? StatValueEvenOdd.Odd : - w == 2 ? StatValueEvenOdd.Even : StatValueEvenOdd.Indifferent) - .ToArray(); - } - customStatWeightOddEven = null; - Properties.Settings.Default.CustomStatWeightOddEven = null; - } - - string[] custWs = Properties.Settings.Default.customStatWeightNames; - var custW = new Dictionary(); - if (custWs != null && custWd != null) - { - for (int i = 0; i < custWs.Length && i < custWd.Length && i < customStatWeightsOddEven.Length; i++) - { - custW.Add(custWs[i], (custWd[i], customStatWeightsOddEven[i])); - } - } - - breedingPlan1.StatWeighting.CustomWeightings = custW; - // last set values are saved at the end of the custom weightings - if (custWs != null && custWd != null && custWd.Length > custWs.Length) - breedingPlan1.StatWeighting.WeightValues = custWd[custWs.Length]; - if (custWs != null && customStatWeightOddEven != null && customStatWeightOddEven.Length > custWs.Length) - breedingPlan1.StatWeighting.AnyOddEven = customStatWeightsOddEven[custWs.Length]; - - // load weapon damages - tamingControl1.WeaponDamages = Properties.Settings.Default.weaponDamages; - tamingControl1.WeaponDamagesEnabled = Properties.Settings.Default.weaponDamagesEnabled; + LoadAppSettings(); - // torpor should not show bar, it get's too wide and is not interesting for breeding + // torpor should not show bar, it gets too wide and is not interesting for breeding _statIOs[Stats.Torpidity].ShowBarAndLock = false; _testingIOs[Stats.Torpidity].ShowBarAndLock = false; // move sums and footnote to bottom @@ -377,8 +259,6 @@ private void Form1_Load(object sender, EventArgs e) flowLayoutPanelStatIOsExtractor.Controls.Add(labelFootnote); flowLayoutPanelStatIOsTester.Controls.Add(panelStatTesterFootnote); - breedingPlan1.MutationLimit = Properties.Settings.Default.MutationLimitBreedingPlanner; - // enable 0-lock for dom-levels of oxygen, food (most often they are not leveled up) _statIOs[Stats.Oxygen].DomLevelLockedZero = true; _statIOs[Stats.Food].DomLevelLockedZero = true; @@ -422,29 +302,17 @@ private void Form1_Load(object sender, EventArgs e) // OCR ocrControl1.Initialize(); - cbGuessSpecies.Checked = Properties.Settings.Default.OcrGuessSpecies; InitializeOcrLabelSets(); // initialize speech recognition if enabled InitializeSpeechRecognition(); - // default owner and tribe - creatureInfoInputExtractor.CreatureOwner = Properties.Settings.Default.DefaultOwnerName; - creatureInfoInputExtractor.CreatureTribe = Properties.Settings.Default.DefaultTribeName; - creatureInfoInputExtractor.CreatureServer = Properties.Settings.Default.DefaultServerName; - creatureInfoInputExtractor.OwnerLock = Properties.Settings.Default.OwnerNameLocked; - creatureInfoInputExtractor.TribeLock = Properties.Settings.Default.TribeNameLocked; - creatureInfoInputExtractor.LockServer = Properties.Settings.Default.ServerNameLocked; - - CbLinkWildMutatedLevelsTester.Checked = Properties.Settings.Default.TesterLinkWildMutatedLevels; - // UI loaded // set theme colors //this.InitializeTabControls(); //this.SetColors(Color.FromArgb(20, 20, 20), Color.LightGray); - //// initialize controls extractionTestControl1.CopyToExtractor += ExtractionTestControl1_CopyToExtractor; extractionTestControl1.CopyToTester += ExtractionTestControl1_CopyToTester; @@ -518,6 +386,147 @@ private void Form1_Load(object sender, EventArgs e) createNewCollection = true; } + if (createNewCollection) + { + NewCollection(); + UpdateRecentlyUsedFileMenu(); + } + + UpdateAsaIndicator(); + } + + private void LoadAppSettings() + { + // the eol is changed during the loading of the settings, the \r is removed. re-add it. + var namingPatterns = Properties.Settings.Default.NamingPatterns; + if (namingPatterns != null) + { + for (int i = 0; i < namingPatterns.Length; i++) + { + if (!string.IsNullOrEmpty(namingPatterns[i])) + namingPatterns[i] = namingPatterns[i].Replace("\r", string.Empty).Replace("\n", "\r\n"); + } + } + UpdatePatternButtons(); + + // conversion of global color level settings to specific options. Remove around 2024-09 + if (Properties.Settings.Default.ChartHueEvenMax != int.MaxValue) + { + var defaultSettings = StatsLevelColors.StatsOptionsDict[string.Empty].StatOptions; + for (var s = 0; s < Stats.StatsCount; s++) + { + defaultSettings[s].LevelGraphRepresentation.LowerColor = Utils.ColorFromHue(Properties.Settings.Default.ChartHueEvenMin); + defaultSettings[s].LevelGraphRepresentation.UpperColor = Utils.ColorFromHue(Properties.Settings.Default.ChartHueEvenMax); + defaultSettings[s].LevelGraphRepresentation.ColorGradientReversed = Properties.Settings.Default.ChartHueEvenMax < Properties.Settings.Default.ChartHueEvenMin; + + if (Properties.Settings.Default.HighlightEvenOdd) + { + defaultSettings[s].LevelGraphRepresentationOdd = new LevelGraphRepresentation + { + LowerColor = Utils.ColorFromHue(Properties.Settings.Default.ChartHueOddMin), + UpperColor = Utils.ColorFromHue(Properties.Settings.Default.ChartHueOddMax), + ColorGradientReversed = Properties.Settings.Default.ChartHueOddMax < Properties.Settings.Default.ChartHueOddMin, + }; + defaultSettings[s].UseDifferentColorsForOddLevels = true; + } + } + + Properties.Settings.Default.ChartHueEvenMax = int.MaxValue; + } + // end of level color settings conversion + + // Load column-widths, display-indices and sort-order of the TimerControlListView + LoadListViewSettings(timerList1.ListViewTimers, nameof(Properties.Settings.Default.TCLVColumnWidths), + nameof(Properties.Settings.Default.TCLVColumnDisplayIndices), + nameof(Properties.Settings.Default.TCLVSortCol), nameof(Properties.Settings.Default.TCLVSortAsc)); + if (Properties.Settings.Default.PedigreeWidthLeftColum > 20) + pedigree1.LeftColumnWidth = Properties.Settings.Default.PedigreeWidthLeftColum; + + LoadListViewSettings(pedigree1.ListViewCreatures, nameof(Properties.Settings.Default.PedigreeListViewColumnWidths)); + + // Load column-widths, display-indices and sort-order of the listViewLibrary + // new columns were added, reset widths and order, old settings don't match the new indices + if ((Properties.Settings.Default.columnWidths?.Length ?? 0) < 40) + { + resetColumnOrderToolStripMenuItem_Click(null, null); + toolStripMenuItemResetLibraryColumnWidths_Click(null, null); + } + else + LoadListViewSettings(listViewLibrary, nameof(Properties.Settings.Default.columnWidths), nameof(Properties.Settings.Default.libraryColumnDisplayIndices)); + + if (Properties.Settings.Default.LibraryShowMutationLevelColumns) + toolStripMenuItemMutationColumns.Checked = true; + else + ToggleLibraryMutationLevelColumns(false); + + _creatureListSorter.SortColumnIndex = Properties.Settings.Default.listViewSortCol; + _creatureListSorter.Order = Properties.Settings.Default.listViewSortAsc + ? SortOrder.Ascending + : SortOrder.Descending; + + LoadListViewSettings(tribesControl1.ListViewPlayers, nameof(Properties.Settings.Default.PlayerListColumnWidths), nameof(Properties.Settings.Default.PlayerListColumnDisplayIndices), + nameof(Properties.Settings.Default.PlayerListSortColumn), nameof(Properties.Settings.Default.PlayerListSortAsc)); + + _creatureListSorter.UseNaturalSort = Properties.Settings.Default.UseNaturalSort; + _creatureListSorter.IgnoreSpacesBetweenWords = Properties.Settings.Default.NaturalSortIgnoreSpaces; + + CbLibraryInfoUseFilter.Checked = Properties.Settings.Default.LibraryColorInfoUseFilter; + showTokenPopupOnListeningToolStripMenuItem.Checked = Properties.Settings.Default.DisplayPopupForServerToken; + + // load stat weights + double[][] custWd = Properties.Settings.Default.customStatWeights; + var customStatWeightsOddEven = Properties.Settings.Default.CustomStatWeightsOddEven; + + // backwards compatibility + var customStatWeightOddEven = Properties.Settings.Default.CustomStatWeightOddEven; + if (customStatWeightOddEven != null) + { + customStatWeightsOddEven = new StatValueEvenOdd[customStatWeightOddEven.Length][]; + for (var i = 0; i < customStatWeightOddEven.Length; i++) + { + customStatWeightsOddEven[i] = customStatWeightOddEven[i].Select(w => + w == 1 ? StatValueEvenOdd.Odd : + w == 2 ? StatValueEvenOdd.Even : StatValueEvenOdd.Indifferent) + .ToArray(); + } + customStatWeightOddEven = null; + Properties.Settings.Default.CustomStatWeightOddEven = null; + } + + string[] custWs = Properties.Settings.Default.customStatWeightNames; + var custW = new Dictionary(); + if (custWs != null && custWd != null) + { + for (int i = 0; i < custWs.Length && i < custWd.Length && i < customStatWeightsOddEven.Length; i++) + { + custW.Add(custWs[i], (custWd[i], customStatWeightsOddEven[i])); + } + } + + breedingPlan1.StatWeighting.CustomWeightings = custW; + // last set values are saved at the end of the custom weightings + if (custWs != null && custWd != null && custWd.Length > custWs.Length) + breedingPlan1.StatWeighting.WeightValues = custWd[custWs.Length]; + if (custWs != null && customStatWeightOddEven != null && customStatWeightOddEven.Length > custWs.Length) + breedingPlan1.StatWeighting.AnyOddEven = customStatWeightsOddEven[custWs.Length]; + + // load weapon damages + tamingControl1.WeaponDamages = Properties.Settings.Default.weaponDamages; + tamingControl1.WeaponDamagesEnabled = Properties.Settings.Default.weaponDamagesEnabled; + + breedingPlan1.MutationLimit = Properties.Settings.Default.MutationLimitBreedingPlanner; + cbGuessSpecies.Checked = Properties.Settings.Default.OcrGuessSpecies; + + // default owner and tribe + creatureInfoInputExtractor.CreatureOwner = Properties.Settings.Default.DefaultOwnerName; + creatureInfoInputExtractor.CreatureTribe = Properties.Settings.Default.DefaultTribeName; + creatureInfoInputExtractor.CreatureServer = Properties.Settings.Default.DefaultServerName; + creatureInfoInputExtractor.OwnerLock = Properties.Settings.Default.OwnerNameLocked; + creatureInfoInputExtractor.TribeLock = Properties.Settings.Default.TribeNameLocked; + creatureInfoInputExtractor.LockServer = Properties.Settings.Default.ServerNameLocked; + + CbLinkWildMutatedLevelsTester.Checked = Properties.Settings.Default.TesterLinkWildMutatedLevels; + // if no export folder is set, try to detect it if ((Properties.Settings.Default.ExportCreatureFolders == null || Properties.Settings.Default.ExportCreatureFolders.Length == 0) @@ -530,23 +539,17 @@ private void Form1_Load(object sender, EventArgs e) .Select(f => $"{f.steamPlayerName}||{f.path}").ToArray(); } - if (createNewCollection) - { - NewCollection(); - UpdateRecentlyUsedFileMenu(); - } - var filterPresets = Properties.Settings.Default.LibraryFilterPresets; if (filterPresets != null) + { + ToolStripTextBoxLibraryFilter.AutoCompleteCustomSource.Clear(); ToolStripTextBoxLibraryFilter.AutoCompleteCustomSource.AddRange(filterPresets); + } - UpdateAsaIndicator(); - UpdatePatternButtons(); + timerList1.SetTimerPresets(Properties.Settings.Default.TimerPresets); SetupAutoLoadFileWatcher(); SetupExportFileWatcher(); - - timerList1.SetTimerPresets(Properties.Settings.Default.TimerPresets); } /// @@ -711,7 +714,7 @@ private void SpeciesSelector1OnSpeciesSelected(bool speciesChanged) creatureInfoInputTester.SelectedSpecies = species; radarChart1.SetLevels(species: species); var statNames = species.statNames; - var levelGraphRepresentations = _statsLevelColors.GetStatsOptions(species); + var levelGraphRepresentations = StatsLevelColors.GetStatsOptions(species); for (int s = 0; s < Stats.StatsCount; s++) { @@ -721,7 +724,17 @@ private void SpeciesSelector1OnSpeciesSelected(bool speciesChanged) _statIOs[s].IsActive = _activeStats[s]; _statIOs[s].Visible = species.UsesStat(s); - _testingIOs[s].Visible = species.UsesStat(s); + if (species.UsesStat(s)) + { + _testingIOs[s].Visible = true; + } + else + { + _testingIOs[s].Visible = false; + _testingIOs[s].LevelWild = 0; + _testingIOs[s].LevelMut = 0; + _testingIOs[s].LevelDom = 0; + } if (!_activeStats[s]) _statIOs[s].Input = 0; _statIOs[s].Title = Utils.StatName(s, false, statNames); _testingIOs[s].Title = Utils.StatName(s, false, statNames); @@ -807,6 +820,22 @@ private void SpeciesSelector1OnSpeciesSelected(bool speciesChanged) _tt.SetToolTip(tbSpeciesGlobal, species.DescriptiveNameAndMod + "\n" + species.blueprintPath); } + /// + /// Applies the level color settings to the stat controls. Call if a species setting was added or removed. + /// + private void StatsLevelColors_SettingsChanged() + { + var levelGraphRepresentations = StatsLevelColors.GetStatsOptions(speciesSelector1.SelectedSpecies); + if (levelGraphRepresentations == null) return; + + for (int s = 0; s < Stats.StatsCount; s++) + { + _statIOs[s].SetStatOptions(levelGraphRepresentations.StatOptions[s]); + _testingIOs[s].SetStatOptions(levelGraphRepresentations.StatOptions[s]); + } + + } + private void numericUpDown_Enter(object sender, EventArgs e) { NumericUpDown n = (NumericUpDown)sender; @@ -1363,7 +1392,18 @@ private static void LoadListViewSettings(ListView lv, string widthName, string i private void Form1_FormClosed(object sender, FormClosedEventArgs e) { // savesettings save settings + SaveAppSettings(); + + // remove old cache-files + CreatureColored.CleanupCache(); + + AsbServerStopListening(false); + _tt?.Dispose(); + _timerGlobal?.Dispose(); + } + private void SaveAppSettings() + { // save window-position and size if (WindowState != FormWindowState.Minimized) { @@ -1437,14 +1477,8 @@ private void Form1_FormClosed(object sender, FormClosedEventArgs e) /////// save settings for next session Properties.Settings.Default.Save(); - _statsLevelColors.SaveSettings(); - - // remove old cache-files - CreatureColored.CleanupCache(); - - AsbServerStopListening(false); - _tt?.Dispose(); - _timerGlobal?.Dispose(); + StatsLevelColors.SaveSettings(); + StatsTopStats.SaveSettings(); } /// @@ -1949,27 +1983,6 @@ private void PasteCreatureFromClipboard() EditCreatureInTester(importedCreatures[0], true); } - private void buttonRecalculateTops_Click(object sender, EventArgs e) - { - int consideredStats = 0; - for (int s = 0; s < Stats.StatsCount; s++) - { - var si = Stats.DisplayOrder[s]; - var statIndexUsed = checkedListBoxConsiderStatTop.GetItemChecked(s); - _considerStatHighlight[si] = statIndexUsed; - - // save consideredStats - if (_considerStatHighlight[si]) - consideredStats += 1 << si; - } - - Properties.Settings.Default.consideredStats = consideredStats; - - // recalculate topstats - CalculateTopStats(_creatureCollection.creatures); - FilterLibRecalculate(); - } - private void aliveToolStripMenuItem_Click(object sender, EventArgs e) { SetStatusOfSelectedCreatures(CreatureStatus.Available); @@ -2123,7 +2136,7 @@ private void OpenSettingsDialog(SettingsTabPages page = SettingsTabPages.Unknown var gameSettingBefore = _creatureCollection.Game; var displayLibraryCreatureIndexBefore = Properties.Settings.Default.DisplayLibraryCreatureIndex; - using (Settings settingsForm = new Settings(_creatureCollection, page, _statsLevelColors)) + using (Settings settingsForm = new Settings(_creatureCollection, page, StatsLevelColors)) { var settingsSaved = settingsForm.ShowDialog() == DialogResult.OK; _settingsLastTabPage = settingsForm.LastTabPageIndex; @@ -2237,7 +2250,17 @@ private void StatIOQuickWildLevelCheck(StatIO sIo) { _clearExtractionCreatureData = true; // as soon as the user changes stat-values, it's assumed it's not an exported creature anymore + if (sIo.statIndex == Stats.Torpidity && rbWildExtractor.Checked) + { + if (!(speciesSelector1.SelectedSpecies?.stats is SpeciesStat[] speciesStats)) return; + var trp = speciesStats[Stats.Torpidity]; + if (trp == null || trp.BaseValue == 0 || trp.IncPerWildLevel == 0) return; + numericUpDownLevel.ValueSaveDouble = (sIo.Input / trp.BaseValue - 1) / trp.IncPerWildLevel; + return; + } + if (!cbQuickWildCheck.Checked) return; + int lvlWild = (int)Math.Round( (sIo.Input - speciesSelector1.SelectedSpecies.stats[sIo.statIndex].BaseValue) / (speciesSelector1.SelectedSpecies.stats[sIo.statIndex].BaseValue * @@ -3618,42 +3641,6 @@ private void CopySelectedCreatureName() } } - /// - /// Replaces the names of the selected creatures with a pattern generated name. - /// - private void GenerateCreatureNames(object sender, EventArgs e) - { - if (listViewLibrary.SelectedIndices.Count == 0) return; - - var namePatternIndex = (int)((ToolStripMenuItem)sender).Tag; - - var creaturesToUpdate = new List(); - Creature[] sameSpecies = null; - var libraryCreatureCount = _creatureCollection.GetTotalCreatureCount(); - - foreach (int i in listViewLibrary.SelectedIndices) - { - var cr = _creaturesDisplayed[i]; - if (cr.Species == null) continue; - - if (sameSpecies?.FirstOrDefault()?.Species != cr.Species) - sameSpecies = _creatureCollection.creatures.Where(c => c.Species == cr.Species).ToArray(); - - // set new name - cr.name = NamePattern.GenerateCreatureName(cr, cr, sameSpecies, _topLevels.TryGetValue(cr.Species, out var tl) ? tl : null, - _customReplacingNamingPattern, false, namePatternIndex, - Properties.Settings.Default.DisplayWarningAboutTooLongNameGenerated, libraryCreatureCount: libraryCreatureCount); - - creaturesToUpdate.Add(cr); - } - - listViewLibrary.BeginUpdate(); - foreach (var cr in creaturesToUpdate) - UpdateDisplayedCreatureValues(cr, false, false); - - listViewLibrary.EndUpdate(); - } - private void fixColorsToolStripMenuItem_Click(object sender, EventArgs e) { if (listViewLibrary.SelectedIndices.Count == 0 @@ -3999,7 +3986,96 @@ private void showTokenPopupOnListeningToolStripMenuItem_Click(object sender, Eve private void statsOptionsToolStripMenuItem_Click(object sender, EventArgs e) { - LevelGraphOptionsControl.ShowWindow(this, _statsLevelColors); + StatsOptionsForm.ShowWindow(this, StatsLevelColors, StatsTopStats); + } + + private void ButtonOpenTopStatsSettingsClick(object sender, EventArgs e) + { + StatsOptionsForm.ShowWindow(this, StatsLevelColors, StatsTopStats, 1); + } + + private void ExportAppSettings() + { + using (var fileSelector = new SaveFileDialog()) + { + fileSelector.FileName = "ASB_appSettings.config"; + fileSelector.Filter = "config files (*.config)|*.config|All files (*.*)|*.*"; + if (fileSelector.ShowDialog(this) != DialogResult.OK) return; + + var destFilePath = fileSelector.FileName; + try + { + SaveAppSettings(); + var settingsFilePath = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath; + File.Copy(settingsFilePath, destFilePath, true); + SetMessageLabelText($"Exported app settings to {destFilePath}", MessageBoxIcon.Information, destFilePath); + } + catch (Exception ex) + { + MessageBoxes.ExceptionMessageBox(ex, "App settings save failed"); + } + } + } + + private void ImportAppSettings() + { + using (var fileSelector = new OpenFileDialog()) + { + fileSelector.FileName = "ASB_appSettings.config"; + fileSelector.Filter = "config files (*.config)|*.config|All files (*.*)|*.*"; + if (fileSelector.ShowDialog(this) != DialogResult.OK) return; + + var newSettingsFilePath = fileSelector.FileName; + + if (new FileInfo(newSettingsFilePath).Length < 5) + { + MessageBoxes.ShowMessageBox("The settings file seems to be empty, aborting settings loading."); + return; + } + + try + { + var settingsFilePath = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath; + var backupFilePathBase = Path.Combine(Path.GetDirectoryName(settingsFilePath), Path.GetFileNameWithoutExtension(settingsFilePath)); + var now = DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"); + backupFilePathBase = $"{backupFilePathBase}_backup_{now}"; + var backupFilePath = $"{backupFilePathBase}.config"; + var i = 1; + while (File.Exists(backupFilePath)) + backupFilePath = $"{backupFilePathBase}_{++i}.config"; + File.Copy(settingsFilePath, backupFilePath); + + File.Copy(newSettingsFilePath, settingsFilePath, true); + Properties.Settings.Default.Reload(); + LoadAppSettings(); + SetMessageLabelText($"Imported app settings from {newSettingsFilePath}", MessageBoxIcon.Information, newSettingsFilePath); + } + catch (Exception ex) + { + MessageBoxes.ExceptionMessageBox(ex, "App settings import failed"); + } + } + } + + private void showSettingsFileInExplorerToolStripMenuItem_Click(object sender, EventArgs e) + { + OpenFolderInExplorer(System.Configuration.ConfigurationManager + .OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath); + } + + private void saveAppSettingsTToolStripMenuItem_Click(object sender, EventArgs e) + { + ExportAppSettings(); + } + + private void loadAppSettingsFromFileToolStripMenuItem_Click(object sender, EventArgs e) + { + ImportAppSettings(); + } + + private void showStatsOptionsFileInExplorerToolStripMenuItem_Click(object sender, EventArgs e) + { + OpenFolderInExplorer(StatsLevelColors.SettingsFilePath); } } } diff --git a/ARKBreedingStats/Form1.extractor.cs b/ARKBreedingStats/Form1.extractor.cs index e9af9cc07..0b47483f1 100644 --- a/ARKBreedingStats/Form1.extractor.cs +++ b/ARKBreedingStats/Form1.extractor.cs @@ -1548,5 +1548,13 @@ private void BtSetImprinting0_Click(object sender, EventArgs e) private void BtSetImprinting100_Click(object sender, EventArgs e) => numericUpDownImprintingBonusExtractor.ValueSave = 100; + + private void numericUpDownLevel_ValueChanged(object sender, EventArgs e) + { + if (!(rbWildExtractor.Checked && speciesSelector1.SelectedSpecies is Species species)) return; + + _statIOs[Stats.Torpidity].Input = StatValueCalculation.CalculateValue(species, + Stats.Torpidity, (int)numericUpDownLevel.Value, 0, 0, false); + } } } diff --git a/ARKBreedingStats/Form1.library.cs b/ARKBreedingStats/Form1.library.cs index d3ea04d84..e8b3f40c8 100644 --- a/ARKBreedingStats/Form1.library.cs +++ b/ARKBreedingStats/Form1.library.cs @@ -14,6 +14,8 @@ using System.Text.RegularExpressions; using ARKBreedingStats.library; using ARKBreedingStats.settings; +using KeyEventArgs = System.Windows.Forms.KeyEventArgs; +using ARKBreedingStats.NamePatterns; namespace ARKBreedingStats { @@ -127,32 +129,35 @@ private void DeleteSelectedCreatures() { if (tabControlMain.SelectedTab == tabPageLibrary) { - if (listViewLibrary.SelectedIndices.Count > 0) + if (listViewLibrary.SelectedIndices.Count == 0) return; + if ((ModifierKeys & Keys.Shift) == 0 + && MessageBox.Show("Do you really want to delete the entry and all data for " + + $"\"{_creaturesDisplayed[listViewLibrary.SelectedIndices[0]].name}\"" + + $"{(listViewLibrary.SelectedIndices.Count > 1 ? " and " + (listViewLibrary.SelectedIndices.Count - 1) + " other creatures" : null)}?\n\n" + + "(Hold the Shift key to delete without this messagebox confirmation shown.)", + "Delete Creature?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) + != DialogResult.Yes) return; + + bool onlyOneSpecies = true; + Species species = _creaturesDisplayed[listViewLibrary.SelectedIndices[0]].Species; + foreach (int i in listViewLibrary.SelectedIndices) { - if (MessageBox.Show("Do you really want to delete the entry and all data for " + - $"\"{_creaturesDisplayed[listViewLibrary.SelectedIndices[0]].name}\"" + - $"{(listViewLibrary.SelectedIndices.Count > 1 ? " and " + (listViewLibrary.SelectedIndices.Count - 1) + " other creatures" : null)}?", - "Delete Creature?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) + var cr = _creaturesDisplayed[i]; + if (onlyOneSpecies) { - bool onlyOneSpecies = true; - Species species = _creaturesDisplayed[listViewLibrary.SelectedIndices[0]].Species; - foreach (int i in listViewLibrary.SelectedIndices) - { - var cr = _creaturesDisplayed[i]; - if (onlyOneSpecies) - { - if (species != cr.Species) - onlyOneSpecies = false; - } - _creatureCollection.DeleteCreature(cr); - } - _creatureCollection.RemoveUnlinkedPlaceholders(); - UpdateCreatureListings(onlyOneSpecies ? species : null); - SetCollectionChanged(true, onlyOneSpecies ? species : null); + if (species != cr.Species) + onlyOneSpecies = false; } + _creatureCollection.DeleteCreature(cr); } + _creatureCollection.RemoveUnlinkedPlaceholders(); + UpdateCreatureListings(onlyOneSpecies ? species : null); + SetCollectionChanged(true, onlyOneSpecies ? species : null); + + return; } - else if (tabControlMain.SelectedTab == tabPagePlayerTribes) + + if (tabControlMain.SelectedTab == tabPagePlayerTribes) { tribesControl1.RemoveSelected(); } @@ -307,6 +312,7 @@ private void CalculateTopStats(List creatures, Species onlySpecies = n var lowestLevels = new int[Stats.StatsCount]; var highestMutationLevels = new int[Stats.StatsCount]; var lowestMutationLevels = new int[Stats.StatsCount]; + var considerAsTopStat = StatsTopStats.GetStatsOptions(species).StatOptions; var statWeights = breedingPlan1.StatWeighting.GetWeightingForSpecies(species); for (int s = 0; s < Stats.StatsCount; s++) { @@ -315,7 +321,7 @@ private void CalculateTopStats(List creatures, Species onlySpecies = n if (species.UsesStat(s)) { usedStatIndices.Add(s); - if (_considerStatHighlight[s]) + if (considerAsTopStat[s].ConsiderStat) usedAndConsideredStatIndices.Add(s); } } @@ -562,8 +568,17 @@ private void CalculateTopStats(List creatures, Species onlySpecies = n } bool considerWastedStatsForTopCreatures = Properties.Settings.Default.ConsiderWastedStatsForTopCreatures; + + var considerTopStats = new Dictionary(); foreach (Creature c in creatures) - c.SetTopStatCount(_considerStatHighlight, considerWastedStatsForTopCreatures); + { + if (!considerTopStats.TryGetValue(c.Species, out var consideredTopStats)) + { + consideredTopStats = StatsTopStats.GetStatsOptions(c.Species).StatOptions.Select(si => si.ConsiderStat).ToArray(); + considerTopStats[c.Species] = consideredTopStats; + } + c.SetTopStatCount(consideredTopStats, considerWastedStatsForTopCreatures); + } var selectedSpecies = speciesSelector1.SelectedSpecies; if (selectedSpecies != null) @@ -1071,8 +1086,6 @@ private ListViewItem CreateCreatureLvItem(Creature cr, bool displayIndex = false }; } - double colorFactor = 100d / _creatureCollection.maxChartLevel; - string[] subItems = new[] { (displayIndex ? cr.ListIndex + " - " : string.Empty) + cr.name, @@ -1109,6 +1122,9 @@ private ListViewItem CreateCreatureLvItem(Creature cr, bool displayIndex = false // apply colors to the subItems var displayZeroMutationLevels = Properties.Settings.Default.LibraryDisplayZeroMutationLevels; + var statOptionsColors = StatsLevelColors.GetStatsOptions(cr.Species).StatOptions; + var statOptionsTopStats = StatsTopStats.GetStatsOptions(cr.Species).StatOptions; + for (int s = 0; s < Stats.StatsCount; s++) { if (cr.valuesDom[s] == 0) @@ -1124,8 +1140,11 @@ private ListViewItem CreateCreatureLvItem(Creature cr, bool displayIndex = false lvi.SubItems[ColumnIndexFirstStat + s].BackColor = Color.White; } else - lvi.SubItems[ColumnIndexFirstStat + s].BackColor = Utils.GetColorFromPercent((int)(cr.levelsWild[s] * (s == Stats.Torpidity ? colorFactor / 7 : colorFactor)), // TODO set factor to number of other stats (flyers have 6, Gacha has 8?) - _considerStatHighlight[s] ? cr.IsTopStat(s) ? 0.2 : 0.75 : 0.93); + { + var backColor = Utils.AdjustColorLight(statOptionsColors[s].GetLevelColor(cr.levelsWild[s]), + statOptionsTopStats[s].ConsiderStat ? cr.IsTopStat(s) ? 0.2 : 0.75 : 0.93); + lvi.SubItems[ColumnIndexFirstStat + s].SetBackColorAndAccordingForeColor(backColor); + } // mutated levels if (cr.levelsMutated == null || (!displayZeroMutationLevels && cr.levelsMutated[s] == 0)) @@ -1134,8 +1153,11 @@ private ListViewItem CreateCreatureLvItem(Creature cr, bool displayIndex = false lvi.SubItems[ColumnIndexFirstStat + Stats.StatsCount + s].BackColor = Color.White; } else - lvi.SubItems[ColumnIndexFirstStat + Stats.StatsCount + s].BackColor = Utils.GetColorFromPercent((int)(cr.levelsMutated[s] * colorFactor), - _considerStatHighlight[s] ? cr.IsTopMutationStat(s) ? 0.5 : 0.8 : 0.93, true); + { + var backColor = Utils.AdjustColorLight(statOptionsColors[s].GetLevelColor(cr.levelsWild[s], false, true), + statOptionsTopStats[s].ConsiderStat ? cr.IsTopMutationStat(s) ? 0.2 : 0.75 : 0.93); + lvi.SubItems[ColumnIndexFirstStat + Stats.StatsCount + s].SetBackColorAndAccordingForeColor(backColor); + } } lvi.SubItems[ColumnIndexSex].BackColor = cr.flags.HasFlag(CreatureFlags.Neutered) ? Color.FromArgb(220, 220, 220) : cr.sex == Sex.Female ? Color.FromArgb(255, 230, 255) : @@ -1634,6 +1656,35 @@ private void listBoxSpeciesLib_Click(object sender, EventArgs e) UpdateSpeciesLists(_creatureCollection.creatures); } + private void listViewLibrary_KeyDown(object sender, KeyEventArgs e) + { + switch (e.KeyCode) + { + case Keys.NumPad1: + GenerateCreatureNames(0); + break; + case Keys.NumPad2: + GenerateCreatureNames(1); + break; + case Keys.NumPad3: + GenerateCreatureNames(2); + break; + case Keys.NumPad4: + GenerateCreatureNames(3); + break; + case Keys.NumPad5: + GenerateCreatureNames(4); + break; + case Keys.NumPad6: + GenerateCreatureNames(5); + break; + default: return; + } + + e.Handled = true; + e.SuppressKeyPress = true; + } + private void listViewLibrary_KeyUp(object sender, KeyEventArgs e) { switch (e.KeyCode) @@ -1989,6 +2040,13 @@ private void applyMutagenToolStripMenuItem_Click(object sender, EventArgs e) affectedSpeciesBlueprints.Count == 1 ? Values.V.SpeciesByBlueprint(affectedSpeciesBlueprints.First()) : null); } + private void BtRecalculateTopStatsAfterChange_Click(object sender, EventArgs e) + { + // Recalculate top stats after considered stats have changed. + CalculateTopStats(_creatureCollection.creatures); + FilterLibRecalculate(); + } + private void adminCommandToSetColorsToolStripMenuItem_Click(object sender, EventArgs e) { AdminCommandToSetColors(); @@ -2177,6 +2235,42 @@ private void importFromTabSeparatedFileToolStripMenuItem_Click(object sender, Ev MessageBoxes.ShowMessageBox(result, "Creatures imported from tsv file", MessageBoxIcon.Information); } + private void GenerateCreatureNames(object sender, EventArgs e) => GenerateCreatureNames((int)((ToolStripMenuItem)sender).Tag); + + /// + /// Replaces the names of the selected creatures with a pattern generated name. + /// + private void GenerateCreatureNames(int namePatternIndex) + { + if (listViewLibrary.SelectedIndices.Count == 0) return; + + var creaturesToUpdate = new List(); + Creature[] sameSpecies = null; + var libraryCreatureCount = _creatureCollection.GetTotalCreatureCount(); + + foreach (int i in listViewLibrary.SelectedIndices) + { + var cr = _creaturesDisplayed[i]; + if (cr.Species == null) continue; + + if (sameSpecies?.FirstOrDefault()?.Species != cr.Species) + sameSpecies = _creatureCollection.creatures.Where(c => c.Species == cr.Species).ToArray(); + + // set new name + cr.name = NamePattern.GenerateCreatureName(cr, cr, sameSpecies, _topLevels.TryGetValue(cr.Species, out var tl) ? tl : null, + _customReplacingNamingPattern, false, namePatternIndex, + Properties.Settings.Default.DisplayWarningAboutTooLongNameGenerated, libraryCreatureCount: libraryCreatureCount); + + creaturesToUpdate.Add(cr); + } + + listViewLibrary.BeginUpdate(); + foreach (var cr in creaturesToUpdate) + UpdateDisplayedCreatureValues(cr, false, false); + + listViewLibrary.EndUpdate(); + } + #region library list view columns private void resetColumnOrderToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/ARKBreedingStats/NOTICE.txt b/ARKBreedingStats/NOTICE.txt new file mode 100644 index 000000000..92c984035 --- /dev/null +++ b/ARKBreedingStats/NOTICE.txt @@ -0,0 +1,95 @@ +This project uses the following projects under the stated licenses + +======== Newtonsoft.Json +https://www.newtonsoft.com/json +The MIT License (MIT) + +Copyright (c) 2007 James Newton-King + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +======== FluentFTP +https://github.com/robinrodricks/FluentFTP +The MIT License (MIT) + +Copyright (c) 2015 Robin Rodricks and FluentFTP Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +======== Jint +https://github.com/sebastienros/jint +BSD 2-Clause License + +Copyright (c) 2013, Sebastien Ros +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +======== Acornima +https://github.com/adams85/acornima +Copyright (c) Adam Simon. All rights reserved. +BSD 3-Clause License - https://opensource.org/licenses/BSD-3-Clause + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Acornima nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +======== ARK Savegame Toolkit +MIT License + +Initial version in Java, Copyright (c) 2016 Roland Firmont https://github.com/Qowyn/ark-savegame-toolkit, https://github.com/Qowyn/ark-tools +Converted to C#, Copyright (c) 2018 Flachdachs https://github.com/Flachdachs +Small additions by Cadon https://github.com/cadon/ArkSavegameToolkit + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/ARKBreedingStats/NamePatterns/JavaScriptNamePattern.cs b/ARKBreedingStats/NamePatterns/JavaScriptNamePattern.cs new file mode 100644 index 000000000..737c28e4a --- /dev/null +++ b/ARKBreedingStats/NamePatterns/JavaScriptNamePattern.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using ARKBreedingStats.Library; +using ARKBreedingStats.utils; +using Jint; +using static ARKBreedingStats.Library.CreatureCollection; + +namespace ARKBreedingStats.NamePatterns +{ + internal static class JavaScriptNamePattern + { + + public static Regex JavaScriptShebang = new Regex(@"^\#!javascript\s*?\n", RegexOptions.IgnoreCase); + private static readonly string FlattenScript = BuildModelFlattenScript(); + + public static string ResolveJavaScript(string pattern, Creature creature, TokenModel tokenModel, Dictionary customReplacings, ColorExisting[] colorsExisting, string[] creatureNames, bool displayError, Action consoleLog) + { + var stopwatch = Stopwatch.StartNew(); + var log = consoleLog ?? (s => { }); + string numberedUniqueName; + string lastNumberedUniqueName = null; + + var n = 1; + + do + { + if (n > 1) + { + log($">> Name not unique. Repeating with model. n = {n}"); + } + + try + { + using (var engine = new Engine(options => options.TimeoutInterval(TimeSpan.FromSeconds(4)))) + { + engine.SetValue("model", tokenModel); + engine.Execute(FlattenScript); + + engine.SetValue("n", n); + engine.SetValue("log", log); + engine.SetValue>("customReplace", (key, defaultValue) => NamePatternFunctions.CustomReplace(key, defaultValue, customReplacings)); + engine.SetValue>("listName", NameList.GetName); + + numberedUniqueName = engine.Evaluate(pattern).ToString(); + + // check if numberedUniqueName actually is different, else break the potentially infinite loop. E.g. it is not different if {n} is an unreached if branch or was altered with other functions + if (numberedUniqueName == lastNumberedUniqueName) + break; + + lastNumberedUniqueName = numberedUniqueName; + n++; + } + } + catch (Exception ex) + { + if (displayError) + { + MessageBoxes.ShowMessageBox($"The naming script generated an exception\n\nSpecific error:\n{ex.Message}", "Naming script error"); + return null; + } + + log($">> ERROR: {ex.Message}"); + return ex.Message; + } + } while (creatureNames?.Contains(numberedUniqueName, StringComparer.OrdinalIgnoreCase) == true); + + log($">> Name resolved in {stopwatch.Elapsed.TotalMilliseconds} ms"); + + return numberedUniqueName; + } + + private static string BuildModelFlattenScript() + { + var builder = new StringBuilder(); + builder.AppendLine("Object.assign(globalThis, model)"); + + for (int s = 0; s < Stats.StatsCount; s++) + { + var abbreviation = NamePattern.StatAbbreviationFromIndex[s]; + builder.AppendLine($"{abbreviation}_m = {abbreviation}.level_m"); + builder.AppendLine($"{abbreviation}_vb = {abbreviation}.level_vb"); + builder.AppendLine($"istop{abbreviation} = {abbreviation}.istop"); + builder.AppendLine($"isnewtop{abbreviation} = {abbreviation}.isnewtop"); + builder.AppendLine($"islowest{abbreviation} = {abbreviation}.islowest"); + builder.AppendLine($"isnewlowest{abbreviation} = {abbreviation}.isnewlowest"); + builder.AppendLine($"istop{abbreviation}_m = {abbreviation}.istop_m"); + builder.AppendLine($"isnewtop{abbreviation}_m = {abbreviation}.isnewtop_m"); + builder.AppendLine($"islowest{abbreviation}_m = {abbreviation}.islowest_m"); + builder.AppendLine($"isnewlowest{abbreviation}_m = {abbreviation}.isnewlowest_m"); + builder.AppendLine($"{abbreviation} = {abbreviation}.level"); + } + + for (int s = 0; s < Stats.StatsCount; s++) + { + builder.AppendLine($"highest{s + 1}l = highest_l[{s}]"); + builder.AppendLine($"highest{s + 1}s = highest_s[{s}]"); + builder.AppendLine($"highest{s + 1}l_m = highest_l_m[{s}]"); + builder.AppendLine($"highest{s + 1}s_m = highest_s_m[{s}]"); + } + + builder.AppendLine("delete model"); + builder.AppendLine("delete highest_l"); + builder.AppendLine("delete highest_s"); + builder.AppendLine("delete highest_s_m"); + + var script = builder.ToString(); + return script; + } + } +} \ No newline at end of file diff --git a/ARKBreedingStats/NamePatterns/NameList.cs b/ARKBreedingStats/NamePatterns/NameList.cs index 571894d92..eaf779984 100644 --- a/ARKBreedingStats/NamePatterns/NameList.cs +++ b/ARKBreedingStats/NamePatterns/NameList.cs @@ -1,9 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace ARKBreedingStats.NamePatterns { @@ -15,8 +12,8 @@ internal static class NameList /// /// Contains all name lists, key is the fileName suffix. /// - private static readonly Dictionary nameLists = new Dictionary(); - private static readonly Dictionary listFileCheckedAt = new Dictionary(); + private static readonly Dictionary NameLists = new Dictionary(); + private static readonly Dictionary ListFileCheckedAt = new Dictionary(); /// /// Returns a name from a list. If the file wasn't checked recently, it's checked and reloaded. @@ -39,9 +36,9 @@ public static string[] GetNameList(string listSuffix = null) { if (listSuffix == null) listSuffix = string.Empty; string[] list; - if (!listFileCheckedAt.TryGetValue(listSuffix, out var checkedAt) + if (!ListFileCheckedAt.TryGetValue(listSuffix, out var checkedAt) || (DateTime.Now - checkedAt).TotalSeconds > 10 - || !nameLists.TryGetValue(listSuffix, out list)) + || !NameLists.TryGetValue(listSuffix, out list)) { list = LoadList(listSuffix, checkedAt); } @@ -58,10 +55,10 @@ private static string[] LoadList(string listSuffix, DateTime checkedAt) if (new FileInfo(filePath).LastWriteTime > checkedAt) { var list = File.ReadAllLines(filePath); - nameLists[listSuffix] = list; + NameLists[listSuffix] = list; } - listFileCheckedAt[listSuffix] = DateTime.Now; - return nameLists[listSuffix]; + ListFileCheckedAt[listSuffix] = DateTime.Now; + return NameLists[listSuffix]; } catch { } return null; diff --git a/ARKBreedingStats/NamePatterns/NamePattern.cs b/ARKBreedingStats/NamePatterns/NamePattern.cs index f7e7080e3..5fd3386f9 100644 --- a/ARKBreedingStats/NamePatterns/NamePattern.cs +++ b/ARKBreedingStats/NamePatterns/NamePattern.cs @@ -1,11 +1,14 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text.RegularExpressions; using System.Windows.Forms; using ARKBreedingStats.library; using ARKBreedingStats.Library; +using ARKBreedingStats.species; using ARKBreedingStats.utils; + using static ARKBreedingStats.Library.CreatureCollection; namespace ARKBreedingStats.NamePatterns @@ -18,14 +21,28 @@ public static class NamePattern private const string PipeEscapeSequence = @"\pipe"; public static Random Random = new Random(); + private static readonly Func[] StatAccessors = { + m => m.hp, // StatNames.Health; + m => m.st, // StatNames.Stamina; + m => m.to, // StatNames.Torpidity; + m => m.ox, // StatNames.Oxygen; + m => m.fo, // StatNames.Food; + m => m.wa, // StatNames.Water; + m => m.te, // StatNames.Temperature; + m => m.we, // StatNames.Weight; + m => m.dm, // StatNames.MeleeDamageMultiplier; + m => m.sp, // StatNames.SpeedMultiplier; + m => m.fr, // StatNames.TemperatureFortitude; + m => m.cr // StatNames.CraftingSpeedMultiplier; + }; /// /// Generate a creature name with the naming pattern. /// /// If the creature already exists in the library, null if the creature is new. public static string GenerateCreatureName(Creature creature, Creature alreadyExistingCreature, Creature[] sameSpecies, TopLevels topLevels, Dictionary customReplacings, - bool showDuplicateNameWarning, int namingPatternIndex, bool showTooLongWarning = true, string pattern = null, bool displayError = true, Dictionary tokenDictionary = null, - CreatureCollection.ColorExisting[] colorsExisting = null, int libraryCreatureCount = 0) + bool showDuplicateNameWarning, int namingPatternIndex, bool showTooLongWarning = true, string pattern = null, bool displayError = true, TokenModel tokenModel = null, + ColorExisting[] colorsExisting = null, int libraryCreatureCount = 0, Action consoleLog = null) { if (pattern == null) { @@ -64,21 +81,59 @@ public static string GenerateCreatureName(Creature creature, Creature alreadyExi else creature.topness = 1000; } - if (tokenDictionary != null) - tokenDictionary["topPercent"] = (creature.topness / 10f).ToString(); + if (tokenModel != null) + tokenModel.toppercent = creature.topness / 10f; } - if (tokenDictionary == null) - tokenDictionary = CreateTokenDictionary(creature, alreadyExistingCreature, sameSpecies, topLevels, libraryCreatureCount); - // first resolve keys, then functions - string name = ResolveFunctions( - ResolveKeysToValues(tokenDictionary, pattern.Replace("\r", string.Empty).Replace("\n", string.Empty)), - creature, customReplacings, displayError, false, colorsExisting); + if (tokenModel == null) + tokenModel = CreateTokenModel(creature, alreadyExistingCreature, sameSpecies, colorsExisting, topLevels, libraryCreatureCount); + + string name; string[] creatureNames = null; - if (showDuplicateNameWarning || name.Contains("{n}")) + + var shebangMatch = JavaScriptNamePattern.JavaScriptShebang.Match(pattern); + + if (showDuplicateNameWarning || pattern.Contains("{n}") || shebangMatch.Success) creatureNames = sameSpecies?.Where(c => c.guid != creature.guid).Select(x => x.name).ToArray() ?? Array.Empty(); + if (shebangMatch.Success) + { + try + { + name = JavaScriptNamePattern.ResolveJavaScript(pattern.Substring(shebangMatch.Length), creature, + tokenModel, customReplacings, colorsExisting, creatureNames, displayError, consoleLog); + } + catch (FileNotFoundException ex) + { + // Jint.dll not installed + MessageBoxes.ExceptionMessageBox(ex, "Probably a needed module is not installed for using the javascript pattern. You can install it via the menu Settings - Extra data."); + return null; + } + } + else + { + name = ResolveTemplate(pattern, creature, tokenModel, customReplacings, colorsExisting, creatureNames, displayError); + } + if (showDuplicateNameWarning && creatureNames.Contains(name, StringComparer.OrdinalIgnoreCase)) + { + MessageBox.Show($"The generated name for the creature\n{name}\nalready exists in the library.\n\nConsider adding {{n}} or {{sn}} in the pattern to generate unique names.", "Name already exists", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + else if (showTooLongWarning && name.Length > Ark.MaxCreatureNameLength) + { + MessageBox.Show($"The generated name is longer than {Ark.MaxCreatureNameLength} characters, the name will look like this in game:\n" + name.Substring(0, Ark.MaxCreatureNameLength), "Name too long for game", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + + return name; + } + + private static string ResolveTemplate(string pattern, Creature creature, TokenModel tokenModel, Dictionary customReplacings, ColorExisting[] colorsExisting, string[] creatureNames, bool displayError) + { + var tokenDictionary = CreateTokenDictionary(tokenModel); + // first resolve keys, then functions + string name = ResolveFunctions( + ResolveKeysToValues(tokenDictionary, pattern.Replace("\r", string.Empty).Replace("\n", string.Empty)), + creature, customReplacings, displayError, false, colorsExisting); if (name.Contains("{n}")) { // replace the unique number key with the lowest possible positive number >= 1 to get a unique name. @@ -101,17 +156,7 @@ public static string GenerateCreatureName(Creature creature, Creature alreadyExi } // evaluate escaped characters - name = NamePatternFunctions.UnEscapeSpecialCharacters(name.Replace(PipeEscapeSequence, "|")); - - if (showDuplicateNameWarning && creatureNames.Contains(name, StringComparer.OrdinalIgnoreCase)) - { - MessageBox.Show($"The generated name for the creature\n{name}\nalready exists in the library.\n\nConsider adding {{n}} or {{sn}} in the pattern to generate unique names.", "Name already exists", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - else if (showTooLongWarning && name.Length > Ark.MaxCreatureNameLength) - { - MessageBox.Show($"The generated name is longer than {Ark.MaxCreatureNameLength} characters, the name will look like this in game:\n" + name.Substring(0, Ark.MaxCreatureNameLength), "Name too long for game", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - + name = name != null ? NamePatternFunctions.UnEscapeSpecialCharacters(name.Replace(PipeEscapeSequence, "|")) : string.Empty; return name; } @@ -176,7 +221,7 @@ private static string ResolveFunction(Match m, NamePatternParameters parameters) return string.Empty; } - private static readonly string[] StatAbbreviationFromIndex = { + internal static readonly string[] StatAbbreviationFromIndex = { "hp", // StatNames.Health; "st", // StatNames.Stamina; "to", // StatNames.Torpidity; @@ -191,43 +236,38 @@ private static string ResolveFunction(Match m, NamePatternParameters parameters) "cr" // StatNames.CraftingSpeedMultiplier; }; - /// - /// This method creates the token dictionary for the dynamic creature name generation. + /// This method creates the token model for the dynamic creature name generation. /// /// Creature with the data /// If the creature is already existing in the library, i.e. if the name is created for a creature that is updated /// A list of all currently stored creatures of the species /// top levels of that species - /// A dictionary containing all tokens and their replacements - public static Dictionary CreateTokenDictionary(Creature creature, Creature alreadyExistingCreature, Creature[] speciesCreatures, TopLevels topLevels, int libraryCreatureCount) + /// A strongly typed model containing all tokens and their values + public static TokenModel CreateTokenModel(Creature creature, Creature alreadyExistingCreature, Creature[] speciesCreatures, ColorExisting[] colorExistings, TopLevels topLevels, int libraryCreatureCount) { string dom = creature.isBred ? "B" : "T"; - double imp = creature.imprintingBonus * 100; double eff = creature.tamingEff * 100; - string effImp = "Z"; - string prefix = string.Empty; + int? effImp; + string prefix; if (creature.isBred) { prefix = "I"; - effImp = Math.Round(imp).ToString(); + effImp = (int)Math.Round(imp); } else if (eff > 1) { prefix = "E"; - effImp = Math.Round(eff).ToString(); + effImp = (int)Math.Round(eff); } - - while (effImp.Length < 3 && effImp != "Z") + else { - effImp = "0" + effImp; + prefix = "Z"; + effImp = null; } - string effImpShort = effImp; - effImp = prefix + effImp; - int generation = creature.generation; if (generation <= 0) generation = Math.Max( @@ -259,7 +299,7 @@ public static Dictionary CreateTokenDictionary(Creature creature oldName = oldName.Replace("|", PipeEscapeSequence); string spcsNm = creature.Species.name; - char[] vowels = new char[] { 'a', 'e', 'i', 'o', 'u' }; + char[] vowels = { 'a', 'e', 'i', 'o', 'u' }; while (spcsNm.LastIndexOfAny(vowels) > 0) spcsNm = spcsNm.Remove(spcsNm.LastIndexOfAny(vowels), 1); // remove last vowel (not the first letter) @@ -285,14 +325,14 @@ public static Dictionary CreateTokenDictionary(Creature creature } } - string indexStr = string.Empty; + int index = 0; if (creature.guid != Guid.Empty && (speciesCreatures?.Any() ?? false)) { for (int i = 0; i < speciesCreatures.Length; i++) { if (creature.guid == speciesCreatures[i].guid) { - indexStr = (i + 1).ToString(); + index = i + 1; break; } } @@ -300,48 +340,50 @@ public static Dictionary CreateTokenDictionary(Creature creature // replace tokens in user configured pattern string // keys have to be all lower case - var dict = new Dictionary + + var model = new TokenModel { - { "species", creature.Species.name }, - { "spcsnm", spcsNm }, - { "firstwordofoldest", firstWordOfOldest }, - - { "owner", creature.owner }, - { "tribe", creature.tribe }, - { "server", creature.server }, - - { "sex", creature.sex.ToString() }, - { "sex_short", creature.sex.ToString().Substring(0, 1) }, - - { "effimp_short", effImpShort}, - { "index", indexStr}, - { "oldname", oldName }, - { "sex_lang", Loc.S(creature.sex.ToString()) }, - { "sex_lang_short", Loc.S(creature.sex.ToString()).Substring(0, 1) }, - { "sex_lang_gen", Loc.S(creature.sex.ToString() + "_gen") }, - { "sex_lang_short_gen", Loc.S(creature.sex.ToString() + "_gen").Substring(0, 1) }, - - { "toppercent" , (creature.topness / 10f).ToString() }, - { "baselvl" , creature.LevelHatched.ToString() }, - { "levelpretamed" , creature.levelFound.ToString() }, - { "effimp" , effImp }, - { "muta", creature.Mutations.ToString()}, - { "mutam", creature.mutationsMaternal.ToString()}, - { "mutap", creature.mutationsPaternal.ToString()}, - { "gen", generation.ToString()}, - { "gena", Dec2Hexvig(generation)}, - { "genn", (speciesCreatures?.Count(c=>c.generation==generation) ?? 0 + 1).ToString()}, - { "nr_in_gen", nrInGeneration.ToString()}, - { "nr_in_gen_sex", nrInGenerationAndSameSex.ToString()}, - { "rnd", Random.Next(0, 999999).ToString("000000")}, - { "ln", libraryCreatureCount.ToString()}, - { "tn", speciesCount.ToString()}, - { "sn", speciesSexCount.ToString()}, - { "dom", dom}, - { "arkid", arkid }, - { "alreadyexists", speciesCreatures.Contains(creature) ? "1" : string.Empty }, - { "isflyer", creature.Species.isFlyer ? "1" : string.Empty }, - { "status", creature.Status.ToString() } + species = creature.Species.name, + spcsnm = spcsNm, + firstwordofoldest = firstWordOfOldest, + + owner = creature.owner, + tribe = creature.tribe, + server = creature.server, + + sex = creature.sex, + sex_short = creature.sex.ToString().Substring(0, 1), + + effimp_short = effImp.HasValue ? effImp.ToString() : prefix, + index = index, + oldname = oldName, + sex_lang = Loc.S(creature.sex.ToString()), + sex_lang_short = Loc.S(creature.sex.ToString()).Substring(0, 1), + sex_lang_gen = Loc.S(creature.sex.ToString() + "_gen"), + sex_lang_short_gen = Loc.S(creature.sex.ToString() + "_gen").Substring(0, 1), + + toppercent = (creature.topness / 10f), + baselvl = creature.LevelHatched, + levelpretamed = creature.levelFound, + effimp = $"{prefix}{effImp}", + effimp_value = effImp, + muta = creature.Mutations, + mutam = creature.mutationsMaternal, + mutap = creature.mutationsPaternal, + gen = generation, + gena = Dec2Hexvig(generation), + genn = (speciesCreatures?.Count(c => c.generation == generation) ?? 0 + 1), + nr_in_gen = nrInGeneration, + nr_in_gen_sex = nrInGenerationAndSameSex, + rnd = Random.Next(0, 999999), + ln = libraryCreatureCount, + tn = speciesCount, + sn = speciesSexCount, + dom = dom, + arkid = arkid, + alreadyexists = speciesCreatures.Contains(creature), + isflyer = creature.Species.isFlyer, + status = creature.Status, }; // stat index and according wild and mutation level @@ -365,25 +407,122 @@ public static Dictionary CreateTokenDictionary(Creature creature for (int s = 0; s < Stats.StatsCount; s++) { - dict.Add(StatAbbreviationFromIndex[s], creature.levelsWild[s].ToString()); - dict.Add($"{StatAbbreviationFromIndex[s]}_vb", (creature.valuesBreeding[s] * (Stats.IsPercentage(s) ? 100 : 1)).ToString()); - dict.Add($"istop{StatAbbreviationFromIndex[s]}", creature.levelsWild[s] != -1 && creature.levelsWild[s] >= wildLevelsHighest[s] ? "1" : string.Empty); - dict.Add($"isnewtop{StatAbbreviationFromIndex[s]}", creature.levelsWild[s] != -1 && creature.levelsWild[s] > wildLevelsHighest[s] ? "1" : string.Empty); - dict.Add($"islowest{StatAbbreviationFromIndex[s]}", creature.levelsWild[s] != -1 && creature.levelsWild[s] <= wildLevelsLowest[s] ? "1" : string.Empty); - dict.Add($"isnewlowest{StatAbbreviationFromIndex[s]}", creature.levelsWild[s] != -1 && creature.levelsWild[s] < wildLevelsLowest[s] ? "1" : string.Empty); - dict.Add($"istop{StatAbbreviationFromIndex[s]}_m", creature.levelsMutated[s] >= mutationLevelsHighest[s] ? "1" : string.Empty); - dict.Add($"isnewtop{StatAbbreviationFromIndex[s]}_m", creature.levelsMutated[s] > mutationLevelsHighest[s] ? "1" : string.Empty); - dict.Add($"islowest{StatAbbreviationFromIndex[s]}_m", creature.levelsMutated[s] <= mutationLevelsLowest[s] ? "1" : string.Empty); - dict.Add($"isnewlowest{StatAbbreviationFromIndex[s]}_m", creature.levelsMutated[s] < mutationLevelsLowest[s] ? "1" : string.Empty); + var statSet = StatAccessors[s](model); + statSet.level = creature.levelsWild[s]; + statSet.level_m = creature.levelsMutated?[s] ?? 0; + statSet.level_vb = creature.valuesBreeding[s] * (Stats.IsPercentage(s) ? 100 : 1); + statSet.istop = creature.levelsWild[s] != -1 && creature.levelsWild[s] >= wildLevelsHighest[s]; + statSet.isnewtop = creature.levelsWild[s] != -1 && creature.levelsWild[s] > wildLevelsHighest[s]; + statSet.islowest = creature.levelsWild[s] != -1 && creature.levelsWild[s] <= wildLevelsLowest[s]; + statSet.isnewlowest = creature.levelsWild[s] != -1 && creature.levelsWild[s] < wildLevelsLowest[s]; + statSet.istop_m = creature.levelsMutated[s] >= mutationLevelsHighest[s]; + statSet.isnewtop_m = creature.levelsMutated[s] > mutationLevelsHighest[s]; + statSet.islowest_m = creature.levelsMutated[s] <= mutationLevelsLowest[s]; + statSet.isnewlowest_m = creature.levelsMutated[s] < mutationLevelsLowest[s]; + + // highest stats and according levels + model.highest_l[s] = s < usedStatsCount ? levelOrderWild[s].Item2.ToString() : string.Empty; + model.highest_s[s] = s < usedStatsCount ? Utils.StatName(levelOrderWild[s].Item1, true, creature.Species.statNames) : string.Empty; + model.highest_l_m[s] = s < usedStatsCount ? levelOrderMutated[s].Item2.ToString() : string.Empty; + model.highest_s_m[s] = s < usedStatsCount ? Utils.StatName(levelOrderMutated[s].Item1, true, creature.Species.statNames) : string.Empty; + } + + for (int i = 0; i < 6; i++) + { + var colorId = creature.colors[i]; + ColorExisting colorExisting = colorExistings != null ? colorExistings[i] : ColorExisting.Unknown; + + model.colors[i] = new ColorModel + { + id = colorId, + name = CreatureColors.CreatureColorName(colorId), + used = creature.Species.EnabledColorRegions[i], + @new = colorExisting == ColorExisting.ColorExistingInOtherRegion ? "newInRegion" + : colorExisting == ColorExisting.ColorIsNew ? "newInSpecies" + : string.Empty + }; + } + + return model; + } + + /// + /// This method creates the token dictionary for the dynamic creature name generation. + /// + /// TokenModel containing the data for the token dictionary + /// A dictionary containing all tokens and their replacements + public static Dictionary CreateTokenDictionary(TokenModel model) + { + // replace tokens in user configured pattern string + // keys have to be all lower case + var dict = new Dictionary + { + { "species", model.species }, + { "spcsnm", model.spcsnm }, + { "firstwordofoldest", model.firstwordofoldest }, + + { "owner", model.owner }, + { "tribe", model.tribe }, + { "server", model.server }, + + { "sex", model.sex.ToString() }, + { "sex_short", model.sex_short }, + + { "effimp_short", model.effimp_short }, + { "index", model.index.ToString() }, + { "oldname", model.oldname }, + { "sex_lang", model.sex_lang }, + { "sex_lang_short", model.sex_lang_short }, + { "sex_lang_gen", model.sex_lang_gen }, + { "sex_lang_short_gen", model.sex_lang_short_gen }, + + { "toppercent", model.toppercent.ToString() }, + { "baselvl", model.baselvl.ToString() }, + { "levelpretamed", model.levelpretamed.ToString() }, + { "effimp", model.effimp }, + { "muta", model.muta.ToString() }, + { "mutam", model.mutam.ToString() }, + { "mutap", model.mutap.ToString() }, + { "gen", model.gen.ToString() }, + { "gena", model.gena }, + { "genn", model.genn.ToString() }, + { "nr_in_gen", model.nr_in_gen.ToString() }, + { "nr_in_gen_sex", model.nr_in_gen_sex.ToString() }, + { "rnd", model.rnd.ToString("000000") }, + { "ln", model.ln.ToString() }, + { "tn", model.tn.ToString() }, + { "sn", model.sn.ToString() }, + { "dom", model.dom }, + { "arkid", model.arkid }, + { "alreadyexists", model.alreadyexists ? "1" : string.Empty }, + { "isflyer", model.isflyer ? "1" : string.Empty }, + { "status", model.status.ToString() }, + }; + + for (int s = 0; s < Stats.StatsCount; s++) + { + var stat = StatAccessors[s](model); + var abbreviation = StatAbbreviationFromIndex[s]; + + dict.Add(abbreviation, stat.level.ToString()); + dict.Add($"{abbreviation}_vb", stat.level_vb.ToString()); + dict.Add($"istop{abbreviation}", stat.istop ? "1" : string.Empty); + dict.Add($"isnewtop{abbreviation}", stat.isnewtop ? "1" : string.Empty); + dict.Add($"islowest{abbreviation}", stat.islowest ? "1" : string.Empty); + dict.Add($"isnewlowest{abbreviation}", stat.isnewlowest ? "1" : string.Empty); + dict.Add($"istop{abbreviation}_m", stat.istop_m ? "1" : string.Empty); + dict.Add($"isnewtop{abbreviation}_m", stat.isnewtop_m ? "1" : string.Empty); + dict.Add($"islowest{abbreviation}_m", stat.islowest_m ? "1" : string.Empty); + dict.Add($"isnewlowest{abbreviation}_m", stat.isnewlowest_m ? "1" : string.Empty); // highest stats and according levels - dict.Add("highest" + (s + 1) + "l", s < usedStatsCount ? levelOrderWild[s].Item2.ToString() : string.Empty); - dict.Add("highest" + (s + 1) + "s", s < usedStatsCount ? Utils.StatName(levelOrderWild[s].Item1, true, creature.Species.statNames) : string.Empty); - dict.Add("highest" + (s + 1) + "l_m", s < usedStatsCount ? levelOrderMutated[s].Item2.ToString() : string.Empty); - dict.Add("highest" + (s + 1) + "s_m", s < usedStatsCount ? Utils.StatName(levelOrderMutated[s].Item1, true, creature.Species.statNames) : string.Empty); + dict.Add("highest" + (s + 1) + "l", model.highest_l[s]); + dict.Add("highest" + (s + 1) + "s", model.highest_s[s]); + dict.Add("highest" + (s + 1) + "l_m", model.highest_l_m[s]); + dict.Add("highest" + (s + 1) + "s_m", model.highest_s_m[s]); // mutated levels - dict.Add(StatAbbreviationFromIndex[s] + "_m", (creature.levelsMutated?[s] ?? 0).ToString()); + dict.Add(abbreviation + "_m", stat.level_m.ToString()); } return dict; diff --git a/ARKBreedingStats/NamePatterns/NamePatternFunctions.cs b/ARKBreedingStats/NamePatterns/NamePatternFunctions.cs index 1e7a29e61..0ff77dec2 100644 --- a/ARKBreedingStats/NamePatterns/NamePatternFunctions.cs +++ b/ARKBreedingStats/NamePatterns/NamePatternFunctions.cs @@ -30,6 +30,18 @@ internal static string ResolveFunction(Match match, NamePatternParameters parame return string.Empty; } + internal static string CustomReplace(string key, string defaultValue, Dictionary customReplacings) + { + if (!string.IsNullOrEmpty(key) && customReplacings?.TryGetValue(key, out var replacement) == true) + { + return replacement; + } + else + { + return defaultValue; + } + } + private static string ParametersInvalid(string specificError, string expression, bool displayError) { if (displayError) @@ -305,11 +317,7 @@ public static string UnEscapeSpecialCharacters(string text) => text? private static string FunctionCustomReplace(Match m, NamePatternParameters p) { // parameter: 1: customreplace, 2: key, 3: return if key not available - if (p.CustomReplacings == null - || string.IsNullOrEmpty(m.Groups[2].Value) - || !p.CustomReplacings.ContainsKey(m.Groups[2].Value)) - return m.Groups[3].Value; - return p.CustomReplacings[m.Groups[2].Value]; + return CustomReplace(m.Groups[2].Value, m.Groups[3].Value, p.CustomReplacings); } private static string FunctionTime(Match m, NamePatternParameters p) diff --git a/ARKBreedingStats/NamePatterns/PatternEditor.Designer.cs b/ARKBreedingStats/NamePatterns/PatternEditor.Designer.cs index dc26c46cf..3bb0e39bb 100644 --- a/ARKBreedingStats/NamePatterns/PatternEditor.Designer.cs +++ b/ARKBreedingStats/NamePatterns/PatternEditor.Designer.cs @@ -28,6 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PatternEditor)); this.txtboxPattern = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); @@ -37,6 +38,7 @@ private void InitializeComponent() this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.panel1 = new System.Windows.Forms.Panel(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.StopwatchLabel = new System.Windows.Forms.Label(); this.cbPreview = new System.Windows.Forms.CheckBox(); this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.tabControl1 = new System.Windows.Forms.TabControl(); @@ -49,8 +51,14 @@ private void InitializeComponent() this.TbFilterKeys = new System.Windows.Forms.TextBox(); this.BtClearFilterKey = new System.Windows.Forms.Button(); this.TabPagePatternTemplates = new System.Windows.Forms.TabPage(); + this.TabPageJavaScriptConsole = new System.Windows.Forms.TabPage(); + this.TextboxJavaScriptConsole = new System.Windows.Forms.TextBox(); this.CbPatternNameToClipboardAfterManualApplication = new System.Windows.Forms.CheckBox(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.panel4 = new System.Windows.Forms.Panel(); + this.BtJavaScript = new System.Windows.Forms.Button(); + this.BtJsTemplate = new System.Windows.Forms.Button(); this.tableLayoutPanel1.SuspendLayout(); this.panel1.SuspendLayout(); this.groupBox1.SuspendLayout(); @@ -59,14 +67,17 @@ private void InitializeComponent() this.TlpKeysFunctions.SuspendLayout(); this.panel3.SuspendLayout(); this.panel2.SuspendLayout(); + this.TabPageJavaScriptConsole.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); + this.panel4.SuspendLayout(); this.SuspendLayout(); // // txtboxPattern // + this.txtboxPattern.AcceptsTab = true; this.txtboxPattern.Dock = System.Windows.Forms.DockStyle.Fill; this.txtboxPattern.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtboxPattern.Location = new System.Drawing.Point(0, 0); @@ -127,7 +138,7 @@ private void InitializeComponent() this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1); this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.linkLabel1, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.panel4, 0, 3); this.tableLayoutPanel1.Controls.Add(this.tabControl1, 0, 4); this.tableLayoutPanel1.Controls.Add(this.CbPatternNameToClipboardAfterManualApplication, 0, 2); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; @@ -137,7 +148,7 @@ private void InitializeComponent() this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 46F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(702, 630); this.tableLayoutPanel1.TabIndex = 7; @@ -155,6 +166,7 @@ private void InitializeComponent() // // groupBox1 // + this.groupBox1.Controls.Add(this.StopwatchLabel); this.groupBox1.Controls.Add(this.cbPreview); this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox1.Location = new System.Drawing.Point(0, 0); @@ -164,6 +176,17 @@ private void InitializeComponent() this.groupBox1.TabStop = false; this.groupBox1.Text = "Preview"; // + // StopwatchLabel + // + this.StopwatchLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.StopwatchLabel.AutoSize = true; + this.StopwatchLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.StopwatchLabel.Location = new System.Drawing.Point(512, 8); + this.StopwatchLabel.Name = "StopwatchLabel"; + this.StopwatchLabel.Size = new System.Drawing.Size(39, 29); + this.StopwatchLabel.TabIndex = 12; + this.StopwatchLabel.Text = "⏱"; + // // cbPreview // this.cbPreview.AutoSize = true; @@ -179,7 +202,8 @@ private void InitializeComponent() // linkLabel1 // this.linkLabel1.AutoSize = true; - this.linkLabel1.Location = new System.Drawing.Point(3, 114); + this.linkLabel1.Dock = System.Windows.Forms.DockStyle.Right; + this.linkLabel1.Location = new System.Drawing.Point(511, 0); this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Size = new System.Drawing.Size(185, 13); this.linkLabel1.TabIndex = 10; @@ -191,11 +215,12 @@ private void InitializeComponent() // this.tabControl1.Controls.Add(this.TabPageKeysFunctions); this.tabControl1.Controls.Add(this.TabPagePatternTemplates); + this.tabControl1.Controls.Add(this.TabPageJavaScriptConsole); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControl1.Location = new System.Drawing.Point(3, 137); + this.tabControl1.Location = new System.Drawing.Point(3, 149); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(696, 490); + this.tabControl1.Size = new System.Drawing.Size(696, 478); this.tabControl1.TabIndex = 16; // // TabPageKeysFunctions @@ -204,7 +229,7 @@ private void InitializeComponent() this.TabPageKeysFunctions.Location = new System.Drawing.Point(4, 22); this.TabPageKeysFunctions.Name = "TabPageKeysFunctions"; this.TabPageKeysFunctions.Padding = new System.Windows.Forms.Padding(3); - this.TabPageKeysFunctions.Size = new System.Drawing.Size(688, 464); + this.TabPageKeysFunctions.Size = new System.Drawing.Size(688, 452); this.TabPageKeysFunctions.TabIndex = 0; this.TabPageKeysFunctions.Text = "Keys and Functions"; this.TabPageKeysFunctions.UseVisualStyleBackColor = true; @@ -222,7 +247,7 @@ private void InitializeComponent() this.TlpKeysFunctions.RowCount = 2; this.TlpKeysFunctions.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); this.TlpKeysFunctions.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.TlpKeysFunctions.Size = new System.Drawing.Size(682, 458); + this.TlpKeysFunctions.Size = new System.Drawing.Size(682, 446); this.TlpKeysFunctions.TabIndex = 15; // // panel3 @@ -290,11 +315,35 @@ private void InitializeComponent() this.TabPagePatternTemplates.Location = new System.Drawing.Point(4, 22); this.TabPagePatternTemplates.Name = "TabPagePatternTemplates"; this.TabPagePatternTemplates.Padding = new System.Windows.Forms.Padding(3); - this.TabPagePatternTemplates.Size = new System.Drawing.Size(688, 472); + this.TabPagePatternTemplates.Size = new System.Drawing.Size(688, 464); this.TabPagePatternTemplates.TabIndex = 1; this.TabPagePatternTemplates.Text = "Templates"; this.TabPagePatternTemplates.UseVisualStyleBackColor = true; // + // TabPageJavaScriptConsole + // + this.TabPageJavaScriptConsole.Controls.Add(this.TextboxJavaScriptConsole); + this.TabPageJavaScriptConsole.Location = new System.Drawing.Point(4, 22); + this.TabPageJavaScriptConsole.Name = "TabPageJavaScriptConsole"; + this.TabPageJavaScriptConsole.Padding = new System.Windows.Forms.Padding(3); + this.TabPageJavaScriptConsole.Size = new System.Drawing.Size(688, 452); + this.TabPageJavaScriptConsole.TabIndex = 2; + this.TabPageJavaScriptConsole.Text = "JavaScript Console"; + this.TabPageJavaScriptConsole.UseVisualStyleBackColor = true; + // + // TextboxJavaScriptConsole + // + this.TextboxJavaScriptConsole.BackColor = System.Drawing.SystemColors.Window; + this.TextboxJavaScriptConsole.Dock = System.Windows.Forms.DockStyle.Fill; + this.TextboxJavaScriptConsole.Location = new System.Drawing.Point(3, 3); + this.TextboxJavaScriptConsole.Multiline = true; + this.TextboxJavaScriptConsole.Name = "TextboxJavaScriptConsole"; + this.TextboxJavaScriptConsole.ReadOnly = true; + this.TextboxJavaScriptConsole.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.TextboxJavaScriptConsole.Size = new System.Drawing.Size(682, 446); + this.TextboxJavaScriptConsole.TabIndex = 0; + this.TextboxJavaScriptConsole.WordWrap = false; + // // CbPatternNameToClipboardAfterManualApplication // this.CbPatternNameToClipboardAfterManualApplication.AutoSize = true; @@ -324,6 +373,39 @@ private void InitializeComponent() this.splitContainer1.SplitterDistance = 40; this.splitContainer1.TabIndex = 8; // + // panel4 + // + this.panel4.Controls.Add(this.linkLabel1); + this.panel4.Controls.Add(this.BtJsTemplate); + this.panel4.Controls.Add(this.BtJavaScript); + this.panel4.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel4.Location = new System.Drawing.Point(3, 117); + this.panel4.Name = "panel4"; + this.panel4.Size = new System.Drawing.Size(696, 26); + this.panel4.TabIndex = 15; + // + // BtJavaScript + // + this.BtJavaScript.Dock = System.Windows.Forms.DockStyle.Left; + this.BtJavaScript.Location = new System.Drawing.Point(0, 0); + this.BtJavaScript.Name = "BtJavaScript"; + this.BtJavaScript.Size = new System.Drawing.Size(139, 26); + this.BtJavaScript.TabIndex = 11; + this.BtJavaScript.Text = "Use JavaScript"; + this.BtJavaScript.UseVisualStyleBackColor = true; + this.BtJavaScript.Click += new System.EventHandler(this.BtJavaScript_Click); + // + // BtJsTemplate + // + this.BtJsTemplate.Dock = System.Windows.Forms.DockStyle.Left; + this.BtJsTemplate.Location = new System.Drawing.Point(139, 0); + this.BtJsTemplate.Name = "BtJsTemplate"; + this.BtJsTemplate.Size = new System.Drawing.Size(92, 26); + this.BtJsTemplate.TabIndex = 13; + this.BtJsTemplate.Text = "JS example"; + this.BtJsTemplate.UseVisualStyleBackColor = true; + this.BtJsTemplate.Click += new System.EventHandler(this.BtJsTemplate_Click); + // // PatternEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -348,11 +430,15 @@ private void InitializeComponent() this.panel3.PerformLayout(); this.panel2.ResumeLayout(false); this.panel2.PerformLayout(); + this.TabPageJavaScriptConsole.ResumeLayout(false); + this.TabPageJavaScriptConsole.PerformLayout(); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel1.PerformLayout(); this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); + this.panel4.ResumeLayout(false); + this.panel4.PerformLayout(); this.ResumeLayout(false); } @@ -370,16 +456,23 @@ private void InitializeComponent() private System.Windows.Forms.SplitContainer splitContainer1; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.CheckBox cbPreview; + private System.Windows.Forms.CheckBox CbPatternNameToClipboardAfterManualApplication; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage TabPageKeysFunctions; + private System.Windows.Forms.TableLayoutPanel TlpKeysFunctions; private System.Windows.Forms.Panel panel3; private System.Windows.Forms.TextBox TbFilterFunctions; private System.Windows.Forms.Button BtClearFilterFunctions; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.TextBox TbFilterKeys; private System.Windows.Forms.Button BtClearFilterKey; - private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage TabPageKeysFunctions; - private System.Windows.Forms.TableLayoutPanel TlpKeysFunctions; private System.Windows.Forms.TabPage TabPagePatternTemplates; - private System.Windows.Forms.CheckBox CbPatternNameToClipboardAfterManualApplication; + private System.Windows.Forms.TabPage TabPageJavaScriptConsole; + private System.Windows.Forms.TextBox TextboxJavaScriptConsole; + private System.Windows.Forms.Label StopwatchLabel; + private System.Windows.Forms.ToolTip toolTip1; + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.Button BtJavaScript; + private System.Windows.Forms.Button BtJsTemplate; } } \ No newline at end of file diff --git a/ARKBreedingStats/NamePatterns/PatternEditor.cs b/ARKBreedingStats/NamePatterns/PatternEditor.cs index fd77c4f6e..82077fa7c 100644 --- a/ARKBreedingStats/NamePatterns/PatternEditor.cs +++ b/ARKBreedingStats/NamePatterns/PatternEditor.cs @@ -4,11 +4,11 @@ using System.IO; using System.Drawing; using System.Linq; +using System.Text.RegularExpressions; using System.Windows.Forms; using System.Windows.Threading; using ARKBreedingStats.library; using ARKBreedingStats.Library; -using ARKBreedingStats.Properties; using ARKBreedingStats.Updater; using ARKBreedingStats.utils; @@ -16,35 +16,125 @@ namespace ARKBreedingStats.NamePatterns { public partial class PatternEditor : Form { + private static readonly Regex LocalizationRegex = new Regex(@"\{\{loc\((?.*?)\)\}\}", RegexOptions.IgnoreCase | RegexOptions.Compiled, TimeSpan.FromSeconds(5)); private readonly Creature _creature; private readonly Creature[] _creaturesOfSameSpecies; private readonly Creature _alreadyExistingCreature; + private readonly TokenModel _tokenModel; private readonly TopLevels _topLevels; private readonly int _libraryCreatureCount; private readonly CreatureCollection.ColorExisting[] _colorExistings; private Dictionary _customReplacings; - private readonly Dictionary _tokenDictionary; private readonly Debouncer _updateNameDebouncer = new Debouncer(); - private Action _reloadCallback; - private TableLayoutPanel _tableLayoutPanelKeys; - private TableLayoutPanel _tableLayoutPanelFunctions; + private readonly Action _reloadCallback; + private readonly TableLayoutPanel _tableLayoutPanelKeys; + private readonly TableLayoutPanel _tableLayoutPanelFunctions; private TableLayoutPanel _tableLayoutPanelTemplates; - private List _listKeys; - private List _listFunctions; + private readonly List _listKeys; + private readonly List _listFunctions; private List _listTemplates; - private Debouncer _keyDebouncer; - private Debouncer _functionDebouncer; + private readonly Debouncer _keyDebouncer; + private readonly Debouncer _functionDebouncer; public PatternEditor() { InitializeComponent(); + txtboxPattern.KeyDown += HandleTextBoxIndentation; + } + + private void HandleTextBoxIndentation(object sender, KeyEventArgs e) + { + if (e.KeyCode != Keys.Tab) + { + return; + } + + // if we're pressing tab with nothing selected + if (txtboxPattern.SelectionLength == 0) + { + var startOfLine = txtboxPattern.GetFirstCharIndexOfCurrentLine(); + var positionInLine = txtboxPattern.SelectionStart - startOfLine; + + if (e.Shift) + { + // if we're holding shift, try to remove a tab or up to 2 spaces from before the cursor + var textBeforeCursor = txtboxPattern.Text.Substring(startOfLine, positionInLine); + + var charactersToRemove = textBeforeCursor.EndsWith(" ") ? 2 + : textBeforeCursor.EndsWith(" ") ? 1 + : textBeforeCursor.EndsWith("\t") ? 1 + : 0; + + if (charactersToRemove > 0) + { + txtboxPattern.Select(txtboxPattern.SelectionStart - charactersToRemove, charactersToRemove); + txtboxPattern.SelectedText = ""; + } + } + else + { + // if we're not holding shift, just insert 2 spaces + txtboxPattern.SelectedText = " "; + } + e.SuppressKeyPress = true; + return; + } + + // if we have text selected, indent or unindent the selected lines + // we want to expand the selection to full lines, so we can apply regex to the whole selection area + SelectFullLines(txtboxPattern, out var endLine, out var startLine); + + if (e.Shift) + { + // if we're holding shift, remove 1 or 2 spaces or a tab from the start of each line + txtboxPattern.SelectedText = Regex.Replace(txtboxPattern.SelectedText, "^( ?|\t)", "", System.Text.RegularExpressions.RegexOptions.Multiline); + } + else + { + // if we're not holding shift, add 2 spaces to the start of each line + txtboxPattern.SelectedText = Regex.Replace(txtboxPattern.SelectedText, "^", " ", System.Text.RegularExpressions.RegexOptions.Multiline); + } + + // reselect the lines we just modified + var start = txtboxPattern.GetFirstCharIndexFromLine(startLine); + var end = txtboxPattern.GetFirstCharIndexFromLine(endLine) + txtboxPattern.Lines[endLine].Length; + txtboxPattern.Select(start, end - start); + + e.SuppressKeyPress = true; + } + + /// + /// Expand the selected text of a textBox to include the full lines + /// + private static void SelectFullLines(TextBox textBox, out int endLine, out int startLine) + { + var startChar = textBox.SelectionStart; + var endChar = startChar + textBox.SelectionLength; + startLine = textBox.GetLineFromCharIndex(startChar); + endLine = textBox.GetLineFromCharIndex(endChar); + + // If the cursor is sitting at the beginning of a line and it's not the first line of the selection, we don't want to indent that line + // > = start of selection < = end of selection + // + // line 1>text indent this line + // line 2 text indent this line + // customReplacings, int namingPatternIndex, Action reloadCallback, int libraryCreatureCount) : this() { - Utils.SetWindowRectangle(this, Settings.Default.PatternEditorFormRectangle); - if (Settings.Default.PatternEditorSplitterDistance > 0) - SplitterDistance = Settings.Default.PatternEditorSplitterDistance; + Utils.SetWindowRectangle(this, Properties.Settings.Default.PatternEditorFormRectangle); + if (Properties.Settings.Default.PatternEditorSplitterDistance > 0) + SplitterDistance = Properties.Settings.Default.PatternEditorSplitterDistance; InitializeLocalization(); @@ -62,7 +152,8 @@ public PatternEditor(Creature creature, Creature[] creaturesOfSameSpecies, TopLe Text = $"Naming Pattern Editor: pattern {namingPatternIndex + 1}"; _alreadyExistingCreature = _creaturesOfSameSpecies?.FirstOrDefault(c => c.guid == creature.guid); - _tokenDictionary = NamePatterns.NamePattern.CreateTokenDictionary(creature, _alreadyExistingCreature, _creaturesOfSameSpecies, _topLevels, _libraryCreatureCount); + _tokenModel = NamePatterns.NamePattern.CreateTokenModel(creature, _alreadyExistingCreature, _creaturesOfSameSpecies, _colorExistings, _topLevels, _libraryCreatureCount); + var tokenDictionary = NamePatterns.NamePattern.CreateTokenDictionary(_tokenModel); _keyDebouncer = new Debouncer(); _functionDebouncer = new Debouncer(); @@ -78,32 +169,31 @@ public PatternEditor(Creature creature, Creature[] creaturesOfSameSpecies, TopLe void SetControlsToTable(TableLayoutPanel tlp, Dictionary nameExamples, List entries, bool columns = true, bool useExampleAsInput = false, int buttonWidth = 120) { - int i = 0; foreach (KeyValuePair p in nameExamples) { var entry = new NamePatternEntry { FilterString = p.Key }; entries.Add(entry); - Button btn = new Button + var btn = new Button { Size = new Size(buttonWidth, 23), Text = p.Key, Dock = DockStyle.Left }; - int substringUntil = p.Value.LastIndexOf("\n"); + var substringUntil = p.Value.LastIndexOf("\n"); btn.Tag = useExampleAsInput ? p.Value.Substring(substringUntil + 1) : $"{{{p.Key}}}"; if (!columns) btn.Dock = DockStyle.Top; btn.Click += Btn_Click; - Label lbl = new Label + var lbl = new Label { Dock = DockStyle.Fill, //Anchor = AnchorStyles.Top | AnchorStyles.Bottom, //MinimumSize = new Size(50, 40), AutoSize = true, - Text = useExampleAsInput ? p.Value.Substring(0, substringUntil) : p.Value + (_tokenDictionary.ContainsKey(p.Key) ? ". E.g. \"" + _tokenDictionary[p.Key] + "\"" : ""), + Text = useExampleAsInput ? p.Value.Substring(0, substringUntil) : p.Value + (tokenDictionary.TryGetValue(p.Key, out var tokenValue) ? ". E.g. \"" + tokenValue + "\"" : ""), Padding = new Padding(3, 3, 3, 5) }; entry.Controls.Add(lbl); @@ -157,12 +247,12 @@ void SetControlsToTable(TableLayoutPanel tlp, Dictionary nameExa Dock = DockStyle.Bottom, Margin = new Padding(0, 3, 0, 5), }); - - i++; } } InitializeTemplates(); + + ShowHideConsoleTab(); } protected override void OnLoad(EventArgs e) @@ -217,8 +307,12 @@ private void InitializeTemplates() TabPagePatternTemplates.Controls.Add(_tableLayoutPanelTemplates); _listTemplates = new List(); + var jsTemplateSet = false; + foreach (var t in templates) { + var localizedPattern = LocalizeTemplateString(t.Pattern); + var panel = new Panel { Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top, @@ -231,13 +325,13 @@ private void InitializeTemplates() Size = new Size(50, 23), Text = t.Title, Dock = DockStyle.Top, - Tag = t.Pattern + Tag = localizedPattern }; var tbPattern = new TextBox { ReadOnly = true, - Text = t.Pattern, + Text = localizedPattern, Dock = DockStyle.Top, Padding = new Padding(3) }; @@ -268,7 +362,21 @@ private void InitializeTemplates() Dock = DockStyle.Bottom, Margin = new Padding(0, 3, 0, 5) }); + + if (t.Title == "Javascript sample with output of creature data") + { + BtJsTemplate.Tag = localizedPattern; + jsTemplateSet = true; + } } + + if (!jsTemplateSet) + BtJsTemplate.Visible = false; + } + + private string LocalizeTemplateString(string pattern) + { + return LocalizationRegex.Replace(pattern, match => Loc.S(match.Groups["key"].Value)); } private void PatternEditorRecalculateControlSizes() @@ -340,7 +448,7 @@ private void ChangeCustomReplacingsFilePath(object sender, EventArgs e) using (OpenFileDialog dlg = new OpenFileDialog { - Filter = $"ASB Custom Replacings File (*.json)|*.json", + Filter = "ASB Custom Replacings File (*.json)|*.json", CheckFileExists = true, InitialDirectory = selectedFolder, FileName = selectedFileName @@ -569,14 +677,47 @@ public int SplitterDistance private void txtboxPattern_TextChanged(object sender, EventArgs e) { - if (cbPreview.Checked) - _updateNameDebouncer.Debounce(500, DisplayPreview, Dispatcher.CurrentDispatcher); + _updateNameDebouncer.Debounce(500, TextChangedDebouncer, Dispatcher.CurrentDispatcher); } - private void DisplayPreview() + private void ShowHideConsoleTab() { + var visible = tabControl1.TabPages.Contains(TabPageJavaScriptConsole); + if (JavaScriptNamePattern.JavaScriptShebang.IsMatch(txtboxPattern.Text)) + { + if (!visible) + tabControl1.TabPages.Add(TabPageJavaScriptConsole); + } + else + { + if (visible) + tabControl1.TabPages.Remove(TabPageJavaScriptConsole); + + } + } + + private void TextChangedDebouncer() + { + ShowHideConsoleTab(); + if (!cbPreview.Checked) return; + + ResetConsoleTab(); + var stopwatch = Stopwatch.StartNew(); cbPreview.Text = NamePatterns.NamePattern.GenerateCreatureName(_creature, _alreadyExistingCreature, _creaturesOfSameSpecies, _topLevels, _customReplacings, - false, -1, false, txtboxPattern.Text, false, _tokenDictionary, _colorExistings, _libraryCreatureCount); + false, -1, false, txtboxPattern.Text, false, _tokenModel, _colorExistings, _libraryCreatureCount, WriteToJavaScriptConsole); + stopwatch.Stop(); + toolTip1.SetToolTip(StopwatchLabel, $"name generated in {stopwatch.Elapsed.TotalMilliseconds:0.0} ms"); + } + + private void ResetConsoleTab() + { + TextboxJavaScriptConsole.Clear(); + TextboxJavaScriptConsole.Update(); + } + + private void WriteToJavaScriptConsole(string value) + { + TextboxJavaScriptConsole.AppendText(value?.Replace("\r", "").Replace("\n", Environment.NewLine) + Environment.NewLine); } private void TbFilterKeys_TextChanged(object sender, EventArgs e) @@ -621,5 +762,29 @@ private void BtClearFilterFunctions_Click(object sender, EventArgs e) { TbFilterFunctions.Text = string.Empty; } + + private void BtJavaScript_Click(object sender, EventArgs e) + { + if (!JsDependenciesAvailable()) + return; + + // add javascript start indicator + if (!JavaScriptNamePattern.JavaScriptShebang.IsMatch(txtboxPattern.Text)) + txtboxPattern.Text = "#!javascript" + Environment.NewLine + "return `${species}`;" + Environment.NewLine + txtboxPattern.Text; + } + + private void BtJsTemplate_Click(object sender, EventArgs e) + { + if (JsDependenciesAvailable()) + Btn_Click(sender, e); + } + + /// + /// Checks if needed dlls are available. + /// + private bool JsDependenciesAvailable() + { + return true; // TODO + } } } diff --git a/ARKBreedingStats/NamePatterns/PatternEditor.resx b/ARKBreedingStats/NamePatterns/PatternEditor.resx index 1eeb27286..3eb7cc83c 100644 --- a/ARKBreedingStats/NamePatterns/PatternEditor.resx +++ b/ARKBreedingStats/NamePatterns/PatternEditor.resx @@ -120,4 +120,7 @@ Use the listed keywords to create a pattern that can be applied to a creature. This will make it easier to give names to creatures that follow the same pattern. Any text that is not a pattern will appear literally. Parameters will be trimmed (i.e. spaces at the front and end will be removed). You can use &&sp; for space and &&lcub; for {, &&rcub; for } and &&vline; for |. + + 17, 17 + \ No newline at end of file diff --git a/ARKBreedingStats/NamePatterns/TokenModel.cs b/ARKBreedingStats/NamePatterns/TokenModel.cs new file mode 100644 index 000000000..87fa6927f --- /dev/null +++ b/ARKBreedingStats/NamePatterns/TokenModel.cs @@ -0,0 +1,98 @@ +using ARKBreedingStats.Library; + +namespace ARKBreedingStats.NamePatterns +{ + public class TokenModel + { + internal int? effimp_value; + + public string species { get; set; } + public string spcsnm { get; set; } + public string firstwordofoldest { get; set; } + public string owner { get; set; } + public string tribe { get; set; } + public string server { get; set; } + public Sex sex { get; set; } + public string sex_short { get; set; } + public string effimp_short { get; set; } + public int index { get; set; } + public string oldname { get; set; } + public string sex_lang { get; set; } + public string sex_lang_short { get; set; } + public string sex_lang_gen { get; set; } + public string sex_lang_short_gen { get; set; } + public float toppercent { get; set; } + public int baselvl { get; set; } + public int levelpretamed { get; set; } + public string effimp { get; set; } + public int muta { get; set; } + public int mutam { get; set; } + public int mutap { get; set; } + public int gen { get; set; } + public string gena { get; set; } + public int nr_in_gen { get; set; } + public int nr_in_gen_sex { get; set; } + public int ln { get; set; } + public int tn { get; set; } + public int sn { get; set; } + public string arkid { get; set; } + public bool alreadyexists { get; set; } + public bool isflyer { get; set; } + public int genn { get; set; } + public int rnd { get; set; } + public string dom { get; set; } + public CreatureStatus status { get; set; } + public StatModel te { get; set; } = new StatModel(); + public StatModel hp { get; set; } = new StatModel(); + public StatModel st { get; set; } = new StatModel(); + public StatModel to { get; set; } = new StatModel(); + public StatModel ox { get; set; } = new StatModel(); + public StatModel fo { get; set; } = new StatModel(); + public StatModel wa { get; set; } = new StatModel(); + public StatModel we { get; set; } = new StatModel(); + public StatModel dm { get; set; } = new StatModel(); + public StatModel sp { get; set; } = new StatModel(); + public StatModel fr { get; set; } = new StatModel(); + public StatModel cr { get; set; } = new StatModel(); + /// + /// Stat levels ordered descended by level height. + /// + public string[] highest_l { get; set; } = new string[Stats.StatsCount]; + /// + /// Stat indices ordered descended by level height. + /// + public string[] highest_s { get; set; } = new string[Stats.StatsCount]; + /// + /// Mutation stat levels ordered descended by level height. + /// + public string[] highest_l_m { get; set; } = new string[Stats.StatsCount]; + /// + /// Mutation stat indices ordered descended by level height. + /// + public string[] highest_s_m { get; set; } = new string[Stats.StatsCount]; + public ColorModel[] colors { get; set; } = new ColorModel[6]; + } + + public class StatModel + { + public int level { get; set; } + public double level_vb { get; set; } + public bool istop { get; set; } + public bool isnewtop { get; set; } + public bool islowest { get; set; } + public bool isnewlowest { get; set; } + public bool istop_m { get; set; } + public bool isnewtop_m { get; set; } + public bool islowest_m { get; set; } + public bool isnewlowest_m { get; set; } + public int level_m { get; set; } + } + + public class ColorModel + { + public byte id { get; set; } + public string name { get; set; } + public bool used { get; set; } + public string @new { get; set; } + } +} \ No newline at end of file diff --git a/ARKBreedingStats/Pedigree/PedigreeCreature.cs b/ARKBreedingStats/Pedigree/PedigreeCreature.cs index 7d0573dae..25cc5d77a 100644 --- a/ARKBreedingStats/Pedigree/PedigreeCreature.cs +++ b/ARKBreedingStats/Pedigree/PedigreeCreature.cs @@ -180,11 +180,9 @@ public Creature Creature } _tt.SetToolTip(labelSex, "Sex: " + Loc.S(_creature.sex.ToString())); - var minChartLevel = CreatureCollection.CurrentCreatureCollection?.minChartLevel ?? 0; - var maxChartLevel = CreatureCollection.CurrentCreatureCollection?.maxChartLevel ?? 50; - var chartLevelRange = maxChartLevel - minChartLevel; - var hueRangeEven = Properties.Settings.Default.ChartHueEvenMax - Properties.Settings.Default.ChartHueEvenMin; - var hueRangeOdd = Properties.Settings.Default.ChartHueOddMax - Properties.Settings.Default.ChartHueOddMin; + + var levelColorOptions = Form1.StatsLevelColors.GetStatsOptions(Creature.Species); + for (int s = 0; s < DisplayedStatsCount; s++) { int si = DisplayedStats[s]; @@ -217,21 +215,9 @@ public Creature Creature if (Properties.Settings.Default.Highlight255Level && _creature.levelsWild[si] > 253) // 255 is max, 254 is the highest that allows dom leveling _labels[s].BackColor = Utils.AdjustColorLight(_creature.levelsWild[si] == 254 ? Utils.Level254 : Utils.Level255, _creature.IsTopStat(si) ? 0.2 : 0.7); else if (Properties.Settings.Default.HighlightEvenOdd) - { - var levelForColor = Math.Min(maxChartLevel, Math.Max(minChartLevel, _creature.levelsWild[si])); - int hue; - if (_creature.levelsWild[si] % 2 == 0) - { - hue = Properties.Settings.Default.ChartHueEvenMin + levelForColor * hueRangeEven / chartLevelRange; - } - else - { - hue = Properties.Settings.Default.ChartHueOddMin + levelForColor * hueRangeOdd / chartLevelRange; - } - _labels[s].BackColor = Utils.ColorFromHue(hue, _creature.IsTopStat(si) ? 0.4 : 0.7); - } - else - _labels[s].BackColor = Utils.GetColorFromPercent((int)(_creature.levelsWild[si] * 2.5), _creature.IsTopStat(si) ? 0.2 : 0.7); + _labels[s].BackColor = Utils.AdjustColorLight(levelColorOptions.StatOptions[si].GetLevelColor(_creature.levelsWild[si]), + _creature.IsTopStat(si) ? 0.2 : 0.7); + _labels[s].ForeColor = Parent?.ForeColor ?? Color.Black; // needed so text is not transparent on overlay _ttMonospaced.SetToolTip(_labels[s], Utils.StatName(si, false, _creature.Species?.statNames) + ": " + $"{_creature.valuesBreeding[si] * (Stats.IsPercentage(si) ? 100 : 1),7:#,0.0}" diff --git a/ARKBreedingStats/Properties/AssemblyInfo.cs b/ARKBreedingStats/Properties/AssemblyInfo.cs index a72a0a7d4..19ce661c1 100644 --- a/ARKBreedingStats/Properties/AssemblyInfo.cs +++ b/ARKBreedingStats/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // Revision // [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("0.62.0.0")] +[assembly: AssemblyFileVersion("0.63.0.0")] [assembly: NeutralResourcesLanguage("en")] diff --git a/ARKBreedingStats/SpeechRecognition.cs b/ARKBreedingStats/SpeechRecognition.cs index f0ae8c580..0ab09d471 100644 --- a/ARKBreedingStats/SpeechRecognition.cs +++ b/ARKBreedingStats/SpeechRecognition.cs @@ -15,7 +15,7 @@ public class SpeechRecognition public Action SpeechCreatureRecognized; public Action SpeechCommandRecognized; private readonly SpeechRecognitionEngine _recognizer; - public readonly Label indicator; + private readonly Label _indicator; private bool _listening; private int _maxLevel; private int _levelStep; @@ -26,7 +26,7 @@ public SpeechRecognition(int maxLevel, int levelStep, List aliases, Labe { Initialized = false; if (!aliases.Any()) return; - this.indicator = indicator; + _indicator = indicator; _recognizer = new SpeechRecognitionEngine(); SetMaxLevelAndSpecies(maxLevel, levelStep, aliases); _recognizer.SpeechRecognized += Sre_SpeechRecognized; @@ -38,7 +38,7 @@ public SpeechRecognition(int maxLevel, int levelStep, List aliases, Labe catch { MessageBoxes.ShowMessageBox("Couldn't set Audio-Input to default-audio device. The speech recognition will not work until a restart.\nTry to change the default-audio-input (e.g. plug-in a microphone).", - $"Microphone Error"); + "Microphone Error"); } _recognizer.SpeechRecognitionRejected += Recognizer_SpeechRecognitionRejected; } @@ -75,7 +75,7 @@ private void Sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) private void Blink(Color c) { - Utils.BlinkAsync(indicator, c); + Utils.BlinkAsync(_indicator, c); } private Grammar CreateTamingGrammar(int maxLevel, int levelSteps, List aliases, CultureInfo culture) @@ -109,20 +109,20 @@ public bool Listen try { _recognizer.RecognizeAsync(RecognizeMode.Multiple); - indicator.ForeColor = Color.Red; + _indicator.ForeColor = Color.Red; } catch { MessageBoxes.ShowMessageBox("Couldn't set Audio-Input to default-audio device. The speech recognition will not work until a restart.\nTry to change the default-audio-input (e.g. plug-in a microphone).", - $"Microphone Error"); + "Microphone Error"); _listening = false; - indicator.ForeColor = SystemColors.GrayText; + _indicator.ForeColor = SystemColors.GrayText; } } else { _recognizer.RecognizeAsyncStop(); - indicator.ForeColor = SystemColors.GrayText; + _indicator.ForeColor = SystemColors.GrayText; } } } @@ -144,15 +144,15 @@ public void SetMaxLevelAndSpecies(int maxLevel, int levelStep, List alia //recognizer.LoadGrammar(CreateCommandsGrammar()); // remove for now, it's too easy to say something that is recognized as "extract" and disturbes the play-flow } - private Grammar CreateCommandsGrammar() - { - // currently not used, appears to execute falsely too often. - Choices commands = new Choices("extract"); - GrammarBuilder commandsElement = new GrammarBuilder(commands); - - Grammar grammar = new Grammar(commandsElement); - return grammar; - } + //private Grammar CreateCommandsGrammar() + //{ + // // currently not used, appears to execute falsely too often. + // Choices commands = new Choices("extract"); + // GrammarBuilder commandsElement = new GrammarBuilder(commands); + // + // Grammar grammar = new Grammar(commandsElement); + // return grammar; + //} public void ToggleListening() { diff --git a/ARKBreedingStats/StatsOptions/HueControl.Designer.cs b/ARKBreedingStats/StatsOptions/LevelColorSettings/HueControl.Designer.cs similarity index 99% rename from ARKBreedingStats/StatsOptions/HueControl.Designer.cs rename to ARKBreedingStats/StatsOptions/LevelColorSettings/HueControl.Designer.cs index b0d3e4ba1..117c3f921 100644 --- a/ARKBreedingStats/StatsOptions/HueControl.Designer.cs +++ b/ARKBreedingStats/StatsOptions/LevelColorSettings/HueControl.Designer.cs @@ -1,6 +1,6 @@ using ARKBreedingStats.uiControls; -namespace ARKBreedingStats.StatsOptions +namespace ARKBreedingStats.StatsOptions.LevelColorSettings { partial class HueControl { diff --git a/ARKBreedingStats/StatsOptions/HueControl.cs b/ARKBreedingStats/StatsOptions/LevelColorSettings/HueControl.cs similarity index 95% rename from ARKBreedingStats/StatsOptions/HueControl.cs rename to ARKBreedingStats/StatsOptions/LevelColorSettings/HueControl.cs index c41edb59b..dbf558448 100644 --- a/ARKBreedingStats/StatsOptions/HueControl.cs +++ b/ARKBreedingStats/StatsOptions/LevelColorSettings/HueControl.cs @@ -5,7 +5,7 @@ using ARKBreedingStats.utils; using Newtonsoft.Json; -namespace ARKBreedingStats.StatsOptions +namespace ARKBreedingStats.StatsOptions.LevelColorSettings { public partial class HueControl : UserControl { @@ -214,9 +214,12 @@ private void UpdateLevelRepresentation(int dx, int dy) private void ResetColors() { - var defaultSettings = LevelGraphRepresentation.GetDefaultValue; - SetColor(defaultSettings.LowerColor, false, BtColorLow); - SetColor(defaultSettings.UpperColor, true, BtColorHigh); + var newSettings = LevelGraphRepresentation.GetDefaultValue; + if (newSettings == LevelGraphRepresentation) + newSettings = LevelGraphRepresentation.GetDefaultMutationLevelValue; + + SetColor(newSettings.LowerColor, false, BtColorLow); + SetColor(newSettings.UpperColor, true, BtColorHigh); } } } diff --git a/ARKBreedingStats/StatsOptions/HueControl.resx b/ARKBreedingStats/StatsOptions/LevelColorSettings/HueControl.resx similarity index 100% rename from ARKBreedingStats/StatsOptions/HueControl.resx rename to ARKBreedingStats/StatsOptions/LevelColorSettings/HueControl.resx diff --git a/ARKBreedingStats/StatsOptions/LevelColorSettings/LevelGraphOptionsControl.cs b/ARKBreedingStats/StatsOptions/LevelColorSettings/LevelGraphOptionsControl.cs new file mode 100644 index 000000000..17f350c80 --- /dev/null +++ b/ARKBreedingStats/StatsOptions/LevelColorSettings/LevelGraphOptionsControl.cs @@ -0,0 +1,36 @@ +using System.Windows.Forms; + +namespace ARKBreedingStats.StatsOptions.LevelColorSettings +{ + internal class LevelGraphOptionsControl : StatsOptionsControl + { + private StatLevelGraphOptionsControl[] _statOptionsControls; + + public LevelGraphOptionsControl(StatsOptionsSettings settings, ToolTip tt) : base(settings, tt) { } + + protected override void InitializeStatControls() + { + _statOptionsControls = new StatLevelGraphOptionsControl[Stats.StatsCount]; + foreach (var si in Stats.DisplayOrder) + { + var c = new StatLevelGraphOptionsControl($"[{si}] {Utils.StatName(si, true)}", si, Tt); + _statOptionsControls[si] = c; + StatsContainer.Controls.Add(c); + StatsContainer.SetFlowBreak(c, true); + } + StatsContainer.Controls.Add(new Label + { + Text = @"Drag color gradient with mouse for fast editing. +On color gradients use shift + right click to copy and shift + left click to paste color settings. +Ctrl + left click to cycle through presets.", + AutoSize = true + }); + } + + protected override void UpdateStatsControls(bool isNotRoot) + { + for (var si = 0; si < Stats.StatsCount; si++) + _statOptionsControls[si].SetStatOptions(SelectedStatsOptions.StatOptions?[si], isNotRoot, SelectedStatsOptions.ParentOptions); + } + } +} diff --git a/ARKBreedingStats/StatsOptions/LevelGraphRepresentation.cs b/ARKBreedingStats/StatsOptions/LevelColorSettings/LevelGraphRepresentation.cs similarity index 76% rename from ARKBreedingStats/StatsOptions/LevelGraphRepresentation.cs rename to ARKBreedingStats/StatsOptions/LevelColorSettings/LevelGraphRepresentation.cs index cc7032195..d46fe6fc9 100644 --- a/ARKBreedingStats/StatsOptions/LevelGraphRepresentation.cs +++ b/ARKBreedingStats/StatsOptions/LevelColorSettings/LevelGraphRepresentation.cs @@ -3,7 +3,7 @@ using ARKBreedingStats.utils; using Newtonsoft.Json; -namespace ARKBreedingStats.StatsOptions +namespace ARKBreedingStats.StatsOptions.LevelColorSettings { /// /// Representation of a level regarding chart scaling and colour. @@ -94,7 +94,7 @@ public Color UpperColor /// /// If false the hue value increases from the lower color to the upper color. /// - [JsonProperty("hueRev")] + [JsonProperty("hueRev", DefaultValueHandling = DefaultValueHandling.Ignore)] public bool ColorGradientReversed { get => _colorGradientReversed; @@ -145,6 +145,15 @@ public static Color GetStatLevelColor(int level, int statIndex) => UpperColor = Color.FromArgb(0, 255, 0) }; + public static LevelGraphRepresentation GetDefaultMutationLevelValue => new LevelGraphRepresentation + { + //ColorGradientReversed = true, + LowerBound = 0, + UpperBound = 255, + LowerColor = Color.Cyan, + UpperColor = Color.DeepPink + }; + public LevelGraphRepresentation Copy() => new LevelGraphRepresentation { @@ -154,5 +163,28 @@ public LevelGraphRepresentation Copy() => UpperColor = UpperColor, ColorGradientReversed = ColorGradientReversed }; + + public static bool operator ==(LevelGraphRepresentation a, LevelGraphRepresentation b) + { + if (ReferenceEquals(a, b)) return true; + if (ReferenceEquals(a, null)) return false; + if (ReferenceEquals(b, null)) return false; + return a.Equals(b); + } + + public static bool operator !=(LevelGraphRepresentation a, LevelGraphRepresentation b) => !(a == b); + + public bool Equals(LevelGraphRepresentation oth) + { + if (ReferenceEquals(oth, null)) return false; + if (ReferenceEquals(this, oth)) return true; + return oth.LowerBound == LowerBound + && oth.UpperBound == UpperBound + && oth.ColorGradientReversed == ColorGradientReversed + && oth.LowerColor == LowerColor + && oth.UpperColor == UpperColor; + } + + public override int GetHashCode() => $"{LowerBound}-{UpperBound}_{LowerColor}-{UpperColor}_{ColorGradientReversed}".GetHashCode(); } } diff --git a/ARKBreedingStats/StatsOptions/StatLevelColors.cs b/ARKBreedingStats/StatsOptions/LevelColorSettings/StatLevelColors.cs similarity index 55% rename from ARKBreedingStats/StatsOptions/StatLevelColors.cs rename to ARKBreedingStats/StatsOptions/LevelColorSettings/StatLevelColors.cs index 1cda8df80..2a46f5c51 100644 --- a/ARKBreedingStats/StatsOptions/StatLevelColors.cs +++ b/ARKBreedingStats/StatsOptions/LevelColorSettings/StatLevelColors.cs @@ -1,4 +1,5 @@ using System.Drawing; +using ARKBreedingStats.StatsOptions.LevelColorSettings; using Newtonsoft.Json; namespace ARKBreedingStats.StatsOptions @@ -21,38 +22,49 @@ public class StatLevelColors : StatOptionsBase [JsonProperty("lvlOdd", DefaultValueHandling = DefaultValueHandling.Ignore)] public LevelGraphRepresentation LevelGraphRepresentationOdd; + /// + /// If not null use this for mutation levels. + /// + [JsonProperty("lvlMut", DefaultValueHandling = DefaultValueHandling.Ignore)] + public LevelGraphRepresentation LevelGraphRepresentationMutation; + public bool UseDifferentColorsForOddLevels; + public bool UseDifferentColorsForMutationLevels; public StatLevelColors Copy() { var c = new StatLevelColors { - LevelGraphRepresentation = LevelGraphRepresentation.Copy(), - LevelGraphRepresentationOdd = LevelGraphRepresentationOdd.Copy(), + LevelGraphRepresentation = LevelGraphRepresentation?.Copy(), + LevelGraphRepresentationOdd = LevelGraphRepresentationOdd?.Copy(), + LevelGraphRepresentationMutation = LevelGraphRepresentationMutation?.Copy(), OverrideParent = OverrideParent }; return c; } - public Color GetLevelColor(int level) + private LevelGraphRepresentation GetLevelGraphRepresentation(int level, bool useCustomOdd, bool mutationLevel) { - var levelRepresentations = - UseDifferentColorsForOddLevels + if (mutationLevel + && UseDifferentColorsForMutationLevels + && LevelGraphRepresentationMutation != null) + return LevelGraphRepresentationMutation; + + if (useCustomOdd + && UseDifferentColorsForOddLevels && LevelGraphRepresentationOdd != null - && level % 2 == 1 - ? LevelGraphRepresentationOdd - : LevelGraphRepresentation; - return levelRepresentations.GetLevelColor(level); + && level % 2 == 1) + return LevelGraphRepresentationOdd; + + return LevelGraphRepresentation; } - public int GetLevelRange(int level, out int lowerBound) + public Color GetLevelColor(int level, bool useCustomOdd = true, bool mutationLevel = false) + => GetLevelGraphRepresentation(level, useCustomOdd, mutationLevel).GetLevelColor(level); + + public int GetLevelRange(int level, out int lowerBound, bool useCustomOdd = true, bool mutationLevel = false) { - var levelRepresentations = - UseDifferentColorsForOddLevels - && LevelGraphRepresentationOdd != null - && level % 2 == 1 - ? LevelGraphRepresentationOdd - : LevelGraphRepresentation; + var levelRepresentations = GetLevelGraphRepresentation(level, useCustomOdd, mutationLevel); lowerBound = levelRepresentations.LowerBound; return levelRepresentations.UpperBound - lowerBound; } @@ -66,10 +78,12 @@ public override void Initialize() OverrideParent = true; if (LevelGraphRepresentationOdd != null) UseDifferentColorsForOddLevels = true; + if (LevelGraphRepresentationMutation != null) + UseDifferentColorsForMutationLevels = true; } /// - /// Call before saving. + /// Call before saving. Sets unused settings to null. /// public override void PrepareForSaving() { @@ -77,16 +91,21 @@ public override void PrepareForSaving() { LevelGraphRepresentation = null; LevelGraphRepresentationOdd = null; + LevelGraphRepresentationMutation = null; + return; } - else if (!UseDifferentColorsForOddLevels) + if (!UseDifferentColorsForOddLevels) LevelGraphRepresentationOdd = null; + if (!UseDifferentColorsForMutationLevels) + LevelGraphRepresentationMutation = null; } public override bool DefinesData() => LevelGraphRepresentation != null; public static StatLevelColors GetDefault() => new StatLevelColors { - LevelGraphRepresentation = LevelGraphRepresentation.GetDefaultValue + LevelGraphRepresentation = LevelGraphRepresentation.GetDefaultValue, + LevelGraphRepresentationMutation = LevelGraphRepresentation.GetDefaultMutationLevelValue }; } } diff --git a/ARKBreedingStats/StatsOptions/StatLevelGraphOptionsControl.Designer.cs b/ARKBreedingStats/StatsOptions/LevelColorSettings/StatLevelGraphOptionsControl.Designer.cs similarity index 73% rename from ARKBreedingStats/StatsOptions/StatLevelGraphOptionsControl.Designer.cs rename to ARKBreedingStats/StatsOptions/LevelColorSettings/StatLevelGraphOptionsControl.Designer.cs index 3f0a9d3da..6d9a923ce 100644 --- a/ARKBreedingStats/StatsOptions/StatLevelGraphOptionsControl.Designer.cs +++ b/ARKBreedingStats/StatsOptions/LevelColorSettings/StatLevelGraphOptionsControl.Designer.cs @@ -1,6 +1,4 @@ -using ARKBreedingStats.uiControls; - -namespace ARKBreedingStats.StatsOptions +namespace ARKBreedingStats.StatsOptions.LevelColorSettings { partial class StatLevelGraphOptionsControl { @@ -37,6 +35,8 @@ private void InitializeComponent() this.hueControlOdd = new HueControl(); this.hueControl = new HueControl(); this.CbOverrideGraphSettings = new System.Windows.Forms.CheckBox(); + this.HueControlMutations = new HueControl(); + this.CbUseDifferentColorsForMutationLevels = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); // // LbStatName @@ -52,9 +52,10 @@ private void InitializeComponent() // panel1 // this.panel1.BackColor = System.Drawing.Color.Gray; + this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(936, 1); + this.panel1.Size = new System.Drawing.Size(1362, 1); this.panel1.TabIndex = 7; // // CbUseDifferentColorsForOddLevels @@ -94,10 +95,31 @@ private void InitializeComponent() this.CbOverrideGraphSettings.UseVisualStyleBackColor = true; this.CbOverrideGraphSettings.CheckedChanged += new System.EventHandler(this.CbOverrideGraphSettings_CheckedChanged); // - // StatOptionsControl + // HueControlMutations + // + this.HueControlMutations.Location = new System.Drawing.Point(1011, 3); + this.HueControlMutations.Name = "HueControlMutations"; + this.HueControlMutations.Size = new System.Drawing.Size(347, 24); + this.HueControlMutations.TabIndex = 13; + // + // CbUseDifferentColorsForMutationLevels + // + this.CbUseDifferentColorsForMutationLevels.AutoSize = true; + this.CbUseDifferentColorsForMutationLevels.Enabled = false; + this.CbUseDifferentColorsForMutationLevels.Location = new System.Drawing.Point(934, 8); + this.CbUseDifferentColorsForMutationLevels.Name = "CbUseDifferentColorsForMutationLevels"; + this.CbUseDifferentColorsForMutationLevels.Size = new System.Drawing.Size(71, 17); + this.CbUseDifferentColorsForMutationLevels.TabIndex = 12; + this.CbUseDifferentColorsForMutationLevels.Text = "mutations"; + this.CbUseDifferentColorsForMutationLevels.UseVisualStyleBackColor = true; + this.CbUseDifferentColorsForMutationLevels.CheckedChanged += new System.EventHandler(this.CbUseDifferentColorsForMutationLevels_CheckedChanged); + // + // StatLevelGraphOptionsControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.HueControlMutations); + this.Controls.Add(this.CbUseDifferentColorsForMutationLevels); this.Controls.Add(this.CbOverrideGraphSettings); this.Controls.Add(this.hueControlOdd); this.Controls.Add(this.hueControl); @@ -105,7 +127,7 @@ private void InitializeComponent() this.Controls.Add(this.panel1); this.Controls.Add(this.LbStatName); this.Name = "StatLevelGraphOptionsControl"; - this.Size = new System.Drawing.Size(936, 29); + this.Size = new System.Drawing.Size(1362, 29); this.ResumeLayout(false); this.PerformLayout(); @@ -120,5 +142,7 @@ private void InitializeComponent() private HueControl hueControl; private HueControl hueControlOdd; private System.Windows.Forms.CheckBox CbOverrideGraphSettings; + private HueControl HueControlMutations; + private System.Windows.Forms.CheckBox CbUseDifferentColorsForMutationLevels; } } diff --git a/ARKBreedingStats/StatsOptions/StatLevelGraphOptionsControl.cs b/ARKBreedingStats/StatsOptions/LevelColorSettings/StatLevelGraphOptionsControl.cs similarity index 63% rename from ARKBreedingStats/StatsOptions/StatLevelGraphOptionsControl.cs rename to ARKBreedingStats/StatsOptions/LevelColorSettings/StatLevelGraphOptionsControl.cs index ae4d1cb4f..f508c2ff4 100644 --- a/ARKBreedingStats/StatsOptions/StatLevelGraphOptionsControl.cs +++ b/ARKBreedingStats/StatsOptions/LevelColorSettings/StatLevelGraphOptionsControl.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Forms; -namespace ARKBreedingStats.StatsOptions +namespace ARKBreedingStats.StatsOptions.LevelColorSettings { public partial class StatLevelGraphOptionsControl : UserControl { @@ -21,6 +21,7 @@ public StatLevelGraphOptionsControl(string name, int statIndex, ToolTip tt) : th hueControl.UpdateTooltips(tt); hueControlOdd.UpdateTooltips(tt); tt.SetToolTip(CbUseDifferentColorsForOddLevels, "Use different colors for odd levels"); + tt.SetToolTip(CbUseDifferentColorsForMutationLevels, "Use different colors for mutation levels"); } public void SetStatOptions(StatLevelColors so, bool isNotRoot, StatsOptions parent) @@ -28,8 +29,10 @@ public void SetStatOptions(StatLevelColors so, bool isNotRoot, StatsOptions _selectedStatsOptions; - private readonly StatsOptionsSettings _statsOptionsSettings; - private Species _species; - private ComboBox _cbbOptions; - private ComboBox _cbbParent; - private Button _btRemove; - private TextBox _tbOptionsName; - private Label _lbParent; - public static Form DisplayedForm; - - public static void ShowWindow(Form parent, StatsOptionsSettings settings) - { - if (DisplayedForm != null) - { - DisplayedForm.BringToFront(); - return; - } - - var so = new LevelGraphOptionsControl(settings); - var f = new Form - { - FormBorderStyle = FormBorderStyle.SizableToolWindow, - Width = Properties.Settings.Default.LevelColorWindowRectangle.Width, - Height = Properties.Settings.Default.LevelColorWindowRectangle.Height, - StartPosition = FormStartPosition.Manual, - Location = new Point(Properties.Settings.Default.LevelColorWindowRectangle.X, Properties.Settings.Default.LevelColorWindowRectangle.Y) - }; - f.Controls.Add(so); - so.Dock = DockStyle.Fill; - DisplayedForm = f; - f.Closed += F_Closed; - f.Show(parent); - } - - private static void F_Closed(object sender, EventArgs e) - { - Properties.Settings.Default.LevelColorWindowRectangle = - new Rectangle(DisplayedForm.Left, DisplayedForm.Top, DisplayedForm.Width, DisplayedForm.Height); - DisplayedForm = null; - } - - public LevelGraphOptionsControl(StatsOptionsSettings settings) - { - _statsOptionsSettings = settings; - InitializeControls(); - InitializeOptions(); - } - - private void InitializeControls() - { - AutoScroll = true; - ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); - RowStyles.Add(new RowStyle(SizeType.AutoSize)); - RowStyles.Add(new RowStyle(SizeType.Percent, 100)); - - var flpHeaderControls = new FlowLayoutPanel { Dock = DockStyle.Fill }; - Controls.Add(flpHeaderControls, 0, 0); - var flpStatControls = new FlowLayoutPanel { Dock = DockStyle.Fill }; - Controls.Add(flpStatControls, 0, 1); - - var btNew = new Button { Width = 20, Height = 20 }; - _btRemove = new Button { Width = 20, Height = 20 }; - flpHeaderControls.Controls.Add(btNew); - flpHeaderControls.Controls.Add(_btRemove); - btNew.Click += BtNew_Click; - _btRemove.Click += BtRemove_Click; - _tt.SetToolTip(btNew, "Create new setting"); - _tt.SetToolTip(_btRemove, "Delete setting"); - InitButtonImages(btNew, _btRemove); - - _cbbOptions = new ComboBox { DropDownStyle = ComboBoxStyle.DropDownList }; - _cbbOptions.SelectedIndexChanged += CbbOptions_SelectedIndexChanged; - flpHeaderControls.Controls.Add(_cbbOptions); - - _tbOptionsName = new TextBox(); - flpHeaderControls.Controls.Add(_tbOptionsName); - _tbOptionsName.Leave += TbOptionsName_Leave; - - _lbParent = new Label { Text = "depends on", Margin = new Padding(5, 7, 5, 0), AutoSize = true }; - flpHeaderControls.Controls.Add(_lbParent); - - _cbbParent = new ComboBox { DropDownStyle = ComboBoxStyle.DropDownList }; - _cbbParent.SelectedIndexChanged += CbbParent_SelectedIndexChanged; - flpHeaderControls.Controls.Add(_cbbParent); - - InitializeStatControls(flpStatControls); - } - - private void InitializeStatControls(FlowLayoutPanel flpStatControls) - { - _statOptionsControls = new StatLevelGraphOptionsControl[Stats.StatsCount]; - foreach (var si in Stats.DisplayOrder) - { - var c = new StatLevelGraphOptionsControl($"[{si}] {Utils.StatName(si, true)}", si, _tt); - _statOptionsControls[si] = c; - flpStatControls.Controls.Add(c); - flpStatControls.SetFlowBreak(c, true); - } - flpStatControls.Controls.Add(new Label - { - Text = @"Drag color gradient with mouse for fast editing. -On color gradients use shift + right click to copy and shift + left click to paste color settings. -Ctrl + left click to reset colors.", - AutoSize = true - }); - } - - public void InitializeOptions() - { - _selectedStatsOptions = null; - _cbbOptions.Items.Clear(); - _cbbParent.Items.Clear(); - - var statsOptions = _statsOptionsSettings.StatsOptionsDict.Values.OrderBy(n => n.Name).ToArray(); - _cbbOptions.Items.AddRange(statsOptions); - _cbbParent.Items.AddRange(statsOptions); - if (_cbbOptions.Items.Count > 0) - _cbbOptions.SelectedIndex = 0; - } - - private void CbbOptions_SelectedIndexChanged(object sender, EventArgs e) - { - _selectedStatsOptions = _cbbOptions.SelectedItem as StatsOptions; - if (_selectedStatsOptions == null) return; - - this.SuspendDrawing(); - _tbOptionsName.Text = _selectedStatsOptions.ToString(); - var isNotRoot = _selectedStatsOptions.Name != string.Empty; - _tbOptionsName.Enabled = isNotRoot; - _lbParent.Visible = isNotRoot; - _cbbParent.Visible = isNotRoot; - _btRemove.Visible = isNotRoot; - for (var si = 0; si < Stats.StatsCount; si++) - _statOptionsControls[si].SetStatOptions(_selectedStatsOptions.StatOptions?[si], isNotRoot, _selectedStatsOptions.ParentOptions); - - _cbbParent.SelectedItem = _selectedStatsOptions.ParentOptions; - this.ResumeDrawing(); - } - - private void CbbParent_SelectedIndexChanged(object sender, EventArgs e) - { - _selectedStatsOptions = _cbbOptions.SelectedItem as StatsOptions; - if (_selectedStatsOptions == null) return; - _selectedStatsOptions.ParentOptions = _cbbParent.SelectedItem as StatsOptions; - } - - private void TbOptionsName_Leave(object sender, EventArgs e) - { - var newNameBase = _tbOptionsName.Text; - if (_selectedStatsOptions.Name == newNameBase) return; // nothing to change - var newName = newNameBase; - var suffix = 1; - while (_statsOptionsSettings.StatsOptionsDict.ContainsKey(newName)) - newName = newNameBase + "_" + ++suffix; - - _tbOptionsName.Text = newName; - _statsOptionsSettings.StatsOptionsDict.Remove(_selectedStatsOptions.Name); - _selectedStatsOptions.Name = newName; - _statsOptionsSettings.StatsOptionsDict.Add(newName, _selectedStatsOptions); - // update text in combobox - _cbbOptions.Items[_cbbOptions.SelectedIndex] = _selectedStatsOptions; - } - - private void BtNew_Click(object sender, EventArgs e) - { - var newNameBase = _species?.name ?? "new entry"; - var newName = newNameBase; - var suffix = 1; - while (_statsOptionsSettings.StatsOptionsDict.ContainsKey(newName)) - newName = newNameBase + "_" + ++suffix; - var newSettings = _statsOptionsSettings.GetDefaultStatOptions(newName); - _statsOptionsSettings.StatsOptionsDict.Add(newName, newSettings); - InitializeOptions(); - _cbbOptions.SelectedItem = newSettings; - } - - private void BtRemove_Click(object sender, EventArgs e) - { - if (_selectedStatsOptions == null - || MessageBox.Show("Delete stat options\n" + _selectedStatsOptions + "\n?", "Delete?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) - != DialogResult.Yes) return; - - var index = _cbbOptions.SelectedIndex; - // set parent of dependant options to parent of this setting - foreach (var so in _statsOptionsSettings.StatsOptionsDict.Values) - { - if (so.ParentOptions == _selectedStatsOptions) - so.ParentOptions = _selectedStatsOptions.ParentOptions; - } - - _statsOptionsSettings.StatsOptionsDict.Remove(_selectedStatsOptions.Name); - - InitializeOptions(); - if (_cbbOptions.Items.Count > 0) - _cbbOptions.SelectedIndex = Math.Max(0, index - 1); // select item before deleted one - } - - public void SetSpecies(Species s) - { - _species = s; - if (_species == null) return; - var autoCompleteList = new AutoCompleteStringCollection(); - autoCompleteList.AddRange(new[] - { - _species.name, - _species.DescriptiveName, - _species.DescriptiveNameAndMod, - _species.blueprintPath - }); - - _tbOptionsName.AutoCompleteCustomSource = autoCompleteList; - } - - private static void InitButtonImages(Button btNew, Button btRemove) - { - const int size = 12; - var bmp = new Bitmap(size, size); - using (var g = Graphics.FromImage(bmp)) - using (var p = new Pen(Brushes.DarkGreen)) - { - g.DrawRectangle(p, size / 3, 0, size / 3 - 1, size - 1); - g.DrawRectangle(p, 0, size / 3, size - 1, size / 3 - 1); - g.FillRectangle(Brushes.LightGreen, size / 3 + 1, 1, size / 3 - 2, size - 2); - g.FillRectangle(Brushes.LightGreen, 1, size / 3 + 1, size - 2, size / 3 - 2); - } - btNew.Image = bmp; - - bmp = new Bitmap(size, size); - using (var g = Graphics.FromImage(bmp)) - using (var p = new Pen(Brushes.DarkRed)) - { - g.DrawRectangle(p, 0, size / 3, size - 1, size / 3 - 1); - g.FillRectangle(Brushes.LightPink, 1, size / 3 + 1, size - 2, size / 3 - 2); - } - btRemove.Image = bmp; - } - } -} diff --git a/ARKBreedingStats/StatsOptions/StatsOptions.cs b/ARKBreedingStats/StatsOptions/StatsOptions.cs index 45e77ccf5..dc1248e4a 100644 --- a/ARKBreedingStats/StatsOptions/StatsOptions.cs +++ b/ARKBreedingStats/StatsOptions/StatsOptions.cs @@ -1,12 +1,4 @@ -using ARKBreedingStats.species; -using ARKBreedingStats.utils; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Newtonsoft.Json; namespace ARKBreedingStats.StatsOptions { @@ -16,17 +8,16 @@ namespace ARKBreedingStats.StatsOptions [JsonObject(MemberSerialization.OptIn)] public class StatsOptions where T : StatOptionsBase { - /// - /// Name of the stats options, usually a species name. + /// Name of the stats options, usually a species name or a group. /// [JsonProperty] public string Name; - public override string ToString() => string.IsNullOrEmpty(Name) ? $"<{Loc.S("default")}>" : Name; + public override string ToString() => string.IsNullOrEmpty(Name) ? $"<{Loc.S("default")}>" : new string(' ', HierarchyLevel * 2) + Name; /// - /// Name of the parent setting + /// Name of the parent setting. /// [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public string ParentName; @@ -38,5 +29,7 @@ public class StatsOptions where T : StatOptionsBase /// [JsonProperty] public T[] StatOptions; + + public int HierarchyLevel; } } diff --git a/ARKBreedingStats/StatsOptions/StatsOptionsControl.cs b/ARKBreedingStats/StatsOptions/StatsOptionsControl.cs new file mode 100644 index 000000000..9c177d044 --- /dev/null +++ b/ARKBreedingStats/StatsOptions/StatsOptionsControl.cs @@ -0,0 +1,269 @@ +using ARKBreedingStats.species; +using ARKBreedingStats.utils; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; + +namespace ARKBreedingStats.StatsOptions +{ + /// + /// Base control for stats options. Displays selector for species settings. + /// + internal class StatsOptionsControl : TableLayoutPanel where T : StatOptionsBase + { + protected ComboBox CbbOptions; + protected ComboBox CbbParent; + protected Species Species; + protected Button BtRemove; + protected TextBox TbOptionsName; + protected Label LbParent; + protected StatsOptions SelectedStatsOptions; + protected StatsOptionsSettings StatsOptionsSettings; + protected FlowLayoutPanel StatsContainer; + protected ToolTip Tt; + private bool _ignoreIndexChange; + + public StatsOptionsControl() { } + + public StatsOptionsControl(StatsOptionsSettings settings, ToolTip tt) + { + InitializeControls(settings, tt); + } + + protected void InitializeControls(StatsOptionsSettings settings, ToolTip tt) + { + StatsOptionsSettings = settings; + Tt = tt; + + AutoScroll = true; + ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); + RowStyles.Add(new RowStyle(SizeType.AutoSize)); + RowStyles.Add(new RowStyle(SizeType.Percent, 100)); + + var flpHeaderControls = new FlowLayoutPanel { Dock = DockStyle.Fill }; + Controls.Add(flpHeaderControls, 0, 0); + StatsContainer = new FlowLayoutPanel { Dock = DockStyle.Fill }; + StatsContainer.AutoScroll = true; + Controls.Add(StatsContainer, 0, 1); + + var btNew = new Button { Width = 20, Height = 20 }; + BtRemove = new Button { Width = 20, Height = 20 }; + flpHeaderControls.Controls.Add(btNew); + flpHeaderControls.Controls.Add(BtRemove); + btNew.Click += BtNew_Click; + BtRemove.Click += BtRemove_Click; + tt.SetToolTip(btNew, "Create new setting"); + tt.SetToolTip(BtRemove, "Delete setting"); + InitButtonImages(btNew, BtRemove); + + CbbOptions = new ComboBox { DropDownStyle = ComboBoxStyle.DropDownList }; + CbbOptions.SelectedIndexChanged += CbbOptions_SelectedIndexChanged; + flpHeaderControls.Controls.Add(CbbOptions); + + TbOptionsName = new TextBox(); + flpHeaderControls.Controls.Add(TbOptionsName); + TbOptionsName.Leave += TbOptionsName_Leave; + + LbParent = new Label { Text = "depends on", Margin = new Padding(5, 7, 5, 0), AutoSize = true }; + tt.SetToolTip(LbParent, "If the current setting has no value for a stat, the parent's values are used."); + flpHeaderControls.Controls.Add(LbParent); + + CbbParent = new ComboBox { DropDownStyle = ComboBoxStyle.DropDownList }; + CbbParent.SelectedIndexChanged += CbbParent_SelectedIndexChanged; + flpHeaderControls.Controls.Add(CbbParent); + + InitializeStatControls(); + InitializeOptions(); + } + + protected virtual void InitializeStatControls() { } + + protected void InitializeOptions(bool reselectItem = false) + { + _ignoreIndexChange = true; + CbbOptions.Items.Clear(); + CbbParent.Items.Clear(); + + var statsOptions = TreeOrder(StatsOptionsSettings.StatsOptionsDict); + CbbOptions.Items.AddRange(statsOptions); + CbbParent.Items.AddRange(statsOptions); + + if (reselectItem) + { + CbbOptions.SelectedItem = SelectedStatsOptions; + CbbParent.SelectedItem = SelectedStatsOptions.ParentOptions; + } + _ignoreIndexChange = false; + if (CbbOptions.SelectedItem == null && CbbOptions.Items.Count > 0) + CbbOptions.SelectedIndex = 0; + } + + private void BtNew_Click(object sender, EventArgs e) + { + var newNameBase = Species?.name ?? "new entry"; + var newName = newNameBase; + var suffix = 1; + while (StatsOptionsSettings.StatsOptionsDict.ContainsKey(newName)) + newName = newNameBase + "_" + ++suffix; + var newSettings = StatsOptionsSettings.GetDefaultStatOptions(newName); + StatsOptionsSettings.StatsOptionsDict.Add(newName, newSettings); + InitializeOptions(); + CbbOptions.SelectedItem = newSettings; + TbOptionsName.Focus(); + TbOptionsName.SelectAll(); + } + + private void BtRemove_Click(object sender, EventArgs e) + { + if (SelectedStatsOptions == null + || MessageBox.Show("Delete stat options\n" + SelectedStatsOptions.Name + "\n?", "Delete?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) + != DialogResult.Yes) return; + + var index = CbbOptions.SelectedIndex; + // set parent of dependant options to parent of this setting + foreach (var so in StatsOptionsSettings.StatsOptionsDict.Values) + { + if (so.ParentOptions == SelectedStatsOptions) + so.ParentOptions = SelectedStatsOptions.ParentOptions; + } + + StatsOptionsSettings.StatsOptionsDict.Remove(SelectedStatsOptions.Name); + + InitializeOptions(); + if (CbbOptions.Items.Count > 0) + CbbOptions.SelectedIndex = Math.Max(0, index - 1); // select item before deleted one + StatsOptionsSettings.ClearSpeciesCache(); + } + + private void CbbOptions_SelectedIndexChanged(object sender, EventArgs e) + { + if (_ignoreIndexChange) return; + SelectedStatsOptions = CbbOptions.SelectedItem as StatsOptions; + if (SelectedStatsOptions == null) return; + + this.SuspendDrawing(); + TbOptionsName.Text = SelectedStatsOptions.ToString(); + var isNotRoot = SelectedStatsOptions.Name != string.Empty; + TbOptionsName.Enabled = isNotRoot; + LbParent.Visible = isNotRoot; + CbbParent.Visible = isNotRoot; + BtRemove.Visible = isNotRoot; + + UpdateStatsControls(isNotRoot); + + CbbParent.SelectedItem = SelectedStatsOptions.ParentOptions; + this.ResumeDrawing(); + } + + /// + /// Override this method to update the UI of the stat controls. + /// + protected virtual void UpdateStatsControls(bool isNotRoot) { } + + private void CbbParent_SelectedIndexChanged(object sender, EventArgs e) + { + if (_ignoreIndexChange) return; + SelectedStatsOptions = CbbOptions.SelectedItem as StatsOptions; + if (SelectedStatsOptions == null) return; + SelectedStatsOptions.ParentOptions = CbbParent.SelectedItem as StatsOptions; + InitializeOptions(true); + StatsOptionsSettings.ClearSpeciesCache(); + } + + private void TbOptionsName_Leave(object sender, EventArgs e) + { + var newNameBase = TbOptionsName.Text; + if (SelectedStatsOptions.Name == newNameBase) return; // nothing to change + var newName = newNameBase; + var suffix = 1; + while (StatsOptionsSettings.StatsOptionsDict.ContainsKey(newName)) + newName = newNameBase + "_" + ++suffix; + + TbOptionsName.Text = newName; + StatsOptionsSettings.StatsOptionsDict.Remove(SelectedStatsOptions.Name); + SelectedStatsOptions.Name = newName; + StatsOptionsSettings.StatsOptionsDict.Add(newName, SelectedStatsOptions); + // update text in combobox + CbbOptions.Items[CbbOptions.SelectedIndex] = SelectedStatsOptions; + StatsOptionsSettings.ClearSpeciesCache(); + } + + private static void InitButtonImages(Button btNew, Button btRemove) + { + const int size = 12; + var bmp = new Bitmap(size, size); + using (var g = Graphics.FromImage(bmp)) + using (var p = new Pen(Brushes.DarkGreen)) + { + g.DrawRectangle(p, size / 3, 0, size / 3 - 1, size - 1); + g.DrawRectangle(p, 0, size / 3, size - 1, size / 3 - 1); + g.FillRectangle(Brushes.LightGreen, size / 3 + 1, 1, size / 3 - 2, size - 2); + g.FillRectangle(Brushes.LightGreen, 1, size / 3 + 1, size - 2, size / 3 - 2); + } + btNew.Image = bmp; + + bmp = new Bitmap(size, size); + using (var g = Graphics.FromImage(bmp)) + using (var p = new Pen(Brushes.DarkRed)) + { + g.DrawRectangle(p, 0, size / 3, size - 1, size / 3 - 1); + g.FillRectangle(Brushes.LightPink, 1, size / 3 + 1, size - 2, size / 3 - 2); + } + btRemove.Image = bmp; + } + + public void SetSpecies(Species s) + { + Species = s; + if (Species == null) return; + var autoCompleteList = new AutoCompleteStringCollection(); + autoCompleteList.AddRange(new[] + { + Species.name, + Species.DescriptiveName, + Species.DescriptiveNameAndMod, + Species.blueprintPath + }); + + TbOptionsName.AutoCompleteCustomSource = autoCompleteList; + } + + /// + /// Returns array ordered like the tree. + /// + private StatsOptions[] TreeOrder(Dictionary> dict) + { + var nodeChildren = dict.ToDictionary(kv => kv.Value, kv => new List>()); + foreach (var item in dict) + { + if (item.Value.ParentOptions != null && nodeChildren.TryGetValue(item.Value.ParentOptions, out var parent)) + parent.Add(item.Value); + } + + if (!dict.TryGetValue(string.Empty, out var rootNode)) + return Array.Empty>(); + + var sortedList = new List> { rootNode }; + var level = 0; + AddChildren(rootNode); + + void AddChildren(StatsOptions n) + { + if (!nodeChildren.TryGetValue(n, out var children)) return; + + level++; + foreach (var item in children.OrderBy(cn => cn.Name)) + { + item.HierarchyLevel = level; + sortedList.Add(item); + AddChildren(item); + } + level--; + } + + return sortedList.ToArray(); + } + } +} diff --git a/ARKBreedingStats/StatsOptions/StatsOptionsForm.cs b/ARKBreedingStats/StatsOptions/StatsOptionsForm.cs new file mode 100644 index 000000000..a4cdd87da --- /dev/null +++ b/ARKBreedingStats/StatsOptions/StatsOptionsForm.cs @@ -0,0 +1,67 @@ +using ARKBreedingStats.StatsOptions.LevelColorSettings; +using System; +using System.Drawing; +using System.Windows.Forms; +using ARKBreedingStats.StatsOptions.TopStatsSettings; + +namespace ARKBreedingStats.StatsOptions +{ + internal class StatsOptionsForm : Form + { + private static StatsOptionsForm _displayedForm; + protected readonly ToolTip Tt = new ToolTip(); + + public static void ShowWindow(Form parent, + StatsOptionsSettings levelColorSettings, + StatsOptionsSettings topStatsSettings, + int selectTabPageIndex = 0 + ) + { + if (_displayedForm != null) + { + _displayedForm.BringToFront(); + return; + } + + var f = new StatsOptionsForm + { + FormBorderStyle = FormBorderStyle.SizableToolWindow, + Width = Properties.Settings.Default.LevelColorWindowRectangle.Width, + Height = Properties.Settings.Default.LevelColorWindowRectangle.Height, + StartPosition = FormStartPosition.Manual, + Location = new Point(Properties.Settings.Default.LevelColorWindowRectangle.X, Properties.Settings.Default.LevelColorWindowRectangle.Y) + }; + + // stat settings tab + var tabs = new TabControl(); + tabs.Dock = DockStyle.Fill; + + AddAndDock(new LevelGraphOptionsControl(levelColorSettings, f.Tt), levelColorSettings.SettingsName); + AddAndDock(new ConsiderTopStatsControl(topStatsSettings, f.Tt), topStatsSettings.SettingsName); + + void AddAndDock(Control c, string tabName) + { + var tabPage = new TabPage(tabName); + c.Dock = DockStyle.Fill; + tabPage.Controls.Add(c); + tabs.Controls.Add(tabPage); + } + + f.Controls.Add(tabs); + tabs.SelectedIndex = selectTabPageIndex; + _displayedForm = f; + f.Closed += F_Closed; + f.Show(parent); + } + + private static void F_Closed(object sender, EventArgs e) + { + if (_displayedForm == null) return; + Properties.Settings.Default.LevelColorWindowRectangle = + new Rectangle(_displayedForm.Left, _displayedForm.Top, _displayedForm.Width, _displayedForm.Height); + _displayedForm.Tt.RemoveAll(); + _displayedForm.Tt.Dispose(); + _displayedForm = null; + } + } +} diff --git a/ARKBreedingStats/StatsOptions/StatsOptionsSettings.cs b/ARKBreedingStats/StatsOptions/StatsOptionsSettings.cs index b04b784fb..9a41252f9 100644 --- a/ARKBreedingStats/StatsOptions/StatsOptionsSettings.cs +++ b/ARKBreedingStats/StatsOptions/StatsOptionsSettings.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using ARKBreedingStats.species; +using ARKBreedingStats.StatsOptions.TopStatsSettings; using ARKBreedingStats.utils; namespace ARKBreedingStats.StatsOptions @@ -15,14 +16,29 @@ public class StatsOptionsSettings where T : StatOptionsBase { public Dictionary> StatsOptionsDict; + public event Action SettingsChanged; + + /// + /// List of cached stat options in species. + /// + private readonly Dictionary> _cache = new Dictionary>(); + /// /// Name of the settings file. /// private readonly string _settingsFileName; - public StatsOptionsSettings(string settingsFileName) + /// + /// Descriptive name of these settings. + /// + public readonly string SettingsName; + + public string SettingsFilePath => FileService.GetJsonPath(_settingsFileName); + + public StatsOptionsSettings(string settingsFileName, string settingsName) { _settingsFileName = settingsFileName; + SettingsName = settingsName; LoadSettings(settingsFileName); } @@ -78,6 +94,12 @@ public StatsOptions GetDefaultStatOptions(string name) statOptions = Enumerable.Range(0, Stats.StatsCount) .Select(si => StatLevelColors.GetDefault() as T).ToArray(); } + else if (typeof(T) == typeof(ConsiderTopStats)) + { + var statIndicesToConsiderDefault = new[] { Stats.Health, Stats.Stamina, Stats.Weight, Stats.MeleeDamageMultiplier }; + statOptions = Enumerable.Range(0, Stats.StatsCount) + .Select(si => new ConsiderTopStats { OverrideParent = true, ConsiderStat = statIndicesToConsiderDefault.Contains(si) } as T).ToArray(); + } else { throw new ArgumentOutOfRangeException($"Unknown type {typeof(T)}, no default value defined"); @@ -123,15 +145,30 @@ public void SaveSettings() /// public StatsOptions GetStatsOptions(Species species) { - if (species == null || StatsOptionsDict == null) return null; + if (string.IsNullOrEmpty(species?.blueprintPath) || StatsOptionsDict == null) return null; + + if (_cache.TryGetValue(species.blueprintPath, out var o)) return o; - if (StatsOptionsDict.TryGetValue(species.blueprintPath, out var o) + StatsOptions speciesStatsOptions; + if (StatsOptionsDict.TryGetValue(species.blueprintPath, out o) || StatsOptionsDict.TryGetValue(species.DescriptiveNameAndMod, out o) || StatsOptionsDict.TryGetValue(species.DescriptiveName, out o) || StatsOptionsDict.TryGetValue(species.name, out o)) - return GenerateStatsOptions(o); - if (StatsOptionsDict.TryGetValue(string.Empty, out o)) return o; // default settings - return null; + { + speciesStatsOptions = GenerateStatsOptions(o); + } + else if (StatsOptionsDict.TryGetValue(string.Empty, out o)) + { + speciesStatsOptions = o; // default settings + } + else + { + // error, on default settings available + return null; + } + + _cache[species.blueprintPath] = speciesStatsOptions; + return speciesStatsOptions; } /// @@ -167,5 +204,14 @@ private StatsOptions GenerateStatsOptions(StatsOptions so) return finalStatsOptions; } + + /// + /// Clear species cache when settings were changed. + /// + public void ClearSpeciesCache() + { + _cache.Clear(); + SettingsChanged?.Invoke(); + } } } diff --git a/ARKBreedingStats/StatsOptions/StatsOptionsWindow.Designer.cs b/ARKBreedingStats/StatsOptions/StatsOptionsWindow.Designer.cs deleted file mode 100644 index 4cc8e0b82..000000000 --- a/ARKBreedingStats/StatsOptions/StatsOptionsWindow.Designer.cs +++ /dev/null @@ -1,88 +0,0 @@ -namespace ARKBreedingStats.StatsOptions -{ - partial class StatsOptionsWindow - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this.tabControl1.SuspendLayout(); - this.SuspendLayout(); - // - // tabControl1 - // - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControl1.Location = new System.Drawing.Point(0, 0); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(800, 450); - this.tabControl1.TabIndex = 0; - // - // tabPage1 - // - this.tabPage1.Location = new System.Drawing.Point(4, 22); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(792, 424); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "Breeding Stats Weighting"; - this.tabPage1.UseVisualStyleBackColor = true; - // - // tabPage2 - // - this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(792, 424); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "Level Colors"; - this.tabPage2.UseVisualStyleBackColor = true; - // - // StatsOptionsWindow - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Controls.Add(this.tabControl1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.Name = "StatsOptionsWindow"; - this.Text = "Stats Options"; - this.tabControl1.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; - } -} \ No newline at end of file diff --git a/ARKBreedingStats/StatsOptions/StatsOptionsWindow.cs b/ARKBreedingStats/StatsOptions/StatsOptionsWindow.cs deleted file mode 100644 index 2fbfc658b..000000000 --- a/ARKBreedingStats/StatsOptions/StatsOptionsWindow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Windows.Forms; - -namespace ARKBreedingStats.StatsOptions -{ - public partial class StatsOptionsWindow : Form - { - public StatsOptionsWindow() - { - InitializeComponent(); - } - } -} diff --git a/ARKBreedingStats/StatsOptions/StatsOptionsWindow.resx b/ARKBreedingStats/StatsOptions/StatsOptionsWindow.resx deleted file mode 100644 index 1af7de150..000000000 --- a/ARKBreedingStats/StatsOptions/StatsOptionsWindow.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/ARKBreedingStats/StatsOptions/TopStatsSettings/ConsiderTopStats.cs b/ARKBreedingStats/StatsOptions/TopStatsSettings/ConsiderTopStats.cs new file mode 100644 index 000000000..cfc5a5db8 --- /dev/null +++ b/ARKBreedingStats/StatsOptions/TopStatsSettings/ConsiderTopStats.cs @@ -0,0 +1,38 @@ +using Newtonsoft.Json; + +namespace ARKBreedingStats.StatsOptions.TopStatsSettings +{ + /// + /// Setting which stats are considered in top stats calculation. + /// + [JsonObject(MemberSerialization.OptIn)] + internal class ConsiderTopStats : StatOptionsBase + { + [JsonProperty("top", DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool ConsiderStat; + + /// + /// Override parent setting. + /// + [JsonProperty("ovr", DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool OverrideParentBool; + + public override void Initialize() + { + OverrideParent = OverrideParentBool; + } + + public override void PrepareForSaving() + { + OverrideParentBool = OverrideParent; + } + + public override bool DefinesData() => true; + + public static ConsiderTopStats GetDefault() => new ConsiderTopStats + { + OverrideParent = true, + ConsiderStat = true + }; + } +} diff --git a/ARKBreedingStats/StatsOptions/TopStatsSettings/ConsiderTopStatsControl.cs b/ARKBreedingStats/StatsOptions/TopStatsSettings/ConsiderTopStatsControl.cs new file mode 100644 index 000000000..623ee9773 --- /dev/null +++ b/ARKBreedingStats/StatsOptions/TopStatsSettings/ConsiderTopStatsControl.cs @@ -0,0 +1,72 @@ +using System.Windows.Forms; + +namespace ARKBreedingStats.StatsOptions.TopStatsSettings +{ + internal class ConsiderTopStatsControl : StatsOptionsControl + { + private readonly CheckBox[] _controlsConsiderAsTopStats = new CheckBox[Stats.StatsCount]; + private readonly CheckBox[] _controlsOverrideParent = new CheckBox[Stats.StatsCount]; + private readonly CheckBox _cbOverrideAll = new CheckBox(); + + public ConsiderTopStatsControl(StatsOptionsSettings settings, ToolTip tt) : base(settings, tt) { } + + protected override void InitializeStatControls() + { + _cbOverrideAll.Text = "override all"; + _cbOverrideAll.Click += (s, e) => + { + var isChecked = ((CheckBox)s).Checked; + for (var i = 0; i < _controlsOverrideParent.Length; i++) + { + _controlsOverrideParent[i].Checked = isChecked; + SelectedStatsOptions.StatOptions[i].OverrideParent = isChecked; + } + }; + StatsContainer.Controls.Add(_cbOverrideAll); + + var cb = new CheckBox { Text = "consider all" }; + cb.Click += (s, e) => + { + var isChecked = ((CheckBox)s).Checked; + for (var i = 0; i < _controlsConsiderAsTopStats.Length; i++) + { + _controlsConsiderAsTopStats[i].Checked = isChecked; + SelectedStatsOptions.StatOptions[i].ConsiderStat = isChecked; + } + }; + StatsContainer.Controls.Add(cb); + StatsContainer.SetFlowBreak(cb, true); + + foreach (var si in Stats.DisplayOrder) + { + var locVar = si; + var c = new CheckBox { Text = "override" }; + c.Click += (s, e) => + SelectedStatsOptions.StatOptions[locVar].OverrideParent = ((CheckBox)s).Checked; + _controlsOverrideParent[si] = c; + StatsContainer.Controls.Add(c); + + c = new CheckBox { Text = $"[{si}] {Utils.StatName(si)}" }; + c.Click += (s, e) => + { + SelectedStatsOptions.StatOptions[locVar].ConsiderStat = ((CheckBox)s).Checked; + SelectedStatsOptions.StatOptions[locVar].OverrideParent = true; + }; + _controlsConsiderAsTopStats[si] = c; + StatsContainer.Controls.Add(c); + StatsContainer.SetFlowBreak(c, true); + } + } + + protected override void UpdateStatsControls(bool isNotRoot) + { + _cbOverrideAll.Visible = isNotRoot; + for (var si = 0; si < Stats.StatsCount; si++) + { + _controlsOverrideParent[si].Checked = !isNotRoot || SelectedStatsOptions.StatOptions[si].OverrideParent; + _controlsOverrideParent[si].Visible = isNotRoot; + _controlsConsiderAsTopStats[si].Checked = SelectedStatsOptions.StatOptions[si].ConsiderStat; + } + } + } +} diff --git a/ARKBreedingStats/Utils.cs b/ARKBreedingStats/Utils.cs index 748907316..bbaf15ebd 100644 --- a/ARKBreedingStats/Utils.cs +++ b/ARKBreedingStats/Utils.cs @@ -684,22 +684,24 @@ public static void SetWindowRectangle(Form form, Rectangle windowRect, bool maxi else { // check if rectangle is on screen - bool isOnScreen = false; + bool centerIsOnScreen = false; foreach (Screen screen in Screen.AllScreens) { - if (screen.WorkingArea.Contains(windowRect)) + if (screen.WorkingArea.Contains(Center(windowRect))) { - isOnScreen = true; + centerIsOnScreen = true; break; } } - if (!isOnScreen) + if (!centerIsOnScreen) { windowRect.X = 100; windowRect.Y = 100; } } + Point Center(Rectangle rect) => new Point(rect.Left + rect.Width / 2, rect.Top + rect.Height / 2); + form.Top = windowRect.Top; form.Left = windowRect.Left; form.Width = windowRect.Width; diff --git a/ARKBreedingStats/_manifest.json b/ARKBreedingStats/_manifest.json index 5d38d3337..1c57342a0 100644 --- a/ARKBreedingStats/_manifest.json +++ b/ARKBreedingStats/_manifest.json @@ -4,7 +4,7 @@ "ARK Smart Breeding": { "Id": "ARK Smart Breeding", "Category": "main", - "version": "0.62.0.0" + "version": "0.63.0.0" }, "SpeciesColorImages": { "Id": "SpeciesColorImages", diff --git a/ARKBreedingStats/importExported/ExportedCreatureControl.cs b/ARKBreedingStats/importExported/ExportedCreatureControl.cs index bb7db7a2d..335ed718d 100644 --- a/ARKBreedingStats/importExported/ExportedCreatureControl.cs +++ b/ARKBreedingStats/importExported/ExportedCreatureControl.cs @@ -25,6 +25,11 @@ public ExportedCreatureControl() { InitializeComponent(); validValues = true; + Disposed += (s, e) => + { + _tt.RemoveAll(); + _tt.Dispose(); + }; } public ExportedCreatureControl(string filePath) : this() @@ -43,17 +48,10 @@ public ExportedCreatureControl(string filePath) : this() groupBox1.Text = $"{creatureValues.name} ({(creatureValues.Species?.name ?? "unknown species")}, Lvl {creatureValues.level}), " + $"exported at {Utils.ShortTimeDate(creatureValues.domesticatedAt)}. " + $"Filename: {Path.GetFileName(filePath)}"; - Disposed += ExportedCreatureControl_Disposed; _tt.SetToolTip(btRemoveFile, "Delete the exported game-file"); } - private void ExportedCreatureControl_Disposed(object sender, EventArgs e) - { - _tt.RemoveAll(); - _tt.Dispose(); - } - private void btLoadValues_Click(object sender, EventArgs e) { CopyValuesToExtractor?.Invoke(this, false, false); @@ -112,27 +110,28 @@ private void btRemoveFile_Click(object sender, EventArgs e) public bool RemoveFile(bool getConfirmation = true) { - bool successfullyDeleted = false; - if (File.Exists(exportedFile)) + if (!File.Exists(exportedFile)) + { + MessageBoxes.ShowMessageBox($"The file does not exist:\n{exportedFile}"); + return false; + } + + var successfullyDeleted = false; + if (getConfirmation && + MessageBox.Show("Are you sure to remove the exported file for this creature?\nThis cannot be undone.\n\n" + + "(Hold the Shift key to not show this confirmation message.)", + "Remove file?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) + != DialogResult.Yes) return successfullyDeleted; + try { - if (!getConfirmation || MessageBox.Show("Are you sure to remove the exported file for this creature?\nThis cannot be undone.", "Remove file?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) - == DialogResult.Yes) - { - try - { - File.Delete(exportedFile); - successfullyDeleted = true; - } - catch - { - // ignored - } - } + File.Delete(exportedFile); + successfullyDeleted = true; } - else + catch { - MessageBoxes.ShowMessageBox($"The file does not exist:\n{exportedFile}"); + // ignored } + return successfullyDeleted; } } diff --git a/ARKBreedingStats/json/namePatternTemplates.json b/ARKBreedingStats/json/namePatternTemplates.json index ae56a0043..337369e5d 100644 --- a/ARKBreedingStats/json/namePatternTemplates.json +++ b/ARKBreedingStats/json/namePatternTemplates.json @@ -1,6 +1,6 @@ { "Format": "1.0", - "Version": "2024.5.4", + "Version": "2024.8.3", "Data": [ { "Pattern": "{{#substring: {{#format_int: {{#substring: {arkid} | -9 }} | X9 }} | -4 }}", @@ -51,6 +51,11 @@ "Pattern": "{sex_short}{n} {{#list:\r\n{{#ifexpr: {hp} > 35 | {{#if: {isTophp} | HP{hp}/ }} }}\r\n{{#ifexpr: {st} > 35 | {{#if: {isTopst} | ST{st}/ }} }}\r\n{{#ifexpr: {ox} > 35 | {{#if: {isTopox} | OX{ox}/ }} }}\r\n{{#ifexpr: {fo} > 35 | {{#if: {isTopfo} | F{fo}/ }} }}\r\n{{#ifexpr: {we} > 35 | {{#if: {isTopwe} | W{we}/ }} }}\r\n{{#ifexpr: {dm} > 35 | {{#if: {isTopdm} | D{dm}/ }} }}\r\n{{#ifexpr: {sp} > 35 | {{#if: {isTopsp} | SP{sp}/ }} }}\r\n{{#ifexpr: {cr} > 35 | {{#if: {isTopcr} | C{cr}/ }} }}\r\n| / | / }}", "Title": "Gender and top stats (if they're > 35)", "Description": "Shows gender & number (if multiple). Shows all top stats creature has upper 35 points.\nExample: F1 HP46/OX37/D42\nBy Xeikos" + }, + { + "Pattern": "#!javascript\r\n{{loc(JavaScriptNamingPatternHelp)}}\r\n\r\nlog('Available variables are:')\r\nlog(JSON.stringify(globalThis, null, ' '))\r\n\r\nlet statList = [\r\n istophp ? `HP${hp}` : null,\r\n istopst ? `ST${st}` : null,\r\n istopox ? `OX${ox}` : null,\r\n istopfo ? `FO${fo}` : null,\r\n istopwe ? `WE${we}` : null,\r\n istopdm ? `DM${dm}` : null,\r\n];\r\n\r\nreturn `${sex_short}${baselvl}-${n} | ${statList.filter(x => !!x).join('/')}`\r\n", + "Title": "Javascript sample with output of creature data", + "Description": "Outputs javascript template help text along with a sample script" } ] -} \ No newline at end of file +} diff --git a/ARKBreedingStats/json/values/ASA-values.json b/ARKBreedingStats/json/values/ASA-values.json index ebd09cb54..ead415add 100644 --- a/ARKBreedingStats/json/values/ASA-values.json +++ b/ARKBreedingStats/json/values/ASA-values.json @@ -1,5 +1,5 @@ { - "version": "43.4.104", + "version": "52.1.118", "format": "1.16-mod-remap", "mod": { "id": "ASA", @@ -158,6 +158,134 @@ } ] }, + { + "blueprintPath": "/Game/ASA/Dinos/Deinosuchus/DeinosuchusASA_Character_BP.DeinosuchusASA_Character_BP", + "name": "Deinosuchus", + "fullStatsRaw": [ + [ 1000, 0.2, 0.27, 0.5, 0 ], + [ 300, 0.1, 0.1, 0, 0 ], + [ 1350, 0.06, 0, 0.5, 0 ], + null, + [ 3000, 0.1, 0.1, 0, 0 ], + null, + null, + [ 600, 0.02, 0.04, 0, 0 ], + [ 1, 0.05, 0.1, 0.5, 0.4 ], + [ 1, 0, 0.01, 0, 0 ], + null, + null + ], + "breeding": { + "gestationTime": 0, + "incubationTime": 8999.28006, + "eggTempMin": 30, + "eggTempMax": 34, + "maturationTime": 333333.333, + "matingCooldownMin": 64800, + "matingCooldownMax": 172800 + }, + "taming": { + "nonViolent": true, + "violent": false, + "tamingIneffectiveness": 1.25, + "affinityNeeded0": 5000, + "affinityIncreasePL": 160, + "wakeAffinityMult": 1.6, + "wakeFoodDeplMult": 2, + "foodConsumptionBase": 0.01, + "foodConsumptionMult": 0.05, + "babyFoodConsumptionMult": 510 + }, + "boneDamageAdjusters": { + "Head": 0.5, + "Jaw": 0.5 + }, + "displayedStats": 919, + "skipWildLevelStats": 520, + "colors": [ + { + "name": "Main", + "colors": [ + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Medium Green", + "Dino Dark Green", + "Dino Medium Brown", + "Dino Dark Brown", + "Dark Grey", + "Dino Darker Grey", + "Black", + "Dino Light Brown", + "Dino Albino" + ] + }, + null, + { + "name": "Accents", + "colors": [ + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Medium Green", + "Dino Dark Green", + "Dino Medium Brown", + "Dino Dark Brown", + "Dark Grey", + "Dino Darker Grey", + "Black", + "Dino Light Brown", + "Dino Albino" + ] + }, + { + "name": "Nose", + "colors": [ + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Medium Green", + "Dino Dark Green", + "Dino Medium Brown", + "Dino Dark Brown", + "Dark Grey", + "Dino Darker Grey", + "Black", + "Dino Light Brown", + "Dino Albino" + ] + }, + { + "name": "Back", + "colors": [ + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Medium Green", + "Dino Dark Green", + "Dino Medium Brown", + "Dino Dark Brown", + "Dark Grey", + "Dino Darker Grey", + "Black", + "Dino Light Brown", + "Dino Albino" + ] + }, + { + "name": "Belly", + "colors": [ + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Medium Green", + "Dino Dark Green", + "Dino Medium Brown", + "Dino Dark Brown", + "Dark Grey", + "Dino Darker Grey", + "Black", + "Dino Light Brown", + "Dino Albino" + ] + } + ] + }, { "blueprintPath": "/Game/ASA/Dinos/Fasolasuchus/Fasola_Character_BP.Fasola_Character_BP", "name": "Fasolasuchus", @@ -459,60 +587,17 @@ "immobilizedBy": [ "Chain Bola", "Large Bear Trap", "Plant Species Y" ] }, { - "blueprintPath": "/Game/ASA/Dinos/FireLion/FireLion_Character_BP.FireLion_Character_BP", - "name": "Pyromane", - "fullStatsRaw": [ - [ 600, 0.2, 0.27, 0.5, 0 ], - [ 350, 0.1, 0.1, 0, 0 ], - [ 500, 0.06, 0, 0.5, 0 ], - [ 150, 0.1, 0.1, 0, 0 ], - [ 1000, 0.1, 0.1, 0, 0 ], - null, - null, - [ 300, 0.02, 0.04, 0, 0 ], - [ 1, 0.05, 0.1, 0.5, 0.4 ], - [ 1, 0, 0.01, 0, 0 ], - null, - null - ], - "breeding": { - "gestationTime": 8628.1277, - "incubationTime": 0, - "maturationTime": 175438.596, - "matingCooldownMin": 64800, - "matingCooldownMax": 172800 - }, - "taming": { - "nonViolent": true, - "violent": false, - "tamingIneffectiveness": 1.875, - "affinityNeeded0": 5000, - "affinityIncreasePL": 25, - "wakeAffinityMult": 1, - "wakeFoodDeplMult": 2, - "foodConsumptionBase": 0.001157, - "foodConsumptionMult": 0.05, - "babyFoodConsumptionMult": 510 - }, - "boneDamageAdjusters": { - "Head": 1.5, - "Jaw": 1.5 - }, - "displayedStats": 927, - "skipWildLevelStats": 512 - }, - { - "blueprintPath": "/Game/ASA/Dinos/Gigantoraptor/Gigantoraptor_Character_BP.Gigantoraptor_Character_BP", - "name": "Gigantoraptor", + "blueprintPath": "/Game/ASA/Dinos/Fasolasuchus/Fasola_Character_BP_Aberrant.Fasola_Character_BP_Aberrant", + "name": "Aberrant Fasolasuchus", "fullStatsRaw": [ - [ 770, 0.2, 0.27, 0.5, 0 ], + [ 950, 0.2, 0.27, 0.5, 0 ], [ 350, 0.1, 0.1, 0, 0 ], - [ 950, 0.06, 0, 0.5, 0 ], + [ 1350, 0.06, 0, 0.5, 0 ], [ 150, 0.1, 0.1, 0, 0 ], - [ 3000, 0.1, 0.1, 0, 0.15 ], + [ 2750, 0.1, 0.1, 0, 0 ], null, null, - [ 320, 0.02, 0.04, 0, 0 ], + [ 450, 0.02, 0.04, 0, 0 ], [ 1, 0.05, 0.1, 0.5, 0.4 ], [ 1, 0, 0.01, 0, 0 ], null, @@ -520,183 +605,244 @@ ], "breeding": { "gestationTime": 0, - "incubationTime": 5999.52004, - "eggTempMin": 26, - "eggTempMax": 32, - "maturationTime": 166666.667, + "incubationTime": 17998.5601, + "eggTempMin": 47, + "eggTempMax": 50, + "maturationTime": 666666.667, "matingCooldownMin": 64800, "matingCooldownMax": 172800 }, "taming": { - "nonViolent": true, - "violent": false, - "tamingIneffectiveness": 1, - "affinityNeeded0": 2400, - "affinityIncreasePL": 100, - "wakeAffinityMult": 1.6, - "wakeFoodDeplMult": 2, - "foodConsumptionBase": 0.002314, - "foodConsumptionMult": 180.0634, + "nonViolent": false, + "violent": true, + "tamingIneffectiveness": 1.5, + "affinityNeeded0": 3000, + "affinityIncreasePL": 150, + "torporDepletionPS0": 1.5, + "foodConsumptionBase": 0.001543, + "foodConsumptionMult": 288.0392, "babyFoodConsumptionMult": 510 }, - "boneDamageAdjusters": { - "Cnt_Head_JNT_SKL": 3, - "Cnt_Neck_002_JNT_SKL": 3, - "Cnt_Neck_000_JNT_SKL": 3 - }, + "TamedBaseHealthMultiplier": 0.96, "displayedStats": 927, "skipWildLevelStats": 512, "colors": [ { - "name": "Feathers main", + "name": "Body", "colors": [ + "Dino Light Orange", "Dino Dark Orange", + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Light Green", + "Dino Medium Green", + "Dino Light Blue", "Dino Dark Blue", + "Dino Light Purple", + "Dino Light Brown", "Dino Medium Brown", "Dino Dark Brown", + "Light Grey", "Dino Darker Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", "DarkWolfFur", "DragonBase0", + "DragonBase1", "DragonGreen0", + "DragonGreen1", + "DragonGreen2", "DragonGreen3", "WyvernPurple0", + "WyvernPurple1", "WyvernBlue0", "WyvernBlue1", "NearBlack", - "DarkTurquoise", - "MediumTurquoise", "GreenSlate", + "Sage", "DarkWarmGray", "MediumWarmGray", + "LightWarmGray", "DarkCement", - "BurntSienna", + "LightCement", + "LightAutumn", + "Mustard", "MidnightBlue", "BlackSands", - "Light Grey", - "DarkTeal", + "Glacial", "Cammo", "DryMoss", - "Dino Albino", - "Dino Medium Blue", - "Glacial" + "Custard" ] }, { - "name": "Wattle", + "name": "Spots", "colors": [ "Dino Light Orange", - "DragonFire", + "Dino Dark Orange", + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Light Green", + "Dino Medium Green", + "Dino Light Blue", + "Dino Dark Blue", + "Dino Light Purple", + "Dino Light Brown", + "Dino Medium Brown", + "Dino Dark Brown", + "Light Grey", + "Dino Darker Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", "DragonBase0", "DragonBase1", "DragonGreen0", "DragonGreen1", + "DragonGreen2", "DragonGreen3", "WyvernPurple0", "WyvernPurple1", "WyvernBlue0", - "Dino Medium Blue", - "MediumTurquoise", - "Turquoise", - "BurntSienna", - "MediumAutumn", - "Coral", - "Orange", - "Peach", + "WyvernBlue1", + "NearBlack", + "GreenSlate", + "Sage", + "DarkWarmGray", + "MediumWarmGray", + "LightWarmGray", + "DarkCement", + "LightCement", "LightAutumn", "Mustard", - "MediumTeal", - "Teal", - "Dino Dark Orange", - "DarkTurquoise", - "DarkCement", "MidnightBlue", "BlackSands", - "Dino Dark Blue" + "Glacial", + "Cammo", + "DryMoss", + "Custard" ] }, { - "name": "Wattle pattern", + "name": "Spike tips", "colors": [ - "Dino Light Red", "Dino Light Orange", + "Dino Dark Orange", + "Dino Light Yellow", + "Dino Dark Yellow", "Dino Light Green", + "Dino Medium Green", "Dino Light Blue", + "Dino Dark Blue", "Dino Light Purple", - "DragonFire", + "Dino Light Brown", + "Dino Medium Brown", + "Dino Dark Brown", + "Light Grey", + "Dino Darker Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", "DragonBase0", "DragonBase1", "DragonGreen0", "DragonGreen1", + "DragonGreen2", "DragonGreen3", "WyvernPurple0", "WyvernPurple1", "WyvernBlue0", - "Dino Medium Blue", - "MediumTurquoise", - "Turquoise", - "LightPink", - "BurntSienna", - "MediumAutumn", - "Vermillion", - "Coral", - "Orange", - "Peach", + "WyvernBlue1", + "NearBlack", + "GreenSlate", + "Sage", + "DarkWarmGray", + "MediumWarmGray", + "LightWarmGray", + "DarkCement", + "LightCement", "LightAutumn", "Mustard", - "Mint", - "LeafGreen", - "Lavender", - "MediumTeal", - "Teal", - "PowderBlue", - "Custard", - "Cream" + "MidnightBlue", + "BlackSands", + "Glacial", + "Cammo", + "DryMoss", + "Custard" ] }, { - "name": "Accent", + "name": "Nothing", "colors": [ - "Dino Light Red", "Dino Light Orange", + "Dino Dark Orange", + "Dino Light Yellow", + "Dino Dark Yellow", "Dino Light Green", + "Dino Medium Green", "Dino Light Blue", + "Dino Dark Blue", "Dino Light Purple", - "DragonFire", + "Dino Light Brown", + "Dino Medium Brown", + "Dino Dark Brown", + "Light Grey", + "Dino Darker Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", "DragonBase0", "DragonBase1", "DragonGreen0", "DragonGreen1", + "DragonGreen2", "DragonGreen3", "WyvernPurple0", "WyvernPurple1", "WyvernBlue0", - "Dino Medium Blue", - "MediumTurquoise", - "Turquoise", - "LightPink", - "BurntSienna", - "MediumAutumn", - "Vermillion", - "Coral", - "Orange", - "Peach", + "WyvernBlue1", + "NearBlack", + "GreenSlate", + "Sage", + "DarkWarmGray", + "MediumWarmGray", + "LightWarmGray", + "DarkCement", + "LightCement", "LightAutumn", "Mustard", - "Mint", - "Jade", - "LeafGreen", - "Lavender", - "MediumTeal", - "Teal", - "PowderBlue", - "Custard", - "Cream" + "MidnightBlue", + "BlackSands", + "Glacial", + "Cammo", + "DryMoss", + "Custard" ] }, { - "name": "Skin", + "name": "Belly", "colors": [ "Dino Light Orange", + "Dino Dark Orange", + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Light Green", + "Dino Medium Green", + "Dino Light Blue", + "Dino Dark Blue", + "Dino Light Purple", "Dino Light Brown", "Dino Medium Brown", "Dino Dark Brown", @@ -708,104 +854,932 @@ "BigFoot5", "WolfFur", "DarkWolfFur", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen2", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "WyvernBlue1", "NearBlack", + "GreenSlate", + "Sage", "DarkWarmGray", "MediumWarmGray", "LightWarmGray", - "Dino Light Yellow", + "DarkCement", + "LightCement", "LightAutumn", - "Cream", - "NearBlack", - "Glacial" + "Mustard", + "MidnightBlue", + "BlackSands", + "Glacial", + "Cammo", + "DryMoss", + "Custard" ] }, { - "name": "Main pattern", + "name": "Back", "colors": [ - "Dino Light Red", "Dino Light Orange", + "Dino Dark Orange", + "Dino Light Yellow", + "Dino Dark Yellow", "Dino Light Green", + "Dino Medium Green", "Dino Light Blue", + "Dino Dark Blue", "Dino Light Purple", - "DragonFire", + "Dino Light Brown", + "Dino Medium Brown", + "Dino Dark Brown", + "Light Grey", + "Dino Darker Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", "DragonBase0", "DragonBase1", "DragonGreen0", "DragonGreen1", + "DragonGreen2", "DragonGreen3", "WyvernPurple0", "WyvernPurple1", "WyvernBlue0", - "Dino Medium Blue", - "MediumTurquoise", - "Turquoise", - "LightPink", - "BurntSienna", - "MediumAutumn", - "Vermillion", - "Coral", - "Orange", - "Peach", + "WyvernBlue1", + "NearBlack", + "GreenSlate", + "Sage", + "DarkWarmGray", + "MediumWarmGray", + "LightWarmGray", + "DarkCement", + "LightCement", "LightAutumn", "Mustard", - "Jade", - "Lavender", - "MediumTeal", - "Teal", - "PowderBlue", - "Custard", - "Cream", - "Dino Dark Blue", - "Dino Dark Brown", - "NearBlack", - "BlackSands" + "MidnightBlue", + "BlackSands", + "Glacial", + "Cammo", + "DryMoss", + "Custard" ] } ] }, { - "blueprintPath": "/Game/ASA/Dinos/Shastasaurus/Shastasaurus_Character_BP.Shastasaurus_Character_BP", - "name": "Shastasaurus", + "blueprintPath": "/Game/ASA/Dinos/FireLion/FireLion_Character_BP.FireLion_Character_BP", + "name": "Pyromane", "fullStatsRaw": [ - [ 4500, 0.12, 0.21, 0.3, 0 ], - [ 300, 0.1, 0.1, 0, 0 ], - [ 3000, 0.06, 0, 0.5, 0 ], + [ 600, 0.2, 0.27, 0.5, 0 ], + [ 350, 0.1, 0.1, 0, 0 ], + [ 500, 0.06, 0, 0.5, 0 ], [ 150, 0.1, 0.1, 0, 0 ], - [ 8000, 0.1, 0.1, 0, 0.15 ], + [ 1000, 0.1, 0.1, 0, 0 ], null, null, - [ 3000, 0.02, 0.04, 0, 0 ], - [ 1, 0.05, 0.1, 0.65, 0.4 ], - [ 1, 0, 0.005, 0, 0 ], + [ 300, 0.02, 0.04, 0, 0 ], + [ 1, 0.05, 0.1, 0.5, 0.4 ], + [ 1, 0, 0.01, 0, 0 ], null, null ], - "altBaseStats": { - "0": 3600, - "1": 400, - "7": 1300 - }, "breeding": { - "gestationTime": 28571.4286, + "gestationTime": 8628.1277, "incubationTime": 0, - "maturationTime": 666666.667, + "maturationTime": 175438.596, "matingCooldownMin": 64800, "matingCooldownMax": 172800 }, "taming": { "nonViolent": true, "violent": false, - "tamingIneffectiveness": 0.06, - "affinityNeeded0": 11000, - "affinityIncreasePL": 600, - "wakeAffinityMult": 1, + "tamingIneffectiveness": 1.875, + "affinityNeeded0": 5000, + "affinityIncreasePL": 25, + "wakeAffinityMult": 1, + "wakeFoodDeplMult": 2, + "foodConsumptionBase": 0.001157, + "foodConsumptionMult": 0.05, + "babyFoodConsumptionMult": 510 + }, + "boneDamageAdjusters": { + "Head": 1.5, + "Jaw": 1.5 + }, + "displayedStats": 927, + "skipWildLevelStats": 512, + "colors": [ + null, + null, + { + "name": "Main body", + "colors": [ + "Dino Dark Orange", + "Dino Medium Brown", + "Dino Dark Brown", + "Dino Darker Grey", + "DarkWolfFur", + "DragonFire", + "DragonBase0", + "WyvernPurple0", + "WyvernBlue0", + "WyvernBlue1", + "NearBlack", + "DarkWarmGray", + "MediumWarmGray", + "DarkCement", + "BurntSienna", + "MediumAutumn", + "MidnightBlue", + "BlackSands", + "Cammo" + ] + }, + { + "name": "Lava cracks / Flames", + "colors": [ + "Dino Light Orange", + "Dino Light Blue", + "DragonFire", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen3", + "WyvernPurple0", + "WyvernBlue0", + "Turquoise", + "BurntSienna", + "MediumAutumn", + "Vermillion", + "Coral", + "Orange", + "Peach", + "LightAutumn", + "Mustard", + "MediumTeal", + "Teal", + "PowderBlue", + "Custard", + "Cream" + ] + }, + null, + { + "name": "Highlights", + "colors": [ + "Dino Dark Orange", + "Dino Medium Brown", + "Dino Dark Brown", + "Dino Darker Grey", + "DarkWolfFur", + "DragonFire", + "DragonBase0", + "WyvernPurple0", + "WyvernBlue0", + "WyvernBlue1", + "NearBlack", + "DarkWarmGray", + "MediumWarmGray", + "DarkCement", + "BurntSienna", + "MediumAutumn", + "MidnightBlue", + "BlackSands", + "Cammo" + ] + } + ] + }, + { + "blueprintPath": "/Game/ASA/Dinos/Gigantoraptor/Gigantoraptor_Character_BP.Gigantoraptor_Character_BP", + "name": "Gigantoraptor", + "fullStatsRaw": [ + [ 770, 0.2, 0.27, 0.5, 0 ], + [ 350, 0.1, 0.1, 0, 0 ], + [ 950, 0.06, 0, 0.5, 0 ], + [ 150, 0.1, 0.1, 0, 0 ], + [ 3000, 0.1, 0.1, 0, 0.15 ], + null, + null, + [ 320, 0.02, 0.04, 0, 0 ], + [ 1, 0.05, 0.1, 0.5, 0.4 ], + [ 1, 0, 0.01, 0, 0 ], + null, + null + ], + "breeding": { + "gestationTime": 0, + "incubationTime": 5999.52004, + "eggTempMin": 26, + "eggTempMax": 32, + "maturationTime": 166666.667, + "matingCooldownMin": 64800, + "matingCooldownMax": 172800 + }, + "taming": { + "nonViolent": true, + "violent": false, + "tamingIneffectiveness": 1, + "affinityNeeded0": 2400, + "affinityIncreasePL": 100, + "wakeAffinityMult": 1.6, + "wakeFoodDeplMult": 2, + "foodConsumptionBase": 0.002314, + "foodConsumptionMult": 180.0634, + "babyFoodConsumptionMult": 510 + }, + "boneDamageAdjusters": { + "Cnt_Head_JNT_SKL": 3, + "Cnt_Neck_002_JNT_SKL": 3, + "Cnt_Neck_000_JNT_SKL": 3 + }, + "displayedStats": 927, + "skipWildLevelStats": 512, + "colors": [ + { + "name": "Feathers main", + "colors": [ + "Dino Dark Orange", + "Dino Dark Blue", + "Dino Medium Brown", + "Dino Dark Brown", + "Dino Darker Grey", + "DarkWolfFur", + "DragonBase0", + "DragonGreen0", + "DragonGreen3", + "WyvernPurple0", + "WyvernBlue0", + "WyvernBlue1", + "NearBlack", + "DarkTurquoise", + "MediumTurquoise", + "GreenSlate", + "DarkWarmGray", + "MediumWarmGray", + "DarkCement", + "BurntSienna", + "MidnightBlue", + "BlackSands", + "Light Grey", + "DarkTeal", + "Cammo", + "DryMoss", + "Dino Albino", + "Dino Medium Blue", + "Glacial" + ] + }, + { + "name": "Wattle", + "colors": [ + "Dino Light Orange", + "DragonFire", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "Dino Medium Blue", + "MediumTurquoise", + "Turquoise", + "BurntSienna", + "MediumAutumn", + "Coral", + "Orange", + "Peach", + "LightAutumn", + "Mustard", + "MediumTeal", + "Teal", + "Dino Dark Orange", + "DarkTurquoise", + "DarkCement", + "MidnightBlue", + "BlackSands", + "Dino Dark Blue" + ] + }, + { + "name": "Wattle pattern", + "colors": [ + "Dino Light Red", + "Dino Light Orange", + "Dino Light Green", + "Dino Light Blue", + "Dino Light Purple", + "DragonFire", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "Dino Medium Blue", + "MediumTurquoise", + "Turquoise", + "LightPink", + "BurntSienna", + "MediumAutumn", + "Vermillion", + "Coral", + "Orange", + "Peach", + "LightAutumn", + "Mustard", + "Mint", + "LeafGreen", + "Lavender", + "MediumTeal", + "Teal", + "PowderBlue", + "Custard", + "Cream" + ] + }, + { + "name": "Accent", + "colors": [ + "Dino Light Red", + "Dino Light Orange", + "Dino Light Green", + "Dino Light Blue", + "Dino Light Purple", + "DragonFire", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "Dino Medium Blue", + "MediumTurquoise", + "Turquoise", + "LightPink", + "BurntSienna", + "MediumAutumn", + "Vermillion", + "Coral", + "Orange", + "Peach", + "LightAutumn", + "Mustard", + "Mint", + "Jade", + "LeafGreen", + "Lavender", + "MediumTeal", + "Teal", + "PowderBlue", + "Custard", + "Cream" + ] + }, + { + "name": "Skin", + "colors": [ + "Dino Light Orange", + "Dino Light Brown", + "Dino Medium Brown", + "Dino Dark Brown", + "Light Grey", + "Dino Darker Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", + "NearBlack", + "DarkWarmGray", + "MediumWarmGray", + "LightWarmGray", + "Dino Light Yellow", + "LightAutumn", + "Cream", + "NearBlack", + "Glacial" + ] + }, + { + "name": "Main pattern", + "colors": [ + "Dino Light Red", + "Dino Light Orange", + "Dino Light Green", + "Dino Light Blue", + "Dino Light Purple", + "DragonFire", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "Dino Medium Blue", + "MediumTurquoise", + "Turquoise", + "LightPink", + "BurntSienna", + "MediumAutumn", + "Vermillion", + "Coral", + "Orange", + "Peach", + "LightAutumn", + "Mustard", + "Jade", + "Lavender", + "MediumTeal", + "Teal", + "PowderBlue", + "Custard", + "Cream", + "Dino Dark Blue", + "Dino Dark Brown", + "NearBlack", + "BlackSands" + ] + } + ] + }, + { + "blueprintPath": "/Game/ASA/Dinos/Gigantoraptor/Gigantoraptor_Character_BP_Aberrant.Gigantoraptor_Character_BP_Aberrant", + "name": "Aberrant Gigantoraptor", + "fullStatsRaw": [ + [ 770, 0.2, 0.27, 0.5, 0 ], + [ 350, 0.1, 0.1, 0, 0 ], + [ 950, 0.06, 0, 0.5, 0 ], + [ 150, 0.1, 0.1, 0, 0 ], + [ 3000, 0.1, 0.1, 0, 0.15 ], + null, + null, + [ 320, 0.02, 0.04, 0, 0 ], + [ 1, 0.05, 0.1, 0.5, 0.4 ], + [ 1, 0, 0.01, 0, 0 ], + null, + null + ], + "breeding": { + "gestationTime": 0, + "incubationTime": 5999.52004, + "eggTempMin": 26, + "eggTempMax": 32, + "maturationTime": 166666.667, + "matingCooldownMin": 64800, + "matingCooldownMax": 172800 + }, + "taming": { + "nonViolent": true, + "violent": false, + "tamingIneffectiveness": 1, + "affinityNeeded0": 2400, + "affinityIncreasePL": 100, + "wakeAffinityMult": 1.6, + "wakeFoodDeplMult": 2, + "foodConsumptionBase": 0.002314, + "foodConsumptionMult": 180.0634, + "babyFoodConsumptionMult": 510 + }, + "boneDamageAdjusters": { + "Cnt_Head_JNT_SKL": 3, + "Cnt_Neck_002_JNT_SKL": 3, + "Cnt_Neck_000_JNT_SKL": 3 + }, + "TamedBaseHealthMultiplier": 0.96, + "displayedStats": 927, + "skipWildLevelStats": 512, + "colors": [ + { + "name": "Feathers main", + "colors": [ + "Dino Dark Orange", + "Dino Dark Blue", + "Dino Medium Brown", + "Dino Dark Brown", + "Dino Darker Grey", + "DarkWolfFur", + "DragonBase0", + "DragonGreen0", + "DragonGreen3", + "WyvernPurple0", + "WyvernBlue0", + "WyvernBlue1", + "NearBlack", + "DarkTurquoise", + "MediumTurquoise", + "GreenSlate", + "DarkWarmGray", + "MediumWarmGray", + "DarkCement", + "BurntSienna", + "MidnightBlue", + "BlackSands", + "Light Grey", + "DarkTeal", + "Cammo", + "DryMoss", + "Dino Albino", + "Dino Medium Blue", + "Glacial" + ] + }, + { + "name": "Wattle", + "colors": [ + "Dino Light Orange", + "DragonFire", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "Dino Medium Blue", + "MediumTurquoise", + "Turquoise", + "BurntSienna", + "MediumAutumn", + "Coral", + "Orange", + "Peach", + "LightAutumn", + "Mustard", + "MediumTeal", + "Teal", + "Dino Dark Orange", + "DarkTurquoise", + "DarkCement", + "MidnightBlue", + "BlackSands", + "Dino Dark Blue" + ] + }, + { + "name": "Wattle pattern", + "colors": [ + "Dino Light Red", + "Dino Light Orange", + "Dino Light Green", + "Dino Light Blue", + "Dino Light Purple", + "DragonFire", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "Dino Medium Blue", + "MediumTurquoise", + "Turquoise", + "LightPink", + "BurntSienna", + "MediumAutumn", + "Vermillion", + "Coral", + "Orange", + "Peach", + "LightAutumn", + "Mustard", + "Mint", + "LeafGreen", + "Lavender", + "MediumTeal", + "Teal", + "PowderBlue", + "Custard", + "Cream" + ] + }, + { + "name": "Accent", + "colors": [ + "Dino Light Red", + "Dino Light Orange", + "Dino Light Green", + "Dino Light Blue", + "Dino Light Purple", + "DragonFire", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "Dino Medium Blue", + "MediumTurquoise", + "Turquoise", + "LightPink", + "BurntSienna", + "MediumAutumn", + "Vermillion", + "Coral", + "Orange", + "Peach", + "LightAutumn", + "Mustard", + "Mint", + "Jade", + "LeafGreen", + "Lavender", + "MediumTeal", + "Teal", + "PowderBlue", + "Custard", + "Cream" + ] + }, + { + "name": "Skin", + "colors": [ + "Dino Light Orange", + "Dino Light Brown", + "Dino Medium Brown", + "Dino Dark Brown", + "Light Grey", + "Dino Darker Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", + "NearBlack", + "DarkWarmGray", + "MediumWarmGray", + "LightWarmGray", + "Dino Light Yellow", + "LightAutumn", + "Cream", + "NearBlack", + "Glacial" + ] + }, + { + "name": "Main pattern", + "colors": [ + "Dino Light Red", + "Dino Light Orange", + "Dino Light Green", + "Dino Light Blue", + "Dino Light Purple", + "DragonFire", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "Dino Medium Blue", + "MediumTurquoise", + "Turquoise", + "LightPink", + "BurntSienna", + "MediumAutumn", + "Vermillion", + "Coral", + "Orange", + "Peach", + "LightAutumn", + "Mustard", + "Jade", + "Lavender", + "MediumTeal", + "Teal", + "PowderBlue", + "Custard", + "Cream", + "Dino Dark Blue", + "Dino Dark Brown", + "NearBlack", + "BlackSands" + ] + } + ] + }, + { + "blueprintPath": "/Game/ASA/Dinos/Shastasaurus/Shastasaurus_Character_BP.Shastasaurus_Character_BP", + "name": "Shastasaurus", + "fullStatsRaw": [ + [ 4500, 0.12, 0.21, 0.3, 0 ], + [ 300, 0.1, 0.1, 0, 0 ], + [ 3000, 0.06, 0, 0.5, 0 ], + [ 150, 0.1, 0.1, 0, 0 ], + [ 8000, 0.1, 0.1, 0, 0.15 ], + null, + null, + [ 3000, 0.02, 0.04, 0, 0 ], + [ 1, 0.05, 0.1, 0.65, 0.4 ], + [ 1, 0, 0.005, 0, 0 ], + null, + null + ], + "altBaseStats": { + "0": 3600, + "1": 400, + "7": 1300 + }, + "breeding": { + "gestationTime": 28571.4286, + "incubationTime": 0, + "maturationTime": 666666.667, + "matingCooldownMin": 64800, + "matingCooldownMax": 172800 + }, + "taming": { + "nonViolent": true, + "violent": false, + "tamingIneffectiveness": 0.06, + "affinityNeeded0": 11000, + "affinityIncreasePL": 600, + "wakeAffinityMult": 1, "wakeFoodDeplMult": 2, "foodConsumptionBase": 0.005, "foodConsumptionMult": 180.0011, "babyFoodConsumptionMult": 510 }, "displayedStats": 919, - "skipWildLevelStats": 520 + "skipWildLevelStats": 520, + "colors": [ + { + "name": "Body main", + "colors": [ + "Dino Light Orange", + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Light Blue", + "Dino Light Purple", + "Dino Light Brown", + "Dino Medium Brown", + "Light Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen2", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "Dino Medium Blue", + "LightWarmGray", + "LightCement", + "Coral", + "Orange", + "Peach", + "LightAutumn", + "Mustard", + "PowderBlue", + "Glacial", + "DryMoss", + "NearBlack", + "DarkWarmGray", + "BlackSands", + "Dino Darker Grey" + ] + }, + null, + { + "name": "Belly", + "colors": [ + "Dino Light Orange", + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Light Green", + "Dino Light Blue", + "Dino Light Purple", + "Dino Light Brown", + "Dino Medium Brown", + "Light Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen2", + "DragonGreen3", + "WyvernBlue0", + "LightWarmGray", + "LightCement", + "Peach", + "LightAutumn", + "Glacial", + "Orange", + "PowderBlue", + "Cream" + ] + }, + null, + { + "name": "Accents", + "colors": [ + "Dino Light Orange", + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Light Green", + "Dino Light Blue", + "Dino Light Purple", + "Dino Light Brown", + "Dino Medium Brown", + "Light Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen2", + "DragonGreen3", + "WyvernBlue0", + "LightWarmGray", + "LightCement", + "Peach", + "LightAutumn", + "Glacial", + "Orange", + "PowderBlue", + "Cream" + ] + }, + { + "name": "Sides", + "colors": [ + "Dino Light Orange", + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Light Green", + "Dino Light Blue", + "Dino Light Purple", + "Dino Light Brown", + "Dino Medium Brown", + "Light Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen2", + "DragonGreen3", + "WyvernBlue0", + "LightWarmGray", + "LightCement", + "Peach", + "LightAutumn", + "Glacial", + "Orange", + "PowderBlue", + "Cream" + ] + } + ] }, { "blueprintPath": "/Game/ASA/Dinos/Xiphactinus/Dinos/Xiphactinus_Character_BP_ASA.Xiphactinus_Character_BP_ASA", @@ -864,60 +1838,384 @@ null, null, { - "name": "Spine", + "name": "Spine", + "colors": [ + "Dino Light Red", + "Dino Dark Red", + "Dino Light Orange", + "Dino Dark Orange", + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Light Green", + "Dino Medium Green", + "Dino Dark Green", + "Dino Light Blue", + "Dino Dark Blue", + "Dino Light Purple", + "Dino Dark Purple", + "Dino Light Brown", + "Dino Medium Brown", + "Dino Dark Brown", + "Light Grey", + "Dark Grey", + "Dino Darker Grey", + "Black", + "Dino Albino" + ] + }, + { + "name": "Belly and fins", + "colors": [ + "Dino Dark Yellow", + "Dino Medium Green", + "Dino Dark Green", + "Dino Dark Blue", + "Dino Dark Purple", + "Dark Grey", + "Dino Darker Grey", + "Black" + ] + } + ] + }, + { + "blueprintPath": "/Game/ASA/Dinos/YiLing/YiLing_Character_BP.YiLing_Character_BP", + "name": "Yi Ling", + "fullStatsRaw": [ + [ 325, 0.2, 0.27, 0.5, 0 ], + [ 300, 0.1, 0.1, 0, 0 ], + [ 180, 0.06, 0, 0.5, 0 ], + [ 150, 0.1, 0.1, 0, 0 ], + [ 1200, 0.1, 0.1, 0, 0 ], + null, + null, + [ 140, 0.02, 0.04, 0, 0 ], + [ 1, 0.05, 0.1, 0.5, 0.4 ], + [ 1, 0, 0, 0, 0 ], + null, + null + ], + "statImprintMult": [ 0.2, 0, 0.2, 0, 0.2, 0.2, 0, 0.2, 0.2, 0, 0, 0 ], + "breeding": { + "gestationTime": 0, + "incubationTime": 3599.71202, + "eggTempMin": 38, + "eggTempMax": 42, + "maturationTime": 166666.667, + "matingCooldownMin": 64800, + "matingCooldownMax": 172800 + }, + "taming": { + "nonViolent": false, + "violent": true, + "tamingIneffectiveness": 1.875, + "affinityNeeded0": 3000, + "affinityIncreasePL": 100, + "torporDepletionPS0": 0.3, + "foodConsumptionBase": 0.001543, + "foodConsumptionMult": 648.0881, + "babyFoodConsumptionMult": 510 + }, + "boneDamageAdjusters": { + "c_head": 3, + "c_jaw": 3 + }, + "displayedStats": 927, + "skipWildLevelStats": 512, + "colors": [ + { + "name": "Feathers main", + "colors": [ + "Dino Dark Orange", + "Dino Dark Blue", + "Dino Medium Brown", + "Dino Dark Brown", + "Dino Darker Grey", + "DarkWolfFur", + "DragonBase0", + "DragonGreen0", + "DragonGreen3", + "WyvernPurple0", + "WyvernBlue0", + "WyvernBlue1", + "NearBlack", + "DarkTurquoise", + "MediumTurquoise", + "GreenSlate", + "DarkWarmGray", + "MediumWarmGray", + "DarkCement", + "BurntSienna", + "MidnightBlue", + "BlackSands", + "Light Grey", + "DarkTeal", + "Cammo", + "DryMoss", + "Dino Albino", + "Dino Medium Blue", + "Glacial" + ] + }, + { + "name": "Wings", + "colors": [ + "Dino Light Orange", + "Dino Light Brown", + "Dino Medium Brown", + "Dino Dark Brown", + "Light Grey", + "Dino Darker Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", + "NearBlack", + "DarkWarmGray", + "MediumWarmGray", + "LightWarmGray", + "Cream" + ] + }, + null, + { + "name": "Wing accents", + "colors": [ + "Dino Light Orange", + "Dino Light Brown", + "Dino Medium Brown", + "Dino Dark Brown", + "Light Grey", + "Dino Darker Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", + "NearBlack", + "DarkWarmGray", + "MediumWarmGray", + "LightWarmGray", + "Cream" + ] + }, + { + "name": "Belly", "colors": [ - "Dino Light Red", - "Dino Dark Red", "Dino Light Orange", - "Dino Dark Orange", - "Dino Light Yellow", - "Dino Dark Yellow", - "Dino Light Green", - "Dino Medium Green", - "Dino Dark Green", - "Dino Light Blue", - "Dino Dark Blue", - "Dino Light Purple", - "Dino Dark Purple", "Dino Light Brown", "Dino Medium Brown", "Dino Dark Brown", "Light Grey", - "Dark Grey", "Dino Darker Grey", - "Black", - "Dino Albino" + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", + "NearBlack", + "DarkWarmGray", + "MediumWarmGray", + "LightWarmGray", + "Dino Light Yellow", + "LightAutumn", + "Cream", + "NearBlack", + "Glacial" ] }, { - "name": "Belly and fins", + "name": "Main pattern", "colors": [ - "Dino Dark Yellow", - "Dino Medium Green", - "Dino Dark Green", - "Dino Dark Blue", - "Dino Dark Purple", - "Dark Grey", - "Dino Darker Grey", - "Black" + "Dino Light Red", + "Dino Light Orange", + "Dino Light Green", + "Dino Light Blue", + "Dino Light Purple", + "DragonFire", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "Dino Medium Blue", + "MediumTurquoise", + "Turquoise", + "LightPink", + "BurntSienna", + "MediumAutumn", + "Vermillion", + "Coral", + "Orange", + "Peach", + "LightAutumn", + "Mustard", + "Jade", + "Lavender", + "MediumTeal", + "Teal", + "PowderBlue", + "Custard", + "Cream", + "Dino Dark Blue" ] } ] }, + { + "blueprintPath": "/Game/Aberration/Boss/Rockwell/Rockwell_Character_BP_Easy.Rockwell_Character_BP_Easy", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Boss/Rockwell/Rockwell_Character_BP_Hard.Rockwell_Character_BP_Hard", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Boss/Rockwell/Rockwell_Character_BP_Medium.Rockwell_Character_BP_Medium", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Boss/RockwellTentacle/RockwellTentacle_Character_BP_Alpha.RockwellTentacle_Character_BP_Alpha", + "name": "Rockwell Tentacle", + "noGender": true, + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Boss/RockwellTentacle/RockwellTentacle_Character_BP_Beta.RockwellTentacle_Character_BP_Beta", + "name": "Rockwell Tentacle", + "noGender": true, + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Boss/RockwellTentacle/RockwellTentacle_Character_BP_Gamma.RockwellTentacle_Character_BP_Gamma", + "name": "Rockwell Tentacle", + "noGender": true, + "skipWildLevelStats": 512 + }, { "blueprintPath": "/Game/Aberration/Dinos/Basilisk/Basilisk_Character_BP.Basilisk_Character_BP", + "fullStatsRaw": [ + [ 2750, 0.2, 0.27, 0.5, 0 ], + [ 650, 0.1, 0.1, 0, 0 ], + [ 175, 0.06, 0, 0.5, 0 ], + [ 150, 0.1, 0.1, 0, 0 ], + [ 2500, 0.1, 0.1, 0, 0 ], + null, + null, + [ 800, 0.02, 0.04, 0, 0 ], + [ 1, 0.05, 0.1, 0.5, 0.4 ], + [ 1, 0, 0.01, 0.2, 0 ], + null, + null + ], + "breeding": { + "gestationTime": 0, + "incubationTime": 22498.2001, + "eggTempMin": 32, + "eggTempMax": 38, + "maturationTime": 666666.667, + "matingCooldownMin": 64800, + "matingCooldownMax": 172800 + }, "skipWildLevelStats": 512 }, { "blueprintPath": "/Game/Aberration/Dinos/Basilisk/Ghost_Basilisk_Character_BP.Ghost_Basilisk_Character_BP", + "fullStatsRaw": [ + [ 2750, 0.2, 0.27, 0.5, 0 ], + [ 650, 0.1, 0.1, 0, 0 ], + [ 175, 0.06, 0, 0.5, 0 ], + [ 150, 0.1, 0.1, 0, 0 ], + [ 2500, 0.1, 0.1, 0, 0 ], + null, + null, + [ 800, 0.02, 0.04, 0, 0 ], + [ 1, 0.05, 0.1, 0.5, 0.4 ], + [ 1, 0, 0.01, 0.2, 0 ], + null, + null + ], + "breeding": { + "gestationTime": 0, + "incubationTime": 22498.2001, + "eggTempMin": 32, + "eggTempMax": 38, + "maturationTime": 666666.667, + "matingCooldownMin": 64800, + "matingCooldownMax": 172800 + }, + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/Basilisk/MegaBasilisk_Character_BP.MegaBasilisk_Character_BP", + "fullStatsRaw": [ + [ 19500, 0.2, 0.27, 0.5, 0 ], + [ 650, 0.1, 0.1, 0, 0 ], + [ 175, 0.06, 0, 0.5, 0 ], + [ 150, 0.1, 0.1, 0, 0 ], + [ 2500, 0.1, 0.1, 0, 0 ], + null, + null, + [ 800, 0.02, 0.04, 0, 0 ], + [ 1, 0.05, 0.1, 0.5, 0.4 ], + [ 1, 0, 0.01, 0.2, 0 ], + null, + null + ], + "breeding": { + "gestationTime": 0, + "incubationTime": 22498.2001, + "eggTempMin": 32, + "eggTempMax": 38, + "maturationTime": 666666.667, + "matingCooldownMin": 64800, + "matingCooldownMax": 172800 + }, "skipWildLevelStats": 512 }, { "blueprintPath": "/Game/Aberration/Dinos/CaveWolf/CaveWolf_Character_BP.CaveWolf_Character_BP", "skipWildLevelStats": 512 }, + { + "blueprintPath": "/Game/Aberration/Dinos/ChupaCabra/ChupaCabra_Character_BP.ChupaCabra_Character_BP", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/ChupaCabra/ChupaCabra_Character_BP_Minion.ChupaCabra_Character_BP_Minion", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/ChupaCabra/ChupaCabra_Character_BP_Surface.ChupaCabra_Character_BP_Surface", + "skipWildLevelStats": 512 + }, { "blueprintPath": "/Game/Aberration/Dinos/Crab/Crab_Character_BP.Crab_Character_BP", + "breeding": { + "gestationTime": 35714.2857, + "incubationTime": 0, + "maturationTime": 416666.667, + "matingCooldownMin": 64800, + "matingCooldownMax": 172800 + }, + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/Crab/MegaCrab_Character_BP.MegaCrab_Character_BP", + "breeding": { + "gestationTime": 35714.2857, + "incubationTime": 0, + "maturationTime": 416666.667, + "matingCooldownMin": 64800, + "matingCooldownMax": 172800 + }, "skipWildLevelStats": 512 }, { @@ -945,111 +2243,195 @@ "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/Aberration/Dinos/MoleRat/MoleRat_Character_BP.MoleRat_Character_BP", + "blueprintPath": "/Game/Aberration/Dinos/MoleRat/MoleRat_Character_BP.MoleRat_Character_BP", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/Nameless/Ghost_Xenomorph_Character_BP_Male_Surface.Ghost_Xenomorph_Character_BP_Male_Surface", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/Nameless/MegaXenomorph_Character_BP_Male_Surface.MegaXenomorph_Character_BP_Male_Surface", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/Nameless/Xenomorph_Character_BP_Female.Xenomorph_Character_BP_Female", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/Nameless/Xenomorph_Character_BP_Male_Chupa.Xenomorph_Character_BP_Male_Chupa", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/Nameless/Xenomorph_Character_BP_Male_Lunar.Xenomorph_Character_BP_Male_Lunar", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/Nameless/Xenomorph_Character_BP_Male_Minion.Xenomorph_Character_BP_Male_Minion", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/Nameless/Xenomorph_Character_BP_Male_Surface.Xenomorph_Character_BP_Male_Surface", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/Nameless/Xenomorph_Character_BP_Male_Tamed.Xenomorph_Character_BP_Male_Tamed", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/Pteroteuthis/Pteroteuthis_Char_BP.Pteroteuthis_Char_BP", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/Pteroteuthis/Pteroteuthis_Char_BP_Surface.Pteroteuthis_Char_BP_Surface", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Aberration/Dinos/RockDrake/RockDrake_Character_BP.RockDrake_Character_BP", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/EndGame/Dinos/Drone/EndDrone_Character_BP.EndDrone_Character_BP", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/EndGame/Dinos/Drone/EndDrone_Character_BP_Hard.EndDrone_Character_BP_Hard", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/EndGame/Dinos/Drone/EndDrone_Character_BP_Med.EndDrone_Character_BP_Med", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndBoss_Character_Easy.EndBoss_Character_Easy", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndBoss_Character_Hard.EndBoss_Character_Hard", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndBoss_Character_Medium.EndBoss_Character_Medium", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossDragon/EndBossDragon_Character_BP_Easy.EndBossDragon_Character_BP_Easy", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossDragon/EndBossDragon_Character_BP_Hard.EndBossDragon_Character_BP_Hard", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossDragon/EndBossDragon_Character_BP_Medium.EndBossDragon_Character_BP_Medium", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossGorilla/EndBossGorilla_Character_BP_Easy.EndBossGorilla_Character_BP_Easy", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/Aberration/Dinos/Nameless/Ghost_Xenomorph_Character_BP_Male_Surface.Ghost_Xenomorph_Character_BP_Male_Surface", + "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossGorilla/EndBossGorilla_Character_BP_Hard.EndBossGorilla_Character_BP_Hard", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/Aberration/Dinos/Nameless/Xenomorph_Character_BP_Female.Xenomorph_Character_BP_Female", + "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossGorilla/EndBossGorilla_Character_BP_Medium.EndBossGorilla_Character_BP_Medium", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/Aberration/Dinos/Nameless/Xenomorph_Character_BP_Male_Lunar.Xenomorph_Character_BP_Male_Lunar", + "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossSpider/EndBossSpiderL_Character_BP_Easy.EndBossSpiderL_Character_BP_Easy", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/Aberration/Dinos/Nameless/Xenomorph_Character_BP_Male_Minion.Xenomorph_Character_BP_Male_Minion", + "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossSpider/EndBossSpiderL_Character_BP_Hard.EndBossSpiderL_Character_BP_Hard", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/Aberration/Dinos/Nameless/Xenomorph_Character_BP_Male_Surface.Xenomorph_Character_BP_Male_Surface", + "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossSpider/EndBossSpiderL_Character_BP_Medium.EndBossSpiderL_Character_BP_Medium", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/Aberration/Dinos/Nameless/Xenomorph_Character_BP_Male_Tamed.Xenomorph_Character_BP_Male_Tamed", + "blueprintPath": "/Game/EndGame/Dinos/Tank/EndTank_Character_BP.EndTank_Character_BP", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/Aberration/Dinos/Pteroteuthis/Pteroteuthis_Char_BP.Pteroteuthis_Char_BP", + "blueprintPath": "/Game/EndGame/Dinos/Tank/EndTank_Character_BP_Hard.EndTank_Character_BP_Hard", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/Aberration/Dinos/RockDrake/RockDrake_Character_BP.RockDrake_Character_BP", + "blueprintPath": "/Game/EndGame/Dinos/Tank/EndTank_Character_BP_Med.EndTank_Character_BP_Med", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Drone/EndDrone_Character_BP.EndDrone_Character_BP", - "skipWildLevelStats": 512 + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Arthropluera/Arthro_Character_BP_Corrupt.Arthro_Character_BP_Corrupt", + "skipWildLevelStats": 520 }, { - "blueprintPath": "/Game/EndGame/Dinos/Drone/EndDrone_Character_BP_Hard.EndDrone_Character_BP_Hard", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Carno/Carno_Character_BP_Corrupt.Carno_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Drone/EndDrone_Character_BP_Med.EndDrone_Character_BP_Med", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Chalicotherium/Chalico_Character_BP_Corrupt.Chalico_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndBoss_Character_Easy.EndBoss_Character_Easy", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Dilo/Dilo_Character_BP_Corrupt.Dilo_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndBoss_Character_Hard.EndBoss_Character_Hard", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Dimorphodon/Dimorph_Character_BP_Corrupt.Dimorph_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndBoss_Character_Medium.EndBoss_Character_Medium", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Giganotosaurus/Gigant_Character_BP_Corrupt.Gigant_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossDragon/EndBossDragon_Character_BP_Easy.EndBossDragon_Character_BP_Easy", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Nameless/Xenomorph_Character_BP_Male_Tamed_Corrupt.Xenomorph_Character_BP_Male_Tamed_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossDragon/EndBossDragon_Character_BP_Hard.EndBossDragon_Character_BP_Hard", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Paraceratherium/Paracer_Character_BP_Corrupt.Paracer_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossDragon/EndBossDragon_Character_BP_Medium.EndBossDragon_Character_BP_Medium", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Ptero/Ptero_Character_BP_Corrupt.Ptero_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossGorilla/EndBossGorilla_Character_BP_Easy.EndBossGorilla_Character_BP_Easy", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Raptor/Raptor_Character_BP_Corrupt.Raptor_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossGorilla/EndBossGorilla_Character_BP_Hard.EndBossGorilla_Character_BP_Hard", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Rex/MegaRex_Character_BP_Corrupt.MegaRex_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossGorilla/EndBossGorilla_Character_BP_Medium.EndBossGorilla_Character_BP_Medium", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Rex/Rex_Character_BP_Corrupt.Rex_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossSpider/EndBossSpiderL_Character_BP_Easy.EndBossSpiderL_Character_BP_Easy", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/RockDrake/RockDrake_Character_BP_Corrupt.RockDrake_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossSpider/EndBossSpiderL_Character_BP_Hard.EndBossSpiderL_Character_BP_Hard", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Spino/Spino_Character_BP_Corrupt.Spino_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Endboss/EndbossSpider/EndBossSpiderL_Character_BP_Medium.EndBossSpiderL_Character_BP_Medium", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Stego/Stego_Character_BP_Corrupt.Stego_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Tank/EndTank_Character_BP.EndTank_Character_BP", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Trike/MegaTrike_Character_BP_Corrupt.MegaTrike_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Tank/EndTank_Character_BP_Hard.EndTank_Character_BP_Hard", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Trike/Trike_Character_BP_Corrupt.Trike_Character_BP_Corrupt", "skipWildLevelStats": 512 }, { - "blueprintPath": "/Game/EndGame/Dinos/Tank/EndTank_Character_BP_Med.EndTank_Character_BP_Med", + "blueprintPath": "/Game/Extinction/Dinos/Corrupt/Wyvern/Wyvern_Character_BP_Fire_Corrupt.Wyvern_Character_BP_Fire_Corrupt", "skipWildLevelStats": 512 }, { @@ -1088,6 +2470,19 @@ "blueprintPath": "/Game/Extinction/Dinos/IceKaiju/IceKaiju_Character_BP.IceKaiju_Character_BP", "skipWildLevelStats": 512 }, + { + "blueprintPath": "/Game/Extinction/Dinos/KingKaiju/CorruptTumor_Character_BP.CorruptTumor_Character_BP", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Extinction/Dinos/KingKaiju/KingKaiju_Character_BP.KingKaiju_Character_BP", + "skipWildLevelStats": 512 + }, + { + "blueprintPath": "/Game/Extinction/Dinos/KingKaiju/Minions/Corrupt_Arthro_Character_BP.Corrupt_Arthro_Character_BP", + "name": "Corrupted Arthropluera", + "skipWildLevelStats": 512 + }, { "blueprintPath": "/Game/Extinction/Dinos/Mek/MegaMek_Character_BP.MegaMek_Character_BP", "skipWildLevelStats": 512 @@ -1220,6 +2615,10 @@ "blueprintPath": "/Game/Genesis/Dinos/GiantTurtle/GiantTurtle_Character_BP.GiantTurtle_Character_BP", "skipWildLevelStats": 512 }, + { + "blueprintPath": "/Game/Genesis/Dinos/MissionVariants/Race/Manta_Character_BP_Race.Manta_Character_BP_Race", + "skipWildLevelStats": 512 + }, { "blueprintPath": "/Game/Genesis/Dinos/Shapeshifter/Shapeshifter_Large/Shapeshifter_Large_Character_BP.Shapeshifter_Large_Character_BP", "skipWildLevelStats": 512 @@ -1342,6 +2741,10 @@ "blueprintPath": "/Game/Genesis2/Dinos/BrainSlug/BrainSlug_Character_BP.BrainSlug_Character_BP", "skipWildLevelStats": 512 }, + { + "blueprintPath": "/Game/Genesis2/Dinos/Exosuit/Exosuit_Character_BP.Exosuit_Character_BP", + "skipWildLevelStats": 512 + }, { "blueprintPath": "/Game/Genesis2/Dinos/LionfishLion/LionfishLion_Character_BP.LionfishLion_Character_BP", "skipWildLevelStats": 512 @@ -1376,6 +2779,29 @@ }, { "blueprintPath": "/Game/Genesis2/Dinos/Summoner/SummonedDinos/Basilisk_Character_BP_Summoned.Basilisk_Character_BP_Summoned", + "fullStatsRaw": [ + [ 2750, 0.2, 0.27, 0.5, 0 ], + [ 650, 0.1, 0.1, 0, 0 ], + [ 175, 0.06, 0, 0.5, 0 ], + [ 150, 0.1, 0.1, 0, 0 ], + [ 2500, 0.1, 0.1, 0, 0 ], + null, + null, + [ 800, 0.02, 0.04, 0, 0 ], + [ 1, 0.05, 0.1, 0.5, 0.4 ], + [ 1, 0, 0.01, 0.2, 0 ], + null, + null + ], + "breeding": { + "gestationTime": 0, + "incubationTime": 22498.2001, + "eggTempMin": 32, + "eggTempMax": 38, + "maturationTime": 666666.667, + "matingCooldownMin": 64800, + "matingCooldownMax": 172800 + }, "skipWildLevelStats": 512 }, { @@ -1404,6 +2830,13 @@ }, { "blueprintPath": "/Game/Genesis2/Dinos/Summoner/SummonedDinos/Crab_Character_BP_Summoned.Crab_Character_BP_Summoned", + "breeding": { + "gestationTime": 35714.2857, + "incubationTime": 0, + "maturationTime": 416666.667, + "matingCooldownMin": 64800, + "matingCooldownMax": 172800 + }, "skipWildLevelStats": 512 }, { @@ -1835,8 +3268,245 @@ }, "boneDamageAdjusters": { "c_head": 3 }, "displayedStats": 927, + "skipWildLevelStats": 512, + "colors": [ + { + "name": "Body main", + "colors": [ + "Dino Medium Brown", + "Dino Dark Brown", + "Dino Darker Grey", + "DarkWolfFur", + "Dino Dark Orange", + "Dino Dark Red", + "Black", + "Dark Grey" + ] + }, + { + "name": "Head highlight", + "colors": [ + "Dino Light Red", + "Dino Dark Red", + "Dino Light Orange", + "Dino Dark Orange", + "Dino Light Blue", + "Dino Dark Blue", + "Dino Light Purple", + "Dino Dark Purple", + "Black" + ] + }, + null, + null, + { + "name": "Head main", + "colors": [ + "BigFoot0", + "Bigfoot4", + "Bigfoot5", + "Dino Light Brown", + "Dino Medium Brown", + "Dino Light Orange", + "Dino Darker Grey" + ] + }, + { + "name": "Body highlights", + "colors": [ + "Dino Medium Brown", + "Dino Dark Brown", + "Dino Darker Grey", + "DarkWolfFur", + "Dino Dark Orange", + "Dino Dark Red", + "Black", + "Dark Grey", + "Bigfoot0", + "Bigfoot5", + "Dino Light Brown", + "Dino Light Orange" + ] + } + ] + }, + { + "blueprintPath": "/Game/Packs/Steampunk/Dinos/HelperBot/HelperBot_Character_BP.HelperBot_Character_BP", + "name": "SIR-5rM8", + "fullStatsRaw": [ + [ 10000, 0, 0, 0.5, 0 ], + null, + [ 100, 0.06, 0, 0.5, 0 ], + null, + null, + null, + null, + [ 500, 0, 0, 0, 0 ], + null, + null, + null, + null + ], + "taming": { + "nonViolent": false, + "violent": false, + "tamingIneffectiveness": 2000, + "affinityNeeded0": 10000, + "affinityIncreasePL": 5, + "foodConsumptionBase": 0, + "foodConsumptionMult": 0, + "babyFoodConsumptionMult": 510 + }, + "boneDamageAdjusters": { + "c_head": 3, + "c_neck3": 3 + }, + "displayedStats": 129, + "noGender": true, "skipWildLevelStats": 512 }, + { + "blueprintPath": "/Game/Packs/Steampunk/Dinos/JumpingSpider/JumpingSpider_Character_BP.JumpingSpider_Character_BP", + "name": "Cosmo", + "fullStatsRaw": [ + [ 115, 0.2, 0.27, 0.5, 0 ], + [ 100, 0.1, 0.125, 0, 0 ], + [ 60, 0.06, 0, 0.5, 0 ], + [ 200, 0.12, 0.115, 0.12, 0 ], + [ 450, 0.1, 0.1, 0, 0.15 ], + null, + null, + [ 70, 0.02, 0.04, 0, 0 ], + [ 1, 0.055, 0.11, 1.11, 0.425 ], + [ 1, 0, 0.01, 1.3, 0 ], + null, + null + ], + "breeding": { + "gestationTime": 0, + "incubationTime": 5142.44575, + "eggTempMin": 4, + "eggTempMax": 12, + "maturationTime": 333333.333, + "matingCooldownMin": 64800, + "matingCooldownMax": 172800 + }, + "taming": { + "nonViolent": true, + "violent": false, + "tamingIneffectiveness": 2.5, + "affinityNeeded0": 2200, + "affinityIncreasePL": 65, + "wakeAffinityMult": 1.65, + "wakeFoodDeplMult": 2, + "foodConsumptionBase": 0.000868, + "foodConsumptionMult": 2880.184, + "babyFoodConsumptionMult": 510 + }, + "boneDamageAdjusters": { + "head": 3, + "c_neck": 3 + }, + "displayedStats": 927, + "skipWildLevelStats": 512, + "colors": [ + { + "name": "Main body", + "colors": [ + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Medium Green", + "DragonBase0", + "Dino Medium Brown", + "DragonBase1", + "DragonGreen0", + "DragonGreen2", + "DragonGreen3", + "WyvernPurple0", + "DragonGreen1", + "WyvernBlue0", + "Black" + ] + }, + { + "name": "Leg pattern ", + "colors": [ + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Medium Green", + "Dino Dark Green", + "Dino Medium Brown", + "Dino Dark Brown", + "Dark Grey", + "Dino Darker Grey", + "Black" + ] + }, + { + "name": "Blue fur", + "colors": [ + "Dino Medium Green", + "DragonBase0", + "WyvernPurple1", + "DragonGreen1", + "DragonBase1", + "DragonFire", + "WyvernPurple0", + "WyvernBlue0" + ] + }, + { + "name": "Lantern", + "colors": [ + "DragonGreen3", + "Dino Deep Blue", + "WyvernBlue0", + "Dino Light Green", + "Dino Light Blue", + "WyvernPurple1", + "Light Yellow", + "Cyan", + "WyvernBlue0", + "DragonBase0", + "DragonBase1" + ] + }, + { + "name": "White fur", + "colors": [ + "Dino Light Yellow", + "Dino Light Orange", + "Dino Light Brown", + "Dino Light Green", + "Dino Light Blue", + "Dino Light Purple", + "Light Grey", + "DragonGreen2", + "BigFoot5", + "BigFoot0", + "Black" + ] + }, + { + "name": "Red fur", + "colors": [ + "Dino Dark Orange", + "Dino Dark Yellow", + "Dino Medium Green", + "DragonBase0", + "DragonFire", + "DragonGreen3", + "WyvernPurple0", + "WyvernBlue1", + "Dino Medium Brown", + "Dino Dark Brown", + "Dark Grey", + "Dino Darker Grey", + "Black" + ] + } + ] + }, { "blueprintPath": "/Game/PrimalEarth/Dinos/Achatina/Achatina_Character_BP.Achatina_Character_BP", "skipWildLevelStats": 520 @@ -2401,6 +4071,281 @@ "blueprintPath": "/Game/PrimalEarth/Dinos/Oviraptor/Oviraptor_Character_BP.Oviraptor_Character_BP", "skipWildLevelStats": 512 }, + { + "blueprintPath": "/Game/PrimalEarth/Dinos/Oviraptor/Oviraptor_Character_BP_Aberrant.Oviraptor_Character_BP_Aberrant", + "name": "Aberrant Oviraptor", + "fullStatsRaw": [ + [ 140, 0.2, 0.27, 0.5, 0 ], + [ 120, 0.1, 0.1, 0, 0 ], + [ 125, 0.06, 0, 0.5, 0 ], + [ 150, 0.1, 0.1, 0, 0 ], + [ 900, 0.1, 0.1, 0, 0.15 ], + null, + null, + [ 100, 0.02, 0.04, 0, 0 ], + [ 1, 0.05, 0.1, 1, 0.4 ], + [ 1, 0, 0.01, 1, 0.15 ], + null, + null + ], + "breeding": { + "gestationTime": 0, + "incubationTime": 4090.58184, + "eggTempMin": 26, + "eggTempMax": 30, + "maturationTime": 75757.5758, + "matingCooldownMin": 64800, + "matingCooldownMax": 172800 + }, + "taming": { + "nonViolent": false, + "violent": true, + "tamingIneffectiveness": 16.66667, + "affinityNeeded0": 960, + "affinityIncreasePL": 42, + "torporDepletionPS0": 0.208, + "foodConsumptionBase": 0.001302, + "foodConsumptionMult": 768.0491, + "babyFoodConsumptionMult": 510 + }, + "boneDamageAdjusters": { + "c_head": 3, + "c_jaw": 3, + "c_neck3": 3 + }, + "TamedBaseHealthMultiplier": 0.96, + "displayedStats": 927, + "skipWildLevelStats": 512, + "colors": [ + { + "name": "Main", + "colors": [ + "Dino Light Orange", + "Dino Dark Orange", + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Light Green", + "Dino Medium Green", + "Dino Light Blue", + "Dino Dark Blue", + "Dino Light Purple", + "Dino Light Brown", + "Dino Medium Brown", + "Dino Dark Brown", + "Light Grey", + "Dino Darker Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen2", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "WyvernBlue1", + "NearBlack", + "DarkTurquoise", + "GreenSlate", + "Sage", + "DarkWarmGray", + "MediumWarmGray", + "LightWarmGray", + "DarkCement", + "LightCement", + "LightAutumn", + "Mustard", + "MidnightBlue", + "DarkBlue", + "BlackSands", + "Glacial", + "Cammo", + "DryMoss", + "Custard" + ] + }, + { + "name": "Beak", + "colors": [ + "Dino Light Orange", + "Dino Light Brown", + "Dino Medium Brown", + "Dino Dark Brown", + "Light Grey", + "Dino Darker Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", + "NearBlack", + "DarkWarmGray", + "MediumWarmGray", + "LightWarmGray", + "BurntSienna", + "LightAutumn", + "Cream" + ] + }, + { + "name": "Spikes", + "colors": [ + "Dino Light Orange", + "Dino Dark Orange", + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Light Green", + "Dino Medium Green", + "Dino Light Blue", + "Dino Dark Blue", + "Dino Light Purple", + "Dino Light Brown", + "Dino Medium Brown", + "Dino Dark Brown", + "Light Grey", + "Dino Darker Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen2", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "WyvernBlue1", + "NearBlack", + "DarkTurquoise", + "GreenSlate", + "Sage", + "DarkWarmGray", + "MediumWarmGray", + "LightWarmGray", + "DarkCement", + "LightCement", + "LightAutumn", + "Mustard", + "MidnightBlue", + "DarkBlue", + "BlackSands", + "Glacial", + "Cammo", + "DryMoss", + "Custard" + ] + }, + null, + { + "name": "Highlights", + "colors": [ + "Dino Light Orange", + "Dino Dark Orange", + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Light Green", + "Dino Medium Green", + "Dino Light Blue", + "Dino Dark Blue", + "Dino Light Purple", + "Dino Light Brown", + "Dino Medium Brown", + "Dino Dark Brown", + "Light Grey", + "Dino Darker Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen2", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "WyvernBlue1", + "NearBlack", + "DarkTurquoise", + "GreenSlate", + "Sage", + "DarkWarmGray", + "MediumWarmGray", + "LightWarmGray", + "DarkCement", + "LightCement", + "LightAutumn", + "Mustard", + "MidnightBlue", + "DarkBlue", + "BlackSands", + "Glacial", + "Cammo", + "DryMoss", + "Custard" + ] + }, + { + "name": "Belly", + "colors": [ + "Dino Light Orange", + "Dino Light Yellow", + "Dino Dark Yellow", + "Dino Light Green", + "Dino Medium Green", + "Dino Light Blue", + "Dino Light Purple", + "Dino Light Brown", + "Dino Medium Brown", + "Light Grey", + "Dino Albino", + "BigFoot0", + "BigFoot4", + "BigFoot5", + "WolfFur", + "DarkWolfFur", + "DragonBase0", + "DragonBase1", + "DragonGreen0", + "DragonGreen1", + "DragonGreen2", + "DragonGreen3", + "WyvernPurple0", + "WyvernPurple1", + "WyvernBlue0", + "Dino Medium Blue", + "LightWarmGray", + "LightCement", + "Coral", + "Orange", + "Peach", + "LightAutumn", + "Mustard", + "PowderBlue", + "Glacial", + "DryMoss", + "Custard", + "Cream" + ] + } + ] + }, { "blueprintPath": "/Game/PrimalEarth/Dinos/Pachy/Pachy_Character_BP.Pachy_Character_BP", "skipWildLevelStats": 512 @@ -2532,7 +4477,7 @@ { "blueprintPath": "/Game/PrimalEarth/Dinos/Rhyniognatha/Rhynio_Character_BP.Rhynio_Character_BP", "fullStatsRaw": [ - [ 900, 0.17, 0.1755, 0.5, 0 ], + [ 900, 0.136, 0.1404, 0.5, 0 ], [ 350, 0.05, 0.06, 0, 0 ], [ 800, 0.06, 0, 0.5, 0 ], [ 800, 0.1, 0.1, 0, 0 ], diff --git a/ARKBreedingStats/json/values/_manifest.json b/ARKBreedingStats/json/values/_manifest.json index 885a849af..56074530e 100644 --- a/ARKBreedingStats/json/values/_manifest.json +++ b/ARKBreedingStats/json/values/_manifest.json @@ -181,7 +181,7 @@ "mod": { "id": "1734595558", "tag": "Pyria2", "title": "Pyria: The Second Chapter" } }, "1754846792-Zythara_Critters.json": { - "version": "358.17.1696180721", + "version": "358.24.1725312197", "mod": { "id": "1754846792", "tag": "Zythara_Critters", "title": "Zythara Critters" } }, "1768499278-BalancedJPE.json": { @@ -286,7 +286,7 @@ "mod": { "id": "2135314513", "tag": "CI_Dinos", "title": "Crystal Isles Dino Addition" } }, "2212177129-Hybridthing.json": { - "version": "358.11.1692981202", + "version": "358.24.1720347505", "mod": { "id": "2212177129", "tag": "Hybridthing", "title": "Sid's Hybrids" } }, "2247209652-MonstersandMore.json": { @@ -378,7 +378,7 @@ "mod": { "id": "883957187", "tag": "WyvernWorld", "title": "Wyvern World" } }, "893735676-AE.json": { - "version": "358.24.1701815786", + "version": "358.24.1722401686", "mod": { "id": "893735676", "tag": "AE", "title": "Ark Eternal" } }, "895711211-ClassicFlyers.json": { @@ -398,7 +398,7 @@ "mod": { "id": "919470289", "tag": "SSFlyer", "title": "SSFlyer" } }, "ASA-values.json": { - "version": "43.4.104", + "version": "52.1.118", "format": "1.16-mod-remap", "mod": { "id": "ASA", "tag": "", "title": "Ark: Survival Ascended", "shortTitle": "ASA", "official": true } }, diff --git a/ARKBreedingStats/library/Creature.cs b/ARKBreedingStats/library/Creature.cs index 331d9f5a3..696ba5e37 100644 --- a/ARKBreedingStats/library/Creature.cs +++ b/ARKBreedingStats/library/Creature.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; +using ARKBreedingStats.library; namespace ARKBreedingStats.Library { @@ -232,6 +233,9 @@ public DateTime? growingUntil [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public List tags = new List(); + [JsonProperty("traits", DefaultValueHandling = DefaultValueHandling.Ignore)] + public List Traits; + /// /// Used to display the creature's position in a list. /// @@ -601,6 +605,13 @@ public void InitializeFlags() flags = (flags & ~CreatureFlags.Mutated) | (Mutations > 0 ? CreatureFlags.Mutated : CreatureFlags.None); } + public void AddTrait(CreatureTrait trait) + { + if (Traits == null) + Traits = new List { trait }; + else Traits.Add(trait); + } + /// /// Calculates the pretame wild level. This value can be off due to wrong inputs due to ingame rounding. /// diff --git a/ARKBreedingStats/library/CreatureInfoGraphic.cs b/ARKBreedingStats/library/CreatureInfoGraphic.cs index 2291cf6dc..3ba3154be 100644 --- a/ARKBreedingStats/library/CreatureInfoGraphic.cs +++ b/ARKBreedingStats/library/CreatureInfoGraphic.cs @@ -2,6 +2,7 @@ using ARKBreedingStats.species; using System; using System.Drawing; +using System.Drawing.Text; using System.Linq; using System.Windows.Forms; @@ -15,16 +16,9 @@ public static class CreatureInfoGraphic /// CreatureCollection for server settings. public static Bitmap InfoGraphic(this Creature creature, CreatureCollection cc) { - var fontName = Properties.Settings.Default.InfoGraphicFontName; - if (string.IsNullOrWhiteSpace(fontName)) - { - fontName = "Arial"; - Properties.Settings.Default.InfoGraphicFontName = fontName; - } - return InfoGraphic(creature, cc, Properties.Settings.Default.InfoGraphicHeight, - fontName, + GetUserFont(), Properties.Settings.Default.InfoGraphicForeColor, Properties.Settings.Default.InfoGraphicBackColor, Properties.Settings.Default.InfoGraphicBorderColor, @@ -39,6 +33,20 @@ public static Bitmap InfoGraphic(this Creature creature, CreatureCollection cc) Properties.Settings.Default.InfoGraphicShowRegionNamesIfNoImage); } + /// + /// Gets user set font. If not font is set, Arial is set. + /// + /// + private static string GetUserFont() + { + var fontName = Properties.Settings.Default.InfoGraphicFontName; + if (string.IsNullOrWhiteSpace(fontName)) + { + fontName = "Arial"; + Properties.Settings.Default.InfoGraphicFontName = fontName; + } + return fontName; + } /// /// Creates an image with infos about the creature. @@ -51,20 +59,20 @@ public static Bitmap InfoGraphic(this Creature creature, CreatureCollection cc, { if (creature?.Species == null) return null; var secondaryCulture = Loc.UseSecondaryCulture; - int maxGraphLevel = cc?.maxChartLevel ?? 0; + var maxGraphLevel = cc?.maxChartLevel ?? 0; if (maxGraphLevel < 1) maxGraphLevel = 50; - int height = infoGraphicHeight < 1 ? 180 : infoGraphicHeight; // 180 - int width = height * 12 / 6; // 330 + var height = infoGraphicHeight < 1 ? 180 : infoGraphicHeight; // 180 + var width = height * 12 / 6; // 330 if (displayExtraRegionNames) width += height / 2; - int fontSize = Math.Max(5, height / 18); // 10 - int fontSizeSmall = Math.Max(5, height * 2 / 45); // 8 - int fontSizeHeader = Math.Max(5, height / 15); // 12 - int frameThickness = Math.Max(1, height / 180); + var fontSize = Math.Max(5, height / 18); // 10 + var fontSizeSmall = Math.Max(5, height * 2 / 45); // 8 + var fontSizeHeader = Math.Max(5, height / 15); // 12 + var frameThickness = Math.Max(1, height / 180); - int statLineHeight = height * 5 / 59; // 15 + var statLineHeight = height * 5 / 59; // 15 var bmp = new Bitmap(width, height); using (var g = Graphics.FromImage(bmp)) @@ -77,7 +85,8 @@ public static Bitmap InfoGraphic(this Creature creature, CreatureCollection cc, using (var stringFormatRightUp = new StringFormat { Alignment = StringAlignment.Far, LineAlignment = StringAlignment.Far }) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; - int currentYPosition = frameThickness * 3; + g.TextRenderingHint = TextRenderingHint.AntiAlias; + var currentYPosition = frameThickness * 3; using (var backgroundBrush = new SolidBrush(backColor)) g.FillRectangle(backgroundBrush, 0, 0, width, height); @@ -101,7 +110,7 @@ public static Bitmap InfoGraphic(this Creature creature, CreatureCollection cc, else creatureLevel = creature.LevelHatched.ToString(); - string creatureInfos = $"{Loc.S("Level", secondaryCulture: secondaryCulture)} {creatureLevel} | {Utils.SexSymbol(creature.sex) + (creature.flags.HasFlag(CreatureFlags.Neutered) ? $" ({Loc.S(creature.sex == Sex.Female ? "Spayed" : "Neutered", secondaryCulture: secondaryCulture)})" : string.Empty)}"; + var creatureInfos = $"{Loc.S("Level", secondaryCulture: secondaryCulture)} {creatureLevel} | {Utils.SexSymbol(creature.sex) + (creature.flags.HasFlag(CreatureFlags.Neutered) ? $" ({Loc.S(creature.sex == Sex.Female ? "Spayed" : "Neutered", secondaryCulture: secondaryCulture)})" : string.Empty)}"; if (displayMutations) creatureInfos += $" | {Loc.S("mutation counter", secondaryCulture: secondaryCulture)} {creature.Mutations}"; if (displayGenerations) @@ -125,16 +134,16 @@ public static Bitmap InfoGraphic(this Creature creature, CreatureCollection cc, currentYPosition += 2; // levels - double meanLetterWidth = fontSize * 7d / 10; - int xStatName = (int)meanLetterWidth; + var meanLetterWidth = fontSize * 7d / 10; + var xStatName = (int)meanLetterWidth; var displayMutatedLevels = !displaySumWildMutLevels && creature.levelsMutated != null && cc?.Game == Ark.Asa; // x position of level number. torpor is the largest level number. - int xRightLevelValue = (int)(xStatName + (6 + creature.levelsWild[Stats.Torpidity].ToString().Length) * meanLetterWidth); - int xRightLevelMutValue = xRightLevelValue + (!displayMutatedLevels ? 0 : (int)((creature.levelsMutated.Max().ToString().Length + 2) * meanLetterWidth)); - int xRightLevelDomValue = xRightLevelMutValue + (!displayWithDomLevels ? 0 : (int)((creature.levelsDom.Max().ToString().Length + 1) * meanLetterWidth)); - int xRightBrValue = (int)(xRightLevelDomValue + (2 + MaxCharLength(creature.valuesBreeding)) * meanLetterWidth); - int maxBoxLength = xRightBrValue - xStatName; - int statBoxHeight = Math.Max(2, height / 90); + var xRightLevelValue = (int)(xStatName + (6 + creature.levelsWild[Stats.Torpidity].ToString().Length) * meanLetterWidth); + var xRightLevelMutValue = xRightLevelValue + (!displayMutatedLevels ? 0 : (int)((creature.levelsMutated.Max().ToString().Length + 2) * meanLetterWidth)); + var xRightLevelDomValue = xRightLevelMutValue + (!displayWithDomLevels ? 0 : (int)((creature.levelsDom.Max().ToString().Length + 1) * meanLetterWidth)); + var xRightBrValue = (int)(xRightLevelDomValue + (2 + MaxCharLength(creature.valuesBreeding)) * meanLetterWidth); + var maxBoxLength = xRightBrValue - xStatName; + var statBoxHeight = Math.Max(2, height / 90); g.DrawString(Loc.S("W", secondaryCulture: secondaryCulture) + (displaySumWildMutLevels ? "+" + Loc.S("M", secondaryCulture: secondaryCulture) : string.Empty) , font, fontBrush, xRightLevelValue - (displayMutatedLevels || displayWithDomLevels ? (int)meanLetterWidth : 0), currentYPosition, stringFormatRight); if (displayMutatedLevels) @@ -143,28 +152,28 @@ public static Bitmap InfoGraphic(this Creature creature, CreatureCollection cc, g.DrawString(Loc.S("D", secondaryCulture: secondaryCulture), font, fontBrush, xRightLevelDomValue, currentYPosition, stringFormatRight); if (displayStatValues) g.DrawString(Loc.S("Values", secondaryCulture: secondaryCulture), font, fontBrush, xRightBrValue, currentYPosition, stringFormatRight); - int statDisplayIndex = 0; + var statDisplayIndex = 0; foreach (var si in Stats.DisplayOrder) { if (si == Stats.Torpidity || !creature.Species.UsesStat(si)) continue; - int y = currentYPosition + (height / 9) + (statDisplayIndex++) * statLineHeight; + var y = currentYPosition + (height / 9) + (statDisplayIndex++) * statLineHeight; // box // empty box to show the max possible length using (var b = new SolidBrush(Color.DarkGray)) g.FillRectangle(b, xStatName, y + statLineHeight - 1, maxBoxLength, statBoxHeight); - double levelFractionOfMax = Math.Min(1, (double)creature.levelsWild[si] / maxGraphLevel); + var levelFractionOfMax = Math.Min(1, (double)creature.levelsWild[si] / maxGraphLevel); if (levelFractionOfMax < 0) levelFractionOfMax = 0; - int levelPercentageOfMax = (int)(100 * levelFractionOfMax); - int statBoxLength = Math.Max((int)(maxBoxLength * levelFractionOfMax), 1); + var levelPercentageOfMax = (int)(100 * levelFractionOfMax); + var statBoxLength = Math.Max((int)(maxBoxLength * levelFractionOfMax), 1); var statColor = Utils.GetColorFromPercent(levelPercentageOfMax); using (var b = new SolidBrush(statColor)) g.FillRectangle(b, xStatName, y + statLineHeight - 1, statBoxLength, statBoxHeight); using (var b = new SolidBrush(Color.FromArgb(10, statColor))) { - for (int r = 4; r > 0; r--) + for (var r = 4; r > 0; r--) g.FillRectangle(b, xStatName - r, y + statLineHeight - 2 - r, statBoxLength + 2 * r, statBoxHeight + 2 * r); } using (var p = new Pen(Utils.GetColorFromPercent(levelPercentageOfMax, -0.5), 1)) @@ -187,7 +196,7 @@ public static Bitmap InfoGraphic(this Creature creature, CreatureCollection cc, // stat breeding value if (displayStatValues && creature.valuesBreeding != null) { - double displayedValue = + var displayedValue = displayWithDomLevels ? creature.valuesDom[si] : creature.valuesBreeding[si]; string statValueRepresentation; if (displayedValue < 0) @@ -210,13 +219,13 @@ public static Bitmap InfoGraphic(this Creature creature, CreatureCollection cc, } // colors - int xColor = (int)(xRightBrValue + meanLetterWidth * 3.5); - int circleDiameter = height * 4 / 45; - int colorRowHeight = circleDiameter + 2; + var xColor = (int)(xRightBrValue + meanLetterWidth * 3.5); + var circleDiameter = height * 4 / 45; + var colorRowHeight = circleDiameter + 2; - bool creatureImageShown = false; - int extraMarginBottom = displayMaxWildLevel ? fontSizeSmall : 0; - int imageSize = (int)Math.Min(width - xColor - circleDiameter - 8 * meanLetterWidth - frameThickness * 4, + var creatureImageShown = false; + var extraMarginBottom = displayMaxWildLevel ? fontSizeSmall : 0; + var imageSize = (int)Math.Min(width - xColor - circleDiameter - 8 * meanLetterWidth - frameThickness * 4, height - currentYPosition - frameThickness * 4 - extraMarginBottom); if (imageSize > 5) { @@ -233,54 +242,14 @@ public static Bitmap InfoGraphic(this Creature creature, CreatureCollection cc, } } - int maxColorNameLength = (int)((width - xColor - circleDiameter - (creatureImageShown ? imageSize : 0)) * 1.5 / meanLetterWidth); // max char length for the color region name + var maxColorNameLength = (int)((width - xColor - circleDiameter - (creatureImageShown ? imageSize : 0)) * 1.5 / meanLetterWidth); // max char length for the color region name if (maxColorNameLength < 0) maxColorNameLength = 0; if (creature.colors != null) { g.DrawString(Loc.S("Colors", secondaryCulture: secondaryCulture), font, fontBrush, xColor, currentYPosition); - int colorRow = 0; - for (int ci = 0; ci < Ark.ColorRegionCount; ci++) - { - if (!creature.Species.EnabledColorRegions[ci]) - continue; - - int y = currentYPosition + (height / 9) + (colorRow++) * colorRowHeight; - - Color c = CreatureColors.CreatureColor(creature.colors[ci]); - //Color fc = Utils.ForeColor(c); - - using (var b = new SolidBrush(c)) - g.FillEllipse(b, xColor, y, circleDiameter, circleDiameter); - g.DrawEllipse(borderAroundColors, xColor, y, circleDiameter, circleDiameter); - - string colorRegionName = null; - //string colorName = CreatureColors.CreatureColorName(creature.colors[ci]); - - if (displayExtraRegionNames || (!creatureImageShown && displayRegionNamesIfNoImage)) - { - colorRegionName = creature.Species.colors?[ci]?.name; - if (colorRegionName != null) - { - int totalColorLength = colorRegionName.Length + 11; - if (totalColorLength > maxColorNameLength) - { - // shorten color region name - int lengthForRegionName = - colorRegionName.Length - (totalColorLength - maxColorNameLength); - colorRegionName = lengthForRegionName < 2 - ? string.Empty - : colorRegionName.Substring(0, lengthForRegionName - 1) + "…"; - } - - if (!string.IsNullOrEmpty(colorRegionName)) - colorRegionName = " (" + colorRegionName + ")"; - } - } - - g.DrawString($"{creature.colors[ci]} - [{ci}]{colorRegionName}", - fontSmall, fontBrush, xColor + circleDiameter + 4, y); - } + DrawColors(creature.Species, creature.colors, displayExtraRegionNames, displayRegionNamesIfNoImage, currentYPosition, height, colorRowHeight, + g, xColor, circleDiameter, borderAroundColors, creatureImageShown, maxColorNameLength, fontSmall, fontBrush); } // mutagen @@ -312,6 +281,54 @@ public static Bitmap InfoGraphic(this Creature creature, CreatureCollection cc, return bmp; } + private static void DrawColors(Species species, byte[] creatureColors, bool displayExtraRegionNames, bool displayRegionNamesIfNoImage, + int currentYPosition, int height, int colorRowHeight, Graphics g, int xColor, int circleDiameter, + Pen borderAroundColors, bool creatureImageShown, int maxColorNameLength, Font fontSmall, SolidBrush fontBrush) + { + var colorRow = 0; + for (var ci = 0; ci < Ark.ColorRegionCount; ci++) + { + if (!species.EnabledColorRegions[ci]) + continue; + + var y = currentYPosition + (height / 9) + (colorRow++) * colorRowHeight; + + var c = CreatureColors.CreatureColor(creatureColors[ci]); + //Color fc = Utils.ForeColor(c); + + using (var b = new SolidBrush(c)) + g.FillEllipse(b, xColor, y, circleDiameter, circleDiameter); + g.DrawEllipse(borderAroundColors, xColor, y, circleDiameter, circleDiameter); + + string colorRegionName = null; + //string colorName = CreatureColors.CreatureColorName(creature.colors[ci]); + + if (displayExtraRegionNames || (!creatureImageShown && displayRegionNamesIfNoImage)) + { + colorRegionName = species.colors?[ci]?.name; + if (colorRegionName != null) + { + var totalColorLength = colorRegionName.Length + 11; + if (totalColorLength > maxColorNameLength) + { + // shorten color region name + var lengthForRegionName = + colorRegionName.Length - (totalColorLength - maxColorNameLength); + colorRegionName = lengthForRegionName < 2 + ? string.Empty + : colorRegionName.Substring(0, lengthForRegionName - 1) + "…"; + } + + if (!string.IsNullOrEmpty(colorRegionName)) + colorRegionName = " (" + colorRegionName + ")"; + } + } + + g.DrawString($"[{ci}] {creatureColors[ci]}{colorRegionName}", + fontSmall, fontBrush, xColor + circleDiameter + 4, y); + } + } + /// /// If the text is too long, the smaller font size is returned to fit the available width. /// @@ -328,10 +345,10 @@ private static float CalculateFontSize(Graphics g, string text, Font font, int a /// private static int MaxCharLength(double[] values) { - int max = 0; - for (int si = 0; si < Stats.StatsCount; si++) + var max = 0; + for (var si = 0; si < Stats.StatsCount; si++) { - int l = values[si].ToString("0").Length + Stats.Precision(si); + var l = values[si].ToString("0").Length + Stats.Precision(si); if (l > max) max = l; } return max; @@ -352,5 +369,59 @@ public static void ExportInfoGraphicToClipboard(this Creature creature, Creature Clipboard.SetImage(bmp); } } + + /// + /// Returns the coloredCreature Image with additional info about the colors. + /// + public static Image GetImageWithColors(Image coloredCreature, byte[] creatureColors, Species species) + { + return CreateImageWithColors(coloredCreature, creatureColors, species, + Properties.Settings.Default.InfoGraphicHeight, + GetUserFont(), + Properties.Settings.Default.InfoGraphicForeColor, + Properties.Settings.Default.InfoGraphicBackColor, + Properties.Settings.Default.InfoGraphicExtraRegionNames, + Properties.Settings.Default.InfoGraphicShowRegionNamesIfNoImage); + } + + /// + /// Returns the coloredCreature Image with additional info about the colors. + /// + private static Image CreateImageWithColors(Image coloredCreature, byte[] creatureColors, Species species, + int infoGraphicHeight, string fontName, Color foreColor, Color backColor, + bool displayExtraRegionNames, bool displayRegionNamesIfNoImage) + { + const int margin = 10; + var height = coloredCreature.Height; + var width = (int)(coloredCreature.Width * (displayExtraRegionNames ? 2 : 1.5)); + var widthForColors = width - coloredCreature.Width; + var circleDiameter = height * 4 / 45; + var fontSize = circleDiameter * 6 / 10; + var meanLetterWidth = fontSize * 7d / 10; + var heightWithoutHeader = height; + height += fontSize; + + var maxColorNameLength = (int)((widthForColors - circleDiameter) * 1.5 / meanLetterWidth); // max char length for the color region name + if (maxColorNameLength < 0) maxColorNameLength = 0; + + var bmp = new Bitmap(width, height); + using (var g = Graphics.FromImage(bmp)) + using (var font = new Font(fontName, fontSize)) + using (var fontBrush = new SolidBrush(foreColor)) + using (var borderAroundColors = new Pen(Utils.ForeColor(backColor), 1)) + { + g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; + g.TextRenderingHint = TextRenderingHint.AntiAlias; + + g.DrawString(species.DescriptiveNameAndMod, font, fontBrush, margin, margin); + + g.DrawImage(coloredCreature, 0, 0); + DrawColors(species, creatureColors, displayExtraRegionNames, displayRegionNamesIfNoImage, fontSize, + heightWithoutHeader, (heightWithoutHeader - 4 * margin) / Ark.ColorRegionCount, g, coloredCreature.Width + margin, + circleDiameter, borderAroundColors, true, maxColorNameLength, font, fontBrush); + } + + return bmp; + } } } diff --git a/ARKBreedingStats/library/CreatureTrait.cs b/ARKBreedingStats/library/CreatureTrait.cs new file mode 100644 index 000000000..0f3c28076 --- /dev/null +++ b/ARKBreedingStats/library/CreatureTrait.cs @@ -0,0 +1,33 @@ +using Newtonsoft.Json; + +namespace ARKBreedingStats.library +{ + /// + /// Can give bonus or malus on inheritance or mutations. + /// + [JsonObject] + public class CreatureTrait + { + [JsonProperty("n")] + public string Name; + [JsonProperty("si")] + public int StatIndex; + [JsonProperty("t")] + public byte Tier; + /// + /// Robust + /// + [JsonProperty("r", DefaultValueHandling = DefaultValueHandling.Ignore)] + public double InheritHigherLevelBonus; + /// + /// Frail + /// + [JsonProperty("f", DefaultValueHandling = DefaultValueHandling.Ignore)] + public double InheritLowerLevelBonus; + /// + /// Mutable + /// + [JsonProperty("m", DefaultValueHandling = DefaultValueHandling.Ignore)] + public double MutationChanceBonus; + } +} diff --git a/ARKBreedingStats/local/strings.resx b/ARKBreedingStats/local/strings.resx index 38e4e4cad..395b2ac55 100644 --- a/ARKBreedingStats/local/strings.resx +++ b/ARKBreedingStats/local/strings.resx @@ -1358,4 +1358,22 @@ It's also possible to filter for creatures with a color in one of multiple possi paste + + /* + JavaScript patterns are enabled by using the text "#!javascript" as the first line of the pattern. + The script must return the creature name as a string. + Creature values are available as global properties. e.g. this.hp, globalThis.hp or just `${hp}` + + In addition to the standard JavaScript functions, additional functions include: + log(text): + Writes the text to the javascript console + + customReplace(key, defaultValue): + Replaces the text with a value saved in the file customReplacings.json. + If a second parameter is given, that is returned if the key is not available. + + listName(index, suffix): + Takes a name from a list in the file creatureNames[suffix].txt +*/ + \ No newline at end of file diff --git a/ARKBreedingStats/multiplierTesting/StatsMultiplierTesting.cs b/ARKBreedingStats/multiplierTesting/StatsMultiplierTesting.cs index 202bead33..2522b5fe1 100644 --- a/ARKBreedingStats/multiplierTesting/StatsMultiplierTesting.cs +++ b/ARKBreedingStats/multiplierTesting/StatsMultiplierTesting.cs @@ -763,12 +763,14 @@ private void CopySpeciesStatsToClipboard(string speciesBlueprintPath = null, dou var sv = _statControls[s].StatValues; if (sv == null || sv.All(v => v == 0)) { - sb.AppendLine(" null,"); + sb.Append(" null"); } else { - sb.AppendLine($" [ {string.Join(", ", sv)} ],"); + sb.Append($" [ {string.Join(", ", sv)} ]"); } + + sb.AppendLine(s + 1 < Stats.StatsCount ? "," : string.Empty); } sb.AppendLine("]"); diff --git a/ARKBreedingStats/ocr/OCRControl.cs b/ARKBreedingStats/ocr/OCRControl.cs index 3136bc763..7a93ee70e 100644 --- a/ARKBreedingStats/ocr/OCRControl.cs +++ b/ARKBreedingStats/ocr/OCRControl.cs @@ -739,6 +739,7 @@ private void buttonGetResFromScreenshot_Click(object sender, EventArgs e) private void nudResizing_ValueChanged(object sender, EventArgs e) { + if (ArkOcr.Ocr.ocrConfig == null) return; ArkOcr.Ocr.ocrConfig.resize = (double)nudResizing.Value; UpdateResizeResultLabel(); } diff --git a/ARKBreedingStats/settings/Settings.cs b/ARKBreedingStats/settings/Settings.cs index fdf41fbb3..158297678 100644 --- a/ARKBreedingStats/settings/Settings.cs +++ b/ARKBreedingStats/settings/Settings.cs @@ -1882,7 +1882,7 @@ private void BtnUpdateOfficialEventValues_Click(object sender, EventArgs e) private void BtOpenLevelColorOptions_Click(object sender, EventArgs e) { - LevelGraphOptionsControl.ShowWindow(this, _statsLevelColors); + StatsOptionsForm.ShowWindow(this, _statsLevelColors, null); } } } diff --git a/ARKBreedingStats/uiControls/LibraryInfoControl.cs b/ARKBreedingStats/uiControls/LibraryInfoControl.cs index 7cef2e3e8..e8ea1379d 100644 --- a/ARKBreedingStats/uiControls/LibraryInfoControl.cs +++ b/ARKBreedingStats/uiControls/LibraryInfoControl.cs @@ -2,6 +2,7 @@ using System.Drawing; using System.Linq; using System.Windows.Forms; +using ARKBreedingStats.library; using ARKBreedingStats.Library; using ARKBreedingStats.species; using ARKBreedingStats.utils; @@ -47,10 +48,10 @@ private void InitializeControls() _tlbMain.Controls.Add(TlpColorInfoText, 0, 0); _tlbMain.SetRowSpan(TlpColorInfoText, 2); - const int buttonsTotalWidth = 444; + const int buttonsTotalWidth = 850; const int buttonMargins = 6; // color region buttons - var flpButtons = new FlowLayoutPanel { Dock = DockStyle.Fill, Height = 180 }; + var flpButtons = new FlowLayoutPanel { Dock = DockStyle.Fill, Height = 103 }; _colorRegionButtons = new Button[Ark.ColorRegionCount]; for (int i = 0; i < Ark.ColorRegionCount; i++) { @@ -59,13 +60,14 @@ private void InitializeControls() Text = i.ToString(), TextAlign = ContentAlignment.MiddleCenter, Tag = i, - Width = buttonsTotalWidth / 3 - buttonMargins, + Width = buttonsTotalWidth / 6 - buttonMargins, Height = 70 }; _colorRegionButtons[i] = bt; bt.Click += ButtonRegionClick; flpButtons.Controls.Add(bt); } + flpButtons.SetFlowBreak(_colorRegionButtons.Last(), true); var colorsButton = new Button { @@ -109,17 +111,18 @@ private void InitializeControls() flpButtons.Controls.Add(colorsButton); _tlbMain.Controls.Add(flpButtons, 1, 0); + _tlbMain.SetColumnSpan(flpButtons, 2); _colorPicker = new ColorPickerControl(); _colorPicker.CbOnlyNatural.Checked = false; _colorPicker.DisableAlternativeColor(); _tlbMain.Controls.Add(_colorPicker, 1, 1); _colorPicker.UserMadeSelection += ColorPickerColorChosen; - _tlbMain.Controls.Add(_speciesPictureBox, 2, 0); + _tlbMain.Controls.Add(_speciesPictureBox, 2, 1); _tlbMain.SetRowSpan(_speciesPictureBox, 2); _speciesPictureBox.Click += _speciesPictureBoxClick; - _tt.SetToolTip(_speciesPictureBox, "Click to copy image to the clipboard"); + _tt.SetToolTip(_speciesPictureBox, "Click to copy image to the clipboard\nLeft click: plain image\nRight click: image with color info"); } private void ButtonClearColorsClick(object sender, EventArgs e) @@ -192,6 +195,7 @@ public void SetSpecies(Species species) SetRegionColorButton(i); _colorRegionButtons[0].PerformClick(); UpdateCreatureImage(); + _tlbMain.PerformLayout(); } public void SetRegionColorButton(int region) @@ -213,7 +217,10 @@ public void UpdateCreatureImage() private void _speciesPictureBoxClick(object sender, EventArgs e) { if (_speciesPictureBox.Image == null) return; - Clipboard.SetImage(_speciesPictureBox.Image); + if (e is MouseEventArgs me && me.Button == MouseButtons.Right) + Clipboard.SetImage(CreatureInfoGraphic.GetImageWithColors(_speciesPictureBox.Image, _selectedColors, _species)); + else + Clipboard.SetImage(_speciesPictureBox.Image); } } } diff --git a/ARKBreedingStats/uiControls/StatIO.cs b/ARKBreedingStats/uiControls/StatIO.cs index 81e0e491e..5d9bb7757 100644 --- a/ARKBreedingStats/uiControls/StatIO.cs +++ b/ARKBreedingStats/uiControls/StatIO.cs @@ -299,7 +299,7 @@ private void numLvW_ValueChanged(object sender, EventArgs e) private void nudLvM_ValueChanged(object sender, EventArgs e) { - SetLevelBar(panelBarMutLevels, (int)nudLvM.Value); + SetLevelBar(panelBarMutLevels, (int)nudLvM.Value, false, true); if (_linkWildMutated && _wildMutatedSum != -1) { @@ -312,15 +312,15 @@ private void nudLvM_ValueChanged(object sender, EventArgs e) private void numLvD_ValueChanged(object sender, EventArgs e) { - SetLevelBar(panelBarDomLevels, (int)nudLvD.Value); + SetLevelBar(panelBarDomLevels, (int)nudLvD.Value, false); if (_inputType != StatIOInputType.FinalValueInputType) LevelChangedDebouncer(); } - private void SetLevelBar(Panel panel, int level) + private void SetLevelBar(Panel panel, int level, bool useCustomOdd = true, bool mutationLevel = false) { - var range = _statLevelColors.GetLevelRange(level, out var lowerBound); + var range = _statLevelColors.GetLevelRange(level, out var lowerBound, useCustomOdd, mutationLevel); if (range < 1) range = 1; var lengthPercentage = 100 * (level - lowerBound) / range; // in percentage of the max bar width @@ -328,7 +328,7 @@ private void SetLevelBar(Panel panel, int level) else if (lengthPercentage < 0) lengthPercentage = 0; panel.Width = lengthPercentage * MaxBarLength / 100; - panel.BackColor = _statLevelColors.GetLevelColor(level); + panel.BackColor = _statLevelColors.GetLevelColor(level, useCustomOdd, mutationLevel); } private void LevelChangedDebouncer() => _levelChangedDebouncer.Debounce(200, FireLevelChanged, Dispatcher.CurrentDispatcher); @@ -414,13 +414,14 @@ public bool LinkWildMutated public void SetStatOptions(StatLevelColors so) { + if (_statLevelColors == so) return; _statLevelColors = so; if (nudLvW.Value > 0) SetLevelBar(panelBarWildLevels, (int)nudLvW.Value); if (nudLvD.Value > 0) - SetLevelBar(panelBarDomLevels, (int)nudLvD.Value); + SetLevelBar(panelBarDomLevels, (int)nudLvD.Value, false); if (nudLvM.Value > 0) - SetLevelBar(panelBarMutLevels, (int)nudLvM.Value); + SetLevelBar(panelBarMutLevels, (int)nudLvM.Value, false, true); } } diff --git a/ARKBreedingStats/utils/ControlExtensions.cs b/ARKBreedingStats/utils/ControlExtensions.cs index 0da3cb303..15374fc5b 100644 --- a/ARKBreedingStats/utils/ControlExtensions.cs +++ b/ARKBreedingStats/utils/ControlExtensions.cs @@ -42,5 +42,14 @@ public static void SetBackColorAndAccordingForeColor(this Control control, Syste control.BackColor = backColor; control.ForeColor = Utils.ForeColor(backColor); } + + /// + /// 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. + /// + public static void SetBackColorAndAccordingForeColor(this ListViewItem.ListViewSubItem control, System.Drawing.Color backColor) + { + control.BackColor = backColor; + control.ForeColor = Utils.ForeColor(backColor); + } } } \ No newline at end of file