Fix giveall count behavior

there isn't one per tab, only one for the entire form.
when the index is changed, reload the give count val/max.
#526
This commit is contained in:
Kurt 2016-11-29 20:43:32 -08:00
parent bfc6733a25
commit c186db2048
3 changed files with 23 additions and 15 deletions

View File

@ -84,6 +84,7 @@ private void InitializeComponent()
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(261, 336);
this.tabControl1.TabIndex = 17;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.switchBag);
//
// IL_Pouch
//

View File

@ -21,6 +21,7 @@ public SAV_Inventory()
Pouches = SAV.Inventory;
initBags();
getBags();
switchBag(null, null); // bag 0
}
private readonly SaveFile SAV = Main.SAV.Clone();
@ -152,20 +153,6 @@ private void getBag(DataGridView dgv, InventoryPouch pouch)
dgv.Rows[i].Cells[0].Value = itemlist[pouch.Items[i].Index];
dgv.Rows[i].Cells[1].Value = pouch.Items[i].Count;
}
if (Main.HaX)
{
// Cap at absolute maximum
if (SAV.Generation <= 2)
NUD_Count.Maximum = byte.MaxValue;
else if (SAV.Generation >= 7)
NUD_Count.Maximum = pouch.MaxCount;
else if (SAV.Generation >= 3)
NUD_Count.Maximum = ushort.MaxValue;
}
else
NUD_Count.Maximum = pouch.MaxCount;
NUD_Count.Value = pouch.Type == InventoryType.KeyItems ? 1 : pouch.MaxCount;
}
private void setBag(DataGridView dgv, InventoryPouch pouch)
{
@ -199,6 +186,26 @@ private void setBag(DataGridView dgv, InventoryPouch pouch)
pouch.Items[i] = new InventoryItem(); // Empty Slots at the end
}
private void switchBag(object sender, EventArgs e)
{
int index = tabControl1.SelectedIndex;
var pouch = Pouches[index];
if (Main.HaX)
{
// Cap at absolute maximum
if (SAV.Generation <= 2)
NUD_Count.Maximum = byte.MaxValue;
else if (SAV.Generation >= 7)
NUD_Count.Maximum = pouch.MaxCount;
else if (SAV.Generation >= 3)
NUD_Count.Maximum = ushort.MaxValue;
}
else
NUD_Count.Maximum = pouch.MaxCount;
NUD_Count.Value = pouch.Type == InventoryType.KeyItems ? 1 : pouch.MaxCount;
}
// Initialize String Tables
private readonly string[] itemlist;
private string[] getItems(ushort[] items, bool sort = true)

View File

@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB0
EwAAAk1TRnQBSQFMAgEBCwEAASABAAEgAQABGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
EwAAAk1TRnQBSQFMAgEBCwEAASgBAAEoAQABGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABYAMAAUgDAAEBAQABCAYAARsYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA