Пример #1
0
        public BeginAutoAttack(INavigationGrid navGrid, IAttackableUnit attacker, IAttackableUnit attacked, uint futureProjNetId, bool isCritical)
            : base(PacketCmd.PKT_S2C_BEGIN_AUTO_ATTACK, attacker.NetId)
        {
            WriteNetId(attacked);
            Write((byte)0x80);            // extraTime
            Write((uint)futureProjNetId); // Basic attack projectile ID, to be spawned later
            if (isCritical)
            {
                Write((byte)0x49); // attackSlot
            }
            else
            {
                Write((byte)0x40); // attackSlot
            }

            Write((byte)0x80); // not sure what this is, but it should be correct (or maybe attacked x z y?) - 4.18
            Write((byte)0x01);
            Write(MovementVector.TargetXToNormalFormat(navGrid, attacked.X));
            Write((byte)0x80);
            Write((byte)0x01);
            Write(MovementVector.TargetYToNormalFormat(navGrid, attacked.Y));
            Write((byte)0xCC);
            Write((byte)0x35);
            Write((byte)0xC4);
            Write((byte)0xD1);
            Write((float)attacker.X);
            Write((float)attacker.Y);
        }
        private void UpdateMovementVectors(Dictionary <JointType, bool> jointDirChange)
        {
            foreach (var change in jointDirChange)
            {
                if (change.Value == true) // if a dir is changed
                {
                    var joint = change.Key;
                    int currentNumberOfVectors = jointMovementVectors[joint].Count;
                    var lastCoordinates        = jointMovementVectors[joint][currentNumberOfVectors - 1]._endPoint;


                    lastCoordinates = SmoothingLine(smoothingBuffer, lastCoordinates, joint);

                    var newVector = new MovementVector(new Point3D(lastCoordinates.X, lastCoordinates.Y, lastCoordinates.Z), lastPositions[0][joint]);


                    bool CheckIfNewVectorIsNeeded = checkNewVector(newVector, joint);
                    if (CheckIfNewVectorIsNeeded == true)
                    {
                        jointMovementVectors[joint].Add(newVector);
                    }
                    else
                    {
                        var lastPoint = jointMovementVectors[joint][currentNumberOfVectors - 1];
                        //Batev: var lastPoint = new Point3D();
                        jointMovementVectors[joint][currentNumberOfVectors - 1]._endPoint = lastPositions[0][joint];
                        var angle = Math3DHelper.AngleBetweenTwoPointsInDegrees(lastPoint._startPoint, lastPositions[0][joint]);
                        //Batev: var angle = Math3DHelper.AngleBetweenTwoPointsInDegrees(lastPoint, lastPositions[0][joint]);
                        jointMovementVectors[joint][currentNumberOfVectors - 1]._angle    = angle;
                        jointMovementVectors[joint][currentNumberOfVectors - 1]._distance = Math3DHelper.DistanceBetwenTwoPoints(lastPoint._startPoint, lastPositions[0][joint]);
                        //Batev:  jointMovementVectors[joint][currentNumberOfVectors - 1]._distance = Math3DHelper.DistanceBetwenTwoPoints(lastPoint, lastPositions[0][joint]);
                    }
                }
            }
        }
Пример #3
0
 public BeginAutoAttack(AttackableUnit attacker, AttackableUnit attacked, uint futureProjNetId, bool isCritical)
     : base(PacketCmd.PKT_S2C_BeginAutoAttack, attacker.NetId)
 {
     buffer.Write(attacked.NetId);
     buffer.Write((byte)0x80);      // extraTime
     buffer.Write(futureProjNetId); // Basic attack projectile ID, to be spawned later
     if (isCritical)
     {
         buffer.Write((byte)0x49); // attackSlot
     }
     else
     {
         buffer.Write((byte)0x40); // attackSlot
     }
     buffer.Write((byte)0x80);     // not sure what this is, but it should be correct (or maybe attacked x z y?) - 4.18
     buffer.Write((byte)0x01);
     buffer.Write(MovementVector.TargetXToNormalFormat(attacked.X));
     buffer.Write((byte)0x80);
     buffer.Write((byte)0x01);
     buffer.Write(MovementVector.TargetYToNormalFormat(attacked.Y));
     buffer.Write((byte)0xCC);
     buffer.Write((byte)0x35);
     buffer.Write((byte)0xC4);
     buffer.Write((byte)0xD1);
     buffer.Write(attacker.X);
     buffer.Write(attacker.Y);
 }
Пример #4
0
        /// <summary>
        ///  Get a new teleport zone that is initialized with a different
        ///  movement vector.
        /// </summary>
        /// <param name="vector">The new movement vector.</param>
        /// <returns>The update teleport zone.</returns>
        public TeleportZone SetVector(MovementVector vector)
        {
            var zone = Clone();

            zone._vector = vector;
            return(zone);
        }
Пример #5
0
        public override void Serialize(LittleEndianWriter writer)
        {
            writer.WriteShort((short)1); // Number of dashes

            writer.WriteByte((byte)4);   // Waypoints size * 2
            writer.WriteUInt((uint)sourceNetId);
            writer.WriteFloat((float)dashSpeed);
            writer.WriteFloat((float)leapHeight);
            writer.WriteFloat((float)unitPosition.X);
            writer.WriteFloat((float)unitPosition.Y);

            writer.WriteByte((byte)(keepFacingLastDirection ? 0x01 : 0x00));

            writer.WriteUInt(targetNetId);

            writer.WriteFloat((float)followTargetMaxDistance);
            writer.WriteFloat((float)backDistance);
            writer.WriteFloat((float)travelTime);

            var waypoints = new List <Vector2>
            {
                new Vector2(unitPosition.X, unitPosition.Y),
                new Vector2(targetPosition.X, targetPosition.Y)
            };

            writer.WriteBytes(MovementVector.EncodeWaypoints(waypoints.ToArray(), mapSize));
        }
Пример #6
0
        public virtual void Step()
        {
            if (Actors.Count == 0)
            {
                Die();
            }
            else
            {
                Hunger();

                if (MovementVector != null)
                {
                    for (int i = 0; i < Actors.Count; i++)
                    {
                        var actor = Actors[i];

                        double speed = Math.Min(Geo.Distance(actor.Position, MovementVector), MaxCellSpeed(actor));

                        var current = actor.Position.ToVector();
                        var target  = MovementVector.ToVector();

                        var direction = target - current;
                        direction = VectorUtil.Normalize(direction);

                        current += direction * speed;

                        actor.Position.X = (int)current.X;
                        actor.Position.Y = (int)current.Y;
                    }
                }
            }
        }
        public override void Serialize(LittleEndianWriter writer)
        {
            writer.WriteUInt(targetNetId);
            writer.WriteByte((byte)extraTime);       // extraTime
            writer.WriteUInt(futureProjectileNetId); // Basic attack projectile ID, to be spawned later

            writer.WriteByte((byte)slot);            // attackSlot

            writer.WriteByte((byte)0x80);            // not sure what this is, but it should be correct (or maybe attacked x z y?) - 4.18
            writer.WriteByte((byte)0x01);

            writer.WriteShort((short)MovementVector.TargetXToNormalFormat(targetPosition.X, middleOfMap));
            writer.WriteByte((byte)0x80);
            writer.WriteByte((byte)0x01);
            writer.WriteShort((short)MovementVector.TargetYToNormalFormat(targetPosition.Y, middleOfMap));

            //    writer.WriteFloat(targetPosition.X);
            //    writer.WriteFloat(targetPosition.Y);



            writer.WriteByte((byte)0xCC);
            writer.WriteByte((byte)0x35);
            writer.WriteByte((byte)0xC4);
            writer.WriteByte((byte)0xD1);
            writer.WriteFloat(sourcePosition.X);
            writer.WriteFloat(sourcePosition.Y);
        }
Пример #8
0
 public override void Tick(Controller controller)
 {
     if (controller.input.jump && !running)
     {
         controller.StartCoroutine(MovementVector.DecayingForce(actualStrength, 1, actualDecel,
                                                                (test) => { running = test; }));
     }
     // NOTE: use Awake(); inside the codeblock and then after can even write logic,
     //       call other functions. pretty cool!
 }
Пример #9
0
        public void AddAttractionVector(Steerable theOther)
        {
            Vector attractionVector = new Vector(Location, theOther.Location);
            double gforce           = Gravitation.Force(this, theOther);

            attractionVector.x *= gforce / Mass;
            attractionVector.y *= gforce / Mass;
            //System.Diagnostics.Debug.WriteLine(attractionVector.stringify());
            //Debug.WriteLine("force: {0}", gforce);
            MovementVector.addVector(attractionVector);
        }
        private void UpdateMovementVectors(Dictionary <JointType, bool> jointDirChange, Dictionary <JointType, float> distanceScale)
        {
            foreach (var change in jointDirChange)
            {
                if (_workingMode == 1)
                {
                    if (change.Value == true) // if a dir is changed
                    {
                        var joint = change.Key;
                        //int currentNumberOfVectors = jointMovementVectors[joint].Count();
                        var lastCoordinates = jointMovementVectors[joint]._endPoint;

                        lastCoordinates = SmoothingLine(smoothingBuffer, lastCoordinates, joint);

                        var newVector = new MovementVector(new Point3D(lastCoordinates.X, lastCoordinates.Y, lastCoordinates.Z), lastPositions[0][joint]);

                        bool CheckIfNewVectorIsNeeded = checkNewVector(newVector, joint);
                        if (CheckIfNewVectorIsNeeded == true)
                        {
                            newVector._distance         = newVector._distance * distanceScale[joint];
                            jointMovementVectors[joint] = newVector;
                        }
                        else
                        {
                            var lastPoint = jointMovementVectors[joint];
                            //Batev: var lastPoint = new Point3D();

                            jointMovementVectors[joint]._endPoint = lastPositions[0][joint];
                            var angle = Math3DHelper.AngleBetweenTwoPointsInDegrees(lastPositions[0][joint], lastPoint._startPoint);
                            //Batev: var angle = Math3DHelper.AngleBetweenTwoPointsInDegrees(lastPoint, lastPositions[0][joint]);

                            if (angle < 0)
                            {
                                angle = 360 + angle;
                            }
                            jointMovementVectors[joint]._angle    = angle;
                            jointMovementVectors[joint]._distance = Math3DHelper.DistanceBetwenTwoPoints(lastPoint._startPoint, lastPositions[0][joint]);
                            //Batev: jointMovementVectors[joint]._distance = Math3DHelper.DistanceBetwenTwoPoints(lastPoint, lastPositions[0][joint]);
                        }
                    }
                }
                // for working mode 2 - we replace the vector every time. We have to skip several frames in order to have better angle calculation
                else if (_workingMode == 2)
                {
                    if (_calculatedFramesSinceStart % _skippedFramesForMode2 == 0)
                    {
                        var joint           = change.Key;
                        var lastCoordinates = jointMovementVectors[joint]._endPoint;
                        var newVector       = new MovementVector(new Point3D(lastCoordinates.X, lastCoordinates.Y, lastCoordinates.Z), lastPositions[0][joint]);
                        jointMovementVectors[joint] = newVector;
                    }
                }
            }
        }
        private bool checkNewVector(MovementVector newVector, JointType joint)
        {
            bool isNeeded = true;

            if (newVector._distance < MOVEMENT_VECTOR_MIN_DISTANCE_IN_PIX)
            {
                isNeeded = false;
            }
            else
            {
                //int currentNumberOfVectors = jointMovementVectors[joint].Count();
                if (Math.Abs(jointMovementVectors[joint]._angle - newVector._angle) < angleDiff)
                {
                    isNeeded = false;
                }
            }

            return(isNeeded);
        }
Пример #12
0
        public EnterVisionAgain(INavigationGrid navGrid, IChampion c)
            : base(PacketCmd.PKT_S2C_OBJECT_SPAWN, c.NetId)
        {
            Write((short)0); // extraInfo
            Write((byte)0);  //c.getInventory().getItems().size(); // itemCount?
            //buffer.Write((short)7; // unknown

            /*
             * for (int i = 0; i < c.getInventory().getItems().size(); i++) {
             * ItemInstance* item = c.getInventory().getItems()[i];
             *
             * if (item != 0 && item.getTemplate() != 0) {
             *    buffer.Write((short)item.getStacks();
             *    buffer.Write((short)0; // unk
             *    buffer.Write((int)item.getTemplate().getId();
             *    buffer.Write((short)item.getSlot();
             * }
             * else {
             *    buffer.fill(0, 7);
             * }
             * }
             */

            Fill(0, 10);
            Write(1.0f);
            Fill(0, 13);

            Write((byte)2);               // Type of data: Waypoints=2
            Write(Environment.TickCount); // unk

            var waypoints = c.Waypoints;

            Write((byte)((waypoints.Count - c.CurWaypoint + 1) * 2)); // coordCount
            WriteNetId(c);
            Write((byte)0);                                           // movement mask; 1=KeepMoving?
            Write(MovementVector.TargetXToNormalFormat(navGrid, c.X));
            Write(MovementVector.TargetYToNormalFormat(navGrid, c.Y));
            for (var i = c.CurWaypoint; i < waypoints.Count; ++i)
            {
                Write(MovementVector.TargetXToNormalFormat(navGrid, waypoints[i].X));
                Write(MovementVector.TargetXToNormalFormat(navGrid, waypoints[i].Y));
            }
        }
Пример #13
0
        public EnterVisionAgain(Champion c) : base(PacketCmd.PKT_S2C_ObjectSpawn, c.NetId)
        {
            buffer.Write((short)0); // extraInfo
            buffer.Write((byte)0);  //c.getInventory().getItems().size(); // itemCount?
            //buffer.Write((short)7; // unknown

            /*
             * for (int i = 0; i < c.getInventory().getItems().size(); i++) {
             * ItemInstance* item = c.getInventory().getItems()[i];
             *
             * if (item != 0 && item.getTemplate() != 0) {
             *    buffer.Write((short)item.getStacks();
             *    buffer.Write((short)0; // unk
             *    buffer.Write((int)item.getTemplate().getId();
             *    buffer.Write((short)item.getSlot();
             * }
             * else {
             *    buffer.fill(0, 7);
             * }
             * }
             */

            buffer.fill(0, 10);
            buffer.Write((float)1.0f);
            buffer.fill(0, 13);

            buffer.Write((byte)2);                    // Type of data: Waypoints=2
            buffer.Write((int)Environment.TickCount); // unk

            List <Vector2> waypoints = c.Waypoints;

            buffer.Write((byte)((waypoints.Count - c.CurWaypoint + 1) * 2)); // coordCount
            buffer.Write(c.NetId);
            buffer.Write((byte)0);                                           // movement mask; 1=KeepMoving?
            buffer.Write(MovementVector.TargetXToNormalFormat(c.X));
            buffer.Write(MovementVector.TargetYToNormalFormat(c.Y));
            for (int i = c.CurWaypoint; i < waypoints.Count; ++i)
            {
                buffer.Write(MovementVector.TargetXToNormalFormat(waypoints[i].X));
                buffer.Write(MovementVector.TargetXToNormalFormat(waypoints[i].Y));
            }
        }
Пример #14
0
        /// <summary> TODO: Probably not the best place to have this, but still better than packet notifier </summary>
        public void TeleportTo(float x, float y)
        {
            if (!_game.Map.NavGrid.IsWalkable(x, y))
            {
                var walkableSpot = _game.Map.NavGrid.GetClosestTerrainExit(new Vector2(x, y));
                SetPosition(walkableSpot);

                x = MovementVector.TargetXToNormalFormat(_game.Map.NavGrid, walkableSpot.X);
                y = MovementVector.TargetYToNormalFormat(_game.Map.NavGrid, walkableSpot.Y);
            }
            else
            {
                SetPosition(x, y);

                x = MovementVector.TargetXToNormalFormat(_game.Map.NavGrid, x);
                y = MovementVector.TargetYToNormalFormat(_game.Map.NavGrid, y);
            }

            _game.PacketNotifier.NotifyTeleport(this, x, y);
        }
Пример #15
0
        public virtual Solution1 Calc(MovementVector vector)
        {
            int countNonEmpty = 0;

            this._skier.Reset();
            this.DumpStart();
            while (this._skier.CanMove(vector))
            {
                this._skier.Move(vector);
                Logger.Debug("Current Skier Position is now: {0} -- TerrainItem is: {1}", this._skier.CurrentPos.ToString(), this._skier.CurrentTerrainItem);
                //Logger.Debug("Current Map:{0}{1}", Environment.NewLine, this._skier.Slope.ToString());
                if (this._skier.CurrentTerrainItem.Equals(TerrainItem.VisitedNonEmpty))
                {
                    countNonEmpty++;
                }
            }
            this.CountTrees = countNonEmpty;
            this.Answer     = countNonEmpty;
            return(this);
        }
        /*Constructor*/
        public WorkoutTracking(List <JointType> pointsOfInterest, int workingMode = 1)
        {
            _workingMode = workingMode;
            //_angleThreshold = angleThresh;
            //_distanceThreshold = distanceThresh;
            jointsOfInterest = new List <JointType>(pointsOfInterest);

            lastPositions        = new Dictionary <JointType, Point3D> [numberOfFramesForDirCalculation];
            jointDirs            = new Dictionary <JointType, int>();
            jointMovementVectors = new Dictionary <JointType, MovementVector>();

            CoordinatesListHead      = new List <Point3D>();                 //Smoothing
            CoordinatesListSpineMid  = new List <Point3D>();                 //Smoothing
            CoordinatesListKneeLeft  = new List <Point3D>();                 //Smoothing
            CoordinatesListKneeRight = new List <Point3D>();                 //Smoothing
            CoordinatesListHandLeft  = new List <Point3D>();                 //Smoothing
            CoordinatesListHandRight = new List <Point3D>();                 //Smoothing

            smoothingBuffer = new Dictionary <JointType, List <Point3D> >(); //Smoothing

            foreach (var joint in jointsOfInterest)
            {
                jointDirs.Add(joint, 0);

                var movementVectors = new MovementVector();

                jointMovementVectors.Add(joint, movementVectors);
            }

            for (int i = 0; i < numberOfFramesForDirCalculation; i++)
            {
                var jointDict = new Dictionary <JointType, Point3D>();
                foreach (var joint in jointsOfInterest)
                {
                    jointDict.Add(joint, new Point3D());
                }

                lastPositions[i] = jointDict;
            }
        }
Пример #17
0
        public EnterVisionAgain(Minion m)
            : base(PacketCmd.PKT_S2C_ObjectSpawn, m.NetId)
        {
            buffer.fill(0, 13);
            buffer.Write(1.0f);
            buffer.fill(0, 13);
            buffer.Write((byte)0x02);
            buffer.Write((int)Environment.TickCount); // unk

            var waypoints = m.Waypoints;

            buffer.Write((byte)((waypoints.Count - m.CurWaypoint + 1) * 2)); // coordCount
            buffer.Write((int)m.NetId);
            // TODO: Check if Movement.EncodeWaypoints is what we need to use here
            buffer.Write((byte)0); // movement mask
            buffer.Write((short)MovementVector.TargetXToNormalFormat(m.X));
            buffer.Write((short)MovementVector.TargetYToNormalFormat(m.Y));
            for (int i = m.CurWaypoint; i < waypoints.Count; i++)
            {
                buffer.Write(MovementVector.TargetXToNormalFormat((float)waypoints[i].X));
                buffer.Write(MovementVector.TargetXToNormalFormat((float)waypoints[i].Y));
            }
        }
Пример #18
0
        public void notifyTeleport(Unit u, float _x, float _y)
        {
            // Can't teleport to this point of the map
            if (!_game.Map.IsWalkable(_x, _y))
            {
                _x = MovementVector.targetXToNormalFormat(u.X);
                _y = MovementVector.targetYToNormalFormat(u.Y);
            }
            else
            {
                u.setPosition(_x, _y);

                //TeleportRequest first(u.NetId, u.teleportToX, u.teleportToY, true);
                //sendPacket(currentPeer, first, Channel.CHL_S2C);

                _x = MovementVector.targetXToNormalFormat(_x);
                _y = MovementVector.targetYToNormalFormat(_y);
            }

            var second = new TeleportRequest(u.NetId, _x, _y, false);

            _game.PacketHandlerManager.broadcastPacketVision(u, second, Channel.CHL_S2C);
        }
Пример #19
0
        public EnterVisionAgain(INavigationGrid navGrid, IMinion m)
            : base(PacketCmd.PKT_S2C_OBJECT_SPAWN, m.NetId)
        {
            Fill(0, 13);
            Write(1.0f);
            Fill(0, 13);
            Write((byte)0x02);
            Write(Environment.TickCount); // unk

            var waypoints = m.Waypoints;

            Write((byte)((waypoints.Count - m.CurWaypoint + 1) * 2)); // coordCount
            WriteNetId(m);
            // TODO: Check if Movement.EncodeWaypoints is what we need to use here
            Write((byte)0); // movement mask
            Write(MovementVector.TargetXToNormalFormat(navGrid, m.X));
            Write(MovementVector.TargetYToNormalFormat(navGrid, m.Y));
            for (var i = m.CurWaypoint; i < waypoints.Count; i++)
            {
                Write(MovementVector.TargetXToNormalFormat(navGrid, waypoints[i].X));
                Write(MovementVector.TargetXToNormalFormat(navGrid, waypoints[i].Y));
            }
        }
Пример #20
0
 /// <summary>
 ///  Creates a new movement action for an organism.
 /// </summary>
 /// <param name="organismID">The ID of the organism the action will work on.</param>
 /// <param name="actionID">The incremental ID representing this action.</param>
 /// <param name="moveTo">The movement vector that defines this action.</param>
 internal MoveToAction(string organismID, int actionID, MovementVector moveTo)
     : base(organismID, actionID)
 {
     MovementVector = moveTo;
 }
Пример #21
0
        public MinionSpawn(INavGrid navGrid, IMinion m)
            : base(PacketCmd.PKT_S2C_OBJECT_SPAWN, m.NetId)
        {
            Write((uint)0x00150017); // unk
            Write((byte)0x03);       // SpawnType - 3 = minion
            WriteNetId(m);
            WriteNetId(m);
            Write((uint)m.SpawnPosition);
            Write((byte)0xFF); // unk
            Write((byte)1);    // wave number ?

            Write((byte)m.MinionSpawnType);

            if (m.MinionSpawnType == MinionSpawnType.MINION_TYPE_MELEE)
            {
                Write((byte)0); // unk
            }
            else
            {
                Write((byte)1); // unk
            }

            Write((byte)0); // unk

            if (m.MinionSpawnType == MinionSpawnType.MINION_TYPE_CASTER)
            {
                Write(0x00010007); // unk
            }
            else if (m.MinionSpawnType == MinionSpawnType.MINION_TYPE_MELEE)
            {
                Write(0x0001000A); // unk
            }
            else if (m.MinionSpawnType == MinionSpawnType.MINION_TYPE_CANNON)
            {
                Write(0x0001000D);
            }
            else
            {
                Write(0x00010007);        // unk
            }
            Write(0x00000000);            // unk
            Write(0x00000000);            // unk
            Write((short)0x0000);         // unk
            Write(1.0f);                  // unk
            Write(0x00000000);            // unk
            Write(0x00000000);            // unk
            Write(0x00000000);            // unk
            Write((short)0x0200);         // unk
            Write(Environment.TickCount); // unk

            var waypoints = m.Waypoints;

            Write((byte)((waypoints.Count - m.CurWaypoint + 1) * 2)); // coordCount
            WriteNetId(m);
            Write((byte)0);                                           // movement mask
            Write(MovementVector.TargetXToNormalFormat(navGrid, m.X));
            Write(MovementVector.TargetYToNormalFormat(navGrid, m.Y));
            for (var i = m.CurWaypoint; i < waypoints.Count; ++i)
            {
                Write(MovementVector.TargetXToNormalFormat(navGrid, waypoints[i].X));
                Write(MovementVector.TargetXToNormalFormat(navGrid, waypoints[i].Y));
            }
        }
Пример #22
0
        public MinionSpawn(Minion m)
            : base(PacketCmd.PKT_S2C_ObjectSpawn, m.NetId)
        {
            buffer.Write((uint)0x00150017); // unk
            buffer.Write((byte)0x03);       // SpawnType - 3 = minion
            buffer.Write((uint)m.NetId);
            buffer.Write((uint)m.NetId);
            buffer.Write((uint)m.SpawnPosition);
            buffer.Write((byte)0xFF); // unk
            buffer.Write((byte)1);    // wave number ?

            buffer.Write((byte)m.getType());

            if (m.getType() == MinionSpawnType.MINION_TYPE_MELEE)
            {
                buffer.Write((byte)0); // unk
            }
            else
            {
                buffer.Write((byte)1); // unk
            }

            buffer.Write((byte)0); // unk

            if (m.getType() == MinionSpawnType.MINION_TYPE_CASTER)
            {
                buffer.Write((int)0x00010007); // unk
            }
            else if (m.getType() == MinionSpawnType.MINION_TYPE_MELEE)
            {
                buffer.Write((int)0x0001000A); // unk
            }
            else if (m.getType() == MinionSpawnType.MINION_TYPE_CANNON)
            {
                buffer.Write((int)0x0001000D);
            }
            else
            {
                buffer.Write((int)0x00010007);        // unk
            }
            buffer.Write((int)0x00000000);            // unk
            buffer.Write((int)0x00000000);            // unk
            buffer.Write((short)0x0000);              // unk
            buffer.Write((float)1.0f);                // unk
            buffer.Write((int)0x00000000);            // unk
            buffer.Write((int)0x00000000);            // unk
            buffer.Write((int)0x00000000);            // unk
            buffer.Write((short)0x0200);              // unk
            buffer.Write((int)Environment.TickCount); // unk

            List <Vector2> waypoints = m.Waypoints;

            buffer.Write((byte)((waypoints.Count - m.CurWaypoint + 1) * 2)); // coordCount
            buffer.Write((int)m.NetId);
            buffer.Write((byte)0);                                           // movement mask
            buffer.Write((short)MovementVector.TargetXToNormalFormat(m.X));
            buffer.Write((short)MovementVector.TargetYToNormalFormat(m.Y));
            for (int i = m.CurWaypoint; i < waypoints.Count; ++i)
            {
                buffer.Write((short)MovementVector.TargetXToNormalFormat(waypoints[i].X));
                buffer.Write((short)MovementVector.TargetXToNormalFormat(waypoints[i].Y));
            }
        }
Пример #23
0
 /// <summary>
 ///  Creates a new teleportzone with all fields initialized.
 /// </summary>
 /// <param name="rectangle">The location and size of the zone.</param>
 /// <param name="vector">The movement vector of the zone.</param>
 /// <param name="ID">The ID for this zone.</param>
 public TeleportZone(Rectangle rectangle, MovementVector vector, int ID)
 {
     _rectangle  = rectangle;
     _vector     = vector;
     _teleportID = ID;
 }