deleriumbg

Legendary Farming 2

Mar 21st, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.01 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace Legendary_Farming
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             Dictionary<string, int> keyMaterials = new Dictionary<string, int>();
  12.             Dictionary<string, int> junk = new Dictionary<string, int>();
  13.             keyMaterials.Add("shards", 0);
  14.             keyMaterials.Add("fragments", 0);
  15.             keyMaterials.Add("motes", 0);
  16.             bool shadowmourneObtained = false;
  17.             bool valanyrObtained = false;
  18.             bool dragonwrathObtained = false;
  19.             string legendary = "";
  20.  
  21.             while (shadowmourneObtained == false && valanyrObtained == false && dragonwrathObtained == false)
  22.             {
  23.                 List<string> input = Console.ReadLine().ToLower().Split(' ').ToList();
  24.                 string material = "";
  25.                 int quantity = 0;
  26.                 for (int i = 0; i < input.Count; i += 2)
  27.                 {
  28.                     quantity = int.Parse(input[i]);
  29.                     material = input[i + 1];
  30.  
  31.  
  32.                     if (material == "shards" || material == "fragments" || material == "motes")
  33.                     {
  34.                         keyMaterials[material] += quantity;
  35.                     }
  36.                     else
  37.                     {
  38.                         if (junk.ContainsKey(material) == false)
  39.                         {
  40.                             junk.Add(material, quantity);
  41.                         }
  42.                         else
  43.                         {
  44.                             junk[material] += quantity;
  45.                         }
  46.                     }
  47.  
  48.                     if (keyMaterials["shards"] >= 250)
  49.                     {
  50.                         shadowmourneObtained = true;
  51.                         legendary = "Shadowmourne";
  52.                         keyMaterials["shards"] -= 250;
  53.                         break;
  54.                     }
  55.                     else if (keyMaterials["fragments"] >= 250)
  56.                     {
  57.                         valanyrObtained = true;
  58.                         legendary = "Valanyr";
  59.                         keyMaterials["fragments"] -= 250;
  60.                         break;
  61.                     }
  62.                     else if (keyMaterials["motes"] >= 250)
  63.                     {
  64.                         dragonwrathObtained = true;
  65.                         legendary = "Dragonwrath";
  66.                         keyMaterials["motes"] -= 250;
  67.                         break;
  68.                     }
  69.                 }
  70.             }
  71.            
  72.             Console.WriteLine($"{legendary} obtained!");
  73.             foreach (var item in keyMaterials.OrderBy(x => x.Key).OrderByDescending(x => x.Value))
  74.             {
  75.                 Console.WriteLine($"{item.Key}: {item.Value}");
  76.             }
  77.             foreach (var item in junk.OrderBy(x => x.Key))
  78.             {
  79.                 Console.WriteLine($"{item.Key}: {item.Value}");
  80.             }
  81.         }
  82.     }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment