/*******************************
        * GetSinglePokemon()
        *******************************/
        public static void GetSinglePokemon(HttpClient client)
        {
            Console.WriteLine("Which Pokemon would you like to see Details for?");
            string pId = Console.ReadLine();

            var     response    = client.GetAsync($"pokemon/{pId}").Result;
            Pokemon pokemonInst = response.Content.ReadAsAsync <Pokemon>().Result;

            Console.WriteLine(
                "\n NAME: " + pokemonInst.name
                + "\n BASE EXP: " + pokemonInst.base_experience
                + "\n HEIGHT: " + pokemonInst.height
                + "\n WEIGHT: " + pokemonInst.weight
                + "\n ORDER: " + pokemonInst.order
                + "\n DEFAULT: " + pokemonInst.is_default
                + "\n MOVES: "
                );

            foreach (var move in pokemonInst.moves)
            {
                Console.WriteLine($"\t {move.move.name}");
            }

            Console.ReadLine();

            Extras.Menu();
        }
Beispiel #2
0
        /*******************************
        * GetAllItems()
        *******************************/
        public static void GetAllItems(HttpClient client)
        {
            var            allItemsResp = client.GetAsync("item").Result;
            ItemCollection allItems     = allItemsResp.Content.ReadAsAsync <ItemCollection>().Result;
            bool           keepShopping = true;

            while (keepShopping)
            {
                Console.Clear();

                foreach (var item in allItems.results)
                {
                    Console.WriteLine(item.name.ToUpper());
                }

                var pageMovement = Extras.WriteRead(
                    "\n (N)ext page |"
                    + "(P)revious page |"
                    + "(G)et Details |"
                    + "(E)xit: ").ToUpper();

                switch (pageMovement)
                {
                case "N":
                    allItems = allItems.GetNext(client);
                    break;

                case "P":
                    allItems = allItems.GetPrevious(client);
                    break;

                case "G":
                    GetSingleItem(client);
                    keepShopping = false;
                    break;

                default:
                    Extras.Menu();
                    keepShopping = false;
                    break;
                }
            }
        }
        /*******************************
        * CatchEmAll()
        *******************************/
        public static void CatchEmAll(HttpClient client)
        {
            HttpResponseMessage allPokemonResp = client.GetAsync("pokemon").Result;
            PokemonCollection   catchEmAll     = allPokemonResp.Content.ReadAsAsync <PokemonCollection>().Result;
            bool keepCatching = true;

            while (keepCatching)
            {
                Console.Clear();

                foreach (var pokemon in catchEmAll.Results)
                {
                    Console.WriteLine(pokemon.name.ToUpper());
                }

                var pageMovement = Extras.WriteRead(
                    "\n (N)ext page |"
                    + "(P)revious page |"
                    + "(G)et Details |"
                    + "(E)xit: ").ToUpper();

                switch (pageMovement)
                {
                case "N":
                    catchEmAll = catchEmAll.GetNext(client);
                    break;

                case "P":
                    catchEmAll = catchEmAll.GetPrevious(client);
                    break;

                case "G":
                    GetSinglePokemon(client);
                    keepCatching = false;
                    break;

                default:
                    Extras.Menu();
                    keepCatching = false;
                    break;
                }
            }
        }
Beispiel #4
0
        /*******************************
        * GetSingleItem()
        *******************************/
        public static void GetSingleItem(HttpClient client)
        {
            Console.WriteLine("Which Item would you like to see Details for?");
            string iId = Console.ReadLine();

            var  response = client.GetAsync($"item/{iId}").Result;
            Item itemInst = response.Content.ReadAsAsync <Item>().Result;

            Console.WriteLine(
                "\n NAME: " + itemInst.name
                + "\n COST: " + itemInst.cost
                + "\n ATTRIBUTES: "
                );

            foreach (var attr in itemInst.attributes)
            {
                Console.WriteLine($"\t {attr.name}");
            }

            Console.ReadLine();

            Extras.Menu();
        }