Beispiel #1
0
            public async Task GetMounts(CommandContext ctx, string server, string name)
            {
                var client = await ConstructBlizzardCharClient(server, name, new Parameter("fields", "mounts", ParameterType.QueryString));

                var response = await client.ExecuteTaskAsync(new RestRequest());

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    CharInfoWithMountResponse resp = JsonConvert.DeserializeObject <CharInfoWithMountResponse>(response.Content);

                    int numberOfMounts = resp.mounts.numCollected;

                    await ctx.RespondAsync("Ejha! " + resp.name + " " + numberOfMounts + " mounttal rendelkezik!");

                    return;
                }
                await ctx.RespondAsync("Nocsak! Ilyen karaktert nem találni!");
            }
Beispiel #2
0
        public async Task <int> GetMounts(string realm, string charname)
        {
            var client = await ConstructBlizzardCharClient(realm, charname, new Parameter("fields", "mounts", ParameterType.QueryString));

            var response = await client.ExecuteTaskAsync(new RestRequest());

            if (response.StatusCode == HttpStatusCode.OK)
            {
                CharInfoWithMountResponse resp = JsonConvert.DeserializeObject <CharInfoWithMountResponse>(response.Content);

                int numberOfMounts = resp.mounts.numCollected;

                return(numberOfMounts);
            }
            else
            {
                throw new Exception("HttpStatusCode is not OK.");
            }
        }