Added a function for giving the player all furniture (#583)

This commit is contained in:
William Stevens
2022-02-15 21:52:22 -05:00
committed by GitHub
parent 79b65f3ffc
commit 1849f15334
2 changed files with 34 additions and 5 deletions

View File

@@ -38,6 +38,7 @@ private void InitializeComponent()
this.B_AllFish = new System.Windows.Forms.ToolStripMenuItem();
this.B_AllBugs = new System.Windows.Forms.ToolStripMenuItem();
this.B_AllArt = new System.Windows.Forms.ToolStripMenuItem();
this.B_AllFurniture = new System.Windows.Forms.ToolStripMenuItem();
this.B_GiveEverything = new System.Windows.Forms.ToolStripMenuItem();
this.L_Received = new System.Windows.Forms.Label();
this.L_VariantBody = new System.Windows.Forms.Label();
@@ -72,7 +73,7 @@ private void InitializeComponent()
//
// CLB_Items
//
this.CLB_Items.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.CLB_Items.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.CLB_Items.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CLB_Items.FormattingEnabled = true;
@@ -118,7 +119,8 @@ private void InitializeComponent()
this.B_AllBugs,
this.B_AllDive,
this.B_AllArt,
this.B_GiveEverything});
this.B_AllFurniture,
this.B_GiveEverything}); ;
this.CM_Buttons.Name = "CM_Buttons";
this.CM_Buttons.Size = new System.Drawing.Size(166, 124);
//
@@ -142,6 +144,13 @@ private void InitializeComponent()
this.B_AllArt.Size = new System.Drawing.Size(165, 24);
this.B_AllArt.Text = "Give All Art";
this.B_AllArt.Click += new System.EventHandler(this.B_AllArt_Click);
//
// B_AllFurniture
//
this.B_AllFurniture.Name = "B_AllFurniture";
this.B_AllFurniture.Size = new System.Drawing.Size(165, 24);
this.B_AllFurniture.Text = "Give All Furniture";
this.B_AllFurniture.Click += new System.EventHandler(this.B_AllFurniture_Click);
//
// B_GiveEverything
//
@@ -172,8 +181,8 @@ private void InitializeComponent()
//
// CLB_Remake
//
this.CLB_Remake.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
this.CLB_Remake.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.CLB_Remake.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CLB_Remake.FormattingEnabled = true;
@@ -228,6 +237,7 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem B_AllFish;
private System.Windows.Forms.ToolStripMenuItem B_AllBugs;
private System.Windows.Forms.ToolStripMenuItem B_AllArt;
private System.Windows.Forms.ToolStripMenuItem B_AllFurniture;
private System.Windows.Forms.Label L_Received;
private System.Windows.Forms.Label L_VariantBody;
private System.Windows.Forms.CheckedListBox CLB_Remake;

View File

@@ -65,7 +65,7 @@ private void FillRemake(IReadOnlyList<string> items)
var flag = FlagUtil.GetFlag(data, ofs, i);
string name = $"{remakeIndex:0000} V{variant:0} - {itemName}";
if (ItemRemakeInfoData.List.TryGetValue((short) remakeIndex, out var info))
if (ItemRemakeInfoData.List.TryGetValue((short)remakeIndex, out var info))
name = $"{name} ({info.GetBodyDescription(variant, str)})";
CLB_Remake.Items.Add(name, flag);
@@ -100,6 +100,24 @@ private void GiveEverything(IReadOnlyList<string> items, bool value = true)
System.Media.SystemSounds.Asterisk.Play();
}
private void GiveAllFurniture(IReadOnlyList<string> items, bool value = true)
{
var skip = new HashSet<ushort>(GameLists.NoCheckReceived);
skip.UnionWith(GameLists.Bugs);
skip.UnionWith(GameLists.Fish);
skip.UnionWith(GameLists.Art);
skip.UnionWith(GameLists.Dive);
for (ushort i = 1; i < CLB_Items.Items.Count; i++)
{
if (string.IsNullOrEmpty(items[i]))
continue;
if (skip.Contains(i))
continue;
GiveItem(i, value);
}
System.Media.SystemSounds.Asterisk.Play();
}
private void GiveItem(ushort item, bool value = true)
{
CLB_Items.SetItemChecked(item, value);
@@ -123,6 +141,7 @@ private void GiveItem(ushort item, bool value = true)
private void B_AllFish_Click(object sender, EventArgs e) => GiveAll(GameLists.Fish, ModifierKeys != Keys.Alt);
private void B_AllArt_Click(object sender, EventArgs e) => GiveAll(GameLists.Art, ModifierKeys != Keys.Alt);
private void B_AllDive_Click(object sender, EventArgs e) => GiveAll(GameLists.Dive, ModifierKeys != Keys.Alt);
private void B_AllFurniture_Click(object sender, EventArgs e) => GiveAllFurniture(GameInfo.Strings.itemlist, ModifierKeys != Keys.Alt);
private void B_GiveEverything_Click(object sender, EventArgs e) => GiveEverything(GameInfo.Strings.itemlist, ModifierKeys != Keys.Alt);
private void B_Cancel_Click(object sender, EventArgs e) => Close();