Show customization available bits

There's probably other bits used for fabric, but that's not researched
This commit is contained in:
Kurt
2020-05-06 21:03:20 -07:00
parent 46272165dc
commit 528eb2f1ec
2 changed files with 93 additions and 21 deletions

View File

@@ -39,13 +39,16 @@ private void InitializeComponent()
this.B_AllBugs = new System.Windows.Forms.ToolStripMenuItem();
this.B_AllArt = new System.Windows.Forms.ToolStripMenuItem();
this.B_GiveEverything = new System.Windows.Forms.ToolStripMenuItem();
this.L_Received = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.CLB_Remake = new System.Windows.Forms.CheckedListBox();
this.CM_Buttons.SuspendLayout();
this.SuspendLayout();
//
// 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(117, 289);
this.B_Cancel.Location = new System.Drawing.Point(449, 349);
this.B_Cancel.Name = "B_Cancel";
this.B_Cancel.Size = new System.Drawing.Size(72, 23);
this.B_Cancel.TabIndex = 7;
@@ -56,7 +59,7 @@ private void InitializeComponent()
// 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(195, 289);
this.B_Save.Location = new System.Drawing.Point(527, 349);
this.B_Save.Name = "B_Save";
this.B_Save.Size = new System.Drawing.Size(72, 23);
this.B_Save.TabIndex = 6;
@@ -66,28 +69,26 @@ private void InitializeComponent()
//
// CLB_Items
//
this.CLB_Items.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_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;
this.CLB_Items.Location = new System.Drawing.Point(12, 12);
this.CLB_Items.Location = new System.Drawing.Point(12, 27);
this.CLB_Items.Name = "CLB_Items";
this.CLB_Items.Size = new System.Drawing.Size(255, 244);
this.CLB_Items.Size = new System.Drawing.Size(231, 289);
this.CLB_Items.TabIndex = 8;
this.CLB_Items.SelectedIndexChanged += new System.EventHandler(this.CLB_Items_SelectedIndexChanged);
//
// CB_Item
//
this.CB_Item.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CB_Item.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.CB_Item.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CB_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CB_Item.DropDownWidth = 322;
this.CB_Item.FormattingEnabled = true;
this.CB_Item.Location = new System.Drawing.Point(12, 262);
this.CB_Item.Location = new System.Drawing.Point(12, 322);
this.CB_Item.Name = "CB_Item";
this.CB_Item.Size = new System.Drawing.Size(255, 21);
this.CB_Item.Size = new System.Drawing.Size(231, 21);
this.CB_Item.TabIndex = 13;
this.CB_Item.SelectedValueChanged += new System.EventHandler(this.CB_Item_SelectedValueChanged);
//
@@ -95,7 +96,7 @@ private void InitializeComponent()
//
this.B_GiveAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.B_GiveAll.ContextMenuStrip = this.CM_Buttons;
this.B_GiveAll.Location = new System.Drawing.Point(12, 289);
this.B_GiveAll.Location = new System.Drawing.Point(12, 349);
this.B_GiveAll.Name = "B_GiveAll";
this.B_GiveAll.Size = new System.Drawing.Size(82, 23);
this.B_GiveAll.TabIndex = 14;
@@ -111,41 +112,74 @@ private void InitializeComponent()
this.B_AllArt,
this.B_GiveEverything});
this.CM_Buttons.Name = "CM_Buttons";
this.CM_Buttons.Size = new System.Drawing.Size(181, 114);
this.CM_Buttons.Size = new System.Drawing.Size(144, 92);
//
// B_AllFish
//
this.B_AllFish.Name = "B_AllFish";
this.B_AllFish.Size = new System.Drawing.Size(180, 22);
this.B_AllFish.Size = new System.Drawing.Size(143, 22);
this.B_AllFish.Text = "Give All Fish";
this.B_AllFish.Click += new System.EventHandler(this.B_AllFish_Click);
//
// B_AllBugs
//
this.B_AllBugs.Name = "B_AllBugs";
this.B_AllBugs.Size = new System.Drawing.Size(180, 22);
this.B_AllBugs.Size = new System.Drawing.Size(143, 22);
this.B_AllBugs.Text = "Give All Bugs";
this.B_AllBugs.Click += new System.EventHandler(this.B_AllBugs_Click);
//
// B_AllArt
//
this.B_AllArt.Name = "B_AllArt";
this.B_AllArt.Size = new System.Drawing.Size(180, 22);
this.B_AllArt.Size = new System.Drawing.Size(143, 22);
this.B_AllArt.Text = "Give All Art";
this.B_AllArt.Click += new System.EventHandler(this.B_AllArt_Click);
//
// B_GiveEverything
//
this.B_GiveEverything.Name = "B_GiveEverything";
this.B_GiveEverything.Size = new System.Drawing.Size(180, 22);
this.B_GiveEverything.Size = new System.Drawing.Size(143, 22);
this.B_GiveEverything.Text = "Everything";
this.B_GiveEverything.Click += new System.EventHandler(this.B_GiveEverything_Click);
//
// L_Received
//
this.L_Received.AutoSize = true;
this.L_Received.Location = new System.Drawing.Point(12, 9);
this.L_Received.Name = "L_Received";
this.L_Received.Size = new System.Drawing.Size(53, 13);
this.L_Received.TabIndex = 15;
this.L_Received.Text = "Received";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(246, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(47, 13);
this.label1.TabIndex = 16;
this.label1.Text = "Remake";
//
// 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)
| 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;
this.CLB_Remake.Location = new System.Drawing.Point(249, 27);
this.CLB_Remake.Name = "CLB_Remake";
this.CLB_Remake.Size = new System.Drawing.Size(350, 289);
this.CLB_Remake.TabIndex = 17;
//
// ItemReceivedEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(279, 324);
this.ClientSize = new System.Drawing.Size(611, 384);
this.Controls.Add(this.CLB_Remake);
this.Controls.Add(this.label1);
this.Controls.Add(this.L_Received);
this.Controls.Add(this.B_GiveAll);
this.Controls.Add(this.CB_Item);
this.Controls.Add(this.CLB_Items);
@@ -159,6 +193,7 @@ private void InitializeComponent()
this.Text = "Received Item List Editor";
this.CM_Buttons.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -174,5 +209,8 @@ 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.Label L_Received;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckedListBox CLB_Remake;
}
}

View File

@@ -16,7 +16,8 @@ public ItemReceivedEditor(Player player)
this.TranslateInterface(GameInfo.CurrentLanguage);
FillCheckBoxes();
Initialize(GameInfo.Strings.ItemDataSource);
CLB_Items.SelectedIndex = 0x50;
CLB_Remake.SelectedIndex = 0;
CLB_Items.SelectedIndex = 0x50; // clackercart
}
public void Initialize(List<ComboItem> items)
@@ -29,10 +30,15 @@ public void Initialize(List<ComboItem> items)
private void FillCheckBoxes()
{
var items = GameInfo.Strings.itemlistdisplay;
FillCollect(items);
FillRemake(items);
}
private void FillCollect(IReadOnlyList<string> items)
{
var ofs = Player.Personal.Offsets.ItemCollectBit;
var data = Player.Personal.Data;
for (int i = 0; i < items.Length; i++)
for (int i = 0; i < items.Count; i++)
{
var flag = FlagUtil.GetFlag(data, ofs, i);
string value = items[i];
@@ -41,6 +47,30 @@ private void FillCheckBoxes()
}
}
private void FillRemake(IReadOnlyList<string> items)
{
var invert = ItemRemakeUtil.GetInvertedDictionary();
var ofs = Player.Personal.Offsets.ItemRemakeCollectBit;
var max = Player.Personal.Offsets.MaxRemakeBitFlag;
var data = Player.Personal.Data;
for (int i = 0; i < max; i++)
{
var remakeIndex = i >> 3;
var variant = i & 7;
ushort itemId = invert.TryGetValue((short)remakeIndex, out var id) ? id : (ushort)0;
var itemName = remakeIndex == 0652 ? "photo" : items[itemId];
var flag = FlagUtil.GetFlag(data, ofs, i);
string name = $"{remakeIndex:0000} V{variant:0} - {itemName}";
if (ItemRemakeInfoData.List.TryGetValue((short) remakeIndex, out var info))
name = $"{name} ({info.GetColorDescription(variant)})";
CLB_Remake.Items.Add(name, flag);
}
}
public void GiveAll(IReadOnlyList<ushort> indexes, bool value = true)
{
foreach (var item in indexes)
@@ -89,9 +119,13 @@ private void B_Save_Click(object sender, EventArgs e)
private void CB_Item_SelectedValueChanged(object sender, EventArgs e)
{
var index = WinFormsUtil.GetIndex(CB_Item);
if (index >= CLB_Items.Items.Count)
if ((uint)index >= CLB_Items.Items.Count)
index = 0;
CLB_Items.SelectedIndex = index;
var remake = ItemRemakeUtil.GetRemakeIndex((ushort)index);
if (remake > 0)
CLB_Remake.SelectedIndex = remake * 8;
}
private void CLB_Items_SelectedIndexChanged(object sender, EventArgs e)