void window_ServerSelected(CharServerInfo obj)
        {
            ROClient.Singleton.NetworkState.SelectedCharServer = obj;

            if (ROClient.Singleton.CurrentConnection != null && ROClient.Singleton.CurrentConnection.Client.Connected)
            {
                ROClient.Singleton.CurrentConnection.Disconnect();
            }

            ROClient.Singleton.CurrentConnection = new Network.Connection();
            ROClient.Singleton.CurrentConnection.PacketSerializer.PacketHooks[0x6B] = new Action <ushort, int, HC_Accept_Enter>(packetLoginAccepted);
            ROClient.Singleton.CurrentConnection.PacketSerializer.PacketHooks[0x6C] = new Action <ushort, int, HC_Refuse_Enter>(packetLoginRejected);

            try
            {
                ROClient.Singleton.CurrentConnection.Connect(obj.IP.ToString(), obj.Port);
            }
            catch
            {
                CloseWait();
                MessageBox.ShowOk("Could not connect to server.", ReenterScreen);
            }

            ROClient.Singleton.CurrentConnection.PacketSerializer.BytesToSkip = 4; // Skip AID
            ROClient.Singleton.CurrentConnection.Start();

            new CH_Enter(
                ROClient.Singleton.NetworkState.LoginAccept.AccountID,
                ROClient.Singleton.NetworkState.LoginAccept.LoginID1,
                ROClient.Singleton.NetworkState.LoginAccept.LoginID2,
                ROClient.Singleton.NetworkState.LoginAccept.Sex).Write(ROClient.Singleton.CurrentConnection.BinaryWriter);
        }
Ejemplo n.º 2
0
        public void Read(MemoryStreamReader br, int size)
        {
            LoginID1  = br.ReadInt();
            AccountID = br.ReadInt();
            LoginID2  = br.ReadInt();

            br.Seek(30, SeekOrigin.Current);

            Sex = (byte)br.ReadByte();

            br.Seek(17, SeekOrigin.Current);

            long serverCount = (br.Length - br.Position) / BLOCK_SIZE;

            Servers = new CharServerInfo[serverCount];
            for (int i = 0; i < serverCount; i++)
            {
                CharServerInfo csi = new CharServerInfo();
                csi.IP        = new IPAddress(br.ReadUInt());
                csi.Port      = br.ReadUShort();
                csi.Name      = br.ReadBinaryString(20);
                csi.UserCount = br.ReadUShort();
                csi.State     = br.ReadShort();
                csi.Property  = br.ReadUShort();

                Servers[i] = csi;
            }
        }
Ejemplo n.º 3
0
        public bool Read(BinaryReader br)
        {
            LoginID1  = br.ReadLong();
            AccountID = br.ReadLong();
            LoginID2  = br.ReadLong();
            br.Seek(30, SeekOrigin.Current);
            Sex = br.ReadUByte();
            br.Seek(17, SeekOrigin.Current);

            /**
             * This seems very wrong to me
             * Which always return 5
             * Is there another way of knowing the server count?
             * header(64) + size (160) * server_num (taken from rAthena)
             * Note: Here we've already skipped 4 bytes from reading the cmd and size
             */

            long serverCount = (br.Length - br.Position) / 32;

            Servers = new CharServerInfo[serverCount];
            for (int i = 0; i < serverCount; i++)
            {
                CharServerInfo csi = new CharServerInfo();
                csi.IP        = new IPAddress(br.ReadULong());
                csi.Port      = br.ReadUShort();
                csi.Name      = br.ReadBinaryString(20);
                csi.UserCount = br.ReadUShort();
                csi.State     = br.ReadShort();
                csi.Property  = br.ReadUShort();

                Servers[i] = csi;
            }

            return(true);
        }
Ejemplo n.º 4
0
 private void ConnectToCharServer(CharServerInfo charServerInfo)
 {
     State.CharServer = charServerInfo;
     CurrentConnection.Connect(charServerInfo.IP.ToString(), charServerInfo.Port);
     HookPacket(HC.ACCEPT_ENTER.HEADER, (ushort cmd, int size, InPacket packet) => {
         if (packet is HC.ACCEPT_ENTER)
         {
             SelectCharacter();
         }
     });
 }
 private void OnCharServerSelected(CharServerInfo charServerInfo)
 {
     this.charServerInfo = charServerInfo;
 }
 public void BindData(CharServerInfo charServerInfo)
 {
     this.charServerInfo      = charServerInfo;
     this.charServerName.text = charServerInfo.Name;
 }