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); }
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); }