private void LoadVendorOld(XmlDocument doc) { try { XmlNodeList traList = doc.GetElementsByTagName("Vendor"); foreach (XmlNode tra in traList) { var v = new Vendor(); v.Load(tra); if (!string.IsNullOrEmpty(v.Name) && v.Spot != null) { NpcController.AddNpc(new VendorsEx(VendorType.Repair, v.Name, v.Spot, int.MinValue)); } } } catch { } }
private void LoadSubProfile(XmlDocument doc) { XmlNodeList subProfiles = doc.GetElementsByTagName("SubProfile"); foreach (XmlNode subProfile in subProfiles) { var sub = new SubProfile(); foreach (XmlNode child in subProfile.ChildNodes) { if (child.Name.Equals("Name")) sub.Name = child.InnerText; if (child.Name.Equals("MinLevel")) sub.PlayerMinLevel = Convert.ToInt32(child.InnerText); if (child.Name.Equals("MaxLevel")) sub.PlayerMaxLevel = Convert.ToInt32(child.InnerText); if (child.Name.Equals("MobMinLevel")) sub.MobMinLevel = Convert.ToInt32(child.InnerText); if (child.Name.Equals("MobMaxLevel")) sub.MobMaxLevel = Convert.ToInt32(child.InnerText); if (child.Name.Equals("SpotRoamDistance")) sub.SpotRoamDistance = Convert.ToInt32(child.InnerText); if (child.Name.Equals("Order")) sub.Order = Convert.ToBoolean(child.InnerText); if (child.Name.Equals("Factions")) { string temp = child.InnerText; string[] split = temp.Split(new[] {' '}); sub.Factions.AddRange(from s in split where s != "" select Convert.ToUInt32(s)); } if (child.Name.Equals("Ignores")) { string temp = child.InnerText; string[] split = temp.Split(new[] {'|'}); sub.Ignore.AddRange(from s in split where s != "" select s); } if (child.Name.Equals("Spot")) { string temp = child.InnerText; string correctString = temp; if (Convert.ToString(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator) != ".") { correctString = temp.Replace(".", CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator); } string xyz = correctString; string[] split = xyz.Split(new[] {' '}); if (split.Length > 2) { var wayPointPos = new Location((float) Convert.ToDouble((split[0])), (float) Convert.ToDouble((split[1])), (float) Convert.ToDouble((split[2]))); sub.Spots.Add(wayPointPos); } else { var wayPointPos = new Location((float) Convert.ToDouble((split[0])), (float) Convert.ToDouble((split[1])), (float) Convert.ToDouble((0))); sub.Spots.Add(wayPointPos); } } if (child.Name.Equals("Vendor")) { var v = new Vendor(); v.Load(child); NpcController.AddNpc(new VendorsEx(VendorType.Repair, v.Name, v.Spot, int.MinValue)); } } _subProfile.Add(sub); } }