Beispiel #1
0
        public List <uint> getCells(uint param1)
        {
            int         i          = 0;
            int         j          = 0;
            int         radiusStep = 0;
            int         xResult    = 0;
            int         yResult    = 0;
            List <uint> aCells     = new List <uint>();

            Burning.DofusProtocol.Data.D2P.MapPoint origin = new Burning.DofusProtocol.Data.D2P.MapPoint((int)param1);
            int x = origin.X;
            int y = origin.Y;

            if (this._radius == 0)
            {
                if (this._minRadius == 0)
                {
                    aCells.Add(param1);
                }
                return(aCells);
            }
            for (radiusStep = (int)this._radius; radiusStep >= this._minRadius;)
            {
                for (i = -radiusStep; i <= radiusStep; i++)
                {
                    for (j = -radiusStep; j <= radiusStep;)
                    {
                        if (Math.Abs(i) + Math.Abs(j) == radiusStep)
                        {
                            xResult = x + i;
                            yResult = y + j;
                            if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap(xResult, yResult))
                            {
                                this.addCell(xResult, yResult, aCells);
                            }
                        }
                        j++;
                    }
                }
                radiusStep--;
            }
            return(aCells);
        }
Beispiel #2
0
        public List <uint> getCells(uint param1)
        {
            int         i      = 0;
            List <uint> aCells = new List <uint>();

            Burning.DofusProtocol.Data.D2P.MapPoint origin = new Burning.DofusProtocol.Data.D2P.MapPoint((int)param1);
            int x = origin.X;
            int y = origin.Y;

            if (this._minRadius == 0)
            {
                aCells.Add(param1);
            }
            for (i = 1; i <= this._radius;)
            {
                switch ((DirectionsEnum)this._direction)
                {
                case DirectionsEnum.DIRECTION_NORTH_WEST:
                    this.addCell(x + i, y + i, aCells);
                    this.addCell(x + i, y - i, aCells);
                    break;

                case DirectionsEnum.DIRECTION_NORTH_EAST:
                    this.addCell(x - i, y - i, aCells);
                    this.addCell(x + i, y - i, aCells);
                    break;

                case DirectionsEnum.DIRECTION_SOUTH_EAST:
                    this.addCell(x - i, y + i, aCells);
                    this.addCell(x - i, y - i, aCells);
                    break;

                case DirectionsEnum.DIRECTION_SOUTH_WEST:
                    this.addCell(x - i, y + i, aCells);
                    this.addCell(x + i, y + i, aCells);
                    break;
                }
                i++;
            }
            return(aCells);
        }
Beispiel #3
0
        public List <uint> getCells(uint param1)
        {
            int         i      = 0;
            int         j      = 0;
            List <uint> aCells = new List <uint>();

            Burning.DofusProtocol.Data.D2P.MapPoint origin = new Burning.DofusProtocol.Data.D2P.MapPoint((int)param1);
            int x = origin.X;
            int y = origin.Y;

            if (this._radius == 0 || this._radius2 == 0)
            {
                if (this._minRadius == 0 && !this._diagonalFree)
                {
                    aCells.Add(param1);
                }
                return(aCells);
            }
            for (i = x - (int)this._radius; i <= x + this._radius;)
            {
                for (j = y - (int)this._radius2; j <= y + this._radius2;)
                {
                    if (this._minRadius == 0 || Math.Abs(x - i) + Math.Abs(y - j) >= this._minRadius)
                    {
                        if (!this._diagonalFree || Math.Abs(x - i) != Math.Abs(y - j))
                        {
                            if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap(i, j))
                            {
                                this.addCell(i, j, aCells);
                            }
                        }
                    }
                    j++;
                }
                i++;
            }
            return(aCells);
        }
Beispiel #4
0
        public List <uint> getCells(uint param1)
        {
            List <uint> aCells = new List <uint>();

            if (this.minRadius == 0)
            {
                aCells.Add(param1);
            }
            if (this.onlyPerpendicular)
            {
                switch ((DirectionsEnum)this._direction)
                {
                case DirectionsEnum.DIRECTION_SOUTH_EAST:     //DOWN_RIGHT
                case DirectionsEnum.DIRECTION_NORTH_WEST:
                    this.disabledDirection.Add(DirectionsEnum.DIRECTION_SOUTH_EAST);
                    this.disabledDirection.Add(DirectionsEnum.DIRECTION_NORTH_WEST);
                    break;

                case DirectionsEnum.DIRECTION_NORTH_EAST:
                case DirectionsEnum.DIRECTION_SOUTH_WEST:
                    this.disabledDirection.Add(DirectionsEnum.DIRECTION_NORTH_EAST);
                    this.disabledDirection.Add(DirectionsEnum.DIRECTION_SOUTH_WEST);
                    break;

                case DirectionsEnum.DIRECTION_SOUTH:
                case DirectionsEnum.DIRECTION_NORTH:
                    this.disabledDirection.Add(DirectionsEnum.DIRECTION_SOUTH);
                    this.disabledDirection.Add(DirectionsEnum.DIRECTION_NORTH);
                    break;

                case DirectionsEnum.DIRECTION_EAST:
                case DirectionsEnum.DIRECTION_WEST:
                    this.disabledDirection.Add(DirectionsEnum.DIRECTION_EAST);
                    this.disabledDirection.Add(DirectionsEnum.DIRECTION_WEST);
                    break;
                }
            }
            Burning.DofusProtocol.Data.D2P.MapPoint origin = new Burning.DofusProtocol.Data.D2P.MapPoint((int)param1);
            int x = origin.X;
            int y = origin.Y;

            for (uint r = this.radius; r > 0;)
            {
                if (r >= this.minRadius)
                {
                    if (!this._diagonal)
                    {
                        if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap((int)(x + r), y) && !this.disabledDirection.Contains(DirectionsEnum.DIRECTION_SOUTH_EAST))
                        {
                            this.addCell((int)(x + r), y, aCells);
                        }
                        if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap((int)(x - r), y) && !this.disabledDirection.Contains(DirectionsEnum.DIRECTION_NORTH_WEST))
                        {
                            this.addCell((int)(x - r), y, aCells);
                        }
                        if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap(x, (int)(y + r)) && !this.disabledDirection.Contains(DirectionsEnum.DIRECTION_NORTH_EAST))
                        {
                            this.addCell(x, (int)(y + r), aCells);
                        }
                        if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap(x, (int)(y - r)) && !this.disabledDirection.Contains(DirectionsEnum.DIRECTION_SOUTH_WEST))
                        {
                            this.addCell(x, (int)(y - r), aCells);
                        }
                    }
                    if (this._diagonal || this._allDirections)
                    {
                        if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap((int)(x + r), (int)(y - r)) && !this.disabledDirection.Contains(DirectionsEnum.DIRECTION_SOUTH))
                        {
                            this.addCell((int)(x + r), (int)(y - r), aCells);
                        }
                        if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap((int)(x - r), (int)(y + r)) && !this.disabledDirection.Contains(DirectionsEnum.DIRECTION_NORTH))
                        {
                            this.addCell((int)(x - r), (int)(y + r), aCells);
                        }
                        if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap((int)(x + r), (int)(y + r)) && !this.disabledDirection.Contains(DirectionsEnum.DIRECTION_EAST))
                        {
                            this.addCell((int)(x + r), (int)(y + r), aCells);
                        }
                        if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap((int)(x - r), (int)(y - r)) && !this.disabledDirection.Contains(DirectionsEnum.DIRECTION_WEST))
                        {
                            this.addCell((int)(x - r), (int)(y - r), aCells);
                        }
                    }
                }
                r--;
            }
            return(aCells);
        }
Beispiel #5
0
        public List <uint> getCells(uint param1)
        {
            int         i      = 0;
            int         j      = 0;
            List <uint> aCells = new List <uint>();

            Burning.DofusProtocol.Data.D2P.MapPoint origin = new Burning.DofusProtocol.Data.D2P.MapPoint((int)param1);
            int x = origin.X;
            int y = origin.Y;

            if (this._radius == 0)
            {
                if (this._minRadius == 0)
                {
                    aCells.Add(param1);
                }
                return(aCells);
            }
            int  inc  = 1;
            uint step = 0;

            switch ((DirectionsEnum)this._nDirection)
            {
            case DirectionsEnum.DIRECTION_NORTH_WEST:
                for (i = x; i >= x - this._radius; i--)
                {
                    for (j = (int)-step; j <= step;)
                    {
                        if (this._minRadius == 0 || Math.Abs(x - i) + Math.Abs(j) >= this._minRadius)
                        {
                            if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap(i, j + y))
                            {
                                this.addCell(i, j + y, aCells);
                            }
                        }
                        j++;
                    }
                    step = step + (uint)inc;
                }
                break;

            case DirectionsEnum.DIRECTION_SOUTH_WEST:
                for (j = y; j >= y - this._radius; j--)
                {
                    for (i = (int)-step; i <= step;)
                    {
                        if (this._minRadius == 0 || Math.Abs(i) + Math.Abs(y - j) >= this._minRadius)
                        {
                            if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap(i + x, j))
                            {
                                this.addCell(i + x, j, aCells);
                            }
                        }
                        i++;
                    }
                    step = step + (uint)inc;
                }
                break;

            case DirectionsEnum.DIRECTION_SOUTH_EAST:
                for (i = x; i <= x + this._radius; i++)
                {
                    for (j = (int)-step; j <= step;)
                    {
                        if (this._minRadius == 0 || Math.Abs(x - i) + Math.Abs(j) >= this._minRadius)
                        {
                            if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap(i, j + y))
                            {
                                this.addCell(i, j + y, aCells);
                            }
                        }
                        j++;
                    }
                    step = step + (uint)inc;
                }
                break;

            case DirectionsEnum.DIRECTION_NORTH_EAST:
                for (j = y; j <= y + this._radius; j++)
                {
                    for (i = (int)-step; i <= step;)
                    {
                        if (this._minRadius == 0 || Math.Abs(i) + Math.Abs(y - j) >= this._minRadius)
                        {
                            if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap(i + x, j))
                            {
                                this.addCell(i + x, j, aCells);
                            }
                        }
                        i++;
                    }
                    step = step + (uint)inc;
                }
                break;
            }
            return(aCells);
        }
Beispiel #6
0
        public List <uint> getCells(uint param1 = 0)
        {
            bool        added    = false;
            uint        distance = 0;
            List <uint> aCells   = new List <uint>();

            Burning.DofusProtocol.Data.D2P.MapPoint origin = !this._fromCaster ? new Burning.DofusProtocol.Data.D2P.MapPoint((int)param1) : new Burning.DofusProtocol.Data.D2P.MapPoint((int)this._casterCellId);
            int  x      = origin.X;
            int  y      = origin.Y;
            uint length = !this._fromCaster ? this._radius : (this._radius + this._minRadius - 1);

            if (this._fromCaster && this._stopAtTarget)
            {
                var loc1 = new Burning.DofusProtocol.Data.D2P.MapPoint((int)param1);
                distance = (uint)origin.DistanceToCell(loc1);
                length   = distance < length ? distance : length;
            }

            for (uint r = this._minRadius; r <= length;)
            {
                switch ((DirectionsEnum)this._nDirection)
                {
                case DirectionsEnum.DIRECTION_WEST:
                    if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap((int)(x - r), (int)(y - r)))
                    {
                        added = this.addCell((int)(x - r), (int)(y - r), aCells);
                    }
                    break;

                case DirectionsEnum.DIRECTION_NORTH:
                    if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap((int)(x - r), (int)(y + r)))
                    {
                        added = this.addCell((int)(x - r), (int)(y + r), aCells);
                    }
                    break;

                case DirectionsEnum.DIRECTION_EAST:
                    if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap((int)(x + r), (int)(y + r)))
                    {
                        added = this.addCell((int)(x + r), (int)(y + r), aCells);
                    }
                    break;

                case DirectionsEnum.DIRECTION_SOUTH:
                    if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap((int)(x + r), (int)(y - r)))
                    {
                        added = this.addCell((int)(x + r), (int)(y - r), aCells);
                    }
                    break;

                case DirectionsEnum.DIRECTION_NORTH_WEST:
                    if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap((int)(x - r), y))
                    {
                        added = this.addCell((int)(x - r), y, aCells);
                    }
                    break;

                case DirectionsEnum.DIRECTION_SOUTH_WEST:
                    if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap(x, (int)(y - r)))
                    {
                        added = this.addCell(x, (int)(y - r), aCells);
                    }
                    break;

                case DirectionsEnum.DIRECTION_SOUTH_EAST:
                    if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap((int)(x + r), y))
                    {
                        added = this.addCell((int)(x + r), y, aCells);
                    }
                    break;

                case DirectionsEnum.DIRECTION_NORTH_EAST:
                    if (Burning.DofusProtocol.Data.D2P.MapPoint.isInMap(x, (int)(y + r)))
                    {
                        added = this.addCell(x, (int)(y + r), aCells);
                    }
                    break;
                }
                r++;
            }
            return(aCells);
        }