public async Task RequestDropAsync([Summary(DropItemSummary)][Remainder] string request) { var cfg = Globals.Bot.Config; var items = ItemParser.GetItemsFromUserInput(request, cfg.DropConfig, cfg.DropConfig.UseLegacyDrop ? ItemDestination.PlayerDropped : ItemDestination.HeldItem); MultiItem.StackToMax(items); await DropItems(items).ConfigureAwait(false); }
public OrderRequest(MultiItem data, T[] order, ulong user, SocketUser trader, ISocketMessageChannel commandSentChannel) { ItemOrderData = data; UserGuid = user; Trader = trader; CommandSentChannel = commandSentChannel; Order = order; VillagerName = trader.Username; }
public async Task RequestDropAsync([Summary(DropItemSummary)][Remainder] string request) { if (Globals.Bot.CurrentUserId != Context.User.Id) { return; } var cfg = Globals.Bot.Config; var items = DropUtil.GetItemsFromUserInput(request, cfg.DropConfig, false); MultiItem.StackToMax(items); await DropItems(items).ConfigureAwait(false); }
private async Task AttemptToQueueRequest(IReadOnlyCollection <Item> items, SocketUser orderer, ISocketMessageChannel msgChannel, bool catalogue = false) { var currentOrderCount = Globals.Bot.Orders.Count; if (currentOrderCount >= MaxOrderCount) { var requestLimit = $"The queue limit has been reached, there are currently {currentOrderCount} players in the queue. Please try again later."; await ReplyAsync(requestLimit).ConfigureAwait(false); return; } if (items.Count > MultiItem.MaxOrder) { var clamped = $"Users are limited to {MultiItem.MaxOrder} items per command, You've asked for {items.Count}. All items above the limit have been removed."; await ReplyAsync(clamped).ConfigureAwait(false); items = items.Take(40).ToArray(); } var multiOrder = new MultiItem(items.ToArray(), catalogue, true, true); var requestInfo = new OrderRequest <Item>(multiOrder, multiOrder.ItemArray.Items.ToArray(), orderer.Id, InsertionID++, orderer, msgChannel); await Context.AddToQueueAsync(requestInfo, orderer.Username, orderer); }
public async Task Write40(Item items, CancellationToken token) { var itemSet = MultiItem.DeepDuplicateItem(items, 40); await Write(itemSet, token).ConfigureAwait(false); }