Exemplo n.º 1
0
        public static async Task <IReadOnlyList <Ability> > GetAbilitiesAsync(GameServiceClient client, IReadOnlyList <Ability> abilities)
        {
            if (abilities == null)
            {
                var request = new GetAbilitiesRequest();
                request.AbilityFields.AddRange(new[] { AbilityField.Id, AbilityField.Name });
                abilities = (await client.GetAbilitiesAsync(request)).Abilities.ToList();
            }

            return(abilities);
        }
Exemplo n.º 2
0
        public static async Task DisplayAbilitiesAsync(GameServiceClient client, IReadOnlyList <int> ids, string name)
        {
            var abilitiesRequest = new GetAbilitiesRequest();

            if (ids != null && ids.Count() != 0)
            {
                abilitiesRequest.AbilityIds.AddRange(ids);
            }
            else if (name != null)
            {
                abilitiesRequest.Name = name;
            }

            abilitiesRequest.AbilityFields.AddRange(new[] { AbilityField.Id, AbilityField.Name, AbilityField.Description, AbilityField.GamePackageName });

            var abilities = await client.GetAbilitiesAsync(abilitiesRequest);

            foreach (var ability in abilities.Abilities)
            {
                ConsoleUtility.WriteLine($"{ability.GamePackage.Name} - {ability.Name} - {ability.Description}");
            }
        }
Exemplo n.º 3
0
        public static async Task DisplayAllAbilitiesAsync(GameServiceClient client)
        {
            var request = new GetGamePackagesRequest();

            request.Fields.AddRange(new[] { GamePackageField.Id, GamePackageField.Name, GamePackageField.PackageType, GamePackageField.BaseMap });
            var reply = await client.GetGamePackagesAsync(request);

            foreach (var gameData in reply.Packages.OrderBy(x => x.BaseMap).ThenBy(x => x.PackageType).ThenBy(x => x.Name))
            {
                var abilitiesRequest = new GetAbilitiesRequest
                {
                    GamePackageId = gameData.Id
                };

                abilitiesRequest.AbilityFields.AddRange(new[] { AbilityField.Id, AbilityField.Name, AbilityField.GamePackageName });

                var abilities = await client.GetAbilitiesAsync(abilitiesRequest);

                foreach (var ability in abilities.Abilities)
                {
                    ConsoleUtility.WriteLine($"{ability.GamePackage.Name} - {ability.Name}");
                }
            }
        }