Guest User

Untitled

a guest
Dec 27th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace LegendaryFarming
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. Dictionary<string, int> items = new Dictionary<string, int>()
  12. {
  13. { "shards", 0 },
  14. { "fragments", 0 },
  15. { "motes", 0}
  16. };
  17.  
  18. while (true)
  19. {
  20. string[] tokens = Console.ReadLine().Split(" ").Select(x => x.ToLower()).ToArray();
  21. for (int i = 0; i < tokens.Length; i += 2)
  22. {
  23. if (items.ContainsKey(tokens[i + 1]))
  24. {
  25. items[tokens[i + 1]] += int.Parse(tokens[i]);
  26. }
  27. else
  28. {
  29. items.Add(tokens[i + 1], int.Parse(tokens[i]));
  30. }
  31.  
  32. if (items.Where(x => x.Key == "shards" || x.Key == "fragments" || x.Key == "motes").Any(x => x.Value >= 250))
  33. {
  34. if (items.Where(x => x.Key == "shards").FirstOrDefault().Value >= 250)
  35. {
  36. Console.WriteLine("Shadowmourne obtained!");
  37. }
  38. else if (items.Where(x => x.Key == "fragments").FirstOrDefault().Value >= 250)
  39. {
  40. Console.WriteLine("Valanyr obtained!");
  41. }
  42. else if (items.Where(x => x.Key == "motes").FirstOrDefault().Value >= 250)
  43. {
  44. Console.WriteLine("Dragonwrath obtained!");
  45. }
  46.  
  47. var temp = items.Where(x => x.Key == "shards" || x.Key == "fragments" || x.Key == "motes").OrderByDescending(x => x.Value % 250).ThenBy(x => x.Key).ToDictionary(x => x.Key, y => y.Value);
  48.  
  49. foreach (var item in temp)
  50. {
  51. Console.WriteLine($"{item.Key}: {item.Value % 250}");
  52. }
  53.  
  54. var temp2 = items.Where(x => x.Key != "shards" && x.Key != "fragments" && x.Key != "motes").OrderBy(x => x.Key).ToDictionary(x => x.Key, y => y.Value);
  55.  
  56. foreach (var item in temp2)
  57. {
  58. Console.WriteLine($"{item.Key}: {item.Value}");
  59. }
  60.  
  61. return;
  62. }
  63. }
  64. }
  65. }
  66. }
  67. }
Add Comment
Please, Sign In to add comment