diff --git a/pkNX.WinForms/Controls/EncounterTableEditor8a.Designer.cs b/pkNX.WinForms/Controls/EncounterTableEditor8a.Designer.cs index e1c5d3b3..57cdd233 100644 --- a/pkNX.WinForms/Controls/EncounterTableEditor8a.Designer.cs +++ b/pkNX.WinForms/Controls/EncounterTableEditor8a.Designer.cs @@ -31,7 +31,7 @@ private void InitializeComponent() this.B_NoShinyLocks = new System.Windows.Forms.Button(); this.PG_Encounters = new System.Windows.Forms.PropertyGrid(); this.CB_Encounters = new System.Windows.Forms.ComboBox(); - this.L_EncTableName = new System.Windows.Forms.Label(); + this.L_ConfigName = new System.Windows.Forms.Label(); this.SuspendLayout(); // // B_NoShinyLocks @@ -66,20 +66,20 @@ private void InitializeComponent() this.CB_Encounters.TabIndex = 6; this.CB_Encounters.SelectedIndexChanged += new System.EventHandler(this.CB_Encounters_SelectedIndexChanged); // - // L_EncTableName + // L_ConfigName // - this.L_EncTableName.AutoSize = true; - this.L_EncTableName.Location = new System.Drawing.Point(3, 1); - this.L_EncTableName.Name = "L_EncTableName"; - this.L_EncTableName.Size = new System.Drawing.Size(35, 13); - this.L_EncTableName.TabIndex = 9; - this.L_EncTableName.Text = "label1"; + this.L_ConfigName.AutoSize = true; + this.L_ConfigName.Location = new System.Drawing.Point(3, 1); + this.L_ConfigName.Name = "L_ConfigName"; + this.L_ConfigName.Size = new System.Drawing.Size(110, 13); + this.L_ConfigName.TabIndex = 9; + this.L_ConfigName.Text = "{Configured File Path}"; // // EncounterTableEditor8a // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.L_EncTableName); + this.Controls.Add(this.L_ConfigName); this.Controls.Add(this.B_NoShinyLocks); this.Controls.Add(this.PG_Encounters); this.Controls.Add(this.CB_Encounters); @@ -95,6 +95,6 @@ private void InitializeComponent() private System.Windows.Forms.Button B_NoShinyLocks; private System.Windows.Forms.PropertyGrid PG_Encounters; private System.Windows.Forms.ComboBox CB_Encounters; - private System.Windows.Forms.Label L_EncTableName; + private System.Windows.Forms.Label L_ConfigName; } } diff --git a/pkNX.WinForms/Controls/EncounterTableEditor8a.cs b/pkNX.WinForms/Controls/EncounterTableEditor8a.cs index a48fbec0..5c80f436 100644 --- a/pkNX.WinForms/Controls/EncounterTableEditor8a.cs +++ b/pkNX.WinForms/Controls/EncounterTableEditor8a.cs @@ -21,7 +21,7 @@ public void LoadTable(EncounterTable8a[] table, string path) } Visible = true; - L_EncTableName.Text = path; + L_ConfigName.Text = path; var items = table.Select(z => new ComboItem(z.TableName.Replace("\"", ""), z)).ToArray(); CB_Encounters.DisplayMember = nameof(ComboItem.Text); diff --git a/pkNX.WinForms/Controls/PlacementSpawnerEditor8a.Designer.cs b/pkNX.WinForms/Controls/PlacementSpawnerEditor8a.Designer.cs new file mode 100644 index 00000000..68a85183 --- /dev/null +++ b/pkNX.WinForms/Controls/PlacementSpawnerEditor8a.Designer.cs @@ -0,0 +1,100 @@ +namespace pkNX.WinForms.Controls +{ + partial class PlacementSpawnerEditor8a + { + /// + /// 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 Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.B_MaxSpawnCountRange = new System.Windows.Forms.Button(); + this.PG_Spawner = new System.Windows.Forms.PropertyGrid(); + this.CB_Encounters = new System.Windows.Forms.ComboBox(); + this.L_ConfigName = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // B_MaxSpawnCountRange + // + this.B_MaxSpawnCountRange.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.B_MaxSpawnCountRange.Location = new System.Drawing.Point(614, 0); + this.B_MaxSpawnCountRange.Name = "B_MaxSpawnCountRange"; + this.B_MaxSpawnCountRange.Size = new System.Drawing.Size(148, 23); + this.B_MaxSpawnCountRange.TabIndex = 8; + this.B_MaxSpawnCountRange.Text = "Max All Spawn Counts"; + this.B_MaxSpawnCountRange.UseVisualStyleBackColor = true; + this.B_MaxSpawnCountRange.Click += new System.EventHandler(this.B_MaxSpawnCountRange_Click); + // + // PG_Spawner + // + this.PG_Spawner.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.PG_Spawner.Location = new System.Drawing.Point(3, 38); + this.PG_Spawner.Name = "PG_Spawner"; + this.PG_Spawner.Size = new System.Drawing.Size(759, 548); + this.PG_Spawner.TabIndex = 7; + // + // CB_Encounters + // + this.CB_Encounters.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_Encounters.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_Encounters.FormattingEnabled = true; + this.CB_Encounters.Location = new System.Drawing.Point(3, 15); + this.CB_Encounters.Name = "CB_Encounters"; + this.CB_Encounters.Size = new System.Drawing.Size(174, 21); + this.CB_Encounters.TabIndex = 6; + this.CB_Encounters.SelectedIndexChanged += new System.EventHandler(this.CB_Encounters_SelectedIndexChanged); + // + // L_ConfigName + // + this.L_ConfigName.AutoSize = true; + this.L_ConfigName.Location = new System.Drawing.Point(3, 1); + this.L_ConfigName.Name = "L_ConfigName"; + this.L_ConfigName.Size = new System.Drawing.Size(110, 13); + this.L_ConfigName.TabIndex = 9; + this.L_ConfigName.Text = "{Configured File Path}"; + // + // PlacementSpawnerEditor8a + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.L_ConfigName); + this.Controls.Add(this.B_MaxSpawnCountRange); + this.Controls.Add(this.PG_Spawner); + this.Controls.Add(this.CB_Encounters); + this.Name = "PlacementSpawnerEditor8a"; + this.Size = new System.Drawing.Size(765, 589); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button B_MaxSpawnCountRange; + private System.Windows.Forms.PropertyGrid PG_Spawner; + private System.Windows.Forms.ComboBox CB_Encounters; + private System.Windows.Forms.Label L_ConfigName; + } +} diff --git a/pkNX.WinForms/Controls/PlacementSpawnerEditor8a.cs b/pkNX.WinForms/Controls/PlacementSpawnerEditor8a.cs new file mode 100644 index 00000000..cd11ab45 --- /dev/null +++ b/pkNX.WinForms/Controls/PlacementSpawnerEditor8a.cs @@ -0,0 +1,62 @@ +using System; +using System.Linq; +using System.Windows.Forms; +using pkNX.Structures.FlatBuffers; + +namespace pkNX.WinForms.Controls; + +public partial class PlacementSpawnerEditor8a : UserControl +{ + public PlacementSpawner8a[] Spawners = Array.Empty(); + + public PlacementSpawnerEditor8a() => InitializeComponent(); + + public void LoadTable(PlacementSpawner8a[] table, string path) + { + Spawners = table; + if (table.Length == 0) + { + Visible = false; + return; + } + + Visible = true; + L_ConfigName.Text = path; + + var items = table.Select(z => new ComboItem(z.NameSummary.Replace("\"", ""), z)).ToArray(); + CB_Encounters.DisplayMember = nameof(ComboItem.Text); + CB_Encounters.ValueMember = nameof(ComboItem.Value); + CB_Encounters.DataSource = new BindingSource(items, null); + + CB_Encounters.SelectedIndex = 0; + } + + private class ComboItem + { + public ComboItem(string text, T value) + { + Text = text; + Value = value; + } + + public string Text { get; } + public T Value { get; } + } + + private void CB_Encounters_SelectedIndexChanged(object sender, EventArgs e) + { + PG_Spawner.SelectedObject = (PlacementSpawner8a)CB_Encounters.SelectedValue; + } + + private void B_MaxSpawnCountRange_Click(object sender, EventArgs e) + { + const int count = 8; + foreach (var spawner in Spawners) + { + spawner.MinSpawnCount = spawner.MaxSpawnCount = count; + } + + WinFormsUtil.Alert($"Set all to have {count} entities spawned."); + CB_Encounters_SelectedIndexChanged(sender, e); + } +} diff --git a/pkNX.WinForms/Controls/PlacementSpawnerEditor8a.resx b/pkNX.WinForms/Controls/PlacementSpawnerEditor8a.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/pkNX.WinForms/Controls/PlacementSpawnerEditor8a.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/pkNX.WinForms/Subforms/AreaEditor8a.Designer.cs b/pkNX.WinForms/Subforms/AreaEditor8a.Designer.cs index c84192f3..1d56bc86 100644 --- a/pkNX.WinForms/Subforms/AreaEditor8a.Designer.cs +++ b/pkNX.WinForms/Subforms/AreaEditor8a.Designer.cs @@ -31,14 +31,18 @@ private void InitializeComponent() this.CB_Area = new System.Windows.Forms.ComboBox(); this.TC_Editor = new System.Windows.Forms.TabControl(); this.Tab_Encounters = new System.Windows.Forms.TabPage(); - this.Edit_Encounters = new pkNX.WinForms.Controls.EncounterTableEditor8a(); this.Tab_Regular = new System.Windows.Forms.TabPage(); this.Tab_Wormhole = new System.Windows.Forms.TabPage(); this.Tab_Landmarks = new System.Windows.Forms.TabPage(); this.Tab_Randomize = new System.Windows.Forms.TabPage(); this.B_Save = new System.Windows.Forms.Button(); + this.Edit_Encounters = new pkNX.WinForms.Controls.EncounterTableEditor8a(); + this.Edit_RegularSpawners = new pkNX.WinForms.Controls.PlacementSpawnerEditor8a(); + this.Edit_WormholeSpawners = new pkNX.WinForms.Controls.PlacementSpawnerEditor8a(); this.TC_Editor.SuspendLayout(); this.Tab_Encounters.SuspendLayout(); + this.Tab_Regular.SuspendLayout(); + this.Tab_Wormhole.SuspendLayout(); this.SuspendLayout(); // // CB_Area @@ -70,25 +74,16 @@ private void InitializeComponent() this.Tab_Encounters.Controls.Add(this.Edit_Encounters); this.Tab_Encounters.Location = new System.Drawing.Point(4, 22); this.Tab_Encounters.Name = "Tab_Encounters"; - this.Tab_Encounters.Padding = new System.Windows.Forms.Padding(3); this.Tab_Encounters.Size = new System.Drawing.Size(677, 455); this.Tab_Encounters.TabIndex = 0; this.Tab_Encounters.Text = "Encounters"; this.Tab_Encounters.UseVisualStyleBackColor = true; // - // Edit_Encounters - // - this.Edit_Encounters.Dock = System.Windows.Forms.DockStyle.Fill; - this.Edit_Encounters.Location = new System.Drawing.Point(3, 3); - this.Edit_Encounters.Name = "Edit_Encounters"; - this.Edit_Encounters.Size = new System.Drawing.Size(671, 449); - this.Edit_Encounters.TabIndex = 0; - // // Tab_Regular // + this.Tab_Regular.Controls.Add(this.Edit_RegularSpawners); this.Tab_Regular.Location = new System.Drawing.Point(4, 22); this.Tab_Regular.Name = "Tab_Regular"; - this.Tab_Regular.Padding = new System.Windows.Forms.Padding(3); this.Tab_Regular.Size = new System.Drawing.Size(677, 455); this.Tab_Regular.TabIndex = 1; this.Tab_Regular.Text = "*Regular"; @@ -96,6 +91,7 @@ private void InitializeComponent() // // Tab_Wormhole // + this.Tab_Wormhole.Controls.Add(this.Edit_WormholeSpawners); this.Tab_Wormhole.Location = new System.Drawing.Point(4, 22); this.Tab_Wormhole.Name = "Tab_Wormhole"; this.Tab_Wormhole.Size = new System.Drawing.Size(677, 455); @@ -132,6 +128,30 @@ private void InitializeComponent() this.B_Save.UseVisualStyleBackColor = true; this.B_Save.Click += new System.EventHandler(this.B_Save_Click); // + // Edit_Encounters + // + this.Edit_Encounters.Dock = System.Windows.Forms.DockStyle.Fill; + this.Edit_Encounters.Location = new System.Drawing.Point(0, 0); + this.Edit_Encounters.Name = "Edit_Encounters"; + this.Edit_Encounters.Size = new System.Drawing.Size(677, 455); + this.Edit_Encounters.TabIndex = 0; + // + // Edit_RegularSpawners + // + this.Edit_RegularSpawners.Dock = System.Windows.Forms.DockStyle.Fill; + this.Edit_RegularSpawners.Location = new System.Drawing.Point(0, 0); + this.Edit_RegularSpawners.Name = "Edit_RegularSpawners"; + this.Edit_RegularSpawners.Size = new System.Drawing.Size(677, 455); + this.Edit_RegularSpawners.TabIndex = 1; + // + // Edit_WormholeSpawners + // + this.Edit_WormholeSpawners.Dock = System.Windows.Forms.DockStyle.Fill; + this.Edit_WormholeSpawners.Location = new System.Drawing.Point(0, 0); + this.Edit_WormholeSpawners.Name = "Edit_WormholeSpawners"; + this.Edit_WormholeSpawners.Size = new System.Drawing.Size(677, 455); + this.Edit_WormholeSpawners.TabIndex = 2; + // // AreaEditor8a // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -145,6 +165,8 @@ private void InitializeComponent() this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AreaEditor8a_FormClosing); this.TC_Editor.ResumeLayout(false); this.Tab_Encounters.ResumeLayout(false); + this.Tab_Regular.ResumeLayout(false); + this.Tab_Wormhole.ResumeLayout(false); this.ResumeLayout(false); } @@ -159,5 +181,7 @@ private void InitializeComponent() private Controls.EncounterTableEditor8a Edit_Encounters; private System.Windows.Forms.TabPage Tab_Randomize; private System.Windows.Forms.Button B_Save; + private Controls.PlacementSpawnerEditor8a Edit_RegularSpawners; + private Controls.PlacementSpawnerEditor8a Edit_WormholeSpawners; } } \ No newline at end of file diff --git a/pkNX.WinForms/Subforms/AreaEditor8a.cs b/pkNX.WinForms/Subforms/AreaEditor8a.cs index 324352af..ee3ea1c8 100644 --- a/pkNX.WinForms/Subforms/AreaEditor8a.cs +++ b/pkNX.WinForms/Subforms/AreaEditor8a.cs @@ -63,6 +63,8 @@ private void LoadArea() { Debug.WriteLine($"Loading Area {AreaIndex}"); Edit_Encounters.LoadTable(Area.Encounters, Area.Settings.Encounters); + Edit_RegularSpawners.LoadTable(Area.Spawners, Area.Settings.Spawners); + Edit_WormholeSpawners.LoadTable(Area.Wormholes, Area.Settings.WormholeSpawners); } private void SaveArea() diff --git a/pkNX.WinForms/Subforms/AreaEditor8a.resx b/pkNX.WinForms/Subforms/AreaEditor8a.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/pkNX.WinForms/Subforms/AreaEditor8a.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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