Example #1
0
        public static List <String[]> ListCooldowns()
        {
            WoWSpell      spell = null;
            List <String> keys  = FTWProps.spellWasLastCast.Keys.ToList();

            keys.Sort();

            List <String[]> cooldowns = new List <String[]>();

            foreach (String key in keys)
            {
                String[] arr = new String[4];
                arr[0] = key;
                FakeCooldown fc = null;
                if (FTWProps.fakecooldowns.ContainsKey(key))
                {
                    fc     = FTWProps.fakecooldowns[key];
                    arr[1] = fc.SpellID.ToString();
                }
                else
                {
                    spell  = SpellManager.Spells[key];
                    arr[1] = spell.Id.ToString();
                }
                arr[2] = string.Format("{0:hhmmss}", FTWProps.spellWasLastCast[key]);
                double cooldownremaining = 0;
                if (fc != null)
                {
                    cooldownremaining = FTWProps.spellWasLastCast[key].AddSeconds(fc.Cooldown).Subtract(DateTime.Now).TotalSeconds;
                }
                else
                {
                    cooldownremaining = spell.CooldownTimeLeft.TotalSeconds;
                }
                arr[3] = (cooldownremaining <= 0 ? "" : string.Format("{0:0.00}", cooldownremaining));
                cooldowns.Add(arr);
            }
            return(cooldowns);
        }
Example #2
0
        private static Dictionary <String, FakeCooldown> LoadFakeCooldowns(String filename)
        {
            string[] readText = File.ReadAllLines(filename);
            Dictionary <String, FakeCooldown> lst = new Dictionary <String, FakeCooldown>();
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < readText.Length; i++)
            {
                string line = readText[i];
                if (line.StartsWith("//") || line.Length < 5)
                {
                    continue;
                }
                FakeCooldown fc = new FakeCooldown(line);
                sb.AppendLine(String.Format("    {0}\t{1}\t{2}", fc.SpellID, fc.Cooldown, fc.Name));
                if (lst.ContainsKey(fc.Name))
                {
                    throw new Exception(string.Format("Spell {0} entered in {1} twice!", fc.Name, filename));
                }
                lst.Add(fc.Name, fc);
            }
            return(lst);
        }
Example #3
0
 private static Dictionary<String, FakeCooldown> LoadFakeCooldowns(String filename)
 {
     string[] readText = File.ReadAllLines(filename);
     Dictionary<String, FakeCooldown> lst = new Dictionary<String, FakeCooldown>();
     StringBuilder sb = new StringBuilder();
     for (int i = 0; i < readText.Length; i++)
     {
         string line = readText[i];
         if (line.StartsWith("//") || line.Length < 5)
             continue;
         FakeCooldown fc = new FakeCooldown(line);
         sb.AppendLine(String.Format("    {0}\t{1}\t{2}", fc.SpellID, fc.Cooldown, fc.Name));
         if (lst.ContainsKey(fc.Name))
             throw new Exception(string.Format("Spell {0} entered in {1} twice!", fc.Name, filename));
         lst.Add(fc.Name, fc);
     }
     return lst;
 }