private void button1_Click(object sender, EventArgs e) { if ((skins_list.SelectedIndex == -1 && allskins_list.SelectedIndex == -1) || weapons_list.SelectedIndex == -1) { return; } var skin = allskins_list.Text == string.Empty ? (string)skins_list.SelectedItem : (string)allskins_list.SelectedItem; var weaponKit = new WeaponKit() { customname = custom_name.Text, weapon = (string)weapons_list.SelectedItem, fallback = Parser.FallBackFromInt(int.Parse(fallback_value.Text)), skin_id = DumpSkins.sharpSkin_AllSkins.Find(x => x.Item2 == (allskins_list.Text == string.Empty ? (string)skins_list.SelectedItem : (string)allskins_list.SelectedItem)).Item1 }; weaponKit.item_index = (int)Enum.Parse(typeof(ItemDefinitionIndex), weaponKit.weapon); int.TryParse(stattrack_value.Text, out weaponKit.stattrack); var isAlreadySet = weaponKits.FindIndex(x => x.weapon == weaponKit.weapon); if (isAlreadySet != -1) { weaponKits.RemoveAt(isAlreadySet); list_sets.Items.RemoveAt(isAlreadySet); } weaponKits.Add(weaponKit); list_sets.Items.AddNewKit(weaponKit); }
private void button1_Click(object sender, EventArgs e) { if (skins_list.SelectedIndex == -1 || knifes_list.SelectedIndex == -1) { return; } var skin = skins_list.SelectedItem; var weaponKit = new WeaponKit() { customname = custom_name.Text, weapon = (string)knifes_list.SelectedItem, fallback = Parser.FallBackFromInt(int.Parse(fallback_value.Text)) }; weaponKit.skin_id = KnifeNameToSkin((string)skins_list.SelectedItem, weaponKit.weapon); weaponKit.item_index = (int)Enum.Parse(typeof(ItemDefinitionIndex), weaponKit.weapon); int.TryParse(stattrack_value.Text, out weaponKit.stattrack); knifeKit = weaponKit; if (list_sets.Items.Count > 0) { list_sets.Items.RemoveAt(0); } list_sets.Items.AddNewKit(weaponKit); }
private void button2_Click(object sender, EventArgs e) { if (list_sets.SelectedIndex == -1) { return; } knifeKit = new WeaponKit(); list_sets.Items.RemoveAt(0); }
public static void addKnife(WeaponKit weaponKit) => new_lines.Add($"[kni]{weaponKit.skin_id}#{weaponKit.item_index}#{weaponKit.weapon}#{weaponKit.fallback.ToString(CultureInfo.InvariantCulture)}#{weaponKit.stattrack}#{weaponKit.customname}#");