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); }
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); } } }
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) { } }
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()); } }
public void RxMsgFromSlaveServer(DPClientController controller, byte[] msg) { DPlay.NetworkPacket npkt = new DPlay.NetworkPacket(); npkt.Write(msg); controller.SendMessageToClient(npkt); }