public Defense(Client _c, GameServer _gs) { InitializeComponent(); c = _c; gs = _gs; condition.Items.Add("Always"); condition.Items.Add("HP"); condition.Items.Add("Distance"); compare.Items.Add("="); compare.Items.Add(">"); compare.Items.Add("<"); Effects sleep, hold, medusa, poison; medusa = new Effects(); medusa.name = "Medusa"; medusa.id = 2048; sleep = new Effects(); sleep.name = "Sleep"; sleep.id = 128; hold = new Effects(); hold.name = "Root"; hold.id = 512; poison = new Effects(); poison.name = "Poison"; poison.id = 2; eff.Items.Add(medusa); eff.Items.Add(sleep); eff.Items.Add(hold); eff.Items.Add(poison); condition.SelectedIndex = 0; compare.SelectedIndex = 0; value.Text = "0"; eff.SelectedIndex = 0; tb_mp.Text = "1500"; }
private void button1_Click(object sender, EventArgs e) { //add to listview Effects thisEffect = new Effects(); DefenseSkills askill = new DefenseSkills(); askill.comparison = compare.SelectedIndex; askill.condition = condition.SelectedIndex; askill.skillname = sl.Items[sl.SelectedIndex].ToString(); askill.skillid = ((skill)sl.Items[sl.SelectedIndex]).id; try { askill.value = Convert.ToInt32(value.Text); } catch { askill.value = 0; } thisEffect = ((Effects)eff.SelectedItem); askill.effect = thisEffect.id; try { askill.MP = Convert.ToUInt32(tb_mp.Text); } catch { askill.MP = 1500; } ListViewItem item = new ListViewItem(askill.skillname); item.SubItems.Add(condition.Items[askill.condition].ToString()); item.SubItems.Add(compare.Items[askill.comparison].ToString()); item.SubItems.Add(askill.value.ToString()); item.SubItems.Add(thisEffect.name); item.SubItems.Add(askill.MP.ToString()); item.Tag = askill; listView1.Items.Add(item); }