private void textBoxID_Validated(object sender, EventArgs e) { // 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) { // Convert the item to a tactic object Tact t = (Tact)item; // Check if the tactic ID is equal to TACT_ID if (t.ID == TACT_ID) { // Popup an error message for the monster ID MessageBox.Show("You must enter a unique monster ID", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); // Change the focus to the textBoxID textBoxID.Focus(); // Break out of the loop break; } } } }
private void HomTactControl_Load(object sender, EventArgs e) { // Create a new array of tactics objects Tact[] items = new Tact[H_Tactics.Tactics.Count]; // Copy the H_Tactics tactics to the new array H_Tactics.Tactics.CopyTo(items, 0); // Add the new array of tactics to the listBoxTactics items list listBoxTactics.Items.AddRange(items); // Select the first item in the listBoxTactics items list listBoxTactics.SelectedIndex = 0; }
private void comboBoxSkill_SelectedIndexChanged(object sender, EventArgs e) { // Get the listBoxTactics selected tactic Tact t = (Tact)listBoxTactics.SelectedItem; // Update the tactic TACT_SKILL t.TACT_SKILL = TACT_SKILL; switch (comboBoxSkill.SelectedIndex) { // If the comboBoxSkill selected index is 0 case 0: { numericUpDownSkill.Enabled = false; } break; case 1: { numericUpDownSkill.Enabled = false; } break; // If the comboBoxSkill selected index is 2 case 2: { numericUpDownSkill.Enabled = true; // Set the numericUpDownSkill minimum to 0 numericUpDownSkill.Minimum = 0; // Set the numericUpDownSkill maximum to 100 numericUpDownSkill.Maximum = 100; } break; // If the comboBoxSkill selected index is 3 case 3: { numericUpDownSkill.Value = 5; numericUpDownSkill.Enabled = true; // Set the numericUpDownSkill minimum to 1 numericUpDownSkill.Minimum = 1; // Set the numericUpDownSkill maximum to 5 numericUpDownSkill.Maximum = 5; } break; } // Check if the TacticsChanged event handler is not null if (TacticsChanged != null) { // Raise the TacticsChanged event TacticsChanged(this, new EventArgs()); } }
private void textBoxName_TextChanged(object sender, EventArgs e) { // Get the listBoxTactics selected tactic Tact t = (Tact)listBoxTactics.SelectedItem; // Update the tactic name t.Name = TACT_NAME; // Check if the TacticsChanged event handler is not null if (TacticsChanged != null) { // Raise the TacticsChanged event TacticsChanged(this, new EventArgs()); } }
private void comboBoxDebuff2_SelectedIndexChanged(object sender, EventArgs e) { // Get the listBoxTactics selected tactic Tact t = (Tact)listBoxTactics.SelectedItem; // Update the tactic TACT_KITE t.TACT_DEBUFF = TACT_DEBUFF; // Check if the TacticsChanged event handler is not null if (TacticsChanged != null) { // Raise the TacticsChanged event TacticsChanged(this, new EventArgs()); } }
private void numericUpDownWeight_ValueChanged(object sender, EventArgs e) { // Get the listBoxTactics selected tactic Tact t = (Tact)listBoxTactics.SelectedItem; // Update the tactic TACT_KITE t.TACT_WEIGHT = TACT_WEIGHT; // Check if the TacticsChanged event handler is not null if (TacticsChanged != null) { // Raise the TacticsChanged event TacticsChanged(this, new EventArgs()); } }
private void comboBoxSize_SelectedIndexChanged(object sender, EventArgs e) { // Get the listBoxTactics selected tactic Tact t = (Tact)listBoxTactics.SelectedItem; // Update the tactic TACT_SKILLCLASS t.TACT_SKILLCLASS = TACT_SKILLCLASS; // Check if the TacticsChanged event handler is not null if (TacticsChanged != null) { // Raise the TacticsChanged event TacticsChanged(this, new EventArgs()); } }
private void checkBoxFfa_CheckedChanged(object sender, EventArgs e) { // Get the listBoxTactics selected tactic Tact t = (Tact)listBoxTactics.SelectedItem; // Update the tactic TACT_KS t.TACT_SNIPE = TACT_SNIPE; // Check if the TacticsChanged event handler is not null if (TacticsChanged != null) { // Raise the TacticsChanged event TacticsChanged(this, new EventArgs()); } }
private void buttonAdd_Click(object sender, EventArgs e) { // Create a new tactic object Tact t = new Tact(1); // Add the new tactic to H_Tactics and the listBoxTactics items list H_Tactics.Tactics.Add(t); listBoxTactics.Items.Add(t); // Select the new tactic listBoxTactics.SelectedItem = t; // Check if the TacticsChanged event handler is not null if (TacticsChanged != null) { // Raise the TacticsChanged event TacticsChanged(this, new EventArgs()); } }
public void Open(string file) { // Load the homunculus tactics from the file H_Tactics.Load(file); // Create a new array of tactics objects Tact[] items = new Tact[H_Tactics.Tactics.Count]; // Copy the H_Tactics tactics to the new array H_Tactics.Tactics.CopyTo(items, 0); // Clear the listBoxTactics items list listBoxTactics.Items.Clear(); // Add the new array of tactics to the listBoxTactics items list listBoxTactics.Items.AddRange(items); // Select the first item in the listBoxTactics items list listBoxTactics.SelectedIndex = 0; }
private void comboBoxBasic_SelectedIndexChanged(object sender, EventArgs e) { // Get the listBoxTactics selected tactic Tact t = (Tact)listBoxTactics.SelectedItem; // Update the tactic TACT_BASIC t.TACT_BASIC = TACT_BASIC; 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 = false; } break; case 3: { numericUpDownSkill.Enabled = true; } break; } // Check if the TacticsChanged event handler is not null if (TacticsChanged != null) { // Raise the TacticsChanged event TacticsChanged(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 Tact t = (Tact)listBoxTactics.SelectedItem; // Remove the selected tactic from H_Tactics and the listBoxTactics items list H_Tactics.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 TacticsChanged event handler is not null if (TacticsChanged != null) { // Raise the TacticsChanged event TacticsChanged(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 "MyTact[0]" if (!Regex.IsMatch(file, "MyTact\\[0\\]")) { // Add the default tactic to the tactics collection _tacts.Add(new Tact(0, "Default")); } // Run through each string object in the lines array foreach (string line in lines) { // Check if the current line contains "MyTact[*]={*}*--*" if (Regex.IsMatch(line, "MyTact\\[(.*?)\\]=\\{(.*?)\\}.*?--(.*?)")) { // Get the set of values from the line string[] values = Regex.Replace(line, "MyTact\\[(.*?)\\]=\\{(.*?)\\}.*?--(.*?)", "$1,$2,$3").Split(','); // Create a new tactic object Tact t = new Tact(Convert.ToInt32(values[0]), values[14]); // 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_OLD") { t.TACT_SKILLCLASS = TACT_SKILLCLASS.CLASS_OLD; } else if (values[7] == "CLASS_S") { t.TACT_SKILLCLASS = TACT_SKILLCLASS.CLASS_S; } 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; } t.TACT_SP = Convert.ToInt32(values[9]); if (values[10] == "SNIPE_OK") { t.TACT_SNIPE = TACT_SNIPE.SNIPE_OK; } else if (values[10] == "SNIPE_DISABLE") { t.TACT_SNIPE = TACT_SNIPE.SNIPE_DISABLE; } if (values[11] == "KS_NEVER") { t.TACT_KS = TACT_KS.KS_NEVER; } else if (values[11] == "KS_ALWAYS") { t.TACT_KS = TACT_KS.KS_ALWAYS; } else if (values[11] == "KS_POLITE") { t.TACT_KS = TACT_KS.KS_POLITE; } t.TACT_WEIGHT = Convert.ToDecimal(values[12], new CultureInfo("en-US")); if (values[13] == "CHASE_NORMAL") { t.TACT_CHASE = TACT_CHASE.CHASE_NORMAL; } else if (values[13] == "CHASE_ALWAYS") { t.TACT_CHASE = TACT_CHASE.CHASE_ALWAYS; } else if (values[13] == "CHASE_NEVER") { t.TACT_CHASE = TACT_CHASE.CHASE_NEVER; } else if (values[13] == "CHASE_CLEVER") { t.TACT_CHASE = TACT_CHASE.CHASE_CLEVER; } // 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); textBoxName.TextChanged -= new EventHandler(textBoxName_TextChanged); textBoxID.TextChanged -= new EventHandler(textBoxID_TextChanged); comboBoxBasic.SelectedIndexChanged -= new EventHandler(comboBoxBasic_SelectedIndexChanged); comboBoxReact.SelectedIndexChanged -= new EventHandler(comboBoxReact_SelectedIndexChanged); checkBoxFfa.CheckedChanged -= new EventHandler(checkBoxFfa_CheckedChanged); comboBoxSkill.SelectedIndexChanged -= new EventHandler(comboBoxSkill_SelectedIndexChanged); numericUpDownSkill.ValueChanged -= new EventHandler(numericUpDownSkill_ValueChanged); comboBoxKite.SelectedIndexChanged -= new EventHandler(comboBoxKite_SelectedIndexChanged); comboBoxSize.SelectedIndexChanged -= new EventHandler(comboBoxSize_SelectedIndexChanged); comboBoxRescue.SelectedIndexChanged -= new EventHandler(comboBoxRescue_SelectedIndexChanged); numericUpDownSP.ValueChanged -= new EventHandler(numericUpDownSP_ValueChanged); numericUpDownWeight.ValueChanged -= new EventHandler(numericUpDownWeight_ValueChanged); comboBoxChase.SelectedIndexChanged -= new EventHandler(comboBoxChase_SelectedIndexChanged); comboBoxKS.SelectedIndexChanged -= new EventHandler(comboBoxKS_SelectedIndexChanged); comboBoxDebuff2.SelectedIndexChanged -= new EventHandler(comboBoxDebuff2_SelectedIndexChanged); // Check if the listBoxTactics selected item is not null if (listBoxTactics.SelectedItem != null) { // Get the listBoxTactics selected tactic Tact t = (Tact)listBoxTactics.SelectedItem; // Update the graphical user interface with the values of the current tactic TACT_ID = t.ID; TACT_NAME = t.Name; TACT_BASIC = t.TACT_BASIC; TACT_CAST = t.TACT_CAST; TACT_KS = t.TACT_KS; TACT_SKILL = t.TACT_SKILL; TACT_KITE = t.TACT_KITE; TACT_SKILLCLASS = t.TACT_SKILLCLASS; TACT_RESCUE = t.TACT_RESCUE; TACT_SNIPE = t.TACT_SNIPE; TACT_WEIGHT = t.TACT_WEIGHT; TACT_CHASE = t.TACT_CHASE; TACT_DEBUFF = t.TACT_DEBUFF; TACT_SP = t.TACT_SP; // Check if the TACT_ID is 0 if (TACT_ID == 0) { // Disable buttonRemove, textBoxName, and textBoxID buttonRemove.Enabled = false; textBoxName.Enabled = false; textBoxID.Enabled = false; } // If the TACT_ID is not 0 else { // Enable buttonRemove, textBoxName, and textBoxID buttonRemove.Enabled = true; textBoxName.Enabled = true; textBoxID.Enabled = true; } } // Add event handlers buttonAdd.Click += new EventHandler(buttonAdd_Click); buttonRemove.Click += new EventHandler(buttonRemove_Click); textBoxName.TextChanged += new EventHandler(textBoxName_TextChanged); textBoxID.TextChanged += new EventHandler(textBoxID_TextChanged); comboBoxBasic.SelectedIndexChanged += new EventHandler(comboBoxBasic_SelectedIndexChanged); comboBoxReact.SelectedIndexChanged += new EventHandler(comboBoxReact_SelectedIndexChanged); checkBoxFfa.CheckedChanged += new EventHandler(checkBoxFfa_CheckedChanged); comboBoxSkill.SelectedIndexChanged += new EventHandler(comboBoxSkill_SelectedIndexChanged); numericUpDownSkill.ValueChanged += new EventHandler(numericUpDownSkill_ValueChanged); comboBoxKite.SelectedIndexChanged += new EventHandler(comboBoxKite_SelectedIndexChanged); comboBoxSize.SelectedIndexChanged += new EventHandler(comboBoxSize_SelectedIndexChanged); comboBoxRescue.SelectedIndexChanged += new EventHandler(comboBoxRescue_SelectedIndexChanged); numericUpDownSP.ValueChanged += new EventHandler(numericUpDownSP_ValueChanged); numericUpDownWeight.ValueChanged += new EventHandler(numericUpDownWeight_ValueChanged); comboBoxChase.SelectedIndexChanged += new EventHandler(comboBoxChase_SelectedIndexChanged); comboBoxKS.SelectedIndexChanged += new EventHandler(comboBoxKS_SelectedIndexChanged); comboBoxDebuff2.SelectedIndexChanged += new EventHandler(comboBoxDebuff2_SelectedIndexChanged); }