示例#1
0
		public static void DoCommand(CommandEventArgs e)
		{
			string output = string.Empty;
			List<Region> regions = Region.CreateCacheFromXML(ref output);
			List<RegionControl> controllers = new List<RegionControl>();
			if (regions == null || regions.Count == 0)
			{
				e.Mobile.SendMessage("Regions failed to load!");
				return;
			}

			foreach (Region r in regions)
			{
				//See if a DRDT region already exists for this one?
				Region temp = Region.GetByName(r.Name, r.Map);
				if (temp == null && (temp is CustomRegion))
				{
					e.Mobile.SendMessage("Region {0} does not exist or is already a DRDT region", r.Name);
					continue;
				}

				RegionControl rc = null;
				//create new region controller 
				if (TestCenter.Enabled && (r.Name == "Skara Brae" || new List<String>(Enum.GetNames(typeof(KinFactionCities))).Find(delegate(string s) { return s.Equals(r.Name); }) != null))
				{
					rc = new Server.Engines.IOBSystem.KinCityRegionStone();
					e.Mobile.SendMessage("Kin Faction Region {0} created", r.Name);
				}
				else
				{
					rc = new RegionControl();
					e.Mobile.SendMessage("Region Control {0} created", r.Name);
				}
				rc.Name = r.Name;
				controllers.Add(rc);
				//upgrade this region to DRDT
				rc.CloneFromRegionObject(r, true);

			}

			//Now sort them alphabetically and move them to the world in rows of 7 from the mobile
			controllers.Sort(delegate(RegionControl rcA, RegionControl rcB) { return rcA.Name.CompareTo(rcB.Name); });

			int x = 0;
			int y = 0;
			foreach (RegionControl rc in controllers)
			{
				Point3D current = e.Mobile.Location;
				current.X += x;
				current.Y += y;
				rc.MoveToWorld(current, e.Mobile.Map);
				x++;
				if (x > 7)
				{
					x = 0;
					y++;
				}
			}

			e.Mobile.SendMessage("done");
		}
示例#2
0
        public static void DoCommand(CommandEventArgs e)
        {
            string               output      = string.Empty;
            List <Region>        regions     = Region.CreateCacheFromXML(ref output);
            List <RegionControl> controllers = new List <RegionControl>();

            if (regions == null || regions.Count == 0)
            {
                e.Mobile.SendMessage("Regions failed to load!");
                return;
            }

            foreach (Region r in regions)
            {
                //See if a DRDT region already exists for this one?
                Region temp = Region.GetByName(r.Name, r.Map);
                if (temp == null && (temp is CustomRegion))
                {
                    e.Mobile.SendMessage("Region {0} does not exist or is already a DRDT region", r.Name);
                    continue;
                }

                RegionControl rc = null;
                //create new region controller
                if (TestCenter.Enabled && (r.Name == "Skara Brae" || new List <String>(Enum.GetNames(typeof(KinFactionCities))).Find(delegate(string s) { return(s.Equals(r.Name)); }) != null))
                {
                    rc = new Server.Engines.IOBSystem.KinCityRegionStone();
                    e.Mobile.SendMessage("Kin Faction Region {0} created", r.Name);
                }
                else
                {
                    rc = new RegionControl();
                    e.Mobile.SendMessage("Region Control {0} created", r.Name);
                }
                rc.Name = r.Name;
                controllers.Add(rc);
                //upgrade this region to DRDT
                rc.CloneFromRegionObject(r, true);
            }

            //Now sort them alphabetically and move them to the world in rows of 7 from the mobile
            controllers.Sort(delegate(RegionControl rcA, RegionControl rcB) { return(rcA.Name.CompareTo(rcB.Name)); });

            int x = 0;
            int y = 0;

            foreach (RegionControl rc in controllers)
            {
                Point3D current = e.Mobile.Location;
                current.X += x;
                current.Y += y;
                rc.MoveToWorld(current, e.Mobile.Map);
                x++;
                if (x > 7)
                {
                    x = 0;
                    y++;
                }
            }

            e.Mobile.SendMessage("done");
        }