private void numericUpDownSkill_ValueChanged(object sender, EventArgs e) { // Get the listBoxTactics selected tactic M_PvpTact t = (M_PvpTact)listBoxTactics.SelectedItem; // Update the tactic TACT_SKILL t.TACT_SKILL = TACT_SKILL; // Check if the M_PvpTacticsChanged event handler is not null if (M_PvpTacticsChanged != null) { // Raise the M_PvpTacticsChanged event M_PvpTacticsChanged(this, new EventArgs()); } }
private void comboBoxDebuff_SelectedIndexChanged(object sender, EventArgs e) { // Get the listBoxTactics selected tactic M_PvpTact t = (M_PvpTact)listBoxTactics.SelectedItem; // Update the tactic TACT_DEBUFF t.TACT_DEBUFF = TACT_DEBUFF; // Check if the M_PvpTacticsChanged event handler is not null if (M_PvpTacticsChanged != null) { // Raise the M_PvpTacticsChanged event M_PvpTacticsChanged(this, new EventArgs()); } }
private void textBoxID_TextChanged(object sender, EventArgs e) { // Get the listBoxTactics selected tactic M_PvpTact t = (M_PvpTact)listBoxTactics.SelectedItem; // Update the tactic ID t.ID = TACT_ID; // Check if the M_PvpTacticsChanged event handler is not null if (M_PvpTacticsChanged != null) { // Raise the M_PvpTacticsChanged event M_PvpTacticsChanged(this, new EventArgs()); } }
private void M_PvpTactControl_Load(object sender, EventArgs e) { // Create a new tactics array M_PvpTact[] items = new M_PvpTact[M_PVP_Tact.Tactics.Count]; // Copy the old tactics to the new array M_PVP_Tact.Tactics.CopyTo(items, 0); // Clear the listBoxTactics items list listBoxTactics.Items.Clear(); // Add the new tactics array to the listBoxTactics items array listBoxTactics.Items.AddRange(items); // Set the listBoxTactics selected index to 0 listBoxTactics.SelectedIndex = 0; }
private void buttonAdd_Click(object sender, EventArgs e) { // Create a new tactic object M_PvpTact t = new M_PvpTact("new"); // Add the new tactic to H_Tactics and the listBoxTactics items list M_PVP_Tact.Tactics.Add(t); listBoxTactics.Items.Add(t); // Select the new tactic listBoxTactics.SelectedItem = t; // Check if the PvpTacticsChanged event handler is not null if (M_PvpTacticsChanged != null) { // Raise the PvpTacticsChanged event M_PvpTacticsChanged(this, new EventArgs()); } }
private void textBoxID_Validated(object sender, EventArgs e) { // Check if the textBoxID text is empty if (textBoxID.Text == "" | textBoxID.Text == "new") { // Popup an error message for the target name MessageBox.Show("You must enter a name.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); // Change the focus to the textBoxID textBoxID.Focus(); } // If the textBoxID text is not empty else { // Run through each object in the listBoxTactics items list foreach (object item in listBoxTactics.Items) { // Check if the current item is not the listBoxTactics selected item if (item != listBoxTactics.SelectedItem) { // Get the current tactic object M_PvpTact t = (M_PvpTact)item; // Check if the tactic ID matches the selected tactic ID if (t.ID == TACT_ID) { // Popup a message for a unique name MessageBox.Show("You must enter a unique name.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); // Change the focus to textBoxID textBoxID.Focus(); // Break out of the loop break; } } } // Refresh the listBoxTactics control listBoxTactics.Refresh(); } }
public void Open(string file) { // Load the configurations from the file M_PVP_Tact.Load(file); // Create a new tactics array M_PvpTact[] items = new M_PvpTact[M_PVP_Tact.Tactics.Count]; // Copy the old tactics to the new array M_PVP_Tact.Tactics.CopyTo(items, 0); // Clear the listBoxTactics items list listBoxTactics.Items.Clear(); // Add the new tactics array to the listBoxTactics items array listBoxTactics.Items.AddRange(items); // Set the listBoxTactics selected index to 0 listBoxTactics.SelectedIndex = 0; }
private void comboBoxSkill_SelectedIndexChanged(object sender, EventArgs e) { // Get the listBoxTactics selected tactic M_PvpTact t = (M_PvpTact)listBoxTactics.SelectedItem; switch (comboBoxSkill.SelectedIndex) { // If the comboBoxSkill selected index is 0 case 0: { numericUpDownSkill.Enabled = false; } break; case 1: { numericUpDownSkill.Enabled = false; } break; case 2: { numericUpDownSkill.Enabled = true; } break; case 3: { numericUpDownSkill.Enabled = true; numericUpDownSkill.Value = 5; } break; } // Update the tactic TACT_SKILL t.TACT_SKILL = TACT_SKILL; // Check if the M_PvpTacticsChanged event handler is not null if (M_PvpTacticsChanged != null) { // Raise the M_PvpTacticsChanged event M_PvpTacticsChanged(this, new EventArgs()); } }
private void buttonRemove_Click(object sender, EventArgs e) { // Check if the listBoxTactics selected item is not null if (listBoxTactics.SelectedItem != null) { // Get the listBoxTactics selected index int i = listBoxTactics.SelectedIndex; // Get the listBoxTactics selected tactic M_PvpTact t = (M_PvpTact)listBoxTactics.SelectedItem; // Remove the tactic from PVP_Tact and the listBoxTactics items list M_PVP_Tact.Tactics.Remove(t); listBoxTactics.Items.Remove(t); // Check if the selected index is less than the number of items in the listBoxTactics items list if (i < listBoxTactics.Items.Count) { // Reset the listBoxTactics selected index listBoxTactics.SelectedIndex = i; } // If the selected index is not less than the number of items in the listBoxTactics items list else { // Reset the listBoxTactics selected index to the previous index listBoxTactics.SelectedIndex = i - 1; } // Check if the M_PvpTacticsChanged event handler is not null if (M_PvpTacticsChanged != null) { // Raise the M_PvpTacticsChanged event M_PvpTacticsChanged(this, new EventArgs()); } } }
public static void Load(string fileName) { // Read the file contents from fileName and split them into an array of lines string file = File.ReadAllText(fileName); string[] lines = file.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); // Check if the file does not contain "MyPVPTact[0]" if (!Regex.IsMatch(file, "MyPVPTact\\[0\\]")) { // Add the default tactic to the tactics collection _tacts.Add(new M_PvpTact("new")); } // Run through each string object in the lines array foreach (string line in lines) { // Check if the current line contains "MyPVPTact[*]={*}" if (Regex.IsMatch(line, "MyPVPTact\\[(.*?)\\]=\\{(.*?)\\}")) { // Get the set of values from the line string[] values = Regex.Replace(line, "MyPVPTact\\[(.*?)\\]=\\{(.*?)\\}", "$1,$2").Split(','); // Create a new tactic object M_PvpTact t = new M_PvpTact(values[0]); // Set the tactic properties if (values[1] == "TACT_TANK") { t.TACT_BASIC = TACT_BASIC.TACT_TANK; } else if (values[1] == "TACT_IGNORE") { t.TACT_BASIC = TACT_BASIC.TACT_IGNORE; } else if (values[1] == "TACT_ATTACK_L") { t.TACT_BASIC = TACT_BASIC.TACT_ATTACK_L; } else if (values[1] == "TACT_ATTACK_M") { t.TACT_BASIC = TACT_BASIC.TACT_ATTACK_M; } else if (values[1] == "TACT_ATTACK_H") { t.TACT_BASIC = TACT_BASIC.TACT_ATTACK_H; } else if (values[1] == "TACT_REACT_L") { t.TACT_BASIC = TACT_BASIC.TACT_REACT_L; } else if (values[1] == "TACT_REACT_M") { t.TACT_BASIC = TACT_BASIC.TACT_REACT_M; } else if (values[1] == "TACT_REACT_H") { t.TACT_BASIC = TACT_BASIC.TACT_REACT_H; } else if (values[1] == "TACT_REACT_SELF") { t.TACT_BASIC = TACT_BASIC.TACT_REACT_SELF; } else if (values[1] == "TACT_SNIPE_L") { t.TACT_BASIC = TACT_BASIC.TACT_SNIPE_L; } else if (values[1] == "TACT_SNIPE_M") { t.TACT_BASIC = TACT_BASIC.TACT_SNIPE_M; } else if (values[1] == "TACT_SNIPE_H") { t.TACT_BASIC = TACT_BASIC.TACT_SNIPE_H; } else if (values[1] == "TACT_ATK_L_REACT_M") { t.TACT_BASIC = TACT_BASIC.TACT_ATK_L_REACT_M; } else if (values[1] == "TACT_ATTACK_LAST") { t.TACT_BASIC = TACT_BASIC.TACT_ATTACK_LAST; } else if (values[1] == "TACT_ATTACK_TOP") { t.TACT_BASIC = TACT_BASIC.TACT_ATTACK_TOP; } t.TACT_SKILL = values[2]; if (values[3] == "KITE_ALWAYS") { t.TACT_KITE = TACT_KITE.KITE_ALWAYS; } else if (values[3] == "KITE_REACT") { t.TACT_KITE = TACT_KITE.KITE_REACT; } else if (values[3] == "KITE_NEVER") { t.TACT_KITE = TACT_KITE.KITE_NEVER; } if (values[4] == "CAST_REACT") { t.TACT_CAST = TACT_CAST.CAST_REACT; } else if (values[4] == "CAST_PASSIVE") { t.TACT_CAST = TACT_CAST.CAST_PASSIVE; } else if (values[4] == "CAST_REACT_MAIN") { t.TACT_CAST = TACT_CAST.CAST_REACT_MAIN; } else if (values[4] == "CAST_REACT_MOB") { t.TACT_CAST = TACT_CAST.CAST_REACT_MOB; } else if (values[4] == "CAST_REACT_DEBUFF") { t.TACT_CAST = TACT_CAST.CAST_REACT_DEBUFF; } else if (values[4] == "CAST_REACT_MINION") { t.TACT_CAST = TACT_CAST.CAST_REACT_MINION; } else if (values[4] == "CAST_REACT_ANY") { t.TACT_CAST = TACT_CAST.CAST_REACT_ANY; } else if (values[4] == "CAST_REACT_CRASH") { t.TACT_CAST = TACT_CAST.CAST_REACT_CRASH; } else if (values[4] == "CAST_REACT_PROVOKE") { t.TACT_CAST = TACT_CAST.CAST_REACT_PROVOKE; } else if (values[4] == "CAST_REACT_SANDMAN") { t.TACT_CAST = TACT_CAST.CAST_REACT_SANDMAN; } else if (values[4] == "CAST_REACT_FREEZE") { t.TACT_CAST = TACT_CAST.CAST_REACT_FREEZE; } else if (values[4] == "CAST_REACT_DECAGI") { t.TACT_CAST = TACT_CAST.CAST_REACT_DECAGI; } else if (values[4] == "CAST_REACT_LEXDIV") { t.TACT_CAST = TACT_CAST.CAST_REACT_LEXDIV; } if (values[5] == "PUSH_NEVER") { t.TACT_PUSHBACK = TACT_PUSHBACK.PUSH_NEVER; } else if (values[5] == "PUSH_FRIEND") { t.TACT_PUSHBACK = TACT_PUSHBACK.PUSH_FRIEND; } else if (values[5] == "PUSH_SELF") { t.TACT_PUSHBACK = TACT_PUSHBACK.PUSH_SELF; } if (values[6] == "DEBUFF_NEVER") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_NEVER; } else if (values[6] == "DEBUFF_ANY_C") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_ANY_C; } else if (values[6] == "DEBUFF_CRASH_C") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_CRASH_C; } else if (values[6] == "DEBUFF_PROVOKE_C") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_PROVOKE_C; } else if (values[6] == "DEBUFF_SANDMAN_C") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_SANDMAN_C; } else if (values[6] == "DEBUFF_FREEZE_C") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_FREEZE_C; } else if (values[6] == "DEBUFF_DECAGI_C") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_DECAGI_C; } else if (values[6] == "DEBUFF_LEXDIV_C") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_LEXDIV_C; } else if (values[6] == "DEBUFF_ANY_A") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_ANY_A; } else if (values[6] == "DEBUFF_CRASH_A") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_CRASH_A; } else if (values[6] == "DEBUFF_PROVOKE_A") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_PROVOKE_A; } else if (values[6] == "DEBUFF_SANDMAN_A") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_SANDMAN_A; } else if (values[6] == "DEBUFF_FREEZE_A") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_FREEZE_A; } else if (values[6] == "DEBUFF_DECAGI_A") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_DECAGI_A; } else if (values[6] == "DEBUFF_LEXDIV_A") { t.TACT_DEBUFF = TACT_DEBUFF.DEBUFF_LEXDIV_A; } if (values[7] == "CLASS_BOTH") { t.TACT_SKILLCLASS = TACT_SKILLCLASS.CLASS_BOTH; } else if (values[7] == "CLASS_MOB") { t.TACT_SKILLCLASS = TACT_SKILLCLASS.CLASS_MOB; } if (values[8] == "RESCUE_NEVER") { t.TACT_RESCUE = TACT_RESCUE.RESCUE_NEVER; } else if (values[8] == "RESCUE_FRIEND") { t.TACT_RESCUE = TACT_RESCUE.RESCUE_FRIEND; } else if (values[8] == "RESCUE_RETAINER") { t.TACT_RESCUE = TACT_RESCUE.RESCUE_RETAINER; } else if (values[8] == "RESCUE_SELF") { t.TACT_RESCUE = TACT_RESCUE.RESCUE_SELF; } else if (values[8] == "RESCUE_OWNER") { t.TACT_RESCUE = TACT_RESCUE.RESCUE_OWNER; } else if (values[8] == "RESCUE_ALL") { t.TACT_RESCUE = TACT_RESCUE.RESCUE_ALL; } // Add the tactic to the tactics collection _tacts.Add(t); } } // Output to the console "Loading complete." Program.WriteLine("Loading complete."); }
private void listBoxTactics_SelectedIndexChanged(object sender, EventArgs e) { // Remove event handlers buttonAdd.Click -= new EventHandler(buttonAdd_Click); buttonRemove.Click -= new EventHandler(buttonRemove_Click); textBoxID.TextChanged -= new EventHandler(textBoxID_TextChanged); comboBoxBasic.SelectedIndexChanged -= new EventHandler(comboBoxBasic_SelectedIndexChanged); comboBoxReact.SelectedIndexChanged -= new EventHandler(comboBoxReact_SelectedIndexChanged); comboBoxDebuff.SelectedIndexChanged -= new EventHandler(comboBoxDebuff_SelectedIndexChanged); comboBoxSkill.SelectedIndexChanged -= new EventHandler(comboBoxSkill_SelectedIndexChanged); numericUpDownSkill.ValueChanged -= new EventHandler(numericUpDownSkill_ValueChanged); comboBoxPushback.SelectedIndexChanged -= new EventHandler(comboBoxPushback_SelectedIndexChanged); comboBoxKite.SelectedIndexChanged -= new EventHandler(comboBoxKite_SelectedIndexChanged); comboBoxSize.SelectedIndexChanged -= new EventHandler(comboBoxSize_SelectedIndexChanged); comboBoxRescue.SelectedIndexChanged -= new EventHandler(comboBoxRescue_SelectedIndexChanged); // Check if the listBoxTactics selected item is not null if (listBoxTactics.SelectedItem != null) { // Get the listBoxTactics selected tactic M_PvpTact t = (M_PvpTact)listBoxTactics.SelectedItem; // Update the graphical user interface with the values of the current tactic TACT_ID = t.ID; TACT_BASIC = t.TACT_BASIC; TACT_CAST = t.TACT_CAST; TACT_DEBUFF = t.TACT_DEBUFF; TACT_SKILL = t.TACT_SKILL; TACT_PUSHBACK = t.TACT_PUSHBACK; TACT_KITE = t.TACT_KITE; TACT_SKILLCLASS = t.TACT_SKILLCLASS; TACT_RESCUE = t.TACT_RESCUE; // Check if the TACT_ID is 0 if (TACT_ID == "0") { // Disable buttonRemove and textBoxID buttonRemove.Enabled = false; textBoxID.Enabled = false; } // If the TACT_ID is not 0 else { // Enable buttonRemove and textBoxID buttonRemove.Enabled = true; } if (TACT_ID == "new") { textBoxID.Enabled = true; } } // Add event handlers buttonAdd.Click += new EventHandler(buttonAdd_Click); buttonRemove.Click += new EventHandler(buttonRemove_Click); textBoxID.TextChanged += new EventHandler(textBoxID_TextChanged); comboBoxBasic.SelectedIndexChanged += new EventHandler(comboBoxBasic_SelectedIndexChanged); comboBoxReact.SelectedIndexChanged += new EventHandler(comboBoxReact_SelectedIndexChanged); comboBoxDebuff.SelectedIndexChanged += new EventHandler(comboBoxDebuff_SelectedIndexChanged); comboBoxSkill.SelectedIndexChanged += new EventHandler(comboBoxSkill_SelectedIndexChanged); numericUpDownSkill.ValueChanged += new EventHandler(numericUpDownSkill_ValueChanged); comboBoxPushback.SelectedIndexChanged += new EventHandler(comboBoxPushback_SelectedIndexChanged); comboBoxKite.SelectedIndexChanged += new EventHandler(comboBoxKite_SelectedIndexChanged); comboBoxSize.SelectedIndexChanged += new EventHandler(comboBoxSize_SelectedIndexChanged); comboBoxRescue.SelectedIndexChanged += new EventHandler(comboBoxRescue_SelectedIndexChanged); }