示例#1
0
        private int getStoreID()
        {
            int num = 0;

            while (num < 16)
            {
                MapleItem store = myCharacter.Inventorys[InventoryType.CASH].getItemById(5030000 + num);
                if (store == null)
                {
                    num++;
                }
                else
                {
                    return(store.ID);
                }
            }
            return(0);
        }
示例#2
0
 public void updateItemCount(byte slot, short itemCount, int itemID = 0)
 {
     try
     {
         if (inventory.ContainsKey(slot))
         {
             MapleItem item = inventory[slot];
             item.quantity = itemCount;
         }
         else
         {
             MapleItem item = new MapleItem(itemID, slot, itemCount);
             inventory.Add(slot, item);
         }
     }
     catch (Exception exception)
     {
     }
 }
示例#3
0
        public void addBagItems(PacketReader packet, byte Pos)
        {
            packet.Skip(3);
            MapleItem mapleEquip;
            byte      num = packet.Read();

            if (num == 2)
            {
                mapleEquip = new MapleItem(packet.ReadInt(), (byte)(inventory.Count() + 1), 1);
            }
            else
            {
                return;
            }
            packet.Skip(13);
            if (mapleEquip != null)
            {
                inventory.Add(mapleEquip.position, mapleEquip);
                mapleEquip.quantity = packet.ReadShort();
                packet.ReadShort();
                packet.ReadShort();
            }
        }
示例#4
0
        public void addFromPacket(PacketReader packet, byte Pos, bool Update, Client c)
        {
            MapleItem mapleEquip;

            if (Update && inventory.ContainsKey(Pos))
            {
                inventory.Remove(Pos);
            }
            if (!Update && this.type < InventoryType.USE)
            {
                packet.Read();
            }
            byte num  = packet.Read();
            byte num1 = num;

            switch (num1)
            {
            case 1:
            {
                mapleEquip = new MapleEquip(packet.ReadInt(), Pos);
                break;
            }

            case 2:
            {
                mapleEquip = new MapleItem(packet.ReadInt(), Pos, 1);
                break;
            }

            case 3:
            {
                mapleEquip = null;
                packet.ReadInt();
                break;
            }

            default:
            {
                return;
            }
            }
            //c.updateLog("Adding " + Database.getItemName(mapleEquip.ID));
            bool flag = packet.Read() > 0;

            if (flag)
            {
                if (mapleEquip != null)
                {
                    mapleEquip.cashOID = packet.ReadLong();
                }
                else
                {
                    packet.Skip(8);
                }
            }
            packet.Skip(8);
            packet.Skip(4);
            if (mapleEquip != null)
            {
                if (!inventory.ContainsKey(mapleEquip.position))
                {
                    inventory.Add(mapleEquip.position, mapleEquip);
                }
                if (mapleEquip.type == 1)
                {
                    while (true)
                    {
                        while (true)
                        {
                            if (packet.Read() == 0x4)
                            {
                                int  x        = 0;
                                byte bytes    = 0;
                                bool complete = false;
                                while (true)
                                {
                                    bytes = packet.Read();
                                    if (bytes == 0)
                                    {
                                        x++;
                                    }
                                    else if (bytes == 4)
                                    {
                                        x = 0;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                    if (x >= 3)
                                    {
                                        complete = true;
                                        break;
                                    }
                                }
                                if (complete)
                                {
                                    packet.Read();
                                    break;
                                }
                            }
                            Thread.Sleep(1);
                        }
                        mapleEquip.craftedBy    = packet.ReadMapleString();
                        mapleEquip.potLevel     = packet.Read();
                        mapleEquip.enhancements = packet.Read();
                        int potLine1 = packet.ReadShort();
                        int potLine2 = packet.ReadShort();
                        int potLine3 = packet.ReadShort();
                        if (mapleEquip.potLevel > 0 & mapleEquip.potLevel <= 20)
                        {
                            if (potLine1 < 20000 && potLine2 < 10000 && potLine2 < 10000)
                            {
                                mapleEquip.potline1 = "Rare";
                            }
                            else if (potLine1 < 30000 && potLine2 < 20000 && potLine2 < 20000)
                            {
                                mapleEquip.potline1 = "Epic";
                            }
                            else if (potLine1 < 40000 && potLine2 < 30000 && potLine2 < 30000)
                            {
                                mapleEquip.potline1 = "Unique";
                            }
                            else if (potLine1 < 50000 && potLine2 < 40000 && potLine2 < 40000)
                            {
                                mapleEquip.potline1 = "Legendary";
                            }
                            mapleEquip.potline1 = getPotentialLines((short)potLine1, mapleEquip.potLevel);
                            mapleEquip.potline1 = mapleEquip.potline1.Replace(".", "");
                            mapleEquip.potline2 = getPotentialLines((short)potLine2, mapleEquip.potLevel);
                            mapleEquip.potline2 = mapleEquip.potline2.Replace(".", "");
                            mapleEquip.potline3 = getPotentialLines((short)potLine3, mapleEquip.potLevel);
                            mapleEquip.potline3 = mapleEquip.potline3.Replace(".", "");
                        }
                        short bonuspotline1 = packet.ReadShort();
                        short bonuspotline2 = packet.ReadShort();
                        short bonuspotline3 = packet.ReadShort();
                        packet.ReadShort();
                        mapleEquip.bonuspotLevel = packet.Read();
                        packet.Read();
                        if (mapleEquip.bonuspotLevel > 0 & mapleEquip.bonuspotLevel <= 20)
                        {
                            mapleEquip.bonuspotline1 = getPotentialLines(bonuspotline1, mapleEquip.bonuspotLevel);
                            mapleEquip.bonuspotline1 = mapleEquip.bonuspotline1.Replace(".", "");
                            mapleEquip.bonuspotline2 = getPotentialLines(bonuspotline2, mapleEquip.bonuspotLevel);
                            mapleEquip.bonuspotline2 = mapleEquip.bonuspotline2.Replace(".", "");
                            mapleEquip.bonuspotline3 = getPotentialLines(bonuspotline3, mapleEquip.bonuspotLevel);
                            mapleEquip.bonuspotline3 = mapleEquip.bonuspotline3.Replace(".", "");
                        }
                        short nebulite = packet.ReadShort();
                        if (nebulite >= 0 & nebulite <= 9999)
                        {
                            mapleEquip.nebulite = getNebuliteLine(nebulite);
                        }

                        /*if ((mapleItem.potLevel > 0 & mapleItem.potLevel <= 20) || (mapleItem.bonuspotLevel > 0 & mapleItem.bonuspotLevel <= 20))
                         * {
                         *  MessageBox.Show(
                         *      storeTitle + "\n" +
                         *      mapleItem.potLevel.ToString() + "\n" +
                         *      mapleItem.potline1 + "\n" +
                         *      mapleItem.potline2 + "\n" +
                         *      mapleItem.potline3 + "\n" +
                         *      mapleItem.bonuspotLevel.ToString() + "\n" +
                         *      mapleItem.bonuspotline1 + "\n" +
                         *      mapleItem.bonuspotline2 + "\n" +
                         *      mapleItem.bonuspotline3 + "\n" +
                         *      mapleItem.nebulite + "\n");
                         * }
                         * int y = 0;
                         * //c.updateLog(mapleItem.ID.ToString() + ", " + mapleItem.price.ToString() + ", " + mapleItem.quantity.ToString() + ", " + "Equip");
                         *
                         * while (true)
                         * {
                         *  while (packet.Read() != 255)
                         *  {
                         *  }
                         *  y++;
                         *  if (y == 1)
                         *  {
                         *      packet.Skip(33);
                         *  }
                         *  else if (y != 1 & y < 3)
                         *      packet.Skip(6);
                         *  else
                         *  {
                         *      packet.Skip(3);
                         *      break;
                         *  }
                         * }
                         * */

                        while (true)
                        {
                            while (packet.Read() != 0x40)
                            {
                            }
                            if (packet.Read() == 0xE0)
                            {
                                break;
                            }
                            Thread.Sleep(1);
                        }
                        while (packet.Read() != 0xFF)
                        {
                            Thread.Sleep(1);
                        }
                        packet.Skip(3);


                        while (true)
                        {
                            while (packet.Read() != 0x40)
                            {
                                Thread.Sleep(1);
                            }
                            if (packet.Read() == 0xE0)
                            {
                                break;
                            }
                            Thread.Sleep(1);
                        }
                        while (packet.Read() != 0x01)
                        {
                            Thread.Sleep(1);
                        }
                        packet.Skip(16);



                        break;

                        /*
                         * packet.Skip(30);
                         * while (packet.Read() != 255)
                         * {
                         * }
                         * while (true)
                         * {
                         *  while (packet.Read() != 0x40)
                         *  {
                         *  }
                         *  if (packet.Read() == 0xE0)
                         *  {
                         *      break;
                         *  }
                         * }
                         * while (packet.Read() != 255)
                         * {
                         * }
                         * packet.Skip(3);
                         * break;
                         */
                    }
                    return;
                }
                else
                {
                    mapleEquip.quantity = packet.ReadShort();
                    short num5 = packet.ReadShort();
                    if (num5 != 0)
                    {
                        packet.ReadString(num5);
                    }
                    if (packet.ReadShort() == 0x0C)
                    {
                        mapleEquip.isOpen = true;
                    }
                    if (isRechargable(mapleEquip.ID) || mapleEquip.ID / 10000 == 287)
                    {
                        packet.Skip(8);
                    }
                    return;
                }
            }
            else
            {
                packet.Skip(13);
                packet.Skip(1);
                packet.Skip(2);
                packet.Skip(1);
                packet.Skip(8);
                packet.Skip(2);
                packet.Skip(2);
                packet.Skip(4);
                packet.Skip(2);
                packet.Skip(1);
                packet.Skip(4);
                return;
            }
        }
示例#5
0
 public void addItem(MapleItem item)
 {
     items.Add(item);
 }