public static void LoadTSV() { var f = File.OpenText("abnormalities.tsv"); Abnormalities = new Dictionary <uint, Abnormality>(); while (true) { var line = f.ReadLine(); if (line == null) { break; } var s = line.Split('\t'); var id = Convert.ToUInt32(s[0]); Enum.TryParse(s[1], out AbnormalityType t); var isShow = bool.Parse(s[2]); var isBuff = bool.Parse(s[3]); var infinity = bool.Parse(s[4]); var name = s[5]; var tooltip = s[6].Replace("
", "\n"); var iconName = s[7]; var ab = new Abnormality(id, isShow, isBuff, infinity, t); ab.SetIcon(iconName); ab.SetInfo(name, tooltip); Abnormalities.Add(id, ab); } }
public static void LoadAbnormalities() { var f = File.OpenText(abnormalitiesDB); Abnormalities = new Dictionary <uint, Abnormality>(); while (true) { var line = f.ReadLine(); if (line == null) { break; } var s = line.Split('\t'); var id = Convert.ToUInt32(s[0]); if (Abnormalities.ContainsKey(id)) { continue; } //Enum.TryParse(s[1], out AbnormalityType t); //var isShow = bool.Parse(s[2]); //var isBuff = bool.Parse(s[3]); //var infinity = bool.Parse(s[4]); var name = s[5]; //var tooltip = s[6].Replace("
", "\n"); var iconName = s[13]; var ab = new Abnormality(id, true, true, true, AbnormalityType.Buff); ab.SetIcon(iconName); ab.SetInfo(name, ""); Abnormalities.Add(id, ab); } }
static void ParseAbnormalityDataDoc(XDocument doc) { foreach (var a in doc.Descendants().Where(x => x.Name == "Abnormal")) { uint id = Convert.ToUInt32(a.Attribute("id").Value); bool isShow = true; if (a.Attribute("isShow").Value == "False") { isShow = false; } bool isBuff = true; if (a.Attribute("isBuff").Value == "False") { isBuff = false; } bool infinity = false; if (a.Attribute("infinity").Value == "True") { infinity = true; } int prop = Convert.ToInt32(a.Attribute("property").Value); Abnormality ab = new Abnormality(id, isShow, isBuff, infinity, (AbnormalityType)prop); foreach (var b in a.Descendants().Where(x => x.Name == "AbnormalityEffect")) { try { Double.TryParse(b.Attribute("value").Value.Replace('.', ','), out double val); var method = Convert.ToInt32(b.Attribute("method").Value); var tickInterval = Convert.ToInt32(b.Attribute("tickInterval").Value); ab.Effects.Add(new Effect(val, method, tickInterval)); } catch (Exception) { } } Abnormalities.Add(ab.Id, ab); } }