private static void HandleSelectItemBox(GameSession session, PacketReader packet, Item item)
        {
            short boxType = packet.ReadShort();
            int   index   = packet.ReadShort() - 0x30;

            ItemBoxHelper.GiveItemFromSelectBox(session, item, index);
        }
    private static void HandleSelectBox(GameSession session, IReadOnlyCollection <Item> items, int index, int amount)
    {
        int           opened = 0;
        OpenBoxResult result = OpenBoxResult.Success;

        foreach (Item item in items)
        {
            for (int i = opened; i < amount; i++)
            {
                if (item.Amount <= 0)
                {
                    break;
                }

                if (!ItemBoxHelper.GiveItemFromSelectBox(session, item, index, out result))
                {
                    break;
                }

                opened++;
            }
        }

        session.Send(ItemUsePacket.Use(items.First().Id, opened, result));
    }
示例#3
0
        private static void HandleSelectBox(GameSession session, Dictionary <long, Item> items, SelectItemBox box, int index, int amount)
        {
            ItemDropMetadata metadata = ItemDropMetadataStorage.GetItemDropMetadata(box.BoxId);
            int opened = 0;

            foreach (KeyValuePair <long, Item> kvp in items)
            {
                Item item = kvp.Value;

                for (int i = opened; i < amount; i++)
                {
                    if (item.Amount <= 0)
                    {
                        break;
                    }

                    opened++;
                    ItemBoxHelper.GiveItemFromSelectBox(session, item, index);
                }
            }

            session.Send(ItemUsePacket.Use(items.FirstOrDefault().Value.Id, amount));
        }