Пример #1
0
        public void processHyperJumpCancel(ref byte[] rpcData)
        {
            double       xDest  = 0;
            double       yDest  = 0;
            double       zDest  = 0;
            PacketReader reader = new PacketReader(rpcData);

            xDest = reader.readDouble(1);
            yDest = reader.readDouble(1);
            zDest = reader.readDouble(1);

            // ToDo: figure out what this 6 bytes are could be
            // Skip 6 bytes as we currently didnt knew
            reader.incrementOffsetByValue(6);
            UInt32 maybeMaxHeight = reader.readUInt32(1);

            reader.setOffsetOverrideValue(rpcData.Length - 4);
            UInt32 clientJumpIdUnknown = reader.readUInt32(1);

            // Players current X Z Y
            double x = 0; double y = 0; double z = 0;

            byte[] Ltvector3d = Store.currentClient.playerInstance.Position.getValue();
            NumericalUtils.LtVector3dToDoubles(Ltvector3d, ref x, ref y, ref z);
            int   rotation = (int)Store.currentClient.playerInstance.YawInterval.getValue()[0];
            float xPos     = (float)x;
            float yPos     = (float)y;
            float zPos     = (float)z;

            float  distance = Maths.getDistance(xPos, yPos, zPos, (float)xDest, (float)yDest, (float)zDest);
            UInt16 duration = (UInt16)(distance * 0.5);

            UInt32 startTime = TimeUtils.getUnixTimeUint32();
            UInt32 endTime   = startTime + duration;

            ServerPackets packets = new ServerPackets();

            packets.sendHyperJumpID(clientJumpIdUnknown);
            packets.SendHyperJumpUpdate(xPos, yPos, zPos, (float)xDest, (float)yDest, (float)zDest, startTime, endTime);
        }