Example #1
0
        public DebuffDisplayInfo GetDebuffDisplayInfo(string name)
        {
            DebuffDisplayInfo debuffDisplayInfo = new DebuffDisplayInfo();

            try
            {
                DebuffEffect debuffEffect = this.DebuffEffects.Find((DebuffEffect f) => f.EffectDetails.Count <DebuffEffectDetails>() > 0 && (from w in f.EffectDetails
                                                                                                                                              where w.DisplayName.Trim().Equals(name.Trim(), StringComparison.CurrentCultureIgnoreCase)
                                                                                                                                              select w).Count <DebuffEffectDetails>() > 0);
                if (debuffEffect != null)
                {
                    debuffDisplayInfo.Icon = debuffEffect.Icon;
                    DebuffEffectDetails debuffEffectDetails = (from w in debuffEffect.EffectDetails
                                                               where w.DisplayName.Trim().Equals(name.Trim(), StringComparison.CurrentCultureIgnoreCase)
                                                               select w).First <DebuffEffectDetails>();
                    if (debuffEffectDetails != null)
                    {
                        debuffDisplayInfo.Icon = debuffEffectDetails.Icon;
                    }
                }
                else
                {
                    DebuffEffect debuffEffect2 = this.DebuffEffects.Find((DebuffEffect f) => f.DisplayName.Trim().Equals(name.Trim(), StringComparison.CurrentCultureIgnoreCase));
                    if (debuffEffect2 != null)
                    {
                        debuffDisplayInfo.Icon = debuffEffect2.Icon;
                    }
                }
            }
            catch (Exception ex) { Repo.RecordException(ex); }
            return(debuffDisplayInfo);
        }
Example #2
0
 public DebuffInfo GetDebuff(int effect)
 {
     try
     {
         var enumerable = from s in this.SpellWords
                          where s.Effect.Equals(effect)
                          select s into sp
                          join de in this.DebuffEffects on sp.Effect equals de.EffectId
                          select new
         {
             CastTime        = sp.CastTime,
             Effect          = sp.Effect,
             SpSpellWords    = sp.SpellWords,
             DebuffCategory  = de.DebuffCategory,
             DefaultDuration = de.DefaultDuration,
             DisplayName     = de.DisplayName,
             EffectDetails   = de.EffectDetails,
             EffectId        = de.EffectId,
             SpellWords      = de.SpellWords
         };
         foreach (var f__AnonymousType in enumerable)
         {
             TimeSpan timeSpan = DateTime.Now.Subtract(f__AnonymousType.CastTime);
             if (((f__AnonymousType.DebuffCategory == DebuffCategories.Life && timeSpan.TotalSeconds >= (double)this.CurrentProfile.DebuffWindowMinLife && timeSpan.TotalSeconds <= (double)this.CurrentProfile.DebuffWindowMaxLife)) && f__AnonymousType.EffectDetails.Count > 0)
             {
                 foreach (DebuffEffectDetails debuffEffectDetails in f__AnonymousType.EffectDetails)
                 {
                     if (debuffEffectDetails.SpellWords.Trim().Replace(" ", "").ToLower().Equals(f__AnonymousType.SpSpellWords.Trim().Replace(" ", "").ToLower()))
                     {
                         return(new DebuffInfo
                         {
                             Effect = f__AnonymousType.Effect,
                             DisplayName = debuffEffectDetails.DisplayName,
                             DefaultDuration = ((debuffEffectDetails.DefaultDuration <= 0) ? ((f__AnonymousType.DefaultDuration <= 0) ? this.CurrentProfile.GetDefaultDuration(f__AnonymousType.DebuffCategory) : f__AnonymousType.DefaultDuration) : debuffEffectDetails.DefaultDuration)
                         });
                     }
                 }
             }
         }
         IEnumerable <DebuffEffect> enumerable2 = from w in this.DebuffEffects
                                                  where w.EffectId.Equals(effect)
                                                  select w;
         if (enumerable2 != null && enumerable2.Count <DebuffEffect>() > 0)
         {
             DebuffEffect debuffEffect = enumerable2.FirstOrDefault <DebuffEffect>();
             return(new DebuffInfo
             {
                 DefaultDuration = ((debuffEffect.DefaultDuration <= 0) ? this.CurrentProfile.GetDefaultDuration(debuffEffect.DebuffCategory) : debuffEffect.DefaultDuration),
                 DisplayName = enumerable2.FirstOrDefault <DebuffEffect>().DisplayName,
                 Effect = enumerable2.FirstOrDefault <DebuffEffect>().EffectId
             });
         }
     }
     catch (Exception ex) { Repo.RecordException(ex); }
     return(null);
 }
Example #3
0
        public static DebuffDB InitialiseDebuffDB()
        {
            DebuffDB debuffDB = new DebuffDB();

            try
            {
                DebuffEffect debuffEffect = new DebuffEffect();

                Assembly     assembly = Assembly.GetExecutingAssembly();
                const string PATH     = "Defiance.Resources.effects.txt";
                using (Stream stream = assembly.GetManifestResourceStream(PATH))
                {
                    using (StreamReader streamReader = new StreamReader(stream))
                    {
                        while (!streamReader.EndOfStream)
                        {
                            try
                            {
                                string text = streamReader.ReadLine();
                                if (text.StartsWith("EFFECT"))
                                {
                                    debuffEffect          = new DebuffEffect();
                                    debuffEffect.EffectId = Convert.ToInt32(text.Replace("EFFECT=", "").Trim());
                                }
                                else if (text.StartsWith("Category"))
                                {
                                    string text2 = text.Replace("Category=", "").Trim();
                                    string a;
                                    if ((a = text2) != null)
                                    {
                                        if (!(a == "Life"))
                                        {
                                            if (a == "Creature")
                                            {
                                                debuffEffect.DebuffCategory = DebuffCategories.Creature;
                                            }
                                        }
                                        else
                                        {
                                            debuffEffect.DebuffCategory = DebuffCategories.Life;
                                        }
                                    }
                                }
                                else if (text.StartsWith("DefaultDebuffDuration"))
                                {
                                    debuffEffect.DefaultDuration = Convert.ToInt32(text.Replace("DefaultDebuffDuration=", "").Trim());
                                }
                                else if (text.StartsWith("DisplayName"))
                                {
                                    debuffEffect.DisplayName = text.Replace("DisplayName=", "").Trim();
                                }
                                else if (text.StartsWith("SpellWords"))
                                {
                                    debuffEffect.SpellWords = text.Replace("SpellWords=", "").Trim();
                                }
                                else if (text.StartsWith("Icon"))
                                {
                                    debuffEffect.Icon = Convert.ToInt32(text.Replace("Icon=", "").Trim());
                                }
                                else if (text.StartsWith("-DEBUFF"))
                                {
                                    DebuffEffectDetails debuffEffectDetails = new DebuffEffectDetails();
                                    text = text.Replace("-DEBUFF|", "");
                                    string[] array = text.Split(new string[]
                                    {
                                        "|"
                                    }, StringSplitOptions.None);
                                    if (array.Length > 0)
                                    {
                                        debuffEffectDetails.DisplayName = array[0];
                                    }
                                    if (array.Length > 1 && array[1].Length > 0)
                                    {
                                        debuffEffectDetails.DefaultDuration = Convert.ToInt32(array[1]);
                                    }
                                    if (array.Length > 2)
                                    {
                                        debuffEffectDetails.SpellWords = array[2];
                                    }
                                    if (array.Length > 4)
                                    {
                                        debuffEffectDetails.Icon = Convert.ToInt32(array[4].Trim());
                                    }
                                    debuffEffect.EffectDetails.Add(debuffEffectDetails);
                                }
                                else if (text.StartsWith("ENDEFFECT"))
                                {
                                    debuffDB.DebuffEffects.Add(debuffEffect);
                                }
                            }
                            catch (Exception ex) { Repo.RecordException(ex); }
                        }
                    }
                }
            }
            catch (Exception ex2) { Repo.RecordException(ex2); }
            return(debuffDB);
        }