コード例 #1
0
        public static void ReplaceSpawnersByRectangle(Rectangle2D rec, Map map, string file)
        {
            string path = null;

            if (file != null)
            {
                path = string.Format("Spawns/{0}.xml", file);

                if (!File.Exists(path))
                {
                    ToConsole(String.Format("Cannot proceed. {0} does not exist.", file), ConsoleColor.Red);
                    return;
                }
            }

            IPooledEnumerable eable = map.GetItemsInBounds(rec);
            List <Item>       list  = new List <Item>();

            foreach (Item item in eable)
            {
                if (item is XmlSpawner || item is Spawner)
                {
                    list.Add(item);
                }
            }

            foreach (var item in list)
            {
                item.Delete();
            }

            ToConsole(String.Format("Deleted {0} Spawners in {1}.", list.Count, map.ToString()));

            ColUtility.Free(list);
            eable.Free();

            if (path != null)
            {
                LoadFromXmlSpawner(path, map);
            }
        }
コード例 #2
0
        private static SR_Rune AddTree( LocationTree tree, Map map )
        {
            SR_Rune runeBook = new SR_Rune( map.ToString(), true );

            for( int i = 0; i < tree.Root.Children.Length; i++ )
                runeBook.AddRune( AddNode( tree.Root.Children[i], map ) );

            return runeBook;
        }
コード例 #3
0
ファイル: HarvestMap.cs プロジェクト: Crome696/ServUO
        public static List<Point2D> LoadLocsFor(Map map, HarvestMap hMap)
        {
            string path = String.Format("Data/HarvestLocs/{0}_{1}.cfg", hMap.IsMinerMap ? "MinerLocs" : "LumberLocs", map.ToString());

            if (!File.Exists(path))
            {
                Console.WriteLine("Warning! {0} does not exist for harvest maps...", path);
                return null;
            }

            List<Point2D> list = new List<Point2D>();

            using (StreamReader ip = new StreamReader(path))
            {
                string line;

                while ((line = ip.ReadLine()) != null)
                {
                    if (line.Length == 0 || line.StartsWith("#"))
                        continue;

                    var split = line.Split('\t');

                    int x, y = 0;

                    if (int.TryParse(split[0], out x) && int.TryParse(split[1], out y) && (x > 0 || y > 0))
                    {
                        list.Add(new Point2D(x, y));
                    }
                }
            }

            return list;
        }