private void Move(object e, EventArgs e2) { lock (Database.Cache.MapsCache.MapsList) { _movements.Interval = Utilities.Basic.Rand(1000, 5000); var map = Database.Cache.MapsCache.MapsList.First(x => x.GetModel.ID == MapID); var path = new Realm.Maps.Pathfinding("", map, MapCell, Dir); var newDir = Utilities.Basic.Rand(0, 3) * 2 + 1; var newCell = path.NextCell(MapCell, newDir); if (newCell <= 0) return; path.UpdatePath(Realm.Maps.Pathfinding.GetDirChar(Dir) + Realm.Maps.Pathfinding.GetCellChars(MapCell) + Realm.Maps.Pathfinding.GetDirChar(newDir) + Realm.Maps.Pathfinding.GetCellChars(newCell)); var startpath = path.GetStartPath; var cellpath = path.RemakePath(); if (!Realm.Maps.Pathfinding.isValidCell(MapCell, cellpath) && !map.RushablesCells.Contains(newCell)) return; if (cellpath != "") { MapCell = path.Destination; Dir = path.Direction; var packet = string.Format("GA0;1;{0};{1}", ID, startpath + cellpath); map.Send(packet); } } }
private void Move(object e, EventArgs e2) { _movements.Interval = Utilities.Basic.Rand(10000, 15000); var path = new Realm.Maps.Pathfinding("", _map, _cell, _dir); var newDir = Utilities.Basic.Rand(0, 3) * 2 + 1; var newCell = path.NextCell(_cell, newDir); if (newCell <= 0) return; path.UpdatePath(Realm.Maps.Pathfinding.GetDirChar(_dir) + Realm.Maps.Pathfinding.GetCellChars(_cell) + Realm.Maps.Pathfinding.GetDirChar(newDir) + Realm.Maps.Pathfinding.GetCellChars(newCell)); var startpath = path.GetStartPath; var cellpath = path.RemakePath(); if (!Realm.Maps.Pathfinding.isValidCell(_cell, cellpath) && !_map.RushablesCells.Contains(newCell)) return; if (cellpath != "") { _cell = path.Destination; _dir = path.Direction; var packet = string.Format("GA0;1;{0};{1}", ID, startpath + cellpath); _map.Send(packet); } }