Example #1
0
        public void SellAndDropItem()
        {
            if (!IsAutoSell && !IsAutoDrop)
            {
                return;
            }
            if (IsAutoSellingOrDropping)
            {
                return;
            }

            IsAutoSellingOrDropping = true;
            var bagItems = BagItems;
            var flag     = false;

            for (byte pos = 1; pos <= 50; pos++)
            {
                if (bagItems[pos].Id <= 0)
                {
                    continue;
                }

                if (IsAutoSell && AutoSellItemList.Contains(bagItems[pos].Id))
                {
                    if (IsSellWhenFull)
                    {
                        flag = (bagItems[pos].Qty == 50 || !DataManagers.ItemManager.IsOverlap(bagItems[pos].Id));
                    }
                    else
                    {
                        flag = true;
                    }

                    if (flag)
                    {
                        _socket.SendPacket(new PacketBuilder(0x1B, 0x03).Add(pos).Build());
                        break;
                    }
                }
                else if (IsAutoDrop && AutoDropItemList.Contains(bagItems[pos].Id))
                {
                    flag = true;
                    _socket.SendPacket(new PacketBuilder(0x17, 0x03).Add(pos).Add(bagItems[pos].Qty).Add((byte)1).Build());
                    _socket.SendPacket(new PacketBuilder(0x17, 0x7C).Add(pos).Add(bagItems[pos].Qty).Add((byte)2).Build());
                    break;
                }
            }

            if (flag)
            {
                var _ = new Timer(CheckSellOrDropAnswer, null, 2000, Timeout.Infinite);
            }
            else
            {
                IsAutoSellingOrDropping = false;
            }
        }
Example #2
0
        public void AddAutoDropItemIdx(int idx)
        {
            if (idx <= 0 || idx >= BagItems.Length || BagItems[idx].Id == 0)
            {
                return;
            }
            if (AutoDropItemList.Contains(BagItems[idx].Id))
            {
                return;
            }
            AutoDropItemList.Add(BagItems[idx].Id);

            AutoDropItemUpdated?.Invoke();
        }