Exemple #1
0
        public ICellMovement MoveToCell(int cellId)
        {
            var path = new Pathfinder(_account.Character.Map).FindPath(_account.Character.CellId, cellId);
            var move = new CellMovement(_account, path);

            return(move);
        }
Exemple #2
0
        public ICellMovement MoveToCellWithDistance(int cellId, int maxDistance, bool bool1)
        {
            MovementPath path           = null;
            var          savDistance    = -1;
            var          characterPoint = new MapPoint(_account.Character.CellId);
            var          targetPoint    = new MapPoint(cellId);

            foreach (var point in GetListPointAtGoodDistance(characterPoint, targetPoint, maxDistance))
            {
                Pathfinder pathFinding = null;
                if (targetPoint.DistanceToCell(point) > maxDistance ||
                    targetPoint.X != point.X && targetPoint.Y != point.Y)
                {
                    continue;
                }
                var distance = characterPoint.DistanceTo(point);
                if (savDistance != -1 && distance >= savDistance)
                {
                    continue;
                }
                if (bool1)
                {
                    if (Data.IsWalkable(point.CellId))
                    {
                        goto Label_00A8;
                    }
                    continue;
                }
                if (!NothingOnCell(point.CellId))
                {
                    continue;
                }
Label_00A8:
                pathFinding = new Pathfinder(_account.Character.Map);
                var path2 = pathFinding.FindPath(_account.Character.CellId, point.CellId);
                if (path2 == null)
                {
                    continue;
                }
                path        = path2;
                savDistance = distance;
            }
            if (path == null)
            {
                return(null);
            }
            var move = new CellMovement(_account, path);

            return(move);
        }