private async Task <List <ItemStack> > GetGuildInventory(Account account, string apiKey) { List <ItemStack> result = new List <ItemStack>(); foreach (var guild in account.Guilds) { var members = await GuildAPI.Members(guild, apiKey); //Check if you are the leader and Member count. This determines if its a personal Bank Guild if (members != null && members.Count <= MIN_AMOUNT_MEMBER_FOR_GUILD_BANK) { var stashes = await GuildAPI.Stash(guild, apiKey); foreach (var stash in stashes) { if (Wallet != null || Wallet.Any(x => x.ID == 1)) { Wallet.FirstOrDefault(y => y.ID == 1).Value += stash.Coins; //Add Gold from the Stash to the total Gold in the wallet } foreach (var inventorySlot in stash.Inventory) { if (inventorySlot != null) { result.Add(inventorySlot); } } } } } return(result); }
public void Refund_WhenBuyerWantsRefundDepositedAmount_ThenVendingMachineShouldRefundWithLessCoins( Wallet machineWallet, Wallet buyerWallet, IReadOnlyCollection<Coin> depositedAmount, Wallet expectedMachineWallet, Wallet expectedBuyerWallet) { var vendingMachine = CreateMachine(machineWallet, buyerWallet); var @event = vendingMachine.Refund(depositedAmount); var refundedMachineWallet = @event.VendingMachineWallet; var refundedBuyerWallet = @event.BuyerWallet; if (!expectedMachineWallet.Any()) { Assert.True(!refundedMachineWallet.Any()); } else { var expectedBuyerWalletMatch = !expectedBuyerWallet .Except(refundedBuyerWallet) .Any(); Assert.True(expectedBuyerWalletMatch); } var expectedMachineWalletMatch = !expectedMachineWallet .Except(refundedMachineWallet) .Any(); Assert.True(expectedMachineWalletMatch); }
public void Refund_WhenBuyerWantsRefundDepositedAmount_ThenVendingMachineShouldRefundWithLessCoins( Wallet machineWallet, Wallet buyerWallet, IReadOnlyCollection <Coin> depositedAmount, Wallet expectedMachineWallet, Wallet expectedBuyerWallet) { var vendingMachine = CreateMachine(machineWallet, buyerWallet); var @event = vendingMachine.Refund(depositedAmount); var refundedMachineWallet = @event.VendingMachineWallet; var refundedBuyerWallet = @event.BuyerWallet; if (!expectedMachineWallet.Any()) { Assert.True(!refundedMachineWallet.Any()); } else { var expectedBuyerWalletMatch = !expectedBuyerWallet .Except(refundedBuyerWallet) .Any(); Assert.True(expectedBuyerWalletMatch); } var expectedMachineWalletMatch = !expectedMachineWallet .Except(refundedMachineWallet) .Any(); Assert.True(expectedMachineWalletMatch); }
private List <ItemStack> GetDeliveryBox(DeliveryBox deliveryBox) { if (Wallet == null || !Wallet.Any(x => x.ID == 1)) { return(new List <ItemStack>()); } Wallet.FirstOrDefault(y => y.ID == 1).Value += deliveryBox.Coins; //Add Gold from the Stash to the total Gold in the wallet return(deliveryBox.Items); }