Exemplo n.º 1
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());
            }
        }