diff --git a/pkNX.WinForms/Controls/EncounterList.cs b/pkNX.WinForms/Controls/EncounterList.cs index 24afe7b8..2663b3af 100644 --- a/pkNX.WinForms/Controls/EncounterList.cs +++ b/pkNX.WinForms/Controls/EncounterList.cs @@ -80,7 +80,6 @@ private void UpdateRowImage(int row) public void LoadSlots(EncounterSlot[] slots) { - SaveCurrent(); Slots = slots; dgv.Rows.Clear(); diff --git a/pkNX.WinForms/Subforms/GGWE.Designer.cs b/pkNX.WinForms/Subforms/GGWE.Designer.cs index c8e5aa6a..876d1c0c 100644 --- a/pkNX.WinForms/Subforms/GGWE.Designer.cs +++ b/pkNX.WinForms/Subforms/GGWE.Designer.cs @@ -34,19 +34,28 @@ private void InitializeComponent() this.L_Rank = new System.Windows.Forms.Label(); this.TC_Tables = new System.Windows.Forms.TabControl(); this.Tab_Ground = new System.Windows.Forms.TabPage(); + this.EL_Ground = new pkNX.WinForms.EncounterList(); this.Tab_Water = new System.Windows.Forms.TabPage(); + this.EL_Water = new pkNX.WinForms.EncounterList(); this.Tab_Old = new System.Windows.Forms.TabPage(); + this.EL_Old = new pkNX.WinForms.EncounterList(); this.Tab_Good = new System.Windows.Forms.TabPage(); + this.EL_Good = new pkNX.WinForms.EncounterList(); this.Tab_Super = new System.Windows.Forms.TabPage(); + this.EL_Super = new pkNX.WinForms.EncounterList(); this.Tab_Sky = new System.Windows.Forms.TabPage(); + this.EL_Sky = new pkNX.WinForms.EncounterList(); + this.Tab_Rand = new System.Windows.Forms.TabPage(); + this.B_RandAll = new System.Windows.Forms.Button(); + this.PG_Species = new System.Windows.Forms.PropertyGrid(); + this.NUD_ModDuration = new System.Windows.Forms.NumericUpDown(); + this.NUD_ModRate = new System.Windows.Forms.NumericUpDown(); + this.NUD_ModCount = new System.Windows.Forms.NumericUpDown(); + this.B_ModDuration = new System.Windows.Forms.Button(); + this.B_ModRate = new System.Windows.Forms.Button(); + this.B_ModSpawn = new System.Windows.Forms.Button(); this.L_Hash = new System.Windows.Forms.Label(); this.B_Save = new System.Windows.Forms.Button(); - this.EL_Ground = new pkNX.WinForms.EncounterList(); - this.EL_Water = new pkNX.WinForms.EncounterList(); - this.EL_Old = new pkNX.WinForms.EncounterList(); - this.EL_Good = new pkNX.WinForms.EncounterList(); - this.EL_Super = new pkNX.WinForms.EncounterList(); - this.EL_Sky = new pkNX.WinForms.EncounterList(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RankMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RankMax)).BeginInit(); this.TC_Tables.SuspendLayout(); @@ -56,6 +65,10 @@ private void InitializeComponent() this.Tab_Good.SuspendLayout(); this.Tab_Super.SuspendLayout(); this.Tab_Sky.SuspendLayout(); + this.Tab_Rand.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ModDuration)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ModRate)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ModCount)).BeginInit(); this.SuspendLayout(); // // CB_Location @@ -65,7 +78,7 @@ private void InitializeComponent() this.CB_Location.FormattingEnabled = true; this.CB_Location.Location = new System.Drawing.Point(12, 12); this.CB_Location.Name = "CB_Location"; - this.CB_Location.Size = new System.Drawing.Size(203, 21); + this.CB_Location.Size = new System.Drawing.Size(207, 21); this.CB_Location.TabIndex = 3; this.CB_Location.SelectedIndexChanged += new System.EventHandler(this.CB_Location_SelectedIndexChanged); // @@ -103,10 +116,11 @@ private void InitializeComponent() this.TC_Tables.Controls.Add(this.Tab_Good); this.TC_Tables.Controls.Add(this.Tab_Super); this.TC_Tables.Controls.Add(this.Tab_Sky); + this.TC_Tables.Controls.Add(this.Tab_Rand); this.TC_Tables.Location = new System.Drawing.Point(12, 78); this.TC_Tables.Name = "TC_Tables"; this.TC_Tables.SelectedIndex = 0; - this.TC_Tables.Size = new System.Drawing.Size(317, 426); + this.TC_Tables.Size = new System.Drawing.Size(321, 426); this.TC_Tables.TabIndex = 10; // // Tab_Ground @@ -114,61 +128,216 @@ private void InitializeComponent() this.Tab_Ground.Controls.Add(this.EL_Ground); this.Tab_Ground.Location = new System.Drawing.Point(4, 22); this.Tab_Ground.Name = "Tab_Ground"; - this.Tab_Ground.Size = new System.Drawing.Size(309, 400); + this.Tab_Ground.Size = new System.Drawing.Size(313, 400); this.Tab_Ground.TabIndex = 0; this.Tab_Ground.Text = "Ground"; this.Tab_Ground.UseVisualStyleBackColor = true; // + // EL_Ground + // + this.EL_Ground.Dock = System.Windows.Forms.DockStyle.Fill; + this.EL_Ground.Location = new System.Drawing.Point(0, 0); + this.EL_Ground.Name = "EL_Ground"; + this.EL_Ground.Size = new System.Drawing.Size(313, 400); + this.EL_Ground.TabIndex = 14; + // // Tab_Water // this.Tab_Water.Controls.Add(this.EL_Water); this.Tab_Water.Location = new System.Drawing.Point(4, 22); this.Tab_Water.Name = "Tab_Water"; - this.Tab_Water.Size = new System.Drawing.Size(309, 400); + this.Tab_Water.Size = new System.Drawing.Size(313, 400); this.Tab_Water.TabIndex = 1; this.Tab_Water.Text = "Water"; this.Tab_Water.UseVisualStyleBackColor = true; // + // EL_Water + // + this.EL_Water.Dock = System.Windows.Forms.DockStyle.Fill; + this.EL_Water.Location = new System.Drawing.Point(0, 0); + this.EL_Water.Name = "EL_Water"; + this.EL_Water.Size = new System.Drawing.Size(313, 400); + this.EL_Water.TabIndex = 13; + // // Tab_Old // this.Tab_Old.Controls.Add(this.EL_Old); this.Tab_Old.Location = new System.Drawing.Point(4, 22); this.Tab_Old.Name = "Tab_Old"; - this.Tab_Old.Size = new System.Drawing.Size(309, 400); + this.Tab_Old.Size = new System.Drawing.Size(313, 400); this.Tab_Old.TabIndex = 2; this.Tab_Old.Text = "Old"; this.Tab_Old.UseVisualStyleBackColor = true; // + // EL_Old + // + this.EL_Old.Dock = System.Windows.Forms.DockStyle.Fill; + this.EL_Old.Location = new System.Drawing.Point(0, 0); + this.EL_Old.Name = "EL_Old"; + this.EL_Old.Size = new System.Drawing.Size(313, 400); + this.EL_Old.TabIndex = 13; + // // Tab_Good // this.Tab_Good.Controls.Add(this.EL_Good); this.Tab_Good.Location = new System.Drawing.Point(4, 22); this.Tab_Good.Name = "Tab_Good"; - this.Tab_Good.Size = new System.Drawing.Size(309, 400); + this.Tab_Good.Size = new System.Drawing.Size(313, 400); this.Tab_Good.TabIndex = 3; this.Tab_Good.Text = "Good"; this.Tab_Good.UseVisualStyleBackColor = true; // + // EL_Good + // + this.EL_Good.Dock = System.Windows.Forms.DockStyle.Fill; + this.EL_Good.Location = new System.Drawing.Point(0, 0); + this.EL_Good.Name = "EL_Good"; + this.EL_Good.Size = new System.Drawing.Size(313, 400); + this.EL_Good.TabIndex = 13; + // // Tab_Super // this.Tab_Super.Controls.Add(this.EL_Super); this.Tab_Super.Location = new System.Drawing.Point(4, 22); this.Tab_Super.Name = "Tab_Super"; - this.Tab_Super.Size = new System.Drawing.Size(309, 400); + this.Tab_Super.Size = new System.Drawing.Size(313, 400); this.Tab_Super.TabIndex = 4; this.Tab_Super.Text = "Super"; this.Tab_Super.UseVisualStyleBackColor = true; // + // EL_Super + // + this.EL_Super.Dock = System.Windows.Forms.DockStyle.Fill; + this.EL_Super.Location = new System.Drawing.Point(0, 0); + this.EL_Super.Name = "EL_Super"; + this.EL_Super.Size = new System.Drawing.Size(313, 400); + this.EL_Super.TabIndex = 12; + // // Tab_Sky // this.Tab_Sky.Controls.Add(this.EL_Sky); this.Tab_Sky.Location = new System.Drawing.Point(4, 22); this.Tab_Sky.Name = "Tab_Sky"; - this.Tab_Sky.Size = new System.Drawing.Size(309, 400); + this.Tab_Sky.Size = new System.Drawing.Size(313, 400); this.Tab_Sky.TabIndex = 5; this.Tab_Sky.Text = "Sky"; this.Tab_Sky.UseVisualStyleBackColor = true; // + // EL_Sky + // + this.EL_Sky.Dock = System.Windows.Forms.DockStyle.Fill; + this.EL_Sky.Location = new System.Drawing.Point(0, 0); + this.EL_Sky.Name = "EL_Sky"; + this.EL_Sky.Size = new System.Drawing.Size(313, 400); + this.EL_Sky.TabIndex = 12; + // + // Tab_Rand + // + this.Tab_Rand.Controls.Add(this.B_RandAll); + this.Tab_Rand.Controls.Add(this.PG_Species); + this.Tab_Rand.Controls.Add(this.NUD_ModDuration); + this.Tab_Rand.Controls.Add(this.NUD_ModRate); + this.Tab_Rand.Controls.Add(this.NUD_ModCount); + this.Tab_Rand.Controls.Add(this.B_ModDuration); + this.Tab_Rand.Controls.Add(this.B_ModRate); + this.Tab_Rand.Controls.Add(this.B_ModSpawn); + this.Tab_Rand.Location = new System.Drawing.Point(4, 22); + this.Tab_Rand.Name = "Tab_Rand"; + this.Tab_Rand.Padding = new System.Windows.Forms.Padding(3); + this.Tab_Rand.Size = new System.Drawing.Size(313, 400); + this.Tab_Rand.TabIndex = 6; + this.Tab_Rand.Text = "Rand"; + this.Tab_Rand.UseVisualStyleBackColor = true; + // + // B_RandAll + // + this.B_RandAll.Location = new System.Drawing.Point(6, 110); + this.B_RandAll.Name = "B_RandAll"; + this.B_RandAll.Size = new System.Drawing.Size(142, 26); + this.B_RandAll.TabIndex = 7; + this.B_RandAll.Text = "Randomize All Species"; + this.B_RandAll.UseVisualStyleBackColor = true; + this.B_RandAll.Click += new System.EventHandler(this.B_RandAll_Click); + // + // propertyGrid1 + // + this.PG_Species.Location = new System.Drawing.Point(0, 142); + this.PG_Species.Name = "PG_Species"; + this.PG_Species.Size = new System.Drawing.Size(313, 258); + this.PG_Species.TabIndex = 6; + this.PG_Species.ToolbarVisible = false; + // + // NUD_ModDuration + // + this.NUD_ModDuration.Location = new System.Drawing.Point(149, 75); + this.NUD_ModDuration.Maximum = new decimal(new int[] { + 300, + 0, + 0, + 0}); + this.NUD_ModDuration.Name = "NUD_ModDuration"; + this.NUD_ModDuration.Size = new System.Drawing.Size(47, 20); + this.NUD_ModDuration.TabIndex = 5; + // + // NUD_ModRate + // + this.NUD_ModRate.Location = new System.Drawing.Point(149, 43); + this.NUD_ModRate.Name = "NUD_ModRate"; + this.NUD_ModRate.Size = new System.Drawing.Size(47, 20); + this.NUD_ModRate.TabIndex = 4; + this.NUD_ModRate.Value = new decimal(new int[] { + 10, + 0, + 0, + 0}); + // + // NUD_ModCount + // + this.NUD_ModCount.Location = new System.Drawing.Point(149, 11); + this.NUD_ModCount.Maximum = new decimal(new int[] { + 300, + 0, + 0, + 0}); + this.NUD_ModCount.Name = "NUD_ModCount"; + this.NUD_ModCount.Size = new System.Drawing.Size(47, 20); + this.NUD_ModCount.TabIndex = 3; + this.NUD_ModCount.Value = new decimal(new int[] { + 10, + 0, + 0, + 0}); + // + // B_ModDuration + // + this.B_ModDuration.Location = new System.Drawing.Point(6, 70); + this.B_ModDuration.Name = "B_ModDuration"; + this.B_ModDuration.Size = new System.Drawing.Size(142, 26); + this.B_ModDuration.TabIndex = 2; + this.B_ModDuration.Text = "Modify All Spawn Duration"; + this.B_ModDuration.UseVisualStyleBackColor = true; + this.B_ModDuration.Click += new System.EventHandler(this.B_ModDuration_Click); + // + // B_ModRate + // + this.B_ModRate.Location = new System.Drawing.Point(6, 38); + this.B_ModRate.Name = "B_ModRate"; + this.B_ModRate.Size = new System.Drawing.Size(142, 26); + this.B_ModRate.TabIndex = 1; + this.B_ModRate.Text = "Modify All Spawn Rate"; + this.B_ModRate.UseVisualStyleBackColor = true; + this.B_ModRate.Click += new System.EventHandler(this.B_ModRate_Click); + // + // B_ModSpawn + // + this.B_ModSpawn.Location = new System.Drawing.Point(6, 6); + this.B_ModSpawn.Name = "B_ModSpawn"; + this.B_ModSpawn.Size = new System.Drawing.Size(142, 26); + this.B_ModSpawn.TabIndex = 0; + this.B_ModSpawn.Text = "Modify All Spawn Count"; + this.B_ModSpawn.UseVisualStyleBackColor = true; + this.B_ModSpawn.Click += new System.EventHandler(this.B_ModCount_Click); + // // L_Hash // this.L_Hash.AutoSize = true; @@ -182,7 +351,7 @@ private void InitializeComponent() // B_Save // this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.B_Save.Location = new System.Drawing.Point(264, 0); + this.B_Save.Location = new System.Drawing.Point(268, 0); this.B_Save.Name = "B_Save"; this.B_Save.Size = new System.Drawing.Size(75, 23); this.B_Save.TabIndex = 12; @@ -190,59 +359,11 @@ private void InitializeComponent() this.B_Save.UseVisualStyleBackColor = true; this.B_Save.Click += new System.EventHandler(this.B_Save_Click); // - // EL_Ground - // - this.EL_Ground.Dock = System.Windows.Forms.DockStyle.Fill; - this.EL_Ground.Location = new System.Drawing.Point(0, 0); - this.EL_Ground.Name = "EL_Ground"; - this.EL_Ground.Size = new System.Drawing.Size(309, 400); - this.EL_Ground.TabIndex = 14; - // - // EL_Water - // - this.EL_Water.Dock = System.Windows.Forms.DockStyle.Fill; - this.EL_Water.Location = new System.Drawing.Point(0, 0); - this.EL_Water.Name = "EL_Water"; - this.EL_Water.Size = new System.Drawing.Size(309, 400); - this.EL_Water.TabIndex = 13; - // - // EL_Old - // - this.EL_Old.Dock = System.Windows.Forms.DockStyle.Fill; - this.EL_Old.Location = new System.Drawing.Point(0, 0); - this.EL_Old.Name = "EL_Old"; - this.EL_Old.Size = new System.Drawing.Size(309, 400); - this.EL_Old.TabIndex = 13; - // - // EL_Good - // - this.EL_Good.Dock = System.Windows.Forms.DockStyle.Fill; - this.EL_Good.Location = new System.Drawing.Point(0, 0); - this.EL_Good.Name = "EL_Good"; - this.EL_Good.Size = new System.Drawing.Size(309, 400); - this.EL_Good.TabIndex = 13; - // - // EL_Super - // - this.EL_Super.Dock = System.Windows.Forms.DockStyle.Fill; - this.EL_Super.Location = new System.Drawing.Point(0, 0); - this.EL_Super.Name = "EL_Super"; - this.EL_Super.Size = new System.Drawing.Size(309, 400); - this.EL_Super.TabIndex = 12; - // - // EL_Sky - // - this.EL_Sky.Dock = System.Windows.Forms.DockStyle.Fill; - this.EL_Sky.Location = new System.Drawing.Point(0, 0); - this.EL_Sky.Name = "EL_Sky"; - this.EL_Sky.Size = new System.Drawing.Size(309, 400); - this.EL_Sky.TabIndex = 12; - // // GGWE // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(344, 516); + this.ClientSize = new System.Drawing.Size(346, 516); this.Controls.Add(this.B_Save); this.Controls.Add(this.L_Hash); this.Controls.Add(this.TC_Tables); @@ -262,6 +383,10 @@ private void InitializeComponent() this.Tab_Good.ResumeLayout(false); this.Tab_Super.ResumeLayout(false); this.Tab_Sky.ResumeLayout(false); + this.Tab_Rand.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ModDuration)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ModRate)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ModCount)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -287,5 +412,14 @@ private void InitializeComponent() private EncounterList EL_Good; private System.Windows.Forms.Label L_Hash; private System.Windows.Forms.Button B_Save; + private System.Windows.Forms.TabPage Tab_Rand; + private System.Windows.Forms.Button B_RandAll; + private System.Windows.Forms.PropertyGrid PG_Species; + private System.Windows.Forms.NumericUpDown NUD_ModDuration; + private System.Windows.Forms.NumericUpDown NUD_ModRate; + private System.Windows.Forms.NumericUpDown NUD_ModCount; + private System.Windows.Forms.Button B_ModDuration; + private System.Windows.Forms.Button B_ModRate; + private System.Windows.Forms.Button B_ModSpawn; } } \ No newline at end of file diff --git a/pkNX.WinForms/Subforms/GGWE.cs b/pkNX.WinForms/Subforms/GGWE.cs index 2e751ef8..877fa606 100644 --- a/pkNX.WinForms/Subforms/GGWE.cs +++ b/pkNX.WinForms/Subforms/GGWE.cs @@ -4,25 +4,28 @@ using System.Windows.Forms; using pkNX.Containers; using pkNX.Game; +using pkNX.Randomization; using pkNX.Structures; namespace pkNX.WinForms { public partial class GGWE : Form { - private EncounterArchive Tables; + private readonly EncounterArchive Tables; + private readonly GameManager ROM; private int entry = -1; - public GGWE(GameManager ROM, string json) + public GGWE(GameManager rom, string json) { InitializeComponent(); EncounterArchive obj = EncounterArchive.ReadJson(json); + ROM = rom; - var spec = ROM.GetStrings(TextName.SpeciesNames); + var spec = rom.GetStrings(TextName.SpeciesNames); var species = (string[]) spec.Clone(); species[0] = ""; EncounterList.species = species; - var locs = ROM.GetStrings(TextName.metlist_000000); + var locs = rom.GetStrings(TextName.metlist_000000); EL_Ground.Initialize(); EL_Water.Initialize(); @@ -37,14 +40,24 @@ public GGWE(GameManager ROM, string json) EL_Old.OverworldSpawn = EL_Good.OverworldSpawn = EL_Super.OverworldSpawn = false; L_Rank.Visible = NUD_RankMin.Visible = NUD_RankMax.Visible = false; - LoadFile(obj, locs); + PG_Species.SelectedObject = new SpeciesSettings + { + Gen2 = false, + Gen3 = false, + Gen4 = false, + Gen5 = false, + Gen6 = false, + Gen7 = false, + }; + + Tables = obj; + LoadFile(locs); CB_Location.SelectedIndex = 0; } - public void LoadFile(EncounterArchive arc, string[] locationNames) + public void LoadFile(string[] locationNames) { - Tables = arc; - var locs = arc.EncounterTables.Select(z => z.ZoneID); + var locs = Tables.EncounterTables.Select(z => z.ZoneID); var names = GetNames(locs, locationNames); var dupeNamed = GetScreenedNames(names); @@ -182,6 +195,7 @@ private void LoadEntry(int i) EL_Old.LoadSlots(arr.OldRodTable); EL_Good.LoadSlots(arr.GoodRodTable); EL_Super.LoadSlots(arr.SuperRodTable); + EL_Sky.LoadSlots(arr.SkyTable); EL_Ground.NUD_Min.Value = arr.GroundTableLevelMin; EL_Ground.NUD_Max.Value = arr.GroundTableLevelMax; @@ -212,8 +226,6 @@ private void LoadEntry(int i) EL_Sky.NUD_SpawnRate.Value = arr.SkyTableEncounterRate; EL_Sky.NUD_Count.Value = arr.SkySpawnCountMax; EL_Sky.NUD_Duration.Value = arr.SkySpawnDuration; - - EL_Sky.LoadSlots(arr.SkyTable); } private void SaveEntry(int i) @@ -255,17 +267,18 @@ private void SaveEntry(int i) arr.SkySpawnCountMax = (int)EL_Sky.NUD_Count.Value; arr.SkySpawnDuration = (int)EL_Sky.NUD_Duration.Value; - EL_Ground.LoadSlots(arr.GroundTable); - EL_Water.LoadSlots(arr.WaterTable); - EL_Old.LoadSlots(arr.OldRodTable); - EL_Good.LoadSlots(arr.GoodRodTable); - EL_Super.LoadSlots(arr.SuperRodTable); + EL_Ground.SaveCurrent(); + EL_Water.SaveCurrent(); + EL_Old.SaveCurrent(); + EL_Good.SaveCurrent(); + EL_Super.SaveCurrent(); } public string Result { get; set; } private void B_Save_Click(object sender, EventArgs e) { + SaveEntry(entry); EL_Ground.SaveCurrent(); EL_Water.SaveCurrent(); EL_Old.SaveCurrent(); @@ -276,5 +289,85 @@ private void B_Save_Click(object sender, EventArgs e) // Clipboard.SetText(Result); Close(); } + + private void B_ModCount_Click(object sender, EventArgs e) + { + SaveEntry(entry); + foreach (var area in Tables.EncounterTables) + { + if (area.GroundSpawnCountMax != 0) + area.GroundSpawnCountMax = (int)NUD_ModCount.Value; + if (area.WaterSpawnCountMax != 0) + area.WaterSpawnCountMax = (int)NUD_ModCount.Value; + if (area.SkySpawnCountMax != 0) + area.SkySpawnCountMax = (int)NUD_ModCount.Value; + } + LoadEntry(entry); + System.Media.SystemSounds.Asterisk.Play(); + } + + private void B_ModRate_Click(object sender, EventArgs e) + { + SaveEntry(entry); + foreach (var area in Tables.EncounterTables) + { + if (area.GroundTableEncounterRate != 0) + area.GroundTableEncounterRate = (int)NUD_ModCount.Value; + if (area.WaterTableEncounterRate != 0) + area.WaterTableEncounterRate = (int)NUD_ModCount.Value; + if (area.SkyTableEncounterRate != 0) + area.SkyTableEncounterRate = (int)NUD_ModCount.Value; + } + LoadEntry(entry); + System.Media.SystemSounds.Asterisk.Play(); + } + + private void B_ModDuration_Click(object sender, EventArgs e) + { + SaveEntry(entry); + foreach (var area in Tables.EncounterTables) + { + if (area.GroundSpawnDuration != 0) + area.GroundSpawnDuration = (int)NUD_ModDuration.Value; + if (area.WaterSpawnDuration != 0) + area.WaterSpawnDuration = (int)NUD_ModDuration.Value; + if (area.SkySpawnDuration != 0) + area.SkySpawnDuration = (int)NUD_ModDuration.Value; + } + LoadEntry(entry); + System.Media.SystemSounds.Asterisk.Play(); + } + + private void B_RandAll_Click(object sender, EventArgs e) + { + SaveEntry(entry); + var settings = (SpeciesSettings) PG_Species.SelectedObject; + var rand = new SpeciesRandomizer(ROM.Info, ROM.Data.PersonalData); + rand.Initialize(settings); + foreach (var area in Tables.EncounterTables) + { + ApplyRand(area.GroundTable); + ApplyRand(area.WaterTable); + ApplyRand(area.SkyTable); + + ApplyRand(area.OldRodTable); + ApplyRand(area.GoodRodTable); + ApplyRand(area.SuperRodTable); + + void ApplyRand(IEnumerable slots) + { + foreach (var s in slots) + { + if (s.Species == 0) + continue; + + s.Species = rand.GetRandomSpecies(s.Species); + // meh form + } + } + } + LoadEntry(entry); + System.Media.SystemSounds.Asterisk.Play(); + } } }