AppendDword() 공개 메소드

public AppendDword ( uint item ) : void
item uint
리턴 void
예제 #1
0
        private static void SendLauncherInfo(int ClientIndex)
        {
            PacketWriter writer = new PacketWriter();

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_PATCH_INFO);
            writer.AppendDword(0x04000101);
            writer.AppendByte(0xA1);
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_LAUNCHER);
            writer.AppendByte(0x00);

            writer.AppendByte(DatabaseCore.News.NumberOfNews);
            for (int i = 0; i < DatabaseCore.News.NumberOfNews; i++)
            {
                writer.AppendWord((ushort)DatabaseCore.News.Head[i].Length);
                writer.AppendString(false, DatabaseCore.News.Head[i]);

                writer.AppendWord((ushort)DatabaseCore.News.Text[i].Length);
                writer.AppendString(false, DatabaseCore.News.Text[i]);

                writer.AppendWord(0x07D8);

                writer.AppendByte(DatabaseCore.News.Month[i]);
                writer.AppendByte(0x00);

                writer.AppendByte(DatabaseCore.News.Day[i]);
                writer.AppendByte(0x00);

                writer.AppendDword(0x0025000B);
                writer.AppendDword(0xAFC00012);
                writer.AppendWord(0x35D2);
            }
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);
        }
예제 #2
0
        private static void SendPatchInfo(int ClientIndex)
        {
            PacketWriter writer = new PacketWriter();

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_PATCH_INFO);
            writer.AppendDword(0x05000101);
            writer.AppendByte(0x20);
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_PATCH_INFO);
            writer.AppendDword(0x01000100);
            writer.AppendDword(0x00050628);
            writer.AppendWord(0x00);
            writer.AppendByte(0x02);
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_PATCH_INFO);
            writer.AppendDword(0x05000101);
            writer.AppendByte(0x60);
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_PATCH_INFO);
            writer.AppendDword(0x02000300);
            writer.AppendWord(0x0200);
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_PATCH_INFO);
            writer.AppendDword(0x00000101);
            writer.AppendByte(0xA1);
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_PATCH_INFO);
            writer.AppendWord(0x0100);
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);
        }
예제 #3
0
        private static void SendLauncherInfo(int ClientIndex)
        {
            PacketWriter writer = new PacketWriter();

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_PATCH_INFO);
            writer.AppendDword(0x04000101);
            writer.AppendByte(0xA1);
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_LAUNCHER);
            writer.AppendByte(0x00);

            writer.AppendByte(DatabaseCore.News.NumberOfNews);
            for (int i = 0; i < DatabaseCore.News.NumberOfNews; i++)
            {

                writer.AppendWord((ushort)DatabaseCore.News.Head[i].Length);
                writer.AppendString(false,DatabaseCore.News.Head[i]);

                writer.AppendWord((ushort)DatabaseCore.News.Text[i].Length);
                writer.AppendString(false, DatabaseCore.News.Text[i]);

                writer.AppendWord(0x07D8);

                writer.AppendByte(DatabaseCore.News.Month[i]);
                writer.AppendByte(0x00);

                writer.AppendByte(DatabaseCore.News.Day[i]);
                writer.AppendByte(0x00);

                writer.AppendDword(0x0025000B);
                writer.AppendDword(0xAFC00012);
                writer.AppendWord(0x35D2);

            }
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);
        }
예제 #4
0
        private static void SendLogin(byte[] buffer, int ClientIndex)
        {
            /*
             * 16 00 L
             * 02 61 Opcode
             * 00 00 Secu
             *
             * 12 Leng_total
             * 07 00 Leng_String
             * 63 61 72 6C 6F 73 78 = carlosx
             * 07 00 Leng_String
             * 63 61 72 6C 6F 73 78 = carlosx
             *
             * FF unk
             * 03 ServerID
             */
            PacketWriter writer = new PacketWriter();
            PacketReader reader = new PacketReader(buffer, buffer.Length);

            reader.ModifyIndex(7);

            ushort userlen = reader.ReadWord();
            string user    = reader.ReadString(false, userlen);

            ushort passlen = reader.ReadWord();
            string pass    = reader.ReadString(false, passlen);

            reader.ReadByte();
            ushort serverid = reader.ReadByte();

            Console.WriteLine("User:{0} - Password:{1} - ServerId:{2}", user, pass, serverid);

            int UserIndex = DatabaseCore.User.GetIndexByName(user);

            if (DatabaseCore.User.Banned[UserIndex])
            {
                ServerSocket.DisconnectSocket(ClientIndex);
                return;
            }
            else if (DatabaseCore.User.Online[UserIndex])
            {
                writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_AUTH_INFO);
                writer.AppendWord(0x302);
                ServerSocket.Send(writer.getWorkspace(), ClientIndex);
                ServerSocket.DisconnectSocket(ClientIndex);
            }
            else if (DatabaseCore.User.User[UserIndex] != user || DatabaseCore.User.Password[UserIndex] != pass)
            {
                writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_AUTH_INFO);

                DatabaseCore.User.FailedLogins[UserIndex]++;
                DatabaseCore.WriteQuery("UPDATE user SET failed_logins = '{0}' WHERE id = '{1}'", DatabaseCore.User.FailedLogins[UserIndex], DatabaseCore.User.User[UserIndex]);

                writer.AppendWord(0x0102);
                writer.AppendByte(DatabaseCore.User.FailedLogins[UserIndex]);
                writer.AppendDword(0x03000000);
                writer.AppendWord(0x00);
                writer.AppendByte(0x00);

                ServerSocket.Send(writer.getWorkspace(), ClientIndex);

                if (DatabaseCore.User.FailedLogins[UserIndex] == 3)
                {
                    DatabaseCore.User.FailedLogins[UserIndex] = 0;
                    DatabaseCore.WriteQuery("UPDATE user SET failed_logins = '{0}' WHERE id = '{1}'", DatabaseCore.User.FailedLogins[UserIndex], DatabaseCore.User.User[UserIndex]);

                    ServerSocket.DisconnectSocket(ClientIndex);
                }
            }
            else
            {
                int ServerIndex = DatabaseCore.Server.GetIndexById(serverid);

                if (DatabaseCore.Server.MaxUser[ServerIndex] <= DatabaseCore.Server.CurUser[ServerIndex])
                {
                    writer.SetOpcode(0xA103);
                    writer.AppendWord(0x402);
                    ServerSocket.Send(writer.getWorkspace(), ClientIndex);
                    return;
                }
                else
                {
                    writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_AUTH_INFO);
                    writer.AppendByte(0x01);
                    writer.AppendDword(0x1234);

                    ushort leng_ip = (ushort)DatabaseCore.Server.ServerIp[ServerIndex].Length;
                    string str_ip  = DatabaseCore.Server.ServerIp[ServerIndex];
                    ushort port    = DatabaseCore.Server.ServerPort[ServerIndex];

                    writer.AppendWord(leng_ip);
                    writer.AppendString(false, str_ip);
                    writer.AppendWord(port);
                    ServerSocket.Send(writer.getWorkspace(), ClientIndex);
                    Console.WriteLine("Lengip:{0} - Ip:{1} - Port:{2}", leng_ip, str_ip, port);

                    //DatabaseCore.Server.CurUser[ServerIndex]++;
                    //DatabaseCore.WriteQuery("UPDATE server SET users_current = '{0}' WHERE name = '{1}'", DatabaseCore.Server.CurUser[ServerIndex], DatabaseCore.Server.ServerName[ServerIndex]);
                }
            }
        }
예제 #5
0
        private static void SendPatchInfo(int ClientIndex)
        {
            PacketWriter writer = new PacketWriter();

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_PATCH_INFO);
            writer.AppendDword(0x05000101);
            writer.AppendByte(0x20);
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_PATCH_INFO);
            writer.AppendDword(0x01000100);
            writer.AppendDword(0x00050628);
            writer.AppendWord(0x00);
            writer.AppendByte(0x02);
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_PATCH_INFO);
            writer.AppendDword(0x05000101);
            writer.AppendByte(0x60);
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_PATCH_INFO);
            writer.AppendDword(0x02000300);
            writer.AppendWord(0x0200);
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_PATCH_INFO);
            writer.AppendDword(0x00000101);
            writer.AppendByte(0xA1);
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);

            writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_PATCH_INFO);
            writer.AppendWord(0x0100);
            ServerSocket.Send(writer.getWorkspace(), ClientIndex);
        }
예제 #6
0
        private static void SendLogin(byte[] buffer, int ClientIndex)
        {
            /*
            16 00 L
            02 61 Opcode
            00 00 Secu

            12 Leng_total
            07 00 Leng_String
            63 61 72 6C 6F 73 78 = carlosx
            07 00 Leng_String
            63 61 72 6C 6F 73 78 = carlosx

            FF unk
            03 ServerID
            */
            PacketWriter writer = new PacketWriter();
            PacketReader reader = new PacketReader(buffer, buffer.Length);
            reader.ModifyIndex(7);

            ushort userlen = reader.ReadWord();
            string user = reader.ReadString(false, userlen);

            ushort passlen = reader.ReadWord();
            string pass = reader.ReadString(false, passlen);

            reader.ReadByte();
            ushort serverid = reader.ReadByte();

            Console.WriteLine("User:{0} - Password:{1} - ServerId:{2}",user,pass,serverid);

            int UserIndex = DatabaseCore.User.GetIndexByName(user);

            if (DatabaseCore.User.Banned[UserIndex])
            {
                ServerSocket.DisconnectSocket(ClientIndex);
                return;
            }
            else if (DatabaseCore.User.Online[UserIndex])
            {
                writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_AUTH_INFO);
                writer.AppendWord(0x302);
                ServerSocket.Send(writer.getWorkspace(), ClientIndex);
                ServerSocket.DisconnectSocket(ClientIndex);
            }
            else if (DatabaseCore.User.User[UserIndex] != user || DatabaseCore.User.Password[UserIndex] != pass)
            {
                writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_AUTH_INFO);

                DatabaseCore.User.FailedLogins[UserIndex]++;
                DatabaseCore.WriteQuery("UPDATE user SET failed_logins = '{0}' WHERE id = '{1}'", DatabaseCore.User.FailedLogins[UserIndex], DatabaseCore.User.User[UserIndex]);

                writer.AppendWord(0x0102);
                writer.AppendByte(DatabaseCore.User.FailedLogins[UserIndex]);
                writer.AppendDword(0x03000000);
                writer.AppendWord(0x00);
                writer.AppendByte(0x00);

                ServerSocket.Send(writer.getWorkspace(), ClientIndex);

                if (DatabaseCore.User.FailedLogins[UserIndex] == 3)
                {
                    DatabaseCore.User.FailedLogins[UserIndex] = 0;
                    DatabaseCore.WriteQuery("UPDATE user SET failed_logins = '{0}' WHERE id = '{1}'", DatabaseCore.User.FailedLogins[UserIndex], DatabaseCore.User.User[UserIndex]);

                    ServerSocket.DisconnectSocket(ClientIndex);
                }
            }
            else
            {
                int ServerIndex = DatabaseCore.Server.GetIndexById(serverid);

                if (DatabaseCore.Server.MaxUser[ServerIndex] <= DatabaseCore.Server.CurUser[ServerIndex])
                {
                    writer.SetOpcode(0xA103);
                    writer.AppendWord(0x402);
                    ServerSocket.Send(writer.getWorkspace(), ClientIndex);
                    return;
                }
                else
                {
                    writer.SetOpcode(SERVER_OPCODES.LOGIN_SERVER_AUTH_INFO);
                    writer.AppendByte(0x01);
                    writer.AppendDword(0x1234);

                    ushort leng_ip = (ushort)DatabaseCore.Server.ServerIp[ServerIndex].Length;
                    string str_ip = DatabaseCore.Server.ServerIp[ServerIndex];
                    ushort port = DatabaseCore.Server.ServerPort[ServerIndex];

                    writer.AppendWord(leng_ip);
                    writer.AppendString(false, str_ip);
                    writer.AppendWord(port);
                    ServerSocket.Send(writer.getWorkspace(), ClientIndex);
                    Console.WriteLine("Lengip:{0} - Ip:{1} - Port:{2}",leng_ip,str_ip,port);

                    //DatabaseCore.Server.CurUser[ServerIndex]++;
                    //DatabaseCore.WriteQuery("UPDATE server SET users_current = '{0}' WHERE name = '{1}'", DatabaseCore.Server.CurUser[ServerIndex], DatabaseCore.Server.ServerName[ServerIndex]);
                }
            }
        }