private void ContextMenu_Click(int eventId) { if (eventId == 1002) { client.Statusbar = client.Memory.ReadInt32(Tibia.Addresses.Client.ClickContextMenuItemId).ToString(); } else { Creature clicked = client.BattleList.GetCreatures().FirstOrDefault( creature => creature.Id == client.Memory.ReadInt32(Tibia.Addresses.Client.ClickContextMenuCreatureId)); if (clicked != null) { Website.CharInfo character = new Website.CharInfo(); character.Name = clicked.Name; this.Invoke(new MethodInvoker(delegate { if (eventId == 1000) { AllyMembers.Add(character); AlliesList.Items.Add(new ListViewItem(new string[] { character.Name, character.GuildName, character.GuildNickName })); } else if (eventId == 1001) { EnemyMembers.Add(character); EnemiesList.Items.Add(new ListViewItem(new string[] { character.Name, character.GuildName, character.GuildNickName })); } })); } } }
private void cmdRemoveEnemy_Click(object sender, EventArgs e) { if (EnemiesList.SelectedItems.Count == 0) { MessageBox.Show("Select at least one character", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } Website.CharInfo Character = new Website.CharInfo(); foreach (ListViewItem SelItem in AlliesList.SelectedItems) { Character = EnemyMembers.Find(delegate(Website.CharInfo c) { return c.Name == SelItem.SubItems[0].Text; }); screen.RemoveCreatureText(Character.Name); EnemyMembers.Remove(Character); EnemiesList.Items.Remove(SelItem); } }
private void btnAddMan_Click(object sender, EventArgs e) { if (txtManName.Text == string.Empty) { MessageBox.Show("Enter Character Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } foreach (Website.CharInfo MemberChar in Members) { if (MemberChar.Name.ToLower() == txtManName.Text.ToLower()) { MessageBox.Show("Character is already at the list", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } Website.CharInfo Character = new Website.CharInfo(); Character.GuildName = txtManGuild.Text; Character.Name = txtManName.Text; Character.GuildNickName = txtManNick.Text; txtManGuild.Text = string.Empty; txtManName.Text = string.Empty; txtManNick.Text = string.Empty; Members.Add(Character); MembersList.Items.Add(new ListViewItem(new string[] { Character.Name, Character.GuildName, Character.GuildNickName })); }