示例#1
0
        public static HarvestMap CheckMapOnHarvest(Mobile from, object harvested, HarvestDefinition def)
        {
            Map map = from.Map;

            if (harvested is IPoint3D && from.Backpack != null)
            {
                IPoint3D p = harvested as IPoint3D;

                Item[] items = from.Backpack.FindItemsByType(typeof(HarvestMap));

                foreach (Item item in items)
                {
                    HarvestMap harvestmap = item as HarvestMap;

                    if (harvestmap != null && harvestmap.TargetMap == map && harvestmap.UsesRemaining > 0 &&
                        def.GetBank(map, p.X, p.Y) == def.GetBank(harvestmap.TargetMap, harvestmap.Target.X, harvestmap.Target.Y))
                    {
                        return(harvestmap);
                    }
                }
            }

            return(null);
        }
示例#2
0
        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);
        }
示例#3
0
        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;
        }