Skip to content

Commit 4751f35

Browse files
committed
Fixed placeholder torch function not clearing inventory.
- Deleting all inventory items now deletes skillset data.
1 parent 6850a2f commit 4751f35

1 file changed

Lines changed: 31 additions & 20 deletions

File tree

src/CoreKeeperInventoryEditor/MainForm.cs

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,29 +1120,29 @@ public async void GetInventoryAddresses()
11201120
{
11211121
// Enable controls.
11221122
ReloadInventory_Button.Enabled = true; // Reload.
1123-
RemoveAll_Button.Enabled = true; // Remove all.
1123+
RemoveAll_Button.Enabled = true; // Remove all.
11241124

11251125
// If scan is larger then 1 result, enable arrow controls.
11261126
if (AoBScanResultsInventory.Count() > 1)
11271127
{
11281128
// Enable arrow buttons.
11291129
PreviousInvAddress_Button.Enabled = true; // Previous.
1130-
NextInvAddress_Button.Enabled = true; // Next.
1130+
NextInvAddress_Button.Enabled = true; // Next.
11311131
}
11321132
else
11331133
{
11341134
// Disable arrow buttons.
11351135
PreviousInvAddress_Button.Enabled = false; // Previous.
1136-
NextInvAddress_Button.Enabled = false; // Next.
1136+
NextInvAddress_Button.Enabled = false; // Next.
11371137
}
11381138
}
11391139
else
11401140
{
11411141
// Disable controls.
1142-
ReloadInventory_Button.Enabled = false; // Reload.
1143-
RemoveAll_Button.Enabled = false; // Remove all.
1142+
ReloadInventory_Button.Enabled = false; // Reload.
1143+
RemoveAll_Button.Enabled = false; // Remove all.
11441144
PreviousInvAddress_Button.Enabled = false; // Previous.
1145-
NextInvAddress_Button.Enabled = false; // Next.
1145+
NextInvAddress_Button.Enabled = false; // Next.
11461146
}
11471147

11481148
// Toggle placeholder torches off.
@@ -1160,11 +1160,11 @@ public async void GetInventoryAddresses()
11601160

11611161
// Function for adding items to the players inventory.
11621162
public void AddItemToInv(
1163-
int ItemSlot = 1,
1164-
int Type = 1,
1165-
int Variation = 0,
1166-
int Amount = 1,
1167-
int Skillset = 0,
1163+
int ItemSlot = 1,
1164+
int Type = 1,
1165+
int Variation = 0,
1166+
int Amount = 1,
1167+
int Skillset = 0,
11681168
bool LoadInventory = false,
11691169
bool CycleAll = false,
11701170
bool ExportInventory = false,
@@ -1616,22 +1616,33 @@ public void TogglePlaceholderTorches(bool Enabled)
16161616
// Check to enable or disable the placeholder torches.
16171617
if (Enabled)
16181618
{
1619-
// Enable placeholder torches.
1619+
// Enable placeholder torches. //
16201620

1621-
Slot1_PictureBox.Image = MakeGrayscale3(new Bitmap(Resources.TorchPlaceholder));
1622-
Slot1_PictureBox.SizeMode = PictureBoxSizeMode.Zoom;
1621+
// Remove all previous images.
1622+
int slotCount = Main_TabControl.TabPages["Inventory_TabPage"].Controls.OfType<PictureBox>().Count();
1623+
for (int i = 1; i <= slotCount; i++)
1624+
{
1625+
// Clear the image from the UI.
1626+
if (this.Controls.Find($"Slot{i}_PictureBox", searchAllChildren: true).FirstOrDefault() is PictureBox picBox)
1627+
{
1628+
picBox.Image = null;
1629+
}
1630+
}
1631+
1632+
Slot1_PictureBox.Image = MakeGrayscale3(new Bitmap(Resources.TorchPlaceholder));
1633+
Slot1_PictureBox.SizeMode = PictureBoxSizeMode.Zoom;
16231634

1624-
Slot30_PictureBox.Image = MakeGrayscale3(new Bitmap(Resources.TorchPlaceholder));
1635+
Slot30_PictureBox.Image = MakeGrayscale3(new Bitmap(Resources.TorchPlaceholder));
16251636
Slot30_PictureBox.SizeMode = PictureBoxSizeMode.Zoom;
16261637

1627-
Slot1_PictureBox.Invalidate(); // Reload picturebox.
1638+
Slot1_PictureBox.Invalidate(); // Reload picturebox.
16281639
Slot30_PictureBox.Invalidate(); // Reload picturebox.
16291640
}
16301641
else
16311642
{
1632-
// Disable placeholder torches.
1643+
// Disable placeholder torches. //
16331644

1634-
Slot1_PictureBox.Image = null;
1645+
Slot1_PictureBox.Image = null;
16351646
Slot30_PictureBox.Image = null;
16361647
}
16371648
}
@@ -1678,7 +1689,7 @@ private void ReloadInventory_Button_Click(object sender, EventArgs e)
16781689
AddItemToInv(LoadInventory: true);
16791690
}
16801691

1681-
// Remove entire Inventory.
1692+
// Remove entire Inventory (& data).
16821693
private void RemoveAll_Button_Click(object sender, EventArgs e)
16831694
{
16841695
if (MessageBox.Show("Delete ALL items? Are you sure?", "Remove All", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
@@ -1687,7 +1698,7 @@ private void RemoveAll_Button_Click(object sender, EventArgs e)
16871698
RemoveAll_Button.Text = "Clearing..";
16881699

16891700
// Reload Inventory.
1690-
AddItemToInv(Type: 0, Amount: 1, Variation: 0, CycleAll: true);
1701+
AddItemToInv(Type: 0, Amount: 1, Variation: 0, Skillset: 0, CycleAll: true);
16911702
}
16921703
}
16931704

0 commit comments

Comments
 (0)