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); }
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); }
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; }