Beispiel #1
0
        public void RxMsgFromClient(DPClientController controller, byte[] msg)
        {
            if (msg[0] == 0x05 && msg.Length == 2)
            {
                // Char info request
                controller.DisconnectFromSlaveServer();
                controller.SetState(DPCSelectingCharacterState.Instance());
                return;
            }

            DPlay.NetworkPacket npkt = new DPlay.NetworkPacket();
            npkt.Write(msg);
            controller.SendMessageToSlaveServer(npkt);
        }
Beispiel #2
0
 public void RxMsgFromClient(DPClientController controller, byte[] msg)
 {
     if (msg[0] == 0x01 && msg.Length == 1)
     {
         if (controller.pendingMsgs.Count > 0)
         {
             controller.SendMessageToClient(controller.pendingMsgs.Dequeue());
         }
         else
         {
             // Keepalive
             DPlay.NetworkPacket keepalive = new DPlay.NetworkPacket();
             keepalive.Write(new byte[] { 0xFF });
             controller.SendMessageToClient(keepalive);
         }
     }
 }
Beispiel #3
0
 protected void sendMessage()
 {
     try
     {
         if (dpc != null)
         {
             if (connected)
             {
                 DPlay.NetworkPacket stm = new DPlay.NetworkPacket();
                 Quaternion          qr  = Quaternion.Normalize(myAirplane.rotation);
                 stm.Write(MessageType.SendMessage);
                 stm.Write(myAirplane.m_vPosition.X);
                 stm.Write(myAirplane.m_vPosition.Y);
                 stm.Write(myAirplane.m_vPosition.Z);
                 stm.Write(qr.X);
                 stm.Write(qr.Y);
                 stm.Write(qr.Z);
                 stm.Write(qr.W);
                 dpc.Send(stm, 0, DPlay.SendFlags.NoLoopback | DPlay.SendFlags.NonSequential | DPlay.SendFlags.Coalesce | DPlay.SendFlags.NoComplete);
             }
         }
         else
         {
             if (playerId != 0)
             {
                 DPlay.NetworkPacket stm = new DPlay.NetworkPacket();
                 Quaternion          qr  = Quaternion.Normalize(myAirplane.rotation);
                 stm.Write(MessageType.SendMessage);
                 stm.Write(myAirplane.m_vPosition.X);
                 stm.Write(myAirplane.m_vPosition.Y);
                 stm.Write(myAirplane.m_vPosition.Z);
                 stm.Write(qr.X);
                 stm.Write(qr.Y);
                 stm.Write(qr.Z);
                 stm.Write(qr.W);
                 dps.SendTo(playerId, stm, 0, DPlay.SendFlags.NoLoopback | DPlay.SendFlags.NonSequential | DPlay.SendFlags.Coalesce | DPlay.SendFlags.NoComplete);
             }
         }
     }
     catch (DPlay.ConnectionLostException con)
     {
     }
 }
Beispiel #4
0
        public void RxMsgFromSlaveServer(DPClientController controller, byte[] msg)
        {
            if (msg[0] == 0x01)
            {
                int  pos     = 2;
                uint iclient = FLMsgType.GetUInt32(msg, ref pos);

                byte[] omsg = new byte[] { 0x01, 0x02 };
                FLMsgType.AddUInt32(ref omsg, iclient);
                DPlay.NetworkPacket connectack = new DPlay.NetworkPacket();
                connectack.Write(omsg); // change to real client ID
                controller.SendMessageToClient(connectack);
            }
            else if (msg[0] == 0x54)
            {
                byte[] omsg = new byte[] { 0x01, 0x03, 0x01 };
                FLMsgType.AddUnicodeString(ref omsg, controller.accountid);
                DPlay.NetworkPacket login = new DPlay.NetworkPacket();
                login.Write(omsg);
                controller.SendMessageToSlaveServer(login);
            }
            else if (msg[0] == 0x02 && msg[1] == 0x02 && msg[2] == 0x03)
            {
                DPlay.NetworkPacket characterinforequest = new DPlay.NetworkPacket();
                characterinforequest.Write(new byte[] { 0x05, 0x03 });
                controller.SendMessageToSlaveServer(characterinforequest);
            }
            else if (msg[0] == 0x03 && msg[1] == 0x02)
            {
                byte[] omsg = new byte[] { 0x06, 0x03 };
                FLMsgType.AddAsciiString(ref omsg, controller.charfile);

                DPlay.NetworkPacket characterselect = new DPlay.NetworkPacket();
                characterselect.Write(omsg);
                controller.SendMessageToSlaveServer(characterselect);
                controller.SetState(DPCConnectedToSlaveServerState.Instance());
            }
        }
Beispiel #5
0
 public void RxMsgFromSlaveServer(DPClientController controller, byte[] msg)
 {
     DPlay.NetworkPacket npkt = new DPlay.NetworkPacket();
     npkt.Write(msg);
     controller.SendMessageToClient(npkt);
 }
 public void SetReplyData(NetworkPacket data)
 {
     throw new NotImplementedException();
 }
Beispiel #7
0
 public void FindHosts(ApplicationDescription applicationDescription, Address hostAddress, Address deviceInformation, NetworkPacket userEnumData, int count, int retryInterval, int timeOut, FindHostsFlags flags, out int asyncHandle)
 {
     throw new NotImplementedException();
 }
Beispiel #8
0
 public void TerminateSession(NetworkPacket terminateData)
 {
     throw new NotImplementedException();
 }
Beispiel #9
0
 public void DestroyPeer(int playerID, NetworkPacket destroyData)
 {
     throw new NotImplementedException();
 }
Beispiel #10
0
 public void SendTo(int playerID, NetworkPacket sendData, int timeOut, out int asyncHandle, SendFlags flags)
 {
     throw new NotImplementedException();
 }
Beispiel #11
0
 public void SendTo(int playerID, NetworkPacket sendData, int timeOut, SendFlags flags, object context)
 {
     throw new NotImplementedException();
 }
Beispiel #12
0
 public void Connect(ApplicationDescription applicationDescription, Address hostAddress, Address deviceInformation, NetworkPacket userConnectData, out int asyncHandle, Microsoft.DirectX.DirectPlay.ConnectFlags flags)
 {
     throw new NotImplementedException();
 }
Beispiel #13
0
 public void Connect(ApplicationDescription applicationDescription, Address hostAddress, Address deviceInformation, NetworkPacket userConnectData, Microsoft.DirectX.DirectPlay.ConnectFlags flags, object playerContext, object userContext)
 {
     throw new NotImplementedException();
 }