示例#1
0
        public HandleLoginInfo(Client client, byte[] packet)
        {
            PacketReader Reader = new PacketReader(packet);

            byte Type = Reader.ReadByte();

            if (Type == 4)
            {
                MessageBox.Show("Incorrect password.");
                client.MapleConnect.Close();
                client.LoginThread.Abort();
                client.Account.LoggingIn = false;
                client.MForm.ChangedAccount();
            }
            else if (Type == 5)
            {
                MessageBox.Show("Username does not exist.");
                client.MapleConnect.Close();
                client.LoginThread.Abort();
                client.Account.LoggingIn = false;
                client.MForm.ChangedAccount();
            }
            else if (Type == 7)
            {
                MessageBox.Show("Account already logged in.");
                client.MapleConnect.Close();
                client.LoginThread.Abort();
                client.Account.LoggingIn = false;
                client.MForm.ChangedAccount();
            }
            else
            {
                client.Account.AccountID = Reader.ReadInt();
                Reader.ReadByte();
                Reader.ReadByte();
                Reader.ReadByte();
                client.Account.Username = Reader.ReadMapleString();
                Reader.ReadMapleString();
                Reader.ReadInt();
                //MessageBox.Show("Actual username: "******"; Account id: " + client.Account.Account_id);

                PacketWriter Writer = new PacketWriter();
                Writer.WriteShort((short)PacketOpcodes.sPin);
                Writer.WriteByte(1);
                Writer.WriteByte(0);
                Writer.WriteInt(client.Account.AccountID);
                Writer.WriteMapleString(client.Account.Pin);

                client.SendPacket(Writer);
            }
        }
示例#2
0
        public HandlePin(Client client, byte[] packet)
        {
            PacketReader Reader = new PacketReader(packet);

            byte type = Reader.ReadByte();

            if (type == 0)
            {
                PacketWriter Writer = new PacketWriter();

                Writer.WriteShort((short)PacketOpcodes.sWorldInfoRequest);
                client.SendPacket(Writer);
            }
            else if (type == 1)
            {
                MessageBox.Show("Please set a pin.");
                client.MapleConnect.Close();
                client.LoginThread.Abort();
                client.Account.LoggingIn = false;
                client.MForm.ChangedAccount();
            }
            else if (type == 2)
            {
                MessageBox.Show("Incorrect pin");
                client.MapleConnect.Close();
                client.LoginThread.Abort();
                client.Account.LoggingIn = false;
                client.MForm.ChangedAccount();
            }
        }
示例#3
0
        public HandleServerConnect(Client client, byte[] packet)
        {
            PacketReader Reader = new PacketReader(packet);

            Reader.ReadByte();                       // unknown
            Reader.ReadByte();                       // unknown
            int Host = Reader.ReadInt();
            int Port = Reader.ReadShort();
            int CharacterID = Reader.ReadInt();
            Reader.ReadByte();                       // unknown
            Reader.ReadInt();                      // unknown

            client.ChangeIntConnection(Host, Port);

            byte[] Buffer = { 0x00, 0xE0, 0x4D, 0xA6, 0xA5, 0xCF, 0xB4, 0x68, 0xCB, 0xE4, 0x00, 0x00, 0x00, 0x00, 0x32, 0xFD, 0x00, 0x00 };

            PacketWriter Writer = new PacketWriter();
            Writer.WriteShort((short)PacketOpcodes.sChannelConnect);
            Writer.WriteInt(CharacterID);
            Writer.WriteBytes(Buffer);
            Writer.WriteBytes(client.Account.SessionID);

            client.SendPacket(Writer);
        }
示例#4
0
        public HandleWorldInfo(Client client, byte[] packet)
        {
            PacketReader Reader = new PacketReader(packet);

            byte WorldID = Reader.ReadByte();

            if (WorldID != 0xFF)
            {
                string WorldName = Reader.ReadMapleString();
                byte EventType = Reader.ReadByte();
                string EventInfo = Reader.ReadMapleString();
                Reader.ReadShort();
                Reader.ReadShort();
                byte ChannelCount = Reader.ReadByte();

                //byte WorldID = # player["worlds"];
                client.Account.Worlds[WorldID] = new Account.World();

                client.Account.Worlds[WorldID].ID = WorldID;
                client.Account.Worlds[WorldID].Name = WorldName;
                client.Account.Worlds[WorldID].EventType = EventType;
                client.Account.Worlds[WorldID].EventInfo = EventInfo;
                client.Account.Worlds[WorldID].ChannelCount = ChannelCount;

                for (int i = 0; i < ChannelCount; i++)
                {
                    string ChannelName = Reader.ReadMapleString();
                    int ChannelPopulation = Reader.ReadInt();
                    byte ChannelWorld = Reader.ReadByte();
                    byte ChannelID = Reader.ReadByte();
                    byte ChannelLanguage = Reader.ReadByte();

                    client.Account.Worlds[WorldID].Channels[i] = new Account.Channel();

                    client.Account.Worlds[WorldID].Channels[i].Name = ChannelName;
                    client.Account.Worlds[WorldID].Channels[i].Population = ChannelPopulation;
                    client.Account.Worlds[WorldID].Channels[i].World = ChannelWorld;
                    client.Account.Worlds[WorldID].Channels[i].ID = ChannelID;
                    client.Account.Worlds[WorldID].Channels[i].Language = ChannelLanguage;
                }
            }
        }
示例#5
0
        /// <summary>
        /// Handles received information about the character list.
        /// Stores character variables for later access.
        /// </summary>
        /// <param name="client">Client from which packet was received</param>
        /// <param name="packet">Packet to be handled</param>
        public HandleCharList(Client client, byte[] packet)
        {
            PacketReader Reader = new PacketReader(packet);

            byte Error = Reader.ReadByte();
            if(Error!=0)
            {
                MessageBox.Show("Error selecting channel");
            }
            else
            {
                client.Account.CharacterCount = Reader.ReadByte();

                for(int i=0; i<client.Account.CharacterCount; i++)
                {
                    client.Account.Characters[i] = new Account.Character();

                    client.Account.Characters[i].ID = Reader.ReadInt();
                    PacketReader SubReader = new PacketReader(Reader.ReadBytes(13));
                    client.Account.Characters[i].Name = SubReader.ReadNullTerminatedString();
                    client.Account.Characters[i].Gender = Reader.ReadByte();
                    client.Account.Characters[i].Skin = Reader.ReadByte();
                    client.Account.Characters[i].Face = Reader.ReadInt();
                    client.Account.Characters[i].Hair = Reader.ReadInt();
                    client.Account.Characters[i].Level = Reader.ReadByte();
                    client.Account.Characters[i].Job = Reader.ReadShort();
                    client.Account.Characters[i].Str = Reader.ReadShort();
                    client.Account.Characters[i].Dex = Reader.ReadShort();
                    client.Account.Characters[i].Int = Reader.ReadShort();
                    client.Account.Characters[i].Luk = Reader.ReadShort();
                    client.Account.Characters[i].HP = Reader.ReadShort();
                    client.Account.Characters[i].MaxHp = Reader.ReadShort();
                    client.Account.Characters[i].MP = Reader.ReadShort();
                    client.Account.Characters[i].MaxMp = Reader.ReadShort();
                    client.Account.Characters[i].AP = Reader.ReadShort();
                    if (client.Account.Characters[i].Job / 1000 == 3 || client.Account.Characters[i].Job / 100 == 22 || client.Account.Characters[i].Job == 2001)
                    {
                        byte spCount = Reader.ReadByte();
                        Reader.Skip(spCount * 2);//sp for each job level
                    }
                    else
                        client.Account.Characters[i].SP = Reader.ReadShort();
                    //Reader.Skip(Reader.ReadByte() * 2);
                    client.Account.Characters[i].XP = Reader.ReadInt();
                    client.Account.Characters[i].Fame = Reader.ReadShort();
                    client.Account.Characters[i].Map = Reader.ReadInt();
                    client.Account.Characters[i].SpawnPoint = Reader.ReadByte();
                    Reader.ReadInt();  // unknown
                    Reader.ReadShort();  // unknown
                    Reader.ReadInt();  // unknown
                    Reader.ReadInt();  // unknown
                    Reader.ReadBytes(8); // unknown
                    Reader.ReadByte();   // gender (again)
                    Reader.ReadByte();   // skin (again)
                    Reader.ReadInt();  // face (again)
                    Reader.ReadByte();   // unknown
                    Reader.ReadInt();  // hair (again)

                    byte Position = Reader.ReadByte();

                    while(Position != 0xFF)
                    {
                        client.Account.Equips.Visible[Position] = Reader.ReadInt();
                        Position = Reader.ReadByte();
                    }

                    Position = Reader.ReadByte();

                    while(Position != 0xFF)
                    {
                        client.Account.Equips.Masked[Position] = Reader.ReadInt();
                        Position = Reader.ReadByte();
                    }

                    client.Account.Equips.CashWeapon = Reader.ReadInt();

                    Reader.ReadBytes(12);    // pet info
                    Reader.ReadByte();       // unknown
                    if(Reader.ReadByte()!=0)
                        Reader.Skip(16);       // ranking
                }

                Reader.ReadShort();          // unknown
                Reader.ReadShort();          // unknown
                Reader.ReadBytes(6);         // unknown
                client.Account.SessionID = Reader.ReadBytes(8);

                client.Account.LoggedIn = true;
                // Program.mFrm.LoggedIn(client.Account.id);
                // Program.mFrm.AddCharacters(client.Account.character_count);
            }
        }