Example #1
0
 public static OutPacket GetCharInfo(MapleCharacter chr)
 {
     using (var packet = new OutPacket(SendOpcodes.WarpToMap))
     {
         packet.WriteInt(chr.Client.ChannelId);
         packet.WriteByte(0x00);
         packet.WriteByte(0x01);
         packet.WriteByte(0x01);
         packet.WriteShort(0);
         packet.WriteInt((int)(Randomizer.NextDouble() * 10));
         packet.WriteLong(DateUtiliy.GetFileTimestamp(DateTime.Now.GetTimeMilliseconds()));
         packet.WriteLong(-1);
         packet.WriteByte(0x00);
         LoginPacket.AddCharStats(packet, chr);
         packet.WriteByte((byte)chr.Buddies.Capacity);
         PacketCreator.AddInventoryInfo(packet, chr);
         PacketCreator.AddSkillRecord(packet, chr);
         PacketCreator.AddQuestRecord(packet, chr);
         PacketCreator.AddRingInfo(packet, chr);
         PacketCreator.AddTeleportRockRecord(packet, chr);
         packet.WriteShort(0);
         packet.WriteLong(0);
         packet.WriteByte(0x00);
         packet.WriteInt(0);
         packet.WriteLong(DateUtiliy.GetFileTimestamp(DateTime.Now.GetTimeMilliseconds()));
         return(packet);
     }
 }
Example #2
0
        public static void getInvenMoney(Client c, int money, int pickup)
        {
            using (OutPacket plew = new OutPacket(ServerOpcode.INVEN_MONEY))
            {
                plew.WriteInt(0); // length + CRC
                plew.WriteInt(0);
                plew.WriteLong(money);
                plew.WriteLong(pickup);

                c.Send(plew);
            }
        }
Example #3
0
        public static void Refresh(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Hooked guild.Refresh with null of activeCharacter");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            OutPacket op = new OutPacket(40);

            op.WriteInt(40);
            op.WriteShort(5);
            op.WriteShort(0x41);
            op.WriteInt(1);
            op.WriteShort(13413);
            c.WriteRawPacket(op.ToArray());

            op = new OutPacket(32);
            op.WriteInt(32);
            op.WriteShort(4);
            op.WriteShort(97);
            op.WriteInt(1);
            op.WriteShort(-15349);
            op.WriteShort((short)chr.getuID());
            op.WriteLong();
            op.WriteLong();
            c.WriteRawPacket(op.ToArray());

            op = new OutPacket(136);
            op.WriteInt(136);
            op.WriteShort(4);
            op.WriteShort(81);
            op.WriteInt(1);
            op.WriteShort(-15349);
            op.WriteShort((short)chr.getuID());
            op.WriteShort(1);
            op.WriteShort(30726);
            op.WriteString("PolishPoverty");
            c.WriteRawPacket(op.ToArray());

            op = new OutPacket(20);
            op.WriteInt(20);
            op.WriteInt(5);
            op.WriteInt(937683714);             // those values.. lelellele
            op.WriteInt(680);
            op.WriteInt(939117056);
            c.WriteRawPacket(op.ToArray());
        }
Example #4
0
 public static void AddCharacterData(OutPacket p, Character c)
 {
     p.WriteInt(c.CharId);
     p.WritePaddedString(c.Name, 13);
     p.WriteByte(c.Gender);
     p.WriteByte(c.SkinColor);
     p.WriteInt(c.Face);
     p.WriteInt(c.Hair);
     p.WriteLong(); //pet
     p.WriteByte(c.Level);
     p.WriteShort(c.Job);
     p.WriteShort(c.Str);
     p.WriteShort(c.Dex);
     p.WriteShort(c.Int);
     p.WriteShort(c.Luk);
     p.WriteShort(c.HP);
     p.WriteShort(c.MaxHP);
     p.WriteShort(c.MP);
     p.WriteShort(c.MaxMP);
     p.WriteShort(c.AP);
     p.WriteShort(c.SP);
     p.WriteInt(c.EXP);
     p.WriteShort(c.Fame);
     p.WriteInt(c.MapId);
     p.WriteByte(c.SpawnPoint);
     p.WriteZero(16);
 }
Example #5
0
 public static void GameLog(Client c, int CharacterID)
 {
     using (var plew = new OutPacket(MessengerServerOpcode.MSG_GAMELOG))
     {
         plew.WriteInt(0); // length + CRC
         plew.WriteInt(0);
         plew.WriteInt(CharacterID);
         plew.WriteLong(0);
         c.Send(plew);
     }
 }
Example #6
0
        public static void AddCharStats(OutPacket p, MapleCharacter chr)
        {
            p.WriteInt(chr.Id); // character id
            p.WriteString(chr.Name);
            // 填充名字字符
            // p.WriteZero(13 - Encoding.Default.GetByteCount(chr.CharacterName));
            for (var x = Encoding.Default.GetByteCount(chr.Name); x < 13; x++)
            {
                // fill to maximum name length
                p.WriteByte(0);
            }

            p.WriteBool(chr.Gender);       // gender (0 = male, 1 = female)
            p.WriteByte(chr.Skin.ColorId); // skin color
            p.WriteInt(chr.Face);          // face
            p.WriteInt(chr.Hair);          // hair
            p.WriteLong(0);
            p.WriteLong(0);
            p.WriteLong(0);
            p.WriteByte(chr.Level);        // level
            p.WriteShort(chr.Job.JobId);   // job
            p.WriteShort(chr.Str);         // str
            p.WriteShort(chr.Dex);         // dex
            p.WriteShort(chr.Int);         // int
            p.WriteShort(chr.Luk);         // luk
            p.WriteShort(chr.Hp);          // hp (?)
            p.WriteShort(chr.MaxHp);       // maxhp
            p.WriteShort(chr.Mp);          // mp (?)
            p.WriteShort(chr.MaxMp);       // maxmp
            p.WriteShort(chr.RemainingAp); // remaining ap
            p.WriteShort(chr.RemainingSp); // remaining sp
            p.WriteInt(chr.Exp.Value);     // current exp
            p.WriteShort(chr.Fame);        // fame
            p.WriteInt(0);
            p.WriteLong(DateUtiliy.GetFileTimestamp(DateTime.Now.GetTimeMilliseconds()));
            p.WriteInt(chr.Map?.MapId ?? 10000); // current map id
            p.WriteByte(chr.InitialSpawnPoint);  // spawnpoint
        }
Example #7
0
        public static byte[] MigrateIn()
        {
            using (OutPacket p = new OutPacket(SendOps.MigrateIn))
            {
                p.WriteInt(6); // TODO: World ID.
                p.WriteInt(MapleConnection.User.ID);
                p.WriteHexString("00 30 67 62 18 18");
                p.WriteInt(MapleConnection.User.HardwareID_1);
                p.WriteInt();
                p.WriteInt(MapleConnection.User.HardwareID_2);
                p.WriteLong(MapleConnection.User.SessionID);

                return(p.ToArray());
            }
        }
Example #8
0
        public static byte[] Login(string password, string authenticationToken)
        {
            using (OutPacket p = new OutPacket(SendOps.Login))
            {
                p.WriteString(password);
                p.WriteString(authenticationToken);
                p.WriteInt();
                p.WriteShort();
                p.WriteInt(MapleConnection.User.HardwareID_1);
                p.WriteInt();
                p.WriteInt(MapleConnection.User.HardwareID_2);
                p.WriteShort();
                p.WriteLong(2);

                return(p.ToArray());
            }
        }
Example #9
0
        public static void OnMigrateIn(MapleClient c, InPacket p)
        {
            int charId = p.ReadInt();

            c.Character = Database.Instance.GetCharacter(charId);
            c.Account   = Database.Instance.GetAccount(c.Character.AccountId);
            c.LoggedIn  = true;

            using (OutPacket packet = new OutPacket(SendOps.SetField))
            {
                packet.WriteInt(c.Channel);
                packet.WriteByte();         //pcount
                packet.WriteBool(true);     //new channel

                for (int i = 0; i < 3; i++) //rand seeds
                {
                    packet.WriteInt(Randomizer.Generate());
                }

                packet.WriteInt();
                packet.WriteShort(-1); // Flags (contains everything: 0xFFFF)

                PacketCreator.Helper.AddCharacterData(packet, c.Character);

                packet.WriteByte(20); //Buddylist

                PacketCreator.Helper.AddInventory(packet, c.Character);

                packet.WriteShort(); //skills
                packet.WriteShort(); //quests
                packet.WriteShort(); //rps
                packet.WriteShort(); //rings

                foreach (int rock in c.Character.TeleportRock)
                {
                    packet.WriteInt(rock);
                }

                packet.WriteLong(64); //padding

                c.Send(packet);
            }
        }
Example #10
0
        public static void Game_Log_Ack(Client c, int characterID)
        {
            using (OutPacket plew = new OutPacket(ServerOpcode.GAMELOG))
            {
                plew.WriteInt(0); // length + CRC
                plew.WriteInt(0);
                plew.WriteInt(characterID);
                plew.WriteInt(ServerConstants.CLIENT_VERSION);
                plew.WriteInt(14199);
                plew.WriteInt(57429138); // TimeLogin
                plew.WriteByte(byte.Parse(c.Title.Split('.')[0]));
                plew.WriteByte(byte.Parse(c.Title.Split('.')[1]));
                plew.WriteByte(byte.Parse(c.Title.Split('.')[2]));
                plew.WriteByte(byte.Parse(c.Title.Split('.')[3]));
                plew.WriteLong(c.SessionID); // Key

                c.Send(plew);
            }
        }
Example #11
0
 public static OutPacket AuthSuccess(string username, int accountId, bool gender)
 {
     using (var packet = new OutPacket(SendOpcodes.LoginStatus))
     {
         packet.WriteByte(0x00);
         packet.WriteInt(accountId);
         packet.WriteBool(gender);
         packet.WriteShort(0);
         packet.WriteMapleString(username);
         packet.WriteBytes(new byte[]
                           { 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, 0xE2, 0xED, 0xA3, 0x7A, 0xFA, 0xC9, 0x01 });
         packet.WriteInt(0);
         packet.WriteLong(0);
         packet.WriteMapleString(accountId.ToString());
         packet.WriteMapleString(username);
         packet.WriteByte(0x01);
         return(packet);
     }
 }
Example #12
0
        public static void SellToNPC(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Attempted to hook sellToNPC while not being ingame.");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            byte[] decrypted = p.ReadBytes(9);

            Item item = new Item();

            if (!chr.getInventory().sellItem(decrypted[5], decrypted[8], item))
            {
                Console.WriteLine("sell to npc teh problemz");
                return;
            }

            if (payedItems.Contains(item.getItemID()))
            {
                ItemData itemData  = ItemDataCache.Instance.getItemData(item.getItemID());
                int      itemPrice = itemData.getNpcPrice() * decrypted[8];
                chr.setCoin(chr.getCoin() + itemPrice);
            }

            OutPacket op = new OutPacket(32);

            op.WriteInt(32);
            op.WriteShort(0x04);
            op.WriteShort(0x14);
            op.WriteInt(0x01);
            op.WriteInt(chr.getuID());
            op.WriteShort(0x01);
            op.WriteByte(0x01);
            op.WriteByte(decrypted[5]);
            op.WriteInt(decrypted[8]);
            op.WriteLong(chr.getCoin());
            c.WriteRawPacket(op.ToArray());
        }
Example #13
0
        public void Encode(OutPacket oPacket, long flag = long.MaxValue)
        {
            oPacket
                .WriteLong(flag)
                .WriteByte(); // NOTE: Unknown.

            this.Stats.Encode(oPacket);

            oPacket
                .WriteByte(20) // NOTE: Max buddylist size.
                .WriteBool(false) // NOTE: Blessing of Fairy.
                .WriteInt(); // NOTE: Mesos.

            this.Items.Encode(oPacket);
            this.Skills.Encode(oPacket);
            this.Quests.Encode(oPacket);

            oPacket
                .WriteShort() // NOTE: Mini games record.
                .WriteShort() // NOTE: Rings (1).
                .WriteShort() // NOTE: Rings (2). 
                .WriteShort(); // NOTE: Rings (3).

            // NOTE: Teleport rock locations.
            for (int i = 0; i < 15; i++)
            {
                oPacket.WriteInt(999999999);
            }

            oPacket
                .WriteInt() // NOTE: Monster book cover ID.
                .WriteByte() // NOTE: Unknown.
                .WriteShort() // NOTE: Monster book cards count.
                .WriteShort() // NOTE: New year cards.
                .WriteShort() // NOTE: Area information.
                .WriteShort(); // NOTE: Unknown.
        }
Example #14
0
        public static void BuyFromNPC(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.CreateCharacter, c, "Attempted to hook a NPC open while not being ingame.");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            byte[] decrypted = p.ReadBytes(9);

            int npcID = BitConverter.ToInt32(decrypted, 0);

            if (WMap.Instance.getNpcs().ElementAtOrDefault(npcID) == null)
            {
                Logger.LogCheat(Logger.HackTypes.NPC, c, "Tried to hook NPC of uID {0}", npcID);
                return;
            }

            NPC npc = WMap.Instance.getNpcs()[npcID];

            OutPacket op = new OutPacket(56);

            op.WriteInt(56);
            op.WriteShort(4);
            op.WriteShort(19);
            op.WriteInt(1);
            op.WriteInt(c.getAccount().activeCharacter.getuID());

            if (decrypted[8] != 0)
            {
                int itemID = NPCDataCache.Instance.getNPCDataByuID(npcID, chr.getMap()).getItemFromSlot(decrypted[4]);
                if (itemID == -1)
                {
                    Console.WriteLine("Somebody tried to buy not existing item");
                    return;
                }

                ItemData itemData = ItemDataCache.Instance.getItemData(itemID);
                if (itemData == null)
                {
                    Console.WriteLine("Tried to buy not existing item");
                    return;
                }

                Item item = new Item(itemID, decrypted[8]);

                int itemPrice = 0;
                if (payedItems.Contains(itemData.getID()))
                {
                    itemPrice = itemData.getNpcPrice() * decrypted[8];
                    if (chr.getCoin() < itemPrice)
                    {
                        Console.WriteLine("Tried to buy free Gold Bars :3");
                        return;
                    }
                }

                Console.WriteLine("line {0} row {1}", decrypted[7], decrypted[6]);
                if (!chr.getInventory().buyItem(item, decrypted[7], decrypted[6]))
                {
                    Console.WriteLine("npc.. something went wrong");
                    return;
                }

                chr.setCoin(chr.getCoin() - itemPrice);

                op.WriteLong(chr.getCoin());
                op.WriteShort(0x01);
                op.WriteByte(decrypted[5]);
                op.WriteByte(decrypted[6]);
                op.WriteByte(decrypted[7]);
                op.WriteByte(chr.getVp());                 // vending points (?)
                op.WriteZero(18);
                op.WriteInt(itemID);
                op.WriteByte(decrypted[8]);
            }
            else
            {
                op.WriteInt(npcID);
                op.WriteInt();
                op.WriteInt(0x01);
                op.WriteInt();
                op.WriteInt();
                op.WriteInt(0);                 // -100% extra charge => free buying
                op.WriteInt(8388608);           // -100% discount => free selling
                op.WriteByte(0x80);
                op.WriteByte(0x3f);
                //op.WriteLong(1294138); // looks like.. areaID? for sure not modelID, or other shit, just the second short looks familiar
                //op.WriteLong(1); // must be 1 to open the shop o.o
                //op.WriteInt(64); // 0% ?
                //op.WriteInt(1065353216); // -100% extra charge => free buying
                //op.WriteInt(1065353216); // -100% discount => free selling

                /* IN TWO WORDS -> WEIRD SHIT HERE */
            }

            c.WriteRawPacket(op.ToArray());
        }
Example #15
0
        public static void AddCharLook(OutPacket p, MapleCharacter chr, bool mega)
        {
            p.WriteBool(chr.Gender);
            p.WriteByte(chr.Skin.ColorId); // skin color
            p.WriteInt(chr.Face);          // face
            p.WriteBool(!mega);
            p.WriteInt(chr.Hair);          // hair

            var equip       = chr.Inventorys[MapleInventoryType.Equipped.Value];
            var myEquip     = new Dictionary <byte, int>();
            var maskedEquip = new Dictionary <byte, int>();

            lock (equip)
            {
                foreach (var item in equip.Inventory.Values)
                {
                    var pos = item.Position;
                    if (pos > 0x9C && !myEquip.ContainsKey(pos))
                    {
                        if (myEquip.ContainsKey(pos))
                        {
                            myEquip[pos] = item.ItemId;
                        }
                        else
                        {
                            myEquip.Add(pos, item.ItemId);
                        }
                    }
                    else if ((pos < 0x9C || pos == 128) && pos != 0x91)
                    {
                        pos -= 100;
                        if (myEquip.ContainsKey(pos))
                        {
                            if (maskedEquip.ContainsKey(pos))
                            {
                                maskedEquip[pos] = myEquip[pos];
                            }
                            else
                            {
                                maskedEquip.Add(pos, myEquip[pos]);
                            }

                            myEquip[pos] = item.ItemId;
                        }
                        else
                        {
                            myEquip.Add(pos, item.ItemId);
                        }
                    }
                    else if (myEquip.ContainsKey(pos))
                    {
                        if (maskedEquip.ContainsKey(pos))
                        {
                            maskedEquip[pos] = myEquip[pos];
                        }
                        else
                        {
                            maskedEquip.Add(pos, myEquip[pos]);
                        }
                    }
                }

                foreach (var entry in myEquip)
                {
                    p.WriteByte((byte)(256 - entry.Key));
                    p.WriteInt(entry.Value);
                }
                p.WriteByte(0xFF);

                foreach (var entry in maskedEquip)
                {
                    p.WriteByte((byte)(256 - entry.Key));
                    p.WriteInt(entry.Value);
                }
                p.WriteByte(0xFF);

                IMapleItem cWeapon;
                p.WriteInt(equip.Inventory.TryGetValue(145, out cWeapon) ? cWeapon.ItemId : 0);
            }
            p.WriteInt(0);
            p.WriteLong(0);
        }
Example #16
0
        // TODO: Beautify this.
        public void Encode(OutPacket oPacket)
        {
            for (byte i = 1; i < mItems.Length; i++)
            {
                oPacket.WriteByte((byte)mItems[i].Length);
            }

            oPacket.WriteLong(); // NOTE: Unknown.

            for (short i = 1; i < mEquipped.Length; i++)
            {
                if (mEquipped[i] != null)
                {
                    oPacket.WriteShort(i); mEquipped[i].Encode(oPacket);
                }
            }
            oPacket.WriteShort();

            for (short i = 1; i < mCashEquipped.Length; i++)
            {
                if (mCashEquipped[i] != null)
                {
                    oPacket.WriteShort(i); mCashEquipped[i].Encode(oPacket);
                }
            }
            oPacket.WriteShort();

            for (short i = 1; i < mItems[(byte)InventoryType.Equipment].Length; i++)
            {
                if (mItems[(byte)InventoryType.Equipment][i] != null)
                {
                    oPacket.WriteShort(i); mItems[(byte)InventoryType.Equipment][i].Encode(oPacket);
                }
            }
            oPacket.WriteShort();

            // TODO: Evan inventory.
            oPacket.WriteShort();

            for (byte i = 1; i < mItems[(byte)InventoryType.Usable].Length; i++)
            {
                if (mItems[(byte)InventoryType.Usable][i] != null)
                {
                    oPacket.WriteByte(i); mItems[(byte)InventoryType.Usable][i].Encode(oPacket);
                }
            }
            oPacket.WriteByte();

            for (byte i = 1; i < mItems[(byte)InventoryType.Setup].Length; i++)
            {
                if (mItems[(byte)InventoryType.Setup][i] != null)
                {
                    oPacket.WriteByte(i); mItems[(byte)InventoryType.Setup][i].Encode(oPacket);
                }
            }
            oPacket.WriteByte();

            for (byte i = 1; i < mItems[(byte)InventoryType.Etcetera].Length; i++)
            {
                if (mItems[(byte)InventoryType.Etcetera][i] != null)
                {
                    oPacket.WriteByte(i); mItems[(byte)InventoryType.Etcetera][i].Encode(oPacket);
                }
            }
            oPacket.WriteByte();

            for (byte i = 1; i < mItems[(byte)InventoryType.Cash].Length; i++)
            {
                if (mItems[(byte)InventoryType.Cash][i] != null)
                {
                    oPacket.WriteByte(i); mItems[(byte)InventoryType.Cash][i].Encode(oPacket);
                }
            }
            oPacket.WriteByte();
        }
Example #17
0
        public static void setPlayerPosition(Character chr, float goX, float goY, short map)
        {
            MartialClient c = chr.getAccount().mClient;

            Logger.WriteLog(Logger.LogTypes.Debug, goX + " | " + goY + " | " + map);

            Area lastArea = chr.getArea();
            Area newArea  = WMap.Instance.getGrid(map).getAreaByRound(goX, goY);

            if (newArea == null)
            {
                StaticPackets.sendSystemMessageToClient(chr.getAccount().mClient, 1, "The position " + goX + "|" + goY + "|" + map + " can't be reached.");
                Waypoint closestTown = TownCoordsCache.Instance.getClosestWaypointForMap(map, new Waypoint(goX, goY));
                if (closestTown == null)
                {
                    Area vvArea = WMap.Instance.getGrid(1).getAreaByRound(-1660, 2344);
                    if (vvArea == null)
                    {
                        Logger.WriteLog(Logger.LogTypes.Error, "Pure setPlayerPosition error {0}|{1}|{2}", goX, goY, map);
                        StaticPackets.sendSystemMessageToClient(chr.getAccount().mClient, 1, "We're sorry, but an hard error has occured. Please report it to an admin.");
                        c.Close();
                        return;
                    }
                    else
                    {
                        goX     = -1660;
                        goY     = 2344;
                        map     = 1;
                        newArea = vvArea;
                    }
                }
                else
                {
                    goX     = closestTown.getX();
                    goY     = closestTown.getY();
                    newArea = WMap.Instance.getGrid(map).getAreaByRound(goX, goY);
                }
            }

            if (lastArea != null)
            {
                WMap.Instance.getGrid(chr.getMap()).sendTo3x3AreaLeave(chr, lastArea);
                lastArea.removeCharacter(chr);
            }

            if (newArea != null)
            {
                chr.setArea(newArea);
            }
            else
            {
                chr.getAccount().mClient.Close();
                return;
            }

            newArea.addCharacter(chr);

            chr.setMap(map);
            chr.setPosition(new float[] { goX, goY });

            OutPacket op = new OutPacket(5840);

            op.WriteInt(5824);
            op.WriteShort(4);                                                          // 4 - 5
            op.WriteShort(1);                                                          // 6 - 7
            op.WriteInt(1);                                                            // 8 - 11
            op.WriteInt(chr.getuID());                                                 // 12 - 15
            op.WriteShort(1);                                                          // 16 - 19
            op.WriteShort(1);                                                          // 16 - 19
            op.WriteInt(chr.getMap());                                                 // 20 - 23
            op.WriteInt(DateTime.Now.Year - 2000);                                     // 24 - 27
            op.WriteByte((byte)DateTime.Now.Month);                                    // 28
            op.WriteByte(DateTime.Now.Day > 30 ? (byte)0x1e : (byte)DateTime.Now.Day); // 29
            op.WriteInt(DateTime.Now.Hour);                                            // 30 - 37

            for (int i = 0; i < 120; i++)
            {
                if (chr.getCargo().getSeqSaved()[i] != -1 && chr.getCargo().getCargoSaved()[chr.getCargo().getSeqSaved()[i]] != null)
                {
                    op.WriteInt();
                    op.WriteByte((byte)(chr.getCargo().getSeqSaved()[i] / 100));
                    op.WriteByte((byte)(chr.getCargo().getSeqSaved()[i] % 100));
                    Item item = chr.getCargo().getCargoSaved()[chr.getCargo().getSeqSaved()[i]];
                    op.WriteInt(item.getItemID());
                    ItemData itemData = ItemDataCache.Instance.getItemData(item.getItemID());
                    if (itemData.getTimeToExpire() > 0)
                    {
                    }
                    op.WriteShort(item.getQuantity());
                }
                else
                {
                    op.WriteZero(12);
                }
            }             // 38 - 1477

            op.Position = 1476;

            for (int i = 0; i < chr.getCommunity().getFriendsList().Capacity; i++)
            {
                if (chr.getCommunity().getFriendsList().ElementAtOrDefault(i) != null)
                {
                    op.WritePaddedString(chr.getCommunity().getFriendsList()[i], 17);
                }
                else
                {
                    op.WriteZero(17);
                }
            }             // 1476 - 1934

            op.WriteRepeatedByte(0x58, 40);

            op.Position = 1986;

            for (int i = 0; i < chr.getCommunity().getIgnoresList().Capacity; i++)
            {
                if (chr.getCommunity().getIgnoresList().ElementAtOrDefault(i) != null)
                {
                    op.WritePaddedString(chr.getCommunity().getIgnoresList()[i], 17);
                }
                else
                {
                    op.WriteZero(17);
                }
            }                 // 1987 - 2157

            op.WriteInt(363); // questsy
            op.WriteLong();
            op.WriteLong(138769276674441706);
            op.WriteLong(21692910);
            op.WriteShort();
            op.WriteShort(1);

            op.Position = 2248;

            for (byte i = 0; i < 240; i++)
            {
                if (chr.getInventory().getSeqSaved()[i] != -1 && chr.getInventory().getInvSaved()[chr.getInventory().getSeqSaved()[i]] != null)
                {
                    op.WriteShort();
                    op.WriteByte((byte)(chr.getInventory().getSeqSaved()[i] / 100));
                    op.WriteByte((byte)(chr.getInventory().getSeqSaved()[i] % 100));
                    Item item = chr.getInventory().getInvSaved()[chr.getInventory().getSeqSaved()[i]];
                    op.WriteInt(item.getItemID());
                    op.WriteInt(item.getQuantity());
                }
                else
                {
                    op.WriteZero(12);
                }
            }             // 2252 - 5133

            op.WriteLong(chr.getCoin());

            op.Position = 5140;

            for (byte i = 0; i < 21; i++)
            {
                if (chr.getSkillBar().getSkillBar().ContainsKey(i))
                {
                    int barID = chr.getSkillBar().getSkillBar()[i];
                    if (barID > 200000000)
                    {
                        op.WriteInt(1);
                    }
                    else if (barID > 511)
                    {
                        op.WriteInt(5); barID -= 512;
                    }
                    else if (barID > 255)
                    {
                        op.WriteInt(6); barID -= 256;
                    }
                    else
                    {
                        SkillData skill = SkillDataCache.Instance.getSkill(chr.getSkills().getLearnedSkills().ElementAtOrDefault(barID));
                        if (skill == null)
                        {
                            op.WriteInt(0);
                        }
                        else if (skill.getTypeSpecific() == 6)
                        {
                            op.WriteInt(3);
                        }
                        else if (skill.getTypeSpecific() == 7)
                        {
                            op.WriteInt(4);
                        }
                        else
                        {
                            op.WriteInt(2);
                        }
                    }
                    op.WriteInt(barID);
                }
                else
                {
                    op.WriteZero(8);
                }
            }             // 5140 - 5299

            op.Position = 5320;

            for (int i = 0; i < 60; i++)
            {
                if (chr.getSkills().getLearnedSkills().Count > i && chr.getSkills().getLearnedSkills()[i] != 0)
                {
                    op.WriteInt(chr.getSkills().getLearnedSkills()[i]);
                    op.WriteInt(SkillDataCache.Instance.getSkill(chr.getSkills().getLearnedSkills()[i]).getSkillPoints());
                }
                else
                {
                    op.WriteLong();
                }
            }             // 5320 - 5799

            op.WriteFloat(chr.getPosition()[0]);
            op.WriteFloat(chr.getPosition()[1]);
            op.WriteInt(0x0c);
            op.WriteInt(140338688);
            op.WriteInt();
            op.WriteShort();
            op.WriteShort(10962);

            //s3c0nd p4ck3t
            op.WriteInt(16);
            op.WriteInt(7929861);
            op.WriteInt(chr.getuID());
            c.WriteRawPacket(op.ToArray());

            WMap.Instance.getGrid(chr.getMap()).sendTo3x3AreaSpawn(chr, chr.getArea());
        }