Example #1
0
 public static void LoadOptionsList(String[] Config, int OptionsStart, int OptionsCount, int AbilityIndex)
 {
     Abilities.Ability[] TempBinds = Abilities.BindingsList.ToArray();
     TempBinds[AbilityIndex].OptionsList = new List <Abilities.AbilityOptions>();
     int[] Spaces = new int[11];
     for (int i = OptionsStart; i < OptionsStart + OptionsCount; i++)
     {
         int Start       = 0;
         int End         = 0;
         int SpacesCount = 0;
         for (int n = 0; n < Config[i].Length; n++)
         {
             String TempStr = Config[i].Substring(n, 1);
             if (TempStr == ":")
             {
                 Start = n + 1;
             }
             if (TempStr == ";")
             {
                 End = n;
             }
             if (TempStr == "\\")
             {
                 Spaces[SpacesCount] = n;
                 SpacesCount++;
             }
         }
         Abilities.AbilityOptions Temp = new Abilities.AbilityOptions();
         Temp.Unit      = Config[i].Substring(Start + 1, (Spaces[0] - 1 - Start));
         Temp.Parameter = Config[i].Substring(Spaces[0] + 1, (Spaces[1] - 1 - Spaces[0]));
         Temp.Condition = Config[i].Substring(Spaces[1] + 1, (Spaces[2] - 1 - Spaces[1]));
         Temp.Value     = Config[i].Substring(Spaces[2] + 1, (Spaces[3] - 1 - Spaces[2]));
         Temp.AndOr     = Config[i].Substring(Spaces[3] + 1, (End - 1 - Spaces[3]));
         TempBinds[AbilityIndex].OptionsList.Add(Temp);
     }
     Abilities.BindingsList.Clear();
     for (int i = 0; i < TempBinds.Length; i++)
     {
         Abilities.BindingsList.Add(TempBinds[i]);
     }
 }
Example #2
0
        private void FillAbilityOptions()
        {
            Abilities.Ability[] Temp = Abilities.BindingsList.ToArray();
            int Rows         = dataGridView1.Rows.Count;
            int AbilityIndex = listBox3.SelectedIndex;

            if (AbilityIndex == -1)
            {
                return;
            }
            Temp[AbilityIndex].OptionsList = new List <Abilities.AbilityOptions>();
            for (int r = 0; r < Rows; r++)
            {
                Abilities.AbilityOptions TempOptions = new Abilities.AbilityOptions();
                try
                {
                    TempOptions.Unit      = dataGridView1.Rows[r].Cells[0].Value.ToString();
                    TempOptions.Parameter = dataGridView1.Rows[r].Cells[1].Value.ToString();
                    TempOptions.Condition = dataGridView1.Rows[r].Cells[2].Value.ToString();
                    TempOptions.Value     = dataGridView1.Rows[r].Cells[3].Value.ToString();
                    TempOptions.AndOr     = dataGridView1.Rows[r].Cells[4].Value.ToString();
                    Temp[AbilityIndex].OptionsList.Add(TempOptions);
                }
                catch (Exception)
                {
                    if ((TempOptions.Unit != null) || (TempOptions.Parameter != null) || (TempOptions.Condition != null) || (TempOptions.Value != null) || (TempOptions.AndOr != null))
                    {
                        Temp[AbilityIndex].OptionsList.Add(TempOptions);
                    }
                }
            }
            Abilities.BindingsList.Clear();
            for (int i = 0; i < Temp.Length; i++)
            {
                Abilities.BindingsList.Add(Temp[i]);
            }
        }
Example #3
0
 public static void LoadOptionsList(String[] Config, int OptionsStart, int OptionsCount, int AbilityIndex)
 {
     Abilities.Ability[] TempBinds = Abilities.BindingsList.ToArray();
     TempBinds[AbilityIndex].OptionsList = new List<Abilities.AbilityOptions>();
     int[] Spaces = new int[11];
     for (int i = OptionsStart; i < OptionsStart + OptionsCount; i++)
     {
         int Start = 0;
         int End = 0;
         int SpacesCount = 0;
         for (int n = 0; n < Config[i].Length; n++)
         {
             String TempStr = Config[i].Substring(n, 1);
             if (TempStr == ":")
             {
                 Start = n + 1;
             }
             if (TempStr == ";")
                 End = n;
             if (TempStr == "\\")
             {
                 Spaces[SpacesCount] = n;
                 SpacesCount++;
             }
         }
         Abilities.AbilityOptions Temp = new Abilities.AbilityOptions();
         Temp.Unit = Config[i].Substring(Start + 1, (Spaces[0] - 1 - Start));
         Temp.Parameter = Config[i].Substring(Spaces[0] + 1, (Spaces[1] - 1 - Spaces[0]));
         Temp.Condition = Config[i].Substring(Spaces[1] + 1, (Spaces[2] - 1 - Spaces[1]));
         Temp.Value = Config[i].Substring(Spaces[2] + 1, (Spaces[3] - 1 - Spaces[2]));
         Temp.AndOr = Config[i].Substring(Spaces[3] + 1, (End - 1 - Spaces[3]));
         TempBinds[AbilityIndex].OptionsList.Add(Temp);
     }
     Abilities.BindingsList.Clear();
     for (int i = 0; i < TempBinds.Length; i++)
         Abilities.BindingsList.Add(TempBinds[i]);
 }
Example #4
0
 private void FillAbilityOptions()
 {
     Abilities.Ability[] Temp = Abilities.BindingsList.ToArray();
     int Rows = dataGridView1.Rows.Count;
     int AbilityIndex=listBox3.SelectedIndex;
     if (AbilityIndex==-1)
         return;
     Temp[AbilityIndex].OptionsList = new List<Abilities.AbilityOptions>();
     for (int r = 0; r < Rows; r++)
     {
         Abilities.AbilityOptions TempOptions = new Abilities.AbilityOptions();
         try
         {
             TempOptions.Unit = dataGridView1.Rows[r].Cells[0].Value.ToString();
             TempOptions.Parameter = dataGridView1.Rows[r].Cells[1].Value.ToString();
             TempOptions.Condition = dataGridView1.Rows[r].Cells[2].Value.ToString();
             TempOptions.Value = dataGridView1.Rows[r].Cells[3].Value.ToString();
             TempOptions.AndOr = dataGridView1.Rows[r].Cells[4].Value.ToString();
             Temp[AbilityIndex].OptionsList.Add(TempOptions);
         }
         catch (Exception)
         {
             if ((TempOptions.Unit != null) || (TempOptions.Parameter != null) || (TempOptions.Condition != null) || (TempOptions.Value != null) || (TempOptions.AndOr != null))
                 Temp[AbilityIndex].OptionsList.Add(TempOptions);
         }
     }
     Abilities.BindingsList.Clear();
     for (int i = 0; i < Temp.Length; i++)
         Abilities.BindingsList.Add(Temp[i]);
 }