Exemple #1
0
        public static void EnterMapPacket(Session pSession, bool pConnecting, int pToMapID)
        {
            Packet packet = new Packet(Program.CHANGE_MAP_HEADER);

            {
                // Option list
                packet.WriteShort(2); // Amount

                packet.WriteInt(1);
                packet.WriteInt(0);

                packet.WriteInt(2);
                packet.WriteInt(0);
            }
            packet.WriteInt(12); // Channel

            packet.WriteByte(0);
            packet.WriteInt(0);

            packet.WriteByte(1); // Portals

            packet.WriteInt(0);  // ...


            packet.WriteBool(pConnecting); // Is Connecting

            if (true)
            {
                packet.WriteShort(1);              // Lines
                packet.WriteString("Test Server"); // Title
                packet.WriteString("This is a test server!");
            }
            else
            {
                packet.WriteShort(0);
            }

            if (pConnecting)
            {
                // Random Numbers for damage calculation
                packet.WriteUInt(4078638766);
                packet.WriteUInt(1285450110);
                packet.WriteUInt(2894412159);

                {
                    // Char Data
                    ulong flag = 0xFFDFFFFFFFFFFFFF;

                    packet.WriteULong(flag);
                    packet.WriteByte(0);


                    packet.WriteInt(0);
                    packet.WriteInt(0);
                    packet.WriteInt(0);

                    packet.WriteByte(0); // Loop1

                    packet.WriteInt(0);  // Loop 2

                    packet.WriteByte(0);

                    packet.WriteBool(false);

                    {
                        // Stats

                        packet.WriteInt(1337); // ID
                        packet.WriteString("TestBoooii", 13);

                        packet.WriteByte(0);
                        packet.WriteByte(3);
                        packet.WriteInt(20100);
                        packet.WriteInt(33830);

                        // Pets
                        packet.WriteLong(0);
                        packet.WriteLong(0);
                        packet.WriteLong(0);

                        packet.WriteByte(250); // Level

                        short job = 910;       // 910 = SGM
                        packet.WriteShort(job);

                        packet.WriteShort(1000); // STR
                        packet.WriteShort(2000); // DEX
                        packet.WriteShort(3000); // INT
                        packet.WriteShort(4000); // LUK

                        packet.WriteInt(500000); // HP
                        packet.WriteInt(500000); // Max HP
                        packet.WriteInt(500000); // MP
                        packet.WriteInt(500000); // Max MP

                        packet.WriteShort(0);    // AP
                        if (IsExtendedSPJob(job))
                        {
                            packet.WriteByte(0);
                        }
                        else
                        {
                            packet.WriteShort(0);
                        }

                        packet.WriteLong(123456789); // EXP
                        packet.WriteInt(0xBADF00D);  // Fame

                        packet.WriteInt(10000);      // Gacha EXP
                        packet.WriteInt(0);          // V.141 unk

                        packet.WriteInt(pToMapID);   // GM map
                        packet.WriteByte(0);         // Map pos

                        packet.WriteInt(0);          // Unk?

                        packet.WriteShort(0);        // Job sub ID?

                        if (job / 100 == 31 || job / 100 == 36 || job == 3001 || job == 3002)
                        {
                            packet.WriteInt(1012278);
                        }

                        packet.WriteByte(0); // Fatigue

                        packet.WriteInt(int.Parse(DateTime.Now.ToString("yyyyMMddHH")));

                        // Traits
                        for (int i = 0; i < 6; i++)
                        {
                            packet.WriteInt(100 * i);
                        }

                        // Traits today
                        for (int i = 0; i < 6; i++)
                        {
                            packet.WriteUShort((ushort)(50 * i));
                        }

                        // 9 bytes leftover
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteByte(0);


                        packet.WriteInt(0);
                        packet.WriteByte(0);
                        packet.WriteInt(0);
                        packet.WriteByte(0);
                        packet.WriteByte(0);
                        packet.WriteInt(0);
                        packet.WriteByte(0);

                        packet.WriteInt(0);
                        packet.WriteInt(0);

                        packet.WriteInt(0);

                        packet.WriteByte(0);

                        // Parttime jobs
                        for (int i = 1; i <= 9; i++)
                        {
                            packet.WriteInt(0);
                            packet.WriteByte(0);
                            packet.WriteInt(0);
                        }


                        packet.WriteInt(0); // 'reverse' time!
                        packet.WriteInt(0);
                    }


                    packet.WriteByte(100);   // Buddylist size

                    packet.WriteBool(false); // Blessings
                    packet.WriteBool(false);
                    packet.WriteBool(false);

                    packet.WriteLong(133713371337); // Mesos

                    packet.WriteInt(0);             // Some loop
                    packet.WriteInt(0);             // Magic Potions loop

                    {
                        // Inventories

                        for (int i = 0; i < 5; i++)
                        {
                            packet.WriteByte(8 * 10);        // inventory slots
                        }
                        packet.WriteLong(94354848000000000); // Some say it's a date for a quest. I don't believe them

                        // Equips
                        for (int i = 0; i < 3 + 9 + 1; i++)
                        {
                            packet.WriteShort(0); // No items!
                        }

                        // Regular inventories
                        for (int i = 0; i < 4; i++)
                        {
                            packet.WriteByte(0); // No items!
                        }

                        // Bags
                        for (int i = 3; i <= 4; i++)
                        {
                            packet.WriteInt(0);
                        }
                    }

                    packet.WriteInt(0); // Loopies
                    packet.WriteInt(0);

                    // while loop here
                    packet.WriteByte(0); // Stop while loop.

                    {
                        // Skills

                        packet.WriteBool(true);
                        if (true)
                        {
                            packet.WriteShort(0); // No skills
                            packet.WriteShort(0); // No link skills
                        }
                        else
                        {
                            // I aint going to program this..
                        }

                        packet.WriteShort(0); // No cooldowns either
                    }

                    {
                        // Quests
                        bool wut = false;
                        packet.WriteBool(wut);
                        packet.WriteShort(0);

                        if (!wut)
                        {
                            packet.WriteShort(0);
                        }

                        packet.WriteShort(0);

                        wut = false;
                        packet.WriteBool(wut);
                        packet.WriteShort(0);

                        if (!wut)
                        {
                            packet.WriteShort(0);
                        }
                    }

                    packet.WriteShort(0); // Match records

                    {
                        // Bunch o rings

                        packet.WriteShort(0); // Couple
                        packet.WriteShort(0); // Friend
                        packet.WriteShort(0); // Marriage
                    }

                    // Tele rocks
                    for (int i = 0; i < 5 + 10 + 13 + 13; i++)
                    {
                        packet.WriteInt(999999999);
                    }


                    {
                        // Monsterbook

                        packet.WriteInt(0);      // Chosen card
                        packet.WriteBool(false); // Method to use; false = old loop
                        packet.WriteShort(0);
                    }

                    packet.WriteInt(-1); // ?

                    packet.WriteShort(0);

                    // Newyear cards
                    packet.WriteShort(0);

                    // PQ data
                    packet.WriteShort(0);

                    // Wildhunter info... no
                    if (false)
                    {
                        packet.WriteByte(1);
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                    }

                    // Finished PQs
                    packet.WriteShort(0);

                    // Some event stuff
                    packet.WriteShort(0);

                    // Stolen skills
                    for (int i = 13; i > 0; i--)
                    {
                        packet.WriteInt(0);
                    }

                    // Chosen skills?
                    for (int i = 4; i > 0; i--)
                    {
                        packet.WriteInt(0);
                    }

                    // Inner stats
                    packet.WriteShort(0);

                    {
                        // Unknown stuff
                        packet.WriteInt(0);

                        packet.WriteByte(0);
                    }


                    // Honour info
                    packet.WriteInt(1337); // Level
                    packet.WriteInt(0);    // EXP

                    {
                        // More unknown stuffs :(
                        packet.WriteByte(1);  // Use first loop
                        packet.WriteShort(0); // End loop
                    }

                    packet.WriteBool(false); // Item decode if true

                    {
                        packet.WriteInt(1680023);
                        packet.WriteInt(1680024);
                        packet.WriteInt(1680025);
                        packet.WriteByte(1);
                    }

                    {
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteLong(94354848000000000);
                    }

                    {
                        // Evolution Cores
                        packet.WriteShort(0);
                        packet.WriteShort(0);
                    }

                    packet.WriteByte(0);

                    {
                        // Farm info
                        packet.WriteString("Creating...");
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteInt(0);

                        packet.WriteByte(0);

                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteInt(0);

                        packet.WriteInt(0);
                        packet.WriteInt(0);
                    }

                    packet.WriteBool(false); // More item decode thingies

                    {
                        packet.WriteInt(0);
                        packet.WriteLong(94354848000000000);
                        packet.WriteInt(0);
                    }

                    {
                        // Decodes 84 bytes

                        packet.WriteInt(1257960);
                        // 4
                        for (int i = 0; i < 64; i += 8)
                        {
                            packet.WriteLong(0);
                        }
                        // 68
                        packet.WriteShort(0);
                        packet.WriteByte(0);
                        // 71

                        // Ohkay
                        packet.WriteLong(DateTime.Now.ToFileTime());
                        // 79

                        packet.WriteInt(0);
                        packet.WriteByte(1);
                        // 84
                    }

                    packet.WriteByte(0);

                    // loop...
                    packet.WriteShort(0);

                    {
                        packet.WriteInt(9995561);
                        packet.WriteInt(2027067);
                        packet.WriteInt(4);
                        packet.WriteInt(0);

                        for (int i = 0; i < 4; i++)
                        {
                            packet.WriteInt(9410165 + i);
                            packet.WriteInt(i * 1000);
                        }
                    }

                    {
                        // Bulk info
                        packet.WriteInt(0);
                    }
                }
            }
            else
            {
                packet.WriteByte(0);

                packet.WriteInt(pToMapID); // Mapid
                packet.WriteByte(0);       // Mapppos

                packet.WriteInt(13371337); // HP

                packet.WriteBool(false);
            }


            packet.WriteLong(DateTime.Now.ToFileTime());
            packet.WriteInt(100);
            packet.WriteByte(0);
            packet.WriteByte(0);
            packet.WriteByte(1);

            pSession.SendPacket(packet);
        }
Exemple #2
0
        public override void OnPacketInbound(Packet pPacket)
        {
            exporter.AddPacket(pPacket, false);

            ushort header = pPacket.ReadUShort();
            Console.WriteLine("Packet: {0}", pPacket.ToString());
            if (header == 0x0038) //(header == 0x0043)
            {
                // Version? > lets get rollin
                ServerPackets.EnterMapPacket(this, true, 180000000);

                short slot = 1;

                foreach (var kvp in Program.ITEMS)
                    ServerPackets.SendTestItem(this, kvp.Value, kvp.Key);

                /*

                ServerPackets.SendTestItem(this, 1003142, slot++);
                ServerPackets.SendTestItem(this, 1102275, slot++);

                ItemEquip equip = new ItemEquip(1222009)
                {
                    BattleModeDamage = 20,
                    BossDamageRate = 30,
                    Durability = 500000,
                    IgnoreDamageRate = 50,
                };
                ServerPackets.SendTestItem(this, equip, slot++);

                equip = new ItemEquip(1003142)
                {
                    AllStatsPercentage = 11,
                    TotalDamagePercentage = 22,
                    IncreasesSkills = 33
                };

                ushort statusflag = 0;
                statusflag |= 0x0020;
                //statusflag |= 0x2000;

                equip.StatusFlags = statusflag;

                ServerPackets.SendTestItem(this, equip, slot++);


                equip = new ItemEquip(1003142)
                {
                    Durability = 100,
                };
                ServerPackets.SendTestItem(this, equip, slot++);



                ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0001 }, slot++); // Potential?
                ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0002 }, slot++); // Potential?
                ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0004 }, slot++); // Potential?
                ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0008 }, slot++); // Potential?
                ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0010 }, slot++);
                ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0020 }, slot++);
                ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0040 }, slot++);
                ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0080 }, slot++);

                ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x0001 }, slot++); 
                ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x0002 }, slot++); 
                ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x0004 }, slot++); 
                ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x0008 }, slot++); 
                ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x001F }, slot++);
                ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x002F }, slot++);
                ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x004F }, slot++);
                ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x008F }, slot++);

                ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x0100 }, slot++);
                ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x0200 }, slot++);
                ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x0400 }, slot++);
                ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x0800 }, slot++);
                ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x1000 }, slot++);
                ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x2000 }, slot++);
                ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x4000 }, slot++);
                ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x8000 }, slot++);

                ServerPackets.SendTestItem(this, new ItemEquip(1113017)
                {
                    StatusFlags = 0x0714,
                    Potential1 = 40356,
                    Potential2 = 30041,
                    Potential3 = 30044,
                    Potential4 = 12011,
                    Potential5 = 2014,
                    Potential6 = 2014,
                    SocketState = 0x00FF,
                    Nebulite2 = 1001,
                    Nebulite1 = 2001,
                    Nebulite3 = 3400,

                }, slot++);
                */

            }
            else if (header == 0x0030)
            {
                int request = pPacket.ReadInt();
                int response;

                response = ((request >> 5) << 5) + (((((request & 0x1F) >> 3) ^ 2) << 3) + (7 - (request & 7)));
                response |= ((request >> 7) << 7);
                response -= 2;

                Packet packet = new Packet(0x0015);
                packet.WriteInt(response);
                this.SendPacket(packet);
            }
            else if (header == 0x040)
            {
                Packet packet = new Packet(0x0000);
                packet.WriteInt(0);
                packet.WriteShort(0);
                
                packet.WriteInt(12222222); // User ID
                packet.WriteByte(0);
                packet.WriteByte(0);
                packet.WriteUShort(0xFFFF); // admin flags
                packet.WriteInt(0);
                packet.WriteByte(0x95);
                packet.WriteString("TestUser"); // Username
                packet.WriteByte(0);
                packet.WriteByte(0);
                packet.WriteLong(0);
                packet.WriteLong(128664365579370000); // create date

                packet.WriteInt(78);

                packet.WriteBool(false); // Else, 18 bytes
                packet.WriteBool(true); // Send 0x22 back
                packet.WriteByte(0);

                packet.WriteLong(0); // CC key

                this.SendPacket(packet);
            }
            else if (header == 0x0022)
            {
                Packet packet = new Packet(0x0009);
                byte worldid = 41;
                string worldname = "Ultimate";
                byte channels = 10;

                packet.WriteByte(worldid);
                packet.WriteString(worldname);
                packet.WriteByte(1);
                packet.WriteString("");
                packet.WriteUShort(100);
                packet.WriteUShort(100);

                packet.WriteByte(0);

                packet.WriteByte(channels); // Channels
                for (byte i = 0; i < channels; i++)
                {
                    packet.WriteString(string.Format("{0}-{1}", worldname, i + 1));
                    packet.WriteInt(1000);
                    packet.WriteByte(worldid);
                    packet.WriteByte(i);
                    packet.WriteByte(0);
                }

                packet.WriteShort(0); // Tooltip thingies

                packet.WriteInt(0);

                this.SendPacket(packet);

                packet = new Packet(0x0009);
                packet.WriteByte(0xFF);
                packet.WriteByte(0); // ? Restriction message?
                this.SendPacket(packet);

            }
            else if (header == 0x001D)
            {
                Packet packet = new Packet(0x0004);
                packet.WriteByte(0); // Server status
                packet.WriteByte(0);
                this.SendPacket(packet);
            }
            else
            {
                Console.WriteLine("Unknown");
            }
        }
Exemple #3
0
        public override void OnPacketInbound(Packet pPacket)
        {
            exporter.AddPacket(pPacket, false);

            ushort header = pPacket.ReadUShort();

            Console.WriteLine("Packet: {0}", pPacket.ToString());
            if (header == 0x0038) //(header == 0x0043)
            {
                // Version? > lets get rollin
                ServerPackets.EnterMapPacket(this, true, 180000000);

                short slot = 1;

                foreach (var kvp in Program.ITEMS)
                {
                    ServerPackets.SendTestItem(this, kvp.Value, kvp.Key);
                }

                /*
                 *
                 * ServerPackets.SendTestItem(this, 1003142, slot++);
                 * ServerPackets.SendTestItem(this, 1102275, slot++);
                 *
                 * ItemEquip equip = new ItemEquip(1222009)
                 * {
                 *  BattleModeDamage = 20,
                 *  BossDamageRate = 30,
                 *  Durability = 500000,
                 *  IgnoreDamageRate = 50,
                 * };
                 * ServerPackets.SendTestItem(this, equip, slot++);
                 *
                 * equip = new ItemEquip(1003142)
                 * {
                 *  AllStatsPercentage = 11,
                 *  TotalDamagePercentage = 22,
                 *  IncreasesSkills = 33
                 * };
                 *
                 * ushort statusflag = 0;
                 * statusflag |= 0x0020;
                 * //statusflag |= 0x2000;
                 *
                 * equip.StatusFlags = statusflag;
                 *
                 * ServerPackets.SendTestItem(this, equip, slot++);
                 *
                 *
                 * equip = new ItemEquip(1003142)
                 * {
                 *  Durability = 100,
                 * };
                 * ServerPackets.SendTestItem(this, equip, slot++);
                 *
                 *
                 *
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0001 }, slot++); // Potential?
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0002 }, slot++); // Potential?
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0004 }, slot++); // Potential?
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0008 }, slot++); // Potential?
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0010 }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0020 }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0040 }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113015) { StatusFlags = 0x0080 }, slot++);
                 *
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x0001 }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x0002 }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x0004 }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x0008 }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x001F }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x002F }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x004F }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113016) { SocketState = 0x008F }, slot++);
                 *
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x0100 }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x0200 }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x0400 }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x0800 }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x1000 }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x2000 }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x4000 }, slot++);
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113017) { SocketState = 0x8000 }, slot++);
                 *
                 * ServerPackets.SendTestItem(this, new ItemEquip(1113017)
                 * {
                 *  StatusFlags = 0x0714,
                 *  Potential1 = 40356,
                 *  Potential2 = 30041,
                 *  Potential3 = 30044,
                 *  Potential4 = 12011,
                 *  Potential5 = 2014,
                 *  Potential6 = 2014,
                 *  SocketState = 0x00FF,
                 *  Nebulite2 = 1001,
                 *  Nebulite1 = 2001,
                 *  Nebulite3 = 3400,
                 *
                 * }, slot++);
                 */
            }
            else if (header == 0x0030)
            {
                int request = pPacket.ReadInt();
                int response;

                response  = ((request >> 5) << 5) + (((((request & 0x1F) >> 3) ^ 2) << 3) + (7 - (request & 7)));
                response |= ((request >> 7) << 7);
                response -= 2;

                Packet packet = new Packet(0x0015);
                packet.WriteInt(response);
                this.SendPacket(packet);
            }
            else if (header == 0x040)
            {
                Packet packet = new Packet(0x0000);
                packet.WriteInt(0);
                packet.WriteShort(0);

                packet.WriteInt(12222222); // User ID
                packet.WriteByte(0);
                packet.WriteByte(0);
                packet.WriteUShort(0xFFFF); // admin flags
                packet.WriteInt(0);
                packet.WriteByte(0x95);
                packet.WriteString("TestUser"); // Username
                packet.WriteByte(0);
                packet.WriteByte(0);
                packet.WriteLong(0);
                packet.WriteLong(128664365579370000); // create date

                packet.WriteInt(78);

                packet.WriteBool(false); // Else, 18 bytes
                packet.WriteBool(true);  // Send 0x22 back
                packet.WriteByte(0);

                packet.WriteLong(0); // CC key

                this.SendPacket(packet);
            }
            else if (header == 0x0022)
            {
                Packet packet    = new Packet(0x0009);
                byte   worldid   = 41;
                string worldname = "Ultimate";
                byte   channels  = 10;

                packet.WriteByte(worldid);
                packet.WriteString(worldname);
                packet.WriteByte(1);
                packet.WriteString("");
                packet.WriteUShort(100);
                packet.WriteUShort(100);

                packet.WriteByte(0);

                packet.WriteByte(channels); // Channels
                for (byte i = 0; i < channels; i++)
                {
                    packet.WriteString(string.Format("{0}-{1}", worldname, i + 1));
                    packet.WriteInt(1000);
                    packet.WriteByte(worldid);
                    packet.WriteByte(i);
                    packet.WriteByte(0);
                }

                packet.WriteShort(0); // Tooltip thingies

                packet.WriteInt(0);

                this.SendPacket(packet);

                packet = new Packet(0x0009);
                packet.WriteByte(0xFF);
                packet.WriteByte(0); // ? Restriction message?
                this.SendPacket(packet);
            }
            else if (header == 0x001D)
            {
                Packet packet = new Packet(0x0004);
                packet.WriteByte(0); // Server status
                packet.WriteByte(0);
                this.SendPacket(packet);
            }
            else
            {
                Console.WriteLine("Unknown");
            }
        }
Exemple #4
0
        public override void Write(Packet pPacket)
        {
            base.Write(pPacket);

            if (this.SocketState != 0)
            {
                this.SocketState |= 0x0001;
            }

            {
                // flags 1
                uint flag = 0;
                int  tmp  = pPacket.Position;
                pPacket.WriteInt(0);

                // this\.([a-zA-Z]+) = FlaggedValue\(pConnection, this\.ItemID, flag, 0x([0-9]+), pPacket, this\.([a-zA-Z]+)\);
                // WriteFlaggedValue\(pPacket, 0x\2, this.\1, ref flag\);

                WriteFlaggedValue(pPacket, 0x00000001, this.Slots, ref flag);
                WriteFlaggedValue(pPacket, 0x00000002, this.Scrolls, ref flag);
                WriteFlaggedValue(pPacket, 0x00000004, this.Str, ref flag);
                WriteFlaggedValue(pPacket, 0x00000008, this.Dex, ref flag);
                WriteFlaggedValue(pPacket, 0x00000010, this.Int, ref flag);
                WriteFlaggedValue(pPacket, 0x00000020, this.Luk, ref flag);
                WriteFlaggedValue(pPacket, 0x00000040, this.HP, ref flag);
                WriteFlaggedValue(pPacket, 0x00000080, this.MP, ref flag);
                WriteFlaggedValue(pPacket, 0x00000100, this.Watk, ref flag);
                WriteFlaggedValue(pPacket, 0x00000200, this.Matk, ref flag);
                WriteFlaggedValue(pPacket, 0x00000400, this.Wdef, ref flag);
                WriteFlaggedValue(pPacket, 0x00000800, this.Mdef, ref flag);
                WriteFlaggedValue(pPacket, 0x00001000, this.Acc, ref flag);
                WriteFlaggedValue(pPacket, 0x00002000, this.Avo, ref flag);
                WriteFlaggedValue(pPacket, 0x00004000, this.Hands, ref flag);
                WriteFlaggedValue(pPacket, 0x00008000, this.Speed, ref flag);
                WriteFlaggedValue(pPacket, 0x00010000, this.Jump, ref flag);
                WriteFlaggedValue(pPacket, 0x00020000, this.Flags, ref flag);

                WriteFlaggedValue(pPacket, 0x00040000, this.IncreasesSkills, ref flag);

                WriteFlaggedValue(pPacket, 0x00080000, this.ItemLevel, ref flag);
                WriteFlaggedValue(pPacket, 0x00100000, this.ItemEXP, ref flag);


                WriteFlaggedValue(pPacket, 0x00200000, this.Durability, ref flag);
                WriteFlaggedValue(pPacket, 0x00400000, this.ViciousHammer, ref flag);

                WriteFlaggedValue(pPacket, 0x00800000, this.BattleModeDamage, ref flag);

                // FlaggedValue\(pConnection, this\.ItemID, flag, 0x([0-9]+), pPacket, \(([a-zA-Z]+)\)(0), true\);
                // WriteFlaggedValue\(pPacket, 0x\1, \(\2\)\3, ref flag\);

                WriteFlaggedValue(pPacket, 0x01000000, this.EquipmentLevelReduction, ref flag); // Item level changer?
                WriteFlaggedValue(pPacket, 0x02000000, (short)0, ref flag);                     // Enhancement buff?
                WriteFlaggedValue(pPacket, 0x04000000, this.SecondDurability, ref flag);        // Second durability
                WriteFlaggedValue(pPacket, 0x08000000, (byte)0, ref flag);                      // Required level changer?!
                WriteFlaggedValue(pPacket, 0x10000000, (byte)0, ref flag);                      // Yggdrasil Wisdom? | If higher than 1, 'Success'
                WriteFlaggedValue(pPacket, 0x20000000, (byte)0, ref flag);                      // Final Strike? | If higher than 1, 'Success'

                WriteFlaggedValue(pPacket, 0x40000000, this.BossDamageRate, ref flag);
                WriteFlaggedValue(pPacket, 0x80000000, this.IgnoreDamageRate, ref flag);

                pPacket.SetUInt(tmp, flag);
            }

            {
                // flags 2
                uint flag = 0;
                int  tmp  = pPacket.Position;
                pPacket.WriteInt(0);

                WriteFlaggedValue(pPacket, 0x01, this.TotalDamagePercentage, ref flag);
                WriteFlaggedValue(pPacket, 0x02, this.AllStatsPercentage, ref flag);
                WriteFlaggedValue(pPacket, 0x04, this.MaxScissors, ref flag);
                WriteFlaggedValue(pPacket, 0x08, (long)0, ref flag);
                WriteFlaggedValue(pPacket, 0x10, (int)0, ref flag);

                pPacket.SetUInt(tmp, flag);
            }

            pPacket.WriteString(this.Name);
            pPacket.WriteUShort(this.StatusFlags);


            pPacket.WriteUShort(this.Potential1);
            pPacket.WriteUShort(this.Potential2);
            pPacket.WriteUShort(this.Potential3);

            pPacket.WriteUShort(this.Potential4);
            pPacket.WriteUShort(this.Potential5);
            pPacket.WriteUShort(this.Potential6);

            pPacket.WriteUShort(this.DisplayID);

            pPacket.WriteUShort(this.SocketState);
            pPacket.WriteShort(this.Nebulite1);
            pPacket.WriteShort(this.Nebulite2);
            pPacket.WriteShort(this.Nebulite3);

            // If cash id
            pPacket.WriteLong(this.UniqueID);

            pPacket.WriteLong(0);
            pPacket.WriteInt(-1);
        }
        public static void EnterMapPacket(Session pSession, bool pConnecting, int pToMapID)
        {
            Packet packet = new Packet(Program.CHANGE_MAP_HEADER);
            {
                // Option list
                packet.WriteShort(2); // Amount

                packet.WriteInt(1);
                packet.WriteInt(0);

                packet.WriteInt(2);
                packet.WriteInt(0);
            }
            packet.WriteInt(12); // Channel

            packet.WriteByte(0);
            packet.WriteInt(0);

            packet.WriteByte(1); // Portals

            packet.WriteInt(0); // ...


            packet.WriteBool(pConnecting); // Is Connecting

            if (true)
            {
                packet.WriteShort(1); // Lines
                packet.WriteString("Test Server"); // Title
                packet.WriteString("This is a test server!");
            }
            else
            {
                packet.WriteShort(0);
            }

            if (pConnecting)
            {
                // Random Numbers for damage calculation
                packet.WriteUInt(4078638766);
                packet.WriteUInt(1285450110);
                packet.WriteUInt(2894412159);

                {
                    // Char Data
                    ulong flag = 0xFFDFFFFFFFFFFFFF;

                    packet.WriteULong(flag);
                    packet.WriteByte(0);


                    packet.WriteInt(0);
                    packet.WriteInt(0);
                    packet.WriteInt(0);

                    packet.WriteByte(0); // Loop1

                    packet.WriteInt(0); // Loop 2

                    packet.WriteByte(0);

                    packet.WriteBool(false);

                    {
                        // Stats

                        packet.WriteInt(1337); // ID
                        packet.WriteString("TestBoooii", 13);

                        packet.WriteByte(0);
                        packet.WriteByte(3);
                        packet.WriteInt(20100);
                        packet.WriteInt(33830);

                        // Pets
                        packet.WriteLong(0);
                        packet.WriteLong(0);
                        packet.WriteLong(0);

                        packet.WriteByte(250); // Level

                        short job = 910; // 910 = SGM
                        packet.WriteShort(job);

                        packet.WriteShort(1000); // STR
                        packet.WriteShort(2000); // DEX
                        packet.WriteShort(3000); // INT
                        packet.WriteShort(4000); // LUK

                        packet.WriteInt(500000); // HP
                        packet.WriteInt(500000); // Max HP
                        packet.WriteInt(500000); // MP
                        packet.WriteInt(500000); // Max MP

                        packet.WriteShort(0); // AP
                        if (IsExtendedSPJob(job)) packet.WriteByte(0);
                        else packet.WriteShort(0);

                        packet.WriteLong(123456789); // EXP
                        packet.WriteInt(0xBADF00D); // Fame

                        packet.WriteInt(10000); // Gacha EXP
                        packet.WriteInt(0); // V.141 unk

                        packet.WriteInt(pToMapID); // GM map
                        packet.WriteByte(0); // Map pos

                        packet.WriteInt(0); // Unk?

                        packet.WriteShort(0); // Job sub ID?

                        if (job / 100 == 31 || job / 100 == 36 || job == 3001 || job == 3002)
                        {
                            packet.WriteInt(1012278);
                        }

                        packet.WriteByte(0); // Fatigue

                        packet.WriteInt(int.Parse(DateTime.Now.ToString("yyyyMMddHH")));

                        // Traits
                        for (int i = 0; i < 6; i++)
                            packet.WriteInt(100 * i);

                        // Traits today
                        for (int i = 0; i < 6; i++)
                            packet.WriteUShort((ushort)(50 * i));

                        // 9 bytes leftover
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteByte(0);


                        packet.WriteInt(0);
                        packet.WriteByte(0);
                        packet.WriteInt(0);
                        packet.WriteByte(0);
                        packet.WriteByte(0);
                        packet.WriteInt(0);
                        packet.WriteByte(0);

                        packet.WriteInt(0);
                        packet.WriteInt(0);

                        packet.WriteInt(0);

                        packet.WriteByte(0);

                        // Parttime jobs
                        for (int i = 1; i <= 9; i++)
                        {

                            packet.WriteInt(0);
                            packet.WriteByte(0);
                            packet.WriteInt(0);
                        }


                        packet.WriteInt(0); // 'reverse' time!
                        packet.WriteInt(0);
                    }


                    packet.WriteByte(100); // Buddylist size

                    packet.WriteBool(false); // Blessings
                    packet.WriteBool(false);
                    packet.WriteBool(false);

                    packet.WriteLong(133713371337); // Mesos

                    packet.WriteInt(0); // Some loop
                    packet.WriteInt(0); // Magic Potions loop

                    {
                        // Inventories

                        for (int i = 0; i < 5; i++)
                            packet.WriteByte(8 * 10); // inventory slots

                        packet.WriteLong(94354848000000000); // Some say it's a date for a quest. I don't believe them

                        // Equips
                        for (int i = 0; i < 3 + 9 + 1; i++)
                        {
                            packet.WriteShort(0); // No items!
                        }

                        // Regular inventories
                        for (int i = 0; i < 4; i++)
                        {
                            packet.WriteByte(0); // No items!
                        }

                        // Bags
                        for (int i = 3; i <= 4; i++)
                        {
                            packet.WriteInt(0);
                        }
                    }

                    packet.WriteInt(0); // Loopies
                    packet.WriteInt(0);

                    // while loop here
                    packet.WriteByte(0); // Stop while loop.

                    {
                        // Skills

                        packet.WriteBool(true);
                        if (true)
                        {
                            packet.WriteShort(0); // No skills
                            packet.WriteShort(0); // No link skills
                        }
                        else
                        {
                            // I aint going to program this..
                        }

                        packet.WriteShort(0); // No cooldowns either
                    }

                    {
                        // Quests
                        bool wut = false;
                        packet.WriteBool(wut);
                        packet.WriteShort(0);

                        if (!wut)
                            packet.WriteShort(0);

                        packet.WriteShort(0);

                        wut = false;
                        packet.WriteBool(wut);
                        packet.WriteShort(0);

                        if (!wut)
                            packet.WriteShort(0);
                    }

                    packet.WriteShort(0); // Match records

                    {
                        // Bunch o rings

                        packet.WriteShort(0); // Couple
                        packet.WriteShort(0); // Friend
                        packet.WriteShort(0); // Marriage
                    }

                    // Tele rocks
                    for (int i = 0; i < 5 + 10 + 13 + 13; i++)
                        packet.WriteInt(999999999);


                    {
                        // Monsterbook

                        packet.WriteInt(0); // Chosen card
                        packet.WriteBool(false); // Method to use; false = old loop
                        packet.WriteShort(0);
                    }

                    packet.WriteInt(-1); // ?

                    packet.WriteShort(0);

                    // Newyear cards
                    packet.WriteShort(0);

                    // PQ data
                    packet.WriteShort(0);

                    // Wildhunter info... no
                    if (false)
                    {
                        packet.WriteByte(1);
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                    }

                    // Finished PQs
                    packet.WriteShort(0);

                    // Some event stuff
                    packet.WriteShort(0);

                    // Stolen skills
                    for (int i = 13; i > 0; i--)
                        packet.WriteInt(0);

                    // Chosen skills?
                    for (int i = 4; i > 0; i--)
                        packet.WriteInt(0);

                    // Inner stats
                    packet.WriteShort(0);

                    {
                        // Unknown stuff
                        packet.WriteInt(0);

                        packet.WriteByte(0);
                    }


                    // Honour info
                    packet.WriteInt(1337); // Level
                    packet.WriteInt(0); // EXP

                    {
                        // More unknown stuffs :(
                        packet.WriteByte(1); // Use first loop
                        packet.WriteShort(0); // End loop
                    }

                    packet.WriteBool(false); // Item decode if true

                    {
                        packet.WriteInt(1680023);
                        packet.WriteInt(1680024);
                        packet.WriteInt(1680025);
                        packet.WriteByte(1);
                    }

                    {
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteLong(94354848000000000);
                    }

                    {
                        // Evolution Cores
                        packet.WriteShort(0);
                        packet.WriteShort(0);
                    }

                    packet.WriteByte(0);

                    {
                        // Farm info
                        packet.WriteString("Creating...");
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteInt(0);

                        packet.WriteByte(0);

                        packet.WriteInt(0);
                        packet.WriteInt(0);
                        packet.WriteInt(0);

                        packet.WriteInt(0);
                        packet.WriteInt(0);
                    }

                    packet.WriteBool(false); // More item decode thingies

                    {
                        packet.WriteInt(0);
                        packet.WriteLong(94354848000000000);
                        packet.WriteInt(0);
                    }

                    {
                        // Decodes 84 bytes

                        packet.WriteInt(1257960);
                        // 4
                        for (int i = 0; i < 64; i += 8)
                            packet.WriteLong(0);
                        // 68
                        packet.WriteShort(0);
                        packet.WriteByte(0);
                        // 71

                        // Ohkay
                        packet.WriteLong(DateTime.Now.ToFileTime());
                        // 79

                        packet.WriteInt(0);
                        packet.WriteByte(1);
                        // 84
                    }

                    packet.WriteByte(0);

                    // loop...
                    packet.WriteShort(0);

                    {
                        packet.WriteInt(9995561);
                        packet.WriteInt(2027067);
                        packet.WriteInt(4);
                        packet.WriteInt(0);

                        for (int i = 0; i < 4; i++)
                        {
                            packet.WriteInt(9410165 + i);
                            packet.WriteInt(i * 1000);
                        }
                    }

                    {
                        // Bulk info
                        packet.WriteInt(0);
                    }
                }
            }
            else
            {
                packet.WriteByte(0);

                packet.WriteInt(pToMapID); // Mapid
                packet.WriteByte(0); // Mapppos

                packet.WriteInt(13371337); // HP

                packet.WriteBool(false);
            }


            packet.WriteLong(DateTime.Now.ToFileTime());
            packet.WriteInt(100);
            packet.WriteByte(0);
            packet.WriteByte(0);
            packet.WriteByte(1);

            pSession.SendPacket(packet);
        }
Exemple #6
0
        public void SendHandshake(ushort pVersion, string pPatchLocation, byte pLocale)
        {
            _encryptIV = new byte[4];
            rnd.NextBytes(_encryptIV);
            _decryptIV = new byte[4];
            rnd.NextBytes(_decryptIV);

            Packet packet = new Packet();
            packet.WriteUShort(pVersion);
            packet.WriteString(pPatchLocation);
            packet.WriteBytes(_decryptIV);
            packet.WriteBytes(_encryptIV);
            packet.WriteByte(pLocale);
            SendPacket(packet);
            _mapleVersion = pVersion;
            _maplePatchLocation = pPatchLocation;
            _mapleLocale = pLocale;


            _rijndaelAES.Key = GMSKeys.GetKeyForVersion(_mapleVersion);
            _rijndaelAES.Mode = CipherMode.ECB;
            _rijndaelAES.Padding = PaddingMode.PKCS7;
            _transformer = _rijndaelAES.CreateEncryptor();
        }
Exemple #7
0
 private void WriteFlaggedValue(Packet pPacket, uint pFlag, ushort pValue, ref uint pOutputFlag)
 {
     if (pValue == 0) return;
     pPacket.WriteUShort(pValue);
     pOutputFlag |= pFlag;
 }
Exemple #8
0
        public override void Write(Packet pPacket)
        {
            base.Write(pPacket);

            if (this.SocketState != 0)
            {
                this.SocketState |= 0x0001;
            }

            {
                // flags 1
                uint flag = 0;
                int tmp = pPacket.Position;
                pPacket.WriteInt(0);

                // this\.([a-zA-Z]+) = FlaggedValue\(pConnection, this\.ItemID, flag, 0x([0-9]+), pPacket, this\.([a-zA-Z]+)\);
                // WriteFlaggedValue\(pPacket, 0x\2, this.\1, ref flag\);

                WriteFlaggedValue(pPacket, 0x00000001, this.Slots, ref flag);
                WriteFlaggedValue(pPacket, 0x00000002, this.Scrolls, ref flag);
                WriteFlaggedValue(pPacket, 0x00000004, this.Str, ref flag);
                WriteFlaggedValue(pPacket, 0x00000008, this.Dex, ref flag);
                WriteFlaggedValue(pPacket, 0x00000010, this.Int, ref flag);
                WriteFlaggedValue(pPacket, 0x00000020, this.Luk, ref flag);
                WriteFlaggedValue(pPacket, 0x00000040, this.HP, ref flag);
                WriteFlaggedValue(pPacket, 0x00000080, this.MP, ref flag);
                WriteFlaggedValue(pPacket, 0x00000100, this.Watk, ref flag);
                WriteFlaggedValue(pPacket, 0x00000200, this.Matk, ref flag);
                WriteFlaggedValue(pPacket, 0x00000400, this.Wdef, ref flag);
                WriteFlaggedValue(pPacket, 0x00000800, this.Mdef, ref flag);
                WriteFlaggedValue(pPacket, 0x00001000, this.Acc, ref flag);
                WriteFlaggedValue(pPacket, 0x00002000, this.Avo, ref flag);
                WriteFlaggedValue(pPacket, 0x00004000, this.Hands, ref flag);
                WriteFlaggedValue(pPacket, 0x00008000, this.Speed, ref flag);
                WriteFlaggedValue(pPacket, 0x00010000, this.Jump, ref flag);
                WriteFlaggedValue(pPacket, 0x00020000, this.Flags, ref flag);

                WriteFlaggedValue(pPacket, 0x00040000, this.IncreasesSkills, ref flag);

                WriteFlaggedValue(pPacket, 0x00080000, this.ItemLevel, ref flag);
                WriteFlaggedValue(pPacket, 0x00100000, this.ItemEXP, ref flag);


                WriteFlaggedValue(pPacket, 0x00200000, this.Durability, ref flag);
                WriteFlaggedValue(pPacket, 0x00400000, this.ViciousHammer, ref flag);

                WriteFlaggedValue(pPacket, 0x00800000, this.BattleModeDamage, ref flag);

                // FlaggedValue\(pConnection, this\.ItemID, flag, 0x([0-9]+), pPacket, \(([a-zA-Z]+)\)(0), true\);
                // WriteFlaggedValue\(pPacket, 0x\1, \(\2\)\3, ref flag\);

                WriteFlaggedValue(pPacket, 0x01000000, this.EquipmentLevelReduction, ref flag); // Item level changer?
                WriteFlaggedValue(pPacket, 0x02000000, (short)0, ref flag); // Enhancement buff?
                WriteFlaggedValue(pPacket, 0x04000000, this.SecondDurability, ref flag); // Second durability
                WriteFlaggedValue(pPacket, 0x08000000, (byte)0, ref flag); // Required level changer?!
                WriteFlaggedValue(pPacket, 0x10000000, (byte)0, ref flag); // Yggdrasil Wisdom? | If higher than 1, 'Success'
                WriteFlaggedValue(pPacket, 0x20000000, (byte)0, ref flag); // Final Strike? | If higher than 1, 'Success'

                WriteFlaggedValue(pPacket, 0x40000000, this.BossDamageRate, ref flag);
                WriteFlaggedValue(pPacket, 0x80000000, this.IgnoreDamageRate, ref flag);

                pPacket.SetUInt(tmp, flag);
            }

            {
                // flags 2
                uint flag = 0;
                int tmp = pPacket.Position;
                pPacket.WriteInt(0);

                WriteFlaggedValue(pPacket, 0x01, this.TotalDamagePercentage, ref flag);
                WriteFlaggedValue(pPacket, 0x02, this.AllStatsPercentage, ref flag);
                WriteFlaggedValue(pPacket, 0x04, this.MaxScissors, ref flag);
                WriteFlaggedValue(pPacket, 0x08, (long)0, ref flag);
                WriteFlaggedValue(pPacket, 0x10, (int)0, ref flag);

                pPacket.SetUInt(tmp, flag);
            }

            pPacket.WriteString(this.Name);
            pPacket.WriteUShort(this.StatusFlags);


            pPacket.WriteUShort(this.Potential1);
            pPacket.WriteUShort(this.Potential2);
            pPacket.WriteUShort(this.Potential3);

            pPacket.WriteUShort(this.Potential4);
            pPacket.WriteUShort(this.Potential5);
            pPacket.WriteUShort(this.Potential6);

            pPacket.WriteUShort(this.DisplayID);

            pPacket.WriteUShort(this.SocketState);
            pPacket.WriteShort(this.Nebulite1);
            pPacket.WriteShort(this.Nebulite2);
            pPacket.WriteShort(this.Nebulite3);

            // If cash id
            pPacket.WriteLong(this.UniqueID);

            pPacket.WriteLong(0);
            pPacket.WriteInt(-1);

        }