From 8537bb56e1697b3837908d505e4666567cda0cf3 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 21 Jan 2023 22:02:21 -0800 Subject: [PATCH] Replace "Set All 6 Stars" with "Copy To Others" Closes #3727 Hold shift to copy the seed too, otherwise it will keep the existing seed randomness. --- .../Substructures/Gen9/RaidSpawnList9.cs | 23 ++++++- .../Save Editors/Gen9/SAV_Raid9.Designer.cs | 62 +++++++++++-------- .../Subforms/Save Editors/Gen9/SAV_Raid9.cs | 12 +--- 3 files changed, 60 insertions(+), 37 deletions(-) diff --git a/PKHeX.Core/Saves/Substructures/Gen9/RaidSpawnList9.cs b/PKHeX.Core/Saves/Substructures/Gen9/RaidSpawnList9.cs index f031e7890..b8273c88b 100644 --- a/PKHeX.Core/Saves/Substructures/Gen9/RaidSpawnList9.cs +++ b/PKHeX.Core/Saves/Substructures/Gen9/RaidSpawnList9.cs @@ -39,6 +39,27 @@ public sealed class RaidSpawnList9 : SaveBlock get => ReadUInt64LittleEndian(Data.AsSpan(0x08)); set => WriteUInt64LittleEndian(Data.AsSpan(0x08), value); } + + /// + /// Copies content from the raid to all other raid details with valid position data. + /// + /// Source raid detail + /// Copy the RNG seed + public void Propagate(int sourceIndex, bool seedToo) + { + var current = GetRaid(sourceIndex); + for (int i = 0; i < CountUsed; i++) + { + var raid = GetRaid(i); + if (raid.AreaID == 0) + continue; + raid.IsEnabled = current.IsEnabled; + raid.Content = current.Content; + raid.IsClaimedLeaguePoints = current.IsClaimedLeaguePoints; + if (seedToo) + raid.Seed = current.Seed; + } + } } public sealed class TeraRaidDetail @@ -99,7 +120,7 @@ public sealed class TeraRaidDetail set => WriteUInt32LittleEndian(Data.AsSpan(Offset + 0x14), value); } - [Category(General), Description("Indicates if the raid crystal is overriden to be a 6-Star Black Raid.")] + [Category(General), Description("Indicates the source of the Raid encounter data and rewards.")] public TeraRaidContentType Content { get => (TeraRaidContentType)ReadUInt32LittleEndian(Data.AsSpan(Offset + 0x18)); diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Raid9.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Raid9.Designer.cs index 0bee41e99..7892464b0 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Raid9.Designer.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Raid9.Designer.cs @@ -42,9 +42,10 @@ namespace PKHeX.WinForms // B_Cancel // this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Cancel.Location = new System.Drawing.Point(227, 286); + this.B_Cancel.Location = new System.Drawing.Point(280, 336); + this.B_Cancel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.B_Cancel.Name = "B_Cancel"; - this.B_Cancel.Size = new System.Drawing.Size(75, 23); + this.B_Cancel.Size = new System.Drawing.Size(96, 24); this.B_Cancel.TabIndex = 0; this.B_Cancel.Text = "Cancel"; this.B_Cancel.UseVisualStyleBackColor = true; @@ -53,9 +54,10 @@ namespace PKHeX.WinForms // B_Save // this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Save.Location = new System.Drawing.Point(227, 260); + this.B_Save.Location = new System.Drawing.Point(280, 304); + this.B_Save.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.B_Save.Name = "B_Save"; - this.B_Save.Size = new System.Drawing.Size(75, 23); + this.B_Save.Size = new System.Drawing.Size(96, 24); this.B_Save.TabIndex = 1; this.B_Save.Text = "Save"; this.B_Save.UseVisualStyleBackColor = true; @@ -66,10 +68,11 @@ namespace PKHeX.WinForms this.PG_Raid.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_Raid.Location = new System.Drawing.Point(12, 32); + this.PG_Raid.Location = new System.Drawing.Point(8, 40); + this.PG_Raid.Margin = new System.Windows.Forms.Padding(0); this.PG_Raid.Name = "PG_Raid"; this.PG_Raid.PropertySort = System.Windows.Forms.PropertySort.NoSort; - this.PG_Raid.Size = new System.Drawing.Size(290, 224); + this.PG_Raid.Size = new System.Drawing.Size(368, 256); this.PG_Raid.TabIndex = 2; this.PG_Raid.ToolbarVisible = false; // @@ -77,40 +80,44 @@ namespace PKHeX.WinForms // this.CB_Raid.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Raid.FormattingEnabled = true; - this.CB_Raid.Location = new System.Drawing.Point(12, 5); + this.CB_Raid.Location = new System.Drawing.Point(8, 8); + this.CB_Raid.Margin = new System.Windows.Forms.Padding(0); this.CB_Raid.Name = "CB_Raid"; - this.CB_Raid.Size = new System.Drawing.Size(103, 21); + this.CB_Raid.Size = new System.Drawing.Size(120, 23); this.CB_Raid.TabIndex = 3; this.CB_Raid.SelectedIndexChanged += new System.EventHandler(this.CB_Raid_SelectedIndexChanged); // // TB_SeedTomorrow // this.TB_SeedTomorrow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.TB_SeedTomorrow.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.TB_SeedTomorrow.Location = new System.Drawing.Point(101, 288); + this.TB_SeedTomorrow.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.TB_SeedTomorrow.Location = new System.Drawing.Point(120, 336); + this.TB_SeedTomorrow.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.TB_SeedTomorrow.MaxLength = 16; this.TB_SeedTomorrow.Name = "TB_SeedTomorrow"; - this.TB_SeedTomorrow.Size = new System.Drawing.Size(120, 20); + this.TB_SeedTomorrow.Size = new System.Drawing.Size(124, 20); this.TB_SeedTomorrow.TabIndex = 17; this.TB_SeedTomorrow.Text = "0000000000000000"; // // TB_SeedToday // this.TB_SeedToday.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.TB_SeedToday.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.TB_SeedToday.Location = new System.Drawing.Point(101, 262); + this.TB_SeedToday.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.TB_SeedToday.Location = new System.Drawing.Point(120, 304); + this.TB_SeedToday.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.TB_SeedToday.MaxLength = 16; this.TB_SeedToday.Name = "TB_SeedToday"; - this.TB_SeedToday.Size = new System.Drawing.Size(120, 20); + this.TB_SeedToday.Size = new System.Drawing.Size(124, 20); this.TB_SeedToday.TabIndex = 16; this.TB_SeedToday.Text = "0000000000000000"; // // L_SeedCurrent // this.L_SeedCurrent.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.L_SeedCurrent.Location = new System.Drawing.Point(12, 262); + this.L_SeedCurrent.Location = new System.Drawing.Point(8, 304); + this.L_SeedCurrent.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_SeedCurrent.Name = "L_SeedCurrent"; - this.L_SeedCurrent.Size = new System.Drawing.Size(83, 20); + this.L_SeedCurrent.Size = new System.Drawing.Size(97, 23); this.L_SeedCurrent.TabIndex = 18; this.L_SeedCurrent.Text = "Current Seed:"; this.L_SeedCurrent.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -118,29 +125,31 @@ namespace PKHeX.WinForms // L_SeedTomorrow // this.L_SeedTomorrow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.L_SeedTomorrow.Location = new System.Drawing.Point(12, 289); + this.L_SeedTomorrow.Location = new System.Drawing.Point(8, 336); + this.L_SeedTomorrow.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.L_SeedTomorrow.Name = "L_SeedTomorrow"; - this.L_SeedTomorrow.Size = new System.Drawing.Size(83, 20); + this.L_SeedTomorrow.Size = new System.Drawing.Size(97, 23); this.L_SeedTomorrow.TabIndex = 19; this.L_SeedTomorrow.Text = "Tomorrow:"; this.L_SeedTomorrow.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // B_Star6 // - this.B_Star6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Star6.Location = new System.Drawing.Point(178, 5); + this.B_Star6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.B_Star6.Location = new System.Drawing.Point(152, 8); + this.B_Star6.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.B_Star6.Name = "B_Star6"; - this.B_Star6.Size = new System.Drawing.Size(124, 23); + this.B_Star6.Size = new System.Drawing.Size(224, 24); this.B_Star6.TabIndex = 20; - this.B_Star6.Text = "Set All 6-Star"; + this.B_Star6.Text = "Copy to Other Raids"; this.B_Star6.UseVisualStyleBackColor = true; - this.B_Star6.Click += new System.EventHandler(this.B_Star6_Click); + this.B_Star6.Click += new System.EventHandler(this.B_CopyToOthers_Click); // // SAV_Raid9 // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(314, 321); + this.ClientSize = new System.Drawing.Size(384, 370); this.Controls.Add(this.B_Star6); this.Controls.Add(this.L_SeedTomorrow); this.Controls.Add(this.L_SeedCurrent); @@ -152,9 +161,10 @@ namespace PKHeX.WinForms this.Controls.Add(this.B_Cancel); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = global::PKHeX.WinForms.Properties.Resources.Icon; + this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.MaximizeBox = false; this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(330, 360); + this.MinimumSize = new System.Drawing.Size(382, 409); this.Name = "SAV_Raid9"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Raid Parameter Editor"; diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Raid9.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Raid9.cs index 8177fe8df..b5b72b9cc 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Raid9.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Raid9.cs @@ -73,17 +73,9 @@ public partial class SAV_Raid9 : Form Raids.TomorrowSeed = value; } - private void B_Star6_Click(object sender, EventArgs e) + private void B_CopyToOthers_Click(object sender, EventArgs e) { - foreach (var raid in Raids.GetAllRaids()) - { - if (raid.AreaID == 0) - continue; - raid.IsEnabled = true; - raid.Content = TeraRaidContentType.Black6; - raid.IsClaimedLeaguePoints = false; - } - CB_Raid_SelectedIndexChanged(sender, e); + Raids.Propagate(CB_Raid.SelectedIndex, seedToo: ModifierKeys == Keys.Shift); System.Media.SystemSounds.Asterisk.Play(); } }