private void slasher_tab_MouseDoubleClick(object sender, MouseEventArgs e) { CharEditTab sending_tab = find_sending_tab(sender); if (sending_tab != null && sending_tab.slasher_list_view.GetItemAt(e.X, e.Y) != null) { var enumerator = sending_tab.slasher_list_view.SelectedIndices.GetEnumerator(); enumerator.MoveNext(); var cur_idx = enumerator.Current; string item_name = sending_tab.slasher_list_view.SelectedItems[0].SubItems[0].Text; NumberForm inpDiag = new NumberForm(sending_tab.dbd_char.Inventory[item_name].ToString()); if (inpDiag.ShowDialog(this) == DialogResult.OK) { item_cnt -= sending_tab.dbd_char.Inventory[item_name]; sending_tab.dbd_char.Inventory[item_name] = int.Parse(inpDiag.GetResult()); sending_tab.slasher_list_view.SelectedItems[0].SubItems[1].Text = "" + sending_tab.dbd_char.Inventory[item_name]; item_cnt += sending_tab.dbd_char.Inventory[item_name]; } inpDiag.Dispose(); } if (item_cnt >= 250000 && !displayed_item_warning) { displayed_item_warning = true; MessageBox.Show("Warning: Profile has more than 250.000 items. Adding too many items causes freeze issues and crashes (instable game)."); } }
private void modify_amount_btn_Click(object sender, EventArgs e) { CharEditTab sending_tab = find_sending_tab(sender); if (sending_tab != null) { var enumerator = sending_tab.slasher_list_view.SelectedIndices.GetEnumerator(); bool first = true; List <string> selected_items = new List <string>(); int ind = 0; string items_string = ""; while (enumerator.MoveNext()) { if (!first) { //Add ',' items_string += ","; } var cur_idx = enumerator.Current; string item_name = sending_tab.slasher_list_view.SelectedItems[ind].SubItems[0].Text; selected_items.Add(item_name); items_string += item_name; first = false; ++ind; } if (ind == 0) { return; //Nothing selected! } int max_amount = 0; foreach (string item in selected_items) { if (sending_tab.dbd_char.Inventory[item] > max_amount) { max_amount = sending_tab.dbd_char.Inventory[item]; } } NumberForm inpDiag = new NumberForm(max_amount.ToString()); if (inpDiag.ShowDialog(this) == DialogResult.OK) { int j = 0; foreach (string item in selected_items) { item_cnt -= sending_tab.dbd_char.Inventory[item]; sending_tab.dbd_char.Inventory[item] = int.Parse(inpDiag.GetResult()); sending_tab.slasher_list_view.SelectedItems[j].SubItems[1].Text = "" + sending_tab.dbd_char.Inventory[item]; item_cnt += sending_tab.dbd_char.Inventory[item]; ++j; } } inpDiag.Dispose(); } if (item_cnt >= 250000 && !displayed_item_warning) { displayed_item_warning = true; MessageBox.Show("Warning: Profile has more than 250.000 items. Adding too many items causes freeze issues and crashes (instable game)."); } }