From 6c870b2e89e7fb1160f0e721d00ea8f6e03fedcf Mon Sep 17 00:00:00 2001 From: berichan <66521620+berichan@users.noreply.github.com> Date: Sat, 7 Aug 2021 13:48:14 +0100 Subject: [PATCH] BulkSpawn alphabetically sorted DIY recipes --- NHSE.WinForms/Subforms/Map/BulkSpawn.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/NHSE.WinForms/Subforms/Map/BulkSpawn.cs b/NHSE.WinForms/Subforms/Map/BulkSpawn.cs index a22a16d..d352270 100644 --- a/NHSE.WinForms/Subforms/Map/BulkSpawn.cs +++ b/NHSE.WinForms/Subforms/Map/BulkSpawn.cs @@ -39,7 +39,7 @@ private void B_Apply_Click(object sender, EventArgs e) IReadOnlyList items; int sizeX; int sizeY; - if (type == SpawnType.SequentialDIY) + if (type is SpawnType.SequentialDIY or SpawnType.AlphabeticalDIY) { var min = (ushort)NUD_DIYStart.Value; var max = (ushort)NUD_DIYStop.Value; @@ -48,6 +48,9 @@ private void B_Apply_Click(object sender, EventArgs e) .Select(z => z.Key) .Select(z => new Item(Item.DIYRecipe) {FreeParam = z}); + if (type == SpawnType.AlphabeticalDIY) + diy = diy.OrderBy(x => GameInfo.Strings.GetItemName(x)); + items = Enumerable.Repeat(diy, count).SelectMany(z => z).ToArray(); sizeX = sizeY = 2; } @@ -145,11 +148,12 @@ private static int SpawnItems(ItemLayer layer, IReadOnlyList items, int x, private void CB_SpawnType_SelectedIndexChanged(object sender, EventArgs e) { var index = (SpawnType)CB_SpawnType.SelectedIndex; - L_DIYStart.Visible = L_DIYStop.Visible = NUD_DIYStart.Visible = NUD_DIYStop.Visible = index == SpawnType.SequentialDIY; + L_DIYStart.Visible = L_DIYStop.Visible = NUD_DIYStart.Visible = NUD_DIYStop.Visible = index is SpawnType.SequentialDIY or SpawnType.AlphabeticalDIY; L_NHI.Visible = L_NHIFileName.Visible = index == SpawnType.ItemsFromNHI; NUD_SpawnCount.Value = index switch { SpawnType.SequentialDIY => 1, + SpawnType.AlphabeticalDIY => 1, SpawnType.ItemsFromNHI => 1, _ => 8, }; @@ -179,6 +183,7 @@ private enum SpawnType { ItemFromEditor, SequentialDIY, + AlphabeticalDIY, ItemsFromNHI, }