Esempio n. 1
0
        private static void Call()
        {
            SMPInterface.Reader.ReadByte();

            string Reason = SMPInterface.Reader.ReadString();

            SMPInterface.Debug("Kicked: " + Reason + "\n");

            SMPInterface.Kicked = true;
            System.Windows.Forms.MessageBox.Show("Kicked: " + Reason);
        }
Esempio n. 2
0
        private static void Call()
        {
            double exx = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadDouble());
            double exy = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadDouble());
            double exz = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadDouble());

            SMPInterface.Reader.ReadSingle();
            int blocksaffected = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32());

            SMPInterface.Reader.ReadBytes(blocksaffected * 3);
            SMPInterface.Debug(string.Format("ASPLODIE AT: {0}, {1}, {2}\n", exx, exy, exz));
        }
Esempio n. 3
0
        private static void Call()
        {
            SMPInterface.Debug("Logged in\n");
            int id = SMPInterface.Reader.ReadInt32();

            SMPInterface.Reader.ReadByte();
            string u1 = SMPInterface.Reader.ReadString();

            SMPInterface.Reader.ReadByte();
            string u2      = SMPInterface.Reader.ReadString();
            long   mapseed = SMPInterface.Reader.ReadInt64();
            byte   dim     = SMPInterface.Reader.ReadByte();
        }
Esempio n. 4
0
        private static void Call()
        {
            short h = SMPInterface.SwapByteOrder((short)SMPInterface.Reader.ReadInt16());

            if (h == 0)
            {
                SMPInterface.Debug("You are now dead");
            }
            else
            {
                SMPInterface.Debug("Health is now " + h.ToString());
            }
        }
Esempio n. 5
0
 private static void Call()
 {
     SMPInterface.PlayerX = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32());
     SMPInterface.PlayerY = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32());
     SMPInterface.PlayerZ = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32());
     SMPInterface.Debug(string.Format("Player Spawn Pos recived @ ({0}, {1}, {2})\n", SMPInterface.PlayerX, SMPInterface.PlayerY, SMPInterface.PlayerZ));
     if (UpdateSpawnPos != null)
     {
         UpdateSpawnPos.Invoke(new Cubia.Vector <int>((int)SMPInterface.PlayerX,
                                                      (int)SMPInterface.PlayerY,
                                                      (int)SMPInterface.PlayerZ));
     }
 }
Esempio n. 6
0
        private static void Call()
        {
            int pid = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt32());

            SMPInterface.Reader.ReadByte();
            string name = SMPInterface.Reader.ReadString();

            SMPInterface.Reader.ReadInt32(); //x
            SMPInterface.Reader.ReadInt32();
            SMPInterface.Reader.ReadInt32(); // z
            SMPInterface.Reader.ReadByte();  // rotation
            SMPInterface.Reader.ReadByte();
            SMPInterface.Reader.ReadInt16(); // current item
            SMPInterface.Debug("Player: " + name + "\n");
        }
Esempio n. 7
0
        public static void CopyStream(System.IO.Stream input, System.IO.Stream output)
        {
            byte[] buffer = new byte[2000];
            int    len;

            while ((len = input.Read(buffer, 0, 2000)) > 0)
            {
                try
                {
                    output.Write(buffer, 0, len);
                }
                catch { SMPInterface.Debug("Error deflating\n"); }
            }
            output.Flush();
        }
Esempio n. 8
0
        private static void Call()
        {
            byte  type        = SMPInterface.Reader.ReadByte();
            short count       = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt16());
            int   totalBlocks = 0;

            for (int i = 0; i < count; i++)
            {
                int bid = SMPInterface.SwapByteOrder(SMPInterface.Reader.ReadInt16());
                if (bid != -1)
                {
                    byte amm = SMPInterface.Reader.ReadByte();
                    totalBlocks += amm;
                    SMPInterface.Reader.ReadInt16(); // uses
                }
            }
            //SMPInterface.Reader.ReadBytes(2);
            SMPInterface.Debug("Got Inv, " + totalBlocks.ToString() + " blocks in total\n");
        }
Esempio n. 9
0
        private static void Call()
        {
            SMPInterface.Reader.ReadByte();
            SMPInterface.Debug("Got handshake\n");

            string ConnectionHash = SMPInterface.Reader.ReadString();

            SMPInterface.Debug("Got connection hash, length: " + ConnectionHash.Length.ToString() + "\n");
            if (ConnectionHash != "-")
            {
                if (!SMPInterface.AuthConnect(SMPInterface.CaseUsername, ConnectionHash))
                {
                    SMPInterface.Disconnect();
                    SMPInterface.Debug("Failed to auth connect.\n");
                    return;
                }
            }
            else
            {
                SMPInterface.Debug("Server is not authing\n");
            }
            SMPInterface.Debug("Sending Login Request\n");

            SMPInterface.Handler.SetOperationCode(SMPInterface.PacketTypes.LoginReq);
            SMPInterface.Handler.Write((int)ProtoclVersion);
            SMPInterface.Handler.Write(SMPInterface.Username);

            if (SMPInterface.SrvPassword.Length > 0)
            {
                SMPInterface.Handler.Write(SMPInterface.SrvPassword);
            }
            else
            {
                SMPInterface.Handler.Write("Password");
            }

            SMPInterface.Handler._Write(new byte[9]); // stuff we don't need
            SMPInterface.Handler.Flush();
        }