public static void Load() { string text1; Map map1; string text2; Region region1; XmlElement element4; string text3; Region region2; if (!File.Exists("Data/Regions.xml")) { Console.WriteLine("Error: Data/Regions.xml does not exist"); return; } Console.Write("Regions: Loading..."); XmlDocument document1 = new XmlDocument(); document1.Load("Data/Regions.xml"); XmlElement element1 = document1["ServerRegions"]; foreach (XmlElement element2 in element1.GetElementsByTagName("Facet")) { text1 = element2.GetAttribute("name"); map1 = null; try { map1 = Map.Parse(text1); } catch { } if ((map1 == null) || (map1 == Map.Internal)) { if (Region.m_SupressXmlWarnings) { continue; } Console.WriteLine("Regions.xml: Invalid facet name \'{0}\'", text1); continue; } foreach (XmlElement element3 in element2.GetElementsByTagName("region")) { text2 = element3.GetAttribute("name"); if ((text2 != null) && (text2.Length > 0)) { region1 = Region.GetByName(text2, map1); if (region1 != null) { if (!region1.LoadFromXml) { if (Region.m_SupressXmlWarnings) { continue; } Console.WriteLine("Regions.xml: Region \'{0}\' has an XML entry, but is set not to LoadFromXml.", text2); continue; } try { region1.Priority = int.Parse(element3.GetAttribute("priority")); } catch { if (!Region.m_SupressXmlWarnings) { Console.WriteLine("Regions.xml: Could not parse priority for region \'{0}\' (assuming TownPriority)", region1.Name); } region1.Priority = 50; } element4 = element3["go"]; if (element4 != null) { try { region1.GoLocation = Point3D.Parse(element4.GetAttribute("location")); } catch { if (!Region.m_SupressXmlWarnings) { Console.WriteLine("Regions.xml: Could not parse go location for region \'{0}\'", region1.Name); } } } element4 = element3["music"]; if (element4 != null) { try { region1.Music = ((MusicName)Enum.Parse(typeof(MusicName), element4.GetAttribute("name"), true)); } catch { if (!Region.m_SupressXmlWarnings) { Console.WriteLine("Regions.xml: Could not parse music for region \'{0}\'", region1.Name); } } } element4 = element3["zrange"]; if (element4 != null) { text3 = element4.GetAttribute("min"); if ((text3 != null) && (text3 != "")) { try { region1.MinZ = int.Parse(text3); } catch { if (!Region.m_SupressXmlWarnings) { Console.WriteLine("Regions.xml: Could not parse zrange:min for region \'{0}\'", region1.Name); } } } text3 = element4.GetAttribute("max"); if ((text3 != null) && (text3 != "")) { try { region1.MaxZ = int.Parse(text3); } catch { if (!Region.m_SupressXmlWarnings) { Console.WriteLine("Regions.xml: Could not parse zrange:max for region \'{0}\'", region1.Name); } } } } foreach (XmlElement element5 in element3.GetElementsByTagName("rect")) { try { if (region1.m_LoadCoords == null) { region1.m_LoadCoords = new ArrayList(1); } region1.m_LoadCoords.Add(Region.ParseRectangle(element5, true)); continue; } catch { if (Region.m_SupressXmlWarnings) { continue; } Console.WriteLine("Regions.xml: Error parsing rect for region \'{0}\'", region1.Name); continue; } } foreach (XmlElement element6 in element3.GetElementsByTagName("inn")) { try { if (region1.InnBounds == null) { region1.InnBounds = new ArrayList(1); } region1.InnBounds.Add(Region.ParseRectangle(element6, false)); continue; } catch { if (Region.m_SupressXmlWarnings) { continue; } Console.WriteLine("Regions.xml: Error parsing inn for region \'{0}\'", region1.Name); continue; } } continue; } } } } ArrayList list1 = new ArrayList(Region.m_Regions); int num1 = 0; while ((num1 < list1.Count)) { region2 = ((Region)list1[num1]); if (!region2.LoadFromXml && (region2.m_Coords == null)) { region2.Coords = new ArrayList(); } else if (region2.LoadFromXml) { if (region2.m_LoadCoords == null) { region2.m_LoadCoords = new ArrayList(); } region2.Coords = region2.m_LoadCoords; } ++num1; } for (num1 = 0; (num1 < Map.AllMaps.Count); ++num1) { ((Map)Map.AllMaps[num1]).Regions.Sort(); } ArrayList list2 = new ArrayList(World.Mobiles.Values); foreach (Mobile mobile1 in list2) { mobile1.ForceRegionReEnter(true); } Console.WriteLine("done"); }