Пример #1
0
        public void processHyperJump(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
            byte[] unknownJumpBytes = reader.readBytes(6);
            float  maybeMaxHeight   = reader.readFloat(1);

            reader.incrementOffsetByValue(1);
            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;

            LtVector3f[] JumpMovements = Maths.ParabolicMovement(new LtVector3f(xPos, yPos, zPos), new LtVector3f((float)xDest, (float)yDest, (float)zDest), 50, 12);

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

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

            ServerPackets packets = new ServerPackets();

            packets.sendHyperJumpID(clientJumpIdUnknown);
            foreach (LtVector3f currentJumpPos in JumpMovements)
            {
                packets.SendHyperJumpStepUpdate(currentJumpPos, xDest, yDest, zDest, maybeMaxHeight, endTime);
            }

            //packets.SendHyperJumpUpdate(xPos,yPos,zPos,(float)xDest,(float)yDest,(float)zDest,startTime,endTime);
            #if DEBUG
            Output.WriteRpcLog("Finished the HyperJumps");
            #endif
        }
Пример #2
0
        private void ProcessJumpStep(Object e)
        {
            JumpStep Step = Steps[0];

            Steps.RemoveAt(0);
            ServerPackets packets = new ServerPackets();

            bool isLastStep = Steps.Count == 0;

            packets.SendHyperJumpStepUpdate(Step.FromPos, Step.ToPos.x, Step.ToPos.y, Step.ToPos.z, Step.JumpHeight,
                                            Step.endTime, Step.jumpId, Step.maybeTimeBasedValue, isLastStep);

            if (Steps.Count > 0)
            {
                hyperjumpTimer = new Timer(ProcessJumpStep, this, 50, 0);
            }
            else
            {
                Store.currentClient.playerData.isJumping = false;
                // ToDo: Check if we need to send some Message for the Clientview
            }
        }