private void button1_Click(object sender, EventArgs e) { //get the key if (String.IsNullOrEmpty(textBox1.Text)) { return; } KeyConverter k = new KeyConverter(); Key key = (Key)k.ConvertFromString(textBox1.Text); //hotkey type string sType = comboBox1.SelectedItem.ToString(); int count = bot.GetHotkeys().Count; string hotkeyID = Convert.ToString(count + 1); Hotkey hotkey; string slot; switch (sType) { case "Use item on yourself": hotkey = new Hotkey(hotkeyID, textBox1.Text, HotkeyType.UseOnYourself); hotkey.ItemId = BotUtil.Number(textBox2.Text); if (hotkey.ItemId < 0) { return; } //add from grid this.dataGridView1.Rows.Add(hotkeyID, textBox1.Text, "Use item on yourself", textBox2.Text, ""); bot.AddHotkey(hotkey); break; case "Use item on target": hotkey = new Hotkey(hotkeyID, textBox1.Text, HotkeyType.UseOnTarget); hotkey.ItemId = BotUtil.Number(textBox2.Text); if (hotkey.ItemId < 0) { return; } //add from grid this.dataGridView1.Rows.Add(hotkeyID, textBox1.Text, "Use item on target", textBox2.Text, ""); bot.AddHotkey(hotkey); break; case "Use with crosshairs": hotkey = new Hotkey(hotkeyID, textBox1.Text, HotkeyType.UseWithCrosshairs); hotkey.ItemId = BotUtil.Number(textBox2.Text); if (hotkey.ItemId < 0) { return; } //add from grid this.dataGridView1.Rows.Add(hotkeyID, textBox1.Text, "Use with crosshairs", textBox2.Text, ""); bot.AddHotkey(hotkey); break; case "Use item": hotkey = new Hotkey(hotkeyID, textBox1.Text, HotkeyType.UseItem); hotkey.ItemId = BotUtil.Number(textBox2.Text); if (hotkey.ItemId < 0) { return; } //add from grid this.dataGridView1.Rows.Add(hotkeyID, textBox1.Text, "Use item", textBox2.Text, ""); bot.AddHotkey(hotkey); break; case "Equip item": hotkey = new Hotkey(hotkeyID, textBox1.Text, HotkeyType.EquipItem); hotkey.ItemId = BotUtil.Number(textBox2.Text); if (hotkey.ItemId < 0) { return; } //add from grid slot = comboBox2.SelectedItem.ToString(); this.dataGridView1.Rows.Add(hotkeyID, textBox1.Text, "Equip item", textBox2.Text, slot); hotkey.InventoryLocation = getInventoryLocationByString(slot); bot.AddHotkey(hotkey); break; case "Unequip item": hotkey = new Hotkey(hotkeyID, textBox1.Text, HotkeyType.UnequipItem); //add from grid slot = comboBox2.SelectedItem.ToString(); this.dataGridView1.Rows.Add(hotkeyID, textBox1.Text, "Unequip item", "", slot); hotkey.InventoryLocation = getInventoryLocationByString(slot); bot.AddHotkey(hotkey); break; } textBox1.Clear(); }