コード例 #1
0
ファイル: ItemWorker.cs プロジェクト: Roytazz/GW2-Projects
        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);
        }
コード例 #2
0
        private async Task SetGuildBank(string apiKey)
        {
            GuildBank = new List <ExtendedItemStack>();
            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.Count > 0 && members.Count <= 5)
                {
                    var stash = await GuildAPI.Stash(guild, apiKey);

                    stash.ForEach(x => {
                        Wallet.Find(y => y.ID == 1).Value += x.Coins;
                        x.Inventory.ForEach(z => {
                            if (z != null)
                            {
                                GuildBank.Add(new ExtendedItemStack {
                                    ID = z.ID, Count = z.Count
                                });
                            }
                        });
                    });
                }
            }
        }